diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-06-19 22:45:37 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-06-19 22:45:37 +0000 |
commit | 6d403070f28cd44860fdb3a53be5da0275c65cf4 (patch) | |
tree | 0d0e7fe7b5fb7568d19e11d7d862b77a866ce081 /drivers/net/bonding.c | |
parent | ecf1bf5f6c2e668d03b0a9fb026db7aa41e292e1 (diff) |
Merge with 2.4.0-test1-ac21 + pile of MIPS cleanups to make merging
possible. Chainsawed RM200 kernel to compile again. Jazz machine
status unknown.
Diffstat (limited to 'drivers/net/bonding.c')
-rw-r--r-- | drivers/net/bonding.c | 63 |
1 files changed, 33 insertions, 30 deletions
diff --git a/drivers/net/bonding.c b/drivers/net/bonding.c index b1234af8d..67f076d46 100644 --- a/drivers/net/bonding.c +++ b/drivers/net/bonding.c @@ -85,35 +85,49 @@ static int bond_open(struct net_device *dev) return 0; } -static int bond_close(struct net_device *master) +static void release_one_slave(struct net_device *master, slave_t *slave) { bonding_t *bond = master->priv; - slave_t *slave; - while ((slave = bond->next) != (slave_t*)bond) { + spin_lock_bh(&master->xmit_lock); + if (bond->current_slave == slave) + bond->current_slave = slave->next; + slave->next->prev = slave->prev; + slave->prev->next = slave->next; + spin_unlock_bh(&master->xmit_lock); - spin_lock_bh(&master->xmit_lock); - slave->next->prev = slave->prev; - slave->prev->next = slave->next; - bond->current_slave = (slave_t*)bond; - spin_unlock_bh(&master->xmit_lock); + netdev_set_master(slave->dev, NULL); - netdev_set_master(slave->dev, NULL); + dev_put(slave->dev); + kfree(slave); + MOD_DEC_USE_COUNT; +} - kfree(slave); - } +static int bond_close(struct net_device *master) +{ + bonding_t *bond = master->priv; + slave_t *slave; + + while ((slave = bond->next) != (slave_t*)bond) + release_one_slave(master, slave); MOD_DEC_USE_COUNT; return 0; } -/* Fake multicast ability. - - NB. It is possible and necessary to make it true one, otherwise - the device is not functional. - */ -static void bond_set_multicast_list(struct net_device *dev) +static void bond_set_multicast_list(struct net_device *master) { + bonding_t *bond = master->priv; + slave_t *slave; + + for (slave = bond->next; slave != (slave_t*)bond; slave = slave->next) { + slave->dev->mc_list = master->mc_list; + slave->dev->mc_count = master->mc_count; + slave->dev->flags = master->flags; + slave->dev->set_multicast_list(slave->dev); + } + + return 0; } static int bond_enslave(struct net_device *master, struct net_device *dev) @@ -161,20 +175,9 @@ static int bond_release(struct net_device *master, struct net_device *dev) if (dev->master != master) return -EINVAL; - netdev_set_master(dev, NULL); - for (slave = bond->next; slave != (slave_t*)bond; slave = slave->next) { if (slave->dev == dev) { - spin_lock_bh(&master->xmit_lock); - if (bond->current_slave == slave) - bond->current_slave = slave->next; - slave->next->prev = slave->prev; - slave->prev->next = slave->next; - spin_unlock_bh(&master->xmit_lock); - - kfree(slave); - dev_put(dev); - MOD_DEC_USE_COUNT; + release_one_slave(master, slave); break; } } @@ -281,7 +284,7 @@ static int bond_xmit(struct sk_buff *skb, struct net_device *dev) if (slave == (slave_t*)bond) continue; - if (netif_running(slave->dev) && netif_carrier_ok(dev)) { + if (netif_running(slave->dev) && netif_carrier_ok(slave->dev)) { bond->current_slave = slave->next; skb->dev = slave->dev; |