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

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/drivers/net/mlxsw/mirror_gre.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 ] ~

  1 #!/bin/bash
  2 # SPDX-License-Identifier: GPL-2.0
  3 
  4 # This test uses standard topology for testing gretap. See
  5 # ../../../net/forwarding/mirror_gre_topo_lib.sh for more details.
  6 #
  7 # Test offloading various features of offloading gretap mirrors specific to
  8 # mlxsw.
  9 
 10 lib_dir=$(dirname $0)/../../../net/forwarding
 11 
 12 NUM_NETIFS=6
 13 source $lib_dir/lib.sh
 14 source $lib_dir/mirror_lib.sh
 15 source $lib_dir/mirror_gre_lib.sh
 16 source $lib_dir/mirror_gre_topo_lib.sh
 17 
 18 ALL_TESTS="
 19         test_keyful
 20         test_soft
 21         test_tos_fixed
 22         test_ttl_inherit
 23 "
 24 
 25 setup_keyful()
 26 {
 27         tunnel_create gt6-key ip6gretap 2001:db8:3::1 2001:db8:3::2 \
 28                       ttl 100 tos inherit allow-localremote \
 29                       key 1234
 30 
 31         tunnel_create h3-gt6-key ip6gretap 2001:db8:3::2 2001:db8:3::1 \
 32                       key 1234
 33         ip link set h3-gt6-key vrf v$h3
 34         matchall_sink_create h3-gt6-key
 35 
 36         ip address add dev $swp3 2001:db8:3::1/64
 37         ip address add dev $h3 2001:db8:3::2/64
 38 }
 39 
 40 cleanup_keyful()
 41 {
 42         ip address del dev $h3 2001:db8:3::2/64
 43         ip address del dev $swp3 2001:db8:3::1/64
 44 
 45         tunnel_destroy h3-gt6-key
 46         tunnel_destroy gt6-key
 47 }
 48 
 49 setup_soft()
 50 {
 51         # Set up a topology for testing underlay routes that point at an
 52         # unsupported soft device.
 53 
 54         tunnel_create gt6-soft ip6gretap 2001:db8:4::1 2001:db8:4::2 \
 55                       ttl 100 tos inherit allow-localremote
 56 
 57         tunnel_create h3-gt6-soft ip6gretap 2001:db8:4::2 2001:db8:4::1
 58         ip link set h3-gt6-soft vrf v$h3
 59         matchall_sink_create h3-gt6-soft
 60 
 61         ip link add name v1 type veth peer name v2
 62         ip link set dev v1 up
 63         ip address add dev v1 2001:db8:4::1/64
 64 
 65         ip link set dev v2 vrf v$h3
 66         ip link set dev v2 up
 67         ip address add dev v2 2001:db8:4::2/64
 68 }
 69 
 70 cleanup_soft()
 71 {
 72         ip link del dev v1
 73 
 74         tunnel_destroy h3-gt6-soft
 75         tunnel_destroy gt6-soft
 76 }
 77 
 78 setup_prepare()
 79 {
 80         h1=${NETIFS[p1]}
 81         swp1=${NETIFS[p2]}
 82 
 83         swp2=${NETIFS[p3]}
 84         h2=${NETIFS[p4]}
 85 
 86         swp3=${NETIFS[p5]}
 87         h3=${NETIFS[p6]}
 88 
 89         vrf_prepare
 90         mirror_gre_topo_create
 91 
 92         ip address add dev $swp3 2001:db8:2::1/64
 93         ip address add dev $h3 2001:db8:2::2/64
 94 
 95         ip address add dev $swp3 192.0.2.129/28
 96         ip address add dev $h3 192.0.2.130/28
 97 
 98         setup_keyful
 99         setup_soft
100 }
101 
102 cleanup()
103 {
104         pre_cleanup
105 
106         cleanup_soft
107         cleanup_keyful
108 
109         ip address del dev $h3 2001:db8:2::2/64
110         ip address del dev $swp3 2001:db8:2::1/64
111 
112         ip address del dev $h3 192.0.2.130/28
113         ip address del dev $swp3 192.0.2.129/28
114 
115         mirror_gre_topo_destroy
116         vrf_cleanup
117 }
118 
119 test_span_gre_ttl_inherit()
120 {
121         local tundev=$1; shift
122         local type=$1; shift
123         local what=$1; shift
124 
125         RET=0
126 
127         ip link set dev $tundev type $type ttl inherit
128         mirror_install $swp1 ingress $tundev "matchall"
129         fail_test_span_gre_dir $tundev
130 
131         ip link set dev $tundev type $type ttl 100
132 
133         quick_test_span_gre_dir $tundev
134         mirror_uninstall $swp1 ingress
135 
136         log_test "$what: no offload on TTL of inherit"
137 }
138 
139 test_span_gre_tos_fixed()
140 {
141         local tundev=$1; shift
142         local type=$1; shift
143         local what=$1; shift
144 
145         RET=0
146 
147         ip link set dev $tundev type $type tos 0x10
148         mirror_install $swp1 ingress $tundev "matchall"
149         fail_test_span_gre_dir $tundev
150 
151         ip link set dev $tundev type $type tos inherit
152         quick_test_span_gre_dir $tundev
153         mirror_uninstall $swp1 ingress
154 
155         log_test "$what: no offload on a fixed TOS"
156 }
157 
158 test_span_failable()
159 {
160         local tundev=$1; shift
161         local what=$1; shift
162 
163         RET=0
164 
165         mirror_install $swp1 ingress $tundev "matchall"
166         fail_test_span_gre_dir  $tundev
167         mirror_uninstall $swp1 ingress
168 
169         log_test "fail $what"
170 }
171 
172 test_keyful()
173 {
174         test_span_failable gt6-key "mirror to keyful gretap"
175 }
176 
177 test_soft()
178 {
179         test_span_failable gt6-soft "mirror to gretap w/ soft underlay"
180 }
181 
182 test_tos_fixed()
183 {
184         test_span_gre_tos_fixed gt4 gretap "mirror to gretap"
185         test_span_gre_tos_fixed gt6 ip6gretap "mirror to ip6gretap"
186 }
187 
188 
189 test_ttl_inherit()
190 {
191         test_span_gre_ttl_inherit gt4 gretap "mirror to gretap"
192         test_span_gre_ttl_inherit gt6 ip6gretap "mirror to ip6gretap"
193 }
194 
195 trap cleanup EXIT
196 
197 setup_prepare
198 setup_wait
199 
200 tests_run
201 
202 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