瀏覽代碼

qcacld-3.0: Move assemble rate code functionality to mlme

Move assemble rate code functionality to mlme

Change-Id: I8acb04f2e09be742f95d38a4688e07c1d011f4e8
CRs-Fixed: 3593174
Prasanna JS 1 年之前
父節點
當前提交
0ed9d7c8cc

+ 18 - 0
components/mlme/dispatcher/inc/wlan_mlme_api.h

@@ -28,6 +28,9 @@
 #include <wlan_cmn.h>
 #include "sme_api.h"
 
+#define ASSEMBLE_RATECODE_V1(_pream, _nss, _rate) \
+		(((1) << 28) | ((_pream) << 8) | ((_nss) << 5) | (_rate))
+
 #ifdef FEATURE_SET
 /**
  * wlan_mlme_get_feature_info() - Get mlme features
@@ -4588,4 +4591,19 @@ QDF_STATUS wlan_mlme_get_sta_ch_width(struct wlan_objmgr_vdev *vdev,
 QDF_STATUS
 wlan_mlme_set_ul_mu_config(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id,
 			   uint8_t ulmu_disable);
+
+/**
+ * wlan_mlme_assemble_rate_code() - assemble rate code to be sent to FW
+ *
+ * @preamble: rate preamble
+ * @nss: number of spatial streams
+ * @rate: rate index
+ *
+ * Rate code assembling is different for targets which are 11ax capable.
+ * Check for the target support and assemble the rate code accordingly.
+ *
+ * Return: assembled rate code
+ */
+uint32_t
+wlan_mlme_assemble_rate_code(uint8_t preamble, uint8_t nss, uint8_t rate);
 #endif /* _WLAN_MLME_API_H_ */

+ 17 - 0
components/mlme/dispatcher/inc/wlan_mlme_ucfg_api.h

@@ -5289,4 +5289,21 @@ QDF_STATUS ucfg_mlme_set_ul_mu_config(struct wlan_objmgr_psoc *psoc,
 {
 	return wlan_mlme_set_ul_mu_config(psoc, vdev_id, ulmu_disable);
 }
+
+/**
+ * ucfg_mlme_assemble_rate_code - assemble rate code to be sent to FW
+ * @preamble: rate preamble
+ * @nss: number of spatial streams
+ * @rate: rate index
+ *
+ * Rate code assembling is different for targets which are 11ax capable.
+ * Check for the target support and assemble the rate code accordingly.
+ *
+ * Return: assembled rate code
+ */
+static inline uint32_t
+ucfg_mlme_assemble_rate_code(uint8_t preamble, uint8_t nss, uint8_t rate)
+{
+	return wlan_mlme_assemble_rate_code(preamble, nss, rate);
+}
 #endif /* _WLAN_MLME_UCFG_API_H_ */

+ 14 - 0
components/mlme/dispatcher/src/wlan_mlme_api.c

@@ -37,6 +37,7 @@
 #include "target_if.h"
 #include "wlan_vdev_mgr_tgt_if_tx_api.h"
 #include "wmi_unified_vdev_api.h"
+#include "wlan_mlme_api.h"
 #include "../../core/src/wlan_cp_stats_defs.h"
 
 /* quota in milliseconds */
@@ -7616,3 +7617,16 @@ err:
 	wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_OBJMGR_ID);
 	return status;
 }
+
+uint32_t
+wlan_mlme_assemble_rate_code(uint8_t preamble, uint8_t nss, uint8_t rate)
+{
+	uint32_t set_value;
+
+	if (wma_get_fw_wlan_feat_caps(DOT11AX))
+		set_value = ASSEMBLE_RATECODE_V1(preamble, nss, rate);
+	else
+		set_value = (preamble << 6) | (nss << 4) | rate;
+
+	return set_value;
+}

+ 1 - 8
core/hdd/src/wlan_hdd_main.c

@@ -3822,14 +3822,7 @@ int hdd_set_11ax_rate(struct hdd_adapter *adapter, int set_value,
 
 int hdd_assemble_rate_code(uint8_t preamble, uint8_t nss, uint8_t rate)
 {
-	int set_value;
-
-	if (sme_is_feature_supported_by_fw(DOT11AX))
-		set_value = WMI_ASSEMBLE_RATECODE_V1(rate, nss, preamble);
-	else
-		set_value = (preamble << 6) | (nss << 4) | rate;
-
-	return set_value;
+	return ucfg_mlme_assemble_rate_code(preamble, nss, rate);
 }
 
 #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH