Lines Matching refs:sch
76 static unsigned int fq_codel_classify(struct sk_buff *skb, struct Qdisc *sch, in fq_codel_classify() argument
79 struct fq_codel_sched_data *q = qdisc_priv(sch); in fq_codel_classify()
84 if (TC_H_MAJ(skb->priority) == sch->handle && in fq_codel_classify()
137 static unsigned int fq_codel_drop(struct Qdisc *sch, unsigned int max_packets, in fq_codel_drop() argument
140 struct fq_codel_sched_data *q = qdisc_priv(sch); in fq_codel_drop()
178 sch->qstats.drops += i; in fq_codel_drop()
179 sch->qstats.backlog -= len; in fq_codel_drop()
180 sch->q.qlen -= i; in fq_codel_drop()
184 static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch, in fq_codel_enqueue() argument
187 struct fq_codel_sched_data *q = qdisc_priv(sch); in fq_codel_enqueue()
194 idx = fq_codel_classify(skb, sch, &ret); in fq_codel_enqueue()
197 qdisc_qstats_drop(sch); in fq_codel_enqueue()
207 qdisc_qstats_backlog_inc(sch, skb); in fq_codel_enqueue()
217 if (++sch->q.qlen <= sch->limit && !memory_limited) in fq_codel_enqueue()
220 prev_backlog = sch->qstats.backlog; in fq_codel_enqueue()
221 prev_qlen = sch->q.qlen; in fq_codel_enqueue()
230 ret = fq_codel_drop(sch, q->drop_batch_size, to_free); in fq_codel_enqueue()
232 prev_qlen -= sch->q.qlen; in fq_codel_enqueue()
233 prev_backlog -= sch->qstats.backlog; in fq_codel_enqueue()
243 qdisc_tree_reduce_backlog(sch, prev_qlen - 1, in fq_codel_enqueue()
247 qdisc_tree_reduce_backlog(sch, prev_qlen, prev_backlog); in fq_codel_enqueue()
257 struct Qdisc *sch = ctx; in dequeue_func() local
258 struct fq_codel_sched_data *q = qdisc_priv(sch); in dequeue_func()
267 sch->q.qlen--; in dequeue_func()
268 sch->qstats.backlog -= qdisc_pkt_len(skb); in dequeue_func()
275 struct Qdisc *sch = ctx; in drop_func() local
278 qdisc_qstats_drop(sch); in drop_func()
281 static struct sk_buff *fq_codel_dequeue(struct Qdisc *sch) in fq_codel_dequeue() argument
283 struct fq_codel_sched_data *q = qdisc_priv(sch); in fq_codel_dequeue()
303 skb = codel_dequeue(sch, &sch->qstats.backlog, &q->cparams, in fq_codel_dequeue()
315 qdisc_bstats_update(sch, skb); in fq_codel_dequeue()
320 if (q->cstats.drop_count && sch->q.qlen) { in fq_codel_dequeue()
321 qdisc_tree_reduce_backlog(sch, q->cstats.drop_count, in fq_codel_dequeue()
335 static void fq_codel_reset(struct Qdisc *sch) in fq_codel_reset() argument
337 struct fq_codel_sched_data *q = qdisc_priv(sch); in fq_codel_reset()
350 sch->q.qlen = 0; in fq_codel_reset()
351 sch->qstats.backlog = 0; in fq_codel_reset()
369 static int fq_codel_change(struct Qdisc *sch, struct nlattr *opt, in fq_codel_change() argument
372 struct fq_codel_sched_data *q = qdisc_priv(sch); in fq_codel_change()
399 sch_tree_lock(sch); in fq_codel_change()
425 sch->limit = nla_get_u32(tb[TCA_FQ_CODEL_LIMIT]); in fq_codel_change()
439 while (sch->q.qlen > sch->limit || in fq_codel_change()
441 struct sk_buff *skb = fq_codel_dequeue(sch); in fq_codel_change()
447 qdisc_tree_reduce_backlog(sch, q->cstats.drop_count, q->cstats.drop_len); in fq_codel_change()
451 sch_tree_unlock(sch); in fq_codel_change()
455 static void fq_codel_destroy(struct Qdisc *sch) in fq_codel_destroy() argument
457 struct fq_codel_sched_data *q = qdisc_priv(sch); in fq_codel_destroy()
464 static int fq_codel_init(struct Qdisc *sch, struct nlattr *opt, in fq_codel_init() argument
467 struct fq_codel_sched_data *q = qdisc_priv(sch); in fq_codel_init()
471 sch->limit = 10*1024; in fq_codel_init()
475 q->quantum = psched_mtu(qdisc_dev(sch)); in fq_codel_init()
481 q->cparams.mtu = psched_mtu(qdisc_dev(sch)); in fq_codel_init()
484 err = fq_codel_change(sch, opt, extack); in fq_codel_init()
489 err = tcf_block_get(&q->block, &q->filter_list, sch, extack); in fq_codel_init()
513 if (sch->limit >= 1) in fq_codel_init()
514 sch->flags |= TCQ_F_CAN_BYPASS; in fq_codel_init()
516 sch->flags &= ~TCQ_F_CAN_BYPASS; in fq_codel_init()
527 static int fq_codel_dump(struct Qdisc *sch, struct sk_buff *skb) in fq_codel_dump() argument
529 struct fq_codel_sched_data *q = qdisc_priv(sch); in fq_codel_dump()
539 sch->limit) || in fq_codel_dump()
570 static int fq_codel_dump_stats(struct Qdisc *sch, struct gnet_dump *d) in fq_codel_dump_stats() argument
572 struct fq_codel_sched_data *q = qdisc_priv(sch); in fq_codel_dump_stats()
586 sch_tree_lock(sch); in fq_codel_dump_stats()
592 sch_tree_unlock(sch); in fq_codel_dump_stats()
597 static struct Qdisc *fq_codel_leaf(struct Qdisc *sch, unsigned long arg) in fq_codel_leaf() argument
602 static unsigned long fq_codel_find(struct Qdisc *sch, u32 classid) in fq_codel_find() argument
607 static unsigned long fq_codel_bind(struct Qdisc *sch, unsigned long parent, in fq_codel_bind() argument
617 static struct tcf_block *fq_codel_tcf_block(struct Qdisc *sch, unsigned long cl, in fq_codel_tcf_block() argument
620 struct fq_codel_sched_data *q = qdisc_priv(sch); in fq_codel_tcf_block()
627 static int fq_codel_dump_class(struct Qdisc *sch, unsigned long cl, in fq_codel_dump_class() argument
634 static int fq_codel_dump_class_stats(struct Qdisc *sch, unsigned long cl, in fq_codel_dump_class_stats() argument
637 struct fq_codel_sched_data *q = qdisc_priv(sch); in fq_codel_dump_class_stats()
663 sch_tree_lock(sch); in fq_codel_dump_class_stats()
669 sch_tree_unlock(sch); in fq_codel_dump_class_stats()
681 static void fq_codel_walk(struct Qdisc *sch, struct qdisc_walker *arg) in fq_codel_walk() argument
683 struct fq_codel_sched_data *q = qdisc_priv(sch); in fq_codel_walk()
695 if (arg->fn(sch, i + 1, arg) < 0) { in fq_codel_walk()