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

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

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/drivers/net/mlxsw/qos_ets_strict.sh
Extension
.sh
Size
9231 bytes
Lines
325
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

if (ret > 0) { ret } else { 0 }
	"
}

__run_hi_measure_rate()
{
	local what=$1; shift
	local -a uc_rate

	start_traffic $h2.222 192.0.2.65 192.0.2.66 $h3mac
	defer stop_traffic $!

	uc_rate=($(measure_rate $swp2 $h3 rx_octets_prio_2 "$what"))
	check_err $? "Could not get high enough $what ingress rate"

	echo ${uc_rate[@]}
}

run_hi_measure_rate()
{
	in_defer_scope __run_hi_measure_rate "$@"
}

test_ets_strict()
{
	RET=0

	# Run high-prio traffic on its own.
	local -a rate_2
	rate_2=($(run_hi_measure_rate "prio 2"))
	local rate_2_in=${rate_2[0]}
	local rate_2_eg=${rate_2[1]}

	# Start low-prio stream.
	start_traffic $h1.111 192.0.2.33 192.0.2.34 $h3mac
	defer stop_traffic $!

	local -a rate_1
	rate_1=($(measure_rate $swp1 $h3 rx_octets_prio_1 "prio 1"))
	check_err $? "Could not get high enough prio-1 ingress rate"
	local rate_1_in=${rate_1[0]}
	local rate_1_eg=${rate_1[1]}

	# High-prio and low-prio on their own should have about the same
	# throughput.
	local rel21=$(rel $rate_1_eg $rate_2_eg)
	check_err $(bc <<< "$rel21 < 95")
	check_err $(bc <<< "$rel21 > 105")

	# Start the high-prio stream--now both streams run.
	rate_3=($(run_hi_measure_rate "prio 2+1"))
	local rate_3_in=${rate_3[0]}
	local rate_3_eg=${rate_3[1]}

	# High-prio should have about the same throughput whether or not
	# low-prio is in the system.
	local rel32=$(rel $rate_2_eg $rate_3_eg)
	check_err $(bc <<< "$rel32 < 95")

	log_test "strict priority"
	echo "Ingress to switch:"
	echo "  p1 in rate            $(humanize $rate_1_in)"
	echo "  p2 in rate            $(humanize $rate_2_in)"
	echo "  p2 in rate w/ p1      $(humanize $rate_3_in)"
	echo "Egress from switch:"
	echo "  p1 eg rate            $(humanize $rate_1_eg)"
	echo "  p2 eg rate            $(humanize $rate_2_eg) ($rel21% of p1)"
	echo "  p2 eg rate w/ p1      $(humanize $rate_3_eg) ($rel32% of p2)"
}

Annotation

Implementation Notes