diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2013-11-18 18:25:20 -0500 |
---|---|---|
committer | Ben Hutchings <bhutchings@solarflare.com> | 2013-11-21 12:17:43 -0500 |
commit | 6ab96d1e06ba1452d583f3e45d6a3a45bb36b1c3 (patch) | |
tree | 84cd42734bb6f2d3e0aaece11f55dfaa1bd84363 | |
parent | a5b4145ba937b76dd698ad6fe5c5f37e0edbac43 (diff) |
tile_net: Implement the SIOCGHWTSTAMP ioctl
Compile-tested only (thanks to the kbuild test robot).
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
-rw-r--r-- | drivers/net/ethernet/tile/tilegx.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/drivers/net/ethernet/tile/tilegx.c b/drivers/net/ethernet/tile/tilegx.c index 628b736e5ae7..858f9a786b8c 100644 --- a/drivers/net/ethernet/tile/tilegx.c +++ b/drivers/net/ethernet/tile/tilegx.c | |||
@@ -481,8 +481,7 @@ static void tile_tx_timestamp(struct sk_buff *skb, int instance) | |||
481 | } | 481 | } |
482 | 482 | ||
483 | /* Use ioctl() to enable or disable TX or RX timestamping. */ | 483 | /* Use ioctl() to enable or disable TX or RX timestamping. */ |
484 | static int tile_hwtstamp_ioctl(struct net_device *dev, struct ifreq *rq, | 484 | static int tile_hwtstamp_set(struct net_device *dev, struct ifreq *rq) |
485 | int cmd) | ||
486 | { | 485 | { |
487 | #ifdef CONFIG_PTP_1588_CLOCK_TILEGX | 486 | #ifdef CONFIG_PTP_1588_CLOCK_TILEGX |
488 | struct hwtstamp_config config; | 487 | struct hwtstamp_config config; |
@@ -535,6 +534,21 @@ static int tile_hwtstamp_ioctl(struct net_device *dev, struct ifreq *rq, | |||
535 | #endif | 534 | #endif |
536 | } | 535 | } |
537 | 536 | ||
537 | static int tile_hwtstamp_get(struct net_device *dev, struct ifreq *rq) | ||
538 | { | ||
539 | #ifdef CONFIG_PTP_1588_CLOCK_TILEGX | ||
540 | struct tile_net_priv *priv = netdev_priv(dev); | ||
541 | |||
542 | if (copy_to_user(rq->ifr_data, &priv->stamp_cfg, | ||
543 | sizeof(priv->stamp_cfg))) | ||
544 | return -EFAULT; | ||
545 | |||
546 | return 0; | ||
547 | #else | ||
548 | return -EOPNOTSUPP; | ||
549 | #endif | ||
550 | } | ||
551 | |||
538 | static inline bool filter_packet(struct net_device *dev, void *buf) | 552 | static inline bool filter_packet(struct net_device *dev, void *buf) |
539 | { | 553 | { |
540 | /* Filter packets received before we're up. */ | 554 | /* Filter packets received before we're up. */ |
@@ -2098,7 +2112,9 @@ static void tile_net_tx_timeout(struct net_device *dev) | |||
2098 | static int tile_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) | 2112 | static int tile_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) |
2099 | { | 2113 | { |
2100 | if (cmd == SIOCSHWTSTAMP) | 2114 | if (cmd == SIOCSHWTSTAMP) |
2101 | return tile_hwtstamp_ioctl(dev, rq, cmd); | 2115 | return tile_hwtstamp_set(dev, rq); |
2116 | if (cmd == SIOCGHWTSTAMP) | ||
2117 | return tile_hwtstamp_get(dev, rq); | ||
2102 | 2118 | ||
2103 | return -EOPNOTSUPP; | 2119 | return -EOPNOTSUPP; |
2104 | } | 2120 | } |