• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500-V1.0.1.40_1.0.68/src/linux/linux-2.6/net/sched/

Lines Matching refs:police

2  * net/sched/police.c	Input police filter.
144 struct tcf_police *police;
171 police = to_police(pc);
173 police->tcf_bindcnt += 1;
174 police->tcf_refcnt += 1;
182 police = kzalloc(sizeof(*police), GFP_KERNEL);
183 if (police == NULL)
186 police->tcf_refcnt = 1;
187 spin_lock_init(&police->tcf_lock);
188 police->tcf_stats_lock = &police->tcf_lock;
190 police->tcf_bindcnt = 1;
207 spin_lock_bh(&police->tcf_lock);
209 qdisc_put_rtab(police->tcfp_R_tab);
210 police->tcfp_R_tab = R_tab;
213 qdisc_put_rtab(police->tcfp_P_tab);
214 police->tcfp_P_tab = P_tab;
218 police->tcfp_result = *(u32*)RTA_DATA(tb[TCA_POLICE_RESULT-1]);
219 police->tcfp_toks = police->tcfp_burst = parm->burst;
220 police->tcfp_mtu = parm->mtu;
221 if (police->tcfp_mtu == 0) {
222 police->tcfp_mtu = ~0;
223 if (police->tcfp_R_tab)
224 police->tcfp_mtu = 255<<police->tcfp_R_tab->rate.cell_log;
226 if (police->tcfp_P_tab)
227 police->tcfp_ptoks = L2T_P(police, police->tcfp_mtu);
228 police->tcf_action = parm->action;
232 police->tcfp_ewma_rate =
235 gen_replace_estimator(&police->tcf_bstats,
236 &police->tcf_rate_est,
237 police->tcf_stats_lock, est);
240 spin_unlock_bh(&police->tcf_lock);
244 police->tcfp_t_c = psched_get_time();
245 police->tcf_index = parm->index ? parm->index :
247 h = tcf_hash(police->tcf_index, POL_TAB_MASK);
249 police->tcf_next = tcf_police_ht[h];
250 tcf_police_ht[h] = &police->common;
253 a->priv = police;
258 kfree(police);
274 struct tcf_police *police = a->priv;
279 spin_lock(&police->tcf_lock);
281 police->tcf_bstats.bytes += skb->len;
282 police->tcf_bstats.packets++;
285 if (police->tcfp_ewma_rate &&
286 police->tcf_rate_est.bps >= police->tcfp_ewma_rate) {
287 police->tcf_qstats.overlimits++;
288 spin_unlock(&police->tcf_lock);
289 return police->tcf_action;
293 if (skb->len <= police->tcfp_mtu) {
294 if (police->tcfp_R_tab == NULL) {
295 spin_unlock(&police->tcf_lock);
296 return police->tcfp_result;
300 toks = psched_tdiff_bounded(now, police->tcfp_t_c,
301 police->tcfp_burst);
302 if (police->tcfp_P_tab) {
303 ptoks = toks + police->tcfp_ptoks;
304 if (ptoks > (long)L2T_P(police, police->tcfp_mtu))
305 ptoks = (long)L2T_P(police, police->tcfp_mtu);
306 ptoks -= L2T_P(police, skb->len);
308 toks += police->tcfp_toks;
309 if (toks > (long)police->tcfp_burst)
310 toks = police->tcfp_burst;
311 toks -= L2T(police, skb->len);
313 police->tcfp_t_c = now;
314 police->tcfp_toks = toks;
315 police->tcfp_ptoks = ptoks;
316 spin_unlock(&police->tcf_lock);
317 return police->tcfp_result;
321 police->tcf_qstats.overlimits++;
322 spin_unlock(&police->tcf_lock);
323 return police->tcf_action;
330 struct tcf_police *police = a->priv;
333 opt.index = police->tcf_index;
334 opt.action = police->tcf_action;
335 opt.mtu = police->tcfp_mtu;
336 opt.burst = police->tcfp_burst;
337 opt.refcnt = police->tcf_refcnt - ref;
338 opt.bindcnt = police->tcf_bindcnt - bind;
339 if (police->tcfp_R_tab)
340 opt.rate = police->tcfp_R_tab->rate;
343 if (police->tcfp_P_tab)
344 opt.peakrate = police->tcfp_P_tab->rate;
348 if (police->tcfp_result)
350 &police->tcfp_result);
352 if (police->tcfp_ewma_rate)
353 RTA_PUT(skb, TCA_POLICE_AVRATE, 4, &police->tcfp_ewma_rate);
367 .kind = "police",
429 struct tcf_police *police;
450 police = to_police(pc);
451 police->tcf_refcnt++;
452 return police;
455 police = kzalloc(sizeof(*police), GFP_KERNEL);
456 if (unlikely(!police))
459 police->tcf_refcnt = 1;
460 spin_lock_init(&police->tcf_lock);
461 police->tcf_stats_lock = &police->tcf_lock;
463 police->tcfp_R_tab =
465 if (police->tcfp_R_tab == NULL)
468 police->tcfp_P_tab =
471 if (police->tcfp_P_tab == NULL)
478 police->tcfp_result = *(u32*)RTA_DATA(tb[TCA_POLICE_RESULT-1]);
484 police->tcfp_ewma_rate =
488 police->tcfp_toks = police->tcfp_burst = parm->burst;
489 police->tcfp_mtu = parm->mtu;
490 if (police->tcfp_mtu == 0) {
491 police->tcfp_mtu = ~0;
492 if (police->tcfp_R_tab)
493 police->tcfp_mtu = 255<<police->tcfp_R_tab->rate.cell_log;
495 if (police->tcfp_P_tab)
496 police->tcfp_ptoks = L2T_P(police, police->tcfp_mtu);
497 police->tcfp_t_c = psched_get_time();
498 police->tcf_index = parm->index ? parm->index :
500 police->tcf_action = parm->action;
503 gen_new_estimator(&police->tcf_bstats, &police->tcf_rate_est,
504 police->tcf_stats_lock, est);
506 h = tcf_hash(police->tcf_index, POL_TAB_MASK);
508 police->tcf_next = tcf_police_ht[h];
509 tcf_police_ht[h] = &police->common;
511 return police;
514 if (police->tcfp_R_tab)
515 qdisc_put_rtab(police->tcfp_R_tab);
516 kfree(police);
520 int tcf_police(struct sk_buff *skb, struct tcf_police *police)
526 spin_lock(&police->tcf_lock);
528 police->tcf_bstats.bytes += skb->len;
529 police->tcf_bstats.packets++;
532 if (police->tcfp_ewma_rate &&
533 police->tcf_rate_est.bps >= police->tcfp_ewma_rate) {
534 police->tcf_qstats.overlimits++;
535 spin_unlock(&police->tcf_lock);
536 return police->tcf_action;
539 if (skb->len <= police->tcfp_mtu) {
540 if (police->tcfp_R_tab == NULL) {
541 spin_unlock(&police->tcf_lock);
542 return police->tcfp_result;
546 toks = psched_tdiff_bounded(now, police->tcfp_t_c,
547 police->tcfp_burst);
548 if (police->tcfp_P_tab) {
549 ptoks = toks + police->tcfp_ptoks;
550 if (ptoks > (long)L2T_P(police, police->tcfp_mtu))
551 ptoks = (long)L2T_P(police, police->tcfp_mtu);
552 ptoks -= L2T_P(police, skb->len);
554 toks += police->tcfp_toks;
555 if (toks > (long)police->tcfp_burst)
556 toks = police->tcfp_burst;
557 toks -= L2T(police, skb->len);
559 police->tcfp_t_c = now;
560 police->tcfp_toks = toks;
561 police->tcfp_ptoks = ptoks;
562 spin_unlock(&police->tcf_lock);
563 return police->tcfp_result;
567 police->tcf_qstats.overlimits++;
568 spin_unlock(&police->tcf_lock);
569 return police->tcf_action;
573 int tcf_police_dump(struct sk_buff *skb, struct tcf_police *police)
578 opt.index = police->tcf_index;
579 opt.action = police->tcf_action;
580 opt.mtu = police->tcfp_mtu;
581 opt.burst = police->tcfp_burst;
582 if (police->tcfp_R_tab)
583 opt.rate = police->tcfp_R_tab->rate;
586 if (police->tcfp_P_tab)
587 opt.peakrate = police->tcfp_P_tab->rate;
591 if (police->tcfp_result)
593 &police->tcfp_result);
595 if (police->tcfp_ewma_rate)
596 RTA_PUT(skb, TCA_POLICE_AVRATE, 4, &police->tcfp_ewma_rate);
605 int tcf_police_dump_stats(struct sk_buff *skb, struct tcf_police *police)
610 TCA_XSTATS, police->tcf_stats_lock,
614 if (gnet_stats_copy_basic(&d, &police->tcf_bstats) < 0 ||
616 gnet_stats_copy_rate_est(&d, &police->tcf_rate_est) < 0 ||
618 gnet_stats_copy_queue(&d, &police->tcf_qstats) < 0)