🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #18388

Re: [PATCH net-next] net/mlx5: E-Switch, Size FDB peer groups for asymmetric peers

#18388
From: netdev-bot+sashiko
Date: Wed, 18 Nov 2026 09:12
134 lines
13386 bytes
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 SMFS/HMFS mode, esw_max_vports() returns the fixed
  MLX5_ESW_MAX_VPORT_ID (4095) and ignores esw->total_vports.
- [Low] The patch changed how the send-to-vport and peer-miss groups are
  sized, but left the comment and the table_size formula in…

--

net/mlx5: E-Switch, Size FDB peer groups for asymmetric peers

The patch changes how the slow path FDB send-to-vport and peer-miss groups
are sized in SW and HW steering modes. They now use a fixed architectural
vport maximum, MLX5_ESW_MAX_VPORT_ID, instead of the local total_vports.
This lets asymmetric peers pair. FW steering keeps the existing sizing.

> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
> index 4747841310914..20eca8b89b8f4 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
> @@ -1744,6 +1744,17 @@ esw_chains_destroy(struct mlx5_eswitch *esw, struct mlx5_fs_chains *chains)
>  
>  #endif
>  
> +/* SW and HW steering tables are unbounded, so they can be sized for any peer.
> + * FW steering is bounded by log_max_ft_size, so it uses local total_vports.
> + */
> +static int esw_max_vports(const struct mlx5_eswitch *esw)
> +{
> +	if (esw->dev->priv.steering->mode == MLX5_FLOW_STEERING_MODE_DMFS)
> +		return esw->total_vports;
> +
> +	return MLX5_ESW_MAX_VPORT_ID;
> +}

[Severity: Medium]
In SMFS/HMFS mode, can esw_max_vports() return less than the old sizing?

MLX5_ESW_MAX_VPORT_ID is 4095, which is the width of the ESW_VPORT_BITS
field in the reg_c_0 source-port metadata. It limits the number of vports
only when vport-match metadata is enabled. In that case
esw_offloads_vport_metadata_setup() fails with -ENOSPC if there are more
than 4095 vports:

	return vport->metadata ? 0 : -ENOSPC;

Metadata matching can be turned off, though. One way is the
esw_port_metadata devlink parameter. Another is a device without metadata
support. The FDB then matches on the 16-bit source_port/source_sqn space,
and nothing limits total_vports to 4095. total_vports comes from firmware
(VFs plus mlx5_sf_max_functions() and the host-PF/SPF SFs and EC VFs).

If total_vports goes above 4095 in that configuration, both groups end up
smaller than before:

  send-to-vport: 8 * (4095 * 32 + 256) = 1,050,368 entries,
                 versus 8 * (32 * N + 256) before
  peer-miss:     4094 * 7 = 28,658 entries,
                 versus (N - 1) * 7 before

Once the number of rules goes past the new capacity, would insert_fte()
fail here?

	index = ida_alloc_max(&fg->fte_allocator, fg->max_ftes - 1, GFP_KERNEL);

Peer-miss or send-to-vport rule installation would then fail, where the old
sizing worked.

Would max(esw->total_vports, MLX5_ESW_MAX_VPORT_ID) keep the old sizing as
a lower bound?

A smaller point: the new public macro is named MLX5_ESW_MAX_VPORT_ID, but
real vport numbers are 16-bit (MLX5_VPORT_UPLINK is 0xffff and
MLX5_VPORT_ECPF is 0xfffe). Here it is used as a vport count, not an ID.
Would a name tied to the metadata field width be clearer?

