|
Packit Service |
3880ab |
.TH CBS 8 "18 Sept 2017" "iproute2" "Linux"
|
|
Packit Service |
3880ab |
.SH NAME
|
|
Packit Service |
3880ab |
CBS \- Credit Based Shaper (CBS) Qdisc
|
|
Packit Service |
3880ab |
.SH SYNOPSIS
|
|
Packit Service |
3880ab |
.B tc qdisc ... dev
|
|
Packit Service |
3880ab |
dev
|
|
Packit Service |
3880ab |
.B parent
|
|
Packit Service |
3880ab |
classid
|
|
Packit Service |
3880ab |
.B [ handle
|
|
Packit Service |
3880ab |
major:
|
|
Packit Service |
3880ab |
.B ] cbs idleslope
|
|
Packit Service |
3880ab |
idleslope
|
|
Packit Service |
3880ab |
.B sendslope
|
|
Packit Service |
3880ab |
sendslope
|
|
Packit Service |
3880ab |
.B hicredit
|
|
Packit Service |
3880ab |
hicredit
|
|
Packit Service |
3880ab |
.B locredit
|
|
Packit Service |
3880ab |
locredit
|
|
Packit Service |
3880ab |
.B [ offload
|
|
Packit Service |
3880ab |
0|1
|
|
Packit Service |
3880ab |
.B ]
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
.SH DESCRIPTION
|
|
Packit Service |
3880ab |
The CBS (Credit Based Shaper) qdisc implements the shaping algorithm
|
|
Packit Service |
3880ab |
defined by the IEEE 802.1Q-2014 Section 8.6.8.2, which applies a well
|
|
Packit Service |
3880ab |
defined rate limiting method to the traffic.
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
This queueing discipline is intended to be used by TSN (Time Sensitive
|
|
Packit Service |
3880ab |
Networking) applications, the CBS parameters are derived directly by
|
|
Packit Service |
3880ab |
what is described by the Annex L of the IEEE 802.1Q-2014
|
|
Packit Service |
3880ab |
Specification. The algorithm and how it affects the latency are
|
|
Packit Service |
3880ab |
detailed there.
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
CBS is meant to be installed under another qdisc that maps packet
|
|
Packit Service |
3880ab |
flows to traffic classes, one example is
|
|
Packit Service |
3880ab |
.BR mqprio(8).
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
.SH PARAMETERS
|
|
Packit Service |
3880ab |
.TP
|
|
Packit Service |
3880ab |
idleslope
|
|
Packit Service |
3880ab |
Idleslope is the rate of credits that is accumulated (in kilobits per
|
|
Packit Service |
3880ab |
second) when there is at least one packet waiting for transmission.
|
|
Packit Service |
3880ab |
Packets are transmitted when the current value of credits is equal or
|
|
Packit Service |
3880ab |
greater than zero. When there is no packet to be transmitted the
|
|
Packit Service |
3880ab |
amount of credits is set to zero. This is the main tunable of the CBS
|
|
Packit Service |
3880ab |
algorithm and represents the bandwidth that will be consumed.
|
|
Packit Service |
3880ab |
Note that when calculating idleslope, the entire packet size must be
|
|
Packit Service |
3880ab |
considered, including headers from all layers (i.e. MAC framing and any
|
|
Packit Service |
3880ab |
overhead from the physical layer), as described by IEEE 802.1Q-2014
|
|
Packit Service |
3880ab |
section 34.4.
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
As an example, for an ethernet frame carrying 284 bytes of payload,
|
|
Packit Service |
3880ab |
and with no VLAN tags, you must add 14 bytes for the Ethernet headers,
|
|
Packit Service |
3880ab |
4 bytes for the Frame check sequence (CRC), and 20 bytes for the L1
|
|
Packit Service |
3880ab |
overhead: 12 bytes of interpacket gap, 7 bytes of preamble and 1 byte
|
|
Packit Service |
3880ab |
of start of frame delimiter. That results in 322 bytes for the total
|
|
Packit Service |
3880ab |
packet size, which is then used for calculating the idleslope.
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
.TP
|
|
Packit Service |
3880ab |
sendslope
|
|
Packit Service |
3880ab |
Sendslope is the rate of credits that is depleted (it should be a
|
|
Packit Service |
3880ab |
negative number of kilobits per second) when a transmission is
|
|
Packit Service |
3880ab |
occurring. It can be calculated as follows, (IEEE 802.1Q-2014 Section
|
|
Packit Service |
3880ab |
8.6.8.2 item g):
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
sendslope = idleslope - port_transmit_rate
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
.TP
|
|
Packit Service |
3880ab |
hicredit
|
|
Packit Service |
3880ab |
Hicredit defines the maximum amount of credits (in bytes) that can be
|
|
Packit Service |
3880ab |
accumulated. Hicredit depends on the characteristics of interfering
|
|
Packit Service |
3880ab |
traffic, 'max_interference_size' is the maximum size of any burst of
|
|
Packit Service |
3880ab |
traffic that can delay the transmission of a frame that is available
|
|
Packit Service |
3880ab |
for transmission for this traffic class, (IEEE 802.1Q-2014 Annex L,
|
|
Packit Service |
3880ab |
Equation L-3):
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
hicredit = max_interference_size * (idleslope / port_transmit_rate)
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
.TP
|
|
Packit Service |
3880ab |
locredit
|
|
Packit Service |
3880ab |
Locredit is the minimum amount of credits that can be reached. It is a
|
|
Packit Service |
3880ab |
function of the traffic flowing through this qdisc (IEEE 802.1Q-2014
|
|
Packit Service |
3880ab |
Annex L, Equation L-2):
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
locredit = max_frame_size * (sendslope / port_transmit_rate)
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
.TP
|
|
Packit Service |
3880ab |
offload
|
|
Packit Service |
3880ab |
When
|
|
Packit Service |
3880ab |
.B offload
|
|
Packit Service |
3880ab |
is 1,
|
|
Packit Service |
3880ab |
.BR cbs(8)
|
|
Packit Service |
3880ab |
will try to configure the network interface so the CBS algorithm runs
|
|
Packit Service |
3880ab |
in the controller. The default is 0.
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
.SH EXAMPLES
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
CBS is used to enforce a Quality of Service by limiting the data rate
|
|
Packit Service |
3880ab |
of a traffic class, to separate packets into traffic classes the user
|
|
Packit Service |
3880ab |
may choose
|
|
Packit Service |
3880ab |
.BR mqprio(8),
|
|
Packit Service |
3880ab |
and configure it like this:
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
.EX
|
|
Packit Service |
3880ab |
# tc qdisc add dev eth0 handle 100: parent root mqprio num_tc 3 \\
|
|
Packit Service |
3880ab |
map 2 2 1 0 2 2 2 2 2 2 2 2 2 2 2 2 \\
|
|
Packit Service |
3880ab |
queues 1@0 1@1 2@2 \\
|
|
Packit Service |
3880ab |
hw 0
|
|
Packit Service |
3880ab |
.EE
|
|
Packit Service |
3880ab |
.P
|
|
Packit Service |
3880ab |
To replace the current queuing disciple by CBS in the current queueing
|
|
Packit Service |
3880ab |
discipline connected to traffic class number 0, issue:
|
|
Packit Service |
3880ab |
.P
|
|
Packit Service |
3880ab |
.EX
|
|
Packit Service |
3880ab |
# tc qdisc replace dev eth0 parent 100:4 cbs \\
|
|
Packit Service |
3880ab |
locredit -1470 hicredit 30 sendslope -980000 idleslope 20000
|
|
Packit Service |
3880ab |
.EE
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
These values are obtained from the following parameters, idleslope is
|
|
Packit Service |
3880ab |
20mbit/s, the transmission rate is 1Gbit/s and the maximum interfering
|
|
Packit Service |
3880ab |
frame size is 1500 bytes.
|
|
Packit Service |
3880ab |
|
|
Packit Service |
3880ab |
.SH AUTHORS
|
|
Packit Service |
3880ab |
Vinicius Costa Gomes <vinicius.gomes@intel.com>
|