tools/testing/selftests/drivers/net/netdevsim/nexthop.sh

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

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/drivers/net/netdevsim/nexthop.sh
Extension
.sh
Size
27013 bytes
Lines
1059
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
#
# This test is for checking the nexthop offload API. It makes use of netdevsim
# which registers a listener to the nexthop notification chain.

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

ALL_TESTS="
	nexthop_single_add_test
	nexthop_single_add_err_test
	nexthop_group_add_test
	nexthop_group_add_err_test
	nexthop_res_group_add_test
	nexthop_res_group_add_err_test
	nexthop_group_replace_test
	nexthop_group_replace_err_test
	nexthop_res_group_replace_test
	nexthop_res_group_replace_err_test
	nexthop_res_group_idle_timer_test
	nexthop_res_group_idle_timer_del_test
	nexthop_res_group_increase_idle_timer_test
	nexthop_res_group_decrease_idle_timer_test
	nexthop_res_group_unbalanced_timer_test
	nexthop_res_group_unbalanced_timer_del_test
	nexthop_res_group_no_unbalanced_timer_test
	nexthop_res_group_short_unbalanced_timer_test
	nexthop_res_group_increase_unbalanced_timer_test
	nexthop_res_group_decrease_unbalanced_timer_test
	nexthop_res_group_force_migrate_busy_test
	nexthop_single_replace_test
	nexthop_single_replace_err_test
	nexthop_single_in_group_replace_test
	nexthop_single_in_group_replace_err_test
	nexthop_single_in_res_group_replace_test
	nexthop_single_in_res_group_replace_err_test
	nexthop_single_in_group_delete_test
	nexthop_single_in_group_delete_err_test
	nexthop_single_in_res_group_delete_test
	nexthop_single_in_res_group_delete_err_test
	nexthop_replay_test
	nexthop_replay_err_test
"
NETDEVSIM_PATH=/sys/bus/netdevsim/
DEV_ADDR=1337
DEV=netdevsim${DEV_ADDR}
SYSFS_NET_DIR=/sys/bus/netdevsim/devices/$DEV/net/
DEBUGFS_NET_DIR=/sys/kernel/debug/netdevsim/$DEV/
NUM_NETIFS=0
source $lib_dir/lib.sh

DEVLINK_DEV=
source $lib_dir/devlink_lib.sh
DEVLINK_DEV=netdevsim/${DEV}

nexthop_check()
{
	local nharg="$1"; shift
	local expected="$1"; shift

	out=$($IP nexthop show ${nharg} | sed -e 's/ *$//')
	if [[ "$out" != "$expected" ]]; then
		return 1
	fi

	return 0
}

nexthop_bucket_nhid_count_check()
{

Annotation

Implementation Notes