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

qcacmn: Handle Connect/disconnect req in during roaming

Handle Connect/disconnect req in during roaming.

Change-Id: I84612631e52fa7c736272f7d1dc4fb911dbb0401
CRs-Fixed: 2873931
gaurank kathpalia 4 жил өмнө
parent
commit
5e808c71c3

+ 7 - 0
umac/mlme/connection_mgr/core/src/wlan_cm_connect.c

@@ -1029,9 +1029,16 @@ cm_handle_connect_req_in_non_init_state(struct cnx_mgr *cm_ctx,
 					enum wlan_cm_sm_state cm_state_substate)
 {
 	switch (cm_state_substate) {
+	case WLAN_CM_S_ROAMING:
 	case WLAN_CM_S_CONNECTED:
 	case WLAN_CM_SS_JOIN_ACTIVE:
 		/*
+		 * In roaming state, there would be no
+		 * pending command, so for new connect request, queue internal
+		 * disconnect. The preauth and reassoc process will be aborted
+		 * as the state machine will be moved to connecting state and
+		 * preauth/reassoc/roam start event posting will fail.
+		 *
 		 * In connected state, there would be no pending command, so
 		 * for new connect request, queue internal disconnect
 		 *

+ 5 - 5
umac/mlme/connection_mgr/core/src/wlan_cm_disconnect.c

@@ -554,12 +554,12 @@ cm_handle_discon_req_in_non_connected_state(struct cnx_mgr *cm_ctx,
 						 true);
 		break;
 	case WLAN_CM_SS_JOIN_ACTIVE:
+	case WLAN_CM_S_ROAMING:
 		/*
-		 * In join active state, there would be no pending command, so
-		 * for new disconnect request, queue disconnect.
-		 * In disconnecting state queue the new disconnect request, and
-		 * when the old diconnect moves the SM to init it would be
-		 * dropped and required callbacks would be called.
+		 * In join active/roaming state, there would be no pending
+		 * command, so no action required. so for new disconnect
+		 * request, queue disconnect and move the state to
+		 * disconnecting.
 		 */
 		break;
 	case WLAN_CM_SS_SCAN:

+ 20 - 5
umac/mlme/connection_mgr/core/src/wlan_cm_host_roam.c

@@ -219,6 +219,24 @@ static QDF_STATUS cm_roam_get_candidates(struct wlan_objmgr_pdev *pdev,
 	return QDF_STATUS_SUCCESS;
 }
 
+#ifdef WLAN_FEATURE_PREAUTH_ENABLE
+static QDF_STATUS cm_host_roam_start(struct cnx_mgr *cm_ctx,
+				     struct cm_req *cm_req)
+{
+	/* start preauth process */
+
+	return QDF_STATUS_SUCCESS;
+}
+#else
+static QDF_STATUS cm_host_roam_start(struct cnx_mgr *cm_ctx,
+				     struct cm_req *cm_req)
+{
+	return cm_sm_deliver_event_sync(cm_ctx, WLAN_CM_SM_EV_START_REASSOC,
+					sizeof(cm_req->roam_req),
+					&cm_req->roam_req);
+}
+#endif
+
 QDF_STATUS cm_host_roam_start_req(struct cnx_mgr *cm_ctx,
 				  struct cm_req *cm_req)
 {
@@ -237,16 +255,13 @@ QDF_STATUS cm_host_roam_start_req(struct cnx_mgr *cm_ctx,
 		goto roam_err;
 	}
 
-	status = cm_roam_get_candidates(pdev, cm_ctx,
-					&cm_req->roam_req);
+	status = cm_roam_get_candidates(pdev, cm_ctx, &cm_req->roam_req);
 	if (QDF_IS_STATUS_ERROR(status)) {
 		reason = CM_NO_CANDIDATE_FOUND;
 		goto roam_err;
 	}
 
-	status = cm_sm_deliver_event_sync(cm_ctx, WLAN_CM_SM_EV_START_REASSOC,
-					  sizeof(cm_req->roam_req),
-					  &cm_req->roam_req);
+	status = cm_host_roam_start(cm_ctx, cm_req);
 	if (QDF_IS_STATUS_SUCCESS(status))
 		return status;
 

+ 53 - 48
umac/mlme/connection_mgr/core/src/wlan_cm_roam_sm.c

@@ -77,37 +77,40 @@ bool cm_state_roaming_event(void *ctx, uint16_t event,
 	return event_handled;
 }
 
-#ifdef WLAN_FEATURE_HOST_ROAM
-#ifdef WLAN_FEATURE_PREAUTH_ENABLE
-void cm_subst_preauth_entry(void *ctx)
-{
-	struct cnx_mgr *cm_ctx = ctx;
-
-	if (cm_get_state(cm_ctx) != WLAN_CM_S_ROAMING)
-		QDF_BUG(0);
-
-	cm_set_substate(cm_ctx, WLAN_CM_SS_PREAUTH);
-}
-
-void cm_subst_preauth_exit(void *ctx)
-{
-}
-
-bool cm_subst_preauth_event(void *ctx, uint16_t event,
-			    uint16_t data_len, void *data)
+static bool cm_handle_connect_disconnect_in_roam(struct cnx_mgr *cm_ctx,
+						 uint16_t event,
+						 uint16_t data_len, void *data)
 {
-	bool event_handled;
+	QDF_STATUS status;
 
 	switch (event) {
+	case WLAN_CM_SM_EV_CONNECT_REQ:
+		status = cm_handle_connect_req_in_non_init_state(cm_ctx, data,
+							WLAN_CM_S_ROAMING);
+		if (QDF_IS_STATUS_ERROR(status))
+			return false;
+		cm_sm_transition_to(cm_ctx, WLAN_CM_S_CONNECTING);
+		cm_sm_deliver_event_sync(cm_ctx, WLAN_CM_SM_EV_CONNECT_START,
+					 data_len, data);
+		break;
+	case WLAN_CM_SM_EV_DISCONNECT_REQ:
+		status = cm_handle_discon_req_in_non_connected_state(cm_ctx,
+						data, WLAN_CM_S_ROAMING);
+		if (QDF_IS_STATUS_ERROR(status))
+			return false;
+		cm_sm_transition_to(cm_ctx, WLAN_CM_S_DISCONNECTING);
+		cm_sm_deliver_event_sync(cm_ctx, WLAN_CM_SM_EV_DISCONNECT_START,
+					 data_len, data);
+		break;
 	default:
-		event_handled = false;
+		return false;
 		break;
 	}
 
-	return event_handled;
+	return true;
 }
 
-#else
+#ifdef WLAN_FEATURE_HOST_ROAM
 void cm_subst_preauth_entry(void *ctx)
 {
 	struct cnx_mgr *cm_ctx = ctx;
@@ -127,9 +130,14 @@ bool cm_subst_preauth_event(void *ctx, uint16_t event,
 {
 	struct cnx_mgr *cm_ctx = ctx;
 	bool event_handled = true;
-	QDF_STATUS status;
 
 	switch (event) {
+	case WLAN_CM_SM_EV_CONNECT_REQ:
+	case WLAN_CM_SM_EV_DISCONNECT_REQ:
+		event_handled =
+			cm_handle_connect_disconnect_in_roam(cm_ctx, event,
+							     data_len, data);
+		break;
 	case WLAN_CM_SM_EV_ROAM_START:
 		cm_host_roam_start_req(cm_ctx, data);
 		break;
@@ -138,16 +146,6 @@ bool cm_subst_preauth_event(void *ctx, uint16_t event,
 		cm_sm_deliver_event_sync(cm_ctx, WLAN_CM_SM_EV_START_REASSOC,
 					 data_len, data);
 		break;
-	case WLAN_CM_SM_EV_DISCONNECT_REQ:
-		status = cm_add_disconnect_req_to_list(cm_ctx, data);
-		if (QDF_IS_STATUS_ERROR(status)) {
-			event_handled = false;
-			break;
-		}
-		cm_sm_transition_to(cm_ctx, WLAN_CM_S_DISCONNECTING);
-		cm_sm_deliver_event_sync(cm_ctx, WLAN_CM_SM_EV_DISCONNECT_START,
-					 data_len, data);
-		break;
 	case WLAN_CM_SM_EV_REASSOC_FAILURE:
 		cm_reassoc_complete(cm_ctx, data);
 		break;
@@ -159,8 +157,6 @@ bool cm_subst_preauth_event(void *ctx, uint16_t event,
 	return event_handled;
 }
 
-#endif /* WLAN_FEATURE_PREAUTH_ENABLE */
-
 void cm_subst_reassoc_entry(void *ctx)
 {
 	struct cnx_mgr *cm_ctx = ctx;
@@ -180,9 +176,14 @@ bool cm_subst_reassoc_event(void *ctx, uint16_t event,
 {
 	struct cnx_mgr *cm_ctx = ctx;
 	bool event_handled = true;
-	QDF_STATUS status;
 
 	switch (event) {
+	case WLAN_CM_SM_EV_CONNECT_REQ:
+	case WLAN_CM_SM_EV_DISCONNECT_REQ:
+		event_handled =
+			cm_handle_connect_disconnect_in_roam(cm_ctx, event,
+							     data_len, data);
+		break;
 	case WLAN_CM_SM_EV_START_REASSOC:
 		cm_reassoc_start(cm_ctx, data);
 		break;
@@ -211,16 +212,6 @@ bool cm_subst_reassoc_event(void *ctx, uint16_t event,
 		cm_sm_transition_to(cm_ctx, WLAN_CM_S_CONNECTED);
 		cm_sm_deliver_event_sync(cm_ctx, event, data_len, data);
 		break;
-	case WLAN_CM_SM_EV_DISCONNECT_REQ:
-		status = cm_add_disconnect_req_to_list(cm_ctx, data);
-		if (QDF_IS_STATUS_ERROR(status)) {
-			event_handled = false;
-			break;
-		}
-		cm_sm_transition_to(cm_ctx, WLAN_CM_S_DISCONNECTING);
-		cm_sm_deliver_event_sync(cm_ctx, WLAN_CM_SM_EV_DISCONNECT_START,
-					 data_len, data);
-		break;
 	case WLAN_CM_SM_EV_REASSOC_FAILURE:
 		cm_reassoc_complete(cm_ctx, data);
 		break;
@@ -252,9 +243,16 @@ void cm_subst_roam_start_exit(void *ctx)
 bool cm_subst_roam_start_event(void *ctx, uint16_t event,
 			       uint16_t data_len, void *data)
 {
-	bool event_handled;
+	bool event_handled = true;
+	struct cnx_mgr *cm_ctx = ctx;
 
 	switch (event) {
+	case WLAN_CM_SM_EV_CONNECT_REQ:
+	case WLAN_CM_SM_EV_DISCONNECT_REQ:
+		event_handled =
+			cm_handle_connect_disconnect_in_roam(cm_ctx, event,
+							     data_len, data);
+		break;
 	default:
 		event_handled = false;
 		break;
@@ -280,9 +278,16 @@ void cm_subst_roam_sync_exit(void *ctx)
 bool cm_subst_roam_sync_event(void *ctx, uint16_t event,
 			      uint16_t data_len, void *data)
 {
-	bool event_handled;
+	bool event_handled = true;
+	struct cnx_mgr *cm_ctx = ctx;
 
 	switch (event) {
+	case WLAN_CM_SM_EV_CONNECT_REQ:
+	case WLAN_CM_SM_EV_DISCONNECT_REQ:
+		event_handled =
+			cm_handle_connect_disconnect_in_roam(cm_ctx, event,
+							     data_len, data);
+		break;
 	default:
 		event_handled = false;
 		break;