Date: Sun, 25 Nov 2007 14:00:40 GMT From: Hans Petter Selasky <hselasky@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 129507 for review Message-ID: <200711251400.lAPE0ewZ099274@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=129507 Change 129507 by hselasky@hselasky_laptop001 on 2007/11/25 14:00:35 Add code that makes UMASS load virtual buffers directly into DMA. Testing did not reveal significantly increased throughput when using this feature. Only less CPU usage. Affected files ... .. //depot/projects/usb/src/sys/dev/usb/umass.c#32 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb/umass.c#32 (text+ko) ==== @@ -121,6 +121,13 @@ #include <cam/cam_periph.h> +#if 0 +/* this enables loading of virtual buffers into DMA */ +#define UMASS_USB_FLAGS .bdma_enable=1,.ext_buffer=1, +#else +#define UMASS_USB_FLAGS +#endif + #ifdef USB_DEBUG #define DIF(m, x) \ do { \ @@ -1097,7 +1104,7 @@ .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, .bufsize = UMASS_BULK_SIZE, - .flags = {.proxy_buffer = 1,.short_xfer_ok = 1,}, + .flags = {.proxy_buffer = 1,.short_xfer_ok = 1, UMASS_USB_FLAGS}, .callback = &umass_t_bbb_data_read_callback, .timeout = 0, /* overwritten later */ }, @@ -1117,7 +1124,7 @@ .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, .bufsize = UMASS_BULK_SIZE, - .flags = {.proxy_buffer = 1,.short_xfer_ok = 1,}, + .flags = {.proxy_buffer = 1,.short_xfer_ok = 1, UMASS_USB_FLAGS}, .callback = &umass_t_bbb_data_write_callback, .timeout = 0, /* overwritten later */ }, @@ -1195,7 +1202,7 @@ .endpoint = UE_ADDR_ANY, .direction = UE_DIR_IN, .bufsize = UMASS_BULK_SIZE, - .flags = {.proxy_buffer = 1,.short_xfer_ok = 1,}, + .flags = {.proxy_buffer = 1,.short_xfer_ok = 1, UMASS_USB_FLAGS}, .callback = &umass_t_cbi_data_read_callback, .timeout = 0, /* overwritten later */ }, @@ -1215,7 +1222,7 @@ .endpoint = UE_ADDR_ANY, .direction = UE_DIR_OUT, .bufsize = UMASS_BULK_SIZE, - .flags = {.proxy_buffer = 1,.short_xfer_ok = 1,}, + .flags = {.proxy_buffer = 1,.short_xfer_ok = 1, UMASS_USB_FLAGS}, .callback = &umass_t_cbi_data_write_callback, .timeout = 0, /* overwritten later */ }, @@ -1893,9 +1900,10 @@ switch (USBD_GET_STATE(xfer)) { case USBD_ST_TRANSFERRED: - usbd_copy_out(&(xfer->buf_data), 0, - sc->sc_transfer.data_ptr, xfer->actlen); - + if (!xfer->flags.bdma_enable) { + usbd_copy_out(&(xfer->buf_data), 0, + sc->sc_transfer.data_ptr, xfer->actlen); + } sc->sc_transfer.data_rem -= xfer->actlen; sc->sc_transfer.data_ptr += xfer->actlen; sc->sc_transfer.actlen += xfer->actlen; @@ -1918,6 +1926,10 @@ xfer->timeout = sc->sc_transfer.data_timeout; xfer->frlengths[0] = max_bulk; + if (xfer->flags.bdma_enable) { + usbd_set_frame_data(xfer, sc->sc_transfer.data_ptr, + max_bulk, 0); + } usbd_start_hardware(xfer); return; @@ -1970,8 +1982,13 @@ xfer->timeout = sc->sc_transfer.data_timeout; xfer->frlengths[0] = max_bulk; - usbd_copy_in(&(xfer->buf_data), 0, - sc->sc_transfer.data_ptr, max_bulk); + if (xfer->flags.bdma_enable) { + usbd_set_frame_data(xfer, sc->sc_transfer.data_ptr, + max_bulk, 0); + } else { + usbd_copy_in(&(xfer->buf_data), 0, + sc->sc_transfer.data_ptr, max_bulk); + } usbd_start_hardware(xfer); return; @@ -2386,9 +2403,10 @@ switch (USBD_GET_STATE(xfer)) { case USBD_ST_TRANSFERRED: - usbd_copy_out(&(xfer->buf_data), 0, - sc->sc_transfer.data_ptr, xfer->actlen); - + if (!xfer->flags.bdma_enable) { + usbd_copy_out(&(xfer->buf_data), 0, + sc->sc_transfer.data_ptr, xfer->actlen); + } sc->sc_transfer.data_rem -= xfer->actlen; sc->sc_transfer.data_ptr += xfer->actlen; sc->sc_transfer.actlen += xfer->actlen; @@ -2463,8 +2481,13 @@ } xfer->timeout = sc->sc_transfer.data_timeout; - usbd_copy_in(&(xfer->buf_data), 0, - sc->sc_transfer.data_ptr, max_bulk); + if (xfer->flags.bdma_enable) { + usbd_set_frame_data(xfer, sc->sc_transfer.data_ptr, + max_bulk, 0); + } else { + usbd_copy_in(&(xfer->buf_data), 0, + sc->sc_transfer.data_ptr, max_bulk); + } xfer->frlengths[0] = max_bulk; usbd_start_hardware(xfer);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200711251400.lAPE0ewZ099274>