]> git.baikalelectronics.ru Git - kernel.git/commit
tun: add ioctl to modify vnet header size
authorMichael S. Tsirkin <mst@redhat.com>
Wed, 17 Mar 2010 15:45:01 +0000 (17:45 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Mon, 3 May 2010 09:33:13 +0000 (12:33 +0300)
commitbc23f5d48c5216a970167825f8152174ddc55b2b
tree6148fda40e5aa28f3e8ceb438ffc51c5bb08dd86
parent1ec80c77145972a46bd190a0c2d04267dc7f657e
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>
drivers/net/tun.c
include/linux/if_tun.h