svn commit: r219102 - head/sys/dev/sis

Pyun YongHyeon yongari at FreeBSD.org
Mon Feb 28 20:37:48 UTC 2011


Author: yongari
Date: Mon Feb 28 20:37:48 2011
New Revision: 219102
URL: http://svn.freebsd.org/changeset/base/219102

Log:
  Make sure changing ownership of RX descriptor to be done as last
  operation.  Previously ownership was transferred to hardware before
  setting address of new RX buffer such that it was possible for
  hardware to use wrong RX buffer address.
  While here keep compiler from re-ordering instructions by declaring
  descriptor members volatile. Memory barriers would do the same job
  but volatile is supposed to be cheaper than using memory barriers,
  especially on MP systems.
  
  Submitted by:	marius
  MFC after:	1 week

Modified:
  head/sys/dev/sis/if_sis.c
  head/sys/dev/sis/if_sisreg.h

Modified: head/sys/dev/sis/if_sis.c
==============================================================================
--- head/sys/dev/sis/if_sis.c	Mon Feb 28 18:53:06 2011	(r219101)
+++ head/sys/dev/sis/if_sis.c	Mon Feb 28 20:37:48 2011	(r219102)
@@ -1566,8 +1566,8 @@ sis_newbuf(struct sis_softc *sc, struct 
 	sc->sis_rx_sparemap = map;
 	bus_dmamap_sync(sc->sis_rx_tag, rxd->rx_dmamap, BUS_DMASYNC_PREREAD);
 	rxd->rx_m = m;
-	rxd->rx_desc->sis_cmdsts = htole32(SIS_RXLEN);
 	rxd->rx_desc->sis_ptr = htole32(SIS_ADDR_LO(segs[0].ds_addr));
+	rxd->rx_desc->sis_cmdsts = htole32(SIS_RXLEN);
 	return (0);
 }
 

Modified: head/sys/dev/sis/if_sisreg.h
==============================================================================
--- head/sys/dev/sis/if_sisreg.h	Mon Feb 28 18:53:06 2011	(r219101)
+++ head/sys/dev/sis/if_sisreg.h	Mon Feb 28 20:37:48 2011	(r219102)
@@ -337,8 +337,8 @@
 struct sis_desc {
 	/* SiS hardware descriptor section */
 	uint32_t		sis_next;
-	uint32_t		sis_cmdsts;
-	uint32_t		sis_ptr;
+	volatile uint32_t	sis_cmdsts;
+	volatile uint32_t	sis_ptr;
 };
 
 #define SIS_CMDSTS_BUFLEN	0x00000FFF


More information about the svn-src-head mailing list