| 1 | #!/bin/bash |
| 2 | # |
| 3 | # Copyright (C) 2024 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 testing XDP busy polling. |
| 9 | # This one used strict priority rather than Qbv. |
| 10 | # |
| 11 | |
| 12 | set -e |
| 13 | |
| 14 | source ../lib/common.sh |
| 15 | source ../lib/igc.sh |
| 16 | |
| 17 | # |
| 18 | # Command line arguments. |
| 19 | # |
| 20 | INTERFACE=$1 |
| 21 | CYCLETIME_NS=$2 |
| 22 | BASETIME=$3 |
| 23 | |
| 24 | [ -z $INTERFACE ] && INTERFACE="enp3s0" # default: enp3s0 |
| 25 | [ -z $CYCLETIME_NS ] && CYCLETIME_NS="1000000" # default: 1ms |
| 26 | [ -z $BASETIME ] && BASETIME=$(date '+%s000000000' -d '-30 sec') # default: now - 30s |
| 27 | |
| 28 | load_kernel_modules |
| 29 | |
| 30 | napi_defer_hard_irqs "${INTERFACE}" "${CYCLETIME_NS}" |
| 31 | |
| 32 | igc_start "${INTERFACE}" |
| 33 | |
| 34 | # |
| 35 | # Tx Assignment with strict priority and hardware offload. |
| 36 | # |
| 37 | # PCP 4 - Rx Q 0 - RTC |
| 38 | # PCP 6/5 - Rx Q 1 - TSN Streams / Prio |
| 39 | # PCP X - Rx Q 2 - 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@3 1@2 1@1 1@0 \ |
| 44 | hw 1 |
| 45 | |
| 46 | # |
| 47 | # Rx Queues Assignment. |
| 48 | # |
| 49 | # PCP 4 - Rx Q 0 - RTC |
| 50 | # PCP 6/5 - Rx Q 1 - TSN Streams / Prio |
| 51 | # PCP X - Rx Q 2 - Everything else |
| 52 | # |
| 53 | RXQUEUES=(2 1 1 0 2 2 2 2 1 1) |
| 54 | igc_rx_queues_assign "${INTERFACE}" RXQUEUES |
| 55 | |
| 56 | igc_end "${INTERFACE}" |
| 57 | |
| 58 | setup_irqs "${INTERFACE}" |
| 59 | |
| 60 | exit 0 |