[ovs-dev] [PATCH] ovn-controller: Provide the option to set Encap.options:csum

Numan Siddique nusiddiq at redhat.com
Tue Jan 10 06:04:42 UTC 2017


ovn-controller by default enables UDP checksums for geneve
tunnels. With this patch user can set the desired value in
Open_vSwitch.external_ids:ovn_encap_csum.

Signed-off-by: Numan Siddique <nusiddiq at redhat.com>
---
 ovn/controller/chassis.c            | 12 ++++++------
 ovn/controller/ovn-controller.8.xml |  9 +++++++++
 ovn/ovn-sb.xml                      |  8 ++++++--
 3 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/ovn/controller/chassis.c b/ovn/controller/chassis.c
index db8cc2e..d38bc94 100644
--- a/ovn/controller/chassis.c
+++ b/ovn/controller/chassis.c
@@ -130,7 +130,8 @@ chassis_run(struct controller_ctx *ctx, const char *chassis_id,
 
     const struct sbrec_chassis *chassis_rec
         = get_chassis(ctx->ovnsb_idl, chassis_id);
-
+    const char *encap_csum = smap_get_def(&cfg->external_ids,
+                                          "ovn-encap-csum", "true");
     if (chassis_rec) {
         if (strcmp(hostname, chassis_rec->hostname)) {
             sbrec_chassis_set_hostname(chassis_rec, hostname);
@@ -165,8 +166,9 @@ chassis_run(struct controller_ctx *ctx, const char *chassis_id,
             cur_tunnels |= get_tunnel_type(chassis_rec->encaps[i]->type);
             same = same && !strcmp(chassis_rec->encaps[i]->ip, encap_ip);
 
-            same = same && smap_get_bool(&chassis_rec->encaps[i]->options,
-                                         "csum", false);
+            same = same && !strcmp(
+                smap_get_def(&chassis_rec->encaps[i]->options, "csum", ""),
+                encap_csum);
         }
         same = same && req_tunnels == cur_tunnels;
 
@@ -211,8 +213,7 @@ chassis_run(struct controller_ctx *ctx, const char *chassis_id,
     ds_destroy(&iface_types);
     int n_encaps = count_1bits(req_tunnels);
     struct sbrec_encap **encaps = xmalloc(n_encaps * sizeof *encaps);
-    const struct smap options = SMAP_CONST1(&options, "csum", "true");
-
+    const struct smap options = SMAP_CONST1(&options, "csum", encap_csum);
     for (int i = 0; i < n_encaps; i++) {
         const char *type = pop_tunnel_name(&req_tunnels);
 
@@ -222,7 +223,6 @@ chassis_run(struct controller_ctx *ctx, const char *chassis_id,
         sbrec_encap_set_ip(encaps[i], encap_ip);
         sbrec_encap_set_options(encaps[i], &options);
     }
-
     sbrec_chassis_set_encaps(chassis_rec, encaps, n_encaps);
     free(encaps);
 
diff --git a/ovn/controller/ovn-controller.8.xml b/ovn/controller/ovn-controller.8.xml
index dda26b3..9bbab00 100644
--- a/ovn/controller/ovn-controller.8.xml
+++ b/ovn/controller/ovn-controller.8.xml
@@ -149,6 +149,15 @@
         value mapping two physical network names to two ovs bridges would be:
         <code>physnet1:br-eth0,physnet2:br-eth1</code>.
       </dd>
+
+      <dt><code>external_ids:ovn-encap-csum</code></dt>
+      <dd>
+        <code>ovn-encap-csum</code> indicates that encapsulation checksums can
+        be transmitted and received with reasonable performance. It is a hint
+        to senders transmitting data to this chassis that they should use
+        checksums to protect OVN metadata. Set to <code>true</code> to enable
+        or <code>false</code> to disable.
+      </dd>
     </dl>
 
     <p>
diff --git a/ovn/ovn-sb.xml b/ovn/ovn-sb.xml
index 2f35079..7fdd0d7 100644
--- a/ovn/ovn-sb.xml
+++ b/ovn/ovn-sb.xml
@@ -310,8 +310,12 @@
         <code>csum</code> indicates that encapsulation checksums can be
         transmitted and received with reasonable performance. It is a hint
         to senders transmitting data to this chassis that they should use
-        checksums to protect OVN metadata. Set to <code>true</code> to enable
-        or <code>false</code> to disable.
+        checksums to protect OVN metadata. <code>ovn-controller</code>
+        populates this key with the value defined in 
+        <ref table="Open_vSwitch" column="external_ids:ovn-encap-csum"/> column
+        of the Open_vSwitch database's <ref table="Open_vSwitch"
+        db="Open_vSwitch"/> table.  Other applications should treat this key as
+        read-only. See <code>ovn-controller</code>(8) for more information.
       </p>
 
       <p>
-- 
2.9.3



More information about the dev mailing list