Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: David Miller <davem@davemloft.net>,
	netdev@vger.kernel.org, Ben Greear <greearb@candelatech.com>,
	Arnd Bergmann <arnd@arndb.de>, Patrick McHardy <kaber@trash.net>
Subject: Re: [PATCH] net: Handle gso packets in dev_forward_skb
Date: Mon, 21 Mar 2011 22:42:24 +0100	[thread overview]
Message-ID: <1300743744.2837.7.camel@edumazet-laptop> (raw)
In-Reply-To: <m1wrjsi2tf.fsf@fess.ebiederm.org>

Le lundi 21 mars 2011 à 14:25 -0700, Eric W. Biederman a écrit :
> Today when gso packets reach dev_forward_skb through the macvlan driver
> we drop them on the floor because they exceed the device mtu.  Ouch!
> 
> I don't undersand the subtelties of gso but I think it is sufficient to
> simply relax the checks and let gso packets through without an mtu
> check, and it works in my test case.
> 
> If needed we can split the gso packets into multiple packets here but
> that just seems like a wast of memory and time.
> 
> Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com>
> ---
>  net/core/dev.c |   16 ++++++++++------
>  1 files changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 0b88eba..2e26606 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -1527,17 +1527,21 @@ int dev_forward_skb(struct net_device *dev, struct sk_buff *skb)
>  	skb_orphan(skb);
>  	nf_reset(skb);
>  
> -	if (unlikely(!(dev->flags & IFF_UP) ||
> -		     (skb->len > (dev->mtu + dev->hard_header_len + VLAN_HLEN)))) {
> -		atomic_long_inc(&dev->rx_dropped);
> -		kfree_skb(skb);
> -		return NET_RX_DROP;
> -	}
> +	if (unlikely(!(dev->flags & IFF_UP)))
> +		goto kfree_skb;
> +	/* Don't check mtu on gso packets... */
> +	if (unlikely(!skb_is_gso(skb) &&
> +		     (skb->len > (dev->mtu + dev->hard_header_len + VLAN_HLEN))))
> +		goto kfree_skb;
>  	skb_set_dev(skb, dev);
>  	skb->tstamp.tv64 = 0;
>  	skb->pkt_type = PACKET_HOST;
>  	skb->protocol = eth_type_trans(skb, dev);
>  	return netif_rx(skb);
> +kfree_skb:
> +	atomic_long_inc(&dev->rx_dropped);
> +	kfree_skb(skb);
> +	return NET_RX_DROP;
>  }
>  EXPORT_SYMBOL_GPL(dev_forward_skb);
>  


Hmm, did you follow http://patchwork.ozlabs.org/patch/86815/
discussion ?




  reply	other threads:[~2011-03-21 21:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-21 21:25 [PATCH] net: Handle gso packets in dev_forward_skb Eric W. Biederman
2011-03-21 21:42 ` Eric Dumazet [this message]
2011-03-21 22:00   ` Eric W. Biederman
2011-03-28  1:09     ` David Miller
2011-03-28 19:20       ` Eric Dumazet
2011-03-28 19:36         ` Eric W. Biederman
2011-03-29 12:54         ` Daniel Lezcano
2011-03-29 21:02           ` Eric W. Biederman
2011-03-30  7:06             ` David Miller

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=1300743744.2837.7.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=arnd@arndb.de \
    --cc=davem@davemloft.net \
    --cc=ebiederm@xmission.com \
    --cc=greearb@candelatech.com \
    --cc=kaber@trash.net \
    --cc=netdev@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox