drm/atomic-helper: document drm_atomic_helper_check() restrictions
[drm/drm-misc.git] / tools / testing / selftests / net / forwarding / mirror_gre_lib.sh
blob20078cc55f24bc6eede738d9fc41c55ee3206793
1 # SPDX-License-Identifier: GPL-2.0
3 source "$net_forwarding_dir/mirror_lib.sh"
5 quick_test_span_gre_dir_ips()
7 local tundev=$1; shift
8 local ip1=$1; shift
9 local ip2=$1; shift
10 local forward_type=$1; shift
11 local backward_type=$1; shift
13 do_test_span_dir_ips 10 h3-$tundev "$ip1" "$ip2" \
14 "$forward_type" "$backward_type"
17 fail_test_span_gre_dir_ips()
19 local tundev=$1; shift
20 local ip1=$1; shift
21 local ip2=$1; shift
23 do_test_span_dir_ips 0 h3-$tundev "$ip1" "$ip2"
26 test_span_gre_dir_ips()
28 local tundev=$1; shift
29 local forward_type=$1; shift
30 local backward_type=$1; shift
31 local ip1=$1; shift
32 local ip2=$1; shift
34 test_span_dir_ips h3-$tundev "$forward_type" \
35 "$backward_type" "$ip1" "$ip2"
38 full_test_span_gre_dir_ips()
40 local tundev=$1; shift
41 local direction=$1; shift
42 local forward_type=$1; shift
43 local backward_type=$1; shift
44 local what=$1; shift
45 local ip1=$1; shift
46 local ip2=$1; shift
48 RET=0
50 mirror_install $swp1 $direction $tundev "matchall"
51 test_span_dir_ips "h3-$tundev" "$forward_type" \
52 "$backward_type" "$ip1" "$ip2"
53 mirror_uninstall $swp1 $direction
55 log_test "$direction $what"
58 full_test_span_gre_dir_vlan_ips()
60 local tundev=$1; shift
61 local direction=$1; shift
62 local vlan_match=$1; shift
63 local forward_type=$1; shift
64 local backward_type=$1; shift
65 local what=$1; shift
66 local ip1=$1; shift
67 local ip2=$1; shift
69 RET=0
71 mirror_install $swp1 $direction $tundev "matchall"
73 test_span_dir_ips "h3-$tundev" "$forward_type" \
74 "$backward_type" "$ip1" "$ip2"
76 tc filter add dev $h3 ingress pref 77 prot 802.1q \
77 flower $vlan_match \
78 action pass
79 mirror_test v$h1 $ip1 $ip2 $h3 77 '>= 10'
80 tc filter del dev $h3 ingress pref 77
82 mirror_uninstall $swp1 $direction
84 log_test "$direction $what"
87 quick_test_span_gre_dir()
89 local tundev=$1; shift
90 local forward_type=${1-8}; shift
91 local backward_type=${1-0}; shift
93 quick_test_span_gre_dir_ips "$tundev" 192.0.2.1 192.0.2.2 \
94 "$forward_type" "$backward_type"
97 fail_test_span_gre_dir()
99 local tundev=$1; shift
101 fail_test_span_gre_dir_ips "$tundev" 192.0.2.1 192.0.2.2
104 full_test_span_gre_dir()
106 local tundev=$1; shift
107 local direction=$1; shift
108 local forward_type=$1; shift
109 local backward_type=$1; shift
110 local what=$1; shift
112 full_test_span_gre_dir_ips "$tundev" "$direction" "$forward_type" \
113 "$backward_type" "$what" 192.0.2.1 192.0.2.2
116 full_test_span_gre_dir_vlan()
118 local tundev=$1; shift
119 local direction=$1; shift
120 local vlan_match=$1; shift
121 local forward_type=$1; shift
122 local backward_type=$1; shift
123 local what=$1; shift
125 full_test_span_gre_dir_vlan_ips "$tundev" "$direction" "$vlan_match" \
126 "$forward_type" "$backward_type" \
127 "$what" 192.0.2.1 192.0.2.2
130 full_test_span_gre_stp_ips()
132 local tundev=$1; shift
133 local nbpdev=$1; shift
134 local what=$1; shift
135 local ip1=$1; shift
136 local ip2=$1; shift
137 local forward_type=$1; shift
138 local backward_type=$1; shift
139 local h3mac=$(mac_get $h3)
141 RET=0
143 mirror_install $swp1 ingress $tundev "matchall"
144 quick_test_span_gre_dir_ips $tundev $ip1 $ip2 \
145 "$forward_type" "$backward_type"
147 bridge link set dev $nbpdev state disabled
148 sleep 1
149 fail_test_span_gre_dir_ips $tundev $ip1 $ip2
151 bridge link set dev $nbpdev state forwarding
152 sleep 1
153 quick_test_span_gre_dir_ips $tundev $ip1 $ip2 \
154 "$forward_type" "$backward_type"
156 mirror_uninstall $swp1 ingress
158 log_test "$what: STP state"
161 full_test_span_gre_stp()
163 local tundev=$1; shift
164 local nbpdev=$1; shift
165 local what=$1; shift
166 local forward_type=${1-8}; shift
167 local backward_type=${1-0}; shift
169 full_test_span_gre_stp_ips "$tundev" "$nbpdev" "$what" \
170 192.0.2.1 192.0.2.2 \
171 "$forward_type" "$backward_type"