提交 6ab96d1e 编写于 作者: B Ben Hutchings

tile_net: Implement the SIOCGHWTSTAMP ioctl

Compile-tested only (thanks to the kbuild test robot).
Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
上级 a5b4145b
...@@ -481,8 +481,7 @@ static void tile_tx_timestamp(struct sk_buff *skb, int instance) ...@@ -481,8 +481,7 @@ static void tile_tx_timestamp(struct sk_buff *skb, int instance)
} }
/* Use ioctl() to enable or disable TX or RX timestamping. */ /* Use ioctl() to enable or disable TX or RX timestamping. */
static int tile_hwtstamp_ioctl(struct net_device *dev, struct ifreq *rq, static int tile_hwtstamp_set(struct net_device *dev, struct ifreq *rq)
int cmd)
{ {
#ifdef CONFIG_PTP_1588_CLOCK_TILEGX #ifdef CONFIG_PTP_1588_CLOCK_TILEGX
struct hwtstamp_config config; struct hwtstamp_config config;
...@@ -535,6 +534,21 @@ static int tile_hwtstamp_ioctl(struct net_device *dev, struct ifreq *rq, ...@@ -535,6 +534,21 @@ static int tile_hwtstamp_ioctl(struct net_device *dev, struct ifreq *rq,
#endif #endif
} }
static int tile_hwtstamp_get(struct net_device *dev, struct ifreq *rq)
{
#ifdef CONFIG_PTP_1588_CLOCK_TILEGX
struct tile_net_priv *priv = netdev_priv(dev);
if (copy_to_user(rq->ifr_data, &priv->stamp_cfg,
sizeof(priv->stamp_cfg)))
return -EFAULT;
return 0;
#else
return -EOPNOTSUPP;
#endif
}
static inline bool filter_packet(struct net_device *dev, void *buf) static inline bool filter_packet(struct net_device *dev, void *buf)
{ {
/* Filter packets received before we're up. */ /* Filter packets received before we're up. */
...@@ -2098,7 +2112,9 @@ static void tile_net_tx_timeout(struct net_device *dev) ...@@ -2098,7 +2112,9 @@ static void tile_net_tx_timeout(struct net_device *dev)
static int tile_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) static int tile_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{ {
if (cmd == SIOCSHWTSTAMP) if (cmd == SIOCSHWTSTAMP)
return tile_hwtstamp_ioctl(dev, rq, cmd); return tile_hwtstamp_set(dev, rq);
if (cmd == SIOCGHWTSTAMP)
return tile_hwtstamp_get(dev, rq);
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册