On Sun, Nov 17, 2019 at 12:36:49PM +0100, Marcus Glocker wrote:
> While recently testing UDL on XHCI I faced a lot of USB timeouts, and
> therefore screen rendering issues.
> The reason is that XHCI currently only supports single bulk transfers
> up to 64k, while UDL can schedule a bulk transfer up to 1m.
>
> The following diff adds XHCI bulk transfer support >64k and makes UDL
> work fine for me on XHCI.
>
> mpi@ already did an initial re-view, and I have adapted some of his
> comments already in this diff.
>
> More testing and comments welcome.
After patrick@ did feedback that the current bulk transfer code in
XHCI should also work for larger transfers as is, we have found the
bug which resulted in a much smaller diff :-)
Attached for your reference. It just has been committed.
Index: xhci.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/xhci.c,v
retrieving revision 1.106
diff -u -p -u -p -r1.106 xhci.c
--- xhci.c 6 Oct 2019 17:30:00 -0000 1.106
+++ xhci.c 18 Nov 2019 19:32:30 -0000
@@ -2871,7 +2871,7 @@ xhci_device_generic_start(struct usbd_xf
/* If the buffer crosses a 64k boundary, we need one more. */
len = XHCI_TRB_MAXSIZE - (paddr & (XHCI_TRB_MAXSIZE - 1));
if (len < xfer->length)
- ntrb++;
+ ntrb = howmany(xfer->length - len, XHCI_TRB_MAXSIZE) + 1;
else
len = xfer->length;