Skip to content

ptp: Support hardware clocks with additional free running cycle counter

Gerhard Engleder netdev 4 versions – Applied

Status from this message: This series was applied to netdev/net-next.git (master)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest6 patches 3 repliesApplied 6/6
  2. v36 patches 10 repliesSuperseded
  3. v25 patches 17 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v16 patches15 repliesSuperseded

Changes in v4 from the cover letter

- if_index of 0 is invalid (Jonathan Lemon)
- set if_index to 0 in the SOF_TIMESTAMPING_RAW_HARDWARE block (Jonathan Lemon)
- add helper function for netdev_get_tstamp() call (Jonathan Lemon)
- update SKBTX_ANY_TSTAMP (Paolo Abeni)
- use separate bits for new tx_flags (Richard Cochran)

Patches in v4 All 6 applied

#Subject and filesSizeRepliesApplied
1/6ptp: Add cycles support for virtual clocksdrivers/ptp/ptp_clock.c drivers/ptp/ptp_private.h drivers/ptp/ptp_sysfs.c +2 more+80 -160 repliesApplied
2/6ptp: Request cycles for TX timestampinclude/linux/skbuff.h net/socket.c+16 -20 repliesApplied
3/6ptp: Pass hwtstamp to ptp_convert_timestamp()drivers/ptp/ptp_vclock.c include/linux/ptp_clock_kernel.h net/socket.c+6 -80 repliesApplied
4/6ptp: Support late timestamp determinationinclude/linux/netdevice.h include/linux/skbuff.h net/socket.c+71 -132 repliesApplied
5/6ptp: Speed up vclock lookupdrivers/ptp/ptp_private.h drivers/ptp/ptp_vclock.c+48 -190 repliesApplied
6/6tsnep: Add free running cycle counter supportdrivers/net/ethernet/engleder/tsnep_hw.h drivers/net/ethernet/engleder/tsnep_main.c drivers/net/ethernet/engleder/tsnep_ptp.c+63 -71 replyApplied

Reviews trailers per patch

All 6 patches have a Reviewed-by or Acked-by.

PatchRichard CochranJonathan Lemon
1/6A-b
2/6A-b
3/6A-b
4/6A-b A-b
5/6A-b
6/6A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH net-next v4 0/6] ptp: Support hardware clocks with additional free running cycle counter

ptp vclocks require a clock with free running time for the timecounter. Currently only a physical clock forced to free running is supported. If vclocks are used, then the physical clock cannot be synchronized anymore. The synchronized time is not available in hardware in this case. As a result, timed transmission with TAPRIO hardware support is not possible anymore.

If hardware would support a free running time additionally to the physical clock, then the physical clock does not need to be forced to free running. Thus, the physical clocks can still be synchronized while vclocks are in use.

The physical clock could be used to synchronize the time domain of the TSN network and trigger TAPRIO. In parallel vclocks can be used to synchronize other time domains.

One year ago I thought for two time domains within a TSN network also two physical clocks are required. This would lead to new kernel interfaces for asking for the second clock, ... . But actually for a time triggered system like TSN there can be only one time domain that controls the system itself. All other time domains belong to other layers, but not to the time triggered system itself. So other time domains can be based on a free running counter if similar mechanisms like 2 step synchroisation are used.

Synchronisation was tested with two time domains between two directly connected hosts. Each host run two ptp4l instances, the first used the physical clock and the second used the virtual clock. I used my FPGA based network controller as network device. ptp4l was used in combination with the virtual clock support patches from Miroslav Lichvar.

v4:
- if_index of 0 is invalid (Jonathan Lemon)
- set if_index to 0 in the SOF_TIMESTAMPING_RAW_HARDWARE block (Jonathan Lemon)
- add helper function for netdev_get_tstamp() call (Jonathan Lemon)
- update SKBTX_ANY_TSTAMP (Paolo Abeni)
- use separate bits for new tx_flags (Richard Cochran)

v3:
- optimize ptp_convert_timestamp (Richard Cochran)
- call dev_get_by_napi_id() only if needed (Richard Cochran)
- use non-negated logical test (Richard Cochran)
- add comment for skipped output (Richard Cochran)
- add comment for SKBTX_HW_TSTAMP_USE_CYCLES masking (Richard Cochran)

v2:
- rename ptp_clock cycles to has_cycles (Richard Cochran)
- call it free running cycle counter (Richard Cochran)
- update struct skb_shared_hwtstamps kdoc (Richard Cochran)
- optimize timestamp address/cookie processing path (Richard Cochran, Vinicius Costa Gomes)

v1:
- complete rework based on suggestions (Richard Cochran)

Gerhard Engleder (6):
ptp: Add cycles support for virtual clocks
ptp: Request cycles for TX timestamp
ptp: Pass hwtstamp to ptp_convert_timestamp()
ptp: Support late timestamp determination
ptp: Speed up vclock lookup
tsnep: Add free running cycle counter support

 drivers/net/ethernet/engleder/tsnep_hw.h   |  9 ++-
 drivers/net/ethernet/engleder/tsnep_main.c | 33 +++++++--
 drivers/net/ethernet/engleder/tsnep_ptp.c  | 28 ++++++++
 drivers/ptp/ptp_clock.c                    | 31 ++++++--
 drivers/ptp/ptp_private.h                  | 11 +++
 drivers/ptp/ptp_sysfs.c                    | 11 +--
 drivers/ptp/ptp_vclock.c                   | 82 ++++++++++++++--------
 include/linux/netdevice.h                  | 21 ++++++
 include/linux/ptp_clock_kernel.h           | 38 ++++++++--
 include/linux/skbuff.h                     | 21 ++++--
 net/socket.c                               | 60 +++++++++++++---
 11 files changed, 282 insertions(+), 63 deletions(-)
Signature · 1 line
2.20.1