Article View: linux.kernel.netdev
Article #27189Re: [PATCH net-next 09/11] selftests: drv-net: tc_flower_police: Test policing across reconfiguration
From: netdev-bot+sashiko
Date: Sat, 05 Dec 2026 00:15
Date: Sat, 05 Dec 2026 00:15
182 lines
14815 bytes
14815 bytes
Thank you for your contribution! Sashiko AI review found 4 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 3 · 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] police_channels() and police_ring_size() in
tools/testing/selftests/drivers/net/hw/tc_flower_police.py lack…
- [Medium] police_ring_size() requests new = cur*2 (or cur//2 if doubling
would exceed rx-max).
- [Medium] selftests: drv-net: premature defer() in
police_channels()/police_ring_size()
- [Low] The attribution tags conflict with the author field.
--
selftests: drv-net: tc_flower_police: Test policing across reconfiguration
This adds tests to tc_flower_police.py that check a flower police rule
keeps limiting traffic across a channel count change, an RX ring size
change and a link flap. It also checks that a rule added while the link
is down takes effect once the link comes back up.
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> Signed-off-by: Mohsin Bashir <hmohsin@meta.com>
[Severity: Low]
Is a Co-developed-by: Jakub Kicinski tag missing here? The Author line
says Mohsin Bashir, but the first Signed-off-by is Jakub's.
Documentation/process/submitting-patches.rst says the first SoB entry
signals primary authorship. It also says co-authors get a
Co-developed-by: tag immediately followed by their Signed-off-by.
As written, the trailers make Jakub look like the primary author, but the
From: line names someone else. The other tc_flower_police commits in the
series use the same pattern.
> diff --git a/tools/testing/selftests/drivers/net/hw/tc_flower_police.py b/tools/testing/selftests/drivers/net/hw/tc_flower_police.py
> index 73162c31bd59a..368882984411a 100755
> --- a/tools/testing/selftests/drivers/net/hw/tc_flower_police.py
> +++ b/tools/testing/selftests/drivers/net/hw/tc_flower_police.py
[ ... ]
> @@ -495,9 +495,139 @@ def police_delete(cfg):
> _check_unpoliced(got, RATE_MBIT, "after delete")
>
>
> +def police_channels(cfg):
> + """
> + Check that a police rule keeps working after the channel count changes.
> + """
[ ... ]
> + defer(wait_file, f"/sys/class/net/{cfg.ifname}/carrier",
> + lambda x: x.strip() == "1", deadline=30)
> + defer(cfg.ethnl.channels_set, ehdr | {"combined-count": cnt})
> + try:
> + cfg.ethnl.channels_set(ehdr | {"combined-count": new})
> + except NlError as ex:
> + raise KsftSkipEx(f"Cannot change the channel count to {new}: "
> + f"{ex}") from ex
> + wait_file(f"/sys/class/net/{cfg.ifname}/carrier",
> + lambda x: x.strip() == "1", deadline=30)
[Severity: Medium]
Is the restore deferred too early here? The carrier wait and the
channels_set() restore are both queued before channels_set(new) has
succeeded.
Take a driver that implements get_channels but not set_channels. The
channels_get() above succeeds. The set then fails with -EOPNOTSUPP
from ethnl_set_channels_validate(), and the except branch raises
KsftSkipEx.
When ksft_run() handles the skip, it flushes the defer queue. The
restore to the unchanged cnt also goes through
ethnl_default_set_doit(). There, set_validate() runs before
ethnl_set_channels() can notice that nothing changed, so the restore
fails with -EOPNOTSUPP again.
ksft_flush_defer() catches that NlError, prints a Defer Exception
traceback and sets KSFT_RESULT = False. The case is reported as a
skip, but the whole run exits non-zero.
police_ring_size() has the same problem with rings_set() and
ethnl_set_rings_validate() when set_ringparam is missing.
This is reachable on real hardware. enetc, am65-cpsw and ef100 all
offload flower police and have the get callback without the matching
set one. On those devices, what the commit message describes as a
clean skip turns into a failed run.
Would it work to register both defer() calls only after the
try/except block, once the new value has actually been applied?
[Severity: Medium]
Should police_channels() and police_ring_size() be marked
@ksft_disruptive?
After channels_set() or rings_set(), both tests wait up to 30 seconds for
carrier to come back. They wait again in the deferred restore, so they
expect the link to drop.
tools/testing/selftests/drivers/net/README.rst says:
All tests which may disconnect NETIF
must be annotated with @ksft_disruptive.
This patch does mark police_link_flap() and police_add_while_down(). With
DISRUPTIVE=False, these two tests still run. They can drop carrier on the
interface used to reach the remote, for up to 30 seconds per step.
If the NIC does not come back, wouldn't both the remote session and the
deferred restore be lost?
> + ksft_eq(cfg.ethnl.channels_get(ehdr)["combined-count"], new,
> + "Combined channel count")
> + got = _iperf3(cfg, dst, OFFERED_MBIT)
> + _check_rate(got, RATE_MBIT, "after channel change")
> +
> +
> +def police_ring_size(cfg):
> + """
> + Check that a police rule keeps working after the RX ring size changes.
> + """
[ ... ]
> + cur = rings["rx"]
> + new = cur * 2 if cur * 2 <= rings["rx-max"] else cur // 2
> + if not new:
> + raise KsftSkipEx("Cannot change the RX ring size")
[ ... ]
> + wait_file(f"/sys/class/net/{cfg.ifname}/carrier",
> + lambda x: x.strip() == "1", deadline=30)
> + ksft_eq(cfg.ethnl.rings_get(ehdr)["rx"], new, "RX ring size")
[Severity: Medium]
Can this exact comparison fail on drivers that round the requested ring
size instead of rejecting it?
octeontx2 offloads flower police (FLOW_ACTION_POLICE in otx2_tc.c), and
otx2_set_ringparam() only allows 16*4^n sizes:
drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c:otx2_set_ringparam() {
...
rx_count = Q_COUNT(Q_SIZE(rx_count, 3));
...
}
Take a 256 entry ring. Doubling it requests 512, the driver rounds that
up to 1024, and rings_get() reports 1024. ksft_eq() then fails even
though the resize and the policing both worked.
ice_set_ringparam() also rounds silently:
new_rx_cnt = ALIGN(ring->rx_pending, ICE_REQ_DESC_MULTIPLE);
An E810 ring at its 8160 maximum would request 4080 and read back 4096.
ice does not offload police today, so this case is not reachable yet.
Would it be enough to check that the reported size differs from cur, or
to use the value read back for the later checks?
> + got = _iperf3(cfg, dst, OFFERED_MBIT)
> + _check_rate(got, RATE_MBIT, "after ring resize")
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261204000521.3396802-1-mohsin.bashr%40gmail.com
Technical Details
Message-ID:
<179642973473.3146.8383978706124841606@kernel.org>Path:
mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377764-linux-kernel-netdev=dewy.ruReferences:
<20261204000521.3396802-10-mohsin.bashr@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377764-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next 09/11] selftests: drv-net: tc_flower_police: Test policing across reconfiguration Date: Sat, 05 Dec 2026 00:15:34 +0000 Organization: Usenet Network Message-ID: <179642973473.3146.8383978706124841606@kernel.org> References: <20261204000521.3396802-10-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="2914050"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:mHk3x+Prl1bigeHimzcqIJNylgQ= sha256:+cMowxumdiCbLmMnpIOts2H0Y8a4qVdd4ifno9GBNA0= sha1:uDowqviVkICJscEOA9UXgbDal5A= sha256:/7NYTj8DYrm/HDHDK8GVN1dGuBCYW3ZMavnHnwGWzQ4= 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 DA2AB117D2F; Sat, 5 Dec 2026 03:16:26 +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 uCl3lzxDy1_y; Sat, 5 Dec 2026 03:16:23 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-377764-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 75B79117A6A; Sat, 5 Dec 2026 03:16:15 +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 B6BF43CC65; Sat, 5 Dec 2026 00:15:44 +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=1796429736; b=lSNyFmu+rfz0phk8eL7hnKIbKdj0hJAmXBVXHmT9FdoQvjqb1oYJLav9kMdyMzjLzloZ BySVhX1b1fMMNguSLw8vQMJFF9m/2nTOAvG5MlYc3Tue7CufEtE2YSr1Je/3Vqp+N7x/1 l5OR11ITwxlbtOZceou5dvAT2ZvPr4lJ60Gyc7xdMkwCzYyRD205G/E595FGlr2p5XFe7 urT3BlSCymZ9zYseSNbcwkbU7SRa9cjA6VpWrT+rq6C6uOoXs6Gx4dwk8hEgRG21XrdhN ZsOGoY2P7ajctR3CBr5ntCyZTFo3q+y96BcsgbZ2kdCed349rpWfk3+lyhbuLUC3Jew== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796429736; 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=eZH3FHFIfUj4Dlsu0KTmC192PS5Tyuq72meMwqv/094=; b=EoQNQIh4W4d7Q/hw5UYHfJUWW49g8KZUf2cz50ziA8vM6tKWhfhumLj0UvVPSB2fxLA2 oL5kBVCBq7zq610fJoned63+iRY7aSZy5j34mWjn14VHVML9OdVvW2njFcRPLM4omKKlE H/MRcPB60zaxzloIFhQyvEMkXKdDePPd2rY5NazaQcvVZSYxYuMT8EPVXf1CEMAGVPal3 Ua9aU4s3Ni6HPAF/Zm5UfEhspieqhmwu0LZ6cA4QOypWfEd4oEEkJ2xwJKTGQJETL35SY dYeyZ+rJ8j2F4pdQUdRDUVwN7S3qjxFlFsaLVGxaUC6owPj6Uj6A2y+z2sNjhwycIJA== 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=iVTWqqbP; 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 B646E606A698; Sat, 5 Dec 2026 00:15:36 +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=iVTWqqbP 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=1796429735; b=IFQCFML1sRBjMGzbFwsNR/Ou8S+0xnTJrXHKOFsQoXKQZDOsscDvZGlVb+wzhsw7rydv usE3js1x9WR5qvxlFKk6xRLlT3748MEgh0OWNP0Co/Jj4gHKppl9/fWw4c0jahRoLLEaz Wb3TL+PWS/wsIJ0d5IraRIic/zkcVD1jkuKJCA4rzclSg/oDr2lb1wyWF0qWSDBKGE9ka Z1Rn28zr/SH/dEjcgExPkXosvm1pa+JGWyim4KZmJHC5+FhCr++SwRVfa23iIY41/15GR GI9dE2mHzfgp/Hko9X/Jf8KLwGrfpUDX93qGVttav2UOBeZEy61IM+YZZpXwdtrcLmg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796429735; 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=eZH3FHFIfUj4Dlsu0KTmC192PS5Tyuq72meMwqv/094=; b=xvc65HXmRAb+/tZSeio7u+z4qwnAiAziIsgyKcCxfGRMtKfrBlgAQARujkHlvBzuPW0Z YSn6EKv5w9JS/KmfbhyDW/8sFpmlAvpl58YpLZW20G2dHf0eYaAFD1nljZK4A0tO3cO4m sPECoav49FjZNY0FMrf8pIKf/9Do0lK5QKj4iXuxJ98cY/uH3/KpwyNDCGC1MwUtl6DfO V3s2Yv63i2ZVuT+G+SvRXa+0Y9ARNSGV+8pic++Alt6xCasRZ27BbWIUoEIf8hkJwGYCb EILpt82LRY/ILb3G/Gx2mJQEE3lb7CmPpA0vhSw2qNZkTTuF6T1Ey82mjotJJdSplGA== 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=iVTWqqbP; 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 D6E43606A33D; Sat, 5 Dec 2026 00:15:35 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2EFAC1F00A18; Sat, 5 Dec 2026 00:15:35 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796429735; bh=eZH3FHFIfUj4Dlsu0KTmC192PS5Tyuq72meMwqv/094=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=iVTWqqbPdGv4plNEFnuAqdtt/KnawaIqZlBecGQipJ2Dryg1WIh7DxHLcKQYzZPEe eNzGIorot/7w3hq/NY0iLMylCg9ufM2Ir7u8lYCMFfS032++8adR9bCHUgdgwNvvST JDXF9BKH7t24Z9M58EhZLsuJN9Jwpk5qodBdA1+9neX16gnPUP0CgQw2WwY08Q5OEJ SYkbWZxFfhLk1GAxoPpA0vLWeF7JGsb7F6ZwmOMpTx6/9WqgtTFLNO1CWUbNwODocZ o3026ct6zZMPFTGhyueJON/m2TE9IewrADqNJ8bd59GS+Bp8qPPOGSIyzEBlcbgKOE dCByxyDPMBlEw== 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-10-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