Introduce bfd_sync_data as private structure for en_bfd_sync node. Introduce bfd_sync_init and bfd_sync_destroy utility routines Build bfd_port sset in bfd_table_sync().
Signed-off-by: Lorenzo Bianconi <lorenzo.bianc...@redhat.com> --- northd/en-lflow.c | 5 +++-- northd/en-northd.c | 15 ++++++++------- northd/northd.c | 18 +++++++++++++++++- northd/northd.h | 11 ++++++++++- 4 files changed, 38 insertions(+), 11 deletions(-) diff --git a/northd/en-lflow.c b/northd/en-lflow.c index f9d7f2459..421fcd48c 100644 --- a/northd/en-lflow.c +++ b/northd/en-lflow.c @@ -42,7 +42,8 @@ lflow_get_input_data(struct engine_node *node, struct lflow_input *lflow_input) { struct northd_data *northd_data = engine_get_input_data("northd", node); - struct bfd_data *bfd_data = engine_get_input_data("bfd_sync", node); + struct bfd_sync_data *bfd_sync_data = + engine_get_input_data("bfd_sync", node); struct static_routes_data *static_routes_data = engine_get_input_data("static_routes", node); struct route_policies_data *route_policies_data = @@ -82,7 +83,7 @@ lflow_get_input_data(struct engine_node *node, lflow_input->meter_groups = &sync_meters_data->meter_groups; lflow_input->lb_datapaths_map = &northd_data->lb_datapaths_map; lflow_input->svc_monitor_map = &northd_data->svc_monitor_map; - lflow_input->bfd_connections = &bfd_data->bfd_connections; + lflow_input->bfd_connections = &bfd_sync_data->bfd_connections; lflow_input->parsed_routes = &static_routes_data->parsed_routes; lflow_input->route_tables = &static_routes_data->route_tables; lflow_input->route_policies = &route_policies_data->route_policies; diff --git a/northd/en-northd.c b/northd/en-northd.c index 63f93bbf4..dee6c0f03 100644 --- a/northd/en-northd.c +++ b/northd/en-northd.c @@ -392,15 +392,16 @@ en_bfd_sync_run(struct engine_node *node, void *data) = engine_get_input_data("static_routes", node); const struct nbrec_bfd_table *nbrec_bfd_table = EN_OVSDB_GET(engine_get_input("NB_bfd", node)); - struct bfd_data *bfd_sync_data = data; + struct bfd_sync_data *bfd_sync_data = data; - bfd_destroy(data); - bfd_init(data); + bfd_sync_destroy(data); + bfd_sync_init(data); bfd_table_sync(eng_ctx->ovnsb_idl_txn, nbrec_bfd_table, &northd_data->lr_ports, &bfd_data->bfd_connections, &route_policies_data->bfd_active_connections, &static_routes_data->bfd_active_connections, - &bfd_sync_data->bfd_connections); + &bfd_sync_data->bfd_connections, + &bfd_sync_data->bfd_ports); engine_set_node_state(node, EN_UPDATED); } @@ -468,8 +469,8 @@ void *en_bfd_sync_init(struct engine_node *node OVS_UNUSED, struct engine_arg *arg OVS_UNUSED) { - struct bfd_data *data = xzalloc(sizeof *data); - bfd_init(data); + struct bfd_sync_data *data = xzalloc(sizeof *data); + bfd_sync_init(data); return data; } @@ -553,7 +554,7 @@ en_bfd_cleanup(void *data) void en_bfd_sync_cleanup(void *data) { - bfd_destroy(data); + bfd_sync_destroy(data); } void diff --git a/northd/northd.c b/northd/northd.c index 7ceed63dd..2009da3d0 100644 --- a/northd/northd.c +++ b/northd/northd.c @@ -10541,7 +10541,8 @@ bfd_table_sync(struct ovsdb_idl_txn *ovnsb_txn, const struct hmap *bfd_connections, const struct hmap *rp_bfd_connections, const struct hmap *sr_bfd_connections, - struct hmap *sync_bfd_connections) + struct hmap *sync_bfd_connections, + struct sset *bfd_ports) { if (!ovnsb_txn) { return; @@ -10624,6 +10625,7 @@ bfd_table_sync(struct ovsdb_idl_txn *ovnsb_txn, } } + sset_add(bfd_ports, nb_bt->logical_port); bfd_e->stale = false; } @@ -18796,6 +18798,13 @@ bfd_init(struct bfd_data *data) hmap_init(&data->bfd_connections); } +void +bfd_sync_init(struct bfd_sync_data *data) +{ + hmap_init(&data->bfd_connections); + sset_init(&data->bfd_ports); +} + void ecmp_nexthop_init(struct ecmp_nexthop_data *data) { @@ -18858,6 +18867,13 @@ bfd_destroy(struct bfd_data *data) __bfd_destroy(&data->bfd_connections); } +void +bfd_sync_destroy(struct bfd_sync_data *data) +{ + __bfd_destroy(&data->bfd_connections); + sset_destroy(&data->bfd_ports); +} + void route_policies_destroy(struct route_policies_data *data) { diff --git a/northd/northd.h b/northd/northd.h index c7f0b829b..39a16c092 100644 --- a/northd/northd.h +++ b/northd/northd.h @@ -195,6 +195,11 @@ struct bfd_data { struct hmap bfd_connections; }; +struct bfd_sync_data { + struct hmap bfd_connections; + struct sset bfd_ports; +}; + struct ecmp_nexthop_data { struct simap nexthops; }; @@ -743,6 +748,9 @@ void static_routes_destroy(struct static_routes_data *); void bfd_init(struct bfd_data *); void bfd_destroy(struct bfd_data *); +void bfd_sync_init(struct bfd_sync_data *); +void bfd_sync_destroy(struct bfd_sync_data *); + void build_ecmp_nexthop_table(struct ovsdb_idl_txn *, struct hmap *, struct simap *, const struct sbrec_ecmp_nexthop_table *); @@ -790,7 +798,8 @@ void build_route_policies(struct ovn_datapath *, const struct hmap *, const struct hmap *, struct hmap *, struct hmap *); void bfd_table_sync(struct ovsdb_idl_txn *, const struct nbrec_bfd_table *, const struct hmap *, const struct hmap *, - const struct hmap *, const struct hmap *, struct hmap *); + const struct hmap *, const struct hmap *, struct hmap *, + struct sset *); void build_bfd_map(const struct nbrec_bfd_table *, const struct sbrec_bfd_table *, struct hmap *); void run_update_worker_pool(int n_threads); -- 2.46.0 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev