๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #21327

Re: [PATCH net-next v3 05/11] net/mlx5e: TC, reject a partial tunnel key with tunnel mapping

#21327
From: netdev-bot+sashiko
Date: Mon, 23 Nov 2026 21:34
80 lines
11460 bytes
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โ€ฆ

--

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

This patch makes mlx5e_get_flow_tunnel_id() refuse any enc_key_id mask
other than all ones. The tunnel mapping stores the matched key, and the
metadata of a packet that misses in hardware is restored from it.

> 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]
Is this check too strict for VXLAN and Geneve? It compares against a
32-bit all-ones mask for every tunnel type. Those tunnels carry a 24-bit
VNI, so a mask of 0x00ffffff already covers every bit a packet can carry.

Both parsers run before mlx5e_get_flow_tunnel_id(), and they already
reject keys that don't fit in 24 bits:

mlx5e_tc_tun_parse_vxlan() and mlx5e_tc_tun_parse_geneve_vni():
	if (be32_to_cpu(enc_keyid.key->keyid) >= MLX5E_TC_TUN_N_VNI) {
		NL_SET_ERR_MSG_MOD(extack,
				   "Tunnel key does not fit the 24 bit VNI");

The mask is then written into fte_match_set_misc.vxlan_vni[0x18] or
geneve_vni[0x18]. Both fields are 24 bits wide, so 0x00ffffff and
0xffffffff program the same hardware match.

This means the masked key stored in the tunnel mapping is the full VNI.
key32_to_tunnel_id(key.enc_key_id.keyid) in mlx5e_restore_tunnel() would
give back the packet's real tunnel id, so the wrong-id restore described
in the commit message can't happen with this mask.

Once the flower enc_key_id mask patch later in this series is applied, a
VXLAN or Geneve rule such as "enc_key_id 42/0xffffff ... action goto
chain 1" would fail here with -EOPNOTSUPP. The same goes for a sample
action, or for any such rule in a chain above 0. With skip_sw the rule
is refused, and otherwise it stays in software. Only GRE uses all 32
bits of the key.

Could the check instead require that the mask covers the full key width
of the tunnel type? No later patch in the series changes
mlx5e_get_flow_tunnel_id(), so this limit is still there at the end of
the series.

> +
>  	esw = priv->mdev->priv.eswitch;
>  	uplink_rpriv = mlx5_eswitch_get_uplink_priv(esw, REP_ETH);
>  	uplink_priv = &uplink_rpriv->uplink_priv;

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261122213200.3207385-1-acassen%40corp.free.fr
Technical Details
Message-ID: <179546966530.3135.14742631609975673237@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369787-linux-kernel-netdev=dewy.ru
References: <20261122213200.3207385-6-acassen@corp.free.fr>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369787-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v3 05/11] net/mlx5e: TC, reject a partial tunnel
 key with tunnel mapping
