Skip to content

Commit

Permalink
northd: Get rid of bfd_connections in bfd_sync_data.
Browse files Browse the repository at this point in the history
Remove bfd_connections hmap in bfd_sync_data structure and make it local
to bfd_table_sync routine since it is no longer used in lflow codebase.

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Han Zhou <hzhou@ovn.org>
  • Loading branch information
LorenzoBianconi authored and hzhou8 committed Aug 23, 2024
1 parent bad91e3 commit 01119a5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
1 change: 0 additions & 1 deletion northd/en-northd.c
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,6 @@ en_bfd_sync_run(struct engine_node *node, void *data)
&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_ports);
engine_set_node_state(node, EN_UPDATED);
}
Expand Down
14 changes: 6 additions & 8 deletions northd/northd.c
Original file line number Diff line number Diff line change
Expand Up @@ -10534,18 +10534,18 @@ 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 sset *bfd_ports)
{
if (!ovnsb_txn) {
return;
}

unsigned long *bfd_src_ports = bitmap_allocate(BFD_UDP_SRC_PORT_LEN);
struct hmap sync_bfd_connections = HMAP_INITIALIZER(&sync_bfd_connections);

struct bfd_entry *bfd_e;
HMAP_FOR_EACH (bfd_e, hmap_node, bfd_connections) {
struct bfd_entry *e = bfd_alloc_entry(sync_bfd_connections,
struct bfd_entry *e = bfd_alloc_entry(&sync_bfd_connections,
bfd_e->logical_port,
bfd_e->dst_ip, bfd_e->status);
e->nb_bt = bfd_e->nb_bt;
Expand All @@ -10560,7 +10560,7 @@ bfd_table_sync(struct ovsdb_idl_txn *ovnsb_txn,

const struct nbrec_bfd *nb_bt;
NBREC_BFD_TABLE_FOR_EACH (nb_bt, nbrec_bfd_table) {
bfd_e = bfd_port_lookup(sync_bfd_connections, nb_bt->logical_port,
bfd_e = bfd_port_lookup(&sync_bfd_connections, nb_bt->logical_port,
nb_bt->dst_ip);
if (!bfd_e) {
continue;
Expand Down Expand Up @@ -10622,13 +10622,13 @@ bfd_table_sync(struct ovsdb_idl_txn *ovnsb_txn,
bfd_e->stale = false;
}

HMAP_FOR_EACH_SAFE (bfd_e, hmap_node, sync_bfd_connections) {
HMAP_FOR_EACH_POP (bfd_e, hmap_node, &sync_bfd_connections) {
if (bfd_e->stale) {
hmap_remove(sync_bfd_connections, &bfd_e->hmap_node);
sbrec_bfd_delete(bfd_e->sb_bt);
bfd_erase_entry(bfd_e);
}
bfd_erase_entry(bfd_e);
}
hmap_destroy(&sync_bfd_connections);

bitmap_free(bfd_src_ports);
}
Expand Down Expand Up @@ -18793,7 +18793,6 @@ bfd_init(struct bfd_data *data)
void
bfd_sync_init(struct bfd_sync_data *data)
{
hmap_init(&data->bfd_connections);
sset_init(&data->bfd_ports);
}

Expand Down Expand Up @@ -18862,7 +18861,6 @@ bfd_destroy(struct bfd_data *data)
void
bfd_sync_destroy(struct bfd_sync_data *data)
{
__bfd_destroy(&data->bfd_connections);
sset_destroy(&data->bfd_ports);
}

Expand Down
3 changes: 1 addition & 2 deletions northd/northd.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ struct bfd_data {
};

struct bfd_sync_data {
struct hmap bfd_connections;
struct sset bfd_ports;
};

Expand Down Expand Up @@ -798,7 +797,7 @@ 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 sset *);
void build_bfd_map(const struct nbrec_bfd_table *,
const struct sbrec_bfd_table *, struct hmap *);
Expand Down

0 comments on commit 01119a5

Please sign in to comment.