This will be later used for incremental processing route changes.

Acked-by: Dumitru Ceara <dce...@redhat.com>
Signed-off-by: Felix Huettner <felix.huettner@stackit.cloud>
---
 northd/en-group-ecmp-route.c |  3 +++
 northd/en-group-ecmp-route.h |  3 +++
 northd/northd.c              | 27 +++++++++++++++------------
 3 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/northd/en-group-ecmp-route.c b/northd/en-group-ecmp-route.c
index fa656c656..c55bbdd8b 100644
--- a/northd/en-group-ecmp-route.c
+++ b/northd/en-group-ecmp-route.c
@@ -17,6 +17,7 @@
 #include <config.h>
 #include <stdbool.h>
 
+#include "northd/lflow-mgr.h"
 #include "openvswitch/vlog.h"
 #include "stopwatch.h"
 #include "northd.h"
@@ -67,6 +68,7 @@ group_node_free(struct group_ecmp_datapath *n)
 
     unique_routes_destroy(&n->unique_routes);
     ecmp_groups_destroy(&n->ecmp_groups);
+    lflow_ref_destroy(n->lflow_ref);
     free(n);
 }
 
@@ -145,6 +147,7 @@ group_ecmp_datapath_add(struct group_ecmp_route_data *data,
     size_t hash = uuid_hash(&od->key);
     struct group_ecmp_datapath *n = xmalloc(sizeof *n);
     n->od = od;
+    n->lflow_ref = lflow_ref_create();
     hmap_init(&n->ecmp_groups);
     hmap_init(&n->unique_routes);
     hmap_insert(&data->datapaths, &n->hmap_node, hash);
diff --git a/northd/en-group-ecmp-route.h b/northd/en-group-ecmp-route.h
index c4f732c31..b85e6014e 100644
--- a/northd/en-group-ecmp-route.h
+++ b/northd/en-group-ecmp-route.h
@@ -54,6 +54,9 @@ struct group_ecmp_datapath {
     /* The datapath for which this node is relevant. */
     const struct ovn_datapath *od;
 
+    /* The lflow ref for all routes of this datapath. */
+    struct lflow_ref *lflow_ref;
+
     /* Contains all routes that are part of an ecmp group.
      * Contains struct ecmp_groups_node. */
     struct hmap ecmp_groups;
diff --git a/northd/northd.c b/northd/northd.c
index ee25b7f1e..99e1fd72f 100644
--- a/northd/northd.c
+++ b/northd/northd.c
@@ -13861,21 +13861,20 @@ static void
 build_route_flows_for_lrouter(
         struct ovn_datapath *od, struct lflow_table *lflows,
         const struct group_ecmp_route_data *route_data,
-        struct simap *route_tables, const struct sset *bfd_ports,
-        struct lflow_ref *lflow_ref)
+        struct simap *route_tables, const struct sset *bfd_ports)
 {
     ovs_assert(od->nbr);
     ovn_lflow_add_default_drop(lflows, od, S_ROUTER_IN_IP_ROUTING_ECMP,
-                               lflow_ref);
+                               NULL);
     ovn_lflow_add_default_drop(lflows, od, S_ROUTER_IN_IP_ROUTING,
-                               lflow_ref);
+                               NULL);
     ovn_lflow_add(lflows, od, S_ROUTER_IN_IP_ROUTING_ECMP, 150,
                   REG_ECMP_GROUP_ID" == 0", "next;",
-                  lflow_ref);
+                  NULL);
 
     for (int i = 0; i < od->nbr->n_ports; i++) {
         build_route_table_lflow(od, lflows, od->nbr->ports[i],
-                                route_tables, lflow_ref);
+                                route_tables, NULL);
     }
 
     const struct group_ecmp_datapath *route_node =
@@ -13888,20 +13887,24 @@ build_route_flows_for_lrouter(
     HMAP_FOR_EACH (group, hmap_node, &route_node->ecmp_groups) {
         /* add a flow in IP_ROUTING, and one flow for each member in
          * IP_ROUTING_ECMP. */
-        build_ecmp_route_flow(lflows, od, group, lflow_ref, NULL);
+        build_ecmp_route_flow(lflows, od, group, route_node->lflow_ref, NULL);
 
         /* If src or dst port is specified for selection_fields, install
          * separate ECMP flows with protocol match of TCP, UDP and SCTP */
         if (sset_contains(&group->selection_fields, "tp_src") ||
             sset_contains(&group->selection_fields, "tp_dst")) {
-            build_ecmp_route_flow(lflows, od, group, lflow_ref, "tcp");
-            build_ecmp_route_flow(lflows, od, group, lflow_ref, "udp");
-            build_ecmp_route_flow(lflows, od, group, lflow_ref, "sctp");
+            build_ecmp_route_flow(lflows, od, group,
+                                  route_node->lflow_ref, "tcp");
+            build_ecmp_route_flow(lflows, od, group,
+                                  route_node->lflow_ref, "udp");
+            build_ecmp_route_flow(lflows, od, group,
+                                  route_node->lflow_ref, "sctp");
         }
     }
     const struct unique_routes_node *ur;
     HMAP_FOR_EACH (ur, hmap_node, &route_node->unique_routes) {
-        build_route_flow(lflows, od, ur->route, bfd_ports, lflow_ref);
+        build_route_flow(lflows, od, ur->route, bfd_ports,
+                         route_node->lflow_ref);
     }
 }
 
@@ -17512,7 +17515,7 @@ build_lswitch_and_lrouter_iterate_by_lr(struct 
ovn_datapath *od,
     build_ip_routing_pre_flows_for_lrouter(od, lsi->lflows, NULL);
     build_route_flows_for_lrouter(od, lsi->lflows,
                                   lsi->route_data, lsi->route_tables,
-                                  lsi->bfd_ports, NULL);
+                                  lsi->bfd_ports);
     build_mcast_lookup_flows_for_lrouter(od, lsi->lflows, &lsi->match, NULL);
     build_ingress_policy_flows_for_lrouter(od, lsi->lflows, lsi->lr_ports,
                                            lsi->route_policies, NULL);
-- 
2.48.1


_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to