summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authoryongari <yongari@FreeBSD.org>2006-07-27 00:26:20 +0000
committeryongari <yongari@FreeBSD.org>2006-07-27 00:26:20 +0000
commit4d0b27175ce914f2c85396de8df8577b6aeb70a0 (patch)
treeeb1f5449debb6d55c60df8a62ba3ba8517553d77 /sys
parent08406d93cdec8b392b538ada3b49516b64d72a03 (diff)
downloadFreeBSD-src-4d0b27175ce914f2c85396de8df8577b6aeb70a0.zip
FreeBSD-src-4d0b27175ce914f2c85396de8df8577b6aeb70a0.tar.gz
Make sure to use the same DMA map in DMA map load/unload operations
by remembering a map used in bus_dmamap_load_mbuf_sg(9). I have no idea how it could ever worked before. This fixes a warning generated by a diagnostic check in sun4v iommu driver. Reported by: jb Tested by: jb(sun4v)
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/em/if_em.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/sys/dev/em/if_em.c b/sys/dev/em/if_em.c
index f90062a..3d3168c 100644
--- a/sys/dev/em/if_em.c
+++ b/sys/dev/em/if_em.c
@@ -1388,13 +1388,13 @@ em_encap(struct em_softc *sc, struct mbuf **m_headp)
struct ifnet *ifp = sc->ifp;
bus_dma_segment_t segs[EM_MAX_SCATTER];
bus_dmamap_t map;
- struct em_buffer *tx_buffer;
+ struct em_buffer *tx_buffer, *tx_buffer_last;
struct em_tx_desc *current_tx_desc;
struct mbuf *m_head;
struct m_tag *mtag;
uint32_t txd_upper, txd_lower, txd_used, txd_saved;
int nsegs, i, j;
- int error = 0;
+ int error;
m_head = *m_headp;
current_tx_desc = NULL;
@@ -1416,9 +1416,10 @@ em_encap(struct em_softc *sc, struct mbuf **m_headp)
* Map the packet for DMA.
*/
tx_buffer = &sc->tx_buffer_area[sc->next_avail_tx_desc];
- error = bus_dmamap_load_mbuf_sg(sc->txtag, tx_buffer->map, m_head,
- segs, &nsegs, BUS_DMA_NOWAIT);
+ tx_buffer_last = tx_buffer;
map = tx_buffer->map;
+ error = bus_dmamap_load_mbuf_sg(sc->txtag, map, m_head, segs, &nsegs,
+ BUS_DMA_NOWAIT);
if (error != 0) {
sc->no_tx_dma_setup++;
return (error);
@@ -1548,6 +1549,8 @@ em_encap(struct em_softc *sc, struct mbuf **m_headp)
}
tx_buffer->m_head = m_head;
+ tx_buffer_last->map = tx_buffer->map;
+ tx_buffer->map = map;
bus_dmamap_sync(sc->txtag, map, BUS_DMASYNC_PREWRITE);
/*
@@ -1572,7 +1575,7 @@ em_encap(struct em_softc *sc, struct mbuf **m_headp)
return (0);
encap_fail:
- bus_dmamap_unload(sc->txtag, tx_buffer->map);
+ bus_dmamap_unload(sc->txtag, map);
return (error);
}
OpenPOWER on IntegriCloud