Commit 1896e61f authored by Sridhar Samudrala's avatar Sridhar Samudrala Committed by David S. Miller
Browse files

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: default avatarSridhar Samudrala <sri@us.ibm.com>

------------------------------------------------------------------
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7d073c68
...@@ -30,6 +30,11 @@ u32 ethtool_op_get_link(struct net_device *dev) ...@@ -30,6 +30,11 @@ u32 ethtool_op_get_link(struct net_device *dev)
return netif_carrier_ok(dev) ? 1 : 0; 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) u32 ethtool_op_get_tx_csum(struct net_device *dev)
{ {
return (dev->features & NETIF_F_ALL_CSUM) != 0; return (dev->features & NETIF_F_ALL_CSUM) != 0;
...@@ -1004,7 +1009,9 @@ int dev_ethtool(struct net *net, struct ifreq *ifr) ...@@ -1004,7 +1009,9 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)
break; break;
case ETHTOOL_GRXCSUM: case ETHTOOL_GRXCSUM:
rc = ethtool_get_value(dev, useraddr, ethcmd, 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; break;
case ETHTOOL_SRXCSUM: case ETHTOOL_SRXCSUM:
rc = ethtool_set_rx_csum(dev, useraddr); rc = ethtool_set_rx_csum(dev, useraddr);
...@@ -1068,7 +1075,9 @@ int dev_ethtool(struct net *net, struct ifreq *ifr) ...@@ -1068,7 +1075,9 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)
break; break;
case ETHTOOL_GFLAGS: case ETHTOOL_GFLAGS:
rc = ethtool_get_value(dev, useraddr, ethcmd, 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; break;
case ETHTOOL_SFLAGS: case ETHTOOL_SFLAGS:
rc = ethtool_set_value(dev, useraddr, rc = ethtool_set_value(dev, useraddr,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment