Эх сурвалжийг харах

qcacld-3.0: Refactor vdev delete code

Refactor vdev delete code for target_if conversion. Remove legacy
vdev delete code.

Change-Id: Ia95faa3a8eb561e19d439046a25bd7e452b98fb2
CRs-Fixed: 2471947
Abhishek Ambure 5 жил өмнө
parent
commit
cbef14404b

+ 21 - 0
components/mlme/core/src/wlan_mlme_vdev_mgr_interface.c

@@ -950,6 +950,25 @@ static QDF_STATUS mon_mlme_vdev_down_send(struct vdev_mlme_obj *vdev_mlme,
 	return wma_mon_mlme_vdev_down_send(vdev_mlme, data_len, data);
 }
 
+/**
+ * vdevmgr_vdev_delete_rsp_handle() - callback to handle vdev delete response
+ * @vdev_mlme: vdev mlme object
+ * @rsp: pointer to vdev delete response
+ *
+ * This function is called to handle vdev delete response and send result to
+ * upper layer
+ *
+ * Return: QDF_STATUS
+ */
+static QDF_STATUS
+vdevmgr_vdev_delete_rsp_handle(struct vdev_mlme_obj *vdev_mlme,
+			       struct vdev_delete_response *rsp)
+{
+	mlme_legacy_debug("vdev id = %d ",
+			  vdev_mlme->vdev->vdev_objmgr.vdev_id);
+	return wma_vdev_detach_callback(vdev_mlme, rsp);
+}
+
 /**
  * struct sta_mlme_ops - VDEV MLME operation callbacks strucutre for sta
  * @mlme_vdev_start_send:               callback to initiate actions of VDEV
@@ -991,6 +1010,7 @@ static struct vdev_mlme_ops sta_mlme_ops = {
 	.mlme_vdev_stop_continue = vdevmgr_mlme_stop_continue,
 	.mlme_vdev_down_send = vdevmgr_mlme_vdev_down_send,
 	.mlme_vdev_notify_down_complete = vdevmgr_notify_down_complete,
+	.mlme_vdev_ext_delete_rsp = vdevmgr_vdev_delete_rsp_handle,
 };
 
 /**
@@ -1039,6 +1059,7 @@ static struct vdev_mlme_ops ap_mlme_ops = {
 	.mlme_vdev_down_send = vdevmgr_mlme_vdev_down_send,
 	.mlme_vdev_notify_down_complete = vdevmgr_notify_down_complete,
 	.mlme_vdev_is_newchan_no_cac = ap_mlme_vdev_is_newchan_no_cac,
+	.mlme_vdev_ext_delete_rsp = vdevmgr_vdev_delete_rsp_handle,
 };
 
 static struct vdev_mlme_ops mon_mlme_ops = {

+ 5 - 5
core/hdd/src/wlan_hdd_main.c

@@ -4336,9 +4336,9 @@ int hdd_vdev_destroy(struct hdd_adapter *adapter)
 
 	/* close sme session (destroy vdev in firmware via legacy API) */
 	qdf_event_reset(&adapter->qdf_session_close_event);
-	status = sme_close_session(hdd_ctx->mac_handle, adapter->vdev_id);
+	status = sme_vdev_delete(hdd_ctx->mac_handle, adapter->vdev_id);
 	if (QDF_IS_STATUS_ERROR(status)) {
-		hdd_err("failed to close sme session; status:%d", status);
+		hdd_err("failed to delete vdev; status:%d", status);
 		goto release_vdev;
 	}
 
@@ -4354,11 +4354,11 @@ int hdd_vdev_destroy(struct hdd_adapter *adapter)
 			hdd_ndp_session_end_handler(adapter);
 
 		if (status == QDF_STATUS_E_TIMEOUT)
-			hdd_err("timed out waiting for sme close session");
+			hdd_err("timed out waiting for sme vdev delete");
 		else if (adapter->qdf_session_close_event.force_set)
-			hdd_info("SSR occurred during sme close session");
+			hdd_info("SSR occurred during sme vdev delete");
 		else
-			hdd_err("failed to wait for sme close session; status:%u",
+			hdd_err("failed to wait for sme vdev delete; status:%u",
 				status);
 	}
 

+ 4 - 2
core/mac/inc/wni_api.h

