All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luca Coelho <luca@coelho.fi>
To: kvalo@codeaurora.org
Cc: luca@coelho.fi, linux-wireless@vger.kernel.org
Subject: [PATCH 06/12] iwlwifi: pcie: free RBs during configure
Date: Mon,  2 Aug 2021 17:09:38 +0300	[thread overview]
Message-ID: <iwlwifi.20210802170640.42d7c93279c4.I07f74e65aab0e3d965a81206fcb289dc92d74878@changeid> (raw)
In-Reply-To: <20210802140944.90143-1-luca@coelho.fi>

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

When switching op-modes, or more generally when reconfiguring,
we might switch the RB size. In _iwl_pcie_rx_init() we have a
comment saying we must free all RBs since we might switch the
size, but this is actually too late: the switch has been done
and we'll free the buffers with the wrong size.

Fix this by always freeing the buffers, if any, at the start
of configure, instead of only after the size may have changed.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/pcie/rx.c    | 5 ++++-
 drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 3 +++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
index 4f6f4b2720f0..ff7ca3c57f34 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
@@ -487,6 +487,9 @@ void iwl_pcie_free_rbs_pool(struct iwl_trans *trans)
 	struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
 	int i;
 
+	if (!trans_pcie->rx_pool)
+		return;
+
 	for (i = 0; i < RX_POOL_SIZE(trans_pcie->num_rx_bufs); i++) {
 		if (!trans_pcie->rx_pool[i].page)
 			continue;
@@ -1062,7 +1065,7 @@ static int _iwl_pcie_rx_init(struct iwl_trans *trans)
 	INIT_LIST_HEAD(&rba->rbd_empty);
 	spin_unlock_bh(&rba->lock);
 
-	/* free all first - we might be reconfigured for a different size */
+	/* free all first - we overwrite everything here */
 	iwl_pcie_free_rbs_pool(trans);
 
 	for (i = 0; i < RX_QUEUE_SIZE; i++)
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
index bee6b4574226..65cc25cbb9ec 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
@@ -1866,6 +1866,9 @@ static void iwl_trans_pcie_configure(struct iwl_trans *trans,
 {
 	struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
 
+	/* free all first - we might be reconfigured for a different size */
+	iwl_pcie_free_rbs_pool(trans);
+
 	trans->txqs.cmd.q_id = trans_cfg->cmd_queue;
 	trans->txqs.cmd.fifo = trans_cfg->cmd_fifo;
 	trans->txqs.cmd.wdg_timeout = trans_cfg->cmd_q_wdg_timeout;
-- 
2.32.0


  parent reply	other threads:[~2021-08-02 14:20 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-02 14:09 [PATCH 00/12] iwlwifi: updates intended for v5.15 2021-08-02 Luca Coelho
2021-08-02 14:09 ` [PATCH 01/12] iwlwifi: iwl-nvm-parse: set STBC flags for HE phy capabilities Luca Coelho
2021-08-26 20:32   ` Luca Coelho
2021-08-02 14:09 ` [PATCH 02/12] iwlwifi: mvm: set BROADCAST_TWT_SUPPORTED in MAC policy Luca Coelho
2021-08-02 14:09 ` [PATCH 03/12] iwlwifi: nvm: enable IEEE80211_HE_PHY_CAP10_HE_MU_M1RU_MAX_LTF Luca Coelho
2021-08-02 14:09 ` [PATCH 04/12] iwlwifi: mvm: avoid FW restart while shutting down Luca Coelho
2021-08-02 14:09 ` [PATCH 05/12] iwlwifi: pcie: optimise struct iwl_rx_mem_buffer layout Luca Coelho
2021-08-02 14:09 ` Luca Coelho [this message]
2021-08-02 14:09 ` [PATCH 07/12] iwlwifi: prepare for synchronous error dumps Luca Coelho
2021-08-02 14:09 ` [PATCH 08/12] iwlwifi: pcie: dump error on FW reset handshake failures Luca Coelho
2021-08-02 14:09 ` [PATCH 09/12] iwlwifi: print PNVM complete notification status in hexadecimal Luca Coelho
2021-08-02 14:09 ` [PATCH 10/12] iwlwifi: mvm: Do not use full SSIDs in 6GHz scan Luca Coelho
2021-08-02 14:09 ` [PATCH 11/12] iwlwifi: mvm: Add support for hidden network scan on 6GHz band Luca Coelho
2021-08-02 14:09 ` [PATCH 12/12] iwlwifi: iwl-dbg-tlv: add info about loading external dbg bin Luca Coelho

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=iwlwifi.20210802170640.42d7c93279c4.I07f74e65aab0e3d965a81206fcb289dc92d74878@changeid \
    --to=luca@coelho.fi \
    --cc=kvalo@codeaurora.org \
    --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.