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

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/drivers/net/netdevsim/fib.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/netdevsim/fib.sh (Architecture i386) and /tools/testing/selftests/drivers/net/netdevsim/fib.sh (Architecture ppc)


  1 #!/bin/bash                                         1 #!/bin/bash
  2 # SPDX-License-Identifier: GPL-2.0                  2 # SPDX-License-Identifier: GPL-2.0
  3 #                                                   3 #
  4 # This test is for checking the FIB offload AP      4 # This test is for checking the FIB offload API. It makes use of netdevsim
  5 # which registers a listener to the FIB notifi      5 # which registers a listener to the FIB notification chain.
  6                                                     6 
  7 lib_dir=$(dirname $0)/../../../net/forwarding       7 lib_dir=$(dirname $0)/../../../net/forwarding
  8                                                     8 
  9 ALL_TESTS="                                         9 ALL_TESTS="
 10         ipv4_identical_routes                      10         ipv4_identical_routes
 11         ipv4_tos                                   11         ipv4_tos
 12         ipv4_metric                                12         ipv4_metric
 13         ipv4_replace                               13         ipv4_replace
 14         ipv4_delete                                14         ipv4_delete
 15         ipv4_plen                                  15         ipv4_plen
 16         ipv4_replay                                16         ipv4_replay
 17         ipv4_flush                                 17         ipv4_flush
 18         ipv4_error_path                            18         ipv4_error_path
 19         ipv4_delete_fail                           19         ipv4_delete_fail
 20         ipv6_add                                   20         ipv6_add
 21         ipv6_metric                                21         ipv6_metric
 22         ipv6_append_single                         22         ipv6_append_single
 23         ipv6_replace_single                        23         ipv6_replace_single
 24         ipv6_metric_multipath                      24         ipv6_metric_multipath
 25         ipv6_append_multipath                      25         ipv6_append_multipath
 26         ipv6_replace_multipath                     26         ipv6_replace_multipath
 27         ipv6_append_multipath_to_single            27         ipv6_append_multipath_to_single
 28         ipv6_delete_single                         28         ipv6_delete_single
 29         ipv6_delete_multipath                      29         ipv6_delete_multipath
 30         ipv6_replay_single                         30         ipv6_replay_single
 31         ipv6_replay_multipath                      31         ipv6_replay_multipath
 32         ipv6_error_path                            32         ipv6_error_path
 33         ipv6_delete_fail                           33         ipv6_delete_fail
 34 "                                                  34 "
 35 NETDEVSIM_PATH=/sys/bus/netdevsim/                 35 NETDEVSIM_PATH=/sys/bus/netdevsim/
 36 DEV_ADDR=1337                                      36 DEV_ADDR=1337
 37 DEV=netdevsim${DEV_ADDR}                           37 DEV=netdevsim${DEV_ADDR}
 38 SYSFS_NET_DIR=/sys/bus/netdevsim/devices/$DEV/     38 SYSFS_NET_DIR=/sys/bus/netdevsim/devices/$DEV/net/
 39 DEBUGFS_DIR=/sys/kernel/debug/netdevsim/$DEV/      39 DEBUGFS_DIR=/sys/kernel/debug/netdevsim/$DEV/
 40 NUM_NETIFS=0                                       40 NUM_NETIFS=0
 41 source $lib_dir/lib.sh                             41 source $lib_dir/lib.sh
 42 source $lib_dir/fib_offload_lib.sh                 42 source $lib_dir/fib_offload_lib.sh
 43                                                    43 
 44 DEVLINK_DEV=                                       44 DEVLINK_DEV=
 45 source $lib_dir/devlink_lib.sh                     45 source $lib_dir/devlink_lib.sh
 46 DEVLINK_DEV=netdevsim/${DEV}                       46 DEVLINK_DEV=netdevsim/${DEV}
 47                                                    47 
 48 ipv4_identical_routes()                            48 ipv4_identical_routes()
 49 {                                                  49 {
 50         fib_ipv4_identical_routes_test "testns     50         fib_ipv4_identical_routes_test "testns1"
 51 }                                                  51 }
 52                                                    52 
 53 ipv4_tos()                                         53 ipv4_tos()
 54 {                                                  54 {
 55         fib_ipv4_tos_test "testns1"                55         fib_ipv4_tos_test "testns1"
 56 }                                                  56 }
 57                                                    57 
 58 ipv4_metric()                                      58 ipv4_metric()
 59 {                                                  59 {
 60         fib_ipv4_metric_test "testns1"             60         fib_ipv4_metric_test "testns1"
 61 }                                                  61 }
 62                                                    62 
 63 ipv4_replace()                                     63 ipv4_replace()
 64 {                                                  64 {
 65         fib_ipv4_replace_test "testns1"            65         fib_ipv4_replace_test "testns1"
 66 }                                                  66 }
 67                                                    67 
 68 ipv4_delete()                                      68 ipv4_delete()
 69 {                                                  69 {
 70         fib_ipv4_delete_test "testns1"             70         fib_ipv4_delete_test "testns1"
 71 }                                                  71 }
 72                                                    72 
 73 ipv4_plen()                                        73 ipv4_plen()
 74 {                                                  74 {
 75         fib_ipv4_plen_test "testns1"               75         fib_ipv4_plen_test "testns1"
 76 }                                                  76 }
 77                                                    77 
 78 ipv4_replay_metric()                               78 ipv4_replay_metric()
 79 {                                                  79 {
 80         fib_ipv4_replay_metric_test "testns1"      80         fib_ipv4_replay_metric_test "testns1" "$DEVLINK_DEV"
 81 }                                                  81 }
 82                                                    82 
 83 ipv4_replay_tos()                                  83 ipv4_replay_tos()
 84 {                                                  84 {
 85         fib_ipv4_replay_tos_test "testns1" "$D     85         fib_ipv4_replay_tos_test "testns1" "$DEVLINK_DEV"
 86 }                                                  86 }
 87                                                    87 
 88 ipv4_replay_plen()                                 88 ipv4_replay_plen()
 89 {                                                  89 {
 90         fib_ipv4_replay_plen_test "testns1" "$     90         fib_ipv4_replay_plen_test "testns1" "$DEVLINK_DEV"
 91 }                                                  91 }
 92                                                    92 
 93 ipv4_replay()                                      93 ipv4_replay()
 94 {                                                  94 {
 95         ipv4_replay_metric                         95         ipv4_replay_metric
 96         ipv4_replay_tos                            96         ipv4_replay_tos
 97         ipv4_replay_plen                           97         ipv4_replay_plen
 98 }                                                  98 }
 99                                                    99 
