Hi Richard,

I’m moving this thread to linuxptp-devel, as it’s not really a user question 
any more…

I started to hack in alarm/timer functionality via an ioctl, but while getting 
familiar with the code I decided it wouldn’t be too much extra work to ‘do it 
properly’ and implement the alarms using the posix timer interface (which is 
how I assume you imagined it working).

I am currently working with the igb driver, and already have some of the 
functionality in, but have a question about how you would prefer the timers to 
be implemented:
- the number of posix timers that can be created is limited to the number of 
hardware timers available on the device. For example on the i210 this would be 
two (assuming that no periodic output signal is running simultaneously).
- the number of posix timers that can be created is unlimited, with the driver 
using only one hardware timer. The driver sets the ‘earliest to fire’ time in 
hardware, and when it fires it sets up the next earliest.

If the latter, do you see the timer ‘queuing’ functionality best implemented in 
the PTP module, or left to the ethernet driver? (in which case each driver 
could implement timers either way).

I’d be keen to hear your opinion as I’d like to submit the patches if it all 
works as planned.

Thanks, Kieran.



> On 22 Aug 2016, at 16:34, Richard Cochran <richardcoch...@gmail.com> wrote:
> 
>> So my questions:
>> - is the one-shot alarm functionality of the PHC actually implemented in any 
>> driver?
> 
> No.
> 
>> - how can I implement this in the freescale FEC driver without
>>  having to modify the kernel? (ptp_clock_kernel.h and
>>  drivers/ptp/ptp_clock.c)
> 
> You can't implement this without changing the kernel.
> 
>> Hopefully I’m missing something and there is a simple way to get the
>> alarm functionality working.
> 
> Unfortunately, you understood the kernel sources well enough.  There
> is a non-trivial amount of work to implement the timer in the PHC core
> code.  I decided some time ago that the possible benefit is not worth
> the effort required.  I would say most use cases can be adequately
> covered by:
> 
> 1. using a PREEMPT_RT kernel
> 2. synchronizing the system time from the PHC using phc2sys
> 3. programming a normal high resolution timer using CLOCK_MONOTONIC or
>   CLOCK_REALTIME.
> 
> Sorry,
> Richard


------------------------------------------------------------------------------
_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to