From owner-svn-src-head@freebsd.org Mon Feb 29 20:36:02 2016 Return-Path: Delivered-To: svn-src-head@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 E897BAB98CD; Mon, 29 Feb 2016 20:36:01 +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 AA6EF382; Mon, 29 Feb 2016 20:36:01 +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 u1TKa02Y083903; Mon, 29 Feb 2016 20:36:00 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u1TKa0O9083902; Mon, 29 Feb 2016 20:36:00 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201602292036.u1TKa0O9083902@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:36:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r296227 - 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-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Feb 2016 20:36:02 -0000 Author: avos Date: Mon Feb 29 20:36:00 2016 New Revision: 296227 URL: https://svnweb.freebsd.org/changeset/base/296227 Log: net80211: reduce code duplication between ieee80211_swscan_cancel_scan() and ieee80211_swscan_cancel_anyscan() Tested with: * Intel 3945BG, STA mode. * RTL8188EU, HOSTAP mode. Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D5133 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:21:54 2016 (r296226) +++ head/sys/net80211/ieee80211_scan_sw.c Mon Feb 29 20:36:00 2016 (r296227) @@ -426,21 +426,18 @@ ieee80211_swscan_bg_scan(const struct ie return (ic->ic_flags & IEEE80211_F_SCAN); } -/* - * Cancel any scan currently going on for the specified vap. - */ static void -ieee80211_swscan_cancel_scan(struct ieee80211vap *vap) +cancel_scan(struct ieee80211vap *vap, int any, const char *func) { struct ieee80211com *ic = vap->iv_ic; struct ieee80211_scan_state *ss = ic->ic_scan; IEEE80211_LOCK(ic); if ((ic->ic_flags & IEEE80211_F_SCAN) && - ss->ss_vap == vap && + (any || ss->ss_vap == vap) && (SCAN_PRIVATE(ss)->ss_iflags & ISCAN_CANCEL) == 0) { IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN, - "%s: cancel %s scan\n", __func__, + "%s: cancel %s scan\n", func, ss->ss_flags & IEEE80211_SCAN_ACTIVE ? "active" : "passive"); @@ -452,7 +449,7 @@ ieee80211_swscan_cancel_scan(struct ieee } else { IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN, "%s: called; F_SCAN=%d, vap=%s, CANCEL=%d\n", - __func__, + func, !! (ic->ic_flags & IEEE80211_F_SCAN), (ss->ss_vap == vap ? "match" : "nomatch"), !! (SCAN_PRIVATE(ss)->ss_iflags & ISCAN_CANCEL)); @@ -461,36 +458,21 @@ ieee80211_swscan_cancel_scan(struct ieee } /* + * Cancel any scan currently going on for the specified vap. + */ +static void +ieee80211_swscan_cancel_scan(struct ieee80211vap *vap) +{ + cancel_scan(vap, 0, __func__); +} + +/* * Cancel any scan currently going on. */ static void ieee80211_swscan_cancel_anyscan(struct ieee80211vap *vap) { - struct ieee80211com *ic = vap->iv_ic; - struct ieee80211_scan_state *ss = ic->ic_scan; - - IEEE80211_LOCK(ic); - if ((ic->ic_flags & IEEE80211_F_SCAN) && - (SCAN_PRIVATE(ss)->ss_iflags & ISCAN_CANCEL) == 0) { - IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN, - "%s: cancel %s scan\n", __func__, - ss->ss_flags & IEEE80211_SCAN_ACTIVE ? - "active" : "passive"); - - /* clear bg scan NOPICK and mark cancel request */ - ss->ss_flags &= ~IEEE80211_SCAN_NOPICK; - SCAN_PRIVATE(ss)->ss_iflags |= ISCAN_CANCEL; - /* wake up the scan task */ - scan_signal(ss); - } else { - IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN, - "%s: called; F_SCAN=%d, vap=%s, CANCEL=%d\n", - __func__, - !! (ic->ic_flags & IEEE80211_F_SCAN), - (ss->ss_vap == vap ? "match" : "nomatch"), - !! (SCAN_PRIVATE(ss)->ss_iflags & ISCAN_CANCEL)); - } - IEEE80211_UNLOCK(ic); + cancel_scan(vap, 1, __func__); } /*