summaryrefslogtreecommitdiffstats
path: root/sys/dev/ti
diff options
context:
space:
mode:
authorscottl <scottl@FreeBSD.org>2005-12-10 08:58:48 +0000
committerscottl <scottl@FreeBSD.org>2005-12-10 08:58:48 +0000
commit84b201a8f1a2a802f465e39a055b5392cb16496e (patch)
tree8dff28337ee4c7b067c8c4bc53df37ffcbfcbd17 /sys/dev/ti
parent3354610e7db0fa531e68a6e6e61ce86af66e6031 (diff)
downloadFreeBSD-src-84b201a8f1a2a802f465e39a055b5392cb16496e.zip
FreeBSD-src-84b201a8f1a2a802f465e39a055b5392cb16496e.tar.gz
Allocate the jumbo rx frame buffer with busdma.
Diffstat (limited to 'sys/dev/ti')
-rw-r--r--sys/dev/ti/if_ti.c41
-rw-r--r--sys/dev/ti/if_tireg.h2
2 files changed, 28 insertions, 15 deletions
diff --git a/sys/dev/ti/if_ti.c b/sys/dev/ti/if_ti.c
index 7286987..a4e924a 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 d2b270c..c565d88 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;
OpenPOWER on IntegriCloud