qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] uhci: Use an intermediate buffer for usb packet


From: Hans de Goede
Subject: Re: [Qemu-devel] [PATCH] uhci: Use an intermediate buffer for usb packet data
Date: Fri, 26 Apr 2013 16:01:21 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130311 Thunderbird/17.0.4

Hi,

On 04/26/2013 02:32 PM, Gerd Hoffmann wrote:
   Hi,

+    if (max_len <= sizeof(async->static_buf)) {
+        async->buf = async->static_buf;
+    } else {
+        async->buf = g_malloc(max_len);
+    }

Do we need this?  I think we should simply make the static buffer big
enough for the maximum allowed packet size (isn't that big on usb 1.1,
isn't it?) or allocate dynamically unconditionally.

The maximum size in the USB spec is 1023 bytes, uhci spec allows upto 1280,
but mentions in the uhci spec that the usb spec limits things to 1023,
this is only for isoc endpoints, for all others the maximum packet size
is 64, hence I opted for the static buffer of 64 bytes, which means
avoiding the malloc / free for all but isoc endpoints, while not wasting
960 bytes / packet for the common case. I'm fine with making the static
buf 1024 bytes.

+    qemu_iovec_add(&async->packet.iov, async->buf, max_len);

There is usb_packet_addbuf() ...

Will fix as soon we know what we want to do with the buffer.

Regards,

Hans



reply via email to

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