Article View: linux.kernel.netdev
Article #27186Re: [PATCH net-next 11/11] selftests: drv-net: tc_flower_police: Test policing with RSS contexts
From: netdev-bot+sashiko
Date: Sat, 05 Dec 2026 00:15
Date: Sat, 05 Dec 2026 00:15
205 lines
16660 bytes
16660 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The docstring of police_rss_ctx() in
tools/testing/selftests/drivers/net/hw/tc_flower_police.py says eachβ¦
- [Low] selftests: drv-net: duplicated channel setup in police_rss_ctx()
- [Low] selftests: drv-net: police_rss_ctx() queues defer() before
channels_set()
--
selftests: drv-net: tc_flower_police: Test policing with RSS contexts
This adds police_rss_ctx() to tc_flower_police.py. The test steers two
secondary addresses into their own RSS contexts with ntuple rules and
checks that a flower policer on each flow limits it to its own rate. It
needs 6 combined channels, ntuple filters and RSS contexts, and skips
otherwise.
> 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 d0315e8bf2b2d..d3051dda49ed9 100755
> --- a/tools/testing/selftests/drivers/net/hw/tc_flower_police.py
> +++ b/tools/testing/selftests/drivers/net/hw/tc_flower_police.py
> @@ -683,6 +683,70 @@ def police_with_ntuple(cfg, ntuple_first):
> ksft_eq(idle, 0, f"Traffic on queues other than 0 and {queue}: {delta}")
>
>
> +def police_rss_ctx(cfg):
> + """
> + Check policing of flows steered to RSS contexts: each flow is limited
> + to its own rate and stays on the queues of its context.
> + """
[ ... ]
> + cnt = channels.get("combined-count", 0)
> + if cnt < 6:
[ ... ]
> + for i, (_, dst, limit, queues) in enumerate(flows):
> + other = flows[1 - i][3]
> + before = _rx_queue_pkts(cfg)
> + got = _iperf3(cfg, dst, OFFERED_MBIT)
> + after = _rx_queue_pkts(cfg)
> + delta = {q: after[q] - before.get(q, 0) for q in after}
> + expected = _expected_pkts(got)
> + _check_rate(got, limit, f"context {i}")
> + ksft_ge(sum(delta.get(q, 0) for q in queues), expected * 0.9,
> + f"Context {i} traffic not on queues {queues}: {delta}")
> + ksft_eq(sum(delta.get(q, 0) for q in other), 0,
> + f"Context {i} traffic on the other context: {delta}")
[Severity: Low]
Do these checks fully cover what the docstring says, that each flow
"stays on the queues of its context"?
Only two sets of queues are checked. The flow's own context queues must
see at least 90% of the expected packets, and the other context's queues
must see zero. Queues 0/1 and any queue numbered 6 or higher are not
checked.
The channel count is only changed when cnt < 6. On a device that already
has more than 6 combined channels, queues 6 and up exist. With the main
indirection table set to [0, 1] and the contexts using 2-5, those queues
should get nothing. Nothing checks that they don't.
Suppose a driver programs part of a context's indirection table with the
wrong queue base. If it sends part of a flow back to queues 0/1 or to a
queue >= 6, would the test still pass as long as the leak stays under
about 10%?
The peer test police_with_ntuple() in the same file requires every
non-target queue to be idle:
idle = sum(delta.values()) - delta.get(0, 0) - delta.get(queue, 0)
ksft_eq(idle, 0, f"Traffic on queues other than 0 and {queue}: {delta}")
Could police_rss_ctx() do the same, and require zero traffic on every
queue outside {0, 1} and the flow's own context queues?
[ ... ]
> @@ -683,6 +683,70 @@ def police_with_ntuple(cfg, ntuple_first):
> ksft_eq(idle, 0, f"Traffic on queues other than 0 and {queue}: {delta}")
>
>
> +def police_rss_ctx(cfg):
> + """
> + Check policing of flows steered to RSS contexts: each flow is limited
> + to its own rate and stays on the queues of its context.
> + """
> + _setup_clsact(cfg)
> + _require_ntuple(cfg)
> + _rx_queue_pkts(cfg)
> +
> + ehdr = {"header": {"dev-index": cfg.ifindex}}
> + try:
> + channels = cfg.ethnl.channels_get(ehdr)
> + except NlError as ex:
> + raise KsftSkipEx("channel-get not supported by device") from ex
> + cnt = channels.get("combined-count", 0)
> + if cnt < 6:
> + if channels.get("combined-max", 0) < 6:
> + raise KsftSkipEx("Need 6 combined channels")
> + 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})
[Severity: Low]
Two cleanups are queued with defer() before channels_set() to 6
has succeeded: the restore of the original channel count and the
carrier wait. If channels_set() raises NlError, the test raises
KsftSkipEx, but ksft_flush_defer() still runs both callbacks.
Take a driver that has get_channels but no set_channels.
ethnl_default_set_doit() calls ethnl_set_channels_validate() first,
and that returns -EOPNOTSUPP. So ethnl_set_channels() never reaches
its no-change early return, and the deferred restore to cnt fails
just like the first call did.
ksft_flush_defer() then sets KSFT_RESULT to False. The intended
SKIP is reported as not ok, and ksft_exit() returns 1. The same
happens if netdev_reconfig_start() or ethnl_ops_begin() fails.
In-tree drivers that pass the earlier checks probably all implement
set_channels, so this is unlikely to trigger today. But even when
the restore succeeds, it is a needless channel set plus an extra
carrier wait, after a change that never happened.
Elsewhere in this function, the defer() for rss_create_act() is
only registered after the create succeeds, and _set_rss_indir()
does the same. Could the two defer() calls be moved after the
try/except around channels_set()? police_with_ntuple() has the same
ordering and might want the same change.
> + try:
> + cfg.ethnl.channels_set(ehdr | {"combined-count": 6})
> + except NlError as ex:
> + raise KsftSkipEx("Cannot set 6 combined channels") from ex
> + wait_file(f"/sys/class/net/{cfg.ifname}/carrier",
> + lambda x: x.strip() == "1", deadline=30)
> +
> + # Steer all other traffic to the default queues 0 and 1
> + _set_rss_indir(cfg, ehdr, [0, 1])
> + flows = []
> + for i in range(2):
> + queues = [2 + 2 * i, 3 + 2 * i]
> + try:
> + ctx = cfg.ethnl.rss_create_act(ehdr | {"indir": queues})["context"]
> + except NlError as ex:
> + raise KsftSkipEx("RSS context not created") from ex
> + defer(cfg.ethnl.rss_delete_act, ehdr | {"context": ctx})
> +
> + dst = _add_secondary_addr(cfg)
> + _add_ntuple(cfg, f"flow-type ip6 dst-ip {dst} context {ctx}")
> +
> + rule = f"protocol ipv6 flower dst_ip {dst}"
> + limit = RATE_MBIT // 2 * (i + 1)
> + flows.append((rule, dst, limit, queues))
> +
> + _check_baseline_rate(cfg)
> + for i, (rule, _, limit, _) in enumerate(flows):
> + _add_filter(cfg, rule, _police(limit), pref=10 + i)
> +
> + for i, (_, dst, limit, queues) in enumerate(flows):
> + other = flows[1 - i][3]
> + before = _rx_queue_pkts(cfg)
> + got = _iperf3(cfg, dst, OFFERED_MBIT)
> + after = _rx_queue_pkts(cfg)
> + delta = {q: after[q] - before.get(q, 0) for q in after}
> + expected = _expected_pkts(got)
> + _check_rate(got, limit, f"context {i}")
> + ksft_ge(sum(delta.get(q, 0) for q in queues), expected * 0.9,
> + f"Context {i} traffic not on queues {queues}: {delta}")
> + ksft_eq(sum(delta.get(q, 0) for q in other), 0,
> + f"Context {i} traffic on the other context: {delta}")
> +
> +
> def _link_down(cfg):
> ctl_file_write("/proc/sys/net/ipv6/conf/all/keep_addr_on_down", 1)
> ip(f"link set dev {cfg.ifname} down")
[Severity: Low]
This block copies the channel setup from police_with_ntuple(). The
only change is that the required count goes from 2 to 6. Both copies
do the same steps: the channels_get() call, the combined-max skip
check, the deferred carrier wait and channel restore, the
channels_set() call and the final carrier wait.
The other setup steps these tests share are already helpers:
_require_ntuple(), _set_rss_indir(), _rx_queue_pkts() and
_add_ntuple(). Could this be pulled into something like
_require_channels(cfg, ehdr, count) and called from both tests?
That keeps the reconfiguration and restore logic in one place. Any
fix to it, such as where the defer() calls sit relative to
channels_set(), would then only have to be made once.
--
Sashiko AI review Β· https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261204000521.3396802-1-mohsin.bashr%40gmail.com
Technical Details
Message-ID:
<179642973700.3146.764045162902780472@kernel.org>Path:
mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mi.newsdeef.eu!srv.newsdeef.eu!newsfeed.endofthelinebbs.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377766-linux-kernel-netdev=dewy.ruReferences:
<20261204000521.3396802-12-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.endofthelinebbs.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377766-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next 11/11] selftests: drv-net: tc_flower_police: Test policing with RSS contexts Date: Sat, 05 Dec 2026 00:15:37 +0000 Organization: Usenet Network Message-ID: <179642973700.3146.764045162902780472@kernel.org> References: <20261204000521.3396802-12-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="2913851"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:oYqv9K3lQPekCkBtFnk5oNdFM2o= sha256:00+zdEhXXReVZQEYDy+xBFb6sGefK69GiYg5PIwgm3A= sha1:EVLfz/2Dt+GXTbMkLWHo3ti628I= sha256:4Co93MI3+dYlzVi3wQ9Kv6NLJLqEwpLCUS4qaWNhuH0= 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 EE36D117D2F; Sat, 5 Dec 2026 03:16:06 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.642 X-Spam-Status: No, score=-3.642 tagged_above=-9999 required=6.31 tests=[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 rm_36ZzNCDtb; Sat, 5 Dec 2026 03:16:03 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-377766-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 sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id A6D8A117D2A; 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 sto.lore.kernel.org (Postfix) with ESMTP id 5E281606BEB; Sat, 5 Dec 2026 00:15:54 +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=1796429744; b=Q6EFm85oM5InomhDTrT7SWLl2ISxxJMViOZ6RCu8naBmeHmCwgIXMMlfIVSNibApd/Kh ieE3qrXFv2pBbPsuBBM9cOVfTOpPWg1lLbbq5zm2mnRQVZoogeh2r/I8+4QvnJUP3xzIb Sjor1p+TknBH0oevhj8vXqY8F8Q055fjLC6ExR2dEX6JEiXIhlRTPLYX/Ca2gWOIqyfiq x5R5xzp/Kx0oTm3uy6enH7OGKkZFvDHV1Wv1K9VlM6P7lSBnYmBcCblWwMi8Ww2nvgyy3 O0b+DhpdlHCeCbRrUjDujg7b7rtw0K4X0+HsFZeX1p1aq7H9gvfGbHd2kHw0EXbmRfw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796429744; 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=VRWr9aXA053F2XPX4PqutsZjRjrrDPy+o5hK3aXy4VU=; b=TvJjPBQvWN8MqXNlBp2srx3n6dEOHYfpmd8U9pjmNT4MZRVtXvhyhAoiKg9iBh6slkwB urUi6AiiHoX5mR3b5dOKCaFH6/vcSUv8tJnm/zkLXyflQlPS6tM0bZFPRBKrMubYcEJM7 LiuDzYYxrDWWiBNgv0JWmQ5wTHA0EVo20LWbH+3gZ1LRUKUq6KuR6diYuvEAy02V1vnzT dKO/37eV5jZmjKU2YjVUULVasHRAOdVK9eZkMLjD1Ua/OT2NynDbjSm/Pf4nKn2my4Iht DKK2AibmkgZ1eWvrtcn87jqhak3Z8yvtLSmdXwAW+1c79b08hckcl9bNTQ8EzPfGlyQ== 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=LEJCiHj8; 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 291EF60A2611; Sat, 5 Dec 2026 00:15:44 +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=LEJCiHj8 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=1796429738; b=xn6Ukptps3tyAsZMTZ7UUtyPsU7W0h2gHI11e+ei9OwYB8yWJGavlSwjQ9T5kQCR49OW OeXZ/ndsDGRptcYD6/Gun6wKC7DFBThqry21RY2IgPtFeZSOwsVKqKcX78FxZrkGN1W7N U5w6J0V9zrZeDSEs3S3Rb8m3/OCh2PJjXrZ6aArQTncOudY2gzlGXNiEspQPjSAf8FA1C wmg1g+NDMkQRp4cF7vLrdBhKljRRsWEzpqKllzkPhV3AetHHUxtnB5uk12onzlho4LTpq DJPfuzizbOE3ju7l4WKcRevvrvbMI8ItZUyFTJEbnYMz2Ku7m0oNEVdCX+QhixMV+WQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796429738; 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=VRWr9aXA053F2XPX4PqutsZjRjrrDPy+o5hK3aXy4VU=; b=ZJ7M66vdJ9Yp+Uqo2Nv4KI1p/vm76heXMQlWT0M4I2paSuLWJEVwZx8QisMo8jXF2tuk amEFE5Fz/C6A+TF2ogLNQep0eOGacTGdEQP4CeXHcoZjoVz4oh9uTIA729pxijWFSWHKn jF+xGPD2ad9SRvcViECxDJv7bxjf8Pe5XuQas7AMthGxia99aUiUEMbJYQq50ARmnJzv0 k7EdyCSJZrUoqYnIAo3I2ITLGHycJ0Xlh9dG2W0YQOZ9Li/uxUAJTxyA8grVKFzdRD9XE JT4rghfC50GWLr4ONX4XJuPP5B0nm3X2EBqx4NKvIXN+GsjPsP7OR6mm/Au+V0W2cwg== 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=LEJCiHj8; 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 2932960A2635; Sat, 5 Dec 2026 00:15:38 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6DE271F00ACB; Sat, 5 Dec 2026 00:15:37 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796429738; bh=VRWr9aXA053F2XPX4PqutsZjRjrrDPy+o5hK3aXy4VU=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=LEJCiHj8tdKQZmDLxmuAUwgfEjdTCFa5esYmHfgLB4b3YNrvhEIbzhkr70Nb8Vn47 qc4sUXs1z01BY1qsr00YnzBCXeQESW5ELVv/UAmckbbzydliD7WwPScH4XNQxle3Pb HYesyrMRc8sSUN/nl/jwBuutNTnhBSMxFifrSVm4m+3qe4zFn5MgWs5eQeKvEq733X 2JJMTBREua5xS8B+quoWzPXq0DVt0HuxwD/72Z3hGkpyRR10KkBZkXZPCIRnlZr/zE 2TlslFOlS9yCzdwJ93mmqfZt/GzO2ThKbqjR6FYbDQZUKv1yyWe1vriYrP4yG/z67k rn/QElbZ8Z3Jg== 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-12-mohsin.bashr@gmail.com> X-sashiko-severity: Low 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