diff mbox series

[ovs-dev,RFC,3/7] ic: lookup southbound port_binding only if needed

Message ID 20221118162050.3019353-4-odivlad@gmail.com
State RFC
Headers show
Series OVN IC bugfixes & proposals/questions | expand

Commit Message

Vladislav Odintsov Nov. 18, 2022, 4:20 p.m. UTC
Signed-off-by: Vladislav Odintsov <odivlad@gmail.com>
---
 ic/ovn-ic.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/ic/ovn-ic.c b/ic/ovn-ic.c
index b3790e965..3e02b4c98 100644
--- a/ic/ovn-ic.c
+++ b/ic/ovn-ic.c
@@ -757,6 +757,7 @@  port_binding_run(struct ic_context *ctx,
     }
     icsbrec_port_binding_index_destroy_row(isb_pb_key);
 
+    const struct sbrec_port_binding *sb_pb;
     const struct icnbrec_transit_switch *ts;
     ICNBREC_TRANSIT_SWITCH_FOR_EACH (ts, ctx->ovninb_idl) {
         const struct nbrec_logical_switch *ls = find_ts_in_nb(ctx, ts->name);
@@ -788,9 +789,9 @@  port_binding_run(struct ic_context *ctx,
         for (int i = 0; i < ls->n_ports; i++) {
             lsp = ls->ports[i];
 
-            const struct sbrec_port_binding *sb_pb = find_lsp_in_sb(ctx, lsp);
             if (!strcmp(lsp->type, "router")) {
                 /* The port is local. */
+                sb_pb = find_lsp_in_sb(ctx, lsp);
                 if (!sb_pb) {
                     continue;
                 }
@@ -807,6 +808,7 @@  port_binding_run(struct ic_context *ctx,
                 if (!isb_pb) {
                     nbrec_logical_switch_update_ports_delvalue(ls, lsp);
                 } else {
+                    sb_pb = find_lsp_in_sb(ctx, lsp);
                     if (!sb_pb) {
                         continue;
                     }