bes2600: Patch C — direct-deliver RX SKBs from sdio_rx_work #3
Closed
claude-noether
wants to merge 1 commits from
bes2600/sdio-rx-direct-deliver into cleanups
pull from: bes2600/sdio-rx-direct-deliver
merge into: marfrit:cleanups
marfrit:mobian
marfrit:bes2600/join-confirm-failure-reset
marfrit:cleanups
marfrit:bes2600/besser-danctnix-v3
marfrit:bh-c-fossil-cleanup-rebased
marfrit:cleanups-rebased-on-danctnix
marfrit:danctnix-sync
marfrit:bes2600/queue-pending-record-lock-bh-fix
marfrit:bes2600/scan-filter-5ghz
marfrit:bes2600/bh-c-fossil-cleanup
marfrit:bes2600/rx-list-batch-delivery
marfrit:bes2600/ps-state-lock-skip-pm-disabled
marfrit:bes2600/ba-lock-atomic
marfrit:bes2600/license-spdx-restore-attribution
marfrit:bes2600/sdio-rx-no-relay
marfrit:bes2600/cw1200-fix-backports
marfrit:bes2600/connection-loss-fast-recover
marfrit:bes2600/decrypt-storm-fast-recover
marfrit:bes2600/pm-detect-firmware-unsupported
marfrit:bes2600/pm-state-resync
marfrit:bes2600/pm-wake-consume-state
marfrit:bes2600/scan-defer-backoff-tune
marfrit:bes2600/lmac-recover-via-mmc-hw-reset
marfrit:bes2600/scan-defer-on-reject
marfrit:debian/copyright-fsf-address
marfrit:bes2600/pm-timeout-silence
marfrit:bes2600/drop-orphan-file-io
marfrit:bes2600/drop-dpd-file-paths
marfrit:bes2600/factory-drop-kernel-write
marfrit:bes2600/staging-prep-series
marfrit:bes2600/tx-sdio-dma-oob
marfrit:bes2600/factory-thread-dev
marfrit:bes2600/enable-testmode
marfrit:bes2600/remove-chardev-user-interface
marfrit:bes2600/pm-gate-on-handshake
marfrit:bes2600/factory-no-efuse-flag
marfrit:bes2600/factory-request-firmware
1 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
c4797b1dbf |
bes2600: deliver RX SKBs directly into wsm_handle_rx from sdio_rx_work
Patch C — collapse the sdio_rx_work → rx_queue → bh_work relay into a
direct call from bes2600_sdio_extract_packets into a new helper
bes2600_bh_handle_rx_skb that performs the per-SKB bookkeeping
previously done inside bes2600_bh_rx_helper after pipe_read.
What this saves per RX frame:
- two spinlock acquires on self->rx_queue->lock
(skb_queue_tail in extract_packets + skb_dequeue in pipe_read)
- one bh wait-queue wake-up per IRQ batch
(sdio_rx_work no longer calls self->irq_handler)
Pre-patch baseline on ohm (4 MB/s sender, ~5 min, srcversion 1B3B3ED0):
- 387,532 RX packets, 578 MB, 1.36 MB/s observed receive
- sdio_rx_work dispatched 34,994 times = 86.4/s = 90.3 per 1000 RX pkts
- sdio_tx_work dispatched 111,770 times = 276.1/s
- bes2600_bh_work redispatches: 0 (single long-lived work item,
refutes earlier review claim of "9 events per frame")
API contract for wsm_handle_rx (cited in bh.c block comment):
- declared wsm.h:2108, defined wsm.c:2211, EXPORT_SYMBOL wsm.c:2463
- process context, sleepable
- caller MUST hold no bes2600 spinlock; SDIO mutex is released at
bes2600_sdio.c before extract_packets is called
- SKB ownership: zeroes *skb_p if consumed, caller frees otherwise.
bes2600_bh_handle_rx_skb frees on every path (success + error)
After patch, bh thread retains responsibility for TX work. TX-confirm
packets that release a TX buffer wake the bh thread via
bes2600_bh_wakeup() inside bes2600_bh_handle_rx_skb (mirrors the in-bh
tx=1 signaling the old bh_rx_helper used to do). Early-boot IRQs
before fw_started are still served via the GPIO IRQ handler's fallback
self->irq_handler path; that branch is unchanged.
Minimum-diff scope:
- struct sbus_priv->rx_queue + ->rx_queue_lock are still defined and
initialised (allocated but never used after this patch). Removed
in a follow-up hygiene patch, not bundled here.
- bes2600_sdio_pipe_read still exists; returns NULL after this patch
(rx_queue always empty). Removed in same follow-up.
- bes2600_bh_rx_helper still exists and still calls pipe_read; it
now always returns 0. Wasted 1 spinlock + skb_dequeue per bh wake;
quantified in Phase 7 to decide whether worth a follow-up.
Awaiting Phase 7 verification on ohm. Per Phase 4 plan §4.5 predicted
delta:
- rx_queue->lock acquire rate: 1914/s -> 0 (high confidence)
- _raw_spin_unlock_irqrestore CPU%: 20% -> 12-15% (medium)
- observed RX KB/s @ 4 MB/s: floor lifts toward >= 1 MB/s sustained
(medium; rep 3's 75 KB/s death has multiple causes)
Phase 7 will N=3 ramp 1 -> 2 -> 4 -> 8 MB/s with identical
instrumentation pre/post. See notes/patch-c-phase4-plan-2026-05-07.md
in marfrit/besser for the plan; this commit is the Phase 6 deliverable.
|