Skip to content

Commit b8927bd

Browse files
Russell King (Oracle)kuba-moo
authored andcommitted
net: dsa: allow use of phylink managed EEE support
In order to allow DSA drivers to use phylink managed EEE, we need to change the behaviour of the DSA's .set_eee() ethtool method. Implementation of the DSA .set_mac_eee() method becomes optional with phylink managed EEE as it is only used to validate the EEE parameters supplied from userspace. The rest of the EEE state management should be left to phylink. Signed-off-by: Russell King (Oracle) <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 2001d21 commit b8927bd

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

net/dsa/user.c

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,16 +1243,25 @@ static int dsa_user_set_eee(struct net_device *dev, struct ethtool_keee *e)
12431243
if (!ds->ops->support_eee || !ds->ops->support_eee(ds, dp->index))
12441244
return -EOPNOTSUPP;
12451245

1246-
/* Port's PHY and MAC both need to be EEE capable */
1247-
if (!dev->phydev)
1248-
return -ENODEV;
1246+
/* If the port is using phylink managed EEE, then an unimplemented
1247+
* set_mac_eee() is permissible.
1248+
*/
1249+
if (!phylink_mac_implements_lpi(ds->phylink_mac_ops)) {
1250+
/* Port's PHY and MAC both need to be EEE capable */
1251+
if (!dev->phydev)
1252+
return -ENODEV;
12491253

1250-
if (!ds->ops->set_mac_eee)
1251-
return -EOPNOTSUPP;
1254+
if (!ds->ops->set_mac_eee)
1255+
return -EOPNOTSUPP;
12521256

1253-
ret = ds->ops->set_mac_eee(ds, dp->index, e);
1254-
if (ret)
1255-
return ret;
1257+
ret = ds->ops->set_mac_eee(ds, dp->index, e);
1258+
if (ret)
1259+
return ret;
1260+
} else if (ds->ops->set_mac_eee) {
1261+
ret = ds->ops->set_mac_eee(ds, dp->index, e);
1262+
if (ret)
1263+
return ret;
1264+
}
12561265

12571266
return phylink_ethtool_set_eee(dp->pl, e);
12581267
}

0 commit comments

Comments
 (0)