All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <simon.horman@netronome.com>
To: David Ahern <dsa@cumulusnetworks.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net,
	buytenh@wantstofly.org, ebiederm@xmission.com,
	rshearma@brocade.com, tom@herbertland.com, tgraf@suug.ch,
	olivier.dugeon@orange.com, alexander.duyck@gmail.com,
	roopa@cumulusnetworks.com
Subject: Re: [PATCH net-next 2/3] net: mpls: Fixups for GSO
Date: Mon, 22 Aug 2016 14:21:24 +0200	[thread overview]
Message-ID: <20160822122122.GA8689@penelope.isobedori.kobe.vergenet.net> (raw)
In-Reply-To: <1471626542-13335-3-git-send-email-dsa@cumulusnetworks.com>

On Fri, Aug 19, 2016 at 10:09:01AM -0700, David Ahern wrote:
> As reported by Lennert the MPLS GSO code is failing to properly segment
> large packets. There are a couple of problems:
> 
> 1. the inner protocol is not set so the gso segment functions for inner
>    protocol layers are not getting run, and
> 
> 2  MPLS labels for packets that use the "native" (non-OVS) MPLS code
>    are not properly accounted for in mpls_gso_segment.
> 
> The MPLS GSO code was added for OVS. It is re-using skb_mac_gso_segment
> to call the gso segment functions for the higher layer protocols. That
> means skb_mac_gso_segment is called twice -- once with the network
> protocol set to MPLS and again with the network protocol set to the
> inner protocol.
> 
> This patch sets the inner skb protocol addressing item 1 above and sets
> the network_header and inner_network_header to mark where the MPLS labels
> start and end. The MPLS code in OVS is also updated to set the two
> network markers.
> 
> From there the MPLS GSO code uses the difference between the network
> header and the inner network header to know the size of the MPLS header
> that was pushed. It then pulls the MPLS header, resets the mac_len and
> protocol for the inner protocol and then calls skb_mac_gso_segment
> to segment the skb.
> 
> Afterward the inner protocol segmentation is done the skb protocol
> is set to mpls for each segment and the network and mac headers
> restored.
> 
> Reported-by: Lennert Buytenhek <buytenh@wantstofly.org>
> Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
> ---
>  net/mpls/mpls_gso.c       | 38 +++++++++++++++++++++++++++-----------
>  net/mpls/mpls_iptunnel.c  |  4 ++++
>  net/openvswitch/actions.c |  6 ++++++
>  3 files changed, 37 insertions(+), 11 deletions(-)
> 
> diff --git a/net/mpls/mpls_gso.c b/net/mpls/mpls_gso.c
> index 2055e57ed1c3..2aa4beaa0e4f 100644

...

> diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c
> index 1ecbd7715f6d..6d78f162a88b 100644
> --- a/net/openvswitch/actions.c
> +++ b/net/openvswitch/actions.c
> @@ -167,6 +167,12 @@ static int push_mpls(struct sk_buff *skb, struct sw_flow_key *key,
>  		skb->mac_len);
>  	skb_reset_mac_header(skb);
>  
> +	/* for GSO: set MPLS as network header and encapsulated protocol
> +	 * header as inner network header
> +	 */
> +	skb_set_network_header(skb, skb->mac_len);
> +	skb_set_inner_network_header(skb, skb->mac_len + MPLS_HLEN);
> +
>  	new_mpls_lse = (__be32 *)skb_mpls_header(skb);
>  	*new_mpls_lse = mpls->mpls_lse;

Is the above calculation correct if push_mpls() is called multiple times?

  parent reply	other threads:[~2016-08-22 12:21 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-19 17:08 [PATCH v3 net-next 0/3] net: mpls: fragmentation and gso fixes for locally originated traffic David Ahern
2016-08-19 17:09 ` [PATCH net-next 1/3] net: lwtunnel: Handle fragmentation David Ahern
2016-08-19 17:09 ` [PATCH net-next 2/3] net: mpls: Fixups for GSO David Ahern
2016-08-19 20:17   ` Alexander Duyck
2016-08-22 12:21   ` Simon Horman [this message]
2016-08-22 13:11     ` David Ahern
2016-08-22 14:51       ` Simon Horman
2016-08-23 19:24         ` David Ahern
2016-08-24  7:20           ` Simon Horman
2016-08-24 16:28             ` pravin shelar
2016-08-24 16:37               ` David Ahern
2016-08-24 17:41                 ` pravin shelar
2016-08-24 18:53                   ` David Ahern
2016-08-25  3:12                     ` David Ahern
2016-08-25  3:58                     ` pravin shelar
2016-09-26 15:56                 ` Jiri Benc
2016-09-26 17:02                   ` Jiri Benc
2016-09-27  2:04                     ` David Ahern
2016-09-27  7:45                       ` Jiri Benc
2016-09-27 16:38                         ` David Ahern
2016-09-27 16:45                           ` Jiri Benc
2016-08-19 17:09 ` [PATCH net-next 3/3] net: veth: Set features for MPLS David Ahern
  -- strict thread matches above, loose matches on Subject: below --
2016-08-17 21:49 [PATCH v2 net-next 0/3] net: mpls: fragmentation and gso fixes for locally originated traffic David Ahern
2016-08-17 21:49 ` [PATCH net-next 2/3] net: mpls: Fixups for GSO David Ahern
2016-08-17 23:16   ` Alexander Duyck
2016-08-17 23:23     ` David Ahern
2016-08-18  1:06       ` Alexander Duyck
2016-08-18  2:59         ` David Ahern
2016-08-18 14:37   ` Alexander Duyck
2016-08-18 16:18     ` David Ahern

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=20160822122122.GA8689@penelope.isobedori.kobe.vergenet.net \
    --to=simon.horman@netronome.com \
    --cc=alexander.duyck@gmail.com \
    --cc=buytenh@wantstofly.org \
    --cc=davem@davemloft.net \
    --cc=dsa@cumulusnetworks.com \
    --cc=ebiederm@xmission.com \
    --cc=netdev@vger.kernel.org \
    --cc=olivier.dugeon@orange.com \
    --cc=roopa@cumulusnetworks.com \
    --cc=rshearma@brocade.com \
    --cc=tgraf@suug.ch \
    --cc=tom@herbertland.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: 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.