diff options
Diffstat (limited to 'drivers/net/bonding/bond_sysfs.c')
-rw-r--r-- | drivers/net/bonding/bond_sysfs.c | 63 |
1 files changed, 20 insertions, 43 deletions
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index 855dc10ffa1b..19d970e0cbb8 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
@@ -662,12 +662,9 @@ static ssize_t bonding_store_arp_interval(struct device *d, | |||
662 | "%s Disabling MII monitoring.\n", | 662 | "%s Disabling MII monitoring.\n", |
663 | bond->dev->name, bond->dev->name); | 663 | bond->dev->name, bond->dev->name); |
664 | bond->params.miimon = 0; | 664 | bond->params.miimon = 0; |
665 | /* Kill MII timer, else it brings bond's link down */ | 665 | if (delayed_work_pending(&bond->mii_work)) { |
666 | if (bond->arp_timer.function) { | 666 | cancel_delayed_work(&bond->mii_work); |
667 | printk(KERN_INFO DRV_NAME | 667 | flush_workqueue(bond->wq); |
668 | ": %s: Kill MII timer, else it brings bond's link down...\n", | ||
669 | bond->dev->name); | ||
670 | del_timer_sync(&bond->mii_timer); | ||
671 | } | 668 | } |
672 | } | 669 | } |
673 | if (!bond->params.arp_targets[0]) { | 670 | if (!bond->params.arp_targets[0]) { |
@@ -682,25 +679,15 @@ static ssize_t bonding_store_arp_interval(struct device *d, | |||
682 | * timer will get fired off when the open function | 679 | * timer will get fired off when the open function |
683 | * is called. | 680 | * is called. |
684 | */ | 681 | */ |
685 | if (bond->arp_timer.function) { | 682 | if (!delayed_work_pending(&bond->arp_work)) { |
686 | /* The timer's already set up, so fire it off */ | 683 | if (bond->params.mode == BOND_MODE_ACTIVEBACKUP) |
687 | mod_timer(&bond->arp_timer, jiffies + 1); | 684 | INIT_DELAYED_WORK(&bond->arp_work, |
688 | } else { | 685 | bond_activebackup_arp_mon); |
689 | /* Set up the timer. */ | 686 | else |
690 | init_timer(&bond->arp_timer); | 687 | INIT_DELAYED_WORK(&bond->arp_work, |
691 | bond->arp_timer.expires = jiffies + 1; | 688 | bond_loadbalance_arp_mon); |
692 | bond->arp_timer.data = | 689 | |
693 | (unsigned long) bond->dev; | 690 | queue_delayed_work(bond->wq, &bond->arp_work, 0); |
694 | if (bond->params.mode == BOND_MODE_ACTIVEBACKUP) { | ||
695 | bond->arp_timer.function = | ||
696 | (void *) | ||
697 | &bond_activebackup_arp_mon; | ||
698 | } else { | ||
699 | bond->arp_timer.function = | ||
700 | (void *) | ||
701 | &bond_loadbalance_arp_mon; | ||
702 | } | ||
703 | add_timer(&bond->arp_timer); | ||
704 | } | 691 | } |
705 | } | 692 | } |
706 | 693 | ||
@@ -1056,12 +1043,9 @@ static ssize_t bonding_store_miimon(struct device *d, | |||
1056 | bond->params.arp_validate = | 1043 | bond->params.arp_validate = |
1057 | BOND_ARP_VALIDATE_NONE; | 1044 | BOND_ARP_VALIDATE_NONE; |
1058 | } | 1045 | } |
1059 | /* Kill ARP timer, else it brings bond's link down */ | 1046 | if (delayed_work_pending(&bond->arp_work)) { |
1060 | if (bond->mii_timer.function) { | 1047 | cancel_delayed_work(&bond->arp_work); |
1061 | printk(KERN_INFO DRV_NAME | 1048 | flush_workqueue(bond->wq); |
1062 | ": %s: Kill ARP timer, else it brings bond's link down...\n", | ||
1063 | bond->dev->name); | ||
1064 | del_timer_sync(&bond->arp_timer); | ||
1065 | } | 1049 | } |
1066 | } | 1050 | } |
1067 | 1051 | ||
@@ -1071,18 +1055,11 @@ static ssize_t bonding_store_miimon(struct device *d, | |||
1071 | * timer will get fired off when the open function | 1055 | * timer will get fired off when the open function |
1072 | * is called. | 1056 | * is called. |
1073 | */ | 1057 | */ |
1074 | if (bond->mii_timer.function) { | 1058 | if (!delayed_work_pending(&bond->mii_work)) { |
1075 | /* The timer's already set up, so fire it off */ | 1059 | INIT_DELAYED_WORK(&bond->mii_work, |
1076 | mod_timer(&bond->mii_timer, jiffies + 1); | 1060 | bond_mii_monitor); |
1077 | } else { | 1061 | queue_delayed_work(bond->wq, |
1078 | /* Set up the timer. */ | 1062 | &bond->mii_work, 0); |
1079 | init_timer(&bond->mii_timer); | ||
1080 | bond->mii_timer.expires = jiffies + 1; | ||
1081 | bond->mii_timer.data = | ||
1082 | (unsigned long) bond->dev; | ||
1083 | bond->mii_timer.function = | ||
1084 | (void *) &bond_mii_monitor; | ||
1085 | add_timer(&bond->mii_timer); | ||
1086 | } | 1063 | } |
1087 | } | 1064 | } |
1088 | } | 1065 | } |