Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 224978
b: refs/heads/master
c: e596e6e
h: refs/heads/master
v: v3
  • Loading branch information
Ben Hutchings authored and David S. Miller committed Dec 10, 2010
1 parent 902978f commit fd14b21
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 29639059a0122d95b34b5475bd9fee3910b401a3
refs/heads/master: e596e6e4d578f2639416e620d367a3af34814a40
4 changes: 3 additions & 1 deletion trunk/include/linux/ethtool.h
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,9 @@ struct ethtool_ops {
#define ETHTOOL_GMSGLVL 0x00000007 /* Get driver message level */
#define ETHTOOL_SMSGLVL 0x00000008 /* Set driver msg level. */
#define ETHTOOL_NWAY_RST 0x00000009 /* Restart autonegotiation. */
#define ETHTOOL_GLINK 0x0000000a /* Get link status (ethtool_value) */
/* Get link status for host, i.e. whether the interface *and* the
* physical port (if there is one) are up (ethtool_value). */
#define ETHTOOL_GLINK 0x0000000a
#define ETHTOOL_GEEPROM 0x0000000b /* Get EEPROM data */
#define ETHTOOL_SEEPROM 0x0000000c /* Set EEPROM data. */
#define ETHTOOL_GCOALESCE 0x0000000e /* Get coalesce config */
Expand Down
17 changes: 15 additions & 2 deletions trunk/net/core/ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -891,6 +891,20 @@ static int ethtool_nway_reset(struct net_device *dev)
return dev->ethtool_ops->nway_reset(dev);
}

static int ethtool_get_link(struct net_device *dev, char __user *useraddr)
{
struct ethtool_value edata = { .cmd = ETHTOOL_GLINK };

if (!dev->ethtool_ops->get_link)
return -EOPNOTSUPP;

edata.data = netif_running(dev) && dev->ethtool_ops->get_link(dev);

if (copy_to_user(useraddr, &edata, sizeof(edata)))
return -EFAULT;
return 0;
}

static int ethtool_get_eeprom(struct net_device *dev, void __user *useraddr)
{
struct ethtool_eeprom eeprom;
Expand Down Expand Up @@ -1530,8 +1544,7 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)
rc = ethtool_nway_reset(dev);
break;
case ETHTOOL_GLINK:
rc = ethtool_get_value(dev, useraddr, ethcmd,
dev->ethtool_ops->get_link);
rc = ethtool_get_link(dev, useraddr);
break;
case ETHTOOL_GEEPROM:
rc = ethtool_get_eeprom(dev, useraddr);
Expand Down

0 comments on commit fd14b21

Please sign in to comment.