Debian Codegraph @

tests/profinet/flow_cml.sh

raw symbols SCIP
1 #!/bin/bash
2 #
3 # Copyright (C) 2023 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 for profinet scenario.
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="enp3s0" # default: enp3s0
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 and everything else.
35 #
36 ENTRY1_NS="50000" # TSN High
37 ENTRY2_NS="50000" # TSN Low
38 ENTRY3_NS="100000" # RTC
39 ENTRY4_NS="800000" # RTA and everything else
40
41 #
42 # Tx Assignment with Qbv and full hardware offload.
43 #
44 # PCP 6 - Tx Q 0 - TSN High
45 # PCP 5 - Tx Q 1 - TSN Low
46 # PCP 4 - Tx Q 2 - RTC
47 # PCP 3/X - Tx Q 3 - RTA and 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 0x08 ${ENTRY4_NS} \
57 flags 0x02
58
59 #
60 # Rx Queues Assignment.
61 #
62 # Rx Q 3 - All Traffic
63 # Rx Q 2 - RTC
64 # Rx Q 1 - TSN Low
65 # Rx Q 0 - TSN High
66 #
67 RXQUEUES=(3 0 1 2 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