@@ -88,7 +88,7 @@ enum eWniMsgTypes {
 	eWNI_SME_BEACON_REPORT_RESP_XMIT_IND = SIR_SME_MSG_TYPES_BEGIN + 46,
 
 	/* unused SIR_SME_MSG_TYPES_BEGIN + 47, */
-	eWNI_SME_DEL_STA_SELF_RSP = SIR_SME_MSG_TYPES_BEGIN + 48,
+	/* unused SIR_SME_MSG_TYPES_BEGIN + 48, */
 
 	eWNI_SME_FT_PRE_AUTH_REQ = SIR_SME_MSG_TYPES_BEGIN + 49,
 	eWNI_SME_FT_PRE_AUTH_RSP = SIR_SME_MSG_TYPES_BEGIN + 50,
@@ -242,7 +242,9 @@ enum eWniMsgTypes {
 	eWNI_SME_MON_DEINIT_SESSION = SIR_SME_MSG_TYPES_BEGIN + 156,
 	eWNI_SME_VDEV_CREATE_REQ = SIR_SME_MSG_TYPES_BEGIN + 157,
 	eWNI_SME_VDEV_CREATE_RSP = SIR_SME_MSG_TYPES_BEGIN + 158,
-	eWNI_SME_MSG_TYPES_END = SIR_SME_MSG_TYPES_BEGIN + 159
+	eWNI_SME_VDEV_DELETE_REQ = SIR_SME_MSG_TYPES_BEGIN + 159,
+	eWNI_SME_VDEV_DELETE_RSP = SIR_SME_MSG_TYPES_BEGIN + 160,
+	eWNI_SME_MSG_TYPES_END = SIR_SME_MSG_TYPES_BEGIN + 161
 };
 
 typedef struct sAniCfgTxRateCtrs {

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

@@ -300,7 +300,8 @@ struct sir_cfg_action_frm_tb_ppdu {
 
 /* (SIR_HAL_ITC_MSG_TYPES_BEGIN + 101) is unused */
 /* (SIR_HAL_ITC_MSG_TYPES_BEGIN + 102) is unused */
-#define SIR_HAL_DEL_STA_SELF_REQ           (SIR_HAL_ITC_MSG_TYPES_BEGIN + 103)
+/* (SIR_HAL_ITC_MSG_TYPES_BEGIN + 103) is unused */
+
 /*
  * (SIR_HAL_ITC_MSG_TYPES_BEGIN + 104) thru
  * (SIR_HAL_ITC_MSG_TYPES_BEGIN + 108) are unused

+ 21 - 0
core/mac/src/pe/lim/lim_process_message_queue.c

@@ -59,6 +59,8 @@
 #include "cds_ieee80211_common.h"
 #include <wlan_scan_ucfg_api.h>
 #include "wlan_mlme_public_struct.h"
+#include "wma.h"
+#include "wma_internal.h"
 #include "../../core/src/vdev_mgr_ops.h"
 
 void lim_log_session_states(struct mac_context *mac);
@@ -1542,6 +1544,20 @@ static void lim_process_sme_obss_scan_ind(struct mac_context *mac_ctx,
 	return;
 }
 
+static void
+lim_process_vdev_delete(struct mac_context *mac_ctx,
+			struct del_vdev_params *vdev_param)
+{
+	tp_wma_handle wma_handle;
+
+	wma_handle = cds_get_context(QDF_MODULE_ID_WMA);
+	if (!wma_handle) {
+		WMA_LOGE("%s: WMA context is invalid", __func__);
+		return;
+	}
+	wma_vdev_detach(wma_handle, vdev_param);
+}
+
 static void
 lim_process_vdev_create(struct mac_context *mac_ctx,
 			struct vdev_create_req_param *vdev_create_param)
@@ -2157,6 +2173,11 @@ static void lim_process_messages(struct mac_context *mac_ctx,
 		/* Do not free msg->bodyptr, same memory used to send resp */
 		msg->bodyptr = NULL;
 		break;
+	case eWNI_SME_VDEV_DELETE_REQ:
+		lim_process_vdev_delete(mac_ctx, msg->bodyptr);
+		/* Do not free msg->bodyptr, same memory used to send resp */
+		msg->bodyptr = NULL;
+		break;
 	default:
 		qdf_mem_free((void *)msg->bodyptr);
 		msg->bodyptr = NULL;

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

@@ -256,7 +256,6 @@ uint8_t *mac_trace_get_sme_msg_string(uint16_t sme_msg)
 		CASE_RETURN_STRING(eWNI_SME_NEIGHBOR_REPORT_IND);
 		CASE_RETURN_STRING(eWNI_SME_BEACON_REPORT_REQ_IND);
 		CASE_RETURN_STRING(eWNI_SME_BEACON_REPORT_RESP_XMIT_IND);
-		CASE_RETURN_STRING(eWNI_SME_DEL_STA_SELF_RSP);
 		CASE_RETURN_STRING(eWNI_SME_FT_PRE_AUTH_REQ);
 		CASE_RETURN_STRING(eWNI_SME_FT_PRE_AUTH_RSP);
 		CASE_RETURN_STRING(eWNI_SME_FT_UPDATE_KEY);
@@ -451,7 +450,6 @@ uint8_t *mac_trace_get_wma_msg_string(uint16_t wma_msg)
 #ifdef WLAN_NS_OFFLOAD
 		CASE_RETURN_STRING(WMA_SET_NS_OFFLOAD);
 #endif /* WLAN_NS_OFFLOAD */
-		CASE_RETURN_STRING(WMA_DEL_STA_SELF_REQ);
 		CASE_RETURN_STRING(WMA_WLAN_SUSPEND_IND);
 		CASE_RETURN_STRING(WMA_WLAN_RESUME_REQ);
 #ifdef WLAN_FEATURE_EXTWOW_SUPPORT

+ 6 - 6
core/sme/inc/sme_api.h

@@ -383,19 +383,19 @@ QDF_STATUS sme_create_vdev(mac_handle_t mac_handle,
 			   struct sme_session_params *params);
 
 /**
- * sme_close_session() - Close a session for given persona
+ * sme_vdev_delete() - Delete vdev for given id
  *
- * This is a synchronous API. This API needs to be called to close the session
+ * This is a synchronous API. This API needs to be called to delete vdev
  * in SME module before terminating the session completely.
  *
  * mac_handle: The handle returned by mac_open.
- * session_id: A previous opened session's ID.
+ * vdev_id: A previous created vdev id.
  *
  * Return:
- * QDF_STATUS_SUCCESS - session is closed.
- * Other status means SME is failed to open the session.
+ * QDF_STATUS_SUCCESS - vdev is deleted.
+ * Other status means SME is failed to delete vdev.
  */
-QDF_STATUS sme_close_session(mac_handle_t mac_handle, uint8_t sessionId);
+QDF_STATUS sme_vdev_delete(mac_handle_t mac_handle, uint8_t vdev_id);
 
 /**
  * sme_set_curr_device_mode() - Sets the current operating device mode.

+ 8 - 7
core/sme/inc/sme_inside.h

@@ -143,19 +143,19 @@ void csr_roam_wm_status_change_complete(struct mac_context *mac_ctx,
 void csr_roam_process_wm_status_change_command(struct mac_context *mac,
 		tSmeCmd *pCommand);
 /**
- * csr_process_del_sta_session_command() - Post WMA_DEL_STA_SELF_REQ to wma
- *
+ * csr_process_del_vdev_command() - Post eWNI_SME_VDEV_DELETE_REQ to wma
  * @mac_ctx: global mac context
  * @sme_command: received Delete Self station request command
  *
- * This API sends the WMA_DEL_STA_SELF_REQ msg to WMA.
+ * This API sends the eWNI_SME_VDEV_DELETE_REQ msg to PE.
  *
  * Return: QDF_STATUS_SUCCESS or QDF_STATUS_E_FAILURE
  */
-QDF_STATUS csr_process_del_sta_session_command(struct mac_context *mac_ctx,
-					       tSmeCmd *sme_command);
+QDF_STATUS csr_process_del_vdev_command(struct mac_context *mac_ctx,
+					tSmeCmd *sme_command);
 void csr_reinit_roam_cmd(struct mac_context *mac, tSmeCmd *pCommand);
-void csr_reinit_wm_status_change_cmd(struct mac_context *mac, tSmeCmd *pCommand);
+void csr_reinit_wm_status_change_cmd(struct mac_context *mac,
+				     tSmeCmd *pCommand);
 QDF_STATUS csr_roam_send_set_key_cmd(struct mac_context *mac_ctx,
 		uint32_t session_id, struct setkey_cmd *set_key_cmd);
 QDF_STATUS csr_is_valid_channel(struct mac_context *mac, uint8_t chnNum);
@@ -163,7 +163,8 @@ QDF_STATUS csr_is_valid_channel(struct mac_context *mac, uint8_t chnNum);
 QDF_STATUS sme_acquire_global_lock(struct sme_context *sme);
 QDF_STATUS sme_release_global_lock(struct sme_context *sme);
 
-QDF_STATUS csr_process_del_sta_session_rsp(struct mac_context *mac, uint8_t *pMsg);
+QDF_STATUS
+csr_process_vdev_del_rsp(struct mac_context *mac, uint8_t *pmsg);
 
 QDF_STATUS csr_flush_cfg_bg_scan_roam_channel_list(struct mac_context *mac,
 		uint8_t sessionId);

+ 1 - 1
core/sme/inc/sme_internal.h

@@ -50,7 +50,7 @@ typedef enum eSmeCommandType {
 	eSmeCsrCommandMask = 0x10000,
 	eSmeCommandRoam,
 	eSmeCommandWmStatusChange,
-	e_sme_command_del_sta_session,
+	e_sme_command_del_vdev,
 	/* QOS */
 	eSmeQosCommandMask = 0x40000,   /* To identify Qos commands */
 	eSmeCommandAddTs,

+ 10 - 11
core/sme/src/common/sme_api.c

@@ -383,9 +383,9 @@ static void dump_csr_command_info(struct mac_context *mac, tSmeCmd *pCmd)
 			pCmd->u.wmStatusChangeCmd.Type);
 		break;
 
-	case e_sme_command_del_sta_session:
-		sme_debug("Issue del STA command for session:%d",
-			   pCmd->sessionId);
+	case e_sme_command_del_vdev:
+		sme_debug("Issue del vdev command for vdev:%d",
+			  pCmd->sessionId);
 		break;
 
 	default:
@@ -516,8 +516,8 @@ QDF_STATUS sme_ser_handle_active_cmd(struct wlan_serialization_command *cmd)
 		csr_roam_process_wm_status_change_command(mac_ctx,
 					sme_cmd);
 		break;
-	case e_sme_command_del_sta_session:
-		csr_process_del_sta_session_command(mac_ctx, sme_cmd);
+	case e_sme_command_del_vdev:
+		csr_process_del_vdev_command(mac_ctx, sme_cmd);
 		break;
 	case eSmeCommandAddTs:
 	case eSmeCommandDelTs:
@@ -2005,10 +2005,9 @@ QDF_STATUS sme_process_msg(struct mac_context *mac, struct scheduler_msg *pMsg)
 			sme_err("Empty message for: %d", pMsg->type);
 		}
 		break;
-	case eWNI_SME_DEL_STA_SELF_RSP:
+	case eWNI_SME_VDEV_DELETE_RSP:
 		if (pMsg->bodyptr) {
-			status = csr_process_del_sta_session_rsp(mac,
-								pMsg->bodyptr);
+			status = csr_process_vdev_del_rsp(mac, pMsg->bodyptr);
 			qdf_mem_free(pMsg->bodyptr);
 		} else {
 			sme_err("Empty message for: %d", pMsg->type);
@@ -4525,16 +4524,16 @@ QDF_STATUS sme_create_vdev(mac_handle_t mac_handle,
 	return status;
 }
 
-QDF_STATUS sme_close_session(mac_handle_t mac_handle, uint8_t session_id)
+QDF_STATUS sme_vdev_delete(mac_handle_t mac_handle, uint8_t vdev_id)
 {
 	QDF_STATUS status;
 	struct mac_context *mac = MAC_CONTEXT(mac_handle);
 
 	MTRACE(qdf_trace(QDF_MODULE_ID_SME,
-			 TRACE_CODE_SME_RX_HDD_CLOSE_SESSION, session_id, 0));
+			 TRACE_CODE_SME_RX_HDD_CLOSE_SESSION, vdev_id, 0));
 	status = sme_acquire_global_lock(&mac->sme);
 	if (QDF_IS_STATUS_SUCCESS(status)) {
-		status = csr_roam_close_session(mac, session_id, false);
+		status = csr_roam_vdev_delete(mac, vdev_id, false);
 		sme_release_global_lock(&mac->sme);
 	}
 

+ 1 - 1
core/sme/src/common/sme_trace.c

@@ -159,7 +159,7 @@ static uint8_t *sme_trace_get_command_string(uint32_t command)
 		CASE_RETURN_STRING(eSmeCsrCommandMask);
 		CASE_RETURN_STRING(eSmeCommandRoam);
 		CASE_RETURN_STRING(eSmeCommandWmStatusChange);
-		CASE_RETURN_STRING(e_sme_command_del_sta_session);
+		CASE_RETURN_STRING(e_sme_command_del_vdev);
 		CASE_RETURN_STRING(eSmeQosCommandMask);
 		CASE_RETURN_STRING(eSmeCommandAddTs);
 		CASE_RETURN_STRING(eSmeCommandDelTs);

+ 63 - 60
core/sme/src/csr/csr_api_roam.c

@@ -1170,7 +1170,7 @@ QDF_STATUS csr_stop(struct mac_context *mac)
 	 */
 	csr_purge_pdev_all_ser_cmd_list(mac);
 	for (sessionId = 0; sessionId < WLAN_MAX_VDEVS; sessionId++)
-		csr_roam_close_session(mac, sessionId, true);
+		csr_roam_vdev_delete(mac, sessionId, true);
 
 	for (sessionId = 0; sessionId < WLAN_MAX_VDEVS; sessionId++)
 		csr_neighbor_roam_close(mac, sessionId);
@@ -1327,7 +1327,7 @@ static QDF_STATUS csr_roam_close(struct mac_context *mac)
 	 */
 	csr_purge_pdev_all_ser_cmd_list(mac);
 	for (sessionId = 0; sessionId < WLAN_MAX_VDEVS; sessionId++)
-		csr_roam_close_session(mac, sessionId, true);
+		csr_roam_vdev_delete(mac, sessionId, true);
 
 	qdf_mc_timer_stop(&mac->roam.hTimerWaitForKey);
 	qdf_mc_timer_destroy(&mac->roam.hTimerWaitForKey);
@@ -13060,35 +13060,38 @@ end:
 	}
 }
 
