BACKPORT: bpf: add bpf_ktime_get_boot_ns()
authorMaciej Żenczykowski <maze@google.com>
Sun, 26 Apr 2020 16:15:25 +0000 (09:15 -0700)
committerCosmin Tanislav <demonsingur@gmail.com>
Thu, 16 May 2024 07:58:23 +0000 (10:58 +0300)
commitc0621e5decc8bc2f9ff8ef7550bbad8582ad63a0
tree51dcd5a8164c1e398ca03ecfd67d4080583ac0fc
parent5d6614d9b31d026df7d5a6ed081d4cd0c7c4b8fc
BACKPORT: bpf: add bpf_ktime_get_boot_ns()

On a device like a cellphone which is constantly suspending
and resuming CLOCK_MONOTONIC is not particularly useful for
keeping track of or reacting to external network events.
Instead you want to use CLOCK_BOOTTIME.

Hence add bpf_ktime_get_boot_ns() as a mirror of bpf_ktime_get_ns()
based around CLOCK_BOOTTIME instead of CLOCK_MONOTONIC.

Signed-off-by: Maciej Żenczykowski <maze@google.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
(cherry picked from commit 71d19214776e61b33da48f7c1b46e522c7f78221)
Change-Id: Ifd62c410dcc5112fd1a473a7e1f70231ca514bc0
include/linux/bpf.h
include/uapi/linux/bpf.h
kernel/bpf/core.c
kernel/bpf/helpers.c
kernel/trace/bpf_trace.c
net/core/filter.c
tools/include/uapi/linux/bpf.h