Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: jhs@mojatatu.com
Cc: netdev@vger.kernel.org, jiri@resnulli.us, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	horms@kernel.org, vtlam@google.com, stable@vger.kernel.org,
	victor@mojatatu.com, hybris@mojatatu.ai, sashiko-bot@kernel.org
Subject: Re: [PATCH net 2/2] selftests/tc-testing: add hhf hh_limit cap tests
Date: Sat, 12 Sep 2026 20:36:24 +0000	[thread overview]
Message-ID: <178924538491.3125.17360124122407490999@kernel.org> (raw)
In-Reply-To: <QDISC-B855.v1.20260911153152@mojatatu.com.2>

Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider:

Critical: 0 · High: 0 · Medium: 1 · Low: 1

- [Medium] The three change-path rejection tests (e3cc, f681, 147f)
  assert a witness value that is identical to the kernel default, so…
- [Low] Commit message overstates the add-path coverage of the new test
  file.

--

selftests/tc-testing: add hhf hh_limit cap tests

Adds tools/testing/selftests/tc-testing/tc-tests/qdiscs/hhf_flows_limit.json
with six cases exercising the TCA_HHF_HH_FLOWS_LIMIT policy bound on the hhf
qdisc, covering rejected out-of-range values, the accepted boundary value
2048, and an add-time value of 500.

A couple of questions about the coverage claims and the assertions.

> Cover the new TCA_HHF_HH_FLOWS_LIMIT bound: values above 2*HH_FLOWS_CNT
> (4294967295, 65536, 2049) are rejected with the configured limit left
> untouched on both the change and the add path, the boundary value 2048 is
> accepted (installed at 100 first so the boundary change is load-bearing),
> and an add-time hh_limit 500 is preserved instead of being clobbered by
> the default.

[Severity: Low]
Does the file really cover all three values "on both the change and the add
path"?

In hhf_flows_limit.json the values 4294967295, 65536 and 2049 appear only in
cmdUnderTest lines that use "qdisc change" (tests e3cc, f681 and 147f).

The only invalid add-path case is ca99, and it uses 4294967295 only:

    "cmdUnderTest": "$TC qdisc add dev $DUMMY handle 1: root hhf hh_limit 4294967295",
    "expExitCode": "2",
    "verifyCmd": "$TC qdisc show dev $DUMMY",
    "matchPattern": "qdisc hhf 1: root",
    "matchCount": "0",

Also, ca99 asserts that no qdisc exists at all, so there is no "configured
limit left untouched" property being checked on the add path.

Could the changelog describe the actual matrix, or could add-path cases for
65536 and 2049 be added?

> diff --git a/tools/testing/selftests/tc-testing/tc-tests/qdiscs/hhf_flows_limit.json b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/hhf_flows_limit.json
> new file mode 100644
> index 0000000000000..44538b9266b65
> --- /dev/null
> +++ b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/hhf_flows_limit.json
> @@ -0,0 +1,128 @@
> +[
> +    {
> +        "id": "e3cc",
> +        "name": "HHF hh_limit rejects value above 2*HH_FLOWS_CNT cap (4294967295)",

[ ... ]

> +        "setup": [
> +            "$TC qdisc add dev $DUMMY handle 1: root hhf"
> +        ],
> +        "cmdUnderTest": "$TC qdisc change dev $DUMMY handle 1: root hhf hh_limit 4294967295",
> +        "expExitCode": "2",
> +        "verifyCmd": "$TC qdisc show dev $DUMMY",
> +        "matchPattern": "qdisc hhf 1: root refcnt [0-9]+.*hh_limit 2048",
> +        "matchCount": "1",

[Severity: Medium]
Can this assertion distinguish "limit left untouched" from "limit reset or
clamped to the cap"?

The setup adds hhf without hh_limit, so hhf_init() leaves the default in
place:

net/sched/sch_hhf.c:hhf_init() {
	...
	/* Cap max active HHs at twice len of hh_flows table. */
	q->hh_flows_limit = 2 * HH_FLOWS_CNT;
	...
}

With HH_FLOWS_CNT 1024 that default is 2048, which is also the policy bound
used for the attribute:

	[TCA_HHF_HH_FLOWS_LIMIT] = NLA_POLICY_MAX(NLA_U32, 2 * HH_FLOWS_CNT),

So the matched witness "hh_limit 2048" is the same string that hhf_dump()
would print if a future implementation validated late and wrote or clamped
q->hh_flows_limit to 2048 before returning the error. Only expExitCode 2 is
actually pinned down here.

The same applies to f681 (hh_limit 65536) and 147f (hh_limit 2049) below,
which use the identical defaulted setup and the identical "hh_limit 2048"
matchPattern.

Would installing a distinct in-range value in setup, e.g.
"$TC qdisc add dev $DUMMY handle 1: root hhf hh_limit 100" and then matching
"hh_limit 100" after the rejected change, make these three assertions
load-bearing? Test 223d further down already uses exactly that technique:

> +        "setup": [
> +            "$TC qdisc add dev $DUMMY handle 1: root hhf hh_limit 100"
> +        ],
> +        "cmdUnderTest": "$TC qdisc change dev $DUMMY handle 1: root hhf hh_limit 2048",

[ ... ]

> +    {
> +        "id": "f681",
> +        "name": "HHF hh_limit rejects 65536 (above 2*HH_FLOWS_CNT cap)",

[ ... ]

> +        "setup": [
> +            "$TC qdisc add dev $DUMMY handle 1: root hhf"
> +        ],
> +        "cmdUnderTest": "$TC qdisc change dev $DUMMY handle 1: root hhf hh_limit 65536",
> +        "expExitCode": "2",
> +        "verifyCmd": "$TC qdisc show dev $DUMMY",
> +        "matchPattern": "qdisc hhf 1: root refcnt [0-9]+.*hh_limit 2048",
> +        "matchCount": "1",

[ ... ]

> +    {
> +        "id": "147f",
> +        "name": "HHF hh_limit rejects first value above cap (2049)",

[ ... ]

> +        "setup": [
> +            "$TC qdisc add dev $DUMMY handle 1: root hhf"
> +        ],
> +        "cmdUnderTest": "$TC qdisc change dev $DUMMY handle 1: root hhf hh_limit 2049",
> +        "expExitCode": "2",
> +        "verifyCmd": "$TC qdisc show dev $DUMMY",
> +        "matchPattern": "qdisc hhf 1: root refcnt [0-9]+.*hh_limit 2048",
> +        "matchCount": "1",

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/QDISC-B855.v1.20260911153152%40mojatatu.com

  reply	other threads:[~2026-09-12 20:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-12 18:09 [PATCH net 1/2] net/sched: hhf: cap hh_flows_limit at change time Jamal Hadi Salim
2026-09-12 18:09 ` [PATCH net 2/2] selftests/tc-testing: add hhf hh_limit cap tests Jamal Hadi Salim
2026-09-12 20:36   ` netdev-bot+sashiko [this message]
2026-09-12 20:36 ` [PATCH net 1/2] net/sched: hhf: cap hh_flows_limit at change time netdev-bot+sashiko
2026-09-13 10:34   ` Jamal Hadi Salim

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=178924538491.3125.17360124122407490999@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=hybris@mojatatu.ai \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sashiko-bot@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=victor@mojatatu.com \
    --cc=vtlam@google.com \
    /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