Skip to content

Commit

Permalink
selftests: mlxsw: Add a test case for L3 VNI
Browse files Browse the repository at this point in the history
Previous patch added the ability to offload a VXLAN tunnel used for L3
VNI when it is present in the VLAN-aware bridge before the corresponding
VLAN interface is configured. This patch adds a test case to verify
that.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
idosch authored and davem330 committed Dec 20, 2018
1 parent f40be47 commit 9d15dce
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions tools/testing/selftests/drivers/net/mlxsw/vxlan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1021,6 +1021,65 @@ offload_indication_vlan_aware_join_vxlan_last()
ip link del dev br0
}

offload_indication_vlan_aware_l3vni_test()
{
local zmac=00:00:00:00:00:00

RET=0

sysctl_set net.ipv6.conf.default.disable_ipv6 1
ip link add dev br0 up type bridge mcast_snooping 0 \
vlan_filtering 1 vlan_default_pvid 0
ip link add name vxlan0 up type vxlan id 10 nolearning noudpcsum \
ttl 20 tos inherit local 198.51.100.1 dstport 4789

ip link set dev $swp1 master br0

# The test will use the offload indication on the FDB entry to
# understand if the tunnel is offloaded or not
bridge fdb append $zmac dev vxlan0 self dst 192.0.2.1

ip link set dev vxlan0 master br0
bridge vlan add dev vxlan0 vid 10 pvid untagged

# No local port or router port is member in the VLAN, so tunnel should
# not be offloaded
bridge fdb show brport vxlan0 | grep $zmac | grep self \
| grep -q offload
check_fail $? "vxlan tunnel offloaded when should not"

# Configure a VLAN interface and make sure tunnel is offloaded
ip link add link br0 name br10 up type vlan id 10
sysctl_set net.ipv6.conf.br10.disable_ipv6 0
ip -6 address add 2001:db8:1::1/64 dev br10
bridge fdb show brport vxlan0 | grep $zmac | grep self \
| grep -q offload
check_err $? "vxlan tunnel not offloaded when should"

# Unlink the VXLAN device, make sure tunnel is no longer offloaded,
# then add it back to the bridge and make sure it is offloaded
ip link set dev vxlan0 nomaster
bridge fdb show brport vxlan0 | grep $zmac | grep self \
| grep -q offload
check_fail $? "vxlan tunnel offloaded after unlinked from bridge"

ip link set dev vxlan0 master br0
bridge fdb show brport vxlan0 | grep $zmac | grep self \
| grep -q offload
check_fail $? "vxlan tunnel offloaded despite no matching vid"

bridge vlan add dev vxlan0 vid 10 pvid untagged
bridge fdb show brport vxlan0 | grep $zmac | grep self \
| grep -q offload
check_err $? "vxlan tunnel not offloaded after adding vid"

log_test "vxlan - l3 vni"

ip link del dev vxlan0
ip link del dev br0
sysctl_restore net.ipv6.conf.default.disable_ipv6
}

offload_indication_vlan_aware_test()
{
offload_indication_vlan_aware_setup_create
Expand All @@ -1031,6 +1090,7 @@ offload_indication_vlan_aware_test()
log_info "offload indication - replay & cleanup - vlan aware"
offload_indication_vlan_aware_join_vxlan_first
offload_indication_vlan_aware_join_vxlan_last
offload_indication_vlan_aware_l3vni_test
}

trap cleanup EXIT
Expand Down

0 comments on commit 9d15dce

Please sign in to comment.