2 # SPDX-License-Identifier: GPL-2.0
4 # This test uses standard topology for testing gretap. See
5 # ../../../net/forwarding/mirror_gre_topo_lib.sh for more details.
7 # Test offloading various features of offloading gretap mirrors specific to
10 lib_dir
=$
(dirname $0)/..
/..
/..
/net
/forwarding
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
20 tunnel_create gt6-key ip6gretap
2001:db8
:3::1 2001:db8
:3::2 \
21 ttl
100 tos inherit allow-localremote \
24 tunnel_create h3-gt6-key ip6gretap
2001:db8
:3::2 2001:db8
:3::1 \
26 ip link
set h3-gt6-key vrf v
$h3
27 matchall_sink_create h3-gt6-key
29 ip address add dev
$swp3 2001:db8
:3::1/64
30 ip address add dev
$h3 2001:db8
:3::2/64
35 ip address del dev
$h3 2001:db8
:3::2/64
36 ip address del dev
$swp3 2001:db8
:3::1/64
38 tunnel_destroy h3-gt6-key
39 tunnel_destroy gt6-key
44 # Set up a topology for testing underlay routes that point at an
45 # unsupported soft device.
47 tunnel_create gt6-soft ip6gretap
2001:db8
:4::1 2001:db8
:4::2 \
48 ttl
100 tos inherit allow-localremote
50 tunnel_create h3-gt6-soft ip6gretap
2001:db8
:4::2 2001:db8
:4::1
51 ip link
set h3-gt6-soft vrf v
$h3
52 matchall_sink_create h3-gt6-soft
54 ip link add name v1
type veth peer name v2
56 ip address add dev v1
2001:db8
:4::1/64
58 ip link
set dev v2 vrf v
$h3
60 ip address add dev v2
2001:db8
:4::2/64
67 tunnel_destroy h3-gt6-soft
68 tunnel_destroy gt6-soft
83 mirror_gre_topo_create
85 ip address add dev
$swp3 2001:db8
:2::1/64
86 ip address add dev
$h3 2001:db8
:2::2/64
88 ip address add dev
$swp3 192.0.2.129/28
89 ip address add dev
$h3 192.0.2.130/28
102 ip address del dev
$h3 2001:db8
:2::2/64
103 ip address del dev
$swp3 2001:db8
:2::1/64
105 ip address del dev
$h3 192.0.2.130/28
106 ip address del dev
$swp3 192.0.2.129/28
108 mirror_gre_topo_destroy
112 test_span_gre_ttl_inherit
()
114 local tundev
=$1; shift
120 ip link
set dev
$tundev type $type ttl inherit
121 mirror_install
$swp1 ingress
$tundev "matchall $tcflags"
122 fail_test_span_gre_dir
$tundev ingress
124 ip link
set dev
$tundev type $type ttl
100
126 quick_test_span_gre_dir
$tundev ingress
127 mirror_uninstall
$swp1 ingress
129 log_test
"$what: no offload on TTL of inherit ($tcflags)"
132 test_span_gre_tos_fixed
()
134 local tundev
=$1; shift
140 ip link
set dev
$tundev type $type tos
0x10
141 mirror_install
$swp1 ingress
$tundev "matchall $tcflags"
142 fail_test_span_gre_dir
$tundev ingress
144 ip link
set dev
$tundev type $type tos inherit
145 quick_test_span_gre_dir
$tundev ingress
146 mirror_uninstall
$swp1 ingress
148 log_test
"$what: no offload on a fixed TOS ($tcflags)"
153 local should_fail
=$1; shift
154 local tundev
=$1; shift
159 mirror_install
$swp1 ingress
$tundev "matchall $tcflags"
160 if ((should_fail
)); then
161 fail_test_span_gre_dir
$tundev ingress
163 quick_test_span_gre_dir
$tundev ingress
165 mirror_uninstall
$swp1 ingress
167 log_test
"$what: should_fail=$should_fail ($tcflags)"
172 local should_fail
=$1; shift
174 test_span_failable
$should_fail gt6-key
"mirror to keyful gretap"
175 test_span_failable
$should_fail gt6-soft
"mirror to gretap w/ soft underlay"
180 slow_path_trap_install
$swp1 ingress
181 slow_path_trap_install
$swp1 egress
185 slow_path_trap_uninstall
$swp1 egress
186 slow_path_trap_uninstall
$swp1 ingress
193 test_span_gre_tos_fixed gt4 gretap
"mirror to gretap"
194 test_span_gre_tos_fixed gt6 ip6gretap
"mirror to ip6gretap"
196 test_span_gre_ttl_inherit gt4 gretap
"mirror to gretap"
197 test_span_gre_ttl_inherit gt6 ip6gretap
"mirror to ip6gretap"
205 if ! tc_offload_check
; then
206 check_err
1 "Could not test offloaded functionality"
207 log_test
"mlxsw-specific tests for mirror to gretap"