[AMF] More Follow-up on #1987

This commit is contained in:
Sukchan Lee 2023-01-08 20:02:18 +09:00
parent 9f4a9790e3
commit 7f9afa0213
8 changed files with 91 additions and 68 deletions

View File

@ -157,6 +157,12 @@ void ogs_timer_stop_debug(ogs_timer_t *timer, const char *file_line)
ogs_rbtree_delete(&manager->tree, timer);
}
bool ogs_timer_running(ogs_timer_t *timer)
{
ogs_assert(timer);
return timer->running;
}
ogs_time_t ogs_timer_mgr_next(ogs_timer_mgr_t *manager)
{
ogs_time_t current;

View File

@ -58,6 +58,8 @@ void ogs_timer_start_debug(
ogs_timer_stop_debug(timer, OGS_FILE_LINE)
void ogs_timer_stop_debug(ogs_timer_t *timer, const char *file_line);
bool ogs_timer_running(ogs_timer_t *timer);
ogs_time_t ogs_timer_mgr_next(ogs_timer_mgr_t *manager);
void ogs_timer_mgr_expire(ogs_timer_mgr_t *manager);

View File

@ -877,6 +877,18 @@ void amf_state_operational(ogs_fsm_t *s, amf_event_t *e)
NGAP_UE_CTX_REL_NG_CONTEXT_REMOVE, 0));
}
amf_ue_associate_ran_ue(amf_ue, ran_ue);
/*
* TS 24.501
* 5.3.7 Handling of the periodic registration update timer
*
* The mobile reachable timer shall be stopped
* when a NAS signalling connection is established for the UE.
* The implicit de-registration timer shall be stopped
* when a NAS signalling connection is established for the UE.
*/
CLEAR_AMF_UE_TIMER(amf_ue->mobile_reachable);
CLEAR_AMF_UE_TIMER(amf_ue->implicit_deregistration);
}
ogs_assert(amf_ue);

View File

@ -1843,18 +1843,6 @@ void amf_ue_associate_ran_ue(amf_ue_t *amf_ue, ran_ue_t *ran_ue)
amf_ue->ran_ue = ran_ue;
ran_ue->amf_ue = amf_ue;
/* Clear mobile_reachable and implicit_deregistration Timers
* TS 24.501
* 5.3.7 Handling of the periodic registration update timer and
* mobile reachable timer
* The mobile reachable timer shall be stopped when a NAS signalling
* connection is established for the UE.
* The implicit de-registration timer shall be stopped when a NAS
* signalling connection is established for the UE.
*/
CLEAR_AMF_UE_TIMER(amf_ue->mobile_reachable);
CLEAR_AMF_UE_TIMER(amf_ue->implicit_deregistration);
}
void ran_ue_deassociate(ran_ue_t *ran_ue)

View File

