Re: [PATCH 1/2] vhost: helpers to enable/disable vring endianness

From
Cornelia Huck <hidden>
Date
2016-02-10 13:13:05
Also in
kvm, lkml, virtualization
Reply to
Greg Kurz, 2016-02-10
On Wed, 10 Feb 2016 13:11:34 +0100
Greg Kurz [off-list ref] wrote:
On Wed, 10 Feb 2016 13:21:22 +0200
"Michael S. Tsirkin" [off-list ref] wrote:
quoted
On Wed, Jan 13, 2016 at 06:09:41PM +0100, Greg Kurz wrote:
quoted
quoted
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index ad2146a9ab2d..e02e06755ab7 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -43,11 +43,16 @@ enum {
 #define vhost_avail_event(vq) ((__virtio16 __user *)&vq->used->ring[vq->num])
 
 #ifdef CONFIG_VHOST_CROSS_ENDIAN_LEGACY
-static void vhost_vq_reset_user_be(struct vhost_virtqueue *vq)
+static void vhost_disable_user_be(struct vhost_virtqueue *vq)
 {
 	vq->user_be = !virtio_legacy_is_little_endian();
 }
   
Hmm this doesn't look like an improvement to me.
What does it mean to disable big endian? Make it little endian?
The default behavior for the device is native endian.

The SET_VRING_ENDIAN ioctl is used to make the device big endian
on little endian hosts, hence "enabling" cross-endian mode...
quoted
Existing reset seems to make sense.
... and we "disable" cross-endian mode on reset.
quoted
quoted
+static void vhost_enable_user_be(struct vhost_virtqueue *vq, bool user_be)
+{
+	vq->user_be = user_be;
+}
+  
And this is maybe "init_user_be"?
Anyway I don't mind changing the names to reset/init_user_be if you think it
is clearer.
FWIW, I find the enable/disable terminology less confusing.
Thread (15 messages) 15 messages, 3 authors, last reply 2016-02-10
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help