]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: ath12k: generalize GI and LTF fixed rate functions
authorMuna Sinada <muna.sinada@oss.qualcomm.com>
Fri, 24 Oct 2025 00:19:23 +0000 (17:19 -0700)
committerJeff Johnson <jeff.johnson@oss.qualcomm.com>
Thu, 30 Oct 2025 21:55:07 +0000 (14:55 -0700)
Currently, functions in mac.c for setting GI and LTF rates are
specifically for HE rates.

Remove any mention of "HE" in such functions in order to allow for
other modes to utilize the functions. The intention is to prepare for
the addition of EHT GI and LTF fixed rate settings.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1

Signed-off-by: Muna Sinada <muna.sinada@oss.qualcomm.com>
Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com>
Link: https://patch.msgid.link/20251024001928.257356-2-muna.sinada@oss.qualcomm.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
drivers/net/wireless/ath/ath12k/mac.c
drivers/net/wireless/ath/ath12k/mac.h
drivers/net/wireless/ath/ath12k/wmi.h

index e79d457e3c03da372c57e4b2c7970d07c38d6008..c17500a3e95f9f24457f928ae01a424f06ff9896 100644 (file)
@@ -12094,55 +12094,57 @@ ath12k_mac_get_single_legacy_rate(struct ath12k *ar,
 }
 
 static int
-ath12k_mac_set_fixed_rate_gi_ltf(struct ath12k_link_vif *arvif, u8 he_gi, u8 he_ltf)
+ath12k_mac_set_fixed_rate_gi_ltf(struct ath12k_link_vif *arvif, u8 gi, u8 ltf)
 {
        struct ath12k *ar = arvif->ar;
-       int ret;
+       int param, ret;
 
        lockdep_assert_wiphy(ath12k_ar_to_hw(ar)->wiphy);
 
        /* 0.8 = 0, 1.6 = 2 and 3.2 = 3. */
-       if (he_gi && he_gi != 0xFF)
-               he_gi += 1;
+       if (gi && gi != 0xFF)
+               gi += 1;
 
        ret = ath12k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
-                                           WMI_VDEV_PARAM_SGI, he_gi);
+                                           WMI_VDEV_PARAM_SGI, gi);
        if (ret) {
-               ath12k_warn(ar->ab, "failed to set HE GI:%d, error:%d\n",
-                           he_gi, ret);
+               ath12k_warn(ar->ab, "failed to set GI:%d, error:%d\n",
+                           gi, ret);
                return ret;
        }
        /* start from 1 */
-       if (he_ltf != 0xFF)
-               he_ltf += 1;
+       if (ltf != 0xFF)
+               ltf += 1;
+
+       param = WMI_VDEV_PARAM_HE_LTF;
 
        ret = ath12k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
-                                           WMI_VDEV_PARAM_HE_LTF, he_ltf);
+                                           param, ltf);
        if (ret) {
-               ath12k_warn(ar->ab, "failed to set HE LTF:%d, error:%d\n",
-                           he_ltf, ret);
+               ath12k_warn(ar->ab, "failed to set LTF:%d, error:%d\n",
+                           ltf, ret);
                return ret;
        }
        return 0;
 }
 
 static int
