Once the set of OVN ports is computed (in memory) in ovn-northd, there's
no need to ever prefer OVN ports that are unbound (no SB datapath linked
to them) in later stages.  They're actually removed after the set of
ports is built in build_ports().

The only case in which "not bound" ports were potentially found and
returned while "bound" versions of the ports also existed was when
connecting logical switch and router peer ports together,
ovn_port_get_peer(), in build_ports() potentially causing issues (and
logical flows to be partially recomputed in subsequent iterations of
ovn-northd.

Fixes: 7b404e68b5b8 ("northd: Fix duplicate logical port detection.")
Signed-off-by: Dumitru Ceara <dce...@redhat.com>
---
 northd/northd.c | 28 +++++++---------------------
 1 file changed, 7 insertions(+), 21 deletions(-)

diff --git a/northd/northd.c b/northd/northd.c
index 12c120a2f9..132a87938f 100644
--- a/northd/northd.c
+++ b/northd/northd.c
@@ -1109,13 +1109,11 @@ ovn_port_destroy(struct hmap *ports, struct ovn_port 
*port)
     }
 }
 
-/* Returns the ovn_port that matches 'name'.  If 'prefer_bound' is true and
- * multiple ports share the same name, gives precendence to ports bound to
- * an ovn_datapath.
+/* Returns the ovn_port that matches 'name'.  If multiple ports share the
+ * same name, gives precendence to ports bound to an ovn_datapath.
  */
-static struct ovn_port *
-ovn_port_find__(const struct hmap *ports, const char *name,
-                bool prefer_bound)
+struct ovn_port *
+ovn_port_find(const struct hmap *ports, const char *name)
 {
     struct ovn_port *matched_op = NULL;
     struct ovn_port *op;
@@ -1123,7 +1121,7 @@ ovn_port_find__(const struct hmap *ports, const char 
*name,
     HMAP_FOR_EACH_WITH_HASH (op, key_node, hash_string(name, 0), ports) {
         if (!strcmp(op->key, name)) {
             matched_op = op;
-            if (!prefer_bound || op->od) {
+            if (op->od) {
                 return op;
             }
         }
@@ -1131,18 +1129,6 @@ ovn_port_find__(const struct hmap *ports, const char 
*name,
     return matched_op;
 }
 
-struct ovn_port *
-ovn_port_find(const struct hmap *ports, const char *name)
-{
-    return ovn_port_find__(ports, name, false);
-}
-
-static struct ovn_port *
-ovn_port_find_bound(const struct hmap *ports, const char *name)
-{
-    return ovn_port_find__(ports, name, true);
-}
-
 static bool
 lsp_is_clone_to_unknown(const struct nbrec_logical_switch_port *nbsp)
 {
@@ -1515,7 +1501,7 @@ join_logical_ports_lsp(struct hmap *ports,
                        struct hmap *tag_alloc_table,
                        struct hmapx *mirror_attached_ports)
 {
-    struct ovn_port *op = ovn_port_find_bound(ports, name);
+    struct ovn_port *op = ovn_port_find(ports, name);
     if (op && (op->od || op->nbsp || op->nbrp)) {
         static struct vlog_rate_limit rl
             = VLOG_RATE_LIMIT_INIT(5, 1);
@@ -1610,7 +1596,7 @@ join_logical_ports_lrp(struct hmap *ports,
       return NULL;
     }
 
-    struct ovn_port *op = ovn_port_find_bound(ports, name);
+    struct ovn_port *op = ovn_port_find(ports, name);
     if (op && (op->od || op->nbsp || op->nbrp)) {
         static struct vlog_rate_limit rl
             = VLOG_RATE_LIMIT_INIT(5, 1);
-- 
2.50.1

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to