net: Add ESP offload features
authorSteffen Klassert <steffen.klassert@secunet.com>
Fri, 14 Apr 2017 08:05:36 +0000 (10:05 +0200)
committerSteffen Klassert <steffen.klassert@secunet.com>
Fri, 14 Apr 2017 08:05:36 +0000 (10:05 +0200)
This patch adds netdev features to configure IPsec offloads.

Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
include/linux/netdev_features.h
include/linux/netdevice.h
include/linux/skbuff.h
net/core/ethtool.c

index 9a0419594e842ca00a5ecfca53823b38bad207bb..1d4737cffc7116c898b42787680b2e9b0dd46812 100644 (file)
@@ -54,8 +54,9 @@ enum {
                                         */
        NETIF_F_GSO_TUNNEL_REMCSUM_BIT, /* ... TUNNEL with TSO & REMCSUM */
        NETIF_F_GSO_SCTP_BIT,           /* ... SCTP fragmentation */
+       NETIF_F_GSO_ESP_BIT,            /* ... ESP with TSO */
        /**/NETIF_F_GSO_LAST =          /* last bit, see GSO_MASK */
-               NETIF_F_GSO_SCTP_BIT,
+               NETIF_F_GSO_ESP_BIT,
 
        NETIF_F_FCOE_CRC_BIT,           /* FCoE CRC32 */
        NETIF_F_SCTP_CRC_BIT,           /* SCTP checksum offload */
@@ -73,6 +74,8 @@ enum {
        NETIF_F_HW_L2FW_DOFFLOAD_BIT,   /* Allow L2 Forwarding in Hardware */
 
        NETIF_F_HW_TC_BIT,              /* Offload TC infrastructure */
+       NETIF_F_HW_ESP_BIT,             /* Hardware ESP transformation offload */
+       NETIF_F_HW_ESP_TX_CSUM_BIT,     /* ESP with TX checksum offload */
 
        /*
         * Add your fresh new feature above and remember to update
@@ -129,11 +132,14 @@ enum {
 #define NETIF_F_GSO_PARTIAL     __NETIF_F(GSO_PARTIAL)
 #define NETIF_F_GSO_TUNNEL_REMCSUM __NETIF_F(GSO_TUNNEL_REMCSUM)
 #define NETIF_F_GSO_SCTP       __NETIF_F(GSO_SCTP)
+#define NETIF_F_GSO_ESP                __NETIF_F(GSO_ESP)
 #define NETIF_F_HW_VLAN_STAG_FILTER __NETIF_F(HW_VLAN_STAG_FILTER)
 #define NETIF_F_HW_VLAN_STAG_RX        __NETIF_F(HW_VLAN_STAG_RX)
 #define NETIF_F_HW_VLAN_STAG_TX        __NETIF_F(HW_VLAN_STAG_TX)
 #define NETIF_F_HW_L2FW_DOFFLOAD       __NETIF_F(HW_L2FW_DOFFLOAD)
 #define NETIF_F_HW_TC          __NETIF_F(HW_TC)
+#define NETIF_F_HW_ESP         __NETIF_F(HW_ESP)
+#define NETIF_F_HW_ESP_TX_CSUM __NETIF_F(HW_ESP_TX_CSUM)
 
 #define for_each_netdev_feature(mask_addr, bit)        \
        for_each_set_bit(bit, (unsigned long *)mask_addr, NETDEV_FEATURE_COUNT)
index cc07c3be2705f1a3432117b1c687fb679813bb5a..5bb03d181848e43cec18a2694068a9a504011606 100644 (file)
@@ -4070,6 +4070,7 @@ static inline bool net_gso_ok(netdev_features_t features, int gso_type)
        BUILD_BUG_ON(SKB_GSO_PARTIAL != (NETIF_F_GSO_PARTIAL >> NETIF_F_GSO_SHIFT));
        BUILD_BUG_ON(SKB_GSO_TUNNEL_REMCSUM != (NETIF_F_GSO_TUNNEL_REMCSUM >> NETIF_F_GSO_SHIFT));
        BUILD_BUG_ON(SKB_GSO_SCTP    != (NETIF_F_GSO_SCTP >> NETIF_F_GSO_SHIFT));
+       BUILD_BUG_ON(SKB_GSO_ESP != (NETIF_F_GSO_ESP >> NETIF_F_GSO_SHIFT));
 
        return (features & feature) == feature;
 }
index 741d75cfc6862be1c524931550ccec7831328104..81ef53f0653494f09e5e8470bdb3e0eed2ec3b28 100644 (file)
@@ -492,6 +492,8 @@ enum {
        SKB_GSO_TUNNEL_REMCSUM = 1 << 14,
 
        SKB_GSO_SCTP = 1 << 15,
+
+       SKB_GSO_ESP = 1 << 16,
 };
 
 #if BITS_PER_LONG > 32
index 905a88ad28e096d57289eba7f966629336382032..03111a2d6653b8f06427540eb5864b255af4ead3 100644 (file)
@@ -90,6 +90,7 @@ static const char netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN]
        [NETIF_F_GSO_UDP_TUNNEL_CSUM_BIT] = "tx-udp_tnl-csum-segmentation",
        [NETIF_F_GSO_PARTIAL_BIT] =      "tx-gso-partial",
        [NETIF_F_GSO_SCTP_BIT] =         "tx-sctp-segmentation",
+       [NETIF_F_GSO_ESP_BIT] =          "tx-esp-segmentation",
 
        [NETIF_F_FCOE_CRC_BIT] =         "tx-checksum-fcoe-crc",
        [NETIF_F_SCTP_CRC_BIT] =        "tx-checksum-sctp",
@@ -103,6 +104,8 @@ static const char netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN]
        [NETIF_F_RXALL_BIT] =            "rx-all",
        [NETIF_F_HW_L2FW_DOFFLOAD_BIT] = "l2-fwd-offload",
        [NETIF_F_HW_TC_BIT] =            "hw-tc-offload",
+       [NETIF_F_HW_ESP_BIT] =           "esp-hw-offload",
+       [NETIF_F_HW_ESP_TX_CSUM_BIT] =   "esp-tx-csum-hw-offload",
 };
 
 static const char