@ -382,17 +382,10 @@ void gmm_state_registered(ogs_fsm_t *s, amf_event_t *e)
}
}
/* Clear Paging Info */
AMF_UE_CLEAR_PAGING_INFO(amf_ue);
/* Clear N2 Transfer */
AMF_UE_CLEAR_N2_TRANSFER(
amf_ue, pdu_session_resource_setup_request);
/* Clear 5GSM Message */
AMF_UE_CLEAR_5GSM_MESSAGE(amf_ue);
/* Clear t3513 Timers */
CLEAR_AMF_UE_TIMER(amf_ue->t3513);
} else {
@ -437,37 +430,58 @@ void gmm_state_registered(ogs_fsm_t *s, amf_event_t *e)
break;
case AMF_TIMER_MOBILE_REACHABLE:
ogs_info("[%s] Mobile Reachable Timer Expired", amf_ue->supi);
/* Clear mobile_reachable Timers */
CLEAR_AMF_UE_TIMER(amf_ue->mobile_reachable);
/* Start AMF_TIMER_IMPLICIT_DEREGISTRATION
/*
* TS 24.501
* 5.3.7 Handling of the periodic registration update timer and
* mobile reachable timer
*
* Upon expiry of the mobile reachable timer the network shall
* start the implicit de-registration timer over 3GPP access.
* The default value of the implicit de-registration timer over
* 3GPP access is 4 minutes greater than the value of timer T3512.
*/
ogs_warn("[%s] Mobile Reachable Timer Expired", amf_ue->supi);
ogs_list_for_each(&amf_ue->sess_list, sess) {
if (sess->paging.ongoing == true &&
sess->paging.n1n2_failure_txf_notif_uri != NULL) {
ogs_assert(true ==
amf_sbi_send_n1_n2_failure_notify(
sess,
OpenAPI_n1_n2_message_transfer_cause_UE_NOT_REACHABLE_FOR_SESSION));
}
}
/* Stop Paging */
AMF_UE_CLEAR_PAGING_INFO(amf_ue);
AMF_UE_CLEAR_N2_TRANSFER(
amf_ue, pdu_session_resource_setup_request);
AMF_UE_CLEAR_5GSM_MESSAGE(amf_ue);
CLEAR_AMF_UE_TIMER(amf_ue->t3513);
ogs_timer_start(amf_ue->implicit_deregistration.timer,
ogs_time_from_sec(amf_self()->time.t3512.value + 240));
break;
case AMF_TIMER_IMPLICIT_DEREGISTRATION:
ogs_info("[%s] Do Network-Initiated De-Register UE", amf_ue->supi);
/* Clear implicit_deregistration Timers */
CLEAR_AMF_UE_TIMER(amf_ue->implicit_deregistration);
/* Implicitly de-register UE
/*
* TS 24.501
* 5.3.7 Handling of the periodic registration update timer and
* mobile reachable timer
*
* If the implicit de-registration timer expires before the UE
* contacts the network, the network shall implicitly de-register
* the UE.
*
* TS 23.502
* 4.2.2.3.3 Network-initiated Deregistration
* The AMF does not send the Deregistration Request message to the UE
* for Implicit Deregistration.
*
* The AMF does not send the Deregistration Request message
* to the UE for Implicit Deregistration.
*/
ogs_info("[%s] Do Network-initiated De-register UE", amf_ue->supi);
ogs_assert(true == amf_ue_sbi_discover_and_send(
OGS_SBI_SERVICE_TYPE_NUDM_SDM, NULL,
amf_nudm_sdm_build_subscription_delete,

View File

@ -272,16 +272,21 @@ int amf_namf_comm_handle_n1_n2_message_transfer(
sendmsg.http.location = ogs_sbi_server_uri(server, &header);
/* Store Paging Info */
AMF_SESS_STORE_PAGING_INFO(
if (ogs_timer_running(
amf_ue->implicit_deregistration.timer) == true) {
ogs_warn("[%s] Paging failed. Stop", amf_ue->supi);
} else {
/* Store Paging Info */
AMF_SESS_STORE_PAGING_INFO(
sess, sendmsg.http.location,
N1N2MessageTransferReqData->n1n2_failure_txf_notif_uri);
/* Store N2 Transfer message */
AMF_SESS_STORE_N2_TRANSFER(
sess, pdu_session_resource_setup_request, n2buf);
/* Store N2 Transfer message */
AMF_SESS_STORE_N2_TRANSFER(
sess, pdu_session_resource_setup_request, n2buf);
ogs_assert(OGS_OK == ngap_send_paging(amf_ue));
ogs_assert(OGS_OK == ngap_send_paging(amf_ue));
}
} else if (CM_CONNECTED(amf_ue)) {
ogs_assert(OGS_OK ==
@ -331,16 +336,21 @@ int amf_namf_comm_handle_n1_n2_message_transfer(
sendmsg.http.location = ogs_sbi_server_uri(server, &header);
/* Store Paging Info */
AMF_SESS_STORE_PAGING_INFO(
sess, sendmsg.http.location, NULL);
if (ogs_timer_running(
amf_ue->implicit_deregistration.timer) == true) {
ogs_warn("[%s] Paging failed. Stop", amf_ue->supi);
} else {
/* Store Paging Info */
AMF_SESS_STORE_PAGING_INFO(
sess, sendmsg.http.location, NULL);
/* Store 5GSM Message */
AMF_SESS_STORE_5GSM_MESSAGE(sess,
OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND,
n1buf, n2buf);
/* Store 5GSM Message */
AMF_SESS_STORE_5GSM_MESSAGE(sess,
OGS_NAS_5GS_PDU_SESSION_MODIFICATION_COMMAND,
n1buf, n2buf);
ogs_assert(OGS_OK == ngap_send_paging(amf_ue));
ogs_assert(OGS_OK == ngap_send_paging(amf_ue));
}
} else if (CM_CONNECTED(amf_ue)) {
ogs_expect(OGS_OK ==

View File

@ -462,6 +462,18 @@ void ngap_handle_initial_ue_message(amf_gnb_t *gnb, ogs_ngap_message_t *message)
NGAP_UE_CTX_REL_NG_CONTEXT_REMOVE, 0));
}
amf_ue_associate_ran_ue(amf_ue, ran_ue);
/*
* TS 24.501
* 5.3.7 Handling of the periodic registration update timer
*
* The mobile reachable timer shall be stopped
* when a NAS signalling connection is established for the UE.
* The implicit de-registration timer shall be stopped
* when a NAS signalling connection is established for the UE.
*/
CLEAR_AMF_UE_TIMER(amf_ue->mobile_reachable);
CLEAR_AMF_UE_TIMER(amf_ue->implicit_deregistration);
}
}
}

View File

@ -369,29 +369,8 @@ int ngap_send_paging(amf_ue_t *amf_ue)
int i, j;
int rv;
if (amf_ue->implicit_deregistration.timer->running) {
/* Mobile Reachable timer has expired if implicit de-registration
* timer is running
* TS 24.501
* 5.3.7 Handling of the periodic registration update timer and
* mobile reachable timer
* The network behaviour upon expiry of the mobile reachable timer
* is network dependent, but typically the network stops sending
* paging messages to the UE on the first expiry
*/
ogs_info("[%s] Paging ignored due to Mobile Reachable timer expiration",
amf_ue->supi);
/* Clear Paging Info */
AMF_UE_CLEAR_PAGING_INFO(amf_ue);
/* Clear N2 Transfer */
AMF_UE_CLEAR_N2_TRANSFER(
amf_ue, pdu_session_resource_setup_request);
/* Clear 5GSM Message */
AMF_UE_CLEAR_5GSM_MESSAGE(amf_ue);
return OGS_OK;
}
ogs_assert(ogs_timer_running(
amf_ue->implicit_deregistration.timer) == false);
ogs_list_for_each(&amf_self()->gnb_list, gnb) {
for (i = 0; i < gnb->num_of_supported_ta_list; i++) {