From owner-p4-projects@FreeBSD.ORG  Thu Apr  3 22:19:50 2008
Return-Path: <owner-p4-projects@FreeBSD.ORG>
Delivered-To: p4-projects@freebsd.org
Received: by hub.freebsd.org (Postfix, from userid 32767)
	id 1589A10656B3; Thu,  3 Apr 2008 22:19:50 +0000 (UTC)
Delivered-To: perforce@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CB041106566B
	for <perforce@freebsd.org>; Thu,  3 Apr 2008 22:19:49 +0000 (UTC)
	(envelope-from thompsa@freebsd.org)
Received: from repoman.freebsd.org (repoman.freebsd.org
	[IPv6:2001:4f8:fff6::29])
	by mx1.freebsd.org (Postfix) with ESMTP id B5A358FC19
	for <perforce@freebsd.org>; Thu,  3 Apr 2008 22:19:49 +0000 (UTC)
	(envelope-from thompsa@freebsd.org)
Received: from repoman.freebsd.org (localhost [127.0.0.1])
	by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m33MJno6041518
	for <perforce@freebsd.org>; Thu, 3 Apr 2008 22:19:49 GMT
	(envelope-from thompsa@freebsd.org)
Received: (from perforce@localhost)
	by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m33MJnMS041513
	for perforce@freebsd.org; Thu, 3 Apr 2008 22:19:49 GMT
	(envelope-from thompsa@freebsd.org)
Date: Thu, 3 Apr 2008 22:19:49 GMT
Message-Id: <200804032219.m33MJnMS041513@repoman.freebsd.org>
X-Authentication-Warning: repoman.freebsd.org: perforce set sender to
	thompsa@freebsd.org using -f
From: Andrew Thompson <thompsa@FreeBSD.org>
To: Perforce Change Reviews <perforce@freebsd.org>
Cc: 
Subject: PERFORCE change 139303 for review
X-BeenThere: p4-projects@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: p4 projects tree changes <p4-projects.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/p4-projects>,
	<mailto:p4-projects-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/p4-projects>
List-Post: <mailto:p4-projects@freebsd.org>
List-Help: <mailto:p4-projects-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/p4-projects>,
	<mailto:p4-projects-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 03 Apr 2008 22:19:50 -0000

http://perforce.freebsd.org/chv.cgi?CH=139303

Change 139303 by thompsa@thompsa_burger on 2008/04/03 22:19:26

	wpi_start doesnt recurse anymore.

Affected files ...

.. //depot/projects/vap/sys/dev/wpi/if_wpi.c#16 edit
.. //depot/projects/vap/sys/dev/wpi/if_wpivar.h#6 edit

Differences ...

==== //depot/projects/vap/sys/dev/wpi/if_wpi.c#16 (text+ko) ====

@@ -197,6 +197,7 @@
 static int	wpi_tx_data(struct wpi_softc *, struct mbuf *,
 		    struct ieee80211_node *, int);
 static void	wpi_start(struct ifnet *);
+static void	wpi_start_locked(struct ifnet *);
 static int	wpi_raw_xmit(struct ieee80211_node *, struct mbuf *,
 		    const struct ieee80211_bpf_params *);
 static void	wpi_scan_start(struct ieee80211com *);
@@ -1585,7 +1586,7 @@
 
 	sc->sc_tx_timer = 0;
 	ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
-	wpi_start(ifp);
+	wpi_start_locked(ifp);
 }
 
 static void
@@ -1985,17 +1986,25 @@
 wpi_start(struct ifnet *ifp)
 {
 	struct wpi_softc *sc = ifp->if_softc;
+
+	WPI_LOCK(sc);
+	wpi_start_locked(ifp);
+	WPI_UNLOCK(sc);
+}
+
+static void
+wpi_start_locked(struct ifnet *ifp)
+{
+	struct wpi_softc *sc = ifp->if_softc;
 	struct ieee80211_node *ni;
 	struct mbuf *m;
-	int ac, waslocked;
+	int ac;
+
+	WPI_LOCK_ASSERT(sc);
 
 	if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
 		return;
 
-	waslocked = WPI_LOCK_OWNED(sc);
-	if (!waslocked)
-		WPI_LOCK(sc);
-
 	for (;;) {
 		IFQ_POLL(&ifp->if_snd, m);
 		if (m == NULL)
@@ -2023,9 +2032,6 @@
 		}
 		sc->sc_tx_timer = 5;
 	}
-
-	if (!waslocked)
-		WPI_UNLOCK(sc);
 }
 
 static int

==== //depot/projects/vap/sys/dev/wpi/if_wpivar.h#6 (text+ko) ====

@@ -238,7 +238,6 @@
 #define WPI_LOCK(_sc)		mtx_lock(&(_sc)->sc_mtx)
 #define WPI_UNLOCK(_sc)		mtx_unlock(&(_sc)->sc_mtx)
 #define WPI_LOCK_ASSERT(sc)     mtx_assert(&(sc)->sc_mtx, MA_OWNED)
-#define WPI_LOCK_OWNED(_sc)	mtx_owned(&(_sc)->sc_mtx)
 #define WPI_LOCK_DESTROY(_sc)	mtx_destroy(&(_sc)->sc_mtx)
 
 #define WPI_CMD_LOCK_INIT(_sc)  \