wifi: ath12k: fix ar->supports_6ghz usage during hw register
authorAditya Kumar Singh <quic_adisi@quicinc.com>
Mon, 9 Dec 2024 18:54:20 +0000 (20:54 +0200)
committerJeff Johnson <jeff.johnson@oss.qualcomm.com>
Mon, 16 Dec 2024 20:46:58 +0000 (12:46 -0800)
In the ath12k_mac_hw_register() function's context, ar is an iterator
variable, and there is no assurance that the last ar will be the one with
6 GHz enabled. Therefore, checking directly ar->supports_6ghz outside the
loop is not appropriate.

Additionally, 6 GHz lacks HT capabilities. To obtain the super set of
HT capabilities across all grouped radios, 6 GHz should be excluded.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3

Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://patch.msgid.link/20241209185421.376381-9-kvalo@kernel.org
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
drivers/net/wireless/ath/ath12k/mac.c

index 705e0b673435851f8f272888215825a9247b3452..e3848485d029ed2940b37a440fdfb02362e9b4f9 100644 (file)
@@ -10723,7 +10723,10 @@ static int ath12k_mac_hw_register(struct ath12k_hw *ah)
                if (ret)
                        goto err_cleanup_unregister;
 
-               ht_cap &= ht_cap_info;
+               /* 6 GHz does not support HT Cap, hence do not consider it */
+               if (!ar->supports_6ghz)
+                       ht_cap &= ht_cap_info;
+
                wiphy->max_ap_assoc_sta += ar->max_num_stations;
 
                /* Advertise the max antenna support of all radios, driver can handle
@@ -10787,7 +10790,7 @@ static int ath12k_mac_hw_register(struct ath12k_hw *ah)
        ieee80211_hw_set(hw, SUPPORTS_TX_FRAG);
        ieee80211_hw_set(hw, REPORTS_LOW_ACK);
 
-       if ((ht_cap & WMI_HT_CAP_ENABLED) || ar->supports_6ghz) {
+       if ((ht_cap & WMI_HT_CAP_ENABLED) || is_6ghz) {
                ieee80211_hw_set(hw, AMPDU_AGGREGATION);
                ieee80211_hw_set(hw, TX_AMPDU_SETUP_IN_HW);
                ieee80211_hw_set(hw, SUPPORTS_REORDERING_BUFFER);
@@ -10803,7 +10806,7 @@ static int ath12k_mac_hw_register(struct ath12k_hw *ah)
         * handle it when the ht capability different for each band.
         */
        if (ht_cap & WMI_HT_CAP_DYNAMIC_SMPS ||
-           (ar->supports_6ghz && ab->hw_params->supports_dynamic_smps_6ghz))
+           (is_6ghz && ab->hw_params->supports_dynamic_smps_6ghz))
                wiphy->features |= NL80211_FEATURE_DYNAMIC_SMPS;
 
        wiphy->max_scan_ssids = WLAN_SCAN_PARAMS_MAX_SSID;