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

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

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/drivers/net/mlxsw/rtnetlink.sh
Extension
.sh
Size
27578 bytes
Lines
936
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
#
# Test various interface configuration scenarios. Observe that configurations
# deemed valid by mlxsw succeed, invalid configurations fail and that no traces
# are produced. To prevent the test from passing in case traces are produced,
# the user can set the 'kernel.panic_on_warn' and 'kernel.panic_on_oops'
# sysctls in its environment.

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

ALL_TESTS="
	rif_vrf_set_addr_test
	rif_non_inherit_bridge_addr_test
	vlan_interface_deletion_test
	bridge_deletion_test
	bridge_vlan_flags_test
	vlan_1_test
	duplicate_vlans_test
	vlan_rif_refcount_test
	subport_rif_refcount_test
	subport_rif_lag_join_test
	vlan_dev_deletion_test
	lag_unlink_slaves_test
	lag_dev_deletion_test
	vlan_interface_uppers_test
	bridge_extern_learn_test
	neigh_offload_test
	nexthop_offload_test
	nexthop_obj_invalid_test
	nexthop_obj_offload_test
	nexthop_obj_group_offload_test
	nexthop_obj_bucket_offload_test
	nexthop_obj_blackhole_offload_test
	nexthop_obj_route_offload_test
	bridge_locked_port_test
	devlink_reload_test
"
NUM_NETIFS=2
: ${TIMEOUT:=20000} # ms
source $lib_dir/lib.sh
source $lib_dir/devlink_lib.sh

setup_prepare()
{
	swp1=${NETIFS[p1]}
	swp2=${NETIFS[p2]}

	ip link set dev $swp1 up
	ip link set dev $swp2 up
}

cleanup()
{
	pre_cleanup

	ip link set dev $swp2 down
	ip link set dev $swp1 down
}

rif_vrf_set_addr_test()
{
	# Test that it is possible to set an IP address on a VRF upper despite
	# its random MAC address.
	RET=0

	ip link add name vrf-test type vrf table 10
	ip link set dev $swp1 master vrf-test

	ip -4 address add 192.0.2.1/24 dev vrf-test

Annotation

Implementation Notes