Skip to content

Commit 12a89f0

Browse files
jmberg-intelkuba-moo
authored andcommitted
wifi: iwlwifi: remove 'use_tfh' config to fix crash
This is equivalent to 'gen2', and it was always confusing to have two identical config entries. The split config patch actually had been originally developed after removing 'use_tfh" and didn't add the use_tfh in the new configs as they'd later been copied to the new files. Thus the easiest way to fix the init crash here now is to just remove use_tfh (which is erroneously unset in most of the configs now) and use 'gen2' in the code instead. There's possibly still an unwind error in iwl_txq_gen2_init() as it crashes if TXQ 0 fails to initialize, but we can deal with it later since the original failure is due to the use_tfh confusion. Tested-by: Xi Ruoyao <[email protected]> Reported-and-tested-by: Niklāvs Koļesņikovs <[email protected]> Reported-and-tested-by: Jeff Chua <[email protected]> Reported-and-tested-by: Zhang Rui <[email protected]> Link: https://bugzilla.kernel.org/show_bug.cgi?id=217622 Link: https://lore.kernel.org/all/[email protected]/ Link: https://lore.kernel.org/all/CAAJw_Zug6VCS5ZqTWaFSr9sd85k%3DtyPm9DEE%2BmV%3DAKoECZM%[email protected]/ Fixes: 19898ce ("wifi: iwlwifi: split 22000.c into multiple files") Signed-off-by: Johannes Berg <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 9373771 commit 12a89f0

File tree

9 files changed

+18
-25
lines changed

9 files changed

+18
-25
lines changed

