Skip to content

bpf: TSTAMP_COMPLETION_CB timestamping + enable it for Bluetooth

Pauli Virtanen bpf linux-bluetooth netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 6 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3bpf: Add BPF_SOCK_OPS_TSTAMP_COMPLETION_CB callbackinclude/uapi/linux/bpf.h net/core/skbuff.c+8 -01 reply
2/3bpf: allow non-TCP skbs for bpf_sock_ops_enable_tx_tstampnet/core/filter.c+10 -20 replies
3/3Bluetooth: enable bpf TX timestampinginclude/net/bluetooth/bluetooth.h net/bluetooth/hci_conn.c+20 -23 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] bpf: TSTAMP_COMPLETION_CB timestamping + enable it for Bluetooth

Add BPF_SOCK_OPS_TSTAMP_COMPLETION_CB and emit it on completion timestamps.

Enable that for Bluetooth.

Tests:
https://lore.kernel.org/linux-bluetooth/a74e58b9cf12bc9c64a024d18e6e58999202f853.1743336056.git.pav@iki.fi/

***

However, I don't quite see how to do the tskey management so that BPF and socket timestamping do not interfere with each other.

The tskey counter here increments only for sendmsg() that have timestamping turned on. IIUC this works similarly as for UDP. I understood the documentation so that stream sockets would do similarly, but apparently TCP increments also for non-timestamped packets.

If BPF needs tskey while socket timestamping is off, we can't increment sk_tskey, as that interferes with counting by user applications doing socket timestamps.

Should the Bluetooth timestamping actually just increment the counters for any packet, timestamped or not?

Pauli Virtanen (3):
bpf: Add BPF_SOCK_OPS_TSTAMP_COMPLETION_CB callback [RFC] bpf: allow non-TCP skbs for bpf_sock_ops_enable_tx_tstamp [RFC] Bluetooth: enable bpf TX timestamping

 include/net/bluetooth/bluetooth.h |  1 +
 include/uapi/linux/bpf.h          |  5 +++++
 net/bluetooth/hci_conn.c          | 21 +++++++++++++++++++--
 net/core/filter.c                 | 12 ++++++++++--
 net/core/skbuff.c                 |  3 +++
 5 files changed, 38 insertions(+), 4 deletions(-)
Signature · 1 line
2.49.0