Skip to content

Commit

Permalink
selftests: tc-testing: add action offload selftest for action and filter
Browse files Browse the repository at this point in the history
Add selftest cases in action police with skip_hw.
Add selftest case to validate flags of filter and action.
These tests depend on corresponding iproute2 command support.

Signed-off-by: Baowen Zheng <baowen.zheng@corigine.com>
Signed-off-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Baowen Zheng authored and David S. Miller committed Dec 19, 2021
1 parent c86e020 commit eb473ba
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tools/testing/selftests/tc-testing/tc-tests/actions/police.json
Original file line number Diff line number Diff line change
Expand Up @@ -812,5 +812,29 @@
"teardown": [
"$TC actions flush action police"
]
},
{
"id": "7d64",
"name": "Add police action with skip_hw option",
"category": [
"actions",
"police"
],
"setup": [
[
"$TC actions flush action police",
0,
1,
255
]
],
"cmdUnderTest": "$TC actions add action police rate 1kbit burst 10k index 100 skip_hw",
"expExitCode": "0",
"verifyCmd": "$TC actions ls action police | grep skip_hw",
"matchPattern": "skip_hw",
"matchCount": "1",
"teardown": [
"$TC actions flush action police"
]
}
]
72 changes: 72 additions & 0 deletions tools/testing/selftests/tc-testing/tc-tests/filters/matchall.json
Original file line number Diff line number Diff line change
Expand Up @@ -387,5 +387,77 @@
"$TC qdisc del dev $DUMMY ingress",
"$IP link del dev $DUMMY type dummy"
]
},
{
"id": "3329",
"name": "Validate flags of the matchall filter with skip_sw and police action with skip_hw",
"category": [
"filter",
"matchall"
],
"setup": [
"$IP link add dev $DUMMY type dummy || /bin/true",
"$TC qdisc add dev $DUMMY ingress",
"$TC actions flush action police",
"$TC actions add action police rate 1mbit burst 100k index 199 skip_hw"
],
"cmdUnderTest": "$TC filter add dev $DUMMY parent ffff: handle 0x1 prio 1 protocol ipv4 matchall skip_sw action police index 199",
"expExitCode": "2",
"verifyCmd": "$TC filter get dev $DUMMY parent ffff: handle 1 prio 1 protocol ipv4 matchall",
"matchPattern": "^filter parent ffff: protocol ip pref 1 matchall.*handle 0x1.*",
"matchCount": "0",
"teardown": [
"$TC qdisc del dev $DUMMY ingress",
"$IP link del dev $DUMMY type dummy",
"$TC actions del action police index 199"
]
},
{
"id": "0eeb",
"name": "Validate flags of the matchall filter with skip_hw and police action",
"category": [
"filter",
"matchall"
],
"setup": [
"$IP link add dev $DUMMY type dummy || /bin/true",
"$TC qdisc add dev $DUMMY ingress",
"$TC actions flush action police",
"$TC actions add action police rate 1mbit burst 100k index 199"
],
"cmdUnderTest": "$TC filter add dev $DUMMY parent ffff: handle 0x1 prio 1 protocol ipv4 matchall skip_hw action police index 199",
"expExitCode": "2",
"verifyCmd": "$TC filter get dev $DUMMY parent ffff: handle 1 prio 1 protocol ipv4 matchall",
"matchPattern": "^filter parent ffff: protocol ip pref 1 matchall.*handle 0x1.*",
"matchCount": "0",
"teardown": [
"$TC qdisc del dev $DUMMY ingress",
"$IP link del dev $DUMMY type dummy",
"$TC actions del action police index 199"
]
},
{
"id": "eee4",
"name": "Validate flags of the matchall filter with skip_sw and police action",
"category": [
"filter",
"matchall"
],
"setup": [
"$IP link add dev $DUMMY type dummy || /bin/true",
"$TC qdisc add dev $DUMMY ingress",
"$TC actions flush action police",
"$TC actions add action police rate 1mbit burst 100k index 199"
],
"cmdUnderTest": "$TC filter add dev $DUMMY parent ffff: handle 0x1 prio 1 protocol ipv4 matchall skip_sw action police index 199",
"expExitCode": "2",
"verifyCmd": "$TC filter get dev $DUMMY parent ffff: handle 1 prio 1 protocol ipv4 matchall",
"matchPattern": "^filter parent ffff: protocol ip pref 1 matchall.*handle 0x1.*",
"matchCount": "0",
"teardown": [
"$TC qdisc del dev $DUMMY ingress",
"$IP link del dev $DUMMY type dummy",
"$TC actions del action police index 199"
]
}
]

0 comments on commit eb473ba

Please sign in to comment.