ethtool: change ethtool_set_gro() to use ethtool_op_get_rx_csum
authorEric Dumazet <eric.dumazet@gmail.com>
Fri, 17 Sep 2010 18:56:18 +0000 (11:56 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 17 Sep 2010 18:56:18 +0000 (11:56 -0700)
To be able to switch on GRO on a device, ethtool_set_gro() checks this
device provides a get_rx_csum() method.

Some devices dont provide this method, while they do support RX
checksumming.

This patch allows bonding to support GRO :

ethtool -K bond0 gro on

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/ethtool.c

index fcd62757704dec9a8f67e40b553bd30d34c97437..248c25c3e820e1b8593dc6ca1e3243c902df6272 100644 (file)
@@ -1181,8 +1181,11 @@ static int ethtool_set_gro(struct net_device *dev, char __user *useraddr)
                return -EFAULT;
 
        if (edata.data) {
-               if (!dev->ethtool_ops->get_rx_csum ||
-                   !dev->ethtool_ops->get_rx_csum(dev))
+               u32 rxcsum = dev->ethtool_ops->get_rx_csum ?
+                               dev->ethtool_ops->get_rx_csum(dev) :
+                               ethtool_op_get_rx_csum(dev);
+
+               if (!rxcsum)
                        return -EINVAL;
                dev->features |= NETIF_F_GRO;
        } else