Ver Fonte

qcacld-3.0: Enable spectral scan vendor support

Enable spectral scan vendor command support.
Add legacy callback API's to support common spectral
component.

Change-Id: I6361fd8cb989b4c8a9b73074155629ddc8a3b465
CRs-Fixed: 2172214
Sandeep Puligilla há 7 anos atrás
pai
commit
063a434073

+ 2 - 2
core/hdd/src/wlan_hdd_cfg80211.c

@@ -112,7 +112,7 @@
 #include "wlan_utility.h"
 #include "wlan_reg_ucfg_api.h"
 #include "wifi_pos_api.h"
-
+#include "wlan_hdd_spectralscan.h"
 #define g_mode_rates_size (12)
 #define a_mode_rates_size (8)
 
@@ -13534,7 +13534,7 @@ const struct wiphy_vendor_command hdd_wiphy_vendor_commands[] = {
 			 WIPHY_VENDOR_CMD_NEED_RUNNING,
 		.doit = wlan_hdd_cfg80211_fetch_bss_transition_status
 	},
-
+	FEATURE_SPECTRAL_SCAN_VENDOR_COMMANDS
 #ifdef WLAN_UMAC_CONVERGENCE
 	COMMON_VENDOR_COMMANDS
 #endif

+ 25 - 0
core/sme/inc/sme_api.h

@@ -1993,6 +1993,31 @@ int sme_get_bss_transition_status(tHalHandle hal,
 uint32_t sme_unpack_rsn_ie(tHalHandle hal, uint8_t *buf,
 				  uint8_t buf_len, tDot11fIERSN *rsn_ie,
 				  bool append_ie);
+/**
+ * sme_get_oper_chan_freq - gets the operating channel freq
+ * @vdev: vdev handle
+ *
+ * Return: operating channel frequency
+ */
+int16_t sme_get_oper_chan_freq(struct wlan_objmgr_vdev *vdev);
+
+/**
+ * sme_get_oper_ch_width - gets the operating channel width
+ * @vdev: vdev handle
+ *
+ * Return: operating channel width
+ */
+enum phy_ch_width sme_get_oper_ch_width(struct wlan_objmgr_vdev *vdev);
+
+/**
+ * sme_get_oper_ch_width - gets the secondary channel frequency
+ * @vdev: vdev handle
+ * @sec20chan_freq: secondary channel frequency
+ *
+ * Return: secondary channel frequency
+ */
+int sme_get_sec20chan_freq_mhz(struct wlan_objmgr_vdev *vdev,
+						uint16_t *sec20chan_freq);
 
 /**
  * sme_enable_roaming_on_connected_sta() - Enable roaming on an connected sta

+ 73 - 0
core/sme/src/common/sme_api.c

@@ -65,6 +65,7 @@
 #include "wifi_pos_api.h"
 #include "net/cfg80211.h"
 #include <qca_vendor.h>
+#include <wlan_spectral_utils_api.h>
 
 static tSelfRecoveryStats g_self_recovery_stats;
 
@@ -1239,6 +1240,7 @@ QDF_STATUS sme_start(tHalHandle hHal)
 	QDF_STATUS status = QDF_STATUS_E_FAILURE;
 	tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
 	struct policy_mgr_sme_cbacks sme_cbacks;
+	struct spectral_legacy_cbacks spectral_cb;
 
 	do {
 		status = csr_start(pMac);
@@ -1264,6 +1266,10 @@ QDF_STATUS sme_start(tHalHandle hHal)
 				status);
 			break;
 		}
+		spectral_cb.vdev_get_chan_freq = sme_get_oper_chan_freq;
+		spectral_cb.vdev_get_ch_width = sme_get_oper_ch_width;
+		spectral_cb.vdev_get_sec20chan_freq_mhz = sme_get_sec20chan_freq_mhz;
+		spectral_register_legacy_cb(pMac->psoc, &spectral_cb);
 		pMac->sme.state = SME_STATE_START;
 
 		/* START RRM */
@@ -15913,6 +15919,73 @@ void sme_enable_roaming_on_connected_sta(tHalHandle hal)
 				      REASON_CTX_INIT);
 		sme_release_global_lock(&mac_ctx->sme);
 	}
