svn commit: r198318 - head/sys/dev/bge

Stanislav Sedov stas at FreeBSD.org
Wed Oct 21 11:50:19 UTC 2009


Author: stas
Date: Wed Oct 21 11:50:18 2009
New Revision: 198318
URL: http://svn.freebsd.org/changeset/base/198318

Log:
  - On entrance to the rx_eof sync RX rings maps with POSTWRITE flag
    instead of POSTREAD: the hardware do not touch this memory (CPU
    updates it).  It is already synchronized as PREWRITE after the
    processing is done.
  
  - Synchronize RX return ring memory in rx_eof.  This is needed
    as the deviced updates this memory when receives packets.
  
  - Decouple the synchronization of BGE status block in the interrupt
    service routine: perfrom PREREAD synchronization only all accesses
    to this block are finished.  This seems to be more natural.
  
  Reviewed by:	yongari, marius
  MFC after:	2 weeks

Modified:
  head/sys/dev/bge/if_bge.c

Modified: head/sys/dev/bge/if_bge.c
==============================================================================
--- head/sys/dev/bge/if_bge.c	Wed Oct 21 11:10:34 2009	(r198317)
+++ head/sys/dev/bge/if_bge.c	Wed Oct 21 11:50:18 2009	(r198318)
@@ -3122,10 +3122,10 @@ bge_rxeof(struct bge_softc *sc)
 	bus_dmamap_sync(sc->bge_cdata.bge_rx_return_ring_tag,
 	    sc->bge_cdata.bge_rx_return_ring_map, BUS_DMASYNC_POSTREAD);
 	bus_dmamap_sync(sc->bge_cdata.bge_rx_std_ring_tag,
-	    sc->bge_cdata.bge_rx_std_ring_map, BUS_DMASYNC_POSTREAD);
+	    sc->bge_cdata.bge_rx_std_ring_map, BUS_DMASYNC_POSTWRITE);
 	if (BGE_IS_JUMBO_CAPABLE(sc))
 		bus_dmamap_sync(sc->bge_cdata.bge_rx_jumbo_ring_tag,
-		    sc->bge_cdata.bge_rx_jumbo_ring_map, BUS_DMASYNC_POSTREAD);
+		    sc->bge_cdata.bge_rx_jumbo_ring_map, BUS_DMASYNC_POSTWRITE);
 
 	while (rx_cons != rx_prod) {
 		struct bge_rx_bd	*cur_rx;
@@ -3251,6 +3251,8 @@ bge_rxeof(struct bge_softc *sc)
 			return (rx_npkts);
 	}
 
+	bus_dmamap_sync(sc->bge_cdata.bge_rx_return_ring_tag,
+	    sc->bge_cdata.bge_rx_return_ring_map, BUS_DMASYNC_PREREAD);
 	if (stdcnt > 0)
 		bus_dmamap_sync(sc->bge_cdata.bge_rx_std_ring_tag,
 		    sc->bge_cdata.bge_rx_std_ring_map, BUS_DMASYNC_PREWRITE);
@@ -3423,8 +3425,6 @@ bge_intr(void *xsc)
 	/* Make sure the descriptor ring indexes are coherent. */
 	bus_dmamap_sync(sc->bge_cdata.bge_status_tag,
 	    sc->bge_cdata.bge_status_map, BUS_DMASYNC_POSTREAD);
-	bus_dmamap_sync(sc->bge_cdata.bge_status_tag,
-	    sc->bge_cdata.bge_status_map, BUS_DMASYNC_PREREAD);
 
 	if ((sc->bge_asicrev == BGE_ASICREV_BCM5700 &&
 	    sc->bge_chipid != BGE_CHIPID_BCM5700_B2) ||
@@ -3445,6 +3445,9 @@ bge_intr(void *xsc)
 	    !IFQ_DRV_IS_EMPTY(&ifp->if_snd))
 		bge_start_locked(ifp);
 
+	bus_dmamap_sync(sc->bge_cdata.bge_status_tag,
+	    sc->bge_cdata.bge_status_map, BUS_DMASYNC_PREREAD);
+
 	BGE_UNLOCK(sc);
 }
 


More information about the svn-src-head mailing list