Re: [PATCH net-next v4 0/5] net-timestamp: additional sw tstamps and
From: Willem de Bruijn <willemb@google.com>
Date: 2014-08-01 13:45:04
At the time we were discussing the removal syststamp, the intention was to use that space for a new value that can be use to match up timestamps properly with the packets they are for. Originally you wanted to use skb->mark for this and then we discussed all of the drawbacks and shortcoming of that. What happened to those plans?
Before skb->mark, in v1, I returned this stored seqno for that purpose. Leaking the raw seqno is not ideal, and hard to work with in userspace without the initial seqno. An option that avoids this problem is to store the initial seqno in sock and return the offset, to give a natural byte index into the stream. For datagrams, the same field in skb_shared_info can store a packet index, incremented on each timestamp request, in which case the field in sock stores the timestamp counter.
Also, there might be 4 bytes available in tcp_skb_cb.
I'll look into that. If the field stores the key to return to userspace, it has to persist across GSO and into skb_tstamp_tx, where skb->cb can longer be trusted to hold tcp_skb_cb. A minor variation is to always return the simple counter, for both datagram and bytestream sockets, in which case seqno is not used for this purpose, never exposed, nor needed beyond GSO. In that case, I can try to store this u32 in tcp_skb_cb and store the separate u16 counter in skb_shared_info (a separate patch). I prefer the first variant, using the same field for both purposes and returning a byte index for bytestreams and packet index for datagram sockets.