Hi Luiz, to, 2024-03-14 kello 20:20 +0200, Pauli Virtanen kirjoitti: > 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. Any suggestions what the plan here should be? The suggestions so far: 1. Socket TX timestamping & deal with POLLERR in BlueZ 2. Socket TX timestamping & disable POLLERR via setsockopt 3. Some custom latency reporting mechanism > 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(-) > -- Pauli Virtanen