Simply put, a qdisc is a scheduler (Section 3.2). Every output interface needs a scheduler of some kind, and the default scheduler is a FIFO. Other qdiscs available under Linux will rearrange the packets entering the scheduler's queue in accordance with that scheduler's rules.
简单来说,一个 qdisc 就是一个调度器。每个输出接口都需要某种调度器,默认调度器是一个 FIFO。Linux 下可用的其他 qdisc 将根据调度程序的规则重新排列进入调度程序队列的数据包。
The qdisc is the major building block on which all of Linux traffic control is built, and is also called a queuing discipline.
qdisc 是构建所有 Linux 流量控制的主要构成模块,也称为排队规则。
The classful qdiscs can contain classes, and provide a handle to which to attach filters. There is no prohibition on using a classful qdisc without child classes, although this will usually consume cycles and other system resources for no benefit.
有类 qdisc 可以包含类,并提供附加过滤器的句柄。没有禁止使用没有子类的有类 qdisc,尽管这通常会消耗周期和其他系统资源而没有任何好处。
The classless qdiscs can contain no classes, nor is it possible to attach filter to a classless qdisc. Because a classless qdisc contains no children of any kind, there is no utility to classifying. This means that no filter can be attached to a classless qdisc.
无类 qdisc 不能包含任何类,也不可能将过滤器附加到无类 qdisc。因为无类 qdisc 不包含任何类型的孩子,所以分类没有用处。这意味着没有过滤器可以附加到无类 qdisc
A source of terminology confusion is the usage of the terms root qdisc and ingress qdisc. These are not really queuing disciplines, but rather locations onto which traffic control structures can be attached for egress (outbound traffic) and ingress (inbound traffic).
Each interface contains both. The primary and more common is the egress qdisc, known as the root qdisc. It can contain any of the queuing disciplines (qdiscs) with potential classes and class structures. The overwhelming majority of documentation applies to the root qdisc and its children. Traffic transmitted on an interface traverses the egress or root qdisc.
For traffic accepted on an interface, the ingress qdisc is traversed. With its limited utility, it allows no child class to be created, and only exists as an object onto which a filter can be attached. For practical purposes, the ingress qdisc is merely a convenient object onto which to attach a policer to limit the amount of traffic accepted on a network interface.
In short, you can do much more with an egress qdisc because it contains a real qdisc and the full power of the traffic control system. An ingress qdisc can only support a policer. The remainder of the documentation will concern itself with traffic control structures attached to the root qdisc unless otherwise specified.
traditional elementLinux componentshapingThe class offers shaping capabilities.schedulingA qdisc is a scheduler. Schedulers canbe simple such as the FIFO or complex,containing classes and other qdiscs,such as HTB.classifyingThe filter object performs the classificationthrough the agency of a classifier object.Strictly speaking,Linux classifiers cannot exist outside of a filter.policingA policer exists in the Linux traffic control implementationonly as part of a filter.droppingTo drop traffic requires a filter with a policer which uses "drop" as an action.markingThe dsmark qdisc is used for marking.
FQ_Codel (Fair Queuing Controlled Delay) is queuingdisciplinethat combines Fair Queuing with the CoDel AQMscheme. FQ_Codel uses a stochastic model to classifyincoming packets into different flows and is used toprovide a fair share of the bandwidth to all the flows using the queue.Each such flow is managed by the CoDel queuing discipline.Reordering within a flow is avoided since Codelinternally uses a FIFO queue.公平队列控制延迟是一种将公平队列与 CoDel AQM 方案相结合的排队规则。FQ_代码 使用随机模型将传入的数据包分类为 不同的流程,用于提供公平的份额 使用队列的所有流的带宽。每个这样的流程是 由 CoDel 排队规则管理。在流中重新排序由于 Codel 在内部使用 FIFO 队列,因此可以避免。
内核网络调度模块
/usr/lib/modules/5.15.0-56-generic/kernel/net/sched
heidsoft@heidsoft-dev:/usr/lib/modules/5.15.0-56-generic/kernel/net/sched$ ls -alh
total 2.5M
drwxr-xr-x 2 root root 4.0K 12月 26 06:24 .
drwxr-xr-x 61 root root 4.0K 12月 26 06:24 ..
-rw-r--r-- 1 root root 22K 11月 23 04:32 act_bpf.ko
-rw-r--r-- 1 root root 106K 11月 23 04:32 act_connmark.ko
-rw-r--r-- 1 root root 26K 11月 23 04:32 act_csum.ko
-rw-r--r-- 1 root root 110K 11月 23 04:32 act_ctinfo.ko
-rw-r--r-- 1 root root 141K 11月 23 04:32 act_ct.ko
-rw-r--r-- 1 root root 20K 11月 23 04:32 act_gact.ko
-rw-r--r-- 1 root root 24K 11月 23 04:32 act_gate.ko
-rw-r--r-- 1 root root 26K 11月 23 04:32 act_ipt.ko
-rw-r--r-- 1 root root 28K 11月 23 04:32 act_mirred.ko
-rw-r--r-- 1 root root 23K 11月 23 04:32 act_mpls.ko
-rw-r--r-- 1 root root 18K 11月 23 04:32 act_nat.ko
-rw-r--r-- 1 root root 24K 11月 23 04:32 act_pedit.ko
-rw-r--r-- 1 root root 26K 11月 23 04:32 act_police.ko
-rw-r--r-- 1 root root 20K 11月 23 04:32 act_sample.ko
-rw-r--r-- 1 root root 17K 11月 23 04:32 act_simple.ko
-rw-r--r-- 1 root root 19K 11月 23 04:32 act_skbedit.ko
-rw-r--r-- 1 root root 18K 11月 23 04:32 act_skbmod.ko
-rw-r--r-- 1 root root 32K 11月 23 04:32 act_tunnel_key.ko
-rw-r--r-- 1 root root 22K 11月 23 04:32 act_vlan.ko
-rw-r--r-- 1 root root 22K 11月 23 04:32 cls_basic.ko
-rw-r--r-- 1 root root 29K 11月 23 04:32 cls_bpf.ko
-rw-r--r-- 1 root root 16K 11月 23 04:32 cls_cgroup.ko
-rw-r--r-- 1 root root 96K 11月 23 04:32 cls_flower.ko
-rw-r--r-- 1 root root 28K 11月 23 04:32 cls_flow.ko
-rw-r--r-- 1 root root 24K 11月 23 04:32 cls_fw.ko
-rw-r--r-- 1 root root 24K 11月 23 04:32 cls_matchall.ko
-rw-r--r-- 1 root root 30K 11月 23 04:32 cls_route.ko
-rw-r--r-- 1 root root 28K 11月 23 04:32 cls_rsvp6.ko
-rw-r--r-- 1 root root 28K 11月 23 04:32 cls_rsvp.ko
-rw-r--r-- 1 root root 34K 11月 23 04:32 cls_tcindex.ko
-rw-r--r-- 1 root root 41K 11月 23 04:32 cls_u32.ko
-rw-r--r-- 1 root root 8.9K 11月 23 04:32 em_canid.ko
-rw-r--r-- 1 root root 7.3K 11月 23 04:32 em_cmp.ko
-rw-r--r-- 1 root root 17K 11月 23 04:32 em_ipset.ko
-rw-r--r-- 1 root root 19K 11月 23 04:32 em_ipt.ko
-rw-r--r-- 1 root root 38K 11月 23 04:32 em_meta.ko
-rw-r--r-- 1 root root 7.5K 11月 23 04:32 em_nbyte.ko
-rw-r--r-- 1 root root 11K 11月 23 04:32 em_text.ko
-rw-r--r-- 1 root root 6.7K 11月 23 04:32 em_u32.ko
-rw-r--r-- 1 root root 44K 11月 23 04:32 sch_atm.ko
-rw-r--r-- 1 root root 159K 11月 23 04:32 sch_cake.ko
-rw-r--r-- 1 root root 59K 11月 23 04:32 sch_cbq.ko
-rw-r--r-- 1 root root 28K 11月 23 04:32 sch_cbs.ko
-rw-r--r-- 1 root root 24K 11月 23 04:32 sch_choke.ko
-rw-r--r-- 1 root root 23K 11月 23 04:32 sch_codel.ko
-rw-r--r-- 1 root root 30K 11月 23 04:32 sch_drr.ko
-rw-r--r-- 1 root root 31K 11月 23 04:32 sch_dsmark.ko
-rw-r--r-- 1 root root 23K 11月 23 04:32 sch_etf.ko
-rw-r--r-- 1 root root 37K 11月 23 04:32 sch_ets.ko
-rw-r--r-- 1 root root 32K 11月 23 04:32 sch_fq_codel.ko
-rw-r--r-- 1 root root 33K 11月 23 04:32 sch_fq.ko
-rw-r--r-- 1 root root 24K 11月 23 04:32 sch_fq_pie.ko
-rw-r--r-- 1 root root 51K 11月 23 04:32 sch_gred.ko
-rw-r--r-- 1 root root 45K 11月 23 04:32 sch_hfsc.ko
-rw-r--r-- 1 root root 23K 11月 23 04:32 sch_hhf.ko
-rw-r--r-- 1 root root 74K 11月 23 04:32 sch_htb.ko
-rw-r--r-- 1 root root 15K 11月 23 04:32 sch_ingress.ko
-rw-r--r-- 1 root root 27K 11月 23 04:32 sch_mqprio.ko
-rw-r--r-- 1 root root 24K 11月 23 04:32 sch_multiq.ko
-rw-r--r-- 1 root root 34K 11月 23 04:32 sch_netem.ko
-rw-r--r-- 1 root root 23K 11月 23 04:32 sch_pie.ko
-rw-r--r-- 1 root root 12K 11月 23 04:32 sch_plug.ko
-rw-r--r-- 1 root root 25K 11月 23 04:32 sch_prio.ko
-rw-r--r-- 1 root root 51K 11月 23 04:32 sch_qfq.ko
-rw-r--r-- 1 root root 35K 11月 23 04:32 sch_red.ko
-rw-r--r-- 1 root root 29K 11月 23 04:32 sch_sfb.ko
-rw-r--r-- 1 root root 40K 11月 23 04:32 sch_sfq.ko
-rw-r--r-- 1 root root 19K 11月 23 04:32 sch_skbprio.ko
-rw-r--r-- 1 root root 57K 11月 23 04:32 sch_taprio.ko
-rw-r--r-- 1 root root 28K 11月 23 04:32 sch_tbf.ko
-rw-r--r-- 1 root root 22K 11月 23 04:32 sch_teql.ko
heidsoft@heidsoft-dev:/usr/lib/modules/5.15.0-56-generic/kernel/net/sched$
ubuntu qdisc 默认
root@heidsoft-dev:~# ip link list
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp0s5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
link/ether 00:1c:42:22:59:eb brd ff:ff:ff:ff:ff:ff