Lines Matching refs:sch
141 static void tbf_offload_change(struct Qdisc *sch) in tbf_offload_change() argument
143 struct tbf_sched_data *q = qdisc_priv(sch); in tbf_offload_change()
144 struct net_device *dev = qdisc_dev(sch); in tbf_offload_change()
151 qopt.handle = sch->handle; in tbf_offload_change()
152 qopt.parent = sch->parent; in tbf_offload_change()
155 qopt.replace_params.qstats = &sch->qstats; in tbf_offload_change()
160 static void tbf_offload_destroy(struct Qdisc *sch) in tbf_offload_destroy() argument
162 struct net_device *dev = qdisc_dev(sch); in tbf_offload_destroy()
169 qopt.handle = sch->handle; in tbf_offload_destroy()
170 qopt.parent = sch->parent; in tbf_offload_destroy()
174 static int tbf_offload_dump(struct Qdisc *sch) in tbf_offload_dump() argument
179 qopt.handle = sch->handle; in tbf_offload_dump()
180 qopt.parent = sch->parent; in tbf_offload_dump()
181 qopt.stats.bstats = &sch->bstats; in tbf_offload_dump()
182 qopt.stats.qstats = &sch->qstats; in tbf_offload_dump()
184 return qdisc_offload_dump_helper(sch, TC_SETUP_QDISC_TBF, &qopt); in tbf_offload_dump()
187 static void tbf_offload_graft(struct Qdisc *sch, struct Qdisc *new, in tbf_offload_graft() argument
191 .handle = sch->handle, in tbf_offload_graft()
192 .parent = sch->parent, in tbf_offload_graft()
197 qdisc_offload_graft_helper(qdisc_dev(sch), sch, new, old, in tbf_offload_graft()
204 static int tbf_segment(struct sk_buff *skb, struct Qdisc *sch, in tbf_segment() argument
207 struct tbf_sched_data *q = qdisc_priv(sch); in tbf_segment()
216 return qdisc_drop(skb, sch, to_free); in tbf_segment()
226 qdisc_qstats_drop(sch); in tbf_segment()
231 sch->q.qlen += nb; in tbf_segment()
233 qdisc_tree_reduce_backlog(sch, 1 - nb, prev_len - len); in tbf_segment()
238 static int tbf_enqueue(struct sk_buff *skb, struct Qdisc *sch, in tbf_enqueue() argument
241 struct tbf_sched_data *q = qdisc_priv(sch); in tbf_enqueue()
248 return tbf_segment(skb, sch, to_free); in tbf_enqueue()
249 return qdisc_drop(skb, sch, to_free); in tbf_enqueue()
254 qdisc_qstats_drop(sch); in tbf_enqueue()
258 sch->qstats.backlog += len; in tbf_enqueue()
259 sch->q.qlen++; in tbf_enqueue()
268 static struct sk_buff *tbf_dequeue(struct Qdisc *sch) in tbf_dequeue() argument
270 struct tbf_sched_data *q = qdisc_priv(sch); in tbf_dequeue()
303 qdisc_qstats_backlog_dec(sch, skb); in tbf_dequeue()
304 sch->q.qlen--; in tbf_dequeue()
305 qdisc_bstats_update(sch, skb); in tbf_dequeue()
323 qdisc_qstats_overlimit(sch); in tbf_dequeue()
328 static void tbf_reset(struct Qdisc *sch) in tbf_reset() argument
330 struct tbf_sched_data *q = qdisc_priv(sch); in tbf_reset()
333 sch->qstats.backlog = 0; in tbf_reset()
334 sch->q.qlen = 0; in tbf_reset()
351 static int tbf_change(struct Qdisc *sch, struct nlattr *opt, in tbf_change() argument
355 struct tbf_sched_data *q = qdisc_priv(sch); in tbf_change()
421 if (max_size < psched_mtu(qdisc_dev(sch))) in tbf_change()
423 max_size, qdisc_dev(sch)->name, in tbf_change()
424 psched_mtu(qdisc_dev(sch))); in tbf_change()
436 child = fifo_create_dflt(sch, &bfifo_qdisc_ops, qopt->limit, in tbf_change()
447 sch_tree_lock(sch); in tbf_change()
469 sch_tree_unlock(sch); in tbf_change()
472 tbf_offload_change(sch); in tbf_change()
477 static int tbf_init(struct Qdisc *sch, struct nlattr *opt, in tbf_init() argument
480 struct tbf_sched_data *q = qdisc_priv(sch); in tbf_init()
482 qdisc_watchdog_init(&q->watchdog, sch); in tbf_init()
490 return tbf_change(sch, opt, extack); in tbf_init()
493 static void tbf_destroy(struct Qdisc *sch) in tbf_destroy() argument
495 struct tbf_sched_data *q = qdisc_priv(sch); in tbf_destroy()
498 tbf_offload_destroy(sch); in tbf_destroy()
502 static int tbf_dump(struct Qdisc *sch, struct sk_buff *skb) in tbf_dump() argument
504 struct tbf_sched_data *q = qdisc_priv(sch); in tbf_dump()
509 err = tbf_offload_dump(sch); in tbf_dump()
544 static int tbf_dump_class(struct Qdisc *sch, unsigned long cl, in tbf_dump_class() argument
547 struct tbf_sched_data *q = qdisc_priv(sch); in tbf_dump_class()
555 static int tbf_graft(struct Qdisc *sch, unsigned long arg, struct Qdisc *new, in tbf_graft() argument
558 struct tbf_sched_data *q = qdisc_priv(sch); in tbf_graft()
563 *old = qdisc_replace(sch, new, &q->qdisc); in tbf_graft()
565 tbf_offload_graft(sch, new, *old, extack); in tbf_graft()
569 static struct Qdisc *tbf_leaf(struct Qdisc *sch, unsigned long arg) in tbf_leaf() argument
571 struct tbf_sched_data *q = qdisc_priv(sch); in tbf_leaf()
575 static unsigned long tbf_find(struct Qdisc *sch, u32 classid) in tbf_find() argument
580 static void tbf_walk(struct Qdisc *sch, struct qdisc_walker *walker) in tbf_walk() argument
584 if (walker->fn(sch, 1, walker) < 0) { in tbf_walk()