🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #23514

[PATCH net v5 2/2] selftests: tc-testing: act_gate: cover the cycle time and base time bounds

#23514
From: Jamal Hadi Salim
Date: Fri, 27 Nov 2026 11:43
150 lines
15926 bytes
The tests:
The gate action now caps the base time and the cycle time at KTIME_MAX.
Cover the accepted upper bound and both refusals.

The accepted values:
A base time and a cycle time of exactly KTIME_MAX install, and the
read-back must show the value that was installed rather than only the
index.

The refusals:
-1 reaches the kernel as the largest u64, above KTIME_MAX, so it is
refused as out of range.  The negative cycle time is tested against a
base time that is itself accepted, so the case pins the cycle bound
instead of whichever bound is checked first.

Context note:
tc does not print the same error line on every build: without libmnl it
prints the strerror text, with libmnl the kernel's own message.  The
cases accept either.

The values are signed decimals on purpose: iproute2 falls back to
strtod() above S64_MAX and the conversion is undefined, so such an input
is refused on x86 and installs on the architectures that saturate it.

Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
---
 .../tc-testing/tc-tests/actions/gate.json     | 108 ++++++++++++++++++
 1 file changed, 108 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..e5450557751d 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,113 @@
         "teardown": [
             "$TC action 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 1000000ns index 201",
+        "expExitCode": "0",
+        "verifyCmd": "$TC -j action get action gate index 201",
+        "matchPattern": "\"base_time\":9223372036854775807",
+        "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 1000000ns index 301",
+        "expExitCode": "0",
+        "verifyCmd": "$TC -j action get action gate index 301",
+        "matchPattern": "\"cycle_time\":9223372036854775807",
+        "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 1000000ns index 401",
+        "expExitCode": "255",
+        "verifyCmd": "$TC action add action gate base-time -1 sched-entry close 1000000ns index 401 2>&1",
+        "matchPattern": "integer out of range|RTNETLINK answers: Numerical result out of range",
+        "matchCount": "1",
+        "teardown": [
+            "$TC actions flush action gate"
+        ]
+    },
+    {
+        "id": "b3c3",
+        "name": "Reject gate action with a negative cycle 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 cycle-time -1 sched-entry close 1000000ns index 402",
+        "expExitCode": "255",
+        "verifyCmd": "$TC action add action gate base-time 9223372036854775807 cycle-time -1 sched-entry close 1000000ns index 402 2>&1",
+        "matchPattern": "integer out of range|RTNETLINK answers: Numerical result out of range",
+        "matchCount": "1",
+        "teardown": [
+            "$TC actions flush action gate"
+        ]
     }
 ]
-- 
2.34.1
Technical Details
Message-ID: <ACT-WEXM.v5.r0.20261127063407-2@mojatatu.com>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-372696-linux-kernel-netdev=dewy.ru
References: <ACT-WEXM.v5.r0.20261127063407@mojatatu.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-372696-linux-kernel-netdev=dewy.ru
From: jhs@mojatatu.com (Jamal Hadi Salim)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v5 2/2] selftests: tc-testing: act_gate: cover the cycle time and base time bounds
Date: Fri, 27 Nov 2026 06:43:35 -0500
Organization: Usenet Network
Message-ID: <ACT-WEXM.v5.r0.20261127063407-2@mojatatu.com>
References: <ACT-WEXM.v5.r0.20261127063407@mojatatu.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="723097"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:jsbV1tS8W9tRjCfGe4rsfVyeZjM= sha256:qDBrvspo03ng0iGFcgpr+yCZRlAXauO5trQzlYRmAK8=
	sha1:IyjTfpbhssUXiqGsmOT+kCedG6M= sha256:EoTMi00rXGdWfNLzj0CqbS7wzYJ95L+Xvv763RV0P1o=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 8616A125F48; Fri, 27 Nov 2026 14:44:04 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.151
