Re: [PATCH 1/2] USB: Allow HCDs to specifiy their DMA alignment requirements

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

 



On Sat, Sep 4, 2010 at 4:46 PM, Ming Lei <tom.leiming@xxxxxxxxx> wrote:
>
> Seems there is very few such cases (buffer is not aligned to the
> HC controller requirement) now, why not fix it in upper driver (do the
> bounce and PIO in interface driver instead of usbcore)?
>
What is the "upper driver"?  (the Host Controller Driver or the usb
"function" driver (usbnet, etc etc). [Is there an accepted non ambiguous
term for this more explicit than just "usb driver"?]

I don't think fixing this in the "function" driver is right - there are too
many of them and they shouldn't need to be concerned with this type
of low level issue. Whether they should be able to discover the low
level requirements to perform _optional_ optimisations is another
question.

Here are the tradeoffs I see between usbcore and HCD implementation:

Advantages of usbcore implementation:
* Single point of implementation for all HCDs that may need it

Currently I think imx21-hcd is the only in tree one but at least
two others not yet in tree have similar requirements. Someone
also reported using this patch for musb but I think there's another
patch out there for that.
There is already a precedent in that usbcore manages bounce
buffers for HCDs requiring "local" memory (HCD_LOCAL_MEM)

* For core mapped buffers no need to sync the buffer before
copying it (since the core can copy the buffer before mapping it)

Advantages of HCD implementation:
* HCD can make "intelligent" decisions (such as using bounce
buffer for large unaligned transfers and PIO for small ones)

* If bounce buffer is implemented in the core it will be allocated
at URB submission time rather than when the hardware needs
it. This will waste memory if multiple URBs are queued
for the same endpoint (each will have a bounce buffer but
only one per endpoint will ever be needed at one time)

I've only just realized this second point and I think it's a
good reason for me to drop this patch and implement it
in the HCD. Unless anyone wants to convince me otherwise :)

Regards,
Martin
--
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