Thanks for the response Jake, Yeah, latency is definitely important here. We know it'll be on /dev/ptp0. Thanks for the insight on the two approaches. Sorry if this is a bit elementary, but I'm trying to better understand how you gain access to the PHC handle to make the gettime64 call from within a kernel module. I take it it's something like the driver_find() call to get the ptp_clock struct pointer? It's my first kernel driver 😊
All the best, Randy -----Original Message----- From: Keller, Jacob E <jacob.e.kel...@intel.com> Sent: September 5, 2018 4:31 PM To: linuxptp-users-boun...@lists.sourceforge.net; linuxptp-users@lists.sourceforge.net Subject: Re: [Linuxptp-users] get PTP clock time in kernel space? > -----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 ------------------------------------------------------------------------------ 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