diff options
| author | Gerhard Engleder <[email protected]> | 2022-05-06 20:01:38 +0000 |
|---|---|---|
| committer | Paolo Abeni <[email protected]> | 2022-05-10 07:48:08 +0000 |
| commit | 51eb7492af276b5b4d27cfa4474d40bdac7b9cf8 (patch) | |
| tree | e0fff209136de8a5af800b4486a659f9bacb3b73 /net/socket.c | |
| parent | ptp: Add cycles support for virtual clocks (diff) | |
| download | kernel-51eb7492af276b5b4d27cfa4474d40bdac7b9cf8.tar.gz kernel-51eb7492af276b5b4d27cfa4474d40bdac7b9cf8.zip | |
ptp: Request cycles for TX timestamp
The free running cycle counter of physical clocks called cycles shall be
used for hardware timestamps to enable synchronisation.
Introduce new flag SKBTX_HW_TSTAMP_USE_CYCLES, which signals driver to
provide a TX timestamp based on cycles if cycles are supported.
Signed-off-by: Gerhard Engleder <[email protected]>
Acked-by: Richard Cochran <[email protected]>
Signed-off-by: Paolo Abeni <[email protected]>
Diffstat (limited to 'net/socket.c')
| -rw-r--r-- | net/socket.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/net/socket.c b/net/socket.c index f0c39c874665..5c1c5e6100e1 100644 --- a/net/socket.c +++ b/net/socket.c @@ -683,9 +683,18 @@ void __sock_tx_timestamp(__u16 tsflags, __u8 *tx_flags) { u8 flags = *tx_flags; - if (tsflags & SOF_TIMESTAMPING_TX_HARDWARE) + if (tsflags & SOF_TIMESTAMPING_TX_HARDWARE) { flags |= SKBTX_HW_TSTAMP; + /* PTP hardware clocks can provide a free running cycle counter + * as a time base for virtual clocks. Tell driver to use the + * free running cycle counter for timestamp if socket is bound + * to virtual clock. + */ + if (tsflags & SOF_TIMESTAMPING_BIND_PHC) + flags |= SKBTX_HW_TSTAMP_USE_CYCLES; + } + if (tsflags & SOF_TIMESTAMPING_TX_SOFTWARE) flags |= SKBTX_SW_TSTAMP; |
