From: Hans de Goede <hdegoede@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/3] usb: Halt ep queue en cancel pending packets on a packet error
Date: Fri, 17 Aug 2012 15:10:52 +0200 [thread overview]
Message-ID: <502E42DC.1000003@redhat.com> (raw)
In-Reply-To: <502E1D47.9090801@redhat.com>
Hi,
On 08/17/2012 12:30 PM, Gerd Hoffmann wrote:
> Hi,
>
>> Note this patch only touches the ehci and uhci controller changes, since AFAIK
>> no other controllers actually queue up multiple transfer. If I'm wrong on this
>> other controllers need to be updated too!
>
> xhci does it too (although it is hard to test as xhci can happily submit
> 256k transfers where ehci and uhci have to use a bunch of smaller
> packets instead).
>
Good point, I'm completely unfamiliar with the xhci code I'm afraid (at some point
in time this will need to change, but not right now), any chance you could fill in
the xhci part of this patch? Feel free to merge it with my patch so as to avoid
having a "broken" state in git.
> Some minor nits below (the other two patches look good):
>
>> + /* Submitting a new packet clears halt */
>> + p->ep->halted = false;
>
> check that the queue is empty when halted is set (i.e. enforce cancel on
> error) ?
Good point will fix.
>
>> +
>> if (QTAILQ_EMPTY(&p->ep->queue) || p->ep->pipeline) {
>> ret = usb_process_one(p);
>> if (ret == USB_RET_ASYNC) {
>> usb_packet_set_state(p, USB_PACKET_ASYNC);
>> QTAILQ_INSERT_TAIL(&p->ep->queue, p, queue);
>> } else {
>> + /*
>> + * When pipelining is enabled usb-devices must always return async,
>> + * otherwise packets can complete out of order!
>> + */
>> + assert(!p->ep->pipeline);
>
> Strictly speaking returning something != async is fine for the first
> package in the queue, but I guess in practice this doesn't matter as
> enabling pipelining doesn't make sense unless you actually go async.
>
>> p->result = ret;
>> usb_packet_set_state(p, USB_PACKET_COMPLETE);
>> }
>> @@ -402,6 +410,20 @@ int usb_handle_packet(USBDevice *dev, USBPacket *p)
>> /* Notify the controller that an async packet is complete. This should only
>> be called for packets previously deferred by returning USB_RET_ASYNC from
>> handle_packet. */
>
> That comments should be ...
>
>> +static void __usb_packet_complete(USBDevice *dev, USBPacket *p)
>> +{
>> + USBEndpoint *ep = p->ep;
>> +
>> + assert(p->result != USB_RET_ASYNC && p->result != USB_RET_NAK);
>> +
>> + if (p->result < 0) {
>> + ep->halted = true;
>> + }
>> + usb_packet_set_state(p, USB_PACKET_COMPLETE);
>> + QTAILQ_REMOVE(&ep->queue, p, queue);
>> + dev->port->ops->complete(dev->port, p);
>> +}
>> +
>
> ... here, where the function for the external users is.
>
Fixed, will send a new version (without the xhci changes) right away, to
cut back on the spam I'm only going to resend 1/3.
Regards,
Hans
next prev parent reply other threads:[~2012-08-17 13:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-17 9:39 [Qemu-devel] [PATCH 1/3] usb: Halt ep queue en cancel pending packets on a packet error Hans de Goede
2012-08-17 9:39 ` [Qemu-devel] [PATCH 2/3] usb: controllers do not need to check for babble themselves Hans de Goede
2012-08-17 9:39 ` [Qemu-devel] [PATCH 3/3] ehci: simplify ehci_state_executing Hans de Goede
2012-08-17 10:30 ` [Qemu-devel] [PATCH 1/3] usb: Halt ep queue en cancel pending packets on a packet error Gerd Hoffmann
2012-08-17 13:10 ` Hans de Goede [this message]
2012-08-17 17:03 ` Andreas Färber
2012-08-18 9:06 ` Hans de Goede
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=502E42DC.1000003@redhat.com \
--to=hdegoede@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).