]>
Commit | Line | Data |
---|---|---|
abfbd08a GKH |
1 | From c12eb97966d0d2796df4b8a99de1605c18a82281 Mon Sep 17 00:00:00 2001 |
2 | From: "nikolay@redhat.com" <nikolay@redhat.com> | |
3 | Date: Wed, 27 Mar 2013 03:32:41 +0000 | |
4 | Subject: bonding: fix disabling of arp_interval and miimon | |
5 | ||
6 | ||
7 | From: "nikolay@redhat.com" <nikolay@redhat.com> | |
8 | ||
9 | [ Upstream commit 1bc7db16782c2a581fb4d53ca853631050f31611 ] | |
10 | ||
11 | Currently if either arp_interval or miimon is disabled, they both get | |
12 | disabled, and upon disabling they get executed once more which is not | |
13 | the proper behaviour. Also when doing a no-op and disabling an already | |
14 | disabled one, the other again gets disabled. | |
15 | Also fix the error messages with the proper valid ranges, and a small | |
16 | typo fix in the up delay error message (outputting "down delay", instead | |
17 | of "up delay"). | |
18 | ||
19 | Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com> | |
20 | Signed-off-by: David S. Miller <davem@davemloft.net> | |
21 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
22 | --- | |
23 | drivers/net/bonding/bond_sysfs.c | 92 ++++++++++++++++++++------------------- | |
24 | 1 file changed, 48 insertions(+), 44 deletions(-) | |
25 | ||
26 | --- a/drivers/net/bonding/bond_sysfs.c | |
27 | +++ b/drivers/net/bonding/bond_sysfs.c | |
28 | @@ -527,7 +527,7 @@ static ssize_t bonding_store_arp_interva | |
29 | goto out; | |
30 | } | |
31 | if (new_value < 0) { | |
32 | - pr_err("%s: Invalid arp_interval value %d not in range 1-%d; rejected.\n", | |
33 | + pr_err("%s: Invalid arp_interval value %d not in range 0-%d; rejected.\n", | |
34 | bond->dev->name, new_value, INT_MAX); | |
35 | ret = -EINVAL; | |
36 | goto out; | |
37 | @@ -542,14 +542,15 @@ static ssize_t bonding_store_arp_interva | |
38 | pr_info("%s: Setting ARP monitoring interval to %d.\n", | |
39 | bond->dev->name, new_value); | |
40 | bond->params.arp_interval = new_value; | |
41 | - if (bond->params.miimon) { | |
42 | - pr_info("%s: ARP monitoring cannot be used with MII monitoring. %s Disabling MII monitoring.\n", | |
43 | - bond->dev->name, bond->dev->name); | |
44 | - bond->params.miimon = 0; | |
45 | - } | |
46 | - if (!bond->params.arp_targets[0]) { | |
47 | - pr_info("%s: ARP monitoring has been set up, but no ARP targets have been specified.\n", | |
48 | - bond->dev->name); | |
49 | + if (new_value) { | |
50 | + if (bond->params.miimon) { | |
51 | + pr_info("%s: ARP monitoring cannot be used with MII monitoring. %s Disabling MII monitoring.\n", | |
52 | + bond->dev->name, bond->dev->name); | |
53 | + bond->params.miimon = 0; | |
54 | + } | |
55 | + if (!bond->params.arp_targets[0]) | |
56 | + pr_info("%s: ARP monitoring has been set up, but no ARP targets have been specified.\n", | |
57 | + bond->dev->name); | |
58 | } | |
59 | if (bond->dev->flags & IFF_UP) { | |
60 | /* If the interface is up, we may need to fire off | |
61 | @@ -557,10 +558,13 @@ static ssize_t bonding_store_arp_interva | |
62 | * timer will get fired off when the open function | |
63 | * is called. | |
64 | */ | |
65 | - cancel_delayed_work_sync(&bond->mii_work); | |
66 | - queue_delayed_work(bond->wq, &bond->arp_work, 0); | |
67 | + if (!new_value) { | |
68 | + cancel_delayed_work_sync(&bond->arp_work); | |
69 | + } else { | |
70 | + cancel_delayed_work_sync(&bond->mii_work); | |
71 | + queue_delayed_work(bond->wq, &bond->arp_work, 0); | |
72 | + } | |
73 | } | |
74 | - | |
75 | out: | |
76 | rtnl_unlock(); | |
77 | return ret; | |
78 | @@ -702,7 +706,7 @@ static ssize_t bonding_store_downdelay(s | |
79 | } | |
80 | if (new_value < 0) { | |
81 | pr_err("%s: Invalid down delay value %d not in range %d-%d; rejected.\n", | |
82 | - bond->dev->name, new_value, 1, INT_MAX); | |
83 | + bond->dev->name, new_value, 0, INT_MAX); | |
84 | ret = -EINVAL; | |
85 | goto out; | |
86 | } else { | |
87 | @@ -757,8 +761,8 @@ static ssize_t bonding_store_updelay(str | |
88 | goto out; | |
89 | } | |
90 | if (new_value < 0) { | |
91 | - pr_err("%s: Invalid down delay value %d not in range %d-%d; rejected.\n", | |
92 | - bond->dev->name, new_value, 1, INT_MAX); | |
93 | + pr_err("%s: Invalid up delay value %d not in range %d-%d; rejected.\n", | |
94 | + bond->dev->name, new_value, 0, INT_MAX); | |
95 | ret = -EINVAL; | |
96 | goto out; | |
97 | } else { | |
98 | @@ -968,37 +972,37 @@ static ssize_t bonding_store_miimon(stru | |
99 | } | |
100 | if (new_value < 0) { | |
101 | pr_err("%s: Invalid miimon value %d not in range %d-%d; rejected.\n", | |
102 | - bond->dev->name, new_value, 1, INT_MAX); | |
103 | + bond->dev->name, new_value, 0, INT_MAX); | |
104 | ret = -EINVAL; | |
105 | goto out; | |
106 | - } else { | |
107 | - pr_info("%s: Setting MII monitoring interval to %d.\n", | |
108 | - bond->dev->name, new_value); | |
109 | - bond->params.miimon = new_value; | |
110 | - if (bond->params.updelay) | |
111 | - pr_info("%s: Note: Updating updelay (to %d) since it is a multiple of the miimon value.\n", | |
112 | - bond->dev->name, | |
113 | - bond->params.updelay * bond->params.miimon); | |
114 | - if (bond->params.downdelay) | |
115 | - pr_info("%s: Note: Updating downdelay (to %d) since it is a multiple of the miimon value.\n", | |
116 | - bond->dev->name, | |
117 | - bond->params.downdelay * bond->params.miimon); | |
118 | - if (bond->params.arp_interval) { | |
119 | - pr_info("%s: MII monitoring cannot be used with ARP monitoring. Disabling ARP monitoring...\n", | |
120 | - bond->dev->name); | |
121 | - bond->params.arp_interval = 0; | |
122 | - if (bond->params.arp_validate) { | |
123 | - bond->params.arp_validate = | |
124 | - BOND_ARP_VALIDATE_NONE; | |
125 | - } | |
126 | - } | |
127 | - | |
128 | - if (bond->dev->flags & IFF_UP) { | |
129 | - /* If the interface is up, we may need to fire off | |
130 | - * the MII timer. If the interface is down, the | |
131 | - * timer will get fired off when the open function | |
132 | - * is called. | |
133 | - */ | |
134 | + } | |
135 | + pr_info("%s: Setting MII monitoring interval to %d.\n", | |
136 | + bond->dev->name, new_value); | |
137 | + bond->params.miimon = new_value; | |
138 | + if (bond->params.updelay) | |
139 | + pr_info("%s: Note: Updating updelay (to %d) since it is a multiple of the miimon value.\n", | |
140 | + bond->dev->name, | |
141 | + bond->params.updelay * bond->params.miimon); | |
142 | + if (bond->params.downdelay) | |
143 | + pr_info("%s: Note: Updating downdelay (to %d) since it is a multiple of the miimon value.\n", | |
144 | + bond->dev->name, | |
145 | + bond->params.downdelay * bond->params.miimon); | |
146 | + if (new_value && bond->params.arp_interval) { | |
147 | + pr_info("%s: MII monitoring cannot be used with ARP monitoring. Disabling ARP monitoring...\n", | |
148 | + bond->dev->name); | |
149 | + bond->params.arp_interval = 0; | |
150 | + if (bond->params.arp_validate) | |
151 | + bond->params.arp_validate = BOND_ARP_VALIDATE_NONE; | |
152 | + } | |
153 | + if (bond->dev->flags & IFF_UP) { | |
154 | + /* If the interface is up, we may need to fire off | |
155 | + * the MII timer. If the interface is down, the | |
156 | + * timer will get fired off when the open function | |
157 | + * is called. | |
158 | + */ | |
159 | + if (!new_value) { | |
160 | + cancel_delayed_work_sync(&bond->mii_work); | |
161 | + } else { | |
162 | cancel_delayed_work_sync(&bond->arp_work); | |
163 | queue_delayed_work(bond->wq, &bond->mii_work, 0); | |
164 | } |