Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH RFC net-next 0/2] wifi: rtw89: fix monitor mode RX filtering and enable raw packet injection
@ 2026-11-01 11:20 ph4ntom-rev
  2026-11-02  2:11 ` Ping-Ke Shih
  2026-11-02  9:00 ` ph4ntom-rev
  0 siblings, 2 replies; 8+ messages in thread
From: ph4ntom-rev @ 2026-11-01 11:20 UTC (permalink / raw)
  To: linux-wireless; +Cc: pkshih, kvalo

Hi Ping-Ke, Kalle, and linux-wireless maintainers,

This RFC patchset addresses long-standing limitations in rtw89 regarding
IEEE 802.11 monitor interfaces (NL80211_IFTYPE_MONITOR) and raw frame
transmission / diagnostic injection (IEEE80211_TX_CTL_INJECTED) on Realtek
802.11ax PCIe hardware (specifically verified on RTL8852AE [10ec:8852]).

While rtw89 includes scaffolding for monitor mode (pure_monitor_mode_vif
and rtw89_core_tx_update_injection), standalone monitor operation hits
four distinct host-driver obstacles rather than a firmware limitation:

1. MAC Promiscuous RX Drops:
   Band 0 MAC registers (R_AX_RX_FLTR_OPT 0xCE20, R_AX_CTRL_FLTR 0xCE24,
   and R_AX_DATA_FLTR 0xCE2C) default to filtering out Control frames (ACK,
   RTS, CTS, BlockAck) and non-matching BSSID Data before reaching host
   DMA rings. Setting promiscuous mask 0x55555555 and syncing CRC32 drops
   with FIF_FCSFAIL unlocks all 16 IEEE 802.11 Control and Management
   subtypes across channel switches.

2. NULL vif Dereference on Monitor TX:
   In rtw89_ops_tx() and rtw89_core_tx_write(), vif_to_rtwvif(vif) is
   evaluated unconditionally in local declarations before checking whether
   info->control.vif is NULL. Injected Radiotap frames from mac80211 pass
   a NULL control.vif, triggering an immediate kernel oops.

3. Injection Descriptor Rate Handling:
   When Radiotap headers omit an explicit bitrate, mac80211 sets
   rates[0].idx = -1. In rtw89_core_tx_update_injection(), casting this to
   u8 yields an invalid rate index 255 and leaves desc_info->en_wd_info
   unset for non-management frames. We map negative indices to a valid
   OFDM 6.0 Mbps fallback (RTW89_HW_RATE_OFDM6), enable hardware rate
   override (use_rate, dis_data_fb), and bound retries (tx_cnt_lmt = 1)
   when IEEE80211_TX_CTL_NO_ACK is set.

4. Firmware Scheduler MACID Stalling:
   When mac80211 allocates a standalone monitor VIF, a mac_id is assigned,
   but default CMAC/DMAC tables are never populated and no H2C join is
   issued, leaving the MACID context paused in the firmware scheduler.
   Attempting to join as RTW89_SELF_ROLE_CLIENT triggers firmware 5-second
   beacon-loss timeouts. However, registering a non-associated AP context
   (RTW89_SELF_ROLE_AP with RTW89_NET_TYPE_NO_LINK) initializes the MACID
   queues without generating AP beacons or tracking client beacons. Clearing
   R_AX_MACID_SLEEP_0 (0xC2C0) and sending rtw89_fw_h2c_macid_pause(..., false)
   cleanly unpauses hardware transmit queues.

Empirical Live Validation (Linux 7.1.5+kali-amd64, RTL8852AE):
==============================================================
- Promiscuous RX: Captured 20,000+ live 802.11 frames on channel 11
  (2462 MHz) with standard LINKTYPE_IEEE802_11_RADIOTAP encapsulation.
  Wireshark inspection confirms reception of Beacons, Probes, ACKs,
  RTS/CTS, BlockAcks, and cross-BSS QoS Data with full dual-antenna RSSI
  reporting (-18 dBm / -24 dBm).
- Packet Injection: Evaluated using standard aireplay-ng -9 against
  active APs. Recorded 100% transmission and delivery success (30/30 probe
  requests acknowledged, average ping round-trip 1.3 - 1.6 ms).
- Firmware Safety: 100% host-side driver changes. Requires zero firmware
  binary modifications; works with unmodified signed /lib/firmware/rtw89/
  images from distribution linux-firmware packages.

Reference repository with architecture notes and packet capture screenshots:
https://github.com/ph4ntom-rev/rtw89-monitor-injection

Patch 1/2 addresses Band 0 MAC RX promiscuous register configuration.
Patch 2/2 resolves NULL vif dereferences, descriptor rate fallbacks,
and the monitor MACID scheduler initialization.

We would appreciate feedback from Ping-Ke and the community on whether
this approach or an alternative vif-tracking model fits best upstream.

Signed-off-by: ph4ntom-rev <owner@ph4ntom-rev.uz>

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-11-15  2:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-01 11:20 [PATCH RFC net-next 0/2] wifi: rtw89: fix monitor mode RX filtering and enable raw packet injection ph4ntom-rev
2026-11-02  2:11 ` Ping-Ke Shih
2026-11-02  9:00 ` ph4ntom-rev
2026-11-03  0:54   ` Ping-Ke Shih
2026-11-03  2:44     ` ph4ntom-rev
2026-11-15  2:57       ` Ping-Ke Shih
2026-11-03 15:08   ` [PATCH v2 1/2] wifi: rtw89: fix RX filter configuration for monitor mode ph4ntom-rev
2026-11-03 15:08     ` [PATCH v2 2/2] wifi: rtw89: support raw frame injection on standalone monitor interface ph4ntom-rev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox