This is a preliminary patch to reduce load balancer logical flows
computation cost.

Signed-off-by: Lorenzo Bianconi <[email protected]>
---
 northd/northd.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/northd/northd.c b/northd/northd.c
index 4efe6b810..5992f5543 100644
--- a/northd/northd.c
+++ b/northd/northd.c
@@ -9987,6 +9987,10 @@ build_lrouter_nat_flows_for_lb(struct ovn_lb_vip *lb_vip,
             "flags.force_snat_for_lb = 1; next;",
             lflows, prio, meter_groups);
 
+    build_gw_lrouter_nat_flows_for_lb(lb, gw_router, n_gw_router,
+            reject, new_match, ds_cstr(action), est_match,
+            "next;", lflows, prio, meter_groups);
+
     for (size_t i = 0; i < lb->n_nb_lr; i++) {
         struct ovn_datapath *od = lb->nb_lr[i];
         char *new_match_p = new_match;
@@ -10047,12 +10051,14 @@ build_lrouter_nat_flows_for_lb(struct ovn_lb_vip 
*lb_vip,
                                         &lb->nlb->header_);
             }
         } else {
-            ovn_lflow_add_with_hint__(lflows, od, S_ROUTER_IN_DNAT, prio,
-                                      new_match_p, ds_cstr(action), NULL,
-                                      meter, &lb->nlb->header_);
-            ovn_lflow_add_with_hint(lflows, od, S_ROUTER_IN_DNAT, prio,
-                                    est_match_p, "next;",
-                                    &lb->nlb->header_);
+            if (od->n_l3dgw_ports) {
+                ovn_lflow_add_with_hint__(lflows, od, S_ROUTER_IN_DNAT, prio,
+                                          new_match_p, ds_cstr(action), NULL,
+                                          meter, &lb->nlb->header_);
+                ovn_lflow_add_with_hint(lflows, od, S_ROUTER_IN_DNAT, prio,
+                                        est_match_p, "next;",
+                                        &lb->nlb->header_);
+            }
         }
 
         if (new_match_p != new_match) {
-- 
2.35.3

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to