netdev.vger.kernel.org archive mirror
 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 related	[flat|nested] 5+ messages in thread

* Re: [PATCH net] microchip: lan865x: fix missing ndo_eth_ioctl handler to support PHY ioctl
  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
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Lunn @ 2025-08-22  0:17 UTC (permalink / raw)
  To: Parthiban Veerasooran
  Cc: andrew+netdev, davem, edumazet, kuba, pabeni, netdev,
	linux-kernel

On Thu, Aug 21, 2025 at 01:58:32PM +0530, Parthiban Veerasooran wrote:
> 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.

I'm not sure this classes as a fix. This IOCTL is optional, not
mandatory. Returning EINVAL is valid behaviour. So for me, this is
just ongoing development work, adding more features to the driver.

Please submit to net-next.

    Andrew

---
pw-bot: cr

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

* Re: [PATCH net] microchip: lan865x: fix missing ndo_eth_ioctl handler to support PHY ioctl
  2025-08-22  0:17 ` Andrew Lunn
@ 2025-08-22  4:24   ` Parthiban.Veerasooran
  2025-08-22 12:59     ` Andrew Lunn
  0 siblings, 1 reply; 5+ messages in thread
From: Parthiban.Veerasooran @ 2025-08-22  4:24 UTC (permalink / raw)
  To: andrew; +Cc: andrew+netdev, davem, edumazet, kuba, pabeni, netdev,
	linux-kernel

Hi Andrew,

Thank you for reviewing this patch.

On 22/08/25 5:47 am, Andrew Lunn wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> On Thu, Aug 21, 2025 at 01:58:32PM +0530, Parthiban Veerasooran wrote:
>> 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.
> 
> I'm not sure this classes as a fix. This IOCTL is optional, not
> mandatory. Returning EINVAL is valid behaviour. So for me, this is
> just ongoing development work, adding more features to the driver.
> 
> Please submit to net-next.
Sure I will submit it to net-next as it is a feature.

By the way, is there a possibility to submit or apply this patch to the 
older stable kernels as well, so that users on those versions can also 
benefit from this feature?

Best regards,
Parthiban V
> 
>      Andrew
> 
> ---
> pw-bot: cr


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

* Re: [PATCH net] microchip: lan865x: fix missing ndo_eth_ioctl handler to support PHY ioctl
  2025-08-22  4:24   ` Parthiban.Veerasooran
@ 2025-08-22 12:59     ` Andrew Lunn
  2025-08-22 13:45       ` Parthiban.Veerasooran
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Lunn @ 2025-08-22 12:59 UTC (permalink / raw)
  To: Parthiban.Veerasooran
  Cc: andrew+netdev, davem, edumazet, kuba, pabeni, netdev,
	linux-kernel

> By the way, is there a possibility to submit or apply this patch to the 
> older stable kernels as well, so that users on those versions can also 
> benefit from this feature?

This is the sort of patch the machine learning bot picks up for back
porting to stable. The Fixes: tag is only one indicator it looks for,
it being a one liner and the words in the commit message might trigger
it as well.

	Andrew

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

* Re: [PATCH net] microchip: lan865x: fix missing ndo_eth_ioctl handler to support PHY ioctl
  2025-08-22 12:59     ` Andrew Lunn
@ 2025-08-22 13:45       ` Parthiban.Veerasooran
  0 siblings, 0 replies; 5+ messages in thread
From: Parthiban.Veerasooran @ 2025-08-22 13:45 UTC (permalink / raw)
  To: andrew; +Cc: andrew+netdev, davem, edumazet, kuba, pabeni, netdev,
	linux-kernel

On 22/08/25 6:29 pm, Andrew Lunn wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
>> By the way, is there a possibility to submit or apply this patch to the
>> older stable kernels as well, so that users on those versions can also
>> benefit from this feature?
> 
> This is the sort of patch the machine learning bot picks up for back
> porting to stable. The Fixes: tag is only one indicator it looks for,
> it being a one liner and the words in the commit message might trigger
> it as well.
Thank you for the explanation. As per your suggestion, I’ve moved this 
feature patch to net-next, so I assume there’s no possibility of getting 
it into the older stable kernels, as it is not a fix—is that correct?

Best regards,
Parthiban V
> 
>          Andrew


^ 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;
as well as URLs for NNTP newsgroup(s).