On Mon, 20 Nov 2023 18:10:04 +0200 Vladimir Oltean <vladimir.oltean@xxxxxxx> wrote: > On Mon, Nov 20, 2023 at 03:53:44PM +0100, Köry Maincent wrote: > > I did thought about it but I got stuck by the case of hardware timestamping > > without PHC. Richard explained the reason of its existence here: > > https://lore.kernel.org/netdev/ZS3MKWlnPqTe8gkq@xxxxxxxxxxxxxxxxxx/#t > > > > Maybe I got a bit stuck in my implementation and should investigate more > > your proposition and how to deal with this case. Do you have an idea on how > > to solve it? > > I would take what Richard said with a grain of salt, and interpret as > "there exists hardware with hwts but w/o PHC, and that may work for > marginal use cases", not that "we should design having that as a > first-class citizen in mind". > When elected as master, it kinda works, and does synchronize with a > slave, even if ptp4l gets confused about the phc_index being -1. > > But when elected as a slave by the BMCA, ptp4l gets confused and thinks > that phc_index == -1 means that it's supposed to use software timestamping. > > So, I guess the only thing we need to do to this kind of setup is not do > too much harm to it. > > We break nothing if we make the phc_index the central aspect of hwts > layer selection - except for the fact that such a MAC won't be able to > change its timestamping layer to be a PHY. > > If we wanted to add such a capability to that MAC driver, the obvious > way to solve the lack of a PHC is to create a PHC that returns > -EOPNOTSUPP for all of its ptp_clock_info operations (gettime, settime > etc). It may possibly be that, in the worst case, ptp4l needs to probe > for each syscall on the NIC's PHC being operational before deciding what > can be done with it. But that's already an improvement over the current > handling to make it more graceful, it's not to keep things on par. Ok, you convinced me. Thanks for your arguments and spending time explaining it. Regards, -- Köry Maincent, Bootlin Embedded Linux and kernel engineering https://bootlin.com