summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2014-07-08 02:57:28 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2014-07-08 02:57:28 +0000
commitf05aaf3eada2f1e60c1a67ce162c98c7f89103c9 (patch)
tree01e0025b868ca2575c47df7db825cf43e785baf1 /sys/dev/pci
parent115320ef81e36e1698dc685fb980d65f8c500f32 (diff)
bus_dmamap_sync the rx ring once per em_rxeof call, rather than for every
rx descriptor. slightly tweak by matthew tested on alpha and amd64
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/if_em.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/sys/dev/pci/if_em.c b/sys/dev/pci/if_em.c
index ce0adcb6e1a..8a1600cfab4 100644
--- a/sys/dev/pci/if_em.c
+++ b/sys/dev/pci/if_em.c
@@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE.
***************************************************************************/
-/* $OpenBSD: if_em.c,v 1.283 2014/07/08 00:17:44 dlg Exp $ */
+/* $OpenBSD: if_em.c,v 1.284 2014/07/08 02:57:27 dlg Exp $ */
/* $FreeBSD: if_em.c,v 1.46 2004/09/29 18:28:28 mlaier Exp $ */
#include <dev/pci/if_em.h>
@@ -2848,25 +2848,24 @@ em_rxeof(struct em_softc *sc)
struct em_buffer *pkt;
u_int8_t status;
+ if (sc->rx_ndescs == 0)
+ return;
+
i = sc->next_rx_desc_to_check;
- while (sc->rx_ndescs > 0) {
+ bus_dmamap_sync(sc->rxdma.dma_tag, sc->rxdma.dma_map,
+ 0, sizeof(*desc) * sc->num_rx_desc,
+ BUS_DMASYNC_POSTREAD);
+
+ do {
m = NULL;
desc = &sc->rx_desc_base[i];
pkt = &sc->rx_buffer_area[i];
- bus_dmamap_sync(sc->rxdma.dma_tag, sc->rxdma.dma_map,
- sizeof(*desc) * i, sizeof(*desc),
- BUS_DMASYNC_POSTREAD);
-
status = desc->status;
- if (!ISSET(status, E1000_RXD_STAT_DD)) {
- bus_dmamap_sync(sc->rxdma.dma_tag, sc->rxdma.dma_map,
- sizeof(*desc) * i, sizeof(*desc),
- BUS_DMASYNC_PREREAD);
+ if (!ISSET(status, E1000_RXD_STAT_DD))
break;
- }
/* pull the mbuf off the ring */
bus_dmamap_sync(sc->rxtag, pkt->map, 0, pkt->map->dm_mapsize,
@@ -2988,14 +2987,15 @@ em_rxeof(struct em_softc *sc)
m_freem(m);
}
- bus_dmamap_sync(sc->rxdma.dma_tag, sc->rxdma.dma_map,
- sizeof(*desc) * i, sizeof(*desc),
- BUS_DMASYNC_PREREAD);
-
/* Advance our pointers to the next descriptor. */
if (++i == sc->num_rx_desc)
i = 0;
- }
+ } while (sc->rx_ndescs > 0);
+
+ bus_dmamap_sync(sc->rxdma.dma_tag, sc->rxdma.dma_map,
+ 0, sizeof(*desc) * sc->num_rx_desc,
+ BUS_DMASYNC_PREREAD);
+
sc->next_rx_desc_to_check = i;
}