[ovs-dev] [PATCH] bond: Use bond_enable_slave at slave registration.

Ethan Jackson ethan at nicira.com
Wed Apr 13 21:30:27 UTC 2011


Slave registration should go through the normal slave enabling
facilities instead of doing it by hand.  Before this patch, newly
created slaves would have no tag associated with them.
Furthermore, any further changes to how slaves are enabled would
not be picked up by the registration code.
---
 lib/bond.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/lib/bond.c b/lib/bond.c
index ee0e68c..de71b9f 100644
--- a/lib/bond.c
+++ b/lib/bond.c
@@ -357,7 +357,8 @@ bond_slave_register(struct bond *bond, void *slave_, struct netdev *netdev,
         slave->aux = slave_;
         slave->delay_expires = LLONG_MAX;
         slave->up = bond_is_link_up(bond, netdev);
-        slave->enabled = slave->up;
+        slave->enabled = false;
+        bond_enable_slave(slave, slave->up, NULL);
     }
 
     slave->netdev = netdev;
@@ -384,6 +385,8 @@ bond_slave_unregister(struct bond *bond, const void *slave_)
         return;
     }
 
+    bond_enable_slave(slave, false, NULL);
+
     del_active = bond->active_slave == slave;
     if (bond->hash) {
         struct bond_entry *e;
@@ -1321,7 +1324,9 @@ bond_enable_slave(struct bond_slave *slave, bool enable, struct tag_set *tags)
         slave->enabled = enable;
         if (!slave->enabled) {
             VLOG_WARN("interface %s: disabled", slave->name);
-            tag_set_add(tags, slave->tag);
+            if (tags) {
+                tag_set_add(tags, slave->tag);
+            }
         } else {
             VLOG_WARN("interface %s: enabled", slave->name);
             slave->tag = tag_create_random();
-- 
1.7.4.2




More information about the dev mailing list