From cc9beb7b77946979dda060e27226264954c2d1d9 Mon Sep 17 00:00:00 2001 From: Maxime Henrion Date: Sat, 5 Apr 2003 23:24:23 +0000 Subject: [PATCH] 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 --- sys/pci/if_xl.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/sys/pci/if_xl.c b/sys/pci/if_xl.c index 50ae7bea10b6..38583cad12bd 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 @@ -306,6 +308,23 @@ xl_dma_map_addr(arg, segs, nseg, error) *paddr = segs->ds_addr; } +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; @@ -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);