With recent kernels it is possible to create virtual PHCs running on top
of a free-running PHC by writing to /sys/class/ptp/ptp?/n_vclocks. If
supported in linuxptp, it would allow users to run multiple ptp4l
instance with hardware timestamping on one interface, e.g. in different
domains for better resiliency, or separate instances for different
unicast servers.

The kernel support was added in 5.14, but there were some bugs fixed
recently, so 5.17-rc1 or later is recommended for testing.

The 1st patch is a bug fix required by the second patch.
The 2nd patch adds detection of virtual clocks via ethtool netlink.

The 3rd-5th patch add support to ptp4l. The PHC index of the virtual
clock needs to be specified in the configuration.

The 6th and 7th patch add support to phc2sys. The PORT_PROPERTIES_NP
message is extended with the PHC index. The command is available only on
the UDS port, but I'm not sure if an incompatible change like this is
acceptable. The alternative would be to add a new command specifically
for the index.

My plan is to add support also to timemaster to detect the kernel
support, automatically create virtual clocks for interfaces specified in
multiple domains (where previously some instances had to use SW
timestamping), and pass the correct PHC indexes to the ptp4l instances. 


Miroslav Lichvar (7):
  rtnl: Fix rtnl_rtattr_parse() to process max attribute.
  rtnl: Add function to detect virtual clocks.
  Add support for binding sockets to virtual clocks.
  config: Add port-specific phc_index option.
  port: Check for virtual clocks.
  tlv: Add PHC index to PORT_PROPERTIES_NP.
  phc2sys: Use PHC index from PORT_PROPERTIES_NP.

 clock.c     |  6 +++-
 config.c    |  1 +
 incdefs.sh  |  4 +++
 interface.c | 12 ++++++++
 interface.h | 14 +++++++++
 missing.h   | 11 +++++++
 phc2sys.c   | 42 +++++++++++++++-----------
 pmc_agent.c |  3 +-
 pmc_agent.h |  4 ++-
 port.c      | 16 +++++++---
 ptp4l.8     |  8 +++++
 raw.c       |  3 +-
 rtnl.c      | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++--
 rtnl.h      |  9 ++++++
 sk.c        | 11 +++++--
 sk.h        |  3 +-
 tlv.c       |  2 ++
 tlv.h       |  1 +
 udp.c       |  3 +-
 udp6.c      |  3 +-
 20 files changed, 211 insertions(+), 32 deletions(-)

-- 
2.33.1



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

Reply via email to