From nobody Tue Dec 2 02:30:41 2025 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (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 7713D36BCFC; Wed, 19 Nov 2025 20:00:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.84.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763582430; cv=none; b=PuWD1uLhvFC6rvaImmOzxTvH3XugOPWlplyL6OtXgHGm0iyKKt+ADQssUGkO33lp57iLAr0qxhE+t2lzf/+mur1DmnnggjKCMTQj+nHBP+d+d6u935H3RJLXCNZkQA+8zgTfdQgPTD1SqWX20xGdYMwE37o1PgK0+y/VHCNtUXw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763582430; c=relaxed/simple; bh=ygnMB0zO5n7LNWTLaftTf7mOpO0kT3kaJ+Cqfp3KG9Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=StmLSlTGxLyL6NUjZEz71x7LxLmjoYxsqQcX7lFGbpKnLbuA4lmSgMGdHNK9sK86vp1lZvvJdy5hfFpqQbJ5efU2AiW650+X7PamiA1mIx+zLq7/LdDMm4Bxkit5xvO6KAFrAK8SxIlySc5CV3cD8qEYPjnZp/jhPl1a51m4B8w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=VJlWKAzV; arc=none smtp.client-ip=185.246.84.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="VJlWKAzV" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 8597D1A1BB3; Wed, 19 Nov 2025 20:00:25 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 5C24860699; Wed, 19 Nov 2025 20:00:25 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 268F110371A45; Wed, 19 Nov 2025 21:00:21 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1763582424; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=q5cHSdBiFQndzU4nTFiD7tW7FCwQQjMLgxuIBfRu/1k=; b=VJlWKAzVHzB+dudMki/sFnzGCmXtuJ8iYEpsqnOVE70nltXlHHoibDS9G4Sn1ksH2ibfqr doXf0kADWlMdBgCk8rWbCad2IQaAP7MIy3myVUGt9UwZfgsTPeo8vARy1koO5otxMTadYu JusuDPbbIJtOQ7G06es7O1ykZU3E/AW4J60y6Ew9/b7s1joTDAbZI/HfQX1xg09qd9ze3U QeL5W8lV/QnLog7p56K2HGn6m22VOQwSMIiHSnareI6k4Q2nKMK4rkIw1e7KTe5u+iDkZU yPtjmFXfwgjZuvjG1qUke/VFGTpeZogoyEabr14nr9iv0WSLwABuTVuFbXKx/w== From: Maxime Chevallier To: davem@davemloft.net Cc: Maxime Chevallier , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, thomas.petazzoni@bootlin.com, Andrew Lunn , Jakub Kicinski , Eric Dumazet , Paolo Abeni , Russell King , linux-arm-kernel@lists.infradead.org, Christophe Leroy , Herve Codina , Florian Fainelli , Heiner Kallweit , Vladimir Oltean , =?UTF-8?q?K=C3=B6ry=20Maincent?= , =?UTF-8?q?Marek=20Beh=C3=BAn?= , Oleksij Rempel , =?UTF-8?q?Nicol=C3=B2=20Veronese?= , Simon Horman , mwojtas@chromium.org, Antoine Tenart , devicetree@vger.kernel.org, Conor Dooley , Krzysztof Kozlowski , Rob Herring , Romain Gantois , Daniel Golle , Dimitri Fedrau Subject: [PATCH net-next v17 15/15] Documentation: networking: Document the phy_port infrastructure Date: Wed, 19 Nov 2025 20:59:16 +0100 Message-ID: <20251119195920.442860-16-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20251119195920.442860-1-maxime.chevallier@bootlin.com> References: <20251119195920.442860-1-maxime.chevallier@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" This documentation aims at describing the main goal of the phy_port infrastructure. Reviewed-by: Christophe Leroy Reviewed-by: Andrew Lunn Tested-by: Christophe Leroy Signed-off-by: Maxime Chevallier --- Documentation/networking/index.rst | 1 + Documentation/networking/phy-port.rst | 111 ++++++++++++++++++++++++++ MAINTAINERS | 2 + 3 files changed, 114 insertions(+) create mode 100644 Documentation/networking/phy-port.rst diff --git a/Documentation/networking/index.rst b/Documentation/networking/= index.rst index 75db2251649b..49fcfa577711 100644 --- a/Documentation/networking/index.rst +++ b/Documentation/networking/index.rst @@ -96,6 +96,7 @@ Contents: packet_mmap phonet phy-link-topology + phy-port pktgen plip ppp_generic diff --git a/Documentation/networking/phy-port.rst b/Documentation/networki= ng/phy-port.rst new file mode 100644 index 000000000000..6e28d9094bce --- /dev/null +++ b/Documentation/networking/phy-port.rst @@ -0,0 +1,111 @@ +.. SPDX-License-Identifier: GPL-2.0 +.. _phy_port: + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +Ethernet ports +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +This document is a basic description of the phy_port infrastructure, +introduced to represent physical interfaces of Ethernet devices. + +Without phy_port, we already have quite a lot of information about what the +media-facing interface of a NIC can do and looks like, through the +:c:type:`struct ethtool_link_ksettings ` attribute= s, +which includes : + + - What the NIC can do through the :c:member:`supported` field + - What the Link Partner advertises through :c:member:`lp_advertising` + - Which features we're advertising through :c:member:`advertising` + +We also have info about the number of pairs and the PORT type. These setti= ngs +are built by aggregating together information reported by various devices = that +are sitting on the link : + + - The NIC itself, through the :c:member:`get_link_ksettings` callback + - Precise information from the MAC and PCS by using phylink in the MAC d= river + - Information reported by the PHY device + - Information reported by an SFP module (which can itself include a PHY) + +This model however starts showing its limitations when we consider devices= that +have more than one media interface. In such a case, only information about= the +actively used interface is reported, and it's not possible to know what the +other interfaces can do. In fact, we have very little information about wh= ether +or not there are any other media interfaces. + +The goal of the phy_port representation is to provide a way of representin= g a +physical interface of a NIC, regardless of what is driving the port (NIC t= hrough +a firmware, SFP module, Ethernet PHY). + +Multi-port interfaces examples +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D + +Several cases of multi-interface NICs have been observed so far : + +Internal MII Mux:: + + +------------------+ + | SoC | + | +-----+ | +-----+ + | +-----+ | |-------------| PHY | + | | MAC |--| Mux | | +-----+ +-----+ + | +-----+ | |-----| SFP | + | +-----+ | +-----+ + +------------------+ + +Internal Mux with internal PHY:: + + +------------------------+ + | SoC | + | +-----+ +-----+ + | +-----+ | |-| PHY | + | | MAC |--| Mux | +-----+ +-----+ + | +-----+ | |-----------| SFP | + | +-----+ | +-----+ + +------------------------+ + +External Mux:: + + +---------+ + | SoC | +-----+ +-----+ + | | | |--| PHY | + | +-----+ | | | +-----+ + | | MAC |----| Mux | +-----+ + | +-----+ | | |--| PHY | + | | +-----+ +-----+ + | | | + | GPIO-------+ + +---------+ + +Double-port PHY:: + + +---------+ + | SoC | +-----+ + | | | |--- RJ45 + | +-----+ | | | + | | MAC |---| PHY | +-----+ + | +-----+ | | |---| SFP | + +---------+ +-----+ +-----+ + +phy_port aims at providing a path to support all the above topologies, by +representing the media interfaces in a way that's agnostic to what's drivi= ng +the interface. the struct phy_port object has its own set of callback ops,= and +will eventually be able to report its own ksettings:: + + _____ +------+ + ( )-----| Port | + +-----+ ( ) +------+ + | MAC |--( ??? ) + +-----+ ( ) +------+ + (_____)-----| Port | + +------+ + +Next steps +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +As of writing this documentation, only ports controlled by PHY devices are +supported. The next steps will be to add the Netlink API to expose these +to userspace and add support for raw ports (controlled by some firmware, a= nd directly +managed by the NIC driver). + +Another parallel task is the introduction of a MII muxing framework to all= ow the +control of non-PHY driver multi-port setups. diff --git a/MAINTAINERS b/MAINTAINERS index e0dc230df90e..219c04aab4a6 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -9283,6 +9283,7 @@ F: Documentation/devicetree/bindings/net/ethernet-con= nector.yaml F: Documentation/devicetree/bindings/net/ethernet-phy.yaml F: Documentation/devicetree/bindings/net/mdio* F: Documentation/devicetree/bindings/net/qca,ar803x.yaml +F: Documentation/networking/phy-port.rst F: Documentation/networking/phy.rst F: drivers/net/mdio/ F: drivers/net/mdio/acpi_mdio.c @@ -17981,6 +17982,7 @@ F: net/ethtool/phy.c NETWORKING [ETHTOOL PHY PORT] M: Maxime Chevallier F: Documentation/devicetree/bindings/net/ethernet-connector.yaml +F: Documentation/networking/phy-port.rst F: drivers/net/phy/phy_port.c F: include/linux/phy_port.h K: struct\s+phy_port|phy_port_ --=20 2.49.0