All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: Jan Kiszka <jan.kiszka@siemens.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] uhci: Use an intermediate buffer for usb packet data
Date: Fri, 26 Apr 2013 16:01:21 +0200	[thread overview]
Message-ID: <517A88B1.4040809@redhat.com> (raw)
In-Reply-To: <517A73CC.8040205@redhat.com>

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	other threads:[~2013-04-26 13:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-25 10:21 [Qemu-devel] [PATCH] uhci: Use an intermediate buffer for usb packet data Hans de Goede
2013-04-26 12:32 ` Gerd Hoffmann
2013-04-26 14:01   ` Hans de Goede [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-05-06  8:48 [Qemu-devel] [PATCH v2 0/1] " Hans de Goede
2013-05-06  8:48 ` [Qemu-devel] [PATCH] " Hans de Goede
2013-05-07 13:36   ` Gerd Hoffmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=517A88B1.4040809@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.