Skip to content

Commit

Permalink
support dedicated bfd lrp
Browse files Browse the repository at this point in the history
Signed-off-by: zhangzujian <[email protected]>
  • Loading branch information
zhangzujian committed Nov 1, 2024
1 parent 07dd76b commit 8079885
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
13 changes: 8 additions & 5 deletions controller/pinctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -7561,15 +7561,18 @@ bfd_monitor_run(struct ovsdb_idl_txn *ovnsb_idl_txn,
continue;
}

bool bfd_only = smap_get_bool(&pb->options, "bfd-only", false);
const char *peer_s = smap_get(&pb->options, "peer");
if (!peer_s) {
if (!peer_s && !bfd_only) {
continue;
}

const struct sbrec_port_binding *peer
= lport_lookup_by_name(sbrec_port_binding_by_name, peer_s);
if (!peer) {
continue;
if (peer_s && !bfd_only) {
const struct sbrec_port_binding *peer
= lport_lookup_by_name(sbrec_port_binding_by_name, peer_s);
if (!peer) {
continue;
}
}

char *redirect_name = xasprintf("cr-%s", pb->logical_port);
Expand Down
19 changes: 15 additions & 4 deletions northd/northd.c
Original file line number Diff line number Diff line change
Expand Up @@ -3905,6 +3905,11 @@ sync_pb_for_lrp(struct ovn_port *op,
smap_add(&new, "ipv6_ra_pd_list", ipv6_pd_list);
}

const bool bfd_only = smap_get_bool(&op->nbrp->options, "bfd-only", false);
if (bfd_only) {
smap_add(&new, "bfd-only", "true");
}

sbrec_port_binding_set_options(op->sb, &new);
smap_destroy(&new);
}
Expand Down Expand Up @@ -10259,6 +10264,7 @@ static struct ovs_mutex bfd_lock = OVS_MUTEX_INITIALIZER;

static bool check_bfd_state(
const struct nbrec_logical_router_policy *rule,
const struct hmap *lr_ports,
const struct hmap *bfd_connections,
struct ovn_port *out_port,
const char *nexthop)
Expand All @@ -10284,7 +10290,11 @@ static bool check_bfd_state(
}

if (strcmp(nb_bt->logical_port, out_port->key)) {
continue;
struct ovn_port *op = ovn_port_find(lr_ports, nb_bt->logical_port);
if (!op || !op->nbrp ||
!smap_get_bool(&op->nbrp->options, "bfd-only", false)) {
continue;
}
}

struct bfd_entry *bfd_e = bfd_port_lookup(bfd_connections,
Expand Down Expand Up @@ -10338,7 +10348,8 @@ build_routing_policy_flow(struct lflow_table *lflows, struct ovn_datapath *od,
return;
}

if (!check_bfd_state(rule, bfd_connections, out_port, nexthop)) {
if (!check_bfd_state(rule, lr_ports, bfd_connections,
out_port, nexthop)) {
return;
}

Expand Down Expand Up @@ -10435,8 +10446,8 @@ build_ecmp_routing_policy_flows(struct lflow_table *lflows,
goto cleanup;
}

if (!check_bfd_state(rule, bfd_connections, out_port,
rule->nexthops[i])) {
if (!check_bfd_state(rule, lr_ports, bfd_connections,
out_port, rule->nexthops[i])) {
continue;
}

Expand Down

0 comments on commit 8079885

Please sign in to comment.