From: Todd Freed <toddfreed@meta.com>
To: <netdev@vger.kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>,
"Andrew Lunn" <andrew+netdev@lunn.ch>,
"Björn Töpel" <bjorn@kernel.org>,
"Boris Pismenny" <borisp@nvidia.com>,
"Cosmin Ratiu" <cratiu@nvidia.com>,
"Daniel Zahka" <daniel.zahka@gmail.com>,
"Donald Hunter" <donald.hunter@gmail.com>,
"Dragos Tatulea" <dtatulea@nvidia.com>,
"Eric Dumazet" <edumazet@kernel.org>,
"Jakub Kicinski" <kuba@kernel.org>,
"Jamal Hadi Salim" <jhs@mojatatu.com>,
"Jiri Pirko" <jiri@resnulli.us>,
"Leon Romanovsky" <leon@kernel.org>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org, linux-rdma@vger.kernel.org,
"Mark Bloch" <mbloch@nvidia.com>,
"Paolo Abeni" <pabeni@redhat.com>,
"Pedro Tammela" <pctammela@mojatatu.com>,
"Saeed Mahameed" <saeedm@nvidia.com>,
"Simon Horman" <horms@kernel.org>,
"Tariq Toukan" <tariqt@nvidia.com>,
"Wei Wang" <weiwan@google.com>,
"Willem de Bruijn" <willemdebruijn.kernel@gmail.com>
Subject: [PATCH net-next v2 11/12] selftests: tc-testing: add tests for the psp action
Date: Wed, 18 Nov 2026 17:31:02 -0800 [thread overview]
Message-ID: <20261119013103.1092559-12-toddfreed@meta.com> (raw)
In-Reply-To: <20261119013103.1092559-1-toddfreed@meta.com>
Add / replace / delete / flush psp decap actions, check that
associations which don't exist are rejected, and add flower filters
matching on psp_spi, psp_ver and psp_dev, out of range psp_ver and
psp_dev rejected.
The tests of rejected actions match the kernel's extack message, so
that they don't pass on tc's own argument checks. tc itself refuses
decap with an association, and encap without one, so those kernel
checks aren't covered here.
Creating associations takes the PSP netlink family and a PSP device;
the drv-net psp.py test covers actions using them.
The tests need a tc with the psp action and the flower psp_* keys; they
skip without it (dependsOn).
Signed-off-by: Todd Freed <toddfreed@meta.com>
---
tools/testing/selftests/tc-testing/config | 2 +
.../tc-testing/tc-tests/actions/psp.json | 403 ++++++++++++++++++
tools/testing/selftests/tc-testing/tdc.sh | 1 +
3 files changed, 406 insertions(+)
create mode 100644 tools/testing/selftests/tc-testing/tc-tests/actions/psp.json
diff --git a/tools/testing/selftests/tc-testing/config b/tools/testing/selftests/tc-testing/config
index 0e5618be0335..7828161cc3c8 100644
--- a/tools/testing/selftests/tc-testing/config
+++ b/tools/testing/selftests/tc-testing/config
@@ -101,6 +101,8 @@ CONFIG_NET_ACT_TUNNEL_KEY=m
CONFIG_NET_ACT_CT=m
CONFIG_NET_ACT_MPLS=m
CONFIG_NET_ACT_GATE=m
+CONFIG_INET_PSP=y
+CONFIG_NET_ACT_PSP=m
CONFIG_NET_IFE_SKBMARK=m
CONFIG_NET_IFE_SKBPRIO=m
CONFIG_NET_IFE_SKBTCINDEX=m
diff --git a/tools/testing/selftests/tc-testing/tc-tests/actions/psp.json b/tools/testing/selftests/tc-testing/tc-tests/actions/psp.json
new file mode 100644
index 000000000000..af5366caf5c7
--- /dev/null
+++ b/tools/testing/selftests/tc-testing/tc-tests/actions/psp.json
@@ -0,0 +1,403 @@
+[
+ {
+ "id": "8357",
+ "name": "Add psp decap action",
+ "category": [
+ "actions",
+ "psp"
+ ],
+ "dependsOn": "$TC actions add action psp help 2>&1 | grep -q decap",
+ "plugins": {
+ "requires": "nsPlugin"
+ },
+ "setup": [
+ [
+ "$TC actions flush action psp",
+ 0,
+ 1,
+ 255
+ ]
+ ],
+ "cmdUnderTest": "$TC actions add action psp decap index 1",
+ "expExitCode": "0",
+ "verifyCmd": "$TC actions get action psp index 1",
+ "matchPattern": "action order [0-9]+: psp decap pipe.*index 1 ref",
+ "matchCount": "1",
+ "teardown": [
+ "$TC actions flush action psp"
+ ]
+ },
+ {
+ "id": "7676",
+ "name": "Add psp decap action with drop control",
+ "category": [
+ "actions",
+ "psp"
+ ],
+ "dependsOn": "$TC actions add action psp help 2>&1 | grep -q decap",
+ "plugins": {
+ "requires": "nsPlugin"
+ },
+ "setup": [
+ [
+ "$TC actions flush action psp",
+ 0,
+ 1,
+ 255
+ ]
+ ],
+ "cmdUnderTest": "$TC actions add action psp decap drop index 2",
+ "expExitCode": "0",
+ "verifyCmd": "$TC actions get action psp index 2",
+ "matchPattern": "action order [0-9]+: psp decap drop.*index 2 ref",
+ "matchCount": "1",
+ "teardown": [
+ "$TC actions flush action psp"
+ ]
+ },
+ {
+ "id": "9a26",
+ "name": "Add psp decap action without index",
+ "category": [
+ "actions",
+ "psp"
+ ],
+ "dependsOn": "$TC actions add action psp help 2>&1 | grep -q decap",
+ "plugins": {
+ "requires": "nsPlugin"
+ },
+ "setup": [
+ [
+ "$TC actions flush action psp",
+ 0,
+ 1,
+ 255
+ ]
+ ],
+ "cmdUnderTest": "$TC actions add action psp decap",
+ "expExitCode": "0",
+ "verifyCmd": "$TC actions list action psp",
+ "matchPattern": "action order [0-9]+: psp decap pipe",
+ "matchCount": "1",
+ "teardown": [
+ "$TC actions flush action psp"
+ ]
+ },
+ {
+ "id": "156e",
+ "name": "Replace psp decap action",
+ "category": [
+ "actions",
+ "psp"
+ ],
+ "dependsOn": "$TC actions add action psp help 2>&1 | grep -q decap",
+ "plugins": {
+ "requires": "nsPlugin"
+ },
+ "setup": [
+ [
+ "$TC actions flush action psp",
+ 0,
+ 1,
+ 255
+ ],
+ "$TC actions add action psp decap index 3"
+ ],
+ "cmdUnderTest": "$TC actions replace action psp decap pass index 3",
+ "expExitCode": "0",
+ "verifyCmd": "$TC actions get action psp index 3",
+ "matchPattern": "action order [0-9]+: psp decap pass.*index 3 ref",
+ "matchCount": "1",
+ "teardown": [
+ "$TC actions flush action psp"
+ ]
+ },
+ {
+ "id": "006b",
+ "name": "Add psp action with an existing index",
+ "category": [
+ "actions",
+ "psp"
+ ],
+ "dependsOn": "$TC actions add action psp help 2>&1 | grep -q decap",
+ "plugins": {
+ "requires": "nsPlugin"
+ },
+ "setup": [
+ [
+ "$TC actions flush action psp",
+ 0,
+ 1,
+ 255
+ ],
+ "$TC actions add action psp decap index 4"
+ ],
+ "cmdUnderTest": "$TC actions add action psp decap pass index 4",
+ "expExitCode": "255",
+ "verifyCmd": "$TC actions get action psp index 4",
+ "matchPattern": "action order [0-9]+: psp decap pipe.*index 4 ref",
+ "matchCount": "1",
+ "teardown": [
+ "$TC actions flush action psp"
+ ]
+ },
+ {
+ "id": "3f41",
+ "name": "Delete psp action",
+ "category": [
+ "actions",
+ "psp"
+ ],
+ "dependsOn": "$TC actions add action psp help 2>&1 | grep -q decap",
+ "plugins": {
+ "requires": "nsPlugin"
+ },
+ "setup": [
+ [
+ "$TC actions flush action psp",
+ 0,
+ 1,
+ 255
+ ],
+ "$TC actions add action psp decap index 5"
+ ],
+ "cmdUnderTest": "$TC actions del action psp index 5",
+ "expExitCode": "0",
+ "verifyCmd": "$TC actions list action psp",
+ "matchPattern": "action order [0-9]+: psp",
+ "matchCount": "0",
+ "teardown": [
+ "$TC actions flush action psp"
+ ]
+ },
+ {
+ "id": "2b21",
+ "name": "Flush psp actions",
+ "category": [
+ "actions",
+ "psp"
+ ],
+ "dependsOn": "$TC actions add action psp help 2>&1 | grep -q decap",
+ "plugins": {
+ "requires": "nsPlugin"
+ },
+ "setup": [
+ [
+ "$TC actions flush action psp",
+ 0,
+ 1,
+ 255
+ ],
+ "$TC actions add action psp decap index 6",
+ "$TC actions add action psp decap drop index 7"
+ ],
+ "cmdUnderTest": "$TC actions flush action psp",
+ "expExitCode": "0",
+ "verifyCmd": "$TC actions list action psp",
+ "matchPattern": "action order [0-9]+: psp",
+ "matchCount": "0",
+ "teardown": [
+ "$TC actions flush action psp"
+ ]
+ },
+ {
+ "id": "2d50",
+ "name": "Add psp action without encap or decap",
+ "category": [
+ "actions",
+ "psp"
+ ],
+ "dependsOn": "$TC actions add action psp help 2>&1 | grep -q decap",
+ "plugins": {
+ "requires": "nsPlugin"
+ },
+ "setup": [
+ [
+ "$TC actions flush action psp",
+ 0,
+ 1,
+ 255
+ ]
+ ],
+ "cmdUnderTest": "$TC actions add action psp index 12 2>&1 | grep -q 'Missing PSP action, encap or decap'",
+ "expExitCode": "0",
+ "verifyCmd": "$TC actions list action psp",
+ "matchPattern": "action order [0-9]+: psp",
+ "matchCount": "0",
+ "teardown": [
+ "$TC actions flush action psp"
+ ]
+ },
+ {
+ "id": "3203",
+ "name": "Add psp encap action with an unknown assoc",
+ "category": [
+ "actions",
+ "psp"
+ ],
+ "dependsOn": "$TC actions add action psp help 2>&1 | grep -q decap",
+ "plugins": {
+ "requires": "nsPlugin"
+ },
+ "setup": [
+ [
+ "$TC actions flush action psp",
+ 0,
+ 1,
+ 255
+ ]
+ ],
+ "cmdUnderTest": "$TC actions add action psp encap assoc 4294967295 index 9",
+ "expExitCode": "255",
+ "verifyCmd": "$TC actions list action psp",
+ "matchPattern": "action order [0-9]+: psp",
+ "matchCount": "0",
+ "teardown": [
+ "$TC actions flush action psp"
+ ]
+ },
+ {
+ "id": "a744",
+ "name": "Add flower psp_spi filter with psp decap",
+ "category": [
+ "actions",
+ "psp",
+ "filter"
+ ],
+ "dependsOn": "$TC filter add flower help 2>&1 | grep -q psp_spi && $TC actions add action psp help 2>&1 | grep -q decap",
+ "plugins": {
+ "requires": "nsPlugin"
+ },
+ "setup": [
+ "$TC qdisc add dev $DEV1 ingress"
+ ],
+ "cmdUnderTest": "$TC filter add dev $DEV1 ingress protocol ip pref 1 flower psp_spi 0x1234 action psp decap",
+ "expExitCode": "0",
+ "verifyCmd": "$TC filter show dev $DEV1 ingress",
+ "matchPattern": "psp_spi 0x1234.*psp decap pipe",
+ "matchCount": "1",
+ "teardown": [
+ "$TC qdisc del dev $DEV1 ingress"
+ ]
+ },
+ {
+ "id": "be4e",
+ "name": "Add flower psp_spi filter with mask",
+ "category": [
+ "actions",
+ "psp",
+ "filter"
+ ],
+ "dependsOn": "$TC filter add flower help 2>&1 | grep -q psp_spi",
+ "plugins": {
+ "requires": "nsPlugin"
+ },
+ "setup": [
+ "$TC qdisc add dev $DEV1 ingress"
+ ],
+ "cmdUnderTest": "$TC filter add dev $DEV1 ingress protocol ipv6 pref 1 flower psp_spi 0x80001234/0x8000ffff action drop",
+ "expExitCode": "0",
+ "verifyCmd": "$TC filter show dev $DEV1 ingress",
+ "matchPattern": "psp_spi 0x80001234/0x8000ffff",
+ "matchCount": "1",
+ "teardown": [
+ "$TC qdisc del dev $DEV1 ingress"
+ ]
+ },
+ {
+ "id": "4e1f",
+ "name": "Add flower psp_spi, psp_ver and psp_dev filter with psp decap",
+ "category": [
+ "actions",
+ "psp",
+ "filter"
+ ],
+ "dependsOn": "$TC filter add flower help 2>&1 | grep -q psp_spi && $TC actions add action psp help 2>&1 | grep -q decap",
+ "plugins": {
+ "requires": "nsPlugin"
+ },
+ "setup": [
+ "$TC qdisc add dev $DEV1 ingress"
+ ],
+ "cmdUnderTest": "$TC filter add dev $DEV1 ingress protocol ip pref 1 flower psp_spi 0x1234 psp_ver 1 psp_dev 7 action psp decap",
+ "expExitCode": "0",
+ "verifyCmd": "$TC filter show dev $DEV1 ingress",
+ "matchPattern": "psp_spi 0x1234.*psp_ver 1.*psp_dev 7.*psp decap pipe",
+ "matchCount": "1",
+ "teardown": [
+ "$TC qdisc del dev $DEV1 ingress"
+ ]
+ },
+ {
+ "id": "7c3a",
+ "name": "Add flower psp_ver 0 filter",
+ "category": [
+ "actions",
+ "psp",
+ "filter"
+ ],
+ "dependsOn": "$TC filter add flower help 2>&1 | grep -q psp_spi",
+ "plugins": {
+ "requires": "nsPlugin"
+ },
+ "setup": [
+ "$TC qdisc add dev $DEV1 ingress"
+ ],
+ "cmdUnderTest": "$TC filter add dev $DEV1 ingress protocol ipv6 pref 1 flower psp_ver 0 action drop",
+ "expExitCode": "0",
+ "verifyCmd": "$TC filter show dev $DEV1 ingress",
+ "matchPattern": "psp_ver 0",
+ "matchCount": "1",
+ "teardown": [
+ "$TC qdisc del dev $DEV1 ingress"
+ ]
+ },
+ {
+ "id": "b58d",
+ "name": "Add flower psp_ver filter with an invalid version",
+ "category": [
+ "actions",
+ "psp",
+ "filter"
+ ],
+ "dependsOn": "$TC filter add flower help 2>&1 | grep -q psp_spi",
+ "plugins": {
+ "requires": "nsPlugin"
+ },
+ "setup": [
+ "$TC qdisc add dev $DEV1 ingress"
+ ],
+ "cmdUnderTest": "$TC filter add dev $DEV1 ingress protocol ip pref 1 flower psp_ver 16 action drop",
+ "expExitCode": "2",
+ "verifyCmd": "$TC filter show dev $DEV1 ingress",
+ "matchPattern": "psp_ver",
+ "matchCount": "0",
+ "teardown": [
+ "$TC qdisc del dev $DEV1 ingress"
+ ]
+ },
+ {
+ "id": "2f96",
+ "name": "Add flower psp_dev filter with an invalid device",
+ "category": [
+ "actions",
+ "psp",
+ "filter"
+ ],
+ "dependsOn": "$TC filter add flower help 2>&1 | grep -q psp_spi",
+ "plugins": {
+ "requires": "nsPlugin"
+ },
+ "setup": [
+ "$TC qdisc add dev $DEV1 ingress"
+ ],
+ "cmdUnderTest": "$TC filter add dev $DEV1 ingress protocol ip pref 1 flower psp_dev 65536 action drop",
+ "expExitCode": "2",
+ "verifyCmd": "$TC filter show dev $DEV1 ingress",
+ "matchPattern": "psp_dev",
+ "matchCount": "0",
+ "teardown": [
+ "$TC qdisc del dev $DEV1 ingress"
+ ]
+ }
+]
diff --git a/tools/testing/selftests/tc-testing/tdc.sh b/tools/testing/selftests/tc-testing/tdc.sh
index 25cdc256287d..433af92364ac 100755
--- a/tools/testing/selftests/tc-testing/tdc.sh
+++ b/tools/testing/selftests/tc-testing/tdc.sh
@@ -24,6 +24,7 @@ try_modprobe act_mpls
try_modprobe act_nat
try_modprobe act_pedit
try_modprobe act_police
+try_modprobe act_psp
try_modprobe act_sample
try_modprobe act_simple
try_modprobe act_skbedit
--
2.53.1-Meta
next prev parent reply other threads:[~2026-11-19 1:31 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 1:30 [PATCH net-next v2 00/12] psp: introduce socket-less associations Todd Freed
2026-11-19 1:30 ` [PATCH net-next v2 01/12] psp: get netns from net_device instead of sock Todd Freed
2026-11-19 1:30 ` [PATCH net-next v2 02/12] psp: take the psp nexthdr from the packet on encap Todd Freed
2026-11-19 1:30 ` [PATCH net-next v2 03/12] psp: declare psp_assoc_set_tx() in psp.h Todd Freed
2026-11-19 1:30 ` [PATCH net-next v2 04/12] psp: add support for socket-less psp associations Todd Freed
2026-11-19 1:30 ` [PATCH net-next v2 05/12] net: add METADATA_PSP dst to carry a psp association on an skb Todd Freed
2026-11-19 1:30 ` [PATCH net-next v2 06/12] net/sched: add act_psp for psp transport mode Todd Freed
2026-11-19 1:30 ` [PATCH net-next v2 07/12] net/sched: flower: add psp_spi, psp_ver, and psp_dev matches Todd Freed
2026-11-19 1:30 ` [PATCH net-next v2 08/12] selftests: drv-net: psp: test socket-less associations and the tc psp action Todd Freed
2026-11-19 1:31 ` [PATCH net-next v2 09/12] selftests: drv-net: psp: test that software encap on ingress drops Todd Freed
2026-11-19 1:31 ` [PATCH net-next v2 10/12] selftests: tc-testing: run dependsOn probes outside the test namespace Todd Freed
2026-11-19 1:31 ` Todd Freed [this message]
2026-11-19 1:31 ` [PATCH net-next v2 12/12] Documentation: networking: psp: document socket-less associations Todd Freed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261119013103.1092559-12-toddfreed@meta.com \
--to=toddfreed@meta.com \
--cc=andrew+netdev@lunn.ch \
--cc=bjorn@kernel.org \
--cc=borisp@nvidia.com \
--cc=cratiu@nvidia.com \
--cc=daniel.zahka@gmail.com \
--cc=davem@davemloft.net \
--cc=donald.hunter@gmail.com \
--cc=dtatulea@nvidia.com \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=mbloch@nvidia.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pctammela@mojatatu.com \
--cc=saeedm@nvidia.com \
--cc=tariqt@nvidia.com \
--cc=weiwan@google.com \
--cc=willemdebruijn.kernel@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®