net: define gso types for IPx over IPv4 and IPv6
authorTom Herbert <tom@herbertland.com>
Wed, 18 May 2016 16:06:10 +0000 (09:06 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 20 May 2016 22:03:15 +0000 (18:03 -0400)
This patch defines two new GSO definitions SKB_GSO_IPXIP4 and
SKB_GSO_IPXIP6 along with corresponding NETIF_F_GSO_IPXIP4 and
NETIF_F_GSO_IPXIP6. These are used to described IP in IP
tunnel and what the outer protocol is. The inner protocol
can be deduced from other GSO types (e.g. SKB_GSO_TCPV4 and
SKB_GSO_TCPV6). The GSO types of SKB_GSO_IPIP and SKB_GSO_SIT
are removed (these are both instances of SKB_GSO_IPXIP4).
SKB_GSO_IPXIP6 will be used when support for GSO with IP
encapsulation over IPv6 is added.

Signed-off-by: Tom Herbert <tom@herbertland.com>
Acked-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
19 files changed:
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/intel/i40e/i40e_main.c
drivers/net/ethernet/intel/i40e/i40e_txrx.c
drivers/net/ethernet/intel/i40evf/i40e_txrx.c
drivers/net/ethernet/intel/i40evf/i40evf_main.c
drivers/net/ethernet/intel/igb/igb_main.c
drivers/net/ethernet/intel/igbvf/netdev.c
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
include/linux/netdev_features.h
include/linux/netdevice.h
include/linux/skbuff.h
net/core/ethtool.c
net/ipv4/af_inet.c
net/ipv4/ipip.c
net/ipv6/ip6_offload.c
net/ipv6/sit.c
net/netfilter/ipvs/ip_vs_xmit.c

index d465bd72114630ca2505c57e0c9f8f23ae7fcccc..0a5b770cefaab6b316f1a9bb6e899c9ef32c953a 100644 (file)
@@ -13259,12 +13259,11 @@ static int bnx2x_init_dev(struct bnx2x *bp, struct pci_dev *pdev,
                NETIF_F_RXHASH | NETIF_F_HW_VLAN_CTAG_TX;
        if (!chip_is_e1x) {
                dev->hw_features |= NETIF_F_GSO_GRE | NETIF_F_GSO_UDP_TUNNEL |
-                                   NETIF_F_GSO_IPIP | NETIF_F_GSO_SIT;
+                                   NETIF_F_GSO_IPXIP4;
                dev->hw_enc_features =
                        NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_SG |
                        NETIF_F_TSO | NETIF_F_TSO_ECN | NETIF_F_TSO6 |
-                       NETIF_F_GSO_IPIP |
-                       NETIF_F_GSO_SIT |
+                       NETIF_F_GSO_IPXIP4 |
                        NETIF_F_GSO_GRE | NETIF_F_GSO_UDP_TUNNEL;
        }
 
index 5a0dca3e6ef6a23f08421d9667c5f7d83efe46c8..72a2efff8e494c7f077b2ee1311bdd54e857ca03 100644 (file)
@@ -6311,7 +6311,7 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
        dev->hw_features = NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_SG |
                           NETIF_F_TSO | NETIF_F_TSO6 |
                           NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_GRE |
-                          NETIF_F_GSO_IPIP | NETIF_F_GSO_SIT |
+                          NETIF_F_GSO_IPXIP4 |
                           NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_GRE_CSUM |
                           NETIF_F_GSO_PARTIAL | NETIF_F_RXHASH |
                           NETIF_F_RXCSUM | NETIF_F_LRO | NETIF_F_GRO;
@@ -6321,8 +6321,7 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
                        NETIF_F_TSO | NETIF_F_TSO6 |
                        NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_GRE |
                        NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_GRE_CSUM |
-                       NETIF_F_GSO_IPIP | NETIF_F_GSO_SIT |
-                       NETIF_F_GSO_PARTIAL;
+                       NETIF_F_GSO_IPXIP4 | NETIF_F_GSO_PARTIAL;
        dev->gso_partial_features = NETIF_F_GSO_UDP_TUNNEL_CSUM |
                                    NETIF_F_GSO_GRE_CSUM;
        dev->vlan_features = dev->hw_features | NETIF_F_HIGHDMA;
index 1cd0ebf7520ac77079f42342c4b868a1608d603f..242a1ff344e63ca18d5efd565ff47d1167d2d4df 100644 (file)
@@ -9083,8 +9083,7 @@ static int i40e_config_netdev(struct i40e_vsi *vsi)
                                   NETIF_F_TSO6                 |
                                   NETIF_F_GSO_GRE              |
                                   NETIF_F_GSO_GRE_CSUM         |
-                                  NETIF_F_GSO_IPIP             |
-                                  NETIF_F_GSO_SIT              |
+                                  NETIF_F_GSO_IPXIP4           |
                                   NETIF_F_GSO_UDP_TUNNEL       |
                                   NETIF_F_GSO_UDP_TUNNEL_CSUM  |
                                   NETIF_F_GSO_PARTIAL          |
index 99a524db5560cbcb2ffb92505f371532336d8d19..0a8122c00ae213508a381bb7b70d0869bdb9e74b 100644 (file)
@@ -2284,8 +2284,7 @@ static int i40e_tso(struct sk_buff *skb, u8 *hdr_len, u64 *cd_type_cmd_tso_mss)
 
        if (skb_shinfo(skb)->gso_type & (SKB_GSO_GRE |
                                         SKB_GSO_GRE_CSUM |
-                                        SKB_GSO_IPIP |
-                                        SKB_GSO_SIT |
+                                        SKB_GSO_IPXIP4 |
                                         SKB_GSO_UDP_TUNNEL |
                                         SKB_GSO_UDP_TUNNEL_CSUM)) {
                if (!(skb_shinfo(skb)->gso_type & SKB_GSO_PARTIAL) &&
index fd7dae46c5d819cb4c04585d3ba631b3fe1a3554..2bbbbd0f9f15d9a4382f03d9a700ce252336a4ce 100644 (file)
@@ -1559,8 +1559,7 @@ static int i40e_tso(struct sk_buff *skb, u8 *hdr_len, u64 *cd_type_cmd_tso_mss)
 
        if (skb_shinfo(skb)->gso_type & (SKB_GSO_GRE |
                                         SKB_GSO_GRE_CSUM |
-                                        SKB_GSO_IPIP |
-                                        SKB_GSO_SIT |
+                                        SKB_GSO_IPXIP4 |
                                         SKB_GSO_UDP_TUNNEL |
                                         SKB_GSO_UDP_TUNNEL_CSUM)) {
                if (!(skb_shinfo(skb)->gso_type & SKB_GSO_PARTIAL) &&
index 642bb45ed9067bac11d7ee9469f10e44b29b42e1..02d0a1ca696038cd2ca5351e0988bb88ebd4adbf 100644 (file)
@@ -2230,8 +2230,7 @@ int i40evf_process_config(struct i40evf_adapter *adapter)
                                   NETIF_F_TSO6                 |
                                   NETIF_F_GSO_GRE              |
                                   NETIF_F_GSO_GRE_CSUM         |
-                                  NETIF_F_GSO_IPIP             |
-                                  NETIF_F_GSO_SIT              |
+                                  NETIF_F_GSO_IPXIP4           |
                                   NETIF_F_GSO_UDP_TUNNEL       |
                                   NETIF_F_GSO_UDP_TUNNEL_CSUM  |
                                   NETIF_F_GSO_PARTIAL          |
index 21727692bef63ed315849d2ca8c7cbb9dd634fa5..b1a5cdb77088789e76a332873ecb17c987632275 100644 (file)
@@ -2418,8 +2418,7 @@ static int igb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 #define IGB_GSO_PARTIAL_FEATURES (NETIF_F_GSO_GRE | \
                                  NETIF_F_GSO_GRE_CSUM | \
-                                 NETIF_F_GSO_IPIP | \
-                                 NETIF_F_GSO_SIT | \
+                                 NETIF_F_GSO_IPXIP4 | \
                                  NETIF_F_GSO_UDP_TUNNEL | \
                                  NETIF_F_GSO_UDP_TUNNEL_CSUM)
 
index 322a2d7828a56ead786558ee2b7412f72daf4fe5..79b907f1a5201b72982ebce0f4b0dc931039685c 100644 (file)
@@ -2763,8 +2763,7 @@ static int igbvf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 #define IGBVF_GSO_PARTIAL_FEATURES (NETIF_F_GSO_GRE | \
                                    NETIF_F_GSO_GRE_CSUM | \
-                                   NETIF_F_GSO_IPIP | \
-                                   NETIF_F_GSO_SIT | \
+                                   NETIF_F_GSO_IPXIP4 | \
                                    NETIF_F_GSO_UDP_TUNNEL | \
                                    NETIF_F_GSO_UDP_TUNNEL_CSUM)
 
index 9f3677c7e96fe861f9b443f4f965405fb08a711a..69452c379cbcbb76bbf37eb37f6c5efd82875d03 100644 (file)
@@ -9482,8 +9482,7 @@ skip_sriov:
 
 #define IXGBE_GSO_PARTIAL_FEATURES (NETIF_F_GSO_GRE | \
                                    NETIF_F_GSO_GRE_CSUM | \
-                                   NETIF_F_GSO_IPIP | \
-                                   NETIF_F_GSO_SIT | \
+                                   NETIF_F_GSO_IPXIP4 | \
                                    NETIF_F_GSO_UDP_TUNNEL | \
                                    NETIF_F_GSO_UDP_TUNNEL_CSUM)
 
index 5e348b1250901bcfe8549d892f0159141bdc2a37..d86e51116384c46905264d874cc62b4f7deb6c62 100644 (file)
@@ -4062,8 +4062,7 @@ static int ixgbevf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 #define IXGBEVF_GSO_PARTIAL_FEATURES (NETIF_F_GSO_GRE | \
                                      NETIF_F_GSO_GRE_CSUM | \
-                                     NETIF_F_GSO_IPIP | \
-                                     NETIF_F_GSO_SIT | \
+                                     NETIF_F_GSO_IPXIP4 | \
                                      NETIF_F_GSO_UDP_TUNNEL | \
                                      NETIF_F_GSO_UDP_TUNNEL_CSUM)
 
index bc87362667497fd845a2fcc5ad0eddbf031d1eaf..aa7b2400f98c584d29e83f0eddf7bf13766cedd1 100644 (file)
@@ -44,8 +44,8 @@ enum {
        NETIF_F_FSO_BIT,                /* ... FCoE segmentation */
        NETIF_F_GSO_GRE_BIT,            /* ... GRE with TSO */
        NETIF_F_GSO_GRE_CSUM_BIT,       /* ... GRE with csum with TSO */
-       NETIF_F_GSO_IPIP_BIT,           /* ... IPIP tunnel with TSO */
-       NETIF_F_GSO_SIT_BIT,            /* ... SIT tunnel with TSO */
+       NETIF_F_GSO_IPXIP4_BIT,         /* ... IP4 or IP6 over IP4 with TSO */
+       NETIF_F_GSO_IPXIP6_BIT,         /* ... IP4 or IP6 over IP6 with TSO */
        NETIF_F_GSO_UDP_TUNNEL_BIT,     /* ... UDP TUNNEL with TSO */
        NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT,/* ... UDP TUNNEL with TSO & CSUM */
        NETIF_F_GSO_PARTIAL_BIT,        /* ... Only segment inner-most L4
@@ -121,8 +121,8 @@ enum {
 #define NETIF_F_RXALL          __NETIF_F(RXALL)
 #define NETIF_F_GSO_GRE                __NETIF_F(GSO_GRE)
 #define NETIF_F_GSO_GRE_CSUM   __NETIF_F(GSO_GRE_CSUM)
-#define NETIF_F_GSO_IPIP       __NETIF_F(GSO_IPIP)
-#define NETIF_F_GSO_SIT                __NETIF_F(GSO_SIT)
+#define NETIF_F_GSO_IPXIP4     __NETIF_F(GSO_IPXIP4)
+#define NETIF_F_GSO_IPXIP6     __NETIF_F(GSO_IPXIP6)
 #define NETIF_F_GSO_UDP_TUNNEL __NETIF_F(GSO_UDP_TUNNEL)
 #define NETIF_F_GSO_UDP_TUNNEL_CSUM __NETIF_F(GSO_UDP_TUNNEL_CSUM)
 #define NETIF_F_TSO_MANGLEID   __NETIF_F(TSO_MANGLEID)
@@ -200,8 +200,8 @@ enum {
 
 #define NETIF_F_GSO_ENCAP_ALL  (NETIF_F_GSO_GRE |                      \
                                 NETIF_F_GSO_GRE_CSUM |                 \
-                                NETIF_F_GSO_IPIP |                     \
-                                NETIF_F_GSO_SIT |                      \
+                                NETIF_F_GSO_IPXIP4 |                   \
+                                NETIF_F_GSO_IPXIP6 |                   \
                                 NETIF_F_GSO_UDP_TUNNEL |               \
                                 NETIF_F_GSO_UDP_TUNNEL_CSUM)
 
index c148edfe49659b2590bb8ff08c1ac286449cb74f..f45929ce815725d868261e9a2585ac53d0c8f128 100644 (file)
@@ -4006,8 +4006,8 @@ static inline bool net_gso_ok(netdev_features_t features, int gso_type)
        BUILD_BUG_ON(SKB_GSO_FCOE    != (NETIF_F_FSO >> NETIF_F_GSO_SHIFT));
        BUILD_BUG_ON(SKB_GSO_GRE     != (NETIF_F_GSO_GRE >> NETIF_F_GSO_SHIFT));
        BUILD_BUG_ON(SKB_GSO_GRE_CSUM != (NETIF_F_GSO_GRE_CSUM >> NETIF_F_GSO_SHIFT));
-       BUILD_BUG_ON(SKB_GSO_IPIP    != (NETIF_F_GSO_IPIP >> NETIF_F_GSO_SHIFT));
-       BUILD_BUG_ON(SKB_GSO_SIT     != (NETIF_F_GSO_SIT >> NETIF_F_GSO_SHIFT));
+       BUILD_BUG_ON(SKB_GSO_IPXIP4  != (NETIF_F_GSO_IPXIP4 >> NETIF_F_GSO_SHIFT));
+       BUILD_BUG_ON(SKB_GSO_IPXIP6  != (NETIF_F_GSO_IPXIP6 >> NETIF_F_GSO_SHIFT));
        BUILD_BUG_ON(SKB_GSO_UDP_TUNNEL != (NETIF_F_GSO_UDP_TUNNEL >> NETIF_F_GSO_SHIFT));
        BUILD_BUG_ON(SKB_GSO_UDP_TUNNEL_CSUM != (NETIF_F_GSO_UDP_TUNNEL_CSUM >> NETIF_F_GSO_SHIFT));
        BUILD_BUG_ON(SKB_GSO_PARTIAL != (NETIF_F_GSO_PARTIAL >> NETIF_F_GSO_SHIFT));
index c413c588a24f854be9e4df78d8a6872b6b1ff9f3..65968a97517fcc7ab6f2045df6dd80994f667059 100644 (file)
@@ -471,9 +471,9 @@ enum {
 
        SKB_GSO_GRE_CSUM = 1 << 8,
 
-       SKB_GSO_IPIP = 1 << 9,
+       SKB_GSO_IPXIP4 = 1 << 9,
 
-       SKB_GSO_SIT = 1 << 10,
+       SKB_GSO_IPXIP6 = 1 << 10,
 
        SKB_GSO_UDP_TUNNEL = 1 << 11,
 
index bdb4013581b1ada73a5957f250c821cca1efb65d..f4034817d2559babb39b06c432facf14e3347890 100644 (file)
@@ -84,8 +84,8 @@ static const char netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN]
        [NETIF_F_FSO_BIT] =              "tx-fcoe-segmentation",
        [NETIF_F_GSO_GRE_BIT] =          "tx-gre-segmentation",
        [NETIF_F_GSO_GRE_CSUM_BIT] =     "tx-gre-csum-segmentation",
-       [NETIF_F_GSO_IPIP_BIT] =         "tx-ipip-segmentation",
-       [NETIF_F_GSO_SIT_BIT] =          "tx-sit-segmentation",
+       [NETIF_F_GSO_IPXIP4_BIT] =       "tx-ipxip4-segmentation",
+       [NETIF_F_GSO_IPXIP6_BIT] =       "tx-ipxip6-segmentation",
        [NETIF_F_GSO_UDP_TUNNEL_BIT] =   "tx-udp_tnl-segmentation",
        [NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT] = "tx-udp_tnl-csum-segmentation",
        [NETIF_F_GSO_PARTIAL_BIT] =      "tx-gso-partial",
index 7f08d4525981a24271f36269bc8575a9042249f8..25040b183a60ae351ee796f6a85fb16d829c712f 100644 (file)
@@ -1483,7 +1483,7 @@ out_unlock:
 static int ipip_gro_complete(struct sk_buff *skb, int nhoff)
 {
        skb->encapsulation = 1;
-       skb_shinfo(skb)->gso_type |= SKB_GSO_IPIP;
+       skb_shinfo(skb)->gso_type |= SKB_GSO_IPXIP4;
        return inet_gro_complete(skb, nhoff);
 }
 
index 92827483ee3d7f03881e5cededec380fa3f15885..978370132f29f3bcce0ae419e52d954a43c5488c 100644 (file)
@@ -219,7 +219,7 @@ static netdev_tx_t ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
        if (unlikely(skb->protocol != htons(ETH_P_IP)))
                goto tx_error;
 
-       if (iptunnel_handle_offloads(skb, SKB_GSO_IPIP))
+       if (iptunnel_handle_offloads(skb, SKB_GSO_IPXIP4))
                goto tx_error;
 
        skb_set_inner_ipproto(skb, IPPROTO_IPIP);
index 9ad743b2c624dfaf1bd713c05d07556fb67b84eb..787e55f4796cf5a8772b18dd8338692fa82bee21 100644 (file)
@@ -86,7 +86,7 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb,
        proto = ipv6_gso_pull_exthdrs(skb, ipv6h->nexthdr);
 
        if (skb->encapsulation &&
-           skb_shinfo(skb)->gso_type & (SKB_GSO_SIT|SKB_GSO_IPIP))
+           skb_shinfo(skb)->gso_type & (SKB_GSO_IPXIP4 | SKB_GSO_IPXIP6))
                udpfrag = proto == IPPROTO_UDP && encap;
        else
                udpfrag = proto == IPPROTO_UDP && !skb->encapsulation;
@@ -294,7 +294,7 @@ out_unlock:
 static int sit_gro_complete(struct sk_buff *skb, int nhoff)
 {
        skb->encapsulation = 1;
-       skb_shinfo(skb)->gso_type |= SKB_GSO_SIT;
+       skb_shinfo(skb)->gso_type |= SKB_GSO_IPXIP4;
        return ipv6_gro_complete(skb, nhoff);
 }
 
index a13d8c114ccb1391ee1426a7c674451b9323b68a..0a5a255277e562ecb11ab703d964143f21bf85cd 100644 (file)
@@ -913,7 +913,7 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb,
                goto tx_error;
        }
 
-       if (iptunnel_handle_offloads(skb, SKB_GSO_SIT)) {
+       if (iptunnel_handle_offloads(skb, SKB_GSO_IPXIP4)) {
                ip_rt_put(rt);
                goto tx_error;
        }
@@ -1000,7 +1000,7 @@ static netdev_tx_t ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
        struct ip_tunnel *tunnel = netdev_priv(dev);
        const struct iphdr  *tiph = &tunnel->parms.iph;
 
-       if (iptunnel_handle_offloads(skb, SKB_GSO_IPIP))
+       if (iptunnel_handle_offloads(skb, SKB_GSO_IPXIP4))
                goto tx_error;
 
        skb_set_inner_ipproto(skb, IPPROTO_IPIP);
index 6d19d2eeaa60dc3770e41edf23c33e4e5737d647..01d3d894de4630b345084c8e0079a235923974b5 100644 (file)
@@ -932,17 +932,14 @@ error:
 
 static inline int __tun_gso_type_mask(int encaps_af, int orig_af)
 {
-       if (encaps_af == AF_INET) {
-               if (orig_af == AF_INET)
-                       return SKB_GSO_IPIP;
-
-               return SKB_GSO_SIT;
+       switch (encaps_af) {
+       case AF_INET:
+               return SKB_GSO_IPXIP4;
+       case AF_INET6:
+               return SKB_GSO_IPXIP6;
+       default:
+               return 0;
        }
-
-       /* GSO: we need to provide proper SKB_GSO_ value for IPv6:
-        * SKB_GSO_SIT/IPV6
-        */
-       return 0;
 }
 
 /*