Debian Codegraph @

tests/ew25/flow.sh

raw symbols SCIP
1 #!/bin/bash
2 #
3 # Copyright (C) 2023-2025 Linutronix GmbH
4 # Author Kurt Kanzenbach <[email protected]>
5 #
6 # SPDX-License-Identifier: BSD-2-Clause
7 #
8 # Setup the Tx and Rx traffic flows for Intel i225/i226 for Embedded World 2025.
9 #
10
11 set -e
12
13 source ../lib/common.sh
14 source ../lib/igc.sh
15
16 #
17 # Command line arguments.
18 #
19 INTERFACE=$1
20 CYCLETIME_NS=$2
21 BASETIME=$3
22
23 [ -z $INTERFACE ] && INTERFACE="enp88s0" # default: enp88s0
24 [ -z $CYCLETIME_NS ] && CYCLETIME_NS="1000000" # default: 1ms
25 [ -z $BASETIME ] && BASETIME=$(date '+%s000000000' -d '-30 sec') # default: now - 30s
26
27 load_kernel_modules
28
29 setup_threaded_napi "${INTERFACE}"
30
31 igc_start "${INTERFACE}"
32
33 #
34 # Split traffic between TSN streams, real time cyclic and everything else.
35 #
36 ENTRY1_NS=$(echo "$CYCLETIME_NS * 12.5 / 100" | bc) # TSN High
37 ENTRY2_NS=$(echo "$CYCLETIME_NS * 12.5 / 100" | bc) # TSN Low
38 ENTRY3_NS=$(echo "$CYCLETIME_NS * 25 / 100" | bc) # RTC
39 ENTRY4_NS=$(echo "$CYCLETIME_NS * 50 / 100" | bc) # Everything else
40
41 #
42 # Tx Assignment with Qbv and full hardware offload.
43 #
44 # PCP 7 - Queue 0 - TSN High
45 # PCP 6 - Queue 1 - TSN Low
46 # PCP 5 - Queue 2 - RTC
47 # PCP X - Queue 3 - Everything else
48 #
49 tc qdisc replace dev ${INTERFACE} handle 100 parent root taprio num_tc 4 \
50 map 3 3 3 3 3 2 1 0 3 3 3 3 3 3 3 3 \
51 queues 1@0 1@1 1@2 1@3 \
52 base-time ${BASETIME} \
53 sched-entry S 0x01 ${ENTRY1_NS} \
54 sched-entry S 0x02 ${ENTRY2_NS} \
55 sched-entry S 0x04 ${ENTRY3_NS} \
56 sched-entry S 0xf8 ${ENTRY4_NS} \
57 flags 0x02
58
59 #
60 # Rx Queues Assignment.
61 #
62 # PCP 7 - Rx Q 0 - TSN High
63 # PCP 6 - Rx Q 1 - TSN Low
64 # PCP 5 - Rx Q 2 - RTC
65 # PCP X - Rx Q 3 - Everything else
66 #
67 RXQUEUES=(0 1 2 3 3 3 3 3 3 3)
68 igc_rx_queues_assign "${INTERFACE}" RXQUEUES
69
70 igc_end "${INTERFACE}"
71
72 setup_irqs "${INTERFACE}"
73
74 exit 0