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

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

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/drivers/net/mlxsw/sch_offload.sh
Extension
.sh
Size
5377 bytes
Lines
291
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
#
# Test qdisc offload indication


ALL_TESTS="
	test_root
	test_port_tbf
	test_etsprio
	test_etsprio_port_tbf
"
NUM_NETIFS=1
lib_dir=$(dirname $0)/../../../net/forwarding
source $lib_dir/lib.sh

check_not_offloaded()
{
	local handle=$1; shift
	local h
	local offloaded

	h=$(qdisc_stats_get $h1 "$handle" .handle)
	[[ $h == '"'$handle'"' ]]
	check_err $? "Qdisc with handle $handle does not exist"

	offloaded=$(qdisc_stats_get $h1 "$handle" .offloaded)
	[[ $offloaded == true ]]
	check_fail $? "Qdisc with handle $handle offloaded, but should not be"
}

check_all_offloaded()
{
	local handle=$1; shift

	if [[ ! -z $handle ]]; then
		local offloaded=$(qdisc_stats_get $h1 "$handle" .offloaded)
		[[ $offloaded == true ]]
		check_err $? "Qdisc with handle $handle not offloaded"
	fi

	local unoffloaded=$(tc q sh dev $h1 invisible |
				grep -v offloaded |
				sed s/root/parent\ root/ |
				cut -d' ' -f 5)
	[[ -z $unoffloaded ]]
	check_err $? "Qdiscs with following parents not offloaded: $unoffloaded"

	pre_cleanup
}

with_ets()
{
	local handle=$1; shift
	local locus=$1; shift

	tc qdisc add dev $h1 $locus handle $handle \
	   ets bands 8 priomap 7 6 5 4 3 2 1 0
	"$@"
	tc qdisc del dev $h1 $locus
}

with_prio()
{
	local handle=$1; shift
	local locus=$1; shift

	tc qdisc add dev $h1 $locus handle $handle \
	   prio bands 8 priomap 7 6 5 4 3 2 1 0
	"$@"

Annotation

Implementation Notes