Skip to content

Commit 0efe9ed

Browse files
pmachatadavem330
authored andcommitted
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: Petr Machata <[email protected]> Signed-off-by: Ido Schimmel <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 8a5969d commit 0efe9ed

File tree

1 file changed

+177
-0
lines changed
  • tools/testing/selftests/drivers/net/mlxsw

1 file changed

+177
-0
lines changed

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

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,12 +647,159 @@ offload_indication_decap_route_test()
647647
noudpcsum ttl 20 tos inherit local 198.51.100.1 dstport 4789
648648
}
649649

650+
check_fdb_offloaded()
651+
{
652+
local mac=00:11:22:33:44:55
653+
local zmac=00:00:00:00:00:00
654+
655+
bridge fdb show dev vxlan0 | grep $mac | grep self | grep -q offload
656+
check_err $?
657+
bridge fdb show dev vxlan0 | grep $mac | grep master | grep -q offload
658+
check_err $?
659+
660+
bridge fdb show dev vxlan0 | grep $zmac | grep self | grep -q offload
661+
check_err $?
662+
}
663+
664+
check_vxlan_fdb_not_offloaded()
665+
{
666+
local mac=00:11:22:33:44:55
667+
local zmac=00:00:00:00:00:00
668+
669+
bridge fdb show dev vxlan0 | grep $mac | grep -q self
670+
check_err $?
671+
bridge fdb show dev vxlan0 | grep $mac | grep self | grep -q offload
672+
check_fail $?
673+
674+
bridge fdb show dev vxlan0 | grep $zmac | grep -q self
675+
check_err $?
676+
bridge fdb show dev vxlan0 | grep $zmac | grep self | grep -q offload
677+
check_fail $?
678+
}
679+
680+
check_bridge_fdb_not_offloaded()
681+
{
682+
local mac=00:11:22:33:44:55
683+
local zmac=00:00:00:00:00:00
684+
685+
bridge fdb show dev vxlan0 | grep $mac | grep -q master
686+
check_err $?
687+
bridge fdb show dev vxlan0 | grep $mac | grep master | grep -q offload
688+
check_fail $?
689+
}
690+
691+
__offload_indication_join_vxlan_first()
692+
{
693+
local vid=$1; shift
694+
695+
local mac=00:11:22:33:44:55
696+
local zmac=00:00:00:00:00:00
697+
698+
bridge fdb append $zmac dev vxlan0 self dst 198.51.100.2
699+
700+
ip link set dev vxlan0 master br0
701+
bridge fdb add dev vxlan0 $mac self master static dst 198.51.100.2
702+
703+
RET=0
704+
check_vxlan_fdb_not_offloaded
705+
ip link set dev $swp1 master br0
706+
sleep .1
707+
check_fdb_offloaded
708+
log_test "offload indication - attach vxlan first"
709+
710+
RET=0
711+
ip link set dev vxlan0 down
712+
check_vxlan_fdb_not_offloaded
713+
check_bridge_fdb_not_offloaded
714+
log_test "offload indication - set vxlan down"
715+
716+
RET=0
717+
ip link set dev vxlan0 up
718+
sleep .1
719+
check_fdb_offloaded
720+
log_test "offload indication - set vxlan up"
721+
722+
if [[ ! -z $vid ]]; then
723+
RET=0
724+
bridge vlan del dev vxlan0 vid $vid
725+
check_vxlan_fdb_not_offloaded
726+
check_bridge_fdb_not_offloaded
727+
log_test "offload indication - delete VLAN"
728+
729+
RET=0
730+
bridge vlan add dev vxlan0 vid $vid
731+
check_vxlan_fdb_not_offloaded
732+
check_bridge_fdb_not_offloaded
733+
log_test "offload indication - add tagged VLAN"
734+
735+
RET=0
736+
bridge vlan add dev vxlan0 vid $vid pvid untagged
737+
sleep .1
738+
check_fdb_offloaded
739+
log_test "offload indication - add pvid/untagged VLAN"
740+
fi
741+
742+
RET=0
743+
ip link set dev $swp1 nomaster
744+
check_vxlan_fdb_not_offloaded
745+
log_test "offload indication - detach port"
746+
}
747+
748+
offload_indication_join_vxlan_first()
749+
{
750+
ip link add dev br0 up type bridge mcast_snooping 0
751+
ip link add name vxlan0 up type vxlan id 10 nolearning noudpcsum \
752+
ttl 20 tos inherit local 198.51.100.1 dstport 4789
753+
754+
__offload_indication_join_vxlan_first
755+
756+
ip link del dev vxlan0
757+
ip link del dev br0
758+
}
759+
760+
__offload_indication_join_vxlan_last()
761+
{
762+
local zmac=00:00:00:00:00:00
763+
764+
RET=0
765+
766+
bridge fdb append $zmac dev vxlan0 self dst 198.51.100.2
767+
768+
ip link set dev $swp1 master br0
769+
770+
bridge fdb show dev vxlan0 | grep $zmac | grep self | grep -q offload
771+
check_fail $?
772+
773+
ip link set dev vxlan0 master br0
774+
775+
bridge fdb show dev vxlan0 | grep $zmac | grep self | grep -q offload
776+
check_err $?
777+
778+
log_test "offload indication - attach vxlan last"
779+
}
780+
781+
offload_indication_join_vxlan_last()
782+
{
783+
ip link add dev br0 up type bridge mcast_snooping 0
784+
ip link add name vxlan0 up type vxlan id 10 nolearning noudpcsum \
785+
ttl 20 tos inherit local 198.51.100.1 dstport 4789
786+
787+
__offload_indication_join_vxlan_last
788+
789+
ip link del dev vxlan0
790+
ip link del dev br0
791+
}
792+
650793
offload_indication_test()
651794
{
652795
offload_indication_setup_create
653796
offload_indication_fdb_test
654797
offload_indication_decap_route_test
655798
offload_indication_setup_destroy
799+
800+
log_info "offload indication - replay & cleanup"
801+
offload_indication_join_vxlan_first
802+
offload_indication_join_vxlan_last
656803
}
657804

