Message ID | 20200901084454.28649-9-peter.chen@nxp.com |
---|---|
State | New |
Headers | show |
Series | usb: cdns3: improve the sg use case | expand |
Hi, Peter Chen <peter.chen@nxp.com> writes: > At Android ADB and MTP use case, it uses f_fs which supports scatter list, > it means one request may need several TRBs for it. Besides, TRB consumes > very fast compared to TRB has prepared for above use case, so we need to > enlarge the TRB ring length to avoid "no free TRB error". can you give a little more detail here? How many sg entries do you get with ADB? What's the size of each TRB? How many memory does 600 TRBs actually amount to? How many segments are you using per endpoint?
Hi, Peter Chen <peter.chen@nxp.com> writes: > On 20-09-08 09:32:32, Felipe Balbi wrote: >> >> Hi, >> >> Peter Chen <peter.chen@nxp.com> writes: >> > At Android ADB and MTP use case, it uses f_fs which supports scatter list, >> > it means one request may need several TRBs for it. Besides, TRB consumes >> > very fast compared to TRB has prepared for above use case, so we need to >> > enlarge the TRB ring length to avoid "no free TRB error". >> >> can you give a little more detail here? > > I will. > >> How many sg entries do you get with ADB? What's the size of each TRB? > > I remembered it is about 120 requests for ADB and MTP use case, 16KB for > each sg entry, so four TRBs (4KB/TRB) per sg entry at worst case. I wonder why this isn't a problem for other UDCs, though. I haven't had a similar report on dwc3, where we use 256 (255 + 1 link) TRBs for each endpoint and we never use more than one segment. What you describe here would amount of 480 TRBs worst case. Anyway, this is hypothetical, something to keep an eye for dwc3 users too, I guess. >> How many memory does 600 TRBs >> actually amount to? How many segments are you using per endpoint? >> > > Each TRB consumes 3 * 32 bits = 12 bytes, 600 TRB consumes 7200 bytes. > One segment for each endpoint, one segment includes 600 TRBs. thanks for the info
diff --git a/drivers/usb/cdns3/gadget.h b/drivers/usb/cdns3/gadget.h index 9f8bd452847e..1ccecd237530 100644 --- a/drivers/usb/cdns3/gadget.h +++ b/drivers/usb/cdns3/gadget.h @@ -966,7 +966,7 @@ struct cdns3_usb_regs { /* * USBSS-DEV DMA interface. */ -#define TRBS_PER_SEGMENT 40 +#define TRBS_PER_SEGMENT 600 #define ISO_MAX_INTERVAL 10
At Android ADB and MTP use case, it uses f_fs which supports scatter list, it means one request may need several TRBs for it. Besides, TRB consumes very fast compared to TRB has prepared for above use case, so we need to enlarge the TRB ring length to avoid "no free TRB error". Signed-off-by: Peter Chen <peter.chen@nxp.com> --- drivers/usb/cdns3/gadget.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)