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 v2 05/10] net/mlx5e: TC, reject a partial tunnel key with tunnel mapping
Date: Fri, 20 Nov 2026 03:30:38 +0000	[thread overview]
Message-ID: <179514543838.3136.15751272244504735479@kernel.org> (raw)
In-Reply-To: <20261117092915.255194-6-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] In mlx5e_get_flow_tunnel_id()
  (drivers/net/ethernet/mellanox/mlx5/core/en_tc.c), the new check only…

--

I found one low-severity regression in this patch: the new check in mlx5e_get_flow_tunnel_id() refuses a VXLAN or Geneve rule that uses the full 24-bit VNI mask, even though the hardware programs it the same way as an all-ones mask. The reply below is ready to send to the list.

net/mlx5e: TC, reject a partial tunnel key with tunnel mapping

This patch makes mlx5e_get_flow_tunnel_id() reject flower rules whose
enc_key_id mask is not all ones. The tunnel mapping keeps the matched key
and uses it to restore metadata after a hardware miss. The change prepares
for flower accepting enc_key_id masks.

> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
> index 1d35c97aea0bc..ba3aef3c80635 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c

[ ... ]

> @@ -2265,6 +2266,16 @@ static int mlx5e_get_flow_tunnel_id(struct mlx5e_priv *priv,
>  	u32 value, mask;
>  	int err;
>  
> +	/* The mapping restores the tunnel id of a packet missing in hardware */
> +	if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ENC_KEYID)) {
> +		flow_rule_match_enc_keyid(rule, &enc_keyid);
> +		if (enc_keyid.mask->keyid != cpu_to_be32(U32_MAX)) {
> +			NL_SET_ERR_MSG_MOD(extack,
> +					   "Partial match of tunnel key in chains isn't supported");
> +			return -EOPNOTSUPP;
> +		}
> +	}
> +

[Severity: Low]
Should this check depend on the tunnel type? For VXLAN and Geneve the
tunnel id is a 24-bit VNI, but this check requires all 32 mask bits.

The VXLAN and Geneve parsers already refuse keys that do not fit in 24
bits:

drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_geneve.c:mlx5e_tc_tun_parse_geneve_vni() {
    ...
	if (be32_to_cpu(enc_keyid.key->keyid) >= MLX5E_TC_TUN_N_VNI) {
    ...
	MLX5_SET(fte_match_set_misc, misc_c, geneve_vni, be32_to_cpu(enc_keyid.mask->keyid));
    ...
}

mlx5e_tc_tun_parse_vxlan() has the same check. The mask is then written
into the 24-bit vxlan_vni or geneve_vni field of fte_match_set_misc, so
MLX5_SET() cuts it down to 0xffffff. On the VXLAN-GBP path,
tunnel_header_1 gets mask << 8, which is 0xffffff00 for both masks.

As a result, enc_key_id <vni>/0xffffff and enc_key_id <vni>/0xffffffff
program the same hardware match. Also, key & 0x00ffffff equals key for
every key the parser accepts. So the wrong-tunnel-id case from the commit
message does not seem possible with this mask.

After "net/sched: cls_flower: add enc_key_id mask" later in this series,
a VXLAN or Geneve rule with the natural full-VNI mask 0xffffff would get
-EOPNOTSUPP on every tunnel-mapping path. That covers rules in a chain
greater than 0, and chain 0 rules with goto or sample actions.

Would it work better to compare against the id width of the tunnel (24
bits for VXLAN/Geneve, 32 for GRE)? Another option is to compare the mask
only over the bits the device actually programs.

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

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

Thread overview: 17+ 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-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-17  9:29 ` [PATCH net-next v2 03/10] nfp: " Alexandre Cassen
2026-11-17  9:29 ` [PATCH net-next v2 04/10] net/mlx5e: TC, " Alexandre Cassen
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-20  3:30   ` netdev-bot+sashiko [this message]
2026-11-17  9:29 ` [PATCH net-next v2 06/10] net/sched: cls_flower: add enc_key_id mask Alexandre Cassen
2026-11-17  9:29 ` [PATCH net-next v2 07/10] selftests: forwarding: tc_flower: test the " Alexandre Cassen
2026-11-20  3:30   ` netdev-bot+sashiko
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-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-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-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=179514543838.3136.15751272244504735479@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