packet: tx timestamping on tpacket ring
When transmit timestamping is enabled at the socket level, record a timestamp on packets written to a PACKET_TX_RING. Tx timestamps are always looped to the application over the socket error queue. Software timestamps are also written back into the packet frame header in the packet ring. Reported-by: Paul Chavent <paul.chavent@onera.fr> Signed-off-by: Willem de Bruijn <willemb@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
92dea7c066
commit
2e31396fa1
@@ -3327,12 +3327,8 @@ void skb_tstamp_tx(struct sk_buff *orig_skb,
|
||||
if (!sk)
|
||||
return;
|
||||
|
||||
skb = skb_clone(orig_skb, GFP_ATOMIC);
|
||||
if (!skb)
|
||||
return;
|
||||
|
||||
if (hwtstamps) {
|
||||
*skb_hwtstamps(skb) =
|
||||
*skb_hwtstamps(orig_skb) =
|
||||
*hwtstamps;
|
||||
} else {
|
||||
/*
|
||||
@@ -3340,9 +3336,13 @@ void skb_tstamp_tx(struct sk_buff *orig_skb,
|
||||
* so keep the shared tx_flags and only
|
||||
* store software time stamp
|
||||
*/
|
||||
skb->tstamp = ktime_get_real();
|
||||
orig_skb->tstamp = ktime_get_real();
|
||||
}
|
||||
|
||||
skb = skb_clone(orig_skb, GFP_ATOMIC);
|
||||
if (!skb)
|
||||
return;
|
||||
|
||||
serr = SKB_EXT_ERR(skb);
|
||||
memset(serr, 0, sizeof(*serr));
|
||||
serr->ee.ee_errno = ENOMSG;
|
||||
|
Reference in New Issue
Block a user