Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <petrm@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Petr Machata and committed by
David S. Miller
0efe9ed9 8a5969d8

+177
+177
tools/testing/selftests/drivers/net/mlxsw/vxlan.sh
··· 647 647 noudpcsum ttl 20 tos inherit local 198.51.100.1 dstport 4789 648 648 } 649 649 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 + 650 793 offload_indication_test() 651 794 { 652 795 offload_indication_setup_create 653 796 offload_indication_fdb_test 654 797 offload_indication_decap_route_test 655 798 offload_indication_setup_destroy 799 + 800 + log_info "offload indication - replay & cleanup" 801 + offload_indication_join_vxlan_first 802 + offload_indication_join_vxlan_last 656 803 } 657 804 658 805 sanitization_vlan_aware_test() ··· 995 848 log_test "vxlan decap route - vni map/unmap" 996 849 } 997 850 851 + offload_indication_vlan_aware_join_vxlan_first() 852 + { 853 + ip link add dev br0 up type bridge mcast_snooping 0 \ 854 + vlan_filtering 1 vlan_default_pvid 1 855 + ip link add name vxlan0 up type vxlan id 10 nolearning noudpcsum \ 856 + ttl 20 tos inherit local 198.51.100.1 dstport 4789 857 + 858 + __offload_indication_join_vxlan_first 1 859 + 860 + ip link del dev vxlan0 861 + ip link del dev br0 862 + } 863 + 864 + offload_indication_vlan_aware_join_vxlan_last() 865 + { 866 + ip link add dev br0 up type bridge mcast_snooping 0 \ 867 + vlan_filtering 1 vlan_default_pvid 1 868 + ip link add name vxlan0 up type vxlan id 10 nolearning noudpcsum \ 869 + ttl 20 tos inherit local 198.51.100.1 dstport 4789 870 + 871 + __offload_indication_join_vxlan_last 872 + 873 + ip link del dev vxlan0 874 + ip link del dev br0 875 + } 876 + 998 877 offload_indication_vlan_aware_test() 999 878 { 1000 879 offload_indication_vlan_aware_setup_create 1001 880 offload_indication_vlan_aware_fdb_test 1002 881 offload_indication_vlan_aware_decap_route_test 1003 882 offload_indication_vlan_aware_setup_destroy 883 + 884 + log_info "offload indication - replay & cleanup - vlan aware" 885 + offload_indication_vlan_aware_join_vxlan_first 886 + offload_indication_vlan_aware_join_vxlan_last 1004 887 } 1005 888 1006 889 trap cleanup EXIT