On Sat, 1 May 2010, Matthew Wilcox wrote: > Thanks! The as1368 patch that this is based on lets me do this to the > UAS driver: > > drivers/usb/storage/uas.c | 55 ++++++++------------------------------------ > 1 files changed, 10 insertions(+), 45 deletions(-) > > because I can now take out the code that maps and unmaps the SGL passed > down from SCSI. Also, with just a couple of lines extra, I included > support for OHCI and UHCI controllers (because the USB midlayer handles > an SGL with one element), so this feels like a big win to me. Are you sure about this last part? As things stand currently, the only way to use SG with ohci-hcd or uhci-hcd is by way of usb_sg_init() and friends -- which has the disadvantage of being synchronous and requiring a process context. Although usbcore could be changed so that single-element SG lists would work directly, at the moment they don't (the DMA address needs to be copied from the scatterlist structure into the URB -- is that your couple of extra lines?). Also, there's a matter of efficiency. Right now usb-storage works fine with arbitrary-length SG lists on OHCI or UHCI, because it uses usb_sg_*(). If you change things so that the HCDs advertise native scatter-gather support with a maximum list size of 1, it will cause a big performance hit. Every single SG buffer would require its own SCSI command, whereas now one command can handle lots of buffers together. (We could avoid this performance hit by not using an HCD's native SG support if sg_tablesize is 1, but that's not an attractive hack.) In principle, adding native scatterlist support to uhci-hcd and ohci-hcd wouldn't be very hard -- ading it to ehci-hcd was fairly easy. But I have yet to be convinced that it would be worth the effort. A better approach (and one that would help all the other USB-1.1 HCDs) would be to improve the usb_sg_*() family by adding an asynchronous mode of operation. Pete Zaitcev and I actually implemented this a while back, but it never was submitted or merged. Alan Stern -- 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