Bug 285822 - rtwn filters BARs for the VAP when not in promiscuous mode
Summary: rtwn filters BARs for the VAP when not in promiscuous mode
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: wireless (show other bugs)
Version: 15.0-CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-wireless (Nobody)
URL:
Keywords:
Depends on:
Blocks: rtwn-tum-run-mtw
  Show dependency treegraph
 
Reported: 2025-03-31 21:36 UTC by Jessica Clarke
Modified: 2025-04-23 02:05 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jessica Clarke freebsd_committer freebsd_triage 2025-03-31 21:36:46 UTC
Without ifconfig wlan0 promisc, tracing sta_input and ieee80211_recv_bar, I do not see any BARs being reported.

Hardware is a T2U Nano (RTL8821AU).
Comment 1 Jessica Clarke freebsd_committer freebsd_triage 2025-03-31 22:01:46 UTC
The following seems to resolve this for me (I see a BAR come through for the VAP, and no others). Whether it's the right approach or not I leave up to people who actually know what they're doing.

diff --git a/sys/dev/rtwn/if_rtwn.c b/sys/dev/rtwn/if_rtwn.c
index 7df1b78db37b..7a547e13cafa 100644
--- a/sys/dev/rtwn/if_rtwn.c
+++ b/sys/dev/rtwn/if_rtwn.c
@@ -1203,6 +1203,9 @@ rtwn_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
 			/* Stop Rx of data frames. */
 			rtwn_write_2(sc, R92C_RXFLTMAP2, 0);
 
+			/* Stop Rx of control frames. */
+			rtwn_write_2(sc, R92C_RXFLTMAP1, 0);
+
 			/* Reset EDCA parameters. */
 			rtwn_write_4(sc, R92C_EDCA_VO_PARAM, 0x002f3217);
 			rtwn_write_4(sc, R92C_EDCA_VI_PARAM, 0x005e4317);
@@ -1374,6 +1377,11 @@ rtwn_run(struct rtwn_softc *sc, struct ieee80211vap *vap)
 	rtwn_write_2(sc, R92C_BCN_INTERVAL(uvp->id), ni->ni_intval);
 
 	if (sc->vaps_running == sc->monvaps_running) {
+		/* Enable Rx of BAR control frames. */
+		rtwn_write_2(sc, R92C_RXFLTMAP1,
+		    1 << (IEEE80211_FC0_SUBTYPE_BAR >>
+		    IEEE80211_FC0_SUBTYPE_SHIFT));
+
 		/* Enable Rx of data frames. */
 		rtwn_write_2(sc, R92C_RXFLTMAP2, 0xffff);
Comment 2 commit-hook freebsd_committer freebsd_triage 2025-04-23 02:05:10 UTC
A commit in branch main references this bug:

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

commit 5c74aa3abd4e353ed7f8cb446c0527c8ebe15d1c
Author:     Jessica Clarke <jrtc27@freebsd.org>
AuthorDate: 2025-04-01 00:43:13 +0000
Commit:     Adrian Chadd <adrian@FreeBSD.org>
CommitDate: 2025-04-23 02:02:39 +0000

    rtwn: enable reception of BAR frames

    The RX filter wasn't enabling BAR frames, so we weren't receiving them
    during normal operation.

    Jessica noticed we WERE getting BAR frames, but only when promisc mode
    is active.  Which is a different set of bugs, but it did highlight
    the differences here.

    Differential Revision:  https://reviews.freebsd.org/D49596
    PR: kern/285822

 sys/dev/rtwn/if_rtwn.c | 8 ++++++++
 1 file changed, 8 insertions(+)