Commit 68a360e8 authored by Willem de Bruijn's avatar Willem de Bruijn Committed by David S. Miller

packet: remove deprecated syststamp timestamp

No device driver will ever return an skb_shared_info structure with
syststamp non-zero, so remove the branch that tests for this and
optionally marks the packet timestamp as TP_STATUS_TS_SYS_HARDWARE.

Do not remove the definition TP_STATUS_TS_SYS_HARDWARE, as processes
may refer to it.
Signed-off-by: default avatarWillem de Bruijn <willemb@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ce750588
...@@ -1008,14 +1008,9 @@ hardware timestamps to be used. Note: you may need to enable the generation ...@@ -1008,14 +1008,9 @@ hardware timestamps to be used. Note: you may need to enable the generation
of hardware timestamps with SIOCSHWTSTAMP (see related information from of hardware timestamps with SIOCSHWTSTAMP (see related information from
Documentation/networking/timestamping.txt). Documentation/networking/timestamping.txt).
PACKET_TIMESTAMP accepts the same integer bit field as PACKET_TIMESTAMP accepts the same integer bit field as SO_TIMESTAMPING:
SO_TIMESTAMPING. However, only the SOF_TIMESTAMPING_SYS_HARDWARE
and SOF_TIMESTAMPING_RAW_HARDWARE values are recognized by int req = SOF_TIMESTAMPING_RAW_HARDWARE;
PACKET_TIMESTAMP. SOF_TIMESTAMPING_SYS_HARDWARE takes precedence over
SOF_TIMESTAMPING_RAW_HARDWARE if both bits are set.
int req = 0;
req |= SOF_TIMESTAMPING_SYS_HARDWARE;
setsockopt(fd, SOL_PACKET, PACKET_TIMESTAMP, (void *) &req, sizeof(req)) setsockopt(fd, SOL_PACKET, PACKET_TIMESTAMP, (void *) &req, sizeof(req))
For the mmap(2)ed ring buffers, such timestamps are stored in the For the mmap(2)ed ring buffers, such timestamps are stored in the
...@@ -1023,14 +1018,13 @@ tpacket{,2,3}_hdr structure's tp_sec and tp_{n,u}sec members. To determine ...@@ -1023,14 +1018,13 @@ tpacket{,2,3}_hdr structure's tp_sec and tp_{n,u}sec members. To determine
what kind of timestamp has been reported, the tp_status field is binary |'ed what kind of timestamp has been reported, the tp_status field is binary |'ed
with the following possible bits ... with the following possible bits ...
TP_STATUS_TS_SYS_HARDWARE
TP_STATUS_TS_RAW_HARDWARE TP_STATUS_TS_RAW_HARDWARE
TP_STATUS_TS_SOFTWARE TP_STATUS_TS_SOFTWARE
... that are equivalent to its SOF_TIMESTAMPING_* counterparts. For the ... that are equivalent to its SOF_TIMESTAMPING_* counterparts. For the
RX_RING, if none of those 3 are set (i.e. PACKET_TIMESTAMP is not set), RX_RING, if neither is set (i.e. PACKET_TIMESTAMP is not set), then a
then this means that a software fallback was invoked *within* PF_PACKET's software fallback was invoked *within* PF_PACKET's processing code (less
processing code (less precise). precise).
Getting timestamps for the TX_RING works as follows: i) fill the ring frames, Getting timestamps for the TX_RING works as follows: i) fill the ring frames,
ii) call sendto() e.g. in blocking mode, iii) wait for status of relevant ii) call sendto() e.g. in blocking mode, iii) wait for status of relevant
......
...@@ -108,7 +108,7 @@ struct tpacket_auxdata { ...@@ -108,7 +108,7 @@ struct tpacket_auxdata {
/* Rx and Tx ring - header status */ /* Rx and Tx ring - header status */
#define TP_STATUS_TS_SOFTWARE (1 << 29) #define TP_STATUS_TS_SOFTWARE (1 << 29)
#define TP_STATUS_TS_SYS_HARDWARE (1 << 30) #define TP_STATUS_TS_SYS_HARDWARE (1 << 30) /* deprecated, never set */
#define TP_STATUS_TS_RAW_HARDWARE (1 << 31) #define TP_STATUS_TS_RAW_HARDWARE (1 << 31)
/* Rx ring - feature request bits */ /* Rx ring - feature request bits */
......
...@@ -441,14 +441,10 @@ static __u32 tpacket_get_timestamp(struct sk_buff *skb, struct timespec *ts, ...@@ -441,14 +441,10 @@ static __u32 tpacket_get_timestamp(struct sk_buff *skb, struct timespec *ts,
{ {
struct skb_shared_hwtstamps *shhwtstamps = skb_hwtstamps(skb); struct skb_shared_hwtstamps *shhwtstamps = skb_hwtstamps(skb);
if (shhwtstamps) { if (shhwtstamps &&
if ((flags & SOF_TIMESTAMPING_SYS_HARDWARE) && (flags & SOF_TIMESTAMPING_RAW_HARDWARE) &&
ktime_to_timespec_cond(shhwtstamps->syststamp, ts)) ktime_to_timespec_cond(shhwtstamps->hwtstamp, ts))
return TP_STATUS_TS_SYS_HARDWARE; return TP_STATUS_TS_RAW_HARDWARE;
if ((flags & SOF_TIMESTAMPING_RAW_HARDWARE) &&
ktime_to_timespec_cond(shhwtstamps->hwtstamp, ts))
return TP_STATUS_TS_RAW_HARDWARE;
}
if (ktime_to_timespec_cond(skb->tstamp, ts)) if (ktime_to_timespec_cond(skb->tstamp, ts))
return TP_STATUS_TS_SOFTWARE; return TP_STATUS_TS_SOFTWARE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment