net: add missing SOF_TIMESTAMPING_OPT_ID support
SOF_TIMESTAMPING_OPT_ID is supported on TCP, UDP and RAW sockets.
But it was missing on RAW with IPPROTO_IP, PF_PACKET and CAN.
Add skb_setup_tx_timestamp that configures both tx_flags and tskey
for these paths that do not need corking or use bytestream keys.
Fixes: 09c2d251b7
("net-timestamp: add key to disambiguate concurrent datagrams")
Signed-off-by: Willem de Bruijn <willemb@google.com>
Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
fbfb2321e9
commit
8f932f762e
@@ -2340,22 +2340,39 @@ static inline void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
|
||||
void __sock_tx_timestamp(__u16 tsflags, __u8 *tx_flags);
|
||||
|
||||
/**
|
||||
* sock_tx_timestamp - checks whether the outgoing packet is to be time stamped
|
||||
* _sock_tx_timestamp - checks whether the outgoing packet is to be time stamped
|
||||
* @sk: socket sending this packet
|
||||
* @tsflags: timestamping flags to use
|
||||
* @tx_flags: completed with instructions for time stamping
|
||||
* @tskey: filled in with next sk_tskey (not for TCP, which uses seqno)
|
||||
*
|
||||
* Note: callers should take care of initial ``*tx_flags`` value (usually 0)
|
||||
*/
|
||||
static inline void sock_tx_timestamp(const struct sock *sk, __u16 tsflags,
|
||||
__u8 *tx_flags)
|
||||
static inline void _sock_tx_timestamp(struct sock *sk, __u16 tsflags,
|
||||
__u8 *tx_flags, __u32 *tskey)
|
||||
{
|
||||
if (unlikely(tsflags))
|
||||
if (unlikely(tsflags)) {
|
||||
__sock_tx_timestamp(tsflags, tx_flags);
|
||||
if (tsflags & SOF_TIMESTAMPING_OPT_ID && tskey &&
|
||||
tsflags & SOF_TIMESTAMPING_TX_RECORD_MASK)
|
||||
*tskey = sk->sk_tskey++;
|
||||
}
|
||||
if (unlikely(sock_flag(sk, SOCK_WIFI_STATUS)))
|
||||
*tx_flags |= SKBTX_WIFI_STATUS;
|
||||
}
|
||||
|
||||
static inline void sock_tx_timestamp(struct sock *sk, __u16 tsflags,
|
||||
__u8 *tx_flags)
|
||||
{
|
||||
_sock_tx_timestamp(sk, tsflags, tx_flags, NULL);
|
||||
}
|
||||
|
||||
static inline void skb_setup_tx_timestamp(struct sk_buff *skb, __u16 tsflags)
|
||||
{
|
||||
_sock_tx_timestamp(skb->sk, tsflags, &skb_shinfo(skb)->tx_flags,
|
||||
&skb_shinfo(skb)->tskey);
|
||||
}
|
||||
|
||||
/**
|
||||
* sk_eat_skb - Release a skb if it is no longer needed
|
||||
* @sk: socket to eat this skb from
|
||||
|
Reference in New Issue
Block a user