diff mbox series

[ovs-dev,v3,1/3] ic: process only local port_bindings

Message ID 20210917214945.10284-2-odivlad@gmail.com
State Superseded, archived
Headers show
Series Add multiple routing tables support to Logical Routers | expand

Checks

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

Commit Message

Vladislav Odintsov Sept. 17, 2021, 9:49 p.m. UTC
This commit adds a small optimization by utilizing ovsdb_index
to iterate over port_bindings.
Prior to this change each iteration checked availability_zone
and continued processing only if port_binding belons to local AZ.

Now we run against port_bindings from local AZ only and don't check
availability_zone.

Signed-off-by: Vladislav Odintsov <odivlad@gmail.com>
---
 ic/ovn-ic.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

Comments

0-day Robot Sept. 17, 2021, 10 p.m. UTC | #1
Bleep bloop.  Greetings Vladislav Odintsov, I am a robot and I have tried out your patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


checkpatch:
WARNING: Line is 80 characters long (recommended limit is 79)
#48 FILE: ic/ovn-ic.c:1398:
                                             ctx->icsbrec_port_binding_by_ts_az)

Lines checked: 75, Warnings: 1, Errors: 0


Please check this out.  If you feel there has been an error, please email aconole@redhat.com

Thanks,
0-day Robot
diff mbox series

Patch

diff --git a/ic/ovn-ic.c b/ic/ovn-ic.c
index 99356253d..92c83d730 100644
--- a/ic/ovn-ic.c
+++ b/ic/ovn-ic.c
@@ -68,6 +68,7 @@  struct ic_context {
     struct ovsdb_idl_index *sbrec_port_binding_by_name;
     struct ovsdb_idl_index *icsbrec_port_binding_by_az;
     struct ovsdb_idl_index *icsbrec_port_binding_by_ts;
+    struct ovsdb_idl_index *icsbrec_port_binding_by_ts_az;
     struct ovsdb_idl_index *icsbrec_route_by_ts;
     struct ovsdb_idl_index *icsbrec_route_by_ts_az;
 };
@@ -1386,17 +1387,15 @@  route_run(struct ic_context *ctx,
         const struct icsbrec_port_binding *isb_pb;
         const struct icsbrec_port_binding *isb_pb_key =
             icsbrec_port_binding_index_init_row(
-                ctx->icsbrec_port_binding_by_ts);
+                ctx->icsbrec_port_binding_by_ts_az);
         icsbrec_port_binding_index_set_transit_switch(isb_pb_key, ts->name);
+        icsbrec_port_binding_index_set_availability_zone(isb_pb_key, az);
 
         /* Each port on TS maps to a logical router, which is stored in the
          * external_ids:router-id of the IC SB port_binding record. */
         ICSBREC_PORT_BINDING_FOR_EACH_EQUAL (isb_pb, isb_pb_key,
-                                             ctx->icsbrec_port_binding_by_ts) {
-            if (isb_pb->availability_zone != az) {
-                continue;
-            }
-
+                                             ctx->icsbrec_port_binding_by_ts_az)
+        {
             const char *ts_lrp_name =
                 get_lrp_name_by_ts_port_name(ctx, isb_pb->logical_port);
             if (!ts_lrp_name) {
@@ -1713,6 +1712,11 @@  main(int argc, char *argv[])
         = ovsdb_idl_index_create1(ovnisb_idl_loop.idl,
                                   &icsbrec_port_binding_col_transit_switch);
 
+    struct ovsdb_idl_index *icsbrec_port_binding_by_ts_az
+        = ovsdb_idl_index_create2(ovnisb_idl_loop.idl,
+                                  &icsbrec_port_binding_col_transit_switch,
+                                  &icsbrec_port_binding_col_availability_zone);
+
     struct ovsdb_idl_index *icsbrec_route_by_ts
         = ovsdb_idl_index_create1(ovnisb_idl_loop.idl,
                                   &icsbrec_route_col_transit_switch);
@@ -1763,6 +1767,7 @@  main(int argc, char *argv[])
                 .sbrec_chassis_by_name = sbrec_chassis_by_name,
                 .icsbrec_port_binding_by_az = icsbrec_port_binding_by_az,
                 .icsbrec_port_binding_by_ts = icsbrec_port_binding_by_ts,
+                .icsbrec_port_binding_by_ts_az = icsbrec_port_binding_by_ts_az,
                 .icsbrec_route_by_ts = icsbrec_route_by_ts,
                 .icsbrec_route_by_ts_az = icsbrec_route_by_ts_az,
             };