Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Mar 2011 00:44:00 +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-7@freebsd.org
Subject:   svn commit: r219357 - stable/7/sys/dev/sis
Message-ID:  <201103070044.p270i0Y5014498@svn.freebsd.org>

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

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/7/sys/dev/sis/if_sis.c
  stable/7/sys/dev/sis/if_sisreg.h
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/sis/if_sis.c
==============================================================================
--- stable/7/sys/dev/sis/if_sis.c	Mon Mar  7 00:42:22 2011	(r219356)
+++ stable/7/sys/dev/sis/if_sis.c	Mon Mar  7 00:44:00 2011	(r219357)
@@ -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/7/sys/dev/sis/if_sisreg.h
==============================================================================
--- stable/7/sys/dev/sis/if_sisreg.h	Mon Mar  7 00:42:22 2011	(r219356)
+++ stable/7/sys/dev/sis/if_sisreg.h	Mon Mar  7 00:44:00 2011	(r219357)
@@ -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?201103070044.p270i0Y5014498>