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

login
register
mail settings
Submitter Amit Shah
Date Nov. 2, 2009, 4:29 p.m.
Message ID <1257179398-22110-1-git-send-email-amit.shah@redhat.com>
Download mbox | patch
Permalink /patch/37439/
State New
Headers show

Comments

Amit Shah - Nov. 2, 2009, 4:29 p.m.
1k is too less; at least send out 4k of data from a chardev.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
---
 qemu-char.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Amit Shah - Nov. 2, 2009, 4:47 p.m.
On (Mon) Nov 02 2009 [21:59:58], Amit Shah wrote:
> 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.

> 
> Signed-off-by: Amit Shah <amit.shah@redhat.com>
> ---
>  qemu-char.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/qemu-char.c b/qemu-char.c
> index 0fd402c..34c0a63 100644
> --- a/qemu-char.c
> +++ b/qemu-char.c
> @@ -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)
> -- 
> 1.6.2.5
> 

		Amit
Anthony Liguori - Nov. 2, 2009, 4:52 p.m.
Amit Shah wrote:
> 1k is too less; at least send out 4k of data from a chardev.
>   

Why is 1k too small?

Regards,

Anthony Liguori
Amit Shah - Nov. 3, 2009, 4:54 a.m.
On (Mon) Nov 02 2009 [10:52:02], Anthony Liguori wrote:
> Amit Shah wrote:
>> 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

Patch

diff --git a/qemu-char.c b/qemu-char.c
index 0fd402c..34c0a63 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -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)