summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSridhar Samudrala <sri@us.ibm.com>2009-07-22 13:38:22 +0000
committerDavid S. Miller <davem@davemloft.net>2009-07-26 19:25:45 -0700
commit1896e61ff7cc1c9dd0d8b1cf4a9426a0f7217a20 (patch)
treeddbcdba63f537681d047a302ef27f2df8b362770
parent7d073c68a49b23b5ba2bc23c3bb5b3bcaa0b4f20 (diff)
downloadop-kernel-dev-1896e61ff7cc1c9dd0d8b1cf4a9426a0f7217a20.zip
op-kernel-dev-1896e61ff7cc1c9dd0d8b1cf4a9426a0f7217a20.tar.gz
ethtool: device independent rx_csum and get_flags routines
This helps avoid error messages with ethtool -k on devices that don't provide device specific routines. Signed-off-by: Sridhar Samudrala <sri@us.ibm.com> ------------------------------------------------------------------ Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/core/ethtool.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index d9d5160..cf36ff4 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -30,6 +30,11 @@ u32 ethtool_op_get_link(struct net_device *dev)
return netif_carrier_ok(dev) ? 1 : 0;
}
+u32 ethtool_op_get_rx_csum(struct net_device *dev)
+{
+ return (dev->features & NETIF_F_ALL_CSUM) != 0;
+}
+
u32 ethtool_op_get_tx_csum(struct net_device *dev)
{
return (dev->features & NETIF_F_ALL_CSUM) != 0;
@@ -1004,7 +1009,9 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)
break;
case ETHTOOL_GRXCSUM:
rc = ethtool_get_value(dev, useraddr, ethcmd,
- dev->ethtool_ops->get_rx_csum);
+ (dev->ethtool_ops->get_rx_csum ?
+ dev->ethtool_ops->get_rx_csum :
+ ethtool_op_get_rx_csum));
break;
case ETHTOOL_SRXCSUM:
rc = ethtool_set_rx_csum(dev, useraddr);
@@ -1068,7 +1075,9 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)
break;
case ETHTOOL_GFLAGS:
rc = ethtool_get_value(dev, useraddr, ethcmd,
- dev->ethtool_ops->get_flags);
+ (dev->ethtool_ops->get_flags ?
+ dev->ethtool_ops->get_flags :
+ ethtool_op_get_flags));
break;
case ETHTOOL_SFLAGS:
rc = ethtool_set_value(dev, useraddr,
OpenPOWER on IntegriCloud