+}
+
+int16_t sme_get_oper_chan_freq(struct wlan_objmgr_vdev *vdev)
+{
+	uint8_t vdev_id, chan;
+	struct csr_roam_session *session;
+	tpAniSirGlobal mac_ctx;
+	tHalHandle h_hal;
+	int16_t freq = 0;
+
+	if (vdev == NULL) {
+		sme_err("Invalid vdev id is passed");
+		return 0;
+	}
 
+	h_hal = cds_get_context(QDF_MODULE_ID_SME);
+	mac_ctx = PMAC_STRUCT(h_hal);
+	vdev_id = wlan_vdev_get_id(vdev);
+	if (!CSR_IS_SESSION_VALID(mac_ctx, vdev_id)) {
+		sme_err("Invalid vdev id is passed");
+		return 0;
+	}
+
+	session = CSR_GET_SESSION(mac_ctx, vdev_id);
+	chan = csr_get_infra_operation_channel(mac_ctx, vdev_id);
+	if (chan)
+		freq = cds_chan_to_freq(chan);
+
+	return freq;
+}
+
+enum phy_ch_width sme_get_oper_ch_width(struct wlan_objmgr_vdev *vdev)
+{
+	uint8_t vdev_id;
+	struct csr_roam_session *session;
+	tpAniSirGlobal mac_ctx;
+	tHalHandle h_hal;
+	enum phy_ch_width ch_width = CH_WIDTH_20MHZ;
+
+	if (vdev == NULL) {
+		sme_err("Invalid vdev id is passed");
+		return CH_WIDTH_INVALID;
+	}
+
+	h_hal = cds_get_context(QDF_MODULE_ID_SME);
+	mac_ctx = PMAC_STRUCT(h_hal);
+	vdev_id = wlan_vdev_get_id(vdev);
+	if (!CSR_IS_SESSION_VALID(mac_ctx, vdev_id)) {
+		sme_err("Invalid vdev id is passed");
+		return CH_WIDTH_INVALID;
+	}
+
+	session = CSR_GET_SESSION(mac_ctx, vdev_id);
+
+	if (csr_is_conn_state_connected(mac_ctx, vdev_id))
+		ch_width = session->connectedProfile.vht_channel_width;
+
+	return ch_width;
+}
+
+int sme_get_sec20chan_freq_mhz(struct wlan_objmgr_vdev *vdev,
+						uint16_t *sec20chan_freq)
+{
+	uint8_t vdev_id;
+
+	vdev_id = wlan_vdev_get_id(vdev);
+	/* Need to extend */
+	return 0;
 }
 

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

@@ -93,6 +93,8 @@
 #include <wlan_pmo_ucfg_api.h>
 #include "wifi_pos_api.h"
 #include "hif_main.h"
+#include <target_if_spectral.h>
+#include <wlan_spectral_utils_api.h>
 
 #define WMA_LOG_COMPLETION_TIMER 3000 /* 3 seconds */
 #define WMI_TLV_HEADROOM 128
@@ -3478,6 +3480,7 @@ QDF_STATUS wma_start(void)
 	QDF_STATUS qdf_status = QDF_STATUS_SUCCESS;
 	tp_wma_handle wma_handle;
 	int status;
+	struct wmi_spectral_cmd_ops cmd_ops;
 
 	WMA_LOGD("%s: Enter", __func__);
 
@@ -3698,6 +3701,11 @@ QDF_STATUS wma_start(void)
 		qdf_status = QDF_STATUS_E_FAILURE;
 		goto end;
 	}
+	cmd_ops.wmi_spectral_configure_cmd_send =
+			wmi_unified_vdev_spectral_configure_cmd_send;
+	cmd_ops.wmi_spectral_enable_cmd_send =
+			wmi_unified_vdev_spectral_enable_cmd_send;
+	wlan_register_wmi_spectral_cmd_ops(wma_handle->pdev, &cmd_ops);
 
 end:
 	WMA_LOGD("%s: Exit", __func__);