Jelajahi Sumber

qcacld-3.0: Send QMI msg to WFDS server on rmmod/SSR

Send QMI misc request message to WFDS server and wait
for response before cleaning up the resources pertaining
to WFDS server on LPASS.

Change-Id: I24bc2295c5a625365a6da95be697c46b08f8b6b7
CRs-Fixed: 3448838
Yeshwanth Sriram Guntuka 2 tahun lalu
induk
melakukan
cd67004cbe
3 mengubah file dengan 93 tambahan dan 22 penghapusan
  1. 2 1
      core/hdd/src/wlan_hdd_main.c
  2. 4 10
      os_if/qmi/src/os_if_qmi.c
  3. 87 11
      os_if/qmi/src/os_if_qmi_wfds.c

+ 2 - 1
core/hdd/src/wlan_hdd_main.c

@@ -15203,7 +15203,8 @@ int hdd_wlan_stop_modules(struct hdd_context *hdd_ctx, bool ftm_mode)
 		hdd_disable_power_management(hdd_ctx);
 
 		if (hdd_get_conparam() == QDF_GLOBAL_MISSION_MODE)
-			ucfg_dp_direct_link_deinit(hdd_ctx->psoc);
+			ucfg_dp_direct_link_deinit(hdd_ctx->psoc,
+						   is_recovery_stop);
 
 		if (hdd_deconfigure_cds(hdd_ctx)) {
 			hdd_err("Failed to de-configure CDS");

+ 4 - 10
os_if/qmi/src/os_if_qmi.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. 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
@@ -89,10 +89,8 @@ QDF_STATUS os_if_qmi_txn_init(struct qmi_handle *qmi_hdl,
 	int ret;
 
 	ret = qmi_txn_init(qmi_hdl, qmi_txn, qmi_ei, resp);
-	if (ret < 0) {
-		osif_info("QMI transaction init failed %d", ret);
+	if (ret < 0)
 		return qdf_status_from_os_return(ret);
-	}
 
 	return QDF_STATUS_SUCCESS;
 }
@@ -106,10 +104,8 @@ QDF_STATUS os_if_qmi_send_request(struct qmi_handle *qmi_hdl,
 	int ret;
 
 	ret = qmi_send_request(qmi_hdl, sq, qmi_txn, msg_id, len, ei, req);
-	if (ret < 0) {
-		osif_info("QMI send request failed %d", ret);
+	if (ret < 0)
 		return qdf_status_from_os_return(ret);
-	}
 
 	return QDF_STATUS_SUCCESS;
 }
@@ -119,10 +115,8 @@ QDF_STATUS os_if_qmi_txn_wait(struct qmi_txn *qmi_txn, unsigned long timeout)
 	int ret;
 
 	ret = qmi_txn_wait(qmi_txn, timeout);
-	if (ret < 0) {
-		osif_info("QMI Failed to wait for response %d", ret);
+	if (ret < 0)
 		return qdf_status_from_os_return(ret);
-	}
 
 	return QDF_STATUS_SUCCESS;
 }

+ 87 - 11
os_if/qmi/src/os_if_qmi_wfds.c

@@ -139,7 +139,8 @@ os_if_qmi_wfds_send_config_msg(struct wlan_qmi_wfds_config_req_msg *src_info)
 	status = os_if_qmi_txn_init(&qmi_wfds, &txn, wfds_gen_resp_msg_v01_ei,
 				    resp);
 	if (QDF_IS_STATUS_ERROR(status)) {
-		osif_info("QMI transaction init failed for WFDS config message");
+		osif_info("QMI txn init failed for WFDS config message %d",
+			  status);
 		goto out;
 	}
 
