Lines Matching refs:q

127 static void increment_one_qlen(u32 sfbhash, u32 slot, struct sfb_sched_data *q)  in increment_one_qlen()  argument
130 struct sfb_bucket *b = &q->bins[slot].bins[0][0]; in increment_one_qlen()
142 static void increment_qlen(const struct sk_buff *skb, struct sfb_sched_data *q) in increment_qlen() argument
148 increment_one_qlen(sfbhash, 0, q); in increment_qlen()
152 increment_one_qlen(sfbhash, 1, q); in increment_qlen()
156 struct sfb_sched_data *q) in decrement_one_qlen() argument
159 struct sfb_bucket *b = &q->bins[slot].bins[0][0]; in decrement_one_qlen()
171 static void decrement_qlen(const struct sk_buff *skb, struct sfb_sched_data *q) in decrement_qlen() argument
177 decrement_one_qlen(sfbhash, 0, q); in decrement_qlen()
181 decrement_one_qlen(sfbhash, 1, q); in decrement_qlen()
184 static void decrement_prob(struct sfb_bucket *b, struct sfb_sched_data *q) in decrement_prob() argument
186 b->p_mark = prob_minus(b->p_mark, q->decrement); in decrement_prob()
189 static void increment_prob(struct sfb_bucket *b, struct sfb_sched_data *q) in increment_prob() argument
191 b->p_mark = prob_plus(b->p_mark, q->increment); in increment_prob()
194 static void sfb_zero_all_buckets(struct sfb_sched_data *q) in sfb_zero_all_buckets() argument
196 memset(&q->bins, 0, sizeof(q->bins)); in sfb_zero_all_buckets()
202 static u32 sfb_compute_qlen(u32 *prob_r, u32 *avgpm_r, const struct sfb_sched_data *q) in sfb_compute_qlen() argument
206 const struct sfb_bucket *b = &q->bins[q->slot].bins[0][0]; in sfb_compute_qlen()
222 static void sfb_init_perturbation(u32 slot, struct sfb_sched_data *q) in sfb_init_perturbation() argument
224 q->bins[slot].perturbation = prandom_u32(); in sfb_init_perturbation()
227 static void sfb_swap_slot(struct sfb_sched_data *q) in sfb_swap_slot() argument
229 sfb_init_perturbation(q->slot, q); in sfb_swap_slot()
230 q->slot ^= 1; in sfb_swap_slot()
231 q->double_buffering = false; in sfb_swap_slot()
237 static bool sfb_rate_limit(struct sk_buff *skb, struct sfb_sched_data *q) in sfb_rate_limit() argument
239 if (q->penalty_rate == 0 || q->penalty_burst == 0) in sfb_rate_limit()
242 if (q->tokens_avail < 1) { in sfb_rate_limit()
243 unsigned long age = min(10UL * HZ, jiffies - q->token_time); in sfb_rate_limit()
245 q->tokens_avail = (age * q->penalty_rate) / HZ; in sfb_rate_limit()
246 if (q->tokens_avail > q->penalty_burst) in sfb_rate_limit()
247 q->tokens_avail = q->penalty_burst; in sfb_rate_limit()
248 q->token_time = jiffies; in sfb_rate_limit()
249 if (q->tokens_avail < 1) in sfb_rate_limit()
253 q->tokens_avail--; in sfb_rate_limit()
286 struct sfb_sched_data *q = qdisc_priv(sch); in sfb_enqueue() local
287 struct Qdisc *child = q->qdisc; in sfb_enqueue()
293 u32 slot = q->slot; in sfb_enqueue()
296 if (unlikely(sch->q.qlen >= q->limit)) { in sfb_enqueue()
298 q->stats.queuedrop++; in sfb_enqueue()
302 if (q->rehash_interval > 0) { in sfb_enqueue()
303 unsigned long limit = q->rehash_time + q->rehash_interval; in sfb_enqueue()
306 sfb_swap_slot(q); in sfb_enqueue()
307 q->rehash_time = jiffies; in sfb_enqueue()
308 } else if (unlikely(!q->double_buffering && q->warmup_time > 0 && in sfb_enqueue()
309 time_after(jiffies, limit - q->warmup_time))) { in sfb_enqueue()
310 q->double_buffering = true; in sfb_enqueue()
314 fl = rcu_dereference_bh(q->filter_list); in sfb_enqueue()
321 sfbhash = jhash_1word(salt, q->bins[slot].perturbation); in sfb_enqueue()
323 sfbhash = skb_get_hash_perturb(skb, q->bins[slot].perturbation); in sfb_enqueue()
333 struct sfb_bucket *b = &q->bins[slot].bins[i][hash]; in sfb_enqueue()
337 decrement_prob(b, q); in sfb_enqueue()
338 else if (b->qlen >= q->bin_size) in sfb_enqueue()
339 increment_prob(b, q); in sfb_enqueue()
349 if (unlikely(minqlen >= q->max)) { in sfb_enqueue()
351 q->stats.bucketdrop++; in sfb_enqueue()
357 if (q->double_buffering) { in sfb_enqueue()
359 q->bins[slot].perturbation); in sfb_enqueue()
366 struct sfb_bucket *b = &q->bins[slot].bins[i][hash]; in sfb_enqueue()
370 decrement_prob(b, q); in sfb_enqueue()
371 else if (b->qlen >= q->bin_size) in sfb_enqueue()
372 increment_prob(b, q); in sfb_enqueue()
375 if (sfb_rate_limit(skb, q)) { in sfb_enqueue()
377 q->stats.penaltydrop++; in sfb_enqueue()
392 q->stats.earlydrop++; in sfb_enqueue()
397 q->stats.marked++; in sfb_enqueue()
399 q->stats.earlydrop++; in sfb_enqueue()
408 sch->q.qlen++; in sfb_enqueue()
409 increment_qlen(skb, q); in sfb_enqueue()
411 q->stats.childdrop++; in sfb_enqueue()
428 struct sfb_sched_data *q = qdisc_priv(sch); in sfb_dequeue() local
429 struct Qdisc *child = q->qdisc; in sfb_dequeue()
432 skb = child->dequeue(q->qdisc); in sfb_dequeue()
437 sch->q.qlen--; in sfb_dequeue()
438 decrement_qlen(skb, q); in sfb_dequeue()
446 struct sfb_sched_data *q = qdisc_priv(sch); in sfb_peek() local
447 struct Qdisc *child = q->qdisc; in sfb_peek()
456 struct sfb_sched_data *q = qdisc_priv(sch); in sfb_reset() local
458 qdisc_reset(q->qdisc); in sfb_reset()
460 sch->q.qlen = 0; in sfb_reset()
461 q->slot = 0; in sfb_reset()
462 q->double_buffering = false; in sfb_reset()
463 sfb_zero_all_buckets(q); in sfb_reset()
464 sfb_init_perturbation(0, q); in sfb_reset()
469 struct sfb_sched_data *q = qdisc_priv(sch); in sfb_destroy() local
471 tcf_block_put(q->block); in sfb_destroy()
472 qdisc_destroy(q->qdisc); in sfb_destroy()
494 struct sfb_sched_data *q = qdisc_priv(sch); in sfb_change() local
524 qdisc_tree_reduce_backlog(q->qdisc, q->qdisc->q.qlen, in sfb_change()
525 q->qdisc->qstats.backlog); in sfb_change()
526 qdisc_destroy(q->qdisc); in sfb_change()
527 q->qdisc = child; in sfb_change()
529 q->rehash_interval = msecs_to_jiffies(ctl->rehash_interval); in sfb_change()
530 q->warmup_time = msecs_to_jiffies(ctl->warmup_time); in sfb_change()
531 q->rehash_time = jiffies; in sfb_change()
532 q->limit = limit; in sfb_change()
533 q->increment = ctl->increment; in sfb_change()
534 q->decrement = ctl->decrement; in sfb_change()
535 q->max = ctl->max; in sfb_change()
536 q->bin_size = ctl->bin_size; in sfb_change()
537 q->penalty_rate = ctl->penalty_rate; in sfb_change()
538 q->penalty_burst = ctl->penalty_burst; in sfb_change()
539 q->tokens_avail = ctl->penalty_burst; in sfb_change()
540 q->token_time = jiffies; in sfb_change()
542 q->slot = 0; in sfb_change()
543 q->double_buffering = false; in sfb_change()
544 sfb_zero_all_buckets(q); in sfb_change()
545 sfb_init_perturbation(0, q); in sfb_change()
546 sfb_init_perturbation(1, q); in sfb_change()
556 struct sfb_sched_data *q = qdisc_priv(sch); in sfb_init() local
559 err = tcf_block_get(&q->block, &q->filter_list, sch, extack); in sfb_init()
563 q->qdisc = &noop_qdisc; in sfb_init()
569 struct sfb_sched_data *q = qdisc_priv(sch); in sfb_dump() local
572 .rehash_interval = jiffies_to_msecs(q->rehash_interval), in sfb_dump()
573 .warmup_time = jiffies_to_msecs(q->warmup_time), in sfb_dump()
574 .limit = q->limit, in sfb_dump()
575 .max = q->max, in sfb_dump()
576 .bin_size = q->bin_size, in sfb_dump()
577 .increment = q->increment, in sfb_dump()
578 .decrement = q->decrement, in sfb_dump()
579 .penalty_rate = q->penalty_rate, in sfb_dump()
580 .penalty_burst = q->penalty_burst, in sfb_dump()
583 sch->qstats.backlog = q->qdisc->qstats.backlog; in sfb_dump()
598 struct sfb_sched_data *q = qdisc_priv(sch); in sfb_dump_stats() local
600 .earlydrop = q->stats.earlydrop, in sfb_dump_stats()
601 .penaltydrop = q->stats.penaltydrop, in sfb_dump_stats()
602 .bucketdrop = q->stats.bucketdrop, in sfb_dump_stats()
603 .queuedrop = q->stats.queuedrop, in sfb_dump_stats()
604 .childdrop = q->stats.childdrop, in sfb_dump_stats()
605 .marked = q->stats.marked, in sfb_dump_stats()
608 st.maxqlen = sfb_compute_qlen(&st.maxprob, &st.avgprob, q); in sfb_dump_stats()
622 struct sfb_sched_data *q = qdisc_priv(sch); in sfb_graft() local
627 *old = qdisc_replace(sch, new, &q->qdisc); in sfb_graft()
633 struct sfb_sched_data *q = qdisc_priv(sch); in sfb_leaf() local
635 return q->qdisc; in sfb_leaf()
674 struct sfb_sched_data *q = qdisc_priv(sch); in sfb_tcf_block() local
678 return q->block; in sfb_tcf_block()