aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c36
1 files changed, 17 insertions, 19 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c
index ea6a0bc8ca20..32314a60e2ac 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c
@@ -536,7 +536,6 @@ int iwl_trans_pcie_tx_agg_alloc(struct iwl_trans *trans,
536 struct iwl_tid_data *tid_data; 536 struct iwl_tid_data *tid_data;
537 unsigned long flags; 537 unsigned long flags;
538 int txq_id; 538 int txq_id;
539 struct iwl_priv *priv = priv(trans);
540 539
541 txq_id = iwlagn_txq_ctx_activate_free(trans); 540 txq_id = iwlagn_txq_ctx_activate_free(trans);
542 if (txq_id == -1) { 541 if (txq_id == -1) {
@@ -560,7 +559,7 @@ int iwl_trans_pcie_tx_agg_alloc(struct iwl_trans *trans,
560 "queue\n", tid_data->tfds_in_queue); 559 "queue\n", tid_data->tfds_in_queue);
561 tid_data->agg.state = IWL_EMPTYING_HW_QUEUE_ADDBA; 560 tid_data->agg.state = IWL_EMPTYING_HW_QUEUE_ADDBA;
562 } 561 }
563 spin_unlock_irqrestore(&priv->shrd->sta_lock, flags); 562 spin_unlock_irqrestore(&trans->shrd->sta_lock, flags);
564 563
565 return 0; 564 return 0;
566} 565}
@@ -856,16 +855,16 @@ static int iwl_enqueue_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
856 * need to be reclaimed. As result, some free space forms. If there is 855 * need to be reclaimed. As result, some free space forms. If there is
857 * enough free space (> low mark), wake the stack that feeds us. 856 * enough free space (> low mark), wake the stack that feeds us.
858 */ 857 */
859static void iwl_hcmd_queue_reclaim(struct iwl_priv *priv, int txq_id, int idx) 858static void iwl_hcmd_queue_reclaim(struct iwl_trans *trans, int txq_id,
859 int idx)
860{ 860{
861 struct iwl_trans_pcie *trans_pcie = 861 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
862 IWL_TRANS_GET_PCIE_TRANS(trans(priv));
863 struct iwl_tx_queue *txq = &trans_pcie->txq[txq_id]; 862 struct iwl_tx_queue *txq = &trans_pcie->txq[txq_id];
864 struct iwl_queue *q = &txq->q; 863 struct iwl_queue *q = &txq->q;
865 int nfreed = 0; 864 int nfreed = 0;
866 865
867 if ((idx >= q->n_bd) || (iwl_queue_used(q, idx) == 0)) { 866 if ((idx >= q->n_bd) || (iwl_queue_used(q, idx) == 0)) {
868 IWL_ERR(priv, "%s: Read index for DMA queue txq id (%d), " 867 IWL_ERR(trans, "%s: Read index for DMA queue txq id (%d), "
869 "index %d is out of range [0-%d] %d %d.\n", __func__, 868 "index %d is out of range [0-%d] %d %d.\n", __func__,
870 txq_id, idx, q->n_bd, q->write_ptr, q->read_ptr); 869 txq_id, idx, q->n_bd, q->write_ptr, q->read_ptr);
871 return; 870 return;
@@ -875,9 +874,9 @@ static void iwl_hcmd_queue_reclaim(struct iwl_priv *priv, int txq_id, int idx)
875 q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) { 874 q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) {
876 875
877 if (nfreed++ > 0) { 876 if (nfreed++ > 0) {
878 IWL_ERR(priv, "HCMD skipped: index (%d) %d %d\n", idx, 877 IWL_ERR(trans, "HCMD skipped: index (%d) %d %d\n", idx,
879 q->write_ptr, q->read_ptr); 878 q->write_ptr, q->read_ptr);
880 iwlagn_fw_error(priv, false); 879 iwlagn_fw_error(priv(trans), false);
881 } 880 }
882 881
883 } 882 }
@@ -891,7 +890,7 @@ static void iwl_hcmd_queue_reclaim(struct iwl_priv *priv, int txq_id, int idx)
891 * will be executed. The attached skb (if present) will only be freed 890 * will be executed. The attached skb (if present) will only be freed
892 * if the callback returns 1 891 * if the callback returns 1
893 */ 892 */
894void iwl_tx_cmd_complete(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) 893void iwl_tx_cmd_complete(struct iwl_trans *trans, struct iwl_rx_mem_buffer *rxb)
895{ 894{
896 struct iwl_rx_packet *pkt = rxb_addr(rxb); 895 struct iwl_rx_packet *pkt = rxb_addr(rxb);
897 u16 sequence = le16_to_cpu(pkt->hdr.sequence); 896 u16 sequence = le16_to_cpu(pkt->hdr.sequence);
@@ -900,7 +899,6 @@ void iwl_tx_cmd_complete(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
900 int cmd_index; 899 int cmd_index;
901 struct iwl_device_cmd *cmd; 900 struct iwl_device_cmd *cmd;
902 struct iwl_cmd_meta *meta; 901 struct iwl_cmd_meta *meta;
903 struct iwl_trans *trans = trans(priv);
904 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans); 902 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
905 struct iwl_tx_queue *txq = &trans_pcie->txq[trans->shrd->cmd_queue]; 903 struct iwl_tx_queue *txq = &trans_pcie->txq[trans->shrd->cmd_queue];
906 unsigned long flags; 904 unsigned long flags;
@@ -913,7 +911,7 @@ void iwl_tx_cmd_complete(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
913 txq_id, trans->shrd->cmd_queue, sequence, 911 txq_id, trans->shrd->cmd_queue, sequence,
914 trans_pcie->txq[trans->shrd->cmd_queue].q.read_ptr, 912 trans_pcie->txq[trans->shrd->cmd_queue].q.read_ptr,
915 trans_pcie->txq[trans->shrd->cmd_queue].q.write_ptr)) { 913 trans_pcie->txq[trans->shrd->cmd_queue].q.write_ptr)) {
916 iwl_print_hex_error(priv, pkt, 32); 914 iwl_print_hex_error(trans, pkt, 32);
917 return; 915 return;
918 } 916 }
919 917
@@ -929,17 +927,17 @@ void iwl_tx_cmd_complete(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
929 meta->source->reply_page = (unsigned long)rxb_addr(rxb); 927 meta->source->reply_page = (unsigned long)rxb_addr(rxb);
930 rxb->page = NULL; 928 rxb->page = NULL;
931 } else if (meta->callback) 929 } else if (meta->callback)
932 meta->callback(priv, cmd, pkt); 930 meta->callback(trans->shrd, cmd, pkt);
933 931
934 spin_lock_irqsave(&trans->hcmd_lock, flags); 932 spin_lock_irqsave(&trans->hcmd_lock, flags);
935 933
936 iwl_hcmd_queue_reclaim(priv, txq_id, index); 934 iwl_hcmd_queue_reclaim(trans, txq_id, index);
937 935
938 if (!(meta->flags & CMD_ASYNC)) { 936 if (!(meta->flags & CMD_ASYNC)) {
939 clear_bit(STATUS_HCMD_ACTIVE, &trans->shrd->status); 937 clear_bit(STATUS_HCMD_ACTIVE, &trans->shrd->status);
940 IWL_DEBUG_INFO(trans, "Clearing HCMD_ACTIVE for command %s\n", 938 IWL_DEBUG_INFO(trans, "Clearing HCMD_ACTIVE for command %s\n",
941 get_cmd_string(cmd->hdr.cmd)); 939 get_cmd_string(cmd->hdr.cmd));
942 wake_up_interruptible(&priv->wait_command_queue); 940 wake_up_interruptible(&trans->shrd->wait_command_queue);
943 } 941 }
944 942
945 meta->flags = 0; 943 meta->flags = 0;
@@ -1031,12 +1029,12 @@ const char *get_cmd_string(u8 cmd)
1031 1029
1032#define HOST_COMPLETE_TIMEOUT (2 * HZ) 1030#define HOST_COMPLETE_TIMEOUT (2 * HZ)
1033 1031
1034static void iwl_generic_cmd_callback(struct iwl_priv *priv, 1032static void iwl_generic_cmd_callback(struct iwl_shared *shrd,
1035 struct iwl_device_cmd *cmd, 1033 struct iwl_device_cmd *cmd,
1036 struct iwl_rx_packet *pkt) 1034 struct iwl_rx_packet *pkt)
1037{ 1035{
1038 if (pkt->hdr.flags & IWL_CMD_FAILED_MSK) { 1036 if (pkt->hdr.flags & IWL_CMD_FAILED_MSK) {
1039 IWL_ERR(priv, "Bad return from %s (0x%08X)\n", 1037 IWL_ERR(shrd->trans, "Bad return from %s (0x%08X)\n",
1040 get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags); 1038 get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags);
1041 return; 1039 return;
1042 } 1040 }
@@ -1045,11 +1043,11 @@ static void iwl_generic_cmd_callback(struct iwl_priv *priv,
1045 switch (cmd->hdr.cmd) { 1043 switch (cmd->hdr.cmd) {
1046 case REPLY_TX_LINK_QUALITY_CMD: 1044 case REPLY_TX_LINK_QUALITY_CMD:
1047 case SENSITIVITY_CMD: 1045 case SENSITIVITY_CMD:
1048 IWL_DEBUG_HC_DUMP(priv, "back from %s (0x%08X)\n", 1046 IWL_DEBUG_HC_DUMP(shrd->trans, "back from %s (0x%08X)\n",
1049 get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags); 1047 get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags);
1050 break; 1048 break;
1051 default: 1049 default:
1052 IWL_DEBUG_HC(priv, "back from %s (0x%08X)\n", 1050 IWL_DEBUG_HC(shrd->trans, "back from %s (0x%08X)\n",
1053 get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags); 1051 get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags);
1054 } 1052 }
1055#endif 1053#endif
@@ -1107,7 +1105,7 @@ static int iwl_send_cmd_sync(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
1107 return ret; 1105 return ret;
1108 } 1106 }
1109 1107
1110 ret = wait_event_interruptible_timeout(priv(trans)->wait_command_queue, 1108 ret = wait_event_interruptible_timeout(trans->shrd->wait_command_queue,
1111 !test_bit(STATUS_HCMD_ACTIVE, &trans->shrd->status), 1109 !test_bit(STATUS_HCMD_ACTIVE, &trans->shrd->status),
1112 HOST_COMPLETE_TIMEOUT); 1110 HOST_COMPLETE_TIMEOUT);
1113 if (!ret) { 1111 if (!ret) {