This function already existed as a private function in
en-datapath-sync.c. This commit makes it callable from outside the
function, as a counterpart to the existing ovn_datapath_from_sbrec()
function.

Signed-off-by: Mark Michelson <[email protected]>
---
 northd/datapath-sync.c    | 27 +++++++++++++++++++++++++++
 northd/datapath-sync.h    |  4 ++++
 northd/en-datapath-sync.c | 29 +----------------------------
 3 files changed, 32 insertions(+), 28 deletions(-)

diff --git a/northd/datapath-sync.c b/northd/datapath-sync.c
index 459d304e6..b4296c4dc 100644
--- a/northd/datapath-sync.c
+++ b/northd/datapath-sync.c
@@ -17,6 +17,7 @@
 
 #include "datapath-sync.h"
 #include "ovsdb-idl-provider.h"
+#include "ovn-sb-idl.h"
 #include "uuid.h"
 
 static const char *ovn_datapath_strings[] = {
@@ -141,3 +142,29 @@ ovn_unsynced_datapath_map_clear_tracked_data(
         hmapx_delete(&map->deleted, node);
     }
 }
+
+struct ovn_synced_datapath *
+ovn_synced_datapath_from_sb(const struct ovn_synced_datapaths *datapaths,
+                            const struct sbrec_datapath_binding *sb_dp)
+{
+    struct ovn_synced_datapath *sdp;
+    struct uuid nb_uuid;
+
+    /* Don't reference sb_dp->nb_uuid directly here. The nb_uuid column was
+     * a later addition to the Datapath_Binding table. We might be
+     * referencing a record that does not have this column set, so use
+     * the helper function instead.
+     */
+    if (!datapath_get_nb_uuid(sb_dp, &nb_uuid)) {
+        return NULL;
+    }
+
+    uint32_t hash = uuid_hash(&nb_uuid);
+    HMAP_FOR_EACH_WITH_HASH (sdp, hmap_node, hash, &datapaths->synced_dps) {
+        if (uuid_equals(&sdp->nb_row->uuid, &nb_uuid)) {
+            return sdp;
+        }
+    }
+
+    return NULL;
+}
diff --git a/northd/datapath-sync.h b/northd/datapath-sync.h
index 49eb008ed..73c874b37 100644
--- a/northd/datapath-sync.h
+++ b/northd/datapath-sync.h
@@ -120,4 +120,8 @@ ovn_unsynced_datapath_find(const struct 
ovn_unsynced_datapath_map *,
 void ovn_unsynced_datapath_map_clear_tracked_data(
     struct ovn_unsynced_datapath_map *);
 
+struct ovn_synced_datapath *
+ovn_synced_datapath_from_sb(const struct ovn_synced_datapaths *datapaths,
+                            const struct sbrec_datapath_binding *sb_dp);
+
 #endif /* DATAPATH_SYNC_H */
diff --git a/northd/en-datapath-sync.c b/northd/en-datapath-sync.c
index 227021e63..7c5c6830c 100644
--- a/northd/en-datapath-sync.c
+++ b/northd/en-datapath-sync.c
@@ -97,32 +97,6 @@ find_synced_datapath_from_udp(
     return NULL;
 }
 
-static struct ovn_synced_datapath *
-find_synced_datapath_from_sb(const struct hmap *datapaths,
-                             const struct sbrec_datapath_binding *sb_dp)
-{
-    struct ovn_synced_datapath *sdp;
-    struct uuid nb_uuid;
-
-    /* Don't reference sb_dp->nb_uuid directly here. The nb_uuid column was
-     * a later addition to the Datapath_Binding table. We might be
-     * referencing a record that does not have this column set, so use
-     * the helper function instead.
-     */
-    if (!datapath_get_nb_uuid(sb_dp, &nb_uuid)) {
-        return NULL;
-    }
-
-    uint32_t hash = uuid_hash(&nb_uuid);
-    HMAP_FOR_EACH_WITH_HASH (sdp, hmap_node, hash, datapaths) {
-        if (uuid_equals(&sdp->nb_row->uuid, &nb_uuid)) {
-            return sdp;
-        }
-    }
-
-    return NULL;
-}
-
 struct candidate_sdp {
     struct ovn_synced_datapath *sdp;
     uint32_t requested_tunnel_key;
@@ -524,8 +498,7 @@ datapath_sync_sb_datapath_binding(struct engine_node *node, 
void *data)
             return EN_UNHANDLED;
         }
         struct ovn_synced_datapath *sdp =
-            find_synced_datapath_from_sb(
-                    &all_dps->synced_dps[dp_type].synced_dps, sb_dp);
+            ovn_synced_datapath_from_sb(&all_dps->synced_dps[dp_type], sb_dp);
         if (sbrec_datapath_binding_is_deleted(sb_dp)) {
             if (sdp) {
                 /* The SB datapath binding was deleted, but we still have a
-- 
2.51.1

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

Reply via email to