diff options
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-3945.c | 12 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965.c | 26 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl3945-base.c | 60 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl4965-base.c | 64 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwlwifi.h | 4 |
5 files changed, 83 insertions, 83 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index d6112816bada..b8d43436d35a 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c | |||
@@ -526,14 +526,14 @@ int iwl_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *ptr, | |||
526 | } | 526 | } |
527 | 527 | ||
528 | /** | 528 | /** |
529 | * iwl_hw_txq_free_tfd - Free one TFD, those at index [txq->q.last_used] | 529 | * iwl_hw_txq_free_tfd - Free one TFD, those at index [txq->q.read_ptr] |
530 | * | 530 | * |
531 | * Does NOT advance any indexes | 531 | * Does NOT advance any indexes |
532 | */ | 532 | */ |
533 | int iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq) | 533 | int iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq) |
534 | { | 534 | { |
535 | struct iwl_tfd_frame *bd_tmp = (struct iwl_tfd_frame *)&txq->bd[0]; | 535 | struct iwl_tfd_frame *bd_tmp = (struct iwl_tfd_frame *)&txq->bd[0]; |
536 | struct iwl_tfd_frame *bd = &bd_tmp[txq->q.last_used]; | 536 | struct iwl_tfd_frame *bd = &bd_tmp[txq->q.read_ptr]; |
537 | struct pci_dev *dev = priv->pci_dev; | 537 | struct pci_dev *dev = priv->pci_dev; |
538 | int i; | 538 | int i; |
539 | int counter; | 539 | int counter; |
@@ -556,12 +556,12 @@ int iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq) | |||
556 | for (i = 1; i < counter; i++) { | 556 | for (i = 1; i < counter; i++) { |
557 | pci_unmap_single(dev, le32_to_cpu(bd->pa[i].addr), | 557 | pci_unmap_single(dev, le32_to_cpu(bd->pa[i].addr), |
558 | le32_to_cpu(bd->pa[i].len), PCI_DMA_TODEVICE); | 558 | le32_to_cpu(bd->pa[i].len), PCI_DMA_TODEVICE); |
559 | if (txq->txb[txq->q.last_used].skb[0]) { | 559 | if (txq->txb[txq->q.read_ptr].skb[0]) { |
560 | struct sk_buff *skb = txq->txb[txq->q.last_used].skb[0]; | 560 | struct sk_buff *skb = txq->txb[txq->q.read_ptr].skb[0]; |
561 | if (txq->txb[txq->q.last_used].skb[0]) { | 561 | if (txq->txb[txq->q.read_ptr].skb[0]) { |
562 | /* Can be called from interrupt context */ | 562 | /* Can be called from interrupt context */ |
563 | dev_kfree_skb_any(skb); | 563 | dev_kfree_skb_any(skb); |
564 | txq->txb[txq->q.last_used].skb[0] = NULL; | 564 | txq->txb[txq->q.read_ptr].skb[0] = NULL; |
565 | } | 565 | } |
566 | } | 566 | } |
567 | } | 567 | } |
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index 7ff8f72d482d..d7e181f9ce80 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c | |||
@@ -1749,14 +1749,14 @@ void iwl_hw_txq_ctx_free(struct iwl_priv *priv) | |||
1749 | } | 1749 | } |
1750 | 1750 | ||
1751 | /** | 1751 | /** |
1752 | * iwl_hw_txq_free_tfd - Free one TFD, those at index [txq->q.last_used] | 1752 | * iwl_hw_txq_free_tfd - Free one TFD, those at index [txq->q.read_ptr] |
1753 | * | 1753 | * |
1754 | * Does NOT advance any indexes | 1754 | * Does NOT advance any indexes |
1755 | */ | 1755 | */ |
1756 | int iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq) | 1756 | int iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq) |
1757 | { | 1757 | { |
1758 | struct iwl_tfd_frame *bd_tmp = (struct iwl_tfd_frame *)&txq->bd[0]; | 1758 | struct iwl_tfd_frame *bd_tmp = (struct iwl_tfd_frame *)&txq->bd[0]; |
1759 | struct iwl_tfd_frame *bd = &bd_tmp[txq->q.last_used]; | 1759 | struct iwl_tfd_frame *bd = &bd_tmp[txq->q.read_ptr]; |
1760 | struct pci_dev *dev = priv->pci_dev; | 1760 | struct pci_dev *dev = priv->pci_dev; |
1761 | int i; | 1761 | int i; |
1762 | int counter = 0; | 1762 | int counter = 0; |
@@ -1796,11 +1796,11 @@ int iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq) | |||
1796 | IWL_GET_BITS(bd->pa[index], tb1_len), | 1796 | IWL_GET_BITS(bd->pa[index], tb1_len), |
1797 | PCI_DMA_TODEVICE); | 1797 | PCI_DMA_TODEVICE); |
1798 | 1798 | ||
1799 | if (txq->txb[txq->q.last_used].skb[i]) { | 1799 | if (txq->txb[txq->q.read_ptr].skb[i]) { |
1800 | struct sk_buff *skb = txq->txb[txq->q.last_used].skb[i]; | 1800 | struct sk_buff *skb = txq->txb[txq->q.read_ptr].skb[i]; |
1801 | 1801 | ||
1802 | dev_kfree_skb(skb); | 1802 | dev_kfree_skb(skb); |
1803 | txq->txb[txq->q.last_used].skb[i] = NULL; | 1803 | txq->txb[txq->q.read_ptr].skb[i] = NULL; |
1804 | } | 1804 | } |
1805 | } | 1805 | } |
1806 | return 0; | 1806 | return 0; |
@@ -2776,11 +2776,11 @@ int iwl4965_tx_queue_update_wr_ptr(struct iwl_priv *priv, | |||
2776 | len = byte_cnt + IWL_TX_CRC_SIZE + IWL_TX_DELIMITER_SIZE; | 2776 | len = byte_cnt + IWL_TX_CRC_SIZE + IWL_TX_DELIMITER_SIZE; |
2777 | 2777 | ||
2778 | IWL_SET_BITS16(shared_data->queues_byte_cnt_tbls[txq_id]. | 2778 | IWL_SET_BITS16(shared_data->queues_byte_cnt_tbls[txq_id]. |
2779 | tfd_offset[txq->q.first_empty], byte_cnt, len); | 2779 | tfd_offset[txq->q.write_ptr], byte_cnt, len); |
2780 | 2780 | ||
2781 | if (txq->q.first_empty < IWL4965_MAX_WIN_SIZE) | 2781 | if (txq->q.write_ptr < IWL4965_MAX_WIN_SIZE) |
2782 | IWL_SET_BITS16(shared_data->queues_byte_cnt_tbls[txq_id]. | 2782 | IWL_SET_BITS16(shared_data->queues_byte_cnt_tbls[txq_id]. |
2783 | tfd_offset[IWL4965_QUEUE_SIZE + txq->q.first_empty], | 2783 | tfd_offset[IWL4965_QUEUE_SIZE + txq->q.write_ptr], |
2784 | byte_cnt, len); | 2784 | byte_cnt, len); |
2785 | 2785 | ||
2786 | return 0; | 2786 | return 0; |
@@ -4134,7 +4134,7 @@ static void iwl4965_rx_reply_compressed_ba(struct iwl_priv *priv, | |||
4134 | */ | 4134 | */ |
4135 | iwl4965_tx_status_reply_compressed_ba(priv, agg, ba_resp); | 4135 | iwl4965_tx_status_reply_compressed_ba(priv, agg, ba_resp); |
4136 | /* releases all the TFDs until the SSN */ | 4136 | /* releases all the TFDs until the SSN */ |
4137 | if (txq->q.last_used != (ba_resp_scd_ssn & 0xff)) | 4137 | if (txq->q.read_ptr != (ba_resp_scd_ssn & 0xff)) |
4138 | iwl_tx_queue_reclaim(priv, ba_resp_scd_flow, index); | 4138 | iwl_tx_queue_reclaim(priv, ba_resp_scd_flow, index); |
4139 | 4139 | ||
4140 | } | 4140 | } |
@@ -4205,8 +4205,8 @@ static int iwl4965_tx_queue_agg_enable(struct iwl_priv *priv, int txq_id, | |||
4205 | 4205 | ||
4206 | iwl_set_bits_restricted_reg(priv, SCD_QUEUECHAIN_SEL, (1<<txq_id)); | 4206 | iwl_set_bits_restricted_reg(priv, SCD_QUEUECHAIN_SEL, (1<<txq_id)); |
4207 | 4207 | ||
4208 | priv->txq[txq_id].q.last_used = (ssn_idx & 0xff); | 4208 | priv->txq[txq_id].q.read_ptr = (ssn_idx & 0xff); |
4209 | priv->txq[txq_id].q.first_empty = (ssn_idx & 0xff); | 4209 | priv->txq[txq_id].q.write_ptr = (ssn_idx & 0xff); |
4210 | 4210 | ||
4211 | /* supposes that ssn_idx is valid (!= 0xFFF) */ | 4211 | /* supposes that ssn_idx is valid (!= 0xFFF) */ |
4212 | iwl4965_set_wr_ptrs(priv, txq_id, ssn_idx); | 4212 | iwl4965_set_wr_ptrs(priv, txq_id, ssn_idx); |
@@ -4257,8 +4257,8 @@ static int iwl4965_tx_queue_agg_disable(struct iwl_priv *priv, u16 txq_id, | |||
4257 | 4257 | ||
4258 | iwl_clear_bits_restricted_reg(priv, SCD_QUEUECHAIN_SEL, (1 << txq_id)); | 4258 | iwl_clear_bits_restricted_reg(priv, SCD_QUEUECHAIN_SEL, (1 << txq_id)); |
4259 | 4259 | ||
4260 | priv->txq[txq_id].q.last_used = (ssn_idx & 0xff); | 4260 | priv->txq[txq_id].q.read_ptr = (ssn_idx & 0xff); |
4261 | priv->txq[txq_id].q.first_empty = (ssn_idx & 0xff); | 4261 | priv->txq[txq_id].q.write_ptr = (ssn_idx & 0xff); |
4262 | /* supposes that ssn_idx is valid (!= 0xFFF) */ | 4262 | /* supposes that ssn_idx is valid (!= 0xFFF) */ |
4263 | iwl4965_set_wr_ptrs(priv, txq_id, ssn_idx); | 4263 | iwl4965_set_wr_ptrs(priv, txq_id, ssn_idx); |
4264 | 4264 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 4fd9eac6516c..f6022649a6b7 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 | ||
210 | static int iwl_queue_space(const struct iwl_queue *q) | 210 | static 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 | ||
238 | static inline int x2_queue_used(const struct iwl_queue *q, int i) | 238 | static 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 | ||
245 | static inline u8 get_cmd_index(struct iwl_queue *q, u32 index, int is_huge) | 245 | static 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 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index eb2d7a555bbc..e0feca8acddb 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c | |||
@@ -208,9 +208,9 @@ static void iwl_print_hex_dump(int level, void *p, u32 len) | |||
208 | 208 | ||
209 | static int iwl_queue_space(const struct iwl_queue *q) | 209 | static int iwl_queue_space(const struct iwl_queue *q) |
210 | { | 210 | { |
211 | int s = q->last_used - q->first_empty; | 211 | int s = q->read_ptr - q->write_ptr; |
212 | 212 | ||
213 | if (q->last_used > q->first_empty) | 213 | if (q->read_ptr > q->write_ptr) |
214 | s -= q->n_bd; | 214 | s -= q->n_bd; |
215 | 215 | ||
216 | if (s <= 0) | 216 | if (s <= 0) |
@@ -236,9 +236,9 @@ static inline int iwl_queue_dec_wrap(int index, int n_bd) | |||
236 | 236 | ||
237 | static inline int x2_queue_used(const struct iwl_queue *q, int i) | 237 | static inline int x2_queue_used(const struct iwl_queue *q, int i) |
238 | { | 238 | { |
239 | return q->first_empty > q->last_used ? | 239 | return q->write_ptr > q->read_ptr ? |
240 | (i >= q->last_used && i < q->first_empty) : | 240 | (i >= q->read_ptr && i < q->write_ptr) : |
241 | !(i < q->last_used && i >= q->first_empty); | 241 | !(i < q->read_ptr && i >= q->write_ptr); |
242 | } | 242 | } |
243 | 243 | ||
244 | static inline u8 get_cmd_index(struct iwl_queue *q, u32 index, int is_huge) | 244 | static inline u8 get_cmd_index(struct iwl_queue *q, u32 index, int is_huge) |
@@ -272,7 +272,7 @@ static int iwl_queue_init(struct iwl_priv *priv, struct iwl_queue *q, | |||
272 | if (q->high_mark < 2) | 272 | if (q->high_mark < 2) |
273 | q->high_mark = 2; | 273 | q->high_mark = 2; |
274 | 274 | ||
275 | q->first_empty = q->last_used = 0; | 275 | q->write_ptr = q->read_ptr = 0; |
276 | 276 | ||
277 | return 0; | 277 | return 0; |
278 | } | 278 | } |
@@ -368,8 +368,8 @@ void iwl_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq) | |||
368 | return; | 368 | return; |
369 | 369 | ||
370 | /* first, empty all BD's */ | 370 | /* first, empty all BD's */ |
371 | for (; q->first_empty != q->last_used; | 371 | for (; q->write_ptr != q->read_ptr; |
372 | q->last_used = iwl_queue_inc_wrap(q->last_used, q->n_bd)) | 372 | q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) |
373 | iwl_hw_txq_free_tfd(priv, txq); | 373 | iwl_hw_txq_free_tfd(priv, txq); |
374 | 374 | ||
375 | len = sizeof(struct iwl_cmd) * q->n_window; | 375 | len = sizeof(struct iwl_cmd) * q->n_window; |
@@ -652,12 +652,12 @@ static int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) | |||
652 | 652 | ||
653 | spin_lock_irqsave(&priv->hcmd_lock, flags); | 653 | spin_lock_irqsave(&priv->hcmd_lock, flags); |
654 | 654 | ||
655 | tfd = &txq->bd[q->first_empty]; | 655 | tfd = &txq->bd[q->write_ptr]; |
656 | memset(tfd, 0, sizeof(*tfd)); | 656 | memset(tfd, 0, sizeof(*tfd)); |
657 | 657 | ||
658 | control_flags = (u32 *) tfd; | 658 | control_flags = (u32 *) tfd; |
659 | 659 | ||
660 | idx = get_cmd_index(q, q->first_empty, cmd->meta.flags & CMD_SIZE_HUGE); | 660 | idx = get_cmd_index(q, q->write_ptr, cmd->meta.flags & CMD_SIZE_HUGE); |
661 | out_cmd = &txq->cmd[idx]; | 661 | out_cmd = &txq->cmd[idx]; |
662 | 662 | ||
663 | out_cmd->hdr.cmd = cmd->id; | 663 | out_cmd->hdr.cmd = cmd->id; |
@@ -669,7 +669,7 @@ static int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) | |||
669 | 669 | ||
670 | out_cmd->hdr.flags = 0; | 670 | out_cmd->hdr.flags = 0; |
671 | out_cmd->hdr.sequence = cpu_to_le16(QUEUE_TO_SEQ(IWL_CMD_QUEUE_NUM) | | 671 | out_cmd->hdr.sequence = cpu_to_le16(QUEUE_TO_SEQ(IWL_CMD_QUEUE_NUM) | |
672 | INDEX_TO_SEQ(q->first_empty)); | 672 | INDEX_TO_SEQ(q->write_ptr)); |
673 | if (out_cmd->meta.flags & CMD_SIZE_HUGE) | 673 | if (out_cmd->meta.flags & CMD_SIZE_HUGE) |
674 | out_cmd->hdr.sequence |= cpu_to_le16(SEQ_HUGE_FRAME); | 674 | out_cmd->hdr.sequence |= cpu_to_le16(SEQ_HUGE_FRAME); |
675 | 675 | ||
@@ -681,11 +681,11 @@ static int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) | |||
681 | "%d bytes at %d[%d]:%d\n", | 681 | "%d bytes at %d[%d]:%d\n", |
682 | get_cmd_string(out_cmd->hdr.cmd), | 682 | get_cmd_string(out_cmd->hdr.cmd), |
683 | out_cmd->hdr.cmd, le16_to_cpu(out_cmd->hdr.sequence), | 683 | out_cmd->hdr.cmd, le16_to_cpu(out_cmd->hdr.sequence), |
684 | fix_size, q->first_empty, idx, IWL_CMD_QUEUE_NUM); | 684 | fix_size, q->write_ptr, idx, IWL_CMD_QUEUE_NUM); |
685 | 685 | ||
686 | txq->need_update = 1; | 686 | txq->need_update = 1; |
687 | ret = iwl4965_tx_queue_update_wr_ptr(priv, txq, 0); | 687 | ret = iwl4965_tx_queue_update_wr_ptr(priv, txq, 0); |
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 | iwl_tx_queue_update_write_ptr(priv, txq); | 689 | 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); |
@@ -2889,21 +2889,21 @@ static int iwl_tx_skb(struct iwl_priv *priv, | |||
2889 | 2889 | ||
2890 | spin_lock_irqsave(&priv->lock, flags); | 2890 | spin_lock_irqsave(&priv->lock, flags); |
2891 | 2891 | ||
2892 | tfd = &txq->bd[q->first_empty]; | 2892 | tfd = &txq->bd[q->write_ptr]; |
2893 | memset(tfd, 0, sizeof(*tfd)); | 2893 | memset(tfd, 0, sizeof(*tfd)); |
2894 | control_flags = (u32 *) tfd; | 2894 | control_flags = (u32 *) tfd; |
2895 | idx = get_cmd_index(q, q->first_empty, 0); | 2895 | idx = get_cmd_index(q, q->write_ptr, 0); |
2896 | 2896 | ||
2897 | memset(&(txq->txb[q->first_empty]), 0, sizeof(struct iwl_tx_info)); | 2897 | memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl_tx_info)); |
2898 | txq->txb[q->first_empty].skb[0] = skb; | 2898 | txq->txb[q->write_ptr].skb[0] = skb; |
2899 | memcpy(&(txq->txb[q->first_empty].status.control), | 2899 | memcpy(&(txq->txb[q->write_ptr].status.control), |
2900 | ctl, sizeof(struct ieee80211_tx_control)); | 2900 | ctl, sizeof(struct ieee80211_tx_control)); |
2901 | out_cmd = &txq->cmd[idx]; | 2901 | out_cmd = &txq->cmd[idx]; |
2902 | memset(&out_cmd->hdr, 0, sizeof(out_cmd->hdr)); | 2902 | memset(&out_cmd->hdr, 0, sizeof(out_cmd->hdr)); |
2903 | memset(&out_cmd->cmd.tx, 0, sizeof(out_cmd->cmd.tx)); | 2903 | memset(&out_cmd->cmd.tx, 0, sizeof(out_cmd->cmd.tx)); |
2904 | out_cmd->hdr.cmd = REPLY_TX; | 2904 | out_cmd->hdr.cmd = REPLY_TX; |
2905 | out_cmd->hdr.sequence = cpu_to_le16((u16)(QUEUE_TO_SEQ(txq_id) | | 2905 | out_cmd->hdr.sequence = cpu_to_le16((u16)(QUEUE_TO_SEQ(txq_id) | |
2906 | INDEX_TO_SEQ(q->first_empty))); | 2906 | INDEX_TO_SEQ(q->write_ptr))); |
2907 | /* copy frags header */ | 2907 | /* copy frags header */ |
2908 | memcpy(out_cmd->cmd.tx.hdr, hdr, hdr_len); | 2908 | memcpy(out_cmd->cmd.tx.hdr, hdr, hdr_len); |
2909 | 2909 | ||
@@ -2969,7 +2969,7 @@ static int iwl_tx_skb(struct iwl_priv *priv, | |||
2969 | 2969 | ||
2970 | iwl4965_tx_queue_update_wr_ptr(priv, txq, len); | 2970 | iwl4965_tx_queue_update_wr_ptr(priv, txq, len); |
2971 | 2971 | ||
2972 | q->first_empty = iwl_queue_inc_wrap(q->first_empty, q->n_bd); | 2972 | q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd); |
2973 | rc = iwl_tx_queue_update_write_ptr(priv, txq); | 2973 | rc = iwl_tx_queue_update_write_ptr(priv, txq); |
2974 | spin_unlock_irqrestore(&priv->lock, flags); | 2974 | spin_unlock_irqrestore(&priv->lock, flags); |
2975 | 2975 | ||
@@ -3463,20 +3463,20 @@ int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index) | |||
3463 | if ((index >= q->n_bd) || (x2_queue_used(q, index) == 0)) { | 3463 | if ((index >= q->n_bd) || (x2_queue_used(q, index) == 0)) { |
3464 | IWL_ERROR("Read index for DMA queue txq id (%d), index %d, " | 3464 | IWL_ERROR("Read index for DMA queue txq id (%d), index %d, " |
3465 | "is out of range [0-%d] %d %d.\n", txq_id, | 3465 | "is out of range [0-%d] %d %d.\n", txq_id, |
3466 | index, q->n_bd, q->first_empty, q->last_used); | 3466 | index, q->n_bd, q->write_ptr, q->read_ptr); |
3467 | return 0; | 3467 | return 0; |
3468 | } | 3468 | } |
3469 | 3469 | ||
3470 | for (index = iwl_queue_inc_wrap(index, q->n_bd); | 3470 | for (index = iwl_queue_inc_wrap(index, q->n_bd); |
3471 | q->last_used != index; | 3471 | q->read_ptr != index; |
3472 | q->last_used = iwl_queue_inc_wrap(q->last_used, q->n_bd)) { | 3472 | q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) { |
3473 | if (txq_id != IWL_CMD_QUEUE_NUM) { | 3473 | if (txq_id != IWL_CMD_QUEUE_NUM) { |
3474 | iwl_txstatus_to_ieee(priv, | 3474 | iwl_txstatus_to_ieee(priv, |
3475 | &(txq->txb[txq->q.last_used])); | 3475 | &(txq->txb[txq->q.read_ptr])); |
3476 | iwl_hw_txq_free_tfd(priv, txq); | 3476 | iwl_hw_txq_free_tfd(priv, txq); |
3477 | } else if (nfreed > 1) { | 3477 | } else if (nfreed > 1) { |
3478 | IWL_ERROR("HCMD skipped: index (%d) %d %d\n", index, | 3478 | IWL_ERROR("HCMD skipped: index (%d) %d %d\n", index, |
3479 | q->first_empty, q->last_used); | 3479 | q->write_ptr, q->read_ptr); |
3480 | queue_work(priv->workqueue, &priv->restart); | 3480 | queue_work(priv->workqueue, &priv->restart); |
3481 | } | 3481 | } |
3482 | nfreed++; | 3482 | nfreed++; |
@@ -3564,7 +3564,7 @@ static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv, | |||
3564 | IWL_DEBUG_TX_REPLY("FrameCnt = %d, StartIdx=%d \n", | 3564 | IWL_DEBUG_TX_REPLY("FrameCnt = %d, StartIdx=%d \n", |
3565 | agg->frame_count, agg->start_idx); | 3565 | agg->frame_count, agg->start_idx); |
3566 | 3566 | ||
3567 | tx_status = &(priv->txq[txq_id].txb[txq->q.last_used].status); | 3567 | tx_status = &(priv->txq[txq_id].txb[txq->q.read_ptr].status); |
3568 | tx_status->retry_count = tx_resp->failure_frame; | 3568 | tx_status->retry_count = tx_resp->failure_frame; |
3569 | tx_status->queue_number = status & 0xff; | 3569 | tx_status->queue_number = status & 0xff; |
3570 | tx_status->queue_length = tx_resp->bt_kill_count; | 3570 | tx_status->queue_length = tx_resp->bt_kill_count; |
@@ -3669,8 +3669,8 @@ static void iwl_rx_reply_tx(struct iwl_priv *priv, | |||
3669 | if ((index >= txq->q.n_bd) || (x2_queue_used(&txq->q, index) == 0)) { | 3669 | if ((index >= txq->q.n_bd) || (x2_queue_used(&txq->q, index) == 0)) { |
3670 | IWL_ERROR("Read index for DMA queue txq_id (%d) index %d " | 3670 | IWL_ERROR("Read index for DMA queue txq_id (%d) index %d " |
3671 | "is out of range [0-%d] %d %d\n", txq_id, | 3671 | "is out of range [0-%d] %d %d\n", txq_id, |
3672 | index, txq->q.n_bd, txq->q.first_empty, | 3672 | index, txq->q.n_bd, txq->q.write_ptr, |
3673 | txq->q.last_used); | 3673 | txq->q.read_ptr); |
3674 | return; | 3674 | return; |
3675 | } | 3675 | } |
3676 | 3676 | ||
@@ -3705,7 +3705,7 @@ static void iwl_rx_reply_tx(struct iwl_priv *priv, | |||
3705 | /* TODO: send BAR */ | 3705 | /* TODO: send BAR */ |
3706 | } | 3706 | } |
3707 | 3707 | ||
3708 | if ((txq->q.last_used != (scd_ssn & 0xff))) { | 3708 | if ((txq->q.read_ptr != (scd_ssn & 0xff))) { |
3709 | index = iwl_queue_dec_wrap(scd_ssn & 0xff, txq->q.n_bd); | 3709 | index = iwl_queue_dec_wrap(scd_ssn & 0xff, txq->q.n_bd); |
3710 | IWL_DEBUG_TX_REPLY("Retry scheduler reclaim scd_ssn " | 3710 | IWL_DEBUG_TX_REPLY("Retry scheduler reclaim scd_ssn " |
3711 | "%d index %d\n", scd_ssn , index); | 3711 | "%d index %d\n", scd_ssn , index); |
@@ -3714,7 +3714,7 @@ static void iwl_rx_reply_tx(struct iwl_priv *priv, | |||
3714 | } else { | 3714 | } else { |
3715 | #endif /* CONFIG_IWLWIFI_HT_AGG */ | 3715 | #endif /* CONFIG_IWLWIFI_HT_AGG */ |
3716 | #endif /* CONFIG_IWLWIFI_HT */ | 3716 | #endif /* CONFIG_IWLWIFI_HT */ |
3717 | tx_status = &(txq->txb[txq->q.last_used].status); | 3717 | tx_status = &(txq->txb[txq->q.read_ptr].status); |
3718 | 3718 | ||
3719 | tx_status->retry_count = tx_resp->failure_frame; | 3719 | tx_status->retry_count = tx_resp->failure_frame; |
3720 | tx_status->queue_number = status; | 3720 | tx_status->queue_number = status; |
@@ -4692,14 +4692,14 @@ int iwl_tx_queue_update_write_ptr(struct iwl_priv *priv, | |||
4692 | if (rc) | 4692 | if (rc) |
4693 | return rc; | 4693 | return rc; |
4694 | iwl_write_restricted(priv, HBUS_TARG_WRPTR, | 4694 | iwl_write_restricted(priv, HBUS_TARG_WRPTR, |
4695 | txq->q.first_empty | (txq_id << 8)); | 4695 | txq->q.write_ptr | (txq_id << 8)); |
4696 | iwl_release_restricted_access(priv); | 4696 | iwl_release_restricted_access(priv); |
4697 | 4697 | ||
4698 | /* else not in power-save mode, uCode will never sleep when we're | 4698 | /* else not in power-save mode, uCode will never sleep when we're |
4699 | * trying to tx (during RFKILL, we're not trying to tx). */ | 4699 | * trying to tx (during RFKILL, we're not trying to tx). */ |
4700 | } else | 4700 | } else |
4701 | iwl_write32(priv, HBUS_TARG_WRPTR, | 4701 | iwl_write32(priv, HBUS_TARG_WRPTR, |
4702 | txq->q.first_empty | (txq_id << 8)); | 4702 | txq->q.write_ptr | (txq_id << 8)); |
4703 | 4703 | ||
4704 | txq->need_update = 0; | 4704 | txq->need_update = 0; |
4705 | 4705 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwlwifi.h b/drivers/net/wireless/iwlwifi/iwlwifi.h index 8e52fef94916..bcff696937f1 100644 --- a/drivers/net/wireless/iwlwifi/iwlwifi.h +++ b/drivers/net/wireless/iwlwifi/iwlwifi.h | |||
@@ -144,8 +144,8 @@ struct iwl_rt_tx_hdr { | |||
144 | */ | 144 | */ |
145 | struct iwl_queue { | 145 | struct iwl_queue { |
146 | int n_bd; /* number of BDs in this queue */ | 146 | int n_bd; /* number of BDs in this queue */ |
147 | int first_empty; /* 1-st empty entry (index) host_w*/ | 147 | int write_ptr; /* 1-st empty entry (index) host_w*/ |
148 | int last_used; /* last used entry (index) host_r*/ | 148 | int read_ptr; /* last used entry (index) host_r*/ |
149 | dma_addr_t dma_addr; /* physical addr for BD's */ | 149 | dma_addr_t dma_addr; /* physical addr for BD's */ |
150 | int n_window; /* safe queue window */ | 150 | int n_window; /* safe queue window */ |
151 | u32 id; | 151 | u32 id; |