Переглянути джерело

qcacmn: Move DFS_BANGRADAR from common code to WIN

Remove the following functions from Common dev to component-dev:
1) dfs_bangradar
2) dfs_start_host_based_bangradar
3) dfs_fill_emulate_bang_radar_test
4) dfs_check_bangradar_sanity
5) dfs_start_host_based_bangradar

CRs-Fixed: 2829438
Change-Id: I5d3564bcb89e60629ee7fddc9827e03e9d9da6a2
Vijay Krishnan 4 роки тому
батько
коміт
7136aa40cb

+ 17 - 0
umac/dfs/core/src/dfs.h

@@ -3032,6 +3032,23 @@ uint8_t dfs_find_dfs_sub_channels_for_freq(struct  wlan_dfs *dfs,
 					   struct dfs_channel *chan,
 					   uint16_t *subchan_arr);
 
+#ifdef QCA_DFS_BANGRADAR
+/**
+ * dfs_bangradar() - Handles all type of Bangradar.
+ * @dfs: Pointer to wlan_dfs structure.
+ * @indata: reference to input data
+ * @insize:  input data size
+ *
+ */
+int dfs_bang_radar(struct wlan_dfs *dfs, void *indata, uint32_t insize);
+#else
+static inline int
+dfs_bang_radar(struct wlan_dfs *dfs, void *indata, uint32_t insize)
+{
+	return 0;
+}
+#endif
+
 #ifdef QCA_SUPPORT_DFS_CHAN_POSTNOL
 /**
  * dfs_set_postnol_freq() - DFS API to set postNOL frequency.

+ 0 - 14
umac/dfs/core/src/dfs_filter_init.h

@@ -50,20 +50,6 @@ static inline void dfs_main_detach(struct wlan_dfs *dfs)
 }
 #endif
 
-/**
- * dfs_start_host_based_bangradar() - Mark as bangradar and start
- * wlan_dfs_task_timer.
- * @dfs: Pointer to wlan_dfs structure.
- */
-#if defined(WLAN_DFS_PARTIAL_OFFLOAD)
-int dfs_start_host_based_bangradar(struct wlan_dfs *dfs);
-#else
-static inline int dfs_start_host_based_bangradar(struct wlan_dfs *dfs)
-{
-	return 0;
-}
-#endif
-
 /**
  * dfs_main_timer_reset() - Stop dfs timers.
  * @dfs: Pointer to wlan_dfs structure.

+ 0 - 49
umac/dfs/core/src/dfs_full_offload.h

@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved.
- *
- *
- * Permission to use, copy, modify, and/or distribute this software for
- * any purpose with or without fee is hereby granted, provided that the
- * above copyright notice and this permission notice appear in all
- * copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
- * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
- * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-/**
- * DOC: dfs_full_offload.h
- * This file contains full offload specific dfs interfaces
- */
-
-#ifndef _DFS_FULL_OFFLOAD_H_
-#define _DFS_FULL_OFFLOAD_H_
-
-#if defined(WLAN_DFS_FULL_OFFLOAD)
-
-/**
- * dfs_fill_emulate_bang_radar_test() - Update dfs unit test arguments and
- * send bangradar command to firmware.
- * @dfs: Pointer to wlan_dfs structure.
- * @bangradar_params: Parameters of the radar to be simulated.
- *
- * Return: If the event is received return 0.
- */
-int
-dfs_fill_emulate_bang_radar_test(struct wlan_dfs *dfs,
-				 struct dfs_bangradar_params *bangradar_params);
-#else
-static inline int
-dfs_fill_emulate_bang_radar_test(struct wlan_dfs *dfs,
-				 struct dfs_bangradar_params *bangradar_params)
-{
-	return 0;
-}
-#endif
-#endif /* _DFS_FULL_OFFLOAD_H_ */

+ 1 - 83
umac/dfs/core/src/misc/dfs.c

@@ -28,7 +28,6 @@
 #include "wlan_dfs_tgt_api.h"
 #include "../dfs_internal.h"
 #include "../dfs_filter_init.h"
