From: Luca Coelho <luca@coelho.fi>
To: linux-wireless@vger.kernel.org
Cc: Liad Kaufman <liad.kaufman@intel.com>,
Luca Coelho <luciano.coelho@intel.com>
Subject: [PATCH 06/16] iwlwifi: mvm: re-assign old queues after hw restart in dqa mode
Date: Tue, 30 Aug 2016 14:38:52 +0300 [thread overview]
Message-ID: <1472557142-14782-6-git-send-email-luca@coelho.fi> (raw)
In-Reply-To: <1472557142-14782-1-git-send-email-luca@coelho.fi>
From: Liad Kaufman <liad.kaufman@intel.com>
When working in DQA mode, if a queue is shared and a HW restart
occurs, there might be a possible race condition between
stations on the queues, and an existing queue might be left
with no queues.
To solve this, make sure in DQA mode to re-assign the same
queues as before the HW restart.
Signed-off-by: Liad Kaufman <liad.kaufman@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 72 +++++++++++++++++++++++++++-
1 file changed, 70 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
index 730ba78..1ddcbea 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
@@ -759,8 +759,9 @@ static int iwl_mvm_sta_alloc_queue(struct iwl_mvm *mvm,
spin_unlock_bh(&mvm->queue_info_lock);
/* Disable the queue */
- iwl_mvm_invalidate_sta_queue(mvm, queue, disable_agg_tids,
- true);
+ if (disable_agg_tids)
+ iwl_mvm_invalidate_sta_queue(mvm, queue,
+ disable_agg_tids, false);
iwl_trans_txq_disable(mvm->trans, queue, false);
ret = iwl_mvm_send_cmd_pdu(mvm, SCD_QUEUE_CFG, 0, sizeof(cmd),
&cmd);
@@ -776,6 +777,10 @@ static int iwl_mvm_sta_alloc_queue(struct iwl_mvm *mvm,
return ret;
}
+
+ /* If TXQ is allocated to another STA, update removal in FW */
+ if (cmd.sta_id != mvmsta->sta_id)
+ iwl_mvm_invalidate_sta_queue(mvm, queue, 0, true);
}
IWL_DEBUG_TX_QUEUES(mvm,
@@ -1072,6 +1077,61 @@ static int iwl_mvm_reserve_sta_stream(struct iwl_mvm *mvm,
return 0;
}
+/*
+ * In DQA mode, after a HW restart the queues should be allocated as before, in
+ * order to avoid race conditions when there are shared queues. This function
+ * does the re-mapping and queue allocation.
+ *
+ * Note that re-enabling aggregations isn't done in this function.
+ */
+static void iwl_mvm_realloc_queues_after_restart(struct iwl_mvm *mvm,
+ struct iwl_mvm_sta *mvm_sta)
+{
+ unsigned int wdg_timeout =
+ iwl_mvm_get_wd_timeout(mvm, mvm_sta->vif, false, false);
+ int i;
+ struct iwl_trans_txq_scd_cfg cfg = {
+ .sta_id = mvm_sta->sta_id,
+ .frame_limit = IWL_FRAME_LIMIT,
+ };
+
+ /* Make sure reserved queue is still marked as such (or allocated) */
+ mvm->queue_info[mvm_sta->reserved_queue].status =
+ IWL_MVM_QUEUE_RESERVED;
+
+ for (i = 0; i <= IWL_MAX_TID_COUNT; i++) {
+ struct iwl_mvm_tid_data *tid_data = &mvm_sta->tid_data[i];
+ int txq_id = tid_data->txq_id;
+ int ac;
+ u8 mac_queue;
+
+ if (txq_id == IEEE80211_INVAL_HW_QUEUE)
+ continue;
+
+ skb_queue_head_init(&tid_data->deferred_tx_frames);
+
+ ac = tid_to_mac80211_ac[i];
+ mac_queue = mvm_sta->vif->hw_queue[ac];
+
+ cfg.tid = i;
+ cfg.fifo = iwl_mvm_ac_to_tx_fifo[ac];
+ cfg.aggregate = (txq_id >= IWL_MVM_DQA_MIN_DATA_QUEUE ||
+ txq_id == IWL_MVM_DQA_BSS_CLIENT_QUEUE);
+
+ IWL_DEBUG_TX_QUEUES(mvm,
+ "Re-mapping sta %d tid %d to queue %d\n",
+ mvm_sta->sta_id, i, txq_id);
+
+ iwl_mvm_enable_txq(mvm, txq_id, mac_queue,
+ IEEE80211_SEQ_TO_SN(tid_data->seq_number),
+ &cfg, wdg_timeout);
+
+ mvm->queue_info[txq_id].status = IWL_MVM_QUEUE_READY;
+ }
+
+ atomic_set(&mvm->pending_frames[mvm_sta->sta_id], 0);
+}
+
int iwl_mvm_add_sta(struct iwl_mvm *mvm,
struct ieee80211_vif *vif,
struct ieee80211_sta *sta)
@@ -1094,6 +1154,13 @@ int iwl_mvm_add_sta(struct iwl_mvm *mvm,
spin_lock_init(&mvm_sta->lock);
+ /* In DQA mode, if this is a HW restart, re-alloc existing queues */
+ if (iwl_mvm_is_dqa_supported(mvm) &&
+ test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) {
+ iwl_mvm_realloc_queues_after_restart(mvm, mvm_sta);
+ goto update_fw;
+ }
+
mvm_sta->sta_id = sta_id;
mvm_sta->mac_id_n_color = FW_CMD_ID_AND_COLOR(mvmvif->id,
mvmvif->color);
@@ -1157,6 +1224,7 @@ int iwl_mvm_add_sta(struct iwl_mvm *mvm,
goto err;
}
+update_fw:
ret = iwl_mvm_sta_send_to_fw(mvm, sta, false, 0);
if (ret)
goto err;
--
2.8.1
next prev parent reply other threads:[~2016-08-30 11:39 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-30 11:36 pull-request: iwlwifi-next 2016-08-30-2 Luca Coelho
2016-08-30 11:38 ` [PATCH 01/16] iwlwifi: mvm: allow same PN for de-aggregated AMSDU Luca Coelho
2016-08-30 11:38 ` [PATCH 02/16] iwlwifi: mvm: support GMAC protocol Luca Coelho
2016-08-30 11:38 ` [PATCH 03/16] iwlwifi: mvm: support new paging command format Luca Coelho
2016-08-30 11:38 ` [PATCH 04/16] iwlwifi: mvm: re-aggregate shared queue after unsharing Luca Coelho
2016-08-30 11:38 ` [PATCH 05/16] iwlwifi: mvm: keep track of tid associated with each queue Luca Coelho
2016-08-30 11:38 ` Luca Coelho [this message]
2016-08-30 11:38 ` [PATCH 07/16] iwlwifi: mvm: use defines for SCD_CONFIG_CMD enablement Luca Coelho
2016-08-30 11:38 ` [PATCH 08/16] iwlwifi: mvm: support txq tid owner change Luca Coelho
2016-08-30 11:38 ` [PATCH 09/16] iwlwifi: rename and reorder 9000 series configuration structs Luca Coelho
2016-08-30 11:38 ` [PATCH 10/16] iwlwifi: add a new series 9460 with new PCI ID Luca Coelho
2016-08-30 11:38 ` [PATCH 11/16] iwlwifi: add new 9460 series PCI IDs Luca Coelho
2016-08-30 11:38 ` [PATCH 12/16] iwlwifi: add the new 9270 series Luca Coelho
2016-08-30 11:38 ` [PATCH 13/16] iwlwifi: add the new 9170 series Luca Coelho
2016-08-30 11:39 ` [PATCH 14/16] iwlwifi: pcie: refrain from SCD accesses Luca Coelho
2016-08-30 11:39 ` [PATCH 15/16] iwlwifi: pcie: fix ucode load flow for a000 devices Luca Coelho
2016-08-30 11:39 ` [PATCH 16/16] iwlwifi: pcie: remove dead code Luca Coelho
2016-09-01 14:28 ` pull-request: iwlwifi-next 2016-08-30-2 Kalle Valo
-- strict thread matches above, loose matches on Subject: below --
2016-08-29 21:23 pull-request: iwlwifi-next 2016-08-30 Luca Coelho
2016-08-29 21:26 ` [PATCH 01/16] iwlwifi: mvm: allow same PN for de-aggregated AMSDU Luca Coelho
2016-08-29 21:26 ` [PATCH 06/16] iwlwifi: mvm: re-assign old queues after hw restart in dqa mode Luca Coelho
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=1472557142-14782-6-git-send-email-luca@coelho.fi \
--to=luca@coelho.fi \
--cc=liad.kaufman@intel.com \
--cc=linux-wireless@vger.kernel.org \
--cc=luciano.coelho@intel.com \
/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