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()
121 struct choke_sched_data *q = qdisc_priv(sch); in choke_drop_by_idx() local
122 struct sk_buff *skb = q->tab[idx]; in choke_drop_by_idx()
124 q->tab[idx] = NULL; in choke_drop_by_idx()
126 if (idx == q->head) in choke_drop_by_idx()
127 choke_zap_head_holes(q); in choke_drop_by_idx()
128 if (idx == q->tail) in choke_drop_by_idx()
129 choke_zap_tail_holes(q); in choke_drop_by_idx()
134 --sch->q.qlen; in choke_drop_by_idx()
190 static struct sk_buff *choke_peek_random(const struct choke_sched_data *q, in choke_peek_random() argument
197 *pidx = (q->head + prandom_u32_max(choke_len(q))) & q->tab_mask; in choke_peek_random()
198 skb = q->tab[*pidx]; in choke_peek_random()
203 return q->tab[*pidx = q->head]; in choke_peek_random()
210 static bool choke_match_random(const struct choke_sched_data *q, in choke_match_random() argument
216 if (q->head == q->tail) in choke_match_random()
219 oskb = choke_peek_random(q, pidx); in choke_match_random()
226 struct choke_sched_data *q = qdisc_priv(sch); in choke_enqueue() local
227 const struct red_parms *p = &q->parms; in choke_enqueue()
231 q->vars.qavg = red_calc_qavg(p, &q->vars, sch->q.qlen); in choke_enqueue()
232 if (red_is_idling(&q->vars)) in choke_enqueue()
233 red_end_of_idle_period(&q->vars); in choke_enqueue()
236 if (q->vars.qavg <= p->qth_min) in choke_enqueue()
237 q->vars.qcount = -1; in choke_enqueue()
242 if (choke_match_random(q, skb, &idx)) { in choke_enqueue()
243 q->stats.matched++; in choke_enqueue()
249 if (q->vars.qavg > p->qth_max) { in choke_enqueue()
250 q->vars.qcount = -1; in choke_enqueue()
253 if (use_harddrop(q) || !use_ecn(q) || in choke_enqueue()
255 q->stats.forced_drop++; in choke_enqueue()
259 q->stats.forced_mark++; in choke_enqueue()
260 } else if (++q->vars.qcount) { in choke_enqueue()
261 if (red_mark_probability(p, &q->vars, q->vars.qavg)) { in choke_enqueue()
262 q->vars.qcount = 0; in choke_enqueue()
263 q->vars.qR = red_random(p); in choke_enqueue()
266 if (!use_ecn(q) || !INET_ECN_set_ce(skb)) { in choke_enqueue()
267 q->stats.prob_drop++; in choke_enqueue()
271 q->stats.prob_mark++; in choke_enqueue()
274 q->vars.qR = red_random(p); in choke_enqueue()
278 if (sch->q.qlen < q->limit) { in choke_enqueue()
279 q->tab[q->tail] = skb; in choke_enqueue()
280 q->tail = (q->tail + 1) & q->tab_mask; in choke_enqueue()
281 ++sch->q.qlen; in choke_enqueue()
286 q->stats.pdrop++; in choke_enqueue()
296 struct choke_sched_data *q = qdisc_priv(sch); in choke_dequeue() local
299 if (q->head == q->tail) { in choke_dequeue()
300 if (!red_is_idling(&q->vars)) in choke_dequeue()
301 red_start_of_idle_period(&q->vars); in choke_dequeue()
305 skb = q->tab[q->head]; in choke_dequeue()
306 q->tab[q->head] = NULL; in choke_dequeue()
307 choke_zap_head_holes(q); in choke_dequeue()
308 --sch->q.qlen; in choke_dequeue()
317 struct choke_sched_data *q = qdisc_priv(sch); in choke_reset() local
319 while (q->head != q->tail) { in choke_reset()
320 struct sk_buff *skb = q->tab[q->head]; in choke_reset()
322 q->head = (q->head + 1) & q->tab_mask; in choke_reset()
328 sch->q.qlen = 0; in choke_reset()
330 memset(q->tab, 0, (q->tab_mask + 1) * sizeof(struct sk_buff *)); in choke_reset()
331 q->head = q->tail = 0; in choke_reset()
332 red_restart(&q->vars); in choke_reset()
350 struct choke_sched_data *q = qdisc_priv(sch); in choke_change() local
380 if (mask != q->tab_mask) { in choke_change()
388 old = q->tab; in choke_change()
390 unsigned int oqlen = sch->q.qlen, tail = 0; in choke_change()
393 while (q->head != q->tail) { in choke_change()
394 struct sk_buff *skb = q->tab[q->head]; in choke_change()
396 q->head = (q->head + 1) & q->tab_mask; in choke_change()
405 --sch->q.qlen; in choke_change()
408 qdisc_tree_reduce_backlog(sch, oqlen - sch->q.qlen, dropped); in choke_change()
409 q->head = 0; in choke_change()
410 q->tail = tail; in choke_change()
413 q->tab_mask = mask; in choke_change()
414 q->tab = ntab; in choke_change()
418 q->flags = ctl->flags; in choke_change()
419 q->limit = ctl->limit; in choke_change()
421 red_set_parms(&q->parms, ctl->qth_min, ctl->qth_max, ctl->Wlog, in choke_change()
425 red_set_vars(&q->vars); in choke_change()
427 if (q->head == q->tail) in choke_change()
428 red_end_of_idle_period(&q->vars); in choke_change()
443 struct choke_sched_data *q = qdisc_priv(sch); in choke_dump() local
446 .limit = q->limit, in choke_dump()
447 .flags = q->flags, in choke_dump()
448 .qth_min = q->parms.qth_min >> q->parms.Wlog, in choke_dump()
449 .qth_max = q->parms.qth_max >> q->parms.Wlog, in choke_dump()
450 .Wlog = q->parms.Wlog, in choke_dump()
451 .Plog = q->parms.Plog, in choke_dump()
452 .Scell_log = q->parms.Scell_log, in choke_dump()
460 nla_put_u32(skb, TCA_CHOKE_MAX_P, q->parms.max_P)) in choke_dump()
471 struct choke_sched_data *q = qdisc_priv(sch); in choke_dump_stats() local
473 .early = q->stats.prob_drop + q->stats.forced_drop, in choke_dump_stats()
474 .marked = q->stats.prob_mark + q->stats.forced_mark, in choke_dump_stats()
475 .pdrop = q->stats.pdrop, in choke_dump_stats()
476 .other = q->stats.other, in choke_dump_stats()
477 .matched = q->stats.matched, in choke_dump_stats()
485 struct choke_sched_data *q = qdisc_priv(sch); in choke_destroy() local
487 choke_free(q->tab); in choke_destroy()
492 struct choke_sched_data *q = qdisc_priv(sch); in choke_peek_head() local
494 return (q->head != q->tail) ? q->tab[q->head] : NULL; in choke_peek_head()