qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [6074] Add support for tap vectored send


From: Anthony Liguori
Subject: [Qemu-devel] [6074] Add support for tap vectored send
Date: Wed, 17 Dec 2008 19:17:19 +0000

Revision: 6074
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6074
Author:   aliguori
Date:     2008-12-17 19:17:17 +0000 (Wed, 17 Dec 2008)

Log Message:
-----------
Add support for tap vectored send

This is adapted from kvm-userspace.  It allows readv to be used with tap when
the host supports it.

Signed-off-by: Anthony Liguori <address@hidden>

Modified Paths:
--------------
    trunk/net.c

Modified: trunk/net.c
===================================================================
--- trunk/net.c 2008-12-17 19:13:11 UTC (rev 6073)
+++ trunk/net.c 2008-12-17 19:17:17 UTC (rev 6074)
@@ -620,6 +620,21 @@
     char down_script[1024];
 } TAPState;
 
+#ifdef HAVE_IOVEC
+static ssize_t tap_receive_iov(void *opaque, const struct iovec *iov,
+                               int iovcnt)
+{
+    TAPState *s = opaque;
+    ssize_t len;
+
+    do {
+        len = writev(s->fd, iov, iovcnt);
+    } while (len == -1 && (errno == EINTR || errno == EAGAIN));
+
+    return len;
+}
+#endif
+
 static void tap_receive(void *opaque, const uint8_t *buf, int size)
 {
     TAPState *s = opaque;
@@ -664,6 +679,9 @@
         return NULL;
     s->fd = fd;
     s->vc = qemu_new_vlan_client(vlan, tap_receive, NULL, s);
+#ifdef HAVE_IOVEC
+    s->vc->fd_readv = tap_receive_iov;
+#endif
     qemu_set_fd_handler(s->fd, tap_send, NULL, s);
     snprintf(s->vc->info_str, sizeof(s->vc->info_str), "tap: fd=%d", fd);
     return s;






reply via email to

[Prev in Thread] Current Thread [Next in Thread]