On Thu, 21 Jan 2016, Justin DeFields wrote:
> In the start_dma function, I added the following lines at the start of
> the function:
>
> if (req->req.length % ep->ep.maxpacket)
> {
> printk("%s packet is short(%d)...\n", (ep->is_in) ? "IN" : "OUT",
> req->req.length);
> }
>
> The packet is never listed as short via my method above during this
> erroneous data transfer, and yet the logic right below "/* previous
> OUT packet might have been short */", is triggered, and
> req->td->dmadesc = 0 is set, causing the 'paranoia' logic to get
> triggered. Is my logic above a correct method of determining if a
> packet was short, or is there another way for a short OUT packet to be
> triggered that I'm not accounting for (i.e. start_dma is not the
> source of the packet)?
Your method is wrong. req->req.length is the size we _expect_ the
transfer to be, not its actual size. For an IN transfer the two will
be the same unless some sort of error occurs, but for an OUT transfer
they can be very different (the host might send less data than we
expect it to send).
Note also that "transfer" != "packet". Only the last data packet in a
transfer can be short, because a short packet immediately terminates
the transfer it is in.
Alan Stern
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html