From owner-p4-projects@FreeBSD.ORG  Sat Jun  9 20:12:23 2007
Return-Path: <owner-p4-projects@FreeBSD.ORG>
X-Original-To: p4-projects@freebsd.org
Delivered-To: p4-projects@freebsd.org
Received: by hub.freebsd.org (Postfix, from userid 32767)
	id C5DE016A46D; Sat,  9 Jun 2007 20:12:22 +0000 (UTC)
X-Original-To: perforce@freebsd.org
Delivered-To: perforce@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 5FC6F16A469
	for <perforce@freebsd.org>; Sat,  9 Jun 2007 20:12:22 +0000 (UTC)
	(envelope-from thompsa@freebsd.org)
Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41])
	by mx1.freebsd.org (Postfix) with ESMTP id 46B0813C46E
	for <perforce@freebsd.org>; Sat,  9 Jun 2007 20:12:22 +0000 (UTC)
	(envelope-from thompsa@freebsd.org)
Received: from repoman.freebsd.org (localhost [127.0.0.1])
	by repoman.freebsd.org (8.13.8/8.13.8) with ESMTP id l59KCMFm033756
	for <perforce@freebsd.org>; Sat, 9 Jun 2007 20:12:22 GMT
	(envelope-from thompsa@freebsd.org)
Received: (from perforce@localhost)
	by repoman.freebsd.org (8.13.8/8.13.8/Submit) id l59KCL7C033740
	for perforce@freebsd.org; Sat, 9 Jun 2007 20:12:21 GMT
	(envelope-from thompsa@freebsd.org)
Date: Sat, 9 Jun 2007 20:12:21 GMT
Message-Id: <200706092012.l59KCL7C033740@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 121293 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: Sat, 09 Jun 2007 20:12:23 -0000

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

Change 121293 by thompsa@thompsa_heff on 2007/06/09 20:11:40

	Move the scan abort code into its own taskqueue, it needs to be able to
	reset scan even if iwi_ops is blocked on a state.

Affected files ...

.. //depot/projects/wifi/sys/dev/iwi/if_iwi.c#47 edit
.. //depot/projects/wifi/sys/dev/iwi/if_iwivar.h#21 edit

Differences ...

==== //depot/projects/wifi/sys/dev/iwi/if_iwi.c#47 (text+ko) ====

@@ -165,6 +165,7 @@
 static int	iwi_scanchan(struct iwi_softc *, unsigned long, int);
 static void	iwi_scan_start(struct ieee80211com *);
 static void	iwi_scan_end(struct ieee80211com *);
+static void	iwi_scanabort(void *, int);
 static void	iwi_set_channel(struct ieee80211com *);
 static void	iwi_scan_curchan(struct ieee80211com *, unsigned long maxdwell);
 #if 0
@@ -280,6 +281,7 @@
 	TASK_INIT(&sc->sc_radiofftask, 0, iwi_radio_off, sc);
 	TASK_INIT(&sc->sc_restarttask, 0, iwi_restart, sc);
 	TASK_INIT(&sc->sc_opstask, 0, iwi_ops, sc);
+	TASK_INIT(&sc->sc_scanaborttask, 0, iwi_scanabort, sc);
 	callout_init_mtx(&sc->sc_wdtimer, &sc->sc_mtx, 0);
 
 	if (pci_get_powerstate(dev) != PCI_POWERSTATE_D0) {
@@ -2818,6 +2820,20 @@
 	return (iwi_cmd(sc, IWI_CMD_SCAN_EXT, &scan, sizeof scan));
 }
 
+static void
+iwi_scanabort(void *arg, int npending)
+{
+	struct iwi_softc *sc = arg;
+	IWI_LOCK_DECL;
+
+	IWI_LOCK(sc);
+	sc->flags &= ~IWI_FLAG_CHANNEL_SCAN;
+	/* NB: make sure we're still scanning */
+	if (sc->fw_state == IWI_FW_SCANNING)
+		iwi_cmd(sc, IWI_CMD_ABORT_SCAN, NULL, 0);
+	IWI_UNLOCK(sc);
+}
+
 static int
 iwi_set_sensitivity(struct iwi_softc *sc, int8_t rssi_dbm)
 {
@@ -3573,12 +3589,6 @@
 	case IWI_SCAN_START:
 		sc->flags |= IWI_FLAG_CHANNEL_SCAN;
 		break;
-	case IWI_SCAN_END:
-		sc->flags &= ~IWI_FLAG_CHANNEL_SCAN;
-		/* NB: make sure we're still scanning */
-		if (sc->fw_state == IWI_FW_SCANNING)
-			iwi_cmd(sc, IWI_CMD_ABORT_SCAN, NULL, 0);
-		break;
 	case IWI_SCAN_CURCHAN:
 	case IWI_SCAN_ALLCHAN:
 		if (!(sc->flags & IWI_FLAG_CHANNEL_SCAN)) {
@@ -3667,7 +3677,7 @@
 	struct ifnet *ifp = ic->ic_ifp;
 	struct iwi_softc *sc = ifp->if_softc;
 
-	iwi_queue_cmd(sc, IWI_SCAN_END);
+	taskqueue_enqueue(sc->sc_tq, &sc->sc_scanaborttask);
 }
 
 static void

==== //depot/projects/wifi/sys/dev/iwi/if_iwivar.h#21 (text+ko) ====

@@ -189,6 +189,7 @@
 
 	struct task		sc_radiontask;	/* radio on processing */
 	struct task		sc_radiofftask;	/* radio off processing */
+	struct task		sc_scanaborttask;	/* cancel active scan */
 	struct task		sc_restarttask;	/* restart adapter processing */
 	struct task		sc_opstask;	/* scan / auth processing */