aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-3945.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-3945.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-3945.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index 4e15a8e20d09..314cae773646 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -958,6 +958,11 @@ static int iwl3945_txq_ctx_reset(struct iwl_priv *priv)
958 958
959 iwl3945_hw_txq_ctx_free(priv); 959 iwl3945_hw_txq_ctx_free(priv);
960 960
961 /* allocate tx queue structure */
962 rc = iwl_alloc_txq_mem(priv);
963 if (rc)
964 return rc;
965
961 /* Tx CMD queue */ 966 /* Tx CMD queue */
962 rc = iwl3945_tx_reset(priv); 967 rc = iwl3945_tx_reset(priv);
963 if (rc) 968 if (rc)
@@ -1170,12 +1175,16 @@ void iwl3945_hw_txq_ctx_free(struct iwl_priv *priv)
1170 int txq_id; 1175 int txq_id;
1171 1176
1172 /* Tx queues */ 1177 /* Tx queues */
1173 for (txq_id = 0; txq_id < priv->hw_params.max_txq_num; txq_id++) 1178 if (priv->txq)
1174 if (txq_id == IWL_CMD_QUEUE_NUM) 1179 for (txq_id = 0; txq_id < priv->hw_params.max_txq_num;
1175 iwl_cmd_queue_free(priv); 1180 txq_id++)
1176 else 1181 if (txq_id == IWL_CMD_QUEUE_NUM)
1177 iwl_tx_queue_free(priv, txq_id); 1182 iwl_cmd_queue_free(priv);
1183 else
1184 iwl_tx_queue_free(priv, txq_id);
1178 1185
1186 /* free tx queue structure */
1187 iwl_free_txq_mem(priv);
1179} 1188}
1180 1189
1181void iwl3945_hw_txq_ctx_stop(struct iwl_priv *priv) 1190void iwl3945_hw_txq_ctx_stop(struct iwl_priv *priv)
@@ -2503,7 +2512,7 @@ int iwl3945_hw_set_hw_params(struct iwl_priv *priv)
2503 } 2512 }
2504 2513
2505 /* Assign number of Usable TX queues */ 2514 /* Assign number of Usable TX queues */
2506 priv->hw_params.max_txq_num = IWL39_NUM_QUEUES; 2515 priv->hw_params.max_txq_num = priv->cfg->num_of_queues;
2507 2516
2508 priv->hw_params.tfd_size = sizeof(struct iwl3945_tfd); 2517 priv->hw_params.tfd_size = sizeof(struct iwl3945_tfd);
2509 priv->hw_params.rx_buf_size = IWL_RX_BUF_SIZE_3K; 2518 priv->hw_params.rx_buf_size = IWL_RX_BUF_SIZE_3K;
@@ -2838,6 +2847,7 @@ static struct iwl_cfg iwl3945_bg_cfg = {
2838 .eeprom_size = IWL3945_EEPROM_IMG_SIZE, 2847 .eeprom_size = IWL3945_EEPROM_IMG_SIZE,
2839 .eeprom_ver = EEPROM_3945_EEPROM_VERSION, 2848 .eeprom_ver = EEPROM_3945_EEPROM_VERSION,
2840 .ops = &iwl3945_ops, 2849 .ops = &iwl3945_ops,
2850 .num_of_queues = IWL39_NUM_QUEUES,
2841 .mod_params = &iwl3945_mod_params, 2851 .mod_params = &iwl3945_mod_params,
2842 .use_isr_legacy = true, 2852 .use_isr_legacy = true,
2843 .ht_greenfield_support = false, 2853 .ht_greenfield_support = false,
@@ -2853,6 +2863,7 @@ static struct iwl_cfg iwl3945_abg_cfg = {
2853 .eeprom_size = IWL3945_EEPROM_IMG_SIZE, 2863 .eeprom_size = IWL3945_EEPROM_IMG_SIZE,
2854 .eeprom_ver = EEPROM_3945_EEPROM_VERSION, 2864 .eeprom_ver = EEPROM_3945_EEPROM_VERSION,
2855 .ops = &iwl3945_ops, 2865 .ops = &iwl3945_ops,
2866 .num_of_queues = IWL39_NUM_QUEUES,
2856 .mod_params = &iwl3945_mod_params, 2867 .mod_params = &iwl3945_mod_params,
2857 .use_isr_legacy = true, 2868 .use_isr_legacy = true,
2858 .ht_greenfield_support = false, 2869 .ht_greenfield_support = false,