Linux Documentation
 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 v3 07/11] selftests: forwarding: tc_flower: test the enc_key_id mask
Date: Mon, 23 Nov 2026 21:34:28 +0000	[thread overview]
Message-ID: <179546966804.3135.7021273084185929997@kernel.org> (raw)
In-Reply-To: <20261122213200.3207385-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] In match_enc_key_id_mask_test() (tc_flower.sh lines 295-305),
  the capability probe adds a filter on $h2 with stderr discarded and…
- [Low] In match_enc_key_id_mask_test()
  (tools/testing/selftests/net/forwarding/tc_flower.sh, lines 290-293),…

--

selftests: forwarding: tc_flower: test the enc_key_id mask

This adds match_enc_key_id_mask_test() to tc_flower.sh. The test sends
frames over two gretap devices with keys 300 and 600. It checks that a
flower filter with enc_key_id 256/0xf00 on an external gretap device
matches only the key inside the mask, and that a probe filter on $h2
decides whether the test runs at all.

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

[ ... ]

> @@ -280,6 +281,64 @@ match_vlan_test()
>  	log_test "VLAN match ($tcflags)"
>  }
>  
> +match_enc_key_id_mask_test()
> +{
> +	local ret
> +
> +	RET=0
> +
> +	# A tunnel device has no offload to take a skip_sw filter
> +	if [[ $tcflags == "skip_sw" ]]; then
> +		return 0
> +	fi

[Severity: Low]
Is this comment accurate as a general statement? The commit message makes
the same claim:

  "A tunnel device takes no skip_sw filter."

Several drivers offload flower rules on gretap devices through indirect
blocks. In drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c:

mlx5e_get_tc_tun() {
    ...
	else if (netif_is_gretap(tunnel_dev) ||
		 netif_is_ip6gretap(tunnel_dev))
		return &gre_tunnel;
    ...
}

mlx5e_rep_check_indr_block_supported() then accepts such devices via
mlx5e_tc_tun_device_to_offload(). The nfp driver
(nfp_fl_is_netdev_to_offload()) and ice also handle gretap devices.

The limit seems to come from this test's topology: an external gt-ex
device, no enc_src_ip/enc_dst_ip match, and frames generated in software.
It doesn't seem to apply to tunnel devices in general.

Could the comment and the commit message say that instead? This path also
returns without log_test or log_test_skip, so nothing in the skip_sw pass
shows that the hardware enc_key_id mask paths had no coverage.

> +
> +	# An old tc refuses the mask and an old kernel drops it
> +	tc filter add dev $h2 ingress protocol ip pref 1 handle 101 flower \
> +		$tcflags enc_key_id 256/0xf00 action drop 2> /dev/null
> +	tc filter show dev $h2 ingress pref 1 | grep -q "enc_key_id 256/0xf00"
> +	ret=$?
> +	tc filter del dev $h2 ingress protocol ip pref 1 handle 101 flower \
> +		2> /dev/null
> +	if [[ $ret -ne 0 ]]; then
> +		echo "SKIP: tc or the kernel lacks the enc_key_id mask"
> +		return 0
> +	fi

[Severity: Medium]
Can this probe hide a regression in the kernel's enc_key_id mask handling?

The kernel side is already in this tree. TCA_FLOWER_KEY_ENC_KEY_ID_MASK is
in the flower policy, and fl_set_key() parses it:

net/sched/cls_flower.c:fl_set_key() {
    ...
	fl_set_key_val(tb, &key->enc_key_id.keyid, TCA_FLOWER_KEY_ENC_KEY_ID,
		       &mask->enc_key_id.keyid, TCA_FLOWER_KEY_ENC_KEY_ID_MASK,
		       sizeof(key->enc_key_id.keyid));
    ...
}

fl_dump_key() dumps it through fl_dump_key_val().

If either path breaks, the grep fails and the function returns 0 before
log_test. RET and EXIT_STATUS stay unchanged, so the script still reports
PASS instead of FAIL. The result of the filter add is also not checked, and
its stderr is discarded.

The commit message is right that log_test_skip would turn the whole
script's exit status into a skip. But a silent return makes an in-tree
kernel regression look the same as an old tc.

By comparison, check_tc_erspan_support() in forwarding/lib.sh only checks
whether tc accepts the syntax:

	tc filter add dev $dev ingress pref 1 handle 1 flower \
		erspan_opts 1:0:0:0 &> /dev/null

It does not use the kernel's dump output to decide whether to skip.

The probe also depends on the exact text "enc_key_id 256/0xf00". That
output format comes from an iproute2 change that the commit message
doesn't reference. Released tc prints enc_key_id as a bare value. If the
final iproute2 output formats the key or the mask differently, wouldn't
the main test never run anywhere, with no failure reported?

Would it work better to probe only whether tc accepts the syntax? A mask
missing from the dump, or a failed match, on the current kernel could then
go through check_err and log_test.

[ ... ]

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

  reply	other threads:[~2026-11-23 21:34 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-22 21:31 [PATCH net-next v3 00/11] tc flower: tunnel key partitioning for RX queue steering Alexandre Cassen
2026-11-22 21:31 ` [PATCH net-next v3 01/11] bnxt_en: require an exact tunnel id in TC flows Alexandre Cassen
2026-11-22 21:31 ` [PATCH net-next v3 02/11] cxgb4: flower: refuse a tunnel key wider than the VNI Alexandre Cassen
2026-11-22 21:31 ` [PATCH net-next v3 03/11] nfp: " Alexandre Cassen
2026-11-22 21:31 ` [PATCH net-next v3 04/11] net/mlx5e: TC, " Alexandre Cassen
2026-11-22 21:31 ` [PATCH net-next v3 05/11] net/mlx5e: TC, reject a partial tunnel key with tunnel mapping Alexandre Cassen
2026-11-23 21:34   ` netdev-bot+sashiko
2026-11-22 21:31 ` [PATCH net-next v3 06/11] net/sched: cls_flower: add enc_key_id mask Alexandre Cassen
2026-11-22 21:31 ` [PATCH net-next v3 07/11] selftests: forwarding: tc_flower: test the " Alexandre Cassen
2026-11-23 21:34   ` netdev-bot+sashiko [this message]
2026-11-22 21:31 ` [PATCH net-next v3 08/11] net/mlx5e: TC, offload RX queue mapping in NIC flows Alexandre Cassen
2026-11-23 21:34   ` netdev-bot+sashiko
2026-11-22 21:31 ` [PATCH net-next v3 09/11] net/mlx5e: TC, reject tunnel keys without a tunnel device Alexandre Cassen
2026-11-23 21:34   ` netdev-bot+sashiko
2026-11-22 21:31 ` [PATCH net-next v3 10/11] net/mlx5e: TC, match the tunnel key " Alexandre Cassen
2026-11-22 21:31 ` [PATCH net-next v3 11/11] docs: networking: describe tunnel key partitioning in TC queue filtering Alexandre Cassen
2026-11-23 21:34   ` 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=179546966804.3135.7021273084185929997@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox