aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-4965.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-4965.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-4965.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 966858587e2..c9d90169ab1 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -62,8 +62,6 @@ static int iwl4965_hw_get_temperature(struct iwl_priv *priv);
62 62
63/* module parameters */ 63/* module parameters */
64static struct iwl_mod_params iwl4965_mod_params = { 64static struct iwl_mod_params iwl4965_mod_params = {
65 .num_of_queues = IWL49_NUM_QUEUES,
66 .num_of_ampdu_queues = IWL49_NUM_AMPDU_QUEUES,
67 .amsdu_size_8K = 1, 65 .amsdu_size_8K = 1,
68 .restart_fw = 1, 66 .restart_fw = 1,
69 /* the rest are 0 by default */ 67 /* the rest are 0 by default */
@@ -698,19 +696,16 @@ static void iwl4965_set_ct_threshold(struct iwl_priv *priv)
698 */ 696 */
699static int iwl4965_hw_set_hw_params(struct iwl_priv *priv) 697static int iwl4965_hw_set_hw_params(struct iwl_priv *priv)
700{ 698{
699 if (priv->cfg->mod_params->num_of_queues >= IWL_MIN_NUM_QUEUES &&
700 priv->cfg->mod_params->num_of_queues <= IWL49_NUM_QUEUES)
701 priv->cfg->num_of_queues =
702 priv->cfg->mod_params->num_of_queues;
701 703
702 if ((priv->cfg->mod_params->num_of_queues > IWL49_NUM_QUEUES) || 704 priv->hw_params.max_txq_num = priv->cfg->num_of_queues;
703 (priv->cfg->mod_params->num_of_queues < IWL_MIN_NUM_QUEUES)) {
704 IWL_ERR(priv,
705 "invalid queues_num, should be between %d and %d\n",
706 IWL_MIN_NUM_QUEUES, IWL49_NUM_QUEUES);
707 return -EINVAL;
708 }
709
710 priv->hw_params.max_txq_num = priv->cfg->mod_params->num_of_queues;
711 priv->hw_params.dma_chnl_num = FH49_TCSR_CHNL_NUM; 705 priv->hw_params.dma_chnl_num = FH49_TCSR_CHNL_NUM;
712 priv->hw_params.scd_bc_tbls_size = 706 priv->hw_params.scd_bc_tbls_size =
713 IWL49_NUM_QUEUES * sizeof(struct iwl4965_scd_bc_tbl); 707 priv->cfg->num_of_queues *
708 sizeof(struct iwl4965_scd_bc_tbl);
714 priv->hw_params.tfd_size = sizeof(struct iwl_tfd); 709 priv->hw_params.tfd_size = sizeof(struct iwl_tfd);
715 priv->hw_params.max_stations = IWL4965_STATION_COUNT; 710 priv->hw_params.max_stations = IWL4965_STATION_COUNT;
716 priv->hw_params.bcast_sta_id = IWL4965_BROADCAST_ID; 711 priv->hw_params.bcast_sta_id = IWL4965_BROADCAST_ID;
@@ -1739,11 +1734,13 @@ static int iwl4965_txq_agg_disable(struct iwl_priv *priv, u16 txq_id,
1739 u16 ssn_idx, u8 tx_fifo) 1734 u16 ssn_idx, u8 tx_fifo)
1740{ 1735{
1741 if ((IWL49_FIRST_AMPDU_QUEUE > txq_id) || 1736 if ((IWL49_FIRST_AMPDU_QUEUE > txq_id) ||
1742 (IWL49_FIRST_AMPDU_QUEUE + IWL49_NUM_AMPDU_QUEUES <= txq_id)) { 1737 (IWL49_FIRST_AMPDU_QUEUE + priv->cfg->num_of_ampdu_queues
1738 <= txq_id)) {
1743 IWL_WARN(priv, 1739 IWL_WARN(priv,
1744 "queue number out of range: %d, must be %d to %d\n", 1740 "queue number out of range: %d, must be %d to %d\n",
1745 txq_id, IWL49_FIRST_AMPDU_QUEUE, 1741 txq_id, IWL49_FIRST_AMPDU_QUEUE,
1746 IWL49_FIRST_AMPDU_QUEUE + IWL49_NUM_AMPDU_QUEUES - 1); 1742 IWL49_FIRST_AMPDU_QUEUE +
1743 priv->cfg->num_of_ampdu_queues - 1);
1747 return -EINVAL; 1744 return -EINVAL;
1748 } 1745 }
1749 1746
@@ -1804,11 +1801,13 @@ static int iwl4965_txq_agg_enable(struct iwl_priv *priv, int txq_id,
1804 u16 ra_tid; 1801 u16 ra_tid;
1805 1802
1806 if ((IWL49_FIRST_AMPDU_QUEUE > txq_id) || 1803 if ((IWL49_FIRST_AMPDU_QUEUE > txq_id) ||
1807 (IWL49_FIRST_AMPDU_QUEUE + IWL49_NUM_AMPDU_QUEUES <= txq_id)) { 1804 (IWL49_FIRST_AMPDU_QUEUE + priv->cfg->num_of_ampdu_queues
1805 <= txq_id)) {
1808 IWL_WARN(priv, 1806 IWL_WARN(priv,
1809 "queue number out of range: %d, must be %d to %d\n", 1807 "queue number out of range: %d, must be %d to %d\n",
1810 txq_id, IWL49_FIRST_AMPDU_QUEUE, 1808 txq_id, IWL49_FIRST_AMPDU_QUEUE,
1811 IWL49_FIRST_AMPDU_QUEUE + IWL49_NUM_AMPDU_QUEUES - 1); 1809 IWL49_FIRST_AMPDU_QUEUE +
1810 priv->cfg->num_of_ampdu_queues - 1);
1812 return -EINVAL; 1811 return -EINVAL;
1813 } 1812 }
1814 1813
@@ -2286,6 +2285,8 @@ struct iwl_cfg iwl4965_agn_cfg = {
2286 .eeprom_ver = EEPROM_4965_EEPROM_VERSION, 2285 .eeprom_ver = EEPROM_4965_EEPROM_VERSION,
2287 .eeprom_calib_ver = EEPROM_4965_TX_POWER_VERSION, 2286 .eeprom_calib_ver = EEPROM_4965_TX_POWER_VERSION,
2288 .ops = &iwl4965_ops, 2287 .ops = &iwl4965_ops,
2288 .num_of_queues = IWL49_NUM_QUEUES,
2289 .num_of_ampdu_queues = IWL49_NUM_AMPDU_QUEUES,
2289 .mod_params = &iwl4965_mod_params, 2290 .mod_params = &iwl4965_mod_params,
2290 .use_isr_legacy = true, 2291 .use_isr_legacy = true,
2291 .ht_greenfield_support = false, 2292 .ht_greenfield_support = false,