Skip to content

Commit 6bb10c2

Browse files
yegorichdavem330
authored andcommitted
cpsw: ethtool: add support for nway reset
This patch adds support for ethtool's '-r' command. Restarting N-WAY negotiation can be useful to activate newly changed EEE settings etc. Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 6d5274e commit 6bb10c2

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

drivers/net/ethernet/ti/cpsw.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2261,6 +2261,18 @@ static int cpsw_set_eee(struct net_device *ndev, struct ethtool_eee *edata)
22612261
return -EOPNOTSUPP;
22622262
}
22632263

2264+
static int cpsw_nway_reset(struct net_device *ndev)
2265+
{
2266+
struct cpsw_priv *priv = netdev_priv(ndev);
2267+
struct cpsw_common *cpsw = priv->cpsw;
2268+
int slave_no = cpsw_slave_index(cpsw, priv);
2269+
2270+
if (cpsw->slaves[slave_no].phy)
2271+
return genphy_restart_aneg(cpsw->slaves[slave_no].phy);
2272+
else
2273+
return -EOPNOTSUPP;
2274+
}
2275+
22642276
static const struct ethtool_ops cpsw_ethtool_ops = {
22652277
.get_drvinfo = cpsw_get_drvinfo,
22662278
.get_msglevel = cpsw_get_msglevel,
@@ -2286,6 +2298,7 @@ static const struct ethtool_ops cpsw_ethtool_ops = {
22862298
.set_link_ksettings = cpsw_set_link_ksettings,
22872299
.get_eee = cpsw_get_eee,
22882300
.set_eee = cpsw_set_eee,
2301+
.nway_reset = cpsw_nway_reset,
22892302
};
22902303

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

0 commit comments

Comments
 (0)