X-Spam-Status: No, score=-3.151 tagged_above=-9999 required=6.31
	tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
	HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key)
	header.d=mojatatu.com
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id 1x2ou2udmNIs;
	Fri, 27 Nov 2026 14:44:01 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-372696-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=mojatatu.com
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id BFCC0125F53; Fri, 27 Nov 2026 14:43:50 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 50B5A37DBA; Fri, 27 Nov 2026 11:43:47 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1795779827;
	b=lH488wXP5tKiL95dv/VRXyw+XjW+zwXyww1MKKrnqqT1cEE4O/Rn1igWyMW4NX2Rp9ZQ
	 /MsIkEPNsq/ROh7EbSoF6bJWw57Rf2zD8mspGCSf4pnRTITtX/PZqfzw2ZrGGuYIiMSoM
	 gY8bn+GhvdXNhpIDid9Y0bLcHQRM0DaGAS0KaFWBycqcEtZor6fYsCVZ8h8gk0gERIJwN
	 Gz4yulKGHUtCxiGF3Ec4QO43ysIMuAjHlghYp/j1Kog4FZgSQukBvck3LizoByC97PCF4
	 EC9laTQHXsK6SCAFCLiy/SsTUIXHRE7MAhnALc2h4ineAIKIJrSyeQFTtNpDUq2C9Dw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795779827;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
	 Received:From:To:Cc:Subject:Date:Message-Id:X-Mailer:In-Reply-To:
	 References:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Transfer-Encoding;
	bh=XcSXK5rWXolEwTqbF/BCgzXzRtdRpf4gIQiNQY2GeVc=;
	b=QXPkZJOLs9R0Hjf/eyGZdO4VxKUW1jPPJEzYjLQpnar3dhr+DN3XoSKaQ5H8WcDKpJNW
	 qrgIqVVn6qa00UIbyvppoEDRqeQ0OHebu3gCeEYNKSuKWnvKl3DG6YHsbl4U2N7EqHpOq
	 1Ftd5deQM7wwpSCYMqTkxN5lMEfS4UNPJ9MenbziI76+cnfOtFFvGBwmGOCsjVjogfl4o
	 BsxzT4p3wkFDb/n1wlwUOScwmCr7/dVF8JPK+Qw5foSlr7opG9oFy/aBC4N1pMZqamkC4
	 brwG35Yzq9GMUA+0jw/W5ddYJJxMd/ACpyNIIoMa26+AMIGdq/CQBpxE3ALR1B+xj8w==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=mojatatu.com header.i=@mojatatu.com header.a=rsa-sha256 header.s=google header.b=dGw07kn3;
	dmarc=none header.from=mojatatu.com;
	spf=none smtp.mailfrom=mojatatu.com;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 1655A606A32C;
	Fri, 27 Nov 2026 11:43:47 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key) header.d=mojatatu.com header.i=@mojatatu.com header.a=rsa-sha256 header.s=google header.b=dGw07kn3
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.160.172
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795779826;
	b=nojk1KsPDhm1mELYrbBqjlqMtBCqRFnV5ARUlEXGK3hrJuT44GZv/81A64k6GjG/bmKh
	 WjFKl8dLNjBc5sJxbisPmej6pVHOoYIdoeQQGqmU1rDFyJ54WRASTzFg6sHfka25ot51o
	 j5oDAilmYn79eFSfPAzIsYiTjnyN7nT0HGiS8OnH7Hi8fW6ivATh0wGQRR83OZYQbmpD6
	 sJlSXw618Zwh+yPuJDchx32pM/Q9shQKDYgFFKjohp298YG5NHx4sLpv4LUvQPlESGrF/
	 /EGNrhGXEkkRkQJF9mB3PwvbUV8JDuuinlhabjEt+LO+MR3/xFSh7xH7ppxQw5d2NnA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795779826;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject:
	 Date:Message-Id:X-Mailer:In-Reply-To:References:MIME-Version:
	 Content-Transfer-Encoding;
	bh=XcSXK5rWXolEwTqbF/BCgzXzRtdRpf4gIQiNQY2GeVc=;
	b=N511lLE+N7iIKJcpGfA2YpUn1or7ZOBi3OD0/SyekNmBMwzZ1SnJdp5NgMZitbqYi2ag
	 0bWiadbnEnyBOdFgmTlFm7ndp/2m2SEn/8b99ad4RoGcd/PVxKrHh8Nqr3RiTfl5PZKyG
	 s0Kd9hnHmQDFutMkTOepC6rHgHrevJ7zmNYSQNovm12h/J2tEtVgY3kdMxobMlEgilWwi
	 xgj08QvAMYQ9eATnVOFkEyvXFxV3jDWZN64w03BHNPyoyXuMNNTV8t2Kj1Ql04JKDLiio
	 1NRbQA5nnKFpviOYvDhgOhdgpApFUn4xC9GBE49IRxonC5bcXg0KCeCq4TgXli0B4Zw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=none header.from=mojatatu.com;
	spf=none smtp.mailfrom=mojatatu.com;
	dkim=pass header.d=mojatatu.com header.i=@mojatatu.com header.a=rsa-sha256 header.s=google header.b=dGw07kn3;
	arc=none smtp.remote-ip=209.85.160.172
