Hello Grant,
On 01/09/15(Tue) 22:26, Grant Czajkowski wrote:
> In ugen(4), bulk reads of length > UGEN_BBSIZE are split into
> multiple transfers. This patch instead sends a single
> transfer utilizing USBD_NO_COPY.
Committed with one tweak below. Do not hesitate to elaborate *why*
you'd like to see such change committed, it might not be obvious to
all the tech@ readers ;)
> @@ -541,14 +541,19 @@ ugen_do_read(struct ugen_softc *sc, int
> xfer = usbd_alloc_xfer(sc->sc_udev);
> if (xfer == 0)
> return (ENOMEM);
> - flags = USBD_SYNCHRONOUS;
> + flags = USBD_SYNCHRONOUS | USBD_NO_COPY;
> if (sce->state & UGEN_SHORT_OK)
> flags |= USBD_SHORT_XFER_OK;
> if (sce->timeout == 0)
> flags |= USBD_CATCH;
> - while ((n = min(UGEN_BBSIZE, uio->uio_resid)) != 0) {
> + if ((n = uio->uio_resid) != 0) {
> + buf = usbd_alloc_buffer(xfer, n);
> + if (buf == 0) {
^^^^
I changed this into "if (buff == NULL)" since we compare pointers to
NULL. I know that ugen(4) needs a bit of cleanup in this regard, feel
free to convert them if you wish :)