summaryrefslogtreecommitdiffstats
path: root/man/man8/tc-taprio.8
blob: bf489b032a7eb3205a458b804288602497fc5b68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
.TH TAPRIO 8 "25 Sept 2018" "iproute2" "Linux"
.SH NAME
TAPRIO \- Time Aware Priority Shaper
.SH SYNOPSIS
.B tc qdisc ... dev
dev
.B parent
classid
.B [ handle
major:
.B ] taprio num_tc
tcs
.ti +8
.B map
P0 P1 P2 ...
.B queues
count1@offset1 count2@offset2 ...
.ti +8
.B base-time
base-time
.B clockid
clockid
.ti +8
.B sched-entry
<command 1> <gate mask 1> <interval 1>
.ti +8
.B sched-entry
<command 2> <gate mask 2> <interval 2>
.ti +8
.B sched-entry
<command 3> <gate mask 3> <interval 3>
.ti +8
.B sched-entry
<command N> <gate mask N> <interval N>
.ti +8
[
.B max-sdu
<queueMaxSDU[TC 0]> <queueMaxSDU[TC 1]> <queueMaxSDU[TC N]> ]
.ti +8
[
.B fp
<adminStatus[TC 0]> <adminStatus[TC 1]> <adminStatus[TC N]> ]

.SH DESCRIPTION
The TAPRIO qdisc implements a simplified version of the scheduling
state machine defined by IEEE 802.1Q-2018 Section 8.6.9, which allows
configuration of a sequence of gate states, where each gate state
allows outgoing traffic for a subset (potentially empty) of traffic
classes.

How traffic is mapped to different hardware queues is similar to
.BR mqprio(8)
and so the
.B map
and
.B queues
parameters have the same meaning.

The other parameters specify the schedule, and at what point in time
it should start (it can behave as the schedule started in the past).

.SH PARAMETERS
.TP
num_tc
.BR
Number of traffic classes to use. Up to 16 classes supported.

.TP
map
.br
The priority to traffic class map. Maps priorities 0..15 to a specified
traffic class. See
.BR mqprio(8)
for more details.

.TP
queues
.br
Provide count and offset of queue range for each traffic class. In the
format,
.B count@offset.
Queue ranges for each traffic classes cannot overlap and must be a
contiguous range of queues.

.TP
base-time
.br
Specifies the instant in nanoseconds, using the reference of
.B clockid,
defining the time when the schedule starts. If 'base-time' is a time
in the past, the schedule will start at

base-time + (N * cycle-time)

where N is the smallest integer so the resulting time is greater than
"now", and "cycle-time" is the sum of all the intervals of the entries
in the schedule;

.TP
clockid
.br
Specifies the clock to be used by qdisc's internal timer for measuring
time and scheduling events. This argument must be omitted when using the
full-offload feature (flags 0x2), since in that case, the clockid is
implicitly /dev/ptpN (where N is given by
.B ethtool -T eth0 | grep 'PTP Hardware Clock'
), and therefore not necessarily synchronized with the system's CLOCK_TAI.

.TP
sched-entry
.br
There may multiple
.B sched-entry
parameters in a single schedule. Each one has the

sched-entry <command> <gatemask> <interval>

format. The only supported <command> is "S", which
means "SetGateStates", following the IEEE 802.1Q-2018 definition
(Table 8-7). <gate mask> is a bitmask where each bit is a associated
with a traffic class, so bit 0 (the least significant bit) being "on"
means that traffic class 0 is "active" for that schedule entry.
<interval> is a time duration, in nanoseconds, that specifies for how
long that state defined by <command> and <gate mask> should be held
before moving to the next entry.

.TP
flags
.br
This is a bit mask which specifies different modes for taprio.
.RS
.TP
.I 0x1
Enables the txtime-assist feature. In this mode, taprio will set the transmit
timestamp depending on the interval in which the packet needs to be
transmitted. It will then utililize the
.BR etf(8)
qdisc to sort and transmit the packets at the right time. The second example
can be used as a reference to configure this mode.
.TP
.I 0x2
Enables the full-offload feature. In this mode, taprio will pass the gate
control list to the NIC which will execute it cyclically in hardware.
When using full-offload, there is no need to specify the
.B clockid
argument.

