On 11/25/2014 03:54 PM, Felipe Balbi wrote: > On Tue, Nov 25, 2014 at 02:44:16AM +0100, Ricardo Ribalda Delgado wrote: >>> might be better if you can fix the code, instead. We have a "better" >>> scatter-gather support in the framework itself. >> >> As I understand it, the code was designed to reduce the number of irqs >> when you expect to send X consecutive packages. In that scenario you >> only want an irq at the end. ie, u_ether supports it. It was not >> designed for sg. >> >> The problem is that the driver only allocates one sg descriptor per >> endpoint, without the possibility of chaining the request I dont see > > right, but what I'm is that we don't want the UDC manually allocating SG > lists and moving req->buf to that sg, we want the gadget driver to pass > a properly formatted sg to the UDC. Currently, only UASP implementation > on top of target framework is doing that. Eventually, we should have > more functions passing sgs to the UDC. You don't want to do sg chaining or something like that in the UDC. The driver should enqueue multiple requests and the UDC *might* depending on req->no_interrupt if the requests completion should be signaled by an interrupt. >From browsing the code I can't figure out how the DMA engines learns that it is done if none of the requests generate an interrupt (except it fires an IRQ if all transfers are done and there none pending). Usually you don't want to have them all completed at once but say, you enqueue 4 requests and you want an interrupt after the second and fourth is completed. Another thing: A request for CDC_NCM (or storage) might be 16KiB in size. A *proper* UDC would be able to transfer the whole 16KiB with only one interrupt (not one after each 512 bytes). >> how can this can work. And it does not work on my hw. >> >> If you could confirm what I am saying about the dma_chaining by >> testing it on net2280 then I think we should remote the module >> parameter, because it will only confuse the user and also ofuscates a >> lot the code. > > Unfortunately I don't have net2280 and I keep forgetting if Alan has > net2280 or net2272. The module parameter doesn't make sense. In my opinion it should consider the ->no_interrupt member of the req instead. >>> UDC needs to set gadget->sg_supported and a pointer to the sg should be >>> passed in by the gadget driver through usb_request->sg. >> >> I could try to implement "pure" sg on net2282.c , but I will only be >> able to test it on usb338x hardware. If you could test it later I can >> give it a try. You are very welcome to do so. I'm sure dummy_hcd supports sg and I think dwc3 and maybe musb might as well. And as Felipe said, the only gadget user is uasp. >> Regards! >> >> -- >> Ricardo Ribalda Sebastian -- 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