From b01810a8580baec28736d5e7fd89ef6370713b16 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 3 Sep 2024 08:20:07 +0200 Subject: [PATCH] Introduce an_release flag: only free UE in RRC+ack if requested by core The F1AP UE context release procedure can happen in at least two cases: 1. core requested a release of a UE 2. CU requests DU a release of a UE without a core release (e.g., handover) In case 1., the CU has to fully release the UE in the CU, then ack the NGAP message from the core, whilst in 2., nothing of that should happen after the DU acknowledges the F1AP UE context release cmd. --- openair2/RRC/NR/nr_rrc_defs.h | 2 ++ openair2/RRC/NR/rrc_gNB.c | 8 +++++++- openair2/RRC/NR/rrc_gNB_NGAP.c | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/openair2/RRC/NR/nr_rrc_defs.h b/openair2/RRC/NR/nr_rrc_defs.h index de4bd5f5ec..cff7395934 100644 --- a/openair2/RRC/NR/nr_rrc_defs.h +++ b/openair2/RRC/NR/nr_rrc_defs.h @@ -289,6 +289,8 @@ typedef struct gNB_RRC_UE_s { uint32_t ue_reestablishment_counter; uint32_t ue_reconfiguration_counter; + bool an_release; // flag if core requested UE release + /* NGUEContextSetup might come with PDU sessions, but setup needs to be * delayed after security (and capability); PDU sessions are stored here */ int n_initial_pdu; diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 6035d05a67..d7a879d248 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -2030,7 +2030,13 @@ static void rrc_CU_process_ue_context_release_complete(MessageDef *msg_p) return; } - rrc_remove_ue(RC.nrrrc[0], ue_context_p); + gNB_RRC_UE_t *UE = &ue_context_p->ue_context; + if (UE->an_release) { + /* only trigger release if it has been requested by core + * otherwise, it might be CU that requested release on a DU during normal + * operation (i.e, handover) */ + rrc_remove_ue(RC.nrrrc[0], ue_context_p); + } } static void rrc_CU_process_ue_context_modification_response(MessageDef *msg_p, instance_t instance) diff --git a/openair2/RRC/NR/rrc_gNB_NGAP.c b/openair2/RRC/NR/rrc_gNB_NGAP.c index a98853af28..1ef1f8c808 100644 --- a/openair2/RRC/NR/rrc_gNB_NGAP.c +++ b/openair2/RRC/NR/rrc_gNB_NGAP.c @@ -1180,6 +1180,7 @@ int rrc_gNB_process_NGAP_UE_CONTEXT_RELEASE_COMMAND(MessageDef *msg_p, instance_ } gNB_RRC_UE_t *UE = &ue_context_p->ue_context; + UE->an_release = true; #ifdef E2_AGENT signal_rrc_state_changed_to(UE, RC_SM_RRC_IDLE); #endif