1CBS(8) Linux CBS(8)
2
3
4
6 CBS - Credit Based Shaper (CBS) Qdisc
7
9 tc qdisc ... dev dev parent classid [ handle major: ] cbs idleslope
10 idleslope sendslope sendslope hicredit hicredit locredit locredit [
11 offload 0|1 ]
12
13
15 The CBS (Credit Based Shaper) qdisc implements the shaping algorithm
16 defined by the IEEE 802.1Q-2014 Section 8.6.8.2, which applies a well
17 defined rate limiting method to the traffic.
18
19 This queueing discipline is intended to be used by TSN (Time Sensitive
20 Networking) applications, the CBS parameters are derived directly by
21 what is described by the Annex L of the IEEE 802.1Q-2014 Specification.
22 The algorithm and how it affects the latency are detailed there.
23
24 CBS is meant to be installed under another qdisc that maps packet flows
25 to traffic classes, one example is mqprio(8).
26
27
29 idleslope
30 Idleslope is the rate of credits that is accumulated (in kilo‐
31 bits per second) when there is at least one packet waiting for
32 transmission. Packets are transmitted when the current value of
33 credits is equal or greater than zero. When there is no packet
34 to be transmitted the amount of credits is set to zero. This is
35 the main tunable of the CBS algorithm and represents the band‐
36 width that will be consumed. Note that when calculating idles‐
37 lope, the entire packet size must be considered, including head‐
38 ers from all layers (i.e. MAC framing and any overhead from the
39 physical layer), as described by IEEE 802.1Q-2014 section 34.4.
40
41 As an example, for an ethernet frame carrying 284 bytes of pay‐
42 load, and with no VLAN tags, you must add 14 bytes for the Eth‐
43 ernet headers, 4 bytes for the Frame check sequence (CRC), and
44 20 bytes for the L1 overhead: 12 bytes of interpacket gap, 7
45 bytes of preamble and 1 byte of start of frame delimiter. That
46 results in 322 bytes for the total packet size, which is then
47 used for calculating the idleslope.
48
49
50 sendslope
51 Sendslope is the rate of credits that is depleted (it should be
52 a negative number of kilobits per second) when a transmission is
53 occurring. It can be calculated as follows, (IEEE 802.1Q-2014
54 Section 8.6.8.2 item g):
55
56 sendslope = idleslope - port_transmit_rate
57
58
59 hicredit
60 Hicredit defines the maximum amount of credits (in bytes) that
61 can be accumulated. Hicredit depends on the characteristics of
62 interfering traffic, 'max_interference_size' is the maximum size
63 of any burst of traffic that can delay the transmission of a
64 frame that is available for transmission for this traffic class,
65 (IEEE 802.1Q-2014 Annex L, Equation L-3):
66
67 hicredit = max_interference_size * (idleslope / port_trans‐
68 mit_rate)
69
70
71 locredit
72 Locredit is the minimum amount of credits that can be reached.
73 It is a function of the traffic flowing through this qdisc (IEEE
74 802.1Q-2014 Annex L, Equation L-2):
75
76 locredit = max_frame_size * (sendslope / port_transmit_rate)
77
78
79 offload
80 When offload is 1, cbs(8) will try to configure the network
81 interface so the CBS algorithm runs in the controller. The
82 default is 0.
83
84
86 CBS is used to enforce a Quality of Service by limiting the data rate
87 of a traffic class, to separate packets into traffic classes the user
88 may choose mqprio(8), and configure it like this:
89
90 # tc qdisc add dev eth0 handle 100: parent root mqprio num_tc 3 \
91 map 2 2 1 0 2 2 2 2 2 2 2 2 2 2 2 2 \
92 queues 1@0 1@1 2@2 \
93 hw 0
94
95 To replace the current queuing disciple by CBS in the current queueing
96 discipline connected to traffic class number 0, issue:
97
98 # tc qdisc replace dev eth0 parent 100:4 cbs \
99 locredit -1470 hicredit 30 sendslope -980000 idleslope 20000
100
101 These values are obtained from the following parameters, idleslope is
102 20mbit/s, the transmission rate is 1Gbit/s and the maximum interfering
103 frame size is 1500 bytes.
104
105
107 Vinicius Costa Gomes <vinicius.gomes@intel.com>
108
109
110
111iproute2 18 Sept 2017 CBS(8)