> +
>  static int
>  esw_create_send_to_vport_group(struct mlx5_eswitch *esw,
>  			       struct mlx5_flow_table *fdb,
> @@ -1771,7 +1782,9 @@ esw_create_send_to_vport_group(struct mlx5_eswitch *esw,
>  	}
>  
>  	/* See comment at table_size calculation */
> -	count = MLX5_MAX_PORTS * (esw->total_vports * MAX_SQ_NVPORTS + MAX_PF_SQ);
> +	count = MLX5_MAX_PORTS *
> +		(esw_max_vports(esw) * MAX_SQ_NVPORTS + MAX_PF_SQ);
> +

[Severity: Low]
This isn't a bug, but should the comment and the table_size calculation in
esw_create_offloads_fdb_tables() be updated as well? The cross-reference
above now points at text that no longer matches this group:

	/* To be strictly correct:
	 *	MLX5_MAX_PORTS * (esw->total_vports * MAX_SQ_NVPORTS + MAX_PF_SQ)
	 [ ... ]
	 * the peer miss group should also be created based on the number of
	 * total vports of the peer (currently is also uses esw->total_vports).
	 */
	table_size = MLX5_MAX_PORTS * (esw->total_vports * MAX_SQ_NVPORTS + MAX_PF_SQ) +
		     esw->total_vports * MLX5_MAX_PORTS + MLX5_ESW_MISS_FLOWS;

In SMFS/HMFS, both the send-to-vport group and the peer-miss group now use
esw_max_vports(). table_size, and so ft_attr.max_fte, is still computed
from total_vports. The group index layout therefore goes well past the
max_fte the table asks for.

This works today only because mlx5_cmd_dr_create_flow_table() and the HWS
create path overwrite the value:

	ft->max_fte = INT_MAX;

Nothing at the table_size site records that dependency. Could the comment
mention it?

>  	MLX5_SET(create_flow_group_in, flow_group_in, start_flow_index, 0);
>  	MLX5_SET(create_flow_group_in, flow_group_in, end_flow_index, *ix + count - 1);
>  	*ix += count;

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261116210917.1297111-1-tariqt%40nvidia.com
Technical Details
Message-ID: <179499312875.3136.7073415507714082354@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-365970-linux-kernel-netdev=dewy.ru
References: <20261116210917.1297111-1-tariqt@nvidia.com>

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-365970-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next] net/mlx5: E-Switch, Size FDB peer groups for
 asymmetric peers
