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

Ethan Jackson ethan at nicira.com
Tue May 3 20:33:18 UTC 2011


If bond->monitor is non-null you will probably need to remove the old
netdev from it and add the new one.  Given the complexity of the
aforementioned step it might be worth check if slave->netdev !=
netdev, and using this new function in bond_slave_register() instead
of doing it by hand.

Ethan

On Tue, Apr 26, 2011 at 09:24, Ben Pfaff <blp at nicira.com> wrote:
> 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
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>



More information about the dev mailing list