svn commit: r296233 - head/sys/net80211

Andriy Voskoboinyk avos at FreeBSD.org
Mon Feb 29 20:56:04 UTC 2016


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;


More information about the svn-src-head mailing list