* [PATCH net-next] microchip: lan865x: add ndo_eth_ioctl handler to enable PHY ioctl support
@ 2025-08-22 8:50 Parthiban Veerasooran
2025-08-28 7:24 ` Paolo Abeni
0 siblings, 1 reply; 3+ messages in thread
From: Parthiban Veerasooran @ 2025-08-22 8:50 UTC (permalink / raw)
To: andrew+netdev, davem, edumazet, kuba, pabeni
Cc: netdev, linux-kernel, Parthiban Veerasooran
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 <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 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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] microchip: lan865x: add ndo_eth_ioctl handler to enable PHY ioctl support
2025-08-22 8:50 [PATCH net-next] microchip: lan865x: add ndo_eth_ioctl handler to enable PHY ioctl support Parthiban Veerasooran
@ 2025-08-28 7:24 ` Paolo Abeni
2025-08-28 8:30 ` Parthiban.Veerasooran
0 siblings, 1 reply; 3+ messages in thread
From: Paolo Abeni @ 2025-08-28 7:24 UTC (permalink / raw)
To: Parthiban Veerasooran, andrew+netdev, davem, edumazet, kuba
Cc: netdev, linux-kernel
On 8/22/25 10:50 AM, Parthiban Veerasooran wrote:
> 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,
It looks like you could use directly phy_do_ioctl_running() and avoid
some code duplication.
/P
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] microchip: lan865x: add ndo_eth_ioctl handler to enable PHY ioctl support
2025-08-28 7:24 ` Paolo Abeni
@ 2025-08-28 8:30 ` Parthiban.Veerasooran
0 siblings, 0 replies; 3+ messages in thread
From: Parthiban.Veerasooran @ 2025-08-28 8:30 UTC (permalink / raw)
To: pabeni, andrew+netdev, davem, edumazet, kuba; +Cc: netdev, linux-kernel
Hi Paolo Abeni,
On 28/08/25 12:54 pm, Paolo Abeni wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> On 8/22/25 10:50 AM, Parthiban Veerasooran wrote:
>> 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,
>
> It looks like you could use directly phy_do_ioctl_running() and avoid
> some code duplication.
Yes, thank you for pointing that out. I will update it in the next version.
Best regards,
Parthiban V
>
> /P
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-08-28 8:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-22 8:50 [PATCH net-next] microchip: lan865x: add ndo_eth_ioctl handler to enable PHY ioctl support Parthiban Veerasooran
2025-08-28 7:24 ` Paolo Abeni
2025-08-28 8:30 ` 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).