From ed03b6d5102f3b90b14d8f51eaeeab10f558a170 Mon Sep 17 00:00:00 2001
From: erj <erj@FreeBSD.org>
Date: Wed, 1 Apr 2015 17:19:55 +0000
Subject: Make changes to busdma code in tx/rx path similar to the ones made in
 r257541.

- bus_dmamap_create() does not take the BUS_DMA_NOWAIT flag
- properly unload maps
- do not assign NULL to dma map pointers

Submitted by:	Konstantin Belousov <kostikbel@gmail.com>
Approved by:	jfv (mentor)
MFC after:	1 week
---
 sys/dev/ixgbe/ix_txrx.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

(limited to 'sys/dev/ixgbe')

diff --git a/sys/dev/ixgbe/ix_txrx.c b/sys/dev/ixgbe/ix_txrx.c
index 536bf9f..6c9c84a 100644
--- a/sys/dev/ixgbe/ix_txrx.c
+++ b/sys/dev/ixgbe/ix_txrx.c
@@ -1049,7 +1049,6 @@ ixgbe_txeof(struct tx_ring *txr)
 			    buf->map);
 			m_freem(buf->m_head);
 			buf->m_head = NULL;
-			buf->map = NULL;
 		}
 		buf->eop = NULL;
 		++txr->tx_avail;
@@ -1075,7 +1074,6 @@ ixgbe_txeof(struct tx_ring *txr)
 				    buf->map);
 				m_freem(buf->m_head);
 				buf->m_head = NULL;
-				buf->map = NULL;
 			}
 			++txr->tx_avail;
 			buf->eop = NULL;
@@ -1319,6 +1317,7 @@ ixgbe_refresh_mbufs(struct rx_ring *rxr, int limit)
 		 */
 		if ((rxbuf->flags & IXGBE_RX_COPY) == 0) {
 			/* Get the memory mapping */
+			bus_dmamap_unload(rxr->ptag, rxbuf->pmap);
 			error = bus_dmamap_load_mbuf_sg(rxr->ptag,
 			    rxbuf->pmap, mp, seg, &nsegs, BUS_DMA_NOWAIT);
 			if (error != 0) {
@@ -1395,8 +1394,7 @@ ixgbe_allocate_receive_buffers(struct rx_ring *rxr)
 
 	for (i = 0; i < rxr->num_desc; i++, rxbuf++) {
 		rxbuf = &rxr->rx_buffers[i];
-		error = bus_dmamap_create(rxr->ptag,
-		    BUS_DMA_NOWAIT, &rxbuf->pmap);
+		error = bus_dmamap_create(rxr->ptag, 0, &rxbuf->pmap);
 		if (error) {
 			device_printf(dev, "Unable to create RX dma map\n");
 			goto fail;
@@ -1715,6 +1713,7 @@ ixgbe_rx_discard(struct rx_ring *rxr, int i)
 		m_free(rbuf->buf);
 		rbuf->buf = NULL;
 	}
+	bus_dmamap_unload(rxr->ptag, rbuf->pmap);
 
 	rbuf->flags = 0;
  
-- 
cgit v1.1