Skip to content

Commit c8a5f34

Browse files
Karthikeyan Periyasamykvalo
authored andcommitted
wifi: ath12k: avoid repeated wiphy access from hw
Currently repeated access of wiphy data from mac80211 hw structure is happen inside the mac80211 registration helper functions. So optimize these helper functions by storing wiphy data locally and accessing it directly. Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1 Signed-off-by: Karthikeyan Periyasamy <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent ed7e818 commit c8a5f34

File tree

1 file changed

+37
-35
lines changed
  • drivers/net/wireless/ath/ath12k

1 file changed

+37
-35
lines changed

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

Lines changed: 37 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -7255,6 +7255,7 @@ static int ath12k_mac_setup_iface_combinations(struct ath12k *ar)
72557255
{
72567256
struct ath12k_base *ab = ar->ab;
72577257
struct ieee80211_hw *hw = ar->hw;
7258+
struct wiphy *wiphy = hw->wiphy;
72587259
struct ieee80211_iface_combination *combinations;
72597260
struct ieee80211_iface_limit *limits;
72607261
int n_limits, max_interfaces;
@@ -7305,8 +7306,8 @@ static int ath12k_mac_setup_iface_combinations(struct ath12k *ar)
73057306
BIT(NL80211_CHAN_WIDTH_40) |
73067307
BIT(NL80211_CHAN_WIDTH_80);
73077308

7308-
hw->wiphy->iface_combinations = combinations;
7309-
hw->wiphy->n_iface_combinations = 1;
7309+
wiphy->iface_combinations = combinations;
7310+
wiphy->n_iface_combinations = 1;
73107311

73117312
return 0;
73127313
}
@@ -7351,6 +7352,7 @@ static const struct wiphy_iftype_ext_capab ath12k_iftypes_ext_capa[] = {
73517352
static void __ath12k_mac_unregister(struct ath12k *ar)
73527353
{
73537354
struct ieee80211_hw *hw = ar->hw;
7355+
struct wiphy *wiphy = hw->wiphy;
73547356

73557357
cancel_work_sync(&ar->regd_update_work);
73567358

@@ -7363,8 +7365,8 @@ static void __ath12k_mac_unregister(struct ath12k *ar)
73637365
kfree(ar->mac.sbands[NL80211_BAND_5GHZ].channels);
73647366
kfree(ar->mac.sbands[NL80211_BAND_6GHZ].channels);
73657367

7366-
kfree(hw->wiphy->iface_combinations[0].limits);
7367-
kfree(hw->wiphy->iface_combinations);
7368+
kfree(wiphy->iface_combinations[0].limits);
7369+
kfree(wiphy->iface_combinations);
73687370

73697371
SET_IEEE80211_DEV(hw, NULL);
73707372
}
@@ -7389,6 +7391,7 @@ static int __ath12k_mac_register(struct ath12k *ar)
73897391
{
73907392
struct ath12k_base *ab = ar->ab;
73917393
struct ieee80211_hw *hw = ar->hw;
7394+
struct wiphy *wiphy = hw->wiphy;
73927395
struct ath12k_pdev_cap *cap = &ar->pdev->cap;
73937396
static const u32 cipher_suites[] = {
73947397
WLAN_CIPHER_SUITE_TKIP,
@@ -7424,14 +7427,14 @@ static int __ath12k_mac_register(struct ath12k *ar)
74247427
goto err_free_channels;
74257428
}
74267429

7427-
hw->wiphy->available_antennas_rx = cap->rx_chain_mask;
7428-
hw->wiphy->available_antennas_tx = cap->tx_chain_mask;
7430+
wiphy->available_antennas_rx = cap->rx_chain_mask;
7431+
wiphy->available_antennas_tx = cap->tx_chain_mask;
74297432

7430-
hw->wiphy->interface_modes = ab->hw_params->interface_modes;
7433+
wiphy->interface_modes = ab->hw_params->interface_modes;
74317434

7432-
if (hw->wiphy->bands[NL80211_BAND_2GHZ] &&
7433-
hw->wiphy->bands[NL80211_BAND_5GHZ] &&
7434-
hw->wiphy->bands[NL80211_BAND_6GHZ])
7435+
if (wiphy->bands[NL80211_BAND_2GHZ] &&
7436+
wiphy->bands[NL80211_BAND_5GHZ] &&
7437+
wiphy->bands[NL80211_BAND_6GHZ])
74357438
ieee80211_hw_set(hw, SINGLE_SCAN_ON_ALL_BANDS);
74367439

74377440
ieee80211_hw_set(hw, SIGNAL_DBM);
@@ -7457,60 +7460,59 @@ static int __ath12k_mac_register(struct ath12k *ar)
74577460
ieee80211_hw_set(hw, USES_RSS);
74587461
}
74597462

7460-
hw->wiphy->features |= NL80211_FEATURE_STATIC_SMPS;
7461-
hw->wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
7463+
wiphy->features |= NL80211_FEATURE_STATIC_SMPS;
7464+
wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
74627465

74637466
/* TODO: Check if HT capability advertised from firmware is different
74647467
* for each band for a dual band capable radio. It will be tricky to
74657468
* handle it when the ht capability different for each band.
74667469
*/
74677470
if (ht_cap & WMI_HT_CAP_DYNAMIC_SMPS)
7468-
hw->wiphy->features |= NL80211_FEATURE_DYNAMIC_SMPS;
7471+
wiphy->features |= NL80211_FEATURE_DYNAMIC_SMPS;
74697472

7470-
hw->wiphy->max_scan_ssids = WLAN_SCAN_PARAMS_MAX_SSID;
7471-
hw->wiphy->max_scan_ie_len = WLAN_SCAN_PARAMS_MAX_IE_LEN;
7473+
wiphy->max_scan_ssids = WLAN_SCAN_PARAMS_MAX_SSID;
7474+
wiphy->max_scan_ie_len = WLAN_SCAN_PARAMS_MAX_IE_LEN;
74727475

74737476
hw->max_listen_interval = ATH12K_MAX_HW_LISTEN_INTERVAL;
74747477

7475-
hw->wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
7476-
hw->wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH;
7477-
hw->wiphy->max_remain_on_channel_duration = 5000;
7478+
wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
7479+
wiphy->flags |= WIPHY_FLAG_HAS_CHANNEL_SWITCH;
7480+
wiphy->max_remain_on_channel_duration = 5000;
74787481

7479-
hw->wiphy->flags |= WIPHY_FLAG_AP_UAPSD;
7480-
hw->wiphy->features |= NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE |
7482+
wiphy->flags |= WIPHY_FLAG_AP_UAPSD;
7483+
wiphy->features |= NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE |
74817484
NL80211_FEATURE_AP_SCAN;
74827485

74837486
ar->max_num_stations = TARGET_NUM_STATIONS;
74847487
ar->max_num_peers = TARGET_NUM_PEERS_PDEV;
74857488

7486-
hw->wiphy->max_ap_assoc_sta = ar->max_num_stations;
7489+
wiphy->max_ap_assoc_sta = ar->max_num_stations;
74877490

74887491
hw->queues = ATH12K_HW_MAX_QUEUES;
7489-
hw->wiphy->tx_queue_len = ATH12K_QUEUE_LEN;
7492+
wiphy->tx_queue_len = ATH12K_QUEUE_LEN;
74907493
hw->offchannel_tx_hw_queue = ATH12K_HW_MAX_QUEUES - 1;
74917494
hw->max_rx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF_HE;
74927495

74937496
hw->vif_data_size = sizeof(struct ath12k_vif);
74947497
hw->sta_data_size = sizeof(struct ath12k_sta);
74957498

7496-
wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST);
7497-
wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_STA_TX_PWR);
7499+
wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST);
7500+
wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_STA_TX_PWR);
74987501

