Skip to contentSkip to conversation

char: tcp: increase size of buffer that holds data to be sent out

PATCH In review Amit Shah 2 participants 4 messages Nov 2, 2009 – Nov 3, 2009

lore
Share & tools
lore

Amit Shah

author
#0 lore raw

PATCH 1/1 char: tcp: increase size of buffer that holds data to be sent out

1k is too less; at least send out 4k of data from a chardev.

---
 qemu-char.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
qemu-char.c +1 -1
index 0fd402c..34c0a63 100644
@@ -1996,7 +1996,7 @@ static void tcp_chr_read(void *opaque)
 {
     CharDriverState *chr = opaque;
     TCPCharDriver *s = chr->opaque;
-    uint8_t buf[1024];
+    uint8_t buf[4096];
     int len, size;
 
     if (!s->connected || s->max_size <= 0)
Signature · 1 line
1.6.2.5
author
#1 lore raw
Quoted 1 line · Amit Shah

1k is too less; at least send out 4k of data from a chardev.

This one only touches unix/tcp sockets; the others use a 1k buffer as well; I'll send a new patch that converts all the users to a consistent buffer size.

Quoted 22 lines
---
 qemu-char.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
qemu-char.c +1 -1
index 0fd402c..34c0a63 100644
@@ -1996,7 +1996,7 @@ static void tcp_chr_read(void *opaque)
 {
     CharDriverState *chr = opaque;
     TCPCharDriver *s = chr->opaque;
-    uint8_t buf[1024];
+    uint8_t buf[4096];
     int len, size;
 
     if (!s->connected || s->max_size <= 0)
Signature · 1 line
1.6.2.5

Amit

author
#3 lore raw
Quoted 5 lines · Anthony Liguori
Quoted 2 lines · Amit Shah

1k is too less; at least send out 4k of data from a chardev.

Why is 1k too small?

Definitely depends on the apps that pump in the data. If an app has data to pump, it will keep pumping as much data as possible (eg, Linux syscalls issue read / write requests for 32k bytes of data).

The char devices have a 'can_read' call to determine how much the backend can accept.

We're artificially limiting to 1k in this code, even if the app can pump and the backend can receive, resulting in multiple splits.

In the case of virtio, 4k is available if the guest is able to receive data.

Amit