[ovs-dev] [STP 1/9] ofproto-dpif: Update bundle when OFPPC_NO_FLOOD changed.

Justin Pettit jpettit at nicira.com
Tue Oct 18 05:31:41 UTC 2011


When the OFPPC_NO_FLOOD flag is toggled on the port, the "floodable"
member of the bundle was not updated.  This would cause OFPP_NORMAL to
not include the proper ports when flooding.  With this commit,
OFPPC_NO_FLOOD changes will cause the floodable members to be
recalculated.

Found by inspection.
---
 ofproto/ofproto-dpif.c |   26 ++++++++++++++++++++------
 1 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index ae76e98..3de1807 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -155,6 +155,7 @@ struct ofbundle {
 };
 
 static void bundle_remove(struct ofport *);
+static void bundle_update(struct ofbundle *);
 static void bundle_destroy(struct ofbundle *);
 static void bundle_del_port(struct ofport_dpif *);
 static void bundle_run(struct ofbundle *);
@@ -825,6 +826,10 @@ port_reconfigured(struct ofport *port_, ovs_be32 old_config)
     if (changed & htonl(OFPPC_NO_RECV | OFPPC_NO_RECV_STP |
                         OFPPC_NO_FWD | OFPPC_NO_FLOOD)) {
         ofproto->need_revalidate = true;
+
+        if (changed & htonl(OFPPC_NO_FLOOD) && port->bundle) {
+            bundle_update(port->bundle);
+        }
     }
 }
 
@@ -959,6 +964,20 @@ bundle_lookup_multiple(struct ofproto_dpif *ofproto,
 }
 
 static void
+bundle_update(struct ofbundle *bundle)
+{
+    struct ofport_dpif *port;
+
+    bundle->floodable = true;
+    LIST_FOR_EACH (port, bundle_node, &bundle->ports) {
+        if (port->up.opp.config & htonl(OFPPC_NO_FLOOD)) {
+            bundle->floodable = false;
+            break;
+        }
+    }
+}
+
+static void
 bundle_del_port(struct ofport_dpif *port)
 {
     struct ofbundle *bundle = port->bundle;
@@ -975,12 +994,7 @@ bundle_del_port(struct ofport_dpif *port)
         bond_slave_unregister(bundle->bond, port);
     }
 
-    bundle->floodable = true;
-    LIST_FOR_EACH (port, bundle_node, &bundle->ports) {
-        if (port->up.opp.config & htonl(OFPPC_NO_FLOOD)) {
-            bundle->floodable = false;
-        }
-    }
+    bundle_update(bundle);
 }
 
 static bool
-- 
1.7.1




More information about the dev mailing list