7499-
hw->wiphy->cipher_suites = cipher_suites;
7500-
hw->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
7502+
wiphy->cipher_suites = cipher_suites;
7503+
wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
75017504

7502-
hw->wiphy->iftype_ext_capab = ath12k_iftypes_ext_capa;
7503-
hw->wiphy->num_iftype_ext_capab =
7504-
ARRAY_SIZE(ath12k_iftypes_ext_capa);
7505+
wiphy->iftype_ext_capab = ath12k_iftypes_ext_capa;
7506+
wiphy->num_iftype_ext_capab = ARRAY_SIZE(ath12k_iftypes_ext_capa);
75057507

75067508
if (ar->supports_6ghz) {
7507-
wiphy_ext_feature_set(hw->wiphy,
7509+
wiphy_ext_feature_set(wiphy,
75087510
NL80211_EXT_FEATURE_FILS_DISCOVERY);
7509-
wiphy_ext_feature_set(hw->wiphy,
7511+
wiphy_ext_feature_set(wiphy,
75107512
NL80211_EXT_FEATURE_UNSOL_BCAST_PROBE_RESP);
75117513
}
75127514

7513-
wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_PUNCT);
7515+
wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_PUNCT);
75147516

75157517
ath12k_reg_init(hw);
75167518

@@ -7532,7 +7534,7 @@ static int __ath12k_mac_register(struct ath12k *ar)
75327534
* while. But that time is so short and in practise it make
75337535
* a difference in real life.
75347536
*/
7535-
hw->wiphy->interface_modes &= ~BIT(NL80211_IFTYPE_MONITOR);
7537+
wiphy->interface_modes &= ~BIT(NL80211_IFTYPE_MONITOR);
75367538

75377539
/* Apply the regd received during initialization */
75387540
ret = ath12k_regd_update(ar, true);
@@ -7547,8 +7549,8 @@ static int __ath12k_mac_register(struct ath12k *ar)
75477549
ieee80211_unregister_hw(hw);
75487550

75497551
err_free_if_combs:
7550-
kfree(hw->wiphy->iface_combinations[0].limits);
7551-
kfree(hw->wiphy->iface_combinations);
7552+
kfree(wiphy->iface_combinations[0].limits);
7553+
kfree(wiphy->iface_combinations);
75527554

75537555
err_free_channels:
75547556
kfree(ar->mac.sbands[NL80211_BAND_2GHZ].channels);

0 commit comments

Comments
 (0)