diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2020-12-26 11:31:43 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2020-12-26 11:31:43 +0000 |
commit | 016a2de503e82c893ca5265f059cd40d16944f15 (patch) | |
tree | ee3d52702cfe3e2de3bfccb07f73b5aea713ca38 /sys/dev/pci/if_mcx.c | |
parent | 2b88473e8664137a1cd77d89cf3a9c7bc9216865 (diff) |
sprinkle some bus_dmamap_syncs around the sq.
ok jmatthew@
Diffstat (limited to 'sys/dev/pci/if_mcx.c')
-rw-r--r-- | sys/dev/pci/if_mcx.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/sys/dev/pci/if_mcx.c b/sys/dev/pci/if_mcx.c index b797ea3cc09..58acc7e7b02 100644 --- a/sys/dev/pci/if_mcx.c +++ b/sys/dev/pci/if_mcx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_mcx.c,v 1.82 2020/12/26 11:06:52 dlg Exp $ */ +/* $OpenBSD: if_mcx.c,v 1.83 2020/12/26 11:31:42 dlg Exp $ */ /* * Copyright (c) 2017 David Gwynne <dlg@openbsd.org> @@ -5003,6 +5003,9 @@ mcx_create_sq(struct mcx_softc *sc, struct mcx_tx *tx, int uar, int db, mbin->sq_wq.wq_log_stride = htobe16(MCX_LOG_SQ_ENTRY_SIZE); mbin->sq_wq.wq_log_size = MCX_LOG_SQ_SIZE; + bus_dmamap_sync(sc->sc_dmat, MCX_DMA_MAP(&tx->tx_sq_mem), + 0, MCX_DMA_LEN(&tx->tx_sq_mem), BUS_DMASYNC_PREWRITE); + /* physical addresses follow the mailbox in data */ mcx_cmdq_mboxes_pas(&mxm, sizeof(*mbin) + 0x10, npages, &tx->tx_sq_mem); @@ -5037,6 +5040,8 @@ mcx_create_sq(struct mcx_softc *sc, struct mcx_tx *tx, int uar, int db, return (0); free_mxm: + bus_dmamap_sync(sc->sc_dmat, MCX_DMA_MAP(&tx->tx_sq_mem), + 0, MCX_DMA_LEN(&tx->tx_sq_mem), BUS_DMASYNC_POSTWRITE); mcx_dmamem_free(sc, &mxm); free_sq: mcx_dmamem_free(sc, &tx->tx_sq_mem); @@ -5079,8 +5084,11 @@ mcx_destroy_sq(struct mcx_softc *sc, struct mcx_tx *tx) return -1; } - tx->tx_sqn = 0; + bus_dmamap_sync(sc->sc_dmat, MCX_DMA_MAP(&tx->tx_sq_mem), + 0, MCX_DMA_LEN(&tx->tx_sq_mem), BUS_DMASYNC_POSTWRITE); mcx_dmamem_free(sc, &tx->tx_sq_mem); + + tx->tx_sqn = 0; return 0; } @@ -7565,6 +7573,10 @@ mcx_start(struct ifqueue *ifq) used = 0; bf = NULL; + + bus_dmamap_sync(sc->sc_dmat, MCX_DMA_MAP(&tx->tx_sq_mem), + 0, MCX_DMA_LEN(&tx->tx_sq_mem), BUS_DMASYNC_POSTWRITE); + sq = (struct mcx_sq_entry *)MCX_DMA_KVA(&tx->tx_sq_mem); for (;;) { @@ -7669,6 +7681,9 @@ mcx_start(struct ifqueue *ifq) used++; } + bus_dmamap_sync(sc->sc_dmat, MCX_DMA_MAP(&tx->tx_sq_mem), + 0, MCX_DMA_LEN(&tx->tx_sq_mem), BUS_DMASYNC_PREWRITE); + if (used) { htobem32(tx->tx_doorbell, tx->tx_prod & MCX_WQ_DOORBELL_MASK); |