diff options
author | Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> | 2012-07-21 02:55:36 -0400 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2012-07-21 18:21:53 -0400 |
commit | 0dd05a3b60ddf0e216fbd9e5116a5273966fd9db (patch) | |
tree | 43ff17c3511b5cdbb3c8ccc00d24005c3e07aaf5 /drivers | |
parent | 186e868786f97c8026f0a81400b451ace306b3a4 (diff) |
vhost: Separate vhost-net features from vhost features
In order for other vhost devices to use the VHOST_FEATURES bits the
vhost-net specific bits need to be moved to their own VHOST_NET_FEATURES
constant.
(Asias: Update drivers/vhost/test.c to use VHOST_NET_FEATURES)
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Cc: Zhi Yong Wu <wuzhy@cn.ibm.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Asias He <asias@redhat.com>
Signed-off-by: Nicholas A. Bellinger <nab@risingtidesystems.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/vhost/net.c | 4 | ||||
-rw-r--r-- | drivers/vhost/test.c | 4 | ||||
-rw-r--r-- | drivers/vhost/vhost.h | 3 |
3 files changed, 6 insertions, 5 deletions
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index f82a7394756e..072cbbadbc36 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c | |||
@@ -823,14 +823,14 @@ static long vhost_net_ioctl(struct file *f, unsigned int ioctl, | |||
823 | return -EFAULT; | 823 | return -EFAULT; |
824 | return vhost_net_set_backend(n, backend.index, backend.fd); | 824 | return vhost_net_set_backend(n, backend.index, backend.fd); |
825 | case VHOST_GET_FEATURES: | 825 | case VHOST_GET_FEATURES: |
826 | features = VHOST_FEATURES; | 826 | features = VHOST_NET_FEATURES; |
827 | if (copy_to_user(featurep, &features, sizeof features)) | 827 | if (copy_to_user(featurep, &features, sizeof features)) |
828 | return -EFAULT; | 828 | return -EFAULT; |
829 | return 0; | 829 | return 0; |
830 | case VHOST_SET_FEATURES: | 830 | case VHOST_SET_FEATURES: |
831 | if (copy_from_user(&features, featurep, sizeof features)) | 831 | if (copy_from_user(&features, featurep, sizeof features)) |
832 | return -EFAULT; | 832 | return -EFAULT; |
833 | if (features & ~VHOST_FEATURES) | 833 | if (features & ~VHOST_NET_FEATURES) |
834 | return -EOPNOTSUPP; | 834 | return -EOPNOTSUPP; |
835 | return vhost_net_set_features(n, features); | 835 | return vhost_net_set_features(n, features); |
836 | case VHOST_RESET_OWNER: | 836 | case VHOST_RESET_OWNER: |
diff --git a/drivers/vhost/test.c b/drivers/vhost/test.c index 3de00d9fae2e..91d6f060aade 100644 --- a/drivers/vhost/test.c +++ b/drivers/vhost/test.c | |||
@@ -261,14 +261,14 @@ static long vhost_test_ioctl(struct file *f, unsigned int ioctl, | |||
261 | return -EFAULT; | 261 | return -EFAULT; |
262 | return vhost_test_run(n, test); | 262 | return vhost_test_run(n, test); |
263 | case VHOST_GET_FEATURES: | 263 | case VHOST_GET_FEATURES: |
264 | features = VHOST_FEATURES; | 264 | features = VHOST_NET_FEATURES; |
265 | if (copy_to_user(featurep, &features, sizeof features)) | 265 | if (copy_to_user(featurep, &features, sizeof features)) |
266 | return -EFAULT; | 266 | return -EFAULT; |
267 | return 0; | 267 | return 0; |
268 | case VHOST_SET_FEATURES: | 268 | case VHOST_SET_FEATURES: |
269 | if (copy_from_user(&features, featurep, sizeof features)) | 269 | if (copy_from_user(&features, featurep, sizeof features)) |
270 | return -EFAULT; | 270 | return -EFAULT; |
271 | if (features & ~VHOST_FEATURES) | 271 | if (features & ~VHOST_NET_FEATURES) |
272 | return -EOPNOTSUPP; | 272 | return -EOPNOTSUPP; |
273 | return vhost_test_set_features(n, features); | 273 | return vhost_test_set_features(n, features); |
274 | case VHOST_RESET_OWNER: | 274 | case VHOST_RESET_OWNER: |
diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h index 8de1fd5b8efb..07b97631fd34 100644 --- a/drivers/vhost/vhost.h +++ b/drivers/vhost/vhost.h | |||
@@ -201,7 +201,8 @@ enum { | |||
201 | VHOST_FEATURES = (1ULL << VIRTIO_F_NOTIFY_ON_EMPTY) | | 201 | VHOST_FEATURES = (1ULL << VIRTIO_F_NOTIFY_ON_EMPTY) | |
202 | (1ULL << VIRTIO_RING_F_INDIRECT_DESC) | | 202 | (1ULL << VIRTIO_RING_F_INDIRECT_DESC) | |
203 | (1ULL << VIRTIO_RING_F_EVENT_IDX) | | 203 | (1ULL << VIRTIO_RING_F_EVENT_IDX) | |
204 | (1ULL << VHOST_F_LOG_ALL) | | 204 | (1ULL << VHOST_F_LOG_ALL), |
205 | VHOST_NET_FEATURES = VHOST_FEATURES | | ||
205 | (1ULL << VHOST_NET_F_VIRTIO_NET_HDR) | | 206 | (1ULL << VHOST_NET_F_VIRTIO_NET_HDR) | |
206 | (1ULL << VIRTIO_NET_F_MRG_RXBUF), | 207 | (1ULL << VIRTIO_NET_F_MRG_RXBUF), |
207 | }; | 208 | }; |