~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/drivers/net/mlxsw/vxlan.sh

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /tools/testing/selftests/drivers/net/mlxsw/vxlan.sh (Architecture i386) and /tools/testing/selftests/drivers/net/mlxsw/vxlan.sh (Architecture sparc64)


  1 #!/bin/bash                                         1 #!/bin/bash
  2 # SPDX-License-Identifier: GPL-2.0                  2 # SPDX-License-Identifier: GPL-2.0
  3 #                                                   3 #
  4 # Test various aspects of VxLAN offloading whi      4 # Test various aspects of VxLAN offloading which are specific to mlxsw, such
  5 # as sanitization of invalid configurations an      5 # as sanitization of invalid configurations and offload indication.
  6                                                     6 
  7 : ${ADDR_FAMILY:=ipv4}                              7 : ${ADDR_FAMILY:=ipv4}
  8 export ADDR_FAMILY                                  8 export ADDR_FAMILY
  9                                                     9 
 10 : ${LOCAL_IP_1:=198.51.100.1}                      10 : ${LOCAL_IP_1:=198.51.100.1}
 11 export LOCAL_IP_1                                  11 export LOCAL_IP_1
 12                                                    12 
 13 : ${LOCAL_IP_2:=198.51.100.2}                      13 : ${LOCAL_IP_2:=198.51.100.2}
 14 export LOCAL_IP_2                                  14 export LOCAL_IP_2
 15                                                    15 
 16 : ${PREFIX_LEN:=32}                                16 : ${PREFIX_LEN:=32}
 17 export PREFIX_LEN                                  17 export PREFIX_LEN
 18                                                    18 
 19 : ${UDPCSUM_FLAFS:=noudpcsum}                      19 : ${UDPCSUM_FLAFS:=noudpcsum}
 20 export UDPCSUM_FLAFS                               20 export UDPCSUM_FLAFS
 21                                                    21 
 22 : ${MC_IP:=239.0.0.1}                              22 : ${MC_IP:=239.0.0.1}
 23 export MC_IP                                       23 export MC_IP
 24                                                    24 
 25 : ${IP_FLAG:=""}                                   25 : ${IP_FLAG:=""}
 26 export IP_FLAG                                     26 export IP_FLAG
 27                                                    27 
 28 : ${ALL_TESTS:="                                   28 : ${ALL_TESTS:="
 29         sanitization_test                          29         sanitization_test
 30         offload_indication_test                    30         offload_indication_test
 31         sanitization_vlan_aware_test               31         sanitization_vlan_aware_test
 32         offload_indication_vlan_aware_test         32         offload_indication_vlan_aware_test
 33 "}                                                 33 "}
 34                                                    34 
 35 lib_dir=$(dirname $0)/../../../net/forwarding      35 lib_dir=$(dirname $0)/../../../net/forwarding
 36 NUM_NETIFS=2                                       36 NUM_NETIFS=2
 37 : ${TIMEOUT:=20000} # ms                           37 : ${TIMEOUT:=20000} # ms
 38 source $lib_dir/lib.sh                             38 source $lib_dir/lib.sh
 39                                                    39 
 40 setup_prepare()                                    40 setup_prepare()
 41 {                                                  41 {
 42         swp1=${NETIFS[p1]}                         42         swp1=${NETIFS[p1]}
 43         swp2=${NETIFS[p2]}                         43         swp2=${NETIFS[p2]}
 44                                                    44 
 45         ip link set dev $swp1 up                   45         ip link set dev $swp1 up
 46         ip link set dev $swp2 up                   46         ip link set dev $swp2 up
 47 }                                                  47 }
 48                                                    48 
 49 cleanup()                                          49 cleanup()
 50 {                                                  50 {
 51         pre_cleanup                                51         pre_cleanup
 52                                                    52 
 53         ip link set dev $swp2 down                 53         ip link set dev $swp2 down
 54         ip link set dev $swp1 down                 54         ip link set dev $swp1 down
 55 }                                                  55 }
 56                                                    56 
 57 sanitization_single_dev_test_pass()                57 sanitization_single_dev_test_pass()
 58 {                                                  58 {
 59         ip link set dev $swp1 master br0           59         ip link set dev $swp1 master br0
 60         check_err $?                               60         check_err $?
 61         ip link set dev vxlan0 master br0          61         ip link set dev vxlan0 master br0
 62         check_err $?                               62         check_err $?
 63                                                    63 
 64         ip link set dev $swp1 nomaster             64         ip link set dev $swp1 nomaster
 65                                                    65 
 66         ip link set dev $swp1 master br0           66         ip link set dev $swp1 master br0
 67         check_err $?                               67         check_err $?
 68 }                                                  68 }
 69                                                    69 
 70 sanitization_single_dev_test_fail()                70 sanitization_single_dev_test_fail()
 71 {                                                  71 {
 72         ip link set dev $swp1 master br0           72         ip link set dev $swp1 master br0
 73         check_err $?                               73         check_err $?
 74         ip link set dev vxlan0 master br0 &> /     74         ip link set dev vxlan0 master br0 &> /dev/null
 75         check_fail $?                              75         check_fail $?
 76                                                    76 
 77         ip link set dev $swp1 nomaster             77         ip link set dev $swp1 nomaster
 78                                                    78 
 79         ip link set dev vxlan0 master br0          79         ip link set dev vxlan0 master br0
 80         check_err $?                               80         check_err $?
 81         ip link set dev $swp1 master br0 &> /d     81         ip link set dev $swp1 master br0 &> /dev/null
 82         check_fail $?                              82         check_fail $?
 83 }                                                  83 }
 84                                                    84 
 85 sanitization_single_dev_valid_test()               85 sanitization_single_dev_valid_test()
 86 {                                                  86 {
 87         RET=0                                      87         RET=0
 88                                                    88 
 89         ip link add dev br0 type bridge mcast_     89         ip link add dev br0 type bridge mcast_snooping 0
 90                                                    90 
 91         ip link add name vxlan0 up type vxlan      91         ip link add name vxlan0 up type vxlan id 10 nolearning $UDPCSUM_FLAFS \
 92                 ttl 20 tos inherit local $LOCA     92                 ttl 20 tos inherit local $LOCAL_IP_1 dstport 4789
 93                                                    93 
 94         sanitization_single_dev_test_pass          94         sanitization_single_dev_test_pass
 95                                                    95 
 96         ip link del dev vxlan0                     96         ip link del dev vxlan0
 97         ip link del dev br0                        97         ip link del dev br0
 98                                                    98 
 99         log_test "vxlan device - valid configu     99         log_test "vxlan device - valid configuration"
100 }                                                 100 }
101                                                   101 
102 sanitization_single_dev_vlan_aware_test()         102 sanitization_single_dev_vlan_aware_test()
103 {                                                 103 {
104         RET=0                                     104         RET=0
105                                                   105 
106         ip link add dev br0 type bridge mcast_    106         ip link add dev br0 type bridge mcast_snooping 0 vlan_filtering 1
107                                                   107 
108         ip link add name vxlan0 up type vxlan     108         ip link add name vxlan0 up type vxlan id 10 nolearning $UDPCSUM_FLAFS \
109                 ttl 20 tos inherit local $LOCA    109                 ttl 20 tos inherit local $LOCAL_IP_1 dstport 4789
110                                                   110 
111         sanitization_single_dev_test_pass         111         sanitization_single_dev_test_pass
112                                                   112 
113         ip link del dev vxlan0                    113         ip link del dev vxlan0
114         ip link del dev br0                       114         ip link del dev br0
115                                                   115 
116         log_test "vxlan device with a vlan-awa    116         log_test "vxlan device with a vlan-aware bridge"
117 }                                                 117 }
118                                                   118 
119 sanitization_single_dev_mcast_enabled_test()      119 sanitization_single_dev_mcast_enabled_test()
120 {                                                 120 {
121         RET=0                                     121         RET=0
122                                                   122 
123         ip link add dev br0 type bridge           123         ip link add dev br0 type bridge
124                                                   124 
125         ip link add name vxlan0 up type vxlan     125         ip link add name vxlan0 up type vxlan id 10 nolearning $UDPCSUM_FLAFS \
126                 ttl 20 tos inherit local $LOCA    126                 ttl 20 tos inherit local $LOCAL_IP_1 dstport 4789
127                                                   127 
128         sanitization_single_dev_test_fail         128         sanitization_single_dev_test_fail
129                                                   129 
130         ip link del dev vxlan0                    130         ip link del dev vxlan0
131         ip link del dev br0                       131         ip link del dev br0
132                                                   132 
133         log_test "vxlan device with a multicas    133         log_test "vxlan device with a multicast enabled bridge"
134 }                                                 134 }
135                                                   135 
136 sanitization_single_dev_mcast_group_test()        136 sanitization_single_dev_mcast_group_test()
137 {                                                 137 {
138         RET=0                                     138         RET=0
139                                                   139 
140         ip link add dev br0 type bridge mcast_    140         ip link add dev br0 type bridge mcast_snooping 0
141         ip link add name dummy1 up type dummy     141         ip link add name dummy1 up type dummy
142                                                   142 
143         ip link add name vxlan0 up type vxlan     143         ip link add name vxlan0 up type vxlan id 10 nolearning $UDPCSUM_FLAFS \
144                 ttl 20 tos inherit local $LOCA    144                 ttl 20 tos inherit local $LOCAL_IP_1 dstport 4789 \
145                 dev dummy1 group $MC_IP           145                 dev dummy1 group $MC_IP
146                                                   146 
147         sanitization_single_dev_test_fail         147         sanitization_single_dev_test_fail
148                                                   148 
149         ip link del dev vxlan0                    149         ip link del dev vxlan0
150         ip link del dev dummy1                    150         ip link del dev dummy1
151         ip link del dev br0                       151         ip link del dev br0
152                                                   152 
153         log_test "vxlan device with a multicas    153         log_test "vxlan device with a multicast group"
154 }                                                 154 }
155                                                   155 
156 sanitization_single_dev_no_local_ip_test()        156 sanitization_single_dev_no_local_ip_test()
157 {                                                 157 {
158         RET=0                                     158         RET=0
159                                                   159 
160         ip link add dev br0 type bridge mcast_    160         ip link add dev br0 type bridge mcast_snooping 0
161                                                   161 
162         ip link add name vxlan0 up type vxlan     162         ip link add name vxlan0 up type vxlan id 10 nolearning $UDPCSUM_FLAFS \
163                 ttl 20 tos inherit dstport 478    163                 ttl 20 tos inherit dstport 4789
164                                                   164 
165         sanitization_single_dev_test_fail         165         sanitization_single_dev_test_fail
166                                                   166 
167         ip link del dev vxlan0                    167         ip link del dev vxlan0
168         ip link del dev br0                       168         ip link del dev br0
169                                                   169 
170         log_test "vxlan device with no local i    170         log_test "vxlan device with no local ip"
171 }                                                 171 }
172                                                   172 
173 sanitization_single_dev_learning_enabled_ipv4_    173 sanitization_single_dev_learning_enabled_ipv4_test()
174 {                                                 174 {
175         RET=0                                     175         RET=0
176                                                   176 
177         ip link add dev br0 type bridge mcast_    177         ip link add dev br0 type bridge mcast_snooping 0
178                                                   178 
179         ip link add name vxlan0 up type vxlan     179         ip link add name vxlan0 up type vxlan id 10 learning $UDPCSUM_FLAFS \
180                 ttl 20 tos inherit local $LOCA    180                 ttl 20 tos inherit local $LOCAL_IP_1 dstport 4789
181                                                   181 
182         sanitization_single_dev_test_pass         182         sanitization_single_dev_test_pass
183                                                   183 
184         ip link del dev vxlan0                    184         ip link del dev vxlan0
185         ip link del dev br0                       185         ip link del dev br0
186                                                   186 
187         log_test "vxlan device with learning e    187         log_test "vxlan device with learning enabled"
188 }                                                 188 }
189                                                   189 
190 sanitization_single_dev_local_interface_test()    190 sanitization_single_dev_local_interface_test()
191 {                                                 191 {
192         RET=0                                     192         RET=0
193                                                   193 
194         ip link add dev br0 type bridge mcast_    194         ip link add dev br0 type bridge mcast_snooping 0
195         ip link add name dummy1 up type dummy     195         ip link add name dummy1 up type dummy
196                                                   196 
197         ip link add name vxlan0 up type vxlan     197         ip link add name vxlan0 up type vxlan id 10 nolearning $UDPCSUM_FLAFS \
198                 ttl 20 tos inherit local $LOCA    198                 ttl 20 tos inherit local $LOCAL_IP_1 dstport 4789 dev dummy1
199                                                   199 
200         sanitization_single_dev_test_fail         200         sanitization_single_dev_test_fail
201                                                   201 
202         ip link del dev vxlan0                    202         ip link del dev vxlan0
203         ip link del dev dummy1                    203         ip link del dev dummy1
204         ip link del dev br0                       204         ip link del dev br0
205                                                   205 
206         log_test "vxlan device with local inte    206         log_test "vxlan device with local interface"
207 }                                                 207 }
208                                                   208 
209 sanitization_single_dev_port_range_test()         209 sanitization_single_dev_port_range_test()
210 {                                                 210 {
211         RET=0                                     211         RET=0
212                                                   212 
213         ip link add dev br0 type bridge mcast_    213         ip link add dev br0 type bridge mcast_snooping 0
214                                                   214 
215         ip link add name vxlan0 up type vxlan     215         ip link add name vxlan0 up type vxlan id 10 nolearning $UDPCSUM_FLAFS \
216                 ttl 20 tos inherit local $LOCA    216                 ttl 20 tos inherit local $LOCAL_IP_1 dstport 4789 \
217                 srcport 4000 5000                 217                 srcport 4000 5000
218                                                   218 
219         sanitization_single_dev_test_fail         219         sanitization_single_dev_test_fail
220                                                   220 
221         ip link del dev vxlan0                    221         ip link del dev vxlan0
222         ip link del dev br0                       222         ip link del dev br0
223                                                   223 
224         log_test "vxlan device with udp source    224         log_test "vxlan device with udp source port range"
225 }                                                 225 }
226                                                   226 
227 sanitization_single_dev_tos_static_test()         227 sanitization_single_dev_tos_static_test()
228 {                                                 228 {
229         RET=0                                     229         RET=0
230                                                   230 
231         ip link add dev br0 type bridge mcast_    231         ip link add dev br0 type bridge mcast_snooping 0
232                                                   232 
233         ip link add name vxlan0 up type vxlan     233         ip link add name vxlan0 up type vxlan id 10 nolearning $UDPCSUM_FLAFS \
234                 ttl 20 tos 20 local $LOCAL_IP_    234                 ttl 20 tos 20 local $LOCAL_IP_1 dstport 4789
235                                                   235 
236         sanitization_single_dev_test_fail         236         sanitization_single_dev_test_fail
237                                                   237 
238         ip link del dev vxlan0                    238         ip link del dev vxlan0
239         ip link del dev br0                       239         ip link del dev br0
240                                                   240 
241         log_test "vxlan device with static tos    241         log_test "vxlan device with static tos"
242 }                                                 242 }
243                                                   243 
244 sanitization_single_dev_ttl_inherit_test()        244 sanitization_single_dev_ttl_inherit_test()
245 {                                                 245 {
246         RET=0                                     246         RET=0
247                                                   247 
248         ip link add dev br0 type bridge mcast_    248         ip link add dev br0 type bridge mcast_snooping 0
249                                                   249 
250         ip link add name vxlan0 up type vxlan     250         ip link add name vxlan0 up type vxlan id 10 nolearning $UDPCSUM_FLAFS \
251                 ttl inherit tos inherit local     251                 ttl inherit tos inherit local $LOCAL_IP_1 dstport 4789
252                                                   252 
253         sanitization_single_dev_test_fail         253         sanitization_single_dev_test_fail
254                                                   254 
255         ip link del dev vxlan0                    255         ip link del dev vxlan0
256         ip link del dev br0                       256         ip link del dev br0
257                                                   257 
258         log_test "vxlan device with inherit tt    258         log_test "vxlan device with inherit ttl"
259 }                                                 259 }
260                                                   260 
261 sanitization_single_dev_udp_checksum_ipv4_test    261 sanitization_single_dev_udp_checksum_ipv4_test()
262 {                                                 262 {
263         RET=0                                     263         RET=0
264                                                   264 
265         ip link add dev br0 type bridge mcast_    265         ip link add dev br0 type bridge mcast_snooping 0
266                                                   266 
267         ip link add name vxlan0 up type vxlan     267         ip link add name vxlan0 up type vxlan id 10 nolearning udpcsum \
268                 ttl 20 tos inherit local $LOCA    268                 ttl 20 tos inherit local $LOCAL_IP_1 dstport 4789
269                                                   269 
270         sanitization_single_dev_test_fail         270         sanitization_single_dev_test_fail
271                                                   271 
272         ip link del dev vxlan0                    272         ip link del dev vxlan0
273         ip link del dev br0                       273         ip link del dev br0
274                                                   274 
275         log_test "vxlan device with udp checks    275         log_test "vxlan device with udp checksum"
276 }                                                 276 }
277                                                   277 
278 sanitization_single_dev_test()                    278 sanitization_single_dev_test()
279 {                                                 279 {
280         # These tests make sure that we correc    280         # These tests make sure that we correctly sanitize VxLAN device
281         # configurations we do not support        281         # configurations we do not support
282         sanitization_single_dev_valid_test        282         sanitization_single_dev_valid_test
283         sanitization_single_dev_vlan_aware_tes    283         sanitization_single_dev_vlan_aware_test
284         sanitization_single_dev_mcast_enabled_    284         sanitization_single_dev_mcast_enabled_test
285         sanitization_single_dev_mcast_group_te    285         sanitization_single_dev_mcast_group_test
286         sanitization_single_dev_no_local_ip_te    286         sanitization_single_dev_no_local_ip_test
287         sanitization_single_dev_learning_enabl    287         sanitization_single_dev_learning_enabled_"$ADDR_FAMILY"_test
288         sanitization_single_dev_local_interfac    288         sanitization_single_dev_local_interface_test
289         sanitization_single_dev_port_range_tes    289         sanitization_single_dev_port_range_test
290         sanitization_single_dev_tos_static_tes    290         sanitization_single_dev_tos_static_test
291         sanitization_single_dev_ttl_inherit_te    291         sanitization_single_dev_ttl_inherit_test
292         sanitization_single_dev_udp_checksum_"    292         sanitization_single_dev_udp_checksum_"$ADDR_FAMILY"_test
293 }                                                 293 }
294                                                   294 
295 sanitization_multi_devs_test_pass()               295 sanitization_multi_devs_test_pass()
296 {                                                 296 {
297         ip link set dev $swp1 master br0          297         ip link set dev $swp1 master br0
298         check_err $?                              298         check_err $?
299         ip link set dev vxlan0 master br0         299         ip link set dev vxlan0 master br0
300         check_err $?                              300         check_err $?
301         ip link set dev $swp2 master br1          301         ip link set dev $swp2 master br1
302         check_err $?                              302         check_err $?
303         ip link set dev vxlan1 master br1         303         ip link set dev vxlan1 master br1
304         check_err $?                              304         check_err $?
305                                                   305 
306         ip link set dev $swp2 nomaster            306         ip link set dev $swp2 nomaster
307         ip link set dev $swp1 nomaster            307         ip link set dev $swp1 nomaster
308                                                   308 
309         ip link set dev $swp1 master br0          309         ip link set dev $swp1 master br0
310         check_err $?                              310         check_err $?
311         ip link set dev $swp2 master br1          311         ip link set dev $swp2 master br1
312         check_err $?                              312         check_err $?
313 }                                                 313 }
314                                                   314 
315 sanitization_multi_devs_test_fail()               315 sanitization_multi_devs_test_fail()
316 {                                                 316 {
317         ip link set dev $swp1 master br0          317         ip link set dev $swp1 master br0
318         check_err $?                              318         check_err $?
319         ip link set dev vxlan0 master br0         319         ip link set dev vxlan0 master br0
320         check_err $?                              320         check_err $?
321         ip link set dev $swp2 master br1          321         ip link set dev $swp2 master br1
322         check_err $?                              322         check_err $?
323         ip link set dev vxlan1 master br1 &> /    323         ip link set dev vxlan1 master br1 &> /dev/null
324         check_fail $?                             324         check_fail $?
325                                                   325 
326         ip link set dev $swp2 nomaster            326         ip link set dev $swp2 nomaster
327         ip link set dev $swp1 nomaster            327         ip link set dev $swp1 nomaster
328                                                   328 
329         ip link set dev vxlan1 master br1         329         ip link set dev vxlan1 master br1
330         check_err $?                              330         check_err $?
331         ip link set dev $swp1 master br0          331         ip link set dev $swp1 master br0
332         check_err $?                              332         check_err $?
333         ip link set dev $swp2 master br1 &> /d    333         ip link set dev $swp2 master br1 &> /dev/null
334         check_fail $?                             334         check_fail $?
335 }                                                 335 }
336                                                   336 
337 sanitization_multi_devs_valid_test()              337 sanitization_multi_devs_valid_test()
338 {                                                 338 {
339         RET=0                                     339         RET=0
340                                                   340 
341         ip link add dev br0 type bridge mcast_    341         ip link add dev br0 type bridge mcast_snooping 0
342         ip link add dev br1 type bridge mcast_    342         ip link add dev br1 type bridge mcast_snooping 0
343                                                   343 
344         ip link add name vxlan0 up type vxlan     344         ip link add name vxlan0 up type vxlan id 10 nolearning $UDPCSUM_FLAFS \
345                 ttl 20 tos inherit local $LOCA    345                 ttl 20 tos inherit local $LOCAL_IP_1 dstport 4789
346         ip link add name vxlan1 up type vxlan     346         ip link add name vxlan1 up type vxlan id 20 nolearning $UDPCSUM_FLAFS \
347                 ttl 20 tos inherit local $LOCA    347                 ttl 20 tos inherit local $LOCAL_IP_1 dstport 4789
348                                                   348 
349         sanitization_multi_devs_test_pass         349         sanitization_multi_devs_test_pass
350                                                   350 
351         ip link del dev vxlan1                    351         ip link del dev vxlan1
352         ip link del dev vxlan0                    352         ip link del dev vxlan0
353         ip link del dev br1                       353         ip link del dev br1
354         ip link del dev br0                       354         ip link del dev br0
355                                                   355 
356         log_test "multiple vxlan devices - val    356         log_test "multiple vxlan devices - valid configuration"
357 }                                                 357 }
358                                                   358 
359 sanitization_multi_devs_ttl_test()                359 sanitization_multi_devs_ttl_test()
360 {                                                 360 {
361         RET=0                                     361         RET=0
362                                                   362 
363         ip link add dev br0 type bridge mcast_    363         ip link add dev br0 type bridge mcast_snooping 0
364         ip link add dev br1 type bridge mcast_    364         ip link add dev br1 type bridge mcast_snooping 0
365                                                   365 
366         ip link add name vxlan0 up type vxlan     366         ip link add name vxlan0 up type vxlan id 10 nolearning $UDPCSUM_FLAFS \
367                 ttl 20 tos inherit local $LOCA    367                 ttl 20 tos inherit local $LOCAL_IP_1 dstport 4789
368         ip link add name vxlan1 up type vxlan     368         ip link add name vxlan1 up type vxlan id 20 nolearning $UDPCSUM_FLAFS \
369                 ttl 40 tos inherit local $LOCA    369                 ttl 40 tos inherit local $LOCAL_IP_1 dstport 4789
370                                                   370 
371         sanitization_multi_devs_test_fail         371         sanitization_multi_devs_test_fail
372                                                   372 
373         ip link del dev vxlan1                    373         ip link del dev vxlan1
374         ip link del dev vxlan0                    374         ip link del dev vxlan0
375         ip link del dev br1                       375         ip link del dev br1
376         ip link del dev br0                       376         ip link del dev br0
377                                                   377 
378         log_test "multiple vxlan devices with     378         log_test "multiple vxlan devices with different ttl"
379 }                                                 379 }
380                                                   380 
381 sanitization_multi_devs_udp_dstport_test()        381 sanitization_multi_devs_udp_dstport_test()
382 {                                                 382 {
383         RET=0                                     383         RET=0
384                                                   384 
385         ip link add dev br0 type bridge mcast_    385         ip link add dev br0 type bridge mcast_snooping 0
386         ip link add dev br1 type bridge mcast_    386         ip link add dev br1 type bridge mcast_snooping 0
387                                                   387 
388         ip link add name vxlan0 up type vxlan     388         ip link add name vxlan0 up type vxlan id 10 nolearning $UDPCSUM_FLAFS \
389                 ttl 20 tos inherit local $LOCA    389                 ttl 20 tos inherit local $LOCAL_IP_1 dstport 4789
390         ip link add name vxlan1 up type vxlan     390         ip link add name vxlan1 up type vxlan id 20 nolearning $UDPCSUM_FLAFS \
391                 ttl 20 tos inherit local $LOCA    391                 ttl 20 tos inherit local $LOCAL_IP_1 dstport 5789
392                                                   392 
393         sanitization_multi_devs_test_fail         393         sanitization_multi_devs_test_fail
394                                                   394 
395         ip link del dev vxlan1                    395         ip link del dev vxlan1
396         ip link del dev vxlan0                    396         ip link del dev vxlan0
397         ip link del dev br1                       397         ip link del dev br1
398         ip link del dev br0                       398         ip link del dev br0
399                                                   399 
400         log_test "multiple vxlan devices with     400         log_test "multiple vxlan devices with different udp destination port"
401 }                                                 401 }
402                                                   402 
403 sanitization_multi_devs_local_ip_test()           403 sanitization_multi_devs_local_ip_test()
404 {                                                 404 {
405         RET=0                                     405         RET=0
406                                                   406 
407         ip link add dev br0 type bridge mcast_    407         ip link add dev br0 type bridge mcast_snooping 0
408         ip link add dev br1 type bridge mcast_    408         ip link add dev br1 type bridge mcast_snooping 0
409                                                   409 
410         ip link add name vxlan0 up type vxlan     410         ip link add name vxlan0 up type vxlan id 10 nolearning $UDPCSUM_FLAFS \
411                 ttl 20 tos inherit local $LOCA    411                 ttl 20 tos inherit local $LOCAL_IP_1 dstport 4789
412         ip link add name vxlan1 up type vxlan     412         ip link add name vxlan1 up type vxlan id 20 nolearning $UDPCSUM_FLAFS \
413                 ttl 20 tos inherit local $LOCA    413                 ttl 20 tos inherit local $LOCAL_IP_2 dstport 4789
414                                                   414 
415         sanitization_multi_devs_test_fail         415         sanitization_multi_devs_test_fail
416                                                   416 
417         ip link del dev vxlan1                    417         ip link del dev vxlan1
418         ip link del dev vxlan0                    418         ip link del dev vxlan0
419         ip link del dev br1                       419         ip link del dev br1
420         ip link del dev br0                       420         ip link del dev br0
421                                                   421 
422         log_test "multiple vxlan devices with     422         log_test "multiple vxlan devices with different local ip"
423 }                                                 423 }
424                                                   424 
425 sanitization_multi_devs_test()                    425 sanitization_multi_devs_test()
426 {                                                 426 {
427         # The device has a single VTEP, which     427         # The device has a single VTEP, which means all the VxLAN devices
428         # we offload must share certain proper    428         # we offload must share certain properties such as source IP and
429         # UDP destination port. These tests ma    429         # UDP destination port. These tests make sure that we forbid
430         # configurations that violate this lim    430         # configurations that violate this limitation
431         sanitization_multi_devs_valid_test        431         sanitization_multi_devs_valid_test
432         sanitization_multi_devs_ttl_test          432         sanitization_multi_devs_ttl_test
433         sanitization_multi_devs_udp_dstport_te    433         sanitization_multi_devs_udp_dstport_test
434         sanitization_multi_devs_local_ip_test     434         sanitization_multi_devs_local_ip_test
435 }                                                 435 }
436                                                   436 
437 sanitization_test()                               437 sanitization_test()
438 {                                                 438 {
439         sanitization_single_dev_test              439         sanitization_single_dev_test
440         sanitization_multi_devs_test              440         sanitization_multi_devs_test
441 }                                                 441 }
442                                                   442 
443 offload_indication_setup_create()                 443 offload_indication_setup_create()
444 {                                                 444 {
445         # Create a simple setup with two bridg    445         # Create a simple setup with two bridges, each with a VxLAN device
446         # and one local port                      446         # and one local port
447         ip link add name br0 type bridge mcast    447         ip link add name br0 type bridge mcast_snooping 0
448         ip link set dev br0 addrgenmode none      448         ip link set dev br0 addrgenmode none
449         ip link set dev br0 up                    449         ip link set dev br0 up
450         ip link add name br1 type bridge mcast    450         ip link add name br1 type bridge mcast_snooping 0
451         ip link set dev br1 addrgenmode none      451         ip link set dev br1 addrgenmode none
452         ip link set dev br1 up                    452         ip link set dev br1 up
453                                                   453 
454         ip link set dev $swp1 master br0          454         ip link set dev $swp1 master br0
455         ip link set dev $swp2 master br1          455         ip link set dev $swp2 master br1
456                                                   456 
457         ip address add $LOCAL_IP_1/$PREFIX_LEN    457         ip address add $LOCAL_IP_1/$PREFIX_LEN dev lo
458                                                   458 
459         ip link add name vxlan0 up master br0     459         ip link add name vxlan0 up master br0 type vxlan id 10 nolearning \
460                 $UDPCSUM_FLAFS ttl 20 tos inhe    460                 $UDPCSUM_FLAFS ttl 20 tos inherit local $LOCAL_IP_1 dstport 4789
461         ip link add name vxlan1 up master br1     461         ip link add name vxlan1 up master br1 type vxlan id 20 nolearning \
462                 $UDPCSUM_FLAFS ttl 20 tos inhe    462                 $UDPCSUM_FLAFS ttl 20 tos inherit local $LOCAL_IP_1 dstport 4789
463 }                                                 463 }
464                                                   464 
465 offload_indication_setup_destroy()                465 offload_indication_setup_destroy()
466 {                                                 466 {
467         ip link del dev vxlan1                    467         ip link del dev vxlan1
468         ip link del dev vxlan0                    468         ip link del dev vxlan0
469                                                   469 
470         ip address del $LOCAL_IP_1/$PREFIX_LEN    470         ip address del $LOCAL_IP_1/$PREFIX_LEN dev lo
471                                                   471 
472         ip link set dev $swp2 nomaster            472         ip link set dev $swp2 nomaster
473         ip link set dev $swp1 nomaster            473         ip link set dev $swp1 nomaster
474                                                   474 
475         ip link del dev br1                       475         ip link del dev br1
476         ip link del dev br0                       476         ip link del dev br0
477 }                                                 477 }
478                                                   478 
479 offload_indication_fdb_flood_test()               479 offload_indication_fdb_flood_test()
480 {                                                 480 {
481         RET=0                                     481         RET=0
482                                                   482 
483         bridge fdb append 00:00:00:00:00:00 de    483         bridge fdb append 00:00:00:00:00:00 dev vxlan0 self dst $LOCAL_IP_2
484                                                   484 
485         busywait "$TIMEOUT" wait_for_offload g    485         busywait "$TIMEOUT" wait_for_offload grep_bridge_fdb 00:00:00:00:00:00 \
486                 bridge fdb show brport vxlan0     486                 bridge fdb show brport vxlan0
487         check_err $?                              487         check_err $?
488                                                   488 
489         bridge fdb del 00:00:00:00:00:00 dev v    489         bridge fdb del 00:00:00:00:00:00 dev vxlan0 self
490                                                   490 
491         log_test "vxlan flood entry offload in    491         log_test "vxlan flood entry offload indication"
492 }                                                 492 }
493                                                   493 
494 offload_indication_fdb_bridge_test()              494 offload_indication_fdb_bridge_test()
495 {                                                 495 {
496         RET=0                                     496         RET=0
497                                                   497 
498         bridge fdb add de:ad:be:ef:13:37 dev v    498         bridge fdb add de:ad:be:ef:13:37 dev vxlan0 self master static \
499                 dst $LOCAL_IP_2                   499                 dst $LOCAL_IP_2
500                                                   500 
501         busywait "$TIMEOUT" wait_for_offload g    501         busywait "$TIMEOUT" wait_for_offload grep_bridge_fdb \
502                 de:ad:be:ef:13:37 self bridge     502                 de:ad:be:ef:13:37 self bridge fdb show brport vxlan0
503         check_err $?                              503         check_err $?
504         busywait "$TIMEOUT" wait_for_offload g    504         busywait "$TIMEOUT" wait_for_offload grep_bridge_fdb \
505                 de:ad:be:ef:13:37 self -v brid    505                 de:ad:be:ef:13:37 self -v bridge fdb show brport vxlan0
506         check_err $?                              506         check_err $?
507                                                   507 
508         log_test "vxlan entry offload indicati    508         log_test "vxlan entry offload indication - initial state"
509                                                   509 
510         # Remove FDB entry from the bridge dri    510         # Remove FDB entry from the bridge driver and check that corresponding
511         # entry in the VxLAN driver is not mar    511         # entry in the VxLAN driver is not marked as offloaded
512         RET=0                                     512         RET=0
513                                                   513 
514         bridge fdb del de:ad:be:ef:13:37 dev v    514         bridge fdb del de:ad:be:ef:13:37 dev vxlan0 master
515         busywait "$TIMEOUT" not wait_for_offlo    515         busywait "$TIMEOUT" not wait_for_offload grep_bridge_fdb \
516                 de:ad:be:ef:13:37 self bridge     516                 de:ad:be:ef:13:37 self bridge fdb show brport vxlan0
517         check_err $?                              517         check_err $?
518                                                   518 
519         log_test "vxlan entry offload indicati    519         log_test "vxlan entry offload indication - after removal from bridge"
520                                                   520 
521         # Add the FDB entry back to the bridge    521         # Add the FDB entry back to the bridge driver and make sure it is
522         # marked as offloaded in both drivers     522         # marked as offloaded in both drivers
523         RET=0                                     523         RET=0
524                                                   524 
525         bridge fdb add de:ad:be:ef:13:37 dev v    525         bridge fdb add de:ad:be:ef:13:37 dev vxlan0 master static
526         busywait "$TIMEOUT" wait_for_offload g    526         busywait "$TIMEOUT" wait_for_offload grep_bridge_fdb \
527                 de:ad:be:ef:13:37 self bridge     527                 de:ad:be:ef:13:37 self bridge fdb show brport vxlan0
528         check_err $?                              528         check_err $?
529         busywait "$TIMEOUT" wait_for_offload g    529         busywait "$TIMEOUT" wait_for_offload grep_bridge_fdb \
530                 de:ad:be:ef:13:37 self -v brid    530                 de:ad:be:ef:13:37 self -v bridge fdb show brport vxlan0
531         check_err $?                              531         check_err $?
532                                                   532 
533         log_test "vxlan entry offload indicati    533         log_test "vxlan entry offload indication - after re-add to bridge"
534                                                   534 
535         # Remove FDB entry from the VxLAN driv    535         # Remove FDB entry from the VxLAN driver and check that corresponding
536         # entry in the bridge driver is not ma    536         # entry in the bridge driver is not marked as offloaded
537         RET=0                                     537         RET=0
538                                                   538 
539         bridge fdb del de:ad:be:ef:13:37 dev v    539         bridge fdb del de:ad:be:ef:13:37 dev vxlan0 self
540         busywait "$TIMEOUT" not wait_for_offlo    540         busywait "$TIMEOUT" not wait_for_offload grep_bridge_fdb \
541                 de:ad:be:ef:13:37 self -v brid    541                 de:ad:be:ef:13:37 self -v bridge fdb show brport vxlan0
542         check_err $?                              542         check_err $?
543                                                   543 
544         log_test "vxlan entry offload indicati    544         log_test "vxlan entry offload indication - after removal from vxlan"
545                                                   545 
546         # Add the FDB entry back to the VxLAN     546         # Add the FDB entry back to the VxLAN driver and make sure it is
547         # marked as offloaded in both drivers     547         # marked as offloaded in both drivers
548         RET=0                                     548         RET=0
549                                                   549 
550         bridge fdb add de:ad:be:ef:13:37 dev v    550         bridge fdb add de:ad:be:ef:13:37 dev vxlan0 self dst $LOCAL_IP_2
551         busywait "$TIMEOUT" wait_for_offload g    551         busywait "$TIMEOUT" wait_for_offload grep_bridge_fdb \
552                 de:ad:be:ef:13:37 self bridge     552                 de:ad:be:ef:13:37 self bridge fdb show brport vxlan0
553         check_err $?                              553         check_err $?
554         busywait "$TIMEOUT" wait_for_offload g    554         busywait "$TIMEOUT" wait_for_offload grep_bridge_fdb \
555                 de:ad:be:ef:13:37 self -v brid    555                 de:ad:be:ef:13:37 self -v bridge fdb show brport vxlan0
556         check_err $?                              556         check_err $?
557                                                   557 
558         log_test "vxlan entry offload indicati    558         log_test "vxlan entry offload indication - after re-add to vxlan"
559                                                   559 
560         bridge fdb del de:ad:be:ef:13:37 dev v    560         bridge fdb del de:ad:be:ef:13:37 dev vxlan0 self master
561 }                                                 561 }
562                                                   562 
563 offload_indication_fdb_test()                     563 offload_indication_fdb_test()
564 {                                                 564 {
565         offload_indication_fdb_flood_test         565         offload_indication_fdb_flood_test
566         offload_indication_fdb_bridge_test        566         offload_indication_fdb_bridge_test
567 }                                                 567 }
568                                                   568 
569 offload_indication_decap_route_test()             569 offload_indication_decap_route_test()
570 {                                                 570 {
571         RET=0                                     571         RET=0
572                                                   572 
573         busywait "$TIMEOUT" wait_for_offload \    573         busywait "$TIMEOUT" wait_for_offload \
574                 ip $IP_FLAG route show table l    574                 ip $IP_FLAG route show table local $LOCAL_IP_1
575         check_err $?                              575         check_err $?
576                                                   576 
577         ip link set dev vxlan0 down               577         ip link set dev vxlan0 down
578         busywait "$TIMEOUT" wait_for_offload \    578         busywait "$TIMEOUT" wait_for_offload \
579                 ip $IP_FLAG route show table l    579                 ip $IP_FLAG route show table local $LOCAL_IP_1
580         check_err $?                              580         check_err $?
581                                                   581 
582         ip link set dev vxlan1 down               582         ip link set dev vxlan1 down
583         busywait "$TIMEOUT" not wait_for_offlo    583         busywait "$TIMEOUT" not wait_for_offload \
584                 ip $IP_FLAG route show table l    584                 ip $IP_FLAG route show table local $LOCAL_IP_1
585         check_err $?                              585         check_err $?
586                                                   586 
587         log_test "vxlan decap route - vxlan de    587         log_test "vxlan decap route - vxlan device down"
588                                                   588 
589         RET=0                                     589         RET=0
590                                                   590 
591         ip link set dev vxlan1 up                 591         ip link set dev vxlan1 up
592         busywait "$TIMEOUT" wait_for_offload \    592         busywait "$TIMEOUT" wait_for_offload \
593                 ip $IP_FLAG route show table l    593                 ip $IP_FLAG route show table local $LOCAL_IP_1
594         check_err $?                              594         check_err $?
595                                                   595 
596         ip link set dev vxlan0 up                 596         ip link set dev vxlan0 up
597         busywait "$TIMEOUT" wait_for_offload \    597         busywait "$TIMEOUT" wait_for_offload \
598                 ip $IP_FLAG route show table l    598                 ip $IP_FLAG route show table local $LOCAL_IP_1
599         check_err $?                              599         check_err $?
600                                                   600 
601         log_test "vxlan decap route - vxlan de    601         log_test "vxlan decap route - vxlan device up"
602                                                   602 
603         RET=0                                     603         RET=0
604                                                   604 
605         ip address delete $LOCAL_IP_1/$PREFIX_    605         ip address delete $LOCAL_IP_1/$PREFIX_LEN dev lo
606         busywait "$TIMEOUT" not wait_for_offlo    606         busywait "$TIMEOUT" not wait_for_offload \
607                 ip $IP_FLAG route show table l    607                 ip $IP_FLAG route show table local $LOCAL_IP_1
608         check_err $?                              608         check_err $?
609                                                   609 
610         ip address add $LOCAL_IP_1/$PREFIX_LEN    610         ip address add $LOCAL_IP_1/$PREFIX_LEN dev lo
611         busywait "$TIMEOUT" wait_for_offload \    611         busywait "$TIMEOUT" wait_for_offload \
612                 ip $IP_FLAG route show table l    612                 ip $IP_FLAG route show table local $LOCAL_IP_1
613         check_err $?                              613         check_err $?
614                                                   614 
615         log_test "vxlan decap route - add loca    615         log_test "vxlan decap route - add local route"
616                                                   616 
617         RET=0                                     617         RET=0
618                                                   618 
619         ip link set dev $swp1 nomaster            619         ip link set dev $swp1 nomaster
620         busywait "$TIMEOUT" wait_for_offload \    620         busywait "$TIMEOUT" wait_for_offload \
621                 ip $IP_FLAG route show table l    621                 ip $IP_FLAG route show table local $LOCAL_IP_1
622         check_err $?                              622         check_err $?
623                                                   623 
624         ip link set dev $swp2 nomaster            624         ip link set dev $swp2 nomaster
625         busywait "$TIMEOUT" not wait_for_offlo    625         busywait "$TIMEOUT" not wait_for_offload \
626                 ip $IP_FLAG route show table l    626                 ip $IP_FLAG route show table local $LOCAL_IP_1
627         check_err $?                              627         check_err $?
628                                                   628 
629         ip link set dev $swp1 master br0          629         ip link set dev $swp1 master br0
630         ip link set dev $swp2 master br1          630         ip link set dev $swp2 master br1
631         busywait "$TIMEOUT" wait_for_offload \    631         busywait "$TIMEOUT" wait_for_offload \
632                 ip $IP_FLAG route show table l    632                 ip $IP_FLAG route show table local $LOCAL_IP_1
633         check_err $?                              633         check_err $?
634                                                   634 
635         log_test "vxlan decap route - local po    635         log_test "vxlan decap route - local ports enslavement"
636                                                   636 
637         RET=0                                     637         RET=0
638                                                   638 
639         ip link del dev br0                       639         ip link del dev br0
640         busywait "$TIMEOUT" wait_for_offload \    640         busywait "$TIMEOUT" wait_for_offload \
641                 ip $IP_FLAG route show table l    641                 ip $IP_FLAG route show table local $LOCAL_IP_1
642         check_err $?                              642         check_err $?
643                                                   643 
644         ip link del dev br1                       644         ip link del dev br1
645         busywait "$TIMEOUT" not wait_for_offlo    645         busywait "$TIMEOUT" not wait_for_offload \
646                 ip $IP_FLAG route show table l    646                 ip $IP_FLAG route show table local $LOCAL_IP_1
647         check_err $?                              647         check_err $?
648                                                   648 
649         log_test "vxlan decap route - bridge d    649         log_test "vxlan decap route - bridge device deletion"
650                                                   650 
651         RET=0                                     651         RET=0
652                                                   652 
653         ip link add name br0 type bridge mcast    653         ip link add name br0 type bridge mcast_snooping 0
654         ip link set dev br0 addrgenmode none      654         ip link set dev br0 addrgenmode none
655         ip link set dev br0 up                    655         ip link set dev br0 up
656         ip link add name br1 type bridge mcast    656         ip link add name br1 type bridge mcast_snooping 0
657         ip link set dev br1 addrgenmode none      657         ip link set dev br1 addrgenmode none
658         ip link set dev br1 up                    658         ip link set dev br1 up
659         ip link set dev $swp1 master br0          659         ip link set dev $swp1 master br0
660         ip link set dev $swp2 master br1          660         ip link set dev $swp2 master br1
661         ip link set dev vxlan0 master br0         661         ip link set dev vxlan0 master br0
662         ip link set dev vxlan1 master br1         662         ip link set dev vxlan1 master br1
663         busywait "$TIMEOUT" wait_for_offload \    663         busywait "$TIMEOUT" wait_for_offload \
664                 ip $IP_FLAG route show table l    664                 ip $IP_FLAG route show table local $LOCAL_IP_1
665         check_err $?                              665         check_err $?
666                                                   666 
667         ip link del dev vxlan0                    667         ip link del dev vxlan0
668         busywait "$TIMEOUT" wait_for_offload \    668         busywait "$TIMEOUT" wait_for_offload \
669                 ip $IP_FLAG route show table l    669                 ip $IP_FLAG route show table local $LOCAL_IP_1
670         check_err $?                              670         check_err $?
671                                                   671 
672         ip link del dev vxlan1                    672         ip link del dev vxlan1
673         busywait "$TIMEOUT" not wait_for_offlo    673         busywait "$TIMEOUT" not wait_for_offload \
674                 ip $IP_FLAG route show table l    674                 ip $IP_FLAG route show table local $LOCAL_IP_1
675         check_err $?                              675         check_err $?
676                                                   676 
677         log_test "vxlan decap route - vxlan de    677         log_test "vxlan decap route - vxlan device deletion"
678                                                   678 
679         ip link add name vxlan0 up master br0     679         ip link add name vxlan0 up master br0 type vxlan id 10 nolearning \
680                 $UDPCSUM_FLAFS ttl 20 tos inhe    680                 $UDPCSUM_FLAFS ttl 20 tos inherit local $LOCAL_IP_1 dstport 4789
681         ip link add name vxlan1 up master br1     681         ip link add name vxlan1 up master br1 type vxlan id 20 nolearning \
682                 $UDPCSUM_FLAFS ttl 20 tos inhe    682                 $UDPCSUM_FLAFS ttl 20 tos inherit local $LOCAL_IP_1 dstport 4789
683 }                                                 683 }
684                                                   684 
685 check_fdb_offloaded()                             685 check_fdb_offloaded()
686 {                                                 686 {
687         local mac=00:11:22:33:44:55               687         local mac=00:11:22:33:44:55
688         local zmac=00:00:00:00:00:00              688         local zmac=00:00:00:00:00:00
689                                                   689 
690         busywait "$TIMEOUT" wait_for_offload g    690         busywait "$TIMEOUT" wait_for_offload grep_bridge_fdb $mac self \
691                 bridge fdb show dev vxlan0        691                 bridge fdb show dev vxlan0
692         check_err $?                              692         check_err $?
693         busywait "$TIMEOUT" wait_for_offload g    693         busywait "$TIMEOUT" wait_for_offload grep_bridge_fdb $mac master \
694                 bridge fdb show dev vxlan0        694                 bridge fdb show dev vxlan0
695         check_err $?                              695         check_err $?
696                                                   696 
697         busywait "$TIMEOUT" wait_for_offload g    697         busywait "$TIMEOUT" wait_for_offload grep_bridge_fdb $zmac self \
698                 bridge fdb show dev vxlan0        698                 bridge fdb show dev vxlan0
699         check_err $?                              699         check_err $?
700 }                                                 700 }
701                                                   701 
702 check_vxlan_fdb_not_offloaded()                   702 check_vxlan_fdb_not_offloaded()
703 {                                                 703 {
704         local mac=00:11:22:33:44:55               704         local mac=00:11:22:33:44:55
705         local zmac=00:00:00:00:00:00              705         local zmac=00:00:00:00:00:00
706                                                   706 
707         bridge fdb show dev vxlan0 | grep $mac    707         bridge fdb show dev vxlan0 | grep $mac | grep -q self
708         check_err $?                              708         check_err $?
709         busywait "$TIMEOUT" not wait_for_offlo    709         busywait "$TIMEOUT" not wait_for_offload grep_bridge_fdb $mac self \
710                 bridge fdb show dev vxlan0        710                 bridge fdb show dev vxlan0
711         check_err $?                              711         check_err $?
712                                                   712 
713         bridge fdb show dev vxlan0 | grep $zma    713         bridge fdb show dev vxlan0 | grep $zmac | grep -q self
714         check_err $?                              714         check_err $?
715         busywait "$TIMEOUT" not wait_for_offlo    715         busywait "$TIMEOUT" not wait_for_offload grep_bridge_fdb $zmac self \
716                 bridge fdb show dev vxlan0        716                 bridge fdb show dev vxlan0
717         check_err $?                              717         check_err $?
718 }                                                 718 }
719                                                   719 
720 check_bridge_fdb_not_offloaded()                  720 check_bridge_fdb_not_offloaded()
721 {                                                 721 {
722         local mac=00:11:22:33:44:55               722         local mac=00:11:22:33:44:55
723         local zmac=00:00:00:00:00:00              723         local zmac=00:00:00:00:00:00
724                                                   724 
725         bridge fdb show dev vxlan0 | grep $mac    725         bridge fdb show dev vxlan0 | grep $mac | grep -q master
726         check_err $?                              726         check_err $?
727         busywait "$TIMEOUT" not wait_for_offlo    727         busywait "$TIMEOUT" not wait_for_offload grep_bridge_fdb $mac master \
728                 bridge fdb show dev vxlan0        728                 bridge fdb show dev vxlan0
729         check_err $?                              729         check_err $?
730 }                                                 730 }
731                                                   731 
732 __offload_indication_join_vxlan_first()           732 __offload_indication_join_vxlan_first()
733 {                                                 733 {
734         local vid=$1; shift                       734         local vid=$1; shift
735                                                   735 
736         local mac=00:11:22:33:44:55               736         local mac=00:11:22:33:44:55
737         local zmac=00:00:00:00:00:00              737         local zmac=00:00:00:00:00:00
738                                                   738 
739         bridge fdb append $zmac dev vxlan0 sel    739         bridge fdb append $zmac dev vxlan0 self dst $LOCAL_IP_2
740                                                   740 
741         ip link set dev vxlan0 master br0         741         ip link set dev vxlan0 master br0
742         bridge fdb add dev vxlan0 $mac self ma    742         bridge fdb add dev vxlan0 $mac self master static dst $LOCAL_IP_2
743                                                   743 
744         RET=0                                     744         RET=0
745         check_vxlan_fdb_not_offloaded             745         check_vxlan_fdb_not_offloaded
746         ip link set dev $swp1 master br0          746         ip link set dev $swp1 master br0
747         sleep .1                                  747         sleep .1
748         check_fdb_offloaded                       748         check_fdb_offloaded
749         log_test "offload indication - attach     749         log_test "offload indication - attach vxlan first"
750                                                   750 
751         RET=0                                     751         RET=0
752         ip link set dev vxlan0 down               752         ip link set dev vxlan0 down
753         check_vxlan_fdb_not_offloaded             753         check_vxlan_fdb_not_offloaded
754         check_bridge_fdb_not_offloaded            754         check_bridge_fdb_not_offloaded
755         log_test "offload indication - set vxl    755         log_test "offload indication - set vxlan down"
756                                                   756 
757         RET=0                                     757         RET=0
758         ip link set dev vxlan0 up                 758         ip link set dev vxlan0 up
759         sleep .1                                  759         sleep .1
760         check_fdb_offloaded                       760         check_fdb_offloaded
761         log_test "offload indication - set vxl    761         log_test "offload indication - set vxlan up"
762                                                   762 
763         if [[ ! -z $vid ]]; then                  763         if [[ ! -z $vid ]]; then
764                 RET=0                             764                 RET=0
765                 bridge vlan del dev vxlan0 vid    765                 bridge vlan del dev vxlan0 vid $vid
766                 check_vxlan_fdb_not_offloaded     766                 check_vxlan_fdb_not_offloaded
767                 check_bridge_fdb_not_offloaded    767                 check_bridge_fdb_not_offloaded
768                 log_test "offload indication -    768                 log_test "offload indication - delete VLAN"
769                                                   769 
770                 RET=0                             770                 RET=0
771                 bridge vlan add dev vxlan0 vid    771                 bridge vlan add dev vxlan0 vid $vid
772                 check_vxlan_fdb_not_offloaded     772                 check_vxlan_fdb_not_offloaded
773                 check_bridge_fdb_not_offloaded    773                 check_bridge_fdb_not_offloaded
774                 log_test "offload indication -    774                 log_test "offload indication - add tagged VLAN"
775                                                   775 
776                 RET=0                             776                 RET=0
777                 bridge vlan add dev vxlan0 vid    777                 bridge vlan add dev vxlan0 vid $vid pvid untagged
778                 sleep .1                          778                 sleep .1
779                 check_fdb_offloaded               779                 check_fdb_offloaded
780                 log_test "offload indication -    780                 log_test "offload indication - add pvid/untagged VLAN"
781         fi                                        781         fi
782                                                   782 
783         RET=0                                     783         RET=0
784         ip link set dev $swp1 nomaster            784         ip link set dev $swp1 nomaster
785         check_vxlan_fdb_not_offloaded             785         check_vxlan_fdb_not_offloaded
786         log_test "offload indication - detach     786         log_test "offload indication - detach port"
787 }                                                 787 }
788                                                   788 
789 offload_indication_join_vxlan_first()             789 offload_indication_join_vxlan_first()
790 {                                                 790 {
791         ip link add dev br0 type bridge mcast_    791         ip link add dev br0 type bridge mcast_snooping 0
792         ip link set dev br0 addrgenmode none      792         ip link set dev br0 addrgenmode none
793         ip link set dev br0 up                    793         ip link set dev br0 up
794         ip link add name vxlan0 up type vxlan     794         ip link add name vxlan0 up type vxlan id 10 nolearning $UDPCSUM_FLAFS \
795                 ttl 20 tos inherit local $LOCA    795                 ttl 20 tos inherit local $LOCAL_IP_1 dstport 4789
796                                                   796 
797         __offload_indication_join_vxlan_first     797         __offload_indication_join_vxlan_first
798                                                   798 
799         ip link del dev vxlan0                    799         ip link del dev vxlan0
800         ip link del dev br0                       800         ip link del dev br0
801 }                                                 801 }
802                                                   802 
803 __offload_indication_join_vxlan_last()            803 __offload_indication_join_vxlan_last()
804 {                                                 804 {
805         local zmac=00:00:00:00:00:00              805         local zmac=00:00:00:00:00:00
806                                                   806 
807         RET=0                                     807         RET=0
808                                                   808 
809         bridge fdb append $zmac dev vxlan0 sel    809         bridge fdb append $zmac dev vxlan0 self dst $LOCAL_IP_2
810                                                   810 
811         ip link set dev $swp1 master br0          811         ip link set dev $swp1 master br0
812                                                   812 
813         busywait "$TIMEOUT" not wait_for_offlo    813         busywait "$TIMEOUT" not wait_for_offload grep_bridge_fdb $zmac self \
814                 bridge fdb show dev vxlan0        814                 bridge fdb show dev vxlan0
815         check_err $?                              815         check_err $?
816                                                   816 
817         ip link set dev vxlan0 master br0         817         ip link set dev vxlan0 master br0
818                                                   818 
819         busywait "$TIMEOUT" wait_for_offload g    819         busywait "$TIMEOUT" wait_for_offload grep_bridge_fdb $zmac self \
820                 bridge fdb show dev vxlan0        820                 bridge fdb show dev vxlan0
821         check_err $?                              821         check_err $?
822                                                   822 
823         log_test "offload indication - attach     823         log_test "offload indication - attach vxlan last"
824 }                                                 824 }
825                                                   825 
826 offload_indication_join_vxlan_last()              826 offload_indication_join_vxlan_last()
827 {                                                 827 {
828         ip link add dev br0 type bridge mcast_    828         ip link add dev br0 type bridge mcast_snooping 0
829         ip link set dev br0 addrgenmode none      829         ip link set dev br0 addrgenmode none
830         ip link set dev br0 up                    830         ip link set dev br0 up
831         ip link add name vxlan0 up type vxlan     831         ip link add name vxlan0 up type vxlan id 10 nolearning $UDPCSUM_FLAFS \
832                 ttl 20 tos inherit local $LOCA    832                 ttl 20 tos inherit local $LOCAL_IP_1 dstport 4789
833                                                   833 
834         __offload_indication_join_vxlan_last      834         __offload_indication_join_vxlan_last
835                                                   835 
836         ip link del dev vxlan0                    836         ip link del dev vxlan0
837         ip link del dev br0                       837         ip link del dev br0
838 }                                                 838 }
839                                                   839 
840 offload_indication_test()                         840 offload_indication_test()
841 {                                                 841 {
842         offload_indication_setup_create           842         offload_indication_setup_create
843         offload_indication_fdb_test               843         offload_indication_fdb_test
844         offload_indication_decap_route_test       844         offload_indication_decap_route_test
845         offload_indication_setup_destroy          845         offload_indication_setup_destroy
846                                                   846 
847         log_info "offload indication - replay     847         log_info "offload indication - replay & cleanup"
848         offload_indication_join_vxlan_first       848         offload_indication_join_vxlan_first
849         offload_indication_join_vxlan_last        849         offload_indication_join_vxlan_last
850 }                                                 850 }
851                                                   851 
852 sanitization_vlan_aware_test()                    852 sanitization_vlan_aware_test()
853 {                                                 853 {
854         RET=0                                     854         RET=0
855                                                   855 
856         ip link add dev br0 type bridge mcast_    856         ip link add dev br0 type bridge mcast_snooping 0 vlan_filtering 1
857         ip link set dev br0 addrgenmode none      857         ip link set dev br0 addrgenmode none
858                                                   858 
859         ip link add name vxlan10 up master br0    859         ip link add name vxlan10 up master br0 type vxlan id 10 nolearning \
860                 $UDPCSUM_FLAFS ttl 20 tos inhe    860                 $UDPCSUM_FLAFS ttl 20 tos inherit local $LOCAL_IP_1 dstport 4789
861                                                   861 
862         ip link add name vxlan20 up master br0    862         ip link add name vxlan20 up master br0 type vxlan id 20 nolearning \
863                 $UDPCSUM_FLAFS ttl 20 tos inhe    863                 $UDPCSUM_FLAFS ttl 20 tos inherit local $LOCAL_IP_1 dstport 4789
864                                                   864 
865         # Test that when each VNI is mapped to    865         # Test that when each VNI is mapped to a different VLAN we can enslave
866         # a port to the bridge                    866         # a port to the bridge
867         bridge vlan add vid 10 dev vxlan10 pvi    867         bridge vlan add vid 10 dev vxlan10 pvid untagged
868         bridge vlan add vid 20 dev vxlan20 pvi    868         bridge vlan add vid 20 dev vxlan20 pvid untagged
869                                                   869 
870         ip link set dev $swp1 master br0          870         ip link set dev $swp1 master br0
871         check_err $?                              871         check_err $?
872                                                   872 
873         log_test "vlan-aware - enslavement to     873         log_test "vlan-aware - enslavement to vlan-aware bridge"
874                                                   874 
875         # Try to map both VNIs to the same VLA    875         # Try to map both VNIs to the same VLAN and make sure configuration
876         # fails                                   876         # fails
877         RET=0                                     877         RET=0
878                                                   878 
879         bridge vlan add vid 10 dev vxlan20 pvi    879         bridge vlan add vid 10 dev vxlan20 pvid untagged &> /dev/null
880         check_fail $?                             880         check_fail $?
881                                                   881 
882         log_test "vlan-aware - two vnis mapped    882         log_test "vlan-aware - two vnis mapped to the same vlan"
883                                                   883 
884         # Test that enslavement of a port to a    884         # Test that enslavement of a port to a bridge fails when two VNIs
885         # are mapped to the same VLAN             885         # are mapped to the same VLAN
886         RET=0                                     886         RET=0
887                                                   887 
888         ip link set dev $swp1 nomaster            888         ip link set dev $swp1 nomaster
889                                                   889 
890         bridge vlan del vid 20 dev vxlan20 pvi    890         bridge vlan del vid 20 dev vxlan20 pvid untagged
891         bridge vlan add vid 10 dev vxlan20 pvi    891         bridge vlan add vid 10 dev vxlan20 pvid untagged
892                                                   892 
893         ip link set dev $swp1 master br0 &> /d    893         ip link set dev $swp1 master br0 &> /dev/null
894         check_fail $?                             894         check_fail $?
895                                                   895 
896         log_test "vlan-aware - failed enslavem    896         log_test "vlan-aware - failed enslavement to vlan-aware bridge"
897                                                   897 
898         bridge vlan del vid 10 dev vxlan20        898         bridge vlan del vid 10 dev vxlan20
899         bridge vlan add vid 20 dev vxlan20 pvi    899         bridge vlan add vid 20 dev vxlan20 pvid untagged
900                                                   900 
901         # Test that when two VXLAN tunnels wit    901         # Test that when two VXLAN tunnels with conflicting configurations
902         # (i.e., different TTL) are enslaved t    902         # (i.e., different TTL) are enslaved to the same VLAN-aware bridge,
903         # then the enslavement of a port to th    903         # then the enslavement of a port to the bridge is denied.
904                                                   904 
905         # Use the offload indication of the lo    905         # Use the offload indication of the local route to ensure the VXLAN
906         # configuration was correctly rollback    906         # configuration was correctly rollbacked.
907         ip address add $LOCAL_IP_1/$PREFIX_LEN    907         ip address add $LOCAL_IP_1/$PREFIX_LEN dev lo
908                                                   908 
909         ip link set dev vxlan10 type vxlan ttl    909         ip link set dev vxlan10 type vxlan ttl 10
910         ip link set dev $swp1 master br0 &> /d    910         ip link set dev $swp1 master br0 &> /dev/null
911         check_fail $?                             911         check_fail $?
912                                                   912 
913         busywait "$TIMEOUT" not wait_for_offlo    913         busywait "$TIMEOUT" not wait_for_offload \
914                 ip $IP_FLAG route show table l    914                 ip $IP_FLAG route show table local $LOCAL_IP_1
915         check_err $?                              915         check_err $?
916                                                   916 
917         log_test "vlan-aware - failed enslavem    917         log_test "vlan-aware - failed enslavement to bridge due to conflict"
918                                                   918 
919         ip link set dev vxlan10 type vxlan ttl    919         ip link set dev vxlan10 type vxlan ttl 20
920         ip address del $LOCAL_IP_1/$PREFIX_LEN    920         ip address del $LOCAL_IP_1/$PREFIX_LEN dev lo
921                                                   921 
922         ip link del dev vxlan20                   922         ip link del dev vxlan20
923         ip link del dev vxlan10                   923         ip link del dev vxlan10
924         ip link del dev br0                       924         ip link del dev br0
925 }                                                 925 }
926                                                   926 
927 offload_indication_vlan_aware_setup_create()      927 offload_indication_vlan_aware_setup_create()
928 {                                                 928 {
929         # Create a simple setup with two VxLAN    929         # Create a simple setup with two VxLAN devices and a single VLAN-aware
930         # bridge                                  930         # bridge
931         ip link add name br0 type bridge mcast    931         ip link add name br0 type bridge mcast_snooping 0 vlan_filtering 1 \
932                 vlan_default_pvid 0               932                 vlan_default_pvid 0
933         ip link set dev br0 addrgenmode none      933         ip link set dev br0 addrgenmode none
934         ip link set dev br0 up                    934         ip link set dev br0 up
935                                                   935 
936         ip link set dev $swp1 master br0          936         ip link set dev $swp1 master br0
937                                                   937 
938         bridge vlan add vid 10 dev $swp1          938         bridge vlan add vid 10 dev $swp1
939         bridge vlan add vid 20 dev $swp1          939         bridge vlan add vid 20 dev $swp1
940                                                   940 
941         ip address add $LOCAL_IP_1/$PREFIX_LEN    941         ip address add $LOCAL_IP_1/$PREFIX_LEN dev lo
942                                                   942 
943         ip link add name vxlan10 up master br0    943         ip link add name vxlan10 up master br0 type vxlan id 10 nolearning \
944                 $UDPCSUM_FLAFS ttl 20 tos inhe    944                 $UDPCSUM_FLAFS ttl 20 tos inherit local $LOCAL_IP_1 dstport 4789
945         ip link add name vxlan20 up master br0    945         ip link add name vxlan20 up master br0 type vxlan id 20 nolearning \
946                 $UDPCSUM_FLAFS ttl 20 tos inhe    946                 $UDPCSUM_FLAFS ttl 20 tos inherit local $LOCAL_IP_1 dstport 4789
947                                                   947 
948         bridge vlan add vid 10 dev vxlan10 pvi    948         bridge vlan add vid 10 dev vxlan10 pvid untagged
949         bridge vlan add vid 20 dev vxlan20 pvi    949         bridge vlan add vid 20 dev vxlan20 pvid untagged
950 }                                                 950 }
951                                                   951 
952 offload_indication_vlan_aware_setup_destroy()     952 offload_indication_vlan_aware_setup_destroy()
953 {                                                 953 {
954         bridge vlan del vid 20 dev vxlan20        954         bridge vlan del vid 20 dev vxlan20
955         bridge vlan del vid 10 dev vxlan10        955         bridge vlan del vid 10 dev vxlan10
956                                                   956 
957         ip link del dev vxlan20                   957         ip link del dev vxlan20
958         ip link del dev vxlan10                   958         ip link del dev vxlan10
959                                                   959 
960         ip address del $LOCAL_IP_1/$PREFIX_LEN    960         ip address del $LOCAL_IP_1/$PREFIX_LEN dev lo
961                                                   961 
962         bridge vlan del vid 20 dev $swp1          962         bridge vlan del vid 20 dev $swp1
963         bridge vlan del vid 10 dev $swp1          963         bridge vlan del vid 10 dev $swp1
964                                                   964 
965         ip link set dev $swp1 nomaster            965         ip link set dev $swp1 nomaster
966                                                   966 
967         ip link del dev br0                       967         ip link del dev br0
968 }                                                 968 }
969                                                   969 
970 offload_indication_vlan_aware_fdb_test()          970 offload_indication_vlan_aware_fdb_test()
971 {                                                 971 {
972         RET=0                                     972         RET=0
973                                                   973 
974         log_info "vxlan entry offload indicati    974         log_info "vxlan entry offload indication - vlan-aware"
975                                                   975 
976         bridge fdb add de:ad:be:ef:13:37 dev v    976         bridge fdb add de:ad:be:ef:13:37 dev vxlan10 self master static \
977                 dst $LOCAL_IP_2 vlan 10           977                 dst $LOCAL_IP_2 vlan 10
978                                                   978 
979         busywait "$TIMEOUT" wait_for_offload g    979         busywait "$TIMEOUT" wait_for_offload grep_bridge_fdb \
980                 de:ad:be:ef:13:37 self bridge     980                 de:ad:be:ef:13:37 self bridge fdb show brport vxlan10
981         check_err $?                              981         check_err $?
982         busywait "$TIMEOUT" wait_for_offload g    982         busywait "$TIMEOUT" wait_for_offload grep_bridge_fdb \
983                 de:ad:be:ef:13:37 self -v brid    983                 de:ad:be:ef:13:37 self -v bridge fdb show brport vxlan10
984         check_err $?                              984         check_err $?
985                                                   985 
986         log_test "vxlan entry offload indicati    986         log_test "vxlan entry offload indication - initial state"
987                                                   987 
988         # Remove FDB entry from the bridge dri    988         # Remove FDB entry from the bridge driver and check that corresponding
989         # entry in the VxLAN driver is not mar    989         # entry in the VxLAN driver is not marked as offloaded
990         RET=0                                     990         RET=0
991                                                   991 
992         bridge fdb del de:ad:be:ef:13:37 dev v    992         bridge fdb del de:ad:be:ef:13:37 dev vxlan10 master vlan 10
993         busywait "$TIMEOUT" not wait_for_offlo    993         busywait "$TIMEOUT" not wait_for_offload grep_bridge_fdb \
994                 de:ad:be:ef:13:37 self bridge     994                 de:ad:be:ef:13:37 self bridge fdb show brport vxlan10
995         check_err $?                              995         check_err $?
996                                                   996 
997         log_test "vxlan entry offload indicati    997         log_test "vxlan entry offload indication - after removal from bridge"
998                                                   998 
999         # Add the FDB entry back to the bridge    999         # Add the FDB entry back to the bridge driver and make sure it is
1000         # marked as offloaded in both drivers    1000         # marked as offloaded in both drivers
1001         RET=0                                    1001         RET=0
1002                                                  1002 
1003         bridge fdb add de:ad:be:ef:13:37 dev     1003         bridge fdb add de:ad:be:ef:13:37 dev vxlan10 master static vlan 10
1004         busywait "$TIMEOUT" wait_for_offload     1004         busywait "$TIMEOUT" wait_for_offload grep_bridge_fdb \
1005                 de:ad:be:ef:13:37 self bridge    1005                 de:ad:be:ef:13:37 self bridge fdb show brport vxlan10
1006         check_err $?                             1006         check_err $?
1007         busywait "$TIMEOUT" wait_for_offload     1007         busywait "$TIMEOUT" wait_for_offload grep_bridge_fdb \
1008                 de:ad:be:ef:13:37 self -v bri    1008                 de:ad:be:ef:13:37 self -v bridge fdb show brport vxlan10
1009         check_err $?                             1009         check_err $?
1010                                                  1010 
1011         log_test "vxlan entry offload indicat    1011         log_test "vxlan entry offload indication - after re-add to bridge"
1012                                                  1012 
1013         # Remove FDB entry from the VxLAN dri    1013         # Remove FDB entry from the VxLAN driver and check that corresponding
1014         # entry in the bridge driver is not m    1014         # entry in the bridge driver is not marked as offloaded
1015         RET=0                                    1015         RET=0
1016                                                  1016 
1017         bridge fdb del de:ad:be:ef:13:37 dev     1017         bridge fdb del de:ad:be:ef:13:37 dev vxlan10 self
1018         busywait "$TIMEOUT" not wait_for_offl    1018         busywait "$TIMEOUT" not wait_for_offload grep_bridge_fdb \
1019                 de:ad:be:ef:13:37 self -v bri    1019                 de:ad:be:ef:13:37 self -v bridge fdb show brport vxlan10
1020         check_err $?                             1020         check_err $?
1021                                                  1021 
1022         log_test "vxlan entry offload indicat    1022         log_test "vxlan entry offload indication - after removal from vxlan"
1023                                                  1023 
1024         # Add the FDB entry back to the VxLAN    1024         # Add the FDB entry back to the VxLAN driver and make sure it is
1025         # marked as offloaded in both drivers    1025         # marked as offloaded in both drivers
1026         RET=0                                    1026         RET=0
1027                                                  1027 
1028         bridge fdb add de:ad:be:ef:13:37 dev     1028         bridge fdb add de:ad:be:ef:13:37 dev vxlan10 self dst $LOCAL_IP_2
1029         busywait "$TIMEOUT" wait_for_offload     1029         busywait "$TIMEOUT" wait_for_offload grep_bridge_fdb \
1030                 de:ad:be:ef:13:37 self bridge    1030                 de:ad:be:ef:13:37 self bridge fdb show brport vxlan10
1031         check_err $?                             1031         check_err $?
1032         busywait "$TIMEOUT" wait_for_offload     1032         busywait "$TIMEOUT" wait_for_offload grep_bridge_fdb \
1033                 de:ad:be:ef:13:37 self -v bri    1033                 de:ad:be:ef:13:37 self -v bridge fdb show brport vxlan10
1034         check_err $?                             1034         check_err $?
1035                                                  1035 
1036         log_test "vxlan entry offload indicat    1036         log_test "vxlan entry offload indication - after re-add to vxlan"
1037                                                  1037 
1038         bridge fdb del de:ad:be:ef:13:37 dev     1038         bridge fdb del de:ad:be:ef:13:37 dev vxlan10 self master vlan 10
1039 }                                                1039 }
1040                                                  1040 
1041 offload_indication_vlan_aware_decap_route_tes    1041 offload_indication_vlan_aware_decap_route_test()
1042 {                                                1042 {
1043         RET=0                                    1043         RET=0
1044                                                  1044 
1045         busywait "$TIMEOUT" wait_for_offload     1045         busywait "$TIMEOUT" wait_for_offload \
1046                 ip $IP_FLAG route show table     1046                 ip $IP_FLAG route show table local $LOCAL_IP_1
1047         check_err $?                             1047         check_err $?
1048                                                  1048 
1049         # Toggle PVID flag on one VxLAN devic    1049         # Toggle PVID flag on one VxLAN device and make sure route is still
1050         # marked as offloaded                    1050         # marked as offloaded
1051         bridge vlan add vid 10 dev vxlan10 un    1051         bridge vlan add vid 10 dev vxlan10 untagged
1052                                                  1052 
1053         busywait "$TIMEOUT" wait_for_offload     1053         busywait "$TIMEOUT" wait_for_offload \
1054                 ip $IP_FLAG route show table     1054                 ip $IP_FLAG route show table local $LOCAL_IP_1
1055         check_err $?                             1055         check_err $?
1056                                                  1056 
1057         # Toggle PVID flag on second VxLAN de    1057         # Toggle PVID flag on second VxLAN device and make sure route is no
1058         # longer marked as offloaded             1058         # longer marked as offloaded
1059         bridge vlan add vid 20 dev vxlan20 un    1059         bridge vlan add vid 20 dev vxlan20 untagged
1060                                                  1060 
1061         busywait "$TIMEOUT" not wait_for_offl    1061         busywait "$TIMEOUT" not wait_for_offload \
1062                 ip $IP_FLAG route show table     1062                 ip $IP_FLAG route show table local $LOCAL_IP_1
1063         check_err $?                             1063         check_err $?
1064                                                  1064 
1065         # Toggle PVID flag back and make sure    1065         # Toggle PVID flag back and make sure route is marked as offloaded
1066         bridge vlan add vid 10 dev vxlan10 pv    1066         bridge vlan add vid 10 dev vxlan10 pvid untagged
1067         bridge vlan add vid 20 dev vxlan20 pv    1067         bridge vlan add vid 20 dev vxlan20 pvid untagged
1068                                                  1068 
1069         busywait "$TIMEOUT" wait_for_offload     1069         busywait "$TIMEOUT" wait_for_offload ip $IP_FLAG route show table local \
1070                 $LOCAL_IP_1                      1070                 $LOCAL_IP_1
1071         check_err $?                             1071         check_err $?
1072                                                  1072 
1073         log_test "vxlan decap route - vni map    1073         log_test "vxlan decap route - vni map/unmap"
1074 }                                                1074 }
1075                                                  1075 
1076 offload_indication_vlan_aware_join_vxlan_firs    1076 offload_indication_vlan_aware_join_vxlan_first()
1077 {                                                1077 {
1078         ip link add dev br0 type bridge mcast    1078         ip link add dev br0 type bridge mcast_snooping 0 \
1079                 vlan_filtering 1 vlan_default    1079                 vlan_filtering 1 vlan_default_pvid 1
1080         ip link set dev br0 addrgenmode none     1080         ip link set dev br0 addrgenmode none
1081         ip link set dev br0 up                   1081         ip link set dev br0 up
1082         ip link add name vxlan0 up type vxlan    1082         ip link add name vxlan0 up type vxlan id 10 nolearning $UDPCSUM_FLAFS \
1083                 ttl 20 tos inherit local $LOC    1083                 ttl 20 tos inherit local $LOCAL_IP_1 dstport 4789
1084                                                  1084 
1085         __offload_indication_join_vxlan_first    1085         __offload_indication_join_vxlan_first 1
1086                                                  1086 
1087         ip link del dev vxlan0                   1087         ip link del dev vxlan0
1088         ip link del dev br0                      1088         ip link del dev br0
1089 }                                                1089 }
1090                                                  1090 
1091 offload_indication_vlan_aware_join_vxlan_last    1091 offload_indication_vlan_aware_join_vxlan_last()
1092 {                                                1092 {
1093         ip link add dev br0 type bridge mcast    1093         ip link add dev br0 type bridge mcast_snooping 0 \
1094                 vlan_filtering 1 vlan_default    1094                 vlan_filtering 1 vlan_default_pvid 1
1095         ip link set dev br0 addrgenmode none     1095         ip link set dev br0 addrgenmode none
1096         ip link set dev br0 up                   1096         ip link set dev br0 up
1097         ip link add name vxlan0 up type vxlan    1097         ip link add name vxlan0 up type vxlan id 10 nolearning $UDPCSUM_FLAFS \
1098                 ttl 20 tos inherit local $LOC    1098                 ttl 20 tos inherit local $LOCAL_IP_1 dstport 4789
1099                                                  1099 
1100         __offload_indication_join_vxlan_last     1100         __offload_indication_join_vxlan_last
1101                                                  1101 
1102         ip link del dev vxlan0                   1102         ip link del dev vxlan0
1103         ip link del dev br0                      1103         ip link del dev br0
1104 }                                                1104 }
1105                                                  1105 
1106 offload_indication_vlan_aware_l3vni_test()       1106 offload_indication_vlan_aware_l3vni_test()
1107 {                                                1107 {
1108         local zmac=00:00:00:00:00:00             1108         local zmac=00:00:00:00:00:00
1109                                                  1109 
1110         RET=0                                    1110         RET=0
1111                                                  1111 
1112         sysctl_set net.ipv6.conf.default.disa    1112         sysctl_set net.ipv6.conf.default.disable_ipv6 1
1113         ip link add dev br0 type bridge mcast    1113         ip link add dev br0 type bridge mcast_snooping 0 \
1114                 vlan_filtering 1 vlan_default    1114                 vlan_filtering 1 vlan_default_pvid 0
1115         ip link set dev br0 addrgenmode none     1115         ip link set dev br0 addrgenmode none
1116         ip link set dev br0 up                   1116         ip link set dev br0 up
1117         ip link add name vxlan0 up type vxlan    1117         ip link add name vxlan0 up type vxlan id 10 nolearning $UDPCSUM_FLAFS \
1118                 ttl 20 tos inherit local $LOC    1118                 ttl 20 tos inherit local $LOCAL_IP_1 dstport 4789
1119                                                  1119 
1120         ip link set dev $swp1 master br0         1120         ip link set dev $swp1 master br0
1121                                                  1121 
1122         # The test will use the offload indic    1122         # The test will use the offload indication on the FDB entry to
1123         # understand if the tunnel is offload    1123         # understand if the tunnel is offloaded or not
1124         bridge fdb append $zmac dev vxlan0 se    1124         bridge fdb append $zmac dev vxlan0 self dst $LOCAL_IP_2
1125                                                  1125 
1126         ip link set dev vxlan0 master br0        1126         ip link set dev vxlan0 master br0
1127         bridge vlan add dev vxlan0 vid 10 pvi    1127         bridge vlan add dev vxlan0 vid 10 pvid untagged
1128                                                  1128 
1129         busywait "$TIMEOUT" wait_for_offload     1129         busywait "$TIMEOUT" wait_for_offload grep_bridge_fdb $zmac self \
1130                 bridge fdb show brport vxlan0    1130                 bridge fdb show brport vxlan0
1131         check_err $? "vxlan tunnel not offloa    1131         check_err $? "vxlan tunnel not offloaded when should"
1132                                                  1132 
1133         # Configure a VLAN interface and make    1133         # Configure a VLAN interface and make sure tunnel is offloaded
1134         ip link add link br0 name br10 up typ    1134         ip link add link br0 name br10 up type vlan id 10
1135         sysctl_set net.ipv6.conf.br10.disable    1135         sysctl_set net.ipv6.conf.br10.disable_ipv6 0
1136         ip -6 address add 2001:db8:1::1/64 de    1136         ip -6 address add 2001:db8:1::1/64 dev br10
1137         busywait "$TIMEOUT" wait_for_offload     1137         busywait "$TIMEOUT" wait_for_offload grep_bridge_fdb $zmac self \
1138                 bridge fdb show brport vxlan0    1138                 bridge fdb show brport vxlan0
1139         check_err $? "vxlan tunnel not offloa    1139         check_err $? "vxlan tunnel not offloaded when should"
1140                                                  1140 
1141         # Unlink the VXLAN device, make sure     1141         # Unlink the VXLAN device, make sure tunnel is no longer offloaded,
1142         # then add it back to the bridge and     1142         # then add it back to the bridge and make sure it is offloaded
1143         ip link set dev vxlan0 nomaster          1143         ip link set dev vxlan0 nomaster
1144         busywait "$TIMEOUT" not wait_for_offl    1144         busywait "$TIMEOUT" not wait_for_offload grep_bridge_fdb $zmac self \
1145                 bridge fdb show brport vxlan0    1145                 bridge fdb show brport vxlan0
1146         check_err $? "vxlan tunnel offloaded     1146         check_err $? "vxlan tunnel offloaded after unlinked from bridge"
1147                                                  1147 
1148         ip link set dev vxlan0 master br0        1148         ip link set dev vxlan0 master br0
1149         busywait "$TIMEOUT" not wait_for_offl    1149         busywait "$TIMEOUT" not wait_for_offload grep_bridge_fdb $zmac self \
1150                 bridge fdb show brport vxlan0    1150                 bridge fdb show brport vxlan0
1151         check_err $? "vxlan tunnel offloaded     1151         check_err $? "vxlan tunnel offloaded despite no matching vid"
1152                                                  1152 
1153         bridge vlan add dev vxlan0 vid 10 pvi    1153         bridge vlan add dev vxlan0 vid 10 pvid untagged
1154         busywait "$TIMEOUT" wait_for_offload     1154         busywait "$TIMEOUT" wait_for_offload grep_bridge_fdb $zmac self \
1155                 bridge fdb show brport vxlan0    1155                 bridge fdb show brport vxlan0
1156         check_err $? "vxlan tunnel not offloa    1156         check_err $? "vxlan tunnel not offloaded after adding vid"
1157                                                  1157 
1158         log_test "vxlan - l3 vni"                1158         log_test "vxlan - l3 vni"
1159                                                  1159 
1160         ip link del dev vxlan0                   1160         ip link del dev vxlan0
1161         ip link del dev br0                      1161         ip link del dev br0
1162         sysctl_restore net.ipv6.conf.default.    1162         sysctl_restore net.ipv6.conf.default.disable_ipv6
1163 }                                                1163 }
1164                                                  1164 
1165 offload_indication_vlan_aware_test()             1165 offload_indication_vlan_aware_test()
1166 {                                                1166 {
1167         offload_indication_vlan_aware_setup_c    1167         offload_indication_vlan_aware_setup_create
1168         offload_indication_vlan_aware_fdb_tes    1168         offload_indication_vlan_aware_fdb_test
1169         offload_indication_vlan_aware_decap_r    1169         offload_indication_vlan_aware_decap_route_test
1170         offload_indication_vlan_aware_setup_d    1170         offload_indication_vlan_aware_setup_destroy
1171                                                  1171 
1172         log_info "offload indication - replay    1172         log_info "offload indication - replay & cleanup - vlan aware"
1173         offload_indication_vlan_aware_join_vx    1173         offload_indication_vlan_aware_join_vxlan_first
1174         offload_indication_vlan_aware_join_vx    1174         offload_indication_vlan_aware_join_vxlan_last
1175         offload_indication_vlan_aware_l3vni_t    1175         offload_indication_vlan_aware_l3vni_test
1176 }                                                1176 }
1177                                                  1177 
1178 trap cleanup EXIT                                1178 trap cleanup EXIT
1179                                                  1179 
1180 setup_prepare                                    1180 setup_prepare
1181 setup_wait                                       1181 setup_wait
1182                                                  1182 
1183 tests_run                                        1183 tests_run
1184                                                  1184 
1185 exit $EXIT_STATUS                                1185 exit $EXIT_STATUS
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php