Forráskód Böngészése

qcacmn: Add target_if changes for host DFS confirmation check

Register for host dfs check event.

Change-Id: I7d6a87e9a6d7e4a4b7a127e05d230b876581bb12
CRs-Fixed: 2211883
Vignesh U 7 éve
szülő
commit
4159e623b5

+ 47 - 3
target_if/dfs/inc/target_if_dfs_partial_offload.h

@@ -50,10 +50,54 @@ target_if_dfs_reg_phyerr_events(struct wlan_objmgr_psoc *psoc)
  */
 #if defined(WLAN_DFS_PARTIAL_OFFLOAD)
 QDF_STATUS target_if_dfs_get_caps(struct wlan_objmgr_pdev *pdev,
-		struct wlan_dfs_caps *dfs_caps);
+				  struct wlan_dfs_caps *dfs_caps);
 #else
-static QDF_STATUS target_if_dfs_get_caps(struct wlan_objmgr_pdev *pdev,
-		struct wlan_dfs_caps *dfs_caps)
+static inline QDF_STATUS target_if_dfs_get_caps(struct wlan_objmgr_pdev *pdev,
+						struct wlan_dfs_caps *dfs_caps)
+{
+	return QDF_STATUS_SUCCESS;
+}
+#endif
+
+/**
+ * target_if_dfs_status_check_event_handler() - Host dfs confirmation event
+ * handler.
+ * @scn: Handle to HIF context
+ * @data: radar event buffer
+ * @datalen: radar event buffer length
+ *
+ * Return: 0 on success
+ */
+#if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST)
+int target_if_dfs_status_check_event_handler(ol_scn_t scn,
+					     uint8_t *data,
+					     uint32_t datalen);
+#else
+static inline
+int target_if_dfs_status_check_event_handler(ol_scn_t scn,
+					     uint8_t *data,
+					     uint32_t datalen)
+{
+	return 0;
+}
+#endif
+
+/**
+ * target_if_dfs_send_avg_params_to_fw() - Send average parameters to FW.
+ * @pdev: pdev pointer
+ * @params: Pointer to dfs_radar_found_params structure.
+ *
+ * Return: QDF_STATUS
+ */
+#if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST)
+QDF_STATUS target_if_dfs_send_avg_params_to_fw(
+		struct wlan_objmgr_pdev *pdev,
+		struct dfs_radar_found_params *params);
+#else
+static inline
+QDF_STATUS target_if_dfs_send_avg_params_to_fw(
+		struct wlan_objmgr_pdev *pdev,
+		struct dfs_radar_found_params *params)
 {
 	return QDF_STATUS_SUCCESS;
 }

+ 43 - 0
target_if/dfs/src/target_if_dfs.c

@@ -40,6 +40,44 @@
 #include <target_if_dfs_full_offload.h>
 #include <target_if_dfs_partial_offload.h>
 
