net: remove deprecated syststamp timestamp
The SO_TIMESTAMPING API defines three types of timestamps: software, hardware in raw format (hwtstamp) and hardware converted to system format (syststamp). The last has been deprecated in favor of combining hwtstamp with a PTP clock driver. There are no active users in the kernel. The option was device driver dependent. If set, but without hardware support, the correct behavior is to return zero in the relevant field in the SCM_TIMESTAMPING ancillary message. Without device drivers implementing the option, this field is effectively always zero. Remove the internal plumbing to dissuage new drivers from implementing the feature. Keep the SOF_TIMESTAMPING_SYS_HARDWARE flag, however, to avoid breaking existing applications that request the timestamp. Signed-off-by: Willem de Bruijn <willemb@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
68a360e82e
commit
4d276eb6a4
|
@ -88,15 +88,8 @@ hwtimeraw is the original hardware time stamp. Filled in if
|
||||||
SOF_TIMESTAMPING_RAW_HARDWARE is set. No assumptions about its
|
SOF_TIMESTAMPING_RAW_HARDWARE is set. No assumptions about its
|
||||||
relation to system time should be made.
|
relation to system time should be made.
|
||||||
|
|
||||||
hwtimetrans is the hardware time stamp transformed so that it
|
hwtimetrans is always zero. This field is deprecated. It used to hold
|
||||||
corresponds as good as possible to system time. This correlation is
|
hw timestamps converted to system time. Instead, expose the hardware
|
||||||
not perfect; as a consequence, sorting packets received via different
|
|
||||||
NICs by their hwtimetrans may differ from the order in which they were
|
|
||||||
received. hwtimetrans may be non-monotonic even for the same NIC.
|
|
||||||
Filled in if SOF_TIMESTAMPING_SYS_HARDWARE is set. Requires support
|
|
||||||
by the network device and will be empty without that support. This
|
|
||||||
field is DEPRECATED. Only one driver computes this value. New device
|
|
||||||
drivers must leave this zero. Instead, they can expose the hardware
|
|
||||||
clock device on the NIC directly as a HW PTP clock source, to allow
|
clock device on the NIC directly as a HW PTP clock source, to allow
|
||||||
time conversion in userspace and optionally synchronize system time
|
time conversion in userspace and optionally synchronize system time
|
||||||
with a userspace PTP stack such as linuxptp. For the PTP clock API,
|
with a userspace PTP stack such as linuxptp. For the PTP clock API,
|
||||||
|
@ -191,7 +184,6 @@ struct skb_shared_hwtstamps {
|
||||||
* since arbitrary point in time
|
* since arbitrary point in time
|
||||||
*/
|
*/
|
||||||
ktime_t hwtstamp;
|
ktime_t hwtstamp;
|
||||||
ktime_t syststamp; /* hwtstamp transformed to system time base */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Time stamps for outgoing packets are to be generated as follows:
|
Time stamps for outgoing packets are to be generated as follows:
|
||||||
|
|
|
@ -76,7 +76,6 @@ static void usage(const char *error)
|
||||||
" SOF_TIMESTAMPING_RX_HARDWARE - hardware time stamping of incoming packets\n"
|
" SOF_TIMESTAMPING_RX_HARDWARE - hardware time stamping of incoming packets\n"
|
||||||
" SOF_TIMESTAMPING_RX_SOFTWARE - software fallback for incoming packets\n"
|
" SOF_TIMESTAMPING_RX_SOFTWARE - software fallback for incoming packets\n"
|
||||||
" SOF_TIMESTAMPING_SOFTWARE - request reporting of software time stamps\n"
|
" SOF_TIMESTAMPING_SOFTWARE - request reporting of software time stamps\n"
|
||||||
" SOF_TIMESTAMPING_SYS_HARDWARE - request reporting of transformed HW time stamps\n"
|
|
||||||
" SOF_TIMESTAMPING_RAW_HARDWARE - request reporting of raw HW time stamps\n"
|
" SOF_TIMESTAMPING_RAW_HARDWARE - request reporting of raw HW time stamps\n"
|
||||||
" SIOCGSTAMP - check last socket time stamp\n"
|
" SIOCGSTAMP - check last socket time stamp\n"
|
||||||
" SIOCGSTAMPNS - more accurate socket time stamp\n");
|
" SIOCGSTAMPNS - more accurate socket time stamp\n");
|
||||||
|
@ -202,9 +201,7 @@ static void printpacket(struct msghdr *msg, int res,
|
||||||
(long)stamp->tv_sec,
|
(long)stamp->tv_sec,
|
||||||
(long)stamp->tv_nsec);
|
(long)stamp->tv_nsec);
|
||||||
stamp++;
|
stamp++;
|
||||||
printf("HW transformed %ld.%09ld ",
|
/* skip deprecated HW transformed */
|
||||||
(long)stamp->tv_sec,
|
|
||||||
(long)stamp->tv_nsec);
|
|
||||||
stamp++;
|
stamp++;
|
||||||
printf("HW raw %ld.%09ld",
|
printf("HW raw %ld.%09ld",
|
||||||
(long)stamp->tv_sec,
|
(long)stamp->tv_sec,
|
||||||
|
@ -361,8 +358,6 @@ int main(int argc, char **argv)
|
||||||
so_timestamping_flags |= SOF_TIMESTAMPING_RX_SOFTWARE;
|
so_timestamping_flags |= SOF_TIMESTAMPING_RX_SOFTWARE;
|
||||||
else if (!strcasecmp(argv[i], "SOF_TIMESTAMPING_SOFTWARE"))
|
else if (!strcasecmp(argv[i], "SOF_TIMESTAMPING_SOFTWARE"))
|
||||||
so_timestamping_flags |= SOF_TIMESTAMPING_SOFTWARE;
|
so_timestamping_flags |= SOF_TIMESTAMPING_SOFTWARE;
|
||||||
else if (!strcasecmp(argv[i], "SOF_TIMESTAMPING_SYS_HARDWARE"))
|
|
||||||
so_timestamping_flags |= SOF_TIMESTAMPING_SYS_HARDWARE;
|
|
||||||
else if (!strcasecmp(argv[i], "SOF_TIMESTAMPING_RAW_HARDWARE"))
|
else if (!strcasecmp(argv[i], "SOF_TIMESTAMPING_RAW_HARDWARE"))
|
||||||
so_timestamping_flags |= SOF_TIMESTAMPING_RAW_HARDWARE;
|
so_timestamping_flags |= SOF_TIMESTAMPING_RAW_HARDWARE;
|
||||||
else
|
else
|
||||||
|
|
|
@ -210,20 +210,9 @@ static inline void skb_frag_size_sub(skb_frag_t *frag, int delta)
|
||||||
* struct skb_shared_hwtstamps - hardware time stamps
|
* struct skb_shared_hwtstamps - hardware time stamps
|
||||||
* @hwtstamp: hardware time stamp transformed into duration
|
* @hwtstamp: hardware time stamp transformed into duration
|
||||||
* since arbitrary point in time
|
* since arbitrary point in time
|
||||||
* @syststamp: hwtstamp transformed to system time base (deprecated)
|
|
||||||
*
|
*
|
||||||
* Software time stamps generated by ktime_get_real() are stored in
|
* Software time stamps generated by ktime_get_real() are stored in
|
||||||
* skb->tstamp. The relation between the different kinds of time
|
* skb->tstamp.
|
||||||
* stamps is as follows:
|
|
||||||
*
|
|
||||||
* syststamp and tstamp can be compared against each other in
|
|
||||||
* arbitrary combinations. The accuracy of a
|
|
||||||
* syststamp/tstamp/"syststamp from other device" comparison is
|
|
||||||
* limited by the accuracy of the transformation into system time
|
|
||||||
* base. This depends on the device driver and its underlying
|
|
||||||
* hardware. The syststamp implementation is deprecated in favor
|
|
||||||
* of hwtstamps and hw PTP clock sources exposed directly to
|
|
||||||
* userspace.
|
|
||||||
*
|
*
|
||||||
* hwtstamps can only be compared against other hwtstamps from
|
* hwtstamps can only be compared against other hwtstamps from
|
||||||
* the same device.
|
* the same device.
|
||||||
|
@ -233,7 +222,6 @@ static inline void skb_frag_size_sub(skb_frag_t *frag, int delta)
|
||||||
*/
|
*/
|
||||||
struct skb_shared_hwtstamps {
|
struct skb_shared_hwtstamps {
|
||||||
ktime_t hwtstamp;
|
ktime_t hwtstamp;
|
||||||
ktime_t syststamp;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Definitions for tx_flags in struct skb_shared_info */
|
/* Definitions for tx_flags in struct skb_shared_info */
|
||||||
|
|
|
@ -707,7 +707,6 @@ enum sock_flags {
|
||||||
SOCK_TIMESTAMPING_RX_SOFTWARE, /* %SOF_TIMESTAMPING_RX_SOFTWARE */
|
SOCK_TIMESTAMPING_RX_SOFTWARE, /* %SOF_TIMESTAMPING_RX_SOFTWARE */
|
||||||
SOCK_TIMESTAMPING_SOFTWARE, /* %SOF_TIMESTAMPING_SOFTWARE */
|
SOCK_TIMESTAMPING_SOFTWARE, /* %SOF_TIMESTAMPING_SOFTWARE */
|
||||||
SOCK_TIMESTAMPING_RAW_HARDWARE, /* %SOF_TIMESTAMPING_RAW_HARDWARE */
|
SOCK_TIMESTAMPING_RAW_HARDWARE, /* %SOF_TIMESTAMPING_RAW_HARDWARE */
|
||||||
SOCK_TIMESTAMPING_SYS_HARDWARE, /* %SOF_TIMESTAMPING_SYS_HARDWARE */
|
|
||||||
SOCK_FASYNC, /* fasync() active */
|
SOCK_FASYNC, /* fasync() active */
|
||||||
SOCK_RXQ_OVFL,
|
SOCK_RXQ_OVFL,
|
||||||
SOCK_ZEROCOPY, /* buffers from userspace */
|
SOCK_ZEROCOPY, /* buffers from userspace */
|
||||||
|
@ -2166,16 +2165,13 @@ sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
|
||||||
* - software time stamp available and wanted
|
* - software time stamp available and wanted
|
||||||
* (SOCK_TIMESTAMPING_SOFTWARE)
|
* (SOCK_TIMESTAMPING_SOFTWARE)
|
||||||
* - hardware time stamps available and wanted
|
* - hardware time stamps available and wanted
|
||||||
* (SOCK_TIMESTAMPING_SYS_HARDWARE or
|
* SOCK_TIMESTAMPING_RAW_HARDWARE
|
||||||
* SOCK_TIMESTAMPING_RAW_HARDWARE)
|
|
||||||
*/
|
*/
|
||||||
if (sock_flag(sk, SOCK_RCVTSTAMP) ||
|
if (sock_flag(sk, SOCK_RCVTSTAMP) ||
|
||||||
sock_flag(sk, SOCK_TIMESTAMPING_RX_SOFTWARE) ||
|
sock_flag(sk, SOCK_TIMESTAMPING_RX_SOFTWARE) ||
|
||||||
(kt.tv64 && sock_flag(sk, SOCK_TIMESTAMPING_SOFTWARE)) ||
|
(kt.tv64 && sock_flag(sk, SOCK_TIMESTAMPING_SOFTWARE)) ||
|
||||||
(hwtstamps->hwtstamp.tv64 &&
|
(hwtstamps->hwtstamp.tv64 &&
|
||||||
sock_flag(sk, SOCK_TIMESTAMPING_RAW_HARDWARE)) ||
|
sock_flag(sk, SOCK_TIMESTAMPING_RAW_HARDWARE)))
|
||||||
(hwtstamps->syststamp.tv64 &&
|
|
||||||
sock_flag(sk, SOCK_TIMESTAMPING_SYS_HARDWARE)))
|
|
||||||
__sock_recv_timestamp(msg, sk, skb);
|
__sock_recv_timestamp(msg, sk, skb);
|
||||||
else
|
else
|
||||||
sk->sk_stamp = kt;
|
sk->sk_stamp = kt;
|
||||||
|
@ -2193,8 +2189,7 @@ static inline void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
|
||||||
#define FLAGS_TS_OR_DROPS ((1UL << SOCK_RXQ_OVFL) | \
|
#define FLAGS_TS_OR_DROPS ((1UL << SOCK_RXQ_OVFL) | \
|
||||||
(1UL << SOCK_RCVTSTAMP) | \
|
(1UL << SOCK_RCVTSTAMP) | \
|
||||||
(1UL << SOCK_TIMESTAMPING_SOFTWARE) | \
|
(1UL << SOCK_TIMESTAMPING_SOFTWARE) | \
|
||||||
(1UL << SOCK_TIMESTAMPING_RAW_HARDWARE) | \
|
(1UL << SOCK_TIMESTAMPING_RAW_HARDWARE))
|
||||||
(1UL << SOCK_TIMESTAMPING_SYS_HARDWARE))
|
|
||||||
|
|
||||||
if (sk->sk_flags & FLAGS_TS_OR_DROPS)
|
if (sk->sk_flags & FLAGS_TS_OR_DROPS)
|
||||||
__sock_recv_ts_and_drops(msg, sk, skb);
|
__sock_recv_ts_and_drops(msg, sk, skb);
|
||||||
|
|
|
@ -862,8 +862,6 @@ set_rcvbuf:
|
||||||
(1UL << SOCK_TIMESTAMPING_RX_SOFTWARE));
|
(1UL << SOCK_TIMESTAMPING_RX_SOFTWARE));
|
||||||
sock_valbool_flag(sk, SOCK_TIMESTAMPING_SOFTWARE,
|
sock_valbool_flag(sk, SOCK_TIMESTAMPING_SOFTWARE,
|
||||||
val & SOF_TIMESTAMPING_SOFTWARE);
|
val & SOF_TIMESTAMPING_SOFTWARE);
|
||||||
sock_valbool_flag(sk, SOCK_TIMESTAMPING_SYS_HARDWARE,
|
|
||||||
val & SOF_TIMESTAMPING_SYS_HARDWARE);
|
|
||||||
sock_valbool_flag(sk, SOCK_TIMESTAMPING_RAW_HARDWARE,
|
sock_valbool_flag(sk, SOCK_TIMESTAMPING_RAW_HARDWARE,
|
||||||
val & SOF_TIMESTAMPING_RAW_HARDWARE);
|
val & SOF_TIMESTAMPING_RAW_HARDWARE);
|
||||||
break;
|
break;
|
||||||
|
@ -1102,8 +1100,6 @@ int sock_getsockopt(struct socket *sock, int level, int optname,
|
||||||
v.val |= SOF_TIMESTAMPING_RX_SOFTWARE;
|
v.val |= SOF_TIMESTAMPING_RX_SOFTWARE;
|
||||||
if (sock_flag(sk, SOCK_TIMESTAMPING_SOFTWARE))
|
if (sock_flag(sk, SOCK_TIMESTAMPING_SOFTWARE))
|
||||||
v.val |= SOF_TIMESTAMPING_SOFTWARE;
|
v.val |= SOF_TIMESTAMPING_SOFTWARE;
|
||||||
if (sock_flag(sk, SOCK_TIMESTAMPING_SYS_HARDWARE))
|
|
||||||
v.val |= SOF_TIMESTAMPING_SYS_HARDWARE;
|
|
||||||
if (sock_flag(sk, SOCK_TIMESTAMPING_RAW_HARDWARE))
|
if (sock_flag(sk, SOCK_TIMESTAMPING_RAW_HARDWARE))
|
||||||
v.val |= SOF_TIMESTAMPING_RAW_HARDWARE;
|
v.val |= SOF_TIMESTAMPING_RAW_HARDWARE;
|
||||||
break;
|
break;
|
||||||
|
|
12
net/socket.c
12
net/socket.c
|
@ -725,14 +725,10 @@ void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk,
|
||||||
if (sock_flag(sk, SOCK_TIMESTAMPING_SOFTWARE) &&
|
if (sock_flag(sk, SOCK_TIMESTAMPING_SOFTWARE) &&
|
||||||
ktime_to_timespec_cond(skb->tstamp, ts + 0))
|
ktime_to_timespec_cond(skb->tstamp, ts + 0))
|
||||||
empty = 0;
|
empty = 0;
|
||||||
if (shhwtstamps) {
|
if (shhwtstamps &&
|
||||||
if (sock_flag(sk, SOCK_TIMESTAMPING_SYS_HARDWARE) &&
|
sock_flag(sk, SOCK_TIMESTAMPING_RAW_HARDWARE) &&
|
||||||
ktime_to_timespec_cond(shhwtstamps->syststamp, ts + 1))
|
ktime_to_timespec_cond(shhwtstamps->hwtstamp, ts + 2))
|
||||||
empty = 0;
|
empty = 0;
|
||||||
if (sock_flag(sk, SOCK_TIMESTAMPING_RAW_HARDWARE) &&
|
|
||||||
ktime_to_timespec_cond(shhwtstamps->hwtstamp, ts + 2))
|
|
||||||
empty = 0;
|
|
||||||
}
|
|
||||||
if (!empty)
|
if (!empty)
|
||||||
put_cmsg(msg, SOL_SOCKET,
|
put_cmsg(msg, SOL_SOCKET,
|
||||||
SCM_TIMESTAMPING, sizeof(ts), &ts);
|
SCM_TIMESTAMPING, sizeof(ts), &ts);
|
||||||
|
|
Loading…
Reference in New Issue