On 22/09/15(Tue) 19:55, Stefan Sperling wrote: > On Tue, Sep 22, 2015 at 01:23:17PM -0400, Ted Unangst wrote: > > Stefan Sperling wrote: > > > Properly reset the RX ring by clearing RX buffer status exposed to > > > hardware. > > > Found by Matthew Dillon while porting FreeBSD's iwm(4) to Dragonfly. > > > > > > ok? > > > > > > Index: if_iwm.c > > > =================================================================== > > > RCS file: /cvs/src/sys/dev/pci/if_iwm.c,v > > > retrieving revision 1.46 > > > diff -u -p -r1.46 if_iwm.c > > > --- if_iwm.c 19 Jul 2015 21:40:00 -0000 1.46 > > > +++ if_iwm.c 22 Sep 2015 16:52:10 -0000 > > > @@ -1046,6 +1046,7 @@ iwm_reset_rx_ring(struct iwm_softc *sc, > > > iwm_nic_unlock(sc); > > > } > > > ring->cur = 0; > > > + memset(ring->stat, 0, sizeof(*ring->stat)); > > > } > > > > do we need any sort of dma sync? > > Seems like a good idea, yes.
ok mpi@. This is coherent to what's done in Linux's iwl_pcie_rx_init() function. Now I don't understand how/why the stat buffers are cleared at the beginning of iwm_nic_rx_init(). > > Index: if_iwm.c > =================================================================== > RCS file: /cvs/src/sys/dev/pci/if_iwm.c,v > retrieving revision 1.46 > diff -u -p -r1.46 if_iwm.c > --- if_iwm.c 19 Jul 2015 21:40:00 -0000 1.46 > +++ if_iwm.c 22 Sep 2015 17:49:41 -0000 > @@ -1046,6 +1046,12 @@ iwm_reset_rx_ring(struct iwm_softc *sc, > iwm_nic_unlock(sc); > } > ring->cur = 0; > + bus_dmamap_sync(sc->sc_dmat, ring->stat_dma.map, 0, > + ring->stat_dma.size, BUS_DMASYNC_PREWRITE); > + memset(ring->stat, 0, sizeof(*ring->stat)); > + bus_dmamap_sync(sc->sc_dmat, ring->stat_dma.map, 0, > + ring->stat_dma.size, BUS_DMASYNC_POSTWRITE); > + > } > > void >
