All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miri Korenblit <miriam.rachel.korenblit@intel.com>
To: johannes@sipsolutions.net
Cc: linux-wireless@vger.kernel.org, Johannes Berg <johannes.berg@intel.com>
Subject: [PATCH 14/15] wifi: iwlwifi: mvm: fix erroneous queue index mask
Date: Mon,  5 Feb 2024 21:21:14 +0200	[thread overview]
Message-ID: <20240205211151.4148a6ef54e0.I733a70f679c25f9f99097a8dcb3a1f8165da6997@changeid> (raw)
In-Reply-To: <20240205192115.2320146-1-miriam.rachel.korenblit@intel.com>

From: Johannes Berg <johannes.berg@intel.com>

When retrieving the queue index ("SCD SSN") from the TX response,
it's currently masked with 0xFFF. However, now that we have queues
longer than 4k, that became wrong, so make the mask depend on the
hardware family.

This fixes an issue where if we get a single frame reclaim while
in the top half of an 8k long queue, we'd reclaim-wrap the queue
twice (once on this and then again on the next non-single reclaim)
which at least triggers the WARN_ON_ONCE() in iwl_txq_reclaim(),
but could have other negative side effects (such as unmapping a
frame that wasn't transmitted yet, and then taking an IOMMU fault)
as well.

Fixes: 7b3e42ea2ead ("iwlwifi: support multiple tfd queue max sizes for different devices")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
index ea1a4283f72b..c5fafaaee521 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/tx.c
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
 /*
- * Copyright (C) 2012-2014, 2018-2023 Intel Corporation
+ * Copyright (C) 2012-2014, 2018-2024 Intel Corporation
  * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
  * Copyright (C) 2016-2017 Intel Deutschland GmbH
  */
@@ -1661,12 +1661,18 @@ static void iwl_mvm_tx_status_check_trigger(struct iwl_mvm *mvm,
  * of the batch. This is why the SSN of the SCD is written at the end of the
  * whole struct at a variable offset. This function knows how to cope with the
  * variable offset and returns the SSN of the SCD.
+ *
+ * For 22000-series and lower, this is just 12 bits. For later, 16 bits.
  */
 static inline u32 iwl_mvm_get_scd_ssn(struct iwl_mvm *mvm,
 				      struct iwl_mvm_tx_resp *tx_resp)
 {
-	return le32_to_cpup((__le32 *)iwl_mvm_get_agg_status(mvm, tx_resp) +
-			    tx_resp->frame_count) & 0xfff;
+	u32 val = le32_to_cpup((__le32 *)iwl_mvm_get_agg_status(mvm, tx_resp) +
+			       tx_resp->frame_count);
+
+	if (mvm->trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_AX210)
+		return val & 0xFFFF;
+	return val & 0xFFF;
 }
 
 static void iwl_mvm_rx_tx_cmd_single(struct iwl_mvm *mvm,
-- 
2.34.1


  parent reply	other threads:[~2024-02-05 19:22 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-05 19:21 [PATCH 00/15] wifi: iwlwifi: updates - 2024-02-05 Miri Korenblit
2024-02-05 19:21 ` [PATCH 01/15] wifi: iwlwifi: mvm: expand queue sync warning messages Miri Korenblit
2024-02-05 19:21 ` [PATCH 02/15] wifi: iwlwifi: mvm: define RX queue sync timeout as a macro Miri Korenblit
2024-02-05 19:21 ` [PATCH 03/15] wifi: iwlwifi: mvm: don't abort queue sync in CT-kill Miri Korenblit
2024-02-05 19:21 ` [PATCH 04/15] wifi: iwlwifi: take SGOM and UATS code out of ACPI ifdef Miri Korenblit
2024-02-05 19:21 ` [PATCH 05/15] wifi: iwlwifi: properly check if link is active Miri Korenblit
2024-02-05 19:21 ` [PATCH 06/15] wifi: iwlwifi: mvm: remove IWL_MVM_STATUS_NEED_FLUSH_P2P Miri Korenblit
2024-02-05 19:21 ` [PATCH 07/15] wifi: iwlwifi: mvm: Keep connection in case of missed beacons during RX Miri Korenblit
2024-02-05 19:21 ` [PATCH 08/15] wifi: iwlwifi: cancel session protection only if there is one Miri Korenblit
2024-02-05 19:21 ` [PATCH 09/15] wifi: iwlwifi: mvm: fix the key PN index Miri Korenblit
2024-02-05 19:21 ` [PATCH 10/15] wifi: iwlwifi: mvm: combine condition/warning Miri Korenblit
2024-02-05 19:21 ` [PATCH 11/15] wifi: iwlwifi: mvm: limit pseudo-D3 to 60 seconds Miri Korenblit
2024-02-05 19:21 ` [PATCH 12/15] wifi: iwlwifi: mvm: always update keys in D3 exit Miri Korenblit
2024-02-05 19:21 ` [PATCH 13/15] wifi: iwlwifi: mvm: avoid garbage iPN Miri Korenblit
2024-02-05 19:21 ` Miri Korenblit [this message]
2024-02-05 19:21 ` [PATCH 15/15] wifi: iwlwifi: mvm: don't do duplicate detection for nullfunc packets Miri Korenblit

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=20240205211151.4148a6ef54e0.I733a70f679c25f9f99097a8dcb3a1f8165da6997@changeid \
    --to=miriam.rachel.korenblit@intel.com \
    --cc=johannes.berg@intel.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.