xref: /linux/tools/testing/selftests/tc-testing/tc-tests/actions/bpf.json (revision 6e7fd890f1d6ac83805409e9c346240de2705584)
1[
2    {
3        "id": "d959",
4        "name": "Add cBPF action with valid bytecode",
5        "category": [
6            "actions",
7            "bpf"
8        ],
9        "setup": [
10            [
11                "$TC action flush action bpf",
12                0,
13                1,
14                255
15            ]
16        ],
17        "cmdUnderTest": "$TC action add action bpf bytecode '4,40 0 0 12,21 0 1 2048,6 0 0 262144,6 0 0 0' index 100",
18        "expExitCode": "0",
19        "verifyCmd": "$TC action get action bpf index 100",
20        "matchPattern": "action order [0-9]*: bpf bytecode '4,40 0 0 12,21 0 1 2048,6 0 0 262144,6 0 0 0' default-action pipe.*index 100 ref",
21        "matchCount": "1",
22        "teardown": [
23            "$TC action flush action bpf"
24        ]
25    },
26    {
27        "id": "f84a",
28        "name": "Add cBPF action with invalid bytecode",
29        "category": [
30            "actions",
31            "bpf"
32        ],
33        "setup": [
34            [
35                "$TC actions flush action bpf",
36                0,
37                1,
38                255
39            ]
40        ],
41        "cmdUnderTest": "$TC action add action bpf bytecode '4,40 0 0 12,31 0 1 2048,6 0 0 262144,6 0 0 0' index 100",
42        "expExitCode": "255",
43        "verifyCmd": "$TC action get action bpf index 100",
44        "matchPattern": "action order [0-9]*: bpf bytecode '4,40 0 0 12,31 0 1 2048,6 0 0 262144,6 0 0 0' default-action pipe.*index 100 ref",
45        "matchCount": "0",
46        "teardown": [
47            "$TC actions flush action bpf"
48        ]
49    },
50    {
51        "id": "e939",
52        "name": "Add eBPF action with valid object-file",
53        "category": [
54            "actions",
55            "bpf"
56        ],
57        "setup": [
58            [
59                "$TC action flush action bpf",
60                0,
61                1,
62                255
63            ]
64        ],
65        "cmdUnderTest": "$TC action add action bpf object-file $EBPFDIR/action-ebpf section action-ok index 667",
66        "expExitCode": "0",
67        "verifyCmd": "$TC action get action bpf index 667",
68        "matchPattern": "action order [0-9]*: bpf action-ebpf:\\[action-ok\\] id [0-9].* tag [0-9a-f]{16}( jited)? default-action pipe.*index 667 ref",
69        "matchCount": "1",
70        "teardown": [
71            "$TC action flush action bpf"
72        ]
73    },
74    {
75        "id": "282d",
76        "name": "Add eBPF action with invalid object-file",
77        "category": [
78            "actions",
79            "bpf"
80        ],
81        "setup": [
82            [
83                "$TC action flush action bpf",
84                0,
85                1,
86                255
87            ]
88        ],
89        "cmdUnderTest": "$TC action add action bpf object-file $EBPFDIR/action-ebpf section action-ko index 667",
90        "expExitCode": "255",
91        "verifyCmd": "$TC action get action bpf index 667",
92        "matchPattern": "action order [0-9]*: bpf action-ebpf:\\[action-ko\\] id [0-9].*index 667 ref",
93        "matchCount": "0",
94        "teardown": [
95            [
96                "$TC action flush action bpf",
97                0,
98                1,
99                255
100            ]
101        ]
102    },
103    {
104        "id": "d819",
105        "name": "Replace cBPF bytecode and action control",
106        "category": [
107            "actions",
108            "bpf"
109        ],
110        "setup": [
111            [
112                "$TC actions flush action bpf",
113                0,
114                1,
115                255
116            ],
117            [
118                "$TC action add action bpf bytecode '4,40 0 0 12,21 0 1 2048,6 0 0 262144,6 0 0 0' index 555",
119                0,
120                1,
121                255
122            ]
123        ],
124        "cmdUnderTest": "$TC action replace action bpf bytecode '4,40 0 0 12,21 0 1 2054,6 0 0 262144,6 0 0 0' drop index 555",
125        "expExitCode": "0",
126        "verifyCmd": "$TC action get action bpf index 555",
127        "matchPattern": "action order [0-9]*: bpf bytecode '4,40 0 0 12,21 0 1 2054,6 0 0 262144,6 0 0 0' default-action drop.*index 555 ref",
128        "matchCount": "1",
129        "teardown": [
130            "$TC action flush action bpf"
131        ]
132    },
133    {
134        "id": "6ae3",
135        "name": "Delete cBPF action ",
136        "category": [
137            "actions",
138            "bpf"
139        ],
140        "setup": [
141            [
142                "$TC actions flush action bpf",
143                0,
144                1,
145                255
146            ],
147            [
148                "$TC action add action bpf bytecode '4,40 0 0 12,21 0 1 2048,6 0 0 262144,6 0 0 0' index 444",
149                0,
150                1,
151                255
152            ]
153        ],
154        "cmdUnderTest": "$TC action delete action bpf index 444",
155        "expExitCode": "0",
156        "verifyCmd": "$TC action get action bpf index 444",
157        "matchPattern": "action order [0-9]*: bpf bytecode '4,40 0 0 12,21 0 1 2048,6 0 0 262144,6 0 0 0' default-action pipe.*index 444 ref",
158        "matchCount": "0",
159        "teardown": [
160            "$TC action flush action bpf"
161        ]
162    },
163    {
164        "id": "3e0d",
165        "name": "List cBPF actions",
166        "category": [
167            "actions",
168            "bpf"
169        ],
170        "setup": [
171            [
172                "$TC action flush action bpf",
173                0,
174                1,
175                255
176            ],
177            "$TC action add action bpf bytecode '4,40 0 0 12,21 0 1 2048,6 0 0 262144,6 0 0 0' ok index 101",
178            "$TC action add action bpf bytecode '4,40 0 0 12,21 0 1 2054,6 0 0 262144,6 0 0 0' drop index 102",
179            "$TC action add action bpf bytecode '4,40 0 0 12,21 0 1 33024,6 0 0 262144,6 0 0 0' continue index 103"
180        ],
181        "cmdUnderTest": "$TC action list action bpf",
182        "expExitCode": "0",
183        "verifyCmd": "$TC action list action bpf",
184        "matchPattern": "action order [0-9]*: bpf bytecode",
185        "matchCount": "3",
186        "teardown": [
187            "$TC actions flush action bpf"
188        ]
189    },
190    {
191        "id": "55ce",
192        "name": "Flush BPF actions",
193        "category": [
194            "actions",
195            "bpf"
196        ],
197        "setup": [
198            [
199                "$TC actions flush action bpf",
200                0,
201                1,
202                255
203            ],
204            "$TC action add action bpf bytecode '4,40 0 0 12,21 0 1 2048,6 0 0 262144,6 0 0 0' ok index 101",
205            "$TC action add action bpf bytecode '4,40 0 0 12,21 0 1 2054,6 0 0 262144,6 0 0 0' drop index 102",
206            "$TC action add action bpf bytecode '4,40 0 0 12,21 0 1 33024,6 0 0 262144,6 0 0 0' continue index 103"
207        ],
208        "cmdUnderTest": "$TC action flush action bpf",
209        "expExitCode": "0",
210        "verifyCmd": "$TC action list action bpf",
211        "matchPattern": "action order [0-9]*: bpf bytecode",
212        "matchCount": "0",
213        "teardown": [
214            "$TC actions flush action bpf"
215        ]
216    },
217    {
218        "id": "ccc3",
219        "name": "Add cBPF action with duplicate index",
220        "category": [
221            "actions",
222            "bpf"
223        ],
224        "setup": [
225            [
226                "$TC actions flush action bpf",
227                0,
228                1,
229                255
230            ],
231            "$TC action add action bpf bytecode '4,40 0 0 12,21 0 1 2048,6 0 0 262144,6 0 0 0' index 4294967295"
232        ],
233        "cmdUnderTest": "$TC action add action bpf bytecode '4,40 0 0 12,21 0 1 2054,6 0 0 262144,6 0 0 0' index 4294967295",
234        "expExitCode": "255",
235        "verifyCmd": "$TC action get action bpf index 4294967295",
236        "matchPattern": "action order [0-9]*: bpf bytecode '4,40 0 0 12,21 0 1 2048,6 0 0 262144,6 0 0 0' default-action pipe.*index 4294967295",
237        "matchCount": "1",
238        "teardown": [
239            "$TC action flush action bpf"
240        ]
241    },
242    {
243        "id": "89c7",
244        "name": "Add cBPF action with invalid index",
245        "category": [
246            "actions",
247            "bpf"
248        ],
249        "setup": [
250            [
251                "$TC actions flush action bpf",
252                0,
253                1,
254                255
255            ]
256        ],
257        "cmdUnderTest": "$TC action add action bpf bytecode '4,40 0 0 12,21 0 1 2054,6 0 0 262144,6 0 0 0' index 4294967296 cookie 123456",
258        "expExitCode": "255",
259        "verifyCmd": "$TC action ls action bpf",
260        "matchPattern": "action order [0-9]*: bpf bytecode '4,40 0 0 12,21 0 1 2048,6 0 0 262144,6 0 0 0' default-action pipe.*cookie 123456",
261        "matchCount": "0",
262        "teardown": [
263            "$TC action flush action bpf"
264        ]
265    },
266    {
267        "id": "7ab9",
268        "name": "Add cBPF action with cookie",
269        "category": [
270            "actions",
271            "bpf"
272        ],
273        "setup": [
274            [
275                "$TC actions flush action bpf",
276                0,
277                1,
278                255
279            ]
280        ],
281        "cmdUnderTest": "$TC action add action bpf bytecode '4,40 0 0 12,21 0 1 2054,6 0 0 262144,6 0 0 0' cookie d0d0d0d0d0d0d0d0",
282        "expExitCode": "0",
283        "verifyCmd": "$TC action list action bpf",
284        "matchPattern": "action order [0-9]*: bpf.*cookie d0d0d0d0d0d0d0",
285        "matchCount": "1",
286        "teardown": [
287            "$TC action flush action bpf"
288        ]
289    },
290    {
291        "id": "b8a1",
292        "name": "Replace bpf action with invalid goto_chain control",
293        "category": [
294            "actions",
295            "bpf"
296        ],
297        "setup": [
298            [
299                "$TC actions flush action bpf",
300                0,
301                1,
302                255
303            ],
304            "$TC action add action bpf bytecode '1,6 0 0 4294967295' pass index 90"
305        ],
306        "cmdUnderTest": "$TC action replace action bpf bytecode '1,6 0 0 4294967295' goto chain 42 index 90 cookie c1a0c1a0",
307        "expExitCode": "255",
308        "verifyCmd": "$TC action list action bpf",
309        "matchPattern": "action order [0-9]*: bpf.* default-action pass.*index 90",
310        "matchCount": "1",
311        "teardown": [
312            "$TC action flush action bpf"
313        ]
314    }
315]
316