diff options
author | mux <mux@FreeBSD.org> | 2003-04-05 23:24:23 +0000 |
---|---|---|
committer | mux <mux@FreeBSD.org> | 2003-04-05 23:24:23 +0000 |
commit | f7b5ba78a896970625aa43e9564f51d524c83fa8 (patch) | |
tree | ef4e386970471094d83c115ff4702629f745ca21 /sys/pci | |
parent | 663bf8811178bfbd7ecfe38996f41d78cd24cc05 (diff) | |
download | FreeBSD-src-f7b5ba78a896970625aa43e9564f51d524c83fa8.zip FreeBSD-src-f7b5ba78a896970625aa43e9564f51d524c83fa8.tar.gz |
Use bus_dmamap_load_mbuf() instead of bus_dmamap_load() for the
RX part of this driver too. It's better since the code wasn't
dealing with bus_dmamap_load() returning EINPROGRESS, and this
can't happen with bus_dmamap_load_mbuf().
Submitted by: jake
Diffstat (limited to 'sys/pci')
-rw-r--r-- | sys/pci/if_xl.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/sys/pci/if_xl.c b/sys/pci/if_xl.c index 50ae7be..38583ca 100644 --- a/sys/pci/if_xl.c +++ b/sys/pci/if_xl.c @@ -249,6 +249,8 @@ static void xl_wait (struct xl_softc *); static void xl_mediacheck (struct xl_softc *); static void xl_choose_xcvr (struct xl_softc *, int); static void xl_dma_map_addr (void *, bus_dma_segment_t *, int, int); +static void xl_dma_map_rxbuf (void *, bus_dma_segment_t *, int, bus_size_t, + int); static void xl_dma_map_txbuf (void *, bus_dma_segment_t *, int, bus_size_t, int); #ifdef notdef @@ -307,6 +309,23 @@ xl_dma_map_addr(arg, segs, nseg, error) } static void +xl_dma_map_rxbuf(arg, segs, nseg, mapsize, error) + void *arg; + bus_dma_segment_t *segs; + int nseg; + bus_size_t mapsize; + int error; +{ + u_int32_t *paddr; + + if (error) + return; + KASSERT(nseg == 1, ("xl_dma_map_rxbuf: too many DMA segments")); + paddr = arg; + *paddr = segs->ds_addr; +} + +static void xl_dma_map_txbuf(arg, segs, nseg, mapsize, error) void *arg; bus_dma_segment_t *segs; @@ -1942,8 +1961,8 @@ xl_newbuf(sc, c) /* Force longword alignment for packet payload. */ m_adj(m_new, ETHER_ALIGN); - error = bus_dmamap_load(sc->xl_mtag, sc->xl_tmpmap, mtod(m_new, void *), - MCLBYTES, xl_dma_map_addr, &baddr, 0); + error = bus_dmamap_load_mbuf(sc->xl_mtag, sc->xl_tmpmap, m_new, + xl_dma_map_rxbuf, &baddr, 0); if (error) { m_freem(m_new); printf("xl%d: can't map mbuf (error %d)\n", sc->xl_unit, error); |