mbox series

[0/3] Bluetooth: add TX timestamping for ISO and L2CAP

Message ID cover.1709409547.git.pav@iki.fi
Headers show
Series Bluetooth: add TX timestamping for ISO and L2CAP | expand

Message

Pauli Virtanen March 2, 2024, 8:07 p.m. UTC
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(-)

Comments

patchwork-bot+bluetooth@kernel.org April 1, 2024, 8 p.m. UTC | #1
Hello:

This series was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Sat,  2 Mar 2024 22:07:35 +0200 you wrote:
> 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.
> 
> [...]

Here is the summary with links:
  - [1/3] Bluetooth: add support for skb TX timestamping
    (no matching commit)
  - [2/3] Bluetooth: ISO: add TX timestamping
    https://git.kernel.org/bluetooth/bluetooth-next/c/3067d73e114f
  - [3/3] Bluetooth: L2CAP: add TX timestamping
    https://git.kernel.org/bluetooth/bluetooth-next/c/e22f35ed23a7

You are awesome, thank you!