diff options
| author | Russell King (Oracle) <rmk+kernel@armlinux.org.uk> | 2024-12-10 14:18:16 +0000 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-09-09 18:58:19 +0200 |
| commit | f7976772b16a7da725f9156c5ab6472ba22e3bc0 (patch) | |
| tree | 23bc7661e78cddd29af61b1abfe79e2a6ec0dec7 /net | |
| parent | 6482c3dccbfb8d20e2856ce67c75856859930b3f (diff) | |
| download | linux-f7976772b16a7da725f9156c5ab6472ba22e3bc0.tar.gz linux-f7976772b16a7da725f9156c5ab6472ba22e3bc0.tar.bz2 linux-f7976772b16a7da725f9156c5ab6472ba22e3bc0.zip | |
net: dsa: add hook to determine whether EEE is supported
commit 9723a77318b7c0cfd06ea207e52a042f8c815318 upstream.
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@armlinux.org.uk>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
Link: https://patch.msgid.link/E1tL144-006cZD-El@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
| -rw-r--r-- | net/dsa/user.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/net/dsa/user.c b/net/dsa/user.c index 64f660d2334b..06267c526dc4 100644 --- a/net/dsa/user.c +++ b/net/dsa/user.c @@ -1231,6 +1231,10 @@ static int dsa_user_set_eee(struct net_device *dev, struct ethtool_keee *e) 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_device *dev, struct ethtool_keee *e) 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; |
