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