net: sched: register noqueue qdisc
authorPhil Sutter <phil@nwl.cc>
Thu, 27 Aug 2015 19:21:38 +0000 (21:21 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 28 Aug 2015 00:14:30 +0000 (17:14 -0700)
This way users can attach noqueue just like any other qdisc using tc
without having to mess with tx_queue_len first.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/sch_generic.h
net/sched/sch_api.c
net/sched/sch_generic.c

index 2eab08c38e3283efd696bfff4198a16ad27c1d16..444faa89a55fdd5e2b581d0ae93c3553268fa7e5 100644 (file)
@@ -340,6 +340,7 @@ extern struct Qdisc noop_qdisc;
 extern struct Qdisc_ops noop_qdisc_ops;
 extern struct Qdisc_ops pfifo_fast_ops;
 extern struct Qdisc_ops mq_qdisc_ops;
+extern struct Qdisc_ops noqueue_qdisc_ops;
 extern const struct Qdisc_ops *default_qdisc_ops;
 
 struct Qdisc_class_common {
index 59c227f26b56f84f7dce499d4f1dc73464b14b37..a3c70a18a7647eaf694ce1a064f56d935ac87309 100644 (file)
@@ -1942,6 +1942,7 @@ static int __init pktsched_init(void)
        register_qdisc(&bfifo_qdisc_ops);
        register_qdisc(&pfifo_head_drop_qdisc_ops);
        register_qdisc(&mq_qdisc_ops);
+       register_qdisc(&noqueue_qdisc_ops);
 
        rtnl_register(PF_UNSPEC, RTM_NEWQDISC, tc_modify_qdisc, NULL, NULL);
        rtnl_register(PF_UNSPEC, RTM_DELQDISC, tc_get_qdisc, NULL, NULL);
index f501b7409320a7e3f9199abaaefeabd211c097da..d5c7c0d887864ec2d4d819efc44dcac4fe111b80 100644 (file)
@@ -416,9 +416,19 @@ struct Qdisc noop_qdisc = {
 };
 EXPORT_SYMBOL(noop_qdisc);
 
-static struct Qdisc_ops noqueue_qdisc_ops __read_mostly = {
+static int noqueue_init(struct Qdisc *qdisc, struct nlattr *opt)
+{
+       /* register_qdisc() assigns a default of noop_enqueue if unset,
+        * but __dev_queue_xmit() treats noqueue only as such
+        * if this is NULL - so clear it here. */
+       qdisc->enqueue = NULL;
+       return 0;
+}
+
+struct Qdisc_ops noqueue_qdisc_ops __read_mostly = {
        .id             =       "noqueue",
        .priv_size      =       0,
+       .init           =       noqueue_init,
        .enqueue        =       noop_enqueue,
        .dequeue        =       noop_dequeue,
        .peek           =       noop_dequeue,