bpf: Add BPF-helper for accessing CLOCK_TAI
authorJesper Dangaard Brouer <brouer@redhat.com>
Tue, 9 Aug 2022 06:08:02 +0000 (08:08 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 9 Aug 2022 16:47:13 +0000 (09:47 -0700)
commitc8996c98f703b09afe77a1d247dae691c9849dc1
tree84f0a854239e06f4a70ade64ff99b2242191b171
parentb2d8ef19c6e7ed71ba5092feb0710063a751834f
bpf: Add BPF-helper for accessing CLOCK_TAI

Commit 3dc6ffae2da2 ("timekeeping: Introduce fast accessor to clock tai")
introduced a fast and NMI-safe accessor for CLOCK_TAI. Especially in time
sensitive networks (TSN), where all nodes are synchronized by Precision Time
Protocol (PTP), it's helpful to have the possibility to generate timestamps
based on CLOCK_TAI instead of CLOCK_MONOTONIC. With a BPF helper for TAI in
place, it becomes very convenient to correlate activity across different
machines in the network.

Use cases for such a BPF helper include functionalities such as Tx launch
time (e.g. ETF and TAPRIO Qdiscs) and timestamping.

Note: CLOCK_TAI is nothing new per se, only the NMI-safe variant of it is.

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
[Kurt: Wrote changelog and renamed helper]
Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
Link: https://lore.kernel.org/r/20220809060803.5773-2-kurt@linutronix.de
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
include/linux/bpf.h
include/uapi/linux/bpf.h
kernel/bpf/core.c
kernel/bpf/helpers.c
tools/include/uapi/linux/bpf.h