Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Apr 2009 17:41:48 +0000 (UTC)
From:      Andrew Thompson <thompsa@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r191066 - user/thompsa/vaptq/sys/net80211
Message-ID:  <200904141741.n3EHfmg5014985@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: thompsa
Date: Tue Apr 14 17:41:48 2009
New Revision: 191066
URL: http://svn.freebsd.org/changeset/base/191066

Log:
  - Dont hold the lock over the driver scan calls
  - Reshuffle the exit flag checks to avoid the cv sleep on abort

Modified:
  user/thompsa/vaptq/sys/net80211/ieee80211_scan.c

Modified: user/thompsa/vaptq/sys/net80211/ieee80211_scan.c
==============================================================================
--- user/thompsa/vaptq/sys/net80211/ieee80211_scan.c	Tue Apr 14 17:14:35 2009	(r191065)
+++ user/thompsa/vaptq/sys/net80211/ieee80211_scan.c	Tue Apr 14 17:41:48 2009	(r191066)
@@ -885,12 +885,15 @@ scan_task(void *arg, int pending)
 
 	printf("%s: starting scan loop\n", __func__);
 	scanend = ticks + SCAN_PRIVATE(ss)->ss_duration;
+	IEEE80211_UNLOCK(ic);
 	ic->ic_scan_start(ic);		/* notify driver */
+	IEEE80211_LOCK(ic);
 
 	for (;;) {
 		scandone = (ss->ss_next >= ss->ss_last) ||
 		    (SCAN_PRIVATE(ss)->ss_iflags & ISCAN_CANCEL) != 0;
 		if (scandone || (ss->ss_flags & IEEE80211_SCAN_GOTPICK) ||
+		    (SCAN_PRIVATE(ss)->ss_iflags & ISCAN_ABORT) ||
 		     time_after(ticks + ss->ss_mindwell, scanend))
 			break;
 
@@ -927,18 +930,26 @@ scan_task(void *arg, int pending)
 		 * sending a probe request (as needed), and arming the
 		 * timeout to switch channels after maxdwell ticks.
 		 */
+		IEEE80211_UNLOCK(ic);
 		ic->ic_scan_curchan(ss, maxdwell);
+		IEEE80211_LOCK(ic);
 
 		SCAN_PRIVATE(ss)->ss_chanmindwell = ticks + ss->ss_mindwell;
 		/* clear mindwell lock and initial channel change flush */
 		SCAN_PRIVATE(ss)->ss_iflags &= ~ISCAN_REP;
 
+		if ((SCAN_PRIVATE(ss)->ss_iflags & (ISCAN_CANCEL|ISCAN_ABORT)))
+			continue;
+
 		/* Wait to be signalled to scan the next channel */
 		cv_wait(&SCAN_PRIVATE(ss)->ss_scan_cv, IEEE80211_LOCK_OBJ(ic));
-		if (SCAN_PRIVATE(ss)->ss_iflags & ISCAN_ABORT)
-			goto done;
 	}
+	if (SCAN_PRIVATE(ss)->ss_iflags & ISCAN_ABORT)
+		goto done;
+
+	IEEE80211_UNLOCK(ic);
 	ic->ic_scan_end(ic);		/* notify driver */
+	IEEE80211_LOCK(ic);
 
 	/*
 	 * Record scan complete time.  Note that we also do



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