| 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 imx93 stmmac for PROFINET RT scenario. |
| 9 | # |
| 10 | |
| 11 | set -e |
| 12 | |
| 13 | source ../../lib/common.sh |
| 14 | source ../../lib/stmmac.sh |
| 15 | |
| 16 | # |
| 17 | # Command line arguments. |
| 18 | # |
| 19 | INTERFACE=$1 |
| 20 | |
| 21 | [ -z $INTERFACE ] && INTERFACE="eth1" |
| 22 | BASETIME=$(date '+%s000000000' -d '60 sec') |
| 23 | |
| 24 | load_kernel_modules |
| 25 | |
| 26 | CYCLETIME_NS="1000000" |
| 27 | napi_defer_hard_irqs "${INTERFACE}" "${CYCLETIME_NS}" |
| 28 | |
| 29 | stmmac_start "${INTERFACE}" |
| 30 | |
| 31 | # |
| 32 | # Tx Assignment with Qbv and full hardware offload: 20% RT, 80% non-RT. |
| 33 | # |
| 34 | # Tx Q 0 - Everything else |
| 35 | # Tx Q 1 - RTC |
| 36 | # |
| 37 | tc qdisc replace dev ${INTERFACE} handle 100 parent root taprio num_tc 2 \ |
| 38 | map 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 \ |
| 39 | queues 1@0 1@1 \ |
| 40 | base-time ${BASETIME} \ |
| 41 | sched-entry S 0x02 200000 \ |
| 42 | sched-entry S 0x01 800000 \ |
| 43 | flags 0x02 |
| 44 | |
| 45 | # |
| 46 | # Rx Queues Assignment. |
| 47 | # |
| 48 | # Rx Q 0 - Everything else |
| 49 | # Rx Q 1 - RTC |
| 50 | # |
| 51 | RXQUEUES=(0 0 0 1 0 0 0 0 0 0) |
| 52 | stmmac_rx_queues_assign "${INTERFACE}" RXQUEUES |
| 53 | |
| 54 | stmmac_end "${INTERFACE}" |
| 55 | |
| 56 | setup_irqs "${INTERFACE}" |
| 57 | |
| 58 | exit 0 |