Repository navigation
jaguar1: HT40 centre channel follows the offset (vendor rtw_get_center_ch) - #500
Conversation
PR Summary by QodoFix Jaguar1 HT40 centre-channel tuning for channel offsets
AI Description
Diagram
High-Level Assessment
Files changed (1)
|
Code Review by Qodo
1.
|
…r_ch) The 40 MHz centre came from a hand-written channel table that ignored the HT40 offset. On 2.4 GHz it only listed primaries 4 and 8, so any other primary stayed uncentred: ch6 HT40+ tuned RF 0x18 to channel 6 instead of 8, 10 MHz low, and every HT40 frame was lost while 20 MHz worked. The table was also wrong on UNII-3 (153->155, 161->163) and for the non-default offset of the pairs it did list. Use the vendor rule instead (UPPER -> primary - 2, otherwise + 2, as Kestrel already does) and drop the table. 8812AU, ch6 HT40+: RF 0x18 0x07406 -> 0x07408 (vendor driver: 0x07408); delivery 0 % -> 36-54 % (vendor driver on the same unit: 52-61 %). ch36/ch40 HT40 unchanged at 94-97 %. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Offset arithmetic alone can leave the band: ch13 HT40+ gives centre 15, which Jaguar1 classifies as 5 GHz, and ch1 HT40- wraps to 255. The vendor never reaches rtw_get_center_ch with such a pair because its channel plan rejects it first. On 2.4 GHz a pair must stay inside 1-13 (HT40+ needs a primary of 1-9, HT40- one of 5-13), so a request that does not fit takes the side that does, with a warning. 5 GHz is left to the caller. The caller's requested offset is kept apart from the fitted one, so a FastRetune hop back from the grid edge restores the requested side instead of inheriting the forced one. 8812AU TX, two 8822B receivers: ch13 requested HT40+ -> RF 0x18 0x0740B (centre 11), 91 / 89 %; ch1 requested HT40- -> 0x07403 (centre 3), 91 / 87 %. Hop 6,13,6 at HT40+: 0x07408, 0x0740B, 0x07408 on both the fast and full paths. ch6 and ch36 unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
cf58fb5 to
b5ffaf4
Compare
What this is
Jaguar1 (8812AU/8811AU/8814AU/8821AU) took the 40 MHz centre channel from a hand-written lookup table that ignored the HT40 offset. On 2.4 GHz the table only listed primaries 4 and 8, so any other primary stayed uncentred. At ch6 HT40+ the RF synthesizer was tuned to channel 6 instead of 8, 10 MHz low. Every HT40 frame was lost, while 20 MHz on the same channel worked. The table was also wrong on UNII-3 (153→155, 161→163) and for the non-default offset of the pairs it did list.
This replaces the table with the vendor rule from
rtw_get_center_ch: UPPER → primary − 2, otherwise primary + 2. That is the rule Kestrel already uses, soDONT_CAREdefaults to HT40+ on both.Found while working the follow-ups in #499.
Evidence
Vendor-driver control first. On Realtek's own driver (
reference/rtl8812au), the same 8812AU decodes ch6 HT40+ at 52–61 %. On devourer it was 0 % in 12 of 12 sessions, so the receive hardware is fine.Register diff, same unit, ch6 HT40+. I read the BB/MAC registers live with
chipstate --no-claimwhile each driver owned the chip. The bandwidth registers (0x483,0x668,0x838,0x8ac,0xa08) were already identical. RF0x18was the one structural difference:0x180x07408: BW 40, channel 80x07406: BW 40, channel 60x07408; HT40− gives0x07404On air. TP-Link T3U (8822B) transmitting from devourer. The 8812AU on devourer is the DUT; an 8812BU (
b812) receives in parallel as an independent witness. 1500 frames per session, 3 reps:¹ Both receivers read zero together in that session. That is a transmit-side failure of the 8822B on 2.4 GHz HT40 (tracked in #499), not this bug.
Grid-edge fit (second commit, from review)
Offset arithmetic alone can leave the band on 2.4 GHz: ch13 HT40+ gives centre 15 (classified as 5 GHz), and ch1 HT40− wraps to 255. A 2.4 GHz HT40 request now has to fit channels 1–13. HT40+ needs a primary of 1–9, HT40− one of 5–13; a request outside that takes the side that fits, with a warning. 5 GHz is left to the caller.
The requested offset is kept apart from the fitted one, so a FastRetune hop back from the edge restores the requested side.
On air, 8812AU transmitting to two 8822Bs:
0x180x0740B(centre 11), 91 / 89 %.0x07403(centre 3), 91 / 87 %.0x07408,0x0740B,0x07408on both the fast and full paths.Not verified
🤖 Generated with Claude Code