ソースを参照

qcacmn: Send all args with unit test command for bangradar

The unit test command being sent to FW for bangradar did not have
enough arguments to perform subchannel marking as expected.

Pack in the existing uint32_t argument the following information
	1). Segment ID (2 bits)
	2). Chirp Information (1 bit)
	3). Frequency Offset (8 bits [can be signed]).
that is being sent in the unit test command structure.

Change-Id: I7cc567f7bdc9367ee0f51080d0c54c55aa3e4a6b
CRs-Fixed: 2342535
Vignesh Mohan 6 年 前
コミット
53d6d1b215

+ 8 - 4
umac/dfs/core/src/dfs_full_offload.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
  *
  *
  * Permission to use, copy, modify, and/or distribute this software for
@@ -25,22 +25,26 @@
 #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.
  * @segid: Segment Identifier(Primary and Secondary)
+ * @is_chirp: Boolean to determine if Chirp or Non Chirp.
+ * @freq_offset: Value of frequency offset from centre frequency.
  * @dfs_unit_test: Pointer to Unit test command structure
  *
  * Return: If the event is received return 0.
  */
-#if defined(WLAN_DFS_FULL_OFFLOAD)
 int dfs_fill_emulate_bang_radar_test(struct wlan_dfs *dfs,
-		uint32_t segid,
+		uint8_t segid, bool is_chirp, int32_t freq_offset,
 		struct dfs_emulate_bang_radar_test_cmd *dfs_unit_test);
+
 #else
 static inline int dfs_fill_emulate_bang_radar_test(struct wlan_dfs *dfs,
-		uint32_t segid,
+		uint8_t segid, bool is_chirp, int32_t freq_offset,
 		struct dfs_emulate_bang_radar_test_cmd *dfs_unit_test)
 {
 	return 0;

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

@@ -423,8 +423,10 @@ int dfs_control(struct wlan_dfs *dfs,
 
 			if (dfs->dfs_is_offload_enabled) {
 				error = dfs_fill_emulate_bang_radar_test
-						 (dfs, dfs->dfs_seg_id,
-						  &dfs_unit_test);
+							(dfs, dfs->dfs_seg_id,
+							 dfs->dfs_is_chirp,
+							 dfs->dfs_freq_offset,
+							 &dfs_unit_test);
 			} else {
 				error = dfs_start_host_based_bangradar(dfs);
 			}

+ 9 - 10
umac/dfs/core/src/misc/dfs_full_offload.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2019 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
@@ -16,8 +16,8 @@
  */
 
 /**
- * DOC: This file contains the dfs_fill_emulate_bang_radar_test() which is used
- * to send command to firmware to emulate RADAR found event.
+ * 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"
@@ -28,13 +28,11 @@
 #include "../dfs_full_offload.h"
 
 int dfs_fill_emulate_bang_radar_test(struct wlan_dfs *dfs,
-		uint32_t segid,
+		uint8_t segid, bool is_chirp, int32_t freq_offset,
 		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.
-	 */
+	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");
@@ -46,13 +44,14 @@ int dfs_fill_emulate_bang_radar_test(struct wlan_dfs *dfs,
 			"Segment id should be 0 or 1");
 		return -EINVAL;
 	}
-
+	packed_args = (segid) | (is_chirp << SEG_ID_SIZE) |
+			((freq_offset & MASK) << (SEG_ID_SIZE + IS_CHIRP_SIZE));
 	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;
+	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) {

+ 37 - 14
umac/dfs/dispatcher/inc/wlan_dfs_tgt_api.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved.
  *
  *
  * Permission to use, copy, modify, and/or distribute this software for
@@ -27,29 +27,52 @@
 
 #include <wlan_dfs_public_struct.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
+/* dfs_radar_args_for_unit_test: Radar parameters to be sent in unit test cmd.
+ * @IDX_CMD_ID:          Index id pointing to command id value
+ * @IDX_PDEV_ID:         Index id pointing to pdev id value
+ * @IDX_RADAR_PARAM1_ID: Index pointing to packed arguments value that includes
+ *                         1). Segment ID,
+ *                         2). Chirp information (is chirp or non chirp),
+ *                         3). Frequency offset.
+ *
+ * The packed argument structure is:
+ *
+ * ------------------------------32 bits arg-------------------------
+ *
+ * ------------21 bits-------------|-------8 bits------|1 bit|2 bits|
+ * __________________________________________________________________
+ *|                                | | | | | | | | | | |     |   |   |
+ *|---------21 Unused bits---------|x|x|x| |x|x|x|x| |x|  x  | x | x |
+ *|________________________________|_|_|_|_|_|_|_|_|_|_|_____|___|___|
+ *
+ *                                 |___________________|_____|_______|
+ *                                   freq.offset        Chirp  segID
+ *
+ * @DFS_UNIT_TEST_NUM_ARGS:     Number of arguments for bangradar unit test
+ *                              command.
+ * @DFS_MAX_NUM_UNIT_TEST_ARGS: Maximum number of arguments for unit test
+ *                              command in radar simulation.
+ */
+enum {
+	IDX_CMD_ID = 0,
+	IDX_PDEV_ID,
+	IDX_RADAR_PARAM1_ID,
+	DFS_UNIT_TEST_NUM_ARGS,
+	DFS_MAX_NUM_UNIT_TEST_ARGS = DFS_UNIT_TEST_NUM_ARGS
+};
 
-/* Index pointing to segment id value */
-#define IDX_SEG_ID 2
+#define SEG_ID_SIZE 2
+#define IS_CHIRP_SIZE 1
+#define MASK 0xFF
 
 /**
  * struct dfs_emulate_bang_radar_test_cmd - Unit test command structure to send