public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] usb: xhci: Queue URB_ZERO_PACKET as one TD
@ 2025-09-08 11:01 Michal Pecio
  2025-09-08 11:02 ` [PATCH 1/1] " Michal Pecio
  2025-09-09 13:04 ` [PATCH 0/1] " Mathias Nyman
  0 siblings, 2 replies; 9+ messages in thread
From: Michal Pecio @ 2025-09-08 11:01 UTC (permalink / raw)
  To: Mathias Nyman; +Cc: linux-usb, linux-kernel

Hi Mathias,

I wanted to finish and send v2 of "Simplify TD cancellation and drop
some states" over the weekend, but I encountered an annoying roadblock
and I need your input.

Basically, there is a bug: URB_ZERO_PACKET is queued as two TDs, and
when the first TD halts, the driver simply advances to the second one.

I found that extending the event handler to cover this case requires
multiple changes:

1. obviously, all TDs must be cancelled, not just the current one
2. they may be given back in weird order (waiting for Set Deq), so
   we need to store the status on urb_priv and override td->status
3. xhci_invalidate_cancelled_tds() would need to recognize multiple
   halted TDs on the same URB as valid

This is doable, and I have already implemented most of it in that
series, but there is an alternative solution: simply stop worrying
about halted multi-TD URBs, because this is the only case and it
can be converted to pretend that it's just one TD per URB as usual.

If you are OK with this patch, cancellation logic will be simpler,
because this time there really are no remaining cases of multi-TD
URBs except isochronous. This is clear in xhci_urb_enqueue():

        if (usb_endpoint_xfer_isoc(&urb->ep->desc))
                num_tds = urb->number_of_packets;
        else         
                num_tds = 1;

Regards,
Michal

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-09-22  8:16 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-08 11:01 [PATCH 0/1] usb: xhci: Queue URB_ZERO_PACKET as one TD Michal Pecio
2025-09-08 11:02 ` [PATCH 1/1] " Michal Pecio
2025-09-09 13:04 ` [PATCH 0/1] " Mathias Nyman
2025-09-09 17:38   ` Michal Pecio
2025-09-09 22:57     ` Mathias Nyman
2025-09-10  0:03       ` Michal Pecio
2025-09-10  0:15         ` Michal Pecio
2025-09-10 21:37           ` Michal Pecio
2025-09-22  8:16       ` Michal Pecio

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox