2 # SPDX-License-Identifier: GPL-2.0
4 # Test various aspects of VxLAN offloading which are specific to mlxsw, such
5 # as sanitization of invalid configurations and offload indication.
7 lib_dir
=$
(dirname $0)/..
/..
/..
/net
/forwarding
9 ALL_TESTS
="sanitization_test offload_indication_test \
10 sanitization_vlan_aware_test offload_indication_vlan_aware_test"
12 source $lib_dir/lib.sh
19 ip link
set dev
$swp1 up
20 ip link
set dev
$swp2 up
27 ip link
set dev
$swp2 down
28 ip link
set dev
$swp1 down
31 sanitization_single_dev_test_pass
()
33 ip link
set dev
$swp1 master br0
35 ip link
set dev vxlan0 master br0
38 ip link
set dev
$swp1 nomaster
40 ip link
set dev
$swp1 master br0
44 sanitization_single_dev_test_fail
()
46 ip link
set dev
$swp1 master br0
48 ip link
set dev vxlan0 master br0
&> /dev
/null
51 ip link
set dev
$swp1 nomaster
53 ip link
set dev vxlan0 master br0
55 ip link
set dev
$swp1 master br0
&> /dev
/null
59 sanitization_single_dev_valid_test
()
63 ip link add dev br0
type bridge mcast_snooping
0
65 ip link add name vxlan0 up
type vxlan id
10 nolearning noudpcsum \
66 ttl
20 tos inherit
local 198.51.100.1 dstport
4789
68 sanitization_single_dev_test_pass
70 ip link del dev vxlan0
73 log_test
"vxlan device - valid configuration"
76 sanitization_single_dev_vlan_aware_test
()
80 ip link add dev br0
type bridge mcast_snooping
0 vlan_filtering
1
82 ip link add name vxlan0 up
type vxlan id
10 nolearning noudpcsum \
83 ttl
20 tos inherit
local 198.51.100.1 dstport
4789
85 sanitization_single_dev_test_pass
87 ip link del dev vxlan0
90 log_test
"vxlan device with a vlan-aware bridge"
93 sanitization_single_dev_mcast_enabled_test
()
97 ip link add dev br0
type bridge
99 ip link add name vxlan0 up
type vxlan id
10 nolearning noudpcsum \
100 ttl
20 tos inherit
local 198.51.100.1 dstport
4789
102 sanitization_single_dev_test_fail
104 ip link del dev vxlan0
107 log_test
"vxlan device with a multicast enabled bridge"
110 sanitization_single_dev_mcast_group_test
()
114 ip link add dev br0
type bridge mcast_snooping
0
116 ip link add name vxlan0 up
type vxlan id
10 nolearning noudpcsum \
117 ttl
20 tos inherit
local 198.51.100.1 dstport
4789 \
118 dev
$swp2 group
239.0.0.1
120 sanitization_single_dev_test_fail
122 ip link del dev vxlan0
125 log_test
"vxlan device with a multicast group"
128 sanitization_single_dev_no_local_ip_test
()
132 ip link add dev br0
type bridge mcast_snooping
0
134 ip link add name vxlan0 up
type vxlan id
10 nolearning noudpcsum \
135 ttl
20 tos inherit dstport
4789
137 sanitization_single_dev_test_fail
139 ip link del dev vxlan0
142 log_test
"vxlan device with no local ip"
145 sanitization_single_dev_local_ipv6_test
()
149 ip link add dev br0
type bridge mcast_snooping
0
151 ip link add name vxlan0 up
type vxlan id
10 nolearning noudpcsum \
152 ttl
20 tos inherit
local 2001:db8
::1 dstport
4789
154 sanitization_single_dev_test_fail
156 ip link del dev vxlan0
159 log_test
"vxlan device with local ipv6 address"
162 sanitization_single_dev_learning_enabled_test
()
166 ip link add dev br0
type bridge mcast_snooping
0
168 ip link add name vxlan0 up
type vxlan id
10 learning noudpcsum \
169 ttl
20 tos inherit
local 198.51.100.1 dstport
4789
171 sanitization_single_dev_test_pass
173 ip link del dev vxlan0
176 log_test
"vxlan device with learning enabled"
179 sanitization_single_dev_local_interface_test
()
183 ip link add dev br0
type bridge mcast_snooping
0
185 ip link add name vxlan0 up
type vxlan id
10 nolearning noudpcsum \
186 ttl
20 tos inherit
local 198.51.100.1 dstport
4789 dev
$swp2
188 sanitization_single_dev_test_fail
190 ip link del dev vxlan0
193 log_test
"vxlan device with local interface"
196 sanitization_single_dev_port_range_test
()
200 ip link add dev br0
type bridge mcast_snooping
0
202 ip link add name vxlan0 up
type vxlan id
10 nolearning noudpcsum \
203 ttl
20 tos inherit
local 198.51.100.1 dstport
4789 \
206 sanitization_single_dev_test_fail
208 ip link del dev vxlan0
211 log_test
"vxlan device with udp source port range"
214 sanitization_single_dev_tos_static_test
()
218 ip link add dev br0
type bridge mcast_snooping
0
220 ip link add name vxlan0 up
type vxlan id
10 nolearning noudpcsum \
221 ttl
20 tos
20 local 198.51.100.1 dstport
4789
223 sanitization_single_dev_test_fail
225 ip link del dev vxlan0
228 log_test
"vxlan device with static tos"
231 sanitization_single_dev_ttl_inherit_test
()
235 ip link add dev br0
type bridge mcast_snooping
0
237 ip link add name vxlan0 up
type vxlan id
10 nolearning noudpcsum \
238 ttl inherit tos inherit
local 198.51.100.1 dstport
4789
240 sanitization_single_dev_test_fail
242 ip link del dev vxlan0
245 log_test
"vxlan device with inherit ttl"
248 sanitization_single_dev_udp_checksum_test
()
252 ip link add dev br0
type bridge mcast_snooping
0
254 ip link add name vxlan0 up
type vxlan id
10 nolearning udpcsum \
255 ttl
20 tos inherit
local 198.51.100.1 dstport
4789
257 sanitization_single_dev_test_fail
259 ip link del dev vxlan0
262 log_test
"vxlan device with udp checksum"
265 sanitization_single_dev_test
()
267 # These tests make sure that we correctly sanitize VxLAN device
268 # configurations we do not support
269 sanitization_single_dev_valid_test
270 sanitization_single_dev_vlan_aware_test
271 sanitization_single_dev_mcast_enabled_test
272 sanitization_single_dev_mcast_group_test
273 sanitization_single_dev_no_local_ip_test
274 sanitization_single_dev_local_ipv6_test
275 sanitization_single_dev_learning_enabled_test
276 sanitization_single_dev_local_interface_test
277 sanitization_single_dev_port_range_test
278 sanitization_single_dev_tos_static_test
279 sanitization_single_dev_ttl_inherit_test
280 sanitization_single_dev_udp_checksum_test
283 sanitization_multi_devs_test_pass
()
285 ip link
set dev
$swp1 master br0
287 ip link
set dev vxlan0 master br0
289 ip link
set dev
$swp2 master br1
291 ip link
set dev vxlan1 master br1
294 ip link
set dev
$swp2 nomaster
295 ip link
set dev
$swp1 nomaster
297 ip link
set dev
$swp1 master br0
299 ip link
set dev
$swp2 master br1
303 sanitization_multi_devs_test_fail
()
305 ip link
set dev
$swp1 master br0
307 ip link
set dev vxlan0 master br0
309 ip link
set dev
$swp2 master br1
311 ip link
set dev vxlan1 master br1
&> /dev
/null
314 ip link
set dev
$swp2 nomaster
315 ip link
set dev
$swp1 nomaster
317 ip link
set dev vxlan1 master br1
319 ip link
set dev
$swp1 master br0
321 ip link
set dev
$swp2 master br1
&> /dev
/null
325 sanitization_multi_devs_valid_test
()
329 ip link add dev br0
type bridge mcast_snooping
0
330 ip link add dev br1
type bridge mcast_snooping
0
332 ip link add name vxlan0 up
type vxlan id
10 nolearning noudpcsum \
333 ttl
20 tos inherit
local 198.51.100.1 dstport
4789
334 ip link add name vxlan1 up
type vxlan id
20 nolearning noudpcsum \
335 ttl
20 tos inherit
local 198.51.100.1 dstport
4789
337 sanitization_multi_devs_test_pass
339 ip link del dev vxlan1
340 ip link del dev vxlan0
344 log_test
"multiple vxlan devices - valid configuration"
347 sanitization_multi_devs_ttl_test
()
351 ip link add dev br0
type bridge mcast_snooping
0
352 ip link add dev br1
type bridge mcast_snooping
0
354 ip link add name vxlan0 up
type vxlan id
10 nolearning noudpcsum \
355 ttl
20 tos inherit
local 198.51.100.1 dstport
4789
356 ip link add name vxlan1 up
type vxlan id
20 nolearning noudpcsum \
357 ttl
40 tos inherit
local 198.51.100.1 dstport
4789
359 sanitization_multi_devs_test_fail
361 ip link del dev vxlan1
362 ip link del dev vxlan0
366 log_test
"multiple vxlan devices with different ttl"
369 sanitization_multi_devs_udp_dstport_test
()
373 ip link add dev br0
type bridge mcast_snooping
0
374 ip link add dev br1
type bridge mcast_snooping
0
376 ip link add name vxlan0 up
type vxlan id
10 nolearning noudpcsum \
377 ttl
20 tos inherit
local 198.51.100.1 dstport
4789
378 ip link add name vxlan1 up
type vxlan id
20 nolearning noudpcsum \
379 ttl
20 tos inherit
local 198.51.100.1 dstport
5789
381 sanitization_multi_devs_test_fail
383 ip link del dev vxlan1
384 ip link del dev vxlan0
388 log_test
"multiple vxlan devices with different udp destination port"
391 sanitization_multi_devs_local_ip_test
()
395 ip link add dev br0
type bridge mcast_snooping
0
396 ip link add dev br1
type bridge mcast_snooping
0
398 ip link add name vxlan0 up
type vxlan id
10 nolearning noudpcsum \
399 ttl
20 tos inherit
local 198.51.100.1 dstport
4789
400 ip link add name vxlan1 up
type vxlan id
20 nolearning noudpcsum \
401 ttl
20 tos inherit
local 198.51.100.2 dstport
4789
403 sanitization_multi_devs_test_fail
405 ip link del dev vxlan1
406 ip link del dev vxlan0
410 log_test
"multiple vxlan devices with different local ip"
413 sanitization_multi_devs_test
()
415 # The device has a single VTEP, which means all the VxLAN devices
416 # we offload must share certain properties such as source IP and
417 # UDP destination port. These tests make sure that we forbid
418 # configurations that violate this limitation
419 sanitization_multi_devs_valid_test
420 sanitization_multi_devs_ttl_test
421 sanitization_multi_devs_udp_dstport_test
422 sanitization_multi_devs_local_ip_test
427 sanitization_single_dev_test
428 sanitization_multi_devs_test
431 offload_indication_setup_create
()
433 # Create a simple setup with two bridges, each with a VxLAN device
435 ip link add name br0 up
type bridge mcast_snooping
0
436 ip link add name br1 up
type bridge mcast_snooping
0
438 ip link
set dev
$swp1 master br0
439 ip link
set dev
$swp2 master br1
441 ip address add
198.51.100.1/32 dev lo
443 ip link add name vxlan0 up master br0
type vxlan id
10 nolearning \
444 noudpcsum ttl
20 tos inherit
local 198.51.100.1 dstport
4789
445 ip link add name vxlan1 up master br1
type vxlan id
20 nolearning \
446 noudpcsum ttl
20 tos inherit
local 198.51.100.1 dstport
4789
449 offload_indication_setup_destroy
()
451 ip link del dev vxlan1
452 ip link del dev vxlan0
454 ip address del
198.51.100.1/32 dev lo
456 ip link
set dev
$swp2 nomaster
457 ip link
set dev
$swp1 nomaster
463 offload_indication_fdb_flood_test
()
467 bridge fdb append
00:00:00:00:00:00 dev vxlan0 self dst
198.51.100.2
469 bridge fdb show brport vxlan0 |
grep 00:00:00:00:00:00 \
473 bridge fdb del
00:00:00:00:00:00 dev vxlan0 self
475 log_test
"vxlan flood entry offload indication"
478 offload_indication_fdb_bridge_test
()
482 bridge fdb add de
:ad
:be
:ef
:13:37 dev vxlan0 self master static \
485 bridge fdb show brport vxlan0 |
grep de
:ad
:be
:ef
:13:37 |
grep self \
488 bridge fdb show brport vxlan0 |
grep de
:ad
:be
:ef
:13:37 |
grep -v self \
492 log_test
"vxlan entry offload indication - initial state"
494 # Remove FDB entry from the bridge driver and check that corresponding
495 # entry in the VxLAN driver is not marked as offloaded
498 bridge fdb del de
:ad
:be
:ef
:13:37 dev vxlan0 master
499 bridge fdb show brport vxlan0 |
grep de
:ad
:be
:ef
:13:37 |
grep self \
503 log_test
"vxlan entry offload indication - after removal from bridge"
505 # Add the FDB entry back to the bridge driver and make sure it is
506 # marked as offloaded in both drivers
509 bridge fdb add de
:ad
:be
:ef
:13:37 dev vxlan0 master static
510 bridge fdb show brport vxlan0 |
grep de
:ad
:be
:ef
:13:37 |
grep self \
513 bridge fdb show brport vxlan0 |
grep de
:ad
:be
:ef
:13:37 |
grep -v self \
517 log_test
"vxlan entry offload indication - after re-add to bridge"
519 # Remove FDB entry from the VxLAN driver and check that corresponding
520 # entry in the bridge driver is not marked as offloaded
523 bridge fdb del de
:ad
:be
:ef
:13:37 dev vxlan0 self
524 bridge fdb show brport vxlan0 |
grep de
:ad
:be
:ef
:13:37 |
grep -v self \
528 log_test
"vxlan entry offload indication - after removal from vxlan"
530 # Add the FDB entry back to the VxLAN driver and make sure it is
531 # marked as offloaded in both drivers
534 bridge fdb add de
:ad
:be
:ef
:13:37 dev vxlan0 self dst
198.51.100.2
535 bridge fdb show brport vxlan0 |
grep de
:ad
:be
:ef
:13:37 |
grep self \
538 bridge fdb show brport vxlan0 |
grep de
:ad
:be
:ef
:13:37 |
grep -v self \
542 log_test
"vxlan entry offload indication - after re-add to vxlan"
544 bridge fdb del de
:ad
:be
:ef
:13:37 dev vxlan0 self master
547 offload_indication_fdb_test
()
549 offload_indication_fdb_flood_test
550 offload_indication_fdb_bridge_test
553 offload_indication_decap_route_test
()
557 ip route show table
local |
grep 198.51.100.1 |
grep -q offload
560 ip link
set dev vxlan0 down
561 ip route show table
local |
grep 198.51.100.1 |
grep -q offload
564 ip link
set dev vxlan1 down
565 ip route show table
local |
grep 198.51.100.1 |
grep -q offload
568 log_test
"vxlan decap route - vxlan device down"
572 ip link
set dev vxlan1 up
573 ip route show table
local |
grep 198.51.100.1 |
grep -q offload
576 ip link
set dev vxlan0 up
577 ip route show table
local |
grep 198.51.100.1 |
grep -q offload
580 log_test
"vxlan decap route - vxlan device up"
584 ip address delete
198.51.100.1/32 dev lo
585 ip route show table
local |
grep 198.51.100.1 |
grep -q offload
588 ip address add
198.51.100.1/32 dev lo
589 ip route show table
local |
grep 198.51.100.1 |
grep -q offload
592 log_test
"vxlan decap route - add local route"
596 ip link
set dev
$swp1 nomaster
597 ip route show table
local |
grep 198.51.100.1 |
grep -q offload
600 ip link
set dev
$swp2 nomaster
601 ip route show table
local |
grep 198.51.100.1 |
grep -q offload
604 ip link
set dev
$swp1 master br0
605 ip link
set dev
$swp2 master br1
606 ip route show table
local |
grep 198.51.100.1 |
grep -q offload
609 log_test
"vxlan decap route - local ports enslavement"
614 ip route show table
local |
grep 198.51.100.1 |
grep -q offload
618 ip route show table
local |
grep 198.51.100.1 |
grep -q offload
621 log_test
"vxlan decap route - bridge device deletion"
625 ip link add name br0 up
type bridge mcast_snooping
0
626 ip link add name br1 up
type bridge mcast_snooping
0
627 ip link
set dev
$swp1 master br0
628 ip link
set dev
$swp2 master br1
629 ip link
set dev vxlan0 master br0
630 ip link
set dev vxlan1 master br1
631 ip route show table
local |
grep 198.51.100.1 |
grep -q offload
634 ip link del dev vxlan0
635 ip route show table
local |
grep 198.51.100.1 |
grep -q offload
638 ip link del dev vxlan1
639 ip route show table
local |
grep 198.51.100.1 |
grep -q offload
642 log_test
"vxlan decap route - vxlan device deletion"
644 ip link add name vxlan0 up master br0
type vxlan id
10 nolearning \
645 noudpcsum ttl
20 tos inherit
local 198.51.100.1 dstport
4789
646 ip link add name vxlan1 up master br1
type vxlan id
20 nolearning \
647 noudpcsum ttl
20 tos inherit
local 198.51.100.1 dstport
4789
650 check_fdb_offloaded
()
652 local mac
=00:11:22:33:44:55
653 local zmac
=00:00:00:00:00:00
655 bridge fdb show dev vxlan0 |
grep $mac |
grep self |
grep -q offload
657 bridge fdb show dev vxlan0 |
grep $mac |
grep master |
grep -q offload
660 bridge fdb show dev vxlan0 |
grep $zmac |
grep self |
grep -q offload
664 check_vxlan_fdb_not_offloaded
()
666 local mac
=00:11:22:33:44:55
667 local zmac
=00:00:00:00:00:00
669 bridge fdb show dev vxlan0 |
grep $mac |
grep -q self
671 bridge fdb show dev vxlan0 |
grep $mac |
grep self |
grep -q offload
674 bridge fdb show dev vxlan0 |
grep $zmac |
grep -q self
676 bridge fdb show dev vxlan0 |
grep $zmac |
grep self |
grep -q offload
680 check_bridge_fdb_not_offloaded
()
682 local mac
=00:11:22:33:44:55
683 local zmac
=00:00:00:00:00:00
685 bridge fdb show dev vxlan0 |
grep $mac |
grep -q master
687 bridge fdb show dev vxlan0 |
grep $mac |
grep master |
grep -q offload
691 __offload_indication_join_vxlan_first
()
695 local mac
=00:11:22:33:44:55
696 local zmac
=00:00:00:00:00:00
698 bridge fdb append
$zmac dev vxlan0 self dst
198.51.100.2
700 ip link
set dev vxlan0 master br0
701 bridge fdb add dev vxlan0
$mac self master static dst
198.51.100.2
704 check_vxlan_fdb_not_offloaded
705 ip link
set dev
$swp1 master br0
708 log_test
"offload indication - attach vxlan first"
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"
717 ip link
set dev vxlan0 up
720 log_test
"offload indication - set vxlan up"
722 if [[ ! -z $vid ]]; then
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"
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"
736 bridge vlan add dev vxlan0 vid
$vid pvid untagged
739 log_test
"offload indication - add pvid/untagged VLAN"
743 ip link
set dev
$swp1 nomaster
744 check_vxlan_fdb_not_offloaded
745 log_test
"offload indication - detach port"
748 offload_indication_join_vxlan_first
()
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
754 __offload_indication_join_vxlan_first
756 ip link del dev vxlan0
760 __offload_indication_join_vxlan_last
()
762 local zmac
=00:00:00:00:00:00
766 bridge fdb append
$zmac dev vxlan0 self dst
198.51.100.2
768 ip link
set dev
$swp1 master br0
770 bridge fdb show dev vxlan0 |
grep $zmac |
grep self |
grep -q offload
773 ip link
set dev vxlan0 master br0
775 bridge fdb show dev vxlan0 |
grep $zmac |
grep self |
grep -q offload
778 log_test
"offload indication - attach vxlan last"
781 offload_indication_join_vxlan_last
()
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
787 __offload_indication_join_vxlan_last
789 ip link del dev vxlan0
793 offload_indication_test
()
795 offload_indication_setup_create
796 offload_indication_fdb_test
797 offload_indication_decap_route_test
798 offload_indication_setup_destroy
800 log_info
"offload indication - replay & cleanup"
801 offload_indication_join_vxlan_first
802 offload_indication_join_vxlan_last
805 sanitization_vlan_aware_test
()
809 ip link add dev br0
type bridge mcast_snooping
0 vlan_filtering
1
811 ip link add name vxlan10 up master br0
type vxlan id
10 nolearning \
812 noudpcsum ttl
20 tos inherit
local 198.51.100.1 dstport
4789
814 ip link add name vxlan20 up master br0
type vxlan id
20 nolearning \
815 noudpcsum ttl
20 tos inherit
local 198.51.100.1 dstport
4789
817 # Test that when each VNI is mapped to a different VLAN we can enslave
818 # a port to the bridge
819 bridge vlan add vid
10 dev vxlan10 pvid untagged
820 bridge vlan add vid
20 dev vxlan20 pvid untagged
822 ip link
set dev
$swp1 master br0
825 log_test
"vlan-aware - enslavement to vlan-aware bridge"
827 # Try to map both VNIs to the same VLAN and make sure configuration
831 bridge vlan add vid
10 dev vxlan20 pvid untagged
&> /dev
/null
834 log_test
"vlan-aware - two vnis mapped to the same vlan"
836 # Test that enslavement of a port to a bridge fails when two VNIs
837 # are mapped to the same VLAN
840 ip link
set dev
$swp1 nomaster
842 bridge vlan del vid
20 dev vxlan20 pvid untagged
843 bridge vlan add vid
10 dev vxlan20 pvid untagged
845 ip link
set dev
$swp1 master br0
&> /dev
/null
848 log_test
"vlan-aware - failed enslavement to vlan-aware bridge"
850 bridge vlan del vid
10 dev vxlan20
851 bridge vlan add vid
20 dev vxlan20 pvid untagged
853 # Test that offloading of an unsupported tunnel fails when it is
854 # triggered by addition of VLAN to a local port
857 # TOS must be set to inherit
858 ip link
set dev vxlan10
type vxlan tos
42
860 ip link
set dev
$swp1 master br0
861 bridge vlan add vid
10 dev
$swp1 &> /dev
/null
864 log_test
"vlan-aware - failed vlan addition to a local port"
866 ip link
set dev vxlan10
type vxlan tos inherit
868 ip link del dev vxlan20
869 ip link del dev vxlan10
873 offload_indication_vlan_aware_setup_create
()
875 # Create a simple setup with two VxLAN devices and a single VLAN-aware
877 ip link add name br0 up
type bridge mcast_snooping
0 vlan_filtering
1 \
880 ip link
set dev
$swp1 master br0
882 bridge vlan add vid
10 dev
$swp1
883 bridge vlan add vid
20 dev
$swp1
885 ip address add
198.51.100.1/32 dev lo
887 ip link add name vxlan10 up master br0
type vxlan id
10 nolearning \
888 noudpcsum ttl
20 tos inherit
local 198.51.100.1 dstport
4789
889 ip link add name vxlan20 up master br0
type vxlan id
20 nolearning \
890 noudpcsum ttl
20 tos inherit
local 198.51.100.1 dstport
4789
892 bridge vlan add vid
10 dev vxlan10 pvid untagged
893 bridge vlan add vid
20 dev vxlan20 pvid untagged
896 offload_indication_vlan_aware_setup_destroy
()
898 bridge vlan del vid
20 dev vxlan20
899 bridge vlan del vid
10 dev vxlan10
901 ip link del dev vxlan20
902 ip link del dev vxlan10
904 ip address del
198.51.100.1/32 dev lo
906 bridge vlan del vid
20 dev
$swp1
907 bridge vlan del vid
10 dev
$swp1
909 ip link
set dev
$swp1 nomaster
914 offload_indication_vlan_aware_fdb_test
()
918 log_info
"vxlan entry offload indication - vlan-aware"
920 bridge fdb add de
:ad
:be
:ef
:13:37 dev vxlan10 self master static \
921 dst
198.51.100.2 vlan
10
923 bridge fdb show brport vxlan10 |
grep de
:ad
:be
:ef
:13:37 |
grep self \
926 bridge fdb show brport vxlan10 |
grep de
:ad
:be
:ef
:13:37 |
grep -v self \
930 log_test
"vxlan entry offload indication - initial state"
932 # Remove FDB entry from the bridge driver and check that corresponding
933 # entry in the VxLAN driver is not marked as offloaded
936 bridge fdb del de
:ad
:be
:ef
:13:37 dev vxlan10 master vlan
10
937 bridge fdb show brport vxlan10 |
grep de
:ad
:be
:ef
:13:37 |
grep self \
941 log_test
"vxlan entry offload indication - after removal from bridge"
943 # Add the FDB entry back to the bridge driver and make sure it is
944 # marked as offloaded in both drivers
947 bridge fdb add de
:ad
:be
:ef
:13:37 dev vxlan10 master static vlan
10
948 bridge fdb show brport vxlan10 |
grep de
:ad
:be
:ef
:13:37 |
grep self \
951 bridge fdb show brport vxlan10 |
grep de
:ad
:be
:ef
:13:37 |
grep -v self \
955 log_test
"vxlan entry offload indication - after re-add to bridge"
957 # Remove FDB entry from the VxLAN driver and check that corresponding
958 # entry in the bridge driver is not marked as offloaded
961 bridge fdb del de
:ad
:be
:ef
:13:37 dev vxlan10 self
962 bridge fdb show brport vxlan10 |
grep de
:ad
:be
:ef
:13:37 |
grep -v self \
966 log_test
"vxlan entry offload indication - after removal from vxlan"
968 # Add the FDB entry back to the VxLAN driver and make sure it is
969 # marked as offloaded in both drivers
972 bridge fdb add de
:ad
:be
:ef
:13:37 dev vxlan10 self dst
198.51.100.2
973 bridge fdb show brport vxlan10 |
grep de
:ad
:be
:ef
:13:37 |
grep self \
976 bridge fdb show brport vxlan10 |
grep de
:ad
:be
:ef
:13:37 |
grep -v self \
980 log_test
"vxlan entry offload indication - after re-add to vxlan"
982 bridge fdb del de
:ad
:be
:ef
:13:37 dev vxlan10 self master vlan
10
985 offload_indication_vlan_aware_decap_route_test
()
989 ip route show table
local |
grep 198.51.100.1 |
grep -q offload
992 # Toggle PVID flag on one VxLAN device and make sure route is still
993 # marked as offloaded
994 bridge vlan add vid
10 dev vxlan10 untagged
996 ip route show table
local |
grep 198.51.100.1 |
grep -q offload
999 # Toggle PVID flag on second VxLAN device and make sure route is no
1000 # longer marked as offloaded
1001 bridge vlan add vid
20 dev vxlan20 untagged
1003 ip route show table
local |
grep 198.51.100.1 |
grep -q offload
1006 # Toggle PVID flag back and make sure route is marked as offloaded
1007 bridge vlan add vid
10 dev vxlan10 pvid untagged
1008 bridge vlan add vid
20 dev vxlan20 pvid untagged
1010 ip route show table
local |
grep 198.51.100.1 |
grep -q offload
1013 log_test
"vxlan decap route - vni map/unmap"
1016 offload_indication_vlan_aware_join_vxlan_first
()
1018 ip link add dev br0 up
type bridge mcast_snooping
0 \
1019 vlan_filtering
1 vlan_default_pvid
1
1020 ip link add name vxlan0 up
type vxlan id
10 nolearning noudpcsum \
1021 ttl
20 tos inherit
local 198.51.100.1 dstport
4789
1023 __offload_indication_join_vxlan_first
1
1025 ip link del dev vxlan0
1029 offload_indication_vlan_aware_join_vxlan_last
()
1031 ip link add dev br0 up
type bridge mcast_snooping
0 \
1032 vlan_filtering
1 vlan_default_pvid
1
1033 ip link add name vxlan0 up
type vxlan id
10 nolearning noudpcsum \
1034 ttl
20 tos inherit
local 198.51.100.1 dstport
4789
1036 __offload_indication_join_vxlan_last
1038 ip link del dev vxlan0
1042 offload_indication_vlan_aware_l3vni_test
()
1044 local zmac
=00:00:00:00:00:00
1048 sysctl_set net.ipv6.conf.default.disable_ipv6
1
1049 ip link add dev br0 up
type bridge mcast_snooping
0 \
1050 vlan_filtering
1 vlan_default_pvid
0
1051 ip link add name vxlan0 up
type vxlan id
10 nolearning noudpcsum \
1052 ttl
20 tos inherit
local 198.51.100.1 dstport
4789
1054 ip link
set dev
$swp1 master br0
1056 # The test will use the offload indication on the FDB entry to
1057 # understand if the tunnel is offloaded or not
1058 bridge fdb append
$zmac dev vxlan0 self dst
192.0.2.1
1060 ip link
set dev vxlan0 master br0
1061 bridge vlan add dev vxlan0 vid
10 pvid untagged
1063 # No local port or router port is member in the VLAN, so tunnel should
1065 bridge fdb show brport vxlan0 |
grep $zmac |
grep self \
1067 check_fail $?
"vxlan tunnel offloaded when should not"
1069 # Configure a VLAN interface and make sure tunnel is offloaded
1070 ip link add link br0 name br10 up
type vlan id
10
1071 sysctl_set net.ipv6.conf.br10.disable_ipv6
0
1072 ip
-6 address add
2001:db8
:1::1/64 dev br10
1073 bridge fdb show brport vxlan0 |
grep $zmac |
grep self \
1075 check_err $?
"vxlan tunnel not offloaded when should"
1077 # Unlink the VXLAN device, make sure tunnel is no longer offloaded,
1078 # then add it back to the bridge and make sure it is offloaded
1079 ip link
set dev vxlan0 nomaster
1080 bridge fdb show brport vxlan0 |
grep $zmac |
grep self \
1082 check_fail $?
"vxlan tunnel offloaded after unlinked from bridge"
1084 ip link
set dev vxlan0 master br0
1085 bridge fdb show brport vxlan0 |
grep $zmac |
grep self \
1087 check_fail $?
"vxlan tunnel offloaded despite no matching vid"
1089 bridge vlan add dev vxlan0 vid
10 pvid untagged
1090 bridge fdb show brport vxlan0 |
grep $zmac |
grep self \
1092 check_err $?
"vxlan tunnel not offloaded after adding vid"
1094 log_test
"vxlan - l3 vni"
1096 ip link del dev vxlan0
1098 sysctl_restore net.ipv6.conf.default.disable_ipv6
1101 offload_indication_vlan_aware_test
()
1103 offload_indication_vlan_aware_setup_create
1104 offload_indication_vlan_aware_fdb_test
1105 offload_indication_vlan_aware_decap_route_test
1106 offload_indication_vlan_aware_setup_destroy
1108 log_info
"offload indication - replay & cleanup - vlan aware"
1109 offload_indication_vlan_aware_join_vxlan_first
1110 offload_indication_vlan_aware_join_vxlan_last
1111 offload_indication_vlan_aware_l3vni_test