Precision Time Protocol (PTP) in P4?

Hi everyone,

I know that this is a complex topic, but has anyone over here used Precision Time Protocol or PTP for time synchronization in their Network Telemetry operations or anything as such? We are adding timing information to our custom headers on P4 language for computing one-way delay and would like to make the delay computations synchronized through the use of a PTP server in our system. Could anybody help me out with it, please? In case you need more information, I can provide you with that as well.

Thanks in advance.


What is your P4 target? What is your required precision?

PTP time synchronization between devices is typically a feature that a commercial device implementation would provide with driver and hardware support for that feature explicitly. Often the implementation of that feature would not itself be P4-programmable. Only the resulting synchronized time value would become readable in your P4 program, e.g. as an input metadata field.

Trying to implement PTP time synchronization by writing P4 code, on a system that did not already provide it for you at a lower level, might be possible, but I would expect the error tolerances would increase noticeably on the time synchronization.

We did use PTPv2 with INT on a Tofino1, maybe it’s useful for you:

My P4 target is Xilinx Alveo U280 Accelerator Cards. My desired precision would be somewhere in the low microseconds.

Have you checked with Xilinx support whether they provide (perhaps as an additional expense option) a PTP implementation?