X-Received: from mail-qt1-f172.google.com (mail-qt1-f172.google.com [209.85.160.172])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id E0492606A31E
	for <netdev@vger.kernel.org>; Fri, 27 Nov 2026 11:43:45 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org E0492606A31E
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=mojatatu.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=mojatatu.com
X-Received: by mail-qt1-f172.google.com with SMTP id d75a77b69052e-55d846e884eso49902951cf.2
        for <netdev@vger.kernel.org>; Fri, 27 Nov 2026 03:43:45 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=mojatatu.com; s=google; t=1795779825; x=1796384625; darn=vger.kernel.org;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=XcSXK5rWXolEwTqbF/BCgzXzRtdRpf4gIQiNQY2GeVc=;
        b=dGw07kn3kMZtQ0j4Y0Am+VjFse7tvg47sQhN44ULp9Ve/er+PjsrAHpIp0h9EscWEc
         G5hjOirwd5nzeKTLQeexK37Rzjcs2Ed0aM6glDjucCP+DL5zCkjmKXndvF8FrKx6HpPl
         4WbPp7p4yWCKsvxci9HOGDOhv0qBVP6rFhLEo=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1795779825; x=1796384625;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
         :to:cc:subject:date:message-id:reply-to:content-type;
        bh=XcSXK5rWXolEwTqbF/BCgzXzRtdRpf4gIQiNQY2GeVc=;
        b=FGcm+VZcm443NJDDWtY/GXbyUps8K5lCr+D90EhNdIda0GLdBOOXIol6lOe1lGfoqX
         7nIewbfcsmU6MK1ZyaxvrtNYFhZiTUHE4XuPNyzRSIiu9cES35Yn2q/govDekVQ1Zkhv
         GomHzjVZO2Q71Ged/zAahObLA/2OsvbUW2dx+/Jm7OtEAx2DmNNn8f9qXvgPJ4rO7Zzi
         EmmwKlNvt3BWOx6tyubH67PkUfNycttvA00PbUhTkTx9Xansd1l62QI12p3We2fGG4+Q
         boliT6F/hRMZzKOrXa40f/LmtMz8RwXr7wJItzf9ek0Lg+HNScRZNz17vP9xNevglsKo
         Kz2A==
X-Gm-Message-State: APuU4Z/L/ntHxUaF7yN87HMCKXfeWqhYq7cf0TT5PiLMBJJlPceVZmWE
	CtANs5Wq/kC9kkWK83vTCwgqodPcF69PsccX+hhFzODJhjZ7irap8n3gn+URWT0A/1HHj+WdGYQ
	ijE0=
X-Gm-Gg: AZFdTZcoobSHdD1KIMHOJiiSpwxCBVgr0/rxgwf7Vw5ibz2EMz248w99mPkqKeGhWbH
	zfeYcU2ycbGqkZwhz5jaEoDFT8jBiQLoOuEd10Qz0Nttt64A6URyGBSmxCQqrMoh0nNDbjT6LrK
	yhQ2LvDwqMrp7XgcyCxrSvt0TdYs3offX4n1YSAGts6mPD8FxYxw2LjGDnFjbwQ0VQMpKLkwtx2
	fJ+76ucQvSMEpny72JNyhxuoGhCQZ/HDctEuPgC6mCN/WHiSq5Ny0eD7qKFowQt+408NNqBSjik
	B1yE02+D1KB2GHv2bcw425OEkVVfZ0GdXWOE/zMm+Y1xcVxH+KZcrm+AlHlsKlOsxGKgd+wnCqu
	1dmphEIJyvc3qwVSZQ65y/ql5bE89ix5Gq0rO7WuUvGrBE9IIybhvmBzfH+gtg8pql3Ffsd0DXd
	OgN9ag+aFghEDXvFrutQrJZG8uzMyCpTdQdDItTsdgeMTxUTe6TGTNrSY0o5Z4ITCVNjl/Gz4g5
	g9l3vvBz0P0IHRCNyqZqjEmOdFkt6fF/hNZfwAebGiCczkTKKCVsUiJHcQrTCOjvrq63dPn0MfG
	I2bniEHZJHBZOVP6/sX9WpJmcF093S6ji+FFvt8/8Q1/KPOGVaBp8N9fm9J7c9If3ZtZ/qaIcVT
	pS3gdV4YjlIILrQ==
X-Received: by 2002:ac8:5a08:0:b0:55d:25a1:72ac with SMTP id d75a77b69052e-55d76a26882mr449612601cf.27.1795779824759;
        Fri, 27 Nov 2026 03:43:44 -0800 (PST)
X-Received: from localhost.localdomain ([64.203.83.2])
        by smtp.gmail.com with ESMTPSA id d75a77b69052e-55dcdd1a2c6sm16652551cf.20.2026.11.27.03.43.42
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Fri, 27 Nov 2026 03:43:44 -0800 (PST)
X-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>,
	linux-kselftest@vger.kernel.org,
	Alexei Starovoitov <ast@kernel.org>,
	Victor Nogueira <victor@mojatatu.com>,
	syzbot+0054fed3dc9085390f51@syzkaller.appspotmail.com,
	shaos <shawnq1@163.com>
X-Mailer: git-send-email 2.34.1
X-In-Reply-To: <ACT-WEXM.v5.r0.20261127063407@mojatatu.com>
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list