[ovs-dev] [next 23/35] bond: New function bond_slave_set_netdev().

Ben Pfaff blp at nicira.com
Tue Apr 26 16:24:49 UTC 2011


To be used by an upcoming change.
---
 lib/bond.c |   14 ++++++++++++++
 lib/bond.h |    1 +
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/lib/bond.c b/lib/bond.c
index ed6ed89..2c76b11 100644
--- a/lib/bond.c
+++ b/lib/bond.c
@@ -383,6 +383,20 @@ bond_slave_register(struct bond *bond, void *slave_, uint16_t stb_id,
     slave->name = xstrdup(netdev_get_name(netdev));
 }
 
+/* Updates the network device to be used with 'slave_' to 'netdev'.
+ *
+ * This is useful if the caller closes and re-opens the network device
+ * registered with bond_slave_register() but doesn't need to change anything
+ * else. */
+void
+bond_slave_set_netdev(struct bond *bond, void *slave_, struct netdev *netdev)
+{
+    struct bond_slave *slave = bond_slave_lookup(bond, slave_);
+    if (slave) {
+        slave->netdev = netdev;
+    }
+}
+
 /* Unregisters 'slave_' from 'bond'.  If 'bond' does not contain such a slave
  * then this function has no effect.
  *
diff --git a/lib/bond.h b/lib/bond.h
index b2ab89c..8736f4c 100644
--- a/lib/bond.h
+++ b/lib/bond.h
@@ -75,6 +75,7 @@ void bond_destroy(struct bond *);
 bool bond_reconfigure(struct bond *, const struct bond_settings *);
 void bond_slave_register(struct bond *, void *slave_,
                          uint16_t stable_id, struct netdev *);
+void bond_slave_set_netdev(struct bond *, void *slave_, struct netdev *);
 void bond_slave_unregister(struct bond *, const void *slave);
 
 void bond_run(struct bond *, struct tag_set *, bool lacp_negotiated);
-- 
1.7.4.4




More information about the dev mailing list