From: Thadeu Lima de Souza Cascardo <cascardo@redhat.com> To: David Laight <David.Laight@ACULAB.COM> Cc: "'Konstantin Khlebnikov'" <koct9i@gmail.com>, "netdev@vger.kernel.org" <netdev@vger.kernel.org>, "David S. Miller" <davem@davemloft.net>, "dev@openvswitch.org" <dev@openvswitch.org>, Eric Dumazet <edumazet@google.com>, Florian Westphal <fw@strlen.de>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, Pravin Shelar <pshelar@nicira.com>, Cong Wang <xiyou.wangcong@gmail.com> Subject: Re: [PATCH] net: preserve IP control block during GSO segmentation Date: Fri, 8 Jan 2016 10:20:17 -0200 [thread overview] Message-ID: <20160108122016.GM27290@indiana.gru.redhat.com> (raw) In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6D1CCC01BA@AcuExch.aculab.com> On Fri, Jan 08, 2016 at 12:13:49PM +0000, David Laight wrote: > From: Of Konstantin Khlebnikov > > Sent: 08 January 2016 12:01 > > Skb_gso_segment() uses skb control block during segmentation. > > This patch adds 32-bytes room for previous control block which > > will be copied into all resulting segments. > > > > This patch fixes kernel crash during fragmenting forwarded packets. > > Fragmentation requires valid IP CB in skb for clearing ip options. > > Also patch removes custom save/restore in ovs code, now it's redundant. > > > ... > > diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h > > index 4355129fff91..9147f9f34cbe 100644 > > --- a/include/linux/skbuff.h > > +++ b/include/linux/skbuff.h > > @@ -3446,7 +3446,8 @@ struct skb_gso_cb { > > int encap_level; > > __u16 csum_start; > > }; > > -#define SKB_GSO_CB(skb) ((struct skb_gso_cb *)(skb)->cb) > > +#define SKB_SGO_CB_OFFSET 32 > > +#define SKB_GSO_CB(skb) ((struct skb_gso_cb *)((skb)->cb + SKB_SGO_CB_OFFSET)) > > You could set SKB_SGO_CB_OFFSET to sizeof ((skb)->cb) - sizeof (struct skb_gso_cb) > so that the end of 'cb' is always used. > (Assuming the former is a multiple of 4.) > > It might be worth using an on-stack structure passed through as a separate > parameter - it doesn't look as though it has to be queued with the skb. > (Clearly a bigger change.) > I considered that as an option. But the bigger change and the use of the extra stack for all users, plus the extra parameters indicated I should go the other way. In my opinion, at least in the IP fragmentation case, saving/restoring cb is not such a big problem since we are in slow path already. Cascardo. > David >
WARNING: multiple messages have this Message-ID (diff)
From: Thadeu Lima de Souza Cascardo <cascardo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> To: David Laight <David.Laight-ZS65k/vG3HxXrIkS9f7CXA@public.gmane.org> Cc: "dev-yBygre7rU0TnMu66kgdUjQ@public.gmane.org" <dev-yBygre7rU0TnMu66kgdUjQ@public.gmane.org>, "netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" <netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>, Florian Westphal <fw-HFFVJYpyMKqzQB+pC5nmwQ@public.gmane.org>, "linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>, Eric Dumazet <edumazet-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>, Cong Wang <xiyou.wangcong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>, "David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>, 'Konstantin Khlebnikov' <koct9i-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Subject: Re: [PATCH] net: preserve IP control block during GSO segmentation Date: Fri, 8 Jan 2016 10:20:17 -0200 [thread overview] Message-ID: <20160108122016.GM27290@indiana.gru.redhat.com> (raw) In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6D1CCC01BA-VkEWCZq2GCInGFn1LkZF6NBPR1lH4CV8@public.gmane.org> On Fri, Jan 08, 2016 at 12:13:49PM +0000, David Laight wrote: > From: Of Konstantin Khlebnikov > > Sent: 08 January 2016 12:01 > > Skb_gso_segment() uses skb control block during segmentation. > > This patch adds 32-bytes room for previous control block which > > will be copied into all resulting segments. > > > > This patch fixes kernel crash during fragmenting forwarded packets. > > Fragmentation requires valid IP CB in skb for clearing ip options. > > Also patch removes custom save/restore in ovs code, now it's redundant. > > > ... > > diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h > > index 4355129fff91..9147f9f34cbe 100644 > > --- a/include/linux/skbuff.h > > +++ b/include/linux/skbuff.h > > @@ -3446,7 +3446,8 @@ struct skb_gso_cb { > > int encap_level; > > __u16 csum_start; > > }; > > -#define SKB_GSO_CB(skb) ((struct skb_gso_cb *)(skb)->cb) > > +#define SKB_SGO_CB_OFFSET 32 > > +#define SKB_GSO_CB(skb) ((struct skb_gso_cb *)((skb)->cb + SKB_SGO_CB_OFFSET)) > > You could set SKB_SGO_CB_OFFSET to sizeof ((skb)->cb) - sizeof (struct skb_gso_cb) > so that the end of 'cb' is always used. > (Assuming the former is a multiple of 4.) > > It might be worth using an on-stack structure passed through as a separate > parameter - it doesn't look as though it has to be queued with the skb. > (Clearly a bigger change.) > I considered that as an option. But the bigger change and the use of the extra stack for all users, plus the extra parameters indicated I should go the other way. In my opinion, at least in the IP fragmentation case, saving/restoring cb is not such a big problem since we are in slow path already. Cascardo. > David > _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev
next prev parent reply other threads:[~2016-01-08 12:20 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2016-01-08 12:00 [PATCH] net: preserve IP control block during GSO segmentation Konstantin Khlebnikov 2016-01-08 12:00 ` Konstantin Khlebnikov 2016-01-08 12:10 ` Konstantin Khlebnikov 2016-01-08 12:10 ` Konstantin Khlebnikov 2016-01-08 12:11 ` Thadeu Lima de Souza Cascardo 2016-01-08 12:13 ` David Laight 2016-01-08 12:13 ` David Laight 2016-01-08 12:20 ` Thadeu Lima de Souza Cascardo [this message] 2016-01-08 12:20 ` Thadeu Lima de Souza Cascardo 2016-01-11 7:45 ` Zang MingJie 2016-01-11 7:45 ` Zang MingJie 2016-01-11 7:45 ` Zang MingJie 2016-01-12 0:58 ` Cong Wang 2016-01-12 0:58 ` Cong Wang 2016-01-08 12:24 ` kbuild test robot 2016-01-08 12:24 ` kbuild test robot
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=20160108122016.GM27290@indiana.gru.redhat.com \ --to=cascardo@redhat.com \ --cc=David.Laight@ACULAB.COM \ --cc=davem@davemloft.net \ --cc=dev@openvswitch.org \ --cc=edumazet@google.com \ --cc=fw@strlen.de \ --cc=koct9i@gmail.com \ --cc=linux-kernel@vger.kernel.org \ --cc=netdev@vger.kernel.org \ --cc=pshelar@nicira.com \ --cc=xiyou.wangcong@gmail.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: linkBe 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.