| 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 OpcUa scenario with Frame Preemption |
| 9 | # (FPE). |
| 10 | # |
| 11 | # Note: The FPE statistics are not included in ethtool -S. Use ethtool --include-statistics |
| 12 | # --show-mm <inf> instead. |
| 13 | # |
| 14 | |
| 15 | set -e |
| 16 | |
| 17 | source ../lib/common.sh |
| 18 | source ../lib/igc.sh |
| 19 | |
| 20 | # |
| 21 | # Command line arguments. |
| 22 | # |
| 23 | INTERFACE=$1 |
| 24 | |
| 25 | [ -z $INTERFACE ] && INTERFACE="enp3s0" # default: enp3s0 |
| 26 | |
| 27 | load_kernel_modules |
| 28 | |
| 29 | setup_threaded_napi "${INTERFACE}" |
| 30 | |
| 31 | igc_start "${INTERFACE}" |
| 32 | |
| 33 | # |
| 34 | # Tx Assignment with Qbv and full hardware offload. |
| 35 | # |
| 36 | # PCP 6 - Tx Q 3 - TSN High / OpcUa |
| 37 | # PCP 5 - Tx Q 2 - TSN Low |
| 38 | # PCP 4 - Tx Q 1 - RTC |
| 39 | # PCP 3/X - Tx Q 0 - RTA and Everything else |
| 40 | # |
| 41 | tc qdisc replace dev ${INTERFACE} handle 100 parent root mqprio num_tc 4 \ |
| 42 | map 0 0 0 0 0 1 2 3 0 0 0 0 0 0 0 0 \ |
| 43 | queues 1@0 1@1 1@2 1@3 \ |
| 44 | fp P P P E \ |
| 45 | hw 1 |
| 46 | |
| 47 | # |
| 48 | # Enable FPE. |
| 49 | # |
| 50 | ethtool --set-mm ${INTERFACE} pmac-enabled on tx-enabled on verify-enabled on |
| 51 | |
| 52 | # |
| 53 | # Rx Queues Assignment. |
| 54 | # |
| 55 | # Rx Q 0 - All Traffic |
| 56 | # Rx Q 1 - RTC |
| 57 | # Rx Q 2 - TSN Low |
| 58 | # Rx Q 3 - TSN High / OpcUa |
| 59 | # |
| 60 | RXQUEUES=(0 3 2 1 0 0 0 0 0 0) |
| 61 | igc_rx_queues_assign "${INTERFACE}" RXQUEUES |
| 62 | |
| 63 | igc_end "${INTERFACE}" |
| 64 | |
| 65 | setup_irqs "${INTERFACE}" |
| 66 | |
| 67 | exit 0 |