-#include "../dfs_full_offload.h"
 #include <wlan_objmgr_vdev_obj.h>
 #include "wlan_dfs_utils_api.h"
 #include "../dfs_process_radar_found_ind.h"
@@ -354,42 +353,6 @@ static inline bool dfs_get_disable_radar_marking(struct wlan_dfs *dfs)
 }
 #endif
 
-static QDF_STATUS
-dfs_check_bangradar_sanity(struct wlan_dfs *dfs,
-			   struct dfs_bangradar_params *bangradar_params)
-{
-	if (!bangradar_params) {
-		dfs_debug(dfs, WLAN_DEBUG_DFS_ALWAYS,
-			  "bangradar params is NULL");
-		return -EINVAL;
-	}
-	if (dfs_is_true_160mhz_supported(dfs)) {
-		if (abs(bangradar_params->freq_offset) >
-		    FREQ_OFFSET_BOUNDARY_FOR_160MHZ) {
-			dfs_debug(dfs, WLAN_DEBUG_DFS_ALWAYS,
-				  "Frequency Offset out of bound");
-			return -EINVAL;
-		}
-	} else if (abs(bangradar_params->freq_offset) >
-		   FREQ_OFFSET_BOUNDARY_FOR_80MHZ) {
-		dfs_debug(dfs, WLAN_DEBUG_DFS_ALWAYS,
-			  "Frequency Offset out of bound");
-		return -EINVAL;
-	}
-	if (bangradar_params->seg_id > SEG_ID_SECONDARY) {
-		dfs_debug(dfs, WLAN_DEBUG_DFS_ALWAYS, "Invalid segment ID");
-		return -EINVAL;
-	}
-	if ((bangradar_params->detector_id > dfs_get_agile_detector_id(dfs)) ||
-	    ((bangradar_params->detector_id ==
-	      dfs_get_agile_detector_id(dfs)) &&
-	      !dfs->dfs_is_offload_enabled)) {
-		dfs_debug(dfs, WLAN_DEBUG_DFS_ALWAYS, "Invalid detector ID");
-		return -EINVAL;
-	}
-	return QDF_STATUS_SUCCESS;
-}
-
 int dfs_control(struct wlan_dfs *dfs,
 		u_int id,
 		void *indata,
@@ -399,7 +362,6 @@ int dfs_control(struct wlan_dfs *dfs,
 {
 	struct wlan_dfs_phyerr_param peout;
 	struct dfs_ioctl_params *dfsparams;
-	struct dfs_bangradar_params *bangradar_params;
 	int error = 0;
 	uint32_t val = 0;
 	struct dfsreq_nolinfo *nol;
@@ -452,51 +414,7 @@ int dfs_control(struct wlan_dfs *dfs,
 			error = -EINVAL;
 		break;
 	case DFS_BANGRADAR:
-		/*
-		 * Handle all types of Bangradar here.
-		 * Bangradar arguments:
-		 * seg_id      : Segment ID where radar should be injected.
-		 * is_chirp    : Is chirp radar or non chirp radar.
-		 * freq_offset : Frequency offset from center frequency.
-		 *
-		 * Type 1 (DFS_BANGRADAR_FOR_ALL_SUBCHANS): To add all subchans.
-		 * Type 2 (DFS_BANGRADAR_FOR_ALL_SUBCHANS_OF_SEGID): To add all
-		 *               subchans of given segment_id.
-		 * Type 3 (DFS_BANGRADAR_FOR_SPECIFIC_SUBCHANS): To add specific
-		 *               subchans based on the arguments.
-		 *
-		 * The arguments will already be filled in the indata structure
-		 * based on the type.
-		 * If an argument is not specified by user, it will be set to
-		 * default (0) in the indata already and correspondingly,
-		 * the type will change.
-		 */
-		if (insize < sizeof(struct dfs_bangradar_params) ||
-		    !indata) {
-			dfs_debug(dfs, WLAN_DEBUG_DFS1,
-				  "insize = %d, expected = %zu bytes, indata = %pK",
-				  insize,
-				  sizeof(struct dfs_bangradar_params),
-				  indata);
-			error = -EINVAL;
-			break;
-		}
-		bangradar_params = (struct dfs_bangradar_params *)indata;
-		error = dfs_check_bangradar_sanity(dfs, bangradar_params);
-		if (error != QDF_STATUS_SUCCESS)
-			break;
-		dfs->dfs_bangradar_type = bangradar_params->bangradar_type;
-		dfs->dfs_seg_id = bangradar_params->seg_id;
-		dfs->dfs_is_chirp = bangradar_params->is_chirp;
-		dfs->dfs_freq_offset = bangradar_params->freq_offset;
-
-		if (dfs->dfs_is_offload_enabled) {
-			error = dfs_fill_emulate_bang_radar_test(
-					dfs,
-					bangradar_params);
-		} else {
-			error = dfs_start_host_based_bangradar(dfs);
-		}
+		error = dfs_bang_radar(dfs, indata, insize);
 		break;
 	case DFS_GET_THRESH:
 		if (!outdata || !outsize ||

+ 1 - 9
umac/dfs/core/src/misc/dfs_filter_init.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2020 The Linux Foundation. All rights reserved.
  * Copyright (c) 2002-2006, Atheros Communications Inc.
  *
  * Permission to use, copy, modify, and/or distribute this software for any
@@ -413,11 +413,3 @@ void dfs_main_detach(struct wlan_dfs *dfs)
 	WLAN_ARQ_LOCK_DESTROY(dfs);
 	WLAN_DFSEVENTQ_LOCK_DESTROY(dfs);
 }
-
-int dfs_start_host_based_bangradar(struct wlan_dfs *dfs)
-{
-	dfs->wlan_radar_tasksched = 1;
-	qdf_timer_mod(&dfs->wlan_dfs_task_timer, 0);
-
-	return 0;
-}

+ 0 - 74
umac/dfs/core/src/misc/dfs_full_offload.c

@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2016-2020 The Linux Foundation. All rights reserved.
- * Copyright (c) 2002-2006, Atheros Communications Inc.
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/**
- * DOC: This file contains the dfs_fill_emulate_bang_radar_test()
- * which is used to send command to firmware to emulate RADAR found event.
- */
-
-#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_full_offload.h"
-
-#if defined(WLAN_DFS_FULL_OFFLOAD)
-#define ADD_TO_32BYTE(_arg, _shift, _mask) (((_arg) & (_mask)) << (_shift))
-int
-dfs_fill_emulate_bang_radar_test(struct wlan_dfs *dfs,
-				 struct dfs_bangradar_params *bangradar_params)
-{
-	struct dfs_emulate_bang_radar_test_cmd dfs_unit_test;
-	uint32_t packed_args = 0;
-
-	if (!(WLAN_IS_PRIMARY_OR_SECONDARY_CHAN_DFS(dfs->dfs_curchan))) {
-		dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS,
-			"Ignore bangradar on a NON-DFS channel");
-		return -EINVAL;
-	}
-
-	packed_args =
-		ADD_TO_32BYTE(bangradar_params->seg_id,
-			      SEG_ID_SHIFT,
-			      SEG_ID_MASK) |
-		ADD_TO_32BYTE(bangradar_params->is_chirp,
-			      IS_CHIRP_SHIFT,
-			      IS_CHIRP_MASK) |
-		ADD_TO_32BYTE(bangradar_params->freq_offset,
-			      FREQ_OFF_SHIFT,
-			      FREQ_OFFSET_MASK) |
-		ADD_TO_32BYTE(bangradar_params->detector_id,
-			      DET_ID_SHIFT,
-			      DET_ID_MASK);
-
-	qdf_mem_zero(&dfs_unit_test, sizeof(dfs_unit_test));
-	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_RADAR_PARAM1_ID] = packed_args;
-
-	if (tgt_dfs_process_emulate_bang_radar_cmd(dfs->dfs_pdev_obj,
-				&dfs_unit_test) == QDF_STATUS_E_FAILURE) {
-		return -EINVAL;
-	}
-
-	return 0;
-}
-#endif