All of lore.kernel.org
 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 0/3] Bluetooth: add TX timestamping for ISO and L2CAP
Date: Sat,  2 Mar 2024 22:07:35 +0200	[thread overview]
Message-ID: <cover.1709409547.git.pav@iki.fi> (raw)

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


             reply	other threads:[~2024-03-02 20:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-02 20:07 Pauli Virtanen [this message]
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

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.1709409547.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.