linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/5] Bluetooth: add TX timestamping for ISO/SCO/L2CAP
@ 2024-03-14 18:20 Pauli Virtanen
  2024-03-14 18:20 ` [PATCH v2 1/5] Bluetooth: add support for skb TX timestamping Pauli Virtanen
                   ` (6 more replies)
  0 siblings, 7 replies; 13+ messages in thread
From: Pauli Virtanen @ 2024-03-14 18:20 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Pauli Virtanen

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


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

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

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-14 18:20 [PATCH v2 0/5] Bluetooth: add TX timestamping for ISO/SCO/L2CAP Pauli Virtanen
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

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