Procházet zdrojové kódy

qcacld-3.0: Set rx chainmask before start spectral scan

It need rx chainmask to select noise floor when start spectral gen3
scan and rx data by DMA. So set rx chainmask before start spectral
scan.

Change-Id: I63efd8f5384537b5697ba809bb05fdd17e243210
CRs-Fixed: 2519366
Wu Gao před 5 roky
rodič
revize
aa3ab36be6

+ 19 - 0
core/hdd/inc/wlan_hdd_spectralscan.h

@@ -232,6 +232,17 @@ void spectral_scan_activate_service(struct hdd_context *hdd_ctx);
  * Return: None
  */
 void spectral_scan_deactivate_service(void);
+
+/**
+ * wlan_spectral_update_rx_chainmask() - API to update rx chainmask before
+ * start spectral gen3
+ * @adapter: pointer to adapter
+ *
+ * API to update rx chainmask before start spectral gen3.
+ *
+ * Return: QDF_STATUS_SUCCESS or non-zero on failure
+ */
+QDF_STATUS wlan_spectral_update_rx_chainmask(struct hdd_adapter *adapter);
 #else
 static inline void spectral_scan_activate_service(struct hdd_context *hdd_ctx)
 {
@@ -240,5 +251,13 @@ static inline void spectral_scan_activate_service(struct hdd_context *hdd_ctx)
 static inline void spectral_scan_deactivate_service(void)
 {
 }
+
+#ifdef WLAN_CONV_SPECTRAL_ENABLE
+static inline QDF_STATUS
+wlan_spectral_update_rx_chainmask(struct hdd_adapter *adapter)
+{
+	return QDF_STATUS_SUCCESS;
+}
+#endif /* WLAN_CONV_SPECTRAL_ENABLE */
 #endif
 #endif

+ 25 - 0
core/hdd/src/wlan_hdd_spectralscan.c

@@ -33,6 +33,7 @@
 #include "wlan_cfg80211_spectral.h"
 #include "wlan_hdd_spectralscan.h"
 #include <wlan_spectral_ucfg_api.h>
+#include "wma.h"
 #ifdef CNSS_GENL
 #include <net/cnss_nl.h>
 #endif
@@ -73,6 +74,7 @@ static int __wlan_hdd_cfg80211_spectral_scan_start(struct wiphy *wiphy,
 	if (wlan_hdd_validate_vdev_id(adapter->vdev_id))
 		return -EINVAL;
 
+	wlan_spectral_update_rx_chainmask(adapter);
 	ret = wlan_cfg80211_spectral_scan_config_and_start(wiphy,
 					hdd_ctx->pdev,
 					data, data_len);
@@ -567,4 +569,27 @@ void spectral_scan_deactivate_service(void)
 {
 	deregister_cld_cmd_cb(WLAN_NL_MSG_SPECTRAL_SCAN);
 }
+
+QDF_STATUS wlan_spectral_update_rx_chainmask(struct hdd_adapter *adapter)
+{
+	uint32_t version;
+	uint32_t sub_version;
+	uint32_t chainmask_2g = 0;
+	uint32_t chainmask_5g = 0;
+	uint32_t chainmask;
+	uint8_t home_chan;
+	uint8_t pdev_id;
+
+	spectral_get_version(adapter->hdd_ctx->pdev, &version, &sub_version);
+	if (version != SPECTRAL_VERSION_3)
+		return QDF_STATUS_SUCCESS;
+
+	home_chan = hdd_get_adapter_home_channel(adapter);
+	pdev_id = wlan_objmgr_pdev_get_pdev_id(adapter->hdd_ctx->pdev);
+	wma_get_rx_chainmask(pdev_id, &chainmask_2g, &chainmask_5g);
+	chainmask = home_chan > MAX_24GHZ_CHANNEL ? chainmask_5g : chainmask_2g;
+	wlan_vdev_mlme_set_rxchainmask(adapter->vdev, chainmask);
+
+	return QDF_STATUS_SUCCESS;
+}
 #endif

+ 13 - 0
core/wma/inc/wma.h

@@ -2578,4 +2578,17 @@ QDF_STATUS wma_add_bss_lfr2_vdev_start(struct bss_params *add_bss);
  * Return: None
  */
 QDF_STATUS wma_send_peer_assoc_req(struct bss_params *add_bss);
+
+/**
+ * wma_get_rx_chainmask() - API to get rx chainmask from mac phy capability
+ * @pdev_id: pdev id
+ * @chainmask_2g: pointer to return 2g chainmask
+ * @chainmask_5g: pointer to return 5g chainmask
+ *
+ * API to get rx chainmask from mac phy capability directly.
+ *
+ * Return: QDF_STATUS_SUCCESS or non-zero on failure
+ */
+QDF_STATUS wma_get_rx_chainmask(uint8_t pdev_id, uint32_t *chainmask_2g,
+				uint32_t *chainmask_5g);
 #endif

+ 29 - 0
core/wma/src/wma_main.c

@@ -9555,3 +9555,32 @@ QDF_STATUS wma_config_bmiss_bcnt_params(uint32_t vdev_id, uint32_t first_cnt,
 	return status;
 }
 
+QDF_STATUS wma_get_rx_chainmask(uint8_t pdev_id, uint32_t *chainmask_2g,
+				uint32_t *chainmask_5g)
+{
+	struct wlan_psoc_host_mac_phy_caps *mac_phy_cap;
+	uint8_t total_mac_phy_cnt;
+	struct target_psoc_info *tgt_hdl;
+	tp_wma_handle wma_handle = cds_get_context(QDF_MODULE_ID_WMA);
+
+	tgt_hdl = wlan_psoc_get_tgt_if_handle(wma_handle->psoc);
+	if (!tgt_hdl) {
+		WMA_LOGE("%s: target psoc info is NULL", __func__);
+		return QDF_STATUS_E_INVAL;
+	}
+
+	total_mac_phy_cnt = target_psoc_get_total_mac_phy_cnt(tgt_hdl);
+	if (total_mac_phy_cnt <= pdev_id) {
+		WMA_LOGE("%s: mac phy cnt %d, pdev id %d", __func__,
+			 total_mac_phy_cnt, pdev_id);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	mac_phy_cap = target_psoc_get_mac_phy_cap(tgt_hdl);
+	*chainmask_2g = mac_phy_cap[pdev_id].rx_chain_mask_2G;
+	*chainmask_5g = mac_phy_cap[pdev_id].rx_chain_mask_5G;
+	WMA_LOGD("%s, pdev id: %d, rx chainmask 2g:%d, rx chainmask 5g:%d",
+		 __func__, pdev_id, *chainmask_2g, *chainmask_5g);
+
+	return QDF_STATUS_SUCCESS;
+}