Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Nov 2006 21:48:28 GMT
From:      Olivier Houchard <cognet@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 109485 for review
Message-ID:  <200611072148.kA7LmSRk061525@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=109485

Change 109485 by cognet@cognet on 2006/11/07 21:47:39

	Introduce ixpnpe_sendandrecvmsg_locked(), to avoid having to drop then
	re-lock the softc mutex in the tick method.

Affected files ...

.. //depot/projects/arm/src/sys/arm/xscale/ixp425/if_npe.c#11 edit
.. //depot/projects/arm/src/sys/arm/xscale/ixp425/ixp425_npe.c#5 edit
.. //depot/projects/arm/src/sys/arm/xscale/ixp425/ixp425_npevar.h#4 edit

Differences ...

==== //depot/projects/arm/src/sys/arm/xscale/ixp425/if_npe.c#11 (text+ko) ====

@@ -655,9 +655,7 @@
 
 	NPE_ASSERT_LOCKED(sc);
 
-	NPE_UNLOCK(sc);			/* XXX */
 	npe_updatestats(sc);		/* update + clear stats */
-	NPE_LOCK(sc);
 
 	bus_dmamap_sync(sc->sc_stats_tag, sc->sc_stats_map,
 		BUS_DMASYNC_POSTREAD);
@@ -1238,7 +1236,7 @@
 
 	msg[0] = NPE_RESETSTATS << NPE_MAC_MSGID_SHL;
 	msg[1] = sc->sc_stats_phys;	/* physical address of stat block */
-	return ixpnpe_sendandrecvmsg(sc->sc_npe, msg, msg);
+	return ixpnpe_sendandrecvmsg_locked(sc->sc_npe, msg, msg);
 }
 
 #if 0

==== //depot/projects/arm/src/sys/arm/xscale/ixp425/ixp425_npe.c#5 (text+ko) ====

@@ -1352,16 +1352,26 @@
  * make other locking confusing.
  */
 int
-ixpnpe_sendandrecvmsg(struct ixpnpe_softc *sc,
+ixpnpe_sendandrecvmsg_locked(struct ixpnpe_softc *sc,
 	const uint32_t send[2], uint32_t recv[2])
 {
     int error;
 
-    mtx_lock(&sc->sc_mtx);
     error = ixpnpe_sendmsg_locked(sc, send);
     if (error == 0)
 	error = ixpnpe_recvmsg_locked(sc, recv);
-    mtx_unlock(&sc->sc_mtx);
 
     return error;
 }
+
+int
+ixpnpe_sendandrecvmsg(struct ixpnpe_softc *sc,
+	const uint32_t send[2], uint32_t recv[2])
+{
+	int error;
+	
+	mtx_lock(&sc->sc_mtx);
+	error = ixpnpe_sendandrecvmsg_locked(sc, send, recv);
+	mtx_unlock(&sc->sc_mtx);
+	return (error);
+}

==== //depot/projects/arm/src/sys/arm/xscale/ixp425/ixp425_npevar.h#4 (text+ko) ====

@@ -89,4 +89,6 @@
 
 int	ixpnpe_sendandrecvmsg(struct ixpnpe_softc *, const uint32_t send[2],
 		uint32_t recv[2]);
+int	ixpnpe_sendandrecvmsg_locked(struct ixpnpe_softc *, 
+    		const uint32_t send[2], uint32_t recv[2]);
 #endif /* _IXP425_NPEVAR_H_ */



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