Skip to content

Commit 25db26a

Browse files
vcgomesdavem330
authored andcommitted
net/sched: Introduce the ETF Qdisc
The ETF (Earliest TxTime First) qdisc uses the information added earlier in this series (the socket option SO_TXTIME and the new role of sk_buff->tstamp) to schedule packets transmission based on absolute time. For some workloads, just bandwidth enforcement is not enough, and precise control of the transmission of packets is necessary. Example: $ tc qdisc replace dev enp2s0 parent root handle 100 mqprio num_tc 3 \ map 2 2 1 0 2 2 2 2 2 2 2 2 2 2 2 2 queues 1@0 1@1 2@2 hw 0 $ tc qdisc add dev enp2s0 parent 100:1 etf delta 100000 \ clockid CLOCK_TAI In this example, the Qdisc will provide SW best-effort for the control of the transmission time to the network adapter, the time stamp in the socket will be in reference to the clockid CLOCK_TAI and packets will leave the qdisc "delta" (100000) nanoseconds before its transmission time. The ETF qdisc will buffer packets sorted by their txtime. It will drop packets on enqueue() if their skbuff clockid does not match the clock reference of the Qdisc. Moreover, on dequeue(), a packet will be dropped if it expires while being enqueued. The qdisc also supports the SO_TXTIME deadline mode. For this mode, it will dequeue a packet as soon as possible and change the skb timestamp to 'now' during etf_dequeue(). Note that both the qdisc's and the SO_TXTIME ABIs allow for a clockid to be configured, but it's been decided that usage of CLOCK_TAI should be enforced until we decide to allow for other clockids to be used. The rationale here is that PTP times are usually in the TAI scale, thus no other clocks should be necessary. For now, the qdisc will return EINVAL if any clocks other than CLOCK_TAI are used. Signed-off-by: Jesus Sanchez-Palencia <[email protected]> Signed-off-by: Vinicius Costa Gomes <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 860b642 commit 25db26a

File tree

5 files changed

+414
-0
lines changed

5 files changed

+414
-0
lines changed

include/linux/netdevice.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,7 @@ enum tc_setup_type {
798798
TC_SETUP_QDISC_RED,
799799
TC_SETUP_QDISC_PRIO,
800800
TC_SETUP_QDISC_MQ,
801+
TC_SETUP_QDISC_ETF,
801802
};
802803

803804
/* These structures hold the attributes of bpf state that are being passed

include/uapi/linux/pkt_sched.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -937,4 +937,21 @@ enum {
937937

938938
#define TCA_CBS_MAX (__TCA_CBS_MAX - 1)
939939

940+
941+
/* ETF */
942+
struct tc_etf_qopt {
943+
__s32 delta;
944+
__s32 clockid;
945+
__u32 flags;
946+
#define TC_ETF_DEADLINE_MODE_ON BIT(0)
947+
};
948+
949+
enum {
950+
TCA_ETF_UNSPEC,
951+
TCA_ETF_PARMS,
952+
__TCA_ETF_MAX,
953+
};
954+
955+
#define TCA_ETF_MAX (__TCA_ETF_MAX - 1)
956+
940957
#endif

net/sched/Kconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,17 @@ config NET_SCH_CBS
183183
To compile this code as a module, choose M here: the
184184
module will be called sch_cbs.
185185

186+
config NET_SCH_ETF
187+
tristate "Earliest TxTime First (ETF)"
188+
help
189+
Say Y here if you want to use the Earliest TxTime First (ETF) packet
190+
scheduling algorithm.
191+
192+
See the top of <file:net/sched/sch_etf.c> for more details.
193+
194+
To compile this code as a module, choose M here: the
195+
module will be called sch_etf.
196+
186197
config NET_SCH_GRED
187198
tristate "Generic Random Early Detection (GRED)"
188199
---help---

net/sched/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ obj-$(CONFIG_NET_SCH_FQ) += sch_fq.o
5454
obj-$(CONFIG_NET_SCH_HHF) += sch_hhf.o
5555
obj-$(CONFIG_NET_SCH_PIE) += sch_pie.o
5656
obj-$(CONFIG_NET_SCH_CBS) += sch_cbs.o
57+
obj-$(CONFIG_NET_SCH_ETF) += sch_etf.o
5758

5859
obj-$(CONFIG_NET_CLS_U32) += cls_u32.o
5960
obj-$(CONFIG_NET_CLS_ROUTE4) += cls_route.o

0 commit comments

Comments
 (0)