Skip to content

Commit 78f65fb

Browse files
benzeajmberg-intel
authored andcommitted
wifi: iwlwifi: mvm: ensure offloading TID queue exists
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]>
1 parent f78c137 commit 78f65fb

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
@@ -1279,7 +1279,9 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw,
12791279

12801280
mvm->net_detect = true;
12811281
} else {
1282-
struct iwl_wowlan_config_cmd wowlan_config_cmd = {};
1282+
struct iwl_wowlan_config_cmd wowlan_config_cmd = {
1283+
.offloading_tid = 0,
1284+
};
12831285

12841286
wowlan_config_cmd.sta_id = mvmvif->deflink.ap_sta_id;
12851287

@@ -1291,6 +1293,11 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw,
12911293
goto out_noreset;
12921294
}
12931295

1296+
ret = iwl_mvm_sta_ensure_queue(
1297+
mvm, ap_sta->txq[wowlan_config_cmd.offloading_tid]);
1298+
if (ret)
1299+
goto out_noreset;
1300+
12941301
ret = iwl_mvm_get_wowlan_config(mvm, wowlan, &wowlan_config_cmd,
12951302
vif, mvmvif, ap_sta);
12961303
if (ret)

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,6 +1502,34 @@ static int iwl_mvm_sta_alloc_queue(struct iwl_mvm *mvm,
15021502
return ret;
15031503
}
15041504

1505+
int iwl_mvm_sta_ensure_queue(struct iwl_mvm *mvm,
1506+
struct ieee80211_txq *txq)
1507+
{
1508+
struct iwl_mvm_txq *mvmtxq = iwl_mvm_txq_from_mac80211(txq);
1509+
int ret = -EINVAL;
1510+
1511+
lockdep_assert_held(&mvm->mutex);
1512+
1513+
if (likely(test_bit(IWL_MVM_TXQ_STATE_READY, &mvmtxq->state)) ||
1514+
!txq->sta) {
1515+
return 0;
1516+
}
1517+
1518+
if (!iwl_mvm_sta_alloc_queue(mvm, txq->sta, txq->ac, txq->tid)) {
1519+
set_bit(IWL_MVM_TXQ_STATE_READY, &mvmtxq->state);
1520+
ret = 0;
1521+
}
1522+
1523+
local_bh_disable();
1524+
spin_lock(&mvm->add_stream_lock);
1525+
if (!list_empty(&mvmtxq->list))
1526+
list_del_init(&mvmtxq->list);
1527+
spin_unlock(&mvm->add_stream_lock);
1528+
local_bh_enable();
1529+
1530+
return ret;
1531+
}
1532+
15051533
void iwl_mvm_add_new_dqa_stream_wk(struct work_struct *wk)
15061534
{
15071535
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-2023 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
*/
@@ -571,6 +571,7 @@ void iwl_mvm_modify_all_sta_disable_tx(struct iwl_mvm *mvm,
571571
bool disable);
572572

573573
void iwl_mvm_csa_client_absent(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
574+
int iwl_mvm_sta_ensure_queue(struct iwl_mvm *mvm, struct ieee80211_txq *txq);
574575
void iwl_mvm_add_new_dqa_stream_wk(struct work_struct *wk);
575576
int iwl_mvm_add_pasn_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
576577
struct iwl_mvm_int_sta *sta, u8 *addr, u32 cipher,

0 commit comments

Comments
 (0)