diff mbox

[net-next-2.6] ethtool: device independent rx_csum and get_flags routines

Message ID 1248305902.1061.84.camel@w-sridhar.beaverton.ibm.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Sridhar Samudrala July 22, 2009, 11:38 p.m. UTC
[PATCH net-next-2.6] ethtool: add 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>

------------------------------------------------------------------



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

David Miller July 27, 2009, 2:49 a.m. UTC | #1
From: Sridhar Samudrala <sri@us.ibm.com>
Date: Wed, 22 Jul 2009 16:38:22 -0700

> [PATCH net-next-2.6] ethtool: add 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>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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,