diff options
-rw-r--r-- | include/net/dsa.h | 9 | ||||
-rw-r--r-- | net/dsa/slave.c | 40 |
2 files changed, 49 insertions, 0 deletions
diff --git a/include/net/dsa.h b/include/net/dsa.h index 4f664fe0e42c..58ad8c6492db 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h | |||
@@ -232,6 +232,15 @@ struct dsa_switch_driver { | |||
232 | struct phy_device *phy); | 232 | struct phy_device *phy); |
233 | void (*port_disable)(struct dsa_switch *ds, int port, | 233 | void (*port_disable)(struct dsa_switch *ds, int port, |
234 | struct phy_device *phy); | 234 | struct phy_device *phy); |
235 | |||
236 | /* | ||
237 | * EEE setttings | ||
238 | */ | ||
239 | int (*set_eee)(struct dsa_switch *ds, int port, | ||
240 | struct phy_device *phydev, | ||
241 | struct ethtool_eee *e); | ||
242 | int (*get_eee)(struct dsa_switch *ds, int port, | ||
243 | struct ethtool_eee *e); | ||
235 | }; | 244 | }; |
236 | 245 | ||
237 | void register_switch_driver(struct dsa_switch_driver *type); | 246 | void register_switch_driver(struct dsa_switch_driver *type); |
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 | ||
345 | static 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 | |||
364 | static 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 | |||
345 | static const struct ethtool_ops dsa_slave_ethtool_ops = { | 383 | static 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 | ||
358 | static const struct net_device_ops dsa_slave_netdev_ops = { | 398 | static const struct net_device_ops dsa_slave_netdev_ops = { |