netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pauli Virtanen <pav@iki.fi>
To: linux-bluetooth@vger.kernel.org
Cc: Pauli Virtanen <pav@iki.fi>,
	netdev@vger.kernel.org, bpf@vger.kernel.org,
	willemdebruijn.kernel@gmail.com, kerneljasonxing@gmail.com
Subject: [PATCH 0/3] bpf: TSTAMP_COMPLETION_CB timestamping + enable it for Bluetooth
Date: Sun, 30 Mar 2025 15:23:35 +0300	[thread overview]
Message-ID: <cover.1743337403.git.pav@iki.fi> (raw)

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(-)

-- 
2.49.0


             reply	other threads:[~2025-03-30 12:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-30 12:23 Pauli Virtanen [this message]
2025-03-30 12:23 ` [PATCH 1/3] bpf: Add BPF_SOCK_OPS_TSTAMP_COMPLETION_CB callback Pauli Virtanen
2025-03-30 12:23 ` [PATCH 2/3] [RFC] bpf: allow non-TCP skbs for bpf_sock_ops_enable_tx_tstamp Pauli Virtanen
2025-03-30 12:23 ` [PATCH 3/3] [RFC] Bluetooth: enable bpf TX timestamping Pauli Virtanen
2025-04-02  1:34   ` Martin KaFai Lau
2025-04-02 16:56     ` Pauli Virtanen
2025-04-07 22:30       ` Martin KaFai Lau
2025-03-31  0:39 ` [PATCH 0/3] bpf: TSTAMP_COMPLETION_CB timestamping + enable it for Bluetooth Jason Xing
2025-03-31  8:37   ` Pauli Virtanen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1743337403.git.pav@iki.fi \
    --to=pav@iki.fi \
    --cc=bpf@vger.kernel.org \
    --cc=kerneljasonxing@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=willemdebruijn.kernel@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).