aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/if_tun.h
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2010-03-17 17:45:01 +0200
committerMichael S. Tsirkin <mst@redhat.com>2010-05-03 12:33:13 +0300
commitd9d52b5178af586d679c1052fb161ee05ea2e83f (patch)
tree6148fda40e5aa28f3e8ceb438ffc51c5bb08dd86 /include/linux/if_tun.h
parentMerge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6 (diff)
downloadlinux-dev-d9d52b5178af586d679c1052fb161ee05ea2e83f.tar.xz
linux-dev-d9d52b5178af586d679c1052fb161ee05ea2e83f.zip
tun: add ioctl to modify vnet header size
virtio added mergeable buffers mode where 2 bytes of extra info is put after vnet header but before actual data (tun does not need this data). In hindsight, it would have been better to add the new info *before* the packet: as it is, users need a lot of tricky code to skip the extra 2 bytes in the middle of the iovec, and in fact applications seem to get it wrong, and only work with specific iovec layout. The fact 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, and future proofs the interface against further extensions, by making the size of the virtio net header configurable from userspace. As a result, tun driver will simply skip the extra 2 bytes on both input and output. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/if_tun.h')
-rw-r--r--include/linux/if_tun.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/if_tun.h b/include/linux/if_tun.h
index 1350a246893a..06b1829731fd 100644
--- a/include/linux/if_tun.h
+++ b/include/linux/if_tun.h
@@ -51,6 +51,8 @@
#define TUNSETSNDBUF _IOW('T', 212, int)
#define TUNATTACHFILTER _IOW('T', 213, struct sock_fprog)
#define TUNDETACHFILTER _IOW('T', 214, struct sock_fprog)
+#define TUNGETVNETHDRSZ _IOR('T', 215, int)
+#define TUNSETVNETHDRSZ _IOW('T', 216, int)
/* TUNSETIFF ifr flags */
#define IFF_TUN 0x0001