🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #471

[PATCH net-next v18 02/13] phylib: Add support for PHYs with broken forced mode

#471
From: Birger Koblitz
Date: Thu, 08 Oct 2026 03:51
54 lines
8804 bytes
Add support for PHYs which only supported auto-negotiated
speed modes. This prevents a kernel warning and stack-trace within the
phy_state_machine when PHYs return -EOPNOTSUPP from config_aneg()
because they do not support forced modes.

Signed-off-by: Birger Koblitz <mail@birger-koblitz.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>
---
 drivers/net/phy/phy.c | 7 +++++++
 include/linux/phy.h   | 1 +
 2 files changed, 8 insertions(+)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index fce9bc7be3304b408c9f3ec9b5b95c76d3680a88..079c53516f424ca5f8d50292f1912af04b45b07a 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -354,6 +354,9 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd)
 			switch (devad) {
 			case MII_BMCR:
 				if ((val & (BMCR_RESET | BMCR_ANENABLE)) == 0) {
+					if (phydev->drv &&
+					    (phydev->drv->flags & PHY_BROKEN_FORCED))
+						return -EOPNOTSUPP;
 					if (phydev->autoneg == AUTONEG_ENABLE)
 						change_autoneg = true;
 					phydev->autoneg = AUTONEG_DISABLE;
@@ -1190,6 +1193,10 @@ int phy_ethtool_ksettings_set(struct phy_device *phydev,
 	      duplex != DUPLEX_FULL)))
 		return -EINVAL;
 
+	if (autoneg == AUTONEG_DISABLE && phydev->drv &&
+	    (phydev->drv->flags & PHY_BROKEN_FORCED))
+		return -EOPNOTSUPP;
+
 	mutex_lock(&phydev->lock);
 	phydev->autoneg = autoneg;
 
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 7c5098a0dd6cd1ffbfc5f55240cd68e41bfb2d73..4143bffdcdb9b293a6e717a41816c05a2c5a252b 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -64,6 +64,7 @@ extern const int phy_basic_ports_array[3];
 #define PHY_RST_AFTER_CLK_EN	0x00000002
 #define PHY_POLL_CABLE_TEST	0x00000004
 #define PHY_ALWAYS_CALL_SUSPEND	0x00000008