+/**
+ * target_if_dfs_register_host_status_check_event() - Register host dfs
+ * confirmation event.
+ * @psoc: pointer to psoc.
+ *
+ * Return: QDF_STATUS.
+ */
+#if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST)
+static QDF_STATUS target_if_dfs_register_host_status_check_event(
+		struct wlan_objmgr_psoc *psoc)
+
+{
+	wmi_unified_t wmi_handle;
+	QDF_STATUS retval;
+
+	wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
+	if (!wmi_handle) {
+		target_if_err("null wmi_handle");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	retval = wmi_unified_register_event(wmi_handle,
+			wmi_host_dfs_status_check_event_id,
+			target_if_dfs_status_check_event_handler);
+	if (QDF_IS_STATUS_ERROR(retval))
+		target_if_err("wmi_dfs_radar_detection_event_id ret=%d",
+			      retval);
+
+	return retval;
+}
+#else
+static QDF_STATUS target_if_dfs_register_host_status_check_event(
+		struct wlan_objmgr_psoc *psoc)
+{
+	return QDF_STATUS_SUCCESS;
+}
+#endif
+
 /**
  * target_if_is_dfs_3() - Is dfs3 support or not
  * @target_type: target type being used.
@@ -174,6 +212,9 @@ static QDF_STATUS target_if_dfs_register_event_handler(
 			target_if_err("null tgt_psoc_info");
 			return QDF_STATUS_E_FAILURE;
 		}
+
+		target_if_dfs_register_host_status_check_event(psoc);
+
 		if (target_if_is_dfs_3(
 				target_psoc_get_target_type(tgt_psoc_info)))
 			return target_if_dfs_reg_phyerr_events(psoc);
@@ -316,6 +357,8 @@ QDF_STATUS target_if_register_dfs_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops)
 				&target_if_dfs_set_phyerr_filter_offload;
 
 	dfs_tx_ops->dfs_get_caps = &target_if_dfs_get_caps;
+	dfs_tx_ops->dfs_send_avg_radar_params_to_fw =
+		&target_if_dfs_send_avg_params_to_fw;
 
 	return QDF_STATUS_SUCCESS;
 }

+ 99 - 0
target_if/dfs/src/target_if_dfs_partial_offload.c

@@ -25,6 +25,7 @@
 #include <target_if.h>
 #include "target_type.h"
 #include "target_if_dfs_partial_offload.h"
+#include "target_if_dfs.h"
 
 QDF_STATUS target_if_dfs_reg_phyerr_events(struct wlan_objmgr_psoc *psoc)
 {
@@ -87,3 +88,101 @@ QDF_STATUS target_if_dfs_get_caps(struct wlan_objmgr_pdev *pdev,
 
 	return QDF_STATUS_SUCCESS;
 }
+
+#if defined(HOST_DFS_SPOOF_TEST)
+QDF_STATUS target_if_dfs_send_avg_params_to_fw(
+		struct wlan_objmgr_pdev *pdev,
+		struct dfs_radar_found_params *params)
+{
+	QDF_STATUS status;
+	wmi_unified_t wmi_handle;
+
+	if (!pdev) {
+		target_if_err("null pdev");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	wmi_handle = get_wmi_unified_hdl_from_pdev(pdev);
+	if (!wmi_handle) {
+		target_if_err("null wmi_handle");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	status = wmi_unified_dfs_send_avg_params_cmd(wmi_handle,
+						     params);
+	if (QDF_IS_STATUS_ERROR(status))
+		target_if_err("dfs radar found average parameters send failed: %d",
+			      status);
+
+	return status;
+}
+
+int target_if_dfs_status_check_event_handler(ol_scn_t scn,
+					     uint8_t *data,
+					     uint32_t datalen)
+{
+	struct wlan_objmgr_psoc *psoc;
+	struct wlan_objmgr_pdev *pdev;
+	struct wlan_lmac_if_dfs_rx_ops *dfs_rx_ops;
+	u_int32_t dfs_status_check;
+	wmi_unified_t wmi_hdl;
+
+	if (!scn || !data) {
+		target_if_err("scn: %pK, data: %pK", scn, data);
+		return -EINVAL;
+	}
+
+	psoc = target_if_get_psoc_from_scn_hdl(scn);
+	if (!psoc) {
+		target_if_err("null psoc");
+		return -EINVAL;
+	}
+
+	/* Since Partial Offload chipsets have only one pdev per psoc, the first
+	 * pdev from the pdev list is used.
+	 */
+	pdev = wlan_objmgr_get_pdev_by_id(psoc, 0, WLAN_DFS_ID);
+	if (!pdev) {
+		target_if_err("null pdev");
+		return -EINVAL;
+	}
+
+	dfs_rx_ops = target_if_dfs_get_rx_ops(psoc);
+	if (!dfs_rx_ops) {
+		target_if_err("null dfs_rx_ops");
+		wlan_objmgr_pdev_release_ref(pdev, WLAN_DFS_ID);
+		return -EINVAL;
+	}
+
+	if (!dfs_rx_ops->dfs_action_on_status) {
+		target_if_err("dfs_rx_ops->dfs_action_on_status is NULL");
+		wlan_objmgr_pdev_release_ref(pdev, WLAN_DFS_ID);
+		return -EINVAL;
+	}
+
+	wmi_hdl = get_wmi_unified_hdl_from_pdev(pdev);
+	if (!wmi_hdl) {
+		target_if_err("wmi_hdl is NULL");
+		wlan_objmgr_pdev_release_ref(pdev, WLAN_DFS_ID);
+		return -EINVAL;
+	}
+
+	if (wmi_extract_dfs_status_from_fw(wmi_hdl, data, &dfs_status_check) !=
+			QDF_STATUS_SUCCESS) {
+		target_if_err("failed to extract status response from FW");
+		wlan_objmgr_pdev_release_ref(pdev, WLAN_DFS_ID);
+		return -EINVAL;
+	}
+
+	if (dfs_rx_ops->dfs_action_on_status(pdev, &dfs_status_check) !=
+		QDF_STATUS_SUCCESS) {
+		target_if_err("dfs action on host dfs status from FW failed");
+		wlan_objmgr_pdev_release_ref(pdev, WLAN_DFS_ID);
+		return -EINVAL;
+	}
+
+	wlan_objmgr_pdev_release_ref(pdev, WLAN_DFS_ID);
+
+	return 0;
+}
+#endif