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()
198 struct choke_sched_data *q = qdisc_priv(sch); in choke_classify() local
203 fl = rcu_dereference_bh(q->filter_list); in choke_classify()
228 static struct sk_buff *choke_peek_random(const struct choke_sched_data *q, in choke_peek_random() argument
235 *pidx = (q->head + prandom_u32_max(choke_len(q))) & q->tab_mask; in choke_peek_random()
236 skb = q->tab[*pidx]; in choke_peek_random()
241 return q->tab[*pidx = q->head]; in choke_peek_random()
248 static bool choke_match_random(const struct choke_sched_data *q, in choke_match_random() argument
254 if (q->head == q->tail) in choke_match_random()
257 oskb = choke_peek_random(q, pidx); in choke_match_random()
258 if (rcu_access_pointer(q->filter_list)) in choke_match_random()
267 struct choke_sched_data *q = qdisc_priv(sch); in choke_enqueue() local
268 const struct red_parms *p = &q->parms; in choke_enqueue()
270 if (rcu_access_pointer(q->filter_list)) { in choke_enqueue()
278 q->vars.qavg = red_calc_qavg(p, &q->vars, sch->q.qlen); in choke_enqueue()
279 if (red_is_idling(&q->vars)) in choke_enqueue()
280 red_end_of_idle_period(&q->vars); in choke_enqueue()
283 if (q->vars.qavg <= p->qth_min) in choke_enqueue()
284 q->vars.qcount = -1; in choke_enqueue()
289 if (choke_match_random(q, skb, &idx)) { in choke_enqueue()
290 q->stats.matched++; in choke_enqueue()
296 if (q->vars.qavg > p->qth_max) { in choke_enqueue()
297 q->vars.qcount = -1; in choke_enqueue()
300 if (use_harddrop(q) || !use_ecn(q) || in choke_enqueue()
302 q->stats.forced_drop++; in choke_enqueue()
306 q->stats.forced_mark++; in choke_enqueue()
307 } else if (++q->vars.qcount) { in choke_enqueue()
308 if (red_mark_probability(p, &q->vars, q->vars.qavg)) { in choke_enqueue()
309 q->vars.qcount = 0; in choke_enqueue()
310 q->vars.qR = red_random(p); in choke_enqueue()
313 if (!use_ecn(q) || !INET_ECN_set_ce(skb)) { in choke_enqueue()
314 q->stats.prob_drop++; in choke_enqueue()
318 q->stats.prob_mark++; in choke_enqueue()
321 q->vars.qR = red_random(p); in choke_enqueue()
325 if (sch->q.qlen < q->limit) { in choke_enqueue()
326 q->tab[q->tail] = skb; in choke_enqueue()
327 q->tail = (q->tail + 1) & q->tab_mask; in choke_enqueue()
328 ++sch->q.qlen; in choke_enqueue()
333 q->stats.pdrop++; in choke_enqueue()
349 struct choke_sched_data *q = qdisc_priv(sch); in choke_dequeue() local
352 if (q->head == q->tail) { in choke_dequeue()
353 if (!red_is_idling(&q->vars)) in choke_dequeue()
354 red_start_of_idle_period(&q->vars); in choke_dequeue()
358 skb = q->tab[q->head]; in choke_dequeue()
359 q->tab[q->head] = NULL; in choke_dequeue()
360 choke_zap_head_holes(q); in choke_dequeue()
361 --sch->q.qlen; in choke_dequeue()
370 struct choke_sched_data *q = qdisc_priv(sch); in choke_drop() local
375 q->stats.other++; in choke_drop()
377 if (!red_is_idling(&q->vars)) in choke_drop()
378 red_start_of_idle_period(&q->vars); in choke_drop()
386 struct choke_sched_data *q = qdisc_priv(sch); in choke_reset() local
388 while (q->head != q->tail) { in choke_reset()
389 struct sk_buff *skb = q->tab[q->head]; in choke_reset()
391 q->head = (q->head + 1) & q->tab_mask; in choke_reset()
395 --sch->q.qlen; in choke_reset()
399 memset(q->tab, 0, (q->tab_mask + 1) * sizeof(struct sk_buff *)); in choke_reset()
400 q->head = q->tail = 0; in choke_reset()
401 red_restart(&q->vars); in choke_reset()
418 struct choke_sched_data *q = qdisc_priv(sch); in choke_change() local
445 if (mask != q->tab_mask) { in choke_change()
456 old = q->tab; in choke_change()
458 unsigned int oqlen = sch->q.qlen, tail = 0; in choke_change()
461 while (q->head != q->tail) { in choke_change()
462 struct sk_buff *skb = q->tab[q->head]; in choke_change()
464 q->head = (q->head + 1) & q->tab_mask; in choke_change()
473 --sch->q.qlen; in choke_change()
476 qdisc_tree_reduce_backlog(sch, oqlen - sch->q.qlen, dropped); in choke_change()
477 q->head = 0; in choke_change()
478 q->tail = tail; in choke_change()
481 q->tab_mask = mask; in choke_change()
482 q->tab = ntab; in choke_change()
486 q->flags = ctl->flags; in choke_change()
487 q->limit = ctl->limit; in choke_change()
489 red_set_parms(&q->parms, ctl->qth_min, ctl->qth_max, ctl->Wlog, in choke_change()
493 red_set_vars(&q->vars); in choke_change()
495 if (q->head == q->tail) in choke_change()
496 red_end_of_idle_period(&q->vars); in choke_change()
510 struct choke_sched_data *q = qdisc_priv(sch); in choke_dump() local
513 .limit = q->limit, in choke_dump()
514 .flags = q->flags, in choke_dump()
515 .qth_min = q->parms.qth_min >> q->parms.Wlog, in choke_dump()
516 .qth_max = q->parms.qth_max >> q->parms.Wlog, in choke_dump()
517 .Wlog = q->parms.Wlog, in choke_dump()
518 .Plog = q->parms.Plog, in choke_dump()
519 .Scell_log = q->parms.Scell_log, in choke_dump()
527 nla_put_u32(skb, TCA_CHOKE_MAX_P, q->parms.max_P)) in choke_dump()
538 struct choke_sched_data *q = qdisc_priv(sch); in choke_dump_stats() local
540 .early = q->stats.prob_drop + q->stats.forced_drop, in choke_dump_stats()
541 .marked = q->stats.prob_mark + q->stats.forced_mark, in choke_dump_stats()
542 .pdrop = q->stats.pdrop, in choke_dump_stats()
543 .other = q->stats.other, in choke_dump_stats()
544 .matched = q->stats.matched, in choke_dump_stats()
552 struct choke_sched_data *q = qdisc_priv(sch); in choke_destroy() local
554 tcf_destroy_chain(&q->filter_list); in choke_destroy()
555 choke_free(q->tab); in choke_destroy()
560 struct choke_sched_data *q = qdisc_priv(sch); in choke_peek_head() local
562 return (q->head != q->tail) ? q->tab[q->head] : NULL; in choke_peek_head()