@@ -40,20 +40,10 @@ bfd_register_ovs_idl(struct ovsdb_idl *ovs_idl)
static void
-interface_set_bfd(const struct ovsrec_interface *iface, bool bfd_setting)
+interface_set_bfd(const struct ovsrec_interface *iface, struct smap *bfd)
{
- const char *new_setting = bfd_setting ? "true":"false";
- const char *current_setting = smap_get(&iface->bfd, "enable");
- if (current_setting && !strcmp(current_setting, new_setting)) {
- /* If already set to the desired setting we skip setting it again
- * to avoid flapping to bfd initialization state */
- return;
- }
- const struct smap bfd = SMAP_CONST1(&bfd, "enable", new_setting);
ovsrec_interface_verify_bfd(iface);
- ovsrec_interface_set_bfd(iface, &bfd);
- VLOG_INFO("%s BFD on interface %s", bfd_setting ? "Enabled" : "Disabled",
- iface->name);
+ ovsrec_interface_set_bfd(iface, bfd);
}
void
@@ -265,6 +255,7 @@ void
bfd_run(struct ovsdb_idl_index *sbrec_chassis_by_name,
struct ovsdb_idl_index *sbrec_port_binding_by_datapath,
const struct ovsrec_interface_table *interface_table,
+ const struct ovsrec_open_vswitch_table *ovs_table,
const struct ovsrec_bridge *br_int,
const struct sbrec_chassis *chassis_rec,
const struct hmap *local_datapaths)
@@ -292,15 +283,46 @@ bfd_run(struct ovsdb_idl_index *sbrec_chassis_by_name,
}
}
+ const struct ovsrec_open_vswitch *cfg;
+ cfg = ovsrec_open_vswitch_table_first(ovs_table);
+ const char *min_rx = NULL;
+ const char *decay_min_rx = NULL;
+ const char *min_tx = NULL;
+ const char *mult = NULL;
+ if (cfg) {
+ min_rx = smap_get(&cfg->external_ids, "ovn-bfd-min-rx");
+ decay_min_rx = smap_get(&cfg->external_ids, "ovn-bfd-decay-min-rx");
+ min_tx = smap_get(&cfg->external_ids, "ovn-bfd-min-tx");
+ mult = smap_get(&cfg->external_ids, "ovn-bfd-mult");
+ }
+ struct smap bfd = SMAP_INITIALIZER(&bfd);
+ if (min_rx) {
+ smap_add(&bfd, "min_rx", min_rx);
+ }
+ if (decay_min_rx) {
+ smap_add(&bfd, "decay_min_rx", decay_min_rx);
+ }
+ if (min_tx) {
+ smap_add(&bfd, "min_tx", min_tx);
+ }
+ if (mult) {
+ smap_add(&bfd, "mult", mult);
+ }
/* Enable or disable bfd */
const struct ovsrec_interface *iface;
OVSREC_INTERFACE_TABLE_FOR_EACH (iface, interface_table) {
if (sset_contains(&tunnels, iface->name)) {
- interface_set_bfd(
- iface, sset_contains(&bfd_ifaces, iface->name));
+ bool bfd_setting = sset_contains(&bfd_ifaces, iface->name);
+ smap_replace(&bfd, "enable", bfd_setting ? "true":"false");
+ if (!smap_equal(&iface->bfd, &bfd)) {
+ interface_set_bfd(iface, &bfd);
+ VLOG_INFO("%s BFD on interface %s",
+ bfd_setting ? "Enabled" : "Disabled", iface->name);
+ }
}
}
+ smap_destroy(&bfd);
sset_destroy(&tunnels);
sset_destroy(&bfd_ifaces);
sset_destroy(&bfd_chassis);
@@ -21,6 +21,7 @@ struct ovsdb_idl;
struct ovsdb_idl_index;
struct ovsrec_bridge;
struct ovsrec_interface_table;
+struct ovsrec_open_vswitch_table;
struct sbrec_chassis;
struct sset;
@@ -28,6 +29,7 @@ void bfd_register_ovs_idl(struct ovsdb_idl *);
void bfd_run(struct ovsdb_idl_index *sbrec_chassis_by_name,
struct ovsdb_idl_index *sbrec_port_binding_by_datapath,
const struct ovsrec_interface_table *interface_table,
+ const struct ovsrec_open_vswitch_table *ovs_table,
const struct ovsrec_bridge *br_int,
const struct sbrec_chassis *chassis_rec,
const struct hmap *local_datapaths);
@@ -159,6 +159,16 @@
specific to this particular chassis. An example would be:
<code>cms_option1,cms_option2:foo</code>.
</dd>
+
+ <dt><code>external_ids:ovn-bfd-min-rx</code></dt>
+ <dt><code>external_ids:ovn-bfd-decay-min-rx</code></dt>
+ <dt><code>external_ids:ovn-bfd-min-tx</code></dt>
+ <dt><code>external_ids:ovn-bfd-mult</code></dt>
+ <dd>
+ These are the BFD parameters to use when <code>ovn-controller</code>
+ enables BFD on the tunnel ports. These can be used to override the
+ default BFD parameters.
+ </dd>
</dl>
<p>
@@ -765,10 +765,12 @@ main(int argc, char *argv[])
&flow_table, &group_table, &meter_table);
if (chassis_id) {
- bfd_run(sbrec_chassis_by_name,
- sbrec_port_binding_by_datapath,
- ovsrec_interface_table_get(ovs_idl_loop.idl),
- br_int, chassis, &local_datapaths);
+ bfd_run(
+ sbrec_chassis_by_name,
+ sbrec_port_binding_by_datapath,
+ ovsrec_interface_table_get(ovs_idl_loop.idl),
+ ovsrec_open_vswitch_table_get(ovs_idl_loop.idl),
+ br_int, chassis, &local_datapaths);
}
physical_run(
sbrec_chassis_by_name,
@@ -9271,6 +9271,32 @@ AT_CHECK([ovn-sbctl --columns chassis --bare find Port_Binding logical_port=cr-o
[0],[[1
]])
+as gw2
+ovs-vsctl set Open . external-ids:ovn-bfd-min-rx=2000
+for chassis in gw1 hv1 hv2; do
+ echo "checking gw2 -> $chassis"
+ OVS_WAIT_UNTIL([
+ bfd_cfg=$(ovs-vsctl --bare --columns bfd find Interface name=ovn-$chassis-0)
+ test "$bfd_cfg" = "enable=true min_rx=2000"
+])
+done
+ovs-vsctl set Open . external-ids:ovn-bfd-min-tx=1500
+for chassis in gw1 hv1 hv2; do
+ echo "checking gw2 -> $chassis"
+ OVS_WAIT_UNTIL([
+ bfd_cfg=$(ovs-vsctl --bare --columns bfd find Interface name=ovn-$chassis-0)
+ test "$bfd_cfg" = "enable=true min_rx=2000 min_tx=1500"
+])
+done
+ovs-vsctl remove Open . external-ids ovn-bfd-min-rx
+for chassis in gw1 hv1 hv2; do
+ echo "checking gw2 -> $chassis"
+ OVS_WAIT_UNTIL([
+ bfd_cfg=$(ovs-vsctl --bare --columns bfd find Interface name=ovn-$chassis-0)
+ test "$bfd_cfg" = "enable=true min_tx=1500"
+])
+done
+
OVN_CLEANUP([gw1],[gw2],[hv1],[hv2])
AT_CLEANUP