Skip to content

Commit 19aefa4

Browse files
lkaufman-helucacoelho
authored andcommitted
iwlwifi: mvm: support txq tid owner change
Every active TXQ is assigned to a TID given through the SCD_CONFIG_CMD, and acts as an identifier in the FW. However, there may be cases this ownership needs to be changed. For example, in the following scenario: 1. TID x is owner of a queue 2. Due to a shortage of queues, TID y and z share with x 3. TID x becomes inactive and needs to be removed from the shared queue. In this scenario, if another queue is freed and traffic on x continues, we can't allocate it a new queue as long as it is the owner of the first queue. Support moving ownership of a TXQ to a different TID (same STA) without stopping the queue. Signed-off-by: Liad Kaufman <[email protected]> Signed-off-by: Luca Coelho <[email protected]>
1 parent f7c692d commit 19aefa4

File tree

1 file changed

+51
-0
lines changed
  • drivers/net/wireless/intel/iwlwifi/mvm

1 file changed

+51
-0
lines changed

drivers/net/wireless/intel/iwlwifi/mvm/sta.c

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -850,6 +850,41 @@ static int iwl_mvm_sta_alloc_queue(struct iwl_mvm *mvm,
850850
return ret;
851851
}
852852

853+
static void iwl_mvm_change_queue_owner(struct iwl_mvm *mvm, int queue)
854+
{
855+
struct iwl_scd_txq_cfg_cmd cmd = {
856+
.scd_queue = queue,
857+
.action = SCD_CFG_UPDATE_QUEUE_TID,
858+
};
859+
s8 sta_id;
860+
int tid;
861+
unsigned long tid_bitmap;
862+
int ret;
863+
864+
lockdep_assert_held(&mvm->mutex);
865+
866+
spin_lock_bh(&mvm->queue_info_lock);
867+
sta_id = mvm->queue_info[queue].ra_sta_id;
868+
tid_bitmap = mvm->queue_info[queue].tid_bitmap;
869+
spin_unlock_bh(&mvm->queue_info_lock);
870+
871+
if (WARN(!tid_bitmap, "TXQ %d has no tids assigned to it\n", queue))
872+
return;
873+
874+
/* Find any TID for queue */
875+
tid = find_first_bit(&tid_bitmap, IWL_MAX_TID_COUNT + 1);
876+
cmd.tid = tid;
877+
cmd.tx_fifo = iwl_mvm_ac_to_tx_fifo[tid_to_mac80211_ac[tid]];
878+
879+
ret = iwl_mvm_send_cmd_pdu(mvm, SCD_QUEUE_CFG, 0, sizeof(cmd), &cmd);
880+
if (ret)
881+
IWL_ERR(mvm, "Failed to update owner of TXQ %d (ret=%d)\n",
882+
queue, ret);
883+
else
884+
IWL_DEBUG_TX_QUEUES(mvm, "Changed TXQ %d ownership to tid %d\n",
885+
queue, tid);
886+
}
887+
853888
static void iwl_mvm_unshare_queue(struct iwl_mvm *mvm, int queue)
854889
{
855890
struct ieee80211_sta *sta;
@@ -1005,14 +1040,30 @@ void iwl_mvm_add_new_dqa_stream_wk(struct work_struct *wk)
10051040
/* Reconfigure queues requiring reconfiguation */
10061041
for (queue = 0; queue < IWL_MAX_HW_QUEUES; queue++) {
10071042
bool reconfig;
1043+
bool change_owner;
10081044

10091045
spin_lock_bh(&mvm->queue_info_lock);
10101046
reconfig = (mvm->queue_info[queue].status ==
10111047
IWL_MVM_QUEUE_RECONFIGURING);
1048+
1049+
/*
1050+
* We need to take into account a situation in which a TXQ was
1051+
* allocated to TID x, and then turned shared by adding TIDs y
1052+
* and z. If TID x becomes inactive and is removed from the TXQ,
1053+
* ownership must be given to one of the remaining TIDs.
1054+
* This is mainly because if TID x continues - a new queue can't
1055+
* be allocated for it as long as it is an owner of another TXQ.
1056+
*/
1057+
change_owner = !(mvm->queue_info[queue].tid_bitmap &
1058+
BIT(mvm->queue_info[queue].txq_tid)) &&
1059+
(mvm->queue_info[queue].status ==
1060+
IWL_MVM_QUEUE_SHARED);
10121061
spin_unlock_bh(&mvm->queue_info_lock);
10131062

10141063
if (reconfig)
10151064
iwl_mvm_unshare_queue(mvm, queue);
1065+
else if (change_owner)
1066+
iwl_mvm_change_queue_owner(mvm, queue);
10161067
}
10171068

10181069
/* Go over all stations with deferred traffic */

0 commit comments

Comments
 (0)