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

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

File Facts

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

# SPDX-License-Identifier: GPL-2.0

RIF_COUNTER_NUM_NETIFS=2

rif_counter_addr4()
{
	local i=$1; shift
	local p=$1; shift

	printf 192.0.%d.%d $((i / 64)) $(((4 * i % 256) + p))
}

rif_counter_addr4pfx()
{
	rif_counter_addr4 $@
	printf /30
}

rif_counter_h1_create()
{
	simple_if_init $h1
}

rif_counter_h1_destroy()
{
	simple_if_fini $h1
}

rif_counter_h2_create()
{
	simple_if_init $h2
}

rif_counter_h2_destroy()
{
	simple_if_fini $h2
}

rif_counter_setup_prepare()
{
	h1=${NETIFS[p1]}
	h2=${NETIFS[p2]}

	vrf_prepare

	rif_counter_h1_create
	rif_counter_h2_create
}

rif_counter_cleanup()
{
	local count=$1; shift

	pre_cleanup

	for ((i = 1; i <= count; i++)); do
		vlan_destroy $h2 $i
	done

	rif_counter_h2_destroy
	rif_counter_h1_destroy

	vrf_cleanup

	if [[ -v RIF_COUNTER_BATCH_FILE ]]; then
		rm -f $RIF_COUNTER_BATCH_FILE
	fi
}

Annotation

Implementation Notes