socket: Add SO_TIMESTAMP[NS]_NEW
Add SO_TIMESTAMP_NEW and SO_TIMESTAMPNS_NEW variants of socket timestamp options. These are the y2038 safe versions of the SO_TIMESTAMP_OLD and SO_TIMESTAMPNS_OLD for all architectures. Note that the format of scm_timestamping.ts[0] is not changed in this patch. Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com> Acked-by: Willem de Bruijn <willemb@google.com> Cc: jejb@parisc-linux.org Cc: ralf@linux-mips.org Cc: rth@twiddle.net Cc: linux-alpha@vger.kernel.org Cc: linux-mips@linux-mips.org Cc: linux-parisc@vger.kernel.org Cc: linux-rdma@vger.kernel.org Cc: netdev@vger.kernel.org Cc: sparclinux@vger.kernel.org Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
98bb03c865
commit
887feae36a
@@ -3498,12 +3498,30 @@ static inline void skb_get_timestamp(const struct sk_buff *skb,
|
||||
*stamp = ns_to_kernel_old_timeval(skb->tstamp);
|
||||
}
|
||||
|
||||
static inline void skb_get_new_timestamp(const struct sk_buff *skb,
|
||||
struct __kernel_sock_timeval *stamp)
|
||||
{
|
||||
struct timespec64 ts = ktime_to_timespec64(skb->tstamp);
|
||||
|
||||
stamp->tv_sec = ts.tv_sec;
|
||||
stamp->tv_usec = ts.tv_nsec / 1000;
|
||||
}
|
||||
|
||||
static inline void skb_get_timestampns(const struct sk_buff *skb,
|
||||
struct timespec *stamp)
|
||||
{
|
||||
*stamp = ktime_to_timespec(skb->tstamp);
|
||||
}
|
||||
|
||||
static inline void skb_get_new_timestampns(const struct sk_buff *skb,
|
||||
struct __kernel_timespec *stamp)
|
||||
{
|
||||
struct timespec64 ts = ktime_to_timespec64(skb->tstamp);
|
||||
|
||||
stamp->tv_sec = ts.tv_sec;
|
||||
stamp->tv_nsec = ts.tv_nsec;
|
||||
}
|
||||
|
||||
static inline void __net_timestamp(struct sk_buff *skb)
|
||||
{
|
||||
skb->tstamp = ktime_get_real();
|
||||
|
Reference in New Issue
Block a user