提交 ca0c88c2 编写于 作者: B Ben Hutchings

gianfar: Implement the SIOCGHWTSTAMP ioctl

This is untested.
Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
上级 1d5244d0
...@@ -795,8 +795,7 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev) ...@@ -795,8 +795,7 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev)
return err; return err;
} }
static int gfar_hwtstamp_ioctl(struct net_device *netdev, static int gfar_hwtstamp_set(struct net_device *netdev, struct ifreq *ifr)
struct ifreq *ifr, int cmd)
{ {
struct hwtstamp_config config; struct hwtstamp_config config;
struct gfar_private *priv = netdev_priv(netdev); struct gfar_private *priv = netdev_priv(netdev);
...@@ -845,7 +844,20 @@ static int gfar_hwtstamp_ioctl(struct net_device *netdev, ...@@ -845,7 +844,20 @@ static int gfar_hwtstamp_ioctl(struct net_device *netdev,
-EFAULT : 0; -EFAULT : 0;
} }
/* Ioctl MII Interface */ static int gfar_hwtstamp_get(struct net_device *netdev, struct ifreq *ifr)
{
struct hwtstamp_config config;
struct gfar_private *priv = netdev_priv(netdev);
config.flags = 0;
config.tx_type = priv->hwts_tx_en ? HWTSTAMP_TX_ON : HWTSTAMP_TX_OFF;
config.rx_filter = (priv->hwts_rx_en ?
HWTSTAMP_FILTER_ALL : HWTSTAMP_FILTER_NONE);
return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ?
-EFAULT : 0;
}
static int gfar_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) static int gfar_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{ {
struct gfar_private *priv = netdev_priv(dev); struct gfar_private *priv = netdev_priv(dev);
...@@ -854,7 +866,9 @@ static int gfar_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) ...@@ -854,7 +866,9 @@ static int gfar_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
return -EINVAL; return -EINVAL;
if (cmd == SIOCSHWTSTAMP) if (cmd == SIOCSHWTSTAMP)
return gfar_hwtstamp_ioctl(dev, rq, cmd); return gfar_hwtstamp_set(dev, rq);
if (cmd == SIOCGHWTSTAMP)
return gfar_hwtstamp_get(dev, rq);
if (!priv->phydev) if (!priv->phydev)
return -ENODEV; return -ENODEV;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册