Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1267892
| From | Cornelia Huck <cornelia.huck@de.ibm.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] vhost: move is_le setup to the backend |
| Date | 2015-11-12 13:40 +0100 |
| Message-ID | <qtZku-rS-29@gated-at.bofh.it> (permalink) |
| References | <qpglY-5iu-25@gated-at.bofh.it> |
| Organization | IBM Deutschland Research & Development GmbH Vorsitzende des Aufsichtsrats: Martina Koederitz Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294 |
On Fri, 30 Oct 2015 12:42:35 +0100 Greg Kurz <gkurz@linux.vnet.ibm.com> wrote: > The vq->is_le field is used to fix endianness when accessing the vring via > the cpu_to_vhost16() and vhost16_to_cpu() helpers in the following cases: > > 1) host is big endian and device is modern virtio > > 2) host has cross-endian support and device is legacy virtio with a different > endianness than the host > > Both cases rely on the VHOST_SET_FEATURES ioctl, but 2) also needs the > VHOST_SET_VRING_ENDIAN ioctl to be called by userspace. Since vq->is_le > is only needed when the backend is active, it was decided to set it at > backend start. > > This is currently done in vhost_init_used()->vhost_init_is_le() but it > obfuscates the core vhost code. This patch moves the is_le setup to a > dedicated function that is called from the backend code. > > Note vhost_net is the only backend that can pass vq->private_data == NULL to > vhost_init_used(), hence the "if (sock)" branch. > > No behaviour change. > > Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com> > --- > drivers/vhost/net.c | 6 ++++++ > drivers/vhost/scsi.c | 3 +++ > drivers/vhost/test.c | 2 ++ > drivers/vhost/vhost.c | 12 +++++++----- > drivers/vhost/vhost.h | 1 + > 5 files changed, 19 insertions(+), 5 deletions(-) Makes sense. Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
Re: [PATCH] vhost: move is_le setup to the backend Cornelia Huck <cornelia.huck@de.ibm.com> - 2015-11-12 13:40 +0100
csiph-web