Received: by 2002:ab2:2441:0:b0:1f3:1f8c:d0c6 with SMTP id k1csp150169lqe; Thu, 4 Apr 2024 02:30:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU4OJAex9SRu8YJ3ERznYtMUJ4WaTtXK7ivtRNElehXRkxgPoWK1AS6AZeTll9oodm8scRXH7cuPDeLJSEdAVKgrOfLA7nSeZFb5/zdcw== X-Google-Smtp-Source: AGHT+IGEZGNB2mj9c57Y3YTeH3RZmXhrGSwkbZ5zcv4Aw0HJRBh00SQ0+SOZb/cA+MA2Y3vfX0k6 X-Received: by 2002:a05:620a:408a:b0:78a:2655:3066 with SMTP id f10-20020a05620a408a00b0078a26553066mr1854991qko.35.1712223045436; Thu, 04 Apr 2024 02:30:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712223045; cv=pass; d=google.com; s=arc-20160816; b=vhdjiFULw7FRpUrmJUHO9vBUKsKoPIJGsldQuzloNC5tBc86JUW7kHZVgeXwrtzxZ5 bFdQ0rRMg+F4g2MqVbpy8PaKDvjcTEmWJ86+ych7lx/9h/hKR5BP6nuWFitfPWd7Cu6K c9uOi7zc8PPxOyxltJQwk1qJoCLuTZYkTTJHel1Ix748DtrUpqMH+YG5Cil5s8Wryaiz F6X1Ev6olRCYfHOQMpBnNc23OGKTey4MBuqEzkt9uiWJbNFkTdMe+Cy5GCT/OsKGayNv E2cBjeYmGZBkBsvAHKKkmYQpnj1/fL7EZoFsbTrtCyuydSpVGTm4ruItyoxS+8HurZcY ysqA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=KpZLzk+yxmd2N+rLGkTeJed9//8KUR7HQ4lmyd8EXFo=; fh=1vUu/d1GTjraph6G+ET+Z0z13QVrf6oL/IrrK9zaTF8=; b=moGjPYC4jEPEGM3WBrjRt8wFCsROjbCFEUZ7E9DHzUAfJIPq7iOkDabrIF/SRFEOps ffNmrhPI4PuR2dinl+wKc/bCjUk2F+8qoLH5K4ZPs2+jWf+v9tMzE2cDihNG+XGeJRVY lv6+4q6BjJrlK5+xt8aOpJFcjIqXcDJU3sEHO16InPiUKfQWdJPSk91duya3cnv3A8OF a4rFlpoNf+kQmD779ebZjuWUhzvnmhP02HCJgo3IEfWyICM1eQ8yAVbCccVsKBLOcqkG oaceaVv1NJHD6QWFwmMJjZAJFtcnZI1kTMizp3Em2yW7+rDmAdmXOnj4oEzhI58oXRBK mgtA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=h7c0ijvT; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-131171-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131171-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id y23-20020a05620a0e1700b0078a4350a0f7si15744445qkm.348.2024.04.04.02.30.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 02:30:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-131171-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=h7c0ijvT; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-131171-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131171-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 1CA2C1C2544E for ; Thu, 4 Apr 2024 09:30:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 81DE876049; Thu, 4 Apr 2024 09:30:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="h7c0ijvT" Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) (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 031627443E; Thu, 4 Apr 2024 09:30:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.198 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712223013; cv=none; b=D4/Z4OmosixV11bQq76g3GpcdTcUO43vBx7Fu9hoYcuiYbqhvIdhrOOxSyVLJ3z2km7kHd5WBboJIVC678uUZhPmSBX8zNmpgxHrXYc8cgY7iBIx8xuBTUaZzN3DkaaHa+WV9bJLywhlUU5bsssd4tfljU5j6U63XSvcXG4WEEg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712223013; c=relaxed/simple; bh=pGQtcE7yixraOz1GdkA161tjH6f1m3i0m+MhY8ICudc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=SLOj7M+9W5XQ8RN4jiS3g1EPkmlvJACiP976VZAQNbiThmWGRH6ZtIQ4qkGbat31G4EbrapREcYzc7Zaod0CMiwxllRXFB2l7aAN2q+J87Zpkv/FV8YwN91XCCztoew31s+st1WAQYJSMjCA023eioZMZsZbbv0yc17Ctwp3SKk= 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=h7c0ijvT; arc=none smtp.client-ip=217.70.183.198 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 Received: by mail.gandi.net (Postfix) with ESMTPSA id 1B934C000A; Thu, 4 Apr 2024 09:30:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1712223009; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=KpZLzk+yxmd2N+rLGkTeJed9//8KUR7HQ4lmyd8EXFo=; b=h7c0ijvTmw4H1AE9La2KRu3naCyGnBspabRjtnT1NwbfV+OhXMOHpXsak+p+Sy9/cCeQRc H26foM5ljHEvNYPkvkm+4jiLgHCGDme5mD5FbyMtQu8vSlHHKgOfkmnvRTxJm0sfeP93a+ yKnQlgRzlneS3bBxk9Q05U0oDBDT+JOBumsDrR4FFKrFAbWzeTCHY0rgtuWpcE7hdcPFKQ oTQXChD6b+xG/1xOwQgJ907qHHO85AKtOxwPoaxi3erzvPYQmT9v8HK+p2SH0nBRjvl6F7 efvNWU5nvFf+mj4MafbY/l6d8Zc9MaiPdQPN4Ar5aN+OwvuYrOB2ecxPaqqvxg== From: Maxime Chevallier To: davem@davemloft.net Cc: Maxime Chevallier , netdev@vger.kernel.org, linux-kernel@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?= , Jesse Brandeburg , Jonathan Corbet , =?UTF-8?q?Marek=20Beh=C3=BAn?= , Piergiorgio Beruto , Oleksij Rempel , =?UTF-8?q?Nicol=C3=B2=20Veronese?= , Simon Horman , mwojtas@chromium.org Subject: [PATCH net-next v11 00/13] Introduce PHY listing and link_topology tracking Date: Thu, 4 Apr 2024 11:29:50 +0200 Message-ID: <20240404093004.2552221-1-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.44.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-GND-Sasl: maxime.chevallier@bootlin.com Hello everyone, This is V11 for the link topology addition, allowing to track all PHYs that are linked to netdevices. This V11 addresses the various netlink-related issues that were raised by Jakub, and fixes some typos in the documentation. As a remainder, here's what the PHY listings would look like : - eth0 has a 88x3310 acting as media converter, and an SFP module with an embedded 88e1111 PHY - eth2 has a 88e1510 PHY # ethtool --show-phys * PHY for eth0: PHY index: 1 Driver name: mv88x3310 PHY device name: f212a600.mdio-mii:00 Downstream SFP bus name: sfp-eth0 PHY id: 0 Upstream type: MAC PHY for eth0: PHY index: 2 Driver name: Marvell 88E1111 PHY device name: i2c:sfp-eth0:16 PHY id: 21040322 Upstream type: PHY Upstream PHY index: 1 Upstream SFP name: sfp-eth0 PHY for eth2: PHY index: 1 Driver name: Marvell 88E1510 PHY device name: f212a200.mdio-mii:00 PHY id: 21040593 Upstream type: MAC Ethtool patches : https://github.com/minimaxwell/ethtool/tree/link-topo-v6 Link to V10: https://lore.kernel.org/netdev/20240304151011.1610175-1-maxime.chevallier@bootlin.com/ Link to V9: https://lore.kernel.org/netdev/20240228114728.51861-1-maxime.chevallier@bootlin.com/ Link to V8: https://lore.kernel.org/netdev/20240220184217.3689988-1-maxime.chevallier@bootlin.com/ Link to V7: https://lore.kernel.org/netdev/20240213150431.1796171-1-maxime.chevallier@bootlin.com/ Link to V6: https://lore.kernel.org/netdev/20240126183851.2081418-1-maxime.chevallier@bootlin.com/ Link to V5: https://lore.kernel.org/netdev/20231221180047.1924733-1-maxime.chevallier@bootlin.com/ Link to V4: https://lore.kernel.org/netdev/20231215171237.1152563-1-maxime.chevallier@bootlin.com/ Link to V3: https://lore.kernel.org/netdev/20231201163704.1306431-1-maxime.chevallier@bootlin.com/ Link to V2: https://lore.kernel.org/netdev/20231117162323.626979-1-maxime.chevallier@bootlin.com/ Link to V1: https://lore.kernel.org/netdev/20230907092407.647139-1-maxime.chevallier@bootlin.com/ Maxime Chevallier (13): net: phy: Introduce ethernet link topology representation net: sfp: pass the phy_device when disconnecting an sfp module's PHY net: phy: add helpers to handle sfp phy connect/disconnect net: sfp: Add helper to return the SFP bus name net: ethtool: Allow passing a phy index for some commands netlink: specs: add phy-index as a header parameter net: ethtool: Introduce a command to list PHYs on an interface netlink: specs: add ethnl PHY_GET command set net: ethtool: plca: Target the command to the requested PHY net: ethtool: pse-pd: Target the command to the requested PHY net: ethtool: cable-test: Target the command to the requested PHY net: ethtool: strset: Allow querying phy stats by index Documentation: networking: document phy_link_topology Documentation/netlink/specs/ethtool.yaml | 62 ++++ Documentation/networking/ethtool-netlink.rst | 52 +++ Documentation/networking/index.rst | 1 + .../networking/phy-link-topology.rst | 120 +++++++ MAINTAINERS | 2 + drivers/net/phy/Makefile | 2 +- drivers/net/phy/marvell-88x2222.c | 2 + drivers/net/phy/marvell.c | 2 + drivers/net/phy/marvell10g.c | 2 + drivers/net/phy/phy_device.c | 55 ++++ drivers/net/phy/phy_link_topology.c | 105 ++++++ drivers/net/phy/phylink.c | 3 +- drivers/net/phy/qcom/at803x.c | 2 + drivers/net/phy/qcom/qca807x.c | 2 + drivers/net/phy/sfp-bus.c | 15 +- include/linux/netdevice.h | 4 +- include/linux/phy.h | 6 + include/linux/phy_link_topology.h | 72 +++++ include/linux/phy_link_topology_core.h | 25 ++ include/linux/sfp.h | 8 +- include/uapi/linux/ethtool.h | 16 + include/uapi/linux/ethtool_netlink.h | 21 ++ net/core/dev.c | 9 + net/ethtool/Makefile | 2 +- net/ethtool/cabletest.c | 16 +- net/ethtool/netlink.c | 57 +++- net/ethtool/netlink.h | 10 + net/ethtool/phy.c | 300 ++++++++++++++++++ net/ethtool/plca.c | 19 +- net/ethtool/pse-pd.c | 13 +- net/ethtool/strset.c | 17 +- 31 files changed, 979 insertions(+), 43 deletions(-) create mode 100644 Documentation/networking/phy-link-topology.rst create mode 100644 drivers/net/phy/phy_link_topology.c create mode 100644 include/linux/phy_link_topology.h create mode 100644 include/linux/phy_link_topology_core.h create mode 100644 net/ethtool/phy.c -- 2.44.0