Article View: linux.kernel.netdev
Article #27187Re: [PATCH net-next 06/11] selftests: drv-net: tc_flower_police: Test police parameters
From: netdev-bot+sashiko
Date: Sat, 05 Dec 2026 00:15
Date: Sat, 05 Dec 2026 00:15
135 lines
13552 bytes
13552 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 1
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] selftests: drv-net: police_params() uses _add_filter() which
skips on error
- [Low] The authorship and Signed-off-by chain in the commit "selftests:
drv-net: tc_flower_police: Test police parameters" contradict each…
--
selftests: drv-net: tc_flower_police: Test police parameters
This commit adds a police_params test case to tc_flower_police.py. It
checks the pipe exceed action, peak rate, overhead and packet rate
options of act_police. If the device rejects an option, the test checks
that a plain police rule still limits traffic and then skips.
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> Signed-off-by: Mohsin Bashir <hmohsin@meta.com>
[Severity: Low]
This isn't a bug, but the Signed-off-by chain and the authorship don't
seem to agree.
The Author is Mohsin Bashir. Jakub Kicinski's Signed-off-by comes before
the author's, and there is no Co-developed-by tag.
Documentation/process/submitting-patches.rst allows two readings of a
Signed-off-by that comes before the author's:
- Jakub wrote the patch and passed it on. In that case the From: line
should name Jakub.
- Jakub co-wrote the patch. In that case a
"Co-developed-by: Jakub Kicinski <kuba@kernel.org>" line should come
right before his Signed-off-by.
Should the From: line be changed, or should a Co-developed-by tag be
added? The same pattern may also be on other patches in the series, but
only this commit's trailer was checked.
[ ... ]
> diff --git a/tools/testing/selftests/drivers/net/hw/tc_flower_police.py b/tools/testing/selftests/drivers/net/hw/tc_flower_police.py
> --- a/tools/testing/selftests/drivers/net/hw/tc_flower_police.py
> +++ b/tools/testing/selftests/drivers/net/hw/tc_flower_police.py
> @@ -330,6 +337,46 @@ def police_dst_prefix(cfg):
> ksft_pr("LOCAL_PREFIX_V6 is a /120, shorter masks not checked")
>
>
> +@ksft_variants([
> + KsftNamedVariant("exceed_pipe",
> + f"{_police(RATE_MBIT, exceed='pipe')} "
> + f"{_police(RATE_MBIT // 2)}",
> + RATE_MBIT + RATE_MBIT // 2),
> + KsftNamedVariant("peakrate",
> + _police(OFFERED_MBIT * 2,
> + extra=f"peakrate {RATE_MBIT}mbit mtu 65535"),
> + RATE_MBIT),
> + KsftNamedVariant("overhead",
> + _police(RATE_MBIT, extra=f"overhead {UDP_PAYLOAD}"),
> + RATE_MBIT * IP6_PKT_LEN / (IP6_PKT_LEN + UDP_PAYLOAD)),
> + KsftNamedVariant("pkts_rate",
> + "action police pkts_rate 1000 pkts_burst 100 "
> + "conform-exceed drop/ok", 1000 * IP6_PKT_LEN * 8 / 1e6),
> +])
> +def police_params(cfg, action, expect):
> + """
> + Check police parameters beyond the rate and burst. A device that
> + offloads the rule must limit the traffic as configured. A device may
> + reject it, and a plain police rule must then still limit the traffic,
> + after which the case is skipped.
> + """
> + _setup_clsact(cfg)
> + rule, dst = _dst_ip_rule(cfg)
> +
> + _check_baseline_rate(cfg)
> + added, err = _try_filter(cfg, rule, action, pref=10)
> + if added:
> + got = _iperf3(cfg, dst, OFFERED_MBIT)
> + _check_rate(got, expect, "policed flow")
> + return
> +
> + if _filter_info(cfg, 10) is not None:
> + raise KsftFailEx(f"Rejected filter left behind: {err}")
> + _add_filter(cfg, rule, _police(RATE_MBIT), pref=10, dst=dst)
> + reason = err.partition("\n")[0]
> + raise KsftSkipEx(f"Not offloaded: {reason}")
> +
> +
> def main() -> None:
> """Ksft boilerplate main."""
> with NetDrvEpEnv(__file__, nsim_test=False) as cfg:
[Severity: Medium]
Does this fallback check actually fail when the plain rule can't be
reinstalled?
The commit message and the docstring say that after a rejection the
test checks that a plain police rule still works. This goes through
_add_filter(), though, and _add_filter() raises
KsftSkipEx("Rule not offloaded: ...") whenever _try_filter() fails.
Consider a driver that rejects, say, peakrate but does not unwind its
own state on that error path, for example by leaking a flow entry or a
policer slot for the same dst_ip. The plain _police(RATE_MBIT) rule at
pref 10 would then fail to install.
The _filter_info(cfg, 10) check won't catch this, because tc core has
already dropped its software copy of the rejected filter. The failure
is reported as a SKIP from _add_filter(), and ksft_run() counts it the
same as a clean rejection.
So the regression this path seems meant to catch is reported as a
skip. Only the case where the plain rule installs but does not limit
the rate becomes a KsftFailEx.
Would it work to check plain police offload first? For example,
install and remove _police(RATE_MBIT) before trying the parameterized
action, or cache that result on cfg the way the baseline rate is
cached. Then a failure to add the plain rule after the rejection could
raise KsftFailEx, while devices that don't offload act_police at all
would still skip.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261204000521.3396802-1-mohsin.bashr%40gmail.com
Technical Details
Message-ID:
<179642973128.3146.7181971439969789325@kernel.org>Path:
mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mi.newsdeef.eu!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377761-linux-kernel-netdev=dewy.ruReferences:
<20261204000521.3396802-7-mohsin.bashr@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mi.newsdeef.eu!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377761-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next 06/11] selftests: drv-net: tc_flower_police: Test police parameters Date: Sat, 05 Dec 2026 00:15:31 +0000 Organization: Usenet Network Message-ID: <179642973128.3146.7181971439969789325@kernel.org> References: <20261204000521.3396802-7-mohsin.bashr@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2913899"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:jER9KTjOXn+Ra0/QH9H/FWQvpLM= sha256:Pp5+MuobfAMr1zEhu64nIG+v+BpdRqpZ8G9faVVztuU= sha1:/hZBWBJJtrApvQynBuatfbzPzvo= sha256:AMfDHzBpK0jDzwAISn82XIs///hcJCoX22k6g4p1pJ8= 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 2DDD7117D2A; Sat, 5 Dec 2026 03:16:08 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.542 X-Spam-Status: No, score=-3.542 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.142, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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 (2048-bit key) header.d=kernel.org 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 lXXzsL9TQnUa; Sat, 5 Dec 2026 03:16:04 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-377761-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id A65F7117D25; Sat, 5 Dec 2026 03:15:54 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id F0BDC3B770; Sat, 5 Dec 2026 00:15:36 +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=1796429733; b=0IunMYmO7MUgRS0X0jxZmfCZ3VeodISObS3ShOjyCS7+fuMaVYmHMb59fdPSNh2otJGI ct/Rhcil1UInmSDJGmMr4/sHpuCl6G1CpVk1TJo2wszKRZ2n4xgcVAK6Vtw3bkmWNxq2q 2UFndo6zRcbPyGN0IZ6ltMR/hyBHoZV5Ej9NjYW98Ojcy+Foi5OWKjdk3oCczB55+HfNM FD5OccK0fScmEBssaRo/fdusw4xBAcT9dbNQ34szsFXVNqmBXUNlFPonAGXsy3Qg8h7Ej A9K3QHosV74oMkH6goYAbhTif8h9lgvt0py1PMGMNwhr97nXscAlnjQtjplfZOWiAQw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796429733; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=bAsAhUG83f3XOOFpjSLtj99iKVy1nXa/WSnQ4vP+tB4=; b=l6ct+9triJI9Qssnsr+i2u+8Vf3obntAgg76RXSotErYlmXvluzQUXmm0p7E8jNVjcfC lF/HbAPam8O5wfFJWUR8OqeiVa7Rc3ElpgnB39yKlRTit2P/vknBqhPIqtlGPgx2rsjF8 yuMZB0pH88kJZnw13uHmsvb2VwwRTVZg96Ukl3ze/90y9UiQP5uyLlNQNaHRvSF+fJOy0 FIm4eEnrR5W3aBHXJOqmG/UVUI2T7E8Lnu04c6wnepElaJ7BMOvKzPRadWyAjuLNbkfoR g1Bw84ONSXHSLIdrPnyTIA9q8otJuxUxsyi8EHrUkEtjm17p2GZAMzYzdvw/OAPT4vw== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=eA2bdP5O; 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 61942606A32D; Sat, 5 Dec 2026 00:15:33 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=eA2bdP5O X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796429732; b=wW7yYu7ls0BtCl3Dzk0uP6uP1yzWXOioMiDKi4l/ti11adk5z+P6wyH043wWQEjmhD2l T1i6NuT9koX/iZgQZ7+beyjoNtFf0eI/P4YwgVbSdg5Sc5qtaiU+DZX6rDahorVUDva5e 2CthFc8MdKeLvBzrDQfL5FHTv8vjIO166mR8Qs1CWxpYbOWqmS8WCqnjX0BxQFqfi9sCy tRaVeM4Y9PnAtX4cD8IJ8eEuIohoQHdDRQxfv3T94EbxyE7Wp9opWtzFDnQHEXBrzRRR0 7RvvLvOnY+GnsHV6Gkm7CCS8HsnCzSIogmWwXtvMlWIVy13KhoKHcHplXAnBkgWKZDQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796429732; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=bAsAhUG83f3XOOFpjSLtj99iKVy1nXa/WSnQ4vP+tB4=; b=hJ2gTy5+uoV87NVPnqKtGyBT6U5eFydwmI/XEWC8W49YhGMm1nZE+9dhapV1aHBD47xL SVFeVfLu6ddNRGdppndZhmgju/OMGJMzsVzAlUvaIf35NoaoEVbPAK1MTcnOakhRWIAse MECr5eTGrIW6ffFCmKvaVe9+mMzz6VdTCWhCzO1DsPZc1q0/Idi7cr6C9Q/Aa2xcI1yni fwzora82Hw7CYAsqXGV/qvB8xMb3uyQQaAzmCykK3HUNBL14u/7rqQN9k+Znhf/XLC8NF AoVBtFMpWQVXSNnSz4tXZwS+8j4H4u4PlXr/eYkpCSx4uDExhFRVOHgY+k0LaxktGig== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=eA2bdP5O; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 82EE3606A683; Sat, 5 Dec 2026 00:15:32 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE0481F0092B; Sat, 5 Dec 2026 00:15:31 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796429732; bh=bAsAhUG83f3XOOFpjSLtj99iKVy1nXa/WSnQ4vP+tB4=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=eA2bdP5O7+rcpsjtBCbhAbv1Jj5GlxA9LUMVi+yroVqBGF/FzAzo6k4PupY/2lfRM p4f4SPSIlsuPA/LH1t5j58a32bzh78iGT51+7kN1p+SahVZMvjJ7MC9AHzWFK/WoxR qlZJi1cmM27Y+u30Z+GRndKdO1I0k1tA+75OJf0ugdW2sKdxiRtaLPu8QjJmbfvDGY F8Fv0nxobkTwlCQgwn6F2lWAei+uiE3l9yb+AcEzfn0lIwD7CVVYJpnxD24GwEFST/ PVrpMvJyGcisj+h55kSV7riezt+kqji3NLZImfO1/vtTnBjhAgJ5lxfnoyyqc30amq eKb5w7e4D1J/Q== X-Cc: netdev@vger.kernel.org, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, shuah@kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org X-In-Reply-To: <20261204000521.3396802-7-mohsin.bashr@gmail.com> X-sashiko-severity: Medium 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