Repository navigation
rx: opt-in drop_ctrl and own_addr_only monitor RX filters (Jaguar2/3, RTL8733B) - #595
Conversation
… RTL8733B) Two DeviceConfig::Rx knobs, both off by default (register writes unchanged): - drop_ctrl (DEVOURER_RX_DROP_CTRL): RXFLTMAP1 = 0, so control frames stop at the MAC. The MAC still acts on the ACKs for its own frames. - own_addr_only (DEVOURER_RX_OWN_ADDR_ONLY): RCR AAP off, APM|AM|AB on, so only unicast to MACID plus group frames reach the host. On a link that sends video and receives its peer's ACKs, the host otherwise spends most of its RX work on the ACKs for its own frames and on other networks' unicast. src/RxFilter.h holds the arithmetic; a selftest pins the per-family RCR values and the knobs-off identity. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011dReg158JQxkhEWGPBro5f
PR Summary by QodoAdd opt-in monitor RX filters for control and foreign unicast frames
AI Description
Merge Risk
|
Code Review by Qodo
1. Beamformee captures lose addressed frames
|
- HalJaguar3::write_rx_filter_maps() now writes the three maps for both monitor_rx_cfg and the re-open after a TX-only InitWrite, so a filter knob has one place to change. Same writes, same order. - Jaguar2 writes the constant 0 under drop_ctrl; its comment says 0x0FFF is the 8822B reset value, not a MAC-init write. - The two DeviceConfig comments shortened to the keep_corrupted style. - Dropped a redundant include and repeated header comments. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011dReg158JQxkhEWGPBro5f
josephnef
left a comment
There was a problem hiding this comment.
Approving. Code read, ctest green on a local build, and checked on air on four dies — including the 8812CU and the "no armed identity" case the description lists as not verified.
On-air check
ch36, 10 s cells. A T3U (8812BU) floods unicast QoS-Data to address X at ~250 frames/s; a second adapter is armed as ACK responder for X so control frames are on air. Each DUT is judged by its own per-frame events (DEVOURER_RX_DUMP_ALL frame-control classes, and SA-gated rx.seq for the flood).
| DUT | off: ctrl / unicast-to-X | drop_ctrl: ctrl / unicast |
own_addr_only, no identity: unicast |
identity = X | identity = Y | both knobs, identity = X: ctrl / unicast |
|---|---|---|---|---|---|---|
8812CU (0bda:c812) |
6168 / 1863 | 3 / 1887 | 0 | 2062 | 0 | 2 / 2015 |
8812BU (0bda:b812) |
2357 / 1946 | 0 / 2073 | 0 | 1971 | 0 | 0 / 1917 |
8733BU (0bda:b733) |
5785 / 2004 | 3 / 2064 | 0 | 2096 | 0 | 1 / 2035 |
8812EU (0bda:a81a) |
5444 / 2075 | 3 / 2051 | 0 | 1951 | 0 | 3 / 1830 |
- Management-frame counts (ambient beacons) were unchanged in every cell, so group frames still pass under
own_addr_only. - Logged RCR / RXFLTMAP1 matched the description on each family (
f410400f→f410400e,f000002f→f000002e,90000001→9000000e). - 1–3 control frames still reached the host under
drop_ctrlon Jaguar3 and the 8733B. Not traced. - Not measured here either: BlockAck handling under A-MPDU TX with
drop_ctrlon (only the ACK/retry path was), the 8821C, PCIe. - One unit of each die, one channel, one session.
Notes, none blocking
- Qodo's "a later receive session loses sounding" is real but narrow. On Jaguar3 a TX-only
InitWritesets_rx_filters_closed, andInitnever clears it. A laterIniton the same object withbf.beamformee_ofanddrop_ctrlarms the beamformee (ORs0x30into RXFLTMAP1) and thenstart_rx_loopcallswrite_rx_filter_maps(), which writes the map back to 0. Before this PR that restore wrote0xFFFF, so it was harmless. Clearing the flag whenInitestablishes its own monitor config would fix it. - Qodo's identity conflict is real too. With
own_addr_only,bf.beamformee_ofplus anack_responderon a different MAC cannot both receive:SetAckResponderoverwrites the MACID the beamformee arm just wrote. Refusing the combination, or a line in theDeviceConfig.hcomment, would do. own_addr_onlywith no identity on Jaguar2/3 is a silent total loss of unicast (the zero column above). The header comment says so; a one-shotWat bring-up when the knob is set and nothing programs MACID would save someone a debugging session.- Jaguar1 is silently inert although it has the same RCR / RXFLTMAP1 registers, and there is no
AdapterCapsflag for a caller to tell. Fine for this PR; worth a follow-up given how common the 8812AU is.
qodo-gate is red because Qodo answered with comments rather than a review; it needs a re-run or the skip-qodo-gate label.
## What changed and why The review of #595 left four notes. This PR covers 1–3, plus one stale comment. Note 4 (Jaguar1 has the same registers but ignores both knobs) is not here and would be its own PR. 1. **Jaguar3: a TX-only bring-up followed by an RX bring-up on the same object.** `InitWrite` sets `_rx_filters_closed` (`src/jaguar3/RtlJaguar3Device.cpp:1136`), and `Init` never cleared it. With `bf.beamformee_of` and `drop_ctrl`: - `Init` arms the beamformee (RXFLTMAP1 |= 0x30); - `StartRxLoop` then saw the stale flag and rewrote the maps, putting RXFLTMAP1 back to 0. `Init` now clears the flag right after `rtw_hal_init`, which has just written this session's own maps through `monitor_rx_cfg`. 2. **One identity under `own_addr_only`.** The `DeviceConfig.h` comment now says that an ACK responder on another address overwrites the MACID a beamformee arm wrote. Comment only: refusing the combination would be a behaviour change. 3. **Silent loss of all unicast.** Jaguar2/3 `StartRxLoop` logs one warning when `own_addr_only` is set and MACID still reads 00:00:00:00:00:00. It reuses `ack::macid_is` from `AckResponder.h`. On Jaguar3 the read is under `_reg_mu`, like the other register access there. 4. **`IRadio.h`'s station note** said the default NOACK stream radiotap "never retries". Only the MT7612U reads that flag (`RadiotapBuilder.h` already says so). The Realtek descriptors take the retry count from `tx.retry_limit` (`src/jaguar2/RtlJaguar2Device.cpp:1900`, `src/jaguar3/RtlJaguar3Device.cpp:2905`, which zero it only in A-MPDU no-ack mode). A unicast frame sent with NOACK on an RTL8733B still aired 5.5 times on average with `retry_limit` 16. ## Evidence Note 3, on an RTL8812BU (`0bda:b812`, USB3), `rxdemo`, ch36, `DEVOURER_RX_OWN_ADDR_ONLY=1`: | Run | Log | |---|---| | no identity | `[W] Jaguar2: rx.own_addr_only with MACID 00:00:00:00:00:00: no unicast passes until SetAckResponder or a station or beacon arm sets an identity` | | `DEVOURER_ACK_RESPONDER=02:57:4e:11:22:33` (control) | `hardware ACK responder armed for 02:57:4e:11:22:33`, no warning | With the knob off the condition is false, so no read and no log. ## Verification - Build: Release, default options. The unique warning set is the same as master's (9). - Tests: `ctest` 93/93. - Hardware: note 3 on the 8812BU only, once per arm. ## Not verified - **Note 1 on hardware.** No in-tree example runs `InitWrite` and then `Init` on the same object. The fix follows the code path the review traced. - **Note 3 on Jaguar3:** same code; not run on an 8812CU or 8812EU. ## Blast radius - Note 1: only a Jaguar3 object that ran `InitWrite` and then `Init`. A plain RX or a plain TX session is unchanged. - Note 3: one register read and at most one log line per `StartRxLoop`, only with `own_addr_only` set. - Notes 2 and 4: comments only. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
## What this is The rest of #597, on top of #598 (which landed the Jaguar3 `Init` flag clear, the MACID-zero warning and the comments). - **Jaguar1 applies `rx.drop_ctrl` and `rx.own_addr_only`.** `own_addr_only` uses the shared `monitor_rcr()`; Jaguar1 bring-up already programs MACID from EFUSE, so it needs no identity arm. `drop_ctrl` clears RCR `ACF` as well as RXFLTMAP1, because on this MAC the map alone filtered nothing. - **Jaguar2/3 refuse one combination at bring-up:** `own_addr_only` with a beamformee arm and an ACK responder on a different address. MACID holds one address, so that session could not receive both. Same address, or promiscuous RX, is unaffected. #598 documented this; this makes it an error (`std::runtime_error`, like a failed responder arm). - **Jaguar3 `InitWrite` clears the "RX filters closed" state** after its bring-up, as `Init` now does. - **`AdapterCaps::rx_mac_filters_ok`** (`rx_mac_filters` in `adapter.caps`): whether the backend applies the two knobs. Jaguar1, Jaguar2, Jaguar3, RTL8733B. - `DeviceConfig.h`: a few control frames admitted during bring-up can still reach the host under `drop_ctrl`. ## Measured All ch36, one unit per die. The flood is a T3U sending unicast QoS-Data to address X; a hardware ACK responder for X puts control frames on air. Counts are the DUT's own per-frame events over a 10 s cell (8 s for the last two rows). **Jaguar1, 8812AU** (on a second host, RF-coupled to the bench): | Cell | Control frames | Flood frames to X | |---|---|---| | off | 4951 | 4210 | | `drop_ctrl` | 143 (all BlockAck) | 4240 | | `own_addr_only`, EFUSE identity | 0 | 0 | | `own_addr_only`, identity X | 0 | 4270 | | `own_addr_only`, identity Y | 0 | 0 | | both, identity X | 0 | 4263 | Management frames were 364–368 in every cell. With RXFLTMAP1 = 0 alone, `drop_ctrl` read 4184 control frames against 4234 off. **8812AU as transmitter, `drop_ctrl` on its own RX** (peer: an 8812BU hardware responder; TX reports OK): | | open | `drop_ctrl` | no responder | |---|---|---|---| | unicast, retry limit 6 | 86% | 87% | 0% | | A-MPDU | 78% | 77% | 0% | **BlockAck under A-MPDU with `drop_ctrl` on the transmitter** (the item #595 left unmeasured), TX reports OK, open / `drop_ctrl` / no responder: 8812CU 96 / 96 / 0%, 8812BU 95 / 97 / 0%, 8733BU 95 / 97 / 0%. Under aggregation the per-frame retry count reads 0 in every cell, including no responder, so only the OK share discriminates. **The refusal**, `rxdemo` with `DEVOURER_RX_OWN_ADDR_ONLY=1 DEVOURER_BF_ARM_BFEE=…`, on an 8812CU and an 8812BU: responder on another address exits with the error; responder on the beamformee address runs; the same pair without `own_addr_only` runs. **The leaked control frames** from the #595 review (1–3 per cell on Jaguar3 and the RTL8733B): all sat in the first ~40 events of a session, while an ambient NDPA source ran at ~60/s for the whole unfiltered cell. They are frames admitted during bring-up before the monitor filter is written. Later runs had 0 or 1. **Regression on this build:** the #595 filter cells on the 8812CU and 8733BU: `drop_ctrl` 1 and 0 control frames against 3396 and 2678; `own_addr_only` 0 flood frames without the identity, 1545 and 1470 with it. `ctest` 96/96. ## Not verified - **The 8812AU as ACK responder under `drop_ctrl`.** The cross-rig loop did not close with both knobs off either (the transmitter retried every frame to its limit with the responder armed), so the run says nothing about the knob. - The RTL8811AU, RTL8821AU and RTL8814AU: same code path as the 8812AU, not run. - The 8821C and the PCIe parts. - One observation not chased: a scratch harness doing `InitWrite` then `Init` on one Jaguar3 object, then `Stop`, logged a clean de-init and did not exit in two of three runs. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
What this is
A monitor-mode link that sends unicast and receives its peer's ACKs spends most of its host RX work on frames it never uses. Measured on an embedded ARM host with an 8812EU sending about 750 frames/s:
Two opt-in
DeviceConfig::Rxknobs let the MAC drop these. Both are off by default, and with both off every register write is unchanged.drop_ctrl(DEVOURER_RX_DROP_CTRL)own_addr_only(DEVOURER_RX_OWN_ADDR_ONLY)Jaguar2, Jaguar3 and the RTL8733B. Silently inert elsewhere, like
keep_corrupted.What changed
src/DeviceConfig.h: the two fields. The comments say that Jaguar2/3 bring-up does not program MACID, so arm an identity first (SetAckResponder, a station or beacon arm). They also say that host readers of control frames get none, and that a beamformee arm re-opens subtypes 4-5.src/RxFilter.h:monitor_rcr()andmonitor_ctrl_map(), the pure arithmetic shared by the three families.HalJaguar3::write_rx_filter_maps(), used by bothmonitor_rx_cfgand the re-open after a TX-onlyInitWrite. Same writes, same order. Its RX log line prints the RCR and RXFLTMAP1 written.HalJaguar2::enable_rx: appliesmonitor_rcr, and writes RXFLTMAP1 = 0 only whendrop_ctrlis set. So the 8822B's reset value0x0FFFand the 8821C's MAC-init0xFFFFstay as before.Halmac8733bMac::configure_monitor_rxnow takes theRxstruct and calls the helpers.examples/common/env_config.cpp: the two env flags.tests/rx_filter_selftest.cpp: the RCR arithmetic on each family's base value, and the knobs-off identity.Cost
None with the knobs off. With them on, the host no longer sees control frames or third-party unicast. The
DeviceConfig.hcomments name the in-tree readers this affects (rx.blockack, the cell RTS/BA attribution, sounding captures).Verification
Camera end: an 8812EU on an SSC338Q (ARM Cortex-A7). It sends about 750 frames/s of real H.265 video to an 8733BU, whose ACK responder is armed at both ends. ch36, MCS4. Both ends use the same knobs. CPU is the sender process's user+sys, over 60 s windows.
The busy channel: an 8812BU nearby, with no peer, sending 700 foreign unicast frames/s of 1400 B at MCS4.
Readback after bring-up:
f410400f→f410400e;90000001→9000000e;0000on both.Each knob alone (register writes from the host, same busy setup):
own_addr_only155 → 139 ms/s;drop_ctrlwith the other filter maps also closed, 155 → 141;The management and data-subtype maps, and a BSSID check, would remove fewer than 75 frames/s together, so they are not in this PR.
The ACKs for our own frames still end retries with
drop_ctrlon, on all three families. On an x86 host, quiet channel, 60 s runs (window from 10 s to the end):The 8822B already drops ACK/CTS by default (RXFLTMAP1
0x0FFF), so it gains less.Loss, checked separately: in 300 s runs with CCX reports on, the busy channel sometimes lost frames in short bursts, almost all of them chip lifetime drops (TX report state 2). This happened with and without the knobs (unfiltered: 1 and 29 lost; filtered: 0 to 160). It tracked the channel through the afternoon, not the knobs.
After the cleanup commit (one Jaguar3 filter-map writer), a 40 s quiet run on the ARM host with both knobs: 86 reports/s, 110.7 ms/s, retry 0.09 %, 0 lost. Readback unchanged.
Tests and build:
ctest: 93/93, and 93/93 under-DDEVOURER_SANITIZE=address+undefined;Not verified
own_addr_onlywithout an armed ACK responder on Jaguar2/3. The comment says it drops unicast there, since MACID is unprogrammed.own_addr_onlyon, the 8812BU still passed about 2 foreign unicast frames/s. What they were was not traced.🤖 Generated with Claude Code