net: mpls: Fixups for GSO
authorDavid Ahern <dsa@cumulusnetworks.com>
Thu, 25 Aug 2016 03:10:44 +0000 (20:10 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 31 Aug 2016 05:27:18 +0000 (22:27 -0700)
commit48d2ab609b6bbecb7698487c8579bc40de9d6dfa
treeb4f68767d70023041a98e1a03cd23711bca754d9
parent14972cbd34ff668c390cbd2e6497323484c9e812
net: mpls: Fixups for GSO

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>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/mpls/mpls_gso.c
net/mpls/mpls_iptunnel.c
net/openvswitch/actions.c