From patchwork Wed Sep 11 21:27:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Chevallier X-Patchwork-Id: 13801130 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B41EFEE57D7 for ; Wed, 11 Sep 2024 21:30:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=101PaTxq6DmgGCqwL9QuDGATpVsTFmA7gnEaLtO+Q/w=; b=wx32BJbX+ybE0sqYTpWcysugBv E1bXVgl6MnYaOPKE5uYQP58+IPEDE0bS0wugwXNenYfYPQN4lpBsANpxpGD3Id2A6E/OazCUwtE31 JWTEOgCGp+NRG5SXE3z3Bld6qFZa5M3kVBYIwVB5M2F7GmWGQvAX20y9CNw+1GQ6mUgIu9NCnD0b1 Bp7gkH+L53pcNPARuD5x3iVrSwM/qT0grUvi1C64g65QXm1J7In1lM00Qiq0Bs0VoijhHbVacYTw6 0yhytlKauv2Zn+MjN1BC8NnUz312W4zCYPCm5H8UtK3CxfdHbrnKBzSjoLKQK5LIvfkfEwcw5Rc2l jWMA2zWQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1soUv2-0000000B3uM-2riE; Wed, 11 Sep 2024 21:30:32 +0000 Received: from relay5-d.mail.gandi.net ([2001:4b98:dc4:8::225]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1soUrw-0000000B3BW-0qNt for linux-arm-kernel@lists.infradead.org; Wed, 11 Sep 2024 21:27:23 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id 2F9841C0002; Wed, 11 Sep 2024 21:27:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1726090037; 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=101PaTxq6DmgGCqwL9QuDGATpVsTFmA7gnEaLtO+Q/w=; b=V5rihcswJGwKhyg7kJXY+O9CZpOtxKu2YMrmJucei5k9Ln3S74adlXQCjr8+SWT8WeFKFH VH9VowshvxNByKpto/sCCS1pMAQf+VesZGDyf8RE33/7nYM/cMVaShrHmcLYk8ileXbDvB NaQlB70zPkJWjPSi2THJri3umjzLvjV9BE2ZkDXBk5SuyWwavMyF22TOGTO9y1QhQlMlcq KvL/8fYiUfS6NXDsg1xk3DUS29W+Jj5adlqWY1+c43HRisgOKfLUWPHIA18MDLIr1ZPKDG Qhr5/uBWqlAiqqGCb/5PVQH7vSNeAqVskt3E3JxxkvlpBNSnYXI4fTJQcNJ0xw== 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?Marek_Beh=C3=BAn?= , =?utf-8?q?K=C3=B6ry_Maince?= =?utf-8?q?nt?= , Oleksij Rempel Subject: [PATCH net-next 0/7] Allow controlling PHY loopback and isolate modes Date: Wed, 11 Sep 2024 23:27:04 +0200 Message-ID: <20240911212713.2178943-1-maxime.chevallier@bootlin.com> X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 X-GND-Sasl: maxime.chevallier@bootlin.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240911_142720_877282_0943D4A8 X-CRM114-Status: GOOD ( 18.74 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hello everyone, This series brings support for controlling the isolation and loopback modes for PHY devices, through a netlink interface. The isolation support work is made in preparation for the support of interfaces that posesses multiple PHYs attached to the same MAC, on the same MII bus. In this configuration, the isolation mode for the PHY is used to avoid interferences on the MII bus, which doesn't support multidrop topologies. This mode is part of the 802.3 spec, however rarely used. It was discovered that some PHYs don't implement that mode correctly, and will continue being active on the MII interface when isolated. This series supports that case, and flags the LXT973 as having such a broken isolation mode. The Marvell 88x3310/3340 PHYs also don't support this mdoe, and are also flagged accordingly. The main part needed for the upcomping multi-PHY support really is the internal kernel API to support this. The second part of the series (patches 5, 6 and 7) focus on allowing userspace to control that mode. The only real benefit of controlling this from userspace is to make it easier to find out if this mode really works or not on the PHY being used. This relies on a new set of ethtool_phy_ops, set_config and get_config, to toggle these modes. The loopback control from that API is added as it fits the API well, and having the ability to easily set the PHY in MII-loopback mode is a helpful tool to have when bringing-up a new device and troubleshooting the link setup. The netlink API is an extension of the existing PHY_GET, reporting 2 new attributes (one for isolate, one for loopback). A PHY_SET command is introduced as well, allowing to configure the loopback and isolation. All in all, the userspace part is a bonus here, let me know if you think is just doesn't make sense, although the loopback feature can be useful and sent as a standalone series. In such case, I'll include the kernel-only support for isolation (so, patches 1 to 5) as part of the multi-PHY support series when it comes out. Thanks, Maxime Maxime Chevallier (7): net: phy: allow isolating PHY devices net: phy: Allow flagging PHY devices that can't isolate their MII net: phy: lxt: Mark LXT973 PHYs as having a broken isolate mode net: phy: marvell10g: 88x3310 and 88x3340 don't support isolate mode net: phy: introduce ethtool_phy_ops to get and set phy configuration net: ethtool: phy: allow reporting and setting the phy isolate status netlink: specs: introduce phy-set command along with configurable attributes Documentation/netlink/specs/ethtool.yaml | 20 +++++ Documentation/networking/ethtool-netlink.rst | 2 + drivers/net/phy/lxt.c | 2 + drivers/net/phy/marvell10g.c | 2 + drivers/net/phy/phy.c | 59 +++++++++++++ drivers/net/phy/phy_device.c | 89 ++++++++++++++++++-- include/linux/ethtool.h | 8 ++ include/linux/phy.h | 26 ++++++ include/uapi/linux/ethtool_netlink.h | 3 + net/ethtool/netlink.c | 8 ++ net/ethtool/netlink.h | 1 + net/ethtool/phy.c | 75 +++++++++++++++++ 12 files changed, 289 insertions(+), 6 deletions(-)