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

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

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/drivers/net/mlxsw/qos_mc_aware.sh
Extension
.sh
Size
9664 bytes
Lines
331
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 }
		    ")

	# Minimum shaper of 200Mbps on MC TCs should cause about 20% of
	# degradation on 1Gbps link.
	check_err $(bc <<< "$deg < 15") "Minimum shaper not in effect"
	check_err $(bc <<< "$deg > 25") "MC traffic degrades UC performance too much"

	local interval=$((d1 - d0))
	local mc_ir=$(rate $u0 $u1 $interval)
	local mc_er=$(rate $t0 $t1 $interval)

	log_test "UC performance under MC overload"

	echo "UC-only throughput  $(humanize $ucth1)"
	echo "UC+MC throughput    $(humanize $ucth2)"
	echo "Degradation         $deg %"
	echo
	echo "Full report:"
	echo "  UC only:"
	echo "    ingress UC throughput $(humanize ${uc_rate[0]})"
	echo "    egress UC throughput  $(humanize ${uc_rate[1]})"
	echo "  UC+MC:"
	echo "    ingress UC throughput $(humanize ${uc_rate_2[0]})"
	echo "    egress UC throughput  $(humanize ${uc_rate_2[1]})"
	echo "    ingress MC throughput $(humanize $mc_ir)"
	echo "    egress MC throughput  $(humanize $mc_er)"
	echo
}

test_uc_aware()
{
	RET=0

	start_traffic $h2.111 192.0.2.129 192.0.2.130 $h3mac
	defer stop_traffic $!

	local d0=$(date +%s)
	local t0=$(ethtool_stats_get $h3 rx_octets_prio_1)
	local u0=$(ethtool_stats_get $swp2 rx_octets_prio_1)
	sleep 1

	local attempts=50
	local passes=0
	local i

	for ((i = 0; i < attempts; ++i)); do
		if $ARPING -c 1 -I $h1 -b 192.0.2.66 -q -w 1; then
			((passes++))
		fi

		sleep 0.1
	done

	local d1=$(date +%s)
	local t1=$(ethtool_stats_get $h3 rx_octets_prio_1)
	local u1=$(ethtool_stats_get $swp2 rx_octets_prio_1)

	local interval=$((d1 - d0))
	local uc_ir=$(rate $u0 $u1 $interval)
	local uc_er=$(rate $t0 $t1 $interval)

	((attempts == passes))
	check_err $?

	log_test "MC performance under UC overload"
	echo "    ingress UC throughput $(humanize ${uc_ir})"
	echo "    egress UC throughput  $(humanize ${uc_er})"
	echo "    sent $attempts BC ARPs, got $passes responses"
}

Annotation

Implementation Notes