All of lore.kernel.org
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: acassen@corp.free.fr
Cc: saeedm@nvidia.com, leon@kernel.org, tariqt@nvidia.com,
	mbloch@nvidia.com, jhs@mojatatu.com, jiri@resnulli.us,
	andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
	kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
	michael.chan@broadcom.com, pavan.chebbi@broadcom.com,
	bharat@chelsio.com, donald.hunter@gmail.com, corbet@lwn.net,
	skhan@linuxfoundation.org, rdunlap@infradead.org,
	dsahern@kernel.org, idosch@nvidia.com, shuah@kernel.org,
	netdev@vger.kernel.org, linux-rdma@vger.kernel.org,
	linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org,
	oss-drivers@corigine.com
Subject: Re: [PATCH net-next v2 07/10] selftests: forwarding: tc_flower: test the enc_key_id mask
Date: Fri, 20 Nov 2026 03:30:40 +0000	[thread overview]
Message-ID: <179514544037.3136.16339086532983375306@kernel.org> (raw)
In-Reply-To: <20261117092915.255194-8-acassen@corp.free.fr>

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] match_enc_key_id_mask_test() in
  tools/testing/selftests/net/forwarding/tc_flower.sh only checks…
- [Low] In tools/testing/selftests/net/forwarding/tc_flower.sh,
  match_enc_key_id_mask_test() depends on a tc (iproute2) change that…

--

selftests: forwarding: tc_flower: test the enc_key_id mask

This adds match_enc_key_id_mask_test() to tc_flower.sh. It creates two
gretap tunnels with keys 300 and 600 and adds a flower filter matching
enc_key_id 256/0xf00 on an external gretap device. It then checks that
key 300 matches and that key 600 falls through to a second filter. The
test returns early without a result when tcflags is skip_sw or when tc
does not know the enc_key_id mask.

> diff --git a/tools/testing/selftests/net/forwarding/tc_flower.sh b/tools/testing/selftests/net/forwarding/tc_flower.sh
> index b58909a931129..693361c4b8f7e 100755
> --- a/tools/testing/selftests/net/forwarding/tc_flower.sh
> +++ b/tools/testing/selftests/net/forwarding/tc_flower.sh

[ ... ]