100 ipv4_flush()                                      100 ipv4_flush()
101 {                                                 101 {
102         fib_ipv4_flush_test "testns1"             102         fib_ipv4_flush_test "testns1"
103 }                                                 103 }
104                                                   104 
105 ipv4_error_path_add()                             105 ipv4_error_path_add()
106 {                                                 106 {
107         local lsb                                 107         local lsb
108                                                   108 
109         RET=0                                     109         RET=0
110                                                   110 
111         ip -n testns1 link add name dummy1 typ    111         ip -n testns1 link add name dummy1 type dummy
112         ip -n testns1 link set dev dummy1 up      112         ip -n testns1 link set dev dummy1 up
113                                                   113 
114         devlink -N testns1 resource set $DEVLI    114         devlink -N testns1 resource set $DEVLINK_DEV path IPv4/fib size 10
115         devlink -N testns1 dev reload $DEVLINK    115         devlink -N testns1 dev reload $DEVLINK_DEV
116                                                   116 
117         for lsb in $(seq 1 20); do                117         for lsb in $(seq 1 20); do
118                 ip -n testns1 route add 192.0.    118                 ip -n testns1 route add 192.0.2.${lsb}/32 dev dummy1 \
119                         &> /dev/null              119                         &> /dev/null
120         done                                      120         done
121                                                   121 
122         log_test "IPv4 error path - add"          122         log_test "IPv4 error path - add"
123                                                   123 
124         ip -n testns1 link del dev dummy1         124         ip -n testns1 link del dev dummy1
125 }                                                 125 }
126                                                   126 
127 ipv4_error_path_replay()                          127 ipv4_error_path_replay()
128 {                                                 128 {
129         local lsb                                 129         local lsb
130                                                   130 
131         RET=0                                     131         RET=0
132                                                   132 
133         ip -n testns1 link add name dummy1 typ    133         ip -n testns1 link add name dummy1 type dummy
134         ip -n testns1 link set dev dummy1 up      134         ip -n testns1 link set dev dummy1 up
135                                                   135 
136         devlink -N testns1 resource set $DEVLI    136         devlink -N testns1 resource set $DEVLINK_DEV path IPv4/fib size 100
137         devlink -N testns1 dev reload $DEVLINK    137         devlink -N testns1 dev reload $DEVLINK_DEV
138                                                   138 
139         for lsb in $(seq 1 20); do                139         for lsb in $(seq 1 20); do
140                 ip -n testns1 route add 192.0.    140                 ip -n testns1 route add 192.0.2.${lsb}/32 dev dummy1
141         done                                      141         done
142                                                   142 
143         devlink -N testns1 resource set $DEVLI    143         devlink -N testns1 resource set $DEVLINK_DEV path IPv4/fib size 10
144         devlink -N testns1 dev reload $DEVLINK    144         devlink -N testns1 dev reload $DEVLINK_DEV &> /dev/null
145                                                   145 
146         log_test "IPv4 error path - replay"       146         log_test "IPv4 error path - replay"
147                                                   147 
148         ip -n testns1 link del dev dummy1         148         ip -n testns1 link del dev dummy1
149                                                   149 
150         # Successfully reload after deleting a    150         # Successfully reload after deleting all the routes.
151         devlink -N testns1 resource set $DEVLI    151         devlink -N testns1 resource set $DEVLINK_DEV path IPv4/fib size 100
152         devlink -N testns1 dev reload $DEVLINK    152         devlink -N testns1 dev reload $DEVLINK_DEV
153 }                                                 153 }
154                                                   154 
155 ipv4_error_path()                                 155 ipv4_error_path()
156 {                                                 156 {
157         # Test the different error paths of th    157         # Test the different error paths of the notifiers by limiting the size
158         # of the "IPv4/fib" resource.             158         # of the "IPv4/fib" resource.
159         ipv4_error_path_add                       159         ipv4_error_path_add
160         ipv4_error_path_replay                    160         ipv4_error_path_replay
161 }                                                 161 }
162                                                   162 
163 ipv4_delete_fail()                                163 ipv4_delete_fail()
164 {                                                 164 {
165         RET=0                                     165         RET=0
166                                                   166 
167         echo "y" > $DEBUGFS_DIR/fib/fail_route    167         echo "y" > $DEBUGFS_DIR/fib/fail_route_delete
168                                                   168 
169         ip -n testns1 link add name dummy1 typ    169         ip -n testns1 link add name dummy1 type dummy
170         ip -n testns1 link set dev dummy1 up      170         ip -n testns1 link set dev dummy1 up
171                                                   171 
172         ip -n testns1 route add 192.0.2.0/24 d    172         ip -n testns1 route add 192.0.2.0/24 dev dummy1
173         ip -n testns1 route del 192.0.2.0/24 d    173         ip -n testns1 route del 192.0.2.0/24 dev dummy1 &> /dev/null
174                                                   174 
175         # We should not be able to delete the     175         # We should not be able to delete the netdev if we are leaking a
176         # reference.                              176         # reference.
177         ip -n testns1 link del dev dummy1         177         ip -n testns1 link del dev dummy1
178                                                   178 
179         log_test "IPv4 route delete failure"      179         log_test "IPv4 route delete failure"
180                                                   180 
181         echo "n" > $DEBUGFS_DIR/fib/fail_route    181         echo "n" > $DEBUGFS_DIR/fib/fail_route_delete
182 }                                                 182 }
183                                                   183 
184 ipv6_add()                                        184 ipv6_add()
185 {                                                 185 {
186         fib_ipv6_add_test "testns1"               186         fib_ipv6_add_test "testns1"
187 }                                                 187 }
188                                                   188 
189 ipv6_metric()                                     189 ipv6_metric()
190 {                                                 190 {
191         fib_ipv6_metric_test "testns1"            191         fib_ipv6_metric_test "testns1"
192 }                                                 192 }
193                                                   193 
194 ipv6_append_single()                              194 ipv6_append_single()
195 {                                                 195 {
196         fib_ipv6_append_single_test "testns1"     196         fib_ipv6_append_single_test "testns1"
197 }                                                 197 }
198                                                   198 
199 ipv6_replace_single()                             199 ipv6_replace_single()
200 {                                                 200 {
201         fib_ipv6_replace_single_test "testns1"    201         fib_ipv6_replace_single_test "testns1"
202 }                                                 202 }
203                                                   203 
204 ipv6_metric_multipath()                           204 ipv6_metric_multipath()
205 {                                                 205 {
206         fib_ipv6_metric_multipath_test "testns    206         fib_ipv6_metric_multipath_test "testns1"
207 }                                                 207 }
208                                                   208 
209 ipv6_append_multipath()                           209 ipv6_append_multipath()
210 {                                                 210 {
211         fib_ipv6_append_multipath_test "testns    211         fib_ipv6_append_multipath_test "testns1"
212 }                                                 212 }
213                                                   213 
214 ipv6_replace_multipath()                          214 ipv6_replace_multipath()
215 {                                                 215 {
216         fib_ipv6_replace_multipath_test "testn    216         fib_ipv6_replace_multipath_test "testns1"
217 }                                                 217 }
218                                                   218 
219 ipv6_append_multipath_to_single()                 219 ipv6_append_multipath_to_single()
220 {                                                 220 {
221         fib_ipv6_append_multipath_to_single_te    221         fib_ipv6_append_multipath_to_single_test "testns1"
222 }                                                 222 }
223                                                   223 
224 ipv6_delete_single()                              224 ipv6_delete_single()
225 {                                                 225 {
226         fib_ipv6_delete_single_test "testns1"     226         fib_ipv6_delete_single_test "testns1"
227 }                                                 227 }
228                                                   228 
229 ipv6_delete_multipath()                           229 ipv6_delete_multipath()
230 {                                                 230 {
231         fib_ipv6_delete_multipath_test "testns    231         fib_ipv6_delete_multipath_test "testns1"
232 }                                                 232 }
233                                                   233 
234 ipv6_replay_single()                              234 ipv6_replay_single()
235 {                                                 235 {
236         fib_ipv6_replay_single_test "testns1"     236         fib_ipv6_replay_single_test "testns1" "$DEVLINK_DEV"
237 }                                                 237 }
238                                                   238 
239 ipv6_replay_multipath()                           239 ipv6_replay_multipath()
240 {                                                 240 {
241         fib_ipv6_replay_multipath_test "testns    241         fib_ipv6_replay_multipath_test "testns1" "$DEVLINK_DEV"
242 }                                                 242 }
243                                                   243 
244 ipv6_error_path_add_single()                      244 ipv6_error_path_add_single()
245 {                                                 245 {
246         local lsb                                 246         local lsb
247                                                   247 
248         RET=0                                     248         RET=0
249                                                   249 
250         ip -n testns1 link add name dummy1 typ    250         ip -n testns1 link add name dummy1 type dummy
251         ip -n testns1 link set dev dummy1 up      251         ip -n testns1 link set dev dummy1 up
252                                                   252 
253         devlink -N testns1 resource set $DEVLI    253         devlink -N testns1 resource set $DEVLINK_DEV path IPv6/fib size 10
254         devlink -N testns1 dev reload $DEVLINK    254         devlink -N testns1 dev reload $DEVLINK_DEV
255                                                   255 
256         for lsb in $(seq 1 20); do                256         for lsb in $(seq 1 20); do
257                 ip -n testns1 route add 2001:d    257                 ip -n testns1 route add 2001:db8:1::${lsb}/128 dev dummy1 \
258                         &> /dev/null              258                         &> /dev/null
259         done                                      259         done
260                                                   260 
261         log_test "IPv6 error path - add single    261         log_test "IPv6 error path - add single"
262                                                   262 
263         ip -n testns1 link del dev dummy1         263         ip -n testns1 link del dev dummy1
264 }                                                 264 }
265                                                   265 
266 ipv6_error_path_add_multipath()                   266 ipv6_error_path_add_multipath()
267 {                                                 267 {
268         local lsb                                 268         local lsb
269                                                   269 
270         RET=0                                     270         RET=0
271                                                   271 
272         for i in $(seq 1 2); do                   272         for i in $(seq 1 2); do
273                 ip -n testns1 link add name du    273                 ip -n testns1 link add name dummy$i type dummy
274                 ip -n testns1 link set dev dum    274                 ip -n testns1 link set dev dummy$i up
275                 ip -n testns1 address add 2001    275                 ip -n testns1 address add 2001:db8:$i::1/64 dev dummy$i
276         done                                      276         done
277                                                   277 
278         devlink -N testns1 resource set $DEVLI    278         devlink -N testns1 resource set $DEVLINK_DEV path IPv6/fib size 10
279         devlink -N testns1 dev reload $DEVLINK    279         devlink -N testns1 dev reload $DEVLINK_DEV
280                                                   280 
281         for lsb in $(seq 1 20); do                281         for lsb in $(seq 1 20); do
282                 ip -n testns1 route add 2001:d    282                 ip -n testns1 route add 2001:db8:10::${lsb}/128 \
283                         nexthop via 2001:db8:1    283                         nexthop via 2001:db8:1::2 dev dummy1 \
284                         nexthop via 2001:db8:2    284                         nexthop via 2001:db8:2::2 dev dummy2 &> /dev/null
285         done                                      285         done
286                                                   286 
287         log_test "IPv6 error path - add multip    287         log_test "IPv6 error path - add multipath"
288                                                   288 
289         for i in $(seq 1 2); do                   289         for i in $(seq 1 2); do
290                 ip -n testns1 link del dev dum    290                 ip -n testns1 link del dev dummy$i
291         done                                      291         done
292 }                                                 292 }
293                                                   293 
294 ipv6_error_path_replay()                          294 ipv6_error_path_replay()
295 {                                                 295 {
296         local lsb                                 296         local lsb
297                                                   297 
298         RET=0                                     298         RET=0
299                                                   299 
300         ip -n testns1 link add name dummy1 typ    300         ip -n testns1 link add name dummy1 type dummy
301         ip -n testns1 link set dev dummy1 up      301         ip -n testns1 link set dev dummy1 up
302                                                   302 
303         devlink -N testns1 resource set $DEVLI    303         devlink -N testns1 resource set $DEVLINK_DEV path IPv6/fib size 100
304         devlink -N testns1 dev reload $DEVLINK    304         devlink -N testns1 dev reload $DEVLINK_DEV
305                                                   305 
306         for lsb in $(seq 1 20); do                306         for lsb in $(seq 1 20); do
307                 ip -n testns1 route add 2001:d    307                 ip -n testns1 route add 2001:db8:1::${lsb}/128 dev dummy1
308         done                                      308         done
309                                                   309 
310         devlink -N testns1 resource set $DEVLI    310         devlink -N testns1 resource set $DEVLINK_DEV path IPv6/fib size 10
311         devlink -N testns1 dev reload $DEVLINK    311         devlink -N testns1 dev reload $DEVLINK_DEV &> /dev/null
312                                                   312 
313         log_test "IPv6 error path - replay"       313         log_test "IPv6 error path - replay"
314                                                   314 
315         ip -n testns1 link del dev dummy1         315         ip -n testns1 link del dev dummy1
316                                                   316 
317         # Successfully reload after deleting a    317         # Successfully reload after deleting all the routes.
318         devlink -N testns1 resource set $DEVLI    318         devlink -N testns1 resource set $DEVLINK_DEV path IPv6/fib size 100
319         devlink -N testns1 dev reload $DEVLINK    319         devlink -N testns1 dev reload $DEVLINK_DEV
320 }                                                 320 }
321                                                   321 
322 ipv6_error_path()                                 322 ipv6_error_path()
323 {                                                 323 {
324         # Test the different error paths of th    324         # Test the different error paths of the notifiers by limiting the size
325         # of the "IPv6/fib" resource.             325         # of the "IPv6/fib" resource.
326         ipv6_error_path_add_single                326         ipv6_error_path_add_single
327         ipv6_error_path_add_multipath             327         ipv6_error_path_add_multipath
328         ipv6_error_path_replay                    328         ipv6_error_path_replay
329 }                                                 329 }
330                                                   330 
331 ipv6_delete_fail()                                331 ipv6_delete_fail()
332 {                                                 332 {
333         RET=0                                     333         RET=0
334                                                   334 
335         echo "y" > $DEBUGFS_DIR/fib/fail_route    335         echo "y" > $DEBUGFS_DIR/fib/fail_route_delete
336                                                   336 
337         ip -n testns1 link add name dummy1 typ    337         ip -n testns1 link add name dummy1 type dummy
338         ip -n testns1 link set dev dummy1 up      338         ip -n testns1 link set dev dummy1 up
339                                                   339 
340         ip -n testns1 route add 2001:db8:1::/6    340         ip -n testns1 route add 2001:db8:1::/64 dev dummy1
341         ip -n testns1 route del 2001:db8:1::/6    341         ip -n testns1 route del 2001:db8:1::/64 dev dummy1 &> /dev/null
342                                                   342 
343         # We should not be able to delete the     343         # We should not be able to delete the netdev if we are leaking a
344         # reference.                              344         # reference.
345         ip -n testns1 link del dev dummy1         345         ip -n testns1 link del dev dummy1
346                                                   346 
347         log_test "IPv6 route delete failure"      347         log_test "IPv6 route delete failure"
348                                                   348 
349         echo "n" > $DEBUGFS_DIR/fib/fail_route    349         echo "n" > $DEBUGFS_DIR/fib/fail_route_delete
350 }                                                 350 }
351                                                   351 
352 fib_notify_on_flag_change_set()                   352 fib_notify_on_flag_change_set()
353 {                                                 353 {
354         local notify=$1; shift                    354         local notify=$1; shift
355                                                   355 
356         ip netns exec testns1 sysctl -qw net.i    356         ip netns exec testns1 sysctl -qw net.ipv4.fib_notify_on_flag_change=$notify
357         ip netns exec testns1 sysctl -qw net.i    357         ip netns exec testns1 sysctl -qw net.ipv6.fib_notify_on_flag_change=$notify
358                                                   358 
359         log_info "Set fib_notify_on_flag_chang    359         log_info "Set fib_notify_on_flag_change to $notify"
360 }                                                 360 }
361                                                   361 
362 setup_prepare()                                   362 setup_prepare()
363 {                                                 363 {
364         local netdev                              364         local netdev
365                                                   365 
366         modprobe netdevsim &> /dev/null           366         modprobe netdevsim &> /dev/null
367                                                   367 
368         echo "$DEV_ADDR 1" > ${NETDEVSIM_PATH}    368         echo "$DEV_ADDR 1" > ${NETDEVSIM_PATH}/new_device
369         while [ ! -d $SYSFS_NET_DIR ] ; do :;     369         while [ ! -d $SYSFS_NET_DIR ] ; do :; done
370                                                   370 
371         ip netns add testns1                      371         ip netns add testns1
372         if [ $? -ne 0 ]; then                     372         if [ $? -ne 0 ]; then
373                 echo "Failed to add netns \"te    373                 echo "Failed to add netns \"testns1\""
374                 exit 1                            374                 exit 1
375         fi                                        375         fi
376                                                   376 
377         devlink dev reload $DEVLINK_DEV netns     377         devlink dev reload $DEVLINK_DEV netns testns1
378         if [ $? -ne 0 ]; then                     378         if [ $? -ne 0 ]; then
379                 echo "Failed to reload into ne    379                 echo "Failed to reload into netns \"testns1\""
380                 exit 1                            380                 exit 1
381         fi                                        381         fi
382 }                                                 382 }
383                                                   383 
384 cleanup()                                         384 cleanup()
385 {                                                 385 {
386         pre_cleanup                               386         pre_cleanup
387         ip netns del testns1                      387         ip netns del testns1
388         echo "$DEV_ADDR" > ${NETDEVSIM_PATH}/d    388         echo "$DEV_ADDR" > ${NETDEVSIM_PATH}/del_device
389         modprobe -r netdevsim &> /dev/null        389         modprobe -r netdevsim &> /dev/null
390 }                                                 390 }
391                                                   391 
392 trap cleanup EXIT                                 392 trap cleanup EXIT
393                                                   393 
394 setup_prepare                                     394 setup_prepare
395                                                   395 
396 fib_notify_on_flag_change_set 1                   396 fib_notify_on_flag_change_set 1
397 tests_run                                         397 tests_run
398                                                   398 
399 fib_notify_on_flag_change_set 0                   399 fib_notify_on_flag_change_set 0
400 tests_run                                         400 tests_run
401                                                   401 
402 exit $EXIT_STATUS                                 402 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