-ath12k_mac_set_auto_rate_gi_ltf(struct ath12k_link_vif *arvif, u16 he_gi, u8 he_ltf)
+ath12k_mac_set_auto_rate_gi_ltf(struct ath12k_link_vif *arvif, u16 gi, u8 ltf)
 {
        struct ath12k *ar = arvif->ar;
        int ret;
-       u32 he_ar_gi_ltf;
+       u32 ar_gi_ltf;
 
-       if (he_gi != 0xFF) {
-               switch (he_gi) {
-               case NL80211_RATE_INFO_HE_GI_0_8:
-                       he_gi = WMI_AUTORATE_800NS_GI;
+       if (gi != 0xFF) {
+               switch (gi) {
+               case ATH12K_RATE_INFO_GI_0_8:
+                       gi = WMI_AUTORATE_800NS_GI;
                        break;
-               case NL80211_RATE_INFO_HE_GI_1_6:
-                       he_gi = WMI_AUTORATE_1600NS_GI;
+               case ATH12K_RATE_INFO_GI_1_6:
+                       gi = WMI_AUTORATE_1600NS_GI;
                        break;
-               case NL80211_RATE_INFO_HE_GI_3_2:
-                       he_gi = WMI_AUTORATE_3200NS_GI;
+               case ATH12K_RATE_INFO_GI_3_2:
+                       gi = WMI_AUTORATE_3200NS_GI;
                        break;
                default:
                        ath12k_warn(ar->ab, "Invalid GI\n");
@@ -12150,16 +12152,16 @@ ath12k_mac_set_auto_rate_gi_ltf(struct ath12k_link_vif *arvif, u16 he_gi, u8 he_
                }
        }
 
-       if (he_ltf != 0xFF) {
-               switch (he_ltf) {
-               case NL80211_RATE_INFO_HE_1XLTF:
-                       he_ltf = WMI_HE_AUTORATE_LTF_1X;
+       if (ltf != 0xFF) {
+               switch (ltf) {
+               case ATH12K_RATE_INFO_1XLTF:
+                       ltf = WMI_AUTORATE_LTF_1X;
                        break;
-               case NL80211_RATE_INFO_HE_2XLTF:
-                       he_ltf = WMI_HE_AUTORATE_LTF_2X;
+               case ATH12K_RATE_INFO_2XLTF:
+                       ltf = WMI_AUTORATE_LTF_2X;
                        break;
-               case NL80211_RATE_INFO_HE_4XLTF:
-                       he_ltf = WMI_HE_AUTORATE_LTF_4X;
+               case ATH12K_RATE_INFO_4XLTF:
+                       ltf = WMI_AUTORATE_LTF_4X;
                        break;
                default:
                        ath12k_warn(ar->ab, "Invalid LTF\n");
@@ -12167,15 +12169,15 @@ ath12k_mac_set_auto_rate_gi_ltf(struct ath12k_link_vif *arvif, u16 he_gi, u8 he_
                }
        }
 
-       he_ar_gi_ltf = he_gi | he_ltf;
+       ar_gi_ltf = gi | ltf;
 
        ret = ath12k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
                                            WMI_VDEV_PARAM_AUTORATE_MISC_CFG,
-                                           he_ar_gi_ltf);
+                                           ar_gi_ltf);
        if (ret) {
                ath12k_warn(ar->ab,
-                           "failed to set HE autorate GI:%u, LTF:%u params, error:%d\n",
-                           he_gi, he_ltf, ret);
+                           "failed to set autorate GI:%u, LTF:%u params, error:%d\n",
+                           gi, ltf, ret);
                return ret;
        }
 
@@ -12200,10 +12202,10 @@ static int ath12k_mac_set_rate_params(struct ath12k_link_vif *arvif,
 {
        struct ieee80211_bss_conf *link_conf;
        struct ath12k *ar = arvif->ar;
+       bool he_support, gi_ltf_set = false;
        u32 vdev_param;
        u32 param_value;
        int ret;
-       bool he_support;
 
        lockdep_assert_wiphy(ath12k_ar_to_hw(ar)->wiphy);
 
@@ -12257,7 +12259,10 @@ static int ath12k_mac_set_rate_params(struct ath12k_link_vif *arvif,
                        ret = ath12k_mac_set_auto_rate_gi_ltf(arvif, he_gi, he_ltf);
                if (ret)
                        return ret;
-       } else {
+               gi_ltf_set = true;
+       }
+
+       if (!gi_ltf_set) {
                vdev_param = WMI_VDEV_PARAM_SGI;
                param_value = ath12k_mac_nlgi_to_wmigi(sgi);
                ret = ath12k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
index c05af40bd7a20103deab30c0edb7cb54b739bec2..1f689e367c8a19d5b4cbd0e6108cecd8f830e5b4 100644 (file)
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause-Clear */
 /*
  * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
  */
 
 #ifndef ATH12K_MAC_H
@@ -84,6 +84,18 @@ enum ath12k_supported_bw {
        ATH12K_BW_320   = 4,
 };
 
+enum ath12k_gi {
+       ATH12K_RATE_INFO_GI_0_8,
+       ATH12K_RATE_INFO_GI_1_6,
+       ATH12K_RATE_INFO_GI_3_2,
+};
+
+enum ath12k_ltf {
+       ATH12K_RATE_INFO_1XLTF,
+       ATH12K_RATE_INFO_2XLTF,
+       ATH12K_RATE_INFO_4XLTF,
+};
+
 struct ath12k_mac_get_any_chanctx_conf_arg {
        struct ath12k *ar;
        struct ieee80211_chanctx_conf *chanctx_conf;
index 911ef9d5281779d8cb38cce1ee23e8a99ac3b2b1..467fc32feee2365eb0cc3b21d1b9e8025c7e5581 100644 (file)
@@ -223,15 +223,15 @@ enum WMI_HOST_WLAN_BAND {
 };
 
 /* Parameters used for WMI_VDEV_PARAM_AUTORATE_MISC_CFG command.
- * Used only for HE auto rate mode.
+ * Used for HE and EHT auto rate mode.
  */
 enum {
-       /* HE LTF related configuration */
-       WMI_HE_AUTORATE_LTF_1X = BIT(0),
-       WMI_HE_AUTORATE_LTF_2X = BIT(1),
-       WMI_HE_AUTORATE_LTF_4X = BIT(2),
+       /* LTF related configuration */
+       WMI_AUTORATE_LTF_1X = BIT(0),
+       WMI_AUTORATE_LTF_2X = BIT(1),
+       WMI_AUTORATE_LTF_4X = BIT(2),
 
-       /* HE GI related configuration */
+       /* GI related configuration */
        WMI_AUTORATE_400NS_GI = BIT(8),
        WMI_AUTORATE_800NS_GI = BIT(9),
        WMI_AUTORATE_1600NS_GI = BIT(10),