Lines Matching refs:q
80 static unsigned int choke_len(const struct choke_sched_data *q) in choke_len() argument
82 return (q->tail - q->head) & q->tab_mask; in choke_len()
86 static int use_ecn(const struct choke_sched_data *q) in use_ecn() argument
88 return q->flags & TC_RED_ECN; in use_ecn()
92 static int use_harddrop(const struct choke_sched_data *q) in use_harddrop() argument
94 return q->flags & TC_RED_HARDDROP; in use_harddrop()
98 static void choke_zap_head_holes(struct choke_sched_data *q) in choke_zap_head_holes() argument
101 q->head = (q->head + 1) & q->tab_mask; in choke_zap_head_holes()
102 if (q->head == q->tail) in choke_zap_head_holes()
104 } while (q->tab[q->head] == NULL); in choke_zap_head_holes()
108 static void choke_zap_tail_holes(struct choke_sched_data *q) in choke_zap_tail_holes() argument
111 q->tail = (q->tail - 1) & q->tab_mask; in choke_zap_tail_holes()
112 if (q->head == q->tail) in choke_zap_tail_holes()
114 } while (q->tab[q->tail] == NULL); in choke_zap_tail_holes()
120 struct choke_sched_data *q = qdisc_priv(sch); in choke_drop_by_idx() local
121 struct sk_buff *skb = q->tab[idx]; in choke_drop_by_idx()
123 q->tab[idx] = NULL; in choke_drop_by_idx()
125 if (idx == q->head) in choke_drop_by_idx()
126 choke_zap_head_holes(q); in choke_drop_by_idx()
127 if (idx == q->tail) in choke_drop_by_idx()
128 choke_zap_tail_holes(q); in choke_drop_by_idx()
133 --sch->q.qlen; in choke_drop_by_idx()
204 struct choke_sched_data *q = qdisc_priv(sch); in choke_classify() local
209 fl = rcu_dereference_bh(q->filter_list); in choke_classify()
234 static struct sk_buff *choke_peek_random(const struct choke_sched_data *q, in choke_peek_random() argument
241 *pidx = (q->head + prandom_u32_max(choke_len(q))) & q->tab_mask; in choke_peek_random()
242 skb = q->tab[*pidx]; in choke_peek_random()
247 return q->tab[*pidx = q->head]; in choke_peek_random()
254 static bool choke_match_random(const struct choke_sched_data *q, in choke_match_random() argument
260 if (q->head == q->tail) in choke_match_random()
263 oskb = choke_peek_random(q, pidx); in choke_match_random()
264 if (rcu_access_pointer(q->filter_list)) in choke_match_random()
273 struct choke_sched_data *q = qdisc_priv(sch); in choke_enqueue() local
274 const struct red_parms *p = &q->parms; in choke_enqueue()
276 if (rcu_access_pointer(q->filter_list)) { in choke_enqueue()
284 q->vars.qavg = red_calc_qavg(p, &q->vars, sch->q.qlen); in choke_enqueue()
285 if (red_is_idling(&q->vars)) in choke_enqueue()
286 red_end_of_idle_period(&q->vars); in choke_enqueue()
289 if (q->vars.qavg <= p->qth_min) in choke_enqueue()
290 q->vars.qcount = -1; in choke_enqueue()
295 if (choke_match_random(q, skb, &idx)) { in choke_enqueue()
296 q->stats.matched++; in choke_enqueue()
302 if (q->vars.qavg > p->qth_max) { in choke_enqueue()
303 q->vars.qcount = -1; in choke_enqueue()
306 if (use_harddrop(q) || !use_ecn(q) || in choke_enqueue()
308 q->stats.forced_drop++; in choke_enqueue()
312 q->stats.forced_mark++; in choke_enqueue()
313 } else if (++q->vars.qcount) { in choke_enqueue()
314 if (red_mark_probability(p, &q->vars, q->vars.qavg)) { in choke_enqueue()
315 q->vars.qcount = 0; in choke_enqueue()
316 q->vars.qR = red_random(p); in choke_enqueue()
319 if (!use_ecn(q) || !INET_ECN_set_ce(skb)) { in choke_enqueue()
320 q->stats.prob_drop++; in choke_enqueue()
324 q->stats.prob_mark++; in choke_enqueue()
327 q->vars.qR = red_random(p); in choke_enqueue()
331 if (sch->q.qlen < q->limit) { in choke_enqueue()
332 q->tab[q->tail] = skb; in choke_enqueue()
333 q->tail = (q->tail + 1) & q->tab_mask; in choke_enqueue()
334 ++sch->q.qlen; in choke_enqueue()
339 q->stats.pdrop++; in choke_enqueue()
355 struct choke_sched_data *q = qdisc_priv(sch); in choke_dequeue() local
358 if (q->head == q->tail) { in choke_dequeue()
359 if (!red_is_idling(&q->vars)) in choke_dequeue()
360 red_start_of_idle_period(&q->vars); in choke_dequeue()
364 skb = q->tab[q->head]; in choke_dequeue()
365 q->tab[q->head] = NULL; in choke_dequeue()
366 choke_zap_head_holes(q); in choke_dequeue()
367 --sch->q.qlen; in choke_dequeue()
376 struct choke_sched_data *q = qdisc_priv(sch); in choke_drop() local
381 q->stats.other++; in choke_drop()
383 if (!red_is_idling(&q->vars)) in choke_drop()
384 red_start_of_idle_period(&q->vars); in choke_drop()
392 struct choke_sched_data *q = qdisc_priv(sch); in choke_reset() local
394 red_restart(&q->vars); in choke_reset()
411 struct choke_sched_data *q = qdisc_priv(sch); in choke_change() local
438 if (mask != q->tab_mask) { in choke_change()
449 old = q->tab; in choke_change()
451 unsigned int oqlen = sch->q.qlen, tail = 0; in choke_change()
454 while (q->head != q->tail) { in choke_change()
455 struct sk_buff *skb = q->tab[q->head]; in choke_change()
457 q->head = (q->head + 1) & q->tab_mask; in choke_change()
466 --sch->q.qlen; in choke_change()
469 qdisc_tree_reduce_backlog(sch, oqlen - sch->q.qlen, dropped); in choke_change()
470 q->head = 0; in choke_change()
471 q->tail = tail; in choke_change()
474 q->tab_mask = mask; in choke_change()
475 q->tab = ntab; in choke_change()
479 q->flags = ctl->flags; in choke_change()
480 q->limit = ctl->limit; in choke_change()
482 red_set_parms(&q->parms, ctl->qth_min, ctl->qth_max, ctl->Wlog, in choke_change()
486 red_set_vars(&q->vars); in choke_change()
488 if (q->head == q->tail) in choke_change()
489 red_end_of_idle_period(&q->vars); in choke_change()
503 struct choke_sched_data *q = qdisc_priv(sch); in choke_dump() local
506 .limit = q->limit, in choke_dump()
507 .flags = q->flags, in choke_dump()
508 .qth_min = q->parms.qth_min >> q->parms.Wlog, in choke_dump()
509 .qth_max = q->parms.qth_max >> q->parms.Wlog, in choke_dump()
510 .Wlog = q->parms.Wlog, in choke_dump()
511 .Plog = q->parms.Plog, in choke_dump()
512 .Scell_log = q->parms.Scell_log, in choke_dump()
520 nla_put_u32(skb, TCA_CHOKE_MAX_P, q->parms.max_P)) in choke_dump()
531 struct choke_sched_data *q = qdisc_priv(sch); in choke_dump_stats() local
533 .early = q->stats.prob_drop + q->stats.forced_drop, in choke_dump_stats()
534 .marked = q->stats.prob_mark + q->stats.forced_mark, in choke_dump_stats()
535 .pdrop = q->stats.pdrop, in choke_dump_stats()
536 .other = q->stats.other, in choke_dump_stats()
537 .matched = q->stats.matched, in choke_dump_stats()
545 struct choke_sched_data *q = qdisc_priv(sch); in choke_destroy() local
547 tcf_destroy_chain(&q->filter_list); in choke_destroy()
548 choke_free(q->tab); in choke_destroy()
561 static void choke_put(struct Qdisc *q, unsigned long cl) in choke_put() argument
574 struct choke_sched_data *q = qdisc_priv(sch); in choke_find_tcf() local
578 return &q->filter_list; in choke_find_tcf()
612 struct choke_sched_data *q = qdisc_priv(sch); in choke_peek_head() local
614 return (q->head != q->tail) ? q->tab[q->head] : NULL; in choke_peek_head()