658805
sanitization_vlan_aware_test()
@@ -848,12 +995,42 @@ offload_indication_vlan_aware_decap_route_test()
848995
log_test "vxlan decap route - vni map/unmap"
849996
}
850997

998+
offload_indication_vlan_aware_join_vxlan_first()
999+
{
1000+
ip link add dev br0 up type bridge mcast_snooping 0 \
1001+
vlan_filtering 1 vlan_default_pvid 1
1002+
ip link add name vxlan0 up type vxlan id 10 nolearning noudpcsum \
1003+
ttl 20 tos inherit local 198.51.100.1 dstport 4789
1004+
1005+
__offload_indication_join_vxlan_first 1
1006+
1007+
ip link del dev vxlan0
1008+
ip link del dev br0
1009+
}
1010+
1011+
offload_indication_vlan_aware_join_vxlan_last()
1012+
{
1013+
ip link add dev br0 up type bridge mcast_snooping 0 \
1014+
vlan_filtering 1 vlan_default_pvid 1
1015+
ip link add name vxlan0 up type vxlan id 10 nolearning noudpcsum \
1016+
ttl 20 tos inherit local 198.51.100.1 dstport 4789
1017+
1018+
__offload_indication_join_vxlan_last
1019+
1020+
ip link del dev vxlan0
1021+
ip link del dev br0
1022+
}
1023+
8511024
offload_indication_vlan_aware_test()
8521025
{
8531026
offload_indication_vlan_aware_setup_create
8541027
offload_indication_vlan_aware_fdb_test
8551028
offload_indication_vlan_aware_decap_route_test
8561029
offload_indication_vlan_aware_setup_destroy
1030+
1031+
log_info "offload indication - replay & cleanup - vlan aware"
1032+
offload_indication_vlan_aware_join_vxlan_first
1033+
offload_indication_vlan_aware_join_vxlan_last
8571034
}
8581035

8591036
trap cleanup EXIT

0 commit comments

Comments
 (0)