From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7F6E321CC64; Fri, 28 Nov 2025 04:16:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764303408; cv=none; b=J25N48jl8smF2fR/K8Du8CUH5N7yvOBTqXB0XdCEjzDrczrhAc1MZBQX7GavulclxA5yRDtfCJiNK8Lwf7J4EkU0qO3IQler7Rqj/BGiOTTwsbyN5TrLBg7abBThnYfYv4+yEX3rxpzh68gQ9XiUzCzcoEcK5sOFwHW+7CYjwFM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764303408; c=relaxed/simple; bh=LuWc4OPdwOePNFT72nG7ZLXUHvAW3UEQTHkrGj7af+0=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=WVQq2ewfmxSzD0IakA2j3+WdoBRwQOfjU31Xztnm3JAhNaOZm/WoNY0MeIlv1fz3z4SmiTWHQAFuN7GC0r8ZQBdZLdnpr8E6oQH0pqG2ecOn2E9/QRlJBzy4eyZN78S4pvka83RI4WJ8vCsv69b9YGOk8O7ZRtVHNNET3jnSRco= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FhDG0e7M; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="FhDG0e7M" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC7EEC4CEF1; Fri, 28 Nov 2025 04:16:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1764303407; bh=LuWc4OPdwOePNFT72nG7ZLXUHvAW3UEQTHkrGj7af+0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=FhDG0e7MLVVidQgSV2u34kGymZf2UUB7vXAOvbHGQrEkaHqN1JRQuR4U6S2aoz7MH xtuA2lSF4bFoVMWkZjrY321+3bnU0OdrPDOrB0zk6PfiLNkJdiy/Lyo6Q2MizTi7EY xrxEWJBkDydW1VSkYMIWwdX2hHr7ks/u4gw/1AEO8iYgM6YzS2Dr+YxgaOArI23UGz dn5rzJJM/R9iOYlL7gbygOuU7h6WE/ClT34ZlNWLHYTRD7ikgkNdjXDYvbA6iXhJmO aWMRwY9n99AgFrafBcDW34CHC/sMUJY79cy+apPOFuD490M2RF92iR/A+0lRM+WWsC YUegCD27q+G+Q== Date: Thu, 27 Nov 2025 20:16:45 -0800 From: Jakub Kicinski To: Tariq Toukan Cc: Eric Dumazet , Paolo Abeni , Andrew Lunn , "David S. Miller" , Donald Hunter , Jiri Pirko , Jonathan Corbet , Saeed Mahameed , "Leon Romanovsky" , Mark Bloch , , , , , Gal Pressman , Moshe Shemesh , Carolina Jubran , Cosmin Ratiu , Jiri Pirko , Randy Dunlap Subject: Re: [PATCH net-next V4 02/14] documentation: networking: add shared devlink documentation Message-ID: <20251127201645.3d7a10f6@kernel.org> In-Reply-To: <1764101173-1312171-3-git-send-email-tariqt@nvidia.com> References: <1764101173-1312171-1-git-send-email-tariqt@nvidia.com> <1764101173-1312171-3-git-send-email-tariqt@nvidia.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Tue, 25 Nov 2025 22:06:01 +0200 Tariq Toukan wrote: > From: Jiri Pirko > > Document shared devlink instances for multiple PFs on the same chip. > > Signed-off-by: Jiri Pirko > Reviewed-by: Cosmin Ratiu > Signed-off-by: Tariq Toukan > --- > .../networking/devlink/devlink-shared.rst | 66 +++++++++++++++++++ > Documentation/networking/devlink/index.rst | 1 + > 2 files changed, 67 insertions(+) > create mode 100644 Documentation/networking/devlink/devlink-shared.rst > > diff --git a/Documentation/networking/devlink/devlink-shared.rst b/Documentation/networking/devlink/devlink-shared.rst > new file mode 100644 > index 000000000000..be9dd6f295df > --- /dev/null > +++ b/Documentation/networking/devlink/devlink-shared.rst > @@ -0,0 +1,66 @@ > +.. SPDX-License-Identifier: GPL-2.0 > + > +============================ > +Devlink Shared Instances > +============================ > + > +Overview > +======== > + > +Shared devlink instances allow multiple physical functions (PFs) on the same > +chip to share an additional devlink instance for chip-wide operations. This > +should be implemented within individual drivers alongside the individual PF > +devlink instances, not replacing them. > + > +The shared devlink instance should be backed by a faux device and should > +provide a common interface for operations that affect the entire chip > +rather than individual PFs. If we go with this we must state very clearly that this is a crutch and _not_ the recommended configuration... > +Implementation > +============== > + > +Architecture > +------------ > + > +The implementation should use: > + > +* **Faux device**: Virtual device backing the shared devlink instance > +* **Chip identification**: PFs are grouped by chip using a driver-specific identifier > +* **Shared instance management**: Global list of shared instances with reference counting > + > +Initialization Flow > +------------------- > + > +1. **PF calls shared devlink init** during driver probe > +2. **Chip identification** using driver-specific method to determine device identity > +3. **Lookup existing shared instance** for this chip identifier > +4. **Create new shared instance** if none exists: > + > + * Create faux device with chip identifier as name > + * Allocate and register devlink instance > + * Add to global shared instances list > + > +5. **Add PF to shared instance** PF list > +6. **Set nested devlink instance** for the PF devlink instance ... because presumably we could use this infra to manage a single devlink instance? Which is what I asked for initially. > +Cleanup Flow > +------------ > + > +1. **Cleanup** when PF is removed; destroy shared instance when last PF is removed > + > +Chip Identification > +------------------- > + > +PFs belonging to the same chip are identified using a driver-specific method. > +The driver is free to choose any identifier that is suitable for determining > +whether two PFs are part of the same device. Examples include VPD serial numbers, > +device tree properties, or other hardware-specific identifiers. > + > +Locking > +------- > + > +A global per-driver mutex protects the shared instances list and individual shared > +instance PF lists during registration/deregistration. Why can't this mutex live in the core? > +Similarly to other nested devlink instance relationships, devlink lock of > +the shared instance should be always taken after the devlink lock of PF. > diff --git a/Documentation/networking/devlink/index.rst b/Documentation/networking/devlink/index.rst > index 35b12a2bfeba..f7ba7dcf477d 100644 > --- a/Documentation/networking/devlink/index.rst > +++ b/Documentation/networking/devlink/index.rst > @@ -68,6 +68,7 @@ general. > devlink-resource > devlink-selftests > devlink-trap > + devlink-shared > > Driver-specific documentation > -----------------------------