Lines Matching refs:q
76 static unsigned int choke_len(const struct choke_sched_data *q) in choke_len() argument
78 return (q->tail - q->head) & q->tab_mask; in choke_len()
82 static int use_ecn(const struct choke_sched_data *q) in use_ecn() argument
84 return q->flags & TC_RED_ECN; in use_ecn()
88 static int use_harddrop(const struct choke_sched_data *q) in use_harddrop() argument
90 return q->flags & TC_RED_HARDDROP; in use_harddrop()
94 static void choke_zap_head_holes(struct choke_sched_data *q) in choke_zap_head_holes() argument
97 q->head = (q->head + 1) & q->tab_mask; in choke_zap_head_holes()
98 if (q->head == q->tail) in choke_zap_head_holes()
100 } while (q->tab[q->head] == NULL); in choke_zap_head_holes()
104 static void choke_zap_tail_holes(struct choke_sched_data *q) in choke_zap_tail_holes() argument
107 q->tail = (q->tail - 1) & q->tab_mask; in choke_zap_tail_holes()
108 if (q->head == q->tail) in choke_zap_tail_holes()
110 } while (q->tab[q->tail] == NULL); in choke_zap_tail_holes()
117 struct choke_sched_data *q = qdisc_priv(sch); in choke_drop_by_idx() local
118 struct sk_buff *skb = q->tab[idx]; in choke_drop_by_idx()
120 q->tab[idx] = NULL; in choke_drop_by_idx()
122 if (idx == q->head) in choke_drop_by_idx()
123 choke_zap_head_holes(q); in choke_drop_by_idx()
124 if (idx == q->tail) in choke_drop_by_idx()
125 choke_zap_tail_holes(q); in choke_drop_by_idx()
130 --sch->q.qlen; in choke_drop_by_idx()
180 static struct sk_buff *choke_peek_random(const struct choke_sched_data *q, in choke_peek_random() argument
187 *pidx = (q->head + prandom_u32_max(choke_len(q))) & q->tab_mask; in choke_peek_random()
188 skb = q->tab[*pidx]; in choke_peek_random()
193 return q->tab[*pidx = q->head]; in choke_peek_random()
200 static bool choke_match_random(const struct choke_sched_data *q, in choke_match_random() argument
206 if (q->head == q->tail) in choke_match_random()
209 oskb = choke_peek_random(q, pidx); in choke_match_random()
216 struct choke_sched_data *q = qdisc_priv(sch); in choke_enqueue() local
217 const struct red_parms *p = &q->parms; in choke_enqueue()
221 q->vars.qavg = red_calc_qavg(p, &q->vars, sch->q.qlen); in choke_enqueue()
222 if (red_is_idling(&q->vars)) in choke_enqueue()
223 red_end_of_idle_period(&q->vars); in choke_enqueue()
226 if (q->vars.qavg <= p->qth_min) in choke_enqueue()
227 q->vars.qcount = -1; in choke_enqueue()
232 if (choke_match_random(q, skb, &idx)) { in choke_enqueue()
233 q->stats.matched++; in choke_enqueue()
239 if (q->vars.qavg > p->qth_max) { in choke_enqueue()
240 q->vars.qcount = -1; in choke_enqueue()
243 if (use_harddrop(q) || !use_ecn(q) || in choke_enqueue()
245 q->stats.forced_drop++; in choke_enqueue()
249 q->stats.forced_mark++; in choke_enqueue()
250 } else if (++q->vars.qcount) { in choke_enqueue()
251 if (red_mark_probability(p, &q->vars, q->vars.qavg)) { in choke_enqueue()
252 q->vars.qcount = 0; in choke_enqueue()
253 q->vars.qR = red_random(p); in choke_enqueue()
256 if (!use_ecn(q) || !INET_ECN_set_ce(skb)) { in choke_enqueue()
257 q->stats.prob_drop++; in choke_enqueue()
261 q->stats.prob_mark++; in choke_enqueue()
264 q->vars.qR = red_random(p); in choke_enqueue()
268 if (sch->q.qlen < q->limit) { in choke_enqueue()
269 q->tab[q->tail] = skb; in choke_enqueue()
270 q->tail = (q->tail + 1) & q->tab_mask; in choke_enqueue()
271 ++sch->q.qlen; in choke_enqueue()
276 q->stats.pdrop++; in choke_enqueue()
286 struct choke_sched_data *q = qdisc_priv(sch); in choke_dequeue() local
289 if (q->head == q->tail) { in choke_dequeue()
290 if (!red_is_idling(&q->vars)) in choke_dequeue()
291 red_start_of_idle_period(&q->vars); in choke_dequeue()
295 skb = q->tab[q->head]; in choke_dequeue()
296 q->tab[q->head] = NULL; in choke_dequeue()
297 choke_zap_head_holes(q); in choke_dequeue()
298 --sch->q.qlen; in choke_dequeue()
307 struct choke_sched_data *q = qdisc_priv(sch); in choke_reset() local
309 while (q->head != q->tail) { in choke_reset()
310 struct sk_buff *skb = q->tab[q->head]; in choke_reset()
312 q->head = (q->head + 1) & q->tab_mask; in choke_reset()
318 sch->q.qlen = 0; in choke_reset()
320 if (q->tab) in choke_reset()
321 memset(q->tab, 0, (q->tab_mask + 1) * sizeof(struct sk_buff *)); in choke_reset()
322 q->head = q->tail = 0; in choke_reset()
323 red_restart(&q->vars); in choke_reset()
341 struct choke_sched_data *q = qdisc_priv(sch); in choke_change() local
373 if (mask != q->tab_mask) { in choke_change()
381 old = q->tab; in choke_change()
383 unsigned int oqlen = sch->q.qlen, tail = 0; in choke_change()
386 while (q->head != q->tail) { in choke_change()
387 struct sk_buff *skb = q->tab[q->head]; in choke_change()
389 q->head = (q->head + 1) & q->tab_mask; in choke_change()
398 --sch->q.qlen; in choke_change()
401 qdisc_tree_reduce_backlog(sch, oqlen - sch->q.qlen, dropped); in choke_change()
402 q->head = 0; in choke_change()
403 q->tail = tail; in choke_change()
406 q->tab_mask = mask; in choke_change()
407 q->tab = ntab; in choke_change()
411 q->flags = ctl->flags; in choke_change()
412 q->limit = ctl->limit; in choke_change()
414 red_set_parms(&q->parms, ctl->qth_min, ctl->qth_max, ctl->Wlog, in choke_change()
418 red_set_vars(&q->vars); in choke_change()
420 if (q->head == q->tail) in choke_change()
421 red_end_of_idle_period(&q->vars); in choke_change()
436 struct choke_sched_data *q = qdisc_priv(sch); in choke_dump() local
439 .limit = q->limit, in choke_dump()
440 .flags = q->flags, in choke_dump()
441 .qth_min = q->parms.qth_min >> q->parms.Wlog, in choke_dump()
442 .qth_max = q->parms.qth_max >> q->parms.Wlog, in choke_dump()
443 .Wlog = q->parms.Wlog, in choke_dump()
444 .Plog = q->parms.Plog, in choke_dump()
445 .Scell_log = q->parms.Scell_log, in choke_dump()
453 nla_put_u32(skb, TCA_CHOKE_MAX_P, q->parms.max_P)) in choke_dump()
464 struct choke_sched_data *q = qdisc_priv(sch); in choke_dump_stats() local
466 .early = q->stats.prob_drop + q->stats.forced_drop, in choke_dump_stats()
467 .marked = q->stats.prob_mark + q->stats.forced_mark, in choke_dump_stats()
468 .pdrop = q->stats.pdrop, in choke_dump_stats()
469 .other = q->stats.other, in choke_dump_stats()
470 .matched = q->stats.matched, in choke_dump_stats()
478 struct choke_sched_data *q = qdisc_priv(sch); in choke_destroy() local
480 choke_free(q->tab); in choke_destroy()
485 struct choke_sched_data *q = qdisc_priv(sch); in choke_peek_head() local
487 return (q->head != q->tail) ? q->tab[q->head] : NULL; in choke_peek_head()