History

net-timestamp: COMPLETION timestamp on packet tx completion

Add SOF_TIMESTAMPING_TX_COMPLETION, for requesting a software timestamp when hardware reports a packet completed. Completion tstamp is useful for Bluetooth, as hardware timestamps do not exist in the HCI specification except for ISO packets, and the hardware has a queue where packets may wait. In this case the software SND timestamp only reflects the kernel-side part of the total latency (usually small) and queue length (usually 0 unless HW buffers congested), whereas the completion report time is more informative of the true latency. It may also be useful in other cases where HW TX timestamps cannot be obtained and user wants to estimate an upper bound to when the TX probably happened.

Pauli Virtanen committed 1 year ago

Commit 983e0e41 parent b257e027 files · +23 −5Browse files

Showing the changes to include/uapi/linux (2 of 7 files). Show all

Unified · Split

2 files
  1. include/uapi/linux/errqueue.h +1 −0
  2. include/uapi/linux/net_tstamp.h +4 −2
include/uapi/linux/errqueue.h+1−0
@@ -73,6 +73,7 @@ enum { · 72 unmodified lines
7373 SCM_TSTAMP_SND, /* driver passed skb to NIC, or HW */
7474 SCM_TSTAMP_SCHED, /* data entered the packet scheduler */
7575 SCM_TSTAMP_ACK, /* data acknowledged by peer */
76+ SCM_TSTAMP_COMPLETION, /* packet tx completion */
7677 };
7778
7879 #endif /* _UAPI_LINUX_ERRQUEUE_H */
include/uapi/linux/net_tstamp.h+4−2
@@ -44,8 +44,9 @@ enum { · 43 unmodified lines
4444 SOF_TIMESTAMPING_BIND_PHC = (1 << 15),
4545 SOF_TIMESTAMPING_OPT_ID_TCP = (1 << 16),
4646 SOF_TIMESTAMPING_OPT_RX_FILTER = (1 << 17),
47+ SOF_TIMESTAMPING_TX_COMPLETION = (1 << 18),
4748
48− SOF_TIMESTAMPING_LAST = SOF_TIMESTAMPING_OPT_RX_FILTER,
49+ SOF_TIMESTAMPING_LAST = SOF_TIMESTAMPING_TX_COMPLETION,
4950 SOF_TIMESTAMPING_MASK = (SOF_TIMESTAMPING_LAST - 1) |
5051 SOF_TIMESTAMPING_LAST
5152 };
@@ -58,7 +59,8 @@ enum { · 6 unmodified lines
5859 #define SOF_TIMESTAMPING_TX_RECORD_MASK (SOF_TIMESTAMPING_TX_HARDWARE | \
5960 SOF_TIMESTAMPING_TX_SOFTWARE | \
6061 SOF_TIMESTAMPING_TX_SCHED | \
61− SOF_TIMESTAMPING_TX_ACK)
62+ SOF_TIMESTAMPING_TX_ACK | \
63+ SOF_TIMESTAMPING_TX_COMPLETION)
6264
6365 /**
6466 * struct so_timestamping - SO_TIMESTAMPING parameter