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

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

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/drivers/net/mlxsw/vxlan_flooding.sh
Extension
.sh
Size
8849 bytes
Lines
327
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 VxLAN flooding. The device stores flood records in a singly linked list
# where each record stores up to three IPv4 addresses of remote VTEPs. The test
# verifies that packets are correctly flooded in various cases such as deletion
# of a record in the middle of the list.
#
# +--------------------+
# | H1 (vrf)           |
# |    + $h1           |
# |    | 203.0.113.1/24|
# +----|---------------+
#      |
# +----|----------------------------------------------------------------------+
# | SW |                                                                      |
# | +--|--------------------------------------------------------------------+ |
# | |  + $swp1                   BR0 (802.1d)                               | |
# | |                                                                       | |
# | |  + vxlan0 (vxlan)                                                     | |
# | |    local 198.51.100.1                                                 | |
# | |    remote 198.51.100.{2..13}                                          | |
# | |    id 10 dstport 4789                                                 | |
# | +-----------------------------------------------------------------------+ |
# |                                                                           |
# |  198.51.100.0/24 via 192.0.2.2                                            |
# |                                                                           |
# |    + $rp1                                                                 |
# |    | 192.0.2.1/24                                                         |
# +----|----------------------------------------------------------------------+
#      |
# +----|--------------------------------------------------------+
# |    |                                               R2 (vrf) |
# |    + $rp2                                                   |
# |      192.0.2.2/24                                           |
# |                                                             |
# +-------------------------------------------------------------+

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

ALL_TESTS="flooding_test"
NUM_NETIFS=4
source $lib_dir/tc_common.sh
source $lib_dir/lib.sh

h1_create()
{
	simple_if_init $h1 203.0.113.1/24
}

h1_destroy()
{
	simple_if_fini $h1 203.0.113.1/24
}

switch_create()
{
	# Make sure the bridge uses the MAC address of the local port and
	# not that of the VxLAN's device
	ip link add dev br0 type bridge mcast_snooping 0
	ip link set dev br0 address $(mac_get $swp1)

	ip link add name vxlan0 type vxlan id 10 nolearning noudpcsum \
		ttl 20 tos inherit local 198.51.100.1 dstport 4789

	ip address add 198.51.100.1/32 dev lo

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

Annotation

Implementation Notes