svn commit: r259508 - stable/10/sys/dev/e1000
Konstantin Belousov
kib at FreeBSD.org
Tue Dec 17 13:18:42 UTC 2013
Author: kib
Date: Tue Dec 17 13:18:41 2013
New Revision: 259508
URL: http://svnweb.freebsd.org/changeset/base/259508
Log:
MFC r257541:
Fix several issues with the busdma(9) KPI use in the e1000 drivers.
Modified:
stable/10/sys/dev/e1000/if_em.c
stable/10/sys/dev/e1000/if_igb.c
stable/10/sys/dev/e1000/if_lem.c
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/sys/dev/e1000/if_em.c
==============================================================================
--- stable/10/sys/dev/e1000/if_em.c Tue Dec 17 13:13:02 2013 (r259507)
+++ stable/10/sys/dev/e1000/if_em.c Tue Dec 17 13:18:41 2013 (r259508)
@@ -4059,8 +4059,7 @@ em_allocate_receive_buffers(struct rx_ri
rxbuf = rxr->rx_buffers;
for (int i = 0; i < adapter->num_rx_desc; i++, rxbuf++) {
rxbuf = &rxr->rx_buffers[i];
- error = bus_dmamap_create(rxr->rxtag, BUS_DMA_NOWAIT,
- &rxbuf->map);
+ error = bus_dmamap_create(rxr->rxtag, 0, &rxbuf->map);
if (error) {
device_printf(dev, "%s: bus_dmamap_create failed: %d\n",
__func__, error);
@@ -4465,6 +4464,7 @@ em_rxeof(struct rx_ring *rxr, int count,
em_rx_discard(rxr, i);
goto next_desc;
}
+ bus_dmamap_unload(rxr->rxtag, rxr->rx_buffers[i].map);
/* Assign correct length to the current fragment */
mp = rxr->rx_buffers[i].m_head;
@@ -4551,6 +4551,8 @@ em_rx_discard(struct rx_ring *rxr, int i
struct em_buffer *rbuf;
rbuf = &rxr->rx_buffers[i];
+ bus_dmamap_unload(rxr->rxtag, rbuf->map);
+
/* Free any previous pieces */
if (rxr->fmp != NULL) {
rxr->fmp->m_flags |= M_PKTHDR;
Modified: stable/10/sys/dev/e1000/if_igb.c
==============================================================================
--- stable/10/sys/dev/e1000/if_igb.c Tue Dec 17 13:13:02 2013 (r259507)
+++ stable/10/sys/dev/e1000/if_igb.c Tue Dec 17 13:18:41 2013 (r259508)
@@ -3996,7 +3996,6 @@ igb_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;
@@ -4022,7 +4021,6 @@ igb_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;
@@ -4230,15 +4228,13 @@ igb_allocate_receive_buffers(struct rx_r
for (i = 0; i < adapter->num_rx_desc; i++) {
rxbuf = &rxr->rx_buffers[i];
- error = bus_dmamap_create(rxr->htag,
- BUS_DMA_NOWAIT, &rxbuf->hmap);
+ error = bus_dmamap_create(rxr->htag, 0, &rxbuf->hmap);
if (error) {
device_printf(dev,
"Unable to create RX head DMA maps\n");
goto fail;
}
- 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 packet DMA maps\n");
@@ -4758,11 +4754,13 @@ igb_rx_discard(struct rx_ring *rxr, int
if (rbuf->m_head) {
m_free(rbuf->m_head);
rbuf->m_head = NULL;
+ bus_dmamap_unload(rxr->htag, rbuf->hmap);
}
if (rbuf->m_pack) {
m_free(rbuf->m_pack);
rbuf->m_pack = NULL;
+ bus_dmamap_unload(rxr->ptag, rbuf->pmap);
}
return;
@@ -4885,6 +4883,7 @@ igb_rxeof(struct igb_queue *que, int cou
** case only the first header is valid.
*/
if (rxr->hdr_split && rxr->fmp == NULL) {
+ bus_dmamap_unload(rxr->htag, rxbuf->hmap);
hlen = (hdr & E1000_RXDADV_HDRBUFLEN_MASK) >>
E1000_RXDADV_HDRBUFLEN_SHIFT;
if (hlen > IGB_HDR_BUF)
@@ -4917,6 +4916,7 @@ igb_rxeof(struct igb_queue *que, int cou
/* clear buf info for refresh */
rxbuf->m_pack = NULL;
}
+ bus_dmamap_unload(rxr->ptag, rxbuf->pmap);
++processed; /* So we know when to refresh */
Modified: stable/10/sys/dev/e1000/if_lem.c
==============================================================================
--- stable/10/sys/dev/e1000/if_lem.c Tue Dec 17 13:13:02 2013 (r259507)
+++ stable/10/sys/dev/e1000/if_lem.c Tue Dec 17 13:18:41 2013 (r259508)
@@ -3182,8 +3182,7 @@ lem_allocate_receive_structures(struct a
}
/* Create the spare map (used by getbuf) */
- error = bus_dmamap_create(adapter->rxtag, BUS_DMA_NOWAIT,
- &adapter->rx_sparemap);
+ error = bus_dmamap_create(adapter->rxtag, 0, &adapter->rx_sparemap);
if (error) {
device_printf(dev, "%s: bus_dmamap_create failed: %d\n",
__func__, error);
@@ -3192,8 +3191,7 @@ lem_allocate_receive_structures(struct a
rx_buffer = adapter->rx_buffer_area;
for (i = 0; i < adapter->num_rx_desc; i++, rx_buffer++) {
- error = bus_dmamap_create(adapter->rxtag, BUS_DMA_NOWAIT,
- &rx_buffer->map);
+ error = bus_dmamap_create(adapter->rxtag, 0, &rx_buffer->map);
if (error) {
device_printf(dev, "%s: bus_dmamap_create failed: %d\n",
__func__, error);
More information about the svn-src-stable-10
mailing list