> -----Original Message----- > From: linuxptp-users-boun...@lists.sourceforge.net [mailto:linuxptp-users- > boun...@lists.sourceforge.net] > Sent: Wednesday, September 05, 2018 10:48 AM > To: linuxptp-users@lists.sourceforge.net > Subject: [Linuxptp-users] get PTP clock time in kernel space? > > I'm new to kernel driver development and was wondering if it is possible to > obtain a PTP timestamp direct from the NIC's PHC within a kernel module? E.g. > timestamping an IRQ after a GPIO pin is triggered? > > > > If we synchronize the system clock to a NIC PHC clock (e.g. phc2sys -s enp6s0 > -m - > O 0), in the kernel module calling getnstimeofday() looks like we get what we > need. I'd be curious if there is a more direct way to query the NIC PHC clock > from > within the kernel module without relying on the system clock to be > synchronized > using phc2sys? > > > > Cheers, > > Randy
If you know which /dev/ptpX device it is, you can grab that phc in the kernel driver and run its gettime64 callback, or whichever one. Bare in mind that this is driver specific and may do things like read the time over the PCIe, or other bus, so they could easily have huge latency. You are probably better off tuning the kernel time using phc2sys and using getnstimeofday instead, but it depends on the hardware and application in mind. Thanks, Jake ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Linuxptp-users mailing list Linuxptp-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-users