Browse Source

qcacld-3.0: Add VDEV state machine for STA

Add support for VDEV state machine support
for STA connection

Change-Id: Ifbf12d13e936b6535baee8f9bbf7062e56f84014
CRs-Fixed: 2321423
Sandeep Puligilla 6 years ago
parent
commit
45e0c5e030

+ 9 - 25
components/mlme/core/src/wlan_mlme_vdev_mgr_interface.c

@@ -97,7 +97,8 @@ static QDF_STATUS sta_mlme_vdev_start_send(struct vdev_mlme_obj *vdev_mlme,
 					   uint16_t event_data_len,
 					   void *event_data)
 {
-	return QDF_STATUS_SUCCESS;
+	return lim_sta_mlme_vdev_start_send(vdev_mlme, event_data_len,
+					    event_data);
 }
 
 /**
@@ -118,24 +119,7 @@ static QDF_STATUS sta_mlme_vdev_restart_send(struct vdev_mlme_obj *vdev_mlme,
 }
 
 /**
- * sta_mlme_vdev_start_continue() - MLME vdev restart send
- * @vdev_mlme: vdev mlme object
- * @event_data_len: event data length
- * @event_data: event data
- *
- * This function is called to initiate actions of VDEV.start
- *
- * Return: QDF_STATUS
- */
-static QDF_STATUS sta_mlme_vdev_start_continue(struct vdev_mlme_obj *vdev_mlme,
-					       uint16_t event_data_len,
-					       void *event_data)
-{
-	return QDF_STATUS_SUCCESS;
-}
-
-/**
- * sta_mlme_vdev_start_continue() - MLME vdev start callback
+ * sta_mlme_vdev_start_connection() - MLME vdev start callback
  * @vdev_mlme: vdev mlme object
  * @event_data_len: event data length
  * @event_data: event data
@@ -289,7 +273,7 @@ static QDF_STATUS ap_mlme_vdev_start_send(struct vdev_mlme_obj *vdev_mlme,
 }
 
 /**
- * ap_mlme_vdev_start_continue () - vdev start rsp calback
+ * mlme_start_continue () - vdev start rsp calback
  * @vdev_mlme: vdev mlme object
  * @data_len: event data length
  * @data: event data
@@ -298,10 +282,10 @@ static QDF_STATUS ap_mlme_vdev_start_send(struct vdev_mlme_obj *vdev_mlme,
  *
  * Return: QDF_STATUS
  */
