From mboxrd@z Thu Jan 1 00:00:00 1970 From: Juergen Gross Subject: Re: [Patch RFC 2/4] usb: add flag to USBPacket to request complete callback after isoc transfer Date: Fri, 17 Jul 2015 10:44:45 +0200 Message-ID: <55A8C07D.1010306@suse.com> References: <1437061658-11769-1-git-send-email-jgross@suse.com> <1437061658-11769-3-git-send-email-jgross@suse.com> <1437120751.3689.14.camel@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1437120751.3689.14.camel@redhat.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Gerd Hoffmann Cc: xen-devel@lists.xensource.com, stefano.stabellini@eu.citrix.com List-Id: xen-devel@lists.xenproject.org On 07/17/2015 10:12 AM, Gerd Hoffmann wrote: > On Do, 2015-07-16 at 17:47 +0200, Juergen Gross wrote: >> In order to avoid having to poll for the result of an iso transfer >> add the possibility to request the "complete" callback which is being >> used for bulk transfers as well. > > Sorry for the late notice (didn't do much usb coding recently and forgot > about it): We actually _have_ a notification mechanism already: > usb_wakeup(USBEndpoint *ep, int streamid). That will trigger a > USBPortOps->wakeup callback in the host adapter emulation. > > So, the usb-host change should be as simple as this: > > --- a/hw/usb/host-libusb.c > +++ b/hw/usb/host-libusb.c > @@ -451,6 +451,7 @@ static void usb_host_req_complete_iso(struct > libusb_transfer *transfer) > } > if (xfer->ring->ep->pid == USB_TOKEN_IN) { > QTAILQ_INSERT_TAIL(&xfer->ring->copy, xfer, next); > + usb_wakeup(xfer->ring->ep, 0); > } else { > QTAILQ_INSERT_TAIL(&xfer->ring->unused, xfer, next); > } Hmm, I can see the benefit of this call to avoid polling. OTOH I don't see how to find the packages already processed via this mechanism. To help in my case I'd need: - the call being made in the else clause - some way to have a package reference in the endpoint (assuming to use the bus .endpoint_wakeup callback which is called by usb_wakeup(), too). The problem here is that host-libusb.c would call usb_wakeup() not for each packet, but for each libusb I/O, which is combining multiple packets given to usb_handle_packet(). Juergen