1#!/bin/bash 2# SPDX-License-Identifier: GPL-2.0 3 4ALL_TESTS=" 5 ping_ipv4 6 ecn_test 7 ecn_nodrop_test 8 red_test 9 mc_backlog_test 10" 11: ${QDISC:=ets} 12source sch_red_core.sh 13 14# do_ecn_test first build 2/3 of the requested backlog and expects no marking, 15# and then builds 3/2 of it and does expect marking. The values of $BACKLOG1 and 16# $BACKLOG2 are far enough not to overlap, so that we can assume that if we do 17# see (do not see) marking, it is actually due to the configuration of that one 18# TC, and not due to configuration of the other TC leaking over. 19BACKLOG1=200000 20BACKLOG2=500000 21 22install_qdisc() 23{ 24 local -a args=("$@") 25 26 tc qdisc add dev $swp3 root handle 10: $QDISC \ 27 bands 8 priomap 7 6 5 4 3 2 1 0 28 tc qdisc add dev $swp3 parent 10:8 handle 108: red \ 29 limit 1000000 min $BACKLOG1 max $((BACKLOG1 + 1)) \ 30 probability 1.0 avpkt 8000 burst 38 "${args[@]}" 31 tc qdisc add dev $swp3 parent 10:7 handle 107: red \ 32 limit 1000000 min $BACKLOG2 max $((BACKLOG2 + 1)) \ 33 probability 1.0 avpkt 8000 burst 63 "${args[@]}" 34 sleep 1 35} 36 37uninstall_qdisc() 38{ 39 tc qdisc del dev $swp3 parent 10:7 40 tc qdisc del dev $swp3 parent 10:8 41 tc qdisc del dev $swp3 root 42} 43 44ecn_test() 45{ 46 install_qdisc ecn 47 48 do_ecn_test 10 $BACKLOG1 49 do_ecn_test 11 $BACKLOG2 50 51 uninstall_qdisc 52} 53 54ecn_nodrop_test() 55{ 56 install_qdisc ecn nodrop 57 58 do_ecn_nodrop_test 10 $BACKLOG1 59 do_ecn_nodrop_test 11 $BACKLOG2 60 61 uninstall_qdisc 62} 63 64red_test() 65{ 66 install_qdisc 67 68 do_red_test 10 $BACKLOG1 69 do_red_test 11 $BACKLOG2 70 71 uninstall_qdisc 72} 73 74mc_backlog_test() 75{ 76 install_qdisc 77 78 # Note that the backlog numbers here do not correspond to RED 79 # configuration, but are arbitrary. 80 do_mc_backlog_test 10 $BACKLOG1 81 do_mc_backlog_test 11 $BACKLOG2 82 83 uninstall_qdisc 84} 85 86trap cleanup EXIT 87 88setup_prepare 89setup_wait 90 91bail_on_lldpad 92tests_run 93 94exit $EXIT_STATUS 95