]> git.proxmox.com Git - qemu.git/commitdiff
net: move UFO support detection to tap-linux.c
authorMark McLoughlin <markmc@redhat.com>
Thu, 22 Oct 2009 16:49:16 +0000 (17:49 +0100)
committerAnthony Liguori <aliguori@us.ibm.com>
Fri, 30 Oct 2009 13:39:29 +0000 (08:39 -0500)
Only supported on Linux

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
net/tap-aix.c
net/tap-bsd.c
net/tap-linux.c
net/tap-solaris.c
net/tap.c
net/tap.h

index 0de3dd9de389a786f2e071445cf0f294c8c6723b..4bc9f2f6d222d9d98a21a2ad4073d6550e443cd4 100644 (file)
@@ -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)
 {
index 1e85a3c22d460c7cba7729d94c5b0e4866bb6022..3ad14bb2c80486527b125a506382e529fc435615 100644 (file)
@@ -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)
 {
index b6f1fad5e44fd33e02e4be3367754c0c0ff6bb1f..0f621a2315d323ffde277cc2eda483118d7b3567 100644 (file)
@@ -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)
 {
index 614df018102c5af822f6c34065cb2b1fca2e8a64..ef4e60c878cca725671df00d3377d68ac2cf07ab 100644 (file)
@@ -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)
 {
index 9b110716e68360bcec886a6104b3c5555785a881..60354e47a992577d38704dcb7e5cdc1c672d0f83 100644 (file)
--- a/net/tap.c
+++ b/net/tap.c
@@ -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;
index 16398b5f4dd35b93c6af4b2161abee7f1e2e9c7b..538a5627206ba34dc244035442023835893342ab 100644 (file)
--- a/net/tap.h
+++ b/net/tap.h
@@ -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 */