aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl3945-base.c
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2007-10-25 05:15:24 -0400
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:03:08 -0500
commitfc4b6853fb5e729616159d4f17785f089227a8e8 (patch)
treea054bb23d3a21c70bd62f48799832418246a37ca /drivers/net/wireless/iwlwifi/iwl3945-base.c
parent91e1747384b80813c2a6c7a9d2dd99722d5b9e1e (diff)
iwlwifi: renaming last_used and first_empty
This patch renames queue pointers to write_ptr and read_ptr instead of first_empty and last_used. This is closer to technical terminology we everyday use Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl3945-base.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c60
1 files changed, 30 insertions, 30 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 4fd9eac6516..f6022649a6b 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -209,9 +209,9 @@ static void iwl_print_hex_dump(int level, void *p, u32 len)
209 209
210static int iwl_queue_space(const struct iwl_queue *q) 210static int iwl_queue_space(const struct iwl_queue *q)
211{ 211{
212 int s = q->last_used - q->first_empty; 212 int s = q->read_ptr - q->write_ptr;
213 213
214 if (q->last_used > q->first_empty) 214 if (q->read_ptr > q->write_ptr)
215 s -= q->n_bd; 215 s -= q->n_bd;
216 216
217 if (s <= 0) 217 if (s <= 0)
@@ -237,9 +237,9 @@ static inline int iwl_queue_dec_wrap(int index, int n_bd)
237 237
238static inline int x2_queue_used(const struct iwl_queue *q, int i) 238static inline int x2_queue_used(const struct iwl_queue *q, int i)
239{ 239{
240 return q->first_empty > q->last_used ? 240 return q->write_ptr > q->read_ptr ?
241 (i >= q->last_used && i < q->first_empty) : 241 (i >= q->read_ptr && i < q->write_ptr) :
242 !(i < q->last_used && i >= q->first_empty); 242 !(i < q->read_ptr && i >= q->write_ptr);
243} 243}
244 244
245static inline u8 get_cmd_index(struct iwl_queue *q, u32 index, int is_huge) 245static inline u8 get_cmd_index(struct iwl_queue *q, u32 index, int is_huge)
@@ -273,7 +273,7 @@ static int iwl_queue_init(struct iwl_priv *priv, struct iwl_queue *q,
273 if (q->high_mark < 2) 273 if (q->high_mark < 2)
274 q->high_mark = 2; 274 q->high_mark = 2;
275 275
276 q->first_empty = q->last_used = 0; 276 q->write_ptr = q->read_ptr = 0;
277 277
278 return 0; 278 return 0;
279} 279}
@@ -369,8 +369,8 @@ void iwl_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq)
369 return; 369 return;
370 370
371 /* first, empty all BD's */ 371 /* first, empty all BD's */
372 for (; q->first_empty != q->last_used; 372 for (; q->write_ptr != q->read_ptr;
373 q->last_used = iwl_queue_inc_wrap(q->last_used, q->n_bd)) 373 q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd))
374 iwl_hw_txq_free_tfd(priv, txq); 374 iwl_hw_txq_free_tfd(priv, txq);
375 375
376 len = sizeof(struct iwl_cmd) * q->n_window; 376 len = sizeof(struct iwl_cmd) * q->n_window;
@@ -649,12 +649,12 @@ static int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
649 649
650 spin_lock_irqsave(&priv->hcmd_lock, flags); 650 spin_lock_irqsave(&priv->hcmd_lock, flags);
651 651
652 tfd = &txq->bd[q->first_empty]; 652 tfd = &txq->bd[q->write_ptr];
653 memset(tfd, 0, sizeof(*tfd)); 653 memset(tfd, 0, sizeof(*tfd));
654 654
655 control_flags = (u32 *) tfd; 655 control_flags = (u32 *) tfd;
656 656
657 idx = get_cmd_index(q, q->first_empty, cmd->meta.flags & CMD_SIZE_HUGE); 657 idx = get_cmd_index(q, q->write_ptr, cmd->meta.flags & CMD_SIZE_HUGE);
658 out_cmd = &txq->cmd[idx]; 658 out_cmd = &txq->cmd[idx];
659 659
660 out_cmd->hdr.cmd = cmd->id; 660 out_cmd->hdr.cmd = cmd->id;
@@ -666,7 +666,7 @@ static int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
666 666
667 out_cmd->hdr.flags = 0; 667 out_cmd->hdr.flags = 0;
668 out_cmd->hdr.sequence = cpu_to_le16(QUEUE_TO_SEQ(IWL_CMD_QUEUE_NUM) | 668 out_cmd->hdr.sequence = cpu_to_le16(QUEUE_TO_SEQ(IWL_CMD_QUEUE_NUM) |
669 INDEX_TO_SEQ(q->first_empty)); 669 INDEX_TO_SEQ(q->write_ptr));
670 if (out_cmd->meta.flags & CMD_SIZE_HUGE) 670 if (out_cmd->meta.flags & CMD_SIZE_HUGE)
671 out_cmd->hdr.sequence |= cpu_to_le16(SEQ_HUGE_FRAME); 671 out_cmd->hdr.sequence |= cpu_to_le16(SEQ_HUGE_FRAME);
672 672
@@ -682,10 +682,10 @@ static int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
682 "%d bytes at %d[%d]:%d\n", 682 "%d bytes at %d[%d]:%d\n",
683 get_cmd_string(out_cmd->hdr.cmd), 683 get_cmd_string(out_cmd->hdr.cmd),
684 out_cmd->hdr.cmd, le16_to_cpu(out_cmd->hdr.sequence), 684 out_cmd->hdr.cmd, le16_to_cpu(out_cmd->hdr.sequence),
685 fix_size, q->first_empty, idx, IWL_CMD_QUEUE_NUM); 685 fix_size, q->write_ptr, idx, IWL_CMD_QUEUE_NUM);
686 686
687 txq->need_update = 1; 687 txq->need_update = 1;
688 q->first_empty = iwl_queue_inc_wrap(q->first_empty, q->n_bd); 688 q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd);
689 ret = iwl_tx_queue_update_write_ptr(priv, txq); 689 ret = iwl_tx_queue_update_write_ptr(priv, txq);
690 690
691 spin_unlock_irqrestore(&priv->hcmd_lock, flags); 691 spin_unlock_irqrestore(&priv->hcmd_lock, flags);
@@ -2799,21 +2799,21 @@ static int iwl_tx_skb(struct iwl_priv *priv,
2799 2799
2800 spin_lock_irqsave(&priv->lock, flags); 2800 spin_lock_irqsave(&priv->lock, flags);
2801 2801
2802 tfd = &txq->bd[q->first_empty]; 2802 tfd = &txq->bd[q->write_ptr];
2803 memset(tfd, 0, sizeof(*tfd)); 2803 memset(tfd, 0, sizeof(*tfd));
2804 control_flags = (u32 *) tfd; 2804 control_flags = (u32 *) tfd;
2805 idx = get_cmd_index(q, q->first_empty, 0); 2805 idx = get_cmd_index(q, q->write_ptr, 0);
2806 2806
2807 memset(&(txq->txb[q->first_empty]), 0, sizeof(struct iwl_tx_info)); 2807 memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl_tx_info));
2808 txq->txb[q->first_empty].skb[0] = skb; 2808 txq->txb[q->write_ptr].skb[0] = skb;
2809 memcpy(&(txq->txb[q->first_empty].status.control), 2809 memcpy(&(txq->txb[q->write_ptr].status.control),
2810 ctl, sizeof(struct ieee80211_tx_control)); 2810 ctl, sizeof(struct ieee80211_tx_control));
2811 out_cmd = &txq->cmd[idx]; 2811 out_cmd = &txq->cmd[idx];
2812 memset(&out_cmd->hdr, 0, sizeof(out_cmd->hdr)); 2812 memset(&out_cmd->hdr, 0, sizeof(out_cmd->hdr));
2813 memset(&out_cmd->cmd.tx, 0, sizeof(out_cmd->cmd.tx)); 2813 memset(&out_cmd->cmd.tx, 0, sizeof(out_cmd->cmd.tx));
2814 out_cmd->hdr.cmd = REPLY_TX; 2814 out_cmd->hdr.cmd = REPLY_TX;
2815 out_cmd->hdr.sequence = cpu_to_le16((u16)(QUEUE_TO_SEQ(txq_id) | 2815 out_cmd->hdr.sequence = cpu_to_le16((u16)(QUEUE_TO_SEQ(txq_id) |
2816 INDEX_TO_SEQ(q->first_empty))); 2816 INDEX_TO_SEQ(q->write_ptr)));
2817 /* copy frags header */ 2817 /* copy frags header */
2818 memcpy(out_cmd->cmd.tx.hdr, hdr, hdr_len); 2818 memcpy(out_cmd->cmd.tx.hdr, hdr, hdr_len);
2819 2819
@@ -2881,7 +2881,7 @@ static int iwl_tx_skb(struct iwl_priv *priv,
2881 iwl_print_hex_dump(IWL_DL_TX, (u8 *)out_cmd->cmd.tx.hdr, 2881 iwl_print_hex_dump(IWL_DL_TX, (u8 *)out_cmd->cmd.tx.hdr,
2882 ieee80211_get_hdrlen(fc)); 2882 ieee80211_get_hdrlen(fc));
2883 2883
2884 q->first_empty = iwl_queue_inc_wrap(q->first_empty, q->n_bd); 2884 q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd);
2885 rc = iwl_tx_queue_update_write_ptr(priv, txq); 2885 rc = iwl_tx_queue_update_write_ptr(priv, txq);
2886 spin_unlock_irqrestore(&priv->lock, flags); 2886 spin_unlock_irqrestore(&priv->lock, flags);
2887 2887
@@ -3375,20 +3375,20 @@ int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index)
3375 if ((index >= q->n_bd) || (x2_queue_used(q, index) == 0)) { 3375 if ((index >= q->n_bd) || (x2_queue_used(q, index) == 0)) {
3376 IWL_ERROR("Read index for DMA queue txq id (%d), index %d, " 3376 IWL_ERROR("Read index for DMA queue txq id (%d), index %d, "
3377 "is out of range [0-%d] %d %d.\n", txq_id, 3377 "is out of range [0-%d] %d %d.\n", txq_id,
3378 index, q->n_bd, q->first_empty, q->last_used); 3378 index, q->n_bd, q->write_ptr, q->read_ptr);
3379 return 0; 3379 return 0;
3380 } 3380 }
3381 3381
3382 for (index = iwl_queue_inc_wrap(index, q->n_bd); 3382 for (index = iwl_queue_inc_wrap(index, q->n_bd);
3383 q->last_used != index; 3383 q->read_ptr != index;
3384 q->last_used = iwl_queue_inc_wrap(q->last_used, q->n_bd)) { 3384 q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) {
3385 if (txq_id != IWL_CMD_QUEUE_NUM) { 3385 if (txq_id != IWL_CMD_QUEUE_NUM) {
3386 iwl_txstatus_to_ieee(priv, 3386 iwl_txstatus_to_ieee(priv,
3387 &(txq->txb[txq->q.last_used])); 3387 &(txq->txb[txq->q.read_ptr]));
3388 iwl_hw_txq_free_tfd(priv, txq); 3388 iwl_hw_txq_free_tfd(priv, txq);
3389 } else if (nfreed > 1) { 3389 } else if (nfreed > 1) {
3390 IWL_ERROR("HCMD skipped: index (%d) %d %d\n", index, 3390 IWL_ERROR("HCMD skipped: index (%d) %d %d\n", index,
3391 q->first_empty, q->last_used); 3391 q->write_ptr, q->read_ptr);
3392 queue_work(priv->workqueue, &priv->restart); 3392 queue_work(priv->workqueue, &priv->restart);
3393 } 3393 }
3394 nfreed++; 3394 nfreed++;
@@ -3428,12 +3428,12 @@ static void iwl_rx_reply_tx(struct iwl_priv *priv,
3428 if ((index >= txq->q.n_bd) || (x2_queue_used(&txq->q, index) == 0)) { 3428 if ((index >= txq->q.n_bd) || (x2_queue_used(&txq->q, index) == 0)) {
3429 IWL_ERROR("Read index for DMA queue txq_id (%d) index %d " 3429 IWL_ERROR("Read index for DMA queue txq_id (%d) index %d "
3430 "is out of range [0-%d] %d %d\n", txq_id, 3430 "is out of range [0-%d] %d %d\n", txq_id,
3431 index, txq->q.n_bd, txq->q.first_empty, 3431 index, txq->q.n_bd, txq->q.write_ptr,
3432 txq->q.last_used); 3432 txq->q.read_ptr);
3433 return; 3433 return;
3434 } 3434 }
3435 3435
3436 tx_status = &(txq->txb[txq->q.last_used].status); 3436 tx_status = &(txq->txb[txq->q.read_ptr].status);
3437 3437
3438 tx_status->retry_count = tx_resp->failure_frame; 3438 tx_status->retry_count = tx_resp->failure_frame;
3439 tx_status->queue_number = status; 3439 tx_status->queue_number = status;
@@ -4368,14 +4368,14 @@ int iwl_tx_queue_update_write_ptr(struct iwl_priv *priv,
4368 if (rc) 4368 if (rc)
4369 return rc; 4369 return rc;
4370 iwl_write_restricted(priv, HBUS_TARG_WRPTR, 4370 iwl_write_restricted(priv, HBUS_TARG_WRPTR,
4371 txq->q.first_empty | (txq_id << 8)); 4371 txq->q.write_ptr | (txq_id << 8));
4372 iwl_release_restricted_access(priv); 4372 iwl_release_restricted_access(priv);
4373 4373
4374 /* else not in power-save mode, uCode will never sleep when we're 4374 /* else not in power-save mode, uCode will never sleep when we're
4375 * trying to tx (during RFKILL, we're not trying to tx). */ 4375 * trying to tx (during RFKILL, we're not trying to tx). */
4376 } else 4376 } else
4377 iwl_write32(priv, HBUS_TARG_WRPTR, 4377 iwl_write32(priv, HBUS_TARG_WRPTR,
4378 txq->q.first_empty | (txq_id << 8)); 4378 txq->q.write_ptr | (txq_id << 8));
4379 4379
4380 txq->need_update = 0; 4380 txq->need_update = 0;
4381 4381