-static QDF_STATUS ap_mlme_vdev_start_continue(struct vdev_mlme_obj *vdev_mlme,
-					      uint16_t data_len, void *data)
+static QDF_STATUS vdevmgr_mlme_start_continue(struct vdev_mlme_obj *vdev_mlme,
+				      uint16_t data_len, void *data)
 {
-	return wma_ap_mlme_vdev_start_continue(vdev_mlme, data_len, data);
+	return wma_mlme_vdev_start_continue(vdev_mlme, data_len, data);
 }
 
 /**
@@ -688,7 +672,7 @@ static QDF_STATUS ap_vdev_dfs_cac_timer_stop(struct vdev_mlme_obj *vdev_mlme,
 static struct vdev_mlme_ops sta_mlme_ops = {
 	.mlme_vdev_start_send = sta_mlme_vdev_start_send,
 	.mlme_vdev_restart_send = sta_mlme_vdev_restart_send,
-	.mlme_vdev_start_continue = sta_mlme_vdev_start_continue,
+	.mlme_vdev_start_continue = vdevmgr_mlme_start_continue,
 	.mlme_vdev_sta_conn_start = sta_mlme_vdev_start_connection,
 	.mlme_vdev_up_send = sta_mlme_vdev_up_send,
 	.mlme_vdev_notify_up_complete = sta_mlme_vdev_notify_up_complete,
@@ -737,7 +721,7 @@ static struct vdev_mlme_ops ap_mlme_ops = {
 	.mlme_vdev_start_send = ap_mlme_vdev_start_send,
 	.mlme_vdev_restart_send = ap_mlme_vdev_restart_send,
 	.mlme_vdev_stop_start_send = ap_mlme_vdev_stop_start_send,
-	.mlme_vdev_start_continue = ap_mlme_vdev_start_continue,
+	.mlme_vdev_start_continue = vdevmgr_mlme_start_continue,
 	.mlme_vdev_start_req_failed = ap_mlme_vdev_start_req_failed,
 	.mlme_vdev_up_send = ap_mlme_vdev_up_send,
 	.mlme_vdev_notify_up_complete = ap_mlme_vdev_notify_up_complete,

+ 8 - 11
core/mac/src/pe/lim/lim_process_mlm_req_messages.c

@@ -41,7 +41,6 @@
 #include "lim_process_fils.h"
 #include "wlan_mlme_public_struct.h"
 
-static void lim_process_mlm_join_req(tpAniSirGlobal, uint32_t *);
 static void lim_process_mlm_auth_req(tpAniSirGlobal, uint32_t *);
 static void lim_process_mlm_assoc_req(tpAniSirGlobal, uint32_t *);
 static void lim_process_mlm_disassoc_req(tpAniSirGlobal, uint32_t *);
@@ -117,9 +116,6 @@ void lim_process_mlm_req_messages(tpAniSirGlobal mac_ctx,
 				  struct scheduler_msg *msg)
 {
 	switch (msg->type) {
-	case LIM_MLM_JOIN_REQ:
-		lim_process_mlm_join_req(mac_ctx, msg->bodyptr);
-		break;
 	case LIM_MLM_AUTH_REQ:
 		lim_process_mlm_auth_req(mac_ctx, msg->bodyptr);
 		break;
@@ -852,7 +848,7 @@ error:
  * lim_process_mlm_join_req() - process mlm join request.
  *
  * @mac_ctx:    Pointer to Global MAC structure
- * @msg:        Pointer to the MLM message buffer
+ * @mlm_join_req:        Pointer to the mlme join request
  *
  * This function is called to process MLM_JOIN_REQ message
  * from SME. It does following:
@@ -874,13 +870,14 @@ error:
  *
  * @Return: None
  */