-QDF_STATUS csr_process_del_sta_session_command(struct mac_context *mac_ctx,
-					       tSmeCmd *sme_command)
+QDF_STATUS csr_process_del_vdev_command(struct mac_context *mac_ctx,
+					tSmeCmd *sme_command)
 {
-	struct del_sta_self_params *del_sta_self_req;
+	struct del_vdev_params *del_vdev_req;
 	struct scheduler_msg msg = {0};
 	QDF_STATUS status;
 
-	del_sta_self_req = qdf_mem_malloc(sizeof(struct del_sta_self_params));
-	if (!del_sta_self_req)
+	del_vdev_req = qdf_mem_malloc(sizeof(struct del_vdev_params));
+	if (!del_vdev_req)
 		return QDF_STATUS_E_NOMEM;
 
-	qdf_mem_copy(del_sta_self_req->self_mac_addr,
+	qdf_mem_copy(del_vdev_req->self_mac_addr,
 		     sme_command->u.delStaSessionCmd.self_mac_addr,
 		     sizeof(tSirMacAddr));
 
-	del_sta_self_req->session_id = sme_command->sessionId;
-	del_sta_self_req->sme_callback =
+	del_vdev_req->vdev_id = sme_command->sessionId;
+	del_vdev_req->sme_callback =
 		sme_command->u.delStaSessionCmd.session_close_cb;
-	del_sta_self_req->sme_ctx = sme_command->u.delStaSessionCmd.context;
-	msg.type = WMA_DEL_STA_SELF_REQ;
+	del_vdev_req->sme_ctx = sme_command->u.delStaSessionCmd.context;
+	msg.type = eWNI_SME_VDEV_DELETE_REQ;
 	msg.reserved = 0;
-	msg.bodyptr = del_sta_self_req;
+	msg.bodyptr = del_vdev_req;
 	msg.bodyval = 0;
 
-	sme_debug("sending WMA_DEL_STA_SELF_REQ");
-	status = wma_post_ctrl_msg(mac_ctx, &msg);
+	sme_debug("sending eWNI_SME_VDEV_DELETE_REQ");
+	status = scheduler_post_message(
+				QDF_MODULE_ID_SME,
+				QDF_MODULE_ID_PE,
+				QDF_MODULE_ID_PE, &msg);
 	if (status != QDF_STATUS_SUCCESS) {
 		sme_err("wma_post_ctrl_msg failed");
-		qdf_mem_free(del_sta_self_req);
+		qdf_mem_free(del_vdev_req);
 		return QDF_STATUS_E_FAILURE;
 	}
 	return QDF_STATUS_SUCCESS;
@@ -17106,16 +17109,16 @@ QDF_STATUS csr_create_vdev(struct mac_context *mac_ctx,
 	return csr_issue_vdev_create_req(mac_ctx, session->sessionId);
 }
 
-QDF_STATUS csr_process_del_sta_session_rsp(struct mac_context *mac_ctx,
-					   uint8_t *pMsg)
+QDF_STATUS csr_process_vdev_del_rsp(struct mac_context *mac_ctx,
+				    uint8_t *pmsg)
 {
 	QDF_STATUS status = QDF_STATUS_E_FAILURE;
-	struct del_sta_self_params *rsp;
-	uint8_t sessionId;
+	struct del_vdev_params *rsp;
+	uint8_t vdev_id;
 	tListElem *entry;
 	tSmeCmd *sme_command;
 
-	if (!pMsg) {
+	if (!pmsg) {
 		sme_err("msg ptr is NULL");
 		return status;
 	}
@@ -17127,22 +17130,22 @@ QDF_STATUS csr_process_del_sta_session_rsp(struct mac_context *mac_ctx,
 	}
 
 	sme_command = GET_BASE_ADDR(entry, tSmeCmd, Link);
-	if (e_sme_command_del_sta_session != sme_command->command) {
-		sme_err("No Del sta session command ACTIVE");
+	if (e_sme_command_del_vdev != sme_command->command) {
+		sme_err("No Del vdev command ACTIVE");
 		return status;
 	}
 
-	rsp = (struct del_sta_self_params *) pMsg;
-	sessionId = rsp->session_id;
-	sme_debug("Del Sta rsp status = %d", rsp->status);
+	rsp = (struct del_vdev_params *)pmsg;
+	vdev_id = rsp->vdev_id;
+	sme_debug("vdev delete rsp status = %d", rsp->status);
 
 	/*
 	 * This session is done. This will also flush all the pending command
 	 * for this vdev, as vdev is deleted and no command should be sent
-	 * for this vdev. Active cmnd is e_sme_command_del_sta_session and will
+	 * for this vdev. Active cmnd is e_sme_command_del_vdev and will
 	 * be removed anyway next.
 	 */
-	csr_cleanup_session(mac_ctx, sessionId);
+	csr_cleanup_session(mac_ctx, vdev_id);
 
 	/* Remove this command out of the non scan active list */
 	if (csr_nonscan_active_ll_remove_entry(mac_ctx, entry,
@@ -17155,7 +17158,7 @@ QDF_STATUS csr_process_del_sta_session_rsp(struct mac_context *mac_ctx,
 		if (!QDF_IS_STATUS_SUCCESS(status))
 			sme_debug("Failed to Release Lock");
 		else {
-			rsp->sme_callback(rsp->session_id);
+			rsp->sme_callback(rsp->vdev_id);
 			status = sme_acquire_global_lock(&mac_ctx->sme);
 			if (!QDF_IS_STATUS_SUCCESS(status))
 				return status;
@@ -17165,12 +17168,11 @@ QDF_STATUS csr_process_del_sta_session_rsp(struct mac_context *mac_ctx,
 	return QDF_STATUS_SUCCESS;
 }
 
-
 static QDF_STATUS
-csr_issue_del_sta_for_session_req(struct mac_context *mac_ctx, uint32_t session_id,
-				  tSirMacAddr session_mac_addr,
-				  csr_session_close_cb callback,
-				  void *context)
+csr_issue_vdev_del_req(struct mac_context *mac_ctx, uint8_t vdev_id,
+		       tSirMacAddr session_mac_addr,
+		       csr_session_close_cb callback,
+		       void *context)
 {
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
 	tSmeCmd *sme_command;
@@ -17179,31 +17181,32 @@ csr_issue_del_sta_for_session_req(struct mac_context *mac_ctx, uint32_t session_
 	if (!sme_command) {
 		status = QDF_STATUS_E_RESOURCES;
 	} else {
-		sme_command->command = e_sme_command_del_sta_session;
-		sme_command->sessionId = (uint8_t)session_id;
+		sme_command->command = e_sme_command_del_vdev;
+		sme_command->sessionId = vdev_id;
 		sme_command->u.delStaSessionCmd.session_close_cb = callback;
 		sme_command->u.delStaSessionCmd.context = context;
 		qdf_mem_copy(sme_command->u.delStaSessionCmd.self_mac_addr,
 			     session_mac_addr, sizeof(tSirMacAddr));
 		status = csr_queue_sme_command(mac_ctx, sme_command, false);
 		if (!QDF_IS_STATUS_SUCCESS(status))
-			sme_err("fail to send message status = %d", status);
+			sme_err("fail to queue vdev delete command = %d",
+				status);
 	}
 	return status;
 }
 
-void csr_cleanup_session(struct mac_context *mac, uint32_t sessionId)
+void csr_cleanup_session(struct mac_context *mac, uint8_t vdev_id)
 {
-	if (CSR_IS_SESSION_VALID(mac, sessionId)) {
+	if (CSR_IS_SESSION_VALID(mac, vdev_id)) {
 		struct csr_roam_session *pSession = CSR_GET_SESSION(mac,
-								sessionId);
+								vdev_id);
 
-		csr_roam_stop(mac, sessionId);
+		csr_roam_stop(mac, vdev_id);
 
 		/* Clean up FT related data structures */
-		sme_ft_close(MAC_HANDLE(mac), sessionId);
-		csr_free_connect_bss_desc(mac, sessionId);
-		sme_reset_key(MAC_HANDLE(mac), sessionId);
+		sme_ft_close(MAC_HANDLE(mac), vdev_id);
+		csr_free_connect_bss_desc(mac, vdev_id);
+		sme_reset_key(MAC_HANDLE(mac), vdev_id);
 		csr_reset_cfg_privacy(mac);
 		csr_roam_free_connect_profile(&pSession->connectedProfile);
 		csr_roam_free_connected_info(mac, &pSession->connectedInfo);
@@ -17211,49 +17214,49 @@ void csr_cleanup_session(struct mac_context *mac, uint32_t sessionId)
 					     &pSession->prev_assoc_ap_info);
 		qdf_mc_timer_destroy(&pSession->hTimerRoaming);
 		qdf_mc_timer_destroy(&pSession->roaming_offload_timer);
-		csr_purge_vdev_pending_ser_cmd_list(mac, sessionId);
-		csr_init_session(mac, sessionId);
+		csr_purge_vdev_pending_ser_cmd_list(mac, vdev_id);
+		csr_init_session(mac, vdev_id);
 	}
 }
 
-QDF_STATUS csr_roam_close_session(struct mac_context *mac_ctx,
-				  uint32_t session_id, bool sync)
+QDF_STATUS csr_roam_vdev_delete(struct mac_context *mac_ctx,
+				uint8_t vdev_id, bool cleanup)
 {
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
 	struct csr_roam_session *session;
 
-	if (!CSR_IS_SESSION_VALID(mac_ctx, session_id)) {
-		sme_debug("session %d not found", session_id);
+	if (!CSR_IS_SESSION_VALID(mac_ctx, vdev_id)) {
+		sme_debug("session %d not found", vdev_id);
 		return QDF_STATUS_E_INVAL;
 	}
 
-	session = CSR_GET_SESSION(mac_ctx, session_id);
+	session = CSR_GET_SESSION(mac_ctx, vdev_id);
 	/* Vdev going down stop roaming */
 	session->fCancelRoaming = true;
-	if (sync) {
-		csr_cleanup_session(mac_ctx, session_id);
+	if (cleanup) {
+		csr_cleanup_session(mac_ctx, vdev_id);
 		return status;
 	}
 
-	if (CSR_IS_WAIT_FOR_KEY(mac_ctx, session_id)) {
+	if (CSR_IS_WAIT_FOR_KEY(mac_ctx, vdev_id)) {
 		sme_debug("Stop Wait for key timer and change substate to eCSR_ROAM_SUBSTATE_NONE");
 		csr_roam_stop_wait_for_key_timer(mac_ctx);
 		csr_roam_substate_change(mac_ctx, eCSR_ROAM_SUBSTATE_NONE,
-					 session_id);
+					 vdev_id);
 	}
 
 	/*
 	 * Flush only scan commands. Non scan commands should go in sequence
 	 * as expected by firmware and should not be flushed.
 	 */
-	csr_purge_vdev_all_scan_ser_cmd_list(mac_ctx, session_id);
+	csr_purge_vdev_all_scan_ser_cmd_list(mac_ctx, vdev_id);
 	if (!session->session_close_cb) {
 		sme_err("no close session callback registered");
 		return QDF_STATUS_E_FAILURE;
 	}
-	status = csr_issue_del_sta_for_session_req(mac_ctx,
-			session_id, session->self_mac_addr.bytes,
-			session->session_close_cb, NULL);
+	status = csr_issue_vdev_del_req(mac_ctx, vdev_id,
+					session->self_mac_addr.bytes,
+					session->session_close_cb, NULL);
 	return status;
 }
 
@@ -19658,7 +19661,7 @@ enum wlan_serialization_cmd_type csr_get_cmd_type(tSmeCmd *sme_cmd)
 	case eSmeCommandWmStatusChange:
 		cmd_type = WLAN_SER_CMD_WM_STATUS_CHANGE;
 		break;
-	case e_sme_command_del_sta_session:
+	case e_sme_command_del_vdev:
 		cmd_type = WLAN_SER_CMD_DEL_STA_SESSION;
 		break;
 	case eSmeCommandAddTs:

+ 24 - 3
core/sme/src/csr/csr_inside_api.h

@@ -366,9 +366,30 @@ QDF_STATUS csr_save_to_channel_power2_g_5_g(struct mac_context *mac,
 					*channelTable);
 QDF_STATUS csr_roam_set_key(struct mac_context *mac, uint32_t sessionId,
 			    tCsrRoamSetKey *pSetKey, uint32_t roamId);
-QDF_STATUS csr_roam_close_session(struct mac_context *mac_ctx,
-				  uint32_t session_id, bool sync);
-void csr_cleanup_session(struct mac_context *mac, uint32_t sessionId);
+
+/*
+ * csr_roam_vdev_delete() - CSR api to delete vdev
+ * @mac_ctx: pointer to mac context
+ * @vdev_id: vdev id to be deleted.
+ * @cleanup: clean up vdev session on true
+ *
+ * Return QDF_STATUS
+ */
+QDF_STATUS csr_roam_vdev_delete(struct mac_context *mac_ctx,
+				uint8_t vdev_id, bool cleanup);
+
+/*
+ * csr_cleanup_session() - CSR api to cleanup vdev
+ * @mac_ctx: pointer to mac context
+ * @vdev_id: vdev id to be deleted.
+ *
+ * This API is used to clean up vdev information gathered during
+ * vdev was enabled.
+ *
+ * Return QDF_STATUS
+ */
+void csr_cleanup_session(struct mac_context *mac, uint8_t vdev_id);
+
 QDF_STATUS csr_roam_get_session_id_from_bssid(struct mac_context *mac,
 						struct qdf_mac_addr *bssid,
 					      uint32_t *pSessionId);

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

@@ -173,7 +173,6 @@
 
 #define WMA_TARGET_REQ_TYPE_VDEV_START 0x1
 #define WMA_TARGET_REQ_TYPE_VDEV_STOP  0x2
-#define WMA_TARGET_REQ_TYPE_VDEV_DEL   0x3
 
 #define WMA_PEER_ASSOC_CNF_START 0x01
 #define WMA_PEER_ASSOC_TIMEOUT SIR_PEER_ASSOC_TIMEOUT

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

@@ -666,6 +666,20 @@ QDF_STATUS wma_mon_mlme_vdev_stop_send(struct vdev_mlme_obj *vdev_mlme,
 QDF_STATUS wma_mon_mlme_vdev_down_send(struct vdev_mlme_obj *vdev_mlme,
 				       uint16_t data_len, void *data);
 
+/**
+ * wma_vdev_detach_callback() - VDEV delete response handler
+ * @vdev_mlme_obj:  VDEV MLME comp object
+ * @rsp: pointer to vdev delete response
+ *
+ * This API proccesses vdev delete response and gives to upper layers
+ *
+ * Return: SUCCESS on successful completion of VDEV delete operation
+ *         FAILURE, if it fails due to any
+ */
+QDF_STATUS wma_vdev_detach_callback(
+				struct vdev_mlme_obj *vdev_mlme,
+				struct vdev_delete_response *rsp);
+
 #ifdef FEATURE_WLM_STATS
 /**
  * typedef wma_wlm_stats_cb() - Callback function for WLM stats

+ 4 - 5
core/wma/inc/wma_if.h

@@ -916,15 +916,15 @@ struct set_dtim_params {
 #define DOT11_VHT_IE    2
 
 /**
- * struct del_sta_self_params - Del Sta Self params
+ * struct del_vdev_params - Del Sta Self params
  * @session_id: SME Session ID
  * @status: response status code
  * @sme_callback: callback to be called from WMA to SME
  * @sme_ctx: pointer to context provided by SME
  */
-struct del_sta_self_params {
+struct del_vdev_params {
 	tSirMacAddr self_mac_addr;
-	uint8_t session_id;
+	uint8_t vdev_id;
 	uint32_t status;
 	csr_session_close_cb sme_callback;
 	void *sme_ctx;
@@ -936,8 +936,7 @@ struct del_sta_self_params {
  * @generate_rsp: generate response to upper layers
  */
 struct del_sta_self_rsp_params {
-	struct del_sta_self_params *self_sta_param;
-	uint8_t generate_rsp;
+	struct del_vdev_params *self_sta_param;
 };
 
 /**

+ 8 - 4
core/wma/inc/wma_internal.h

@@ -564,9 +564,15 @@ static inline uint8_t *wma_find_bssid_by_vdev_id(tp_wma_handle wma,
 struct cdp_vdev *wma_find_vdev_by_bssid(tp_wma_handle wma, uint8_t *bssid,
 				    uint8_t *vdev_id);
 
+/**
+ * wma_vdev_detach() - send vdev delete command to fw
+ * @wma_handle: wma handle
+ * @pdel_vdev_req_param: del vdev params
+ *
+ * Return: QDF status
+ */
 QDF_STATUS wma_vdev_detach(tp_wma_handle wma_handle,
-			struct del_sta_self_params *pdel_sta_self_req_param,
-			uint8_t generateRsp);
+			struct del_vdev_params *pdel_vdev_req_param);
 
 /**
  * wma_release_vdev_and_peer_ref() - release vdev ref taken by interface txrx
@@ -1282,8 +1288,6 @@ QDF_STATUS wma_process_set_ie_info(tp_wma_handle wma,
 				   struct vdev_ie_info *ie_info);
 int wma_peer_assoc_conf_handler(void *handle, uint8_t *cmd_param_info,
 				uint32_t len);
-int wma_vdev_delete_handler(void *handle, uint8_t *cmd_param_info,
-				uint32_t len);
 
 int wma_peer_delete_handler(void *handle, uint8_t *cmd_param_info,
 				uint32_t len);

+ 0 - 1
core/wma/inc/wma_types.h

@@ -207,7 +207,6 @@
 #ifdef WLAN_NS_OFFLOAD
 #define WMA_SET_NS_OFFLOAD             SIR_HAL_SET_NS_OFFLOAD
 #endif /* WLAN_NS_OFFLOAD */
-#define WMA_DEL_STA_SELF_REQ           SIR_HAL_DEL_STA_SELF_REQ
 
 #ifdef FEATURE_WLAN_TDLS
 #define WMA_SET_TDLS_LINK_ESTABLISH_REQ SIR_HAL_TDLS_LINK_ESTABLISH_REQ

+ 71 - 203
core/wma/src/wma_dev_if.c

@@ -81,6 +81,7 @@
 #include "wlan_mlme_public_struct.h"
 #include "wlan_mlme_api.h"
 #include "wlan_mlme_main.h"
+#include "../../core/src/vdev_mgr_ops.h"
 
 /**
  * wma_find_vdev_by_addr() - find vdev_id from mac address
@@ -496,17 +497,17 @@ static struct wma_target_req *wma_find_vdev_req(tp_wma_handle wma,
 }
 
 /**
- * wma_send_del_sta_self_resp() - send del sta self resp to Upper layer
- * @param: params of del sta resp
+ * wma_send_vdev_del_resp() - send vdev del resp to Upper layer
+ * @param: params of del vdev response
  *
  * Return: none
  */
-static inline void wma_send_del_sta_self_resp(struct del_sta_self_params *param)
+static inline void wma_send_vdev_del_resp(struct del_vdev_params *param)
 {
 	struct scheduler_msg sme_msg = {0};
 	QDF_STATUS status;
 
-	sme_msg.type = eWNI_SME_DEL_STA_SELF_RSP;
+	sme_msg.type = eWNI_SME_VDEV_DELETE_RSP;
 	sme_msg.bodyptr = param;
 
 	status = scheduler_post_message(QDF_MODULE_ID_WMA,
@@ -516,44 +517,32 @@ static inline void wma_send_del_sta_self_resp(struct del_sta_self_params *param)
 		qdf_mem_free(param);
 }
 
-/**
- * wma_vdev_detach_callback() - send vdev detach response to upper layer
- * @ctx: txrx node ptr
- *
- * Return: none
- */
-static void wma_vdev_detach_callback(void *ctx)
+QDF_STATUS wma_vdev_detach_callback(
+				struct vdev_mlme_obj *vdev_mlme,
+				struct vdev_delete_response *rsp)
 {
 	tp_wma_handle wma;
-	struct wma_txrx_node *iface = (struct wma_txrx_node *)ctx;
-	struct del_sta_self_params *param;
-	struct wma_target_req *req_msg;
+	struct wma_txrx_node *iface = NULL;
+	struct del_vdev_params *param;
 
 	wma = cds_get_context(QDF_MODULE_ID_WMA);
 
-	if (!wma || !iface->del_staself_req) {
-		WMA_LOGE("%s: wma %pK iface %pK", __func__, wma,
-			 iface->del_staself_req);
-		return;
+	if (!wma) {
+		wma_err("wma handle is NULL for VDEV_%d", rsp->vdev_id);
+		return QDF_STATUS_E_FAILURE;
 	}
-	param = (struct del_sta_self_params *) iface->del_staself_req;
-	iface->del_staself_req = NULL;
-	WMA_LOGD("%s: sending eWNI_SME_DEL_STA_SELF_RSP for vdev %d",
-		 __func__, param->session_id);
-	if (!wmi_service_enabled(wma->wmi_handle,
-				    wmi_service_sync_delete_cmds)) {
-		req_msg = wma_find_vdev_req(wma, param->session_id,
-					    WMA_TARGET_REQ_TYPE_VDEV_DEL,
-					    true);
-		if (req_msg) {
-			WMA_LOGD("%s: Found vdev request for vdev id %d",
-				 __func__, param->session_id);
-			qdf_mc_timer_stop(&req_msg->event_timeout);
-			qdf_mc_timer_destroy(&req_msg->event_timeout);
-			qdf_mem_free(req_msg);
-		}
+
+	iface = &wma->interfaces[vdev_mlme->vdev->vdev_objmgr.vdev_id];
+
+	if (!iface->del_staself_req) {
+		wma_err(" iface handle is NULL for VDEV_%d", rsp->vdev_id);
+		return QDF_STATUS_E_FAILURE;
 	}
 
+	wma_debug("vdev del response received for VDEV_%d", rsp->vdev_id);
+	param = (struct del_vdev_params *)iface->del_staself_req;
+	iface->del_staself_req = NULL;
+
 	if (iface->roam_scan_stats_req) {
 		struct sir_roam_scan_stats *roam_scan_stats_req =
 						iface->roam_scan_stats_req;
@@ -567,34 +556,34 @@ static void wma_vdev_detach_callback(void *ctx)
 	wma_vdev_init(iface);
 
 	param->status = QDF_STATUS_SUCCESS;
-	wma_send_del_sta_self_resp(param);
-}
+	wma_send_vdev_del_resp(param);
 
+	return param->status;
+}
 
 /**
  * wma_self_peer_remove() - Self peer remove handler
  * @wma: wma handle
- * @del_sta_self_req_param: vdev id
+ * @del_vdev_req_param: vdev id
  * @generate_vdev_rsp: request type
  *
  * Return: success if peer delete command sent to firmware, else failure.
  */
 
 static QDF_STATUS wma_self_peer_remove(tp_wma_handle wma_handle,
-			struct del_sta_self_params *del_sta_self_req_param,
-			uint8_t generate_vdev_rsp)
+			struct del_vdev_params *del_vdev_req_param)
 {
 	void *peer;
 	struct cdp_pdev *pdev;
 	QDF_STATUS qdf_status;
 	uint8_t peer_id;
-	uint8_t vdev_id = del_sta_self_req_param->session_id;
+	uint8_t vdev_id = del_vdev_req_param->vdev_id;
 	struct wma_target_req *msg = NULL;
 	struct del_sta_self_rsp_params *sta_self_wmi_rsp;
 	void *soc = cds_get_context(QDF_MODULE_ID_SOC);
 
 	WMA_LOGD("P2P Device: removing self peer %pM",
-		 del_sta_self_req_param->self_mac_addr);
+		 del_vdev_req_param->self_mac_addr);
 
 	pdev = cds_get_context(QDF_MODULE_ID_TXRX);
 	if (!pdev) {
@@ -604,17 +593,17 @@ static QDF_STATUS wma_self_peer_remove(tp_wma_handle wma_handle,
 	}
 
 	peer = cdp_peer_find_by_addr(soc, pdev,
-			del_sta_self_req_param->self_mac_addr,
+			del_vdev_req_param->self_mac_addr,
 			&peer_id);
 	if (!peer) {
 		WMA_LOGE("%s Failed to find peer %pM", __func__,
-			 del_sta_self_req_param->self_mac_addr);
+			 del_vdev_req_param->self_mac_addr);
 		qdf_status = QDF_STATUS_E_FAULT;
 		goto error;
 	}
 
 	qdf_status = wma_remove_peer(wma_handle,
-				     del_sta_self_req_param->self_mac_addr,
+				     del_vdev_req_param->self_mac_addr,
 				     vdev_id, peer, false);
 	if (QDF_IS_STATUS_ERROR(qdf_status)) {
 		WMA_LOGE(FL("wma_remove_peer is failed"));
@@ -629,8 +618,7 @@ static QDF_STATUS wma_self_peer_remove(tp_wma_handle wma_handle,
 			qdf_status = QDF_STATUS_E_NOMEM;
 			goto error;
 		}
-		sta_self_wmi_rsp->self_sta_param = del_sta_self_req_param;
-		sta_self_wmi_rsp->generate_rsp = generate_vdev_rsp;
+		sta_self_wmi_rsp->self_sta_param = del_vdev_req_param;
 		msg = wma_fill_hold_req(wma_handle, vdev_id,
 				   WMA_DELETE_STA_REQ,
 				   WMA_DEL_P2P_SELF_STA_RSP_START,
@@ -705,14 +693,13 @@ static void wma_handle_monitor_mode_vdev_detach(tp_wma_handle wma,
 }
 
 static QDF_STATUS wma_handle_vdev_detach(tp_wma_handle wma_handle,
-			struct del_sta_self_params *del_sta_self_req_param,
-			uint8_t generate_rsp)
+			struct del_vdev_params *del_vdev_req_param)
 {
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
-	uint8_t vdev_id = del_sta_self_req_param->session_id;
+	uint8_t vdev_id = del_vdev_req_param->vdev_id;
 	struct wma_txrx_node *iface = &wma_handle->interfaces[vdev_id];
-	struct wma_target_req *msg = NULL;
 	void *soc = cds_get_context(QDF_MODULE_ID_SOC);
+	struct vdev_mlme_obj *vdev_mlme;
 
 	if (!soc) {
 		WMA_LOGE("%s:SOC context is NULL", __func__);
@@ -720,65 +707,46 @@ static QDF_STATUS wma_handle_vdev_detach(tp_wma_handle wma_handle,
 		goto out;
 	}
 
+	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(iface->vdev);
+	if (!vdev_mlme) {
+		wma_err("Failed to get vdev mlme obj for vdev id %d",
+			del_vdev_req_param->vdev_id);
+		qdf_mem_free(del_vdev_req_param);
+		return QDF_STATUS_E_INVAL;
+	}
+
 	if (cds_get_conparam() == QDF_GLOBAL_MONITOR_MODE)
 		wma_handle_monitor_mode_vdev_detach(wma_handle, vdev_id);
 
-	status = wmi_unified_vdev_delete_send(wma_handle->wmi_handle, vdev_id);
+	status = vdev_mgr_delete_send(vdev_mlme);
 	if (QDF_IS_STATUS_ERROR(status)) {
 		WMA_LOGE("Unable to remove an interface");
 		goto out;
 	}
 
 	WMA_LOGD("vdev_id:%hu", vdev_id);
-	if (!generate_rsp) {
-		WMA_LOGE("Call txrx detach w/o callback for vdev %d", vdev_id);
-		goto out;
-	}
 
-	iface->del_staself_req = del_sta_self_req_param;
-	msg = wma_fill_vdev_req(wma_handle, vdev_id, WMA_DEL_STA_SELF_REQ,
-				WMA_TARGET_REQ_TYPE_VDEV_DEL, iface, 6000);
-	if (!msg) {
-		WMA_LOGE("%s: Failed to fill vdev request for vdev_id %d",
-			 __func__, vdev_id);
-		status = QDF_STATUS_E_NOMEM;
-		iface->del_staself_req = NULL;
-		goto out;
-	}
-
-	/* Acquire wake lock only when you expect a response from firmware */
-	if (wmi_service_enabled(wma_handle->wmi_handle,
-				   wmi_service_sync_delete_cmds)) {
-		wma_acquire_wakelock(&wma_handle->wmi_cmd_rsp_wake_lock,
-				     WMA_FW_RSP_EVENT_WAKE_LOCK_DURATION);
-	}
+	del_vdev_req_param->status = status;
+	iface->del_staself_req = del_vdev_req_param;
 	WMA_LOGD("Call txrx detach with callback for vdev %d", vdev_id);
 	wlan_vdev_set_dp_handle(iface->vdev, NULL);
-	wma_release_vdev_ref(iface);
 	wma_cdp_vdev_detach(soc, wma_handle, vdev_id);
+	wma_release_vdev_ref(iface);
 
-	/*
-	 * send the response immediately if WMI_SERVICE_SYNC_DELETE_CMDS
-	 * service is not supported by firmware
-	 */
-	if (!wmi_service_enabled(wma_handle->wmi_handle,
-				    wmi_service_sync_delete_cmds))
-		wma_vdev_detach_callback(iface);
 	return status;
+
 out:
-	WMA_LOGE("Call txrx detach callback for vdev %d, generate_rsp %u",
-		vdev_id, generate_rsp);
+	WMA_LOGE("Call txrx detach callback for vdev %d", vdev_id);
 	wlan_vdev_set_dp_handle(iface->vdev, NULL);
-	wma_release_vdev_ref(iface);
 	wma_cdp_vdev_detach(soc, wma_handle, vdev_id);
+	wma_release_vdev_ref(iface);
 
 	wma_vdev_deinit(iface);
 	qdf_mem_zero(iface, sizeof(*iface));
 	wma_vdev_init(iface);
 
-	del_sta_self_req_param->status = status;
-	if (generate_rsp)
-		wma_send_del_sta_self_resp(del_sta_self_req_param);
+	del_vdev_req_param->status = status;
+	wma_send_vdev_del_resp(del_vdev_req_param);
 	return status;
 }
 
@@ -911,21 +879,12 @@ static void wma_remove_objmgr_peer(tp_wma_handle wma, uint8_t vdev_id,
 	wlan_objmgr_vdev_release_ref(obj_vdev, WLAN_LEGACY_WMA_ID);
 }
 
-/**
- * wma_vdev_detach() - send vdev delete command to fw
- * @wma_handle: wma handle
- * @pdel_sta_self_req_param: del sta params
- * @generateRsp: generate Response flag
- *
- * Return: QDF status
- */
 QDF_STATUS wma_vdev_detach(tp_wma_handle wma_handle,
-			struct del_sta_self_params *pdel_sta_self_req_param,
-			uint8_t generateRsp)
+			struct del_vdev_params *pdel_vdev_req_param)
 {
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
 	void *soc = cds_get_context(QDF_MODULE_ID_SOC);
-	uint8_t vdev_id = pdel_sta_self_req_param->session_id;
+	uint8_t vdev_id = pdel_vdev_req_param->vdev_id;
 	struct wma_txrx_node *iface = &wma_handle->interfaces[vdev_id];
 	struct wma_target_req *req_msg;
 
@@ -958,45 +917,38 @@ QDF_STATUS wma_vdev_detach(tp_wma_handle wma_handle,
 			goto send_fail_rsp;
 		WMA_LOGA("BSS is not yet stopped. Defering vdev(vdev id %x) deletion",
 			vdev_id);
-		iface->del_staself_req = pdel_sta_self_req_param;
+		iface->del_staself_req = pdel_vdev_req_param;
 		iface->is_del_sta_defered = true;
 		return status;
 	}
 	iface->is_del_sta_defered = false;
 
 	if (wma_vdev_uses_self_peer(iface->type, iface->sub_type)) {
-		status = wma_self_peer_remove(wma_handle,
-					pdel_sta_self_req_param, generateRsp);
-		if ((status != QDF_STATUS_SUCCESS) && generateRsp) {
+		status = wma_self_peer_remove(wma_handle, pdel_vdev_req_param);
+		if (QDF_IS_STATUS_ERROR(status)) {
 			WMA_LOGE("can't remove selfpeer, send rsp session: %d",
 				 vdev_id);
 			status = wma_handle_vdev_detach(wma_handle,
-							pdel_sta_self_req_param,
-							generateRsp);
+							pdel_vdev_req_param);
 			if (QDF_IS_STATUS_ERROR(status)) {
 				WMA_LOGE("Trigger recovery for vdev %d",
 					 vdev_id);
 				cds_trigger_recovery(QDF_REASON_UNSPECIFIED);
 			}
 			return status;
-		} else if (status != QDF_STATUS_SUCCESS) {
-			WMA_LOGE("can't remove selfpeer, free msg session: %d",
-				 vdev_id);
-			qdf_mem_free(pdel_sta_self_req_param);
-			pdel_sta_self_req_param = NULL;
-			return status;
 		}
+
 		if (!wmi_service_enabled(wma_handle->wmi_handle,
 				wmi_service_sync_delete_cmds))
 			status = wma_handle_vdev_detach(wma_handle,
-				pdel_sta_self_req_param, generateRsp);
+							pdel_vdev_req_param);
 	} else {
 		if (iface->type == WMI_VDEV_TYPE_STA) {
 			wma_remove_objmgr_peer(wma_handle, vdev_id,
-				pdel_sta_self_req_param->self_mac_addr);
+				pdel_vdev_req_param->self_mac_addr);
 		}
 		status = wma_handle_vdev_detach(wma_handle,
-				pdel_sta_self_req_param, generateRsp);
+						pdel_vdev_req_param);
 	}
 
 	if (QDF_IS_STATUS_SUCCESS(status) &&
@@ -1011,13 +963,9 @@ send_fail_rsp:
 	status = QDF_STATUS_E_FAILURE;
 
 send_rsp:
-	if (generateRsp) {
-		pdel_sta_self_req_param->status = status;
-		wma_send_del_sta_self_resp(pdel_sta_self_req_param);
-	} else {
-		qdf_mem_free(pdel_sta_self_req_param);
-		pdel_sta_self_req_param = NULL;
-	}
+	pdel_vdev_req_param->status = status;
+	wma_send_vdev_del_resp(pdel_vdev_req_param);
+
 	return status;
 }
 
@@ -2336,7 +2284,7 @@ void wma_send_del_bss_response(tp_wma_handle wma, struct wma_target_req *req)
 		iface->is_del_sta_defered = false;
 		WMA_LOGA("scheduling defered deletion (vdev id %x)",
 			 vdev_id);
-		wma_vdev_detach(wma, iface->del_staself_req, 1);
+		wma_vdev_detach(wma, iface->del_staself_req);
 	}
 }
 
@@ -3352,55 +3300,6 @@ free_req_msg:
 	return status;
 }
 
-/**
- * wma_vdev_delete_handler() - vdev delete response handler
- * @handle: wma handle
- * @cmd_param_info: event buffer
- * @len: buffer length
- *
- * Return: 0 for success or error code
- */
-int wma_vdev_delete_handler(void *handle, uint8_t *cmd_param_info,
-				uint32_t len)
-{
-	tp_wma_handle wma = (tp_wma_handle) handle;
-	WMI_VDEV_DELETE_RESP_EVENTID_param_tlvs *param_buf;
-	wmi_vdev_delete_cmd_fixed_param *event;
-	struct wma_target_req *req_msg;
-	int status = 0;
-
-	param_buf = (WMI_VDEV_DELETE_RESP_EVENTID_param_tlvs *)cmd_param_info;
-	if (!param_buf) {
-		WMA_LOGE("Invalid vdev delete event buffer");
-		return -EINVAL;
-	}
-
-	event = (wmi_vdev_delete_cmd_fixed_param *)param_buf->fixed_param;
-	if (!event) {
-		WMA_LOGE("Invalid vdev delete event buffer");
-		return -EINVAL;
-	}
-
-	WMA_LOGD("%s Vdev delete resp vdev id %d", __func__, event->vdev_id);
-	req_msg = wma_find_vdev_req(wma, event->vdev_id,
-				WMA_TARGET_REQ_TYPE_VDEV_DEL, true);
-	if (!req_msg) {
-		WMA_LOGD(FL("Vdev delete resp is not handled! vdev id %d"),
-				event->vdev_id);
-		return -EINVAL;
-	}
-	qdf_mc_timer_stop(&req_msg->event_timeout);
-	qdf_mc_timer_destroy(&req_msg->event_timeout);
-
-	wma_release_wakelock(&wma->wmi_cmd_rsp_wake_lock);
-
-	/* Send response to upper layers */
-	wma_vdev_detach_callback(req_msg->user_data);
-	qdf_mem_free(req_msg);
-
-	return status;
-}
-
 /**
  * wma_peer_delete_handler() - peer delete response handler
  * @handle: wma handle
@@ -3464,8 +3363,7 @@ int wma_peer_delete_handler(void *handle, uint8_t *cmd_param_info,
 
 		data = (struct del_sta_self_rsp_params *)req_msg->user_data;
 		WMA_LOGD(FL("Calling vdev detach handler"));
-		wma_handle_vdev_detach(wma, data->self_sta_param,
-				data->generate_rsp);
+		wma_handle_vdev_detach(wma, data->self_sta_param);
 		qdf_mem_free(data);
 	} else if (req_msg->type == WMA_SET_LINK_PEER_RSP) {
 		wma_handle_set_link_down_rsp(wma, req_msg);
@@ -3581,8 +3479,7 @@ void wma_hold_req_timer(void *data)
 		if (wma_crash_on_fw_timeout(wma->fw_timeout_crash))
 			wma_trigger_recovery_assert_on_fw_timeout(
 				WMA_DELETE_STA_REQ);
-		wma_handle_vdev_detach(wma, del_sta->self_sta_param,
-				       del_sta->generate_rsp);
+		wma_handle_vdev_detach(wma, del_sta->self_sta_param);
 		qdf_mem_free(tgt_req->user_data);
 	} else if ((tgt_req->msg_type == WMA_DELETE_STA_REQ) &&
 			(tgt_req->type == WMA_SET_LINK_PEER_RSP)) {
@@ -3798,7 +3695,6 @@ void wma_vdev_resp_timer(void *data)
 	void *peer;
 	void *soc = cds_get_context(QDF_MODULE_ID_SOC);
 	struct wma_txrx_node *iface;
-	struct del_sta_self_params *del_sta_self_params;
 #ifdef FEATURE_AP_MCC_CH_AVOIDANCE
 	struct mac_context *mac_ctx;
 #endif /* FEATURE_AP_MCC_CH_AVOIDANCE */
@@ -3926,36 +3822,8 @@ void wma_vdev_resp_timer(void *data)
 			iface->is_del_sta_defered = false;
 			WMA_LOGA("scheduling defered deletion(vdev id %x)",
 				 tgt_req->vdev_id);
-			wma_vdev_detach(wma, iface->del_staself_req, 1);
-		}
-	} else if (tgt_req->msg_type == WMA_DEL_STA_SELF_REQ) {
-		iface = (struct wma_txrx_node *)tgt_req->user_data;
-		del_sta_self_params =
-			(struct del_sta_self_params *) iface->del_staself_req;
-
-		if (wmi_service_enabled(wma->wmi_handle,
-					   wmi_service_sync_delete_cmds)) {
-			wma_release_wakelock(&wma->wmi_cmd_rsp_wake_lock);
+			wma_vdev_detach(wma, iface->del_staself_req);
 		}
-		del_sta_self_params->status = QDF_STATUS_E_TIMEOUT;
-
-		WMA_LOGA("%s: WMA_DEL_STA_SELF_REQ timedout", __func__);
-
-		if (wma_crash_on_fw_timeout(wma->fw_timeout_crash) == true) {
-			wma_trigger_recovery_assert_on_fw_timeout(
-				WMA_DEL_STA_SELF_REQ);
-		} else if (!cds_is_driver_unloading() &&
-			   (cds_is_fw_down() || cds_is_driver_recovering())) {
-			qdf_mem_free(iface->del_staself_req);
-			iface->del_staself_req = NULL;
-		} else {
-			wma_send_del_sta_self_resp(iface->del_staself_req);
-			iface->del_staself_req = NULL;
-		}
-
-		wma_vdev_deinit(iface);
-		qdf_mem_zero(iface, sizeof(*iface));
-		wma_vdev_init(iface);
 	} else if (tgt_req->msg_type == WMA_ADD_BSS_REQ) {
 
 		wma_handle_add_bss_req_timeout(wma, tgt_req);

+ 7 - 8
core/wma/src/wma_main.c

@@ -97,6 +97,8 @@
 #include "init_cmd_api.h"
 #include "nan_ucfg_api.h"
 #include "wma_coex.h"
+#include "target_if_vdev_mgr_rx_ops.h"
+
 #ifdef DIRECT_BUF_RX_ENABLE
 #include <target_if_direct_buf_rx_api.h>
 #endif
@@ -3554,10 +3556,11 @@ QDF_STATUS wma_open(struct wlan_objmgr_psoc *psoc,
 					   wmi_peer_assoc_conf_event_id,
 					   wma_peer_assoc_conf_handler,
 					   WMA_RX_SERIALIZER_CTX);
-	wmi_unified_register_event_handler(wma_handle->wmi_handle,
-					   wmi_vdev_delete_resp_event_id,
-					   wma_vdev_delete_handler,
-					   WMA_RX_SERIALIZER_CTX);
+	wmi_unified_register_event_handler(
+				wma_handle->wmi_handle,
+				wmi_vdev_delete_resp_event_id,
+				target_if_vdev_mgr_delete_response_handler,
+				WMA_RX_SERIALIZER_CTX);
 	wmi_unified_register_event_handler(wma_handle->wmi_handle,
 					   wmi_peer_delete_response_event_id,
 					   wma_peer_delete_handler,
@@ -8447,10 +8450,6 @@ static QDF_STATUS wma_mc_process_msg(struct scheduler_msg *msg)
 		wma_process_tsm_stats_req(wma_handle, (void *)msg->bodyptr);
 		break;
 #endif /* FEATURE_WLAN_ESE */
-	case WMA_DEL_STA_SELF_REQ:
-		wma_vdev_detach(wma_handle,
-				(struct del_sta_self_params *) msg->bodyptr, 1);
-		break;
 	case WMA_UPDATE_CHAN_LIST_REQ:
 		wma_update_channel_list(wma_handle,
 					(tSirUpdateChanList *) msg->bodyptr);