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