Re: [PATCH] usb: gadget: file_storage: don't assume wMaxPacketSize to be 512

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

 



On Tue, Apr 5, 2011 at 11:58 AM, Felipe Balbi <balbi@xxxxxx> wrote:
> Hi,
>
> On Tue, Apr 05, 2011 at 11:50:23AM +0200, Mian Yousaf Kaukab wrote:
>> > @@ -1333,10 +1311,12 @@ static int do_write(struct fsg_dev *fsg)
>> >                        if (amount_left_to_req == 0)
>> >                                get_some_more = 0;
>> >
>> > -                       /* amount is always divisible by 512, hence by
>> > -                        * the bulk-out maxpacket size */
>> > +                       /* Except at the end of the transfer, amount will be
>> > +                        * equal to the buffer size, which is divisible by
>> > +                        * the page size and hence by the bulk-out maxpacket
>> > +                        * size.
>> > +                        */
>> >                        bh->outreq->length = amount;
>> > -                       bh->outreq->short_not_ok = 1;
>>
>> Instead of removing short_not_ok can we use something like following?
>>                            bh->outreq->short_not_ok = (amount % maxp) ? 0 : 1;
>> short_not_ok is useful for example when it is not possible to do DMA
>> tranfers from usb controller's buffer to the memory for unaligned
>> lengths.
>> controller driver can decide to use dma or  pio mode based on if short
>> packets are expected or not.
>
> IMHO, we should avoid PIO as much as possible. Specially with USB3
> comming. It's fairly simple for driver to always set req->length as a
> multiple of wMaxPacketSize and that'll make all controllers happy, not
> only just a few.
I didn't say anything about the req->length ;).  What I am trying to
say is that please do not remove short_not_ok.

Even for the CBW request, it is ok to bring back
set_bulk_out_req_length(). Just make sure that short_not_ok is set to
0 for that.

>
> --
> balbi
>

Thanks,

--
Mian Yousaf Kaukab
--
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