linux-bluetooth.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>
Subject: [PATCH v2 0/5] Bluetooth: add TX timestamping for ISO/SCO/L2CAP
Date: Thu, 14 Mar 2024 20:20:16 +0200	[thread overview]
Message-ID: <cover.1710440392.git.pav@iki.fi> (raw)

Add support for TX timestamping in ISO/SCO/L2CAP sockets.

These patches allow fixing / working around controller(?) issue where
two ISO streams in same group get desynchronized. It also gives user
applications the best latency information as available to kernel.

Also add sockopt BT_NO_ERRQUEUE_POLL to optionally disable POLLERR
wakeup on TX timestamp arrival, which is mainly a nuisance in the use
case here.  The alternative to this seems be to deal with the POLLERR
wakeups in BlueZ side, but this seems hard as it's always enabled in
poll() flags so not clear if anything else than polling at regular
intervals can be done there.

Pipewire side:
https://gitlab.freedesktop.org/pvir/pipewire/-/commits/iso-ts-test2

With this change, https://github.com/bluez/bluez/issues/515 is more or
less fixed, and the sound server can figure out the total latency to
audio rendering (tx latency + transport latency + presentation delay).

For ISO, we can later use LE Read ISO TX Sync to provide hardware
timestamps, but this requires figuring out the sequence number
synchronization first.

v2:
- Rename *tx_comp* -> *tx*
- Add hci_send_conn_frame() and handle all link types
- Add SCO timestamping. Deal with no flow control -> no Num_Comp_* events
- Handle HCI_FLOW_CTL_MODE_BLOCK_BASED
- Add BT_NO_ERRQUEUE_POLL

Pauli Virtanen (5):
  Bluetooth: add support for skb TX timestamping
  Bluetooth: ISO: add TX timestamping
  Bluetooth: L2CAP: add TX timestamping
  Bluetooth: SCO: add TX timestamping
  Bluetooth: add BT_NO_ERRQUEUE_POLL socket option

 include/net/bluetooth/bluetooth.h |  10 ++-
 include/net/bluetooth/hci_core.h  |  12 ++++
 include/net/bluetooth/l2cap.h     |   3 +-
 net/bluetooth/6lowpan.c           |   2 +-
 net/bluetooth/af_bluetooth.c      |  72 ++++++++++++++++++-
 net/bluetooth/hci_conn.c          | 111 ++++++++++++++++++++++++++++++
 net/bluetooth/hci_core.c          |  19 +++--
 net/bluetooth/hci_event.c         |  11 ++-
 net/bluetooth/iso.c               |  32 ++++++---
 net/bluetooth/l2cap_core.c        |  11 ++-
 net/bluetooth/l2cap_sock.c        |  23 +++++--
 net/bluetooth/sco.c               |  27 ++++++--
 net/bluetooth/smp.c               |   2 +-
 13 files changed, 303 insertions(+), 32 deletions(-)

-- 
2.44.0


             reply	other threads:[~2024-03-14 18:20 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-14 18:20 Pauli Virtanen [this message]
2024-03-14 18:20 ` [PATCH v2 1/5] Bluetooth: add support for skb TX timestamping Pauli Virtanen
2024-03-14 18:57   ` Bluetooth: add TX timestamping for ISO/SCO/L2CAP bluez.test.bot
2024-03-14 18:20 ` [PATCH v2 2/5] Bluetooth: ISO: add TX timestamping Pauli Virtanen
2024-03-14 18:20 ` [PATCH v2 3/5] Bluetooth: L2CAP: " Pauli Virtanen
2024-03-14 18:20 ` [PATCH v2 4/5] Bluetooth: SCO: " Pauli Virtanen
2024-03-14 18:20 ` [PATCH v2 5/5] Bluetooth: add BT_NO_ERRQUEUE_POLL socket option Pauli Virtanen
2024-03-15  3:18   ` Luiz Augusto von Dentz
2024-03-15 10:49     ` Pauli Virtanen
2024-03-22 16:56 ` [PATCH v2 0/5] Bluetooth: add TX timestamping for ISO/SCO/L2CAP Pauli Virtanen
2024-04-01 20:00 ` patchwork-bot+bluetooth
2024-04-01 20:05   ` Luiz Augusto von Dentz
2024-04-01 20:39     ` 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.1710440392.git.pav@iki.fi \
    --to=pav@iki.fi \
    --cc=linux-bluetooth@vger.kernel.org \
    /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).