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"
10source sch_red_core.sh
11
12BACKLOG=300000
13
14install_qdisc()
15{
16	local -a args=("$@")
17
18	tc qdisc add dev $swp3 root handle 108: red \
19	   limit 1000000 min $BACKLOG max $((BACKLOG + 1)) \
20	   probability 1.0 avpkt 8000 burst 38 "${args[@]}"
21	sleep 1
22}
23
24uninstall_qdisc()
25{
26	tc qdisc del dev $swp3 root
27}
28
29ecn_test()
30{
31	install_qdisc ecn
32	do_ecn_test 10 $BACKLOG
33	uninstall_qdisc
34}
35
36red_test()
37{
38	install_qdisc
39	do_red_test 10 $BACKLOG
40	uninstall_qdisc
41}
42
43mc_backlog_test()
44{
45	install_qdisc
46	# Note that the backlog value here does not correspond to RED
47	# configuration, but is arbitrary.
48	do_mc_backlog_test 10 $BACKLOG
49	uninstall_qdisc
50}
51
52trap cleanup EXIT
53
54setup_prepare
55setup_wait
56
57bail_on_lldpad
58tests_run
59
60exit $EXIT_STATUS
61