From: Simon Horman <horms@verge.net.au>
To: Jesse Gross <jesse@nicira.com>
Cc: Ben Pfaff <blp@nicira.com>, Pravin Shelar <pshelar@nicira.com>,
"dev@openvswitch.org" <dev@openvswitch.org>,
netdev <netdev@vger.kernel.org>, Ravi K <rkerur@gmail.com>,
Isaku Yamahata <yamahata@valinux.co.jp>,
Joe Stringer <joe@wand.net.nz>
Subject: Re: [PATCH v2.39 7/7] datapath: Add basic MPLS support to kernel
Date: Tue, 24 Sep 2013 10:32:22 +0900 [thread overview]
Message-ID: <20130924013222.GL25601@verge.net.au> (raw)
In-Reply-To: <CAEP_g=969qq6EAmo3mkaJP+tzqHQ9AUHje9j31CpzfD3RoRPaA@mail.gmail.com>
On Mon, Sep 23, 2013 at 02:17:50PM -0700, Jesse Gross wrote:
> On Sat, Sep 21, 2013 at 10:34 PM, Simon Horman <horms@verge.net.au> wrote:
> > On Thu, Sep 19, 2013 at 12:21:33PM -0500, Jesse Gross wrote:
> >> On Thu, Sep 19, 2013 at 10:57 AM, Simon Horman <horms@verge.net.au> wrote:
> >> > On Mon, Sep 16, 2013 at 03:38:21PM -0500, Jesse Gross wrote:
> >> >> On Mon, Sep 9, 2013 at 12:20 AM, Simon Horman <horms@verge.net.au> wrote:
> >> >> > @@ -616,6 +736,13 @@ int ovs_execute_actions(struct datapath *dp, struct sk_buff *skb)
> >> >> > goto out_loop;
> >> >> > }
> >> >> >
> >> >> > + /* Needed to initialise inner protocol on kernels older
> >> >> > + * than v3.11 where skb->inner_protocol is not present
> >> >> > + * and compatibility code uses the OVS_CB(skb) to store
> >> >> > + * the inner protocol.
> >> >> > + */
> >> >> > + ovs_skb_set_inner_protocol(skb, skb->protocol);
> >> >>
> >> >> The comment makes it sound like this code should just be deleted when
> >> >> upstreaming. However, I believe that we still need to initialize this
> >> >> field, right? Is this the best place do it or should it be conditional
> >> >> on adding a first MPLS header? (i.e. what happens if inner_protocol is
> >> >> already set and the packet simply passes through OVS?)
> >> >
> >> > I believe there are several problems here.
> >> >
> >> > The first one, which my comment was written around is that I think that if
> >> > inner_protocol is a field of struct sk_buff then we can rely on it already
> >> > being initialised. However, if we are using compatibility code, where
> >> > inner_protcol is called in the callback field of struct sk_buff then I
> >> > think that OVS needs to initialise it.
> >>
> >> I'm not sure that it's true that inner_protocol is already initialized
> >> - I grepped the tree and the only assignment that I found is in
> >> skbuff.c in __copy_skb_header().
> >
> > My assumption was that it would be initialised to zero,
> > primarily due to the behaviour of __alloc_skb_head().
> > Perhaps the core code should be fixed to make my assumption true?
>
> I misunderstood then - I think you can assume that it is initialized
> to zero, I though you meant that it was initialized to a protocol
> value. However, I then still have my original question - don't we need
> to set it here in both cases since we're not just 'initializing' it
> but actually setting a protocol?
I believe that you are correct and it needs to be set in both cases.
> >> One other consideration in the OVS case - with recirculation we may
> >> hit this code multiple times and the difference in behavior could be
> >> surprising. However, on the other hand, we need to be careful because
> >> skb->cb is not guaranteed to be initialized to zero.
> >
> > Thanks, that is also not something that I had considered.
> >
> > I'm not sure, but I think that we can rely on skb->cb
> > not being clobbered between rounds of recirculation.
> > Or at the very least I think we could save and restore it
> > as necessary.
>
> Yes, it should be safe to assume this.
>
> > So I think if we could be careful to make sure that inner_protocol
> > is in a sane state the first time we see the skb but not
> > each time it is recirculated then I think things should work out.
> >
> > In my current implementation of recirculation the datapath
> > side is driven ovs_dp_process_received_packet(). So by my reasoning
> > above I think it would make sense to reset the inner_protocol there
> > and in ovs_packet_cmd_execute() rather than in ovs_execute_actions()
> > which each of those functions call.
>
> I think that would work, however, I wonder if it's the right place in
> general, independent of this compatibility issue. I guess it still
> seems like the ideal thing to do is to move this as close to where it
> is necessary as possible, specifically in mpls_push(). Is there a
> reason to not put it there (again, other than the out-of-tree
> compatibility issues)?
I agree that should work, out-of-tree compatibility issues aside.
Perhaps a solution is to have a conditional set_inner_protocol call inside
push_mpls, where the condition is that inner_protocol is zero.
And a reset_inner_protocol call earlier on, a call that sets inner_protocol
to zero only if the compatibility code is in use and thus it resides in
struct ovs_gso_cb. This call could be remove once the compatibility
code is no longer needed, that is once kernels older than 3.11 are no
longer supported.
next prev parent reply other threads:[~2013-09-24 1:32 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-09 7:20 [PATCH v2.39 0/7] MPLS actions and matches Simon Horman
2013-09-09 7:20 ` [PATCH v2.39 2/7] odp: Allow VLAN actions after MPLS actions Simon Horman
[not found] ` <1378711207-29890-1-git-send-email-horms-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org>
2013-09-09 7:20 ` [PATCH v2.39 1/7] odp: Only pass vlan_tci to commit_vlan_action() Simon Horman
2013-09-09 7:20 ` [PATCH v2.39 3/7] ofp-actions: Add OFPUTIL_OFPAT13_PUSH_MPLS Simon Horman
2013-09-09 7:20 ` [PATCH v2.39 4/7] ofp-actions: Add separate OpenFlow 1.3 action parser Simon Horman
2013-09-09 7:20 ` [PATCH v2.39 5/7] lib: Push MPLS tags in the OpenFlow 1.3 ordering Simon Horman
2013-09-09 7:20 ` [PATCH v2.39 6/7] datapath: Break out deacceleration portion of vlan_push Simon Horman
2013-09-13 22:07 ` Jesse Gross
[not found] ` <CAEP_g=_ZQ6hNpxoHm6t3N=PxA+3WTrvNegL514j0R3GDM5C92A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-09-15 16:32 ` Simon Horman
2013-09-19 14:56 ` Simon Horman
2013-09-09 7:20 ` [PATCH v2.39 7/7] datapath: Add basic MPLS support to kernel Simon Horman
[not found] ` <1378711207-29890-8-git-send-email-horms-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org>
2013-09-16 20:38 ` Jesse Gross
[not found] ` <CAEP_g=8FBQPZ=C6G39YdHRzG57m5MqfXSZFAX2S_KLHRwfzc2w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-09-16 20:46 ` Ben Pfaff
2013-09-17 23:47 ` Simon Horman
2013-09-18 0:05 ` Ben Pfaff
2013-09-19 15:57 ` Simon Horman
2013-09-19 17:21 ` Jesse Gross
2013-09-22 5:34 ` Simon Horman
[not found] ` <20130922053156.GA4849-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org>
2013-09-23 21:17 ` Jesse Gross
2013-09-24 1:32 ` Simon Horman [this message]
2013-09-24 1:38 ` Jesse Gross
2013-09-24 2:49 ` Simon Horman
2013-09-17 18:38 ` Pravin Shelar
2013-09-18 22:07 ` Simon Horman
2013-09-19 17:31 ` Jesse Gross
2013-09-22 5:38 ` Simon Horman
2013-09-23 19:47 ` Pravin Shelar
[not found] ` <CALnjE+o_bcNbU6kv2eUBaNS4tincV+BmrFyJtZZRTaMPMVv8gw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-09-23 21:24 ` Jesse Gross
2013-09-24 1:33 ` Simon Horman
[not found] ` <20130918220756.GA24919-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org>
2013-09-19 20:45 ` Simon Horman
2013-09-20 1:31 ` [ovs-dev] " Pravin Shelar
2013-09-22 3:54 ` Simon Horman
2013-09-09 7:25 ` [PATCH v2.39 0/7] MPLS actions and matches Simon Horman
2013-09-12 19:06 ` [ovs-dev] " Ben Pfaff
[not found] ` <20130912190636.GL16044-l0M0P4e3n4LQT0dZR+AlfA@public.gmane.org>
2013-09-12 22:56 ` Simon Horman
[not found] ` <20130912225614.GB30229-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org>
2013-09-12 22:54 ` Ben Pfaff
2013-09-13 22:15 ` [ovs-dev] " Jesse Gross
2013-09-15 16:39 ` Simon Horman
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=20130924013222.GL25601@verge.net.au \
--to=horms@verge.net.au \
--cc=blp@nicira.com \
--cc=dev@openvswitch.org \
--cc=jesse@nicira.com \
--cc=joe@wand.net.nz \
--cc=netdev@vger.kernel.org \
--cc=pshelar@nicira.com \
--cc=rkerur@gmail.com \
--cc=yamahata@valinux.co.jp \
/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;
as well as URLs for NNTP newsgroup(s).