Netdev List
 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 04/10] net/mlx5e: TC, refuse a tunnel key wider than the VNI
Date: Wed, 11 Nov 2026 19:12:03 +0000	[thread overview]
Message-ID: <179442432378.2199510.219572665710096354@kernel.org> (raw)
In-Reply-To: <20261109131039.959438-5-acassen@corp.free.fr>

Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The commit message says this is a fix for a bug that exists
  today: "An exact key above bit 23 already selects the wrong VNI." The…

--

net/mlx5e: TC, refuse a tunnel key wider than the VNI

This patch makes mlx5e_tc_tun_parse_vxlan() and
mlx5e_tc_tun_parse_geneve_vni() reject an enc_key_id whose key does not
fit in the 24 bit VNI match field. Such rules now fail with -EOPNOTSUPP
and an extack message. The 32 bit GRE key handling is left as is.

> VXLAN and GENEVE flows truncate the key and the mask of enc_key_id to a 24
> bit VNI. An exact key above bit 23 already selects the wrong VNI. Flower
> is about to accept partial masks. A mask that only covers bits above 23
> would then match any VNI. Refuse a key that no VNI can match. GRE keeps
> its 32 bit key.

[ ... ]

> Signed-off-by: Alexandre Cassen <acassen@corp.free.fr>

[Severity: Low]
The commit message says the problem exists today ("An exact key above bit
23 already selects the wrong VNI"). Should the patch carry a Fixes: tag,
and maybe go through net?

The truncation does look reachable in the current tree. Flower parses
TCA_FLOWER_KEY_ENC_KEY_ID with TCA_FLOWER_UNSPEC as the mask type, so every
enc_key_id rule is an exact 32 bit match. The parsers then write the key
into 24 bit fields:

mlx5e_tc_tun_parse_vxlan() {
    ...
	MLX5_SET(fte_match_set_misc, misc_v, vxlan_vni,
		 be32_to_cpu(enc_keyid.key->keyid));
    ...
}

mlx5e_tc_tun_parse_geneve_vni() {
    ...
	MLX5_SET(fte_match_set_misc, misc_v, geneve_vni, be32_to_cpu(enc_keyid.key->keyid));
    ...
}

In mlx5_ifc.h, vxlan_vni and geneve_vni are 0x18 bits wide, so MLX5_SET()
masks off bits 24-31.

The VXLAN-GBP path in mlx5e_tc_tun_parse_vxlan() also loses those bits. It
shifts the key left by 8 into the 32 bit tunnel_header_1:

	MLX5_SET(fte_match_set_misc5, misc_v, tunnel_header_1,
		 be32_to_cpu(enc_keyid.key->keyid) << 8);

As a result, a skip_sw rule with enc_key_id 0x01000001 is offloaded as a
match on VNI 1. Software never matches that rule.

Because this fixes a mismatch that already exists, a Fixes: tag would tell
backporters which stable trees are affected. These look like the
candidate targets:

  9272e3df3023 ("net/mlx5e: Geneve, Add support for encap/decap flows
  offload") for the geneve_vni MLX5_SET()

  the original en_tc.c commit that added VXLAN VNI matching, for the
  vxlan_vni MLX5_SET(). d386939a327d ("net/mlx5e: Rearrange tc tunnel code
  in a modular way") later moved that code into tc_tun_vxlan.c.

  eacc77a73275 ("net/mlx5e: Use custom tunnel header for vxlan gbp") for
  the tunnel_header_1 path

Would it also make sense to send this to net as a standalone fix, rather
than untagged as part of the net-next series that adds flower partial
masks?

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

  reply	other threads:[~2026-11-11 19:12 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-09 13:10 [PATCH net-next 00/10] tc flower: tunnel key partitioning for RX queue steering Alexandre Cassen
2026-11-09 13:10 ` [PATCH net-next 01/10] bnxt_en: require an exact tunnel id in TC flows Alexandre Cassen
2026-11-09 13:10 ` [PATCH net-next 02/10] cxgb4: flower: refuse a tunnel key wider than the VNI Alexandre Cassen
2026-11-11 19:11   ` netdev-bot+sashiko
2026-11-09 13:10 ` [PATCH net-next 03/10] nfp: " Alexandre Cassen
2026-11-11 19:12   ` netdev-bot+sashiko
2026-11-09 13:10 ` [PATCH net-next 04/10] net/mlx5e: TC, " Alexandre Cassen
2026-11-11 19:12   ` netdev-bot+sashiko [this message]
2026-11-09 13:10 ` [PATCH net-next 05/10] net/mlx5e: TC, reject a partial tunnel key with tunnel mapping Alexandre Cassen
2026-11-11 19:12   ` netdev-bot+sashiko
2026-11-09 13:10 ` [PATCH net-next 06/10] net/sched: cls_flower: add enc_key_id mask Alexandre Cassen
2026-11-11 19:12   ` netdev-bot+sashiko
2026-11-09 13:10 ` [PATCH net-next 07/10] selftests: forwarding: tc_flower: test the " Alexandre Cassen
2026-11-11 19:12   ` netdev-bot+sashiko
2026-11-09 13:10 ` [PATCH net-next 08/10] net/mlx5e: TC, offload RX queue mapping in NIC flows Alexandre Cassen
2026-11-11 19:12   ` netdev-bot+sashiko
2026-11-09 13:10 ` [PATCH net-next 09/10] net/mlx5e: TC, match the tunnel key without a tunnel device Alexandre Cassen
2026-11-11 19:12   ` netdev-bot+sashiko
2026-11-09 13:10 ` [PATCH net-next 10/10] docs: networking: describe tunnel key partitioning in TC queue filtering Alexandre Cassen
2026-11-11 19:12   ` 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=179442432378.2199510.219572665710096354@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