[openwrt/openwrt] generic: 6.12: backport dsa support_eee patches
LEDE Commits
lede-commits at lists.infradead.org
Wed May 28 22:50:43 PDT 2025
noltari pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/0cec046987e9ef106822672b923041f2a3bd362d
commit 0cec046987e9ef106822672b923041f2a3bd362d
Author: Álvaro Fernández Rojas <noltari at gmail.com>
AuthorDate: Wed May 28 21:43:51 2025 +0200
generic: 6.12: backport dsa support_eee patches
These patches are needed for b53 implementation of b53_support_eee, which
prevent system hangs on bmips devices.
99379f587278c net: dsa: provide implementation of .support_eee()
9723a77318b7c net: dsa: add hook to determine whether EEE is supported
Signed-off-by: Álvaro Fernández Rojas <noltari at gmail.com>
---
...-hook-to-determine-whether-EEE-is-support.patch | 54 ++++++++++++++++++++++
...sa-provide-implementation-of-.support_eee.patch | 53 +++++++++++++++++++++
2 files changed, 107 insertions(+)
diff --git a/target/linux/generic/backport-6.12/700-01-v6.14-net-dsa-add-hook-to-determine-whether-EEE-is-support.patch b/target/linux/generic/backport-6.12/700-01-v6.14-net-dsa-add-hook-to-determine-whether-EEE-is-support.patch
new file mode 100644
index 0000000000..446f918fa0
--- /dev/null
+++ b/target/linux/generic/backport-6.12/700-01-v6.14-net-dsa-add-hook-to-determine-whether-EEE-is-support.patch
@@ -0,0 +1,54 @@
+From 9723a77318b7c0cfd06ea207e52a042f8c815318 Mon Sep 17 00:00:00 2001
+From: "Russell King (Oracle)" <rmk+kernel at armlinux.org.uk>
+Date: Tue, 10 Dec 2024 14:18:16 +0000
+Subject: [PATCH] net: dsa: add hook to determine whether EEE is supported
+
+Add a hook to determine whether the switch supports EEE. This will
+return false if the switch does not, or true if it does. If the
+method is not implemented, we assume (currently) that the switch
+supports EEE.
+
+Signed-off-by: Russell King (Oracle) <rmk+kernel at armlinux.org.uk>
+Reviewed-by: Florian Fainelli <florian.fainelli at broadcom.com>
+Reviewed-by: Vladimir Oltean <olteanv at gmail.com>
+Link: https://patch.msgid.link/E1tL144-006cZD-El@rmk-PC.armlinux.org.uk
+Signed-off-by: Jakub Kicinski <kuba at kernel.org>
+---
+ include/net/dsa.h | 1 +
+ net/dsa/user.c | 8 ++++++++
+ 2 files changed, 9 insertions(+)
+
+--- a/include/net/dsa.h
++++ b/include/net/dsa.h
+@@ -1003,6 +1003,7 @@ struct dsa_switch_ops {
+ /*
+ * Port's MAC EEE settings
+ */
++ bool (*support_eee)(struct dsa_switch *ds, int port);
+ int (*set_mac_eee)(struct dsa_switch *ds, int port,
+ struct ethtool_keee *e);
+ int (*get_mac_eee)(struct dsa_switch *ds, int port,
+--- a/net/dsa/user.c
++++ b/net/dsa/user.c
+@@ -1231,6 +1231,10 @@ static int dsa_user_set_eee(struct net_d
+ struct dsa_switch *ds = dp->ds;
+ int ret;
+
++ /* Check whether the switch supports EEE */
++ if (ds->ops->support_eee && !ds->ops->support_eee(ds, dp->index))
++ return -EOPNOTSUPP;
++
+ /* Port's PHY and MAC both need to be EEE capable */
+ if (!dev->phydev || !dp->pl)
+ return -ENODEV;
+@@ -1251,6 +1255,10 @@ static int dsa_user_get_eee(struct net_d
+ struct dsa_switch *ds = dp->ds;
+ int ret;
+
++ /* Check whether the switch supports EEE */
++ if (ds->ops->support_eee && !ds->ops->support_eee(ds, dp->index))
++ return -EOPNOTSUPP;
++
+ /* Port's PHY and MAC both need to be EEE capable */
+ if (!dev->phydev || !dp->pl)
+ return -ENODEV;
diff --git a/target/linux/generic/backport-6.12/700-02-v6.14-net-dsa-provide-implementation-of-.support_eee.patch b/target/linux/generic/backport-6.12/700-02-v6.14-net-dsa-provide-implementation-of-.support_eee.patch
new file mode 100644
index 0000000000..d7342daa0b
--- /dev/null
+++ b/target/linux/generic/backport-6.12/700-02-v6.14-net-dsa-provide-implementation-of-.support_eee.patch
@@ -0,0 +1,53 @@
+From 99379f587278c818777cb4778e2c79c6c1440c65 Mon Sep 17 00:00:00 2001
+From: "Russell King (Oracle)" <rmk+kernel at armlinux.org.uk>
+Date: Tue, 10 Dec 2024 14:18:21 +0000
+Subject: [PATCH] net: dsa: provide implementation of .support_eee()
+
+Provide a trivial implementation for the .support_eee() method which
+switch drivers can use to simply indicate that they support EEE on
+all their user ports.
+
+Signed-off-by: Russell King (Oracle) <rmk+kernel at armlinux.org.uk>
+Reviewed-by: Florian Fainelli <florian.fainelli at broadcom.com>
+Reviewed-by: Vladimir Oltean <olteanv at gmail.com>
+Link: https://patch.msgid.link/E1tL149-006cZJ-JJ@rmk-PC.armlinux.org.uk
+Signed-off-by: Jakub Kicinski <kuba at kernel.org>
+---
+ include/net/dsa.h | 1 +
+ net/dsa/port.c | 16 ++++++++++++++++
+ 2 files changed, 17 insertions(+)
+
+--- a/include/net/dsa.h
++++ b/include/net/dsa.h
+@@ -1399,5 +1399,6 @@ static inline bool dsa_user_dev_check(co
+
+ netdev_tx_t dsa_enqueue_skb(struct sk_buff *skb, struct net_device *dev);
+ void dsa_port_phylink_mac_change(struct dsa_switch *ds, int port, bool up);
++bool dsa_supports_eee(struct dsa_switch *ds, int port);
+
+ #endif
+--- a/net/dsa/port.c
++++ b/net/dsa/port.c
+@@ -1589,6 +1589,22 @@ dsa_port_phylink_mac_select_pcs(struct p
+ return pcs;
+ }
+
++/* dsa_supports_eee - indicate that EEE is supported
++ * @ds: pointer to &struct dsa_switch
++ * @port: port index
++ *
++ * A default implementation for the .support_eee() DSA operations member,
++ * which drivers can use to indicate that they support EEE on all of their
++ * user ports.
++ *
++ * Returns: true
++ */
++bool dsa_supports_eee(struct dsa_switch *ds, int port)
++{
++ return true;
++}
++EXPORT_SYMBOL_GPL(dsa_supports_eee);
++
+ static void dsa_port_phylink_mac_config(struct phylink_config *config,
+ unsigned int mode,
+ const struct phylink_link_state *state)
More information about the lede-commits
mailing list