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 06/11] selftests: drv-net: tc_flower_police: Test police parameters
Date: Sat, 05 Dec 2026 00:15:31 +0000	[thread overview]
Message-ID: <179642973128.3146.7181971439969789325@kernel.org> (raw)
In-Reply-To: <20261204000521.3396802-7-mohsin.bashr@gmail.com>

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

  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 [this message]
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
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=179642973128.3146.7181971439969789325@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