linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Emmanuel Grumbach <egrumbach@gmail.com>
To: linux-wireless@vger.kernel.org
Cc: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Subject: [PATCH 18/47] iwlwifi: pcie: WARN upon traffic while flushing TX queues
Date: Sun, 13 Apr 2014 22:19:33 +0300	[thread overview]
Message-ID: <1397416802-32403-18-git-send-email-egrumbach@gmail.com> (raw)
In-Reply-To: <534AE330.2020805@gmail.com>

From: Emmanuel Grumbach <emmanuel.grumbach@intel.com>

This must not happen - otherwise we might keep flushing
forever.

Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
---
 drivers/net/wireless/iwlwifi/pcie/trans.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c
index 0f20e73..4845d50 100644
--- a/drivers/net/wireless/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/iwlwifi/pcie/trans.c
@@ -1270,6 +1270,8 @@ static int iwl_trans_pcie_wait_txq_empty(struct iwl_trans *trans, u32 txq_bm)
 
 	/* waiting for all the tx frames complete might take a while */
 	for (cnt = 0; cnt < trans->cfg->base_params->num_of_queues; cnt++) {
+		u8 wr_ptr;
+
 		if (cnt == trans_pcie->cmd_queue)
 			continue;
 		if (!test_bit(cnt, trans_pcie->queue_used))
@@ -1278,9 +1280,19 @@ static int iwl_trans_pcie_wait_txq_empty(struct iwl_trans *trans, u32 txq_bm)
 			continue;
 		txq = &trans_pcie->txq[cnt];
 		q = &txq->q;
-		while (q->read_ptr != q->write_ptr && !time_after(jiffies,
-		       now + msecs_to_jiffies(IWL_FLUSH_WAIT_MS)))
+		wr_ptr = ACCESS_ONCE(q->write_ptr);
+
+		while (q->read_ptr != ACCESS_ONCE(q->write_ptr) &&
+		       !time_after(jiffies,
+				   now + msecs_to_jiffies(IWL_FLUSH_WAIT_MS))) {
+			u8 write_ptr = ACCESS_ONCE(q->write_ptr);
+
+			if (WARN_ONCE(wr_ptr != write_ptr,
+				      "WR pointer moved while flushing %d -> %d\n",
+				      wr_ptr, write_ptr))
+				return -ETIMEDOUT;
 			msleep(1);
+		}
 
 		if (q->read_ptr != q->write_ptr) {
 			IWL_ERR(trans,
-- 
1.8.3.2


  parent reply	other threads:[~2014-04-13 19:20 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-13 19:19 pull request: iwlwifi 2014-04-13 Emmanuel Grumbach
2014-04-13 19:19 ` [PATCH 01/47] iwlwifi: mvm: Handle power management constraints for additional use-cases Emmanuel Grumbach
2014-04-13 19:19 ` [PATCH 02/47] iwlwifi: mvm: fix the number of channels in family 8000 Emmanuel Grumbach
2014-04-13 19:19 ` [PATCH 03/47] iwlwifi: pcie: don't leave the new NICs awake for commands Emmanuel Grumbach
2014-04-13 19:19 ` [PATCH 04/47] iwlwifi: mvm: add lq_cmd/tx_resp reduced_tpc field Emmanuel Grumbach
2014-04-13 19:19 ` [PATCH 05/47] iwlwifi: mvm: add ATPC implementation Emmanuel Grumbach
2014-04-13 19:19 ` [PATCH 06/47] iwlwifi: mvm: add debugfs file for fixed reduced tx power Emmanuel Grumbach
2014-04-13 19:19 ` [PATCH 07/47] iwlwifi: pcie: implement GRO without NAPI Emmanuel Grumbach
2014-04-13 19:19 ` [PATCH 08/47] iwlwifi: pcie: clarify RX queue need_update handling and locking Emmanuel Grumbach
2014-04-13 19:19 ` [PATCH 09/47] iwlwifi: pcie: use bool for TX queue where appropriate Emmanuel Grumbach
2014-04-13 19:19 ` [PATCH 10/47] iwlwifi: pcie: fix TX queue locking Emmanuel Grumbach
2014-04-13 19:19 ` [PATCH 11/47] iwlwifi: pcie: clarify TX queue need_update handling Emmanuel Grumbach
2014-04-13 19:19 ` [PATCH 12/47] iwlwifi: pcie: unify iwl_rx_replenish and iwl_rx_replenish_now Emmanuel Grumbach
2014-04-13 19:19 ` [PATCH 13/47] iwlwifi: move CPU1_CPU2_SEPARATOR_SECTION to iwl-fw.h Emmanuel Grumbach
2014-04-13 19:19 ` [PATCH 14/47] iwlwifi: mvm: remove redundant empty line Emmanuel Grumbach
2014-04-13 19:19 ` [PATCH 15/47] iwlwifi: mvm: propagate the beamforming status from firmware Emmanuel Grumbach
2014-04-13 19:19 ` [PATCH 16/47] iwlwifi: mvm: don't set AP STA to EINVAL Emmanuel Grumbach
2014-04-13 19:19 ` [PATCH 17/47] iwlwifi: allow to wait for a subset of the queues Emmanuel Grumbach
2014-04-13 19:19 ` Emmanuel Grumbach [this message]
2014-04-13 19:19 ` [PATCH 19/47] iwlwifi: mvm: dump Rx FIFO when the firmware asserts Emmanuel Grumbach
2014-04-13 19:19 ` [PATCH 20/47] iwlwifi: mvm: Fix warning message when exit thermal throttling Emmanuel Grumbach
2014-04-13 19:19 ` [PATCH 21/47] iwlwifi: mvm: Fix tx-backoff when NIC " Emmanuel Grumbach
2014-04-13 19:19 ` [PATCH 22/47] iwlwifi: mvm: don't enable bcast filtering on P2P client Emmanuel Grumbach
2014-04-13 19:19 ` [PATCH 23/47] iwlwifi: mvm: Use RCU_INIT_POINTER(x, NULL) Emmanuel Grumbach
2014-04-13 19:19 ` [PATCH 24/47] iwlwifi: mvm: add per rate tx stats Emmanuel Grumbach
2014-04-13 19:19 ` [PATCH 25/47] iwlwifi: mvm: replace BUG_ON by WARN_ON in scan.c Emmanuel Grumbach
2014-04-13 19:19 ` [PATCH 26/47] iwlwifi: mvm: deprecate -7 firmware Emmanuel Grumbach
2014-04-13 19:19 ` [PATCH 27/47] iwlwifi: mvm: Change scan fragmentation condition Emmanuel Grumbach
2014-04-13 19:19 ` [PATCH 28/47] iwlwifi: mvm: Fix scan parameters units Emmanuel Grumbach
2014-04-13 19:19 ` [PATCH 29/47] iwlwifi: remove IWL_UCODE_TLV_FLAGS_NEWBT_COEX TLV flag Emmanuel Grumbach
2014-04-13 19:19 ` [PATCH 30/47] iwlwifi: remove IWL_UCODE_TLV_FLAGS_PM_CMD_SUPPORT flag Emmanuel Grumbach
2014-04-13 19:19 ` [PATCH 31/47] iwlwifi: remove IWL_UCODE_TLV_FLAGS_RX_ENERGY_API flag Emmanuel Grumbach
2014-04-13 19:19 ` [PATCH 32/47] iwlwifi: remove IWL_UCODE_TLV_FLAGS_TIME_EVENT_API_V2 flag Emmanuel Grumbach
2014-04-13 19:19 ` [PATCH 33/47] iwlwifi: remove IWL_UCODE_TLV_FLAGS_BF_UPDATED flag Emmanuel Grumbach
2014-04-13 19:19 ` [PATCH 34/47] iwlwifi: remove IWL_UCODE_TLV_FLAGS_D3_CONTINUITY_API flag Emmanuel Grumbach
2014-04-13 19:19 ` [PATCH 35/47] iwlwifi: remove IWL_UCODE_TLV_FLAGS_SCHED_SCAN flag Emmanuel Grumbach
2014-04-13 19:19 ` [PATCH 36/47] iwlwifi: remove IWL_UCODE_TLV_FLAGS_UAPSD_SUPPORT flag Emmanuel Grumbach
2014-04-13 19:19 ` [PATCH 37/47] iwlwifi: remove IWL_UCODE_TLV_FLAGS_STA_KEY_CMD flag Emmanuel Grumbach
2014-04-13 19:19 ` [PATCH 38/47] iwlwifi: remove IWL_UCODE_TLV_FLAGS_DEVICE_PS_CMD flag Emmanuel Grumbach
2014-04-13 19:19 ` [PATCH 39/47] iwlwifi: mvm: BT Coex - don't use comma operator Emmanuel Grumbach
2014-04-13 19:19 ` [PATCH 40/47] iwlwifi: mvm: BT Coex - minor API change Emmanuel Grumbach
2014-04-13 19:19 ` [PATCH 41/47] iwlwifi: mvm: BT Coex - send priority tables from iwl_send_bt_init_conf Emmanuel Grumbach
2014-04-13 19:19 ` [PATCH 42/47] iwlwifi: mvm: Add support for Energy based scan (EBS) Emmanuel Grumbach
2014-04-13 19:19 ` [PATCH 43/47] iwlwifi: 7000: bump firmware API version to 9 Emmanuel Grumbach
2014-04-13 19:19 ` [PATCH 44/47] iwlwifi: mvm: don't use d3 fw if d0i3 is used Emmanuel Grumbach
2014-04-13 19:20 ` [PATCH 45/47] iwlwifi: mvm: replace leading spaces by tabs Emmanuel Grumbach
2014-04-13 19:20 ` [PATCH 46/47] iwlwifi: mvm: Re-factor enabling uAPSD logic Emmanuel Grumbach
2014-04-13 19:20 ` [PATCH 47/47] iwlwifi: don't disable SCD chain extension on newer devices Emmanuel Grumbach
2014-04-13 19:25 ` pull request: iwlwifi 2014-04-13 Emmanuel Grumbach
2014-04-22 20:07   ` John W. Linville

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1397416802-32403-18-git-send-email-egrumbach@gmail.com \
    --to=egrumbach@gmail.com \
    --cc=emmanuel.grumbach@intel.com \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).