Date: Wed, 18 Nov 2026 09:12:08 +0000
Organization: Usenet Network
Message-ID: <179499312875.3136.7073415507714082354@kernel.org>
References: <20261116210917.1297111-1-tariqt@nvidia.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2550807"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:FG/gmZuJg6+AKmDeU9l25CoMP8Q= sha256:XU1TtMnncoErbO2z4NfiuUvr0aivTAzQK/kVEZbFi9Q=
	sha1:DzLdy1eUgIG0Pi3UA0e9hpMdyi8= sha256:ejCLdtOY8ETRiY3dOzr28CSeZXPM/U8DnO8CftqtUGA=
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 675231151DE; Wed, 18 Nov 2026 12:12:49 +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 NIetxIQx3qcU;
	Wed, 18 Nov 2026 12:12:45 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-365970-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id B0525115207; Wed, 18 Nov 2026 12:12:35 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id E9D8662F97; Wed, 18 Nov 2026 09:12:22 +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=1794993131;
	b=XdaTjlUzgER5U3ITfsFyNd+yJDLl7/5X2Ez8o93NqDBVCW5D4HBY1L5TE7NWX3k7rFd+
	 xri8otB4EPiLOQF7TKzH9wcKo0/j5yOX5fBS+rHMpaluVY6WxHrpbWQ15+dVnr7VnVPQz
	 T7HnvcGvqe1tJ2clcgubeJ2X5Uf1tg1bgxEkZfxzaK+j5+C6yzUF6iPIOzuTVvRXcaEsV
	 tVTNO2/v2FU7pmhyrXuLZv/y6nnjjzYW4Mr+aKhCCarBe1VDRykyDhAILTS9ohh/YRubj
	 BVCw/2LhWcI2xxS/1v6eC4Iqi9y/XUIMXASD+UPj074kYvTK8m2U8LyghKPPZoZH9kA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794993131;
	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=kyPEMtNB1WsJRDOsvvodLv8gkX0hMfYjt/jgN5NieCg=;
	b=WXxPrJw3JZYVGUEZuNMT4E7IudNlG4lG/kH/Y4Bt0PFYDVK1aHEsXCOSg/bNvZkwYAPt
	 8fXgFb7i1ogpbLexht2Lv9/VgJFUjgI0mxkC2gc0qa4abysvPziX7YcVlSSsCFnd+mjZL
	 lJn41fRNN6+VUBosjbI/HMEKodb7t0QBUROXEan/yMDDT8uu4f+VVejo988PNqaQAXPyu
	 /Zn7CUAnoaOgj42lwgSRipIhn1jyA/rIlnyOPhsdUd+Mm+V2BB6W6NKX8Ckz5ZbKtr/ec
	 Hu0Qa8wuRDsE+KK57BpWJqMLh6BTpW6o9mvSvCMH0aVEhvvD5wchSfG8ZgUJGUAPHCg==
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=HSs0rVMk;
	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 7517160A2605;
	Wed, 18 Nov 2026 09:12:11 +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=HSs0rVMk
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=1794993130;
	b=ht3KFlbAKM8LI5/wBIxeq2/nrWlISSedcfbwat2+dSuk0wpUyI70ZwCCg7t/VOWbmZoG
	 iGxbgGI/jiHCdBeBK3NNEa7Pb0zMwwucWJ8IsAOa855DQb+D0Cd9QxYyX/JhlPLkOyGQv
	 Bb03Clt26+D5BjzehS2ARPgeNVnmtXP15ok8D59h7RYgWPOSLXCiIQuS5BrxaVzSNI3Vf
	 7xmk2U167U0gc0yQ/Io9aKYvcM5tQVTolvbAInwWpIqwAgurPp1zlnpuxdVg7M6u0wVGM
	 GLqTgrx8QQJ9+jJ09u3j+gv/eZQZGfOl2nQDAdN3dN+uEIYxC5W9pJddcA4OdGIEpwA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794993130;
	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=kyPEMtNB1WsJRDOsvvodLv8gkX0hMfYjt/jgN5NieCg=;
	b=GI3zmxJTJ+EeO97Jdx7t1O8NEnrPNYbZkQbhb0gk/gr0G/uQiFOJNuAKWRrIca1BmDCW
	 JusBsvnH+Qfd/3hZ4DS3BQuGt1eS3zjAAcUSOo/4COFEuyIJla+EjqoLDWktzyKChKLIf
	 /s8KL9P69WRg31gA73NtMd3jVjXohFa2PweFBjT3H9i5P9EDeOhL2dc/hyKRAEgRvdLKN
	 FvX0d5ltlWW7QXU9+fX+OloDSiWQjRFZKu3B5SXIDhEItikKlNolHH8sHIAYJAk3mbjFe
	 KiMKfONxiC6LXRn6f5PafhmNkhTvxmlNlZRuN4GWGkIxYZEusV5RtPJ42MLiLdiz+qg==
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=HSs0rVMk;
	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 963A5606A88E;
	Wed, 18 Nov 2026 09:12:10 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C8F31F000CE;
	Wed, 18 Nov 2026 09:12:09 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1794993130;
	bh=kyPEMtNB1WsJRDOsvvodLv8gkX0hMfYjt/jgN5NieCg=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=HSs0rVMkt8QPfo1izHLhXCbm2oXS26L7g07R6UtZ+fWcSQsH8sure7+EyY1i2C4rj
	 4WMPyBNQ1tYAG/lNCYR9MNyxmYCTR4d5K5M06M+Al/KlVaAw6gXGmUUC1f47py2GJK
	 maqFVHOYoh6ljsrz5YrRLWdIvBP+lVKQCrRyui0Wcq5gnWeDYnHojxjPjeE8tRmYwn
	 Pf9j9RLgt7HhZg5lUFQZgWHM+mfPCD/7xDR6xB07vbyWrw/lJSMtwj5cr8R0rXPMVv
	 xBBeIZpkGfPYEGk1mmQQ4vqUw87waj71xL2GFL1MedESdKWo8EuVMSvjt39r0k845X
	 3JlLFAsXvrZ0Q==
X-Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
 kuba@kernel.org, netdev@vger.kernel.org, pabeni@redhat.com, gal@nvidia.com,
 leon@kernel.org, linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org,
 mbloch@nvidia.com, moshe@nvidia.com, saeedm@nvidia.com, shayd@nvidia.com,
 udar@nvidia.com
X-In-Reply-To: <20261116210917.1297111-1-tariqt@nvidia.com>
X-sashiko-severity: Medium
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