RE: musb: Clear_TT_Buffer implementation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It's a good point.

It looks like we'll need to refactor the code quite a bit to change the way qh deallocation
gets done and prevent it before we end any pending Clear_TT_Buffer requests.

Right now qh gets deallocated at a few different places. This means that once in the complete
callback, our clearing_tt flag or the like doesn`t exist anymore.

Any though on this that might help narrow down the scope of the modifications?

François Gervais

> -----Original Message-----
> From: Alan Stern [mailto:stern@xxxxxxxxxxxxxxxxxxx]
> Sent: November 1, 2017 2:48 PM
> To: Gervais, Francois <FGervais@xxxxxxxxxxxxxxxxxxxx>
> Cc: linux-usb@xxxxxxxxxxxxxxx
> Subject: Re: musb: Clear_TT_Buffer implementation
> 
> Please tell your email client to fold lines after 72 columns or so.
> 
> On Wed, 1 Nov 2017, Gervais, Francois wrote:
> 
> > We are running the musb driver on a AM335 cpu paired with a microchip
> hub (USB2412).
> >
> > In one of our use-cases, we have a high chance of having an error on a bulk
> split transaction. Since the musb driver does not implement the clear TT
> buffer it leaves us with a TT buffer full on the hub which in turns NAK any
> new split transactions.
> >
> > To fix this problem, we added the Clear_TT_Buffer handling in case of a
> split transaction error, trying to match the spec as closely as possible.
> >
> > We came up with the following:
> >
> > diff --git a/drivers/usb/musb/musb_host.c
> > b/drivers/usb/musb/musb_host.c index 26bda88..ac1a959 100755
> > --- a/drivers/usb/musb/musb_host.c
> > +++ b/drivers/usb/musb/musb_host.c
> > @@ -376,6 +376,11 @@ static void musb_advance_schedule(struct musb
> *musb, struct urb *urb,
> >                 break;
> >         }
> >
> > +       if ((status || urb->unlinked) &&
> > +           (usb_pipecontrol(urb->pipe) || usb_pipebulk(urb->pipe)) &&
> > +           urb->dev->tt)
> > +               usb_hub_clear_tt_buffer(urb);
> > +
> >         qh->is_ready = 0;
> >         musb_giveback(musb, urb, status);
> >         qh->is_ready = ready;
> >
> > This seems to work in our case but we'd like to get feedback in order to
> improve the patch if needed.
> 
> The patch is incomplete.  You need to register a completion routine, as the
> .clear_tt_buffer_complete member of musb_hc_driver.  This routine will be
> called after the Clear-TT-Buffer request has completed.  Until that happens,
> you must not try to use the TT.
> 
> For an example, see ehci_clear_tt_buffer_complete() in
> drivers/usb/host/ehci-q.c.
> 
> 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



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux