net/sfc: prepare to support Rx datapath without checksum
authorAndrew Rybchenko <arybchenko@solarflare.com>
Sun, 15 Jul 2018 09:56:15 +0000 (10:56 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 23 Jul 2018 21:55:26 +0000 (23:55 +0200)
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
drivers/net/sfc/sfc_dp_rx.h
drivers/net/sfc/sfc_ef10_essb_rx.c
drivers/net/sfc/sfc_ef10_rx.c
drivers/net/sfc/sfc_rx.c

index 83faad1..ce96e83 100644 (file)
@@ -195,6 +195,7 @@ struct sfc_dp_rx {
 #define SFC_DP_RX_FEAT_TUNNELS                 0x4
 #define SFC_DP_RX_FEAT_FLOW_FLAG               0x8
 #define SFC_DP_RX_FEAT_FLOW_MARK               0x10
+#define SFC_DP_RX_FEAT_CHECKSUM                        0x20
        sfc_dp_rx_get_dev_info_t                *get_dev_info;
        sfc_dp_rx_pool_ops_supported_t          *pool_ops_supported;
        sfc_dp_rx_qsize_up_rings_t              *qsize_up_rings;
index 3e0c7fd..81c8f7f 100644 (file)
@@ -705,7 +705,8 @@ struct sfc_dp_rx sfc_ef10_essb_rx = {
                                  SFC_DP_HW_FW_CAP_RX_ES_SUPER_BUFFER,
        },
        .features               = SFC_DP_RX_FEAT_FLOW_FLAG |
-                                 SFC_DP_RX_FEAT_FLOW_MARK,
+                                 SFC_DP_RX_FEAT_FLOW_MARK |
+                                 SFC_DP_RX_FEAT_CHECKSUM,
        .get_dev_info           = sfc_ef10_essb_rx_get_dev_info,
        .pool_ops_supported     = sfc_ef10_essb_rx_pool_ops_supported,
        .qsize_up_rings         = sfc_ef10_essb_rx_qsize_up_rings,
index 42b35b9..6a5052b 100644 (file)
@@ -658,7 +658,8 @@ struct sfc_dp_rx sfc_ef10_rx = {
                .hw_fw_caps     = SFC_DP_HW_FW_CAP_EF10,
        },
        .features               = SFC_DP_RX_FEAT_MULTI_PROCESS |
-                                 SFC_DP_RX_FEAT_TUNNELS,
+                                 SFC_DP_RX_FEAT_TUNNELS |
+                                 SFC_DP_RX_FEAT_CHECKSUM,
        .get_dev_info           = sfc_ef10_rx_get_dev_info,
        .qsize_up_rings         = sfc_ef10_rx_qsize_up_rings,
        .qcreate                = sfc_ef10_rx_qcreate,
index 6ff9227..d8503e2 100644 (file)
@@ -517,7 +517,8 @@ struct sfc_dp_rx sfc_efx_rx = {
                .type           = SFC_DP_RX,
                .hw_fw_caps     = 0,
        },
-       .features               = SFC_DP_RX_FEAT_SCATTER,
+       .features               = SFC_DP_RX_FEAT_SCATTER |
+                                 SFC_DP_RX_FEAT_CHECKSUM,
        .qsize_up_rings         = sfc_efx_rx_qsize_up_rings,
        .qcreate                = sfc_efx_rx_qcreate,
        .qdestroy               = sfc_efx_rx_qdestroy,
@@ -792,9 +793,12 @@ sfc_rx_get_dev_offload_caps(struct sfc_adapter *sa)
 
        caps |= DEV_RX_OFFLOAD_JUMBO_FRAME;
        caps |= DEV_RX_OFFLOAD_CRC_STRIP;
-       caps |= DEV_RX_OFFLOAD_IPV4_CKSUM;
-       caps |= DEV_RX_OFFLOAD_UDP_CKSUM;
-       caps |= DEV_RX_OFFLOAD_TCP_CKSUM;
+
+       if (sa->dp_rx->features & SFC_DP_RX_FEAT_CHECKSUM) {
+               caps |= DEV_RX_OFFLOAD_IPV4_CKSUM;
+               caps |= DEV_RX_OFFLOAD_UDP_CKSUM;
+               caps |= DEV_RX_OFFLOAD_TCP_CKSUM;
+       }
 
        if (encp->enc_tunnel_encapsulations_supported &&
            (sa->dp_rx->features & SFC_DP_RX_FEAT_TUNNELS))
@@ -1443,8 +1447,13 @@ sfc_rx_check_mode(struct sfc_adapter *sa, struct rte_eth_rxmode *rxmode)
                rxmode->offloads |= DEV_RX_OFFLOAD_CRC_STRIP;
        }
 
+       /*
+        * Requested offloads are validated against supported by ethdev,
+        * so unsupported offloads cannot be added as the result of
+        * below check.
+        */
        if ((rxmode->offloads & DEV_RX_OFFLOAD_CHECKSUM) !=
-           DEV_RX_OFFLOAD_CHECKSUM) {
+           (offloads_supported & DEV_RX_OFFLOAD_CHECKSUM)) {
                sfc_warn(sa, "Rx checksum offloads cannot be disabled - always on (IPv4/TCP/UDP)");
                rxmode->offloads |= DEV_RX_OFFLOAD_CHECKSUM;
        }