diff mbox

ethtool: change ethtool_set_gro() to use ethtool_op_get_rx_csum

Message ID 1284624663.3352.9.camel@edumazet-laptop
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Eric Dumazet Sept. 16, 2010, 8:11 a.m. UTC
Le jeudi 16 septembre 2010 à 08:43 +0200, Eric Dumazet a écrit :
> Le mercredi 15 septembre 2010 à 23:38 -0700, David Miller a écrit :
> > From: Stephen Hemminger <shemminger@vyatta.com>
> > Date: Wed, 15 Sep 2010 23:21:25 -0700
> > 
> > > I think it is more complex than that. GRO is tied to NAPI,
> > > and bridge/bond don't use NAPI directly. They use netif_rx() for receiving
> > > because layered drivers can't directly up call because of possible
> > > issues with stack depth. 
> > > 
> > > To get GRO working for netif_rx case,
> > > the logic in process_backlog would have to change.
> > > But this queue is processing packets from multiple devices so
> > > it is not clear if GRO could be used.
> > 
> > Bonding's un-layering on RX is done in the normal netif_receive_skb()
> > control flow.
> > 
> > And bridging only uses netif_rx for multicast replication.
> 
> Yes, bonding case should be easy, I'll take a look today.
> 

[PATCH] ethtool: change ethtool_set_gro() to use ethtool_op_get_rx_csum

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>
---
 net/core/ethtool.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)



--
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 Sept. 17, 2010, 6:57 p.m. UTC | #1
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 16 Sep 2010 10:11:03 +0200

> [PATCH] ethtool: change ethtool_set_gro() to use ethtool_op_get_rx_csum
> 
> 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>

Applied, thanks Eric.

Can you do whatever change is needed to get it enabled by default?

Thanks again.
--
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 7a85367..8c8c6d4 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -1175,8 +1175,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