aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/pcie/tx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/pcie/tx.c')
-rw-r--r--drivers/net/wireless/iwlwifi/pcie/tx.c37
1 files changed, 15 insertions, 22 deletions
diff --git a/drivers/net/wireless/iwlwifi/pcie/tx.c b/drivers/net/wireless/iwlwifi/pcie/tx.c
index a4ef5cc11100..8df24787c141 100644
--- a/drivers/net/wireless/iwlwifi/pcie/tx.c
+++ b/drivers/net/wireless/iwlwifi/pcie/tx.c
@@ -207,7 +207,7 @@ static void iwl_pcie_txq_stuck_timer(unsigned long data)
207 IWL_ERR(trans, "scratch %d = 0x%08x\n", i, 207 IWL_ERR(trans, "scratch %d = 0x%08x\n", i,
208 le32_to_cpu(txq->scratchbufs[i].scratch)); 208 le32_to_cpu(txq->scratchbufs[i].scratch));
209 209
210 iwl_nic_error(trans); 210 iwl_trans_fw_error(trans);
211} 211}
212 212
213/* 213/*
@@ -300,10 +300,8 @@ void iwl_pcie_txq_inc_wr_ptr(struct iwl_trans *trans, struct iwl_txq *txq)
300 iwl_write32(trans, HBUS_TARG_WRPTR, 300 iwl_write32(trans, HBUS_TARG_WRPTR,
301 txq->q.write_ptr | (txq_id << 8)); 301 txq->q.write_ptr | (txq_id << 8));
302 } else { 302 } else {
303 struct iwl_trans_pcie *trans_pcie =
304 IWL_TRANS_GET_PCIE_TRANS(trans);
305 /* if we're trying to save power */ 303 /* if we're trying to save power */
306 if (test_bit(STATUS_TPOWER_PMI, &trans_pcie->status)) { 304 if (test_bit(STATUS_TPOWER_PMI, &trans->status)) {
307 /* wake up nic if it's powered down ... 305 /* wake up nic if it's powered down ...
308 * uCode will wake up, and interrupt us again, so next 306 * uCode will wake up, and interrupt us again, so next
309 * time we'll skip this part. */ 307 * time we'll skip this part. */
@@ -1023,7 +1021,7 @@ static void iwl_pcie_cmdq_reclaim(struct iwl_trans *trans, int txq_id, int idx)
1023 if (nfreed++ > 0) { 1021 if (nfreed++ > 0) {
1024 IWL_ERR(trans, "HCMD skipped: index (%d) %d %d\n", 1022 IWL_ERR(trans, "HCMD skipped: index (%d) %d %d\n",
1025 idx, q->write_ptr, q->read_ptr); 1023 idx, q->write_ptr, q->read_ptr);
1026 iwl_nic_error(trans); 1024 iwl_trans_fw_error(trans);
1027 } 1025 }
1028 } 1026 }
1029 1027
@@ -1449,12 +1447,12 @@ void iwl_pcie_hcmd_complete(struct iwl_trans *trans,
1449 iwl_pcie_cmdq_reclaim(trans, txq_id, index); 1447 iwl_pcie_cmdq_reclaim(trans, txq_id, index);
1450 1448
1451 if (!(meta->flags & CMD_ASYNC)) { 1449 if (!(meta->flags & CMD_ASYNC)) {
1452 if (!test_bit(STATUS_HCMD_ACTIVE, &trans_pcie->status)) { 1450 if (!test_bit(STATUS_SYNC_HCMD_ACTIVE, &trans->status)) {
1453 IWL_WARN(trans, 1451 IWL_WARN(trans,
1454 "HCMD_ACTIVE already clear for command %s\n", 1452 "HCMD_ACTIVE already clear for command %s\n",
1455 get_cmd_string(trans_pcie, cmd->hdr.cmd)); 1453 get_cmd_string(trans_pcie, cmd->hdr.cmd));
1456 } 1454 }
1457 clear_bit(STATUS_HCMD_ACTIVE, &trans_pcie->status); 1455 clear_bit(STATUS_SYNC_HCMD_ACTIVE, &trans->status);
1458 IWL_DEBUG_INFO(trans, "Clearing HCMD_ACTIVE for command %s\n", 1456 IWL_DEBUG_INFO(trans, "Clearing HCMD_ACTIVE for command %s\n",
1459 get_cmd_string(trans_pcie, cmd->hdr.cmd)); 1457 get_cmd_string(trans_pcie, cmd->hdr.cmd));
1460 wake_up(&trans_pcie->wait_command_queue); 1458 wake_up(&trans_pcie->wait_command_queue);
@@ -1499,8 +1497,8 @@ static int iwl_pcie_send_hcmd_sync(struct iwl_trans *trans,
1499 IWL_DEBUG_INFO(trans, "Attempting to send sync command %s\n", 1497 IWL_DEBUG_INFO(trans, "Attempting to send sync command %s\n",
1500 get_cmd_string(trans_pcie, cmd->id)); 1498 get_cmd_string(trans_pcie, cmd->id));
1501 1499
1502 if (WARN(test_and_set_bit(STATUS_HCMD_ACTIVE, 1500 if (WARN(test_and_set_bit(STATUS_SYNC_HCMD_ACTIVE,
1503 &trans_pcie->status), 1501 &trans->status),
1504 "Command %s: a command is already active!\n", 1502 "Command %s: a command is already active!\n",
1505 get_cmd_string(trans_pcie, cmd->id))) 1503 get_cmd_string(trans_pcie, cmd->id)))
1506 return -EIO; 1504 return -EIO;
@@ -1511,7 +1509,7 @@ static int iwl_pcie_send_hcmd_sync(struct iwl_trans *trans,
1511 cmd_idx = iwl_pcie_enqueue_hcmd(trans, cmd); 1509 cmd_idx = iwl_pcie_enqueue_hcmd(trans, cmd);
1512 if (cmd_idx < 0) { 1510 if (cmd_idx < 0) {
1513 ret = cmd_idx; 1511 ret = cmd_idx;
1514 clear_bit(STATUS_HCMD_ACTIVE, &trans_pcie->status); 1512 clear_bit(STATUS_SYNC_HCMD_ACTIVE, &trans->status);
1515 IWL_ERR(trans, 1513 IWL_ERR(trans,
1516 "Error sending %s: enqueue_hcmd failed: %d\n", 1514 "Error sending %s: enqueue_hcmd failed: %d\n",
1517 get_cmd_string(trans_pcie, cmd->id), ret); 1515 get_cmd_string(trans_pcie, cmd->id), ret);
@@ -1523,8 +1521,8 @@ static int iwl_pcie_send_hcmd_sync(struct iwl_trans *trans,
1523 1521
1524 timeout -= COMMAND_POKE_TIMEOUT; 1522 timeout -= COMMAND_POKE_TIMEOUT;
1525 ret = wait_event_timeout(trans_pcie->wait_command_queue, 1523 ret = wait_event_timeout(trans_pcie->wait_command_queue,
1526 !test_bit(STATUS_HCMD_ACTIVE, 1524 !test_bit(STATUS_SYNC_HCMD_ACTIVE,
1527 &trans_pcie->status), 1525 &trans->status),
1528 COMMAND_POKE_TIMEOUT); 1526 COMMAND_POKE_TIMEOUT);
1529 if (ret) 1527 if (ret)
1530 break; 1528 break;
@@ -1552,17 +1550,17 @@ static int iwl_pcie_send_hcmd_sync(struct iwl_trans *trans,
1552 IWL_ERR(trans, "Current CMD queue read_ptr %d write_ptr %d\n", 1550 IWL_ERR(trans, "Current CMD queue read_ptr %d write_ptr %d\n",
1553 q->read_ptr, q->write_ptr); 1551 q->read_ptr, q->write_ptr);
1554 1552
1555 clear_bit(STATUS_HCMD_ACTIVE, &trans_pcie->status); 1553 clear_bit(STATUS_SYNC_HCMD_ACTIVE, &trans->status);
1556 IWL_DEBUG_INFO(trans, "Clearing HCMD_ACTIVE for command %s\n", 1554 IWL_DEBUG_INFO(trans, "Clearing HCMD_ACTIVE for command %s\n",
1557 get_cmd_string(trans_pcie, cmd->id)); 1555 get_cmd_string(trans_pcie, cmd->id));
1558 ret = -ETIMEDOUT; 1556 ret = -ETIMEDOUT;
1559 1557
1560 iwl_nic_error(trans); 1558 iwl_trans_fw_error(trans);
1561 1559
1562 goto cancel; 1560 goto cancel;
1563 } 1561 }
1564 1562
1565 if (test_bit(STATUS_FW_ERROR, &trans_pcie->status)) { 1563 if (test_bit(STATUS_FW_ERROR, &trans->status)) {
1566 IWL_ERR(trans, "FW error in SYNC CMD %s\n", 1564 IWL_ERR(trans, "FW error in SYNC CMD %s\n",
1567 get_cmd_string(trans_pcie, cmd->id)); 1565 get_cmd_string(trans_pcie, cmd->id));
1568 dump_stack(); 1566 dump_stack();
@@ -1571,7 +1569,7 @@ static int iwl_pcie_send_hcmd_sync(struct iwl_trans *trans,
1571 } 1569 }
1572 1570
1573 if (!(cmd->flags & CMD_SEND_IN_RFKILL) && 1571 if (!(cmd->flags & CMD_SEND_IN_RFKILL) &&
1574 test_bit(STATUS_RFKILL, &trans_pcie->status)) { 1572 test_bit(STATUS_RFKILL, &trans->status)) {
1575 IWL_DEBUG_RF_KILL(trans, "RFKILL in SYNC CMD... no rsp\n"); 1573 IWL_DEBUG_RF_KILL(trans, "RFKILL in SYNC CMD... no rsp\n");
1576 ret = -ERFKILL; 1574 ret = -ERFKILL;
1577 goto cancel; 1575 goto cancel;
@@ -1608,13 +1606,8 @@ cancel:
1608 1606
1609int iwl_trans_pcie_send_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd) 1607int iwl_trans_pcie_send_hcmd(struct iwl_trans *trans, struct iwl_host_cmd *cmd)
1610{ 1608{
1611 struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
1612
1613 if (test_bit(STATUS_FW_ERROR, &trans_pcie->status))
1614 return -EIO;
1615
1616 if (!(cmd->flags & CMD_SEND_IN_RFKILL) && 1609 if (!(cmd->flags & CMD_SEND_IN_RFKILL) &&
1617 test_bit(STATUS_RFKILL, &trans_pcie->status)) { 1610 test_bit(STATUS_RFKILL, &trans->status)) {
1618 IWL_DEBUG_RF_KILL(trans, "Dropping CMD 0x%x: RF KILL\n", 1611 IWL_DEBUG_RF_KILL(trans, "Dropping CMD 0x%x: RF KILL\n",
1619 cmd->id); 1612 cmd->id);
1620 return -ERFKILL; 1613 return -ERFKILL;