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

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

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/drivers/net/mlxsw/mirror_gre.sh
Extension
.sh
Size
3871 bytes
Lines
203
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 uses standard topology for testing gretap. See
# ../../../net/forwarding/mirror_gre_topo_lib.sh for more details.
#
# Test offloading various features of offloading gretap mirrors specific to
# mlxsw.

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

NUM_NETIFS=6
source $lib_dir/lib.sh
source $lib_dir/mirror_lib.sh
source $lib_dir/mirror_gre_lib.sh
source $lib_dir/mirror_gre_topo_lib.sh

ALL_TESTS="
	test_keyful
	test_soft
	test_tos_fixed
	test_ttl_inherit
"

setup_keyful()
{
	tunnel_create gt6-key ip6gretap 2001:db8:3::1 2001:db8:3::2 \
		      ttl 100 tos inherit allow-localremote \
		      key 1234

	tunnel_create h3-gt6-key ip6gretap 2001:db8:3::2 2001:db8:3::1 \
		      key 1234
	ip link set h3-gt6-key vrf v$h3
	matchall_sink_create h3-gt6-key

	ip address add dev $swp3 2001:db8:3::1/64
	ip address add dev $h3 2001:db8:3::2/64
}

cleanup_keyful()
{
	ip address del dev $h3 2001:db8:3::2/64
	ip address del dev $swp3 2001:db8:3::1/64

	tunnel_destroy h3-gt6-key
	tunnel_destroy gt6-key
}

setup_soft()
{
	# Set up a topology for testing underlay routes that point at an
	# unsupported soft device.

	tunnel_create gt6-soft ip6gretap 2001:db8:4::1 2001:db8:4::2 \
		      ttl 100 tos inherit allow-localremote

	tunnel_create h3-gt6-soft ip6gretap 2001:db8:4::2 2001:db8:4::1
	ip link set h3-gt6-soft vrf v$h3
	matchall_sink_create h3-gt6-soft

	ip link add name v1 type veth peer name v2
	ip link set dev v1 up
	ip address add dev v1 2001:db8:4::1/64

	ip link set dev v2 vrf v$h3
	ip link set dev v2 up
	ip address add dev v2 2001:db8:4::2/64
}

cleanup_soft()

Annotation

Implementation Notes