mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "David Härdeman" <david@hardeman.nu>
To: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Cc: "Emmanuel Grumbach" <emmanuel.grumbach@intel.com>,
	linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
	"David Härdeman" <david@hardeman.nu>,
	stable@vger.kernel.org
Subject: [PATCH 1/2] wifi: iwlwifi: mvm: release frames before one beyond the window
Date: Mon, 16 Nov 2026 16:56:08 +0100	[thread overview]
Message-ID: <20261116155609.535595-2-david@hardeman.nu> (raw)
In-Reply-To: <20261116155609.535595-1-david@hardeman.nu>

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


  reply	other threads:[~2026-11-16 15:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2026-11-16 15:56 ` [PATCH 2/2] wifi: iwlwifi: mld: release frames before one beyond the window David Härdeman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261116155609.535595-2-david@hardeman.nu \
    --to=david@hardeman.nu \
    --cc=emmanuel.grumbach@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=miriam.rachel.korenblit@intel.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®