Add a tdc test case checking that cls_u32 honors skip_sw. The dummy device has no tc offload, so the block bound to its ingress qdisc counts a non offload-capable device and a skip_sw filter cannot be offloaded anywhere. The filter add is expected to fail with EOPNOTSUPP (exit 2) and leave no u32 filter behind. Before the fix, skip_sw was ignored for u32 knodes, the add silently succeeded and the filter matched neither in software nor in hardware. Signed-off-by: Jedrzej Jagielski --- .../tc-testing/tc-tests/filters/u32.json | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tools/testing/selftests/tc-testing/tc-tests/filters/u32.json b/tools/testing/selftests/tc-testing/tc-tests/filters/u32.json index edc5148a8d97..a97caf9ff85d 100644 --- a/tools/testing/selftests/tc-testing/tc-tests/filters/u32.json +++ b/tools/testing/selftests/tc-testing/tc-tests/filters/u32.json @@ -424,5 +424,27 @@ "teardown": [ "$TC qdisc del dev $DEV1 ingress" ] + }, + { + "id": "a6e9", + "name": "Reject u32 with skip_sw on device without offload support", + "category": [ + "filter", + "u32" + ], + "plugins": { + "requires": "nsPlugin" + }, + "setup": [ + "$TC qdisc add dev $DUMMY ingress" + ], + "cmdUnderTest": "$TC filter add dev $DUMMY ingress u32 match u32 0 0 skip_sw", + "expExitCode": "2", + "verifyCmd": "$TC filter show dev $DUMMY ingress", + "matchPattern": "u32", + "matchCount": "0", + "teardown": [ + "$TC qdisc del dev $DUMMY ingress" + ] } ] -- 2.31.1