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

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

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/drivers/net/mlxsw/qos_headroom.sh
Extension
.sh
Size
8384 bytes
Lines
380
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="
	test_defaults
	test_dcb_ets
	test_mtu
	test_pfc
	test_int_buf
	test_tc_priomap
	test_tc_mtu
	test_tc_sizes
	test_tc_int_buf
"

lib_dir=$(dirname $0)/../../../net/forwarding

NUM_NETIFS=0
source $lib_dir/lib.sh
source $lib_dir/devlink_lib.sh

swp=$NETIF_NO_CABLE

cleanup()
{
	pre_cleanup
}

get_prio_pg()
{
	# Produces a string of numbers "<B0> <B1> ... <B7> ", where BX is number
	# of buffer that priority X is mapped to.
	dcb -j buffer show dev $swp |
		jq -r '[.prio_buffer | .[] | tostring + " "] | add'
}

get_prio_pfc()
{
	# Produces a string of numbers "<P0> <P1> ... <P7> ", where PX denotes
	# whether priority X has PFC enabled (the value is 1) or disabled (0).
	dcb -j pfc show dev $swp |
		jq -r '[.prio_pfc | .[] | if . then "1 " else "0 " end] | add'
}

get_prio_tc()
{
	# Produces a string of numbers "<T0> <T1> ... <T7> ", where TC is number
	# of TC that priority X is mapped to.
	dcb -j ets show dev $swp |
		jq -r '[.prio_tc | .[] | tostring + " "] | add'
}

get_buf_size()
{
	local idx=$1; shift

	dcb -j buffer show dev $swp | jq ".buffer_size[$idx]"
}

get_tot_size()
{
	dcb -j buffer show dev $swp | jq '.total_size'
}

check_prio_pg()
{
	local expect=$1; shift

	local current=$(get_prio_pg)
	test "$current" = "$expect"

Annotation

Implementation Notes