]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
bpf: Support selective sampling for bpf timestamping
authorJason Xing <kerneljasonxing@gmail.com>
Thu, 20 Feb 2025 07:29:39 +0000 (15:29 +0800)
committerMartin KaFai Lau <martin.lau@kernel.org>
Thu, 20 Feb 2025 22:30:02 +0000 (14:30 -0800)
commit59422464266f8baa091edcb3779f0955a21abf00
tree4b244bd463f9919f319ebea4927093f148759124
parentc9525d240c8117de35171ae705058ddf9667be27
bpf: Support selective sampling for bpf timestamping

Add the bpf_sock_ops_enable_tx_tstamp kfunc to allow BPF programs to
selectively enable TX timestamping on a skb during tcp_sendmsg().

For example, BPF program will limit tracking X numbers of packets
and then will stop there instead of tracing all the sendmsgs of
matched flow all along. It would be helpful for users who cannot
afford to calculate latencies from every sendmsg call probably
due to the performance or storage space consideration.

Signed-off-by: Jason Xing <kerneljasonxing@gmail.com>
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20250220072940.99994-12-kerneljasonxing@gmail.com
kernel/bpf/btf.c
net/core/filter.c