diff options
Diffstat (limited to 'drivers/net/bonding/bond_main.c')
-rw-r--r-- | drivers/net/bonding/bond_main.c | 52 |
1 files changed, 34 insertions, 18 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 832739f38db4..a3efba59eee9 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -1979,6 +1979,20 @@ void bond_destroy(struct bonding *bond) | |||
1979 | unregister_netdevice(bond->dev); | 1979 | unregister_netdevice(bond->dev); |
1980 | } | 1980 | } |
1981 | 1981 | ||
1982 | static void bond_destructor(struct net_device *bond_dev) | ||
1983 | { | ||
1984 | struct bonding *bond = bond_dev->priv; | ||
1985 | |||
1986 | if (bond->wq) | ||
1987 | destroy_workqueue(bond->wq); | ||
1988 | |||
1989 | netif_addr_lock_bh(bond_dev); | ||
1990 | bond_mc_list_destroy(bond); | ||
1991 | netif_addr_unlock_bh(bond_dev); | ||
1992 | |||
1993 | free_netdev(bond_dev); | ||
1994 | } | ||
1995 | |||
1982 | /* | 1996 | /* |
1983 | * First release a slave and than destroy the bond if no more slaves iare left. | 1997 | * First release a slave and than destroy the bond if no more slaves iare left. |
1984 | * Must be under rtnl_lock when this function is called. | 1998 | * Must be under rtnl_lock when this function is called. |
@@ -2376,6 +2390,9 @@ static void bond_miimon_commit(struct bonding *bond) | |||
2376 | continue; | 2390 | continue; |
2377 | 2391 | ||
2378 | case BOND_LINK_DOWN: | 2392 | case BOND_LINK_DOWN: |
2393 | if (slave->link_failure_count < UINT_MAX) | ||
2394 | slave->link_failure_count++; | ||
2395 | |||
2379 | slave->link = BOND_LINK_DOWN; | 2396 | slave->link = BOND_LINK_DOWN; |
2380 | 2397 | ||
2381 | if (bond->params.mode == BOND_MODE_ACTIVEBACKUP || | 2398 | if (bond->params.mode == BOND_MODE_ACTIVEBACKUP || |
@@ -4550,7 +4567,7 @@ static int bond_init(struct net_device *bond_dev, struct bond_params *params) | |||
4550 | 4567 | ||
4551 | bond_set_mode_ops(bond, bond->params.mode); | 4568 | bond_set_mode_ops(bond, bond->params.mode); |
4552 | 4569 | ||
4553 | bond_dev->destructor = free_netdev; | 4570 | bond_dev->destructor = bond_destructor; |
4554 | 4571 | ||
4555 | /* Initialize the device options */ | 4572 | /* Initialize the device options */ |
4556 | bond_dev->tx_queue_len = 0; | 4573 | bond_dev->tx_queue_len = 0; |
@@ -4589,20 +4606,6 @@ static int bond_init(struct net_device *bond_dev, struct bond_params *params) | |||
4589 | return 0; | 4606 | return 0; |
4590 | } | 4607 | } |
4591 | 4608 | ||
4592 | /* De-initialize device specific data. | ||
4593 | * Caller must hold rtnl_lock. | ||
4594 | */ | ||
4595 | static void bond_deinit(struct net_device *bond_dev) | ||
4596 | { | ||
4597 | struct bonding *bond = bond_dev->priv; | ||
4598 | |||
4599 | list_del(&bond->bond_list); | ||
4600 | |||
4601 | #ifdef CONFIG_PROC_FS | ||
4602 | bond_remove_proc_entry(bond); | ||
4603 | #endif | ||
4604 | } | ||
4605 | |||
4606 | static void bond_work_cancel_all(struct bonding *bond) | 4609 | static void bond_work_cancel_all(struct bonding *bond) |
4607 | { | 4610 | { |
4608 | write_lock_bh(&bond->lock); | 4611 | write_lock_bh(&bond->lock); |
@@ -4624,6 +4627,22 @@ static void bond_work_cancel_all(struct bonding *bond) | |||
4624 | cancel_delayed_work(&bond->ad_work); | 4627 | cancel_delayed_work(&bond->ad_work); |
4625 | } | 4628 | } |
4626 | 4629 | ||
4630 | /* De-initialize device specific data. | ||
4631 | * Caller must hold rtnl_lock. | ||
4632 | */ | ||
4633 | static void bond_deinit(struct net_device *bond_dev) | ||
4634 | { | ||
4635 | struct bonding *bond = bond_dev->priv; | ||
4636 | |||
4637 | list_del(&bond->bond_list); | ||
4638 | |||
4639 | bond_work_cancel_all(bond); | ||
4640 | |||
4641 | #ifdef CONFIG_PROC_FS | ||
4642 | bond_remove_proc_entry(bond); | ||
4643 | #endif | ||
4644 | } | ||
4645 | |||
4627 | /* Unregister and free all bond devices. | 4646 | /* Unregister and free all bond devices. |
4628 | * Caller must hold rtnl_lock. | 4647 | * Caller must hold rtnl_lock. |
4629 | */ | 4648 | */ |
@@ -4635,9 +4654,6 @@ static void bond_free_all(void) | |||
4635 | struct net_device *bond_dev = bond->dev; | 4654 | struct net_device *bond_dev = bond->dev; |
4636 | 4655 | ||
4637 | bond_work_cancel_all(bond); | 4656 | bond_work_cancel_all(bond); |
4638 | netif_addr_lock_bh(bond_dev); | ||
4639 | bond_mc_list_destroy(bond); | ||
4640 | netif_addr_unlock_bh(bond_dev); | ||
4641 | /* Release the bonded slaves */ | 4657 | /* Release the bonded slaves */ |
4642 | bond_release_all(bond_dev); | 4658 | bond_release_all(bond_dev); |
4643 | bond_destroy(bond); | 4659 | bond_destroy(bond); |