Re: [PATCH net-next] net: stmmac: Simplify ioctl handling
From: Maxime Chevallier
Date: Mon Jul 20 2026 - 11:39:25 EST
On 7/20/26 17:17, Vadim Fedorenko wrote:
> On 19.07.2026 17:13, Andrew Lunn wrote:
>>> Looking at this, I'm wondering if we can't just get rid of SIOCSHWTSTAMP
>>> handling in phy_mii_ioctl(). Looks like we can ?
>>
>> I'm not sure about that. We need Richards input.
>>
>> The code in phy_mii_ioctl() allows the MAC to be bypassed, it goes
>> straight to a PHY based stamper. It could be the MAC has no idea the
>> PHY has this capability, so it has not implemented the .ndo?
Indeed, but even then the SIOCxHWTSTAMP aren't reaching the ndo_ioctl.
Maybe the thing to change (unrelated to the icotl though) is in
dev_set_hwtstamp :
if (!ops->ndo_hwtstamp_set)
return -EOPNOTSUPP;
if (!netif_device_present(dev))
return -ENODEV;
netdev_lock_ops(dev);
err = dev_set_hwtstamp_phylib(dev, &kernel_cfg, &extack);
netdev_unlock_ops(dev);
We don't try to configure the PHY timestamping if the MAC doesn't support the
.ndo, maybe we should allow that ?
>>
>> It might be we need to hoist the code from phy_mii_ioctl() into
>> dev_{sg}et_hwtstamp()?
>
> Hi Andrew!
>
> I think I've converted all phy drivers while removing support for
> SIOCSHWTSTAMP/SIOCGHWTSTAMP from netdev ioctl. I believe it's impossible right
> now to reach SIOCSHWTSTAMP path of phy_mii_ioctl via ioctl on net device.
That was also my understanding indeed.
> Is it possible to have ioctl on phy device directly without involving netdev?
Unless there's an obscure mechanism I don't know about, there shouldn't be a way.
SIOCSHWTSTAMP/SIOCGHWTSTAMP don't seem to reach netdev anymore with the (great !) work
you've done, so they won't reach the PHY either indeed.
The SIOC ioctls can't reach PHYs without a netdev, neither can the ethnl ones.
Even when we have multiple PHYs and we use netlink, we can only reach the ones
behind a netdevice.
There is still sysfs entries for standalone PHYs, but I don't think we can use
any of that for ioctl.
Maxime