Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Mar 2011 00:42:22 +0000 (UTC)
From:      Pyun YongHyeon <yongari@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r219356 - stable/8/sys/dev/sis
Message-ID:  <201103070042.p270gMND014429@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: yongari
Date: Mon Mar  7 00:42:22 2011
New Revision: 219356
URL: http://svn.freebsd.org/changeset/base/219356

Log:
  MFC r219102:
    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

Modified:
  stable/8/sys/dev/sis/if_sis.c
  stable/8/sys/dev/sis/if_sisreg.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/dev/sis/if_sis.c
==============================================================================
--- stable/8/sys/dev/sis/if_sis.c	Sun Mar  6 23:15:24 2011	(r219355)
+++ stable/8/sys/dev/sis/if_sis.c	Mon Mar  7 00:42:22 2011	(r219356)
@@ -1568,8 +1568,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: stable/8/sys/dev/sis/if_sisreg.h
==============================================================================
--- stable/8/sys/dev/sis/if_sisreg.h	Sun Mar  6 23:15:24 2011	(r219355)
+++ stable/8/sys/dev/sis/if_sisreg.h	Mon Mar  7 00:42:22 2011	(r219356)
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201103070042.p270gMND014429>