> @@ -280,6 +281,59 @@ match_vlan_test()
>  	log_test "VLAN match ($tcflags)"
>  }
>  
> +match_enc_key_id_mask_test()
> +{
> +	RET=0
> +
> +	# A tunnel device has no offload to take a skip_sw filter
> +	if [[ $tcflags == "skip_sw" ]]; then
> +		return 0
> +	fi
> +
> +	if ! tc filter add dev $h2 ingress flower help 2>&1 | \
> +		grep -q MASKED-KEY-ID; then
> +		echo "SKIP: iproute2 too old; tc is missing the enc_key_id mask"
> +		return 0
> +	fi

[Severity: Low]
Which iproute2 change adds the MASKED-KEY-ID token to the flower help
output?

The kernel tree does not contain MASKED-KEY-ID. It also does not contain
the "enc_key_id 256/0xf00" dump format checked further down. Released tc
parses enc_key_id as a plain be32 and rejects 256/0xf00. The commit
message does not name or link the tc patch that these strings come from.

With any tc that lacks this exact token, the test echoes the SKIP line
and returns 0 without a TEST: line. The new TCA_FLOWER_KEY_ENC_KEY_ID_MASK
handling in fl_set_key() and fl_dump_key() is then never exercised.

If the final tc patch uses a different help placeholder, the test would
skip forever. If tc prints the key in another format, the dump check
would fail.

Could the commit reference the tc change it depends on? Then the probe
string and the dump format could be checked against it.

> +
> +	tunnel_create gt1 gretap 192.0.2.1 192.0.2.2 dev $h1 key 300
> +	tunnel_create gt2 gretap 192.0.2.1 192.0.2.2 dev $h1 key 600
> +	ip link set dev gt1 master v$h1
> +	ip link set dev gt2 master v$h1
> +	ip link add gt-ex type gretap external # To collect tunnel info
> +	ip link set dev gt-ex up
> +	ip link set dev gt-ex master v$h2
> +	tc qdisc add dev gt-ex clsact
> +
> +	tc filter add dev gt-ex ingress protocol ip pref 1 handle 101 flower \
> +		$tcflags enc_key_id 256/0xf00 action drop
> +	tc filter add dev gt-ex ingress protocol ip pref 2 handle 102 flower \
> +		$tcflags enc_key_id 600 action drop
> +
> +	tc filter show dev gt-ex ingress pref 1 | grep -q "enc_key_id 256/0xf00"
> +	check_err $? "Did not dump the mask"

[Severity: Medium]
What happens here when a tc that knows the mask runs on a kernel without
TCA_FLOWER_KEY_ENC_KEY_ID_MASK?

tc answers the flower help probe above by itself and never asks the
kernel. So the probe only detects userspace support.

TCA_FLOWER_KEY_ENC_KEY_ID_MASK is added just before __TCA_FLOWER_MAX, so
older kernels have a smaller TCA_FLOWER_MAX. fl_change() parses the
options liberally:

net/sched/cls_flower.c:fl_change() {
    ...
	err = nla_parse_nested_deprecated(tb, TCA_FLOWER_MAX,
					  tca_opts, fl_policy, NULL);
    ...
}

In that mode, __nla_validate_parse() skips attributes above maxtype:

lib/nlattr.c:__nla_validate_parse() {
    ...
		if (type == 0 || type > maxtype) {
			if (validate & NL_VALIDATE_MAXTYPE) {
				...
				return -EINVAL;
			}
			continue;
		}
    ...
}

So an older kernel would install the enc_key_id 256/0xf00 filter as an
exact match on key 256. The "Did not dump the mask" and "Did not match a
key inside the mask" checks would both fail, and tc_flower.sh would exit
with ksft_fail.

Documentation/dev-tools/kselftest.rst says mainline kselftests should
skip gracefully on older stable kernels. The test already reads the dump
back. Could a missing mask in the dump be handled the same way as the tc
probe, instead of being reported as a failure?

> +
> +	$MZ gt1 -c 1 -p 64 -a "$(mac_get gt1)" -b $h2mac -t ip -q
> +
> +	tc_check_packets "dev gt-ex ingress" 101 1
> +	check_err $? "Did not match a key inside the mask"

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261117092915.255194-1-acassen%40corp.free.fr

  parent reply	other threads:[~2026-11-20  3:30 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17  9:29 [PATCH net-next v2 00/10] tc flower: tunnel key partitioning for RX queue steering Alexandre Cassen
2026-11-17  9:29 ` [PATCH net-next v2 01/10] bnxt_en: require an exact tunnel id in TC flows Alexandre Cassen
2026-11-18  9:29   ` sashiko-bot
2026-11-17  9:29 ` [PATCH net-next v2 02/10] cxgb4: flower: refuse a tunnel key wider than the VNI Alexandre Cassen
2026-11-17 14:05   ` Potnuri Bharat Teja
2026-11-18  9:29   ` sashiko-bot
2026-11-17  9:29 ` [PATCH net-next v2 03/10] nfp: " Alexandre Cassen
2026-11-18  9:29   ` sashiko-bot
2026-11-17  9:29 ` [PATCH net-next v2 04/10] net/mlx5e: TC, " Alexandre Cassen
2026-11-18  9:29   ` sashiko-bot
2026-11-17  9:29 ` [PATCH net-next v2 05/10] net/mlx5e: TC, reject a partial tunnel key with tunnel mapping Alexandre Cassen
2026-11-18  9:29   ` sashiko-bot
2026-11-20  3:30   ` netdev-bot+sashiko
2026-11-17  9:29 ` [PATCH net-next v2 06/10] net/sched: cls_flower: add enc_key_id mask Alexandre Cassen
2026-11-18  9:29   ` sashiko-bot
2026-11-17  9:29 ` [PATCH net-next v2 07/10] selftests: forwarding: tc_flower: test the " Alexandre Cassen
2026-11-18  9:29   ` sashiko-bot
2026-11-20  3:30   ` netdev-bot+sashiko [this message]
2026-11-17  9:29 ` [PATCH net-next v2 08/10] net/mlx5e: TC, offload RX queue mapping in NIC flows Alexandre Cassen
2026-11-18  9:29   ` sashiko-bot
2026-11-20  3:30   ` netdev-bot+sashiko
2026-11-17  9:29 ` [PATCH net-next v2 09/10] net/mlx5e: TC, match the tunnel key without a tunnel device Alexandre Cassen
2026-11-18  9:29   ` sashiko-bot
2026-11-20  3:30   ` netdev-bot+sashiko
2026-11-17  9:29 ` [PATCH net-next v2 10/10] docs: networking: describe tunnel key partitioning in TC queue filtering Alexandre Cassen
2026-11-18  9:29   ` sashiko-bot
2026-11-20  3:30   ` 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=179514544037.3136.16339086532983375306@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=acassen@corp.free.fr \
    --cc=andrew+netdev@lunn.ch \
    --cc=bharat@chelsio.com \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=donald.hunter@gmail.com \
    --cc=dsahern@kernel.org \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=mbloch@nvidia.com \
    --cc=michael.chan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=oss-drivers@corigine.com \
    --cc=pabeni@redhat.com \
    --cc=pavan.chebbi@broadcom.com \
    --cc=rdunlap@infradead.org \
    --cc=saeedm@nvidia.com \
    --cc=shuah@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=tariqt@nvidia.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.