aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-tx.c
diff options
context:
space:
mode:
authorWey-Yi Guy <wey-yi.w.guy@intel.com>2009-10-09 16:20:28 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-10-27 16:47:59 -0400
commit88804e2b33b6ab3974ff2330cd045ca53d6750c5 (patch)
tree1e8d7f27f59774c159e80ad0a9f3bfd6100a525f /drivers/net/wireless/iwlwifi/iwl-tx.c
parent008a9e3e3c37abd7f56d2478fe92d5874de3630a (diff)
iwlwifi: dynamic allocate tx queue structure
Instead of always allocate the max number of tx queue structure, use dynamic allocation based on the number of queues in device configuration. With these changes, device does not have to allocate more memory than the h/w can support. Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-tx.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-tx.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-tx.c b/drivers/net/wireless/iwlwifi/iwl-tx.c
index c832ba085db..625da63d01e 100644
--- a/drivers/net/wireless/iwlwifi/iwl-tx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-tx.c
@@ -405,15 +405,19 @@ void iwl_hw_txq_ctx_free(struct iwl_priv *priv)
405 int txq_id; 405 int txq_id;
406 406
407 /* Tx queues */ 407 /* Tx queues */
408 for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) 408 if (priv->txq)
409 if (txq_id == IWL_CMD_QUEUE_NUM) 409 for (txq_id = 0; txq_id < priv->hw_params.max_txq_num;
410 iwl_cmd_queue_free(priv); 410 txq_id++)
411 else 411 if (txq_id == IWL_CMD_QUEUE_NUM)
412 iwl_tx_queue_free(priv, txq_id); 412 iwl_cmd_queue_free(priv);
413 413 else
414 iwl_tx_queue_free(priv, txq_id);
414 iwl_free_dma_ptr(priv, &priv->kw); 415 iwl_free_dma_ptr(priv, &priv->kw);
415 416
416 iwl_free_dma_ptr(priv, &priv->scd_bc_tbls); 417 iwl_free_dma_ptr(priv, &priv->scd_bc_tbls);
418
419 /* free tx queue structure */
420 iwl_free_txq_mem(priv);
417} 421}
418EXPORT_SYMBOL(iwl_hw_txq_ctx_free); 422EXPORT_SYMBOL(iwl_hw_txq_ctx_free);
419 423
@@ -445,6 +449,12 @@ int iwl_txq_ctx_reset(struct iwl_priv *priv)
445 IWL_ERR(priv, "Keep Warm allocation failed\n"); 449 IWL_ERR(priv, "Keep Warm allocation failed\n");
446 goto error_kw; 450 goto error_kw;
447 } 451 }
452
453 /* allocate tx queue structure */
454 ret = iwl_alloc_txq_mem(priv);
455 if (ret)
456 goto error;
457
448 spin_lock_irqsave(&priv->lock, flags); 458 spin_lock_irqsave(&priv->lock, flags);
449 459
450 /* Turn off all Tx DMA fifos */ 460 /* Turn off all Tx DMA fifos */