git: bb6b965bebc7 - stable/13 - net80211: simplify code after STA/AP VAPs traffic hang fix

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Fri, 03 Jun 2022 17:19:20 UTC
The branch stable/13 has been updated by bz:

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

commit bb6b965bebc70085320d6d58e6a048a7b1bf0edc
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2022-05-05 22:21:03 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2022-06-03 16:56:01 +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
    Reviewed by:    adrian
    Differential Revision: https://reviews.freebsd.org/D35135
    
    (cherry picked from commit 464907ce1cf931091fa48999ea64480a6d2ef52c)
---
 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);