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