diff options
author | Richard Cochran <richardcochran@gmail.com> | 2010-07-17 04:49:36 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-07-18 22:15:26 -0400 |
commit | c1f19b51d1d87f3e3bb7e6648f43f7d57ed2da6b (patch) | |
tree | d9525359409e3493b48e8676717cc11ed69b640a /include/linux/skbuff.h | |
parent | 15f0127d1d189fda3294b7823e3e654afca54055 (diff) |
net: support time stamping in phy devices.
This patch adds a new networking option to allow hardware time stamps
from PHY devices. When enabled, likely candidates among incoming and
outgoing network packets are offered to the PHY driver for possible
time stamping. When accepted by the PHY driver, incoming packets are
deferred for later delivery by the driver.
The patch also adds phylib driver methods for the SIOCSHWTSTAMP ioctl
and callbacks for transmit and receive time stamping. Drivers may
optionally implement these functions.
Signed-off-by: Richard Cochran <richard.cochran@omicron.at>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/skbuff.h')
-rw-r--r-- | include/linux/skbuff.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index a1b0400c8d86..f5aa87e1e0c8 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -1933,6 +1933,36 @@ static inline ktime_t net_invalid_timestamp(void) | |||
1933 | return ktime_set(0, 0); | 1933 | return ktime_set(0, 0); |
1934 | } | 1934 | } |
1935 | 1935 | ||
1936 | extern void skb_timestamping_init(void); | ||
1937 | |||
1938 | #ifdef CONFIG_NETWORK_PHY_TIMESTAMPING | ||
1939 | |||
1940 | extern void skb_clone_tx_timestamp(struct sk_buff *skb); | ||
1941 | extern bool skb_defer_rx_timestamp(struct sk_buff *skb); | ||
1942 | |||
1943 | #else /* CONFIG_NETWORK_PHY_TIMESTAMPING */ | ||
1944 | |||
1945 | static inline void skb_clone_tx_timestamp(struct sk_buff *skb) | ||
1946 | { | ||
1947 | } | ||
1948 | |||
1949 | static inline bool skb_defer_rx_timestamp(struct sk_buff *skb) | ||
1950 | { | ||
1951 | return false; | ||
1952 | } | ||
1953 | |||
1954 | #endif /* !CONFIG_NETWORK_PHY_TIMESTAMPING */ | ||
1955 | |||
1956 | /** | ||
1957 | * skb_complete_tx_timestamp() - deliver cloned skb with tx timestamps | ||
1958 | * | ||
1959 | * @skb: clone of the the original outgoing packet | ||
1960 | * @hwtstamps: hardware time stamps | ||
1961 | * | ||
1962 | */ | ||
1963 | void skb_complete_tx_timestamp(struct sk_buff *skb, | ||
1964 | struct skb_shared_hwtstamps *hwtstamps); | ||
1965 | |||
1936 | /** | 1966 | /** |
1937 | * skb_tstamp_tx - queue clone of skb with send time stamps | 1967 | * skb_tstamp_tx - queue clone of skb with send time stamps |
1938 | * @orig_skb: the original outgoing packet | 1968 | * @orig_skb: the original outgoing packet |
@@ -1965,6 +1995,7 @@ static inline void sw_tx_timestamp(struct sk_buff *skb) | |||
1965 | */ | 1995 | */ |
1966 | static inline void skb_tx_timestamp(struct sk_buff *skb) | 1996 | static inline void skb_tx_timestamp(struct sk_buff *skb) |
1967 | { | 1997 | { |
1998 | skb_clone_tx_timestamp(skb); | ||
1968 | sw_tx_timestamp(skb); | 1999 | sw_tx_timestamp(skb); |
1969 | } | 2000 | } |
1970 | 2001 | ||