Skip to content

Commit 4903303

Browse files
benzeagregkh
authored andcommitted
wifi: iwlwifi: mvm: ensure offloading TID queue exists
commit 78f65fbf421a61894c14a1b91fe2fb4437b3fe5f upstream. The resume code path assumes that the TX queue for the offloading TID has been configured. At resume time it then tries to sync the write pointer as it may have been updated by the firmware. In the unusual event that no packets have been send on TID 0, the queue will not have been allocated and this causes a crash. Fix this by ensuring the queue exist at suspend time. Signed-off-by: Benjamin Berg <[email protected]> Signed-off-by: Miri Korenblit <[email protected]> Link: https://msgid.link/20240218194912.6632e6dc7b35.Ie6e6a7488c9c7d4529f13d48f752b5439d8ac3c4@changeid Signed-off-by: Johannes Berg <[email protected]> Signed-off-by: Jianqi Ren <[email protected]> Signed-off-by: He Zhe <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 406a037 commit 4903303

File tree

3 files changed

+38
-2
lines changed

3 files changed

+38
-2
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1286,7 +1286,9 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw,
12861286

12871287
mvm->net_detect = true;
12881288
} else {
1289-
struct iwl_wowlan_config_cmd wowlan_config_cmd = {};
1289+
struct iwl_wowlan_config_cmd wowlan_config_cmd = {
1290+
.offloading_tid = 0,
1291+
};
12901292

12911293
wowlan_config_cmd.sta_id = mvmvif->ap_sta_id;
12921294

@@ -1298,6 +1300,11 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw,
12981300
goto out_noreset;
12991301
}
13001302

1303+
ret = iwl_mvm_sta_ensure_queue(
1304+
mvm, ap_sta->txq[wowlan_config_cmd.offloading_tid]);
1305+
if (ret)
1306+
goto out_noreset;
1307+
13011308
ret = iwl_mvm_get_wowlan_config(mvm, wowlan, &wowlan_config_cmd,
13021309
vif, mvmvif, ap_sta);
13031310
if (ret)

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1419,6 +1419,34 @@ static int iwl_mvm_sta_alloc_queue(struct iwl_mvm *mvm,
14191419
return ret;
14201420
}
14211421

1422+
int iwl_mvm_sta_ensure_queue(struct iwl_mvm *mvm,
1423+
struct ieee80211_txq *txq)
1424+
{
1425+
struct iwl_mvm_txq *mvmtxq = iwl_mvm_txq_from_mac80211(txq);
1426+
int ret = -EINVAL;
1427+
1428+
lockdep_assert_held(&mvm->mutex);
1429+
1430+
if (likely(test_bit(IWL_MVM_TXQ_STATE_READY, &mvmtxq->state)) ||
1431+
!txq->sta) {
1432+
return 0;
1433+
}
1434+
1435+
if (!iwl_mvm_sta_alloc_queue(mvm, txq->sta, txq->ac, txq->tid)) {
1436+
set_bit(IWL_MVM_TXQ_STATE_READY, &mvmtxq->state);
1437+
ret = 0;
1438+
}
1439+
1440+
local_bh_disable();
1441+
spin_lock(&mvm->add_stream_lock);
1442+
if (!list_empty(&mvmtxq->list))
1443+
list_del_init(&mvmtxq->list);
1444+
spin_unlock(&mvm->add_stream_lock);
1445+
local_bh_enable();
1446+
1447+
return ret;
1448+
}
1449+
14221450
void iwl_mvm_add_new_dqa_stream_wk(struct work_struct *wk)
14231451
{
14241452
struct iwl_mvm *mvm = container_of(wk, struct iwl_mvm,

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
22
/*
3-
* Copyright (C) 2012-2014, 2018-2021 Intel Corporation
3+
* Copyright (C) 2012-2014, 2018-2024 Intel Corporation
44
* Copyright (C) 2013-2014 Intel Mobile Communications GmbH
55
* Copyright (C) 2015-2016 Intel Deutschland GmbH
66
*/
@@ -544,6 +544,7 @@ void iwl_mvm_modify_all_sta_disable_tx(struct iwl_mvm *mvm,
544544
struct iwl_mvm_vif *mvmvif,
545545
bool disable);
546546
void iwl_mvm_csa_client_absent(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
547+
int iwl_mvm_sta_ensure_queue(struct iwl_mvm *mvm, struct ieee80211_txq *txq);
547548
void iwl_mvm_add_new_dqa_stream_wk(struct work_struct *wk);
548549
int iwl_mvm_add_pasn_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
549550
struct iwl_mvm_int_sta *sta, u8 *addr, u32 cipher,

0 commit comments

Comments
 (0)