Re: [PATCH v2 3/4] net: Let the active time stamping layer be selectable.

From: Andrew Lunn
Date: Sat Mar 04 2023 - 10:44:00 EST


On Fri, Mar 03, 2023 at 05:42:40PM +0100, Köry Maincent wrote:
> From: Richard Cochran <richardcochran@xxxxxxxxx>
>
> Make the sysfs knob writable, and add checks in the ioctl and time
> stamping paths to respect the currently selected time stamping layer.

Although it probably works, i think the ioctl code is ugly.

I think it would be better to pull the IOCTL code into the PTP object
interface. Add an ioctl member to struct ptp_clock_info. The PTP core
can then directly call into the PTP object.

You now have a rather odd semantic that calling the .ndo_eth_ioctl
means operate on the MAC PTP. If you look at net_device_ops, i don't
think any of the other members have this semantic. They all look at
the netdev as a whole, and ask the netdev to do something, without
caring what level it operates at. So a PTP ioctl should operate on
'the' PTP of the netdev, whichever that might be, MAC or PHY.

Clearly, it is a bigger change, you need to touch every MAC driver
with PTP support, but at the end, you have a cleaner architecture.

Andrew