diff options
-rw-r--r-- | include/net/net.h | 5 | ||||
-rw-r--r-- | net/net.c | 2 | ||||
-rw-r--r-- | net/socket.c | 4 | ||||
-rw-r--r-- | net/tap.c | 7 | ||||
-rw-r--r-- | net/vde.c | 2 |
5 files changed, 10 insertions, 10 deletions
diff --git a/include/net/net.h b/include/net/net.h index cb049a16a3..43d85a16eb 100644 --- a/include/net/net.h +++ b/include/net/net.h @@ -11,6 +11,11 @@ #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]; }; @@ -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)); diff --git a/net/socket.c b/net/socket.c index b0c83e022c..6c3752b88a 100644 --- a/net/socket.c +++ b/net/socket.c @@ -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); @@ -44,17 +44,12 @@ #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; @@ -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); |