aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl4965-base.c
diff options
context:
space:
mode:
authorCahill, Ben M <ben.m.cahill@intel.com>2007-11-28 22:09:54 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:05:22 -0500
commit8b6eaea8ec79b111a18a1c60333deb16ba27e6b3 (patch)
tree4a6de834ae5c503e4140a763486ced7022dcb64d /drivers/net/wireless/iwlwifi/iwl4965-base.c
parent74093ddf4c42da74922b63fb6844989e21164d9e (diff)
iwlwifi: add comments, mostly on Tx queues
Add comments, mostly on Tx queues Signed-off-by: Cahill, Ben M <ben.m.cahill@intel.com> Signed-off-by: Zhu Yi <yi.zhu@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl4965-base.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl4965-base.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index 74c3d3917fe1..66aa938e316e 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -305,6 +305,9 @@ static int iwl4965_tx_queue_alloc(struct iwl4965_priv *priv,
305 return -ENOMEM; 305 return -ENOMEM;
306} 306}
307 307
308/**
309 * iwl4965_tx_queue_init - Allocate and initialize one tx/cmd queue
310 */
308int iwl4965_tx_queue_init(struct iwl4965_priv *priv, 311int iwl4965_tx_queue_init(struct iwl4965_priv *priv,
309 struct iwl4965_tx_queue *txq, int slots_num, u32 txq_id) 312 struct iwl4965_tx_queue *txq, int slots_num, u32 txq_id)
310{ 313{
@@ -312,9 +315,14 @@ int iwl4965_tx_queue_init(struct iwl4965_priv *priv,
312 int len; 315 int len;
313 int rc = 0; 316 int rc = 0;
314 317
315 /* allocate command space + one big command for scan since scan 318 /*
316 * command is very huge the system will not have two scan at the 319 * Alloc buffer array for commands (Tx or other types of commands).
317 * same time */ 320 * For the command queue (#4), allocate command space + one big
321 * command for scan, since scan command is very huge; the system will
322 * not have two scans at the same time, so only one is needed.
323 * For normal Tx queues (all other queues), no super-size command
324 * space is needed.
325 */
318 len = sizeof(struct iwl4965_cmd) * slots_num; 326 len = sizeof(struct iwl4965_cmd) * slots_num;
319 if (txq_id == IWL_CMD_QUEUE_NUM) 327 if (txq_id == IWL_CMD_QUEUE_NUM)
320 len += IWL_MAX_SCAN_SIZE; 328 len += IWL_MAX_SCAN_SIZE;
@@ -322,6 +330,7 @@ int iwl4965_tx_queue_init(struct iwl4965_priv *priv,
322 if (!txq->cmd) 330 if (!txq->cmd)
323 return -ENOMEM; 331 return -ENOMEM;
324 332
333 /* Alloc driver data array and TFD circular buffer */
325 rc = iwl4965_tx_queue_alloc(priv, txq, txq_id); 334 rc = iwl4965_tx_queue_alloc(priv, txq, txq_id);
326 if (rc) { 335 if (rc) {
327 pci_free_consistent(dev, len, txq->cmd, txq->dma_addr_cmd); 336 pci_free_consistent(dev, len, txq->cmd, txq->dma_addr_cmd);
@@ -333,8 +342,11 @@ int iwl4965_tx_queue_init(struct iwl4965_priv *priv,
333 /* TFD_QUEUE_SIZE_MAX must be power-of-two size, otherwise 342 /* TFD_QUEUE_SIZE_MAX must be power-of-two size, otherwise
334 * iwl4965_queue_inc_wrap and iwl4965_queue_dec_wrap are broken. */ 343 * iwl4965_queue_inc_wrap and iwl4965_queue_dec_wrap are broken. */
335 BUILD_BUG_ON(TFD_QUEUE_SIZE_MAX & (TFD_QUEUE_SIZE_MAX - 1)); 344 BUILD_BUG_ON(TFD_QUEUE_SIZE_MAX & (TFD_QUEUE_SIZE_MAX - 1));
345
346 /* Initialize queue's high/low-water marks, and head/tail indexes */
336 iwl4965_queue_init(priv, &txq->q, TFD_QUEUE_SIZE_MAX, slots_num, txq_id); 347 iwl4965_queue_init(priv, &txq->q, TFD_QUEUE_SIZE_MAX, slots_num, txq_id);
337 348
349 /* Tell device where to find queue */
338 iwl4965_hw_tx_queue_init(priv, txq); 350 iwl4965_hw_tx_queue_init(priv, txq);
339 351
340 return 0; 352 return 0;