Lines Matching refs:police
122 struct tcf_police *police; in tcf_act_police_locate() local
143 police = to_police(a->priv); in tcf_act_police_locate()
145 police->tcf_bindcnt += 1; in tcf_act_police_locate()
146 police->tcf_refcnt += 1; in tcf_act_police_locate()
156 police = kzalloc(sizeof(*police), GFP_KERNEL); in tcf_act_police_locate()
157 if (police == NULL) in tcf_act_police_locate()
160 police->tcf_refcnt = 1; in tcf_act_police_locate()
161 spin_lock_init(&police->tcf_lock); in tcf_act_police_locate()
163 police->tcf_bindcnt = 1; in tcf_act_police_locate()
179 spin_lock_bh(&police->tcf_lock); in tcf_act_police_locate()
181 err = gen_replace_estimator(&police->tcf_bstats, NULL, in tcf_act_police_locate()
182 &police->tcf_rate_est, in tcf_act_police_locate()
183 &police->tcf_lock, est); in tcf_act_police_locate()
188 !gen_estimator_active(&police->tcf_bstats, in tcf_act_police_locate()
189 &police->tcf_rate_est))) { in tcf_act_police_locate()
195 police->tcfp_mtu = parm->mtu; in tcf_act_police_locate()
196 if (police->tcfp_mtu == 0) { in tcf_act_police_locate()
197 police->tcfp_mtu = ~0; in tcf_act_police_locate()
199 police->tcfp_mtu = 255 << R_tab->rate.cell_log; in tcf_act_police_locate()
202 police->rate_present = true; in tcf_act_police_locate()
203 psched_ratecfg_precompute(&police->rate, &R_tab->rate, 0); in tcf_act_police_locate()
206 police->rate_present = false; in tcf_act_police_locate()
209 police->peak_present = true; in tcf_act_police_locate()
210 psched_ratecfg_precompute(&police->peak, &P_tab->rate, 0); in tcf_act_police_locate()
213 police->peak_present = false; in tcf_act_police_locate()
217 police->tcfp_result = nla_get_u32(tb[TCA_POLICE_RESULT]); in tcf_act_police_locate()
218 police->tcfp_burst = PSCHED_TICKS2NS(parm->burst); in tcf_act_police_locate()
219 police->tcfp_toks = police->tcfp_burst; in tcf_act_police_locate()
220 if (police->peak_present) { in tcf_act_police_locate()
221 police->tcfp_mtu_ptoks = (s64) psched_l2t_ns(&police->peak, in tcf_act_police_locate()
222 police->tcfp_mtu); in tcf_act_police_locate()
223 police->tcfp_ptoks = police->tcfp_mtu_ptoks; in tcf_act_police_locate()
225 police->tcf_action = parm->action; in tcf_act_police_locate()
228 police->tcfp_ewma_rate = nla_get_u32(tb[TCA_POLICE_AVRATE]); in tcf_act_police_locate()
230 spin_unlock_bh(&police->tcf_lock); in tcf_act_police_locate()
234 police->tcfp_t_c = ktime_get_ns(); in tcf_act_police_locate()
235 police->tcf_index = parm->index ? parm->index : in tcf_act_police_locate()
237 h = tcf_hash(police->tcf_index, POL_TAB_MASK); in tcf_act_police_locate()
239 hlist_add_head(&police->tcf_head, &hinfo->htab[h]); in tcf_act_police_locate()
242 a->priv = police; in tcf_act_police_locate()
246 spin_unlock_bh(&police->tcf_lock); in tcf_act_police_locate()
251 kfree(police); in tcf_act_police_locate()
258 struct tcf_police *police = a->priv; in tcf_act_police() local
263 spin_lock(&police->tcf_lock); in tcf_act_police()
265 bstats_update(&police->tcf_bstats, skb); in tcf_act_police()
267 if (police->tcfp_ewma_rate && in tcf_act_police()
268 police->tcf_rate_est.bps >= police->tcfp_ewma_rate) { in tcf_act_police()
269 police->tcf_qstats.overlimits++; in tcf_act_police()
270 if (police->tcf_action == TC_ACT_SHOT) in tcf_act_police()
271 police->tcf_qstats.drops++; in tcf_act_police()
272 spin_unlock(&police->tcf_lock); in tcf_act_police()
273 return police->tcf_action; in tcf_act_police()
276 if (qdisc_pkt_len(skb) <= police->tcfp_mtu) { in tcf_act_police()
277 if (!police->rate_present) { in tcf_act_police()
278 spin_unlock(&police->tcf_lock); in tcf_act_police()
279 return police->tcfp_result; in tcf_act_police()
283 toks = min_t(s64, now - police->tcfp_t_c, in tcf_act_police()
284 police->tcfp_burst); in tcf_act_police()
285 if (police->peak_present) { in tcf_act_police()
286 ptoks = toks + police->tcfp_ptoks; in tcf_act_police()
287 if (ptoks > police->tcfp_mtu_ptoks) in tcf_act_police()
288 ptoks = police->tcfp_mtu_ptoks; in tcf_act_police()
289 ptoks -= (s64) psched_l2t_ns(&police->peak, in tcf_act_police()
292 toks += police->tcfp_toks; in tcf_act_police()
293 if (toks > police->tcfp_burst) in tcf_act_police()
294 toks = police->tcfp_burst; in tcf_act_police()
295 toks -= (s64) psched_l2t_ns(&police->rate, qdisc_pkt_len(skb)); in tcf_act_police()
297 police->tcfp_t_c = now; in tcf_act_police()
298 police->tcfp_toks = toks; in tcf_act_police()
299 police->tcfp_ptoks = ptoks; in tcf_act_police()
300 spin_unlock(&police->tcf_lock); in tcf_act_police()
301 return police->tcfp_result; in tcf_act_police()
305 police->tcf_qstats.overlimits++; in tcf_act_police()
306 if (police->tcf_action == TC_ACT_SHOT) in tcf_act_police()
307 police->tcf_qstats.drops++; in tcf_act_police()
308 spin_unlock(&police->tcf_lock); in tcf_act_police()
309 return police->tcf_action; in tcf_act_police()
316 struct tcf_police *police = a->priv; in tcf_act_police_dump() local
318 .index = police->tcf_index, in tcf_act_police_dump()
319 .action = police->tcf_action, in tcf_act_police_dump()
320 .mtu = police->tcfp_mtu, in tcf_act_police_dump()
321 .burst = PSCHED_NS2TICKS(police->tcfp_burst), in tcf_act_police_dump()
322 .refcnt = police->tcf_refcnt - ref, in tcf_act_police_dump()
323 .bindcnt = police->tcf_bindcnt - bind, in tcf_act_police_dump()
326 if (police->rate_present) in tcf_act_police_dump()
327 psched_ratecfg_getrate(&opt.rate, &police->rate); in tcf_act_police_dump()
328 if (police->peak_present) in tcf_act_police_dump()
329 psched_ratecfg_getrate(&opt.peakrate, &police->peak); in tcf_act_police_dump()
332 if (police->tcfp_result && in tcf_act_police_dump()
333 nla_put_u32(skb, TCA_POLICE_RESULT, police->tcfp_result)) in tcf_act_police_dump()
335 if (police->tcfp_ewma_rate && in tcf_act_police_dump()
336 nla_put_u32(skb, TCA_POLICE_AVRATE, police->tcfp_ewma_rate)) in tcf_act_police_dump()