File Index
Files and directories
Sign in
FILE

sch_red_ets.sh

File preview with syntax highlighting.

linux-6.19.14/tools/testing/selftests/drivers/net/mlxsw/sch_red_ets.sh BASH
  1#!/bin/bash
  2# SPDX-License-Identifier: GPL-2.0
  3
  4ALL_TESTS="
  5	ping_ipv4
  6	ecn_test
  7	ecn_test_perband
  8	ecn_nodrop_test
  9	red_test
 10	mc_backlog_test
 11	red_mirror_test
 12	red_trap_test
 13	ecn_mirror_test
 14"
 15: ${QDISC:=ets}
 16source sch_red_core.sh
 17
 18# do_ecn_test first build 2/3 of the requested backlog and expects no marking,
 19# and then builds 3/2 of it and does expect marking. The values of $BACKLOG1 and
 20# $BACKLOG2 are far enough not to overlap, so that we can assume that if we do
 21# see (do not see) marking, it is actually due to the configuration of that one
 22# TC, and not due to configuration of the other TC leaking over.
 23BACKLOG1=400000
 24BACKLOG2=1000000
 25
 26install_root_qdisc()
 27{
 28	tc qdisc add dev $swp3 parent 1: handle 10: $QDISC \
 29	   bands 8 priomap 7 6 5 4 3 2 1 0
 30}
 31
 32install_qdisc_tc0()
 33{
 34	local -a args=("$@")
 35
 36	tc qdisc add dev $swp3 parent 10:8 handle 108: red \
 37	   limit 1000000 min $BACKLOG1 max $((BACKLOG1 + 1)) \
 38	   probability 1.0 avpkt 8000 burst 51 "${args[@]}"
 39}
 40
 41install_qdisc_tc1()
 42{
 43	local -a args=("$@")
 44
 45	tc qdisc add dev $swp3 parent 10:7 handle 107: red \
 46	   limit 1000000 min $BACKLOG2 max $((BACKLOG2 + 1)) \
 47	   probability 1.0 avpkt 8000 burst 126 "${args[@]}"
 48}
 49
 50install_qdisc()
 51{
 52	install_root_qdisc
 53	install_qdisc_tc0 "$@"
 54	install_qdisc_tc1 "$@"
 55	sleep 1
 56}
 57
 58uninstall_qdisc_tc0()
 59{
 60	tc qdisc del dev $swp3 parent 10:8
 61}
 62
 63uninstall_qdisc_tc1()
 64{
 65	tc qdisc del dev $swp3 parent 10:7
 66}
 67
 68uninstall_root_qdisc()
 69{
 70	tc qdisc del dev $swp3 parent 1:
 71}
 72
 73uninstall_qdisc()
 74{
 75	uninstall_qdisc_tc0
 76	uninstall_qdisc_tc1
 77	uninstall_root_qdisc
 78}
 79
 80ecn_test()
 81{
 82	install_qdisc ecn
 83	defer uninstall_qdisc
 84
 85	do_ecn_test 10 $BACKLOG1
 86	do_ecn_test 11 $BACKLOG2
 87}
 88
 89ecn_test_perband()
 90{
 91	install_qdisc ecn
 92	defer uninstall_qdisc
 93
 94	do_ecn_test_perband 10 $BACKLOG1
 95	do_ecn_test_perband 11 $BACKLOG2
 96}
 97
 98ecn_nodrop_test()
 99{
100	install_qdisc ecn nodrop
101	defer uninstall_qdisc
102
103	do_ecn_nodrop_test 10 $BACKLOG1
104	do_ecn_nodrop_test 11 $BACKLOG2
105}
106
107red_test()
108{
109	install_qdisc
110	defer uninstall_qdisc
111
112	# Make sure that we get the non-zero value if there is any.
113	local cur=$(busywait 1100 until_counter_is "> 0" \
114			    qdisc_stats_get $swp3 10: .backlog)
115	(( cur == 0 ))
116	check_err $? "backlog of $cur observed on non-busy qdisc"
117	log_test "$QDISC backlog properly cleaned"
118
119	do_red_test 10 $BACKLOG1
120	do_red_test 11 $BACKLOG2
121}
122
123mc_backlog_test()
124{
125	install_qdisc
126	defer uninstall_qdisc
127
128	# Note that the backlog numbers here do not correspond to RED
129	# configuration, but are arbitrary.
130	do_mc_backlog_test 10 $BACKLOG1
131	do_mc_backlog_test 11 $BACKLOG2
132}
133
134red_mirror_test()
135{
136	install_qdisc qevent early_drop block 10
137	defer uninstall_qdisc
138
139	do_drop_mirror_test 10 $BACKLOG1 early_drop
140	do_drop_mirror_test 11 $BACKLOG2 early_drop
141}
142
143red_trap_test()
144{
145	install_qdisc qevent early_drop block 10
146	defer uninstall_qdisc
147
148	do_drop_trap_test 10 $BACKLOG1 early_drop
149	do_drop_trap_test 11 $BACKLOG2 early_drop
150}
151
152ecn_mirror_test()
153{
154	install_qdisc ecn qevent mark block 10
155	defer uninstall_qdisc
156
157	do_mark_mirror_test 10 $BACKLOG1
158	do_mark_mirror_test 11 $BACKLOG2
159}
160
161bail_on_lldpad "configure DCB" "configure Qdiscs"
162
163trap cleanup EXIT
164setup_prepare
165setup_wait
166tests_run
167
168exit $EXIT_STATUS
~/ Read-only file preview.