dpdk: fix tso not properly check the 'enable-tcp-udp-checksum' option issue 37/22637/2
authorChenmin Sun <chenmin.sun@intel.com>
Thu, 10 Oct 2019 16:28:13 +0000 (00:28 +0800)
committerDamjan Marion <dmarion@me.com>
Fri, 1 Nov 2019 17:26:43 +0000 (17:26 +0000)
Type: fix

Fix tso did not properly check the 'enable-tcp-udp-checksum' option issue
Add description of 'tso' and 'enable-tcp-udp-checksum' in startup.conf

Signed-off-by: Chenmin Sun <chenmin.sun@intel.com>
Change-Id: Id659067a9fa9e1db6c3f8dc533a2e90351b86831

src/plugins/dpdk/device/init.c
src/vpp/conf/startup.conf

index 1068e2e..4cf827c 100644 (file)
@@ -748,22 +748,21 @@ dpdk_lib_init (dpdk_main_t * dm)
        if (xd->flags & DPDK_DEVICE_FLAG_TX_OFFLOAD && hi != NULL)
          hi->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD;
 
-    if (devconf->tso == DPDK_DEVICE_TSO_ON)
-    {
-      if (xd->flags & DPDK_DEVICE_FLAG_TX_OFFLOAD && hi != NULL)
-      {
-        /*tcp_udp checksum must be enabled*/
-        if (hi->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD)
-        {
-          hi->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO;
-          vnm->interface_main.gso_interface_count++;
-          xd->port_conf.txmode.offloads |= DEV_TX_OFFLOAD_TCP_TSO |
-                                   DEV_TX_OFFLOAD_UDP_TSO;
-        }
-        else
-          return clib_error_return (0, "TSO: TCP/UDP checksum offload must be enabled");
-      }
-    }
+      if (devconf->tso == DPDK_DEVICE_TSO_ON && hi != NULL)
+       {
+         /*tcp_udp checksum must be enabled*/
+         if ((dm->conf->enable_tcp_udp_checksum) &&
+             (hi->flags & VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD))
+           {
+               hi->flags |= VNET_HW_INTERFACE_FLAG_SUPPORTS_GSO;
+               vnm->interface_main.gso_interface_count++;
+               xd->port_conf.txmode.offloads |= DEV_TX_OFFLOAD_TCP_TSO |
+                 DEV_TX_OFFLOAD_UDP_TSO;
+           }
+         else
+           clib_warning ("%s: TCP/UDP checksum offload must be enabled",
+             hi->name);
+       }
 
       dpdk_device_setup (xd);
 
index b61e451..3d83a13 100644 (file)
@@ -100,6 +100,11 @@ cpu {
                ## VLAN strip offload mode for interface
                ## Default is off
                # vlan-strip-offload on
+
+               ## TCP Segment Offload
+               ## Default is off
+               ## To enable TSO, 'enable-tcp-udp-checksum' must be set
+               # tso on
        # }
 
        ## Whitelist specific interface by specifying PCI address
@@ -135,6 +140,10 @@ cpu {
        ## Disables UDP / TCP TX checksum offload. Typically needed for use
        ## faster vector PMDs (together with no-multi-seg)
        # no-tx-checksum-offload
+
+       ## Enable UDP / TCP TX checksum offload
+       ## This is the reversed option of 'no-tx-checksum-offload'
+       # enable-tcp-udp-checksum
 # }