浏览代码

qcacld-3.0: Send the vdev create to firmware in the caller thread

Presently upon interface up a message is posted to the scheduler
to create the vdev, which sends the vdev create to the firmware,
for the vdev create there is no response from the firmware host
internally posts a fake message internally for the vdev create
response.

Dont post the vdev create to the scheduler thread but directly
send the vdev create to the firmware in the caller context.

Change-Id: Iafb186b13d948e421d152c3142cb8614fdbbffa6
CRs-Fixed: 2549530
Arun Kumar Khandavalli 5 年之前
父节点
当前提交
bcd5634dae

+ 10 - 0
components/mlme/core/inc/wlan_mlme_vdev_mgr_interface.h

@@ -232,4 +232,14 @@ QDF_STATUS mlme_set_vdev_stop_type(struct wlan_objmgr_vdev *vdev,
  */
 enum vdev_assoc_type  mlme_get_assoc_type(struct wlan_objmgr_vdev *vdev);
 
+/**
+ * mlme_vdev_create_send() - function to send the vdev create to firmware
+ * @vdev: vdev pointer
+ *
+ * Return: QDF_STATUS_SUCCESS when the command has been successfully sent
+ * to firmware or QDF_STATUS_E_** when there is a failure in sending the command
+ * to firmware.
+ */
+QDF_STATUS mlme_vdev_create_send(struct wlan_objmgr_vdev *vdev);
+
 #endif

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

@@ -24,6 +24,7 @@
 #include "wma_api.h"
 #include "lim_types.h"
 #include <include/wlan_mlme_cmn.h>
+#include <../../core/src/vdev_mgr_ops.h>
 
 static struct vdev_mlme_ops sta_mlme_ops;
 static struct vdev_mlme_ops ap_mlme_ops;
@@ -1069,6 +1070,35 @@ vdevmgr_vdev_start_rsp_handle(struct vdev_mlme_obj *vdev_mlme,
 	return status;
 }
 
+QDF_STATUS mlme_vdev_create_send(struct wlan_objmgr_vdev *vdev)
+{
+	struct vdev_mlme_obj *vdev_mlme = NULL;
+	QDF_STATUS status;
+
+	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
+	if (!vdev_mlme) {
+		mlme_err("Failed to get vdev mlme obj for vdev id %d",
+			 wlan_vdev_get_id(vdev));
+		status = QDF_STATUS_E_INVAL;
+		goto return_status;
+	}
+
+	status = vdev_mgr_create_send(vdev_mlme);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		mlme_err("Failed to create vdev for vdev id %d",
+			 wlan_vdev_get_id(vdev));
+		goto return_status;
+	}
+
+	status = wma_post_vdev_create_setup(vdev);
+
+	if (QDF_IS_STATUS_ERROR(status))
+		vdev_mgr_delete_send(vdev_mlme);
+
+return_status:
+	return status;
+}
+
 /**
  * struct sta_mlme_ops - VDEV MLME operation callbacks strucutre for sta
  * @mlme_vdev_start_send:               callback to initiate actions of VDEV

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

@@ -4307,33 +4307,6 @@ static QDF_STATUS hdd_register_interface(struct hdd_adapter *adapter, bool rtnl_
 	return QDF_STATUS_SUCCESS;
 }
 
-QDF_STATUS hdd_sme_open_session_callback(uint8_t vdev_id,
-					 QDF_STATUS qdf_status)
-{
-	struct hdd_adapter *adapter;
-	struct hdd_context *hdd_ctx;
-
-	hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
-	if (!hdd_ctx) {
-		hdd_err("Invalid HDD_CTX");
-		return QDF_STATUS_E_FAILURE;
-	}
-
-	adapter = hdd_get_adapter_by_vdev(hdd_ctx, vdev_id);
-	if (!adapter) {
-		hdd_err("NULL adapter for %d", vdev_id);
-		return QDF_STATUS_E_INVAL;
-	}
-
-	if (qdf_status == QDF_STATUS_SUCCESS)
-		set_bit(SME_SESSION_OPENED, &adapter->event_flags);
-
-	qdf_event_set(&adapter->qdf_session_open_event);
-	hdd_debug("session %d opened", adapter->vdev_id);
-
-	return QDF_STATUS_SUCCESS;
-}
-
 QDF_STATUS hdd_sme_close_session_callback(uint8_t vdev_id)
 {
 	struct hdd_adapter *adapter;
@@ -4498,7 +4471,6 @@ static int hdd_set_sme_session_param(struct hdd_adapter *adapter,
 {
 	session_param->vdev_id = adapter->vdev_id;
 	session_param->self_mac_addr = (uint8_t *)&adapter->mac_addr;
-	session_param->session_open_cb = hdd_sme_open_session_callback;
 	session_param->session_close_cb = hdd_sme_close_session_callback;
 	session_param->callback = callback;
 	session_param->callback_ctx = callback_ctx;
@@ -4562,13 +4534,6 @@ int hdd_vdev_create(struct hdd_adapter *adapter,
 		return errno;
 	}
 
-	/* Open a SME session (prepare vdev in firmware via legacy API) */
-	status = qdf_event_reset(&adapter->qdf_session_open_event);
-	if (QDF_STATUS_SUCCESS != status) {
-		hdd_err("failed to reinit session open event");
-		errno = qdf_status_to_os_return(status);
-		goto objmgr_vdev_destroy_procedure;
-	}
 	errno = hdd_set_sme_session_param(adapter, &sme_session_params,
 					  callback, ctx);
 	if (errno) {
@@ -4583,33 +4548,7 @@ int hdd_vdev_create(struct hdd_adapter *adapter,
 		goto objmgr_vdev_destroy_procedure;
 	}
 
-	/* block on a completion variable until vdev is created in firmware */
-	status = qdf_wait_for_event_completion(&adapter->qdf_session_open_event,
-			SME_CMD_VDEV_CREATE_DELETE_TIMEOUT);
-	if (QDF_STATUS_SUCCESS != status) {
-		if (adapter->qdf_session_open_event.force_set)
-			/*
-			 * SSR/PDR has caused shutdown, which has forcefully
-			 * set the event.
-			 */
-			hdd_err("Session open event forcefully set");
-
-		else if (QDF_STATUS_E_TIMEOUT == status)
-			hdd_err("Session failed to open within timeout period");
-		else
-			hdd_err("Failed to wait for session open event(status-%d)",
-				status);
-		errno = -ETIMEDOUT;
-		set_bit(SME_SESSION_OPENED, &adapter->event_flags);
-		goto hdd_vdev_destroy_procedure;
-	}
-
-	if (!test_bit(SME_SESSION_OPENED, &adapter->event_flags)) {
-		hdd_err("Session failed to open due to vdev create failure");
-		errno = -EINVAL;
-		goto objmgr_vdev_destroy_procedure;
-	}
-
+	set_bit(SME_SESSION_OPENED, &adapter->event_flags);
 	/* firmware ready for component communication, raise vdev_ready event */
 	errno = hdd_vdev_ready(adapter);
 	if (errno) {

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

@@ -241,11 +241,10 @@ enum eWniMsgTypes {
 	WNI_SME_REGISTER_BCN_REPORT_SEND_CB = SIR_SME_MSG_TYPES_BEGIN + 154,
 	eWNI_SME_ANTENNA_ISOLATION_RSP = SIR_SME_MSG_TYPES_BEGIN + 155,
 	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_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
+	eWNI_SME_VDEV_DELETE_REQ = SIR_SME_MSG_TYPES_BEGIN + 157,
+	eWNI_SME_VDEV_DELETE_RSP = SIR_SME_MSG_TYPES_BEGIN + 158,
+	eWNI_SME_MSG_TYPES_END = SIR_SME_MSG_TYPES_BEGIN + 159
+
 };
 
 typedef struct sAniCfgTxRateCtrs {

+ 1 - 59
core/mac/src/pe/lim/lim_process_message_queue.c

@@ -527,6 +527,7 @@ static bool def_msg_decision(struct mac_context *mac_ctx,
 			lim_log_session_states(mac_ctx);
 			lim_handle_defer_msg_error(mac_ctx, lim_msg);
 		}
+
 		return true;
 	}
 
@@ -1561,60 +1562,6 @@ lim_process_vdev_delete(struct mac_context *mac_ctx,
 	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)
-{
-	struct wlan_objmgr_vdev *vdev;
-	struct vdev_mlme_obj *vdev_mlme = NULL;
-	struct scheduler_msg message = {0};
-	QDF_STATUS status = QDF_STATUS_SUCCESS;
-
-	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(mac_ctx->psoc,
-						    vdev_create_param->vdev_id,
-						    WLAN_LEGACY_MAC_ID);
-	if (!vdev) {
-		pe_err("Failed to get vdev obj for vdev id %d",
-		       vdev_create_param->vdev_id);
-		status = QDF_STATUS_E_INVAL;
-		goto end;
-	}
-
-	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
-	if (!vdev_mlme) {
-		pe_err("Failed to get vdev mlme obj for vdev id %d",
-		       vdev_create_param->vdev_id);
-		status = QDF_STATUS_E_INVAL;
-		goto end;
-	}
-
-	status = vdev_mgr_create_send(vdev_mlme);
-	if (QDF_IS_STATUS_ERROR(vdev_create_param->status)) {
-		pe_err("Failed to create vdev for vdev id %d",
-		       vdev_create_param->vdev_id);
-		goto end;
-	}
-
-	status = wma_post_vdev_create_setup(vdev);
-
-	if (QDF_IS_STATUS_ERROR(status))
-		vdev_mgr_delete_send(vdev_mlme);
-
-end:
-	if (vdev)
-		wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_MAC_ID);
-
-	vdev_create_param->status = status;
-	message.type = eWNI_SME_VDEV_CREATE_RSP;
-	message.bodyptr = vdev_create_param;
-	status = scheduler_post_message(QDF_MODULE_ID_PE, QDF_MODULE_ID_SME,
-					QDF_MODULE_ID_SME, &message);
-	if (!QDF_IS_STATUS_SUCCESS(status)) {
-		qdf_mem_free(vdev_create_param);
-		pe_err("scheduler_post_msg failed!(err=%d)", status);
-	}
-}
-
 /**
  * lim_process_messages() - Process messages from upper layers.
  *
@@ -2142,11 +2089,6 @@ static void lim_process_messages(struct mac_context *mac_ctx,
 		qdf_mem_free((void *)msg->bodyptr);
 		msg->bodyptr = NULL;
 		break;
-	case eWNI_SME_VDEV_CREATE_REQ:
-		lim_process_vdev_create(mac_ctx, msg->bodyptr);
-		/* 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 */

+ 0 - 1
core/sme/inc/csr_internal.h

@@ -542,7 +542,6 @@ struct csr_roam_session {
 	/* For BT-AMP station, this serve as BSSID for self-BSS. */
 	struct qdf_mac_addr self_mac_addr;
 
-	csr_session_open_cb  session_open_cb;
 	csr_session_close_cb session_close_cb;
 	csr_roam_complete_cb callback;
 	void *pContext;

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

@@ -2066,14 +2066,6 @@ 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_VDEV_CREATE_RSP:
-		if (pMsg->bodyptr) {
-			status = csr_vdev_create_resp(mac, pMsg->bodyptr);
-			qdf_mem_free(pMsg->bodyptr);
-		} else {
-			sme_err("Empty message for: %d", pMsg->type);
-		}
-		break;
 	case eWNI_SME_VDEV_DELETE_RSP:
 		if (pMsg->bodyptr) {
 			status = csr_process_vdev_del_rsp(mac, pMsg->bodyptr);
@@ -2091,7 +2083,6 @@ QDF_STATUS sme_process_msg(struct mac_context *mac, struct scheduler_msg *pMsg)
 			sme_err("Empty message for: %d", pMsg->type);
 		}
 		break;
-
 #ifdef WLAN_FEATURE_11W
 	case eWNI_SME_UNPROT_MGMT_FRM_IND:
 		if (pMsg->bodyptr) {

+ 20 - 120
core/sme/src/csr/csr_api_roam.c

@@ -3792,7 +3792,7 @@ QDF_STATUS csr_roam_call_callback(struct mac_context *mac, uint32_t sessionId,
 				  uint32_t roamId,
 				  eRoamCmdStatus u1, eCsrRoamResult u2)
 {
-	QDF_STATUS ret, status = QDF_STATUS_SUCCESS;
+	QDF_STATUS status = QDF_STATUS_SUCCESS;
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
 
 	WLAN_HOST_DIAG_EVENT_DEF(connectionStatus,
@@ -3865,15 +3865,8 @@ QDF_STATUS csr_roam_call_callback(struct mac_context *mac, uint32_t sessionId,
 		   && (u2 == eCSR_ROAM_RESULT_CHANNEL_CHANGE_SUCCESS)) {
 		pSession->connectedProfile.op_freq =
 			roam_info->channelChangeRespEvent->new_op_freq;
-	} else if (u1 == eCSR_ROAM_SESSION_OPENED) {
-		ret = (u2 == eCSR_ROAM_RESULT_SUCCESS) ?
-		      QDF_STATUS_SUCCESS : QDF_STATUS_E_FAILURE;
-
-		if (pSession->session_open_cb)
-			pSession->session_open_cb(sessionId, ret);
-		else
-			sme_err("session_open_cb is not registered");
 	}
+
 	if (eCSR_ROAM_ASSOCIATION_COMPLETION == u1)
 		csr_dump_connection_stats(mac, pSession, roam_info, u1, u2);
 
@@ -17141,31 +17134,6 @@ QDF_STATUS csr_reassoc(struct mac_context *mac, uint32_t sessionId,
 	return status;
 }
 
-static QDF_STATUS csr_roam_session_opened(struct mac_context *mac,
-					  QDF_STATUS qdf_status,
-					  uint32_t sessionId)
-{
-	QDF_STATUS status = QDF_STATUS_SUCCESS;
-	struct csr_roam_info *roam_info;
-
-	roam_info = qdf_mem_malloc(sizeof(*roam_info));
-	if (!roam_info)
-		return QDF_STATUS_E_NOMEM;
-
-	if (QDF_IS_STATUS_ERROR(qdf_status)) {
-		status = csr_roam_call_callback(mac, sessionId, roam_info, 0,
-						eCSR_ROAM_SESSION_OPENED,
-						eCSR_ROAM_RESULT_FAILURE);
-	} else {
-		status = csr_roam_call_callback(mac, sessionId, roam_info, 0,
-						eCSR_ROAM_SESSION_OPENED,
-						eCSR_ROAM_RESULT_SUCCESS);
-	}
-
-	qdf_mem_free(roam_info);
-	return status;
-}
-
 /**
  * csr_store_oce_cfg_flags_in_vdev() - fill OCE flags from ini
  * @mac: mac_context.
@@ -17220,63 +17188,6 @@ static void csr_send_set_ie(uint8_t type, uint8_t sub_type,
 		sme_err("Failed to send set IE req for vdev_%d", vdev_id);
 }
 
-QDF_STATUS csr_vdev_create_resp(struct mac_context *mac, uint8_t *pmsg)
-{
-	struct vdev_create_req_param *rsp;
-	struct vdev_mlme_obj *vdev_mlme;
-	struct wlan_objmgr_vdev *vdev;
-
-	if (!pmsg) {
-		sme_err("msg ptr is NULL");
-		return QDF_STATUS_E_FAILURE;
-	}
-	rsp = (struct vdev_create_req_param *)pmsg;
-
-	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(mac->psoc,
-						    rsp->vdev_id,
-						    WLAN_LEGACY_MAC_ID);
-	if (!vdev) {
-		sme_err("Failed to get vdev obj for vdev id %d",
-			rsp->vdev_id);
-		csr_cleanup_session(mac, rsp->vdev_id);
-		csr_roam_session_opened(mac, QDF_STATUS_E_FAILURE,
-					rsp->vdev_id);
-		return QDF_STATUS_E_FAILURE;
-	}
-
-	sme_debug("create vdev status = %d", rsp->status);
-	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
-	if (!vdev_mlme) {
-		sme_err("Fail to get vdev priv object");
-		wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_MAC_ID);
-		csr_cleanup_session(mac, rsp->vdev_id);
-		csr_roam_session_opened(mac, QDF_STATUS_E_FAILURE,
-					rsp->vdev_id);
-		return QDF_STATUS_E_FAILURE;
-	}
-
-	if (QDF_IS_STATUS_SUCCESS(rsp->status)) {
-		csr_send_set_ie(vdev_mlme->mgmt.generic.type,
-				vdev_mlme->mgmt.generic.subtype,
-				rsp->vdev_id);
-
-		if (vdev_mlme->mgmt.generic.type == WLAN_VDEV_MLME_TYPE_STA) {
-			csr_store_oce_cfg_flags_in_vdev(mac, mac->pdev,
-							rsp->vdev_id);
-			wlan_mlme_update_oce_flags(mac->pdev);
-		}
-	}
-
-	csr_roam_session_opened(mac, rsp->status, rsp->vdev_id);
-
-	if (QDF_IS_STATUS_ERROR(rsp->status))
-		csr_cleanup_session(mac, rsp->vdev_id);
-
-	wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_MAC_ID);
-
-	return QDF_STATUS_SUCCESS;
-}
-
 /**
  * csr_get_vdev_type_nss() - gets the nss value based on vdev type
  * @mac_ctx: Pointer to Global MAC structure
@@ -17339,33 +17250,6 @@ void csr_get_vdev_type_nss(struct mac_context *mac_ctx,
 		  dev_mode, *nss_2g, *nss_5g);
 }
 
-static
-QDF_STATUS csr_issue_vdev_create_req(struct mac_context *mac,
-				     uint32_t vdev_id)
-{
-	QDF_STATUS status = QDF_STATUS_SUCCESS;
-	struct vdev_create_req_param *vdev_create_req;
-	struct scheduler_msg message = {0};
-
-	vdev_create_req = qdf_mem_malloc(sizeof(*vdev_create_req));
-	if (!vdev_create_req)
-		return QDF_STATUS_E_NOMEM;
-
-	vdev_create_req->vdev_id = vdev_id;
-	/* Serialize the req through MC thread */
-	message.type    = eWNI_SME_VDEV_CREATE_REQ;
-	message.bodyptr = vdev_create_req;
-	status = scheduler_post_message(QDF_MODULE_ID_SME, QDF_MODULE_ID_PE,
-					QDF_MODULE_ID_PE, &message);
-	if (!QDF_IS_STATUS_SUCCESS(status)) {
-		sme_err("scheduler_post_msg failed!(err=%d)", status);
-		qdf_mem_free(vdev_create_req);
-		status = QDF_STATUS_E_FAILURE;
-	}
-
-	return status;
-}
-
 QDF_STATUS csr_create_vdev(struct mac_context *mac_ctx,
 			   struct wlan_objmgr_vdev *vdev,
 			   struct sme_session_params *session_param)
@@ -17435,7 +17319,6 @@ QDF_STATUS csr_create_vdev(struct mac_context *mac_ctx,
 	/* Initialize FT related data structures only in STA mode */
 	sme_ft_open(MAC_HANDLE(mac_ctx), session->sessionId);
 
-	session->session_open_cb = session_param->session_open_cb;
 	session->session_close_cb = session_param->session_close_cb;
 	session->callback = session_param->callback;
 	session->pContext = session_param->callback_ctx;
@@ -17499,7 +17382,24 @@ QDF_STATUS csr_create_vdev(struct mac_context *mac_ctx,
 	 */
 	csr_init_session_twt_cap(session, vdev_mlme->mgmt.generic.type);
 
-	return csr_issue_vdev_create_req(mac_ctx, session->sessionId);
+	status = mlme_vdev_create_send(vdev);
+
+	if (QDF_IS_STATUS_ERROR(status)) {
+		csr_cleanup_session(mac_ctx, wlan_vdev_get_id(vdev));
+		return status;
+	}
+
+	csr_send_set_ie(vdev_mlme->mgmt.generic.type,
+			vdev_mlme->mgmt.generic.subtype,
+			wlan_vdev_get_id(vdev));
+
+	if (vdev_mlme->mgmt.generic.type == WLAN_VDEV_MLME_TYPE_STA) {
+		csr_store_oce_cfg_flags_in_vdev(mac_ctx, mac_ctx->pdev,
+						wlan_vdev_get_id(vdev));
+		wlan_mlme_update_oce_flags(mac_ctx->pdev);
+	}
+
+	return status;
 }
 
 QDF_STATUS csr_process_vdev_del_rsp(struct mac_context *mac_ctx,

+ 0 - 11
core/sme/src/csr/csr_inside_api.h

@@ -238,17 +238,6 @@ csr_roam_save_connected_information(struct mac_context *mac,
 void csr_roam_check_for_link_status_change(struct mac_context *mac,
 					tSirSmeRsp *pSirMsg);
 
-/**
- * csr_vdev_create_resp() - Vdev create response handler
- * @mac_ctx: global mac context
- * @pMsg: pointer to response data
- *
- * This API handles vdev create response.
- *
- * Return: QDF_STATUS_SUCCESS or QDF_STATUS_E_FAILURE
- */
-QDF_STATUS csr_vdev_create_resp(struct mac_context *mac, uint8_t *pmsg);
-
 QDF_STATUS csr_roam_issue_start_bss(struct mac_context *mac, uint32_t sessionId,
 				    struct csr_roamstart_bssparams *pParam,
 				    struct csr_roam_profile *pProfile,