[iwn] Perform BUS_DMASYNC_PREREAD when initializing RX buffer

BUS_DMASYNC_PREREAD is required when setting up RX buffer, otherwise
data provided by card can be overwritten by data evicted from cache

Also use proper tag when setting up RX descriptor

Reviewed by:	adrian, avos, ivadasz
Differential Revision:	https://reviews.freebsd.org/D8717
This commit is contained in:
gonzo 2016-12-10 17:59:34 +00:00
parent efd1e69399
commit 56e9b8d55f

View File

@ -1910,6 +1910,9 @@ iwn_alloc_rx_ring(struct iwn_softc *sc, struct iwn_rx_ring *ring)
goto fail;
}
bus_dmamap_sync(ring->data_dmat, data->map,
BUS_DMASYNC_PREREAD);
/* Set physical address of RX buffer (256-byte aligned). */
ring->desc[i] = htole32(paddr >> 8);
}
@ -3040,14 +3043,19 @@ iwn_rx_done(struct iwn_softc *sc, struct iwn_rx_desc *desc,
if (error != 0 && error != EFBIG) {
panic("%s: could not load old RX mbuf", __func__);
}
bus_dmamap_sync(ring->data_dmat, data->map,
BUS_DMASYNC_PREREAD);
/* Physical address may have changed. */
ring->desc[ring->cur] = htole32(paddr >> 8);
bus_dmamap_sync(ring->data_dmat, ring->desc_dma.map,
bus_dmamap_sync(ring->desc_dma.tag, ring->desc_dma.map,
BUS_DMASYNC_PREWRITE);
counter_u64_add(ic->ic_ierrors, 1);
return;
}
bus_dmamap_sync(ring->data_dmat, data->map,
BUS_DMASYNC_PREREAD);
m = data->m;
data->m = m1;
/* Update RX descriptor. */