tools/testing/selftests/drivers/net/mlxsw/sch_red_ets.sh

Source file repositories/reference/linux-study-clean/tools/testing/selftests/drivers/net/mlxsw/sch_red_ets.sh

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/drivers/net/mlxsw/sch_red_ets.sh
Extension
.sh
Size
3190 bytes
Lines
169
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: tools
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

#!/bin/bash
# SPDX-License-Identifier: GPL-2.0

ALL_TESTS="
	ping_ipv4
	ecn_test
	ecn_test_perband
	ecn_nodrop_test
	red_test
	mc_backlog_test
	red_mirror_test
	red_trap_test
	ecn_mirror_test
"
: ${QDISC:=ets}
source sch_red_core.sh

# do_ecn_test first build 2/3 of the requested backlog and expects no marking,
# and then builds 3/2 of it and does expect marking. The values of $BACKLOG1 and
# $BACKLOG2 are far enough not to overlap, so that we can assume that if we do
# see (do not see) marking, it is actually due to the configuration of that one
# TC, and not due to configuration of the other TC leaking over.
BACKLOG1=400000
BACKLOG2=1000000

install_root_qdisc()
{
	tc qdisc add dev $swp3 parent 1: handle 10: $QDISC \
	   bands 8 priomap 7 6 5 4 3 2 1 0
}

install_qdisc_tc0()
{
	local -a args=("$@")

	tc qdisc add dev $swp3 parent 10:8 handle 108: red \
	   limit 1000000 min $BACKLOG1 max $((BACKLOG1 + 1)) \
	   probability 1.0 avpkt 8000 burst 51 "${args[@]}"
}

install_qdisc_tc1()
{
	local -a args=("$@")

	tc qdisc add dev $swp3 parent 10:7 handle 107: red \
	   limit 1000000 min $BACKLOG2 max $((BACKLOG2 + 1)) \
	   probability 1.0 avpkt 8000 burst 126 "${args[@]}"
}

install_qdisc()
{
	install_root_qdisc
	install_qdisc_tc0 "$@"
	install_qdisc_tc1 "$@"
	sleep 1
}

uninstall_qdisc_tc0()
{
	tc qdisc del dev $swp3 parent 10:8
}

uninstall_qdisc_tc1()
{
	tc qdisc del dev $swp3 parent 10:7
}

uninstall_root_qdisc()
{
	tc qdisc del dev $swp3 parent 1:

Annotation

Implementation Notes