sock: enable timestamping using control messages
Currently, SOL_TIMESTAMPING can only be enabled using setsockopt. This is very costly when users want to sample writes to gather tx timestamps. Add support for enabling SO_TIMESTAMPING via control messages by using tsflags added in `struct sockcm_cookie` (added in the previous patches in this series) to set the tx_flags of the last skb created in a sendmsg. With this patch, the timestamp recording bits in tx_flags of the skbuff is overridden if SO_TIMESTAMPING is passed in a cmsg. Please note that this is only effective for overriding the recording timestamps flags. Users should enable timestamp reporting (e.g., SOF_TIMESTAMPING_SOFTWARE | SOF_TIMESTAMPING_OPT_ID) using socket options and then should ask for SOF_TIMESTAMPING_TX_* using control messages per sendmsg to sample timestamps for each write. Signed-off-by: Soheil Hassas Yeganeh <soheil@google.com> Acked-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
ad1e46a837
commit
c14ac9451c
@@ -867,7 +867,8 @@ int ip6_append_data(struct sock *sk,
|
||||
int odd, struct sk_buff *skb),
|
||||
void *from, int length, int transhdrlen, int hlimit,
|
||||
int tclass, struct ipv6_txoptions *opt, struct flowi6 *fl6,
|
||||
struct rt6_info *rt, unsigned int flags, int dontfrag);
|
||||
struct rt6_info *rt, unsigned int flags, int dontfrag,
|
||||
const struct sockcm_cookie *sockc);
|
||||
|
||||
int ip6_push_pending_frames(struct sock *sk);
|
||||
|
||||
@@ -884,7 +885,8 @@ struct sk_buff *ip6_make_skb(struct sock *sk,
|
||||
void *from, int length, int transhdrlen,
|
||||
int hlimit, int tclass, struct ipv6_txoptions *opt,
|
||||
struct flowi6 *fl6, struct rt6_info *rt,
|
||||
unsigned int flags, int dontfrag);
|
||||
unsigned int flags, int dontfrag,
|
||||
const struct sockcm_cookie *sockc);
|
||||
|
||||
static inline struct sk_buff *ip6_finish_skb(struct sock *sk)
|
||||
{
|
||||
|
Reference in New Issue
Block a user