| 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 RT 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 | |
| 21 | [ -z $INTERFACE ] && INTERFACE="enp3s0" # default: enp3s0 |
| 22 | BASETIME=$(date '+%s000000000' -d '-30 sec') # default: now - 30s |
| 23 | CYCLETIME_NS="1000000" # default: 1ms |
| 24 | |
| 25 | load_kernel_modules |
| 26 | |
| 27 | napi_defer_hard_irqs "${INTERFACE}" "${CYCLETIME_NS}" |
| 28 | |
| 29 | igc_start "${INTERFACE}" |
| 30 | |
| 31 | # |
| 32 | # Tx Assignment with Qbv and full hardware offload. |
| 33 | # |
| 34 | # Tx Q 0 - RTC |
| 35 | # Tx Q 1 - RTA |
| 36 | # Tx Q 2 - DCP, LLDP, UDP High |
| 37 | # Tx Q 3 - Everything else |
| 38 | # |
| 39 | tc qdisc replace dev ${INTERFACE} handle 100 parent root taprio num_tc 4 \ |
| 40 | map 3 3 3 3 3 2 1 0 3 3 3 3 3 3 3 3 \ |
| 41 | queues 1@0 1@1 1@2 1@3 \ |
| 42 | base-time ${BASETIME} \ |
| 43 | sched-entry S 0x01 100000 \ |
| 44 | sched-entry S 0x02 100000 \ |
| 45 | sched-entry S 0x04 400000 \ |
| 46 | sched-entry S 0x08 400000 \ |
| 47 | flags 0x02 |
| 48 | |
| 49 | # |
| 50 | # Rx Queues Assignment. |
| 51 | # |
| 52 | # Rx Q 0 - RTC |
| 53 | # Rx Q 1 - RTA |
| 54 | # Rx Q 2 - DCP, LLDP, UDP High |
| 55 | # Rx Q 3 - Everything else |
| 56 | # |
| 57 | RXQUEUES=(2 2 2 0 1 2 2 3 2 2) |
| 58 | igc_rx_queues_assign "${INTERFACE}" RXQUEUES |
| 59 | |
| 60 | igc_end "${INTERFACE}" |
| 61 | |
| 62 | setup_irqs "${INTERFACE}" |
| 63 | |
| 64 | exit 0 |