summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/intel/iwlwifi/queue
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2024-06-05 14:05:00 +0300
committerJohannes Berg <johannes.berg@intel.com>2024-06-12 13:04:26 +0200
commit57bb72fad7bcb9ed0b2d7ec1b73a116ac3c6a2ba (patch)
tree0106d18e1caa73e1ec75e8647b9e755ec20f4710 /drivers/net/wireless/intel/iwlwifi/queue
parent62a5c4029552a5645d0600fcb311a14131ccced1 (diff)
wifi: iwlwifi: move TXQ bytecount limit to queue code
This really isn't correct to be in the opmode, do the clamping (and power-of-2 fixup that may be necessary due to this, or even otherwise) in the queue code. Also move down the retrying of the allocation, it should be after all the size fixups, but also it just makes sense, and avoids retrying same-size allocations in the case of the BZ-family A-step workaround. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com> Link: https://msgid.link/20240605140327.000a0a1e807d.Ib822590d5aca76ff3168418ae2c139b3d43d81ed@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'drivers/net/wireless/intel/iwlwifi/queue')
-rw-r--r--drivers/net/wireless/intel/iwlwifi/queue/tx.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/drivers/net/wireless/intel/iwlwifi/queue/tx.c b/drivers/net/wireless/intel/iwlwifi/queue/tx.c
index 6229c785c845..726035dfa5cd 100644
--- a/drivers/net/wireless/intel/iwlwifi/queue/tx.c
+++ b/drivers/net/wireless/intel/iwlwifi/queue/tx.c
@@ -1237,11 +1237,29 @@ int iwl_txq_dyn_alloc(struct iwl_trans *trans, u32 flags, u32 sta_mask,
};
int ret;
+ /* take the min with bytecount table entries allowed */
+ size = min_t(u32, size, trans->txqs.bc_tbl_size / sizeof(u16));
+ /* but must be power of 2 values for calculating read/write pointers */
+ size = rounddown_pow_of_two(size);
+
if (trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_BZ &&
- trans->hw_rev_step == SILICON_A_STEP)
+ trans->hw_rev_step == SILICON_A_STEP) {
size = 4096;
+ txq = iwl_txq_dyn_alloc_dma(trans, size, timeout);
+ } else {
+ do {
+ txq = iwl_txq_dyn_alloc_dma(trans, size, timeout);
+ if (!IS_ERR(txq))
+ break;
+
+ IWL_DEBUG_TX_QUEUES(trans,
+ "Failed allocating TXQ of size %d for sta mask %x tid %d, ret: %ld\n",
+ size, sta_mask, tid,
+ PTR_ERR(txq));
+ size /= 2;
+ } while (size >= 16);
+ }
- txq = iwl_txq_dyn_alloc_dma(trans, size, timeout);
if (IS_ERR(txq))
return PTR_ERR(txq);