%sphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget>/translations/zh_CN/networking/device_drivers/ethernet/ti/cpswmodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget>/translations/zh_TW/networking/device_drivers/ethernet/ti/cpswmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget>/translations/it_IT/networking/device_drivers/ethernet/ti/cpswmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget>/translations/ja_JP/networking/device_drivers/ethernet/ti/cpswmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget>/translations/ko_KR/networking/device_drivers/ethernet/ti/cpswmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget>/translations/sp_SP/networking/device_drivers/ethernet/ti/cpswmodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhcomment)}(h SPDX-License-Identifier: GPL-2.0h]h SPDX-License-Identifier: GPL-2.0}hhsbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1hhhhhhX/var/lib/git/docbuild/linux/Documentation/networking/device_drivers/ethernet/ti/cpsw.rsthKubhsection)}(hhh](htitle)}(h&Texas Instruments CPSW ethernet driverh]h&Texas Instruments CPSW ethernet driver}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hMultiqueue & CBS & MQPRIOh]hMultiqueue & CBS & MQPRIO}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh paragraph)}(hThe cpsw has 3 CBS shapers for each external ports. This document describes MQPRIO and CBS Qdisc offload configuration for cpsw driver based on examples. It potentially can be used in audio video bridging (AVB) and time sensitive networking (TSN).h]hThe cpsw has 3 CBS shapers for each external ports. This document describes MQPRIO and CBS Qdisc offload configuration for cpsw driver based on examples. It potentially can be used in audio video bridging (AVB) and time sensitive networking (TSN).}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hhhhubh)}(h@The following examples were tested on AM572x EVM and BBB boards.h]h@The following examples were tested on AM572x EVM and BBB boards.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubeh}(h]multiqueue-cbs-mqprioah ]h"]multiqueue & cbs & mqprioah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h Test setuph]h Test setup}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hWUnder consideration two examples with AM572x EVM running cpsw driver in dual_emac mode.h]hWUnder consideration two examples with AM572x EVM running cpsw driver in dual_emac mode.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hSeveral prerequisites:h]hSeveral prerequisites:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh bullet_list)}(hhh](h list_item)}(hDTX queues must be rated starting from txq0 that has highest priorityh]h)}(hj6h]hDTX queues must be rated starting from txq0 that has highest priority}(hj8hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj4ubah}(h]h ]h"]h$]h&]uh1j2hj/hhhhhNubj3)}(hCTraffic classes are used starting from 0, that has highest priorityh]h)}(hjMh]hCTraffic classes are used starting from 0, that has highest priority}(hjOhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjKubah}(h]h ]h"]h$]h&]uh1j2hj/hhhhhNubj3)}(h,CBS shapers should be used with rated queuesh]h)}(hjdh]h,CBS shapers should be used with rated queues}(hjfhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjbubah}(h]h ]h"]h$]h&]uh1j2hj/hhhhhNubj3)}(hThe bandwidth for CBS shapers has to be set a little bit more then potential incoming rate, thus, rate of all incoming tx queues has to be a little lessh]h)}(hThe bandwidth for CBS shapers has to be set a little bit more then potential incoming rate, thus, rate of all incoming tx queues has to be a little lessh]hThe bandwidth for CBS shapers has to be set a little bit more then potential incoming rate, thus, rate of all incoming tx queues has to be a little less}(hj}hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjyubah}(h]h ]h"]h$]h&]uh1j2hj/hhhhhNubj3)}(h*Real rates can differ, due to discreetnessh]h)}(hjh]h*Real rates can differ, due to discreetness}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hjubah}(h]h ]h"]h$]h&]uh1j2hj/hhhhhNubj3)}(hqMap skb-priority to txq is not enough, also skb-priority to l2 prio map has to be created with ip or vconfig toolh]h)}(hqMap skb-priority to txq is not enough, also skb-priority to l2 prio map has to be created with ip or vconfig toolh]hqMap skb-priority to txq is not enough, also skb-priority to l2 prio map has to be created with ip or vconfig tool}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK!hjubah}(h]h ]h"]h$]h&]uh1j2hj/hhhhhNubj3)}(hgAny l2/socket prio (0 - 7) for classes can be used, but for simplicity default values are used: 3 and 2h]h)}(hgAny l2/socket prio (0 - 7) for classes can be used, but for simplicity default values are used: 3 and 2h]hgAny l2/socket prio (0 - 7) for classes can be used, but for simplicity default values are used: 3 and 2}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK#hjubah}(h]h ]h"]h$]h&]uh1j2hj/hhhhhNubj3)}(hwonly 2 classes tested: A and B, but checked and can work with more, maximum allowed 4, but only for 3 rate can be set. h]h)}(hvonly 2 classes tested: A and B, but checked and can work with more, maximum allowed 4, but only for 3 rate can be set.h]hvonly 2 classes tested: A and B, but checked and can work with more, maximum allowed 4, but only for 3 rate can be set.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK%hjubah}(h]h ]h"]h$]h&]uh1j2hj/hhhhhNubeh}(h]h ]h"]h$]h&]bullet-uh1j-hhhKhjhhubeh}(h] test-setupah ]h"] test setupah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hTest setup for examplesh]hTest setup for examples}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhK)ubh literal_block)}(hX +-------------------------------+ |--+ | | | Workstation0 | |E | MAC 18:03:73:66:87:42 | +-----------------------------+ +--|t | | | | 1 | E | | |h |./tsn_listener -d \ | | Target board: | 0 | t |--+ |0 | 18:03:73:66:87:42 -i eth0 \| | AM572x EVM | 0 | h | | | -s 1500 | | | 0 | 0 | |--+ | | Only 2 classes: |Mb +---| +-------------------------------+ | class A, class B | | | | +---| +-------------------------------+ | | 1 | E | |--+ | | | 0 | t | | | Workstation1 | | | 0 | h |--+ |E | MAC 20:cf:30:85:7d:fd | | |Mb | 1 | +--|t | | +-----------------------------+ |h |./tsn_listener -d \ | |0 | 20:cf:30:85:7d:fd -i eth0 \| | | -s 1500 | |--+ | +-------------------------------+h]hX +-------------------------------+ |--+ | | | Workstation0 | |E | MAC 18:03:73:66:87:42 | +-----------------------------+ +--|t | | | | 1 | E | | |h |./tsn_listener -d \ | | Target board: | 0 | t |--+ |0 | 18:03:73:66:87:42 -i eth0 \| | AM572x EVM | 0 | h | | | -s 1500 | | | 0 | 0 | |--+ | | Only 2 classes: |Mb +---| +-------------------------------+ | class A, class B | | | | +---| +-------------------------------+ | | 1 | E | |--+ | | | 0 | t | | | Workstation1 | | | 0 | h |--+ |E | MAC 20:cf:30:85:7d:fd | | |Mb | 1 | +--|t | | +-----------------------------+ |h |./tsn_listener -d \ | |0 | 20:cf:30:85:7d:fd -i eth0 \| | | -s 1500 | |--+ | +-------------------------------+}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhK-hjhhubh)}(hhh](h)}(h@Example 1: One port tx AVB configuration scheme for target boardh]h@Example 1: One port tx AVB configuration scheme for target board}(hj$hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj!hhhhhKEubh)}(hE(prints and scheme for AM572x evm, applicable for single port boards)h]hE(prints and scheme for AM572x evm, applicable for single port boards)}(hj2hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKGhj!hhubj.)}(hhh](j3)}(htc - traffic classh]h)}(hjEh]htc - traffic class}(hjGhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKIhjCubah}(h]h ]h"]h$]h&]uh1j2hj@hhhhhNubj3)}(htxq - transmit queueh]h)}(hj\h]htxq - transmit queue}(hj^hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKJhjZubah}(h]h ]h"]h$]h&]uh1j2hj@hhhhhNubj3)}(h p - priorityh]h)}(hjsh]h p - priority}(hjuhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKKhjqubah}(h]h ]h"]h$]h&]uh1j2hj@hhhhhNubj3)}(hf - fifo (cpsw fifo)h]h)}(hjh]hf - fifo (cpsw fifo)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKLhjubah}(h]h ]h"]h$]h&]uh1j2hj@hhhhhNubj3)}(hS - shaper configured h]h)}(hS - shaper configuredh]hS - shaper configured}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKMhjubah}(h]h ]h"]h$]h&]uh1j2hj@hhhhhNubeh}(h]h ]h"]h$]h&]jjuh1j-hhhKIhj!hhubj)}(hX+------------------------------------------------------------------+ u | +---------------+ +---------------+ +------+ +------+ | s | | | | | | | | | | e | | App 1 | | App 2 | | Apps | | Apps | | r | | Class A | | Class B | | Rest | | Rest | | | | Eth0 | | Eth0 | | Eth0 | | Eth1 | | s | | VLAN100 | | VLAN100 | | | | | | | | p | | 40 Mb/s | | 20 Mb/s | | | | | | | | a | | SO_PRIORITY=3 | | SO_PRIORITY=2 | | | | | | | | c | | | | | | | | | | | | | | e | +---|-----------+ +---|-----------+ +---|--+ +---|--+ | +-----|------------------|------------------|--------|-------------+ +-+ +------------+ | | | | +-----------------+ +--+ | | | | +---|-------|-------------|-----------------------|----------------+ | +----+ +----+ +----+ +----+ +----+ | | | p3 | | p2 | | p1 | | p0 | | p0 | | k | \ / \ / \ / \ / \ / | e | \ / \ / \ / \ / \ / | r | \/ \/ \/ \/ \/ | n | | | | | | e | | | +-----+ | | l | | | | | | | +----+ +----+ +----+ +----+ | s | |tc0 | |tc1 | |tc2 | |tc0 | | p | \ / \ / \ / \ / | a | \ / \ / \ / \ / | c | \/ \/ \/ \/ | e | | | +-----+ | | | | | | | | | | | | | | | | | | | | | | | | +----+ +----+ +----+ +----+ +----+ | | |txq0| |txq1| |txq2| |txq3| |txq4| | | \ / \ / \ / \ / \ / | | \ / \ / \ / \ / \ / | | \/ \/ \/ \/ \/ | | +-|------|------|------|--+ +--|--------------+ | | | | | | | | Eth0.100 | | Eth1 | | +---|------|------|------|------------------------|----------------+ | | | | | p p p p | 3 2 0-1, 4-7 <- L2 priority | | | | | | | | | | | +---|------|------|------|------------------------|----------------+ | | | | | |----------+ | | +----+ +----+ +----+ +----+ +----+ | | |dma7| |dma6| |dma5| |dma4| |dma3| | | \ / \ / \ / \ / \ / | c | \S / \S / \ / \ / \ / | p | \/ \/ \/ \/ \/ | s | | | | +----- | | w | | | | | | | | | | | | | | d | +----+ +----+ +----+p p+----+ | r | | | | | | |o o| | | i | | f3 | | f2 | | f0 |r r| f0 | | v | |tc0 | |tc1 | |tc2 |t t|tc0 | | e | \CBS / \CBS / \CBS /1 2\CBS / | r | \S / \S / \ / \ / | | \/ \/ \/ \/ | +------------------------------------------------------------------+h]hX+------------------------------------------------------------------+ u | +---------------+ +---------------+ +------+ +------+ | s | | | | | | | | | | e | | App 1 | | App 2 | | Apps | | Apps | | r | | Class A | | Class B | | Rest | | Rest | | | | Eth0 | | Eth0 | | Eth0 | | Eth1 | | s | | VLAN100 | | VLAN100 | | | | | | | | p | | 40 Mb/s | | 20 Mb/s | | | | | | | | a | | SO_PRIORITY=3 | | SO_PRIORITY=2 | | | | | | | | c | | | | | | | | | | | | | | e | +---|-----------+ +---|-----------+ +---|--+ +---|--+ | +-----|------------------|------------------|--------|-------------+ +-+ +------------+ | | | | +-----------------+ +--+ | | | | +---|-------|-------------|-----------------------|----------------+ | +----+ +----+ +----+ +----+ +----+ | | | p3 | | p2 | | p1 | | p0 | | p0 | | k | \ / \ / \ / \ / \ / | e | \ / \ / \ / \ / \ / | r | \/ \/ \/ \/ \/ | n | | | | | | e | | | +-----+ | | l | | | | | | | +----+ +----+ +----+ +----+ | s | |tc0 | |tc1 | |tc2 | |tc0 | | p | \ / \ / \ / \ / | a | \ / \ / \ / \ / | c | \/ \/ \/ \/ | e | | | +-----+ | | | | | | | | | | | | | | | | | | | | | | | | +----+ +----+ +----+ +----+ +----+ | | |txq0| |txq1| |txq2| |txq3| |txq4| | | \ / \ / \ / \ / \ / | | \ / \ / \ / \ / \ / | | \/ \/ \/ \/ \/ | | +-|------|------|------|--+ +--|--------------+ | | | | | | | | Eth0.100 | | Eth1 | | +---|------|------|------|------------------------|----------------+ | | | | | p p p p | 3 2 0-1, 4-7 <- L2 priority | | | | | | | | | | | +---|------|------|------|------------------------|----------------+ | | | | | |----------+ | | +----+ +----+ +----+ +----+ +----+ | | |dma7| |dma6| |dma5| |dma4| |dma3| | | \ / \ / \ / \ / \ / | c | \S / \S / \ / \ / \ / | p | \/ \/ \/ \/ \/ | s | | | | +----- | | w | | | | | | | | | | | | | | d | +----+ +----+ +----+p p+----+ | r | | | | | | |o o| | | i | | f3 | | f2 | | f0 |r r| f0 | | v | |tc0 | |tc1 | |tc2 |t t|tc0 | | e | \CBS / \CBS / \CBS /1 2\CBS / | r | \S / \S / \ / \ / | | \/ \/ \/ \/ | +------------------------------------------------------------------+}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKQhj!hhubhenumerated_list)}(hhh](j3)}(h:: // Add 4 tx queues, for interface Eth0, and 1 tx queue for Eth1 $ ethtool -L eth0 rx 1 tx 5 rx unmodified, ignoring h]j)}(hs// Add 4 tx queues, for interface Eth0, and 1 tx queue for Eth1 $ ethtool -L eth0 rx 1 tx 5 rx unmodified, ignoringh]hs// Add 4 tx queues, for interface Eth0, and 1 tx queue for Eth1 $ ethtool -L eth0 rx 1 tx 5 rx unmodified, ignoring}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjubah}(h]h ]h"]h$]h&]uh1j2hjhhhhhNubj3)}(hX]:: // Check if num of queues is set correctly: $ ethtool -l eth0 Channel parameters for eth0: Pre-set maximums: RX: 8 TX: 8 Other: 0 Combined: 0 Current hardware settings: RX: 1 TX: 5 Other: 0 Combined: 0 h]j)}(hX// Check if num of queues is set correctly: $ ethtool -l eth0 Channel parameters for eth0: Pre-set maximums: RX: 8 TX: 8 Other: 0 Combined: 0 Current hardware settings: RX: 1 TX: 5 Other: 0 Combined: 0h]hX// Check if num of queues is set correctly: $ ethtool -l eth0 Channel parameters for eth0: Pre-set maximums: RX: 8 TX: 8 Other: 0 Combined: 0 Current hardware settings: RX: 1 TX: 5 Other: 0 Combined: 0}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjubah}(h]h ]h"]h$]h&]uh1j2hjhhhhhNubj3)}(hXj:: // TX queues must be rated starting from 0, so set bws for tx0 and tx1 // Set rates 40 and 20 Mb/s appropriately. // Pay attention, real speed can differ a bit due to discreetness. // Leave last 2 tx queues not rated. $ echo 40 > /sys/class/net/eth0/queues/tx-0/tx_maxrate $ echo 20 > /sys/class/net/eth0/queues/tx-1/tx_maxrate h]j)}(hXG// TX queues must be rated starting from 0, so set bws for tx0 and tx1 // Set rates 40 and 20 Mb/s appropriately. // Pay attention, real speed can differ a bit due to discreetness. // Leave last 2 tx queues not rated. $ echo 40 > /sys/class/net/eth0/queues/tx-0/tx_maxrate $ echo 20 > /sys/class/net/eth0/queues/tx-1/tx_maxrateh]hXG// TX queues must be rated starting from 0, so set bws for tx0 and tx1 // Set rates 40 and 20 Mb/s appropriately. // Pay attention, real speed can differ a bit due to discreetness. // Leave last 2 tx queues not rated. $ echo 40 > /sys/class/net/eth0/queues/tx-0/tx_maxrate $ echo 20 > /sys/class/net/eth0/queues/tx-1/tx_maxrate}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjubah}(h]h ]h"]h$]h&]uh1j2hjhhhhhNubj3)}(h:: // Check maximum rate of tx (cpdma) queues: $ cat /sys/class/net/eth0/queues/tx-*/tx_maxrate 40 20 0 0 0 h]j)}(hh// Check maximum rate of tx (cpdma) queues: $ cat /sys/class/net/eth0/queues/tx-*/tx_maxrate 40 20 0 0 0h]hh// Check maximum rate of tx (cpdma) queues: $ cat /sys/class/net/eth0/queues/tx-*/tx_maxrate 40 20 0 0 0}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjubah}(h]h ]h"]h$]h&]uh1j2hjhhhhhNubj3)}(hXU:: // Map skb->priority to traffic class: // 3pri -> tc0, 2pri -> tc1, (0,1,4-7)pri -> tc2 // Map traffic class to transmit queue: // tc0 -> txq0, tc1 -> txq1, tc2 -> (txq2, txq3) $ tc qdisc replace dev eth0 handle 100: parent root 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 1 h]j)}(hX2// Map skb->priority to traffic class: // 3pri -> tc0, 2pri -> tc1, (0,1,4-7)pri -> tc2 // Map traffic class to transmit queue: // tc0 -> txq0, tc1 -> txq1, tc2 -> (txq2, txq3) $ tc qdisc replace dev eth0 handle 100: parent root 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 1h]hX2// Map skb->priority to traffic class: // 3pri -> tc0, 2pri -> tc1, (0,1,4-7)pri -> tc2 // Map traffic class to transmit queue: // tc0 -> txq0, tc1 -> txq1, tc2 -> (txq2, txq3) $ tc qdisc replace dev eth0 handle 100: parent root 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 1}hj4sbah}(h]h ]h"]h$]h&]hhuh1jhhhKhj0ubah}(h]h ]h"]h$]h&]uh1j2hjhhhhhNubeh}(h]h ]h"]h$]h&]enumtypearabicprefixhsuffix)uh1jhj!hhhhhKubh)}(h5a) ::h]h5a)}(hjShhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj!hhubj)}(hX// As two interface sharing same set of tx queues, assign all traffic // coming to interface Eth1 to separate queue in order to not mix it // with traffic from interface Eth0, so use separate txq to send // packets to Eth1, so all prio -> tc0 and tc0 -> txq4 // Here hw 0, so here still default configuration for eth1 in hw $ tc qdisc replace dev eth1 handle 100: parent root mqprio num_tc 1 \ map 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 queues 1@4 hw 0h]hX// As two interface sharing same set of tx queues, assign all traffic // coming to interface Eth1 to separate queue in order to not mix it // with traffic from interface Eth0, so use separate txq to send // packets to Eth1, so all prio -> tc0 and tc0 -> txq4 // Here hw 0, so here still default configuration for eth1 in hw $ tc qdisc replace dev eth1 handle 100: parent root mqprio num_tc 1 \ map 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 queues 1@4 hw 0}hjasbah}(h]h ]h"]h$]h&]hhuh1jhhhKhj!hhubj)}(hhh](j3)}(hXo:: // Check classes settings $ tc -g class show dev eth0 +---(100:ffe2) mqprio | +---(100:3) mqprio | +---(100:4) mqprio | +---(100:ffe1) mqprio | +---(100:2) mqprio | +---(100:ffe0) mqprio +---(100:1) mqprio $ tc -g class show dev eth1 +---(100:ffe0) mqprio +---(100:5) mqprio h]j)}(hX$// Check classes settings $ tc -g class show dev eth0 +---(100:ffe2) mqprio | +---(100:3) mqprio | +---(100:4) mqprio | +---(100:ffe1) mqprio | +---(100:2) mqprio | +---(100:ffe0) mqprio +---(100:1) mqprio $ tc -g class show dev eth1 +---(100:ffe0) mqprio +---(100:5) mqprioh]hX$// Check classes settings $ tc -g class show dev eth0 +---(100:ffe2) mqprio | +---(100:3) mqprio | +---(100:4) mqprio | +---(100:ffe1) mqprio | +---(100:2) mqprio | +---(100:ffe0) mqprio +---(100:1) mqprio $ tc -g class show dev eth1 +---(100:ffe0) mqprio +---(100:5) mqprio}hjvsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjrubah}(h]h ]h"]h$]h&]uh1j2hjohhhhhNubj3)}(hX:: // Set rate for class A - 41 Mbit (tc0, txq0) using CBS Qdisc // Set it +1 Mb for reserve (important!) // here only idle slope is important, others arg are ignored // Pay attention, real speed can differ a bit due to discreetness $ tc qdisc add dev eth0 parent 100:1 cbs locredit -1438 \ hicredit 62 sendslope -959000 idleslope 41000 offload 1 net eth0: set FIFO3 bw = 50 h]j)}(hXs// Set rate for class A - 41 Mbit (tc0, txq0) using CBS Qdisc // Set it +1 Mb for reserve (important!) // here only idle slope is important, others arg are ignored // Pay attention, real speed can differ a bit due to discreetness $ tc qdisc add dev eth0 parent 100:1 cbs locredit -1438 \ hicredit 62 sendslope -959000 idleslope 41000 offload 1 net eth0: set FIFO3 bw = 50h]hXs// Set rate for class A - 41 Mbit (tc0, txq0) using CBS Qdisc // Set it +1 Mb for reserve (important!) // here only idle slope is important, others arg are ignored // Pay attention, real speed can differ a bit due to discreetness $ tc qdisc add dev eth0 parent 100:1 cbs locredit -1438 \ hicredit 62 sendslope -959000 idleslope 41000 offload 1 net eth0: set FIFO3 bw = 50}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjubah}(h]h ]h"]h$]h&]uh1j2hjohhhhhNubj3)}(hX:: // Set rate for class B - 21 Mbit (tc1, txq1) using CBS Qdisc: // Set it +1 Mb for reserve (important!) $ tc qdisc add dev eth0 parent 100:2 cbs locredit -1468 \ hicredit 65 sendslope -979000 idleslope 21000 offload 1 net eth0: set FIFO2 bw = 30 h]j)}(h// Set rate for class B - 21 Mbit (tc1, txq1) using CBS Qdisc: // Set it +1 Mb for reserve (important!) $ tc qdisc add dev eth0 parent 100:2 cbs locredit -1468 \ hicredit 65 sendslope -979000 idleslope 21000 offload 1 net eth0: set FIFO2 bw = 30h]h// Set rate for class B - 21 Mbit (tc1, txq1) using CBS Qdisc: // Set it +1 Mb for reserve (important!) $ tc qdisc add dev eth0 parent 100:2 cbs locredit -1468 \ hicredit 65 sendslope -979000 idleslope 21000 offload 1 net eth0: set FIFO2 bw = 30}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjubah}(h]h ]h"]h$]h&]uh1j2hjohhhhhNubj3)}(hX9:: // Create vlan 100 to map sk->priority to vlan qos $ ip link add link eth0 name eth0.100 type vlan id 100 8021q: 802.1Q VLAN Support v1.8 8021q: adding VLAN 0 to HW filter on device eth0 8021q: adding VLAN 0 to HW filter on device eth1 net eth0: Adding vlanid 100 to vlan filter h]j)}(hX// Create vlan 100 to map sk->priority to vlan qos $ ip link add link eth0 name eth0.100 type vlan id 100 8021q: 802.1Q VLAN Support v1.8 8021q: adding VLAN 0 to HW filter on device eth0 8021q: adding VLAN 0 to HW filter on device eth1 net eth0: Adding vlanid 100 to vlan filterh]hX// Create vlan 100 to map sk->priority to vlan qos $ ip link add link eth0 name eth0.100 type vlan id 100 8021q: 802.1Q VLAN Support v1.8 8021q: adding VLAN 0 to HW filter on device eth0 8021q: adding VLAN 0 to HW filter on device eth1 net eth0: Adding vlanid 100 to vlan filter}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjubah}(h]h ]h"]h$]h&]uh1j2hjohhhhhNubj3)}(h:: // Map skb->priority to L2 prio, 1 to 1 $ ip link set eth0.100 type vlan \ egress 0:0 1:1 2:2 3:3 4:4 5:5 6:6 7:7 h]j)}(hq// Map skb->priority to L2 prio, 1 to 1 $ ip link set eth0.100 type vlan \ egress 0:0 1:1 2:2 3:3 4:4 5:5 6:6 7:7h]hq// Map skb->priority to L2 prio, 1 to 1 $ ip link set eth0.100 type vlan \ egress 0:0 1:1 2:2 3:3 4:4 5:5 6:6 7:7}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjubah}(h]h ]h"]h$]h&]uh1j2hjohhhhhNubj3)}(h:: // Check egress map for vlan 100 $ cat /proc/net/vlan/eth0.100 [...] INGRESS priority mappings: 0:0 1:0 2:0 3:0 4:0 5:0 6:0 7:0 EGRESS priority mappings: 0:0 1:1 2:2 3:3 4:4 5:5 6:6 7:7 h]j)}(h// Check egress map for vlan 100 $ cat /proc/net/vlan/eth0.100 [...] INGRESS priority mappings: 0:0 1:0 2:0 3:0 4:0 5:0 6:0 7:0 EGRESS priority mappings: 0:0 1:1 2:2 3:3 4:4 5:5 6:6 7:7h]h// Check egress map for vlan 100 $ cat /proc/net/vlan/eth0.100 [...] INGRESS priority mappings: 0:0 1:0 2:0 3:0 4:0 5:0 6:0 7:0 EGRESS priority mappings: 0:0 1:1 2:2 3:3 4:4 5:5 6:6 7:7}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhMhjubah}(h]h ]h"]h$]h&]uh1j2hjohhhhhNubj3)}(hX<:: // Run your appropriate tools with socket option "SO_PRIORITY" // to 3 for class A and/or to 2 for class B // (I took at https://www.spinics.net/lists/netdev/msg460869.html) ./tsn_talker -d 18:03:73:66:87:42 -i eth0.100 -p3 -s 1500& ./tsn_talker -d 18:03:73:66:87:42 -i eth0.100 -p2 -s 1500& h]j)}(hX#// Run your appropriate tools with socket option "SO_PRIORITY" // to 3 for class A and/or to 2 for class B // (I took at https://www.spinics.net/lists/netdev/msg460869.html) ./tsn_talker -d 18:03:73:66:87:42 -i eth0.100 -p3 -s 1500& ./tsn_talker -d 18:03:73:66:87:42 -i eth0.100 -p2 -s 1500&h]hX#// Run your appropriate tools with socket option "SO_PRIORITY" // to 3 for class A and/or to 2 for class B // (I took at https://www.spinics.net/lists/netdev/msg460869.html) ./tsn_talker -d 18:03:73:66:87:42 -i eth0.100 -p3 -s 1500& ./tsn_talker -d 18:03:73:66:87:42 -i eth0.100 -p2 -s 1500&}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhM hjubah}(h]h ]h"]h$]h&]uh1j2hjohhhhhNubj3)}(hX:: // run your listener on workstation (should be in same vlan) // (I took at https://www.spinics.net/lists/netdev/msg460869.html) ./tsn_listener -d 18:03:73:66:87:42 -i enp5s0 -s 1500 Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39000 kbps h]j)}(hXU// run your listener on workstation (should be in same vlan) // (I took at https://www.spinics.net/lists/netdev/msg460869.html) ./tsn_listener -d 18:03:73:66:87:42 -i enp5s0 -s 1500 Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39000 kbpsh]hXU// run your listener on workstation (should be in same vlan) // (I took at https://www.spinics.net/lists/netdev/msg460869.html) ./tsn_listener -d 18:03:73:66:87:42 -i enp5s0 -s 1500 Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39000 kbps}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhMhjubah}(h]h ]h"]h$]h&]uh1j2hjohhhhhNubj3)}(hX:: // Restore default configuration if needed $ ip link del eth0.100 $ tc qdisc del dev eth1 root $ tc qdisc del dev eth0 root net eth0: Prev FIFO2 is shaped net eth0: set FIFO3 bw = 0 net eth0: set FIFO2 bw = 0 $ ethtool -L eth0 rx 1 tx 1 h]j)}(h// Restore default configuration if needed $ ip link del eth0.100 $ tc qdisc del dev eth1 root $ tc qdisc del dev eth0 root net eth0: Prev FIFO2 is shaped net eth0: set FIFO3 bw = 0 net eth0: set FIFO2 bw = 0 $ ethtool -L eth0 rx 1 tx 1h]h// Restore default configuration if needed $ ip link del eth0.100 $ tc qdisc del dev eth1 root $ tc qdisc del dev eth0 root net eth0: Prev FIFO2 is shaped net eth0: set FIFO3 bw = 0 net eth0: set FIFO2 bw = 0 $ ethtool -L eth0 rx 1 tx 1}hj6sbah}(h]h ]h"]h$]h&]hhuh1jhhhM(hj2ubah}(h]h ]h"]h$]h&]uh1j2hjohhhhhNubeh}(h]h ]h"]h$]h&]jNjOjPhjQjRstartKuh1jhj!hhhhhKubeh}(h]?example-1-one-port-tx-avb-configuration-scheme-for-target-boardah ]h"]@example 1: one port tx avb configuration scheme for target boardah$]h&]uh1hhjhhhhhKEubh)}(hhh](h)}(h@Example 2: Two port tx AVB configuration scheme for target boardh]h@Example 2: Two port tx AVB configuration scheme for target board}(hj\hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjYhhhhhM2ubh)}(h=(prints and scheme for AM572x evm, for dual emac boards only)h]h=(prints and scheme for AM572x evm, for dual emac boards only)}(hjjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM4hjYhhubj)}(hX+------------------------------------------------------------------+ u | +----------+ +----------+ +------+ +----------+ +----------+ | s | | | | | | | | | | | | e | | App 1 | | App 2 | | Apps | | App 3 | | App 4 | | r | | Class A | | Class B | | Rest | | Class B | | Class A | | | | Eth0 | | Eth0 | | | | | Eth1 | | Eth1 | | s | | VLAN100 | | VLAN100 | | | | | VLAN100 | | VLAN100 | | p | | 40 Mb/s | | 20 Mb/s | | | | | 10 Mb/s | | 30 Mb/s | | a | | SO_PRI=3 | | SO_PRI=2 | | | | | SO_PRI=3 | | SO_PRI=2 | | c | | | | | | | | | | | | | | | | | e | +---|------+ +---|------+ +---|--+ +---|------+ +---|------+ | +-----|-------------|-------------|---------|-------------|--------+ +-+ +-------+ | +----------+ +----+ | | +-------+------+ | | | | | | | | +---|-------|-------------|--------------|-------------|-------|---+ | +----+ +----+ +----+ +----+ +----+ +----+ +----+ +----+ | | | p3 | | p2 | | p1 | | p0 | | p0 | | p1 | | p2 | | p3 | | k | \ / \ / \ / \ / \ / \ / \ / \ / | e | \ / \ / \ / \ / \ / \ / \ / \ / | r | \/ \/ \/ \/ \/ \/ \/ \/ | n | | | | | | | | e | | | +----+ +----+ | | | l | | | | | | | | | +----+ +----+ +----+ +----+ +----+ +----+ | s | |tc0 | |tc1 | |tc2 | |tc2 | |tc1 | |tc0 | | p | \ / \ / \ / \ / \ / \ / | a | \ / \ / \ / \ / \ / \ / | c | \/ \/ \/ \/ \/ \/ | e | | | +-----+ +-----+ | | | | | | | | | | | | | | | | | | | | | | | | | | | | E E | | | | | | +----+ +----+ +----+ +----+ t t +----+ +----+ +----+ +----+ | | |txq0| |txq1| |txq4| |txq5| h h |txq6| |txq7| |txq3| |txq2| | | \ / \ / \ / \ / 0 1 \ / \ / \ / \ / | | \ / \ / \ / \ / . . \ / \ / \ / \ / | | \/ \/ \/ \/ 1 1 \/ \/ \/ \/ | | +-|------|------|------|--+ 0 0 +-|------|------|------|--+ | | | | | | | | 0 0 | | | | | | | +---|------|------|------|---------------|------|------|------|----+ | | | | | | | | p p p p p p p p 3 2 0-1, 4-7 <-L2 pri-> 0-1, 4-7 2 3 | | | | | | | | | | | | | | | | +---|------|------|------|---------------|------|------|------|----+ | | | | | | | | | | | +----+ +----+ +----+ +----+ +----+ +----+ +----+ +----+ | | |dma7| |dma6| |dma3| |dma2| |dma1| |dma0| |dma4| |dma5| | | \ / \ / \ / \ / \ / \ / \ / \ / | c | \S / \S / \ / \ / \ / \ / \S / \S / | p | \/ \/ \/ \/ \/ \/ \/ \/ | s | | | | +----- | | | | | w | | | | | +----+ | | | | | | | | | | | | | | d | +----+ +----+ +----+p p+----+ +----+ +----+ | r | | | | | | |o o| | | | | | | i | | f3 | | f2 | | f0 |r CPSW r| f3 | | f2 | | f0 | | v | |tc0 | |tc1 | |tc2 |t t|tc0 | |tc1 | |tc2 | | e | \CBS / \CBS / \CBS /1 2\CBS / \CBS / \CBS / | r | \S / \S / \ / \S / \S / \ / | | \/ \/ \/ \/ \/ \/ | +------------------------------------------------------------------+ ========================================Eth==========================>h]hX+------------------------------------------------------------------+ u | +----------+ +----------+ +------+ +----------+ +----------+ | s | | | | | | | | | | | | e | | App 1 | | App 2 | | Apps | | App 3 | | App 4 | | r | | Class A | | Class B | | Rest | | Class B | | Class A | | | | Eth0 | | Eth0 | | | | | Eth1 | | Eth1 | | s | | VLAN100 | | VLAN100 | | | | | VLAN100 | | VLAN100 | | p | | 40 Mb/s | | 20 Mb/s | | | | | 10 Mb/s | | 30 Mb/s | | a | | SO_PRI=3 | | SO_PRI=2 | | | | | SO_PRI=3 | | SO_PRI=2 | | c | | | | | | | | | | | | | | | | | e | +---|------+ +---|------+ +---|--+ +---|------+ +---|------+ | +-----|-------------|-------------|---------|-------------|--------+ +-+ +-------+ | +----------+ +----+ | | +-------+------+ | | | | | | | | +---|-------|-------------|--------------|-------------|-------|---+ | +----+ +----+ +----+ +----+ +----+ +----+ +----+ +----+ | | | p3 | | p2 | | p1 | | p0 | | p0 | | p1 | | p2 | | p3 | | k | \ / \ / \ / \ / \ / \ / \ / \ / | e | \ / \ / \ / \ / \ / \ / \ / \ / | r | \/ \/ \/ \/ \/ \/ \/ \/ | n | | | | | | | | e | | | +----+ +----+ | | | l | | | | | | | | | +----+ +----+ +----+ +----+ +----+ +----+ | s | |tc0 | |tc1 | |tc2 | |tc2 | |tc1 | |tc0 | | p | \ / \ / \ / \ / \ / \ / | a | \ / \ / \ / \ / \ / \ / | c | \/ \/ \/ \/ \/ \/ | e | | | +-----+ +-----+ | | | | | | | | | | | | | | | | | | | | | | | | | | | | E E | | | | | | +----+ +----+ +----+ +----+ t t +----+ +----+ +----+ +----+ | | |txq0| |txq1| |txq4| |txq5| h h |txq6| |txq7| |txq3| |txq2| | | \ / \ / \ / \ / 0 1 \ / \ / \ / \ / | | \ / \ / \ / \ / . . \ / \ / \ / \ / | | \/ \/ \/ \/ 1 1 \/ \/ \/ \/ | | +-|------|------|------|--+ 0 0 +-|------|------|------|--+ | | | | | | | | 0 0 | | | | | | | +---|------|------|------|---------------|------|------|------|----+ | | | | | | | | p p p p p p p p 3 2 0-1, 4-7 <-L2 pri-> 0-1, 4-7 2 3 | | | | | | | | | | | | | | | | +---|------|------|------|---------------|------|------|------|----+ | | | | | | | | | | | +----+ +----+ +----+ +----+ +----+ +----+ +----+ +----+ | | |dma7| |dma6| |dma3| |dma2| |dma1| |dma0| |dma4| |dma5| | | \ / \ / \ / \ / \ / \ / \ / \ / | c | \S / \S / \ / \ / \ / \ / \S / \S / | p | \/ \/ \/ \/ \/ \/ \/ \/ | s | | | | +----- | | | | | w | | | | | +----+ | | | | | | | | | | | | | | d | +----+ +----+ +----+p p+----+ +----+ +----+ | r | | | | | | |o o| | | | | | | i | | f3 | | f2 | | f0 |r CPSW r| f3 | | f2 | | f0 | | v | |tc0 | |tc1 | |tc2 |t t|tc0 | |tc1 | |tc2 | | e | \CBS / \CBS / \CBS /1 2\CBS / \CBS / \CBS / | r | \S / \S / \ / \S / \S / \ / | | \/ \/ \/ \/ \/ \/ | +------------------------------------------------------------------+ ========================================Eth==========================>}hjxsbah}(h]h ]h"]h$]h&]hhuh1jhhhM8hjYhhubj)}(hhh](j3)}(h:: // Add 8 tx queues, for interface Eth0, but they are common, so are accessed // by two interfaces Eth0 and Eth1. $ ethtool -L eth1 rx 1 tx 8 rx unmodified, ignoring h]j)}(h// Add 8 tx queues, for interface Eth0, but they are common, so are accessed // by two interfaces Eth0 and Eth1. $ ethtool -L eth1 rx 1 tx 8 rx unmodified, ignoringh]h// Add 8 tx queues, for interface Eth0, but they are common, so are accessed // by two interfaces Eth0 and Eth1. $ ethtool -L eth1 rx 1 tx 8 rx unmodified, ignoring}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhM|hjubah}(h]h ]h"]h$]h&]uh1j2hjhhhhhNubj3)}(hX]:: // Check if num of queues is set correctly: $ ethtool -l eth0 Channel parameters for eth0: Pre-set maximums: RX: 8 TX: 8 Other: 0 Combined: 0 Current hardware settings: RX: 1 TX: 8 Other: 0 Combined: 0 h]j)}(hX// Check if num of queues is set correctly: $ ethtool -l eth0 Channel parameters for eth0: Pre-set maximums: RX: 8 TX: 8 Other: 0 Combined: 0 Current hardware settings: RX: 1 TX: 8 Other: 0 Combined: 0h]hX// Check if num of queues is set correctly: $ ethtool -l eth0 Channel parameters for eth0: Pre-set maximums: RX: 8 TX: 8 Other: 0 Combined: 0 Current hardware settings: RX: 1 TX: 8 Other: 0 Combined: 0}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhMhjubah}(h]h ]h"]h$]h&]uh1j2hjhhhhhNubj3)}(hX-:: // TX queues must be rated starting from 0, so set bws for tx0 and tx1 for Eth0 // and for tx2 and tx3 for Eth1. That is, rates 40 and 20 Mb/s appropriately // for Eth0 and 30 and 10 Mb/s for Eth1. // Real speed can differ a bit due to discreetness // Leave last 4 tx queues as not rated $ echo 40 > /sys/class/net/eth0/queues/tx-0/tx_maxrate $ echo 20 > /sys/class/net/eth0/queues/tx-1/tx_maxrate $ echo 30 > /sys/class/net/eth1/queues/tx-2/tx_maxrate $ echo 10 > /sys/class/net/eth1/queues/tx-3/tx_maxrate h]j)}(hX// TX queues must be rated starting from 0, so set bws for tx0 and tx1 for Eth0 // and for tx2 and tx3 for Eth1. That is, rates 40 and 20 Mb/s appropriately // for Eth0 and 30 and 10 Mb/s for Eth1. // Real speed can differ a bit due to discreetness // Leave last 4 tx queues as not rated $ echo 40 > /sys/class/net/eth0/queues/tx-0/tx_maxrate $ echo 20 > /sys/class/net/eth0/queues/tx-1/tx_maxrate $ echo 30 > /sys/class/net/eth1/queues/tx-2/tx_maxrate $ echo 10 > /sys/class/net/eth1/queues/tx-3/tx_maxrateh]hX// TX queues must be rated starting from 0, so set bws for tx0 and tx1 for Eth0 // and for tx2 and tx3 for Eth1. That is, rates 40 and 20 Mb/s appropriately // for Eth0 and 30 and 10 Mb/s for Eth1. // Real speed can differ a bit due to discreetness // Leave last 4 tx queues as not rated $ echo 40 > /sys/class/net/eth0/queues/tx-0/tx_maxrate $ echo 20 > /sys/class/net/eth0/queues/tx-1/tx_maxrate $ echo 30 > /sys/class/net/eth1/queues/tx-2/tx_maxrate $ echo 10 > /sys/class/net/eth1/queues/tx-3/tx_maxrate}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhMhjubah}(h]h ]h"]h$]h&]uh1j2hjhhhhhNubj3)}(h:: // Check maximum rate of tx (cpdma) queues: $ cat /sys/class/net/eth0/queues/tx-*/tx_maxrate 40 20 30 10 0 0 0 0 h]j)}(hp// Check maximum rate of tx (cpdma) queues: $ cat /sys/class/net/eth0/queues/tx-*/tx_maxrate 40 20 30 10 0 0 0 0h]hp// Check maximum rate of tx (cpdma) queues: $ cat /sys/class/net/eth0/queues/tx-*/tx_maxrate 40 20 30 10 0 0 0 0}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhMhjubah}(h]h ]h"]h$]h&]uh1j2hjhhhhhNubj3)}(hX^:: // Map skb->priority to traffic class for Eth0: // 3pri -> tc0, 2pri -> tc1, (0,1,4-7)pri -> tc2 // Map traffic class to transmit queue: // tc0 -> txq0, tc1 -> txq1, tc2 -> (txq4, txq5) $ tc qdisc replace dev eth0 handle 100: parent root 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@4 hw 1 h]j)}(hX;// Map skb->priority to traffic class for Eth0: // 3pri -> tc0, 2pri -> tc1, (0,1,4-7)pri -> tc2 // Map traffic class to transmit queue: // tc0 -> txq0, tc1 -> txq1, tc2 -> (txq4, txq5) $ tc qdisc replace dev eth0 handle 100: parent root 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@4 hw 1h]hX;// Map skb->priority to traffic class for Eth0: // 3pri -> tc0, 2pri -> tc1, (0,1,4-7)pri -> tc2 // Map traffic class to transmit queue: // tc0 -> txq0, tc1 -> txq1, tc2 -> (txq4, txq5) $ tc qdisc replace dev eth0 handle 100: parent root 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@4 hw 1}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhMhjubah}(h]h ]h"]h$]h&]uh1j2hjhhhhhNubj3)}(hX:: // Check classes settings $ tc -g class show dev eth0 +---(100:ffe2) mqprio | +---(100:5) mqprio | +---(100:6) mqprio | +---(100:ffe1) mqprio | +---(100:2) mqprio | +---(100:ffe0) mqprio +---(100:1) mqprio h]j)}(h// Check classes settings $ tc -g class show dev eth0 +---(100:ffe2) mqprio | +---(100:5) mqprio | +---(100:6) mqprio | +---(100:ffe1) mqprio | +---(100:2) mqprio | +---(100:ffe0) mqprio +---(100:1) mqprioh]h// Check classes settings $ tc -g class show dev eth0 +---(100:ffe2) mqprio | +---(100:5) mqprio | +---(100:6) mqprio | +---(100:ffe1) mqprio | +---(100:2) mqprio | +---(100:ffe0) mqprio +---(100:1) mqprio}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhMhjubah}(h]h ]h"]h$]h&]uh1j2hjhhhhhNubj3)}(hX_:: // Set rate for class A - 41 Mbit (tc0, txq0) using CBS Qdisc for Eth0 // here only idle slope is important, others ignored // Real speed can differ a bit due to discreetness $ tc qdisc add dev eth0 parent 100:1 cbs locredit -1470 \ hicredit 62 sendslope -959000 idleslope 41000 offload 1 net eth0: set FIFO3 bw = 50 h]j)}(hX<// Set rate for class A - 41 Mbit (tc0, txq0) using CBS Qdisc for Eth0 // here only idle slope is important, others ignored // Real speed can differ a bit due to discreetness $ tc qdisc add dev eth0 parent 100:1 cbs locredit -1470 \ hicredit 62 sendslope -959000 idleslope 41000 offload 1 net eth0: set FIFO3 bw = 50h]hX<// Set rate for class A - 41 Mbit (tc0, txq0) using CBS Qdisc for Eth0 // here only idle slope is important, others ignored // Real speed can differ a bit due to discreetness $ tc qdisc add dev eth0 parent 100:1 cbs locredit -1470 \ hicredit 62 sendslope -959000 idleslope 41000 offload 1 net eth0: set FIFO3 bw = 50}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhMhjubah}(h]h ]h"]h$]h&]uh1j2hjhhhhhNubj3)}(h:: // Set rate for class B - 21 Mbit (tc1, txq1) using CBS Qdisc for Eth0 $ tc qdisc add dev eth0 parent 100:2 cbs locredit -1470 \ hicredit 65 sendslope -979000 idleslope 21000 offload 1 net eth0: set FIFO2 bw = 30 h]j)}(h// Set rate for class B - 21 Mbit (tc1, txq1) using CBS Qdisc for Eth0 $ tc qdisc add dev eth0 parent 100:2 cbs locredit -1470 \ hicredit 65 sendslope -979000 idleslope 21000 offload 1 net eth0: set FIFO2 bw = 30h]h// Set rate for class B - 21 Mbit (tc1, txq1) using CBS Qdisc for Eth0 $ tc qdisc add dev eth0 parent 100:2 cbs locredit -1470 \ hicredit 65 sendslope -979000 idleslope 21000 offload 1 net eth0: set FIFO2 bw = 30}hj5sbah}(h]h ]h"]h$]h&]hhuh1jhhhMhj1ubah}(h]h ]h"]h$]h&]uh1j2hjhhhhhNubj3)}(h:: // Create vlan 100 to map sk->priority to vlan qos for Eth0 $ ip link add link eth0 name eth0.100 type vlan id 100 net eth0: Adding vlanid 100 to vlan filter h]j)}(h// Create vlan 100 to map sk->priority to vlan qos for Eth0 $ ip link add link eth0 name eth0.100 type vlan id 100 net eth0: Adding vlanid 100 to vlan filterh]h// Create vlan 100 to map sk->priority to vlan qos for Eth0 $ ip link add link eth0 name eth0.100 type vlan id 100 net eth0: Adding vlanid 100 to vlan filter}hjMsbah}(h]h ]h"]h$]h&]hhuh1jhhhMhjIubah}(h]h ]h"]h$]h&]uh1j2hjhhhhhNubj3)}(h:: // Map skb->priority to L2 prio for Eth0.100, one to one $ ip link set eth0.100 type vlan \ egress 0:0 1:1 2:2 3:3 4:4 5:5 6:6 7:7 h]j)}(h// Map skb->priority to L2 prio for Eth0.100, one to one $ ip link set eth0.100 type vlan \ egress 0:0 1:1 2:2 3:3 4:4 5:5 6:6 7:7h]h// Map skb->priority to L2 prio for Eth0.100, one to one $ ip link set eth0.100 type vlan \ egress 0:0 1:1 2:2 3:3 4:4 5:5 6:6 7:7}hjesbah}(h]h ]h"]h$]h&]hhuh1jhhhMhjaubah}(h]h ]h"]h$]h&]uh1j2hjhhhhhNubj3)}(h:: // Check egress map for vlan 100 $ cat /proc/net/vlan/eth0.100 [...] INGRESS priority mappings: 0:0 1:0 2:0 3:0 4:0 5:0 6:0 7:0 EGRESS priority mappings: 0:0 1:1 2:2 3:3 4:4 5:5 6:6 7:7 h]j)}(h// Check egress map for vlan 100 $ cat /proc/net/vlan/eth0.100 [...] INGRESS priority mappings: 0:0 1:0 2:0 3:0 4:0 5:0 6:0 7:0 EGRESS priority mappings: 0:0 1:1 2:2 3:3 4:4 5:5 6:6 7:7h]h// Check egress map for vlan 100 $ cat /proc/net/vlan/eth0.100 [...] INGRESS priority mappings: 0:0 1:0 2:0 3:0 4:0 5:0 6:0 7:0 EGRESS priority mappings: 0:0 1:1 2:2 3:3 4:4 5:5 6:6 7:7}hj}sbah}(h]h ]h"]h$]h&]hhuh1jhhhMhjyubah}(h]h ]h"]h$]h&]uh1j2hjhhhhhNubj3)}(hXX:: // Map skb->priority to traffic class for Eth1: // 3pri -> tc0, 2pri -> tc1, (0,1,4-7)pri -> tc2 // Map traffic class to transmit queue: // tc0 -> txq2, tc1 -> txq3, tc2 -> (txq6, txq7) $ tc qdisc replace dev eth1 handle 100: parent root mqprio num_tc 3 \ map 2 2 1 0 2 2 2 2 2 2 2 2 2 2 2 2 queues 1@2 1@3 2@6 hw 1 h]j)}(hX;// Map skb->priority to traffic class for Eth1: // 3pri -> tc0, 2pri -> tc1, (0,1,4-7)pri -> tc2 // Map traffic class to transmit queue: // tc0 -> txq2, tc1 -> txq3, tc2 -> (txq6, txq7) $ tc qdisc replace dev eth1 handle 100: parent root mqprio num_tc 3 \ map 2 2 1 0 2 2 2 2 2 2 2 2 2 2 2 2 queues 1@2 1@3 2@6 hw 1h]hX;// Map skb->priority to traffic class for Eth1: // 3pri -> tc0, 2pri -> tc1, (0,1,4-7)pri -> tc2 // Map traffic class to transmit queue: // tc0 -> txq2, tc1 -> txq3, tc2 -> (txq6, txq7) $ tc qdisc replace dev eth1 handle 100: parent root mqprio num_tc 3 \ map 2 2 1 0 2 2 2 2 2 2 2 2 2 2 2 2 queues 1@2 1@3 2@6 hw 1}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhMhjubah}(h]h ]h"]h$]h&]uh1j2hjhhhhhNubj3)}(hX :: // Check classes settings $ tc -g class show dev eth1 +---(100:ffe2) mqprio | +---(100:7) mqprio | +---(100:8) mqprio | +---(100:ffe1) mqprio | +---(100:4) mqprio | +---(100:ffe0) mqprio +---(100:3) mqprio h]j)}(h// Check classes settings $ tc -g class show dev eth1 +---(100:ffe2) mqprio | +---(100:7) mqprio | +---(100:8) mqprio | +---(100:ffe1) mqprio | +---(100:4) mqprio | +---(100:ffe0) mqprio +---(100:3) mqprioh]h// Check classes settings $ tc -g class show dev eth1 +---(100:ffe2) mqprio | +---(100:7) mqprio | +---(100:8) mqprio | +---(100:ffe1) mqprio | +---(100:4) mqprio | +---(100:ffe0) mqprio +---(100:3) mqprio}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhMhjubah}(h]h ]h"]h$]h&]uh1j2hjhhhhhNubj3)}(hX:: // Set rate for class A - 31 Mbit (tc0, txq2) using CBS Qdisc for Eth1 // here only idle slope is important, others ignored, but calculated // for interface speed - 100Mb for eth1 port. // Set it +1 Mb for reserve (important!) $ tc qdisc add dev eth1 parent 100:3 cbs locredit -1035 \ hicredit 465 sendslope -69000 idleslope 31000 offload 1 net eth1: set FIFO3 bw = 31 h]j)}(hXp// Set rate for class A - 31 Mbit (tc0, txq2) using CBS Qdisc for Eth1 // here only idle slope is important, others ignored, but calculated // for interface speed - 100Mb for eth1 port. // Set it +1 Mb for reserve (important!) $ tc qdisc add dev eth1 parent 100:3 cbs locredit -1035 \ hicredit 465 sendslope -69000 idleslope 31000 offload 1 net eth1: set FIFO3 bw = 31h]hXp// Set rate for class A - 31 Mbit (tc0, txq2) using CBS Qdisc for Eth1 // here only idle slope is important, others ignored, but calculated // for interface speed - 100Mb for eth1 port. // Set it +1 Mb for reserve (important!) $ tc qdisc add dev eth1 parent 100:3 cbs locredit -1035 \ hicredit 465 sendslope -69000 idleslope 31000 offload 1 net eth1: set FIFO3 bw = 31}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhMhjubah}(h]h ]h"]h$]h&]uh1j2hjhhhhhNubj3)}(hX:: // Set rate for class B - 11 Mbit (tc1, txq3) using CBS Qdisc for Eth1 // Set it +1 Mb for reserve (important!) $ tc qdisc add dev eth1 parent 100:4 cbs locredit -1335 \ hicredit 405 sendslope -89000 idleslope 11000 offload 1 net eth1: set FIFO2 bw = 11 h]j)}(h// Set rate for class B - 11 Mbit (tc1, txq3) using CBS Qdisc for Eth1 // Set it +1 Mb for reserve (important!) $ tc qdisc add dev eth1 parent 100:4 cbs locredit -1335 \ hicredit 405 sendslope -89000 idleslope 11000 offload 1 net eth1: set FIFO2 bw = 11h]h// Set rate for class B - 11 Mbit (tc1, txq3) using CBS Qdisc for Eth1 // Set it +1 Mb for reserve (important!) $ tc qdisc add dev eth1 parent 100:4 cbs locredit -1335 \ hicredit 405 sendslope -89000 idleslope 11000 offload 1 net eth1: set FIFO2 bw = 11}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhMhjubah}(h]h ]h"]h$]h&]uh1j2hjhhhhhNubj3)}(h:: // Create vlan 100 to map sk->priority to vlan qos for Eth1 $ ip link add link eth1 name eth1.100 type vlan id 100 net eth1: Adding vlanid 100 to vlan filter h]j)}(h// Create vlan 100 to map sk->priority to vlan qos for Eth1 $ ip link add link eth1 name eth1.100 type vlan id 100 net eth1: Adding vlanid 100 to vlan filterh]h// Create vlan 100 to map sk->priority to vlan qos for Eth1 $ ip link add link eth1 name eth1.100 type vlan id 100 net eth1: Adding vlanid 100 to vlan filter}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhMhjubah}(h]h ]h"]h$]h&]uh1j2hjhhhhhNubj3)}(h:: // Map skb->priority to L2 prio for Eth1.100, one to one $ ip link set eth1.100 type vlan \ egress 0:0 1:1 2:2 3:3 4:4 5:5 6:6 7:7 h]j)}(h// Map skb->priority to L2 prio for Eth1.100, one to one $ ip link set eth1.100 type vlan \ egress 0:0 1:1 2:2 3:3 4:4 5:5 6:6 7:7h]h// Map skb->priority to L2 prio for Eth1.100, one to one $ ip link set eth1.100 type vlan \ egress 0:0 1:1 2:2 3:3 4:4 5:5 6:6 7:7}hj sbah}(h]h ]h"]h$]h&]hhuh1jhhhMhj ubah}(h]h ]h"]h$]h&]uh1j2hjhhhhhNubj3)}(h:: // Check egress map for vlan 100 $ cat /proc/net/vlan/eth1.100 [...] INGRESS priority mappings: 0:0 1:0 2:0 3:0 4:0 5:0 6:0 7:0 EGRESS priority mappings: 0:0 1:1 2:2 3:3 4:4 5:5 6:6 7:7 h]j)}(h// Check egress map for vlan 100 $ cat /proc/net/vlan/eth1.100 [...] INGRESS priority mappings: 0:0 1:0 2:0 3:0 4:0 5:0 6:0 7:0 EGRESS priority mappings: 0:0 1:1 2:2 3:3 4:4 5:5 6:6 7:7h]h// Check egress map for vlan 100 $ cat /proc/net/vlan/eth1.100 [...] INGRESS priority mappings: 0:0 1:0 2:0 3:0 4:0 5:0 6:0 7:0 EGRESS priority mappings: 0:0 1:1 2:2 3:3 4:4 5:5 6:6 7:7}hj%sbah}(h]h ]h"]h$]h&]hhuh1jhhhMhj!ubah}(h]h ]h"]h$]h&]uh1j2hjhhhhhNubj3)}(hX:: // Run appropriate tools with socket option "SO_PRIORITY" to 3 // for class A and to 2 for class B. For both interfaces ./tsn_talker -d 18:03:73:66:87:42 -i eth0.100 -p2 -s 1500& ./tsn_talker -d 18:03:73:66:87:42 -i eth0.100 -p3 -s 1500& ./tsn_talker -d 20:cf:30:85:7d:fd -i eth1.100 -p2 -s 1500& ./tsn_talker -d 20:cf:30:85:7d:fd -i eth1.100 -p3 -s 1500& h]j)}(hXc// Run appropriate tools with socket option "SO_PRIORITY" to 3 // for class A and to 2 for class B. For both interfaces ./tsn_talker -d 18:03:73:66:87:42 -i eth0.100 -p2 -s 1500& ./tsn_talker -d 18:03:73:66:87:42 -i eth0.100 -p3 -s 1500& ./tsn_talker -d 20:cf:30:85:7d:fd -i eth1.100 -p2 -s 1500& ./tsn_talker -d 20:cf:30:85:7d:fd -i eth1.100 -p3 -s 1500&h]hXc// Run appropriate tools with socket option "SO_PRIORITY" to 3 // for class A and to 2 for class B. For both interfaces ./tsn_talker -d 18:03:73:66:87:42 -i eth0.100 -p2 -s 1500& ./tsn_talker -d 18:03:73:66:87:42 -i eth0.100 -p3 -s 1500& ./tsn_talker -d 20:cf:30:85:7d:fd -i eth1.100 -p2 -s 1500& ./tsn_talker -d 20:cf:30:85:7d:fd -i eth1.100 -p3 -s 1500&}hj=sbah}(h]h ]h"]h$]h&]hhuh1jhhhM$hj9ubah}(h]h ]h"]h$]h&]uh1j2hjhhhhhNubj3)}(hX:: // run your listener on workstation (should be in same vlan) // (I took at https://www.spinics.net/lists/netdev/msg460869.html) ./tsn_listener -d 18:03:73:66:87:42 -i enp5s0 -s 1500 Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39000 kbps h]j)}(hXU// run your listener on workstation (should be in same vlan) // (I took at https://www.spinics.net/lists/netdev/msg460869.html) ./tsn_listener -d 18:03:73:66:87:42 -i enp5s0 -s 1500 Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39000 kbpsh]hXU// run your listener on workstation (should be in same vlan) // (I took at https://www.spinics.net/lists/netdev/msg460869.html) ./tsn_listener -d 18:03:73:66:87:42 -i enp5s0 -s 1500 Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39012 kbps Receiving data rate: 39000 kbps}hjUsbah}(h]h ]h"]h$]h&]hhuh1jhhhM-hjQubah}(h]h ]h"]h$]h&]uh1j2hjhhhhhNubj3)}(hX:: // Restore default configuration if needed $ ip link del eth1.100 $ ip link del eth0.100 $ tc qdisc del dev eth1 root net eth1: Prev FIFO2 is shaped net eth1: set FIFO3 bw = 0 net eth1: set FIFO2 bw = 0 $ tc qdisc del dev eth0 root net eth0: Prev FIFO2 is shaped net eth0: set FIFO3 bw = 0 net eth0: set FIFO2 bw = 0 $ ethtool -L eth0 rx 1 tx 1h]j)}(hXX// Restore default configuration if needed $ ip link del eth1.100 $ ip link del eth0.100 $ tc qdisc del dev eth1 root net eth1: Prev FIFO2 is shaped net eth1: set FIFO3 bw = 0 net eth1: set FIFO2 bw = 0 $ tc qdisc del dev eth0 root net eth0: Prev FIFO2 is shaped net eth0: set FIFO3 bw = 0 net eth0: set FIFO2 bw = 0 $ ethtool -L eth0 rx 1 tx 1h]hXX// Restore default configuration if needed $ ip link del eth1.100 $ ip link del eth0.100 $ tc qdisc del dev eth1 root net eth1: Prev FIFO2 is shaped net eth1: set FIFO3 bw = 0 net eth1: set FIFO2 bw = 0 $ tc qdisc del dev eth0 root net eth0: Prev FIFO2 is shaped net eth0: set FIFO3 bw = 0 net eth0: set FIFO2 bw = 0 $ ethtool -L eth0 rx 1 tx 1}hjmsbah}(h]h ]h"]h$]h&]hhuh1jhhhM@hjiubah}(h]h ]h"]h$]h&]uh1j2hjhhhhhNubeh}(h]h ]h"]h$]h&]jNjOjPhjQjRuh1jhjYhhhhhMzubeh}(h]?example-2-two-port-tx-avb-configuration-scheme-for-target-boardah ]h"]@example 2: two port tx avb configuration scheme for target boardah$]h&]uh1hhjhhhhhM2ubeh}(h]test-setup-for-examplesah ]h"]test setup for examplesah$]h&]uh1hhhhhhhhK)ubeh}(h]&texas-instruments-cpsw-ethernet-driverah ]h"]&texas instruments cpsw ethernet driverah$]h&]uh1hhhhhhhhKubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksentryfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerjerror_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourceh _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}nameids}(jjhhjjjjjVjSjju nametypes}(jhjjjVjuh}(jhhhjjjjjSj!jjYu footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}Rparse_messages]hsystem_message)}(hhh]h)}(h:Enumerated list start value not ordinal-1: "6" (ordinal 6)h]h>Enumerated list start value not ordinal-1: “6” (ordinal 6)}(hj)hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj&ubah}(h]h ]h"]h$]h&]levelKtypeINFOsourcehlineKuh1j$hj!hhhhhKubatransform_messages] transformerN include_log] decorationNhhub.