* [PATCH 0/2] wifi: iwlwifi: release frames before one beyond the reorder window
@ 2026-11-16 15:56 David Härdeman
2026-11-16 15:56 ` [PATCH 1/2] wifi: iwlwifi: mvm: release frames before one beyond the window David Härdeman
2026-11-16 15:56 ` [PATCH 2/2] wifi: iwlwifi: mld: " David Härdeman
0 siblings, 2 replies; 3+ messages in thread
From: David Härdeman @ 2026-11-16 15:56 UTC (permalink / raw)
To: Miri Korenblit
Cc: Emmanuel Grumbach, linux-wireless, linux-kernel, David Härdeman
An AP that gives up on an MPDU of a BA session without sending a BAR
and keeps transmitting will eventually send a frame with SN ==
head_sn + buf_size. Both iwlmvm and iwlmld store that frame in the slot
of head_sn and then release it ahead of the frames before it, which
all fail the PN check. A single lost MPDU becomes a burst of up to 63
dropped frames, i.e. a TCP loss burst.
I ran into this with an AX210 (iwlmvm) on an rtw88 SDIO AP (RTL8822CS)
that drops frames without a BAR while the client is off-channel for
background scans; the AP side is a separate problem. A kprobe at the
PN check showed every burst starting with the frame at hole + 64.
Patch 1 restores the window check that iwlmvm had before the reorder
buffer was simplified. Tested on 7.2.15 (same code): PN-replay drops
per client scan went from about 280 to about 12, and in normal use
(8 two-minute bidirectional TCP runs each) from 290 to 3 per run.
Patch 2 does the same for iwlmld, which has the same code. I have no
iwlmld hardware; it adds a KUnit case that fails without the fix and
passes with it.
The patches were generated with the help of an LLM; I have reviewed
them (to the best of my ability), and tested patch 1 on actual hardware
as described above (patch 2 only with the KUnit case).
David Härdeman (2):
wifi: iwlwifi: mvm: release frames before one beyond the window
wifi: iwlwifi: mld: release frames before one beyond the window
drivers/net/wireless/intel/iwlwifi/mld/agg.c | 14 ++++++++++
.../wireless/intel/iwlwifi/mld/tests/agg.c | 28 +++++++++++++++++++
drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c | 13 +++++++++
3 files changed, 55 insertions(+)
base-commit: 3627924ed81fd7783394fb2555ea179c6606a231
--
2.47.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] wifi: iwlwifi: mvm: release frames before one beyond the window
2026-11-16 15:56 [PATCH 0/2] wifi: iwlwifi: release frames before one beyond the reorder window David Härdeman
@ 2026-11-16 15:56 ` David Härdeman
2026-11-16 15:56 ` [PATCH 2/2] wifi: iwlwifi: mld: " David Härdeman
1 sibling, 0 replies; 3+ messages in thread
From: David Härdeman @ 2026-11-16 15:56 UTC (permalink / raw)
To: Miri Korenblit
Cc: Emmanuel Grumbach, linux-wireless, linux-kernel,
David Härdeman, stable
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@vger.kernel.org
Assisted-by: LLM
Signed-off-by: David Härdeman <david@hardeman.nu>
---
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/2] wifi: iwlwifi: mld: release frames before one beyond the window
2026-11-16 15:56 [PATCH 0/2] wifi: iwlwifi: release frames before one beyond the reorder window David Härdeman
2026-11-16 15:56 ` [PATCH 1/2] wifi: iwlwifi: mvm: release frames before one beyond the window David Härdeman
@ 2026-11-16 15:56 ` David Härdeman
1 sibling, 0 replies; 3+ messages in thread
From: David Härdeman @ 2026-11-16 15:56 UTC (permalink / raw)
To: Miri Korenblit
Cc: Emmanuel Grumbach, linux-wireless, linux-kernel,
David Härdeman, stable
iwl_mld_reorder() has the same problem as iwlmvm had: a frame with
SN >= head_sn + buf_size, which a transmitter sends after giving up on
an older MPDU without a BAR, is stored in the slot of head_sn, and
iwl_mld_reorder_release_frames() then passes it to mac80211 ahead of
the frames before it, which all fail the PN check.
Release the older frames first, up to min(sn, nssn), as iwlmvm did
before the reorder buffer was simplified, and add a KUnit case for it.
Not tested on hardware (seen and tested with iwlmvm on an AX210); the
new KUnit case fails without the fix (SN=164 is released first) and
passes with it.
Fixes: d1e879ec600f ("wifi: iwlwifi: add iwlmld sub-driver")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: David Härdeman <david@hardeman.nu>
---
drivers/net/wireless/intel/iwlwifi/mld/agg.c | 14 ++++++++++
.../wireless/intel/iwlwifi/mld/tests/agg.c | 28 +++++++++++++++++++
2 files changed, 42 insertions(+)
diff --git a/drivers/net/wireless/intel/iwlwifi/mld/agg.c b/drivers/net/wireless/intel/iwlwifi/mld/agg.c
index ea1f02380ad..6b3c311a3d3 100644
--- a/drivers/net/wireless/intel/iwlwifi/mld/agg.c
+++ b/drivers/net/wireless/intel/iwlwifi/mld/agg.c
@@ -305,6 +305,20 @@ iwl_mld_reorder(struct iwl_mld *mld, struct napi_struct *napi,
return IWL_MLD_PASS_SKB;
}
+ /* 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_mld_reorder_release_frames(mld, link_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);
diff --git a/drivers/net/wireless/intel/iwlwifi/mld/tests/agg.c b/drivers/net/wireless/intel/iwlwifi/mld/tests/agg.c
index e9efe2996f0..8fec274cc25 100644
--- a/drivers/net/wireless/intel/iwlwifi/mld/tests/agg.c
+++ b/drivers/net/wireless/intel/iwlwifi/mld/tests/agg.c
@@ -426,6 +426,34 @@ static const struct reorder_buffer_case {
.head_sn = 100,
},
},
+ {
+ .desc = "RX packet beyond the reorder window, release older packets first",
+ .rx_pkt = {
+ .fc = FC_QOS_DATA,
+ .sn = 164,
+ .nssn = 165,
+ },
+ .reorder_buf_state = {
+ .valid = true,
+ .head_sn = 100,
+ .num_entries = 2,
+ .entries[0].sn = 101,
+ .entries[1].sn = 102,
+ },
+ .expected = {
+ /* 1. Reorder buffer contains SN={101, 102}, hole at 100.
+ * 2. RX packet SN=164 = head_sn + BA_WINDOW_SIZE: the
+ * transmitter gave up on SN=100 (no BAR), NSSN moves
+ * past it. SN=164 maps to the slot of SN=100.
+ * The stored packets are released before the RX packet.
+ */
+ .reorder_res = IWL_MLD_BUFFERED_SKB,
+ .num_stored = 0,
+ .head_sn = 165,
+ .skb_release_order = {101, 102, 164},
+ .skb_release_order_count = 3,
+ },
+ },
};
KUNIT_ARRAY_PARAM_DESC(test_reorder_buffer, reorder_buffer_cases, desc);
--
2.47.3
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-16 15:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-16 15:56 [PATCH 0/2] wifi: iwlwifi: release frames before one beyond the reorder window David Härdeman
2026-11-16 15:56 ` [PATCH 1/2] wifi: iwlwifi: mvm: release frames before one beyond the window David Härdeman
2026-11-16 15:56 ` [PATCH 2/2] wifi: iwlwifi: mld: " David Härdeman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®