diff mbox series

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

Message ID 20221202173147.3032702-4-odivlad@gmail.com
State Changes Requested
Headers show
Series OVN IC bugfixes & proposals/questions | 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. 2, 2022, 5:31 p.m. UTC
Signed-off-by: Vladislav Odintsov <odivlad@gmail.com>
---
 ic/ovn-ic.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Dumitru Ceara Dec. 5, 2022, 4:37 p.m. UTC | #1
On 12/2/22 18:31, Vladislav Odintsov wrote:
> Signed-off-by: Vladislav Odintsov <odivlad@gmail.com>
> ---

Acked-by: Dumitru Ceara <dceara@redhat.com>

Thanks!
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;
                     }