From owner-svn-src-all@freebsd.org Mon Feb 29 20:56:04 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 3413AAB70E2; Mon, 29 Feb 2016 20:56:04 +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 DFFDF15CB; Mon, 29 Feb 2016 20:56:03 +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 u1TKu2la090001; Mon, 29 Feb 2016 20:56:02 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u1TKu22m089999; Mon, 29 Feb 2016 20:56:02 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201602292056.u1TKu22m089999@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:56:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r296233 - 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:56:04 -0000 Author: avos Date: Mon Feb 29 20:56:02 2016 New Revision: 296233 URL: https://svnweb.freebsd.org/changeset/base/296233 Log: net80211: wakeup scan_start() task when null data frame was actually transmitted - Use M_TXCB mechanism to report about null data frame transmission. - Increase timeout from 1 to 10 ms (the previous one may be not enough for non-empty queue). Tested with: * Intel 3945BG, STA mode. * RTL8188CUS, STA mode. Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D5147 Modified: head/sys/net80211/ieee80211_output.c head/sys/net80211/ieee80211_scan_sw.c Modified: head/sys/net80211/ieee80211_output.c ============================================================================== --- head/sys/net80211/ieee80211_output.c Mon Feb 29 20:53:27 2016 (r296232) +++ head/sys/net80211/ieee80211_output.c Mon Feb 29 20:56:02 2016 (r296233) @@ -849,6 +849,15 @@ ieee80211_mgmt_output(struct ieee80211_n return (ret); } +static void +ieee80211_nulldata_transmitted(struct ieee80211_node *ni, void *arg, + int status) +{ + struct ieee80211vap *vap = ni->ni_vap; + + wakeup(vap); +} + /* * Send a null data frame to the specified node. If the station * is setup for QoS then a QoS Null Data frame is constructed. @@ -937,6 +946,11 @@ ieee80211_send_nulldata(struct ieee80211 vap->iv_opmode != IEEE80211_M_HOSTAP) wh->i_fc[1] |= IEEE80211_FC1_PWR_MGT; } + if ((ic->ic_flags & IEEE80211_F_SCAN) && + (ni->ni_flags & IEEE80211_NODE_PWR_MGT)) { + ieee80211_add_callback(m, ieee80211_nulldata_transmitted, + NULL); + } m->m_len = m->m_pkthdr.len = hdrlen; m->m_flags |= M_ENCAP; /* mark encapsulated */ Modified: head/sys/net80211/ieee80211_scan_sw.c ============================================================================== --- head/sys/net80211/ieee80211_scan_sw.c Mon Feb 29 20:53:27 2016 (r296232) +++ head/sys/net80211/ieee80211_scan_sw.c Mon Feb 29 20:56:02 2016 (r296233) @@ -629,13 +629,9 @@ scan_start(void *arg, int pending) if ((vap->iv_bss->ni_flags & IEEE80211_NODE_PWR_MGT) == 0) { /* Enable station power save mode */ vap->iv_sta_ps(vap, 1); - /* - * Use an 1ms delay so the null data frame has a chance - * to go out. - * XXX Should use M_TXCB mechanism to eliminate this. - */ + /* Wait until null data frame will be ACK'ed */ mtx_sleep(vap, IEEE80211_LOCK_OBJ(ic), PCATCH, - "sta_ps", msecs_to_ticks(1)); + "sta_ps", msecs_to_ticks(10)); if (ss_priv->ss_iflags & ISCAN_ABORT) { scan_done(ss, 0); return;