Skip to contentSkip to conversation

net_sched: allow configuring default qdisc

PATCH Superseded Stephen Hemminger 2 participants 2 messages Apr 8, 2017

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net_sched: 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 analagous to how TCP congestion control is configured.

---
 net/sched/Kconfig   | 31 +++++++++++++++++++++++++++++++
 net/sched/sch_api.c |  7 +++++++
 2 files changed, 38 insertions(+)
net/sched/Kconfig +31 -0
index 403790cce7d2..8fb45655e59b 100644
@@ -820,6 +820,37 @@ config NET_CLS_IND
 	  classification based on the incoming device. This option is
 	  likely to disappear in favour of the metadata ematch.
 
+choice
+	prompt "Default queuing discipline"
+	default DEFAULT_PFIFO
+	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_FQ_CODEL
+		bool "Fair Queue Controlled Delay (FQ_CODEL)" if NET_SCH_FQ_CODEL
+
+	config DEFAULT_CODEL
+		bool "Controlled Delay (CODEL)" if NET_SCH_CODEL
+
+	config DEFAULT_SFQ
+		bool "Stochastic Fair Queue (SFQ)" if NET_SCH_SFQ
+
+	config DEFAULT_PFIFO
+		bool "Priority FIFO"
+endchoice
+
+config DEFAULT_NET_SCH
+	string
+	default "pfifo" if DEFAULT_PFIFO
+	default "fq" if DEFAULT_FQ
+	default "fq_codel" if DEFAULT_FQ_CODEL
+	default "sfq" if DEFAULT_SFQ
+	default "pfifo"
+
 endif # NET_SCHED
 
 config NET_SCH_FIFO
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
#1 lore raw
Quoted 45 lines · Stephen Hemminger

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 analagous to how TCP congestion control is configured.

---
 net/sched/Kconfig   | 31 +++++++++++++++++++++++++++++++
 net/sched/sch_api.c |  7 +++++++
 2 files changed, 38 insertions(+)
net/sched/Kconfig +22 -0
index 403790cce7d2..8fb45655e59b 100644
@@ -820,6 +820,37 @@ config NET_CLS_IND
 	  classification based on the incoming device. This option is
 	  likely to disappear in favour of the metadata ematch.
 
+choice
+	prompt "Default queuing discipline"
+	default DEFAULT_PFIFO
+	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_FQ_CODEL
+		bool "Fair Queue Controlled Delay (FQ_CODEL)" if NET_SCH_FQ_CODEL
+
+	config DEFAULT_CODEL
+		bool "Controlled Delay (CODEL)" if NET_SCH_CODEL
+
+	config DEFAULT_SFQ
+		bool "Stochastic Fair Queue (SFQ)" if NET_SCH_SFQ
+
+	config DEFAULT_PFIFO
+		bool "Priority FIFO"
+endchoice

net/sched/Kconfig config NET_CLS_IND · line 854

Quoted 10 lines
net/sched/Kconfig +9 -0
+
+config DEFAULT_NET_SCH
+	string
+	default "pfifo" if DEFAULT_PFIFO
+	default "fq" if DEFAULT_FQ
+	default "fq_codel" if DEFAULT_FQ_CODEL
+	default "sfq" if DEFAULT_SFQ
+	default "pfifo"
+
 endif # NET_SCHED

Note that pfifo != pfifo_fast

We probably still want pfifo_fast being the default ?