aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-debugfs.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-debugfs.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-debugfs.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debugfs.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
index aa62357c9151..028d4bf8dcd8 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
@@ -884,10 +884,14 @@ static ssize_t iwl_dbgfs_traffic_log_read(struct file *file,
884 struct iwl_rx_queue *rxq = &priv->rxq; 884 struct iwl_rx_queue *rxq = &priv->rxq;
885 char *buf; 885 char *buf;
886 int bufsz = ((IWL_TRAFFIC_ENTRIES * IWL_TRAFFIC_ENTRY_SIZE * 64) * 2) + 886 int bufsz = ((IWL_TRAFFIC_ENTRIES * IWL_TRAFFIC_ENTRY_SIZE * 64) * 2) +
887 (IWL_MAX_NUM_QUEUES * 32 * 8) + 400; 887 (priv->cfg->num_of_queues * 32 * 8) + 400;
888 const u8 *ptr; 888 const u8 *ptr;
889 ssize_t ret; 889 ssize_t ret;
890 890
891 if (!priv->txq) {
892 IWL_ERR(priv, "txq not ready\n");
893 return -EAGAIN;
894 }
891 buf = kzalloc(bufsz, GFP_KERNEL); 895 buf = kzalloc(bufsz, GFP_KERNEL);
892 if (!buf) { 896 if (!buf) {
893 IWL_ERR(priv, "Can not allocate buffer\n"); 897 IWL_ERR(priv, "Can not allocate buffer\n");
@@ -979,8 +983,12 @@ static ssize_t iwl_dbgfs_tx_queue_read(struct file *file,
979 int pos = 0; 983 int pos = 0;
980 int cnt; 984 int cnt;
981 int ret; 985 int ret;
982 const size_t bufsz = sizeof(char) * 60 * IWL_MAX_NUM_QUEUES; 986 const size_t bufsz = sizeof(char) * 60 * priv->cfg->num_of_queues;
983 987
988 if (!priv->txq) {
989 IWL_ERR(priv, "txq not ready\n");
990 return -EAGAIN;
991 }
984 buf = kzalloc(bufsz, GFP_KERNEL); 992 buf = kzalloc(bufsz, GFP_KERNEL);
985 if (!buf) 993 if (!buf)
986 return -ENOMEM; 994 return -ENOMEM;