History

tun: add VNET_LE flag

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.

Michael S. Tsirkin committed 11 years ago

Commit e999d6e1 parent 40630b81 file · +1 −0Browse files

Unified · Split

include/uapi/linux/if_tun.h+1−0
@@ -57,6 +57,7 @@ · 56 unmodified lines
57#define IFF_ONE_QUEUE 0x200057#define IFF_ONE_QUEUE 0x2000
58#define IFF_VNET_HDR 0x400058#define IFF_VNET_HDR 0x4000
59#define IFF_TUN_EXCL 0x800059#define IFF_TUN_EXCL 0x8000
60#define IFF_VNET_LE 0x10000
60#define IFF_MULTI_QUEUE 0x010061#define IFF_MULTI_QUEUE 0x0100
61#define IFF_ATTACH_QUEUE 0x020062#define IFF_ATTACH_QUEUE 0x0200
62#define IFF_DETACH_QUEUE 0x040063#define IFF_DETACH_QUEUE 0x0400