]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net: gso: use feature flag argument in all protocol gso handlers
authorFlorian Westphal <fw@strlen.de>
Mon, 20 Oct 2014 11:49:16 +0000 (13:49 +0200)
committerLuis Henriques <luis.henriques@canonical.com>
Thu, 27 Aug 2015 13:27:14 +0000 (14:27 +0100)
commit 1e16aa3ddf863c6b9f37eddf52503230a62dedb3 upstream.

skb_gso_segment() has a 'features' argument representing offload features
available to the output path.

A few handlers, e.g. GRE, instead re-fetch the features of skb->dev and use
those instead of the provided ones when handing encapsulation/tunnels.

Depending on dev->hw_enc_features of the output device skb_gso_segment() can
then return NULL even when the caller has disabled all GSO feature bits,
as segmentation of inner header thinks device will take care of segmentation.

This e.g. affects the tbf scheduler, which will silently drop GRE-encap GSO skbs
that did not fit the remaining token quota as the segmentation does not work
when device supports corresponding hw offload capabilities.

Cc: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
[ luis: backported to 3.16: used davem's backport to 3.14 ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
net/ipv4/af_inet.c
net/ipv4/gre_offload.c
net/ipv4/udp.c
net/ipv6/ip6_offload.c
net/mpls/mpls_gso.c

index 13fa803ff549521d3e2a7638102da220e32116ff..6ebb8f6235c9dfc7e97815b466899fbfffc537b2 100644 (file)
@@ -1286,7 +1286,7 @@ static struct sk_buff *inet_gso_segment(struct sk_buff *skb,
 
        encap = SKB_GSO_CB(skb)->encap_level > 0;
        if (encap)
-               features = skb->dev->hw_enc_features & netif_skb_features(skb);
+               features &= skb->dev->hw_enc_features;
        SKB_GSO_CB(skb)->encap_level += ihl;
 
        skb_reset_transport_header(skb);
index 4ae6b52751e9e8e74510a88f3b78e0f6b2265204..d7a1f450653d8527ef9ec9909fbeb4ad78a6bc2d 100644 (file)
@@ -72,7 +72,7 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb,
        skb->mac_len = skb_inner_network_offset(skb);
 
        /* segment inner packet. */
-       enc_features = skb->dev->hw_enc_features & netif_skb_features(skb);
+       enc_features = skb->dev->hw_enc_features & features;
        segs = skb_mac_gso_segment(skb, enc_features);
        if (!segs || IS_ERR(segs)) {
                skb_gso_error_unwind(skb, protocol, ghl, mac_offset, mac_len);
index 8253b5d3cc89d154df6ce80eb0f0a01cc646f224..10c1530ba978e8d5efc5968f122489a0094d4f29 100644 (file)
@@ -2574,7 +2574,7 @@ struct sk_buff *skb_udp_tunnel_segment(struct sk_buff *skb,
                skb->encap_hdr_csum = 1;
 
        /* segment inner packet. */
-       enc_features = skb->dev->hw_enc_features & netif_skb_features(skb);
+       enc_features = skb->dev->hw_enc_features & features;
        segs = skb_mac_gso_segment(skb, enc_features);
        if (!segs || IS_ERR(segs)) {
                skb_gso_error_unwind(skb, protocol, tnl_hlen, mac_offset,
index 65eda2a8af48280e0c068f24d8ef7adc8c7d8c9e..ef590d4e0171a56a95fd05b30036e0f75eeb9171 100644 (file)
@@ -114,7 +114,7 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb,
 
        encap = SKB_GSO_CB(skb)->encap_level > 0;
        if (encap)
-               features = skb->dev->hw_enc_features & netif_skb_features(skb);
+               features &= skb->dev->hw_enc_features;
        SKB_GSO_CB(skb)->encap_level += sizeof(*ipv6h);
 
        ipv6h = ipv6_hdr(skb);
index 6b38d083e1c973c55e18914748d49fe4968a7188..fefda6cc61fa500f30a30278250e86bff5be8bec 100644 (file)
@@ -48,7 +48,7 @@ static struct sk_buff *mpls_gso_segment(struct sk_buff *skb,
        __skb_push(skb, skb->mac_len);
 
        /* Segment inner packet. */
-       mpls_features = skb->dev->mpls_features & netif_skb_features(skb);
+       mpls_features = skb->dev->mpls_features & features;
        segs = skb_mac_gso_segment(skb, mpls_features);