11 #include <linux/types.h>
12 #include <linux/slab.h>
13 #include <linux/kernel.h>
14 #include <linux/export.h>
15 #include <linux/string.h>
16 #include <linux/errno.h>
25 static void mq_destroy(
struct Qdisc *
sch)
49 if (!netif_is_multiqueue(dev))
59 dev_queue = netdev_get_tx_queue(dev, ntx);
76 static void mq_attach(
struct Qdisc *sch)
79 struct mq_sched *priv = qdisc_priv(sch);
104 qdisc = netdev_get_tx_queue(dev, ntx)->qdisc_sleeping;
105 spin_lock_bh(qdisc_lock(qdisc));
106 sch->
q.qlen += qdisc->
q.qlen;
114 spin_unlock_bh(qdisc_lock(qdisc));
122 unsigned long ntx = cl - 1;
126 return netdev_get_tx_queue(dev, ntx);
133 struct netdev_queue *dev_queue = mq_queue_get(sch, ntx);
138 return netdev_get_tx_queue(dev, 0);
143 static int mq_graft(
struct Qdisc *sch,
unsigned long cl,
struct Qdisc *
new,
159 static struct Qdisc *mq_leaf(
struct Qdisc *sch,
unsigned long cl)
166 static unsigned long mq_get(
struct Qdisc *sch,
u32 classid)
168 unsigned int ntx =
TC_H_MIN(classid);
170 if (!mq_queue_get(sch, ntx))
175 static void mq_put(
struct Qdisc *sch,
unsigned long cl)
179 static int mq_dump_class(
struct Qdisc *sch,
unsigned long cl,
190 static int mq_dump_class_stats(
struct Qdisc *sch,
unsigned long cl,
196 sch->
qstats.qlen = sch->
q.qlen;
213 if (arg->
fn(sch, ntx + 1, arg) < 0) {
222 .select_queue = mq_select_queue,
228 .dump = mq_dump_class,
229 .dump_stats = mq_dump_class_stats,
233 .cl_ops = &mq_class_ops,
235 .priv_size =
sizeof(
struct mq_sched),
237 .destroy = mq_destroy,