Netdev List
 help / color / mirror / Atom feed
From: Jamal Hadi Salim <jhs@mojatatu.com>
To: netdev@vger.kernel.org
Cc: Jamal Hadi Salim <jhs@mojatatu.com>,
	Jiri Pirko <jiri@resnulli.us>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Willem de Bruijn <willemb@google.com>,
	Simon Horman <horms@kernel.org>, Shuah Khan <shuah@kernel.org>,
	Victor Nogueira <victor@mojatatu.com>,
	linux-kselftest@vger.kernel.org, Po Liu <Po.Liu@nxp.com>
Subject: [PATCH net v4 3/3] selftests: tc-testing: act_gate: cover the new cycle time and interval limits
Date: Tue, 24 Nov 2026 09:12:10 -0500	[thread overview]
Message-ID: <ACT-WEXM.v4.r0.20261124074514-3@mojatatu.com> (raw)
In-Reply-To: <ACT-WEXM.v4.r0.20261124074514@mojatatu.com>

The tests:
The gate action now bounds the base time and the cycle time at KTIME_MAX
and refuses a schedule entry shorter than 10 us.  Cover the four
refusals, both ends of the cycle time range and both sides of the
interval boundary.

The refusals:
A base time or a cycle time of 2^63 is above KTIME_MAX, so it is refused
as out of range; a base time of -1 reaches the kernel as the largest u64
and is refused the same way.  An entry interval of 9999 ns is below the
floor and is refused as an invalid argument.

The accepted values:
An entry interval of exactly 10000 ns installs and reads back with the
interval it was given, and so do a base time and a cycle time of exactly
KTIME_MAX.

Context note:
tc does not pass the action path's extended acknowledgment back to the
caller, so the negative cases re-run the failing command and match the
kernel's own error text instead of relying on the exit code alone.

Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
---
 .../tc-testing/tc-tests/actions/gate.json     | 189 ++++++++++++++++++
 1 file changed, 189 insertions(+)

diff --git a/tools/testing/selftests/tc-testing/tc-tests/actions/gate.json b/tools/testing/selftests/tc-testing/tc-tests/actions/gate.json
index db645c22ad7b..1c910e07c41c 100644
--- a/tools/testing/selftests/tc-testing/tc-tests/actions/gate.json
+++ b/tools/testing/selftests/tc-testing/tc-tests/actions/gate.json
@@ -347,5 +347,194 @@
         "teardown": [
             "$TC action flush action gate"
         ]
