فهرست منبع

qcacld-3.0: Provide SME API to send unit test command to FW

Current driver forming a unit test command within HDD layer and uses
message passing method to deliver it to WMA layer which
requires HDD layer to have a knowledge of how to form a unit test command.

User SME API to send params to WMA layer and let WMA form a unit test
command and send it directly to FW through WMI layer instead of HDD
forming and passing it down.

CRs-Fixed: 2118725
Change-Id: Id1838939813e6cd2d52cee8720a1f4e0ca34329b
Krunal Soni 7 سال پیش
والد
کامیت
aadaa27fbd

+ 11 - 27
core/hdd/src/wlan_hdd_wext.c

@@ -11147,41 +11147,25 @@ static int __iw_set_var_ints_getnone(struct net_device *dev,
 #endif
 	case WE_UNIT_TEST_CMD:
 	{
-		t_wma_unit_test_cmd *unitTestArgs;
-		struct scheduler_msg msg = { 0 };
-		int i, j;
+		QDF_STATUS status;
 
 		if ((apps_args[0] < WLAN_MODULE_ID_MIN) ||
 		    (apps_args[0] >= WLAN_MODULE_ID_MAX)) {
-			hdd_err("Invalid MODULE ID %d",
-			       apps_args[0]);
+			hdd_err("Invalid MODULE ID %d", apps_args[0]);
 			return -EINVAL;
 		}
-		if ((apps_args[1] > (WMA_MAX_NUM_ARGS)) ||
+		if ((apps_args[1] >= (WMA_MAX_NUM_ARGS)) ||
 		    (apps_args[1] < 0)) {
-			hdd_err("Too Many/Few args %d",
-			       apps_args[1]);
+			hdd_err("Too Many/Few args %d", apps_args[1]);
 			return -EINVAL;
 		}
-		unitTestArgs = qdf_mem_malloc(sizeof(*unitTestArgs));
-		if (NULL == unitTestArgs) {
-			hdd_err("qdf_mem_malloc failed for unitTestArgs");
-			return -ENOMEM;
-		}
-		unitTestArgs->vdev_id = (int)adapter->sessionId;
-		unitTestArgs->module_id = apps_args[0];
-		unitTestArgs->num_args = apps_args[1];
-		for (i = 0, j = 2; i < unitTestArgs->num_args; i++, j++)
-			unitTestArgs->args[i] = apps_args[j];
-
-		msg.type = SIR_HAL_UNIT_TEST_CMD;
-		msg.reserved = 0;
-		msg.bodyptr = unitTestArgs;
-		if (QDF_STATUS_SUCCESS !=
-		    scheduler_post_msg(QDF_MODULE_ID_WMA, &msg)) {
-			qdf_mem_free(unitTestArgs);
-			hdd_err("Not able to post UNIT_TEST_CMD message to WMA");
-			return -EINVAL;
+		status = sme_send_unit_test_cmd(adapter->sessionId,
+						apps_args[0],
+						apps_args[1],
+						&apps_args[2]);
+		if (QDF_STATUS_SUCCESS != status) {
+		    hdd_err("Not able to post UNIT_TEST_CMD message to WMA");
+		    return -EINVAL;
 		}
 	}
 	break;

+ 1 - 1
core/mac/src/include/sir_params.h

@@ -519,7 +519,7 @@ typedef struct sSirMbMsgP2p {
 
 #define SIR_HAL_SET_BASE_MACADDR_IND         (SIR_HAL_ITC_MSG_TYPES_BEGIN + 214)
 
-#define SIR_HAL_UNIT_TEST_CMD                (SIR_HAL_ITC_MSG_TYPES_BEGIN + 215)
+/* (SIR_HAL_ITC_MSG_TYPES_BEGIN + 215) is unused */
 
 #define SIR_HAL_LINK_STATUS_GET_REQ          (SIR_HAL_ITC_MSG_TYPES_BEGIN + 216)
 

+ 0 - 1
core/mac/src/sys/legacy/src/utils/src/mac_trace.c

@@ -609,7 +609,6 @@ uint8_t *mac_trace_get_wma_msg_string(uint16_t wma_msg)
 		CASE_RETURN_STRING(WMA_ENCRYPT_DECRYPT_MSG);
 		CASE_RETURN_STRING(WMA_POWER_DEBUG_STATS_REQ);
 		CASE_RETURN_STRING(WNI_CFG_DNLD_REQ);
-		CASE_RETURN_STRING(SIR_HAL_UNIT_TEST_CMD);
 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
 		CASE_RETURN_STRING(SIR_HAL_ROAM_INVOKE);
 #endif

+ 14 - 1
core/sme/inc/sme_api.h

@@ -790,7 +790,20 @@ void sme_stats_ext_register_callback(tHalHandle hHal,
  */
 void sme_stats_ext2_register_callback(tHalHandle hal_handle,
 	void (*stats_ext2_cb)(void *, struct sir_sme_rx_aggr_hole_ind *));
-
+/**
+ * sme_send_unit_test_cmd() - send unit test command to lower layer
+ * @session_id: sme session id to be filled while forming the command
+ * @module_id: module id given by user to be filled in the command
+ * @arg_count: number of argument count
+ * @arg: pointer to argument list
+ *
+ * This API exposed to HDD layer which takes the argument from user and sends
+ * down to lower layer for further processing
+ *
+ * Return: QDF_STATUS based on overall success
+ */
+QDF_STATUS sme_send_unit_test_cmd(uint32_t vdev_id, uint32_t module_id,
+				  uint32_t arg_count, uint32_t *arg);
 void sme_stats_ext_deregister_callback(tHalHandle hhal);
 QDF_STATUS sme_stats_ext_request(uint8_t session_id,
 		tpStatsExtRequestReq input);

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

@@ -12917,6 +12917,13 @@ QDF_STATUS sme_set_dhcp_srv_offload(tHalHandle hHal,
 }
 #endif /* DHCP_SERVER_OFFLOAD */
 
+QDF_STATUS sme_send_unit_test_cmd(uint32_t vdev_id, uint32_t module_id,
+				  uint32_t arg_count, uint32_t *arg)
+{
+	return wma_form_unit_test_cmd_and_send(vdev_id, module_id,
+					       arg_count, arg);
+}
+
 #ifdef WLAN_FEATURE_GPIO_LED_FLASHING
 /*
  * sme_set_led_flashing() -

+ 0 - 14
core/wma/inc/wma.h

@@ -2088,20 +2088,6 @@ enum uapsd_up {
 	UAPSD_UP_MAX
 };
 
-/**
- * struct wma_unit_test_cmd - unit test command parameters
- * @vdev_id: vdev id
- * @module_id: module id
- * @num_args: number of arguments
- * @args: arguments
- */
-typedef struct wma_unit_test_cmd {
-	uint32_t vdev_id;
-	WLAN_MODULE_ID module_id;
-	uint32_t num_args;
-	uint32_t args[WMA_MAX_NUM_ARGS];
-} t_wma_unit_test_cmd;
-
 /**
  * struct wma_roam_invoke_cmd - roam invoke command
  * @vdev_id: vdev id

+ 14 - 0
core/wma/inc/wma_api.h

@@ -175,6 +175,20 @@ QDF_STATUS wma_get_caps_for_phyidx_hwmode(struct wma_caps_per_phy *caps_per_phy,
 		enum hw_mode_dbs_capab hw_mode, enum cds_band_type band);
 bool wma_is_rx_ldpc_supported_for_channel(uint32_t channel);
 int wma_unified_radio_tx_mem_free(void *handle);
+/**
+ * wma_form_unit_test_cmd_and_send() - to form a wma command and send it to FW
+ * @session_id: wma session id to be filled while forming the command
+ * @module_id: module id given by user to be filled in the command
+ * @arg_count: number of argument count
+ * @arg: pointer to argument list
+ *
+ * This API exposed to HDD layer which takes the argument from user and forms
+ * the wma unit test command to be sent down to firmware
+ *
+ * Return: QDF_STATUS based on overall success
+ */
+QDF_STATUS wma_form_unit_test_cmd_and_send(uint32_t vdev_id,
+		uint32_t module_id, uint32_t arg_count, uint32_t *arg);
 
 #if defined(FEATURE_LRO)
 int wma_lro_init(struct cdp_lro_hash_config *lro_config);

+ 0 - 3
core/wma/inc/wma_internal.h

@@ -420,9 +420,6 @@ QDF_STATUS wma_reset_passpoint_network_list(tp_wma_handle wma,
 QDF_STATUS  wma_ipa_offload_enable_disable(tp_wma_handle wma,
 			struct sir_ipa_offload_enable_disable *ipa_offload);
 
-void wma_process_unit_test_cmd(WMA_HANDLE handle,
-				      t_wma_unit_test_cmd *wma_utest);
-
 QDF_STATUS wma_scan_probe_setoui(tp_wma_handle wma, tSirScanMacOui *psetoui);
 
 int wma_scan_event_callback(WMA_HANDLE handle, uint8_t *data, uint32_t len);

+ 36 - 5
core/wma/src/wma_main.c

@@ -604,6 +604,42 @@ int wma_cli_set_command(int vdev_id, int param_id, int sval, int vpdev)
 
 }
 
+QDF_STATUS wma_form_unit_test_cmd_and_send(uint32_t vdev_id,
+			uint32_t module_id, uint32_t arg_count, uint32_t *arg)
+{
+	struct wmi_unit_test_cmd *unit_test_args;
+	tp_wma_handle wma_handle = cds_get_context(QDF_MODULE_ID_WMA);
+	uint32_t i;
+	QDF_STATUS status;
+
+	WMA_LOGD(FL("enter"));
+	if (arg_count >= WMA_MAX_NUM_ARGS) {
+		WMA_LOGE(FL("arg_count is crossed the boundary"));
+		return QDF_STATUS_E_FAILURE;
+	}
+	if (!wma_handle || !wma_handle->wmi_handle) {
+		WMA_LOGE(FL("Invalid WMA/WMI handle"));
+		return QDF_STATUS_E_FAILURE;
+	}
+	unit_test_args = qdf_mem_malloc(sizeof(*unit_test_args));
+	if (NULL == unit_test_args) {
+		WMA_LOGE(FL("qdf_mem_malloc failed for unit_test_args"));
+		return QDF_STATUS_E_NOMEM;
+	}
+	unit_test_args->vdev_id = vdev_id;
+	unit_test_args->module_id = module_id;
+	unit_test_args->num_args = arg_count;
+	for (i = 0; i < arg_count; i++)
+		unit_test_args->args[i] = arg[i];
+
+	status = wmi_unified_unit_test_cmd(wma_handle->wmi_handle,
+					   unit_test_args);
+	qdf_mem_free(unit_test_args);
+	WMA_LOGD(FL("exit"));
+
+	return status;
+}
+
 /**
  * wma_ipa_get_stat() - get IPA data path stats from FW
  *
@@ -7480,11 +7516,6 @@ static QDF_STATUS wma_mc_process_msg(struct scheduler_msg *msg)
 		qdf_mem_free(msg->bodyptr);
 		break;
 #endif /* WLAN_FEATURE_LINK_LAYER_STATS */
-	case SIR_HAL_UNIT_TEST_CMD:
-		wma_process_unit_test_cmd(wma_handle,
-					  (t_wma_unit_test_cmd *) msg->bodyptr);
-		qdf_mem_free(msg->bodyptr);
-		break;
 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
 	case WMA_ROAM_OFFLOAD_SYNCH_FAIL:
 		wma_process_roam_synch_fail(wma_handle,

+ 0 - 26
core/wma/src/wma_scan_roam.c

@@ -2836,32 +2836,6 @@ int wma_rssi_breached_event_handler(void *handle,
 	return 0;
 }
 
-/**
- * wma_process_unit_test_cmd() - send unit test command to fw.
- * @handle: wma handle
- * @wma_utest: unit test command
- *
- * This function send unit test command to fw.
- *
- * Return: none
- */
-void wma_process_unit_test_cmd(WMA_HANDLE handle,
-			       t_wma_unit_test_cmd *wma_utest)
-{
-	tp_wma_handle wma_handle = (tp_wma_handle) handle;
-
-	if (!wma_handle || !wma_handle->wmi_handle) {
-		WMA_LOGE("%s: WMA is closed, can not issue fw unit test cmd",
-			 __func__);
-		return;
-	}
-
-	if (wmi_unified_unit_test_cmd(wma_handle->wmi_handle,
-				 (struct wmi_unit_test_cmd *)wma_utest)) {
-		return;
-	}
-}
-
 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
 /**
  * wma_roam_ho_fail_handler() - LFR3.0 roam hand off failed handler