summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2010-09-22 08:49:15 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2010-09-22 08:49:15 +0000
commit4644a56ba161c5256c8aa84e604d4f0657921836 (patch)
treed165c6576d84594530ef6e11c5e7cb2b0f9121d3 /sys/dev
parent99534ddecd6efe03744a62d3b6801cec2a4dd971 (diff)
Call bus_dmamap_sync() of a dma descriptor before checking the ownership
of the descriptor. Diff created and tested by Loganaden Velvindron. Looks good dlg@ and myself
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/xl.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/sys/dev/ic/xl.c b/sys/dev/ic/xl.c
index a629c357d6b..3d5eacce92e 100644
--- a/sys/dev/ic/xl.c
+++ b/sys/dev/ic/xl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xl.c,v 1.98 2010/09/21 01:05:12 claudio Exp $ */
+/* $OpenBSD: xl.c,v 1.99 2010/09/22 08:49:14 claudio Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -1180,18 +1180,19 @@ xl_rxeof(struct xl_softc *sc)
again:
- while ((rxstat = letoh32(sc->xl_cdata.xl_rx_cons->xl_ptr->xl_status))
- != 0 && sc->xl_cdata.xl_rx_cnt > 0) {
+ while (sc->xl_cdata.xl_rx_cnt > 0) {
cur_rx = sc->xl_cdata.xl_rx_cons;
+ bus_dmamap_sync(sc->sc_dmat, sc->sc_listmap,
+ ((caddr_t)cur_rx->xl_ptr - sc->sc_listkva),
+ sizeof(struct xl_list),
+ BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
+ if ((rxstat = letoh32(sc->xl_cdata.xl_rx_cons->xl_ptr->xl_status)) == 0)
+ break;
m = cur_rx->xl_mbuf;
cur_rx->xl_mbuf = NULL;
sc->xl_cdata.xl_rx_cons = cur_rx->xl_next;
sc->xl_cdata.xl_rx_cnt--;
total_len = rxstat & XL_RXSTAT_LENMASK;
- bus_dmamap_sync(sc->sc_dmat, sc->sc_listmap,
- ((caddr_t)cur_rx->xl_ptr - sc->sc_listkva),
- sizeof(struct xl_list),
- BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
/*
* Since we have told the chip to allow large frames,