]> asedeno.scripts.mit.edu Git - linux.git/commit
ptp: introduce ptp auxiliary worker
authorGrygorii Strashko <grygorii.strashko@ti.com>
Fri, 28 Jul 2017 22:30:02 +0000 (17:30 -0500)
committerDavid S. Miller <davem@davemloft.net>
Tue, 1 Aug 2017 22:22:55 +0000 (15:22 -0700)
commitd9535cb7b7603aeb549c697ecdf92024e4d0a650
treee03c4fc2145d6df6afebf07ec5f4c21ad62cd880
parentbc78d646e708dabd1744ca98744dea316f459497
ptp: introduce ptp auxiliary worker

Many PTP drivers required to perform some asynchronous or periodic work,
like periodically handling PHC counter overflow or handle delayed timestamp
for RX/TX network packets. In most of the cases, such work is implemented
using workqueues. Unfortunately, Kernel workqueues might introduce
significant delay in work scheduling under high system load and on -RT,
which could cause misbehavior of PTP drivers due to internal counter
overflow, for example, and there is no way to tune its execution policy and
priority manuallly.

Hence, The kthread_worker can be used insted of workqueues, as it create
separte named kthread for each worker and its its execution policy and
priority can be configured using chrt tool.

This prblem was reported for two drivers TI CPSW CPTS and dp83640, so
instead of modifying each of these driver it was proposed to add PTP
auxiliary worker to the PHC subsystem.

The patch adds PTP auxiliary worker in PHC subsystem using kthread_worker
and kthread_delayed_work and introduces two new PHC subsystem APIs:

- long (*do_aux_work)(struct ptp_clock_info *ptp) callback in
ptp_clock_info structure, which driver should assign if it require to
perform asynchronous or periodic work. Driver should return the delay of
the PTP next auxiliary work scheduling time (>=0) or negative value in case
further scheduling is not required.

- int ptp_schedule_worker(struct ptp_clock *ptp, unsigned long delay) which
allows schedule PTP auxiliary work.

The name of kthread_worker thread corresponds PTP PHC device name "ptp%d".

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/ptp/ptp_clock.c
drivers/ptp/ptp_private.h
include/linux/ptp_clock_kernel.h