drivers/net/wireless/intel/iwlwifi/cfg/22000.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ const struct iwl_ht_params iwl_22000_ht_params = {
8484
.mac_addr_from_csr = 0x380, \
8585
.ht_params = &iwl_22000_ht_params, \
8686
.nvm_ver = IWL_22000_NVM_VERSION, \
87-
.trans.use_tfh = true, \
8887
.trans.rf_id = true, \
8988
.trans.gen2 = true, \
9089
.nvm_type = IWL_NVM_EXT, \
@@ -122,7 +121,6 @@ const struct iwl_ht_params iwl_22000_ht_params = {
122121

123122
const struct iwl_cfg_trans_params iwl_qu_trans_cfg = {
124123
.mq_rx_supported = true,
125-
.use_tfh = true,
126124
.rf_id = true,
127125
.gen2 = true,
128126
.device_family = IWL_DEVICE_FAMILY_22000,
@@ -134,7 +132,6 @@ const struct iwl_cfg_trans_params iwl_qu_trans_cfg = {
134132

135133
const struct iwl_cfg_trans_params iwl_qu_medium_latency_trans_cfg = {
136134
.mq_rx_supported = true,
137-
.use_tfh = true,
138135
.rf_id = true,
139136
.gen2 = true,
140137
.device_family = IWL_DEVICE_FAMILY_22000,
@@ -146,7 +143,6 @@ const struct iwl_cfg_trans_params iwl_qu_medium_latency_trans_cfg = {
146143

147144
const struct iwl_cfg_trans_params iwl_qu_long_latency_trans_cfg = {
148145
.mq_rx_supported = true,
149-
.use_tfh = true,
150146
.rf_id = true,
151147
.gen2 = true,
152148
.device_family = IWL_DEVICE_FAMILY_22000,
@@ -200,7 +196,6 @@ const struct iwl_cfg_trans_params iwl_ax200_trans_cfg = {
200196
.device_family = IWL_DEVICE_FAMILY_22000,
201197
.base_params = &iwl_22000_base_params,
202198
.mq_rx_supported = true,
203-
.use_tfh = true,
204199
.rf_id = true,
205200
.gen2 = true,
206201
.bisr_workaround = 1,

drivers/net/wireless/intel/iwlwifi/iwl-config.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,6 @@ enum iwl_cfg_trans_ltr_delay {
256256
* @xtal_latency: power up latency to get the xtal stabilized
257257
* @extra_phy_cfg_flags: extra configuration flags to pass to the PHY
258258
* @rf_id: need to read rf_id to determine the firmware image
259-
* @use_tfh: use TFH
260259
* @gen2: 22000 and on transport operation
261260
* @mq_rx_supported: multi-queue rx support
262261
* @integrated: discrete or integrated
@@ -271,7 +270,6 @@ struct iwl_cfg_trans_params {
271270
u32 xtal_latency;
272271
u32 extra_phy_cfg_flags;
273272
u32 rf_id:1,
274-
use_tfh:1,
275273
gen2:1,
276274
mq_rx_supported:1,
277275
integrated:1,

drivers/net/wireless/intel/iwlwifi/iwl-fh.h

Lines changed: 2 additions & 2 deletions
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) 2005-2014, 2018-2021 Intel Corporation
3+
* Copyright (C) 2005-2014, 2018-2021, 2023 Intel Corporation
44
* Copyright (C) 2015-2017 Intel Deutschland GmbH
55
*/
66
#ifndef __iwl_fh_h__
@@ -71,7 +71,7 @@
7171
static inline unsigned int FH_MEM_CBBC_QUEUE(struct iwl_trans *trans,
7272
unsigned int chnl)
7373
{
74-
if (trans->trans_cfg->use_tfh) {
74+
if (trans->trans_cfg->gen2) {
7575
WARN_ON_ONCE(chnl >= 64);
7676
return TFH_TFDQ_CBB_TABLE + 8 * chnl;
7777
}

drivers/net/wireless/intel/iwlwifi/iwl-trans.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/*
33
* Copyright (C) 2015 Intel Mobile Communications GmbH
44
* Copyright (C) 2016-2017 Intel Deutschland GmbH
5-
* Copyright (C) 2019-2021 Intel Corporation
5+
* Copyright (C) 2019-2021, 2023 Intel Corporation
66
*/
77
#include <linux/kernel.h>
88
#include <linux/bsearch.h>
@@ -42,7 +42,7 @@ struct iwl_trans *iwl_trans_alloc(unsigned int priv_size,
4242

4343
WARN_ON(!ops->wait_txq_empty && !ops->wait_tx_queues_empty);
4444

45-
if (trans->trans_cfg->use_tfh) {
45+
if (trans->trans_cfg->gen2) {
4646
trans->txqs.tfd.addr_size = 64;
4747
trans->txqs.tfd.max_tbs = IWL_TFH_NUM_TBS;
4848
trans->txqs.tfd.size = sizeof(struct iwl_tfh_tfd);
@@ -101,7 +101,7 @@ int iwl_trans_init(struct iwl_trans *trans)
101101

102102
/* Some things must not change even if the config does */
103103
WARN_ON(trans->txqs.tfd.addr_size !=
104-
(trans->trans_cfg->use_tfh ? 64 : 36));
104+
(trans->trans_cfg->gen2 ? 64 : 36));
105105

106106
snprintf(trans->dev_cmd_pool_name, sizeof(trans->dev_cmd_pool_name),
107107
"iwl_cmd_pool:%s", dev_name(trans->dev));

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1450,7 +1450,7 @@ static inline bool iwl_mvm_has_new_station_api(const struct iwl_fw *fw)
14501450
static inline bool iwl_mvm_has_new_tx_api(struct iwl_mvm *mvm)
14511451
{
14521452
/* TODO - replace with TLV once defined */
1453-
return mvm->trans->trans_cfg->use_tfh;
1453+
return mvm->trans->trans_cfg->gen2;
14541454
}
14551455

14561456
static inline bool iwl_mvm_has_unified_ucode(struct iwl_mvm *mvm)

drivers/net/wireless/intel/iwlwifi/pcie/trans.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,7 @@ static int iwl_pcie_load_cpu_sections_8000(struct iwl_trans *trans,
819819

820820
iwl_enable_interrupts(trans);
821821

822-
if (trans->trans_cfg->use_tfh) {
822+
if (trans->trans_cfg->gen2) {
823823
if (cpu == 1)
824824
iwl_write_prph(trans, UREG_UCODE_LOAD_STATUS,
825825
0xFFFF);
@@ -3394,7 +3394,7 @@ iwl_trans_pcie_dump_data(struct iwl_trans *trans,
33943394
u8 tfdidx;
33953395
u32 caplen, cmdlen;
33963396

3397-
if (trans->trans_cfg->use_tfh)
3397+
if (trans->trans_cfg->gen2)
33983398
tfdidx = idx;
33993399
else
34003400
tfdidx = ptr;

drivers/net/wireless/intel/iwlwifi/pcie/tx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ void iwl_trans_pcie_tx_reset(struct iwl_trans *trans)
364364
for (txq_id = 0; txq_id < trans->trans_cfg->base_params->num_of_queues;
365365
txq_id++) {
366366
struct iwl_txq *txq = trans->txqs.txq[txq_id];
367-
if (trans->trans_cfg->use_tfh)
367+
if (trans->trans_cfg->gen2)
368368
iwl_write_direct64(trans,
369369
FH_MEM_CBBC_QUEUE(trans, txq_id),
370370
txq->dma_addr);

drivers/net/wireless/intel/iwlwifi/queue/tx.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -985,7 +985,7 @@ void iwl_txq_log_scd_error(struct iwl_trans *trans, struct iwl_txq *txq)
985985
bool active;
986986
u8 fifo;
987987

988-
if (trans->trans_cfg->use_tfh) {
988+
if (trans->trans_cfg->gen2) {
989989
IWL_ERR(trans, "Queue %d is stuck %d %d\n", txq_id,
990990
txq->read_ptr, txq->write_ptr);
991991
/* TODO: access new SCD registers and dump them */
@@ -1040,7 +1040,7 @@ int iwl_txq_alloc(struct iwl_trans *trans, struct iwl_txq *txq, int slots_num,
10401040
if (WARN_ON(txq->entries || txq->tfds))
10411041
return -EINVAL;
10421042

1043-
if (trans->trans_cfg->use_tfh)
1043+
if (trans->trans_cfg->gen2)
10441044
tfd_sz = trans->txqs.tfd.size * slots_num;
10451045

10461046
timer_setup(&txq->stuck_timer, iwl_txq_stuck_timer, 0);
@@ -1347,7 +1347,7 @@ static inline dma_addr_t iwl_txq_gen1_tfd_tb_get_addr(struct iwl_trans *trans,
13471347
dma_addr_t addr;
13481348
dma_addr_t hi_len;
13491349

1350-
if (trans->trans_cfg->use_tfh) {
1350+
if (trans->trans_cfg->gen2) {
13511351
struct iwl_tfh_tfd *tfh_tfd = _tfd;
13521352
struct iwl_tfh_tb *tfh_tb = &tfh_tfd->tbs[idx];
13531353

@@ -1408,7 +1408,7 @@ void iwl_txq_gen1_tfd_unmap(struct iwl_trans *trans,
14081408

14091409
meta->tbs = 0;
14101410

1411-
if (trans->trans_cfg->use_tfh) {
1411+
if (trans->trans_cfg->gen2) {
14121412
struct iwl_tfh_tfd *tfd_fh = (void *)tfd;
14131413

14141414
tfd_fh->num_tbs = 0;
@@ -1625,7 +1625,7 @@ void iwl_txq_reclaim(struct iwl_trans *trans, int txq_id, int ssn,
16251625

16261626
txq->entries[read_ptr].skb = NULL;
16271627

1628-
if (!trans->trans_cfg->use_tfh)
1628+
if (!trans->trans_cfg->gen2)
16291629
iwl_txq_gen1_inval_byte_cnt_tbl(trans, txq);
16301630

16311631
iwl_txq_free_tfd(trans, txq);

drivers/net/wireless/intel/iwlwifi/queue/tx.h

Lines changed: 4 additions & 4 deletions
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) 2020-2022 Intel Corporation
3+
* Copyright (C) 2020-2023 Intel Corporation
44
*/
55
#ifndef __iwl_trans_queue_tx_h__
66
#define __iwl_trans_queue_tx_h__
@@ -38,7 +38,7 @@ static inline void iwl_wake_queue(struct iwl_trans *trans,
3838
static inline void *iwl_txq_get_tfd(struct iwl_trans *trans,
3939
struct iwl_txq *txq, int idx)
4040
{
41-
if (trans->trans_cfg->use_tfh)
41+
if (trans->trans_cfg->gen2)
4242
idx = iwl_txq_get_cmd_index(txq, idx);
4343

4444
return (u8 *)txq->tfds + trans->txqs.tfd.size * idx;
@@ -135,7 +135,7 @@ static inline u8 iwl_txq_gen1_tfd_get_num_tbs(struct iwl_trans *trans,
135135
{
136136
struct iwl_tfd *tfd;
137137

138-
if (trans->trans_cfg->use_tfh) {
138+
if (trans->trans_cfg->gen2) {
139139
struct iwl_tfh_tfd *tfh_tfd = _tfd;
140140

141141
return le16_to_cpu(tfh_tfd->num_tbs) & 0x1f;
@@ -151,7 +151,7 @@ static inline u16 iwl_txq_gen1_tfd_tb_get_len(struct iwl_trans *trans,
151151
struct iwl_tfd *tfd;
152152
struct iwl_tfd_tb *tb;
153153

154-
if (trans->trans_cfg->use_tfh) {
154+
if (trans->trans_cfg->gen2) {
155155
struct iwl_tfh_tfd *tfh_tfd = _tfd;
156156
struct iwl_tfh_tb *tfh_tb = &tfh_tfd->tbs[idx];
157157

0 commit comments

Comments
 (0)