@@ -148,14 +149,15 @@ os_if_qmi_wfds_send_config_msg(struct wlan_qmi_wfds_config_req_msg *src_info)
 					WFDS_CONFIG_REQ_MSG_V01_MAX_MSG_LEN,
 					wfds_config_req_msg_v01_ei, req);
 	if (QDF_IS_STATUS_ERROR(status)) {
-		osif_info("QMI WFDS config send request failed");
+		osif_info("QMI WFDS config send request failed %d", status);
 		os_if_qmi_txn_cancel(&txn);
 		goto out;
 	}
 
 	status = os_if_qmi_txn_wait(&txn, QMI_WFDS_TIMEOUT_JF);
 	if (QDF_IS_STATUS_ERROR(status)) {
-		osif_info("Failed to wait for QMI WFDS config response");
+		osif_info("Wait for QMI WFDS config response timed out %d",
+			  status);
 		goto out;
 	}
 
@@ -221,7 +223,8 @@ os_if_qmi_wfds_send_req_mem_msg(struct wlan_qmi_wfds_mem_req_msg *src_info)
 	status = os_if_qmi_txn_init(&qmi_wfds, &txn, wfds_gen_resp_msg_v01_ei,
 				    resp);
 	if (QDF_IS_STATUS_ERROR(status)) {
-		osif_info("QMI transaction init failed for WFDS config message");
+		osif_info("QMI txn init failed for WFDS mem req message %d",
+			  status);
 		goto out;
 	}
 
@@ -230,14 +233,75 @@ os_if_qmi_wfds_send_req_mem_msg(struct wlan_qmi_wfds_mem_req_msg *src_info)
 					WFDS_MEM_REQ_MSG_V01_MAX_MSG_LEN,
 					wfds_mem_req_msg_v01_ei, req);
 	if (QDF_IS_STATUS_ERROR(status)) {
-		osif_info("QMI WFDS config send request failed");
+		osif_info("QMI WFDS mem request send failed %d", status);
 		os_if_qmi_txn_cancel(&txn);
 		goto out;
 	}
 
 	status = os_if_qmi_txn_wait(&txn, QMI_WFDS_TIMEOUT_JF);
 	if (QDF_IS_STATUS_ERROR(status)) {
-		osif_info("Failed to wait for QMI WFDS config response");
+		osif_info("Wait for QMI WFDS mem response timed out %d",
+			  status);
+		goto out;
+	}
+
+	qdf_assert(resp->resp.result == QMI_RESULT_SUCCESS_V01);
+
+out:
+	qdf_mem_free(resp);
+	qdf_mem_free(req);
+
+	return status;
+}
+
+/*
+ * os_if_qmi_wfds_send_misc_req_msg() - Send misc req message to QMI server
+ * @is_ssr: true if SSR is in progress else false
+ *
+ * Return: QDF status
+ */
+static QDF_STATUS
+os_if_qmi_wfds_send_misc_req_msg(bool is_ssr)
+{
+	struct wfds_misc_req_msg_v01 *req;
+	struct wfds_gen_resp_msg_v01 *resp;
+	struct qmi_txn txn;
+	QDF_STATUS status;
+
+	req = qdf_mem_malloc(sizeof(*req));
+	if (!req)
+		return QDF_STATUS_E_NOMEM;
+
+	resp = qdf_mem_malloc(sizeof(*resp));
+	if (!resp) {
+		qdf_mem_free(req);
+		return QDF_STATUS_E_NOMEM;
+	}
+
+	req->event = (is_ssr) ? WFDS_EVENT_WLAN_SSR_V01 :
+			WFDS_EVENT_WLAN_HOST_RMMOD_V01;
+
+	status = os_if_qmi_txn_init(&qmi_wfds, &txn, wfds_gen_resp_msg_v01_ei,
+				    resp);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		osif_info("QMI txn for WFDS misc request failed %d",
+			  status);
+		goto out;
+	}
+
+	status = os_if_qmi_send_request(&qmi_wfds, NULL, &txn,
+					QMI_WFDS_MISC_REQ_V01,
+					WFDS_MISC_REQ_MSG_V01_MAX_MSG_LEN,
+					wfds_misc_req_msg_v01_ei, req);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		osif_info("QMI WFDS misc request send failed %d", status);
+		os_if_qmi_txn_cancel(&txn);
+		goto out;
+	}
+
+	status = os_if_qmi_txn_wait(&txn, QMI_WFDS_TIMEOUT_JF);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		osif_info("Failed to wait for WFDS misc response %d", status);
 		goto out;
 	}
 
