On Wed, Mar 18, 2020 at 01:41:06PM +0100, Patrick Wildt wrote: > On Wed, Mar 18, 2020 at 11:22:40AM +0100, Patrick Wildt wrote: > > Hi, > > > > I've spent a few days investigating why USB ethernet adapters are so > > horribly slow on my ARMs. Using dt(4) I realized that it was spending > > most of its time in memcpy. But, why? As it turns out, all USB data > > buffers are mapped COHERENT, which on some/most ARMs means uncached. > > Using cached data buffers makes the performance rise from 20 mbit/s to > > 200 mbit/s. Quite a difference. > > > > sys/dev/usb/usb_mem.c: > > error = bus_dmamem_map(tag, p->segs, p->nsegs, p->size, > > &p->kaddr, BUS_DMA_NOWAIT|BUS_DMA_COHERENT); > > > > On x86, COHERENT is essentially a no-op. On ARM, it depends on the SoC. > > Some SoCs have cache-coherent USB controllers, some don't. Mine does > > not, so mapping it COHERENT means uncached and thus slow. > > > > Why do we do that? Well, when the code was imported in 99, it was > > already there. Since then we have gained infrastructure for DMA > > syncs in the USB stack, which I think are proper. > > > > sys/dev/usb/usbdi.c - usbd_transfer() (before transfer) > > > > if (!usbd_xfer_isread(xfer)) { > > if ((xfer->flags & USBD_NO_COPY) == 0) > > memcpy(KERNADDR(&xfer->dmabuf, 0), xfer->buffer, > > xfer->length); > > usb_syncmem(&xfer->dmabuf, 0, xfer->length, > > BUS_DMASYNC_PREWRITE); > > } else > > usb_syncmem(&xfer->dmabuf, 0, xfer->length, > > BUS_DMASYNC_PREREAD); > > err = pipe->methods->transfer(xfer); > > > > sys/dev/usb/usbdi.c - usb_transfer_complete() (after transfer) > > > > if (xfer->actlen != 0) { > > if (usbd_xfer_isread(xfer)) { > > usb_syncmem(&xfer->dmabuf, 0, xfer->actlen, > > BUS_DMASYNC_POSTREAD); > > if (!(xfer->flags & USBD_NO_COPY)) > > memcpy(xfer->buffer, KERNADDR(&xfer->dmabuf, 0), > > xfer->actlen); > > } else > > usb_syncmem(&xfer->dmabuf, 0, xfer->actlen, > > BUS_DMASYNC_POSTWRITE); > > } > > > > We cannot just remove COHERENT, since some drivers, like ehci(4), use > > the same backend to allocate their rings. And I can't vouch for those > > drivers' sanity. > > > > As a first step, I would like to go ahead with another solution, which > > is based on a diff from Marius Strobl, who added those syncs in the > > first place. Essentially it splits the memory handling into cacheable > > and non-cacheable blocks. The USB data transfers and everyone who uses > > usbd_alloc_buffer() then use cacheable buffers, while code like ehci(4) > > still don't. This is a bit of a safer approach imho, since we don't > > hurt the controller drivers, but speed up the data buffers. > > > > Once we have verified that there are no regressions, we can adjust > > ehci(4) and the like, add proper syncs, make sure they still work as > > well as before, and maybe then back this out again. > > > > Keep note that this is all a no-op on X86, but all the other archs will > > profit from this. > > > > ok? > > > > Patrick > > Update diff with inverted logic. kettenis@ argues that we should > invert the logic, and those who need COHERENT memory should ask > for that explicitly, since for bus_dmamem_map() it also needs to > be passed explicitly. This also points out all those users that > use usb_allocmem() internally, where we might want to have a look > if COHERENT is actually needed or not, or if it can be refactored > in another way.
These commits broke usb on imx.6 with cubox: imxehci0 at simplebus3 usb0 at imxehci0: USB revision 2.0 usb0: root hub problem imxehci1 at simplebus3 usb1 at imxehci1: USB revision 2.0 usb1: root hub problem "usbmisc" at simplebus3 not configured After reverting them I can use filesystems on usb again. diff --git sys/dev/usb/dwc2/dwc2.c sys/dev/usb/dwc2/dwc2.c index 6ca3cc658e5..6f035467213 100644 --- sys/dev/usb/dwc2/dwc2.c +++ sys/dev/usb/dwc2/dwc2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dwc2.c,v 1.51 2020/03/21 12:08:31 patrick Exp $ */ +/* $OpenBSD: dwc2.c,v 1.49 2019/11/27 11:16:59 mpi Exp $ */ /* $NetBSD: dwc2.c,v 1.32 2014/09/02 23:26:20 macallan Exp $ */ /*- @@ -474,7 +474,7 @@ dwc2_open(struct usbd_pipe *pipe) case UE_CONTROL: pipe->methods = &dwc2_device_ctrl_methods; err = usb_allocmem(&sc->sc_bus, sizeof(usb_device_request_t), - 0, USB_DMA_COHERENT, &dpipe->req_dma); + 0, &dpipe->req_dma); if (err) return err; break; diff --git sys/dev/usb/dwc2/dwc2_hcd.c sys/dev/usb/dwc2/dwc2_hcd.c index ab76de7d766..7e5c91481d5 100644 --- sys/dev/usb/dwc2/dwc2_hcd.c +++ sys/dev/usb/dwc2/dwc2_hcd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dwc2_hcd.c,v 1.22 2020/03/21 12:08:31 patrick Exp $ */ +/* $OpenBSD: dwc2_hcd.c,v 1.20 2017/09/08 05:36:53 deraadt Exp $ */ /* $NetBSD: dwc2_hcd.c,v 1.15 2014/11/24 10:14:14 skrll Exp $ */ /* @@ -680,7 +680,7 @@ STATIC int dwc2_hc_setup_align_buf(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh, qh->dw_align_buf = NULL; qh->dw_align_buf_dma = 0; err = usb_allocmem(&hsotg->hsotg_sc->sc_bus, buf_size, buf_size, - USB_DMA_COHERENT, &qh->dw_align_buf_usbdma); + &qh->dw_align_buf_usbdma); if (!err) { struct usb_dma *ud = &qh->dw_align_buf_usbdma; @@ -2269,7 +2269,6 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg, if (hsotg->core_params->dma_enable > 0) { retval = usb_allocmem(&hsotg->hsotg_sc->sc_bus, DWC2_HCD_STATUS_BUF_SIZE, 0, - USB_DMA_COHERENT, &hsotg->status_buf_usbdma); if (!retval) { hsotg->status_buf = KERNADDR(&hsotg->status_buf_usbdma, 0); diff --git sys/dev/usb/dwc2/dwc2_hcdddma.c sys/dev/usb/dwc2/dwc2_hcdddma.c index 4355fd2d30a..d8584eed50d 100644 --- sys/dev/usb/dwc2/dwc2_hcdddma.c +++ sys/dev/usb/dwc2/dwc2_hcdddma.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dwc2_hcdddma.c,v 1.16 2020/03/21 12:08:31 patrick Exp $ */ +/* $OpenBSD: dwc2_hcdddma.c,v 1.14 2017/09/08 05:36:53 deraadt Exp $ */ /* $NetBSD: dwc2_hcdddma.c,v 1.6 2014/04/03 06:34:58 skrll Exp $ */ /* @@ -104,7 +104,7 @@ STATIC int dwc2_desc_list_alloc(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh, qh->desc_list = NULL; err = usb_allocmem(&hsotg->hsotg_sc->sc_bus, sizeof(struct dwc2_hcd_dma_desc) * dwc2_max_desc_num(qh), 0, - USB_DMA_COHERENT, &qh->desc_list_usbdma); + &qh->desc_list_usbdma); if (!err) { qh->desc_list = KERNADDR(&qh->desc_list_usbdma, 0); @@ -144,7 +144,7 @@ STATIC int dwc2_frame_list_alloc(struct dwc2_hsotg *hsotg, gfp_t mem_flags) /* XXXNH - struct pool */ hsotg->frame_list = NULL; err = usb_allocmem(&hsotg->hsotg_sc->sc_bus, 4 * FRLISTEN_64_SIZE, - 0, USB_DMA_COHERENT, &hsotg->frame_list_usbdma); + 0, &hsotg->frame_list_usbdma); if (!err) { hsotg->frame_list = KERNADDR(&hsotg->frame_list_usbdma, 0); diff --git sys/dev/usb/ehci.c sys/dev/usb/ehci.c index a352d83eaf4..4bfea89233a 100644 --- sys/dev/usb/ehci.c +++ sys/dev/usb/ehci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ehci.c,v 1.209 2020/03/30 22:29:04 krw Exp $ */ +/* $OpenBSD: ehci.c,v 1.206 2020/02/22 14:01:34 jasper Exp $ */ /* $NetBSD: ehci.c,v 1.66 2004/06/30 03:11:56 mycroft Exp $ */ /* @@ -356,7 +356,7 @@ ehci_init(struct ehci_softc *sc) return (USBD_IOERROR); } err = usb_allocmem(&sc->sc_bus, sc->sc_flsize * sizeof(ehci_link_t), - EHCI_FLALIGN_ALIGN, USB_DMA_COHERENT, &sc->sc_fldma); + EHCI_FLALIGN_ALIGN, &sc->sc_fldma); if (err) return (err); DPRINTF(("%s: flsize=%d\n", sc->sc_bus.bdev.dv_xname,sc->sc_flsize)); @@ -1470,7 +1470,7 @@ ehci_open(struct usbd_pipe *pipe) switch (xfertype) { case UE_CONTROL: err = usb_allocmem(&sc->sc_bus, sizeof(usb_device_request_t), - 0, USB_DMA_COHERENT, &epipe->u.ctl.reqdma); + 0, &epipe->u.ctl.reqdma); if (err) { ehci_free_sqh(sc, sqh); return (err); @@ -2258,7 +2258,7 @@ ehci_alloc_sqh(struct ehci_softc *sc) if (sc->sc_freeqhs == NULL) { DPRINTFN(2, ("ehci_alloc_sqh: allocating chunk\n")); err = usb_allocmem(&sc->sc_bus, EHCI_SQH_SIZE * EHCI_SQH_CHUNK, - EHCI_PAGE_SIZE, USB_DMA_COHERENT, &dma); + EHCI_PAGE_SIZE, &dma); if (err) goto out; for (i = 0; i < EHCI_SQH_CHUNK; i++) { @@ -2306,7 +2306,7 @@ ehci_alloc_sqtd(struct ehci_softc *sc) if (sc->sc_freeqtds == NULL) { DPRINTFN(2, ("ehci_alloc_sqtd: allocating chunk\n")); err = usb_allocmem(&sc->sc_bus, EHCI_SQTD_SIZE*EHCI_SQTD_CHUNK, - EHCI_PAGE_SIZE, USB_DMA_COHERENT, &dma); + EHCI_PAGE_SIZE, &dma); if (err) goto out; for(i = 0; i < EHCI_SQTD_CHUNK; i++) { @@ -2532,7 +2532,7 @@ ehci_alloc_itd(struct ehci_softc *sc) if (freeitd == NULL) { err = usb_allocmem(&sc->sc_bus, EHCI_ITD_SIZE * EHCI_ITD_CHUNK, - EHCI_PAGE_SIZE, USB_DMA_COHERENT, &dma); + EHCI_PAGE_SIZE, &dma); if (err) { splx(s); return (NULL); diff --git sys/dev/usb/ohci.c sys/dev/usb/ohci.c index 7aa2303eabd..ad3a9811a9c 100644 --- sys/dev/usb/ohci.c +++ sys/dev/usb/ohci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ohci.c,v 1.160 2020/03/21 12:08:31 patrick Exp $ */ +/* $OpenBSD: ohci.c,v 1.158 2020/02/22 14:01:34 jasper Exp $ */ /* $NetBSD: ohci.c,v 1.139 2003/02/22 05:24:16 tsutsui Exp $ */ /* $FreeBSD: src/sys/dev/usb/ohci.c,v 1.22 1999/11/17 22:33:40 n_hibma Exp $ */ @@ -395,7 +395,7 @@ ohci_alloc_sed(struct ohci_softc *sc) if (sc->sc_freeeds == NULL) { DPRINTFN(2, ("ohci_alloc_sed: allocating chunk\n")); err = usb_allocmem(&sc->sc_bus, OHCI_SED_SIZE * OHCI_SED_CHUNK, - OHCI_ED_ALIGN, USB_DMA_COHERENT, &dma); + OHCI_ED_ALIGN, &dma); if (err) goto out; for (i = 0; i < OHCI_SED_CHUNK; i++) { @@ -440,7 +440,7 @@ ohci_alloc_std(struct ohci_softc *sc) if (sc->sc_freetds == NULL) { DPRINTFN(2, ("ohci_alloc_std: allocating chunk\n")); err = usb_allocmem(&sc->sc_bus, OHCI_STD_SIZE * OHCI_STD_CHUNK, - OHCI_TD_ALIGN, USB_DMA_COHERENT, &dma); + OHCI_TD_ALIGN, &dma); if (err) goto out; for (i = 0; i < OHCI_STD_CHUNK; i++) { @@ -598,7 +598,7 @@ ohci_alloc_sitd(struct ohci_softc *sc) if (sc->sc_freeitds == NULL) { DPRINTFN(2, ("ohci_alloc_sitd: allocating chunk\n")); err = usb_allocmem(&sc->sc_bus, OHCI_SITD_SIZE * OHCI_SITD_CHUNK, - OHCI_ITD_ALIGN, USB_DMA_COHERENT, &dma); + OHCI_ITD_ALIGN, &dma); if (err) return (NULL); s = splusb(); @@ -728,8 +728,8 @@ ohci_init(struct ohci_softc *sc) /* XXX determine alignment by R/W */ /* Allocate the HCCA area. */ - err = usb_allocmem(&sc->sc_bus, OHCI_HCCA_SIZE, OHCI_HCCA_ALIGN, - USB_DMA_COHERENT, &sc->sc_hccadma); + err = usb_allocmem(&sc->sc_bus, OHCI_HCCA_SIZE, + OHCI_HCCA_ALIGN, &sc->sc_hccadma); if (err) return (err); sc->sc_hcca = KERNADDR(&sc->sc_hccadma, 0); @@ -1933,8 +1933,7 @@ ohci_open(struct usbd_pipe *pipe) pipe->methods = &ohci_device_ctrl_methods; err = usb_allocmem(&sc->sc_bus, sizeof(usb_device_request_t), - 0, USB_DMA_COHERENT, - &opipe->u.ctl.reqdma); + 0, &opipe->u.ctl.reqdma); if (err) goto bad; s = splusb(); diff --git sys/dev/usb/uhci.c sys/dev/usb/uhci.c index bae6c1b81a9..47e6d1678c0 100644 --- sys/dev/usb/uhci.c +++ sys/dev/usb/uhci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uhci.c,v 1.151 2020/03/21 12:08:31 patrick Exp $ */ +/* $OpenBSD: uhci.c,v 1.149 2020/02/22 14:01:34 jasper Exp $ */ /* $NetBSD: uhci.c,v 1.172 2003/02/23 04:19:26 simonb Exp $ */ /* $FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $ */ @@ -379,7 +379,7 @@ uhci_init(struct uhci_softc *sc) /* Allocate and initialize real frame array. */ err = usb_allocmem(&sc->sc_bus, UHCI_FRAMELIST_COUNT * sizeof(uhci_physaddr_t), - UHCI_FRAMELIST_ALIGN, USB_DMA_COHERENT, &sc->sc_dma); + UHCI_FRAMELIST_ALIGN, &sc->sc_dma); if (err) return (err); sc->sc_pframes = KERNADDR(&sc->sc_dma, 0); @@ -1415,7 +1415,7 @@ uhci_alloc_std(struct uhci_softc *sc) if (sc->sc_freetds == NULL) { DPRINTFN(2,("uhci_alloc_std: allocating chunk\n")); err = usb_allocmem(&sc->sc_bus, UHCI_STD_SIZE * UHCI_STD_CHUNK, - UHCI_TD_ALIGN, USB_DMA_COHERENT, &dma); + UHCI_TD_ALIGN, &dma); if (err) goto out; for(i = 0; i < UHCI_STD_CHUNK; i++) { @@ -1469,7 +1469,7 @@ uhci_alloc_sqh(struct uhci_softc *sc) if (sc->sc_freeqhs == NULL) { DPRINTFN(2, ("uhci_alloc_sqh: allocating chunk\n")); err = usb_allocmem(&sc->sc_bus, UHCI_SQH_SIZE * UHCI_SQH_CHUNK, - UHCI_QH_ALIGN, USB_DMA_COHERENT, &dma); + UHCI_QH_ALIGN, &dma); if (err) goto out; for (i = 0; i < UHCI_SQH_CHUNK; i++) { @@ -2652,8 +2652,7 @@ uhci_open(struct usbd_pipe *pipe) } err = usb_allocmem(&sc->sc_bus, sizeof(usb_device_request_t), - 0, USB_DMA_COHERENT, - &upipe->u.ctl.reqdma); + 0, &upipe->u.ctl.reqdma); if (err) { uhci_free_sqh(sc, upipe->u.ctl.sqh); uhci_free_std(sc, upipe->u.ctl.setup); diff --git sys/dev/usb/usb_mem.c sys/dev/usb/usb_mem.c index d0b37e54766..c65906b43f4 100644 --- sys/dev/usb/usb_mem.c +++ sys/dev/usb/usb_mem.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usb_mem.c,v 1.34 2020/03/21 12:08:31 patrick Exp $ */ +/* $OpenBSD: usb_mem.c,v 1.32 2018/12/05 17:41:23 gerhard Exp $ */ /* $NetBSD: usb_mem.c,v 1.26 2003/02/01 06:23:40 thorpej Exp $ */ /* @@ -72,7 +72,7 @@ struct usb_frag_dma { }; usbd_status usb_block_allocmem(bus_dma_tag_t, size_t, size_t, - struct usb_dma_block **, int); + struct usb_dma_block **); void usb_block_freemem(struct usb_dma_block *); LIST_HEAD(, usb_dma_block) usb_blk_freelist = @@ -84,7 +84,7 @@ LIST_HEAD(, usb_frag_dma) usb_frag_freelist = usbd_status usb_block_allocmem(bus_dma_tag_t tag, size_t size, size_t align, - struct usb_dma_block **dmap, int coherent) + struct usb_dma_block **dmap) { int error; struct usb_dma_block *p; @@ -96,8 +96,7 @@ usb_block_allocmem(bus_dma_tag_t tag, size_t size, size_t align, s = splusb(); /* First check the free list. */ for (p = LIST_FIRST(&usb_blk_freelist); p; p = LIST_NEXT(p, next)) { - if (p->tag == tag && p->size >= size && p->align >= align && - p->coherent == coherent) { + if (p->tag == tag && p->size >= size && p->align >= align) { LIST_REMOVE(p, next); usb_blk_nfree--; splx(s); @@ -117,7 +116,6 @@ usb_block_allocmem(bus_dma_tag_t tag, size_t size, size_t align, p->tag = tag; p->size = size; p->align = align; - p->coherent = coherent; error = bus_dmamem_alloc(tag, p->size, align, 0, p->segs, nitems(p->segs), &p->nsegs, BUS_DMA_NOWAIT); @@ -125,8 +123,7 @@ usb_block_allocmem(bus_dma_tag_t tag, size_t size, size_t align, goto free0; error = bus_dmamem_map(tag, p->segs, p->nsegs, p->size, - &p->kaddr, BUS_DMA_NOWAIT | (coherent ? - BUS_DMA_COHERENT : 0)); + &p->kaddr, BUS_DMA_NOWAIT|BUS_DMA_COHERENT); if (error) goto free1; @@ -184,25 +181,20 @@ usb_block_freemem(struct usb_dma_block *p) } usbd_status -usb_allocmem(struct usbd_bus *bus, size_t size, size_t align, int flags, - struct usb_dma *p) +usb_allocmem(struct usbd_bus *bus, size_t size, size_t align, struct usb_dma *p) { bus_dma_tag_t tag = bus->dmatag; usbd_status err; struct usb_frag_dma *f; struct usb_dma_block *b; - int coherent; int i; int s; - coherent = !!(flags & USB_DMA_COHERENT); - /* If the request is large then just use a full block. */ if (size > USB_MEM_SMALL || align > USB_MEM_SMALL) { DPRINTFN(1, ("%s: large alloc %d\n", __func__, (int)size)); size = (size + USB_MEM_BLOCK - 1) & ~(USB_MEM_BLOCK - 1); - err = usb_block_allocmem(tag, size, align, &p->block, - coherent); + err = usb_block_allocmem(tag, size, align, &p->block); if (!err) { p->block->frags = NULL; p->offs = 0; @@ -213,12 +205,11 @@ usb_allocmem(struct usbd_bus *bus, size_t size, size_t align, int flags, s = splusb(); /* Check for free fragments. */ for (f = LIST_FIRST(&usb_frag_freelist); f; f = LIST_NEXT(f, next)) - if (f->block->tag == tag && f->block->coherent == coherent) + if (f->block->tag == tag) break; if (f == NULL) { DPRINTFN(1, ("usb_allocmem: adding fragments\n")); - err = usb_block_allocmem(tag, USB_MEM_BLOCK, USB_MEM_SMALL, &b, - coherent); + err = usb_block_allocmem(tag, USB_MEM_BLOCK, USB_MEM_SMALL,&b); if (err) { splx(s); return (err); diff --git sys/dev/usb/usb_mem.h sys/dev/usb/usb_mem.h index 98a221eae9a..1ae933f4bd9 100644 --- sys/dev/usb/usb_mem.h +++ sys/dev/usb/usb_mem.h @@ -1,4 +1,4 @@ -/* $OpenBSD: usb_mem.h,v 1.17 2020/03/21 12:08:31 patrick Exp $ */ +/* $OpenBSD: usb_mem.h,v 1.15 2016/11/30 10:19:18 mpi Exp $ */ /* $NetBSD: usb_mem.h,v 1.20 2003/05/03 18:11:42 wiz Exp $ */ /* $FreeBSD: src/sys/dev/usb/usb_mem.h,v 1.9 1999/11/17 22:33:47 n_hibma Exp $ */ @@ -40,7 +40,6 @@ struct usb_dma_block { caddr_t kaddr; bus_dma_segment_t segs[1]; int nsegs; - int coherent; size_t size; size_t align; struct usb_frag_dma *frags; @@ -51,7 +50,6 @@ struct usb_dma_block { #define KERNADDR(dma, o) \ ((void *)((char *)((dma)->block->kaddr + (dma)->offs) + (o))) -usbd_status usb_allocmem(struct usbd_bus *, size_t, size_t, int, - struct usb_dma *); +usbd_status usb_allocmem(struct usbd_bus *,size_t,size_t, struct usb_dma *); void usb_freemem(struct usbd_bus *, struct usb_dma *); void usb_syncmem(struct usb_dma *, bus_addr_t, bus_size_t, int); diff --git sys/dev/usb/usbdi.c sys/dev/usb/usbdi.c index 5161afc21e5..aba1220103f 100644 --- sys/dev/usb/usbdi.c +++ sys/dev/usb/usbdi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usbdi.c,v 1.104 2020/03/21 12:08:31 patrick Exp $ */ +/* $OpenBSD: usbdi.c,v 1.103 2020/02/22 14:01:35 jasper Exp $ */ /* $NetBSD: usbdi.c,v 1.103 2002/09/27 15:37:38 provos Exp $ */ /* $FreeBSD: src/sys/dev/usb/usbdi.c,v 1.28 1999/11/17 22:33:49 n_hibma Exp $ */ @@ -305,7 +305,7 @@ usbd_transfer(struct usbd_xfer *xfer) if (xfer->rqflags & URQ_AUTO_DMABUF) printf("usbd_transfer: has old buffer!\n"); #endif - err = usb_allocmem(bus, xfer->length, 0, 0, &xfer->dmabuf); + err = usb_allocmem(bus, xfer->length, 0, &xfer->dmabuf); if (err) return (err); xfer->rqflags |= URQ_AUTO_DMABUF; @@ -389,7 +389,7 @@ usbd_alloc_buffer(struct usbd_xfer *xfer, u_int32_t size) if (xfer->rqflags & (URQ_DEV_DMABUF | URQ_AUTO_DMABUF)) printf("usbd_alloc_buffer: xfer already has a buffer\n"); #endif - err = usb_allocmem(bus, size, 0, 0, &xfer->dmabuf); + err = usb_allocmem(bus, size, 0, &xfer->dmabuf); if (err) return (NULL); xfer->rqflags |= URQ_DEV_DMABUF; diff --git sys/dev/usb/usbdivar.h sys/dev/usb/usbdivar.h index 5aa207818f7..6600c402979 100644 --- sys/dev/usb/usbdivar.h +++ sys/dev/usb/usbdivar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: usbdivar.h,v 1.81 2020/03/21 12:08:31 patrick Exp $ */ +/* $OpenBSD: usbdivar.h,v 1.79 2018/11/27 14:56:09 mpi Exp $ */ /* $NetBSD: usbdivar.h,v 1.70 2002/07/11 21:14:36 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/usbdivar.h,v 1.11 1999/11/17 22:33:51 n_hibma Exp $ */ @@ -47,7 +47,6 @@ struct usb_dma_block; struct usb_dma { struct usb_dma_block *block; u_int offs; -#define USB_DMA_COHERENT (1 << 0) }; struct usbd_xfer;