aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/vhost
diff options
context:
space:
mode:
authorAsias He <asias@redhat.com>2013-04-25 03:35:22 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2013-04-25 04:07:45 -0400
commit11c634183961c1f22a44167a676d0610cee3edaa (patch)
tree6859bbb05a027e080e16389f9ea2c039021466ad /drivers/vhost
parenta6c9af87363c5e964d981fe0ec4aa73061a0c793 (diff)
tcm_vhost: Add ioctl to get and set events missed flag
Signed-off-by: Asias He <asias@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/vhost')
-rw-r--r--drivers/vhost/tcm_vhost.c17
-rw-r--r--drivers/vhost/tcm_vhost.h3
2 files changed, 20 insertions, 0 deletions
diff --git a/drivers/vhost/tcm_vhost.c b/drivers/vhost/tcm_vhost.c
index 5340fd759c6e..07217d818ad7 100644
--- a/drivers/vhost/tcm_vhost.c
+++ b/drivers/vhost/tcm_vhost.c
@@ -1200,8 +1200,11 @@ static long vhost_scsi_ioctl(struct file *f, unsigned int ioctl,
1200 struct vhost_scsi_target backend; 1200 struct vhost_scsi_target backend;
1201 void __user *argp = (void __user *)arg; 1201 void __user *argp = (void __user *)arg;
1202 u64 __user *featurep = argp; 1202 u64 __user *featurep = argp;
1203 u32 __user *eventsp = argp;
1204 u32 events_missed;
1203 u64 features; 1205 u64 features;
1204 int r, abi_version = VHOST_SCSI_ABI_VERSION; 1206 int r, abi_version = VHOST_SCSI_ABI_VERSION;
1207 struct vhost_virtqueue *vq = &vs->vqs[VHOST_SCSI_VQ_EVT];
1205 1208
1206 switch (ioctl) { 1209 switch (ioctl) {
1207 case VHOST_SCSI_SET_ENDPOINT: 1210 case VHOST_SCSI_SET_ENDPOINT:
@@ -1222,6 +1225,20 @@ static long vhost_scsi_ioctl(struct file *f, unsigned int ioctl,
1222 if (copy_to_user(argp, &abi_version, sizeof abi_version)) 1225 if (copy_to_user(argp, &abi_version, sizeof abi_version))
1223 return -EFAULT; 1226 return -EFAULT;
1224 return 0; 1227 return 0;
1228 case VHOST_SCSI_SET_EVENTS_MISSED:
1229 if (get_user(events_missed, eventsp))
1230 return -EFAULT;
1231 mutex_lock(&vq->mutex);
1232 vs->vs_events_missed = events_missed;
1233 mutex_unlock(&vq->mutex);
1234 return 0;
1235 case VHOST_SCSI_GET_EVENTS_MISSED:
1236 mutex_lock(&vq->mutex);
1237 events_missed = vs->vs_events_missed;
1238 mutex_unlock(&vq->mutex);
1239 if (put_user(events_missed, eventsp))
1240 return -EFAULT;
1241 return 0;
1225 case VHOST_GET_FEATURES: 1242 case VHOST_GET_FEATURES:
1226 features = VHOST_SCSI_FEATURES; 1243 features = VHOST_SCSI_FEATURES;
1227 if (copy_to_user(featurep, &features, sizeof features)) 1244 if (copy_to_user(featurep, &features, sizeof features))
diff --git a/drivers/vhost/tcm_vhost.h b/drivers/vhost/tcm_vhost.h
index a545a5b766a3..514b9fda230e 100644
--- a/drivers/vhost/tcm_vhost.h
+++ b/drivers/vhost/tcm_vhost.h
@@ -123,3 +123,6 @@ struct vhost_scsi_target {
123#define VHOST_SCSI_CLEAR_ENDPOINT _IOW(VHOST_VIRTIO, 0x41, struct vhost_scsi_target) 123#define VHOST_SCSI_CLEAR_ENDPOINT _IOW(VHOST_VIRTIO, 0x41, struct vhost_scsi_target)
124/* Changing this breaks userspace. */ 124/* Changing this breaks userspace. */
125#define VHOST_SCSI_GET_ABI_VERSION _IOW(VHOST_VIRTIO, 0x42, int) 125#define VHOST_SCSI_GET_ABI_VERSION _IOW(VHOST_VIRTIO, 0x42, int)
126/* Set and get the events missed flag */
127#define VHOST_SCSI_SET_EVENTS_MISSED _IOW(VHOST_VIRTIO, 0x43, __u32)
128#define VHOST_SCSI_GET_EVENTS_MISSED _IOW(VHOST_VIRTIO, 0x44, __u32)