@@ -299,7 +363,8 @@ os_if_qmi_wfds_ipcc_map_n_cfg_msg(struct wlan_qmi_wfds_ipcc_map_n_cfg_req_msg *s
 	status = os_if_qmi_txn_init(&qmi_wfds, &txn, wfds_gen_resp_msg_v01_ei,
 				    resp);
 	if (QDF_IS_STATUS_ERROR(status)) {
-		osif_info("QMI transaction init failed for WFDS config message");
+		osif_info("QMI txn init failed for WFDS ipcc cfg req message %d",
+			  status);
 		goto out;
 	}
 
@@ -308,14 +373,15 @@ os_if_qmi_wfds_ipcc_map_n_cfg_msg(struct wlan_qmi_wfds_ipcc_map_n_cfg_req_msg *s
 				    WFDS_IPCC_MAP_N_CFG_REQ_MSG_V01_MAX_MSG_LEN,
 				    wfds_ipcc_map_n_cfg_req_msg_v01_ei, req);
 	if (QDF_IS_STATUS_ERROR(status)) {
-		osif_info("QMI WFDS config send request failed");
+		osif_info("QMI WFDS IPCC cfg request send failed %d", status);
 		os_if_qmi_txn_cancel(&txn);
 		goto out;
 	}
 
 	status = os_if_qmi_txn_wait(&txn, QMI_WFDS_TIMEOUT_JF);
 	if (QDF_IS_STATUS_ERROR(status)) {
-		osif_info("Failed to wait for QMI WFDS config response");
+		osif_info("Wait for QMI WFDS IPCC response timed out %d",
+			  status);
 		goto out;
 	}
 
@@ -446,7 +512,8 @@ os_if_qmi_wfds_send_ut_cmd_req_msg(struct os_if_qmi_wfds_ut_cmd_info *cmd_info)
 	status = os_if_qmi_txn_init(&qmi_wfds, &txn, wfds_gen_resp_msg_v01_ei,
 				    resp);
 	if (QDF_IS_STATUS_ERROR(status)) {
-		osif_info("QMI transaction for WFDS unit test cmd init failed");
+		osif_info("QMI txn for WFDS unit test cmd init failed %d",
+			  status);
 		goto out;
 	}
 
@@ -454,10 +521,17 @@ os_if_qmi_wfds_send_ut_cmd_req_msg(struct os_if_qmi_wfds_ut_cmd_info *cmd_info)
 					QMI_WFDS_UT_CMD_REQ_V01,
 					WFDS_UT_CMD_REQ_MSG_V01_MAX_MSG_LEN,
 					wfds_ut_cmd_req_msg_v01_ei, req);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		osif_info("QMI WFDS UT command request send failed %d",
+			  status);
+		os_if_qmi_txn_cancel(&txn);
+		goto out;
+	}
 
 	status = os_if_qmi_txn_wait(&txn, QMI_WFDS_TIMEOUT_JF);
 	if (QDF_IS_STATUS_ERROR(status)) {
-		osif_info("Failed to wait for unit test cmd response");
+		osif_info("Wait for unit test cmd response timed out %d",
+			  status);
 		goto out;
 	}
 
@@ -578,4 +652,6 @@ void os_if_qmi_wfds_register_callbacks(struct wlan_qmi_psoc_callbacks *cb_obj)
 	cb_obj->qmi_wfds_send_req_mem_msg = os_if_qmi_wfds_send_req_mem_msg;
 	cb_obj->qmi_wfds_send_ipcc_map_n_cfg_msg =
 					os_if_qmi_wfds_ipcc_map_n_cfg_msg;
+	cb_obj->qmi_wfds_send_misc_req_msg =
+					os_if_qmi_wfds_send_misc_req_msg;
 }