diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-12-28 15:49:40 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-12-28 15:49:40 -0500 |
commit | 0191b625ca5a46206d2fb862bb08f36f2fcb3b31 (patch) | |
tree | 454d1842b1833d976da62abcbd5c47521ebe9bd7 /net/sched/act_police.c | |
parent | 54a696bd07c14d3b1192d03ce7269bc59b45209a (diff) | |
parent | eb56092fc168bf5af199d47af50c0d84a96db898 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6: (1429 commits)
net: Allow dependancies of FDDI & Tokenring to be modular.
igb: Fix build warning when DCA is disabled.
net: Fix warning fallout from recent NAPI interface changes.
gro: Fix potential use after free
sfc: If AN is enabled, always read speed/duplex from the AN advertising bits
sfc: When disabling the NIC, close the device rather than unregistering it
sfc: SFT9001: Add cable diagnostics
sfc: Add support for multiple PHY self-tests
sfc: Merge top-level functions for self-tests
sfc: Clean up PHY mode management in loopback self-test
sfc: Fix unreliable link detection in some loopback modes
sfc: Generate unique names for per-NIC workqueues
802.3ad: use standard ethhdr instead of ad_header
802.3ad: generalize out mac address initializer
802.3ad: initialize ports LACPDU from const initializer
802.3ad: remove typedef around ad_system
802.3ad: turn ports is_individual into a bool
802.3ad: turn ports is_enabled into a bool
802.3ad: make ntt bool
ixgbe: Fix set_ringparam in ixgbe to use the same memory pools.
...
Fixed trivial IPv4/6 address printing conflicts in fs/cifs/connect.c due
to the conversion to %pI (in this networking merge) and the addition of
doing IPv6 addresses (from the earlier merge of CIFS).
Diffstat (limited to 'net/sched/act_police.c')
-rw-r--r-- | net/sched/act_police.c | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/net/sched/act_police.c b/net/sched/act_police.c index 38015b493947..5c72a116b1a4 100644 --- a/net/sched/act_police.c +++ b/net/sched/act_police.c | |||
@@ -182,17 +182,32 @@ override: | |||
182 | R_tab = qdisc_get_rtab(&parm->rate, tb[TCA_POLICE_RATE]); | 182 | R_tab = qdisc_get_rtab(&parm->rate, tb[TCA_POLICE_RATE]); |
183 | if (R_tab == NULL) | 183 | if (R_tab == NULL) |
184 | goto failure; | 184 | goto failure; |
185 | |||
186 | if (!est && (ret == ACT_P_CREATED || | ||
187 | !gen_estimator_active(&police->tcf_bstats, | ||
188 | &police->tcf_rate_est))) { | ||
189 | err = -EINVAL; | ||
190 | goto failure; | ||
191 | } | ||
192 | |||
185 | if (parm->peakrate.rate) { | 193 | if (parm->peakrate.rate) { |
186 | P_tab = qdisc_get_rtab(&parm->peakrate, | 194 | P_tab = qdisc_get_rtab(&parm->peakrate, |
187 | tb[TCA_POLICE_PEAKRATE]); | 195 | tb[TCA_POLICE_PEAKRATE]); |
188 | if (P_tab == NULL) { | 196 | if (P_tab == NULL) |
189 | qdisc_put_rtab(R_tab); | ||
190 | goto failure; | 197 | goto failure; |
191 | } | ||
192 | } | 198 | } |
193 | } | 199 | } |
194 | /* No failure allowed after this point */ | 200 | |
195 | spin_lock_bh(&police->tcf_lock); | 201 | spin_lock_bh(&police->tcf_lock); |
202 | if (est) { | ||
203 | err = gen_replace_estimator(&police->tcf_bstats, | ||
204 | &police->tcf_rate_est, | ||
205 | &police->tcf_lock, est); | ||
206 | if (err) | ||
207 | goto failure_unlock; | ||
208 | } | ||
209 | |||
210 | /* No failure allowed after this point */ | ||
196 | if (R_tab != NULL) { | 211 | if (R_tab != NULL) { |
197 | qdisc_put_rtab(police->tcfp_R_tab); | 212 | qdisc_put_rtab(police->tcfp_R_tab); |
198 | police->tcfp_R_tab = R_tab; | 213 | police->tcfp_R_tab = R_tab; |
@@ -217,10 +232,6 @@ override: | |||
217 | 232 | ||
218 | if (tb[TCA_POLICE_AVRATE]) | 233 | if (tb[TCA_POLICE_AVRATE]) |
219 | police->tcfp_ewma_rate = nla_get_u32(tb[TCA_POLICE_AVRATE]); | 234 | police->tcfp_ewma_rate = nla_get_u32(tb[TCA_POLICE_AVRATE]); |
220 | if (est) | ||
221 | gen_replace_estimator(&police->tcf_bstats, | ||
222 | &police->tcf_rate_est, | ||
223 | &police->tcf_lock, est); | ||
224 | 235 | ||
225 | spin_unlock_bh(&police->tcf_lock); | 236 | spin_unlock_bh(&police->tcf_lock); |
226 | if (ret != ACT_P_CREATED) | 237 | if (ret != ACT_P_CREATED) |
@@ -238,7 +249,13 @@ override: | |||
238 | a->priv = police; | 249 | a->priv = police; |
239 | return ret; | 250 | return ret; |
240 | 251 | ||
252 | failure_unlock: | ||
253 | spin_unlock_bh(&police->tcf_lock); | ||
241 | failure: | 254 | failure: |
255 | if (P_tab) | ||
256 | qdisc_put_rtab(P_tab); | ||
257 | if (R_tab) | ||
258 | qdisc_put_rtab(R_tab); | ||
242 | if (ret == ACT_P_CREATED) | 259 | if (ret == ACT_P_CREATED) |
243 | kfree(police); | 260 | kfree(police); |
244 | return err; | 261 | return err; |