πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #19587

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

#19587
From: netdev-bot+sashiko
Date: Fri, 20 Nov 2026 03:30
79 lines
11624 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 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
Technical Details
Message-ID: <179514543838.3136.15751272244504735479@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-367604-linux-kernel-netdev=dewy.ru
References: <20261117092915.255194-6-acassen@corp.free.fr>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-367604-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
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
Organization: Usenet Network
Message-ID: <179514543838.3136.15751272244504735479@kernel.org>
References: <20261117092915.255194-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="3050337"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:j3Sw2HmSws3ppAjU7+3ong7x6oA= sha256:RJM5/maU473zpJgT8B9Cf5pRdvPErHP+dhPo3kYNwoQ=
	sha1:eiV7UmuP5ntLKPNVdcTiFwkY6PE= sha256:kbjZjd8Zm5T7X10++ZorOmml5TrEgDpOUUpR7ahO7hk=
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 1F3CB11588D; Fri, 20 Nov 2026 06:30:57 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.4
X-Spam-Status: No, score=-3.4 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, URIBL_BLOCKED=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 SNEmAs04vLM1;
	Fri, 20 Nov 2026 06:30:52 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-367604-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 0D374115858; Fri, 20 Nov 2026 06:30:44 +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 B907282EB6; Fri, 20 Nov 2026 03:30:41 +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=1795145441;
	b=YoAUyt1F6uXZybp4WH/O4fl6ops2EFbIRxZKoMd7YmiJUj+J4gY9dTslkg1HUs02IXL2
	 gW9Q5IKLZgYfVRuE6mT+Y7fl5xJT5UW8OjUtDmtyYZFbyWnL1/nH7aPea02q5Yq2WfS7G
	 tHpWq7Wlq3ZOSQzAtrXP60MyuAut+9mHoyoF6A7lGzovObBeJ2zfPEeXA6BzWwRYst0FX
	 3lkVj5xgZXrP1gewG+CUagIY7alMSlkSC2/uUmMa5lRWO8DdIrr61bsLV00o5Zd2YE74w
	 ypDnXO+zAWrC29Nx2xZfxHkNfreDFAEqRy4NOFaZoR3xF/SUExAqxX4cD7bymaCKiww==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795145441;
	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=svVu4tGtXkUqJeH2S67jLdV8xt9bisNFvl26L3qlsJI=;
	b=YyVwVqtErx+/MKQCbQ2OxZpAovRSObb+AS7u9AFL2HTVdAV2aZnttaKyTa6LLDoNOVN/
	 Tv8H+ljP8j21GEJVjIFK/IOCsLJjV093c9WfvCwxe0aQZv2ov5KAamsK3BbSAVjEetpJP
	 43LSD3ViJthKSbxSk0LuyJyUJC8Kr0ERDj9FAiBD/Wyz2cMLbuT9VeU0lwn65RXchoePk
	 l+bXW+Wua6rOnKCa/am1lNj9cZVMLt7IGRcpoVgY8VYxD1sE0DovSK6AE13jNPRRDTKuY
	 C9SReXtB7ALJfaLDPLPQuvPNdsrNsi2Oa5RMDgjwv296Ig76F6gHDFtiFoDN1d+Ufog==
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=aDlHmmls;
	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 4FFBE60A2600;
	Fri, 20 Nov 2026 03:30:41 +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=aDlHmmls
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=1795145440;
	b=itBTvYywGH7P3nNXyVdy9s1Jr3sfjwWIkqjiZSkK9Nh0OuJAMnn538siM47z439nd4yW
	 tEEaL/ce7NK3p7Zq7Fqk7l0P6phdZ2LLENJZribcew7WqxQtilZUDJvNI2k0H1b8qYjPt
	 ACgcwcMCx9XXAWdrnrzkwNmOgGvjM3tcgKJJ1OuxAiEvfkTBtBUrFprzVyGgF5vDV1yaH
	 jLv00sK4hkkY/ercrj3hj5aqaqyNEU3dqzo34+Bhl6HRC+531hL5CP6DiRFyzF6rJYNYE
	 Q2xo+67+6LtKD/zpnnEdloqmPVOWU5i6bQkjKA1UP+ygh1vY0ry44+u4No/4yAAZxEg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795145440;
	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=svVu4tGtXkUqJeH2S67jLdV8xt9bisNFvl26L3qlsJI=;
	b=d2g+Z9tt8M2CW/TMpT84cpEbH89E9TQ87/9pyRvA2VNR65VgLGQLoTCyOEK+l8s5rde9
	 QVQa8as78o3SpcunU26OyhYqB7kXhST5e9QdxEG4yI2BTLQ33qNWTp8x54JGUar6RleYq
	 lMFANiooOmlg5HHetxVtUXr3XQGCJzN0PxF1z0E5UdOONNeS0h1eS/sqE3BlTJuXrNsDT
	 1H+eYpCH5FQ1nIo2GSP3kJSbN+a4mMmM57XEgS4NntTbQO9Py9ixbjCuZxcD0287EuDx5
	 CvSXyro+vZGg+qlpFKtO4BDPZNHf/OMtdwd07yf/cw+7l+JrbgoyML/0MbTYDKglK4A==
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=aDlHmmls;
	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 70685606A330;
	Fri, 20 Nov 2026 03:30:40 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id D08DE1F000C4;
	Fri, 20 Nov 2026 03:30:38 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795145440;
	bh=svVu4tGtXkUqJeH2S67jLdV8xt9bisNFvl26L3qlsJI=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=aDlHmmlsjwOA5819XcEcfYMdn8JfR28OvPOsvKTx0IvSVNwF4EPrIIjThTpSF+xhV
	 SXIPRVt5CWJJPkFXn7odk6Ivi9ct95PMwWeGhgTWFNEL+4c3dgZ8Z42kwOApD/aUun
	 tzBSH/gg3LP56jeUxPpha5PSoe74n347ABHUEyl8Og9S5CvQFS6ZWMdYDzMgDhqe77
	 Al1CohkjkRmIFvMoyFO1giovqfviL1u4aosq33NSQynsME8y92DXSa2xQYfOUVYbB2
	 3ZQU1GeG+abQ4T+rdAmM3BbSBLnL4E3QyKQUq0rrb8+iCyDpISs/UlEf0ut57A1zEx
	 qKDNUOyoYH+Xw==
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: <20261117092915.255194-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