]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
gso: Remove arbitrary checks for unsupported GSO
authorTom Herbert <tom@herbertland.com>
Wed, 18 May 2016 16:06:09 +0000 (09:06 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 20 May 2016 22:03:15 +0000 (18:03 -0400)
In several gso_segment functions there are checks of gso_type against
a seemingly arbitrary list of SKB_GSO_* flags. This seems like an
attempt to identify unsupported GSO types, but since the stack is
the one that set these GSO types in the first place this seems
unnecessary to do. If a combination isn't valid in the first
place that stack should not allow setting it.

This is a code simplication especially for add new GSO types.

Signed-off-by: Tom Herbert <tom@herbertland.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/af_inet.c
net/ipv4/gre_offload.c
net/ipv4/tcp_offload.c
net/ipv4/udp_offload.c
net/ipv6/ip6_offload.c
net/ipv6/udp_offload.c
net/mpls/mpls_gso.c

index 2e6e65fc4d203b91a06075e02d2dd1ac8141f3db..7f08d4525981a24271f36269bc8575a9042249f8 100644 (file)
@@ -1205,24 +1205,6 @@ static struct sk_buff *inet_gso_segment(struct sk_buff *skb,
        int ihl;
        int id;
 
-       if (unlikely(skb_shinfo(skb)->gso_type &
-                    ~(SKB_GSO_TCPV4 |
-                      SKB_GSO_UDP |
-                      SKB_GSO_DODGY |
-                      SKB_GSO_TCP_ECN |
-                      SKB_GSO_GRE |
-                      SKB_GSO_GRE_CSUM |
-                      SKB_GSO_IPIP |
-                      SKB_GSO_SIT |
-                      SKB_GSO_TCPV6 |
-                      SKB_GSO_UDP_TUNNEL |
-                      SKB_GSO_UDP_TUNNEL_CSUM |
-                      SKB_GSO_TCP_FIXEDID |
-                      SKB_GSO_TUNNEL_REMCSUM |
-                      SKB_GSO_PARTIAL |
-                      0)))
-               goto out;
-
        skb_reset_network_header(skb);
        nhoff = skb_network_header(skb) - skb_mac_header(skb);
        if (unlikely(!pskb_may_pull(skb, sizeof(*iph))))
index e88190a8699ad9c900be71d80d8ff3f9e12471ff..ecd1e09dbbf137d44996a4a83aec2c13b48d09f9 100644 (file)
@@ -26,20 +26,6 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb,
        int gre_offset, outer_hlen;
        bool need_csum, ufo;
 
-       if (unlikely(skb_shinfo(skb)->gso_type &
-                               ~(SKB_GSO_TCPV4 |
-                                 SKB_GSO_TCPV6 |
-                                 SKB_GSO_UDP |
-                                 SKB_GSO_DODGY |
-                                 SKB_GSO_TCP_ECN |
-                                 SKB_GSO_TCP_FIXEDID |
-                                 SKB_GSO_GRE |
-                                 SKB_GSO_GRE_CSUM |
-                                 SKB_GSO_IPIP |
-                                 SKB_GSO_SIT |
-                                 SKB_GSO_PARTIAL)))
-               goto out;
-
        if (!skb->encapsulation)
                goto out;
 
index 02737b607aa716d2249aa507793abfb500f7bfeb..5c5964962d0ca2f00157c4e533597a34b9a96979 100644 (file)
@@ -83,25 +83,6 @@ struct sk_buff *tcp_gso_segment(struct sk_buff *skb,
 
        if (skb_gso_ok(skb, features | NETIF_F_GSO_ROBUST)) {
                /* Packet is from an untrusted source, reset gso_segs. */
-               int type = skb_shinfo(skb)->gso_type;
-
-               if (unlikely(type &
-                            ~(SKB_GSO_TCPV4 |
-                              SKB_GSO_DODGY |
-                              SKB_GSO_TCP_ECN |
-                              SKB_GSO_TCP_FIXEDID |
-                              SKB_GSO_TCPV6 |
-                              SKB_GSO_GRE |
-                              SKB_GSO_GRE_CSUM |
-                              SKB_GSO_IPIP |
-                              SKB_GSO_SIT |
-                              SKB_GSO_UDP_TUNNEL |
-                              SKB_GSO_UDP_TUNNEL_CSUM |
-                              SKB_GSO_TUNNEL_REMCSUM |
-                              0) ||
-                            !(type & (SKB_GSO_TCPV4 |
-                                      SKB_GSO_TCPV6))))
-                       goto out;
 
                skb_shinfo(skb)->gso_segs = DIV_ROUND_UP(skb->len, mss);
 
index 6b7459c92bb2a89c9372b9dafa4621031b624123..81f253b6ff363e6fe1707a7ed0e2061ea69a25f9 100644 (file)
@@ -209,16 +209,6 @@ static struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb,
 
        if (skb_gso_ok(skb, features | NETIF_F_GSO_ROBUST)) {
                /* Packet is from an untrusted source, reset gso_segs. */
-               int type = skb_shinfo(skb)->gso_type;
-
-               if (unlikely(type & ~(SKB_GSO_UDP | SKB_GSO_DODGY |
-                                     SKB_GSO_UDP_TUNNEL |
-                                     SKB_GSO_UDP_TUNNEL_CSUM |
-                                     SKB_GSO_TUNNEL_REMCSUM |
-                                     SKB_GSO_IPIP |
-                                     SKB_GSO_GRE | SKB_GSO_GRE_CSUM) ||
-                            !(type & (SKB_GSO_UDP))))
-                       goto out;
 
                skb_shinfo(skb)->gso_segs = DIV_ROUND_UP(skb->len, mss);
 
index f5eb184e109307b355949d02103f83c2d1a7d737..9ad743b2c624dfaf1bd713c05d07556fb67b84eb 100644 (file)
@@ -69,24 +69,6 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb,
        bool encap, udpfrag;
        int nhoff;
 
-       if (unlikely(skb_shinfo(skb)->gso_type &
-                    ~(SKB_GSO_TCPV4 |
-                      SKB_GSO_UDP |
-                      SKB_GSO_DODGY |
-                      SKB_GSO_TCP_ECN |
-                      SKB_GSO_TCP_FIXEDID |
-                      SKB_GSO_TCPV6 |
-                      SKB_GSO_GRE |
-                      SKB_GSO_GRE_CSUM |
-                      SKB_GSO_IPIP |
-                      SKB_GSO_SIT |
-                      SKB_GSO_UDP_TUNNEL |
-                      SKB_GSO_UDP_TUNNEL_CSUM |
-                      SKB_GSO_TUNNEL_REMCSUM |
-                      SKB_GSO_PARTIAL |
-                      0)))
-               goto out;
-
        skb_reset_network_header(skb);
        nhoff = skb_network_header(skb) - skb_mac_header(skb);
        if (unlikely(!pskb_may_pull(skb, sizeof(*ipv6h))))
index 5429f6bcf0479415c212e8b45e9304290c694583..ac858c480f2f272f37275cddfd9ffe889a91af97 100644 (file)
@@ -36,19 +36,6 @@ static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb,
 
        if (skb_gso_ok(skb, features | NETIF_F_GSO_ROBUST)) {
                /* Packet is from an untrusted source, reset gso_segs. */
-               int type = skb_shinfo(skb)->gso_type;
-
-               if (unlikely(type & ~(SKB_GSO_UDP |
-                                     SKB_GSO_DODGY |
-                                     SKB_GSO_UDP_TUNNEL |
-                                     SKB_GSO_UDP_TUNNEL_CSUM |
-                                     SKB_GSO_TUNNEL_REMCSUM |
-                                     SKB_GSO_GRE |
-                                     SKB_GSO_GRE_CSUM |
-                                     SKB_GSO_IPIP |
-                                     SKB_GSO_SIT) ||
-                            !(type & (SKB_GSO_UDP))))
-                       goto out;
 
                skb_shinfo(skb)->gso_segs = DIV_ROUND_UP(skb->len, mss);
 
index bbcf60465e5c439a51b7ef72dcd0d4ddca244ea7..2055e57ed1c3a32297f521e35e0cd078562e8bbe 100644 (file)
@@ -26,15 +26,6 @@ static struct sk_buff *mpls_gso_segment(struct sk_buff *skb,
        netdev_features_t mpls_features;
        __be16 mpls_protocol;
 
-       if (unlikely(skb_shinfo(skb)->gso_type &
-                               ~(SKB_GSO_TCPV4 |
-                                 SKB_GSO_TCPV6 |
-                                 SKB_GSO_UDP |
-                                 SKB_GSO_DODGY |
-                                 SKB_GSO_TCP_FIXEDID |
-                                 SKB_GSO_TCP_ECN)))
-               goto out;
-
        /* Setup inner SKB. */
        mpls_protocol = skb->protocol;
        skb->protocol = skb->inner_protocol;
@@ -57,7 +48,7 @@ static struct sk_buff *mpls_gso_segment(struct sk_buff *skb,
         * skb_mac_gso_segment(), an indirect caller of this function.
         */
        __skb_pull(skb, skb->data - skb_mac_header(skb));
-out:
+
        return segs;
 }