aboutsummaryrefslogtreecommitdiffstats
path: root/net/openvswitch
diff options
context:
space:
mode:
authorDavid Ahern <dsa@cumulusnetworks.com>2016-08-24 23:10:44 -0400
committerDavid S. Miller <davem@davemloft.net>2016-08-31 01:27:18 -0400
commit48d2ab609b6bbecb7698487c8579bc40de9d6dfa (patch)
treeb4f68767d70023041a98e1a03cd23711bca754d9 /net/openvswitch
parent14972cbd34ff668c390cbd2e6497323484c9e812 (diff)
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>
Diffstat (limited to 'net/openvswitch')
-rw-r--r--net/openvswitch/actions.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c
index 1ecbd7715f6d..ca91fc33f8a9 100644
--- a/net/openvswitch/actions.c
+++ b/net/openvswitch/actions.c
@@ -162,10 +162,16 @@ static int push_mpls(struct sk_buff *skb, struct sw_flow_key *key,
162 if (skb_cow_head(skb, MPLS_HLEN) < 0) 162 if (skb_cow_head(skb, MPLS_HLEN) < 0)
163 return -ENOMEM; 163 return -ENOMEM;
164 164
165 if (!skb->inner_protocol) {
166 skb_set_inner_network_header(skb, skb->mac_len);
167 skb_set_inner_protocol(skb, skb->protocol);
168 }
169
165 skb_push(skb, MPLS_HLEN); 170 skb_push(skb, MPLS_HLEN);
166 memmove(skb_mac_header(skb) - MPLS_HLEN, skb_mac_header(skb), 171 memmove(skb_mac_header(skb) - MPLS_HLEN, skb_mac_header(skb),
167 skb->mac_len); 172 skb->mac_len);
168 skb_reset_mac_header(skb); 173 skb_reset_mac_header(skb);
174 skb_set_network_header(skb, skb->mac_len);
169 175
170 new_mpls_lse = (__be32 *)skb_mpls_header(skb); 176 new_mpls_lse = (__be32 *)skb_mpls_header(skb);
171 *new_mpls_lse = mpls->mpls_lse; 177 *new_mpls_lse = mpls->mpls_lse;
@@ -173,8 +179,6 @@ static int push_mpls(struct sk_buff *skb, struct sw_flow_key *key,
173 skb_postpush_rcsum(skb, new_mpls_lse, MPLS_HLEN); 179 skb_postpush_rcsum(skb, new_mpls_lse, MPLS_HLEN);
174 180
175 update_ethertype(skb, eth_hdr(skb), mpls->mpls_ethertype); 181 update_ethertype(skb, eth_hdr(skb), mpls->mpls_ethertype);
176 if (!skb->inner_protocol)
177 skb_set_inner_protocol(skb, skb->protocol);
178 skb->protocol = mpls->mpls_ethertype; 182 skb->protocol = mpls->mpls_ethertype;
179 183
180 invalidate_flow_key(key); 184 invalidate_flow_key(key);
@@ -198,6 +202,7 @@ static int pop_mpls(struct sk_buff *skb, struct sw_flow_key *key,
198 202
199 __skb_pull(skb, MPLS_HLEN); 203 __skb_pull(skb, MPLS_HLEN);
200 skb_reset_mac_header(skb); 204 skb_reset_mac_header(skb);
205 skb_set_network_header(skb, skb->mac_len);
201 206
202 /* skb_mpls_header() is used to locate the ethertype 207 /* skb_mpls_header() is used to locate the ethertype
203 * field correctly in the presence of VLAN tags. 208 * field correctly in the presence of VLAN tags.