All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@free.fr>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: David Miller <davem@davemloft.net>,
	ebiederm@xmission.com, netdev@vger.kernel.org,
	greearb@candelatech.com, arnd@arndb.de, kaber@trash.net
Subject: Re: [PATCH] net: Handle gso packets in dev_forward_skb
Date: Tue, 29 Mar 2011 14:54:43 +0200	[thread overview]
Message-ID: <4D91D693.1070202@free.fr> (raw)
In-Reply-To: <1301340048.2506.13.camel@edumazet-laptop>

On 03/28/2011 09:20 PM, Eric Dumazet wrote:
> Le dimanche 27 mars 2011 à 18:09 -0700, David Miller a écrit :
>> From: ebiederm@xmission.com (Eric W. Biederman)
>> Date: Mon, 21 Mar 2011 15:00:56 -0700
>>
>>> Eric Dumazet<eric.dumazet@gmail.com>  writes:
>>>
>>>> Hmm, did you follow http://patchwork.ozlabs.org/patch/86815/
>>>> discussion ?
>>> No.  It seems I missed it, but I do have the same problem, and
>>> essentially the same fix.
>> Can someone work on getting this straightened out and resubmit the
>> final patch so I can apply something?
>>
> Apparently Daniel is busy.

Yes, sorry for the delay.
I would like to fix it but I am not sure to understand the different 
solutions proposed.

On 03/28/2011 09:20 PM, Eric Dumazet wrote:
> Le dimanche 27 mars 2011 à 18:09 -0700, David Miller a écrit :
>> From: ebiederm@xmission.com (Eric W. Biederman)
>> Date: Mon, 21 Mar 2011 15:00:56 -0700
>>
>>> Eric Dumazet<eric.dumazet@gmail.com>  writes:
>>>
>>>> Hmm, did you follow http://patchwork.ozlabs.org/patch/86815/
>>>> discussion ?
>>> No.  It seems I missed it, but I do have the same problem, and
>>> essentially the same fix.
>> Can someone work on getting this straightened out and resubmit the
>> final patch so I can apply something?
>>
> Apparently Daniel is busy.

Yes, sorry for the delay.
I would like to fix it, but my knowledge in limited on offloading.

I did the following patch, it fixes the problem. If it looks good I can 
resend it in patch format:

Index: net-2.6/net/core/dev.c
===================================================================
--- net-2.6.orig/net/core/dev.c 2011-03-29 14:50:00.047646000 +0200
+++ net-2.6/net/core/dev.c      2011-03-29 14:50:35.587646000 +0200
@@ -1454,6 +1454,27 @@ static inline void net_timestamp_check(s
                 __net_timestamp(skb);
  }

+static inline bool is_skb_forwardable(struct net_device *dev,
+                                     struct sk_buff *skb)
+{
+       unsigned int len;
+
+       if (!(dev->flags & IFF_UP))
+               return false;
+
+       len = dev->mtu + dev->hard_header_len + VLAN_HLEN;
+       if (skb->len <= len)
+               return true;
+
+       /* if TSO is enabled, we don't care about the length as the packet
+        * could be forwarded without being segmented before
+        */
+       if (skb_is_gso(skb))
+               return true;
+
+       return false;
+}
+
  /**
   * dev_forward_skb - loopback an skb to another netif
   *
@@ -1477,8 +1498,7 @@ int dev_forward_skb(struct net_device *d
         skb_orphan(skb);
         nf_reset(skb);

-       if (unlikely(!(dev->flags & IFF_UP) ||
-                    (skb->len > (dev->mtu + dev->hard_header_len + 
VLAN_HLEN)))) {
+       if (unlikely(!is_skb_forwardable(dev, skb))) {
                 atomic_long_inc(&dev->rx_dropped);
                 kfree_skb(skb);
                 return NET_RX_DROP;


  parent reply	other threads:[~2011-03-29 12:54 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
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 [this message]
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=4D91D693.1070202@free.fr \
    --to=daniel.lezcano@free.fr \
    --cc=arnd@arndb.de \
    --cc=davem@davemloft.net \
    --cc=ebiederm@xmission.com \
    --cc=eric.dumazet@gmail.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 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.