Commit 0efe9ed9 authored by Petr Machata's avatar Petr Machata Committed by David S. Miller

selftests: mlxsw: vxlan: Test FDB un/marking on VXLAN join/leave

When a VXLAN device is attached to an offloaded bridge, or when a
front-panel port is attached to a bridge that already has a VXLAN
device, mlxsw should offload the existing offloadable FDB entries.
Similarly when VXLAN device is downed, the FDB entries are unoffloaded,
and the marks thus need to be cleared. Similarly when a front-panel port
device is attached to a bridge with a VXLAN device, or when VLAN flags
are tweaked on a VXLAN port attached to a VLAN-aware bridge.

Test that the replaying / clearing logic works by observing transitions
in presence of offload marks under different scenarios.
Signed-off-by: default avatarPetr Machata <petrm@mellanox.com>
Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8a5969d8
...@@ -647,12 +647,159 @@ offload_indication_decap_route_test() ...@@ -647,12 +647,159 @@ offload_indication_decap_route_test()
noudpcsum ttl 20 tos inherit local 198.51.100.1 dstport 4789 noudpcsum ttl 20 tos inherit local 198.51.100.1 dstport 4789
} }
check_fdb_offloaded()
{
local mac=00:11:22:33:44:55
local zmac=00:00:00:00:00:00
bridge fdb show dev vxlan0 | grep $mac | grep self | grep -q offload
check_err $?
bridge fdb show dev vxlan0 | grep $mac | grep master | grep -q offload
check_err $?
bridge fdb show dev vxlan0 | grep $zmac | grep self | grep -q offload
check_err $?
}
check_vxlan_fdb_not_offloaded()
{
local mac=00:11:22:33:44:55
local zmac=00:00:00:00:00:00
bridge fdb show dev vxlan0 | grep $mac | grep -q self
check_err $?
bridge fdb show dev vxlan0 | grep $mac | grep self | grep -q offload
check_fail $?
bridge fdb show dev vxlan0 | grep $zmac | grep -q self
check_err $?
bridge fdb show dev vxlan0 | grep $zmac | grep self | grep -q offload
check_fail $?
}
check_bridge_fdb_not_offloaded()
{
local mac=00:11:22:33:44:55
local zmac=00:00:00:00:00:00
bridge fdb show dev vxlan0 | grep $mac | grep -q master
check_err $?
bridge fdb show dev vxlan0 | grep $mac | grep master | grep -q offload
check_fail $?
}
__offload_indication_join_vxlan_first()
{
local vid=$1; shift
local mac=00:11:22:33:44:55
local zmac=00:00:00:00:00:00
bridge fdb append $zmac dev vxlan0 self dst 198.51.100.2
ip link set dev vxlan0 master br0
bridge fdb add dev vxlan0 $mac self master static dst 198.51.100.2
RET=0
check_vxlan_fdb_not_offloaded
ip link set dev $swp1 master br0
sleep .1
check_fdb_offloaded
log_test "offload indication - attach vxlan first"
RET=0
ip link set dev vxlan0 down
check_vxlan_fdb_not_offloaded
check_bridge_fdb_not_offloaded
log_test "offload indication - set vxlan down"
RET=0
ip link set dev vxlan0 up
sleep .1
check_fdb_offloaded
log_test "offload indication - set vxlan up"
if [[ ! -z $vid ]]; then
RET=0
bridge vlan del dev vxlan0 vid $vid
check_vxlan_fdb_not_offloaded
check_bridge_fdb_not_offloaded
log_test "offload indication - delete VLAN"
RET=0
bridge vlan add dev vxlan0 vid $vid
check_vxlan_fdb_not_offloaded
check_bridge_fdb_not_offloaded
log_test "offload indication - add tagged VLAN"
RET=0
bridge vlan add dev vxlan0 vid $vid pvid untagged
sleep .1
check_fdb_offloaded
log_test "offload indication - add pvid/untagged VLAN"
fi
RET=0
ip link set dev $swp1 nomaster
check_vxlan_fdb_not_offloaded
log_test "offload indication - detach port"
}
offload_indication_join_vxlan_first()
{
ip link add dev br0 up type bridge mcast_snooping 0
ip link add name vxlan0 up type vxlan id 10 nolearning noudpcsum \
ttl 20 tos inherit local 198.51.100.1 dstport 4789
__offload_indication_join_vxlan_first
ip link del dev vxlan0
ip link del dev br0
}
__offload_indication_join_vxlan_last()
{
local zmac=00:00:00:00:00:00
RET=0
bridge fdb append $zmac dev vxlan0 self dst 198.51.100.2
ip link set dev $swp1 master br0
bridge fdb show dev vxlan0 | grep $zmac | grep self | grep -q offload
check_fail $?
ip link set dev vxlan0 master br0
bridge fdb show dev vxlan0 | grep $zmac | grep self | grep -q offload
check_err $?
log_test "offload indication - attach vxlan last"
}
offload_indication_join_vxlan_last()
{
ip link add dev br0 up type bridge mcast_snooping 0
ip link add name vxlan0 up type vxlan id 10 nolearning noudpcsum \
ttl 20 tos inherit local 198.51.100.1 dstport 4789
__offload_indication_join_vxlan_last
ip link del dev vxlan0
ip link del dev br0
}
offload_indication_test() offload_indication_test()
{ {
offload_indication_setup_create offload_indication_setup_create
offload_indication_fdb_test offload_indication_fdb_test
offload_indication_decap_route_test offload_indication_decap_route_test
offload_indication_setup_destroy offload_indication_setup_destroy
log_info "offload indication - replay & cleanup"
offload_indication_join_vxlan_first
offload_indication_join_vxlan_last
} }
sanitization_vlan_aware_test() sanitization_vlan_aware_test()
...@@ -848,12 +995,42 @@ offload_indication_vlan_aware_decap_route_test() ...@@ -848,12 +995,42 @@ offload_indication_vlan_aware_decap_route_test()
log_test "vxlan decap route - vni map/unmap" log_test "vxlan decap route - vni map/unmap"
} }
offload_indication_vlan_aware_join_vxlan_first()
{
ip link add dev br0 up type bridge mcast_snooping 0 \
vlan_filtering 1 vlan_default_pvid 1
ip link add name vxlan0 up type vxlan id 10 nolearning noudpcsum \
ttl 20 tos inherit local 198.51.100.1 dstport 4789
__offload_indication_join_vxlan_first 1
ip link del dev vxlan0
ip link del dev br0
}
offload_indication_vlan_aware_join_vxlan_last()
{
ip link add dev br0 up type bridge mcast_snooping 0 \
vlan_filtering 1 vlan_default_pvid 1
ip link add name vxlan0 up type vxlan id 10 nolearning noudpcsum \
ttl 20 tos inherit local 198.51.100.1 dstport 4789
__offload_indication_join_vxlan_last
ip link del dev vxlan0
ip link del dev br0
}
offload_indication_vlan_aware_test() offload_indication_vlan_aware_test()
{ {
offload_indication_vlan_aware_setup_create offload_indication_vlan_aware_setup_create
offload_indication_vlan_aware_fdb_test offload_indication_vlan_aware_fdb_test
offload_indication_vlan_aware_decap_route_test offload_indication_vlan_aware_decap_route_test
offload_indication_vlan_aware_setup_destroy offload_indication_vlan_aware_setup_destroy
log_info "offload indication - replay & cleanup - vlan aware"
offload_indication_vlan_aware_join_vxlan_first
offload_indication_vlan_aware_join_vxlan_last
} }
trap cleanup EXIT trap cleanup EXIT
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment