提交 450e55e9 编写于 作者: B Ben Hutchings

vxge: Implement the SIOCGHWTSTAMP ioctl

Compile-tested only.
Signed-off-by: NBen Hutchings <bhutchings@solarflare.com>
上级 100dbda8
...@@ -3185,7 +3185,7 @@ static enum vxge_hw_status vxge_timestamp_config(struct __vxge_hw_device *devh) ...@@ -3185,7 +3185,7 @@ static enum vxge_hw_status vxge_timestamp_config(struct __vxge_hw_device *devh)
return status; return status;
} }
static int vxge_hwtstamp_ioctl(struct vxgedev *vdev, void __user *data) static int vxge_hwtstamp_set(struct vxgedev *vdev, void __user *data)
{ {
struct hwtstamp_config config; struct hwtstamp_config config;
int i; int i;
...@@ -3246,6 +3246,21 @@ static int vxge_hwtstamp_ioctl(struct vxgedev *vdev, void __user *data) ...@@ -3246,6 +3246,21 @@ static int vxge_hwtstamp_ioctl(struct vxgedev *vdev, void __user *data)
return 0; return 0;
} }
static int vxge_hwtstamp_get(struct vxgedev *vdev, void __user *data)
{
struct hwtstamp_config config;
config.flags = 0;
config.tx_type = HWTSTAMP_TX_OFF;
config.rx_filter = (vdev->rx_hwts ?
HWTSTAMP_FILTER_ALL : HWTSTAMP_FILTER_NONE);
if (copy_to_user(data, &config, sizeof(config)))
return -EFAULT;
return 0;
}
/** /**
* vxge_ioctl * vxge_ioctl
* @dev: Device pointer. * @dev: Device pointer.
...@@ -3259,19 +3274,15 @@ static int vxge_hwtstamp_ioctl(struct vxgedev *vdev, void __user *data) ...@@ -3259,19 +3274,15 @@ static int vxge_hwtstamp_ioctl(struct vxgedev *vdev, void __user *data)
static int vxge_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) static int vxge_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
{ {
struct vxgedev *vdev = netdev_priv(dev); struct vxgedev *vdev = netdev_priv(dev);
int ret;
switch (cmd) { switch (cmd) {
case SIOCSHWTSTAMP: case SIOCSHWTSTAMP:
ret = vxge_hwtstamp_ioctl(vdev, rq->ifr_data); return vxge_hwtstamp_set(vdev, rq->ifr_data);
if (ret) case SIOCGHWTSTAMP:
return ret; return vxge_hwtstamp_get(vdev, rq->ifr_data);
break;
default: default:
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
return 0;
} }
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册