This will be later used for incremental processing route changes.
Signed-off-by: Felix Huettner <[email protected]>
---
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 d930905a5..08edd5e00 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/list.h"
#include "openvswitch/vlog.h"
#include "stopwatch.h"
@@ -76,6 +77,7 @@ group_node_free(struct group_ecmp_route_node *n)
unique_routes_destroy(&n->unique_routes);
ecmp_groups_destroy(&n->ecmp_groups);
+ lflow_ref_destroy(n->lflow_ref);
free(n);
}
@@ -153,6 +155,7 @@ group_ecmp_route_add(struct group_ecmp_route_data *data,
size_t hash = uuid_hash(&od->key);
struct group_ecmp_route_node *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->routes, &n->hmap_node, hash);
diff --git a/northd/en-group-ecmp-route.h b/northd/en-group-ecmp-route.h
index 0da8fa88c..8d2d8bb3d 100644
--- a/northd/en-group-ecmp-route.h
+++ b/northd/en-group-ecmp-route.h
@@ -52,6 +52,9 @@ struct group_ecmp_route_node {
/* 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 893e4c8fb..45e43ce37 100644
--- a/northd/northd.c
+++ b/northd/northd.c
@@ -13823,21 +13823,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_route_node *route_node =
@@ -13850,20 +13849,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);
}
}
@@ -17474,7 +17477,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
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev