The commit being fixed change enum chassis_tunnel_type from bit-field
values to simple sequential indices to simplify array-based lookups
in future optimizations but some callers were left unchanged this led
to incorrect logging.

Fixes: 16734b82f207 ("ovn-util: Refactor chassis_tunnel_type enum to use 
sequential values.")
Signed-off-by: Alexandra Rukomoinikova <[email protected]>
---
 controller/binding.c | 5 +++--
 controller/chassis.c | 4 ++--
 controller/encaps.c  | 5 +++--
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/controller/binding.c b/controller/binding.c
index de51be823..c2bce665e 100644
--- a/controller/binding.c
+++ b/controller/binding.c
@@ -554,12 +554,13 @@ sbrec_get_port_encap(const struct sbrec_chassis 
*chassis_rec,
     }
 
     struct sbrec_encap *best_encap = NULL;
-    uint32_t best_type = 0;
+    enum chassis_tunnel_type best_type = TUNNEL_TYPE_INVALID;
     for (int i = 0; i < chassis_rec->n_encaps; i++) {
         if ((encap_ip && !strcmp(chassis_rec->encaps[i]->ip, encap_ip)) ||
             (!encap_ip && smap_get_bool(&chassis_rec->encaps[i]->options,
                                         "is_default", false))) {
-            uint32_t tun_type = get_tunnel_type(chassis_rec->encaps[i]->type);
+            enum chassis_tunnel_type tun_type =
+                get_tunnel_type(chassis_rec->encaps[i]->type);
             if (tun_type > best_type) {
                 best_type = tun_type;
                 best_encap = chassis_rec->encaps[i];
diff --git a/controller/chassis.c b/controller/chassis.c
index ea64c9f81..d2149293e 100644
--- a/controller/chassis.c
+++ b/controller/chassis.c
@@ -270,9 +270,9 @@ chassis_parse_ovs_encap_type(const char *encap_type,
     const char *type;
 
     SSET_FOR_EACH (type, encap_type_set) {
-        uint32_t tun_type = get_tunnel_type(type);
+        enum chassis_tunnel_type tun_type = get_tunnel_type(type);
 
-        if (!tun_type) {
+        if (tun_type == TUNNEL_TYPE_INVALID) {
             VLOG_INFO_RL(&rl, "Unknown tunnel type: %s", type);
         }
     }
diff --git a/controller/encaps.c b/controller/encaps.c
index 61ae55965..0452b91e0 100644
--- a/controller/encaps.c
+++ b/controller/encaps.c
@@ -398,9 +398,10 @@ chassis_tunnel_add(const struct sbrec_chassis *chassis_rec,
         return tuncnt;
     }
 
-    uint32_t pref_type = get_tunnel_type(encap->type);
+    enum chassis_tunnel_type pref_type = get_tunnel_type(encap->type);
     for (int i = 0; i < chassis_rec->n_encaps; i++) {
-        uint32_t tun_type = get_tunnel_type(chassis_rec->encaps[i]->type);
+        enum chassis_tunnel_type tun_type =
+            get_tunnel_type(chassis_rec->encaps[i]->type);
         if (tun_type != pref_type) {
             continue;
         }
-- 
2.48.1

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to