[ovs-dev] [PATCH] bridge: LACP port ID and system ID in database.

Ethan Jackson ethan at nicira.com
Sat Apr 16 00:15:17 UTC 2011


Extremely advanced users may want fine grained control over the
LACP port and system IDs of a bond.  This would be extremely
unusual for the average user, so this patch puts the configuration
parameters in other_config of the relevant tables.
---
 vswitchd/bridge.c    |   31 ++++++++++++++++++++++++-------
 vswitchd/vswitch.xml |    9 +++++++++
 2 files changed, 33 insertions(+), 7 deletions(-)

diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index ab4d507..4dcfb8f 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -3078,14 +3078,23 @@ static void
 iface_reconfigure_lacp(struct iface *iface)
 {
     struct lacp_slave_settings s;
-    int priority;
+    int priority, portid;
+
+    portid = atoi(get_interface_other_config(iface->cfg, "lacp-port-id", "0"));
+    priority = atoi(get_interface_other_config(iface->cfg,
+                                               "lacp-port-priority", "0"));
+
+    if (portid <= 0 || portid > UINT16_MAX) {
+        portid = iface->dp_ifidx;
+    }
+
+    if (priority <= 0 || priority > UINT16_MAX) {
+        priority = UINT16_MAX;
+    }
 
     s.name = iface->name;
-    s.id = iface->dp_ifidx;
-    priority = atoi(get_interface_other_config(
-                        iface->cfg, "lacp-port-priority", "0"));
-    s.priority = (priority >= 0 && priority <= UINT16_MAX
-                  ? priority : UINT16_MAX);
+    s.id = portid;
+    s.priority = priority;
     lacp_slave_register(iface->port->lacp, iface, &s);
 }
 
@@ -3094,6 +3103,8 @@ port_reconfigure_lacp(struct port *port)
 {
     static struct lacp_settings s;
     struct iface *iface;
+    uint8_t sysid[ETH_ADDR_LEN];
+    const char *sysid_str;
 
     if (!enable_lacp(port, &s.active)) {
         lacp_destroy(port->lacp);
@@ -3101,8 +3112,14 @@ port_reconfigure_lacp(struct port *port)
         return;
     }
 
+    sysid_str = get_port_other_config(port->cfg, "lacp-system-id", NULL);
+    if (sysid_str && eth_addr_from_string(sysid_str, sysid)) {
+        memcpy(s.id, sysid, ETH_ADDR_LEN);
+    } else {
+        memcpy(s.id, port->bridge->ea, ETH_ADDR_LEN);
+    }
+
     s.name = port->name;
-    memcpy(s.id, port->bridge->ea, ETH_ADDR_LEN);
     s.priority = atoi(get_port_other_config(port->cfg, "lacp-system-priority",
                                             "0"));
     s.fast = !strcmp(get_port_other_config(port->cfg, "lacp-time", "slow"),
diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml
index 7603719..1b72e87 100644
--- a/vswitchd/vswitch.xml
+++ b/vswitchd/vswitch.xml
@@ -647,6 +647,10 @@
           <dd> The number of milliseconds between successive attempts to
             poll each interface's MII.  Only relevant on ports which use
             <code>miimon</code> to detect failures. </dd>
+          <dt><code>lacp-system-id</code></dt>
+          <dd> The LACP system ID of this <ref table="Port"/>.  The system ID
+            of a LACP bond is used to indentify itself to its partners.  Must
+            be a non-zero MAC address.</dd>
           <dt><code>lacp-system-priority</code></dt>
           <dd> The LACP system priority of this <ref table="Port"/>.  In
             LACP negotiations, link status decisions are made by the system
@@ -1254,6 +1258,11 @@
       <column name="other_config">
         Key-value pairs for rarely used interface features.
         <dl>
+          <dt><code>lacp-port-id</code></dt>
+          <dd> The LACP port ID of this <ref table="Interface"/>.  Port IDs are
+            used in LACP negotiations to indentify individual ports
+            participating in a bond.  Must be a number between 1 and
+            65535.</dd>
           <dt><code>lacp-port-priority</code></dt>
           <dd> The LACP port priority of this <ref table="Interface"/>.  In
             LACP negotiations <ref table="Interface"/>s with numerically lower
-- 
1.7.4.2




More information about the dev mailing list