bes2600: Patch E — skip ps_state_lock when PSM-known-disabled #8

Merged
marfrit merged 1 commits from bes2600/ps-state-lock-skip-pm-disabled into cleanups 2026-05-07 22:31:46 +00:00
Collaborator

Per the Opus structural critique (PR #8 §2.4) and Sonnet review item 5.

What this patch does

The per-RX-frame early-data path in bes2600_rx_cb (txrx.c:1945-1951 in cleanups+G+D) takes spin_lock_bh(&priv->ps_state_lock) to double-check whether a link entry has transitioned to BES2600_LINK_SOFT (AP-side power-save soft-link state).

When c7 has latched hw_priv->bes_power.pm_unsupported = true (firmware does not honour PSM — see feedback_bes2600_firmware_no_psm memory), the AP-side power-save state machine is dead and link entries never transition to LINK_SOFT. The per-frame spin_lock_bh + double-check is wasted work.

This patch gates the lock acquisition on !pm_unsupported. When the latch is on (the steady state on the production-shipped firmware), early_data RX frames bypass the spinlock and deliver directly via ieee80211_rx_irqsafe.

If a future firmware drop fixes PSM, c7 self-clears pm_unsupported on the first real PM_INDICATION and the locked path resumes — the predicate is dynamic.

Scope

Narrower than Sonnet originally framed: only the per-RX-frame hot path. Other ps_state_lock sites in txrx.c (lines 657, 1256, 1420, 1528) are TX submission / multicast-start / link-id paths, NOT per-frame RX, and NOT on the Bug #5 hot path. Left untouched.

Diff

1 file (txrx.c), +24/-6 net.

Build verified

bes2600.ko builds clean on ohm sandbox: srcversion B5922B4933590F33207EE97, 0 warnings, 0 errors.

Test plan

  • Reload module on ohm (reboot per dev-allocation override)
  • Smoke-test association + traffic
  • Optional Phase 7: confirm pm_unsupported latches at boot (it should — production firmware doesn't honour PSM); confirm RX path is identical to today otherwise
  • Fallback rollback: /var/tmp/bes2600.patchF.rollback.ko on ohm
Per the Opus structural critique (PR #8 §2.4) and Sonnet review item 5. ## What this patch does The per-RX-frame early-data path in `bes2600_rx_cb` (`txrx.c:1945-1951` in cleanups+G+D) takes `spin_lock_bh(&priv->ps_state_lock)` to double-check whether a link entry has transitioned to `BES2600_LINK_SOFT` (AP-side power-save soft-link state). When c7 has latched `hw_priv->bes_power.pm_unsupported = true` (firmware does not honour PSM — see `feedback_bes2600_firmware_no_psm` memory), the AP-side power-save state machine is dead and link entries never transition to `LINK_SOFT`. The per-frame `spin_lock_bh` + double-check is wasted work. This patch gates the lock acquisition on `!pm_unsupported`. When the latch is on (the steady state on the production-shipped firmware), early_data RX frames bypass the spinlock and deliver directly via `ieee80211_rx_irqsafe`. If a future firmware drop fixes PSM, c7 self-clears `pm_unsupported` on the first real PM_INDICATION and the locked path resumes — the predicate is dynamic. ## Scope Narrower than Sonnet originally framed: only the per-RX-frame hot path. Other `ps_state_lock` sites in txrx.c (lines 657, 1256, 1420, 1528) are TX submission / multicast-start / link-id paths, NOT per-frame RX, and NOT on the Bug #5 hot path. Left untouched. ## Diff 1 file (txrx.c), +24/-6 net. ## Build verified `bes2600.ko` builds clean on ohm sandbox: srcversion **`B5922B4933590F33207EE97`**, 0 warnings, 0 errors. ## Test plan - [ ] Reload module on ohm (reboot per dev-allocation override) - [ ] Smoke-test association + traffic - [ ] Optional Phase 7: confirm pm_unsupported latches at boot (it should — production firmware doesn't honour PSM); confirm RX path is identical to today otherwise - [ ] Fallback rollback: `/var/tmp/bes2600.patchF.rollback.ko` on ohm
claude-noether added 1 commit 2026-05-07 22:24:42 +00:00
Per the Opus structural critique (PR #8 §2.4) and Sonnet review item 5.
The per-RX-frame early-data path takes ps_state_lock to double-check
whether a link entry transitioned to BES2600_LINK_SOFT (AP-side
power-save state machine, soft-link transition).

When c7 has latched pm_unsupported = true (firmware does not honor
PSM, see feedback_bes2600_firmware_no_psm memory), the AP power-save
state machine is dead and link entries never transition to LINK_SOFT.
The per-frame spin_lock_bh + double-check is wasted work.

This patch gates the lock acquisition on !pm_unsupported.  When the
latch is on (the steady state on the production-shipped bes2600
firmware), early_data RX frames bypass the spin_lock_bh and go
directly to ieee80211_rx_irqsafe.

If a future firmware drop fixes PSM, c7 self-clears pm_unsupported on
the first real PM_INDICATION and the locked path resumes.

Scope is narrower than Sonnet originally framed: only the per-RX-frame
hot path (txrx.c:1945-1951 in cleanups+G+D) is touched.  Other
ps_state_lock sites in txrx.c (lines 657, 1256, 1420, 1528) are TX
submission / multicast-start / link-id paths, not per-frame RX, and
not on the Bug #5 hot path.  Leave those alone.

Build verified: srcversion B5922B4933590F33207EE97 on ohm sandbox.
marfrit merged commit 42fd0ceab6 into cleanups 2026-05-07 22:31:46 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: marfrit/bes2600-dkms#8