From 34e9cedabfe095c4ca22e92003a9877edeccf08a Mon Sep 17 00:00:00 2001 From: phk Date: Sun, 14 Dec 2008 20:05:03 +0000 Subject: [PATCH] Bump the FTDI receive buffer size to 256 in order to improve throughput. --- sys/dev/usb/uftdi.c | 45 +++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/sys/dev/usb/uftdi.c b/sys/dev/usb/uftdi.c index 5a9921be7f4b..c32bfa6e96ad 100644 --- a/sys/dev/usb/uftdi.c +++ b/sys/dev/usb/uftdi.c @@ -100,7 +100,7 @@ SYSCTL_INT(_hw_usb_uftdi, OID_AUTO, debug, CTLFLAG_RW, * These are the maximum number of bytes transferred per frame. * The output buffer size cannot be increased due to the size encoding. */ -#define UFTDIIBUFSIZE 64 +#define UFTDIIBUFSIZE 256 #define UFTDIOBUFSIZE 64 struct uftdi_softc { @@ -458,32 +458,33 @@ uftdi_read(void *vsc, int portno, u_char **ptr, u_int32_t *count) { struct uftdi_softc *sc = vsc; u_char msr, lsr; + unsigned l; - DPRINTFN(15,("uftdi_read: sc=%p, port=%d count=%d\n", sc, portno, - *count)); + DPRINTFN(15,("uftdi_read: sc=%p, port=%d count=%d\n", + sc, portno, *count)); + while (*count > 0) { + l = *count; + if (l > 64) + l = 64; - msr = FTDI_GET_MSR(*ptr); - lsr = FTDI_GET_LSR(*ptr); + msr = FTDI_GET_MSR(*ptr); + lsr = FTDI_GET_LSR(*ptr); -#ifdef USB_DEBUG - if (*count != 2) - DPRINTFN(10,("uftdi_read: sc=%p, port=%d count=%d data[0]=" - "0x%02x\n", sc, portno, *count, (*ptr)[2])); -#endif + if (sc->sc_msr != msr || + (sc->sc_lsr & FTDI_LSR_MASK) != (lsr & FTDI_LSR_MASK)) { + DPRINTF(("uftdi_read: status change msr=0x%02x(0x%02x) " + "lsr=0x%02x(0x%02x)\n", msr, sc->sc_msr, + lsr, sc->sc_lsr)); + sc->sc_msr = msr; + sc->sc_lsr = lsr; + ucom_status_change(&sc->sc_ucom); + } - if (sc->sc_msr != msr || - (sc->sc_lsr & FTDI_LSR_MASK) != (lsr & FTDI_LSR_MASK)) { - DPRINTF(("uftdi_read: status change msr=0x%02x(0x%02x) " - "lsr=0x%02x(0x%02x)\n", msr, sc->sc_msr, - lsr, sc->sc_lsr)); - sc->sc_msr = msr; - sc->sc_lsr = lsr; - ucom_status_change(&sc->sc_ucom); + if (l > 2) + ucomrxchars(&sc->sc_ucom, (*ptr) + 2, l - 2); + *ptr += l; + *count -= l; } - - /* Pick up status and adjust data part. */ - *ptr += 2; - *count -= 2; } static size_t