+#define PHY_BROKEN_FORCED	0x00000010
 #define MDIO_DEVICE_IS_PHY	0x80000000
 
 /**

-- 
2.47.3
Technical Details
Message-ID: <20261008-ax88179a-v18-2-6fa1d4c40422@birger-koblitz.de>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-342718-linux-kernel-netdev=dewy.ru
References: <20261008-ax88179a-v18-0-6fa1d4c40422@birger-koblitz.de>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-342718-linux-kernel-netdev=dewy.ru
From: mail@birger-koblitz.de (Birger Koblitz)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next v18 02/13] phylib: Add support for PHYs with
 broken forced mode
Date: Thu, 08 Oct 2026 05:51:08 +0200
Organization: Usenet Network
Message-ID: <20261008-ax88179a-v18-2-6fa1d4c40422@birger-koblitz.de>
References: <20261008-ax88179a-v18-0-6fa1d4c40422@birger-koblitz.de>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="796852"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:W7NafQPM0MwUmLRwo2QaXtfj9OM= sha256:/fJi8HF5fd27FAWNq6zEX+EwBFaBilHrFxninTkkYfw=
	sha1:oTbk/qJbxgE20EsFkucoderXzaY= sha256:4NtM8D3GEmEzvwcRTfDhE346ewHyXCiPcwKEoOzIJfk=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id B069B10F2EB; Thu,  8 Oct 2026 06:52:00 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -0.75
X-Spam-Status: No, score=-0.75 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
	URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=birger-koblitz.de header.b=EN93VUpU; dkim=pass (2048-bit key)
	header.d=birger-koblitz.de header.b=yb5jeqEB
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id jOv0Or_BPBau;
	Thu,  8 Oct 2026 06:51:57 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-342718-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=birger-koblitz.de
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 5B47810F2EA; Thu,  8 Oct 2026 06:51:53 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1])
	by tor.lore.kernel.org (Postfix) with ESMTP id 78FA52CA1D; Thu,  8 Oct 2026 03:51:27 +0000 (UTC)
X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 057593B8D78;
	Thu,  8 Oct 2026 03:51:21 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=birger-koblitz.de header.i=@birger-koblitz.de header.b="EN93VUpU";
	dkim=pass (2048-bit key) header.d=birger-koblitz.de header.i=@birger-koblitz.de header.b="yb5jeqEB"
X-Received: from bkemail.birger-koblitz.de (bkemail.birger-koblitz.de [23.88.97.239])
	(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 A5F823B14DE;
	Thu,  8 Oct 2026 03:51:19 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=23.88.97.239
X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
	t=1791431480; cv=none; b=jzy2ro/YCqtVzQP931ArcZyz6pnEa5EwfOo5oetsem3/yCmN/ThRgZwDD6xbpZpz4cMhunHM2U21dSEY9F+x+vdihinDldEd2zsZdxD+rvmI/An8wFNCHdc0FqqrLWXapp41zwDb2GpoxJ7Cx/Cnw7pmR1q9hD8Yit8luiJaYGg=
X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
	s=arc-20240116; t=1791431480; c=relaxed/simple;
	bh=gNeiBeIBcPq+3N6f0e6/oenfPkBMrSQA5YVjwdyOuis=;
	h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References:
	 In-Reply-To:To:Cc; b=CKKxCjYbmqGChjLisXuX/wqcNImO4cQj0GZWkMrf3Iq6jPGwvMU9QDv9qjTOnX/etie9eMNoMqQSQ1rJ+3UfwIr0mh1+2fGNDs1tOy3B6qD1JcPC60bHvsEVvaEptX+RdzYVSftbDMsZV4A/EQkf5JktQprEeZ+PN6bXck+6nEA=
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=birger-koblitz.de; spf=pass smtp.mailfrom=birger-koblitz.de; dkim=pass (2048-bit key) header.d=birger-koblitz.de header.i=@birger-koblitz.de header.b=EN93VUpU; dkim=pass (2048-bit key) header.d=birger-koblitz.de header.i=@birger-koblitz.de header.b=yb5jeqEB; arc=none smtp.client-ip=23.88.97.239
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=birger-koblitz.de
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=birger-koblitz.de
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=birger-koblitz.de;
	s=default; t=1791431477;
	bh=gNeiBeIBcPq+3N6f0e6/oenfPkBMrSQA5YVjwdyOuis=;
	h=From:Date:Subject:References:In-Reply-To:To:Cc:From;
	b=EN93VUpUXZJuPagWMdSqlMI5x0eHSr+5u6JxhwPEVZkvzrKKhpFA/bUKbfEVMEPqz
	 4wNUdphfDAL+3nFGLxMem6GOFDSgir5cTACCynhezyN8qXwJYV+dI5afmhZ8VOx11E
	 UFFXJN7YhKpCNbEfxvP+FooNndk9jEy7dVTcdeIFGGx1FUK9G67e8Fsgc8RVt1Ks9n
	 BjgnNjSV/WlEYx1jwmlCGRVZCqhxKaJZqeBxOMhOJkblMD22IvJt6WK7yAXamQr3PE
	 gw+qdlwSsBL+ciJZ89ZRA7KOeOeMwdOlqCJNul4PpdInlvBDwj9ict8U3/HpMKxjwm
	 FU8vlAOMUlEkQ==
X-Received: by bkemail.birger-koblitz.de (Postfix, from userid 109)
	id F14E347285; Thu,  8 Oct 2026 03:51:17 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=birger-koblitz.de;
	s=default; t=1791431475;
	bh=gNeiBeIBcPq+3N6f0e6/oenfPkBMrSQA5YVjwdyOuis=;
	h=From:Date:Subject:References:In-Reply-To:To:Cc:From;
	b=yb5jeqEBzTqBm4B2PF9JyH4O1SFzhavGDRCaTrgxOQauayBn+ZBm1XF4703EF5qLP
	 cOFqn2AMMM+P2f1an8y/P+qJtHS75bpVg1qBElSefPhR84F4aN5xzQaHH6ccgssIxS
	 5ES1EgBzt+fzV5aVIi7YhV01pxTPEmEu28AcagbM3pVhfRv/tUvSbvDfGeCaxejU1u
	 nYSFzUF9Omy87tZy2unDZSN3OLcMeOl6kHaJBbLR/8+HaSfqx0R++SYFbjLKU0gvO2
	 wshNPNgfJfOF1w/JFMdspMH4i+BOk2AxgcOBo5HUAekbnhh6NBPLxWZngfI78hx9a3
	 aOOfDUGOfjZOw==
X-Received: from AMDDesktop.lan (unknown [IPv6:2a00:6020:47a3:e800:271c:c6c5:9fde:77cb])
	by bkemail.birger-koblitz.de (Postfix) with ESMTPSA id 08D7D470CF;
	Thu,  8 Oct 2026 03:51:15 +0000 (UTC)
X-Precedence: bulk
X-Mailing-List: netdev@vger.kernel.org
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-In-Reply-To: <20261008-ax88179a-v18-0-6fa1d4c40422@birger-koblitz.de>
X-Cc: linux-usb@vger.kernel.org, netdev@vger.kernel.org, 
 linux-kernel@vger.kernel.org, loongarch@lists.linux.dev, 
 Jianhui Xu <neuromoments@gmail.com>, 
 Birger Koblitz <mail@birger-koblitz.de>, Nicolai Buchwitz <nb@tipi-net.de>
X-Mailer: b4 0.14.2