PERFORCE change 102496 for review
John Birrell
jb at FreeBSD.org
Wed Jul 26 20:25:47 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=102496
Change 102496 by jb at jb_freebsd2 on 2006/07/26 20:25:03
Patch from yongari@ which resolves the bus_dmamap_unload problem.
Affected files ...
.. //depot/projects/dtrace/src/sys/dev/em/if_em.c#5 edit
Differences ...
==== //depot/projects/dtrace/src/sys/dev/em/if_em.c#5 (text+ko) ====
@@ -1388,13 +1388,13 @@
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 @@
* 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,
+ 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);
- map = tx_buffer->map;
if (error != 0) {
sc->no_tx_dma_setup++;
return (error);
@@ -1548,6 +1549,8 @@
}
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 @@
return (0);
encap_fail:
- bus_dmamap_unload(sc->txtag, tx_buffer->map);
+ bus_dmamap_unload(sc->txtag, map);
return (error);
}
@@ -2808,7 +2811,7 @@
MCLBYTES, /* maxsize */
1, /* nsegments */
MCLBYTES, /* maxsegsize */
- BUS_DMA_ALLOCNOW, /* flags */
+ 0, /* flags */
NULL, /* lockfunc */
NULL, /* lockarg */
&sc->rxtag);
More information about the p4-projects
mailing list