diff options
| author | Anthony Liguori <aliguori@us.ibm.com> | 2010-09-08 14:26:14 -0500 |
|---|---|---|
| committer | Anthony Liguori <aliguori@us.ibm.com> | 2010-09-08 14:26:14 -0500 |
| commit | dccbe6fbab47c9a2589f436e0592933b47cbe40b (patch) | |
| tree | e5a851b48a3801dd28282eb17533975cade7ac23 /net/tap-linux.c | |
| parent | 630c26893d6dc7713c0fcfc3c09d6bfe536a6ce3 (diff) | |
| parent | a697a334b3c4d3250e6420f5d38550ea10eb5319 (diff) | |
| download | focaccia-qemu-dccbe6fbab47c9a2589f436e0592933b47cbe40b.tar.gz focaccia-qemu-dccbe6fbab47c9a2589f436e0592933b47cbe40b.zip | |
Merge remote branch 'mst/for_anthony' into staging
Diffstat (limited to 'net/tap-linux.c')
| -rw-r--r-- | net/tap-linux.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/net/tap-linux.c b/net/tap-linux.c index c92983cb53..f7aa9041b8 100644 --- a/net/tap-linux.c +++ b/net/tap-linux.c @@ -129,6 +129,35 @@ int tap_probe_has_ufo(int fd) return 1; } +/* Verify that we can assign given length */ +int tap_probe_vnet_hdr_len(int fd, int len) +{ + int orig; + if (ioctl(fd, TUNGETVNETHDRSZ, &orig) == -1) { + return 0; + } + if (ioctl(fd, TUNSETVNETHDRSZ, &len) == -1) { + return 0; + } + /* Restore original length: we can't handle failure. */ + if (ioctl(fd, TUNSETVNETHDRSZ, &orig) == -1) { + fprintf(stderr, "TUNGETVNETHDRSZ ioctl() failed: %s. Exiting.\n", + strerror(errno)); + assert(0); + return -errno; + } + return 1; +} + +void tap_fd_set_vnet_hdr_len(int fd, int len) +{ + if (ioctl(fd, TUNSETVNETHDRSZ, &len) == -1) { + fprintf(stderr, "TUNSETVNETHDRSZ ioctl() failed: %s. Exiting.\n", + strerror(errno)); + assert(0); + } +} + void tap_fd_set_offload(int fd, int csum, int tso4, int tso6, int ecn, int ufo) { |