netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tom Herbert <tom@herbertland.com>
To: Jiri Benc <jbenc@redhat.com>
Cc: Linux Kernel Network Developers <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next 1/5] vxlan: implement GPE in L2 mode
Date: Mon, 29 Feb 2016 09:13:50 -0800	[thread overview]
Message-ID: <CALx6S37aU8q1QResU+HKMeCbMgkGDqWbnuckqs1V_9bC-jp8Ow@mail.gmail.com> (raw)
In-Reply-To: <20160229112322.4da0f0c0@griffin>

On Mon, Feb 29, 2016 at 2:23 AM, Jiri Benc <jbenc@redhat.com> wrote:
> On Sat, 27 Feb 2016 12:54:52 -0800, Tom Herbert wrote:
>> Yes, but RCO has not been specified for VXLAN-GPE either
>
> As far as I can see, RCO will just work with VXLAN-GPE. But I have no
> problem disallowing them to be set together, if you prefer that.
>
>> so the patch
>> does not correctly refuse setting those two together. Inevitably
>> though, those and other extensions will defined for VXLAN-GPE and new
>> ones for VXLAN. Again, the protocols are fundamentally incompatible,
>> so instead of trying to enforce each valid combination at
>> configuration
>
> We need to do the checking in either case. If we accepted unsupported
> combinations and then just silently ignored them, we'd be in troubles
> later when such combination becomes defined/supported. There would be
> no way for the userspace tools to detect whether a particular kernel
> supports the combination or not.
>
> So, we need to check for supported combination of options during
> configuration anyway.
>
> And when we have that, I don't really see the reason for doing that
> kind of code duplication that you suggest.
>
>> or performing multiple checks for flavor each time we
>> look at a packet, it seems easier to split the parsing with at most
>> one check for the protocol variant. For instance in
>> vxlan_udp_encap_recv just do:
>>
>> if (vs->flags & VXLAN_F_GPE)
>>                if (!vxlan_parse_gpe_hdr(&unparsed, skb, vs->flags))
>>                        goto drop;
>> else
>>                if (!vxlan_parse_gpe(&unparsed, skb, vs->flags))
>>                        goto drop;
>
> Most of the code of these two functions will be identical. To
> consolidate that as much as possible, you'll end up with what I have or
> something very similar.
>
>> And then move REMCSUM and GPB and other protocol specific checks to
>> the right function.
>
> And when RCO is defined for GPE, we copy the code? Doesn't make sense,
> sorry.
>
> If you look at the code in the current net-next (and the code after
> this patchset), the extension handling has been made generic and each
> extension gets its own handler function, leading to clean separation in
> the code. There's no reason to split the vxlan_rcv into two functions
> doing the same things but with slightly different calls to extensions.
>
They may or may not be "slightly different"; if they are the same
(like RCO for VXLAN-GPE uses the low order bits in VNI) then a common
backend function can be called.

As defined now, GPB can't be used with VXLAN-GPE at all, but when I
read your patch it looks very much like GPB is being checked and
allowed in the VXLAN-GPE path. The fact that "if (vs->flags &
VXLAN_F_GBP)" always fails for VXLAN-GPE packets because of
configuration constraints is not at all obvious, and really this just
results in an unnecessary conditional that gives the same answer for
every single VXLAN-GPE packet which we've already checked for just a
few lines above. At least the check for GPB could be moved to an else
block of " if (vs->flags & VXLAN_F_GPE)", this alone improves clarity
and eliminates an unnecessary conditional in the VXLAN-GPE path.

>  Jiri

  reply	other threads:[~2016-02-29 17:13 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-26  7:48 [PATCH net-next 0/5] vxlan: implement Generic Protocol Extension (GPE) Jiri Benc
2016-02-26  7:48 ` [PATCH net-next 1/5] vxlan: implement GPE in L2 mode Jiri Benc
2016-02-26 23:51   ` Tom Herbert
2016-02-27 19:31     ` Jiri Benc
2016-02-27 20:54       ` Tom Herbert
2016-02-27 21:02         ` Tom Herbert
2016-02-29 10:23         ` Jiri Benc
2016-02-29 17:13           ` Tom Herbert [this message]
2016-03-01 18:16             ` Jiri Benc
2016-02-26  7:48 ` [PATCH net-next 2/5] vxlan: move L2 mode initialization to a separate function Jiri Benc
2016-02-26  7:48 ` [PATCH net-next 3/5] vxlan: move fdb code to common location in vxlan_xmit Jiri Benc
2016-02-26  7:48 ` [PATCH net-next 4/5] vxlan: fix too large pskb_may_pull with remote checksum Jiri Benc
2016-02-26  7:48 ` [PATCH net-next 5/5] vxlan: implement GPE in L3 mode Jiri Benc
2016-02-26 22:22   ` Jesse Gross
2016-02-26 23:42     ` Tom Herbert
2016-02-27 19:26       ` Jiri Benc
2016-02-27 19:21     ` Jiri Benc
2016-02-27 19:44       ` Jiri Benc
2016-03-08 22:18         ` Jesse Gross

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=CALx6S37aU8q1QResU+HKMeCbMgkGDqWbnuckqs1V_9bC-jp8Ow@mail.gmail.com \
    --to=tom@herbertland.com \
    --cc=jbenc@redhat.com \
    --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;
as well as URLs for NNTP newsgroup(s).