Skip to content

Commit

Permalink
[lte][agw] Backport v1 3 c575e3d (#4313)
Browse files Browse the repository at this point in the history
* Merge conflicts are resolved

Signed-off-by: Ulas Kozat <kozat@fb.com>
  • Loading branch information
ulaskozat committed Jan 9, 2021
1 parent cef8ec6 commit ae5ed41
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 55 deletions.
117 changes: 63 additions & 54 deletions lte/gateway/c/oai/tasks/mme_app/mme_app_bearer.c
Expand Up @@ -928,6 +928,7 @@ void mme_app_handle_delete_session_rsp(
if (ue_context_p->ue_context_rel_cause == S1AP_INVALID_CAUSE) {
ue_context_p->ue_context_rel_cause = S1AP_NAS_DETACH;
}
#if EMBEDDED_SGW
/* If UE has rejected activate default eps bearer request message
* delete the pdn context
*/
Expand All @@ -954,12 +955,16 @@ void mme_app_handle_delete_session_rsp(
}
OAILOG_FUNC_OUT(LOG_MME_APP);
}

hashtable_uint64_ts_remove(
#endif
hashtable_rc_t hash_rc = hashtable_uint64_ts_remove(
mme_app_desc_p->mme_ue_contexts.tun11_ue_context_htbl,
(const hash_key_t) ue_context_p->mme_teid_s11);
ue_context_p->mme_teid_s11 = 0;

if (hash_rc == HASH_TABLE_OK) {
ue_context_p->mme_teid_s11 = 0;
}
if (ue_context_p->nb_active_pdn_contexts > 0) {
ue_context_p->nb_active_pdn_contexts -= 1;
}
/* In case of Ue initiated explicit IMSI Detach or Combined EPS/IMSI detach
Do not send UE Context Release Command to eNB before receiving SGs IMSI
Detach Ack from MSC/VLR */
Expand Down Expand Up @@ -1517,7 +1522,11 @@ void mme_app_handle_initial_context_setup_rsp(
OAILOG_FUNC_OUT(LOG_MME_APP);
}

// Stop Initial context setup process guard timer,if running
/* Stop Initial context setup process guard timer,if running.
* Do not process the message if timer is not running because
* it means that the timer has already expired
* and implicit detach is triggered.
*/
if (ue_context_p->initial_context_setup_rsp_timer.id !=
MME_APP_TIMER_INACTIVE_ID) {
nas_itti_timer_arg_t* timer_argP = NULL;
Expand All @@ -1536,29 +1545,29 @@ void mme_app_handle_initial_context_setup_rsp(
ue_context_p->initial_context_setup_rsp_timer.id =
MME_APP_TIMER_INACTIVE_ID;
ue_context_p->time_ics_rsp_timer_started = 0;
}

if (mme_app_send_modify_bearer_request_for_active_pdns(
ue_context_p, initial_ctxt_setup_rsp_p) != RETURNok) {
OAILOG_ERROR_UE(
LOG_MME_APP, ue_context_p->emm_context._imsi64,
"Failed to send modify bearer request for UE id %d \n",
ue_context_p->mme_ue_s1ap_id);
OAILOG_FUNC_OUT(LOG_MME_APP);
}
/*
* During Service request procedure,after initial context setup response
* Send ULR, when UE moved from Idle to Connected and
* flag location_info_confirmed_in_hss set to true during hss reset.
*/
if (ue_context_p->location_info_confirmed_in_hss == true) {
mme_app_send_s6a_update_location_req(ue_context_p);
}
if (ue_context_p->sgs_context) {
ue_context_p->sgs_context->csfb_service_type = CSFB_SERVICE_NONE;
// Reset mt_call_in_progress flag
if (ue_context_p->sgs_context->mt_call_in_progress) {
ue_context_p->sgs_context->mt_call_in_progress = false;
if (mme_app_send_modify_bearer_request_for_active_pdns(
ue_context_p, initial_ctxt_setup_rsp_p) != RETURNok) {
OAILOG_ERROR_UE(
LOG_MME_APP, ue_context_p->emm_context._imsi64,
"Failed to send modify bearer request for UE id %d \n",
ue_context_p->mme_ue_s1ap_id);
OAILOG_FUNC_OUT(LOG_MME_APP);
}
/*
* During Service request procedure,after initial context setup response
* Send ULR, when UE moved from Idle to Connected and
* flag location_info_confirmed_in_hss set to true during hss reset.
*/
if (ue_context_p->location_info_confirmed_in_hss == true) {
mme_app_send_s6a_update_location_req(ue_context_p);
}
if (ue_context_p->sgs_context) {
ue_context_p->sgs_context->csfb_service_type = CSFB_SERVICE_NONE;
// Reset mt_call_in_progress flag
if (ue_context_p->sgs_context->mt_call_in_progress) {
ue_context_p->sgs_context->mt_call_in_progress = false;
}
}
}
OAILOG_FUNC_OUT(LOG_MME_APP);
Expand Down Expand Up @@ -1927,35 +1936,35 @@ void mme_app_handle_initial_context_setup_failure(
ue_context_p->initial_context_setup_rsp_timer.id =
MME_APP_TIMER_INACTIVE_ID;
ue_context_p->time_implicit_detach_timer_started = 0;
}
/* *********Abort the ongoing procedure*********
* Check if UE is registered already that implies service request procedure is
* active. If so then release the S1AP context and move the UE back to idle
* mode. Otherwise if UE is not yet registered that implies attach procedure
* is active. If so,then abort the attach procedure and release the UE
* context.
*/
ue_context_p->ue_context_rel_cause = S1AP_INITIAL_CONTEXT_SETUP_FAILED;
if (ue_context_p->mm_state == UE_UNREGISTERED) {
// Initiate Implicit Detach for the UE
nas_proc_implicit_detach_ue_ind(ue_context_p->mme_ue_s1ap_id);
increment_counter(
"ue_attach", 1, 2, "result", "failure", "cause",
"initial_context_setup_failure_rcvd");
increment_counter("ue_attach", 1, 1, "action", "attach_abort");
} else {
// Release S1-U bearer and move the UE to idle mode
/* *********Abort the ongoing procedure*********
* Check if UE is registered already that implies service request procedure
* is active. If so then release the S1AP context and move the UE back to
* idle mode. Otherwise if UE is not yet registered that implies attach
* procedure is active. If so,then abort the attach procedure and release
* the UE context.
*/
ue_context_p->ue_context_rel_cause = S1AP_INITIAL_CONTEXT_SETUP_FAILED;
if (ue_context_p->mm_state == UE_UNREGISTERED) {
// Initiate Implicit Detach for the UE
nas_proc_implicit_detach_ue_ind(ue_context_p->mme_ue_s1ap_id);
increment_counter(
"ue_attach", 1, 2, "result", "failure", "cause",
"initial_context_setup_failure_rcvd");
increment_counter("ue_attach", 1, 1, "action", "attach_abort");
} else {
// Release S1-U bearer and move the UE to idle mode

for (pdn_cid_t i = 0; i < MAX_APN_PER_UE; i++) {
if (ue_context_p->pdn_contexts[i]) {
mme_app_send_s11_release_access_bearers_req(ue_context_p, i);
for (pdn_cid_t i = 0; i < MAX_APN_PER_UE; i++) {
if (ue_context_p->pdn_contexts[i]) {
mme_app_send_s11_release_access_bearers_req(ue_context_p, i);
}
}
/* Handles CSFB failure */
if (ue_context_p->sgs_context != NULL) {
handle_csfb_s1ap_procedure_failure(
ue_context_p, "initial_context_setup_failed",
INTIAL_CONTEXT_SETUP_PROCEDURE_FAILED);
}
}
/* Handles CSFB failure */
if (ue_context_p->sgs_context != NULL) {
handle_csfb_s1ap_procedure_failure(
ue_context_p, "initial_context_setup_failed",
INTIAL_CONTEXT_SETUP_PROCEDURE_FAILED);
}
}
OAILOG_FUNC_OUT(LOG_MME_APP);
Expand Down
2 changes: 1 addition & 1 deletion lte/gateway/c/oai/tasks/mme_app/mme_app_context.c
Expand Up @@ -598,7 +598,7 @@ void mme_ue_context_update_coll_keys(
h_rc = hashtable_uint64_ts_remove(
mme_ue_context_p->tun11_ue_context_htbl,
(const hash_key_t) ue_context_p->mme_teid_s11);
if (INVALID_MME_UE_S1AP_ID != mme_ue_s1ap_id) {
if ((INVALID_MME_UE_S1AP_ID != mme_ue_s1ap_id) && (mme_teid_s11)) {
h_rc = hashtable_uint64_ts_insert(
mme_ue_context_p->tun11_ue_context_htbl,
(const hash_key_t) mme_teid_s11, (uint64_t) mme_ue_s1ap_id);
Expand Down
2 changes: 2 additions & 0 deletions lte/gateway/c/oai/tasks/sgw/sgw_handlers.c
Expand Up @@ -846,6 +846,8 @@ static int send_mbr_failure(
modify_response_p->bearer_contexts_marked_for_removal.bearer_contexts[idx]
.cause.cause_value = CONTEXT_NOT_FOUND;
}
// Fill mme s11 teid received in modify bearer request
modify_response_p->teid = modify_bearer_pP->local_teid;
modify_response_p->bearer_contexts_marked_for_removal.num_bearer_context += 1;
modify_response_p->cause.cause_value = CONTEXT_NOT_FOUND;
modify_response_p->trxn = modify_bearer_pP->trxn;
Expand Down

0 comments on commit ae5ed41

Please sign in to comment.