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/phy.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/phy.h')
-rw-r--r-- | include/linux/phy.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/linux/phy.h b/include/linux/phy.h index d63736a84002..6b0a782c6224 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h | |||
@@ -234,6 +234,8 @@ enum phy_state { | |||
234 | PHY_RESUMING | 234 | PHY_RESUMING |
235 | }; | 235 | }; |
236 | 236 | ||
237 | struct sk_buff; | ||
238 | |||
237 | /* phy_device: An instance of a PHY | 239 | /* phy_device: An instance of a PHY |
238 | * | 240 | * |
239 | * drv: Pointer to the driver for this PHY instance | 241 | * drv: Pointer to the driver for this PHY instance |
@@ -402,6 +404,26 @@ struct phy_driver { | |||
402 | /* Clears up any memory if needed */ | 404 | /* Clears up any memory if needed */ |
403 | void (*remove)(struct phy_device *phydev); | 405 | void (*remove)(struct phy_device *phydev); |
404 | 406 | ||
407 | /* Handles SIOCSHWTSTAMP ioctl for hardware time stamping. */ | ||
408 | int (*hwtstamp)(struct phy_device *phydev, struct ifreq *ifr); | ||
409 | |||
410 | /* | ||
411 | * Requests a Rx timestamp for 'skb'. If the skb is accepted, | ||
412 | * the phy driver promises to deliver it using netif_rx() as | ||
413 | * soon as a timestamp becomes available. One of the | ||
414 | * PTP_CLASS_ values is passed in 'type'. The function must | ||
415 | * return true if the skb is accepted for delivery. | ||
416 | */ | ||
417 | bool (*rxtstamp)(struct phy_device *dev, struct sk_buff *skb, int type); | ||
418 | |||
419 | /* | ||
420 | * Requests a Tx timestamp for 'skb'. The phy driver promises | ||
421 | * to deliver it to the socket's error queue as soon as a | ||
422 | * timestamp becomes available. One of the PTP_CLASS_ values | ||
423 | * is passed in 'type'. | ||
424 | */ | ||
425 | void (*txtstamp)(struct phy_device *dev, struct sk_buff *skb, int type); | ||
426 | |||
405 | struct device_driver driver; | 427 | struct device_driver driver; |
406 | }; | 428 | }; |
407 | #define to_phy_driver(d) container_of(d, struct phy_driver, driver) | 429 | #define to_phy_driver(d) container_of(d, struct phy_driver, driver) |