Skip to content

wifi: mt7932: acknowledge interrupts before servicing the rings - #265

Merged
RyanTheTide merged 1 commit into
aurora-wipfrom
j700/mt7932-irq-ack-order
Oct 11, 2026
Merged

RyanTheTide merged 1 commit into
aurora-wipfrom
j700/mt7932-irq-ack-order

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

Acknowledge MT7932 interrupts before servicing the rings

The bug

mt_service() drained the RX rings and retired TX descriptors first, and only then wrote the causes it
had read back to the interrupt status register (write-1-to-clear). A completion that the device posted
after its ring had been drained, but before that write, set a status bit that the write then cleared. Its
descriptor waited, unserviced, for some unrelated interrupt. For a firmware command reply that can mean
the full 5 s command timeout.

The fix

Read the causes, acknowledge them (including the MCU software interrupt), read the status register back
so the acknowledgment has reached the device and the descriptors written before it are visible, and only
then service the rings, which is the order other MediaTek PCIe drivers use. A completion that arrives while
the rings are being serviced keeps its status bit, and the device interrupts again when the mask is
restored. Polled mode (poll_test) uses the same function and gets the same order.

Testing

Written for this tree; tested on a MacBook Neo (J700), 5 GHz channel 149 at 40 MHz: 120 s
bidirectional iperf3 with 20 concurrent scans, on three boots with this change and twice without it.
With the change, every scan returned 0 in 1.06-1.18 s, iperf3 completed both directions, the station
stayed associated, and there were no timeout PCI command or recovery required lines. Short
zero-throughput intervals (1-3 s) coincide with the scans with and without the change.

  • Build: arm64 Image modules apple/t8140-j700.dtb with the J700 config, clang 22.1.6; W=1 build of
    drivers/net/wireless/mediatek/mt7932/ and drivers/bluetooth/mt7932_bt_pcie.o with no diagnostics.
  • checkpatch.pl --strict: clean apart from the Assisted-by: format note.
  • Hardware: association, 120 s bidirectional iperf3 with 20 concurrent scans, no command timeouts
    (results to be added).

🤖 Generated with Claude Code

mt_service() drains the RX rings and retires TX descriptors first and
only then writes the causes it read back to the interrupt status
register. A completion that the device posts after a ring has been
drained but before that write sets a status bit that the write clears
again. Its descriptor then waits, unserviced, until some unrelated
interrupt arrives; for a command reply that can be the full command
timeout.

Acknowledge the causes, then service the rings, as other MediaTek PCIe
drivers do. Read the status register back after the write so that the
acknowledgment has reached the device, and the descriptors written
before it are visible, before the rings are read. A completion that
arrives while the rings are being serviced now leaves its status bit
set, and the device interrupts again once the mask is restored.

Fixes: 8709ef5 ("wifi: add existing J700 MT7932 fullmac implementation")
Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant