14 #include <linux/module.h>
15 #include <linux/slab.h>
16 #include <linux/types.h>
17 #include <linux/kernel.h>
18 #include <linux/string.h>
19 #include <linux/errno.h>
44 #ifdef CONFIG_NET_CLS_ACT
73 qdisc = prio_classify(skb, sch, &ret);
74 #ifdef CONFIG_NET_CLS_ACT
84 ret = qdisc_enqueue(skb, qdisc);
99 for (prio = 0; prio < q->
bands; prio++) {
101 struct sk_buff *skb = qdisc->
ops->peek(qdisc);
113 for (prio = 0; prio < q->
bands; prio++) {
115 struct sk_buff *skb = qdisc_dequeue_peeked(qdisc);
117 qdisc_bstats_update(sch, skb);
126 static unsigned int prio_drop(
struct Qdisc *sch)
133 for (prio = q->
bands-1; prio >= 0; prio--) {
135 if (qdisc->
ops->drop && (len = qdisc->
ops->drop(qdisc)) != 0) {
145 prio_reset(
struct Qdisc *sch)
150 for (prio = 0; prio < q->
bands; prio++)
156 prio_destroy(
struct Qdisc *sch)
162 for (prio = 0; prio < q->
bands; prio++)
172 if (nla_len(opt) <
sizeof(*qopt))
174 qopt = nla_data(opt);
196 sch_tree_unlock(sch);
198 for (i = 0; i < q->
bands; i++) {
200 struct Qdisc *child, *old;
215 sch_tree_unlock(sch);
222 static int prio_init(
struct Qdisc *sch,
struct nlattr *opt)
235 if ((err = prio_tune(sch, opt)) != 0)
241 static int prio_dump(
struct Qdisc *sch,
struct sk_buff *skb)
244 unsigned char *
b = skb_tail_pointer(skb);
247 opt.bands = q->
bands;
251 goto nla_put_failure;
260 static int prio_graft(
struct Qdisc *sch,
unsigned long arg,
struct Qdisc *
new,
264 unsigned long band = arg - 1;
274 sch_tree_unlock(sch);
279 static struct Qdisc *
280 prio_leaf(
struct Qdisc *sch,
unsigned long arg)
283 unsigned long band = arg - 1;
288 static unsigned long prio_get(
struct Qdisc *sch,
u32 classid)
291 unsigned long band =
TC_H_MIN(classid);
293 if (band - 1 >= q->
bands)
298 static unsigned long prio_bind(
struct Qdisc *sch,
unsigned long parent,
u32 classid)
300 return prio_get(sch, classid);
304 static void prio_put(
struct Qdisc *q,
unsigned long cl)
308 static int prio_dump_class(
struct Qdisc *sch,
unsigned long cl,
struct sk_buff *skb,
318 static int prio_dump_class_stats(
struct Qdisc *sch,
unsigned long cl,
325 cl_q->
qstats.qlen = cl_q->
q.qlen;
341 for (prio = 0; prio < q->
bands; prio++) {
346 if (arg->
fn(sch, prio + 1, arg) < 0) {
354 static struct tcf_proto **prio_find_tcf(
struct Qdisc *sch,
unsigned long cl)
369 .tcf_chain = prio_find_tcf,
370 .bind_tcf = prio_bind,
371 .unbind_tcf = prio_put,
372 .dump = prio_dump_class,
373 .dump_stats = prio_dump_class_stats,
378 .cl_ops = &prio_class_ops,
381 .enqueue = prio_enqueue,
382 .dequeue = prio_dequeue,
387 .destroy = prio_destroy,
393 static int __init prio_module_init(
void)
398 static void __exit prio_module_exit(
void)