All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luca Coelho <luca@coelho.fi>
To: kvalo@codeaurora.org
Cc: linux-wireless@vger.kernel.org
Subject: [PATCH 02/11] iwlwifi: mvm: attempt to allocate smaller queues
Date: Sat, 25 Apr 2020 13:04:50 +0300	[thread overview]
Message-ID: <iwlwifi.20200425130140.c8548d7cc08a.I5059c410e628726cbce98d6311b690c632d00f97@changeid> (raw)
In-Reply-To: <20200425100459.2778317-1-luca@coelho.fi>

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

We currently attempt to allocate queues that are 512 entries long,
but that requires 32 KiB memory, which may not be available, at
least not contiguously. If we fail to allocate, attempt to use a
smaller queue all the way down to 16 entries (which fit into a
single page).

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 23 +++++++++++++-------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
index 1a210292f56c..3e16bd4190ff 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
@@ -744,16 +744,23 @@ static int iwl_mvm_tvqm_enable_txq(struct iwl_mvm *mvm,
 		size = max_t(u32, IWL_MGMT_QUEUE_SIZE,
 			     mvm->trans->cfg->min_txq_size);
 	}
-	queue = iwl_trans_txq_alloc(mvm->trans,
-				    cpu_to_le16(TX_QUEUE_CFG_ENABLE_QUEUE),
-				    sta_id, tid, SCD_QUEUE_CFG, size, timeout);
 
-	if (queue < 0) {
-		IWL_DEBUG_TX_QUEUES(mvm,
-				    "Failed allocating TXQ for sta %d tid %d, ret: %d\n",
-				    sta_id, tid, queue);
+	do {
+		__le16 enable = cpu_to_le16(TX_QUEUE_CFG_ENABLE_QUEUE);
+
+		queue = iwl_trans_txq_alloc(mvm->trans, enable,
+					    sta_id, tid, SCD_QUEUE_CFG,
+					    size, timeout);
+
+		if (queue < 0)
+			IWL_DEBUG_TX_QUEUES(mvm,
+					    "Failed allocating TXQ of size %d for sta %d tid %d, ret: %d\n",
+					    size, sta_id, tid, queue);
+		size /= 2;
+	} while (queue < 0 && size >= 16);
+
+	if (queue < 0)
 		return queue;
-	}
 
 	IWL_DEBUG_TX_QUEUES(mvm, "Enabling TXQ #%d for sta %d tid %d\n",
 			    queue, sta_id, tid);
-- 
2.26.2


  parent reply	other threads:[~2020-04-25 10:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-25 10:04 [PATCH 00/11] iwlwifi: updates intended for v5.8 2020-04-25 Luca Coelho
2020-04-25 10:04 ` [PATCH 01/11] iwlwifi: pcie: allocate much smaller byte-count table Luca Coelho
2020-04-25 10:04 ` Luca Coelho [this message]
2020-04-25 10:04 ` [PATCH 03/11] iwlwifi: dbg: mark a variable __maybe_unused Luca Coelho
2020-04-25 10:04 ` [PATCH 04/11] iwlwifi: pcie: remove some dead code Luca Coelho
2020-04-25 10:04 ` [PATCH 05/11] iwlwifi: pcie: gen2: use DMA pool for byte-count tables Luca Coelho
2020-04-25 10:04 ` [PATCH 06/11] iwlwifi: use longer queues for 256-BA Luca Coelho
2020-04-25 10:04 ` [PATCH 07/11] iwlwifi: tx: enable A-MSDU in low latency mode Luca Coelho
2020-04-25 10:04 ` [PATCH 08/11] iwlwifi: mvm: don't transmit on unallocated queue Luca Coelho
2020-04-25 10:04 ` [PATCH 09/11] iwlwifi: remove outdated copyright print/module statement Luca Coelho
2020-04-25 10:04 ` [PATCH 10/11] iwlwifi: pcie: skip fragmented receive buffers Luca Coelho
2020-04-25 10:04 ` [PATCH 11/11] iwlwifi: dbg_ini: differentiate ax210 hw with same hw type 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.20200425130140.c8548d7cc08a.I5059c410e628726cbce98d6311b690c632d00f97@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.