Article View: linux.kernel.netdev
Article #27190Re: [PATCH net-next 07/11] selftests: drv-net: tc_flower_police: Test multiple policers
From: netdev-bot+sashiko
Date: Sat, 05 Dec 2026 00:15
Date: Sat, 05 Dec 2026 00:15
239 lines
17822 bytes
17822 bytes
Thank you for your contribution! Sashiko AI review found 4 potential
issue(s) to consider.
Critical: 0 ยท High: 0 ยท Medium: 1 ยท Low: 3
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_shared_action() allows a dropping
rule to pass
- [Low] The authorship tags contradict the From: line.
- [Low] selftests/drv-net: police_shared_action() index exceeds HW
policer table size
- [Low] selftests/drv-net: _iperf3_flows() does not reap child or close
pipes on kill
--
selftests: drv-net: tc_flower_police: Test multiple policers
This commit adds three tests to tc_flower_police.py: police_independent,
police_shared_action and police_priority. Together they check that a
device keeps separate policers apart, shares a police action across
rules when asked to, and applies overlapping rules in priority order.
Both flows run at the same time through a new _iperf3_flows() helper.
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> Signed-off-by: Mohsin Bashir <hmohsin@meta.com>
[Severity: Low]
This isn't a bug, but do these trailers match the From: line?
The author is Mohsin Bashir, but the first Signed-off-by is Jakub
Kicinski's, and there is no Co-developed-by tag.
Documentation/process/submitting-patches.rst says the first SoB entry
signals primary authorship. It also says that when a patch has more than
one author, each co-author needs a Co-developed-by tag immediately
followed by their Signed-off-by.
If Jakub co-developed the patch, should the block look like this?
Co-developed-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Mohsin Bashir <hmohsin@meta.com>
If Jakub is the sole author, should the From: line carry his name
instead?
Every patch in the series has the same trailer, from "selftests:
drv-net: Iperf3Runner: Support UDP and server side results" through
"selftests: drv-net: tc_flower_police: Test policing with RSS contexts",
so the same change would apply to all of them.
[ ... ]
> 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
> @@ -377,6 +378,108 @@ def police_params(cfg, action, expect):
> raise KsftSkipEx(f"Not offloaded: {reason}")
>
>
> +def _iperf3_flows(cfg, dsts, bw_mbit):
> + runners = [Iperf3Runner(cfg, port=port, server_ip=dst)
> + for dst, port in zip(dsts, rand_ports(len(dsts)))]
> + servers, clients = [], []
> + try:
> + for runner in runners:
> + servers.append(runner.start_server(json=True))
> + for runner in runners:
> + clients.append(runner.start_client(background=True,
> + duration=MEASURE_SEC, omit=1,
> + udp_mbit=_payload_mbit(bw_mbit),
> + length=UDP_PAYLOAD))
> + for proc in clients:
> + proc.process(terminate=False, timeout=MEASURE_SEC + 15)
> + for proc in servers:
> + proc.process(terminate=False, fail=False, timeout=5)
> + except CmdExitFailure as ex:
> + out = f"{ex.cmd.stderr} {ex.cmd.stdout}"
> + raise KsftFailEx(f"iperf3 failed: {out}") from ex
> + finally:
> + for proc in clients + servers:
> + if proc.ret is None:
> + try:
> + proc.process(terminate=True, fail=False, timeout=5)
> + except subprocess.TimeoutExpired:
> + proc.proc.kill()
> + return [_rx_mbit(server.stdout) for server in servers]
> +
> +
> +def police_independent(cfg):
> + """
> + Check that two rules with their own police actions each enforce their
> + own rate.
> + """
> + _setup_clsact(cfg)
> + rule1, dst1 = _dst_ip_rule(cfg)
> + rule2, dst2 = _dst_ip_rule(cfg)
> +
> + _check_baseline_rate(cfg)
> + _add_filter(cfg, rule1, _police(RATE_MBIT // 4), pref=10)
> + _add_filter(cfg, rule2, _police(RATE_MBIT // 2), pref=11)
> +
> + got1, got2 = _iperf3_flows(cfg, [dst1, dst2], OFFERED_MBIT // 2)
> + _check_rate(got1, RATE_MBIT // 4, "first filter")
> + _check_rate(got2, RATE_MBIT // 2, "second filter")
> +
> +
> +def _skip_rejected(cfg, err, pref, what):
> + if _filter_info(cfg, pref) is not None:
> + raise KsftFailEx(f"Rejected {what} left behind")
> + ksft_pr(err)
> + raise KsftSkipEx(f"{what} not offloaded")
> +
> +
> +def police_shared_action(cfg):
> + """
> + Check that two rules sharing a police action index are limited together
> + to a single rate.
> + """
> + _setup_clsact(cfg)
> + rule1, dst1 = _dst_ip_rule(cfg)
> + rule2, dst2 = _dst_ip_rule(cfg)
> + while True:
> + index = random.randint(1000, 60000)
[Severity: Low]
Does this leave the killed process behind?
proc.process(terminate=True, ...) ends up in cmd._process_terminate().
That function calls self.proc.communicate(timeout=timeout) before it
closes self.proc.stdout and self.proc.stderr and sets self.ret. When
communicate() raises subprocess.TimeoutExpired, none of that happens.
proc.proc.kill() then only sends SIGKILL.
Nothing waits for the child afterwards. It stays a zombie, and its
pipes stay open until the objects are garbage collected. The deferred
teardown of the test addresses and the clsact qdisc can then race with
the dying iperf3 process. Later test cases in the same run also keep
the leaked descriptors.
Would it be better to follow the kill with proc.proc.wait(), or with
another proc.process(terminate=False, fail=False) call? The kperf
helpers in drivers/net/lib/py already handle their kill path that way.
[Severity: Low]
Will this index work on devices that map the police action index
straight onto a hardware policer slot?
The kernel hands act->tcfa_index to drivers as
flow_action_entry.hw_index, and some in-tree drivers use it directly.
ocelot_flower_parse_action() computes pol_ix from a->hw_index plus
vcap_pol.base, and returns -EINVAL once that reaches vcap_pol.max,
which is 191 on VSC7514. enetc_psfp_parse_clsflower() uses
entryp->hw_index as the flow meter index.
random.randint(1000, 60000) never picks anything below 1000. On such
hardware the first _add_filter() in police_shared_action() would be
rejected, and the test would bail out before the shared rule is even
tried. That can happen even if the device supports shared policers
just fine.
Could the first rule be installed without an explicit index, and the
index the kernel assigned be read back for the second rule? For
example, _filter_info() on pref 10 could provide it, if it exposes the
action index. Or would probing for a free index starting from a low
value be simpler?
> + if cmd(f"tc actions get action police index {index}",
> + fail=False).ret:
> + break
> +
> + _check_baseline_rate(cfg)
> + _add_filter(cfg, rule1, _police(RATE_MBIT, extra=f"index {index}"),
> + pref=10)
> + added, err = _try_filter(cfg, rule2, f"action police index {index}",
> + pref=11)
> + if not added:
> + _skip_rejected(cfg, err, 11, "Shared police action")
> +
> + total = sum(_iperf3_flows(cfg, [dst1, dst2], OFFERED_MBIT // 2))
> + _check_rate(total, RATE_MBIT, "aggregate of shared action")
> +
> +
> +@ksft_variants([
> + KsftNamedVariant("slow_first", 10, 20, RATE_MBIT // 2),
> + KsftNamedVariant("fast_first", 20, 10, RATE_MBIT),
> +])
> +def police_priority(cfg, slow_pref, fast_pref, expect):
> + """
> + Check that of two rules with the same match, the one with the lower
> + priority value decides, whichever of them is installed first.
> + """
> + _setup_clsact(cfg)
> + rule, dst = _dst_ip_rule(cfg)
> + _check_baseline_rate(cfg)
> +
> + _add_filter(cfg, rule, _police(RATE_MBIT // 2), pref=slow_pref)
> + added, err = _try_filter(cfg, rule, _police(RATE_MBIT), pref=fast_pref)
> + if not added:
> + _skip_rejected(cfg, err, fast_pref, "Second rule with the same match")
> +
> + got = _iperf3(cfg, dst, OFFERED_MBIT)
> + _check_rate(got, expect, "rule with the lower pref")
> +
> +
> def main() -> None:
> """Ksft boilerplate main."""
> with NetDrvEpEnv(__file__, nsim_test=False) as cfg:
[Severity: Medium]
Can this check pass when one of the two rules is not forwarding
anything?
_iperf3_flows() is called with OFFERED_MBIT // 2, so each flow offers
100 Mbit/s. That is already the full RATE_MBIT of the shared policer.
Only the sum of the two measured rates is compared against RATE_MBIT.
Suppose the device mis-programs the second rule, the one created with
"action police index N", and drops all of its traffic. The first flow
alone then delivers about 100 Mbit/s, and _check_rate() is satisfied.
The same holds the other way round.
That looks like exactly the kind of breakage a shared-action test
should catch. Would it make sense to also check that each value
returned by _iperf3_flows() carries a meaningful share of the rate?
Alternatively, each flow could offer less than
RATE_MBIT * (1 - TOLERANCE). The policer is still oversubscribed in
aggregate, but a single flow can no longer reach the limit on its own.
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261204000521.3396802-1-mohsin.bashr%40gmail.com
Technical Details
Message-ID:
<179642973256.3146.13809553627644999013@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-377762-linux-kernel-netdev=dewy.ruReferences:
<20261204000521.3396802-8-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-377762-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next 07/11] selftests: drv-net: tc_flower_police: Test multiple policers Date: Sat, 05 Dec 2026 00:15:32 +0000 Organization: Usenet Network Message-ID: <179642973256.3146.13809553627644999013@kernel.org> References: <20261204000521.3396802-8-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="2914107"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:/Ij7rwbSbqYwZK59yw9lW+BL0mQ= sha256:jS8fPyPlQrkDEuqlFzwJ1irorZdXYNBXLUi0ydCFps4= sha1:f9SWhhBsJocmHVD8WVXacs8TLRw= sha256:NjRAiEub1miUegQzNwuGgRcGjlLC6L31t0uMlTpUa2Y= 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 72733117D30; Sat, 5 Dec 2026 03:16:40 +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 RyP6Z6Xdcu3e; Sat, 5 Dec 2026 03:16:37 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-377762-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 DDD8A117A6A; Sat, 5 Dec 2026 03:16:28 +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 0D1C93DB5B; Sat, 5 Dec 2026 00:15:49 +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=1796429739; b=IS2QkzaxBH4/XNkfIER2byJwtmw2eqoTyN/Mf2WneKjLzLKxQa6ettlljv0zEjZRUQ8Z kpU58MsViNc5uBLuidCIDNgqooywhgD9Fz+DvDggi4TdjqSz8ovm5+psnzGou2F43EcBQ xKhr9QDwp9C341/KKP0MJFMCzMgEyCJkFrFDIDdru6JxNQ3EpdXe0UowKK1UGpOG7W2/t QMAEJIu7J0+NlxXCjC5bDRch+zKg17133eejrRzqB7PSeHgmNIoHDU+3K07x6u4ZHn3jl 9+QFsfiD+6uzcPvk81HvIYQIzH39Oz3eO5zhsGcqMNkK8W46uQtyTaM3mwhHt76wnBA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796429739; 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=7LtI3l64/CnzYDkIoz2Y8Z3RHaMTWcLkUCFLqX/22og=; b=WlwXEGF4mKKraqw67RTuSRDmlmz6tJvZ+3EVS5jgNkV7u7F6sFbmXIdN+1jlGEyj6Yox 240ybPq0eUXfeO7/e3AWdVHW6SNXYRY5VDXaDRZ9BFajRLZ0mTBdqXTonHBs0/0NTzNML I2N2spxaaPklJM/BgdLDhzXxigc2DqXj2b5qMxcE4iyNhmhwSt4FDwfduTWW/uLImgmLT IoRlvR1G9X9xY94g0I8zf3598Em5ln8VYtUhh47D5HtW6OhLHI4lb2IXieTilGEZoc0mq A2ofv2slLRxudmbYPxwRQMtTSr98ZN2x1uDe+y0B6QBHUbtY+dTMMCCnS6kUfYJD0GA== 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=SpdL26JA; 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 9360560A3801; Sat, 5 Dec 2026 00:15:39 +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=SpdL26JA 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=1796429733; b=Uy7501BOMT+Ebuih9dpmnMUf9aWgIpihHqm0l+llVix1WLBh9OzXCW0k86lV3zLrDWV6 HbgAS6T34acdpBH+XBcap9u0b84N4PTs+ZS199tsCG9IPw7aBlpIzCo52ZSJWAyq+0yjS xKbA40CGKRAk8/FIRb3S3fc5gKf+BaX9uD20j3QHNcRsAiUjxIJyAM2A4PfEXvecB0yj3 K4ioPEMOSvrfpx+HJsgxC59w+3fwbeEHqQKATWo82fQGkVs+L1rmfasXq3Cty/CNflfDG sJMr6q5X2zXIJmYPFAS9JvzCCYwcRlPc2K+30oBYM758JqVyHKASxjgh/IdBRB2Ecpg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796429733; 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=7LtI3l64/CnzYDkIoz2Y8Z3RHaMTWcLkUCFLqX/22og=; b=jRadeFGkwfZRV0B9aQLocIWdyxEbqqH0XQt7/eXxxLR0qLDlw4aQqlzSo7+FzXqkhNXG P1KccxP+/w3zREo8zUv3weSeN24mBq8dTw+wh7FaqpP6ANzOk7BjC7rUuThAG2Wl8CxiO cbPnv8nIB21DE4SaVIMeqdMRFnTlUSxyfORpMTXbUuE8UEDr8SI02/M95ZoBQrqMw6YwQ yITegrJiGz5odybQKSjHFTq4Vgd1PepJOjZ1FdWI2cg9c30xPygdczrOZp3Zknl8KJmcT JhmtgYyvsGRhYLOO8WUJoPxgdDqalQHP3ZIrd+/480w26rNovhSZ/HpBYdv7b8Do4Aw== 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=SpdL26JA; 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 B2678606A685; Sat, 5 Dec 2026 00:15:33 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id F251C1F00A18; Sat, 5 Dec 2026 00:15:32 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796429733; bh=7LtI3l64/CnzYDkIoz2Y8Z3RHaMTWcLkUCFLqX/22og=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=SpdL26JAX8x5xHdkZfYLrKGaYri75j4BxmwWZJZu+D2BZnjdNibfOgsmFvWj2IVJb ur4PMwX7IokcXQdnLTD1AU9GloUspcYwyfaPeriuG+o261I6n71VLNI3C7Lr8GFVA9 vXADLSVtVLOzP0rWr4ZrdOdqEceudU19DG45HuddOOlYtt46UUUZk4woDoqQKXTN3C wpuPnW9EFgm5eLzFktpAkXDnH0AFLg8lRxnufOOdSM7HLXt0hIB1qBd6zWFdSn2xpE B3WhOuamgaL5u5JXHOc05kanUrLngDAeDHET3YDn1QaTgYdk4TdEj3/ZVJIcSdffSL 7Egyk3U5p+N6A== 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-8-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