aboutsummaryrefslogtreecommitdiffstats
path: root/net/dsa
diff options
context:
space:
mode:
authorFlorian Fainelli <f.fainelli@gmail.com>2014-09-24 20:05:21 -0400
committerDavid S. Miller <davem@davemloft.net>2014-09-28 17:14:09 -0400
commit7905288f093ad924004609bb89a7ce1597892726 (patch)
treeda6ce32338f5e7c2e617864552e91691dc44aed3 /net/dsa
parentb6d045db59210476323caef042c5b50884e4675f (diff)
net: dsa: allow switches driver to implement get/set EEE
Allow switches driver to query and enable/disable EEE on a per-port basis by implementing the ethtool_{get,set}_eee settings and delegating these operations to the switch driver. set_eee() will need to coordinate with the PHY driver to make sure that EEE is enabled, the link-partner supports it and the auto-negotiation result is satisfactory. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dsa')
-rw-r--r--net/dsa/slave.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 182d30ae6818..36953c84ff2d 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -342,6 +342,44 @@ static int dsa_slave_set_wol(struct net_device *dev, struct ethtool_wolinfo *w)
342 return ret; 342 return ret;
343} 343}
344 344
345static int dsa_slave_set_eee(struct net_device *dev, struct ethtool_eee *e)
346{
347 struct dsa_slave_priv *p = netdev_priv(dev);
348 struct dsa_switch *ds = p->parent;
349 int ret;
350
351 if (!ds->drv->set_eee)
352 return -EOPNOTSUPP;
353
354 ret = ds->drv->set_eee(ds, p->port, p->phy, e);
355 if (ret)
356 return ret;
357
358 if (p->phy)
359 ret = phy_ethtool_set_eee(p->phy, e);
360
361 return ret;
362}
363
364static int dsa_slave_get_eee(struct net_device *dev, struct ethtool_eee *e)
365{
366 struct dsa_slave_priv *p = netdev_priv(dev);
367 struct dsa_switch *ds = p->parent;
368 int ret;
369
370 if (!ds->drv->get_eee)
371 return -EOPNOTSUPP;
372
373 ret = ds->drv->get_eee(ds, p->port, e);
374 if (ret)
375 return ret;
376
377 if (p->phy)
378 ret = phy_ethtool_get_eee(p->phy, e);
379
380 return ret;
381}
382
345static const struct ethtool_ops dsa_slave_ethtool_ops = { 383static const struct ethtool_ops dsa_slave_ethtool_ops = {
346 .get_settings = dsa_slave_get_settings, 384 .get_settings = dsa_slave_get_settings,
347 .set_settings = dsa_slave_set_settings, 385 .set_settings = dsa_slave_set_settings,
@@ -353,6 +391,8 @@ static const struct ethtool_ops dsa_slave_ethtool_ops = {
353 .get_sset_count = dsa_slave_get_sset_count, 391 .get_sset_count = dsa_slave_get_sset_count,
354 .set_wol = dsa_slave_set_wol, 392 .set_wol = dsa_slave_set_wol,
355 .get_wol = dsa_slave_get_wol, 393 .get_wol = dsa_slave_get_wol,
394 .set_eee = dsa_slave_set_eee,
395 .get_eee = dsa_slave_get_eee,
356}; 396};
357 397
358static const struct net_device_ops dsa_slave_netdev_ops = { 398static const struct net_device_ops dsa_slave_netdev_ops = {