History

net-timestamp: add key to disambiguate concurrent datagrams

Datagrams timestamped on transmission can coexist in the kernel stack and be reordered in packet scheduling. When reading looped datagrams from the socket error queue it is not always possible to unique correlate looped data with original send() call (for application level retransmits). Even if possible, it may be expensive and complex, requiring packet inspection. Introduce a data-independent ID mechanism to associate timestamps with send calls. Pass an ID alongside the timestamp in field ee_data of sock_extended_err. The ID is a simple 32 bit unsigned int that is associated with the socket and incremented on each send() call for which software tx timestamp generation is enabled. The feature is enabled only if SOF_TIMESTAMPING_OPT_ID is set, to avoid changing ee_data for existing applications that expect it 0. The counter is reset each time the flag is reenabled. Reenabling does not change the ID of already submitted data. It is possible to receive out of order IDs if the timestamp stream is not quiesced first.

Willem de Bruijn committed 12 years ago

Commit 09c2d251 parent b9f40e27 files · +27 −4Browse files

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

Unified · Split

include/uapi/linux/net_tstamp.h+5−3
@@ -20,9 +20,11 @@ enum { · 19 unmodified lines
20 SOF_TIMESTAMPING_SOFTWARE = (1<<4),20 SOF_TIMESTAMPING_SOFTWARE = (1<<4),
21 SOF_TIMESTAMPING_SYS_HARDWARE = (1<<5),21 SOF_TIMESTAMPING_SYS_HARDWARE = (1<<5),
22 SOF_TIMESTAMPING_RAW_HARDWARE = (1<<6),22 SOF_TIMESTAMPING_RAW_HARDWARE = (1<<6),
23 SOF_TIMESTAMPING_MASK =23 SOF_TIMESTAMPING_OPT_ID = (1<<7),
24 (SOF_TIMESTAMPING_RAW_HARDWARE - 1) |24
25 SOF_TIMESTAMPING_RAW_HARDWARE25 SOF_TIMESTAMPING_LAST = SOF_TIMESTAMPING_OPT_ID,
26 SOF_TIMESTAMPING_MASK = (SOF_TIMESTAMPING_LAST - 1) |
27 SOF_TIMESTAMPING_LAST
26};28};
27 29
28/**30/**