Skip to content

Commit d586137

Browse files
jmberg-intelMiriam-Rachel
authored andcommitted
wifi: iwlwifi: trans: collect device information
Add a new device information 'info' substruct to the transport that's const and can only be set by a special helper, and move some information there. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com> Link: https://patch.msgid.link/20250503224232.cd80cb55403c.Ic18524b66d655fad734bf97192a54d9cfa9fdf1f@changeid
1 parent d43c01d commit d586137

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+264
-228
lines changed

drivers/net/wireless/intel/iwlwifi/dvm/eeprom.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ static int iwl_nvm_is_otp(struct iwl_trans *trans)
746746
u32 otpgp;
747747

748748
/* OTP only valid for CP/PP and after */
749-
switch (trans->hw_rev & CSR_HW_REV_TYPE_MSK) {
749+
switch (trans->info.hw_rev & CSR_HW_REV_TYPE_MSK) {
750750
case CSR_HW_REV_TYPE_NONE:
751751
IWL_ERR(trans, "Unknown hardware type\n");
752752
return -EIO;

drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv,
9696
ieee80211_hw_set(hw, SUPPORT_FAST_XMIT);
9797
ieee80211_hw_set(hw, WANT_MONITOR_VIF);
9898

99-
if (priv->trans->max_skb_frags)
99+
if (priv->trans->info.max_skb_frags)
100100
hw->netdev_features = NETIF_F_HIGHDMA | NETIF_F_SG;
101101

102102
hw->offchannel_tx_hw_queue = IWL_AUX_QUEUE;
@@ -188,7 +188,7 @@ int iwlagn_mac_setup_register(struct iwl_priv *priv,
188188
priv->hw->wiphy->bands[NL80211_BAND_5GHZ] =
189189
&priv->nvm_data->bands[NL80211_BAND_5GHZ];
190190

191-
hw->wiphy->hw_version = priv->trans->hw_id;
191+
hw->wiphy->hw_version = priv->trans->info.hw_id;
192192

193193
iwl_leds_init(priv);
194194

drivers/net/wireless/intel/iwlwifi/dvm/main.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,7 +1248,8 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
12481248
************************/
12491249
hw = iwl_alloc_all();
12501250
if (!hw) {
1251-
pr_err("%s: Cannot allocate network device\n", trans->name);
1251+
pr_err("%s: Cannot allocate network device\n",
1252+
trans->info.name);
12521253
err = -ENOMEM;
12531254
goto out;
12541255
}
@@ -1378,7 +1379,7 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,
13781379
* 2. Read REV register
13791380
***********************/
13801381
IWL_INFO(priv, "Detected %s, REV=0x%X\n",
1381-
priv->trans->name, priv->trans->hw_rev);
1382+
priv->trans->info.name, priv->trans->info.hw_rev);
13821383

13831384
err = iwl_trans_start_hw(priv->trans);
13841385
if (err)
@@ -1992,7 +1993,7 @@ static void iwl_nic_config(struct iwl_op_mode *op_mode)
19921993
/* SKU Control */
19931994
iwl_trans_set_bits_mask(priv->trans, CSR_HW_IF_CONFIG_REG,
19941995
CSR_HW_IF_CONFIG_REG_MSK_MAC_STEP_DASH,
1995-
CSR_HW_REV_STEP_DASH(priv->trans->hw_rev));
1996+
CSR_HW_REV_STEP_DASH(priv->trans->info.hw_rev));
19961997

19971998
/* write radio config values to register */
19981999
if (priv->nvm_data->radio_cfg_type <= EEPROM_RF_CONFIG_TYPE_MAX) {

drivers/net/wireless/intel/iwlwifi/fw/dbg.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -904,13 +904,14 @@ iwl_fw_error_dump_file(struct iwl_fw_runtime *fwrt,
904904
dump_data->len = cpu_to_le32(sizeof(*dump_info));
905905
dump_info = (void *)dump_data->data;
906906
dump_info->hw_type =
907-
cpu_to_le32(CSR_HW_REV_TYPE(fwrt->trans->hw_rev));
907+
cpu_to_le32(CSR_HW_REV_TYPE(fwrt->trans->info.hw_rev));
908908
dump_info->hw_step =
909-
cpu_to_le32(fwrt->trans->hw_rev_step);
909+
cpu_to_le32(fwrt->trans->info.hw_rev_step);
910910
memcpy(dump_info->fw_human_readable, fwrt->fw->human_readable,
911911
sizeof(dump_info->fw_human_readable));
912-
strscpy_pad(dump_info->dev_human_readable, fwrt->trans->name,
913-
sizeof(dump_info->dev_human_readable));
912+
strscpy_pad(dump_info->dev_human_readable,
913+
fwrt->trans->info.name,
914+
sizeof(dump_info->dev_human_readable));
914915
strscpy_pad(dump_info->bus_human_readable, fwrt->dev->bus->name,
915916
sizeof(dump_info->bus_human_readable));
916917
dump_info->num_of_lmacs = fwrt->smem_cfg.num_lmacs;
@@ -2403,13 +2404,13 @@ static u32 iwl_dump_ini_info(struct iwl_fw_runtime *fwrt,
24032404
dump->ver_type = cpu_to_le32(fwrt->dump.fw_ver.type);
24042405
dump->ver_subtype = cpu_to_le32(fwrt->dump.fw_ver.subtype);
24052406

2406-
dump->hw_step = cpu_to_le32(fwrt->trans->hw_rev_step);
2407+
dump->hw_step = cpu_to_le32(fwrt->trans->info.hw_rev_step);
24072408

24082409
/*
24092410
* Several HWs all have type == 0x42, so we'll override this value
24102411
* according to the detected HW
24112412
*/
2412-
hw_type = CSR_HW_REV_TYPE(fwrt->trans->hw_rev);
2413+
hw_type = CSR_HW_REV_TYPE(fwrt->trans->info.hw_rev);
24132414
if (hw_type == IWL_AX210_HW_TYPE) {
24142415
u32 prph_val = iwl_read_umac_prph(fwrt->trans, WFPM_OTP_CFG1_ADDR);
24152416
u32 is_jacket = !!(prph_val & WFPM_OTP_CFG1_IS_JACKET_BIT);
@@ -2426,10 +2427,10 @@ static u32 iwl_dump_ini_info(struct iwl_fw_runtime *fwrt,
24262427
dump->hw_type = cpu_to_le32(hw_type);
24272428

24282429
dump->rf_id_flavor =
2429-
cpu_to_le32(CSR_HW_RFID_FLAVOR(fwrt->trans->hw_rf_id));
2430-
dump->rf_id_dash = cpu_to_le32(CSR_HW_RFID_DASH(fwrt->trans->hw_rf_id));
2431-
dump->rf_id_step = cpu_to_le32(CSR_HW_RFID_STEP(fwrt->trans->hw_rf_id));
2432-
dump->rf_id_type = cpu_to_le32(CSR_HW_RFID_TYPE(fwrt->trans->hw_rf_id));
2430+
cpu_to_le32(CSR_HW_RFID_FLAVOR(fwrt->trans->info.hw_rf_id));
2431+
dump->rf_id_dash = cpu_to_le32(CSR_HW_RFID_DASH(fwrt->trans->info.hw_rf_id));
2432+
dump->rf_id_step = cpu_to_le32(CSR_HW_RFID_STEP(fwrt->trans->info.hw_rf_id));
2433+
dump->rf_id_type = cpu_to_le32(CSR_HW_RFID_TYPE(fwrt->trans->info.hw_rf_id));
24332434

24342435
dump->lmac_major = cpu_to_le32(fwrt->dump.fw_ver.lmac_major);
24352436
dump->lmac_minor = cpu_to_le32(fwrt->dump.fw_ver.lmac_minor);

drivers/net/wireless/intel/iwlwifi/fw/debugfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ static ssize_t iwl_dbgfs_fw_ver_read(struct iwl_fw_runtime *fwrt,
311311
pos += scnprintf(pos, endpos - pos, "FW: %s\n",
312312
fwrt->fw->human_readable);
313313
pos += scnprintf(pos, endpos - pos, "Device: %s\n",
314-
fwrt->trans->name);
314+
fwrt->trans->info.name);
315315
pos += scnprintf(pos, endpos - pos, "Bus: %s\n",
316316
fwrt->dev->bus->name);
317317

drivers/net/wireless/intel/iwlwifi/fw/init.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
22
/*
33
* Copyright (C) 2017 Intel Deutschland GmbH
4-
* Copyright (C) 2019-2021, 2024 Intel Corporation
4+
* Copyright (C) 2019-2021, 2024-2025 Intel Corporation
55
*/
66
#include "iwl-drv.h"
77
#include "runtime.h"
@@ -116,14 +116,14 @@ int iwl_configure_rxq(struct iwl_fw_runtime *fwrt)
116116
* The default queue is configured via context info, so if we
117117
* have a single queue, there's nothing to do here.
118118
*/
119-
if (fwrt->trans->num_rx_queues == 1)
119+
if (fwrt->trans->info.num_rxqs == 1)
120120
return 0;
121121

122122
if (fwrt->trans->trans_cfg->device_family < IWL_DEVICE_FAMILY_22000)
123123
return 0;
124124

125125
/* skip the default queue */
126-
num_queues = fwrt->trans->num_rx_queues - 1;
126+
num_queues = fwrt->trans->info.num_rxqs - 1;
127127

128128
size = struct_size(cmd, data, num_queues);
129129

drivers/net/wireless/intel/iwlwifi/fw/pnvm.c

Lines changed: 6 additions & 6 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-2024 Intel Corporation
3+
* Copyright(c) 2020-2025 Intel Corporation
44
*/
55

66
#include "iwl-drv.h"
@@ -96,8 +96,8 @@ static int iwl_pnvm_handle_section(struct iwl_trans *trans, const u8 *data,
9696
"Got IWL_UCODE_TLV_HW_TYPE mac_type 0x%0x rf_id 0x%0x\n",
9797
mac_type, rf_id);
9898

99-
if (mac_type == CSR_HW_REV_TYPE(trans->hw_rev) &&
100-
rf_id == CSR_HW_RFID_TYPE(trans->hw_rf_id))
99+
if (mac_type == CSR_HW_REV_TYPE(trans->info.hw_rev) &&
100+
rf_id == CSR_HW_RFID_TYPE(trans->info.hw_rf_id))
101101
hw_match = true;
102102
break;
103103
case IWL_UCODE_TLV_SEC_RT: {
@@ -152,8 +152,8 @@ static int iwl_pnvm_handle_section(struct iwl_trans *trans, const u8 *data,
152152
if (!hw_match) {
153153
IWL_DEBUG_FW(trans,
154154
"HW mismatch, skipping PNVM section (need mac_type 0x%x rf_id 0x%x)\n",
155-
CSR_HW_REV_TYPE(trans->hw_rev),
156-
CSR_HW_RFID_TYPE(trans->hw_rf_id));
155+
CSR_HW_REV_TYPE(trans->info.hw_rev),
156+
CSR_HW_RFID_TYPE(trans->info.hw_rf_id));
157157
return -ENOENT;
158158
}
159159

@@ -205,7 +205,7 @@ static int iwl_pnvm_parse(struct iwl_trans *trans, const u8 *data,
205205
len -= ALIGN(tlv_len, 4);
206206

207207
trans->reduced_cap_sku = false;
208-
rf_type = CSR_HW_RFID_TYPE(trans->hw_rf_id);
208+
rf_type = CSR_HW_RFID_TYPE(trans->info.hw_rf_id);
209209
if ((trans->sku_id[0] & IWL_PNVM_REDUCED_CAP_BIT) &&
210210
rf_type == IWL_CFG_RF_TYPE_FM)
211211
trans->reduced_cap_sku = true;

drivers/net/wireless/intel/iwlwifi/fw/regulatory.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,9 @@ bool iwl_sar_geo_support(struct iwl_fw_runtime *fwrt)
181181
*/
182182
return IWL_UCODE_SERIAL(fwrt->fw->ucode_ver) >= 38 ||
183183
(IWL_UCODE_SERIAL(fwrt->fw->ucode_ver) == 17 &&
184-
fwrt->trans->hw_rev != CSR_HW_REV_TYPE_3160) ||
184+
fwrt->trans->info.hw_rev != CSR_HW_REV_TYPE_3160) ||
185185
(IWL_UCODE_SERIAL(fwrt->fw->ucode_ver) == 29 &&
186-
((fwrt->trans->hw_rev & CSR_HW_REV_TYPE_MSK) ==
186+
((fwrt->trans->info.hw_rev & CSR_HW_REV_TYPE_MSK) ==
187187
CSR_HW_REV_TYPE_7265D));
188188
}
189189
IWL_EXPORT_SYMBOL(iwl_sar_geo_support);
@@ -314,7 +314,7 @@ int iwl_fill_ppag_table(struct iwl_fw_runtime *fwrt,
314314
bool send_ppag_always;
315315

316316
/* many firmware images for JF lie about this */
317-
if (CSR_HW_RFID_TYPE(fwrt->trans->hw_rf_id) ==
317+
if (CSR_HW_RFID_TYPE(fwrt->trans->info.hw_rf_id) ==
318318
CSR_HW_RFID_TYPE(CSR_HW_RF_ID_TYPE_JF))
319319
return -EOPNOTSUPP;
320320

@@ -491,7 +491,7 @@ __le32 iwl_get_lari_config_bitmap(struct iwl_fw_runtime *fwrt)
491491
u32 val;
492492
__le32 config_bitmap = 0;
493493

494-
switch (CSR_HW_RFID_TYPE(fwrt->trans->hw_rf_id)) {
494+
switch (CSR_HW_RFID_TYPE(fwrt->trans->info.hw_rf_id)) {
495495
case IWL_CFG_RF_TYPE_HR1:
496496
case IWL_CFG_RF_TYPE_HR2:
497497
case IWL_CFG_RF_TYPE_JF1:

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ static inline char iwl_drv_get_step(int step)
176176

177177
static bool iwl_drv_is_wifi7_supported(struct iwl_trans *trans)
178178
{
179-
return CSR_HW_RFID_TYPE(trans->hw_rf_id) >= IWL_CFG_RF_TYPE_FM;
179+
return CSR_HW_RFID_TYPE(trans->info.hw_rf_id) >= IWL_CFG_RF_TYPE_FM;
180180
}
181181

182182
const char *iwl_drv_get_fwname_pre(struct iwl_trans *trans, char *buf)
@@ -187,9 +187,9 @@ const char *iwl_drv_get_fwname_pre(struct iwl_trans *trans, char *buf)
187187
if (trans->cfg->fw_name_pre)
188188
return trans->cfg->fw_name_pre;
189189

190-
mac_step = iwl_drv_get_step(trans->hw_rev_step);
190+
mac_step = iwl_drv_get_step(trans->info.hw_rev_step);
191191

192-
switch (CSR_HW_REV_TYPE(trans->hw_rev)) {
192+
switch (CSR_HW_REV_TYPE(trans->info.hw_rev)) {
193193
case IWL_CFG_MAC_TYPE_PU:
194194
mac = "pu";
195195
break;
@@ -237,9 +237,9 @@ const char *iwl_drv_get_fwname_pre(struct iwl_trans *trans, char *buf)
237237
return "unknown-mac";
238238
}
239239

240-
rf_step = iwl_drv_get_step(CSR_HW_RFID_STEP(trans->hw_rf_id));
240+
rf_step = iwl_drv_get_step(CSR_HW_RFID_STEP(trans->info.hw_rf_id));
241241

242-
switch (CSR_HW_RFID_TYPE(trans->hw_rf_id)) {
242+
switch (CSR_HW_RFID_TYPE(trans->info.hw_rf_id)) {
243243
case IWL_CFG_RF_TYPE_HR1:
244244
case IWL_CFG_RF_TYPE_HR2:
245245
rf = "hr";
@@ -253,7 +253,7 @@ const char *iwl_drv_get_fwname_pre(struct iwl_trans *trans, char *buf)
253253
break;
254254
case IWL_CFG_RF_TYPE_WH:
255255
if (SILICON_Z_STEP ==
256-
CSR_HW_RFID_STEP(trans->hw_rf_id)) {
256+
CSR_HW_RFID_STEP(trans->info.hw_rf_id)) {
257257
rf = "whtc";
258258
rf_step = 'a';
259259
} else {
@@ -264,7 +264,7 @@ const char *iwl_drv_get_fwname_pre(struct iwl_trans *trans, char *buf)
264264
return "unknown-rf";
265265
}
266266

267-
cdb = CSR_HW_RFID_IS_CDB(trans->hw_rf_id) ? "4" : "";
267+
cdb = CSR_HW_RFID_IS_CDB(trans->info.hw_rf_id) ? "4" : "";
268268

269269
scnprintf(buf, FW_NAME_PRE_BUFSIZE,
270270
"iwlwifi-%s-%c0-%s%s-%c0",
@@ -284,11 +284,11 @@ static int iwl_request_firmware(struct iwl_drv *drv, bool first)
284284
const char *fw_name_pre;
285285

286286
if (drv->trans->trans_cfg->device_family == IWL_DEVICE_FAMILY_9000 &&
287-
(drv->trans->hw_rev_step != SILICON_B_STEP &&
288-
drv->trans->hw_rev_step != SILICON_C_STEP)) {
287+
(drv->trans->info.hw_rev_step != SILICON_B_STEP &&
288+
drv->trans->info.hw_rev_step != SILICON_C_STEP)) {
289289
IWL_ERR(drv,
290290
"Only HW steps B and C are currently supported (0x%0x)\n",
291-
drv->trans->hw_rev);
291+
drv->trans->info.hw_rev);
292292
return -EINVAL;
293293
}
294294

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

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) 2003-2014, 2018-2022, 2024 Intel Corporation
3+
* Copyright (C) 2003-2014, 2018-2022, 2024-2025 Intel Corporation
44
* Copyright (C) 2015-2016 Intel Deutschland GmbH
55
*/
66
#include <linux/delay.h>
@@ -260,7 +260,7 @@ struct reg {
260260
static int iwl_dump_rfh(struct iwl_trans *trans, char **buf)
261261
{
262262
int i, q;
263-
int num_q = trans->num_rx_queues;
263+
int num_q = trans->info.num_rxqs;
264264
static const u32 rfh_tbl[] = {
265265
RFH_RXF_DMA_CFG,
266266
RFH_GEN_CFG,

0 commit comments

Comments
 (0)