Skip to content

Commit

Permalink
fix(mme): Fix for NG setup failure on N1 link restoration (magma#15336)
Browse files Browse the repository at this point in the history
Signed-off-by: krishnavamsi-wavelabs <[email protected]>
Co-authored-by: panyogesh <[email protected]>
  • Loading branch information
Krishnavamsi-wavelabs and panyogesh authored Nov 13, 2023
1 parent 2bd75a2 commit 310acf9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
9 changes: 5 additions & 4 deletions lte/gateway/c/core/oai/tasks/amf/amf_app_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1364,7 +1364,8 @@ static void amf_app_handle_ngap_ue_context_release(
amf_nas_proc_implicit_deregister_ue_ind(ue_context_p->amf_ue_ngap_id);
}
} else {
if (cause == NGAP_RADIO_NR_GENERATED_REASON) {
if (cause == NGAP_RADIO_NR_GENERATED_REASON ||
cause == NGAP_SCTP_SHUTDOWN_OR_RESET) {
int rc = RETURNerror;
rc = ue_state_handle_message_initial(
ue_context_p->mm_state, STATE_EVENT_CONTEXT_RELEASE, SESSION_NULL,
Expand All @@ -1374,7 +1375,7 @@ static void amf_app_handle_ngap_ue_context_release(
OAILOG_WARNING(LOG_AMF_APP, "Failed transitioning to idle mode\n");
}

amf_app_itti_ue_context_release(ue_context_p, NGAP_USER_INACTIVITY);
amf_app_itti_ue_context_release(ue_context_p, cause);
}
}
OAILOG_FUNC_OUT(LOG_AMF_APP);
Expand Down Expand Up @@ -1447,8 +1448,8 @@ void amf_app_handle_gnb_deregister_ind(
const itti_ngap_gNB_deregistered_ind_t* const gNB_deregistered_ind) {
for (int i = 0; i < gNB_deregistered_ind->nb_ue_to_deregister; i++) {
amf_app_handle_ngap_ue_context_release(
gNB_deregistered_ind->gnb_ue_ngap_id[i],
gNB_deregistered_ind->amf_ue_ngap_id[i], gNB_deregistered_ind->gnb_id,
gNB_deregistered_ind->amf_ue_ngap_id[i],
gNB_deregistered_ind->gnb_ue_ngap_id[i], gNB_deregistered_ind->gnb_id,
NGAP_SCTP_SHUTDOWN_OR_RESET);
}
}
Expand Down
8 changes: 4 additions & 4 deletions lte/gateway/c/core/oai/tasks/ngap/ngap_amf.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ void ngap_remove_ue(ngap_state_t* state, m5g_ue_description_t* ue_ref) {
// NULL reference...
if (ue_ref == NULL) return;

gnb_ue_ngap_id_t gnb_ue_ngap_id = ue_ref->gnb_ue_ngap_id;
amf_ue_ngap_id_t amf_ue_ngap_id = ue_ref->amf_ue_ngap_id;
gNB_ref = ngap_state_get_gnb(state, ue_ref->sctp_assoc_id);

// Updating number of UE
Expand All @@ -361,14 +361,14 @@ void ngap_remove_ue(ngap_state_t* state, m5g_ue_description_t* ue_ref) {

hash_table_ts_t* state_ue_ht = get_ngap_ue_state();
hashtable_ts_free(state_ue_ht, ue_ref->comp_ngap_id);
hashtable_ts_free(&state->amfid2associd, gnb_ue_ngap_id);
hashtable_uint64_ts_remove(&gNB_ref->ue_id_coll, gnb_ue_ngap_id);
hashtable_ts_free(&state->amfid2associd, amf_ue_ngap_id);
hashtable_uint64_ts_remove(&gNB_ref->ue_id_coll, amf_ue_ngap_id);

imsi64_t imsi64 = INVALID_IMSI64;
ngap_imsi_map_t* ngap_imsi_map = get_ngap_imsi_map();

hashtable_uint64_ts_get(ngap_imsi_map->amf_ue_id_imsi_htbl,
(const hash_key_t)gnb_ue_ngap_id, &imsi64);
(const hash_key_t)amf_ue_ngap_id, &imsi64);

delete_ngap_ue_state(imsi64);

Expand Down
4 changes: 3 additions & 1 deletion lte/gateway/c/core/oai/test/amf/test_amf_procedures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2789,6 +2789,7 @@ TEST_F(AMFAppProcedureTest, SctpShutWithServiceRequest) {
NGAP_INITIAL_CONTEXT_SETUP_REQ,
NGAP_PDUSESSION_RESOURCE_SETUP_REQ,
NGAP_PDUSESSIONRESOURCE_REL_REQ,
NGAP_UE_CONTEXT_RELEASE_COMMAND,
AMF_APP_NGAP_AMF_UE_ID_NOTIFICATION,
NGAP_NAS_DL_DATA_REQ,
NGAP_UE_CONTEXT_RELEASE_COMMAND,
Expand Down Expand Up @@ -2883,7 +2884,7 @@ TEST_F(AMFAppProcedureTest, SctpShutWithServiceRequest) {
int res = RETURNerror;

// Check the states of UE
res = check_ue_context_state(ue_id, REGISTERED_CONNECTED, M5GCM_IDLE);
res = check_ue_context_state(ue_id, REGISTERED_IDLE, M5GCM_IDLE);
EXPECT_TRUE(res == RETURNok);

// Service Request
Expand Down Expand Up @@ -3324,6 +3325,7 @@ TEST_F(AMFAppProcedureTest, GnbInitiatedNGReset) {
NGAP_NAS_DL_DATA_REQ,
NGAP_NAS_DL_DATA_REQ,
NGAP_INITIAL_CONTEXT_SETUP_REQ,
NGAP_UE_CONTEXT_RELEASE_COMMAND,
NGAP_GNB_INITIATED_RESET_ACK,
NGAP_NAS_DL_DATA_REQ,
NGAP_UE_CONTEXT_RELEASE_COMMAND,
Expand Down

0 comments on commit 310acf9

Please sign in to comment.