]> Git Repo - qemu.git/commitdiff
net: increase buffer size to accommodate Jumbo frame pkts
authorScott Feldman <[email protected]>
Mon, 18 Mar 2013 18:43:44 +0000 (11:43 -0700)
committerStefan Hajnoczi <[email protected]>
Mon, 25 Mar 2013 10:14:07 +0000 (11:14 +0100)
Socket buffer sizes were hard-coded to 4K for VDE and socket netdevs.  Bump this
up to 68K (ala tap netdev) to handle maximum GSO packet size (64k) plus plenty
of room for the ethernet and virtio_net headers.

Originally, ran into this limitation when using -netdev UDP sockets to connect
VM-to-VM, where VM interface is configure with MTU=9000.  (Using virtio_net
NIC model).  Test is simple: ping -M do -s 8500 <target>.  This test will
attempt to ping with unfragmented packet of given size.  Without patch, size
is limited to < 4K (minus protocol hdrs).  With patch, ping test works with pkt
size up to 9000 (again, minus protocol hdrs).

v2: per Stefan, increase buf size to (4096+65536) as done in tap and apply
    to vde and socket netdevs.
v1: increase buf size to 12K just for -netdev UDP sockets

Signed-off-by: Scott Feldman <[email protected]>
Signed-off-by: Stefan Hajnoczi <[email protected]>
include/net/net.h
net/net.c
net/socket.c
net/tap.c
net/vde.c

index cb049a16a3239a3e01fdcf4a8c11b417a2df6156..43d85a16eb708fe4d6fdf9381e1f6fc1c9169e9a 100644 (file)
 
 #define MAX_QUEUE_NUM 1024
 
+/* Maximum GSO packet size (64k) plus plenty of room for
+ * the ethernet and virtio_net headers
+ */
+#define NET_BUFSIZE (4096 + 65536)
+
 struct MACAddr {
     uint8_t a[6];
 };
index f3d67f83221eff51b07170b1bf520a299cc339ee..7869161d8d67546a9af7ec17a82b824a0b189703 100644 (file)
--- a/net/net.c
+++ b/net/net.c
@@ -497,7 +497,7 @@ ssize_t qemu_send_packet_raw(NetClientState *nc, const uint8_t *buf, int size)
 static ssize_t nc_sendv_compat(NetClientState *nc, const struct iovec *iov,
                                int iovcnt)
 {
-    uint8_t buffer[4096];
+    uint8_t buffer[NET_BUFSIZE];
     size_t offset;
 
     offset = iov_to_buf(iov, iovcnt, 0, buffer, sizeof(buffer));
index b0c83e022c31229ac52fc438c76b1cccbc7f3868..6c3752b88a132127b13f346b0112cdb599a14bbd 100644 (file)
@@ -40,7 +40,7 @@ typedef struct NetSocketState {
     unsigned int index;
     unsigned int packet_len;
     unsigned int send_index;      /* number of bytes sent (only SOCK_STREAM) */
-    uint8_t buf[4096];
+    uint8_t buf[NET_BUFSIZE];
     struct sockaddr_in dgram_dst; /* contains inet host and port destination iff connectionless (SOCK_DGRAM) */
     IOHandler *send_fn;           /* differs between SOCK_STREAM/SOCK_DGRAM */
     bool read_poll;               /* waiting to receive data? */
@@ -146,7 +146,7 @@ static void net_socket_send(void *opaque)
     NetSocketState *s = opaque;
     int size, err;
     unsigned l;
-    uint8_t buf1[4096];
+    uint8_t buf1[NET_BUFSIZE];
     const uint8_t *buf;
 
     size = qemu_recv(s->fd, buf1, sizeof(buf1), 0);
index ce796997a35833343336b88f72376ec25b490de2..e7c84811ac37d4f2e12ef562e346f1473e1a362a 100644 (file)
--- a/net/tap.c
+++ b/net/tap.c
 
 #include "hw/vhost_net.h"
 
-/* Maximum GSO packet size (64k) plus plenty of room for
- * the ethernet and virtio_net headers
- */
-#define TAP_BUFSIZE (4096 + 65536)
-
 typedef struct TAPState {
     NetClientState nc;
     int fd;
     char down_script[1024];
     char down_script_arg[128];
-    uint8_t buf[TAP_BUFSIZE];
+    uint8_t buf[NET_BUFSIZE];
     bool read_poll;
     bool write_poll;
     bool using_vnet_hdr;
index 4dea32d07a51805ffa78eb839efa81bb4813f04c..2a619fbc813b3e2fe8b508f347348a6d115ab381 100644 (file)
--- a/net/vde.c
+++ b/net/vde.c
@@ -39,7 +39,7 @@ typedef struct VDEState {
 static void vde_to_qemu(void *opaque)
 {
     VDEState *s = opaque;
-    uint8_t buf[4096];
+    uint8_t buf[NET_BUFSIZE];
     int size;
 
     size = vde_recv(s->vde, (char *)buf, sizeof(buf), 0);
This page took 0.033482 seconds and 4 git commands to generate.