-static void lim_process_mlm_join_req(tpAniSirGlobal mac_ctx, uint32_t *msg)
+void lim_process_mlm_join_req(tpAniSirGlobal mac_ctx,
+			      tLimMlmJoinReq *mlm_join_req)
 {
 	tLimMlmJoinCnf mlmjoin_cnf;
 	uint8_t sessionid;
 	tpPESession session;
 
-	sessionid = ((tpLimMlmJoinReq) msg)->sessionId;
+	sessionid = mlm_join_req->sessionId;
 
 	session = pe_find_session_by_session_id(mac_ctx, sessionid);
 	if (NULL == session) {
@@ -892,12 +889,12 @@ static void lim_process_mlm_join_req(tpAniSirGlobal mac_ctx, uint32_t *msg)
 	     ((session->limMlmState == eLIM_MLM_IDLE_STATE) ||
 	     (session->limMlmState == eLIM_MLM_JOINED_STATE)) &&
 	     (SIR_MAC_GET_ESS
-		(((tpLimMlmJoinReq) msg)->bssDescription.capabilityInfo) !=
-		SIR_MAC_GET_IBSS(((tpLimMlmJoinReq) msg)->bssDescription.
+		(mlm_join_req->bssDescription.capabilityInfo) !=
+		SIR_MAC_GET_IBSS(mlm_join_req->bssDescription.
 			capabilityInfo))) {
 		/* Hold onto Join request parameters */
 
-		session->pLimMlmJoinReq = (tpLimMlmJoinReq) msg;
+		session->pLimMlmJoinReq = mlm_join_req;
 		if (is_lim_session_off_channel(mac_ctx, sessionid)) {
 			pe_debug("SessionId:%d LimSession is on OffChannel",
 				sessionid);
@@ -933,7 +930,7 @@ static void lim_process_mlm_join_req(tpAniSirGlobal mac_ctx, uint32_t *msg)
 	}
 
 error:
-	qdf_mem_free(msg);
+	qdf_mem_free(mlm_join_req);
 	if (session != NULL)
 		session->pLimMlmJoinReq = NULL;
 	mlmjoin_cnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE;

+ 28 - 2
core/mac/src/pe/lim/lim_process_sme_req_messages.c

@@ -1205,6 +1205,33 @@ static inline void lim_update_sae_config(tpPESession session,
 {}
 #endif
 
+/**
+ * lim_send_join_req() - send vdev start request
+ *@session: pe session
+ *@mlm_join_req: join req
+ *
+ * Return: QDF_STATUS
+ */
+
+#ifdef CONFIG_VDEV_SM
+static QDF_STATUS lim_send_join_req(tpPESession session,
+				    tLimMlmJoinReq *mlm_join_req)
+{
+	return wlan_vdev_mlme_sm_deliver_evt(session->vdev,
+					     WLAN_VDEV_SM_EV_START,
+					     sizeof(*mlm_join_req),
+					     mlm_join_req);
+}
+#else
+static QDF_STATUS lim_send_join_req(tpPESession session,
+				    tLimMlmJoinReq *mlm_join_req)
+{
+	lim_process_mlm_join_req(session->mac_ctx, mlm_join_req);
+
+	return QDF_STATUS_SUCCESS;
+}
+#endif
+
 
 /**
  * __lim_process_sme_join_req() - process SME_JOIN_REQ message
@@ -1686,8 +1713,7 @@ __lim_process_sme_join_req(tpAniSirGlobal mac_ctx, uint32_t *msg_buf)
 		session->isOSENConnection = sme_join_req->isOSENConnection;
 
 		/* Issue LIM_MLM_JOIN_REQ to MLM */
-		lim_post_mlm_message(mac_ctx, LIM_MLM_JOIN_REQ,
-				     (uint32_t *) mlm_join_req);
+		lim_send_join_req(session, mlm_join_req);
 		return;
 
 	} else {

+ 3 - 0
core/mac/src/pe/lim/lim_send_messages.c

@@ -258,6 +258,9 @@ QDF_STATUS lim_send_switch_chnl_params(tpAniSirGlobal pMac,
 		return QDF_STATUS_E_FAILURE;
 	}
 	pSessionEntry->ch_switch_in_progress = true;
+#ifdef CONFIG_VDEV_SM
+	mlme_set_chan_switch_in_progress(pSessionEntry->vdev, true);
+#endif
 	return QDF_STATUS_SUCCESS;
 }
 

+ 28 - 0
core/mac/src/pe/lim/lim_types.h

@@ -1117,4 +1117,32 @@ void lim_send_csa_restart_req(tpAniSirGlobal mac_ctx, uint8_t vdev_id);
 void lim_process_mlm_start_req(tpAniSirGlobal mac_ctx,
 					  tLimMlmStartReq *mlm_start_req);
 
+/**
+ * lim_process_mlm_join_req() - process mlm join request.
+ *
+ * @mac_ctx:    Pointer to Global MAC structure
+ * @msg:        Pointer to the MLM message buffer
+ *
+ * This function is called to process MLM_JOIN_REQ message
+ * from SME. It does following:
+ * 1) Initialize LIM, HAL, DPH
+ * 2) Configure the BSS for which the JOIN REQ was received
+ *   a) Send WMA_ADD_BSS_REQ to HAL -
+ *   This will identify the BSS that we are interested in
+ *   --AND--
+ *   Add a STA entry for the AP (in a STA context)
+ *   b) Wait for WMA_ADD_BSS_RSP
+ *   c) Send WMA_ADD_STA_REQ to HAL
+ *   This will add the "local STA" entry to the STA table
+ * 3) Continue as before, i.e,
+ *   a) Send a PROBE REQ
+ *   b) Wait for PROBE RSP/BEACON containing the SSID that
+ *   we are interested in
+ *   c) Then start an AUTH seq
+ *   d) Followed by the ASSOC seq
+ *
+ * @Return: None
+ */
+void lim_process_mlm_join_req(tpAniSirGlobal mac_ctx,
+			      tLimMlmJoinReq *mlm_join_req);
 #endif /* __LIM_TYPES_H */

+ 17 - 0
core/mac/src/pe/lim/lim_utils.c

@@ -8414,6 +8414,23 @@ void lim_process_ap_ecsa_timeout(void *data)
 }
 
 #ifdef CONFIG_VDEV_SM
+QDF_STATUS lim_sta_mlme_vdev_start_send(struct vdev_mlme_obj *vdev_mlme,
+					uint16_t data_len, void *data)
+{
+	tpAniSirGlobal mac_ctx;
+
+	mac_ctx = cds_get_context(QDF_MODULE_ID_PE);
+	if (!mac_ctx) {
+		pe_err("mac_ctx is NULL");
+		if (data)
+			qdf_mem_free(data);
+		return QDF_STATUS_E_INVAL;
+	}
+
+	lim_process_mlm_join_req(mac_ctx, (tLimMlmJoinReq *)data);
+
+	return QDF_STATUS_SUCCESS;
+}
 
 void lim_send_beacon(tpAniSirGlobal mac_ctx, tpPESession session)
 {

+ 15 - 0
core/mac/src/pe/lim/lim_utils.h

@@ -1510,6 +1510,21 @@ void lim_send_beacon(tpAniSirGlobal mac_ctx, tpPESession session);
  */
 QDF_STATUS lim_ap_mlme_vdev_start_send(struct vdev_mlme_obj *vdev_mlme,
 				       uint16_t data_len, void *event);
+
+/**
+ * lim_sta_mlme_vdev_start_send() - Invokes VDEV start operation
+ * @vdev_mlme_obj:  VDEV MLME comp object
+ * @data_len: data size
+ * @data: event data
+ *
+ * API invokes VDEV start operation
+ *
+ * Return: SUCCESS on successful completion of start operation
+ *         FAILURE, if it fails due to any
+ */
+QDF_STATUS lim_sta_mlme_vdev_start_send(struct vdev_mlme_obj *vdev_mlme,
+					uint16_t data_len, void *data);
+
 /*
  * lim_ap_mlme_vdev_update_beacon() - Updates beacon
  * @vdev_mlme_obj:  VDEV MLME comp object

+ 15 - 1
core/wma/inc/wma_api.h

@@ -444,9 +444,23 @@ bool wma_get_hidden_ssid_restart_in_progress(struct wma_txrx_node *iface);
  * Return: SUCCESS on successful completion of start response operation
  *         FAILURE, if it fails due to any
  */
-QDF_STATUS wma_ap_mlme_vdev_start_continue(struct vdev_mlme_obj *vdev_mlme,
+QDF_STATUS wma_mlme_vdev_start_continue(struct vdev_mlme_obj *vdev_mlme,
 					   uint16_t data_len, void *data);
 
+/**
+ * wma_sta_vdev_up_send - Send VDEV UP command
+ * @vdev_mlme_obj:  VDEV MLME comp object
+ * @data_len: data size
+ * @data: event data
+ *
+ * API invokes VDEV UP Command
+ *
+ * Return: SUCCESS on successful completion of start response operation
+ *         FAILURE, if it fails due to any
+ */
+QDF_STATUS wma_sta_vdev_up_send(struct vdev_mlme_obj *vdev_mlme,
+				 uint16_t data_len, void *data);
+
 /**
  * wma_ap_mlme_vdev_stop_continue - VDEV stop response handling
  * @vdev_mlme_obj:  VDEV MLME comp object

+ 16 - 4
core/wma/src/wma_dev_if.c

@@ -1126,7 +1126,9 @@ int wma_vdev_start_resp_handler(void *handle, uint8_t *cmd_param_info,
 #ifdef FEATURE_AP_MCC_CH_AVOIDANCE
 	tpAniSirGlobal mac_ctx = cds_get_context(QDF_MODULE_ID_PE);
 #endif
-
+#ifdef CONFIG_VDEV_SM
+	enum wlan_vdev_sm_evt  event;
+#endif
 	if (!psoc) {
 		WMA_LOGE("%s: psoc is NULL", __func__);
 		return -EINVAL;
@@ -1317,8 +1319,12 @@ int wma_vdev_start_resp_handler(void *handle, uint8_t *cmd_param_info,
 			}
 		}
 #ifdef CONFIG_VDEV_SM
+		if (wma_is_vdev_in_ap_mode(wma, resp_event->vdev_id))
+			event = WLAN_VDEV_SM_EV_RESTART_RESP;
+		else
+			event = WLAN_VDEV_SM_EV_START_RESP;
 		wlan_vdev_mlme_sm_deliver_evt(iface->vdev,
-					      WLAN_VDEV_SM_EV_RESTART_RESP,
+					      event,
 					      sizeof(*params), params);
 #else
 		wma_send_msg_high_priority(wma, WMA_SWITCH_CHANNEL_RSP,
@@ -5166,8 +5172,14 @@ static void wma_add_sta_req_sta_mode(tp_wma_handle wma, tpAddStaParams params)
 
 	param.vdev_id = params->smesessionId;
 	param.assoc_id = params->assocId;
-	if (wma_send_vdev_up_to_fw(wma, &param, params->bssId) !=
-	    QDF_STATUS_SUCCESS) {
+#ifdef CONFIG_VDEV_SM
+	status = wlan_vdev_mlme_sm_deliver_evt(wma->interfaces[param.vdev_id].vdev,
+					       WLAN_VDEV_SM_EV_START_SUCCESS,
+					       sizeof(param), (void *)&param);
+#else
+	status = wma_send_vdev_up_to_fw(wma, &param, params->bssId);
+#endif
+	if (QDF_IS_STATUS_ERROR(status)) {
 		WMA_LOGE("%s: Failed to send vdev up cmd: vdev %d bssid %pM",
 			 __func__, params->smesessionId, params->bssId);
 		policy_mgr_set_do_hw_mode_change_flag(

+ 20 - 6
core/wma/src/wma_utils.c

@@ -4798,6 +4798,20 @@ QDF_STATUS wma_get_roam_scan_stats(WMA_HANDLE handle,
 }
 
 #ifdef CONFIG_VDEV_SM
+
+QDF_STATUS wma_sta_vdev_up_send(struct vdev_mlme_obj *vdev_mlme,
+				uint16_t data_len, void *data)
+{
+	struct vdev_up_params *param;
+	tp_wma_handle wma = cds_get_context(QDF_MODULE_ID_WMA);
+
+	param = (struct vdev_up_params *)data;
+	wma_send_vdev_up_to_fw(wma, param,
+			       wma->interfaces[param->vdev_id].bssid);
+
+	return QDF_STATUS_SUCCESS;
+}
+
 bool wma_get_hidden_ssid_restart_in_progress(struct wma_txrx_node *iface)
 {
 	if (!iface)
@@ -4806,8 +4820,8 @@ bool wma_get_hidden_ssid_restart_in_progress(struct wma_txrx_node *iface)
 	return ap_mlme_is_hidden_ssid_restart_in_progress(iface->vdev);
 }
 
-static QDF_STATUS
-wma_ap_vdev_send_start_resp(tp_wma_handle wma, tpAddBssParams add_bss)
+static QDF_STATUS wma_vdev_send_start_resp(tp_wma_handle wma,
+					   tpAddBssParams add_bss)
 {
 	WMA_LOGD(FL("Sending add bss rsp to umac(vdev %d status %d)"),
 		 add_bss->bssIdx, add_bss->status);
@@ -4816,8 +4830,8 @@ wma_ap_vdev_send_start_resp(tp_wma_handle wma, tpAddBssParams add_bss)
 	return QDF_STATUS_SUCCESS;
 }
 
-QDF_STATUS wma_ap_mlme_vdev_start_continue(struct vdev_mlme_obj *vdev_mlme,
-					   uint16_t data_len, void *data)
+QDF_STATUS wma_mlme_vdev_start_continue(struct vdev_mlme_obj *vdev_mlme,
+					uint16_t data_len, void *data)
 {
 	tp_wma_handle wma = cds_get_context(QDF_MODULE_ID_WMA);
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
@@ -4831,7 +4845,7 @@ QDF_STATUS wma_ap_mlme_vdev_start_continue(struct vdev_mlme_obj *vdev_mlme,
 		wma_send_msg(wma, WMA_HIDDEN_SSID_RESTART_RSP, data, 0);
 		ap_mlme_set_hidden_ssid_restart_in_progress(vdev, false);
 	} else {
-		status = wma_ap_vdev_send_start_resp(wma, (tpAddBssParams)data);
+		status = wma_vdev_send_start_resp(wma, (tpAddBssParams)data);
 	}
 
 	return status;
@@ -4879,7 +4893,7 @@ QDF_STATUS wma_ap_mlme_vdev_stop_start_send(struct vdev_mlme_obj *vdev_mlme,
 		WMA_LOGE(FL("Failed to send vdev stop for vdev id %d"),
 			 bss_params->bssIdx);
 
-	return wma_ap_vdev_send_start_resp(wma, bss_params);
+	return wma_vdev_send_start_resp(wma, bss_params);
 }
 
 #else