OSDN Git Service

smb3: Add defines for new information level, FileIdInformation
[tomoyo/tomoyo-test1.git] / tools / testing / selftests / drivers / net / mlxsw / fib.sh
1 #!/bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 #
4 # This test is for checking the FIB offload API on top of mlxsw.
5
6 lib_dir=$(dirname $0)/../../../net/forwarding
7
8 ALL_TESTS="
9         ipv4_identical_routes
10         ipv4_tos
11         ipv4_metric
12         ipv4_replace
13         ipv4_delete
14         ipv4_plen
15         ipv4_replay
16         ipv4_flush
17         ipv6_add
18         ipv6_metric
19         ipv6_append_single
20         ipv6_replace_single
21         ipv6_metric_multipath
22         ipv6_append_multipath
23         ipv6_replace_multipath
24         ipv6_append_multipath_to_single
25         ipv6_delete_single
26         ipv6_delete_multipath
27         ipv6_replay_single
28         ipv6_replay_multipath
29 "
30 NUM_NETIFS=0
31 source $lib_dir/lib.sh
32 source $lib_dir/devlink_lib.sh
33 source $lib_dir/fib_offload_lib.sh
34
35 ipv4_identical_routes()
36 {
37         fib_ipv4_identical_routes_test "testns1"
38 }
39
40 ipv4_tos()
41 {
42         fib_ipv4_tos_test "testns1"
43 }
44
45 ipv4_metric()
46 {
47         fib_ipv4_metric_test "testns1"
48 }
49
50 ipv4_replace()
51 {
52         fib_ipv4_replace_test "testns1"
53 }
54
55 ipv4_delete()
56 {
57         fib_ipv4_delete_test "testns1"
58 }
59
60 ipv4_plen()
61 {
62         fib_ipv4_plen_test "testns1"
63 }
64
65 ipv4_replay_metric()
66 {
67         fib_ipv4_replay_metric_test "testns1" "$DEVLINK_DEV"
68 }
69
70 ipv4_replay_tos()
71 {
72         fib_ipv4_replay_tos_test "testns1" "$DEVLINK_DEV"
73 }
74
75 ipv4_replay_plen()
76 {
77         fib_ipv4_replay_plen_test "testns1" "$DEVLINK_DEV"
78 }
79
80 ipv4_replay()
81 {
82         ipv4_replay_metric
83         ipv4_replay_tos
84         ipv4_replay_plen
85 }
86
87 ipv4_flush()
88 {
89         fib_ipv4_flush_test "testns1"
90 }
91
92 ipv6_add()
93 {
94         fib_ipv6_add_test "testns1"
95 }
96
97 ipv6_metric()
98 {
99         fib_ipv6_metric_test "testns1"
100 }
101
102 ipv6_append_single()
103 {
104         fib_ipv6_append_single_test "testns1"
105 }
106
107 ipv6_replace_single()
108 {
109         fib_ipv6_replace_single_test "testns1"
110 }
111
112 ipv6_metric_multipath()
113 {
114         fib_ipv6_metric_multipath_test "testns1"
115 }
116
117 ipv6_append_multipath()
118 {
119         fib_ipv6_append_multipath_test "testns1"
120 }
121
122 ipv6_replace_multipath()
123 {
124         fib_ipv6_replace_multipath_test "testns1"
125 }
126
127 ipv6_append_multipath_to_single()
128 {
129         fib_ipv6_append_multipath_to_single_test "testns1"
130 }
131
132 ipv6_delete_single()
133 {
134         fib_ipv6_delete_single_test "testns1"
135 }
136
137 ipv6_delete_multipath()
138 {
139         fib_ipv6_delete_multipath_test "testns1"
140 }
141
142 ipv6_replay_single()
143 {
144         fib_ipv6_replay_single_test "testns1" "$DEVLINK_DEV"
145 }
146
147 ipv6_replay_multipath()
148 {
149         fib_ipv6_replay_multipath_test "testns1" "$DEVLINK_DEV"
150 }
151
152 setup_prepare()
153 {
154         ip netns add testns1
155         if [ $? -ne 0 ]; then
156                 echo "Failed to add netns \"testns1\""
157                 exit 1
158         fi
159
160         devlink dev reload $DEVLINK_DEV netns testns1
161         if [ $? -ne 0 ]; then
162                 echo "Failed to reload into netns \"testns1\""
163                 exit 1
164         fi
165 }
166
167 cleanup()
168 {
169         pre_cleanup
170         devlink -N testns1 dev reload $DEVLINK_DEV netns $$
171         ip netns del testns1
172 }
173
174 trap cleanup EXIT
175
176 setup_prepare
177
178 tests_run
179
180 exit $EXIT_STATUS