linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: David Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>,
	cornelia.huck-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org,
	rusty-8fk3Idey6ehBDgjK7y7TUQ@public.gmane.org,
	nab-IzHhD5pYlfBP7FQvKIMDCQ@public.gmane.org,
	pbonzini-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH v4 35/42] tun: add VNET_LE flag
Date: Tue, 25 Nov 2014 18:43:54 +0200	[thread overview]
Message-ID: <1416933600-21398-36-git-send-email-mst@redhat.com> (raw)
In-Reply-To: <1416933600-21398-1-git-send-email-mst-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

virtio 1.0 modified virtio net header format,
making all fields little endian.

Users can tweak header format before submitting it to tun,
but this means more data copies where none were necessary.
And if the iovec is in RO memory, this means we might
need to split iovec also means we might in theory overflow
iovec max size.

This patch adds a simpler way for applications to handle this,
using new "little endian" flag in tun.
As a result, tun simply byte-swaps header fields as appropriate.
This is a NOP on LE architectures.

Signed-off-by: Michael S. Tsirkin <mst-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 include/uapi/linux/if_tun.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/uapi/linux/if_tun.h b/include/uapi/linux/if_tun.h
index 277a260..18b2403 100644
--- a/include/uapi/linux/if_tun.h
+++ b/include/uapi/linux/if_tun.h
@@ -57,6 +57,7 @@
 #define IFF_ONE_QUEUE	0x2000
 #define IFF_VNET_HDR	0x4000
 #define IFF_TUN_EXCL	0x8000
+#define IFF_VNET_LE	0x10000
 #define IFF_MULTI_QUEUE 0x0100
 #define IFF_ATTACH_QUEUE 0x0200
 #define IFF_DETACH_QUEUE 0x0400
-- 
MST

  parent reply	other threads:[~2014-11-25 16:43 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1416933600-21398-1-git-send-email-mst@redhat.com>
2014-11-25 16:41 ` [PATCH v4 03/42] virtio: add virtio 1.0 feature bit Michael S. Tsirkin
2014-11-25 16:41 ` [PATCH v4 05/42] virtio: memory access APIs Michael S. Tsirkin
2014-11-25 17:42   ` Cornelia Huck
2014-11-25 16:42 ` [PATCH v4 09/42] virtio: set FEATURES_OK Michael S. Tsirkin
2014-11-25 17:48   ` Cornelia Huck
2014-11-25 21:38     ` Michael S. Tsirkin
2014-11-26  9:18       ` Cornelia Huck
2014-11-25 16:42 ` [PATCH v4 12/42] virtio_net: v1.0 endianness Michael S. Tsirkin
2014-11-25 16:42 ` [PATCH v4 13/42] virtio_blk: v1.0 support Michael S. Tsirkin
     [not found]   ` <1416933600-21398-14-git-send-email-mst-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-11-25 17:55     ` Cornelia Huck
2014-11-25 21:43       ` Michael S. Tsirkin
2014-11-26 15:40         ` David Hildenbrand
2014-11-26 15:48           ` Michael S. Tsirkin
     [not found] ` <1416933600-21398-1-git-send-email-mst-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-11-25 16:43   ` [PATCH v4 33/42] tun: move internal flag defines out of uapi Michael S. Tsirkin
2014-11-25 16:43   ` Michael S. Tsirkin [this message]
2014-11-25 16:44 ` [PATCH v4 40/42] virtio_scsi: export to userspace Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1416933600-21398-36-git-send-email-mst@redhat.com \
    --to=mst-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=cornelia.huck-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org \
    --cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
    --cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=nab-IzHhD5pYlfBP7FQvKIMDCQ@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=pbonzini-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=rusty-8fk3Idey6ehBDgjK7y7TUQ@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).