diff mbox series

[ovs-dev,v2,2/4] ic: lookup southbound port_binding only if needed

Message ID 20221206102001.3058710-3-odivlad@gmail.com
State Changes Requested
Headers show
Series OVN IC multiple same routes fixes | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/github-robot-_ovn-kubernetes success github build: passed

Commit Message

Vladislav Odintsov Dec. 6, 2022, 10:19 a.m. UTC
Signed-off-by: Vladislav Odintsov <odivlad@gmail.com>
Acked-by: Dumitru Ceara <dceara@redhat.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 d3bc08761..9e2369fef 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;
                     }