Lines Matching refs:q
123 static void increment_one_qlen(u32 sfbhash, u32 slot, struct sfb_sched_data *q) in increment_one_qlen() argument
126 struct sfb_bucket *b = &q->bins[slot].bins[0][0]; in increment_one_qlen()
138 static void increment_qlen(const struct sfb_skb_cb *cb, struct sfb_sched_data *q) in increment_qlen() argument
144 increment_one_qlen(sfbhash, 0, q); in increment_qlen()
148 increment_one_qlen(sfbhash, 1, q); in increment_qlen()
152 struct sfb_sched_data *q) in decrement_one_qlen() argument
155 struct sfb_bucket *b = &q->bins[slot].bins[0][0]; in decrement_one_qlen()
167 static void decrement_qlen(const struct sk_buff *skb, struct sfb_sched_data *q) in decrement_qlen() argument
173 decrement_one_qlen(sfbhash, 0, q); in decrement_qlen()
177 decrement_one_qlen(sfbhash, 1, q); in decrement_qlen()
180 static void decrement_prob(struct sfb_bucket *b, struct sfb_sched_data *q) in decrement_prob() argument
182 b->p_mark = prob_minus(b->p_mark, q->decrement); in decrement_prob()
185 static void increment_prob(struct sfb_bucket *b, struct sfb_sched_data *q) in increment_prob() argument
187 b->p_mark = prob_plus(b->p_mark, q->increment); in increment_prob()
190 static void sfb_zero_all_buckets(struct sfb_sched_data *q) in sfb_zero_all_buckets() argument
192 memset(&q->bins, 0, sizeof(q->bins)); in sfb_zero_all_buckets()
198 static u32 sfb_compute_qlen(u32 *prob_r, u32 *avgpm_r, const struct sfb_sched_data *q) in sfb_compute_qlen() argument
202 const struct sfb_bucket *b = &q->bins[q->slot].bins[0][0]; in sfb_compute_qlen()
218 static void sfb_init_perturbation(u32 slot, struct sfb_sched_data *q) in sfb_init_perturbation() argument
220 get_random_bytes(&q->bins[slot].perturbation, in sfb_init_perturbation()
221 sizeof(q->bins[slot].perturbation)); in sfb_init_perturbation()
224 static void sfb_swap_slot(struct sfb_sched_data *q) in sfb_swap_slot() argument
226 sfb_init_perturbation(q->slot, q); in sfb_swap_slot()
227 q->slot ^= 1; in sfb_swap_slot()
228 q->double_buffering = false; in sfb_swap_slot()
234 static bool sfb_rate_limit(struct sk_buff *skb, struct sfb_sched_data *q) in sfb_rate_limit() argument
236 if (q->penalty_rate == 0 || q->penalty_burst == 0) in sfb_rate_limit()
239 if (q->tokens_avail < 1) { in sfb_rate_limit()
240 unsigned long age = min(10UL * HZ, jiffies - q->token_time); in sfb_rate_limit()
242 q->tokens_avail = (age * q->penalty_rate) / HZ; in sfb_rate_limit()
243 if (q->tokens_avail > q->penalty_burst) in sfb_rate_limit()
244 q->tokens_avail = q->penalty_burst; in sfb_rate_limit()
245 q->token_time = jiffies; in sfb_rate_limit()
246 if (q->tokens_avail < 1) in sfb_rate_limit()
250 q->tokens_avail--; in sfb_rate_limit()
283 struct sfb_sched_data *q = qdisc_priv(sch); in sfb_enqueue() local
285 struct Qdisc *child = q->qdisc; in sfb_enqueue()
292 u32 slot = q->slot; in sfb_enqueue()
295 if (unlikely(sch->q.qlen >= q->limit)) { in sfb_enqueue()
297 q->stats.queuedrop++; in sfb_enqueue()
301 if (q->rehash_interval > 0) { in sfb_enqueue()
302 unsigned long limit = q->rehash_time + q->rehash_interval; in sfb_enqueue()
305 sfb_swap_slot(q); in sfb_enqueue()
306 q->rehash_time = jiffies; in sfb_enqueue()
307 } else if (unlikely(!q->double_buffering && q->warmup_time > 0 && in sfb_enqueue()
308 time_after(jiffies, limit - q->warmup_time))) { in sfb_enqueue()
309 q->double_buffering = true; in sfb_enqueue()
313 fl = rcu_dereference_bh(q->filter_list); in sfb_enqueue()
320 sfbhash = siphash_1u32(salt, &q->bins[slot].perturbation); in sfb_enqueue()
322 sfbhash = skb_get_hash_perturb(skb, &q->bins[slot].perturbation); in sfb_enqueue()
332 struct sfb_bucket *b = &q->bins[slot].bins[i][hash]; in sfb_enqueue()
336 decrement_prob(b, q); in sfb_enqueue()
337 else if (b->qlen >= q->bin_size) in sfb_enqueue()
338 increment_prob(b, q); in sfb_enqueue()
348 if (unlikely(minqlen >= q->max)) { in sfb_enqueue()
350 q->stats.bucketdrop++; in sfb_enqueue()
356 if (q->double_buffering) { in sfb_enqueue()
358 &q->bins[slot].perturbation); in sfb_enqueue()
365 struct sfb_bucket *b = &q->bins[slot].bins[i][hash]; in sfb_enqueue()
369 decrement_prob(b, q); in sfb_enqueue()
370 else if (b->qlen >= q->bin_size) in sfb_enqueue()
371 increment_prob(b, q); in sfb_enqueue()
374 if (sfb_rate_limit(skb, q)) { in sfb_enqueue()
376 q->stats.penaltydrop++; in sfb_enqueue()
391 q->stats.earlydrop++; in sfb_enqueue()
396 q->stats.marked++; in sfb_enqueue()
398 q->stats.earlydrop++; in sfb_enqueue()
408 sch->q.qlen++; in sfb_enqueue()
409 increment_qlen(&cb, 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 if (likely(q->qdisc)) in sfb_reset()
459 qdisc_reset(q->qdisc); in sfb_reset()
460 q->slot = 0; in sfb_reset()
461 q->double_buffering = false; in sfb_reset()
462 sfb_zero_all_buckets(q); in sfb_reset()
463 sfb_init_perturbation(0, q); in sfb_reset()
468 struct sfb_sched_data *q = qdisc_priv(sch); in sfb_destroy() local
470 tcf_block_put(q->block); in sfb_destroy()
471 qdisc_put(q->qdisc); in sfb_destroy()
493 struct sfb_sched_data *q = qdisc_priv(sch); in sfb_change() local
524 qdisc_purge_queue(q->qdisc); in sfb_change()
525 old = q->qdisc; in sfb_change()
526 q->qdisc = child; in sfb_change()
528 q->rehash_interval = msecs_to_jiffies(ctl->rehash_interval); in sfb_change()
529 q->warmup_time = msecs_to_jiffies(ctl->warmup_time); in sfb_change()
530 q->rehash_time = jiffies; in sfb_change()
531 q->limit = limit; in sfb_change()
532 q->increment = ctl->increment; in sfb_change()
533 q->decrement = ctl->decrement; in sfb_change()
534 q->max = ctl->max; in sfb_change()
535 q->bin_size = ctl->bin_size; in sfb_change()
536 q->penalty_rate = ctl->penalty_rate; in sfb_change()
537 q->penalty_burst = ctl->penalty_burst; in sfb_change()
538 q->tokens_avail = ctl->penalty_burst; in sfb_change()
539 q->token_time = jiffies; in sfb_change()
541 q->slot = 0; in sfb_change()
542 q->double_buffering = false; in sfb_change()
543 sfb_zero_all_buckets(q); in sfb_change()
544 sfb_init_perturbation(0, q); in sfb_change()
545 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()
670 struct sfb_sched_data *q = qdisc_priv(sch); in sfb_tcf_block() local
674 return q->block; in sfb_tcf_block()