diff options
author | Emmanuel Grumbach <emmanuel.grumbach@intel.com> | 2011-08-26 02:11:29 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-08-29 15:33:00 -0400 |
commit | 5f178cd2ebe8ac196b245428c574f1def1964b14 (patch) | |
tree | fcf8fb7326c374304e4cfbc376b828f863f94b4f /drivers/net/wireless/iwlwifi/iwl-trans.c | |
parent | c91bd12489f50809af94c46d7c4c4d98b70c6f47 (diff) |
iwlagn: move wait_for_tx_queue_empty to transport layer
This one is really transport related.
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-trans.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-trans.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.c b/drivers/net/wireless/iwlwifi/iwl-trans.c index 9b0ecd4b1e1c..7b868c7b523a 100644 --- a/drivers/net/wireless/iwlwifi/iwl-trans.c +++ b/drivers/net/wireless/iwlwifi/iwl-trans.c | |||
@@ -1446,6 +1446,35 @@ static struct iwl_trans *iwl_trans_pcie_alloc(struct iwl_shared *shrd) | |||
1446 | return iwl_trans; | 1446 | return iwl_trans; |
1447 | } | 1447 | } |
1448 | 1448 | ||
1449 | #define IWL_FLUSH_WAIT_MS 2000 | ||
1450 | |||
1451 | static int iwl_trans_pcie_wait_tx_queue_empty(struct iwl_trans *trans) | ||
1452 | { | ||
1453 | struct iwl_tx_queue *txq; | ||
1454 | struct iwl_queue *q; | ||
1455 | int cnt; | ||
1456 | unsigned long now = jiffies; | ||
1457 | int ret = 0; | ||
1458 | |||
1459 | /* waiting for all the tx frames complete might take a while */ | ||
1460 | for (cnt = 0; cnt < hw_params(trans).max_txq_num; cnt++) { | ||
1461 | if (cnt == trans->shrd->cmd_queue) | ||
1462 | continue; | ||
1463 | txq = &priv(trans)->txq[cnt]; | ||
1464 | q = &txq->q; | ||
1465 | while (q->read_ptr != q->write_ptr && !time_after(jiffies, | ||
1466 | now + msecs_to_jiffies(IWL_FLUSH_WAIT_MS))) | ||
1467 | msleep(1); | ||
1468 | |||
1469 | if (q->read_ptr != q->write_ptr) { | ||
1470 | IWL_ERR(trans, "fail to flush all tx fifo queues\n"); | ||
1471 | ret = -ETIMEDOUT; | ||
1472 | break; | ||
1473 | } | ||
1474 | } | ||
1475 | return ret; | ||
1476 | } | ||
1477 | |||
1449 | #ifdef CONFIG_IWLWIFI_DEBUGFS | 1478 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
1450 | /* create and remove of files */ | 1479 | /* create and remove of files */ |
1451 | #define DEBUGFS_ADD_FILE(name, parent, mode) do { \ | 1480 | #define DEBUGFS_ADD_FILE(name, parent, mode) do { \ |
@@ -2024,6 +2053,9 @@ const struct iwl_trans_ops trans_ops_pcie = { | |||
2024 | .free = iwl_trans_pcie_free, | 2053 | .free = iwl_trans_pcie_free, |
2025 | 2054 | ||
2026 | .dbgfs_register = iwl_trans_pcie_dbgfs_register, | 2055 | .dbgfs_register = iwl_trans_pcie_dbgfs_register, |
2056 | |||
2057 | .wait_tx_queue_empty = iwl_trans_pcie_wait_tx_queue_empty, | ||
2058 | |||
2027 | .suspend = iwl_trans_pcie_suspend, | 2059 | .suspend = iwl_trans_pcie_suspend, |
2028 | .resume = iwl_trans_pcie_resume, | 2060 | .resume = iwl_trans_pcie_resume, |
2029 | }; | 2061 | }; |