RE: [PATCH v2] usb: xhci: Add support for URB_ZERO_PACKET

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

 



> From: Sarah Sharp
> On Wed, Nov 13, 2013 at 12:28:09PM -0000, David Laight wrote:
> > If URB_ZERO_PACKET is set on a transfer that is an integral number
> > of maximum length packets (1k for USB3 bulk) then an additional
> > zero length fragment must be sent.
> >
> > Merge together the functions that setup single buffer and scatter-gather
> > transfers (they aren't that different) simplifying the logic as well.
> >
> > In particular we note that the number of TRB passed to prepare_ring()
> > need only be an upper limit on the number required. However we do try
> > to only request 1 TRB when we know one is sufficient.
> >
> > Signed-off-by: David Laight <david.laight@xxxxxxxxxx>
> > ---
> > Change for v2:
> > - Ensure we check there is space for 1 TRB for zero length transfer requests.
> >   (The extra TRB is added in the same path that checks URB_ZERO_PACKET).
> >
> > I hope I've edited the patch correctly.
> > I've NFI how to get git to generate modified patches.
> 
> git commit --amend

Thanks

> I'll look over this patch in a couple days.  ISTR that someone else
> submitted a zero-length packet fix patch, so I need to coordinate the
> two.

I don't remember seeing the earlier patch - probably went through a while ago.

For v1.0 the calculation of td_size depends on whether a ZLP is needed.
The td_size calculation was already over-complicated (and used a lot of local
variables). Since td_size is just the number of packets needed to complete
the TD it can be calculated by rounding up the 'length left' provided that
the 'length left' assumed an integral number of packets.
If a ZLP is requested adding one to the TD size causes the correct td_size
to be calculated for all the early TRB. It is then just a matter of getting
the correct test for the last fragment.

	David



--
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