mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-04 05:58:57 +00:00
MFC r257541:
Fix several issues with the busdma(9) KPI use in the e1000 drivers.
This commit is contained in:
parent
7c1c8f55f6
commit
209fa4a174
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/stable/10/; revision=259508
@ -4059,8 +4059,7 @@ em_allocate_receive_buffers(struct rx_ring *rxr)
|
||||
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, int *done)
|
||||
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;
|
||||
|
@ -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_ring *rxr)
|
||||
|
||||
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 i)
|
||||
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 count, int *done)
|
||||
** 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 count, int *done)
|
||||
/* clear buf info for refresh */
|
||||
rxbuf->m_pack = NULL;
|
||||
}
|
||||
bus_dmamap_unload(rxr->ptag, rxbuf->pmap);
|
||||
|
||||
++processed; /* So we know when to refresh */
|
||||
|
||||
|
@ -3182,8 +3182,7 @@ lem_allocate_receive_structures(struct adapter *adapter)
|
||||
}
|
||||
|
||||
/* 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 adapter *adapter)
|
||||
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user