Article View: linux.kernel.netdev
Article #24770Re: [PATCH net-next V2 1/5] net/mlx5: E-switch, add match-metadata allocator for nested VF/SF eswitches
From: Simon Horman
Date: Mon, 30 Nov 2026 19:52
Date: Mon, 30 Nov 2026 19:52
41 lines
10246 bytes
10246 bytes
On Fri, Nov 20, 2026 at 09:59:54AM +0200, Tariq Toukan wrote: > From: Shay Drory <shayd@nvidia.com> > > The eswitch source-port match metadata is laid out as 4 bits of PFNUM > and 12 bits of a unique id (ESW_SOURCE_PORT_METADATA_BITS). PFNUM is the > native_port_num reported in HCA_CAP, so all VFs/SFs of the same PF share > a single PFNUM. Each VF/SF eswitch allocates its id from its own > vport_metadata_ida, restarting from the lowest value, so two VFs/SFs of > the same PF can end up with identical metadata. Once their eswitches > share an FDB (virt LAG), that metadata no longer uniquely identifies the > source port. > > Add a dedicated allocator for nested (virt LAG) eswitches that replaces > the PFNUM field with the VF/SF's slot in the LAG (its xarray index in > ldev->fns). That index is unique per function within the LAG, so > combined with a per-VF/SF id it yields unique metadata regardless of > which PF the VFs/SFs belong to. The split is 8 bits for the virt LAG > index - which fits the U8_MAX cap on the LAG xarray - and the remaining > 8 bits for the id; the two still sum to ESW_SOURCE_PORT_METADATA_BITS, > so nothing downstream of the match changes. Describe the nested layout > next to the reg_c_0 layout in include/linux/mlx5/eswitch.h. > > The PFNUM value 0xf is reserved for internal port offload, which stamps > it into reg_c_0 and matches it with the same mask used for vport > metadata. That offload is gated on switchdev mode only, so it can be > used on a nested eswitch as well. Cap the LAG index accordingly. > > Select the nested layout for a non-PF eswitch, unless it is virt LAG > capable but not a LAG member, e.g. one refused as a late joiner and left > standalone. Such a device keeps the PFNUM layout: it does not pair with > the eswitches of the LAG members, so its metadata is never compared > against theirs. PFs, which never report the virt LAG capabilities, keep > the PFNUM layout. > > Signed-off-by: Shay Drory <shayd@nvidia.com> > Reviewed-by: Moshe Shemesh <moshe@nvidia.com> > Reviewed-by: Mark Bloch <mbloch@nvidia.com> > Signed-off-by: Tariq Toukan <tariqt@nvidia.com> Reviewed-by: Simon Horman <horms@kernel.org>
Technical Details
Message-ID:
<20261130195204.GF804035@horms.kernel.org>Path:
mbox-mo1.pugleaf.net!news-can.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-374424-linux-kernel-netdev=dewy.ruReferences:
<20261120075959.2533702-1-tariqt@nvidia.com> <20261120075959.2533702-2-tariqt@nvidia.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-can.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-374424-linux-kernel-netdev=dewy.ru From: horms@kernel.org (Simon Horman) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next V2 1/5] net/mlx5: E-switch, add match-metadata allocator for nested VF/SF eswitches Date: Mon, 30 Nov 2026 19:52:04 +0000 Organization: Usenet Network Message-ID: <20261130195204.GF804035@horms.kernel.org> References: <20261120075959.2533702-1-tariqt@nvidia.com> <20261120075959.2533702-2-tariqt@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: usenet.network; logging-data="1522625"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:oaH3df4Lcx7YiDfZaocgKxaWYRY= sha256:F6yvrA1lBd8MeVQ0myDiuLLYv49B2l8hNhhe6V1ceUE= sha1:nPQw98O1f4s5UdjDeoJrT9yS1XM= sha256:zltbBa8uGX2zuDWxwbaO3W6s3rNKwXrwk51q2mQ2TEg= Content-Disposition: inline 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 AC8E0126003; Mon, 30 Nov 2026 22:52:35 +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 b0kySWMtMb5L; Mon, 30 Nov 2026 22:52:28 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-374424-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 9B627126001; Mon, 30 Nov 2026 22:52:18 +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 7EE412F396; Mon, 30 Nov 2026 19:52:16 +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=1796068336; b=vN+UDqj7dl1I+jBzEWZH8Mjz0H/P3gswtKFfLaG8IKiQHzxXkRBRq7H6dKpiwsJ+hq/V eqzQgTHQbeQ5mx9uol2tBnoDENcWv2ID9V6gghzCRDQ6qBWtFOqGCtxtKfAaL3FI6iBsD VI9z+deTheMfuFkJgnahjjwYySyMJWKb5N+pUSOLI641x+efrO9XOjClolMvKUG/ozIPy XZYYw22MIEpxKYVARsc1kXZHIpgoUn2cfT7qDCOnBbTaMOMn1ORM/ibalAmj9uLyezAcj GvGKj2cv/WJy/LfTACA0wjmDYBCB+KZvnCDm+MEI+ExS8cnt0N2F64AcJAWy1G/qEyA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796068336; h=X-Original-To:Received:Received:DKIM-Signature:Date:From:To:Cc: Subject:Message-ID:References:X-Mailing-List:List-Id:List-Post: List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence: MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=Sb7M4Z9a3UTc5E9daB2Go6qKWTLGaVa3IXKt4ceFrbs=; b=R9I4K7hEUAlXzCaKIreLTK4zOA90DZ+xhbAlUmqAI9f7PPxjKBu/CyPGd97U53Jh/UAY 6IWnNiYzW/l9CD+rVP2B2xnzKe5H0XZQrk9g72wRjSWg9mCDXAxu94QL7ErSE+IFce9an +3NYdckRZUHClI+r4vucerc9DiYGpiZ1Wm8ze44XfsHukpzdFtdUDp/gq+CPwiPJVLzyL zb/i3dVngnJa74EYB4jqEntRj4UQPzUdhla0m8/6nyRzXqCePDkBYbveOUEcqEukW063L iU2B8wlvdc8Kdw+P/ZHL19ic3WoXhYnXk5bA/p5+bBb5HX/h0O/RK0fHvR6Y4iEy1wg== 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=K+MpMk5N; 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 5858C606A32D; Mon, 30 Nov 2026 19:52:16 +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=K+MpMk5N 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=1796068330; b=4erpPbeUYE1axa9ijuZKF7OcoXWWz6S5wxxPZtRdhWEaH4AXbc/hW/4R5oWzkDZ2vFM4 cvituAw8giZPVo4+Otz4b6ez8W8ANDMJ7DUyob2w2J8YpOhyLjemy1o09QauSP9SwFdNU pmE0VpUvGH/XbhMMsfjtllSHBlulJIJLo7767C+72B2lf8uKuiSlrrflLD8Yy/plKtA6G q8Gl15qbQpnBvKgj1Rbf3pLgFz2sfYG9VvVMOST324nHgznTRsA1iXn1TvMsrqLKZFn8x aRqz71aUF0uu8pCMpV4KuECDnB4Hve36tupkcRbi+4tBbMEyyF0dsonfYv3u+0qdjmA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796068330; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=Sb7M4Z9a3UTc5E9daB2Go6qKWTLGaVa3IXKt4ceFrbs=; b=4TUoXXQ+m5FQxs8EE/9RVaPGDSCjGFl+nw5y3HYqwwgZR47x//dmHwiAygiQl3NGzftH g39/HhS+OYZq392z/crLFWXjWMMsE6geDEzpHt2lcwUX3PSvpSW/OWs9ayz/SNNTccGSE R/+SuUrDuD5JQMAK2aD8zpfP2gHYXzYvK+wI8nFwKyIuApYan7w2T6ATTVVxLNkRZ+WJU 8AdhLioIm+CNddrl5/eFv22cZPjwzKlh7ykl3rtSDMDE41P+mkQUun6SVM+zkKlWnAwf/ bPEz/ymMs4xwvN020gg4r00qv7yTmPLfIWymMfLciHgKT764PW9+56krkWPVnki+wFA== 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=K+MpMk5N; 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 746DF606A320; Mon, 30 Nov 2026 19:52:10 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id D82651F000C1; Mon, 30 Nov 2026 19:52:06 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796068329; bh=Sb7M4Z9a3UTc5E9daB2Go6qKWTLGaVa3IXKt4ceFrbs=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=K+MpMk5NWOXI7GknDpyCMP/538mmOzZ+18O8C6ehsN1RHE3WWMF0V0RbqRju3SuWY xdP1uVyniWak5M9fwXrx/oH+RWwPcTxkjk+1x5cTZa18vTyJmI8BuLyvp34LFHsaf3 ARR6pOenmw90ofRP0mE/rWqdMYMBS80GpVlVzT6h5k6q82AnyvGgl2UI3aXvdfsJmS iacM4FnIo8ZjeXe66c2eLwUrI6TjkdgTrwLtaCrb1Xg3T6van0NoUOc0MPgtNLEVzv mF0ci42f0EPzHOBDaDMXp7WnVjZkWCImeP6L4xrhXid+KxSPXrbz9EOuf9tQ4UXyqq 7XHzjVqTPLuQA== X-Cc: Andrew Lunn <andrew+netdev@lunn.ch>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>, netdev@vger.kernel.org, Paolo Abeni <pabeni@redhat.com>, Akiva Goldberger <agoldberger@nvidia.com>, Gal Pressman <gal@nvidia.com>, Jason Gunthorpe <jgg@ziepe.ca>, Leon Romanovsky <leon@kernel.org>, linux-rdma@vger.kernel.org, Mark Bloch <mbloch@nvidia.com>, Moshe Shemesh <moshe@nvidia.com>, Or Har-Toov <ohartoov@nvidia.com>, Saeed Mahameed <saeedm@nvidia.com>, Shay Drory <shayd@nvidia.com> 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 X-In-Reply-To: <20261120075959.2533702-2-tariqt@nvidia.com>