mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net] microchip: lan865x: fix missing ndo_eth_ioctl handler to support PHY ioctl
@ 2025-08-21  8:28 Parthiban Veerasooran
  2025-08-22  0:17 ` Andrew Lunn
  0 siblings, 1 reply; 5+ messages in thread
From: Parthiban Veerasooran @ 2025-08-21  8:28 UTC (permalink / raw)
  To: andrew+netdev, davem, edumazet, kuba, pabeni
  Cc: netdev, linux-kernel, Parthiban Veerasooran

The LAN865x Ethernet driver is missing an .ndo_eth_ioctl implementation,
which is required to handle standard MII ioctl commands such as
SIOCGMIIREG and SIOCSMIIREG. These commands are used by userspace tools
(e.g., ethtool, mii-tool) to access and configure PHY registers.

This patch adds the lan865x_eth_ioctl() function to pass ioctl calls to
the PHY layer via phy_mii_ioctl() when the interface is up.

Without this handler, MII ioctl operations return -EINVAL, breaking PHY
diagnostics and configuration from userspace.

Fixes: 5cd2340cb6a3 ("microchip: lan865x: add driver support for Microchip's LAN865X MAC-PHY")
Signed-off-by: Parthiban Veerasooran <parthiban.veerasooran@microchip.com>
---
 drivers/net/ethernet/microchip/lan865x/lan865x.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/net/ethernet/microchip/lan865x/lan865x.c b/drivers/net/ethernet/microchip/lan865x/lan865x.c
index dd436bdff0f8..09e6a0406350 100644
--- a/drivers/net/ethernet/microchip/lan865x/lan865x.c
+++ b/drivers/net/ethernet/microchip/lan865x/lan865x.c
@@ -314,12 +314,22 @@ static int lan865x_net_open(struct net_device *netdev)
 	return 0;
 }
 
+static int lan865x_eth_ioctl(struct net_device *netdev, struct ifreq *rq,
+			     int cmd)
+{
+	if (!netif_running(netdev))
+		return -EINVAL;
+
+	return phy_mii_ioctl(netdev->phydev, rq, cmd);
+}
+
 static const struct net_device_ops lan865x_netdev_ops = {
 	.ndo_open		= lan865x_net_open,
 	.ndo_stop		= lan865x_net_close,
 	.ndo_start_xmit		= lan865x_send_packet,
 	.ndo_set_rx_mode	= lan865x_set_multicast_list,
 	.ndo_set_mac_address	= lan865x_set_mac_address,
+	.ndo_eth_ioctl          = lan865x_eth_ioctl,
 };
 
 static int lan865x_probe(struct spi_device *spi)

base-commit: 62a2b3502573091dc5de3f9acd9e47f4b5aac9a1
-- 
2.34.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-08-22 13:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-21  8:28 [PATCH net] microchip: lan865x: fix missing ndo_eth_ioctl handler to support PHY ioctl Parthiban Veerasooran
2025-08-22  0:17 ` Andrew Lunn
2025-08-22  4:24   ` Parthiban.Veerasooran
2025-08-22 12:59     ` Andrew Lunn
2025-08-22 13:45       ` Parthiban.Veerasooran

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®