Prechádzať zdrojové kódy

qcacmn: Add support for bangradar for hawkeye

Add support for bangradar command to send unit test command
to firmware as a hook to simulate radar injection

Change-Id: Ieaa7eab6d452ab864a10beca1478d0e61d605107
CRs-fixed: 2113724
Shaakir Mohamed 7 rokov pred
rodič
commit
a1a7e163af

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

@@ -26,12 +26,14 @@
 #include <qdf_types.h>
 #include <qdf_status.h>
 #include <target_if_dfs.h>
+#include <wlan_module_ids.h>
 #include <wmi_unified_api.h>
 #include <wlan_lmac_if_def.h>
 #include <wmi_unified_priv.h>
 #include <wlan_scan_tgt_api.h>
 #include <wmi_unified_param.h>
 #include <wmi_unified_dfs_api.h>
+#include "wlan_dfs_tgt_api.h"
 
 static inline struct wlan_lmac_if_dfs_rx_ops *
 target_if_dfs_get_rx_ops(struct wlan_objmgr_psoc *psoc)
@@ -196,6 +198,37 @@ static QDF_STATUS target_if_dfs_register_event_handler(
 	return status;
 }
 
+static QDF_STATUS target_process_bang_radar_cmd(
+		struct wlan_objmgr_pdev *pdev,
+		struct dfs_emulate_bang_radar_test_cmd *dfs_unit_test)
+{
+	QDF_STATUS status = QDF_STATUS_SUCCESS;
+	struct wmi_unit_test_cmd wmi_utest;
+	int i;
+	wmi_unified_t wmi_handle;
+
+	wmi_handle = (wmi_unified_t) pdev->tgt_if_handle;
+
+	wmi_utest.vdev_id = dfs_unit_test->vdev_id;
+	wmi_utest.module_id = WLAN_MODULE_PHYERR_DFS;
+	wmi_utest.num_args = dfs_unit_test->num_args;
+
+	for (i = 0; i < dfs_unit_test->num_args; i++)
+		wmi_utest.args[i] = dfs_unit_test->args[i];
+	/*
+	 * Host to Target  conversion for pdev id required
+	 * before we send a wmi unit test command
+	 */
+	wmi_utest.args[IDX_PDEV_ID] = wmi_handle->ops->
+		convert_pdev_id_host_to_target(pdev->pdev_objmgr.wlan_pdev_id);
+
+	status = wmi_unified_unit_test_cmd(pdev->tgt_if_handle, &wmi_utest);
+	if (!QDF_IS_STATUS_SUCCESS(status))
+		target_if_err("dfs: unit_test_cmd send failed %d", status);
+
+	return status;
+}
+
 QDF_STATUS target_if_register_dfs_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops)
 {
 	struct wlan_lmac_if_dfs_tx_ops *dfs_tx_ops;
@@ -208,5 +241,8 @@ QDF_STATUS target_if_register_dfs_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops)
 	dfs_tx_ops = &tx_ops->dfs_tx_ops;
 	dfs_tx_ops->dfs_reg_ev_handler = &target_if_dfs_register_event_handler;
 
+	dfs_tx_ops->dfs_process_emulate_bang_radar_cmd =
+						&target_process_bang_radar_cmd;
+
 	return QDF_STATUS_SUCCESS;
 }

+ 37 - 2
umac/dfs/core/src/misc/dfs.c

@@ -25,6 +25,7 @@
 #include "../dfs_zero_cac.h"
 #include "wlan_dfs_lmac_api.h"
 #include "wlan_dfs_mlme_api.h"
+#include "wlan_dfs_tgt_api.h"
 #include "../dfs_internal.h"
 #include <dfs_ioctl.h>
 
@@ -87,6 +88,29 @@ static os_timer_func(dfs_testtimer_task)
 	dfs_mlme_start_csa(dfs->dfs_pdev_obj, dfs->wlan_dfstest_ieeechan);
 }
 
