[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250724013133.1645142-1-yicongsrfy@163.com>
Date: Thu, 24 Jul 2025 09:31:33 +0800
From: yicongsrfy@....com
To: kuba@...nel.org,
andrew+netdev@...n.ch,
andrew@...n.ch,
oneukum@...e.com
Cc: davem@...emloft.net,
linux-usb@...r.kernel.org,
netdev@...r.kernel.org,
yicong@...inos.cn
Subject: [PATCH v2] usbnet: Set duplex status to unknown in the absence of MII
From: Yi Cong <yicong@...inos.cn>
Currently, USB CDC devices that do not use MDIO to get link status have
their duplex mode set to half-duplex by default. However, since the CDC
specification does not define a duplex status, this can be misleading.
This patch changes the default to DUPLEX_UNKNOWN in the absence of MII,
which more accurately reflects the state of the link and avoids implying
an incorrect or error state.
v2: rewrote commmit messages and code comments
Link: https://lore.kernel.org/all/20250723152151.70a8034b@kernel.org/
Signed-off-by: Yi Cong <yicong@...inos.cn>
---
drivers/net/usb/usbnet.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 6a3cca104af9..b870e7c6d6a0 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -1013,6 +1013,13 @@ int usbnet_get_link_ksettings_internal(struct net_device *net,
else
cmd->base.speed = SPEED_UNKNOWN;
+ /* The standard "Universal Serial Bus Class Definitions
+ * for Communications Devices v1.2" does not specify
+ * anything about duplex status.
+ * So set it DUPLEX_UNKNOWN instead of default DUPLEX_HALF.
+ */
+ cmd->base.duplex = DUPLEX_UNKNOWN;
+
return 0;
}
EXPORT_SYMBOL_GPL(usbnet_get_link_ksettings_internal);
--
2.25.1
Powered by blists - more mailing lists