git: 464907ce1cf9 - main - net80211: simplify code after STA/AP VAPs traffic hang fix

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Fri, 06 May 2022 09:36:48 UTC
The branch main has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=464907ce1cf931091fa48999ea64480a6d2ef52c

commit 464907ce1cf931091fa48999ea64480a6d2ef52c
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2022-05-05 22:21:03 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2022-05-06 09:34:16 +0000

    net80211: simplify code after STA/AP VAPs traffic hang fix
    
    Combine the comment and double-unsetting of OACTIVE into a single case
    after e8de31caceaa36caf5d7b4355072f148e2433b82.
    This saves the question of why we do it twice--once right before and
    one more time right after the state change check.
    Also move the XXX comment about kicking the queue up to where it seems
    better suited now.
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      3 days
    Reviewed by:    adrian
    Differential Revision: https://reviews.freebsd.org/D35135
---
 sys/net80211/ieee80211_proto.c | 28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/sys/net80211/ieee80211_proto.c b/sys/net80211/ieee80211_proto.c
index d2bde99ce79c..f42c62444579 100644
--- a/sys/net80211/ieee80211_proto.c
+++ b/sys/net80211/ieee80211_proto.c
@@ -2582,18 +2582,6 @@ ieee80211_newstate_cb(void *xvap, int npending)
 	 * be no-op code - and also if OACTIVE is finally retired, it'll
 	 * also be no-op code.
 	 */
-	if (nstate == IEEE80211_S_RUN) {
-		/*
-		 * Unblock the VAP queue; a RUN->RUN state can happen
-		 * on a STA+AP setup on the AP vap.  See wakeupwaiting().
-		 */
-		vap->iv_ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
-	}
-
-	/* No actual transition, skip post processing */
-	if (ostate == nstate)
-		goto done;
-
 	if (nstate == IEEE80211_S_RUN) {
 		/*
 		 * OACTIVE may be set on the vap if the upper layer
@@ -2602,12 +2590,28 @@ ieee80211_newstate_cb(void *xvap, int npending)
 		 *
 		 * Note this can also happen as a result of SLEEP->RUN
 		 * (i.e. coming out of power save mode).
+		 *
+		 * Historically this was done only for a state change
+		 * but is needed earlier; see next comment.  The 2nd half
+		 * of the work is still only done in case of an actual
+		 * state change below.
+		 */
+		/*
+		 * Unblock the VAP queue; a RUN->RUN state can happen
+		 * on a STA+AP setup on the AP vap.  See wakeupwaiting().
 		 */
 		vap->iv_ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
 
 		/*
 		 * XXX TODO Kick-start a VAP queue - this should be a method!
 		 */
+	}
+
+	/* No actual transition, skip post processing */
+	if (ostate == nstate)
+		goto done;
+
+	if (nstate == IEEE80211_S_RUN) {
 
 		/* bring up any vaps waiting on us */
 		wakeupwaiting(vap);