bbaaef
From 44a2c882067553a069c1b294644ebbda50d326c8 Mon Sep 17 00:00:00 2001
bbaaef
From: Numan Siddique <numans@ovn.org>
bbaaef
Date: Wed, 22 Jan 2020 17:58:23 +0530
bbaaef
Subject: [PATCH 1/4] Make is_switch() in lflow.c a util function
bbaaef
bbaaef
This patch renames is_switch() to datapath_is_switch() and moves to
bbaaef
lib/ovn-util.c.
bbaaef
bbaaef
Upcoming patch will make use of it.
bbaaef
bbaaef
Acked-by: Han Zhou <hzhou@ovn.org>
bbaaef
Signed-off-by: Numan Siddique <numans@ovn.org>
bbaaef
bbaaef
(cherry-picked from upstream master commit 280429aaa380da43820961a552fe5e18e07578e5)
bbaaef
bbaaef
Change-Id: I3091105a6cb56857ee2752749c5910f0c9aaa867
bbaaef
---
bbaaef
 ovn/controller/lflow.c | 11 ++---------
bbaaef
 ovn/lib/ovn-util.c     |  6 ++++++
bbaaef
 ovn/lib/ovn-util.h     |  3 ++-
bbaaef
 3 files changed, 10 insertions(+), 10 deletions(-)
bbaaef
bbaaef
diff --git a/ovn/controller/lflow.c b/ovn/controller/lflow.c
bbaaef
index 9dbce91d1..b38a3f38a 100644
bbaaef
--- a/ovn/controller/lflow.c
bbaaef
+++ b/ovn/controller/lflow.c
bbaaef
@@ -128,13 +128,6 @@ is_chassis_resident_cb(const void *c_aux_, const char *port_name)
bbaaef
     }
bbaaef
 }
bbaaef
 
bbaaef
-static bool
bbaaef
-is_switch(const struct sbrec_datapath_binding *ldp)
bbaaef
-{
bbaaef
-    return smap_get(&ldp->external_ids, "logical-switch") != NULL;
bbaaef
-
bbaaef
-}
bbaaef
-
bbaaef
 void
bbaaef
 lflow_resource_init(struct lflow_resource_ref *lfrr)
bbaaef
 {
bbaaef
@@ -682,7 +675,7 @@ consider_logical_flow(
bbaaef
     struct ovnact_encode_params ep = {
bbaaef
         .lookup_port = lookup_port_cb,
bbaaef
         .aux = &aux,
bbaaef
-        .is_switch = is_switch(ldp),
bbaaef
+        .is_switch = datapath_is_switch(ldp),
bbaaef
         .group_table = group_table,
bbaaef
         .meter_table = meter_table,
bbaaef
         .lflow_uuid = lflow->header_.uuid,
bbaaef
@@ -706,7 +699,7 @@ consider_logical_flow(
bbaaef
         if (m->match.wc.masks.conj_id) {
bbaaef
             m->match.flow.conj_id += *conj_id_ofs;
bbaaef
         }
bbaaef
-        if (is_switch(ldp)) {
bbaaef
+        if (datapath_is_switch(ldp)) {
bbaaef
             unsigned int reg_index
bbaaef
                 = (ingress ? MFF_LOG_INPORT : MFF_LOG_OUTPORT) - MFF_REG0;
bbaaef
             int64_t port_id = m->match.flow.regs[reg_index];
bbaaef
diff --git a/ovn/lib/ovn-util.c b/ovn/lib/ovn-util.c
bbaaef
index 91ec3d62e..9b6efdfc6 100644
bbaaef
--- a/ovn/lib/ovn-util.c
bbaaef
+++ b/ovn/lib/ovn-util.c
bbaaef
@@ -405,3 +405,9 @@ ovn_logical_flow_hash(const struct uuid *logical_datapath,
bbaaef
     hash = hash_string(match, hash);
bbaaef
     return hash_string(actions, hash);
bbaaef
 }
bbaaef
+
bbaaef
+bool
bbaaef
+datapath_is_switch(const struct sbrec_datapath_binding *ldp)
bbaaef
+{
bbaaef
+    return smap_get(&ldp->external_ids, "logical-switch") != NULL;
bbaaef
+}
bbaaef
diff --git a/ovn/lib/ovn-util.h b/ovn/lib/ovn-util.h
bbaaef
index 8461db505..f49f91862 100644
bbaaef
--- a/ovn/lib/ovn-util.h
bbaaef
+++ b/ovn/lib/ovn-util.h
bbaaef
@@ -23,6 +23,7 @@ struct sbrec_logical_flow;
bbaaef
 struct uuid;
bbaaef
 struct eth_addr;
bbaaef
 struct sbrec_port_binding;
bbaaef
+struct sbrec_datapath_binding;
bbaaef
 
bbaaef
 struct ipv4_netaddr {
bbaaef
     ovs_be32 addr;            /* 192.168.10.123 */
bbaaef
@@ -85,5 +86,5 @@ uint32_t ovn_logical_flow_hash(const struct uuid *logical_datapath,
bbaaef
                                uint8_t table_id, const char *pipeline,
bbaaef
                                uint16_t priority,
bbaaef
                                const char *match, const char *actions);
bbaaef
-
bbaaef
+bool datapath_is_switch(const struct sbrec_datapath_binding *);
bbaaef
 #endif
bbaaef
-- 
bbaaef
2.26.2
bbaaef