Skip to content

Commit a090994

Browse files
yegorichdavem330
authored andcommitted
cpsw: ethtool: add support for getting/setting EEE registers
Add the ability to query and set Energy Efficient Ethernet parameters via ethtool for applicable devices. This patch doesn't activate full EEE support in cpsw driver, but it enables reading and writing EEE advertising settings. This way one can disable advertising EEE for certain speeds. Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com> Acked-by: Rami Rosen <roszenrami@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 93ba222 commit a090994

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

drivers/net/ethernet/ti/cpsw.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2237,6 +2237,30 @@ static int cpsw_set_channels(struct net_device *ndev,
22372237
return ret;
22382238
}
22392239

2240+
static int cpsw_get_eee(struct net_device *ndev, struct ethtool_eee *edata)
2241+
{
2242+
struct cpsw_priv *priv = netdev_priv(ndev);
2243+
struct cpsw_common *cpsw = priv->cpsw;
2244+
int slave_no = cpsw_slave_index(cpsw, priv);
2245+
2246+
if (cpsw->slaves[slave_no].phy)
2247+
return phy_ethtool_get_eee(cpsw->slaves[slave_no].phy, edata);
2248+
else
2249+
return -EOPNOTSUPP;
2250+
}
2251+
2252+
static int cpsw_set_eee(struct net_device *ndev, struct ethtool_eee *edata)
2253+
{
2254+
struct cpsw_priv *priv = netdev_priv(ndev);
2255+
struct cpsw_common *cpsw = priv->cpsw;
2256+
int slave_no = cpsw_slave_index(cpsw, priv);
2257+
2258+
if (cpsw->slaves[slave_no].phy)
2259+
return phy_ethtool_set_eee(cpsw->slaves[slave_no].phy, edata);
2260+
else
2261+
return -EOPNOTSUPP;
2262+
}
2263+
22402264
static const struct ethtool_ops cpsw_ethtool_ops = {
22412265
.get_drvinfo = cpsw_get_drvinfo,
22422266
.get_msglevel = cpsw_get_msglevel,
@@ -2260,6 +2284,8 @@ static const struct ethtool_ops cpsw_ethtool_ops = {
22602284
.set_channels = cpsw_set_channels,
22612285
.get_link_ksettings = cpsw_get_link_ksettings,
22622286
.set_link_ksettings = cpsw_set_link_ksettings,
2287+
.get_eee = cpsw_get_eee,
2288+
.set_eee = cpsw_set_eee,
22632289
};
22642290

22652291
static void cpsw_slave_init(struct cpsw_slave *slave, struct cpsw_common *cpsw,

0 commit comments

Comments
 (0)