On Thu, 26 Feb 2015, Mathias Nyman wrote: > On 26.02.2015 16:57, Alan Stern wrote: > > On Thu, 26 Feb 2015, Mathias Nyman wrote: > > > >> I'm starting to like your idea of setting the urb->actual_length in advance, > >> It may actually simplify things. > > > > But it will make unlinking more difficult. Also, what will you do if > > there is more than one TRB? > > > > current xhci driver can't handle more than one data trb in control tranfers: > xhci-ring.c, Yes, that's right. I was thinking about bulk transfers. I guess they don't suffer from this problem, though. > Shouldn't control urbs only be given back when they finish (SUCCESS, STALL, SHORT etc), > are dequeued, or some major host failure causes us to empty the rings? Yes. In fact, that's true for every URB, not just control. > I thought it would be enough to set urb->actual_length = 0 for the ctrl URBs in all other > cases than short or successful completion? urb->actual_length should always be set to the number of bytes actually transferred, as closely as you can tell. For example, suppose you have a 1500-byte transfer. If the first packet successfully sends 1024 bytes but the second packet fails (so the entire URB fails), actual_length should be set to 1024. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html