aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-10-31 03:17:34 -0400
committerDavid S. Miller <davem@davemloft.net>2008-10-31 03:17:34 -0400
commita1744d3bee19d3b9cbfb825ab316a101b9c9f109 (patch)
treec0e2324c09beca0eb5782eb5abf241ea2b7a4a11 /drivers/net/bonding
parent275f165fa970174f8a98205529750e8abb6c0a33 (diff)
parenta432226614c5616e3cfd211e0acffa0acfb4770c (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts: drivers/net/wireless/p54/p54common.c
Diffstat (limited to 'drivers/net/bonding')
-rw-r--r--drivers/net/bonding/bond_alb.c13
-rw-r--r--drivers/net/bonding/bond_main.c52
2 files changed, 42 insertions, 23 deletions
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index ade5f3f6693b..87437c788476 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -169,11 +169,14 @@ static void tlb_clear_slave(struct bonding *bond, struct slave *slave, int save_
169 /* clear slave from tx_hashtbl */ 169 /* clear slave from tx_hashtbl */
170 tx_hash_table = BOND_ALB_INFO(bond).tx_hashtbl; 170 tx_hash_table = BOND_ALB_INFO(bond).tx_hashtbl;
171 171
172 index = SLAVE_TLB_INFO(slave).head; 172 /* skip this if we've already freed the tx hash table */
173 while (index != TLB_NULL_INDEX) { 173 if (tx_hash_table) {
174 u32 next_index = tx_hash_table[index].next; 174 index = SLAVE_TLB_INFO(slave).head;
175 tlb_init_table_entry(&tx_hash_table[index], save_load); 175 while (index != TLB_NULL_INDEX) {
176 index = next_index; 176 u32 next_index = tx_hash_table[index].next;
177 tlb_init_table_entry(&tx_hash_table[index], save_load);
178 index = next_index;
179 }
177 } 180 }
178 181
179 tlb_init_slave(slave); 182 tlb_init_slave(slave);
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index f2da031fd7ba..fd9028d7c06e 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1978,6 +1978,20 @@ void bond_destroy(struct bonding *bond)
1978 unregister_netdevice(bond->dev); 1978 unregister_netdevice(bond->dev);
1979} 1979}
1980 1980
1981static void bond_destructor(struct net_device *bond_dev)
1982{
1983 struct bonding *bond = bond_dev->priv;
1984
1985 if (bond->wq)
1986 destroy_workqueue(bond->wq);
1987
1988 netif_addr_lock_bh(bond_dev);
1989 bond_mc_list_destroy(bond);
1990 netif_addr_unlock_bh(bond_dev);
1991
1992 free_netdev(bond_dev);
1993}
1994
1981/* 1995/*
1982* First release a slave and than destroy the bond if no more slaves iare left. 1996* First release a slave and than destroy the bond if no more slaves iare left.
1983* Must be under rtnl_lock when this function is called. 1997* Must be under rtnl_lock when this function is called.
@@ -2375,6 +2389,9 @@ static void bond_miimon_commit(struct bonding *bond)
2375 continue; 2389 continue;
2376 2390
2377 case BOND_LINK_DOWN: 2391 case BOND_LINK_DOWN:
2392 if (slave->link_failure_count < UINT_MAX)
2393 slave->link_failure_count++;
2394
2378 slave->link = BOND_LINK_DOWN; 2395 slave->link = BOND_LINK_DOWN;
2379 2396
2380 if (bond->params.mode == BOND_MODE_ACTIVEBACKUP || 2397 if (bond->params.mode == BOND_MODE_ACTIVEBACKUP ||
@@ -4543,7 +4560,7 @@ static int bond_init(struct net_device *bond_dev, struct bond_params *params)
4543 4560
4544 bond_set_mode_ops(bond, bond->params.mode); 4561 bond_set_mode_ops(bond, bond->params.mode);
4545 4562
4546 bond_dev->destructor = free_netdev; 4563 bond_dev->destructor = bond_destructor;
4547 4564
4548 /* Initialize the device options */ 4565 /* Initialize the device options */
4549 bond_dev->tx_queue_len = 0; 4566 bond_dev->tx_queue_len = 0;
@@ -4582,20 +4599,6 @@ static int bond_init(struct net_device *bond_dev, struct bond_params *params)
4582 return 0; 4599 return 0;
4583} 4600}
4584 4601
4585/* De-initialize device specific data.
4586 * Caller must hold rtnl_lock.
4587 */
4588static void bond_deinit(struct net_device *bond_dev)
4589{
4590 struct bonding *bond = bond_dev->priv;
4591
4592 list_del(&bond->bond_list);
4593
4594#ifdef CONFIG_PROC_FS
4595 bond_remove_proc_entry(bond);
4596#endif
4597}
4598
4599static void bond_work_cancel_all(struct bonding *bond) 4602static void bond_work_cancel_all(struct bonding *bond)
4600{ 4603{
4601 write_lock_bh(&bond->lock); 4604 write_lock_bh(&bond->lock);
@@ -4617,6 +4620,22 @@ static void bond_work_cancel_all(struct bonding *bond)
4617 cancel_delayed_work(&bond->ad_work); 4620 cancel_delayed_work(&bond->ad_work);
4618} 4621}
4619 4622
4623/* De-initialize device specific data.
4624 * Caller must hold rtnl_lock.
4625 */
4626static void bond_deinit(struct net_device *bond_dev)
4627{
4628 struct bonding *bond = bond_dev->priv;
4629
4630 list_del(&bond->bond_list);
4631
4632 bond_work_cancel_all(bond);
4633
4634#ifdef CONFIG_PROC_FS
4635 bond_remove_proc_entry(bond);
4636#endif
4637}
4638
4620/* Unregister and free all bond devices. 4639/* Unregister and free all bond devices.
4621 * Caller must hold rtnl_lock. 4640 * Caller must hold rtnl_lock.
4622 */ 4641 */
@@ -4628,9 +4647,6 @@ static void bond_free_all(void)
4628 struct net_device *bond_dev = bond->dev; 4647 struct net_device *bond_dev = bond->dev;
4629 4648
4630 bond_work_cancel_all(bond); 4649 bond_work_cancel_all(bond);
4631 netif_addr_lock_bh(bond_dev);
4632 bond_mc_list_destroy(bond);
4633 netif_addr_unlock_bh(bond_dev);
4634 /* Release the bonded slaves */ 4650 /* Release the bonded slaves */
4635 bond_release_all(bond_dev); 4651 bond_release_all(bond_dev);
4636 bond_destroy(bond); 4652 bond_destroy(bond);