diff options
author | 2009-10-22 17:49:16 +0100 | |
---|---|---|
committer | 2009-10-30 08:39:29 -0500 | |
commit | 9c282718aafd021661f0fa0431322a7df75705b0 (patch) | |
tree | 931d70eb2bd7065f0185452ce2d85ce4e4b2d30e /net | |
parent | net: move tap_set_offload() code into tap-linux.c (diff) | |
download | qemu-kvm-9c282718aafd021661f0fa0431322a7df75705b0.tar.gz qemu-kvm-9c282718aafd021661f0fa0431322a7df75705b0.tar.bz2 qemu-kvm-9c282718aafd021661f0fa0431322a7df75705b0.zip |
net: move UFO support detection to tap-linux.c
Only supported on Linux
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/tap-aix.c | 5 | ||||
-rw-r--r-- | net/tap-bsd.c | 5 | ||||
-rw-r--r-- | net/tap-linux.c | 12 | ||||
-rw-r--r-- | net/tap-solaris.c | 5 | ||||
-rw-r--r-- | net/tap.c | 7 | ||||
-rw-r--r-- | net/tap.h | 1 |
6 files changed, 29 insertions, 6 deletions
diff --git a/net/tap-aix.c b/net/tap-aix.c index 0de3dd9de..4bc9f2f6d 100644 --- a/net/tap-aix.c +++ b/net/tap-aix.c @@ -41,6 +41,11 @@ int tap_probe_vnet_hdr(int fd) return 0; } +int tap_probe_has_ufo(int fd) +{ + return 0; +} + void tap_fd_set_offload(int fd, int csum, int tso4, int tso6, int ecn, int ufo) { diff --git a/net/tap-bsd.c b/net/tap-bsd.c index 1e85a3c22..3ad14bb2c 100644 --- a/net/tap-bsd.c +++ b/net/tap-bsd.c @@ -71,6 +71,11 @@ int tap_probe_vnet_hdr(int fd) return 0; } +int tap_probe_has_ufo(int fd) +{ + return 0; +} + void tap_fd_set_offload(int fd, int csum, int tso4, int tso6, int ecn, int ufo) { diff --git a/net/tap-linux.c b/net/tap-linux.c index b6f1fad5e..0f621a231 100644 --- a/net/tap-linux.c +++ b/net/tap-linux.c @@ -112,6 +112,18 @@ int tap_probe_vnet_hdr(int fd) return ifr.ifr_flags & IFF_VNET_HDR; } +int tap_probe_has_ufo(int fd) +{ + unsigned offload; + + offload = TUN_F_CSUM | TUN_F_UFO; + + if (ioctl(fd, TUNSETOFFLOAD, offload) < 0) + return 0; + + return 1; +} + void tap_fd_set_offload(int fd, int csum, int tso4, int tso6, int ecn, int ufo) { diff --git a/net/tap-solaris.c b/net/tap-solaris.c index 614df0181..ef4e60c87 100644 --- a/net/tap-solaris.c +++ b/net/tap-solaris.c @@ -194,6 +194,11 @@ int tap_probe_vnet_hdr(int fd) return 0; } +int tap_probe_has_ufo(int fd) +{ + return 0; +} + void tap_fd_set_offload(int fd, int csum, int tso4, int tso6, int ecn, int ufo) { @@ -271,7 +271,6 @@ static TAPState *net_tap_fd_init(VLANState *vlan, int vnet_hdr) { TAPState *s; - unsigned int offload; s = qemu_mallocz(sizeof(TAPState)); s->fd = fd; @@ -281,11 +280,7 @@ static TAPState *net_tap_fd_init(VLANState *vlan, vlan, NULL, model, name, NULL, tap_receive, tap_receive_raw, tap_receive_iov, tap_cleanup, s); - s->has_ufo = 0; - /* Check if tap supports UFO */ - offload = TUN_F_CSUM | TUN_F_UFO; - if (ioctl(s->fd, TUNSETOFFLOAD, offload) == 0) - s->has_ufo = 1; + s->has_ufo = tap_probe_has_ufo(s->fd); tap_set_offload(s->vc, 0, 0, 0, 0, 0); tap_read_poll(s, 1); return s; @@ -45,6 +45,7 @@ void tap_set_offload(VLANClientState *vc, int csum, int tso4, int tso6, int ecn, int tap_set_sndbuf(int fd, QemuOpts *opts); int tap_probe_vnet_hdr(int fd); +int tap_probe_has_ufo(int fd); void tap_fd_set_offload(int fd, int csum, int tso4, int tso6, int ecn, int ufo); #endif /* QEMU_NET_TAP_H */ |