svn commit: r281992 - projects/em_mq/sys/dev/e1000
Sean Bruno
sbruno at FreeBSD.org
Sun Apr 26 01:41:11 UTC 2015
Author: sbruno
Date: Sun Apr 26 01:41:10 2015
New Revision: 281992
URL: https://svnweb.freebsd.org/changeset/base/281992
Log:
Repair a race condition where we can accidently use the same mbuf in multiple
irq threads somehow. Steal bus_dmamap_sync() invocations from igb(4).
Modified:
projects/em_mq/sys/dev/e1000/if_em.c
Modified: projects/em_mq/sys/dev/e1000/if_em.c
==============================================================================
--- projects/em_mq/sys/dev/e1000/if_em.c Sat Apr 25 22:42:03 2015 (r281991)
+++ projects/em_mq/sys/dev/e1000/if_em.c Sun Apr 26 01:41:10 2015 (r281992)
@@ -1552,8 +1552,8 @@ em_handle_que(void *context, int pending
{
struct em_queue *que = context;
struct adapter *adapter = que->adapter;
- if_t ifp = adapter->ifp;
struct tx_ring *txr = que->txr;
+ if_t ifp = adapter->ifp;
if (if_getdrvflags(ifp) & IFF_DRV_RUNNING) {
bool more = em_rxeof(que, adapter->rx_process_limit, NULL);
@@ -4445,6 +4445,11 @@ em_rxeof(struct em_queue *que, int count
EM_RX_LOCK(rxr);
+ /* Sync the ring */
+ bus_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map,
+ BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
+
+
#ifdef DEV_NETMAP
if (netmap_rx_irq(ifp, rxr->me, &processed)) {
EM_RX_UNLOCK(rxr);
@@ -4457,9 +4462,6 @@ em_rxeof(struct em_queue *que, int count
if ((if_getdrvflags(ifp) & IFF_DRV_RUNNING) == 0)
break;
- bus_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map,
- BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
-
cur = &rxr->rx_base[i];
status = cur->status;
mp = sendmp = NULL;
@@ -4525,6 +4527,10 @@ skip:
rxr->fmp = rxr->lmp = NULL;
}
next_desc:
+ /* Sync the ring */
+ bus_dmamap_sync(rxr->rxdma.dma_tag, rxr->rxdma.dma_map,
+ BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
+
/* Zero out the receive descriptors status. */
cur->status = 0;
++rxdone; /* cumulative for POLL */
More information about the svn-src-projects
mailing list