[ovs-dev] [PATCH/RFC] bond: add enable-recirc configuration for bond.

Simon Horman simon.horman at netronome.com
Tue Aug 15 16:13:33 UTC 2017


From: Pieter Jansen van Vuuren <pieter.jansenvanvuuren at netronome.com>

Adds a config parameter that determines if a bond will use recirculation
in the kernel datapath when implementing a bond in balance-tcp mode.

The default for enable-recirc is "true", resulting in the traditional
implementation of a bond in balance-tcp mode. Setting enable-recirc to
false results in datapath rules that do not rely on the recirculation
action.

example usage:
ovs-vsctl set port bond0 other_config:enable-recirc=false

Advantages:
- Allows TC offloading of OVS bonds on hardware which
  does not support recirculation
- Appears to result in lower latency (in systems using few flows).

Quick ping test results in:

other_config:enable-recirc=false
rtt min/avg/max/mdev = 0.039/0.193/7.612/1.059 ms

other_config:enable-recirc=true
rtt min/avg/max/mdev = 0.038/0.321/14.091/1.967 ms

More comprehensive testing is in progress.

Signed-off-by: Pieter Jansen van Vuuren <pieter.jansenvanvuuren at netronome.com>
Signed-off-by: Simon Horman <simon.horman at netronome.com>
---
 ofproto/bond.c       | 11 ++++++++++-
 ofproto/bond.h       |  1 +
 vswitchd/bridge.c    |  3 +++
 vswitchd/vswitch.xml |  8 ++++++++
 4 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/ofproto/bond.c b/ofproto/bond.c
index 365a3ca7ffad..46f8a9afcb3b 100644
--- a/ofproto/bond.c
+++ b/ofproto/bond.c
@@ -147,6 +147,7 @@ struct bond {
                                /* The MAC address of the active interface. */
     /* Legacy compatibility. */
     bool lacp_fallback_ab; /* Fallback to active-backup on LACP failure. */
+    bool recirc_enabled;
 
     struct ovs_refcount ref_cnt;
 };
@@ -437,6 +438,11 @@ bond_reconfigure(struct bond *bond, const struct bond_settings *s)
         revalidate = true;
     }
 
+    if (bond->recirc_enabled != s->recirc_enabled) {
+        bond->recirc_enabled = s->recirc_enabled;
+        revalidate = true;
+    }
+
     if (bond->rebalance_interval != s->rebalance_interval) {
         bond->rebalance_interval = s->rebalance_interval;
         revalidate = true;
@@ -458,7 +464,10 @@ bond_reconfigure(struct bond *bond, const struct bond_settings *s)
     }
 
     if (bond->balance != BM_AB) {
-        if (!bond->recirc_id) {
+	if (!bond->recirc_enabled) {
+            recirc_free_id(bond->recirc_id);
+            bond->recirc_id = 0;
+        } else if (!bond->recirc_id) {
             bond->recirc_id = recirc_alloc_id(bond->ofproto);
         }
     } else if (bond->recirc_id) {
diff --git a/ofproto/bond.h b/ofproto/bond.h
index e7c3d9bc35dd..beb937b9910e 100644
--- a/ofproto/bond.h
+++ b/ofproto/bond.h
@@ -53,6 +53,7 @@ struct bond_settings {
     int down_delay;             /* ms before disabling a down slave. */
 
     bool lacp_fallback_ab_cfg;  /* Fallback to active-backup on LACP failure. */
+    bool recirc_enabled;
 
     struct eth_addr active_slave_mac;
                                 /* The MAC address of the interface
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index a8cbae78cb23..b4b5c89ca6a0 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -4259,6 +4259,9 @@ port_configure_bond(struct port *port, struct bond_settings *s)
     s->lacp_fallback_ab_cfg = smap_get_bool(&port->cfg->other_config,
                                        "lacp-fallback-ab", false);
 
+    s->recirc_enabled = smap_get_bool(&port->cfg->other_config,
+                                      "enable-recirc", true);
+
     LIST_FOR_EACH (iface, port_elem, &port->ifaces) {
         netdev_set_miimon_interval(iface->netdev, miimon_interval);
     }
diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml
index 074535b588ef..7b97d720d276 100644
--- a/vswitchd/vswitch.xml
+++ b/vswitchd/vswitch.xml
@@ -1693,6 +1693,14 @@
             is configured to LACP mode, the bond will use LACP.
           </p>
         </column>
+
+        <column name="other_config" key="enable-recirc"
+                type='{"type": "boolean"}'>
+          <p>
+            Determines if a bond will use recirculation in the kernel datapath
+            when implementing a bond in balance-tcp mode.
+          </p>
+        </column>
       </group>
 
       <group title="Rebalancing Configuration">
-- 
2.1.4



More information about the dev mailing list