All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Ben Hutchings <bhutchings@solarflare.com>
Cc: David Miller <davem@davemloft.net>,
	netdev@vger.kernel.org, linux-net-drivers@solarflare.com,
	Kieran Mansley <kmansley@solarflare.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	Stephen Hemminger <shemminger@vyatta.com>
Subject: Re: [PATCH 1/2] net: Disable LRO on devices that are forwarding
Date: Fri, 20 Jun 2008 13:17:10 +0200	[thread overview]
Message-ID: <485B91B6.6090303@trash.net> (raw)
In-Reply-To: <20080620111139.GB29360@solarflare.com>

Ben Hutchings wrote:
> Ben Hutchings wrote:
> [...]
>> diff --git a/net/core/dev.c b/net/core/dev.c
>> index a495f71..f6944ec 100644
>> --- a/net/core/dev.c
>> +++ b/net/core/dev.c
> [...]
>> @@ -1123,6 +1124,29 @@ int dev_close(struct net_device *dev)
>>  }
>>  
>>  
>> +/**
>> + *	dev_disable_lro - disable Large Receive Offload on a device
>> + *	@dev: device
>> + *
>> + *	Disable Large Receive Offload (LRO) on a net device.  Must be
>> + *	called under RTNL.  This is needed if received packets may be
>> + *	forwarded to another interface.
>> + */
>> +void dev_disable_lro(struct net_device *dev)
>> +{
>> +	if (dev->ethtool_ops && dev->ethtool_ops->get_flags &&
>> +	    dev->ethtool_ops->set_flags) {
>> +		u32 flags = dev->ethtool_ops->get_flags(dev);
>> +		if (flags & ETH_FLAG_LRO) {
>> +			flags &= ~ETH_FLAG_LRO;
>> +			dev->ethtool_ops->set_flags(dev, flags);
>> +		}
>> +	}
>> +	WARN_ON(dev->features & NETIF_F_LRO);
>> +}
>> +EXPORT_SYMBOL(dev_disable_lro);
> [...]
> 
> Of course, this doesn't work where the device that's about to start
> forwarding is a VLAN device, bonding device or other device depending on
> the physical device which is doing LRO.
> 
> It might be worth separating out the offload control ops from ethtool ops
> since they could usefully be applied to other device types... particularly
> here.


You can propagate it to the real device. I have a patch queued
to add ethtool support to vlan, I can send it to Dave this
weekend. I guess for bonding etc. that would also be useful
for disabling offloading/checksumming/... globally or just
querying the state.

  reply	other threads:[~2008-06-20 11:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-19 18:44 [PATCH 0/2] Disable forwarding of LRO skbs [2nd try] Ben Hutchings
2008-06-19 18:07 ` [PATCH 1/2] net: Disable LRO on devices that are forwarding Ben Hutchings
2008-06-19 23:21   ` David Miller
2008-06-20 11:11   ` Ben Hutchings
2008-06-20 11:17     ` Patrick McHardy [this message]
2008-06-20 14:21   ` Andi Kleen
2008-06-19 18:08 ` [PATCH 2/2] net: Discard and warn about LRO'd skbs received for forwarding Ben Hutchings
2008-06-19 21:50   ` Stephen Hemminger
2008-06-19 22:29     ` Brandeburg, Jesse
2008-06-19 22:42     ` Ben Hutchings
2008-06-19 23:27   ` David Miller
2008-06-19 21:50 ` [PATCH 0/2] Disable forwarding of LRO skbs [2nd try] Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=485B91B6.6090303@trash.net \
    --to=kaber@trash.net \
    --cc=bhutchings@solarflare.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=kmansley@solarflare.com \
    --cc=linux-net-drivers@solarflare.com \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@vyatta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.