diff options
Diffstat (limited to 'net/core/ethtool.c')
| -rw-r--r-- | net/core/ethtool.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/net/core/ethtool.c b/net/core/ethtool.c index 9c2afb480270..cbf033dcaf1f 100644 --- a/net/core/ethtool.c +++ b/net/core/ethtool.c | |||
| @@ -729,6 +729,40 @@ static int ethtool_set_wol(struct net_device *dev, char __user *useraddr) | |||
| 729 | return dev->ethtool_ops->set_wol(dev, &wol); | 729 | return dev->ethtool_ops->set_wol(dev, &wol); |
| 730 | } | 730 | } |
| 731 | 731 | ||
| 732 | static int ethtool_get_eee(struct net_device *dev, char __user *useraddr) | ||
| 733 | { | ||
| 734 | struct ethtool_eee edata; | ||
| 735 | int rc; | ||
| 736 | |||
| 737 | if (!dev->ethtool_ops->get_eee) | ||
| 738 | return -EOPNOTSUPP; | ||
| 739 | |||
| 740 | memset(&edata, 0, sizeof(struct ethtool_eee)); | ||
| 741 | edata.cmd = ETHTOOL_GEEE; | ||
| 742 | rc = dev->ethtool_ops->get_eee(dev, &edata); | ||
| 743 | |||
| 744 | if (rc) | ||
| 745 | return rc; | ||
| 746 | |||
| 747 | if (copy_to_user(useraddr, &edata, sizeof(edata))) | ||
| 748 | return -EFAULT; | ||
| 749 | |||
| 750 | return 0; | ||
| 751 | } | ||
| 752 | |||
| 753 | static int ethtool_set_eee(struct net_device *dev, char __user *useraddr) | ||
| 754 | { | ||
| 755 | struct ethtool_eee edata; | ||
| 756 | |||
| 757 | if (!dev->ethtool_ops->set_eee) | ||
| 758 | return -EOPNOTSUPP; | ||
| 759 | |||
| 760 | if (copy_from_user(&edata, useraddr, sizeof(edata))) | ||
| 761 | return -EFAULT; | ||
| 762 | |||
| 763 | return dev->ethtool_ops->set_eee(dev, &edata); | ||
| 764 | } | ||
| 765 | |||
| 732 | static int ethtool_nway_reset(struct net_device *dev) | 766 | static int ethtool_nway_reset(struct net_device *dev) |
| 733 | { | 767 | { |
| 734 | if (!dev->ethtool_ops->nway_reset) | 768 | if (!dev->ethtool_ops->nway_reset) |
| @@ -1409,6 +1443,7 @@ int dev_ethtool(struct net *net, struct ifreq *ifr) | |||
| 1409 | case ETHTOOL_GSET: | 1443 | case ETHTOOL_GSET: |
| 1410 | case ETHTOOL_GDRVINFO: | 1444 | case ETHTOOL_GDRVINFO: |
| 1411 | case ETHTOOL_GMSGLVL: | 1445 | case ETHTOOL_GMSGLVL: |
| 1446 | case ETHTOOL_GLINK: | ||
| 1412 | case ETHTOOL_GCOALESCE: | 1447 | case ETHTOOL_GCOALESCE: |
| 1413 | case ETHTOOL_GRINGPARAM: | 1448 | case ETHTOOL_GRINGPARAM: |
| 1414 | case ETHTOOL_GPAUSEPARAM: | 1449 | case ETHTOOL_GPAUSEPARAM: |
| @@ -1417,6 +1452,7 @@ int dev_ethtool(struct net *net, struct ifreq *ifr) | |||
| 1417 | case ETHTOOL_GSG: | 1452 | case ETHTOOL_GSG: |
| 1418 | case ETHTOOL_GSSET_INFO: | 1453 | case ETHTOOL_GSSET_INFO: |
| 1419 | case ETHTOOL_GSTRINGS: | 1454 | case ETHTOOL_GSTRINGS: |
| 1455 | case ETHTOOL_GSTATS: | ||
| 1420 | case ETHTOOL_GTSO: | 1456 | case ETHTOOL_GTSO: |
| 1421 | case ETHTOOL_GPERMADDR: | 1457 | case ETHTOOL_GPERMADDR: |
| 1422 | case ETHTOOL_GUFO: | 1458 | case ETHTOOL_GUFO: |
| @@ -1429,8 +1465,11 @@ int dev_ethtool(struct net *net, struct ifreq *ifr) | |||
| 1429 | case ETHTOOL_GRXCLSRLCNT: | 1465 | case ETHTOOL_GRXCLSRLCNT: |
| 1430 | case ETHTOOL_GRXCLSRULE: | 1466 | case ETHTOOL_GRXCLSRULE: |
| 1431 | case ETHTOOL_GRXCLSRLALL: | 1467 | case ETHTOOL_GRXCLSRLALL: |
| 1468 | case ETHTOOL_GRXFHINDIR: | ||
| 1432 | case ETHTOOL_GFEATURES: | 1469 | case ETHTOOL_GFEATURES: |
| 1470 | case ETHTOOL_GCHANNELS: | ||
| 1433 | case ETHTOOL_GET_TS_INFO: | 1471 | case ETHTOOL_GET_TS_INFO: |
| 1472 | case ETHTOOL_GEEE: | ||
| 1434 | break; | 1473 | break; |
| 1435 | default: | 1474 | default: |
| 1436 | if (!capable(CAP_NET_ADMIN)) | 1475 | if (!capable(CAP_NET_ADMIN)) |
| @@ -1471,6 +1510,12 @@ int dev_ethtool(struct net *net, struct ifreq *ifr) | |||
| 1471 | rc = ethtool_set_value_void(dev, useraddr, | 1510 | rc = ethtool_set_value_void(dev, useraddr, |
| 1472 | dev->ethtool_ops->set_msglevel); | 1511 | dev->ethtool_ops->set_msglevel); |
| 1473 | break; | 1512 | break; |
| 1513 | case ETHTOOL_GEEE: | ||
| 1514 | rc = ethtool_get_eee(dev, useraddr); | ||
| 1515 | break; | ||
| 1516 | case ETHTOOL_SEEE: | ||
| 1517 | rc = ethtool_set_eee(dev, useraddr); | ||
| 1518 | break; | ||
| 1474 | case ETHTOOL_NWAY_RST: | 1519 | case ETHTOOL_NWAY_RST: |
| 1475 | rc = ethtool_nway_reset(dev); | 1520 | rc = ethtool_nway_reset(dev); |
| 1476 | break; | 1521 | break; |
