Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1195710 > unrolled thread

Re: [Question]Why a skb with frag_list causes BUG_ON in function skb_segment

Started byJason Wang <jasowang@redhat.com>
First post2015-07-30 06:30 +0200
Last post2015-07-30 08:00 +0200
Articles 3 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [Question]Why a skb with frag_list causes BUG_ON in function  skb_segment Jason Wang <jasowang@redhat.com> - 2015-07-30 06:30 +0200
    Re: [Question]Why a skb with frag_list causes BUG_ON in function  skb_segment Eric Dumazet <eric.dumazet@gmail.com> - 2015-07-30 07:10 +0200
      RE: [Question]Why a skb with frag_list causes BUG_ON in function  skb_segment "Zhangjie (HZ)" <zhangjie14@huawei.com> - 2015-07-30 08:00 +0200

#1195710 — Re: [Question]Why a skb with frag_list causes BUG_ON in function skb_segment

FromJason Wang <jasowang@redhat.com>
Date2015-07-30 06:30 +0200
SubjectRe: [Question]Why a skb with frag_list causes BUG_ON in function skb_segment
Message-ID<pRNDI-4hT-5@gated-at.bofh.it>
cc netdev for more experts

On 07/28/2015 04:53 PM, Zhangjie (HZ) wrote:
>
> Hi,
>
> I generate a skb as follows:
>
> It has a linear data region, 17 frags and the last fragment is in
> skb_shinfo(skb)->frag_list.
>
> Before this skb is sent to driver, dev_hard_start_xmit() will segment
> it first(skb has frag_list,
>
> so we get true from netif_needs_gso()), then the skb is passed to
> function skb_segment().
>
> Then, BUG_ON() happened.
>
> while (pos < offset + len) {
>
>         if (i >= nfrags) {
>
>                 BUG_ON(skb_headlen(list_skb));    (skbuff.c:3120)
>
>                 …
>
>         }
>
>         …
>
> }
>
> A skb that has no frags but frag_list also causes BUG_ON().
>
> I wonder if skb like follows is legal? Could skb in frag_list have
> linear data region?
>
>  
>
>  
>
> Thanks
>
> Zhangjie
>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1195713

FromEric Dumazet <eric.dumazet@gmail.com>
Date2015-07-30 07:10 +0200
Message-ID<pROgp-5g1-3@gated-at.bofh.it>
In reply to#1195710
On Thu, 2015-07-30 at 12:26 +0800, Jason Wang wrote:
> cc netdev for more experts
> 
> On 07/28/2015 04:53 PM, Zhangjie (HZ) wrote:
> >
> > Hi,
> >
> > I generate a skb as follows:
> >
> > It has a linear data region, 17 frags and the last fragment is in
> > skb_shinfo(skb)->frag_list.
> >
> > Before this skb is sent to driver, dev_hard_start_xmit() will segment
> > it first(skb has frag_list,
> >
> > so we get true from netif_needs_gso()), then the skb is passed to
> > function skb_segment().
> >
> > Then, BUG_ON() happened.
> >
> > while (pos < offset + len) {
> >
> >         if (i >= nfrags) {
> >
> >                 BUG_ON(skb_headlen(list_skb));    (skbuff.c:3120)
> >
> >                 …
> >
> >         }
> >
> >         …
> >
> > }
> >
> > A skb that has no frags but frag_list also causes BUG_ON().
> >
> > I wonder if skb like follows is legal? Could skb in frag_list have
> > linear data region?

The answer is : skb_segment() is very complex but does not handle all
possible cases.

skb found in skb_shinfo(skb)->frag_list must not have anything in their
skb->head. This would require very expensive logic and memory
allocations and copies.

Make sure you follow this rule in your driver, or even better leave this
work to GRO engine.



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1195723

From"Zhangjie (HZ)" <zhangjie14@huawei.com>
Date2015-07-30 08:00 +0200
Message-ID<pRP2N-6am-3@gated-at.bofh.it>
In reply to#1195713
R2V0IGl0Lg0KRXJpYywgdGhhbmtzIGZvciB5b3VyIGV4cGxhaW5hdGlvbi4gOi0pDQoNCkphc29u
LCB0aGFuayB5b3UhIEkg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5IGV4cGVuc2l2ZSBs
b2dpYyBhbmQgbWVtb3J5DQphbGxvY2F0aW9ucyBhbmQgY29waWVzLg0KDQpNYWtlIHN1cmUgeW91
IGZvbGxvdyB0aGlzIHJ1bGUgaW4geW91ciBkcml2ZXIsIG9yIGV2ZW4gYmV0dGVyIGxlYXZlIHRo
aXMgd29yayB0byBHUk8gZW5naW5lLg0KDQoNCg0K
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web