+    },
+    {
+        "id": "c873",
+        "name": "Add gate action with the minimum schedule entry interval",
+        "category": [
+            "actions",
+            "gate"
+        ],
+        "plugins": {
+           "requires": "nsPlugin"
+        },
+        "setup": [
+            [
+                "$TC actions flush action gate",
+                0,
+                1,
+                255
+            ]
+        ],
+        "cmdUnderTest": "$TC action add action gate sched-entry close 10000ns index 100",
+        "expExitCode": "0",
+        "verifyCmd": "$TC action get action gate index 100",
+        "matchPattern": "interval 10us",
+        "matchCount": "1",
+        "teardown": [
+            "$TC actions flush action gate"
+        ]
+    },
+    {
+        "id": "2c35",
+        "name": "Reject gate action with a schedule entry below the minimum interval",
+        "category": [
+            "actions",
+            "gate"
+        ],
+        "plugins": {
+           "requires": "nsPlugin"
+        },
+        "setup": [
+            [
+                "$TC actions flush action gate",
+                0,
+                1,
+                255
+            ]
+        ],
+        "cmdUnderTest": "$TC action add action gate sched-entry close 9999ns index 100",
+        "expExitCode": "255",
+        "verifyCmd": "$TC action add action gate sched-entry close 9999ns index 100 2>&1",
+        "matchPattern": "RTNETLINK answers: Invalid argument",
+        "matchCount": "1",
+        "teardown": [
+            "$TC actions flush action gate"
+        ]
+    },
+    {
+        "id": "92b8",
+        "name": "Reject gate action with a base time above S64_MAX",
+        "category": [
+            "actions",
+            "gate"
+        ],
+        "plugins": {
+           "requires": "nsPlugin"
+        },
+        "setup": [
+            [
+                "$TC actions flush action gate",
+                0,
+                1,
+                255
+            ]
+        ],
+        "cmdUnderTest": "$TC action add action gate base-time 9223372036854775808 sched-entry close 10000ns index 200",
+        "expExitCode": "255",
+        "verifyCmd": "$TC action add action gate base-time 9223372036854775808 sched-entry close 10000ns index 200 2>&1",
+        "matchPattern": "RTNETLINK answers: Numerical result out of range",
+        "matchCount": "1",
+        "teardown": [
+            "$TC actions flush action gate"
+        ]
+    },
+    {
+        "id": "8265",
+        "name": "Reject gate action with a cycle time above S64_MAX",
+        "category": [
+            "actions",
+            "gate"
+        ],
+        "plugins": {
+           "requires": "nsPlugin"
+        },
+        "setup": [
+            [
+                "$TC actions flush action gate",
+                0,
+                1,
+                255
+            ]
+        ],
+        "cmdUnderTest": "$TC action add action gate cycle-time 9223372036854775808 sched-entry close 10000ns index 300",
+        "expExitCode": "255",
+        "verifyCmd": "$TC action add action gate cycle-time 9223372036854775808 sched-entry close 10000ns index 300 2>&1",
+        "matchPattern": "RTNETLINK answers: Numerical result out of range",
+        "matchCount": "1",
+        "teardown": [
+            "$TC actions flush action gate"
+        ]
+    },
+    {
+        "id": "7d1f",
+        "name": "Add gate action with the maximum base time",
+        "category": [
+            "actions",
+            "gate"
+        ],
+        "plugins": {
+            "requires": "nsPlugin"
+        },
+        "setup": [
+            [
+                "$TC actions flush action gate",
+                0,
+                1,
+                255
+            ]
+        ],
+        "cmdUnderTest": "$TC action add action gate base-time 9223372036854775807 sched-entry close 10000ns index 201",
+        "expExitCode": "0",
+        "verifyCmd": "$TC action get action gate index 201",
+        "matchPattern": "index 201",
+        "matchCount": "1",
+        "teardown": [
+            "$TC actions flush action gate"
+        ]
+    },
+    {
+        "id": "9f10",
+        "name": "Add gate action with the maximum cycle time",
+        "category": [
+            "actions",
+            "gate"
+        ],
+        "plugins": {
+            "requires": "nsPlugin"
+        },
+        "setup": [
+            [
+                "$TC actions flush action gate",
+                0,
+                1,
+                255
+            ]
+        ],
+        "cmdUnderTest": "$TC action add action gate cycle-time 9223372036854775807 sched-entry close 10000ns index 301",
+        "expExitCode": "0",
+        "verifyCmd": "$TC action get action gate index 301",
+        "matchPattern": "index 301",
+        "matchCount": "1",
+        "teardown": [
+            "$TC actions flush action gate"
+        ]
+    },
+    {
+        "id": "5c47",
+        "name": "Reject gate action with a negative base time",
+        "category": [
+            "actions",
+            "gate"
+        ],
+        "plugins": {
+            "requires": "nsPlugin"
+        },
+        "setup": [
+            [
+                "$TC actions flush action gate",
+                0,
+                1,
+                255
+            ]
+        ],
+        "cmdUnderTest": "$TC action add action gate base-time -1 sched-entry close 10000ns index 401",
+        "expExitCode": "255",
+        "verifyCmd": "$TC action add action gate base-time -1 sched-entry close 10000ns index 401 2>&1",
+        "matchPattern": "RTNETLINK answers: Numerical result out of range",
+        "matchCount": "1",
+        "teardown": [
+            "$TC actions flush action gate"
+        ]
     }
 ]
-- 
2.43.0


      parent reply	other threads:[~2026-11-24 14:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 14:12 [PATCH net v4 0/3] net/sched: act_gate: bound the cycle time and refuse schedule entries shorter than 10 us Jamal Hadi Salim
2026-11-24 14:12 ` [PATCH net v4 1/3] net/sched: act_gate: bound the cycle time and start time arithmetic Jamal Hadi Salim
2026-11-24 14:12 ` [PATCH net v4 2/3] net/sched: act_gate: refuse schedule entries shorter than 10 us Jamal Hadi Salim
2026-11-24 14:12 ` Jamal Hadi Salim [this message]

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=ACT-WEXM.v4.r0.20261124074514-3@mojatatu.com \
    --to=jhs@mojatatu.com \
    --cc=Po.Liu@nxp.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shuah@kernel.org \
    --cc=victor@mojatatu.com \
    --cc=willemb@google.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