diff options
author | Scott Long <scottl@FreeBSD.org> | 2005-12-10 08:58:48 +0000 |
---|---|---|
committer | Scott Long <scottl@FreeBSD.org> | 2005-12-10 08:58:48 +0000 |
commit | d29dab303f3e8c85c35649b1d28a35f2142f7d6b (patch) | |
tree | 8dff28337ee4c7b067c8c4bc53df37ffcbfcbd17 | |
parent | 82dbbc4120de9c553521586ee901db0cac50ff28 (diff) | |
download | src-d29dab303f3e8c85c35649b1d28a35f2142f7d6b.tar.gz src-d29dab303f3e8c85c35649b1d28a35f2142f7d6b.zip |
Allocate the jumbo rx frame buffer with busdma.
Notes
Notes:
svn path=/head/; revision=153288
-rw-r--r-- | sys/dev/ti/if_ti.c | 41 | ||||
-rw-r--r-- | sys/dev/ti/if_tireg.h | 2 |
2 files changed, 28 insertions, 15 deletions
diff --git a/sys/dev/ti/if_ti.c b/sys/dev/ti/if_ti.c index 7286987e7553..a4e924a80019 100644 --- a/sys/dev/ti/if_ti.c +++ b/sys/dev/ti/if_ti.c @@ -985,11 +985,25 @@ ti_alloc_jumbo_mem(sc) struct ti_jpool_entry *entry; /* Grab a big chunk o' storage. */ - sc->ti_cdata.ti_jumbo_buf = contigmalloc(TI_JMEM, M_DEVBUF, - M_NOWAIT, 0, 0xffffffff, PAGE_SIZE, 0); + if (bus_dma_tag_create(sc->ti_parent_dmat, /* parent */ + PAGE_SIZE, 0, /* algnmnt, boundary */ + BUS_SPACE_MAXADDR_32BIT,/* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + TI_JMEM, /* maxsize */ + 1, /* nsegments */ + TI_JMEM, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &sc->ti_jumbo_dmat) != 0) { + device_printf(dev, "Failed to allocate jumbo dmat\n"); + return (ENOBUFS); + } - if (sc->ti_cdata.ti_jumbo_buf == NULL) { - if_printf(sc->ti_ifp, "no memory for jumbo buffers!\n"); + if (bus_dmamem_alloc(sc->ti_jumbo_dmat, + (void**)&sc->ti_cdata.ti_jumbo_buf, + BUS_DMA_NOWAIT, &sc->ti_jumbo_dmamap) != 0) { + device_printf(dev, "Failed to allocate jumbo memory\n"); return (ENOBUFS); } @@ -1007,10 +1021,7 @@ ti_alloc_jumbo_mem(sc) entry = malloc(sizeof(struct ti_jpool_entry), M_DEVBUF, M_NOWAIT); if (entry == NULL) { - contigfree(sc->ti_cdata.ti_jumbo_buf, TI_JMEM, - M_DEVBUF); - sc->ti_cdata.ti_jumbo_buf = NULL; - if_printf(sc->ti_ifp, "no memory for jumbo " + device_printf(dev, "no memory for jumbo " "buffer queue!\n"); return (ENOBUFS); } @@ -2329,6 +2340,13 @@ ti_detach(dev) } ifmedia_removeall(&sc->ifmedia); +#ifdef TI_PRIVATE_JUMBOS + if (sc->ti_cdata.ti_jumbo_buf) + bus_dmamem_free(sc->ti_jumbo_dmat, sc->ti_cdata.ti_jumbo_buf, + sc->ti_jumbo_dmamap); + if (sc->ti_jumbo_dmat) + bus_dma_tag_destroy(sc->ti_jumbo_dmat); +#endif if (sc->ti_rdata) bus_dmamem_free(sc->ti_rdata_dmat, sc->ti_rdata, sc->ti_rdata_dmamap); @@ -2347,13 +2365,6 @@ ti_detach(dev) if (ifp) if_free(ifp); -#ifdef TI_PRIVATE_JUMBOS - if (sc->ti_cdata.ti_jumbo_buf) - contigfree(sc->ti_cdata.ti_jumbo_buf, TI_JMEM, M_DEVBUF); -#endif - if (sc->ti_rdata) - contigfree(sc->ti_rdata, sizeof(struct ti_ring_data), M_DEVBUF); - TI_UNLOCK(sc); mtx_destroy(&sc->ti_mtx); diff --git a/sys/dev/ti/if_tireg.h b/sys/dev/ti/if_tireg.h index d2b270cf3c64..c565d88decf6 100644 --- a/sys/dev/ti/if_tireg.h +++ b/sys/dev/ti/if_tireg.h @@ -1001,6 +1001,8 @@ struct ti_softc { u_int8_t ti_linkstat; /* Link state */ int ti_hdrsplit; /* enable header splitting */ bus_dma_tag_t ti_parent_dmat; + bus_dma_tag_t ti_jumbo_dmat; + bus_dmamap_t ti_jumbo_dmamap; bus_dma_tag_t ti_rdata_dmat; bus_dmamap_t ti_rdata_dmamap; uint32_t ti_rdata_phys; |