+static inline int dfs_fill_emulate_bang_radar_test(struct wlan_dfs *dfs,
+		uint32_t segid,
+		struct dfs_emulate_bang_radar_test_cmd *dfs_unit_test)
+{
+	/*
+	 * More parameters are to be added later indicating
+	 * seg id, chirp and sidx values to be sent to fw.
+	 */
+	dfs_unit_test->num_args = DFS_UNIT_TEST_NUM_ARGS;
+	dfs_unit_test->args[IDX_CMD_ID] =
+			DFS_PHYERR_OFFLOAD_TEST_SET_RADAR;
+	dfs_unit_test->args[IDX_PDEV_ID] =
+			wlan_objmgr_pdev_get_pdev_id(dfs->dfs_pdev_obj);
+	dfs_unit_test->args[IDX_SEG_ID] = segid;
+
+	if (tgt_dfs_process_emulate_bang_radar_cmd(dfs->dfs_pdev_obj,
+				dfs_unit_test) == QDF_STATUS_E_FAILURE) {
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
 int dfs_get_debug_info(struct wlan_dfs *dfs, void *data)
 {
 	if (data)
@@ -646,6 +670,9 @@ int dfs_control(struct wlan_dfs *dfs,
 	struct dfsreq_nolinfo *nol;
 	uint32_t *data = NULL;
 	int i;
+	struct dfs_emulate_bang_radar_test_cmd dfs_unit_test;
+
+	qdf_mem_zero(&dfs_unit_test, sizeof(dfs_unit_test));
 
 	/* dfs is dereferenced (dfs->dfs_ignore_dfs) when dfs is NULL */
 	if (!dfs) {
@@ -939,7 +966,11 @@ int dfs_control(struct wlan_dfs *dfs,
 		dfs_print_nolhistory(dfs);
 		break;
 	case DFS_BANGRADAR:
-		if (!dfs->dfs_is_offload_enabled) {
+		if (dfs->dfs_is_offload_enabled) {
+			error = dfs_fill_emulate_bang_radar_test(dfs,
+					SEG_ID_PRIMARY,
+					&dfs_unit_test);
+		} else {
 			dfs->dfs_bangradar = 1;
 			dfs->wlan_radar_tasksched = 1;
 			qdf_timer_mod(&dfs->wlan_dfs_task_timer, 0);
@@ -953,7 +984,11 @@ int dfs_control(struct wlan_dfs *dfs,
 		dfs_reset_precac_lists(dfs);
 		break;
 	case DFS_SECOND_SEGMENT_BANGRADAR:
-		if (!dfs->dfs_is_offload_enabled) {
+		if (dfs->dfs_is_offload_enabled) {
+			error = dfs_fill_emulate_bang_radar_test(dfs,
+					SEG_ID_SECONDARY,
+					&dfs_unit_test);
+		} else {
 			dfs->dfs_second_segment_bangradar = 1;
 			dfs->wlan_radar_tasksched = 1;
 			qdf_timer_mod(&dfs->wlan_dfs_task_timer, 0);

+ 50 - 2
umac/dfs/dispatcher/inc/wlan_dfs_tgt_api.h

@@ -25,8 +25,43 @@
 #ifndef _WLAN_DFS_TGT_API_H_
 #define _WLAN_DFS_TGT_API_H_
 
-#include "wlan_dfs_ucfg_api.h"
-#include "wlan_dfs_utils_api.h"
+/* Max number arguments for DFS unit test command */
+#define DFS_MAX_NUM_UNIT_TEST_ARGS 3
+
+/* Command id to send test radar to firmware */
+#define DFS_PHYERR_OFFLOAD_TEST_SET_RADAR 0
+
+/* Number of arguments for  DFS unit test command */
+#define DFS_UNIT_TEST_NUM_ARGS 3
+
+/* Segment ID corresponding to primary segment */
+#define SEG_ID_PRIMARY 0
+
+/* Segment ID corresponding to secondary segment */
+#define SEG_ID_SECONDARY 1
+
+/* Index id pointing to command id value */
+#define IDX_CMD_ID 0
+
+/* Index id pointing to pdev id value */
+#define IDX_PDEV_ID 1
+
+/* Index pointing to segment id value */
+#define IDX_SEG_ID 2
+
+/**
+ * struct dfs_emulate_bang_radar_test_cmd - Unit test command structure to send
+ *                                          WMI command to firmware from host
+ *                                          and simulate bangradar event.
+ * @vdev_id: vdev id
+ * @num_args: number of arguments
+ * @args: arguments
+ */
+struct dfs_emulate_bang_radar_test_cmd {
+	uint32_t vdev_id;
+	uint32_t num_args;
+	uint32_t args[DFS_MAX_NUM_UNIT_TEST_ARGS];
+};
 
 extern struct dfs_to_mlme global_dfs_to_mlme;
 
@@ -191,4 +226,17 @@ QDF_STATUS tgt_dfs_reg_ev_handler(struct wlan_objmgr_psoc *psoc,
  * @dfs: Pointer to wlan_dfs structure.
  */
 QDF_STATUS tgt_dfs_stop(struct wlan_objmgr_pdev *pdev);
+
+/**
+* tgt_dfs_process_emulate_bang_radar_cmd() - Process to emulate dfs bangradar
+*                                            command.
+* @pdev: Pointer to DFS pdev object.
+*
+* Process  to emulate dfs bangradar command.
+*
+* Return: QDF_STATUS.
+*/
+QDF_STATUS tgt_dfs_process_emulate_bang_radar_cmd(struct wlan_objmgr_pdev *pdev,
+		struct dfs_emulate_bang_radar_test_cmd *dfs_unit_test);
+
 #endif /* _WLAN_DFS_TGT_API_H_ */

+ 25 - 0
umac/dfs/dispatcher/src/wlan_dfs_tgt_api.c

@@ -21,6 +21,7 @@
  * DOC: This file has the DFS dispatcher API implementation which is exposed
  * to outside of DFS component.
  */
+#include <wlan_objmgr_pdev_obj.h>
 #include "wlan_dfs_tgt_api.h"
 #include "wlan_lmac_if_def.h"
 #include "wlan_lmac_if_api.h"
@@ -314,3 +315,27 @@ QDF_STATUS tgt_dfs_stop(struct wlan_objmgr_pdev *pdev)
 	return QDF_STATUS_SUCCESS;
 }
 EXPORT_SYMBOL(tgt_dfs_stop);
+
+QDF_STATUS tgt_dfs_process_emulate_bang_radar_cmd(struct wlan_objmgr_pdev *pdev,
+		struct dfs_emulate_bang_radar_test_cmd *dfs_unit_test)
+{
+	struct wlan_objmgr_psoc *psoc;
+	struct wlan_lmac_if_dfs_tx_ops *dfs_tx_ops;
+
+	psoc = wlan_pdev_get_psoc(pdev);
+	if (!psoc) {
+		dfs_err(NULL, WLAN_DEBUG_DFS_ALWAYS,  "psoc is null");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	dfs_tx_ops = wlan_psoc_get_dfs_txops(psoc);
+	if (dfs_tx_ops && dfs_tx_ops->dfs_process_emulate_bang_radar_cmd)
+		return dfs_tx_ops->dfs_process_emulate_bang_radar_cmd(pdev,
+				dfs_unit_test);
+	else
+		dfs_err(NULL, WLAN_DEBUG_DFS_ALWAYS,
+				"dfs_tx_ops=%p", dfs_tx_ops);
+
+	return QDF_STATUS_E_FAILURE;
+}
+EXPORT_SYMBOL(tgt_dfs_process_emulate_bang_radar_cmd);

+ 21 - 12
umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h

@@ -46,6 +46,8 @@
 #include "wlan_crypto_global_def.h"
 #endif
 
+#include <wlan_dfs_tgt_api.h>
+
 /* Number of dev type: Direct attach and Offload */
 #define MAX_DEV_TYPE 2
 
@@ -432,18 +434,22 @@ struct wlan_lmac_if_reg_tx_ops {
 /**
  * struct wlan_lmac_if_dfs_tx_ops - Function pointer to call offload/lmac
  *                                  functions from DFS module.
- * @dfs_enable:                    Enable DFS.
- * @dfs_get_caps:                  Get DFS capabilities.
- * @dfs_disable:                   Disable DFS
- * @dfs_gettsf64:                  Get tsf64 value.
- * @dfs_set_use_cac_prssi:         Set use_cac_prssi value.
- * @dfs_get_thresholds:            Get thresholds.
- * @dfs_get_ext_busy:              Get ext_busy.
- * @dfs_get_target_type:           Get target type.
- * @dfs_is_mode_offload:           Check the radio for offload.
- * @dfs_get_ah_devid:              Get ah devid.
- * @dfs_get_phymode_info:          Get phymode info.
- * @dfs_reg_ev_handler:            Register dfs event handler.
+ * @dfs_enable:                         Enable DFS.
+ * @dfs_get_caps:                       Get DFS capabilities.
+ * @dfs_disable:                        Disable DFS
+ * @dfs_gettsf64:                       Get tsf64 value.
+ * @dfs_set_use_cac_prssi:              Set use_cac_prssi value.
+ * @dfs_get_dfsdomain:                  Get DFS domain.
+ * @dfs_is_countryCode_CHINA:           Check is country code CHINA.
+ * @dfs_get_thresholds:                 Get thresholds.
+ * @dfs_get_ext_busy:                   Get ext_busy.
+ * @dfs_get_target_type:                Get target type.
+ * @dfs_is_countryCode_KOREA_ROC3:      Check is county code Korea.
+ * @dfs_is_mode_offload:                Check the radio for offload.
+ * @dfs_get_ah_devid:                   Get ah devid.
+ * @dfs_get_phymode_info:               Get phymode info.
+ * @dfs_reg_ev_handler:                 Register dfs event handler.
+ * @dfs_process_emulate_bang_radar_cmd: Process emulate bang radar test command.
  */
 
 struct wlan_lmac_if_dfs_tx_ops {
@@ -495,6 +501,9 @@ struct wlan_lmac_if_dfs_tx_ops {
 			uint32_t *mode_info);
 	QDF_STATUS (*dfs_reg_ev_handler)(struct wlan_objmgr_pdev *pdev,
 			bool dfs_offload);
+	QDF_STATUS (*dfs_process_emulate_bang_radar_cmd)(
+			struct wlan_objmgr_pdev *pdev,
+			struct dfs_emulate_bang_radar_test_cmd *dfs_unit_test);
 };
 
 /**