OSDN Git Service

bpf: Add hardware timestamp field to __sk_buff
authorVadim Fedorenko <vfedorenko@novek.ru>
Thu, 9 Sep 2021 22:04:08 +0000 (01:04 +0300)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 10 Sep 2021 21:19:58 +0000 (23:19 +0200)
commitf64c4acea51fbe2c08c0b0f48b7f5d1657d7a5e4
tree3eba5257c1f02ab91894a0cb41e4b2fdd3981731
parente876a0367c379519f8558342fda30e74e0295893
bpf: Add hardware timestamp field to __sk_buff

BPF programs may want to know hardware timestamps if NIC supports
such timestamping.

Expose this data as hwtstamp field of __sk_buff the same way as
gso_segs/gso_size. This field could be accessed from the same
programs as tstamp field, but it's read-only field. Explicit test
to deny access to padding data is added to bpf_skb_is_valid_access.

Also update BPF_PROG_TEST_RUN tests of the feature.

Signed-off-by: Vadim Fedorenko <vfedorenko@novek.ru>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/20210909220409.8804-2-vfedorenko@novek.ru
include/uapi/linux/bpf.h
net/core/filter.c
tools/include/uapi/linux/bpf.h