[ovs-dev] [PATCH] bfd: Detect Multiplier configuration

Ben Pfaff blp at ovn.org
Tue Jun 6 17:17:45 UTC 2017


On Tue, Jun 06, 2017 at 05:11:54PM +0200, Szucs Gabor wrote:
> Mult value (bfd.DetectMult in RFC5880) is hard-coded and equal to 3 in
> current openvswitch. As a consequence remote and local mult is the same.
> 
> In this commit the mult (Detect Multiplier/bfd.DetectMult/Detect Mult)
> can be set on each interface setting the mult=<value> in bfd Column
> in Interface table of ovsdb database.
> Example:
> ovs-vsctl set Interface p1 bfd:mult=4
> sets mult=4 on p1 interface

Thanks for working on this!

I applied this to master.  I folded in the following changes.  In
bfd_configure(), I removed some log messages that seem to be more
aggressive than otherwise used in the bfd module.  I also fixed an
indentation error.  In vswitch.xml, I changed documentation that just
quoted a standard without explaining it, and I updated a place that had
been missed, that said 3 was the multiplier, to say that this way only
the default.  I also added a NEWS item.

--8<--------------------------cut here-------------------------->8--

diff --git a/NEWS b/NEWS
index 000573367f1e..82004c845ce4 100644
--- a/NEWS
+++ b/NEWS
@@ -57,6 +57,7 @@ Post-v2.7.0
      * New vxlan tunnel extension "gpe" to support VXLAN-GPE tunnels.
      * Transparently pop and push Ethernet headers at transmit/reception
        of packets to/from L3 tunnels.
+   - The BFD detection multiplier is now user-configurable.
 
 v2.7.0 - 21 Feb 2017
 ---------------------
diff --git a/lib/bfd.c b/lib/bfd.c
index eaf1821c1d0f..4174e8b8e535 100644
--- a/lib/bfd.c
+++ b/lib/bfd.c
@@ -356,8 +356,6 @@ bfd_configure(struct bfd *bfd, const char *name, const struct smap *cfg,
     bool need_poll = false;
     bool cfg_min_rx_changed = false;
     bool cpath_down, forwarding_if_rx;
-    int new_mult;
-    int old_mult;
 
     if (!cfg || !smap_get_bool(cfg, "enable", false)) {
         bfd_unref(bfd);
@@ -394,20 +392,12 @@ bfd_configure(struct bfd *bfd, const char *name, const struct smap *cfg,
         bfd_status_changed(bfd);
     }
 
-    old_mult = bfd->mult;
-
-    new_mult = smap_get_int(cfg, "mult", DEFAULT_MULT);
+    int old_mult = bfd->mult;
+    int new_mult = smap_get_int(cfg, "mult", DEFAULT_MULT);
     if (new_mult < 1 || new_mult > 255) {
-        VLOG_INFO("Interface %s mult value %d out of range 1-255 changedto %d",
-                   name, new_mult, DEFAULT_MULT);
         new_mult = DEFAULT_MULT;
     }
-
-    bfd->mult = (uint8_t) new_mult;
-    if (new_mult != old_mult) {
-        VLOG_INFO("Interface %s mult value %d changed to %d",
-              name, old_mult, new_mult);
-    }
+    bfd->mult = new_mult;
 
     bfd->oam = smap_get_bool(cfg, "oam", false);
 
@@ -1006,7 +996,7 @@ bfd_set_next_tx(struct bfd *bfd) OVS_REQUIRES(mutex)
 {
     long long int interval = bfd_tx_interval(bfd);
     if (bfd->mult == 1) {
-       interval -= interval * (10 + random_range(16)) / 100;
+        interval -= interval * (10 + random_range(16)) / 100;
     } else {
         interval -= interval * random_range(26) / 100;
     }
diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml
index 613673ff7465..892f83923617 100644
--- a/vswitchd/vswitch.xml
+++ b/vswitchd/vswitch.xml
@@ -2838,12 +2838,12 @@
         BFD operates by regularly transmitting BFD control messages at a rate
         negotiated independently in each direction.  Each endpoint specifies
         the rate at which it expects to receive control messages, and the rate
-        at which it is willing to transmit them.  Open vSwitch uses a detection
-        multiplier of three, meaning that an endpoint signals a connectivity
-        fault if three consecutive BFD control messages fail to arrive.  In the
-        case of a unidirectional connectivity issue, the system not receiving
-        BFD control messages signals the problem to its peer in the messages it
-        transmits.
+        at which it is willing to transmit them.  By default, Open vSwitch uses
+        a detection multiplier of three, meaning that an endpoint signals a
+        connectivity fault if three consecutive BFD control messages fail to
+        arrive.  In the case of a unidirectional connectivity issue, the system
+        not receiving BFD control messages signals the problem to its peer in
+        the messages it transmits.
       </p>
 
       <p>
@@ -2957,12 +2957,9 @@
 
         <column name="bfd" key="mult"
                 type='{"type": "integer", "minInteger": 1, "maxInteger": 255}'>
-          From RFC5880 Jun 20 2010 page 28 (bfd.DetectMult)
-          "The desired Detection Time multiplier for BFD Control packetson
-          the local system.  The negotiated Control packet transmission
-          interval, multiplied by this variable, will be the Detection Time
-          for this session (as seen by the remote system).  This variable
-          MUST be a nonzero integer..." Defaults to <code>3</code>.
+          The BFD detection multiplier, which defaults to 3.  An endpoint
+          signals a connectivity fault if the given number of consecutive BFD
+          control messages fail to arrive.
         </column>
       </group>
 


More information about the dev mailing list