[PATCH 1/2] wifi: iwlwifi: mvm: release frames before one beyond the window
From: David Härdeman
Date: Mon Nov 16 2026 - 10:56:55 EST
If a transmitter gives up on an MPDU of a BA session without sending a
BAR and keeps sending, it can send a frame with SN == head_sn + buf_size
(or beyond). The firmware then moves the window and reports an NSSN
past the hole, but iwl_mvm_reorder() first stores the frame at
sn % buf_size, which is the slot of head_sn. iwl_mvm_release_frames()
starts at head_sn and so passes the new frame to mac80211 ahead of the
buf_size - 1 frames before it, and those then all fail
iwl_mvm_check_pn(): one lost frame turns into buf_size lost frames.
Seen with an AX210 (iwlmvm, 7.2.15) on an rtw88 AP during client
background scans: bursts of up to 63 PN-replay drops per lost frame
(two such bursts back to back when two holes were close together), each
starting with the frame at hole + 64 (traced at iwl_mvm_release_frames,
e.g. SN 447 PN 0x1bb3f0 passed, then SN 384-446 with PN
0x1bb3b1-0x1bb3ef dropped).
The driver used to release frames up to min(sn, nssn) for a frame
outside the window; that check went with the RSS-sync logic. Restore
just the window check.
With the fix, the PN-replay drops in that setup went from about 280 to
about 12 per client scan.
Fixes: ff8e3a40d78b ("wifi: iwlwifi: mvm: simplify the reorder buffer")
Cc: stable@xxxxxxxxxxxxxxx
Assisted-by: LLM
Signed-off-by: David Härdeman <david@xxxxxxxxxxx>
---
drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
index 77a3d8dcab5..c2fdc3a5155 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c
@@ -899,6 +899,19 @@ static bool iwl_mvm_reorder(struct iwl_mvm *mvm,
return false;
}
+ /*
+ * A frame beyond the end of the reorder window means that the
+ * transmitter gave up on older frames without sending a BAR. The
+ * firmware moves the window (NSSN) for it, but the frame would be
+ * stored in the slot of an older SN and released ahead of the frames
+ * before it, which would then all fail the PN check. Release the
+ * older frames first, as for a BAR.
+ */
+ if (!ieee80211_sn_less(sn, ieee80211_sn_add(buffer->head_sn,
+ baid_data->buf_size)))
+ iwl_mvm_release_frames(mvm, sta, napi, baid_data, buffer,
+ ieee80211_sn_less(sn, nssn) ? sn : nssn);
+
/* put in reorder buffer */
index = sn % baid_data->buf_size;
__skb_queue_tail(&entries[index].frames, skb);
--
2.47.3