Bluetooth: add support for skb TX SND/COMPLETION timestamping
authorPauli Virtanen <pav@iki.fi>
Tue, 18 Mar 2025 19:06:43 +0000 (21:06 +0200)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Tue, 25 Mar 2025 16:49:38 +0000 (12:49 -0400)
commit134f4b39df7b77225a80ef585c15d46f964f5e6f
tree1b31495e10d88407bb96b3b3ea0454d82b8a763c
parent983e0e4e87bdf465e8424b1902e41bfe51ba128a
Bluetooth: add support for skb TX SND/COMPLETION timestamping

Support enabling TX timestamping for some skbs, and track them until
packet completion. Generate software SCM_TSTAMP_COMPLETION when getting
completion report from hardware.

Generate software SCM_TSTAMP_SND before sending to driver. Sending from
driver requires changes in the driver API, and drivers mostly are going
to send the skb immediately.

Make the default situation with no COMPLETION TX timestamping more
efficient by only counting packets in the queue when there is nothing to
track.  When there is something to track, we need to make clones, since
the driver may modify sent skbs.

The tx_q queue length is bounded by the hdev flow control, which will
not send new packets before it has got completion reports for old ones.

Signed-off-by: Pauli Virtanen <pav@iki.fi>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
include/net/bluetooth/hci_core.h
net/bluetooth/hci_conn.c
net/bluetooth/hci_core.c
net/bluetooth/hci_event.c