Re: [v2] usb: UHCI: fix pkt size in TD for a non-aligned sg element

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

 



On Sat, Jun 22, 2013 at 12:45 AM, Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:
>> Sorry, could you explain why that won't work? I understand the URBs
>> with maxp-unaligned length still can be completed.
>
> Suppose the SG list has two elements, where the first element's length
> is 1000 (not a multiple of 64) and the second element's length is 512.
> Then usb_sg_init() will create two URBs to carry out the transfer.  The
> transfer_length of the first URB will be 1000 and the transfer_length
> of the second URB will be 512.
>
> When the first URB is submitted to uhci-hcd, it will be broken up into
> 15 TDs of length 64 (the maxpacket size) followed by a TD of length 40.
> The second URB will be broken up into 8 TDs of length 64.
>
> Therefore the device will see 15 full-size packets, a short packet, and
> then 8 more full-size packets.  This is not what you want.

>From view of driver, maybe they only want to transfer 1512 bytes, and
it is hard to say what the driver or device wants. Maybe they don't depend
on the middle short packet at all, maybe they do, who knows?

Denis's patch still can't do what you hope(short packet is at the end of the
transfer), can it?

>
> (By the way, this is exactly what would happen when the same transfer
> is submitted to an HCD that doesn't have SG support, like ohci-hcd.  As
> you can see, the problem doesn't lie in the fact that SG is being used;
> it lies in the fact that the SG element length isn't a multiple of the
> maxpacket length.)
>
>> > Furthermore, URBs using SG can be submitted directly, without going
>> > through usb_sg_init() at all.  So changing usb_sg_init() won't fix the
>> > problem.
>>
>> Looks usbtest use it, so the reported problem can be fixed.
>
> Sometimes it's hard to tell whether you are serious or joking.

I mean other places still can do this way like usb_sg_init().


Thanks,
-- 
Ming Lei
--
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