linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] Bluetooth: add TX timestamping for ISO and L2CAP
@ 2024-03-02 20:07 Pauli Virtanen
  2024-03-02 20:07 ` [PATCH 1/3] Bluetooth: add support for skb TX timestamping Pauli Virtanen
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Pauli Virtanen @ 2024-03-02 20:07 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Pauli Virtanen

Add support for TX timestamping in ISO/L2CAP sockets.

These patches allow fixing / working around controller(?) issue where
two ISO streams in same group get desynchronized.  Having accurate
knowledge of the packet queue lengths, user application can drop packets
if it detects the ISO streams are not in sync.

For using this for audio, BlueZ needs to be changed to not
unconditionally terminate connections on POLLERR.  It currently thinks
the TX timestamp POLLERR is an error, and closes the audio channel.  For
BAP, BlueZ only closes the fd in this case so it accidentally works
there, but for A2DP it is more thorough in tearing down the connection.

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.

Pauli Virtanen (3):
  Bluetooth: add support for skb TX timestamping
  Bluetooth: ISO: add TX timestamping
  Bluetooth: L2CAP: add TX timestamping

 include/net/bluetooth/bluetooth.h |  1 +
 include/net/bluetooth/hci_core.h  | 12 +++++
 include/net/bluetooth/l2cap.h     |  3 +-
 net/bluetooth/6lowpan.c           |  2 +-
 net/bluetooth/hci_conn.c          | 78 +++++++++++++++++++++++++++++++
 net/bluetooth/hci_core.c          |  5 ++
 net/bluetooth/hci_event.c         |  4 ++
 net/bluetooth/iso.c               | 24 ++++++++--
 net/bluetooth/l2cap_core.c        | 11 ++++-
 net/bluetooth/l2cap_sock.c        | 15 +++++-
 net/bluetooth/smp.c               |  2 +-
 11 files changed, 148 insertions(+), 9 deletions(-)

-- 
2.44.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-04-01 20:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-02 20:07 [PATCH 0/3] Bluetooth: add TX timestamping for ISO and L2CAP Pauli Virtanen
2024-03-02 20:07 ` [PATCH 1/3] Bluetooth: add support for skb TX timestamping Pauli Virtanen
2024-03-02 20:33   ` Bluetooth: add TX timestamping for ISO and L2CAP bluez.test.bot
2024-03-04 14:36   ` [PATCH 1/3] Bluetooth: add support for skb TX timestamping Luiz Augusto von Dentz
2024-03-04 23:38     ` Pauli Virtanen
2024-03-02 20:07 ` [PATCH 2/3] Bluetooth: ISO: add " Pauli Virtanen
2024-03-02 20:07 ` [PATCH 3/3] Bluetooth: L2CAP: " Pauli Virtanen
2024-04-01 20:00 ` [PATCH 0/3] Bluetooth: add TX timestamping for ISO and L2CAP patchwork-bot+bluetooth

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