From owner-svn-src-all@freebsd.org Mon Feb 29 20:45:00 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C5E78AB9BB3; Mon, 29 Feb 2016 20:45:00 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 87D9CD0D; Mon, 29 Feb 2016 20:45:00 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u1TKixY8086903; Mon, 29 Feb 2016 20:44:59 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u1TKixRr086902; Mon, 29 Feb 2016 20:44:59 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201602292044.u1TKixRr086902@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Mon, 29 Feb 2016 20:44:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r296230 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Feb 2016 20:45:01 -0000 Author: avos Date: Mon Feb 29 20:44:59 2016 New Revision: 296230 URL: https://svnweb.freebsd.org/changeset/base/296230 Log: net80211: split scan_task() (#1) (replace 'done' label with scan_done() function) Tested with: * Intel 3945BG, STA mode. * RTL8188EU, IBSS mode. Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D5142 Modified: head/sys/net80211/ieee80211_scan_sw.c Modified: head/sys/net80211/ieee80211_scan_sw.c ============================================================================== --- head/sys/net80211/ieee80211_scan_sw.c Mon Feb 29 20:41:10 2016 (r296229) +++ head/sys/net80211/ieee80211_scan_sw.c Mon Feb 29 20:44:59 2016 (r296230) @@ -100,6 +100,7 @@ static void scan_curchan(struct ieee8021 static void scan_mindwell(struct ieee80211_scan_state *); static void scan_signal(void *); static void scan_task(void *, int); +static void scan_done(struct ieee80211_scan_state *, int); MALLOC_DEFINE(M_80211_SCAN, "80211scan", "802.11 scan state"); @@ -604,14 +605,15 @@ scan_task(void *arg, int pending) if (vap == NULL || (ic->ic_flags & IEEE80211_F_SCAN) == 0 || (ss_priv->ss_iflags & ISCAN_ABORT)) { /* Cancelled before we started */ - goto done; + scan_done(ss, 0); + return; } if (ss->ss_next == ss->ss_last) { IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN, "%s: no channels to scan\n", __func__); - scandone = 1; - goto done; + scan_done(ss, 1); + return; } if (vap->iv_opmode == IEEE80211_M_STA && @@ -626,8 +628,10 @@ scan_task(void *arg, int pending) */ cv_timedwait(&ss_priv->ss_scan_cv, IEEE80211_LOCK_OBJ(ic), msecs_to_ticks(1)); - if (ss_priv->ss_iflags & ISCAN_ABORT) - goto done; + if (ss_priv->ss_iflags & ISCAN_ABORT) { + scan_done(ss, 0); + return; + } } } @@ -721,8 +725,10 @@ scan_task(void *arg, int pending) IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN, "%s: out\n", __func__); - if (ss_priv->ss_iflags & ISCAN_ABORT) - goto done; + if (ss_priv->ss_iflags & ISCAN_ABORT) { + scan_done(ss, scandone); + return; + } IEEE80211_UNLOCK(ic); ic->ic_scan_end(ic); /* notify driver */ @@ -810,14 +816,26 @@ scan_task(void *arg, int pending) scandone = 1; } + scan_done(ss, scandone); +} + +static void +scan_done(struct ieee80211_scan_state *ss, int scandone) +{ + struct scan_state *ss_priv = SCAN_PRIVATE(ss); + struct ieee80211com *ic = ss->ss_ic; + struct ieee80211vap *vap = ss->ss_vap; + + IEEE80211_LOCK_ASSERT(ic); + /* * Clear the SCAN bit first in case frames are * pending on the station power save queue. If * we defer this then the dispatch of the frames * may generate a request to cancel scanning. */ -done: ic->ic_flags &= ~IEEE80211_F_SCAN; + /* * Drop out of power save mode when a scan has * completed. If this scan was prematurely terminated