Skip to content

Commit c4cdf75

Browse files
committed
ath10k: move fw_features to struct ath10k_fw_file
Preparation for testmode.c to use ath10k_core_fetch_board_data_api_n(). Signed-off-by: Kalle Valo <[email protected]>
1 parent 4531735 commit c4cdf75

File tree

8 files changed

+39
-45
lines changed

8 files changed

+39
-45
lines changed

drivers/net/wireless/ath/ath10k/core.c

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ void ath10k_core_get_fw_features_str(struct ath10k *ar,
261261
int i;
262262

263263
for (i = 0; i < ATH10K_FW_FEATURE_COUNT; i++) {
264-
if (test_bit(i, ar->fw_features)) {
264+
if (test_bit(i, ar->normal_mode_fw.fw_file.fw_features)) {
265265
if (len > 0)
266266
len += scnprintf(buf + len, buf_len - len, ",");
267267

@@ -627,7 +627,7 @@ static int ath10k_download_and_run_otp(struct ath10k *ar)
627627
ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot otp execute result %d\n", result);
628628

629629
if (!(skip_otp || test_bit(ATH10K_FW_FEATURE_IGNORE_OTP_RESULT,
630-
ar->fw_features)) &&
630+
ar->running_fw->fw_file.fw_features)) &&
631631
result != 0) {
632632
ath10k_err(ar, "otp calibration failed: %d", result);
633633
return -EINVAL;
@@ -1074,13 +1074,13 @@ static int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name,
10741074
ath10k_dbg(ar, ATH10K_DBG_BOOT,
10751075
"Enabling feature bit: %i\n",
10761076
i);
1077-
__set_bit(i, ar->fw_features);
1077+
__set_bit(i, fw_file->fw_features);
10781078
}
10791079
}
10801080

10811081
ath10k_dbg_dump(ar, ATH10K_DBG_BOOT, "features", "",
1082-
ar->fw_features,
1083-
sizeof(ar->fw_features));
1082+
ar->running_fw->fw_file.fw_features,
1083+
sizeof(fw_file->fw_features));
10841084
break;
10851085
case ATH10K_FW_IE_FW_IMAGE:
10861086
ath10k_dbg(ar, ATH10K_DBG_BOOT,
@@ -1430,8 +1430,10 @@ static void ath10k_core_restart(struct work_struct *work)
14301430

14311431
static int ath10k_core_init_firmware_features(struct ath10k *ar)
14321432
{
1433-
if (test_bit(ATH10K_FW_FEATURE_WMI_10_2, ar->fw_features) &&
1434-
!test_bit(ATH10K_FW_FEATURE_WMI_10X, ar->fw_features)) {
1433+
struct ath10k_fw_file *fw_file = &ar->normal_mode_fw.fw_file;
1434+
1435+
if (test_bit(ATH10K_FW_FEATURE_WMI_10_2, fw_file->fw_features) &&
1436+
!test_bit(ATH10K_FW_FEATURE_WMI_10X, fw_file->fw_features)) {
14351437
ath10k_err(ar, "feature bits corrupted: 10.2 feature requires 10.x feature to be set as well");
14361438
return -EINVAL;
14371439
}
@@ -1450,7 +1452,7 @@ static int ath10k_core_init_firmware_features(struct ath10k *ar)
14501452
break;
14511453
case ATH10K_CRYPT_MODE_SW:
14521454
if (!test_bit(ATH10K_FW_FEATURE_RAW_MODE_SUPPORT,
1453-
ar->fw_features)) {
1455+
fw_file->fw_features)) {
14541456
ath10k_err(ar, "cryptmode > 0 requires raw mode support from firmware");
14551457
return -EINVAL;
14561458
}
@@ -1469,7 +1471,7 @@ static int ath10k_core_init_firmware_features(struct ath10k *ar)
14691471

14701472
if (rawmode) {
14711473
if (!test_bit(ATH10K_FW_FEATURE_RAW_MODE_SUPPORT,
1472-
ar->fw_features)) {
1474+
fw_file->fw_features)) {
14731475
ath10k_err(ar, "rawmode = 1 requires support from firmware");
14741476
return -EINVAL;
14751477
}
@@ -1495,9 +1497,9 @@ static int ath10k_core_init_firmware_features(struct ath10k *ar)
14951497
* ATH10K_FW_IE_WMI_OP_VERSION.
14961498
*/
14971499
if (ar->wmi.op_version == ATH10K_FW_WMI_OP_VERSION_UNSET) {
1498-
if (test_bit(ATH10K_FW_FEATURE_WMI_10X, ar->fw_features)) {
1500+
if (test_bit(ATH10K_FW_FEATURE_WMI_10X, fw_file->fw_features)) {
14991501
if (test_bit(ATH10K_FW_FEATURE_WMI_10_2,
1500-
ar->fw_features))
1502+
fw_file->fw_features))
15011503
ar->wmi.op_version = ATH10K_FW_WMI_OP_VERSION_10_2;
15021504
else
15031505
ar->wmi.op_version = ATH10K_FW_WMI_OP_VERSION_10_1;
@@ -1553,7 +1555,7 @@ static int ath10k_core_init_firmware_features(struct ath10k *ar)
15531555
ar->max_spatial_stream = ar->hw_params.max_spatial_stream;
15541556

15551557
if (test_bit(ATH10K_FW_FEATURE_PEER_FLOW_CONTROL,
1556-
ar->fw_features))
1558+
fw_file->fw_features))
15571559
ar->htt.max_num_pending_tx = TARGET_10_4_NUM_MSDU_DESC_PFC;
15581560
else
15591561
ar->htt.max_num_pending_tx = TARGET_10_4_NUM_MSDU_DESC;
@@ -1621,7 +1623,7 @@ int ath10k_core_start(struct ath10k *ar, enum ath10k_firmware_mode mode,
16211623
* to set the clock source once the target is initialized.
16221624
*/
16231625
if (test_bit(ATH10K_FW_FEATURE_SUPPORTS_SKIP_CLOCK_INIT,
1624-
ar->fw_features)) {
1626+
ar->running_fw->fw_file.fw_features)) {
16251627
status = ath10k_bmi_write32(ar, hi_skip_clock_init, 1);
16261628
if (status) {
16271629
ath10k_err(ar, "could not write to skip_clock_init: %d\n",

drivers/net/wireless/ath/ath10k/core.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,8 @@ struct ath10k_fw_file {
632632

633633
char fw_version[ETHTOOL_FWVERS_LEN];
634634

635+
DECLARE_BITMAP(fw_features, ATH10K_FW_FEATURE_COUNT);
636+
635637
const void *firmware_data;
636638
size_t firmware_len;
637639

@@ -675,8 +677,6 @@ struct ath10k {
675677
/* protected by conf_mutex */
676678
bool ani_enabled;
677679

678-
DECLARE_BITMAP(fw_features, ATH10K_FW_FEATURE_COUNT);
679-
680680
bool p2p;
681681

682682
struct {
@@ -895,7 +895,6 @@ struct ath10k {
895895
struct {
896896
/* protected by conf_mutex */
897897
struct ath10k_fw_components utf_mode_fw;
898-
DECLARE_BITMAP(orig_fw_features, ATH10K_FW_FEATURE_COUNT);
899898
enum ath10k_fw_wmi_op_version orig_wmi_op_version;
900899
enum ath10k_fw_wmi_op_version op_version;
901900

drivers/net/wireless/ath/ath10k/htt_rx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -966,7 +966,7 @@ static int ath10k_htt_rx_nwifi_hdrlen(struct ath10k *ar,
966966
int len = ieee80211_hdrlen(hdr->frame_control);
967967

968968
if (!test_bit(ATH10K_FW_FEATURE_NO_NWIFI_DECAP_4ADDR_PADDING,
969-
ar->fw_features))
969+
ar->running_fw->fw_file.fw_features))
970970
len = round_up(len, 4);
971971

972972
return len;

drivers/net/wireless/ath/ath10k/htt_tx.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,8 @@ static void ath10k_htt_tx_free_txq(struct ath10k_htt *htt)
267267
struct ath10k *ar = htt->ar;
268268
size_t size;
269269

270-
if (!test_bit(ATH10K_FW_FEATURE_PEER_FLOW_CONTROL, ar->fw_features))
270+
if (!test_bit(ATH10K_FW_FEATURE_PEER_FLOW_CONTROL,
271+
ar->running_fw->fw_file.fw_features))
271272
return;
272273

273274
size = sizeof(*htt->tx_q_state.vaddr);
@@ -282,7 +283,8 @@ static int ath10k_htt_tx_alloc_txq(struct ath10k_htt *htt)
282283
size_t size;
283284
int ret;
284285

285-
if (!test_bit(ATH10K_FW_FEATURE_PEER_FLOW_CONTROL, ar->fw_features))
286+
if (!test_bit(ATH10K_FW_FEATURE_PEER_FLOW_CONTROL,
287+
ar->running_fw->fw_file.fw_features))
286288
return 0;
287289

288290
htt->tx_q_state.num_peers = HTT_TX_Q_STATE_NUM_PEERS;
@@ -513,7 +515,8 @@ int ath10k_htt_send_frag_desc_bank_cfg(struct ath10k_htt *htt)
513515
info |= SM(htt->tx_q_state.type,
514516
HTT_FRAG_DESC_BANK_CFG_INFO_Q_STATE_DEPTH_TYPE);
515517

516-
if (test_bit(ATH10K_FW_FEATURE_PEER_FLOW_CONTROL, ar->fw_features))
518+
if (test_bit(ATH10K_FW_FEATURE_PEER_FLOW_CONTROL,
519+
ar->running_fw->fw_file.fw_features))
517520
info |= HTT_FRAG_DESC_BANK_CFG_INFO_Q_STATE_VALID;
518521

519522
cfg = &cmd->frag_desc_bank_cfg;

drivers/net/wireless/ath/ath10k/mac.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1772,7 +1772,7 @@ static int ath10k_mac_vif_setup_ps(struct ath10k_vif *arvif)
17721772

17731773
if (enable_ps && ath10k_mac_num_vifs_started(ar) > 1 &&
17741774
!test_bit(ATH10K_FW_FEATURE_MULTI_VIF_PS_SUPPORT,
1775-
ar->fw_features)) {
1775+
ar->running_fw->fw_file.fw_features)) {
17761776
ath10k_warn(ar, "refusing to enable ps on vdev %i: not supported by fw\n",
17771777
arvif->vdev_id);
17781778
enable_ps = false;
@@ -2060,7 +2060,8 @@ static void ath10k_peer_assoc_h_crypto(struct ath10k *ar,
20602060
}
20612061

20622062
if (sta->mfp &&
2063-
test_bit(ATH10K_FW_FEATURE_MFP_SUPPORT, ar->fw_features)) {
2063+
test_bit(ATH10K_FW_FEATURE_MFP_SUPPORT,
2064+
ar->running_fw->fw_file.fw_features)) {
20642065
arg->peer_flags |= ar->wmi.peer_flags->pmf;
20652066
}
20662067
}
@@ -3207,7 +3208,8 @@ ath10k_mac_tx_h_get_txmode(struct ath10k *ar,
32073208
*/
32083209
if (ar->htt.target_version_major < 3 &&
32093210
(ieee80211_is_nullfunc(fc) || ieee80211_is_qos_nullfunc(fc)) &&
3210-
!test_bit(ATH10K_FW_FEATURE_HAS_WMI_MGMT_TX, ar->fw_features))
3211+
!test_bit(ATH10K_FW_FEATURE_HAS_WMI_MGMT_TX,
3212+
ar->running_fw->fw_file.fw_features))
32113213
return ATH10K_HW_TXRX_MGMT;
32123214

32133215
/* Workaround:
@@ -3394,7 +3396,7 @@ ath10k_mac_tx_h_get_txpath(struct ath10k *ar,
33943396
return ATH10K_MAC_TX_HTT;
33953397
case ATH10K_HW_TXRX_MGMT:
33963398
if (test_bit(ATH10K_FW_FEATURE_HAS_WMI_MGMT_TX,
3397-
ar->fw_features))
3399+
ar->running_fw->fw_file.fw_features))
33983400
return ATH10K_MAC_TX_WMI_MGMT;
33993401
else if (ar->htt.target_version_major >= 3)
34003402
return ATH10K_MAC_TX_HTT;
@@ -4435,7 +4437,7 @@ static int ath10k_start(struct ieee80211_hw *hw)
44354437
}
44364438

44374439
if (test_bit(ATH10K_FW_FEATURE_SUPPORTS_ADAPTIVE_CCA,
4438-
ar->fw_features)) {
4440+
ar->running_fw->fw_file.fw_features)) {
44394441
ret = ath10k_wmi_pdev_enable_adaptive_cca(ar, 1,
44404442
WMI_CCA_DETECT_LEVEL_AUTO,
44414443
WMI_CCA_DETECT_MARGIN_AUTO);
@@ -7694,7 +7696,7 @@ int ath10k_mac_register(struct ath10k *ar)
76947696
ar->hw->wiphy->available_antennas_rx = ar->cfg_rx_chainmask;
76957697
ar->hw->wiphy->available_antennas_tx = ar->cfg_tx_chainmask;
76967698

7697-
if (!test_bit(ATH10K_FW_FEATURE_NO_P2P, ar->fw_features))
7699+
if (!test_bit(ATH10K_FW_FEATURE_NO_P2P, ar->normal_mode_fw.fw_file.fw_features))
76987700
ar->hw->wiphy->interface_modes |=
76997701
BIT(NL80211_IFTYPE_P2P_DEVICE) |
77007702
BIT(NL80211_IFTYPE_P2P_CLIENT) |

drivers/net/wireless/ath/ath10k/testmode.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -362,14 +362,8 @@ static int ath10k_tm_cmd_utf_start(struct ath10k *ar, struct nlattr *tb[])
362362
spin_lock_bh(&ar->data_lock);
363363
ar->testmode.utf_monitor = true;
364364
spin_unlock_bh(&ar->data_lock);
365-
BUILD_BUG_ON(sizeof(ar->fw_features) !=
366-
sizeof(ar->testmode.orig_fw_features));
367365

368-
memcpy(ar->testmode.orig_fw_features, ar->fw_features,
369-
sizeof(ar->fw_features));
370366
ar->testmode.orig_wmi_op_version = ar->wmi.op_version;
371-
memset(ar->fw_features, 0, sizeof(ar->fw_features));
372-
373367
ar->wmi.op_version = ar->testmode.op_version;
374368

375369
ath10k_dbg(ar, ATH10K_DBG_TESTMODE, "testmode wmi version %d\n",
@@ -407,9 +401,6 @@ static int ath10k_tm_cmd_utf_start(struct ath10k *ar, struct nlattr *tb[])
407401
ath10k_hif_power_down(ar);
408402

409403
err_fw_features:
410-
/* return the original firmware features */
411-
memcpy(ar->fw_features, ar->testmode.orig_fw_features,
412-
sizeof(ar->fw_features));
413404
ar->wmi.op_version = ar->testmode.orig_wmi_op_version;
414405

415406
release_firmware(ar->testmode.utf_mode_fw.fw_file.firmware);
@@ -434,11 +425,6 @@ static void __ath10k_tm_cmd_utf_stop(struct ath10k *ar)
434425

435426
spin_unlock_bh(&ar->data_lock);
436427

437-
/* return the original firmware features */
438-
memcpy(ar->fw_features, ar->testmode.orig_fw_features,
439-
sizeof(ar->fw_features));
440-
ar->wmi.op_version = ar->testmode.orig_wmi_op_version;
441-
442428
release_firmware(ar->testmode.utf_mode_fw.fw_file.firmware);
443429
ar->testmode.utf_mode_fw.fw_file.firmware = NULL;
444430

drivers/net/wireless/ath/ath10k/wmi.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2149,7 +2149,8 @@ static int ath10k_wmi_op_pull_mgmt_rx_ev(struct ath10k *ar, struct sk_buff *skb,
21492149
u32 msdu_len;
21502150
u32 len;
21512151

2152-
if (test_bit(ATH10K_FW_FEATURE_EXT_WMI_MGMT_RX, ar->fw_features)) {
2152+
if (test_bit(ATH10K_FW_FEATURE_EXT_WMI_MGMT_RX,
2153+
ar->running_fw->fw_file.fw_features)) {
21532154
ev_v2 = (struct wmi_mgmt_rx_event_v2 *)skb->data;
21542155
ev_hdr = &ev_v2->hdr.v1;
21552156
pull_len = sizeof(*ev_v2);
@@ -4634,7 +4635,7 @@ static void ath10k_wmi_event_service_ready_work(struct work_struct *work)
46344635

46354636
if (test_bit(WMI_SERVICE_PEER_CACHING, ar->wmi.svc_map)) {
46364637
if (test_bit(ATH10K_FW_FEATURE_PEER_FLOW_CONTROL,
4637-
ar->fw_features))
4638+
ar->running_fw->fw_file.fw_features))
46384639
ar->num_active_peers = TARGET_10_4_QCACHE_ACTIVE_PEERS_PFC +
46394640
ar->max_num_vdevs;
46404641
else

drivers/net/wireless/ath/ath10k/wow.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ int ath10k_wow_op_suspend(struct ieee80211_hw *hw,
233233
mutex_lock(&ar->conf_mutex);
234234

235235
if (WARN_ON(!test_bit(ATH10K_FW_FEATURE_WOWLAN_SUPPORT,
236-
ar->fw_features))) {
236+
ar->running_fw->fw_file.fw_features))) {
237237
ret = 1;
238238
goto exit;
239239
}
@@ -285,7 +285,7 @@ int ath10k_wow_op_resume(struct ieee80211_hw *hw)
285285
mutex_lock(&ar->conf_mutex);
286286

287287
if (WARN_ON(!test_bit(ATH10K_FW_FEATURE_WOWLAN_SUPPORT,
288-
ar->fw_features))) {
288+
ar->running_fw->fw_file.fw_features))) {
289289
ret = 1;
290290
goto exit;
291291
}
@@ -325,7 +325,8 @@ int ath10k_wow_op_resume(struct ieee80211_hw *hw)
325325

326326
int ath10k_wow_init(struct ath10k *ar)
327327
{
328-
if (!test_bit(ATH10K_FW_FEATURE_WOWLAN_SUPPORT, ar->fw_features))
328+
if (!test_bit(ATH10K_FW_FEATURE_WOWLAN_SUPPORT,
329+
ar->running_fw->fw_file.fw_features))
329330
return 0;
330331

331332
if (WARN_ON(!test_bit(WMI_SERVICE_WOW, ar->wmi.svc_map)))

0 commit comments

Comments
 (0)