Skip to content

Commit 54293e4

Browse files
tammelakuba-moo
authored andcommitted
selftests/tc-testing: add hashtable tests for u32
Add tests to specifically check for the refcount interactions of hashtables created by u32. These tables should not be deleted when referenced and the flush order should respect a tree like composition. Signed-off-by: Pedro Tammela <pctammela@mojatatu.com> Acked-by: Jamal Hadi Salim <jhs@mojatatu.com> Link: https://lore.kernel.org/r/20231114141856.974326-3-pctammela@mojatatu.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 6b78deb commit 54293e4

File tree

1 file changed

+57
-0
lines changed
  • tools/testing/selftests/tc-testing/tc-tests/filters

1 file changed

+57
-0
lines changed

tools/testing/selftests/tc-testing/tc-tests/filters/u32.json

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,5 +272,62 @@
272272
"teardown": [
273273
"$TC qdisc del dev $DEV1 parent root drr"
274274
]
275+
},
276+
{
277+
"id": "bd32",
278+
"name": "Try to delete hashtable referenced by another u32 filter",
279+
"category": [
280+
"filter",
281+
"u32"
282+
],
283+
"plugins": {
284+
"requires": "nsPlugin"
285+
},
286+
"setup": [
287+
"$TC qdisc add dev $DEV1 parent root handle 10: drr",
288+
"$TC filter add dev $DEV1 parent 10:0 protocol ip prio 2 handle 1: u32 divisor 1",
289+
"$TC filter add dev $DEV1 parent 10:0 protocol ip prio 2 u32 ht 800: match ip src any link 1:"
290+
],
291+
"cmdUnderTest": "$TC filter delete dev $DEV1 parent 10: prio 2 handle 1: u32",
292+
"expExitCode": "2",
293+
"verifyCmd": "$TC filter show dev $DEV1",
294+
"matchPattern": "protocol ip pref 2 u32 chain 0 fh 1:",
295+
"matchCount": "1",
296+
"teardown": [
297+
"$TC qdisc del dev $DEV1 parent root drr"
298+
]
299+
},
300+
{
301+
"id": "4585",
302+
"name": "Delete small tree of u32 hashtables and filters",
303+
"category": [
304+
"filter",
305+
"u32"
306+
],
307+
"plugins": {
308+
"requires": "nsPlugin"
309+
},
310+
"setup": [
311+
"$TC qdisc add dev $DEV1 parent root handle 10: drr",
312+
"$TC filter add dev $DEV1 parent 10:0 protocol ip prio 2 handle 1: u32 divisor 1",
313+
"$TC filter add dev $DEV1 parent 10:0 protocol ip prio 2 handle 2: u32 divisor 1",
314+
"$TC filter add dev $DEV1 parent 10:0 protocol ip prio 2 handle 3: u32 divisor 2",
315+
"$TC filter add dev $DEV1 parent 10:0 protocol ip prio 2 handle 4: u32 divisor 1",
316+
"$TC filter add dev $DEV1 parent 10:0 protocol ip prio 2 u32 ht 1: match ip src any action drop",
317+
"$TC filter add dev $DEV1 parent 10:0 protocol ip prio 2 u32 ht 2: match ip src any action drop",
318+
"$TC filter add dev $DEV1 parent 10:0 protocol ip prio 2 u32 ht 3: match ip src any link 2:",
319+
"$TC filter add dev $DEV1 parent 10:0 protocol ip prio 2 u32 ht 3: match ip src any link 1:",
320+
"$TC filter add dev $DEV1 parent 10:0 protocol ip prio 2 u32 ht 4: match ip src any action drop",
321+
"$TC filter add dev $DEV1 parent 10:0 protocol ip prio 2 u32 ht 800: match ip src any link 3:",
322+
"$TC filter add dev $DEV1 parent 10:0 protocol ip prio 2 u32 ht 800: match ip src any link 4:"
323+
],
324+
"cmdUnderTest": "$TC filter delete dev $DEV1 parent 10:",
325+
"expExitCode": "0",
326+
"verifyCmd": "$TC filter show dev $DEV1",
327+
"matchPattern": "protocol ip pref 2 u32",
328+
"matchCount": "0",
329+
"teardown": [
330+
"$TC qdisc del dev $DEV1 parent root drr"
331+
]
275332
}
276333
]

0 commit comments

Comments
 (0)