The txtime-assist and full-offload features are mutually exclusive, i.e.
setting flags to 0x3 is invalid.
.RE

.TP
txtime-delay
.br
This parameter is specific to the txtime offload mode. It specifies the maximum
time a packet might take to reach the network card from the taprio qdisc. The
value should always be greater than the delta specified in the
.BR etf(8)
qdisc.

.TP
max-sdu
.br
Specifies an array containing at most 16 elements, one per traffic class, which
corresponds to the queueMaxSDU table from IEEE 802.1Q-2018. Each array element
represents the maximum L2 payload size that can egress that traffic class.
Elements that are not filled in default to 0. The value 0 means that the
traffic class can send packets up to the port's maximum MTU in size.

.TP
fp
.br
Selects whether traffic classes are express or preemptible. See
.BR tc-mqprio(8)
for details.

.SH EXAMPLES

The following example shows how an traffic schedule with three traffic
classes ("num_tc 3"), which are separated different traffic classes,
we are going to call these TC 0, TC 1 and TC 2. We could read the
"map" parameter below as: traffic with priority 3 is classified as TC
0, priority 2 is classified as TC 1 and the rest is classified as TC
2.

The schedule will start at instant 1528743495910289987 using the
reference CLOCK_TAI. The schedule is composed of three entries each of
300us duration.

.EX
# tc qdisc replace dev eth0 parent root handle 100 stab overhead 24 taprio \\
              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 \\
              base-time 1528743495910289987 \\
              sched-entry S 01 300000 \\
              sched-entry S 02 300000 \\
              sched-entry S 04 300000 \\
              clockid CLOCK_TAI
.EE

Following is an example to enable the txtime offload mode in taprio. See
.BR etf(8)
for more information about configuring the ETF qdisc.

.EX
# tc qdisc replace dev eth0 parent root handle 100 stab overhead 24 taprio \\
              num_tc 3 \\
              map 2 2 1 0 2 2 2 2 2 2 2 2 2 2 2 2 \\
              queues 1@0 1@0 1@0 \\
              base-time 1528743495910289987 \\
              sched-entry S 01 300000 \\
              sched-entry S 02 300000 \\
              sched-entry S 04 400000 \\
              flags 0x1 \\
              txtime-delay 200000 \\
              clockid CLOCK_TAI

# tc qdisc replace dev $IFACE parent 100:1 etf skip_skb_check \\
              offload delta 200000 clockid CLOCK_TAI
.EE

The following is a schedule in full offload mode. The
.B base-time
is 200 ns and the
.B cycle-time
is implicitly calculated as the sum of all
.B sched-entry
durations (i.e. 20 us + 20 us + 60 us = 100 us). Although the base-time is in
the past, the hardware will start executing the schedule at a PTP time equal to
the smallest integer multiple of 100 us, plus 200 ns, that is larger than the
NIC's current PTP time. In addition, the MTU for traffic class 5 is limited to
200 octets, so that the interference this creates upon traffic class 7 during
the time window when their gates are both open is bounded. The interference is
determined by the transmit time of the max SDU, plus the L2 header length, plus
the L1 overhead (determined from the size table specified using
.BR tc-stab(8)).

.EX
# tc qdisc add dev eth0 parent root stab overhead 24 taprio \\
              num_tc 8 \\
              map 0 1 2 3 4 5 6 7 \\
              queues 1@0 1@1 1@2 1@3 1@4 1@5 1@6 1@7 \\
              max-sdu 0 0 0 0 0 200 0 0 \\
              base-time 200 \\
              sched-entry S 80 20000 \\
              sched-entry S a0 20000 \\
              sched-entry S 5f 60000 \\
              flags 0x2
.EE

.SH SEE ALSO
.BR tc-stab(8)

.SH AUTHORS
Vinicius Costa Gomes <vinicius.gomes@intel.com>