aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-6000.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-6000.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-6000.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-6000.c36
1 files changed, 27 insertions, 9 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c
index dda1dd6ed40a..bdc1c74b6820 100644
--- a/drivers/net/wireless/iwlwifi/iwl-6000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-6000.c
@@ -129,18 +129,16 @@ static struct iwl_sensitivity_ranges iwl6000_sensitivity = {
129 129
130static int iwl6000_hw_set_hw_params(struct iwl_priv *priv) 130static int iwl6000_hw_set_hw_params(struct iwl_priv *priv)
131{ 131{
132 if ((priv->cfg->mod_params->num_of_queues > IWL50_NUM_QUEUES) || 132 if (priv->cfg->mod_params->num_of_queues >= IWL_MIN_NUM_QUEUES &&
133 (priv->cfg->mod_params->num_of_queues < IWL_MIN_NUM_QUEUES)) { 133 priv->cfg->mod_params->num_of_queues <= IWL50_NUM_QUEUES)
134 IWL_ERR(priv, 134 priv->cfg->num_of_queues =
135 "invalid queues_num, should be between %d and %d\n", 135 priv->cfg->mod_params->num_of_queues;
136 IWL_MIN_NUM_QUEUES, IWL50_NUM_QUEUES);
137 return -EINVAL;
138 }
139 136
140 priv->hw_params.max_txq_num = priv->cfg->mod_params->num_of_queues; 137 priv->hw_params.max_txq_num = priv->cfg->num_of_queues;
141 priv->hw_params.dma_chnl_num = FH50_TCSR_CHNL_NUM; 138 priv->hw_params.dma_chnl_num = FH50_TCSR_CHNL_NUM;
142 priv->hw_params.scd_bc_tbls_size = 139 priv->hw_params.scd_bc_tbls_size =
143 IWL50_NUM_QUEUES * sizeof(struct iwl5000_scd_bc_tbl); 140 priv->cfg->num_of_queues *
141 sizeof(struct iwl5000_scd_bc_tbl);
144 priv->hw_params.tfd_size = sizeof(struct iwl_tfd); 142 priv->hw_params.tfd_size = sizeof(struct iwl_tfd);
145 priv->hw_params.max_stations = IWL5000_STATION_COUNT; 143 priv->hw_params.max_stations = IWL5000_STATION_COUNT;
146 priv->hw_params.bcast_sta_id = IWL5000_BROADCAST_ID; 144 priv->hw_params.bcast_sta_id = IWL5000_BROADCAST_ID;
@@ -248,6 +246,8 @@ struct iwl_cfg iwl6000h_2agn_cfg = {
248 .eeprom_size = OTP_LOW_IMAGE_SIZE, 246 .eeprom_size = OTP_LOW_IMAGE_SIZE,
249 .eeprom_ver = EEPROM_6000_EEPROM_VERSION, 247 .eeprom_ver = EEPROM_6000_EEPROM_VERSION,
250 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION, 248 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
249 .num_of_queues = IWL50_NUM_QUEUES,
250 .num_of_ampdu_queues = IWL50_NUM_AMPDU_QUEUES,
251 .mod_params = &iwl50_mod_params, 251 .mod_params = &iwl50_mod_params,
252 .valid_tx_ant = ANT_AB, 252 .valid_tx_ant = ANT_AB,
253 .valid_rx_ant = ANT_AB, 253 .valid_rx_ant = ANT_AB,
@@ -272,6 +272,8 @@ struct iwl_cfg iwl6000h_2abg_cfg = {
272 .eeprom_size = OTP_LOW_IMAGE_SIZE, 272 .eeprom_size = OTP_LOW_IMAGE_SIZE,
273 .eeprom_ver = EEPROM_6000_EEPROM_VERSION, 273 .eeprom_ver = EEPROM_6000_EEPROM_VERSION,
274 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION, 274 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
275 .num_of_queues = IWL50_NUM_QUEUES,
276 .num_of_ampdu_queues = IWL50_NUM_AMPDU_QUEUES,
275 .mod_params = &iwl50_mod_params, 277 .mod_params = &iwl50_mod_params,
276 .valid_tx_ant = ANT_AB, 278 .valid_tx_ant = ANT_AB,
277 .valid_rx_ant = ANT_AB, 279 .valid_rx_ant = ANT_AB,
@@ -295,6 +297,8 @@ struct iwl_cfg iwl6000h_2bg_cfg = {
295 .eeprom_size = OTP_LOW_IMAGE_SIZE, 297 .eeprom_size = OTP_LOW_IMAGE_SIZE,
296 .eeprom_ver = EEPROM_6000_EEPROM_VERSION, 298 .eeprom_ver = EEPROM_6000_EEPROM_VERSION,
297 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION, 299 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
300 .num_of_queues = IWL50_NUM_QUEUES,
301 .num_of_ampdu_queues = IWL50_NUM_AMPDU_QUEUES,
298 .mod_params = &iwl50_mod_params, 302 .mod_params = &iwl50_mod_params,
299 .valid_tx_ant = ANT_AB, 303 .valid_tx_ant = ANT_AB,
300 .valid_rx_ant = ANT_AB, 304 .valid_rx_ant = ANT_AB,
@@ -321,6 +325,8 @@ struct iwl_cfg iwl6000i_2agn_cfg = {
321 .eeprom_size = OTP_LOW_IMAGE_SIZE, 325 .eeprom_size = OTP_LOW_IMAGE_SIZE,
322 .eeprom_ver = EEPROM_6000_EEPROM_VERSION, 326 .eeprom_ver = EEPROM_6000_EEPROM_VERSION,
323 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION, 327 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
328 .num_of_queues = IWL50_NUM_QUEUES,
329 .num_of_ampdu_queues = IWL50_NUM_AMPDU_QUEUES,
324 .mod_params = &iwl50_mod_params, 330 .mod_params = &iwl50_mod_params,
325 .valid_tx_ant = ANT_BC, 331 .valid_tx_ant = ANT_BC,
326 .valid_rx_ant = ANT_BC, 332 .valid_rx_ant = ANT_BC,
@@ -345,6 +351,8 @@ struct iwl_cfg iwl6000i_2abg_cfg = {
345 .eeprom_size = OTP_LOW_IMAGE_SIZE, 351 .eeprom_size = OTP_LOW_IMAGE_SIZE,
346 .eeprom_ver = EEPROM_6000_EEPROM_VERSION, 352 .eeprom_ver = EEPROM_6000_EEPROM_VERSION,
347 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION, 353 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
354 .num_of_queues = IWL50_NUM_QUEUES,
355 .num_of_ampdu_queues = IWL50_NUM_AMPDU_QUEUES,
348 .mod_params = &iwl50_mod_params, 356 .mod_params = &iwl50_mod_params,
349 .valid_tx_ant = ANT_BC, 357 .valid_tx_ant = ANT_BC,
350 .valid_rx_ant = ANT_BC, 358 .valid_rx_ant = ANT_BC,
@@ -368,6 +376,8 @@ struct iwl_cfg iwl6000i_2bg_cfg = {
368 .eeprom_size = OTP_LOW_IMAGE_SIZE, 376 .eeprom_size = OTP_LOW_IMAGE_SIZE,
369 .eeprom_ver = EEPROM_6000_EEPROM_VERSION, 377 .eeprom_ver = EEPROM_6000_EEPROM_VERSION,
370 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION, 378 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
379 .num_of_queues = IWL50_NUM_QUEUES,
380 .num_of_ampdu_queues = IWL50_NUM_AMPDU_QUEUES,
371 .mod_params = &iwl50_mod_params, 381 .mod_params = &iwl50_mod_params,
372 .valid_tx_ant = ANT_BC, 382 .valid_tx_ant = ANT_BC,
373 .valid_rx_ant = ANT_BC, 383 .valid_rx_ant = ANT_BC,
@@ -391,6 +401,8 @@ struct iwl_cfg iwl6050_2agn_cfg = {
391 .eeprom_size = OTP_LOW_IMAGE_SIZE, 401 .eeprom_size = OTP_LOW_IMAGE_SIZE,
392 .eeprom_ver = EEPROM_6000_EEPROM_VERSION, 402 .eeprom_ver = EEPROM_6000_EEPROM_VERSION,
393 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION, 403 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
404 .num_of_queues = IWL50_NUM_QUEUES,
405 .num_of_ampdu_queues = IWL50_NUM_AMPDU_QUEUES,
394 .mod_params = &iwl50_mod_params, 406 .mod_params = &iwl50_mod_params,
395 .valid_tx_ant = ANT_AB, 407 .valid_tx_ant = ANT_AB,
396 .valid_rx_ant = ANT_AB, 408 .valid_rx_ant = ANT_AB,
@@ -415,6 +427,8 @@ struct iwl_cfg iwl6050_2abg_cfg = {
415 .eeprom_size = OTP_LOW_IMAGE_SIZE, 427 .eeprom_size = OTP_LOW_IMAGE_SIZE,
416 .eeprom_ver = EEPROM_6000_EEPROM_VERSION, 428 .eeprom_ver = EEPROM_6000_EEPROM_VERSION,
417 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION, 429 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
430 .num_of_queues = IWL50_NUM_QUEUES,
431 .num_of_ampdu_queues = IWL50_NUM_AMPDU_QUEUES,
418 .mod_params = &iwl50_mod_params, 432 .mod_params = &iwl50_mod_params,
419 .valid_tx_ant = ANT_AB, 433 .valid_tx_ant = ANT_AB,
420 .valid_rx_ant = ANT_AB, 434 .valid_rx_ant = ANT_AB,
@@ -438,6 +452,8 @@ struct iwl_cfg iwl6000_3agn_cfg = {
438 .eeprom_size = OTP_LOW_IMAGE_SIZE, 452 .eeprom_size = OTP_LOW_IMAGE_SIZE,
439 .eeprom_ver = EEPROM_6000_EEPROM_VERSION, 453 .eeprom_ver = EEPROM_6000_EEPROM_VERSION,
440 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION, 454 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
455 .num_of_queues = IWL50_NUM_QUEUES,
456 .num_of_ampdu_queues = IWL50_NUM_AMPDU_QUEUES,
441 .mod_params = &iwl50_mod_params, 457 .mod_params = &iwl50_mod_params,
442 .valid_tx_ant = ANT_ABC, 458 .valid_tx_ant = ANT_ABC,
443 .valid_rx_ant = ANT_ABC, 459 .valid_rx_ant = ANT_ABC,
@@ -462,6 +478,8 @@ struct iwl_cfg iwl6050_3agn_cfg = {
462 .eeprom_size = OTP_LOW_IMAGE_SIZE, 478 .eeprom_size = OTP_LOW_IMAGE_SIZE,
463 .eeprom_ver = EEPROM_6000_EEPROM_VERSION, 479 .eeprom_ver = EEPROM_6000_EEPROM_VERSION,
464 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION, 480 .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
481 .num_of_queues = IWL50_NUM_QUEUES,
482 .num_of_ampdu_queues = IWL50_NUM_AMPDU_QUEUES,
465 .mod_params = &iwl50_mod_params, 483 .mod_params = &iwl50_mod_params,
466 .valid_tx_ant = ANT_ABC, 484 .valid_tx_ant = ANT_ABC,
467 .valid_rx_ant = ANT_ABC, 485 .valid_rx_ant = ANT_ABC,