|
@@ -93,36 +93,49 @@ static bool cm_state_init_event(void *ctx, uint16_t event,
|
|
|
uint16_t data_len, void *data)
|
|
|
{
|
|
|
struct cnx_mgr *cm_ctx = ctx;
|
|
|
- bool status;
|
|
|
- QDF_STATUS qdf_status;
|
|
|
+ bool event_handled;
|
|
|
+ QDF_STATUS status;
|
|
|
+ struct cm_disconnect_req *req;
|
|
|
|
|
|
switch (event) {
|
|
|
case WLAN_CM_SM_EV_CONNECT_REQ:
|
|
|
- qdf_status = cm_add_connect_req_to_list(cm_ctx, data);
|
|
|
- if (QDF_IS_STATUS_ERROR(qdf_status)) {
|
|
|
+ status = cm_add_connect_req_to_list(cm_ctx, data);
|
|
|
+ if (QDF_IS_STATUS_ERROR(status)) {
|
|
|
/* if fail to add req return failure */
|
|
|
- status = false;
|
|
|
+ event_handled = false;
|
|
|
break;
|
|
|
}
|
|
|
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);
|
|
|
- status = true;
|
|
|
+ event_handled = true;
|
|
|
break;
|
|
|
case WLAN_CM_SM_EV_CONNECT_FAILURE:
|
|
|
cm_connect_complete(cm_ctx, data);
|
|
|
- status = true;
|
|
|
+ event_handled = true;
|
|
|
break;
|
|
|
case WLAN_CM_SM_EV_DISCONNECT_DONE:
|
|
|
cm_disconnect_complete(cm_ctx, data);
|
|
|
- status = true;
|
|
|
+ event_handled = true;
|
|
|
+ break;
|
|
|
+ case WLAN_CM_SM_EV_DISCONNECT_REQ:
|
|
|
+ status = cm_add_disconnect_req_to_list(cm_ctx, data);
|
|
|
+ if (QDF_IS_STATUS_ERROR(status)) {
|
|
|
+ /* if fail to add req return failure */
|
|
|
+ event_handled = false;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ req = data;
|
|
|
+ cm_send_disconnect_resp(cm_ctx, req->cm_id);
|
|
|
+ event_handled = true;
|
|
|
break;
|
|
|
default:
|
|
|
- status = false;
|
|
|
+ event_handled = false;
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
- return status;
|
|
|
+ return event_handled;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -167,20 +180,20 @@ static bool cm_state_connecting_event(void *ctx, uint16_t event,
|
|
|
uint16_t data_len, void *data)
|
|
|
{
|
|
|
struct cnx_mgr *cm_ctx = ctx;
|
|
|
- bool status;
|
|
|
+ bool event_handled;
|
|
|
|
|
|
switch (event) {
|
|
|
case WLAN_CM_SM_EV_CONNECT_START:
|
|
|
cm_sm_transition_to(cm_ctx, WLAN_CM_SS_JOIN_PENDING);
|
|
|
cm_sm_deliver_event_sync(cm_ctx, event, data_len, data);
|
|
|
- status = true;
|
|
|
+ event_handled = true;
|
|
|
break;
|
|
|
default:
|
|
|
- status = false;
|
|
|
+ event_handled = false;
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
- return status;
|
|
|
+ return event_handled;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -236,12 +249,16 @@ static bool cm_state_connected_event(void *ctx, uint16_t event,
|
|
|
event_handled = false;
|
|
|
break;
|
|
|
}
|
|
|
- cm_sm_transition_to(cm_ctx, WLAN_CM_SS_JOIN_PENDING);
|
|
|
+ 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);
|
|
|
event_handled = true;
|
|
|
break;
|
|
|
+ case WLAN_CM_SM_EV_DISCONNECT_ACTIVE:
|
|
|
+ cm_disconnect_active(cm_ctx, data);
|
|
|
+ event_handled = true;
|
|
|
+ break;
|
|
|
case WLAN_CM_SM_EV_CONNECT_SUCCESS:
|
|
|
cm_connect_complete(cm_ctx, data);
|
|
|
event_handled = true;
|
|
@@ -319,7 +336,7 @@ static bool cm_state_disconnecting_event(void *ctx, uint16_t event,
|
|
|
event_handled = false;
|
|
|
break;
|
|
|
}
|
|
|
- cm_sm_transition_to(cm_ctx, WLAN_CM_SS_JOIN_PENDING);
|
|
|
+ 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);
|
|
@@ -338,6 +355,18 @@ static bool cm_state_disconnecting_event(void *ctx, uint16_t event,
|
|
|
cm_sm_deliver_event_sync(cm_ctx, event, data_len, data);
|
|
|
event_handled = true;
|
|
|
break;
|
|
|
+ case WLAN_CM_SM_EV_DISCONNECT_REQ:
|
|
|
+ status = cm_handle_discon_req_in_non_connected_state(cm_ctx,
|
|
|
+ data, WLAN_CM_S_DISCONNECTING);
|
|
|
+ if (QDF_IS_STATUS_ERROR(status)) {
|
|
|
+ event_handled = false;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ cm_sm_deliver_event_sync(cm_ctx,
|
|
|
+ WLAN_CM_SM_EV_DISCONNECT_START,
|
|
|
+ data_len, data);
|
|
|
+ event_handled = true;
|
|
|
+ break;
|
|
|
default:
|
|
|
event_handled = false;
|
|
|
break;
|
|
@@ -459,6 +488,23 @@ static bool cm_subst_join_pending_event(void *ctx, uint16_t event,
|
|
|
cm_disconnect_active(cm_ctx, data);
|
|
|
event_handled = true;
|
|
|
break;
|
|
|
+ case WLAN_CM_SM_EV_DISCONNECT_DONE:
|
|
|
+ cm_disconnect_complete(cm_ctx, data);
|
|
|
+ event_handled = true;
|
|
|
+ break;
|
|
|
+ case WLAN_CM_SM_EV_DISCONNECT_REQ:
|
|
|
+ status = cm_handle_discon_req_in_non_connected_state(cm_ctx,
|
|
|
+ data, WLAN_CM_SS_JOIN_PENDING);
|
|
|
+ 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);
|
|
|
+ event_handled = true;
|
|
|
+ break;
|
|
|
default:
|
|
|
event_handled = false;
|
|
|
break;
|
|
@@ -548,6 +594,23 @@ static bool cm_subst_scan_event(void *ctx, uint16_t event,
|
|
|
cm_disconnect_active(cm_ctx, data);
|
|
|
event_handled = true;
|
|
|
break;
|
|
|
+ case WLAN_CM_SM_EV_DISCONNECT_DONE:
|
|
|
+ cm_disconnect_complete(cm_ctx, data);
|
|
|
+ event_handled = true;
|
|
|
+ break;
|
|
|
+ case WLAN_CM_SM_EV_DISCONNECT_REQ:
|
|
|
+ status = cm_handle_discon_req_in_non_connected_state(cm_ctx,
|
|
|
+ data, WLAN_CM_SS_SCAN);
|
|
|
+ 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);
|
|
|
+ event_handled = true;
|
|
|
+ break;
|
|
|
default:
|
|
|
event_handled = false;
|
|
|
break;
|
|
@@ -669,6 +732,19 @@ static bool cm_subst_join_active_event(void *ctx, uint16_t event,
|
|
|
cm_resume_connect_after_peer_create(cm_ctx, data);
|
|
|
event_handled = true;
|
|
|
break;
|
|
|
+ case WLAN_CM_SM_EV_DISCONNECT_REQ:
|
|
|
+ status = cm_handle_discon_req_in_non_connected_state(cm_ctx,
|
|
|
+ data, WLAN_CM_SS_JOIN_ACTIVE);
|
|
|
+ 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);
|
|
|
+ event_handled = true;
|
|
|
+ break;
|
|
|
default:
|
|
|
event_handled = false;
|
|
|
break;
|
|
@@ -841,7 +917,7 @@ static const char *cm_sm_event_names[] = {
|
|
|
"EV_CONNECT_ACTIVE",
|
|
|
"EV_CONNECT_SUCCESS",
|
|
|
"EV_BSS_SELECT_IND_SUCCESS",
|
|
|
- "EV_BSS_CREATE_PEER_SUCCESS"
|
|
|
+ "EV_BSS_CREATE_PEER_SUCCESS",
|
|
|
"EV_CONNECT_GET_NXT_CANDIDATE",
|
|
|
"EV_CONNECT_FAILURE",
|
|
|
"EV_DISCONNECT_REQ",
|