ti-cpsw.txt 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541
  1. * Texas Instruments CPSW ethernet driver
  2. Multiqueue & CBS & MQPRIO
  3. =====================================================================
  4. =====================================================================
  5. The cpsw has 3 CBS shapers for each external ports. This document
  6. describes MQPRIO and CBS Qdisc offload configuration for cpsw driver
  7. based on examples. It potentially can be used in audio video bridging
  8. (AVB) and time sensitive networking (TSN).
  9. The following examples were tested on AM572x EVM and BBB boards.
  10. Test setup
  11. ==========
  12. Under consideration two examples with AM572x EVM running cpsw driver
  13. in dual_emac mode.
  14. Several prerequisites:
  15. - TX queues must be rated starting from txq0 that has highest priority
  16. - Traffic classes are used starting from 0, that has highest priority
  17. - CBS shapers should be used with rated queues
  18. - The bandwidth for CBS shapers has to be set a little bit more then
  19. potential incoming rate, thus, rate of all incoming tx queues has
  20. to be a little less
  21. - Real rates can differ, due to discreetness
  22. - Map skb-priority to txq is not enough, also skb-priority to l2 prio
  23. map has to be created with ip or vconfig tool
  24. - Any l2/socket prio (0 - 7) for classes can be used, but for
  25. simplicity default values are used: 3 and 2
  26. - only 2 classes tested: A and B, but checked and can work with more,
  27. maximum allowed 4, but only for 3 rate can be set.
  28. Test setup for examples
  29. =======================
  30. +-------------------------------+
  31. |--+ |
  32. | | Workstation0 |
  33. |E | MAC 18:03:73:66:87:42 |
  34. +-----------------------------+ +--|t | |
  35. | | 1 | E | | |h |./tsn_listener -d \ |
  36. | Target board: | 0 | t |--+ |0 | 18:03:73:66:87:42 -i eth0 \|
  37. | AM572x EVM | 0 | h | | | -s 1500 |
  38. | | 0 | 0 | |--+ |
  39. | Only 2 classes: |Mb +---| +-------------------------------+
  40. | class A, class B | |
  41. | | +---| +-------------------------------+
  42. | | 1 | E | |--+ |
  43. | | 0 | t | | | Workstation1 |
  44. | | 0 | h |--+ |E | MAC 20:cf:30:85:7d:fd |
  45. | |Mb | 1 | +--|t | |
  46. +-----------------------------+ |h |./tsn_listener -d \ |
  47. |0 | 20:cf:30:85:7d:fd -i eth0 \|
  48. | | -s 1500 |
  49. |--+ |
  50. +-------------------------------+
  51. *********************************************************************
  52. *********************************************************************
  53. *********************************************************************
  54. Example 1: One port tx AVB configuration scheme for target board
  55. ----------------------------------------------------------------------
  56. (prints and scheme for AM572x evm, applicable for single port boards)
  57. tc - traffic class
  58. txq - transmit queue
  59. p - priority
  60. f - fifo (cpsw fifo)
  61. S - shaper configured
  62. +------------------------------------------------------------------+ u
  63. | +---------------+ +---------------+ +------+ +------+ | s
  64. | | | | | | | | | | e
  65. | | App 1 | | App 2 | | Apps | | Apps | | r
  66. | | Class A | | Class B | | Rest | | Rest | |
  67. | | Eth0 | | Eth0 | | Eth0 | | Eth1 | | s
  68. | | VLAN100 | | VLAN100 | | | | | | | | p
  69. | | 40 Mb/s | | 20 Mb/s | | | | | | | | a
  70. | | SO_PRIORITY=3 | | SO_PRIORITY=2 | | | | | | | | c
  71. | | | | | | | | | | | | | | e
  72. | +---|-----------+ +---|-----------+ +---|--+ +---|--+ |
  73. +-----|------------------|------------------|--------|-------------+
  74. +-+ +------------+ | |
  75. | | +-----------------+ +--+
  76. | | | |
  77. +---|-------|-------------|-----------------------|----------------+
  78. | +----+ +----+ +----+ +----+ +----+ |
  79. | | p3 | | p2 | | p1 | | p0 | | p0 | | k
  80. | \ / \ / \ / \ / \ / | e
  81. | \ / \ / \ / \ / \ / | r
  82. | \/ \/ \/ \/ \/ | n
  83. | | | | | | e
  84. | | | +-----+ | | l
  85. | | | | | |
  86. | +----+ +----+ +----+ +----+ | s
  87. | |tc0 | |tc1 | |tc2 | |tc0 | | p
  88. | \ / \ / \ / \ / | a
  89. | \ / \ / \ / \ / | c
  90. | \/ \/ \/ \/ | e
  91. | | | +-----+ | |
  92. | | | | | | |
  93. | | | | | | |
  94. | | | | | | |
  95. | +----+ +----+ +----+ +----+ +----+ |
  96. | |txq0| |txq1| |txq2| |txq3| |txq4| |
  97. | \ / \ / \ / \ / \ / |
  98. | \ / \ / \ / \ / \ / |
  99. | \/ \/ \/ \/ \/ |
  100. | +-|------|------|------|--+ +--|--------------+ |
  101. | | | | | | | Eth0.100 | | Eth1 | |
  102. +---|------|------|------|------------------------|----------------+
  103. | | | | |
  104. p p p p |
  105. 3 2 0-1, 4-7 <- L2 priority |
  106. | | | | |
  107. | | | | |
  108. +---|------|------|------|------------------------|----------------+
  109. | | | | | |----------+ |
  110. | +----+ +----+ +----+ +----+ +----+ |
  111. | |dma7| |dma6| |dma5| |dma4| |dma3| |
  112. | \ / \ / \ / \ / \ / | c
  113. | \S / \S / \ / \ / \ / | p
  114. | \/ \/ \/ \/ \/ | s
  115. | | | | +----- | | w
  116. | | | | | | |
  117. | | | | | | | d
  118. | +----+ +----+ +----+p p+----+ | r
  119. | | | | | | |o o| | | i
  120. | | f3 | | f2 | | f0 |r r| f0 | | v
  121. | |tc0 | |tc1 | |tc2 |t t|tc0 | | e
  122. | \CBS / \CBS / \CBS /1 2\CBS / | r
  123. | \S / \S / \ / \ / |
  124. | \/ \/ \/ \/ |
  125. +------------------------------------------------------------------+
  126. ========================================Eth==========================>
  127. 1)
  128. // Add 4 tx queues, for interface Eth0, and 1 tx queue for Eth1
  129. $ ethtool -L eth0 rx 1 tx 5
  130. rx unmodified, ignoring
  131. 2)
  132. // Check if num of queues is set correctly:
  133. $ ethtool -l eth0
  134. Channel parameters for eth0:
  135. Pre-set maximums:
  136. RX: 8
  137. TX: 8
  138. Other: 0
  139. Combined: 0
  140. Current hardware settings:
  141. RX: 1
  142. TX: 5
  143. Other: 0
  144. Combined: 0
  145. 3)
  146. // TX queues must be rated starting from 0, so set bws for tx0 and tx1
  147. // Set rates 40 and 20 Mb/s appropriately.
  148. // Pay attention, real speed can differ a bit due to discreetness.
  149. // Leave last 2 tx queues not rated.
  150. $ echo 40 > /sys/class/net/eth0/queues/tx-0/tx_maxrate
  151. $ echo 20 > /sys/class/net/eth0/queues/tx-1/tx_maxrate
  152. 4)
  153. // Check maximum rate of tx (cpdma) queues:
  154. $ cat /sys/class/net/eth0/queues/tx-*/tx_maxrate
  155. 40
  156. 20
  157. 0
  158. 0
  159. 0
  160. 5)
  161. // Map skb->priority to traffic class:
  162. // 3pri -> tc0, 2pri -> tc1, (0,1,4-7)pri -> tc2
  163. // Map traffic class to transmit queue:
  164. // tc0 -> txq0, tc1 -> txq1, tc2 -> (txq2, txq3)
  165. $ tc qdisc replace dev eth0 handle 100: parent root mqprio num_tc 3 \
  166. 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
  167. 5a)
  168. // As two interface sharing same set of tx queues, assign all traffic
  169. // coming to interface Eth1 to separate queue in order to not mix it
  170. // with traffic from interface Eth0, so use separate txq to send
  171. // packets to Eth1, so all prio -> tc0 and tc0 -> txq4
  172. // Here hw 0, so here still default configuration for eth1 in hw
  173. $ tc qdisc replace dev eth1 handle 100: parent root mqprio num_tc 1 \
  174. map 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 queues 1@4 hw 0
  175. 6)
  176. // Check classes settings
  177. $ tc -g class show dev eth0
  178. +---(100:ffe2) mqprio
  179. | +---(100:3) mqprio
  180. | +---(100:4) mqprio
  181. |
  182. +---(100:ffe1) mqprio
  183. | +---(100:2) mqprio
  184. |
  185. +---(100:ffe0) mqprio
  186. +---(100:1) mqprio
  187. $ tc -g class show dev eth1
  188. +---(100:ffe0) mqprio
  189. +---(100:5) mqprio
  190. 7)
  191. // Set rate for class A - 41 Mbit (tc0, txq0) using CBS Qdisc
  192. // Set it +1 Mb for reserve (important!)
  193. // here only idle slope is important, others arg are ignored
  194. // Pay attention, real speed can differ a bit due to discreetness
  195. $ tc qdisc add dev eth0 parent 100:1 cbs locredit -1438 \
  196. hicredit 62 sendslope -959000 idleslope 41000 offload 1
  197. net eth0: set FIFO3 bw = 50
  198. 8)
  199. // Set rate for class B - 21 Mbit (tc1, txq1) using CBS Qdisc:
  200. // Set it +1 Mb for reserve (important!)
  201. $ tc qdisc add dev eth0 parent 100:2 cbs locredit -1468 \
  202. hicredit 65 sendslope -979000 idleslope 21000 offload 1
  203. net eth0: set FIFO2 bw = 30
  204. 9)
  205. // Create vlan 100 to map sk->priority to vlan qos
  206. $ ip link add link eth0 name eth0.100 type vlan id 100
  207. 8021q: 802.1Q VLAN Support v1.8
  208. 8021q: adding VLAN 0 to HW filter on device eth0
  209. 8021q: adding VLAN 0 to HW filter on device eth1
  210. net eth0: Adding vlanid 100 to vlan filter
  211. 10)
  212. // Map skb->priority to L2 prio, 1 to 1
  213. $ ip link set eth0.100 type vlan \
  214. egress 0:0 1:1 2:2 3:3 4:4 5:5 6:6 7:7
  215. 11)
  216. // Check egress map for vlan 100
  217. $ cat /proc/net/vlan/eth0.100
  218. [...]
  219. INGRESS priority mappings: 0:0 1:0 2:0 3:0 4:0 5:0 6:0 7:0
  220. EGRESS priority mappings: 0:0 1:1 2:2 3:3 4:4 5:5 6:6 7:7
  221. 12)
  222. // Run your appropriate tools with socket option "SO_PRIORITY"
  223. // to 3 for class A and/or to 2 for class B
  224. // (I took at https://www.spinics.net/lists/netdev/msg460869.html)
  225. ./tsn_talker -d 18:03:73:66:87:42 -i eth0.100 -p3 -s 1500&
  226. ./tsn_talker -d 18:03:73:66:87:42 -i eth0.100 -p2 -s 1500&
  227. 13)
  228. // run your listener on workstation (should be in same vlan)
  229. // (I took at https://www.spinics.net/lists/netdev/msg460869.html)
  230. ./tsn_listener -d 18:03:73:66:87:42 -i enp5s0 -s 1500
  231. Receiving data rate: 39012 kbps
  232. Receiving data rate: 39012 kbps
  233. Receiving data rate: 39012 kbps
  234. Receiving data rate: 39012 kbps
  235. Receiving data rate: 39012 kbps
  236. Receiving data rate: 39012 kbps
  237. Receiving data rate: 39012 kbps
  238. Receiving data rate: 39012 kbps
  239. Receiving data rate: 39012 kbps
  240. Receiving data rate: 39012 kbps
  241. Receiving data rate: 39012 kbps
  242. Receiving data rate: 39012 kbps
  243. Receiving data rate: 39000 kbps
  244. 14)
  245. // Restore default configuration if needed
  246. $ ip link del eth0.100
  247. $ tc qdisc del dev eth1 root
  248. $ tc qdisc del dev eth0 root
  249. net eth0: Prev FIFO2 is shaped
  250. net eth0: set FIFO3 bw = 0
  251. net eth0: set FIFO2 bw = 0
  252. $ ethtool -L eth0 rx 1 tx 1
  253. *********************************************************************
  254. *********************************************************************
  255. *********************************************************************
  256. Example 2: Two port tx AVB configuration scheme for target board
  257. ----------------------------------------------------------------------
  258. (prints and scheme for AM572x evm, for dual emac boards only)
  259. +------------------------------------------------------------------+ u
  260. | +----------+ +----------+ +------+ +----------+ +----------+ | s
  261. | | | | | | | | | | | | e
  262. | | App 1 | | App 2 | | Apps | | App 3 | | App 4 | | r
  263. | | Class A | | Class B | | Rest | | Class B | | Class A | |
  264. | | Eth0 | | Eth0 | | | | | Eth1 | | Eth1 | | s
  265. | | VLAN100 | | VLAN100 | | | | | VLAN100 | | VLAN100 | | p
  266. | | 40 Mb/s | | 20 Mb/s | | | | | 10 Mb/s | | 30 Mb/s | | a
  267. | | SO_PRI=3 | | SO_PRI=2 | | | | | SO_PRI=3 | | SO_PRI=2 | | c
  268. | | | | | | | | | | | | | | | | | e
  269. | +---|------+ +---|------+ +---|--+ +---|------+ +---|------+ |
  270. +-----|-------------|-------------|---------|-------------|--------+
  271. +-+ +-------+ | +----------+ +----+
  272. | | +-------+------+ | |
  273. | | | | | |
  274. +---|-------|-------------|--------------|-------------|-------|---+
  275. | +----+ +----+ +----+ +----+ +----+ +----+ +----+ +----+ |
  276. | | p3 | | p2 | | p1 | | p0 | | p0 | | p1 | | p2 | | p3 | | k
  277. | \ / \ / \ / \ / \ / \ / \ / \ / | e
  278. | \ / \ / \ / \ / \ / \ / \ / \ / | r
  279. | \/ \/ \/ \/ \/ \/ \/ \/ | n
  280. | | | | | | | | e
  281. | | | +----+ +----+ | | | l
  282. | | | | | | | |
  283. | +----+ +----+ +----+ +----+ +----+ +----+ | s
  284. | |tc0 | |tc1 | |tc2 | |tc2 | |tc1 | |tc0 | | p
  285. | \ / \ / \ / \ / \ / \ / | a
  286. | \ / \ / \ / \ / \ / \ / | c
  287. | \/ \/ \/ \/ \/ \/ | e
  288. | | | +-----+ +-----+ | | |
  289. | | | | | | | | | |
  290. | | | | | | | | | |
  291. | | | | | E E | | | | |
  292. | +----+ +----+ +----+ +----+ t t +----+ +----+ +----+ +----+ |
  293. | |txq0| |txq1| |txq4| |txq5| h h |txq6| |txq7| |txq3| |txq2| |
  294. | \ / \ / \ / \ / 0 1 \ / \ / \ / \ / |
  295. | \ / \ / \ / \ / . . \ / \ / \ / \ / |
  296. | \/ \/ \/ \/ 1 1 \/ \/ \/ \/ |
  297. | +-|------|------|------|--+ 0 0 +-|------|------|------|--+ |
  298. | | | | | | | 0 0 | | | | | | |
  299. +---|------|------|------|---------------|------|------|------|----+
  300. | | | | | | | |
  301. p p p p p p p p
  302. 3 2 0-1, 4-7 <-L2 pri-> 0-1, 4-7 2 3
  303. | | | | | | | |
  304. | | | | | | | |
  305. +---|------|------|------|---------------|------|------|------|----+
  306. | | | | | | | | | |
  307. | +----+ +----+ +----+ +----+ +----+ +----+ +----+ +----+ |
  308. | |dma7| |dma6| |dma3| |dma2| |dma1| |dma0| |dma4| |dma5| |
  309. | \ / \ / \ / \ / \ / \ / \ / \ / | c
  310. | \S / \S / \ / \ / \ / \ / \S / \S / | p
  311. | \/ \/ \/ \/ \/ \/ \/ \/ | s
  312. | | | | +----- | | | | | w
  313. | | | | | +----+ | | | |
  314. | | | | | | | | | | d
  315. | +----+ +----+ +----+p p+----+ +----+ +----+ | r
  316. | | | | | | |o o| | | | | | | i
  317. | | f3 | | f2 | | f0 |r CPSW r| f3 | | f2 | | f0 | | v
  318. | |tc0 | |tc1 | |tc2 |t t|tc0 | |tc1 | |tc2 | | e
  319. | \CBS / \CBS / \CBS /1 2\CBS / \CBS / \CBS / | r
  320. | \S / \S / \ / \S / \S / \ / |
  321. | \/ \/ \/ \/ \/ \/ |
  322. +------------------------------------------------------------------+
  323. ========================================Eth==========================>
  324. 1)
  325. // Add 8 tx queues, for interface Eth0, but they are common, so are accessed
  326. // by two interfaces Eth0 and Eth1.
  327. $ ethtool -L eth1 rx 1 tx 8
  328. rx unmodified, ignoring
  329. 2)
  330. // Check if num of queues is set correctly:
  331. $ ethtool -l eth0
  332. Channel parameters for eth0:
  333. Pre-set maximums:
  334. RX: 8
  335. TX: 8
  336. Other: 0
  337. Combined: 0
  338. Current hardware settings:
  339. RX: 1
  340. TX: 8
  341. Other: 0
  342. Combined: 0
  343. 3)
  344. // TX queues must be rated starting from 0, so set bws for tx0 and tx1 for Eth0
  345. // and for tx2 and tx3 for Eth1. That is, rates 40 and 20 Mb/s appropriately
  346. // for Eth0 and 30 and 10 Mb/s for Eth1.
  347. // Real speed can differ a bit due to discreetness
  348. // Leave last 4 tx queues as not rated
  349. $ echo 40 > /sys/class/net/eth0/queues/tx-0/tx_maxrate
  350. $ echo 20 > /sys/class/net/eth0/queues/tx-1/tx_maxrate
  351. $ echo 30 > /sys/class/net/eth1/queues/tx-2/tx_maxrate
  352. $ echo 10 > /sys/class/net/eth1/queues/tx-3/tx_maxrate
  353. 4)
  354. // Check maximum rate of tx (cpdma) queues:
  355. $ cat /sys/class/net/eth0/queues/tx-*/tx_maxrate
  356. 40
  357. 20
  358. 30
  359. 10
  360. 0
  361. 0
  362. 0
  363. 0
  364. 5)
  365. // Map skb->priority to traffic class for Eth0:
  366. // 3pri -> tc0, 2pri -> tc1, (0,1,4-7)pri -> tc2
  367. // Map traffic class to transmit queue:
  368. // tc0 -> txq0, tc1 -> txq1, tc2 -> (txq4, txq5)
  369. $ tc qdisc replace dev eth0 handle 100: parent root mqprio num_tc 3 \
  370. 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
  371. 6)
  372. // Check classes settings
  373. $ tc -g class show dev eth0
  374. +---(100:ffe2) mqprio
  375. | +---(100:5) mqprio
  376. | +---(100:6) mqprio
  377. |
  378. +---(100:ffe1) mqprio
  379. | +---(100:2) mqprio
  380. |
  381. +---(100:ffe0) mqprio
  382. +---(100:1) mqprio
  383. 7)
  384. // Set rate for class A - 41 Mbit (tc0, txq0) using CBS Qdisc for Eth0
  385. // here only idle slope is important, others ignored
  386. // Real speed can differ a bit due to discreetness
  387. $ tc qdisc add dev eth0 parent 100:1 cbs locredit -1470 \
  388. hicredit 62 sendslope -959000 idleslope 41000 offload 1
  389. net eth0: set FIFO3 bw = 50
  390. 8)
  391. // Set rate for class B - 21 Mbit (tc1, txq1) using CBS Qdisc for Eth0
  392. $ tc qdisc add dev eth0 parent 100:2 cbs locredit -1470 \
  393. hicredit 65 sendslope -979000 idleslope 21000 offload 1
  394. net eth0: set FIFO2 bw = 30
  395. 9)
  396. // Create vlan 100 to map sk->priority to vlan qos for Eth0
  397. $ ip link add link eth0 name eth0.100 type vlan id 100
  398. net eth0: Adding vlanid 100 to vlan filter
  399. 10)
  400. // Map skb->priority to L2 prio for Eth0.100, one to one
  401. $ ip link set eth0.100 type vlan \
  402. egress 0:0 1:1 2:2 3:3 4:4 5:5 6:6 7:7
  403. 11)
  404. // Check egress map for vlan 100
  405. $ cat /proc/net/vlan/eth0.100
  406. [...]
  407. INGRESS priority mappings: 0:0 1:0 2:0 3:0 4:0 5:0 6:0 7:0
  408. EGRESS priority mappings: 0:0 1:1 2:2 3:3 4:4 5:5 6:6 7:7
  409. 12)
  410. // Map skb->priority to traffic class for Eth1:
  411. // 3pri -> tc0, 2pri -> tc1, (0,1,4-7)pri -> tc2
  412. // Map traffic class to transmit queue:
  413. // tc0 -> txq2, tc1 -> txq3, tc2 -> (txq6, txq7)
  414. $ tc qdisc replace dev eth1 handle 100: parent root mqprio num_tc 3 \
  415. 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
  416. 13)
  417. // Check classes settings
  418. $ tc -g class show dev eth1
  419. +---(100:ffe2) mqprio
  420. | +---(100:7) mqprio
  421. | +---(100:8) mqprio
  422. |
  423. +---(100:ffe1) mqprio
  424. | +---(100:4) mqprio
  425. |
  426. +---(100:ffe0) mqprio
  427. +---(100:3) mqprio
  428. 14)
  429. // Set rate for class A - 31 Mbit (tc0, txq2) using CBS Qdisc for Eth1
  430. // here only idle slope is important, others ignored, but calculated
  431. // for interface speed - 100Mb for eth1 port.
  432. // Set it +1 Mb for reserve (important!)
  433. $ tc qdisc add dev eth1 parent 100:3 cbs locredit -1035 \
  434. hicredit 465 sendslope -69000 idleslope 31000 offload 1
  435. net eth1: set FIFO3 bw = 31
  436. 15)
  437. // Set rate for class B - 11 Mbit (tc1, txq3) using CBS Qdisc for Eth1
  438. // Set it +1 Mb for reserve (important!)
  439. $ tc qdisc add dev eth1 parent 100:4 cbs locredit -1335 \
  440. hicredit 405 sendslope -89000 idleslope 11000 offload 1
  441. net eth1: set FIFO2 bw = 11
  442. 16)
  443. // Create vlan 100 to map sk->priority to vlan qos for Eth1
  444. $ ip link add link eth1 name eth1.100 type vlan id 100
  445. net eth1: Adding vlanid 100 to vlan filter
  446. 17)
  447. // Map skb->priority to L2 prio for Eth1.100, one to one
  448. $ ip link set eth1.100 type vlan \
  449. egress 0:0 1:1 2:2 3:3 4:4 5:5 6:6 7:7
  450. 18)
  451. // Check egress map for vlan 100
  452. $ cat /proc/net/vlan/eth1.100
  453. [...]
  454. INGRESS priority mappings: 0:0 1:0 2:0 3:0 4:0 5:0 6:0 7:0
  455. EGRESS priority mappings: 0:0 1:1 2:2 3:3 4:4 5:5 6:6 7:7
  456. 19)
  457. // Run appropriate tools with socket option "SO_PRIORITY" to 3
  458. // for class A and to 2 for class B. For both interfaces
  459. ./tsn_talker -d 18:03:73:66:87:42 -i eth0.100 -p2 -s 1500&
  460. ./tsn_talker -d 18:03:73:66:87:42 -i eth0.100 -p3 -s 1500&
  461. ./tsn_talker -d 20:cf:30:85:7d:fd -i eth1.100 -p2 -s 1500&
  462. ./tsn_talker -d 20:cf:30:85:7d:fd -i eth1.100 -p3 -s 1500&
  463. 20)
  464. // run your listener on workstation (should be in same vlan)
  465. // (I took at https://www.spinics.net/lists/netdev/msg460869.html)
  466. ./tsn_listener -d 18:03:73:66:87:42 -i enp5s0 -s 1500
  467. Receiving data rate: 39012 kbps
  468. Receiving data rate: 39012 kbps
  469. Receiving data rate: 39012 kbps
  470. Receiving data rate: 39012 kbps
  471. Receiving data rate: 39012 kbps
  472. Receiving data rate: 39012 kbps
  473. Receiving data rate: 39012 kbps
  474. Receiving data rate: 39012 kbps
  475. Receiving data rate: 39012 kbps
  476. Receiving data rate: 39012 kbps
  477. Receiving data rate: 39012 kbps
  478. Receiving data rate: 39012 kbps
  479. Receiving data rate: 39000 kbps
  480. 21)
  481. // Restore default configuration if needed
  482. $ ip link del eth1.100
  483. $ ip link del eth0.100
  484. $ tc qdisc del dev eth1 root
  485. net eth1: Prev FIFO2 is shaped
  486. net eth1: set FIFO3 bw = 0
  487. net eth1: set FIFO2 bw = 0
  488. $ tc qdisc del dev eth0 root
  489. net eth0: Prev FIFO2 is shaped
  490. net eth0: set FIFO3 bw = 0
  491. net eth0: set FIFO2 bw = 0
  492. $ ethtool -L eth0 rx 1 tx 1