From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 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== 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== 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 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) 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 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D82651F000C1; Mon, 30 Nov 2026 19:52:06 +0000 (UTC) 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== Date: Mon, 30 Nov 2026 19:52:04 +0000 From: Simon Horman To: Tariq Toukan Cc: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , netdev@vger.kernel.org, Paolo Abeni , Akiva Goldberger , Gal Pressman , Jason Gunthorpe , Leon Romanovsky , linux-rdma@vger.kernel.org, Mark Bloch , Moshe Shemesh , Or Har-Toov , Saeed Mahameed , Shay Drory Subject: Re: [PATCH net-next V2 1/5] net/mlx5: E-switch, add match-metadata allocator for nested VF/SF eswitches Message-ID: <20261130195204.GF804035@horms.kernel.org> References: <20261120075959.2533702-1-tariqt@nvidia.com> <20261120075959.2533702-2-tariqt@nvidia.com> X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261120075959.2533702-2-tariqt@nvidia.com> On Fri, Nov 20, 2026 at 09:59:54AM +0200, Tariq Toukan wrote: > From: Shay Drory > > 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 > Reviewed-by: Moshe Shemesh > Reviewed-by: Mark Bloch > Signed-off-by: Tariq Toukan Reviewed-by: Simon Horman