From owner-svn-src-all@freebsd.org Fri Sep 30 18:43:40 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 2E485C04614; Fri, 30 Sep 2016 18:43:40 +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 09A6ED7B; Fri, 30 Sep 2016 18:43:39 +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 u8UIhdFF082705; Fri, 30 Sep 2016 18:43:39 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8UIhdY1082704; Fri, 30 Sep 2016 18:43:39 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201609301843.u8UIhdY1082704@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Fri, 30 Sep 2016 18:43:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r306519 - 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.23 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: Fri, 30 Sep 2016 18:43:40 -0000 Author: avos Date: Fri Sep 30 18:43:39 2016 New Revision: 306519 URL: https://svnweb.freebsd.org/changeset/base/306519 Log: net80211: do not cancel scan when packet is sent. Restore pre-r300383 behavior when a frame is sent: - stop scan; - send frame; - when beacon arrives and our bit in TIM is not set - restart the scan. NOTE: Ideally, this should introduce new interface (ieee80211_pause_anyscan()); however, since ieee80211_cancel_anyscan() is not used by drivers and only called by ieee80211_start_pkt() the current patch overrides it's behavior instead. Tested with Intel 3945BG, STA mode Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D7979 Modified: head/sys/net80211/ieee80211_scan_sw.c Modified: head/sys/net80211/ieee80211_scan_sw.c ============================================================================== --- head/sys/net80211/ieee80211_scan_sw.c Fri Sep 30 18:36:23 2016 (r306518) +++ head/sys/net80211/ieee80211_scan_sw.c Fri Sep 30 18:43:39 2016 (r306519) @@ -57,9 +57,11 @@ struct scan_state { u_int ss_iflags; /* flags used internally */ #define ISCAN_MINDWELL 0x0001 /* min dwell time reached */ #define ISCAN_DISCARD 0x0002 /* discard rx'd frames */ -#define ISCAN_CANCEL 0x0004 /* cancel current scan */ -#define ISCAN_ABORT 0x0008 /* end the scan immediately */ -#define ISCAN_RUNNING 0x0010 /* scan was started */ +#define ISCAN_INTERRUPT 0x0004 /* interrupt current scan */ +#define ISCAN_CANCEL 0x0008 /* cancel current scan */ +#define ISCAN_PAUSE (ISCAN_INTERRUPT | ISCAN_CANCEL) +#define ISCAN_ABORT 0x0010 /* end the scan immediately */ +#define ISCAN_RUNNING 0x0020 /* scan was started */ unsigned long ss_chanmindwell; /* min dwell on curchan */ unsigned long ss_scanend; /* time scan must stop */ @@ -415,27 +417,31 @@ cancel_scan(struct ieee80211vap *vap, in { struct ieee80211com *ic = vap->iv_ic; struct ieee80211_scan_state *ss = ic->ic_scan; + struct scan_state *ss_priv = SCAN_PRIVATE(ss); + int signal; IEEE80211_LOCK(ic); + signal = any ? ISCAN_PAUSE : ISCAN_CANCEL; if ((ic->ic_flags & IEEE80211_F_SCAN) && (any || ss->ss_vap == vap) && - (SCAN_PRIVATE(ss)->ss_iflags & ISCAN_CANCEL) == 0) { + (ss_priv->ss_iflags & signal) == 0) { IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN, - "%s: cancel %s scan\n", func, + "%s: %s %s scan\n", func, + any ? "pause" : "cancel", ss->ss_flags & IEEE80211_SCAN_ACTIVE ? "active" : "passive"); /* clear bg scan NOPICK */ ss->ss_flags &= ~IEEE80211_SCAN_NOPICK; - /* mark cancel request and wake up the scan task */ - scan_signal_locked(ss, ISCAN_CANCEL); + /* mark request and wake up the scan task */ + scan_signal_locked(ss, signal); } else { IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN, - "%s: called; F_SCAN=%d, vap=%s, CANCEL=%d\n", + "%s: called; F_SCAN=%d, vap=%s, signal=%d\n", func, !! (ic->ic_flags & IEEE80211_F_SCAN), (ss->ss_vap == vap ? "match" : "nomatch"), - !! (SCAN_PRIVATE(ss)->ss_iflags & ISCAN_CANCEL)); + !! (ss_priv->ss_iflags & signal)); } IEEE80211_UNLOCK(ic); } @@ -868,9 +874,11 @@ scan_done(struct ieee80211_scan_state *s if (ss->ss_next >= ss->ss_last) ic->ic_flags_ext &= ~IEEE80211_FEXT_BGSCAN; - ieee80211_notify_scan_done(vap); + /* send 'scan done' event if not interrupted due to traffic. */ + if (!(ss_priv->ss_iflags & ISCAN_INTERRUPT)) + ieee80211_notify_scan_done(vap); } - ss_priv->ss_iflags &= ~(ISCAN_CANCEL|ISCAN_ABORT); + ss_priv->ss_iflags &= ~(ISCAN_PAUSE | ISCAN_ABORT); ss_priv->ss_scanend = 0; ss->ss_flags &= ~(IEEE80211_SCAN_ONCE | IEEE80211_SCAN_PICK1ST); IEEE80211_UNLOCK(ic);