PERFORCE change 77360 for review

Sam Leffler sam at FreeBSD.org
Mon May 23 21:22:21 GMT 2005


http://perforce.freebsd.org/chv.cgi?CH=77360

Change 77360 by sam at sam_ebb on 2005/05/23 21:21:54

	code shuffle

Affected files ...

.. //depot/projects/vap/sys/net80211/ieee80211_power.c#2 edit

Differences ...

==== //depot/projects/vap/sys/net80211/ieee80211_power.c#2 (text+ko) ====

@@ -314,52 +314,51 @@
 	struct ieee80211_node *ni = vap->iv_bss;
 	int qlen;
 
+	if (!((enable != 0) ^ ((ni->ni_flags & IEEE80211_NODE_PWR_MGT) != 0)))
+		return;
+
 	IEEE80211_NOTE(vap, IEEE80211_MSG_POWER, ni,
 	    "sta power save mode %s", enable ? "on" : "off");
 	if (!enable) {
-		if (ni->ni_flags & IEEE80211_NODE_PWR_MGT) {
-			ni->ni_flags &= ~IEEE80211_NODE_PWR_MGT;
-			ieee80211_send_nulldata(ieee80211_ref_node(ni));
-			/*
-			 * Flush any queued frames; we can do this immediately
-			 * because we know they'll be queued behind the null
-			 * data frame we send the ap.
-			 * XXX can we use a data frame to take us out of ps?
-			 */
-			qlen = IEEE80211_NODE_SAVEQ_QLEN(ni);
-			if (qlen != 0) {
-				struct ifnet *ifp = &vap->iv_arp.ac_if;
-				struct ifaltq *ifq = &ifp->if_snd;
-				struct ifqueue *psq = &ni->ni_savedq;
-				int active;
+		ni->ni_flags &= ~IEEE80211_NODE_PWR_MGT;
+		ieee80211_send_nulldata(ieee80211_ref_node(ni));
+		/*
+		 * Flush any queued frames; we can do this immediately
+		 * because we know they'll be queued behind the null
+		 * data frame we send the ap.
+		 * XXX can we use a data frame to take us out of ps?
+		 */
+		qlen = IEEE80211_NODE_SAVEQ_QLEN(ni);
+		if (qlen != 0) {
+			struct ifnet *ifp = &vap->iv_arp.ac_if;
+			struct ifaltq *ifq = &ifp->if_snd;
+			struct ifqueue *psq = &ni->ni_savedq;
+			int active;
 
-				IEEE80211_NOTE(vap, IEEE80211_MSG_POWER, ni,
-				    "flush ps queue, %u packets queued", qlen);
-				active = 1;
-				IF_LOCK(ifq);
-				IF_LOCK(psq);
-				for (;;) {
-					struct mbuf *m;
+			IEEE80211_NOTE(vap, IEEE80211_MSG_POWER, ni,
+			    "flush ps queue, %u packets queued", qlen);
+			active = 1;
+			IF_LOCK(ifq);
+			IF_LOCK(psq);
+			for (;;) {
+				struct mbuf *m;
 
-					if (_IF_QLEN(psq) == 0)
-						break;
-					if (_IF_QFULL(ifq))
-						break;
-					_IF_DEQUEUE(psq, m);
-					/* NB: no accounting, already done */
-					_IF_ENQUEUE(ifq, m);
-					active = ifp->if_flags & IFF_OACTIVE;
-				}
-				IF_UNLOCK(psq);
-				IF_UNLOCK(ifq);
-				if (!active)
-					if_start(ifp);
+				if (_IF_QLEN(psq) == 0)
+					break;
+				if (_IF_QFULL(ifq))
+					break;
+				_IF_DEQUEUE(psq, m);
+				/* NB: no accounting, already done */
+				_IF_ENQUEUE(ifq, m);
+				active = ifp->if_flags & IFF_OACTIVE;
 			}
+			IF_UNLOCK(psq);
+			IF_UNLOCK(ifq);
+			if (!active)
+				if_start(ifp);
 		}
 	} else {
-		if ((ni->ni_flags & IEEE80211_NODE_PWR_MGT) == 0) {
-			ni->ni_flags |= IEEE80211_NODE_PWR_MGT;
-			ieee80211_send_nulldata(ieee80211_ref_node(ni));
-		}
+		ni->ni_flags |= IEEE80211_NODE_PWR_MGT;
+		ieee80211_send_nulldata(ieee80211_ref_node(ni));
 	}
 }


More information about the p4-projects mailing list