Skip to contentSkip to conversation

net: allow configuring default qdisc

PATCH In review Stephen Hemminger 2 participants 4 messages Apr 8, 2017 – Apr 13, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 net: allow configuring default qdisc

Since 3.12 it has been possible to configure the default queuing discipline via sysctl. This patch adds ability to configure the default queue discipline in kernel configuration. This is useful for environments where configuring the value from userspace is difficult to manage.

The default is still the same as before (pfifo_fast) and it is possible to change after kernel init with sysctl. This is similar to how TCP congestion control works.

---
v2 - rearrange order of menu items
use pfifo_fast not pfifo

 net/sched/Kconfig   | 31 +++++++++++++++++++++++++++++++
 net/sched/sch_api.c |  7 +++++++
 2 files changed, 38 insertions(+)
net/sched/Kconfig +31 -0
index 403790cce7d2..c1243b8e6465 100644
@@ -352,6 +352,37 @@ config NET_SCH_PLUG
 	  To compile this code as a module, choose M here: the
 	  module will be called sch_plug.
 
+choice
+	prompt "Default queuing discipline"
+	default DEFAULT_PFIFO_FAST
+	help
+	  Select the queueing discipline that will be used by default
+	  for all network devices.
+
+	config DEFAULT_FQ
+		bool "Fair Queue" if NET_SCH_FQ
+
+	config DEFAULT_CODEL
+		bool "Controlled Delay" if NET_SCH_CODEL
+
+	config DEFAULT_FQ_CODEL
+		bool "Fair Queue Controlled Delay" if NET_SCH_FQ_CODEL
+
+	config DEFAULT_SFQ
+		bool "Stochastic Fair Queue" if NET_SCH_SFQ
+
+	config DEFAULT_PFIFO_FAST
+		bool "Priority FIFO Fast"
+endchoice
+
+config DEFAULT_NET_SCH
+	string
+	default "pfifo_fast" if DEFAULT_PFIFO_FAST
+	default "fq" if DEFAULT_FQ
+	default "fq_codel" if DEFAULT_FQ_CODEL
+	default "sfq" if DEFAULT_SFQ
+	default "pfifo_fast"
+
 comment "Classification"
 
 config NET_CLS
net/sched/sch_api.c +7 -0
index 62567bfe52c7..0d82f76f622d 100644
@@ -251,6 +251,13 @@ int qdisc_set_default(const char *name)
 	return ops ? 0 : -ENOENT;
 }
 
+/* Set default value from kernel config */
+static int __init sch_default_qdisc(void)
+{
+	return qdisc_set_default(CONFIG_DEFAULT_NET_SCH);
+}
+late_initcall(sch_default_qdisc);
+
 /* We know handle. Find qdisc among all qdisc's attached to device
  * (root qdisc, all its children, children of children etc.)
  * Note: caller either uses rtnl or rcu_read_lock()
Signature · 1 line
2.11.0
maintainer
#1 lore raw

From: Stephen Hemminger <[email protected]>
Date: Sat, 8 Apr 2017 15:39:46 -0400

Quoted 6 lines

Since 3.12 it has been possible to configure the default queuing discipline via sysctl. This patch adds ability to configure the default queue discipline in kernel configuration. This is useful for environments where configuring the value from userspace is difficult to manage.

Quoted 8 lines

The default is still the same as before (pfifo_fast) and it is possible to change after kernel init with sysctl. This is similar to how TCP congestion control works.

---
v2 - rearrange order of menu items
use pfifo_fast not pfifo

Stephen I'm still thinking about this.

Normal users typing "make oldconfig" shouldn't be asked a question like this. They have no idea. This is just like how we hide all the advanced ipv4 routing choices behind the Kconfig symbol IP_ADVANCED_ROUTER and TCP congestion control with TCP_CONG_ADVANCED.

And from experience I know that if it shows up when Linus types 'make' after pulling this in, he will complain :-)

author Reviewed-by Bart Van Assche Reviewed-by Omar Sandoval
#2 lore raw
Quoted 20 lines · On Tue, 11 Apr 2017 22:09:59 -0400 (EDT) David Miller <[email protected]>…

From: Stephen Hemminger <[email protected]>
Date: Sat, 8 Apr 2017 15:39:46 -0400

Quoted 6 lines

Since 3.12 it has been possible to configure the default queuing discipline via sysctl. This patch adds ability to configure the default queue discipline in kernel configuration. This is useful for environments where configuring the value from userspace is difficult to manage.

Quoted 8 lines

The default is still the same as before (pfifo_fast) and it is possible to change after kernel init with sysctl. This is similar to how TCP congestion control works.

---
v2 - rearrange order of menu items
use pfifo_fast not pfifo

Stephen I'm still thinking about this.

Quoted 7 lines

Normal users typing "make oldconfig" shouldn't be asked a question like this. They have no idea. This is just like how we hide all the advanced ipv4 routing choices behind the Kconfig symbol IP_ADVANCED_ROUTER and TCP congestion control with TCP_CONG_ADVANCED.

And from experience I know that if it shows up when Linus types 'make' after pulling this in, he will complain :-)

I understand your concern about less clueful users not knowing what to answer. But there have been many recent cases where things have been added with the adage "just hit return and take the default".

The most recent example was in the block layer.

commit d34849913819a5e0cbfbe724dbe79df89278c524

Author: Jens Axboe <[email protected]>
Date:   Fri Jan 13 14:43:58 2017 -0700

blk-mq-sched: allow setting of default IO scheduler

Add Kconfig entries to manage what devices get assigned an MQ scheduler, and add a blk-mq flag for drivers to opt out of scheduling. The latter is useful for admin type queues that still allocate a blk-mq queue and tag set, but aren't use for normal IO.

Maybe Linus understands IO better than networking :=)

maintainer
#3 lore raw

From: Stephen Hemminger <[email protected]>
Date: Wed, 12 Apr 2017 15:59:25 -0700

Quoted 1 line

The most recent example was in the block layer.

Linus complained about this, loudly.