aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/ethtool.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/core/ethtool.c')
-rw-r--r--net/core/ethtool.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 956a9f4971c..17741782a34 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -891,6 +891,20 @@ static int ethtool_nway_reset(struct net_device *dev)
891 return dev->ethtool_ops->nway_reset(dev); 891 return dev->ethtool_ops->nway_reset(dev);
892} 892}
893 893
894static int ethtool_get_link(struct net_device *dev, char __user *useraddr)
895{
896 struct ethtool_value edata = { .cmd = ETHTOOL_GLINK };
897
898 if (!dev->ethtool_ops->get_link)
899 return -EOPNOTSUPP;
900
901 edata.data = netif_running(dev) && dev->ethtool_ops->get_link(dev);
902
903 if (copy_to_user(useraddr, &edata, sizeof(edata)))
904 return -EFAULT;
905 return 0;
906}
907
894static int ethtool_get_eeprom(struct net_device *dev, void __user *useraddr) 908static int ethtool_get_eeprom(struct net_device *dev, void __user *useraddr)
895{ 909{
896 struct ethtool_eeprom eeprom; 910 struct ethtool_eeprom eeprom;
@@ -1171,7 +1185,9 @@ static int ethtool_set_ufo(struct net_device *dev, char __user *useraddr)
1171 return -EFAULT; 1185 return -EFAULT;
1172 if (edata.data && !(dev->features & NETIF_F_SG)) 1186 if (edata.data && !(dev->features & NETIF_F_SG))
1173 return -EINVAL; 1187 return -EINVAL;
1174 if (edata.data && !(dev->features & NETIF_F_HW_CSUM)) 1188 if (edata.data && !((dev->features & NETIF_F_GEN_CSUM) ||
1189 (dev->features & (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM))
1190 == (NETIF_F_IP_CSUM|NETIF_F_IPV6_CSUM)))
1175 return -EINVAL; 1191 return -EINVAL;
1176 return dev->ethtool_ops->set_ufo(dev, edata.data); 1192 return dev->ethtool_ops->set_ufo(dev, edata.data);
1177} 1193}
@@ -1528,8 +1544,7 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)
1528 rc = ethtool_nway_reset(dev); 1544 rc = ethtool_nway_reset(dev);
1529 break; 1545 break;
1530 case ETHTOOL_GLINK: 1546 case ETHTOOL_GLINK:
1531 rc = ethtool_get_value(dev, useraddr, ethcmd, 1547 rc = ethtool_get_link(dev, useraddr);
1532 dev->ethtool_ops->get_link);
1533 break; 1548 break;
1534 case ETHTOOL_GEEPROM: 1549 case ETHTOOL_GEEPROM:
1535 rc = ethtool_get_eeprom(dev, useraddr); 1550 rc = ethtool_get_eeprom(dev, useraddr);