From 4eee14cb27a9ac8cb627fc1ff5a4a21bdc92a3c0 Mon Sep 17 00:00:00 2001 From: Marius Strobl Date: Sat, 26 Apr 2008 10:54:17 +0000 Subject: [PATCH] - Use more appropriate maxsize, nsegments and maxsegsize parameters when creating the parent bus DMA tag. While at it correct the style and a nearby comment. - Take advantage of m_collapse(9) for performance reasons. MFC after: 2 weeks --- sys/dev/bge/if_bge.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/sys/dev/bge/if_bge.c b/sys/dev/bge/if_bge.c index b0238f7e16b8..8d31cfbe1412 100644 --- a/sys/dev/bge/if_bge.c +++ b/sys/dev/bge/if_bge.c @@ -1894,16 +1894,10 @@ bge_dma_alloc(device_t dev) /* * Allocate the parent bus DMA tag appropriate for PCI. */ - error = bus_dma_tag_create(bus_get_dma_tag(sc->bge_dev), /* parent */ - 1, 0, /* alignment, boundary */ - BUS_SPACE_MAXADDR, /* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filter, filterarg */ - MAXBSIZE, BGE_NSEG_NEW, /* maxsize, nsegments */ - BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */ - 0, /* flags */ - NULL, NULL, /* lockfunc, lockarg */ - &sc->bge_cdata.bge_parent_tag); + error = bus_dma_tag_create(bus_get_dma_tag(sc->bge_dev), + 1, 0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, + NULL, BUS_SPACE_MAXSIZE_32BIT, 0, BUS_SPACE_MAXSIZE_32BIT, + 0, NULL, NULL, &sc->bge_cdata.bge_parent_tag); if (error != 0) { device_printf(sc->bge_dev, @@ -1912,7 +1906,7 @@ bge_dma_alloc(device_t dev) } /* - * Create tag for RX mbufs. + * Create tag for mbufs. */ error = bus_dma_tag_create(sc->bge_cdata.bge_parent_tag, 1, 0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, @@ -3402,7 +3396,7 @@ bge_encap(struct bge_softc *sc, struct mbuf **m_head, uint32_t *txidx) error = bus_dmamap_load_mbuf_sg(sc->bge_cdata.bge_mtag, map, m, segs, &nsegs, BUS_DMA_NOWAIT); if (error == EFBIG) { - m = m_defrag(m, M_DONTWAIT); + m = m_collapse(m, M_DONTWAIT, BGE_NSEG_NEW); if (m == NULL) { m_freem(*m_head); *m_head = NULL;