Thread (5 messages) 5 messages, 2 authors, 2017-08-22

Re: [PATCH net-next 1/2] tcp: Extend SOF_TIMESTAMPING_RX_SOFTWARE to TCP recvmsg

flat view

From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Date: 2017-08-22 18:58:16

On Tue, Aug 22, 2017 at 1:27 PM, Mike Maloney [off-list ref] wrote:
From: Mike Maloney <redacted>

When SOF_TIMESTAMPING_RX_SOFTWARE is enabled for tcp sockets, return the
timestamp corresponding to the highest sequence number data returned.

Previously the skb->tstamp is overwritten when a TCP packet is placed
in the out of order queue.  While the packet is in the ooo queue, save the
timestamp in the TCB_SKB_CB.  This space is shared with the gso_*
options which are only used on the tx path, and a previously unused 4
byte hole.

When skbs are coalesced either in the sk_receive_queue or the
out_of_order_queue always choose the timestamp of the appended skb to
maintain the invariant of returning the timestamp of the last byte in
the recvmsg buffer.
quoted hunk ↗ jump to hunk
+static void tcp_update_recv_tstamps(struct sk_buff *skb,
+                                   struct scm_timestamping *tss)
+{
+       if (skb->tstamp)
+               tss->ts[0] = ktime_to_timespec(skb->tstamp);
+       else
+               tss->ts[0] = (struct timespec) {0};
+
+       if (skb_hwtstamps(skb)->hwtstamp)
+               tss->ts[2] = ktime_to_timespec(skb_hwtstamps(skb)->hwtstamp);
+       else
+               tss->ts[2] = (struct timespec) {0};
tss->ts[1] may remain uninitialized.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help