mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-10-23 07:23:12 +02:00
net: dsa: add hook to determine whether EEE is supported
commit 9723a77318
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>
This commit is contained in:
parent
6482c3dccb
commit
f7976772b1
|
@ -1003,6 +1003,7 @@ struct dsa_switch_ops {
|
||||||
/*
|
/*
|
||||||
* Port's MAC EEE settings
|
* Port's MAC EEE settings
|
||||||
*/
|
*/
|
||||||
|
bool (*support_eee)(struct dsa_switch *ds, int port);
|
||||||
int (*set_mac_eee)(struct dsa_switch *ds, int port,
|
int (*set_mac_eee)(struct dsa_switch *ds, int port,
|
||||||
struct ethtool_keee *e);
|
struct ethtool_keee *e);
|
||||||
int (*get_mac_eee)(struct dsa_switch *ds, int port,
|
int (*get_mac_eee)(struct dsa_switch *ds, int port,
|
||||||
|
|
|
@ -1231,6 +1231,10 @@ static int dsa_user_set_eee(struct net_device *dev, struct ethtool_keee *e)
|
||||||
struct dsa_switch *ds = dp->ds;
|
struct dsa_switch *ds = dp->ds;
|
||||||
int ret;
|
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 */
|
/* Port's PHY and MAC both need to be EEE capable */
|
||||||
if (!dev->phydev || !dp->pl)
|
if (!dev->phydev || !dp->pl)
|
||||||
return -ENODEV;
|
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;
|
struct dsa_switch *ds = dp->ds;
|
||||||
int ret;
|
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 */
|
/* Port's PHY and MAC both need to be EEE capable */
|
||||||
if (!dev->phydev || !dp->pl)
|
if (!dev->phydev || !dp->pl)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user