Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: mohsin.bashr@gmail.com
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
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	[thread overview]
Message-ID: <179642973473.3146.8383978706124841606@kernel.org> (raw)
In-Reply-To: <20261204000521.3396802-10-mohsin.bashr@gmail.com>

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

  reply	other threads:[~2026-12-05  0:15 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04  0:05 [PATCH net-next 00/11] selftests: drv-net: Test tc-flower police offload Mohsin Bashir
2026-12-04  0:05 ` [PATCH net-next 01/11] selftests: drv-net: Iperf3Runner: Support UDP and server side results Mohsin Bashir
2026-12-05  0:15   ` netdev-bot+sashiko
2026-12-04  0:05 ` [PATCH net-next 02/11] selftests: drv-net: Add tc-flower police offload test Mohsin Bashir
2026-12-05  0:15   ` netdev-bot+sashiko
2026-12-04  0:05 ` [PATCH net-next 03/11] selftests: drv-net: tc_flower_police: Test that rules do not leak Mohsin Bashir
2026-12-05  0:15   ` netdev-bot+sashiko
2026-12-04  0:05 ` [PATCH net-next 04/11] selftests: drv-net: tc_flower_police: Test the policed rate and its scope Mohsin Bashir
2026-12-05  0:15   ` netdev-bot+sashiko
2026-12-04  0:05 ` [PATCH net-next 05/11] selftests: drv-net: tc_flower_police: Test destination prefix rules Mohsin Bashir
2026-12-05  0:15   ` netdev-bot+sashiko
2026-12-04  0:05 ` [PATCH net-next 06/11] selftests: drv-net: tc_flower_police: Test police parameters Mohsin Bashir
2026-12-05  0:15   ` netdev-bot+sashiko
2026-12-04  0:05 ` [PATCH net-next 07/11] selftests: drv-net: tc_flower_police: Test multiple policers Mohsin Bashir
2026-12-05  0:15   ` netdev-bot+sashiko
2026-12-04  0:05 ` [PATCH net-next 08/11] selftests: drv-net: tc_flower_police: Test rule removal Mohsin Bashir
2026-12-05  0:15   ` netdev-bot+sashiko
2026-12-04  0:05 ` [PATCH net-next 09/11] selftests: drv-net: tc_flower_police: Test policing across reconfiguration Mohsin Bashir
2026-12-05  0:15   ` netdev-bot+sashiko [this message]
2026-12-04  0:05 ` [PATCH net-next 10/11] selftests: drv-net: tc_flower_police: Test policing with ntuple steering Mohsin Bashir
2026-12-05  0:15   ` netdev-bot+sashiko
2026-12-04  0:05 ` [PATCH net-next 11/11] selftests: drv-net: tc_flower_police: Test policing with RSS contexts Mohsin Bashir
2026-12-05  0:15   ` netdev-bot+sashiko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179642973473.3146.8383978706124841606@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mohsin.bashr@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox