[ovs-dev] [RFC PATCH] netdev-vport: Enable outer checksum on UDP tunnels by default

Alexander Duyck aduyck at mirantis.com
Thu May 26 23:19:37 UTC 2016


Change the checksum default for UDP based tunnels from true to false and
allow for csum=false to be used to clear the checksum value on such
tunnels.

This enables us to use GRO and Rx checksum offloads on incoming frames even
when the NIC itself is unable to recognize the tunnel based on the UDP port
number.  For example GENEVE was only recently introduced.  As a result most
NICs in Linux still don't have support for it.  However, due to the fact
that we can convert an outer checksum to CHECKSUM_COMPLETE we can get the
advantage of checksum offload and GRO just based on the outer UDP checksum
being validated.  As a result we can see throughput significantly increase
for most cases.

The one case where this might cause performance regression is an
environment in which a device only supports offloading of UDP tunnels
without checksums.  This is addressed in kernels 4.7 and newer with the
introduction of GSO_PARTIAL which will allow most NICs that support
UDP_TUNNEL segmentation to also support UDP_TUNNEL_CSUM segmentation.  As
such there should only be a few cases where this can cause a performance
regression while in the vast majority of cases this will allow for an
improvement in performance for all NICs that can support UDP checksum
offload.

Signed-off-by: Alexander Duyck <aduyck at mirantis.com>
---
 lib/netdev-vport.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c
index 8f2229c45a6d..4c2ec831740a 100644
--- a/lib/netdev-vport.c
+++ b/lib/netdev-vport.c
@@ -432,10 +432,12 @@ set_tunnel_config(struct netdev *dev_, const struct smap *args)
     /* Add a default destination port for tunnel ports if none specified. */
     if (!strcmp(type, "geneve")) {
         tnl_cfg.dst_port = htons(GENEVE_DST_PORT);
+        tnl_cfg.csum = true;
     }
 
     if (!strcmp(type, "vxlan")) {
         tnl_cfg.dst_port = htons(VXLAN_DST_PORT);
+        tnl_cfg.csum = true;
     }
 
     if (!strcmp(type, "lisp")) {
@@ -495,9 +497,7 @@ set_tunnel_config(struct netdev *dev_, const struct smap *args)
         } else if (!strcmp(node->key, "dst_port") && needs_dst_port) {
             tnl_cfg.dst_port = htons(atoi(node->value));
         } else if (!strcmp(node->key, "csum") && has_csum) {
-            if (!strcmp(node->value, "true")) {
-                tnl_cfg.csum = true;
-            }
+            tnl_cfg.csum = !strcmp(node->value, "true");
         } else if (!strcmp(node->key, "df_default")) {
             if (!strcmp(node->value, "false")) {
                 tnl_cfg.dont_fragment = false;




More information about the dev mailing list