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

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

File Facts

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

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

ALL_TESTS="
	create_8021ad_vlan_upper_on_top_front_panel_port
	create_8021ad_vlan_upper_on_top_bridge_port
	create_8021ad_vlan_upper_on_top_lag
	create_8021ad_vlan_upper_on_top_bridge
	create_8021ad_vlan_upper_on_top_8021ad_bridge
	create_vlan_upper_on_top_8021ad_bridge
	create_vlan_upper_on_top_front_panel_enslaved_to_8021ad_bridge
	create_vlan_upper_on_top_lag_enslaved_to_8021ad_bridge
	enslave_front_panel_with_vlan_upper_to_8021ad_bridge
	enslave_lag_with_vlan_upper_to_8021ad_bridge
	add_ip_address_to_8021ad_bridge
	switch_bridge_protocol_from_8021q_to_8021ad
"
NUM_NETIFS=2
source $lib_dir/lib.sh

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

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

	sleep 10
}

cleanup()
{
	pre_cleanup

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

create_vlan_upper_on_top_of_bridge()
{
	RET=0

	local bridge_proto=$1; shift
	local netdev_proto=$1; shift

	ip link add dev br0 type bridge vlan_filtering 1 \
		vlan_protocol $bridge_proto vlan_default_pvid 0 mcast_snooping 0
	ip link set dev br0 addrgenmode none

	ip link set dev br0 up
	ip link set dev $swp1 master br0

	ip link add name br0.100 link br0 type vlan \
		protocol $netdev_proto id 100 2>/dev/null
	check_fail $? "$netdev_proto vlan upper creation on top of an $bridge_proto bridge not rejected"

	ip link add name br0.100 link br0 type vlan \
		protocol $netdev_proto id 100 2>&1 >/dev/null \
		| grep -q mlxsw_spectrum
	check_err $? "$netdev_proto vlan upper creation on top of an $bridge_proto bridge rejected without extack"

	log_test "create $netdev_proto vlan upper on top $bridge_proto bridge"

	ip link del dev br0
}

create_8021ad_vlan_upper_on_top_front_panel_port()

Annotation

Implementation Notes