Introduce support for standard MII ioctl operations in the LAN865x Ethernet driver by implementing the .ndo_eth_ioctl callback. This allows userspace tools such as ethtool and mii-tool to perform PHY register access using commands like SIOCGMIIREG and SIOCSMIIREG. The new lan865x_eth_ioctl() function forwards these ioctl calls to the PHY layer through phy_mii_ioctl() when the network interface is up. This feature enables improved diagnostics and PHY configuration capabilities from userspace. Signed-off-by: Parthiban Veerasooran --- 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 84c41f193561..7f586f9558ff 100644 --- a/drivers/net/ethernet/microchip/lan865x/lan865x.c +++ b/drivers/net/ethernet/microchip/lan865x/lan865x.c @@ -320,12 +320,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: a7bd72158063740212344fad5d99dcef45bc70d6 -- 2.34.1