Date: Mon, 23 Nov 2026 21:34:25 +0000
Organization: Usenet Network
Message-ID: <179546966530.3135.14742631609975673237@kernel.org>
References: <20261122213200.3207385-6-acassen@corp.free.fr>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3989810"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:fI3rv4eFigsvxOtQ1Hr79YF2MjM= sha256:hk/IYhXkDsCG0hdYK6IJdHDok9u0FI2tEzrSvEwRO8I=
	sha1:oMyV2gS982qCcKQfZ2XkS8UAgX0= sha256:8Fd7D9PenvOuk/ZeEhjTtsamlqAssMdM5+XrYh8dWmQ=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 0DFC6125DC9; Tue, 24 Nov 2026 00:34:46 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id hAUk7CgUS1dT;
	Tue, 24 Nov 2026 00:34:42 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-369787-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id B8CE2125DC7; Tue, 24 Nov 2026 00:34:32 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 29DFA36F31; Mon, 23 Nov 2026 21:34:29 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1795469668;
	b=akCsnDAGmx1/C42BWbCuZn1IoDA+ReLlJlHvVhoYxF3WqTlYXnTXPSfpvp32xMHj3ipg
	 r5nkf6Vt0TuZlq+B7NUWVA4tOcIYtzT+oWToBeGWZGBAd/EjTahN9fNGOvlIabkuyh6/m
	 7QljfS8K+aEKy2X0UqUvA9wWooD6wXkUsm/6LaiUwYr2OALIcHGPn4Hz0C3wkTVAtWsZ0
	 AYTI5rFbVsEIhKJu16Y1jO9uN4eRWVNZemsaKWSKraKaGBOLVXRPPMsozq/U1DAgdwvSM
	 x8OyXJWDtE5GF1xEQ5uY4mbssWMj7Z+oVxpyvTQhoGHbHFgThFFjfjr/q68FPdtoCgw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795469668;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=0CvUnIpTCsoLAZFv5fEnyxCYoygVAmsjuGHwr8OUOzE=;
	b=xRVTAAcmXF+NkdKHQgpwOqt/h7UbmzqGX0TanzseDAW9WH7IXv/QYPDNDYWVyAsyevsW
	 bBsE224QIVCm/kemGVp1um0L82/hP/WrsYWwuP3lTe1KKjwv3ZzyElDw/wMRvq9CHMUPB
	 rkVQSIzeWw8uQMw78ySdY71rLZ7O3doWXPX1AJVEE+Syra0GWalaIDLzc+eVsvkGf+s9x
	 NvMOfIBJ+KWL4Y2ERwwxMqzon9ANh6LIPUjQND8RjOfjSBVIYhEkfHpbBER3SJWq2o4dL
	 NT7hGbiKQe/34xH5g9m//oXd5Oj7zWCRBE/2uEZw3CSjlxQHaiDidtBTTrqFmxCFbCg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=SokxTiBz;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id A094E606A335;
	Mon, 23 Nov 2026 21:34:28 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=SokxTiBz
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795469667;
	b=RN/HgSfBPIR9AyIw6sGaQwqci/D8oPjDd+Msgh7n8Gjvex+bL8yolqFzSDCVQ3w+8wI6
	 99mCkZEv9pYfmO+topSJf95ZlXZpQJy2zRje8a9tYJXhzfi5xNa06WwRZeolUXY8NC0M6
	 sLkGdGMgEKIaEUaL2lfqkvZx+1qojCKB+JWK/SyEf+J57wYAcSvqYJUZsB+iQJHtudH8l
	 MhqH9xVn2aMnW1dB8tH729hgYQ44HfhooQau5Xxti20mW+rgFAdlFsLh/PEZHIc8wLLef
	 3b2czMFbikGo1wmwGXoYFA3dbzH44JwHBF9tPNVHnaEccZVTYLi50KfwHobRUF5Bzxw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795469667;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=0CvUnIpTCsoLAZFv5fEnyxCYoygVAmsjuGHwr8OUOzE=;
	b=ULqWBN5H+M60Y3xM30FnK7Tk3Xp6inj5iPZCMWdIRW1TzyER+n+U+7anb7jt1w5vr9vq
	 LkunjIONHt3oAXUc8QQK1I/wUdpTq3t43bDbi83Ywj/NNn6on6f4v33f7yN9dWgCHLPfP
	 TR26f+IFkW8Gdh9pnwHctS5d6P/F+N72ejO0vbFBhpUMnWu0IfRCY9EWczHBn7ilF+JvC
	 ezGXIZB/aUFbajdUn/TLyhgay7oUh0H1j7B4vrBYV6XcbcLn6E3CAkC9Cog6zXsheQUOX
	 JeoLTEYsGFB0uRsuIGlpndaUH62JMsOlulRw+SDUjPBKzWhXAlqmwYTMss2zhINd3dQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=SokxTiBz;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id BFBD5606A31E;
	Mon, 23 Nov 2026 21:34:27 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id C80191F000D8;
	Mon, 23 Nov 2026 21:34:25 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795469667;
	bh=0CvUnIpTCsoLAZFv5fEnyxCYoygVAmsjuGHwr8OUOzE=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=SokxTiBzfM6nkJz6PFUfTNET9o+qkwp5JM85l21kyooUPTGup9EQoyYoUxNvkwibY
	 Akwh+tOjVcXxv3H95tPYc+zT2+2QOyy83LJwfpy86vNtYOr7ckWuSTAUrcb+brrME7
	 ud3negYEvS4y2X+YF1917wFVuZt+JoOGqBnWbXqQ3hMd8m+it3Mav5+L80zm1HxtXC
	 9JZuryI8A7Yzvt6qtjKc1oLpxojwIj46iHPTPBFLdlggKYZdkFa+SgDeWpYFBEU9hg
	 4fToR49GuDLF257oa1CCm6LrKKTZdmym9d/qA5+VeMQA8e0rsnnkhmzs9+nbUxx8v5
	 TdzRz0oy6StHA==
X-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
X-In-Reply-To: <20261122213200.3207385-6-acassen@corp.free.fr>
X-sashiko-severity: Low
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list