From e42c303bd72006262a60a50c887ada401aaed810 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 31 May 2024 19:49:43 +0200 Subject: [PATCH] Handle UE Context Modification Response in HO case We expect the UE's RRC Reconfiguration Complete to come through the target DU, as the "new UE" at the target CU. Also, function CU_handle_UL_RRC_MESSAGE_TRANSFER() checks that the UL RRC Message, through which we will receive RRC Reconfiguration Complete, matches the DU UE ID stored in RRC. Since the DU UE ID will be the one at the target DU, while up to now, we stored the DU UE ID at the source DU. Correspondingly, update the DU UE ID to the one at the target DU; also update the corresponding assoc_id. Co-authored-by: batuhanduyuler Co-authored-by: rmagueta --- openair2/RRC/NR/rrc_gNB.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index e0c94fc293..3335116a21 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -1983,6 +1983,24 @@ static void rrc_CU_process_ue_context_modification_response(MessageDef *msg_p, i rrc_gNB_generate_dedicatedRRCReconfiguration(rrc, UE); } + + // Reconfiguration should have been sent to the UE, so it will attempt the + // handover. In the F1 case, update with new RNTI, and update secondary UE + // association, so we can receive the new UE from the target DU (in N2/Xn, + // nothing is to be done, we wait for confirmation to release the UE in the + // CU/DU) + if (UE->ho_context && UE->ho_context->target && UE->ho_context->source) { + nr_ho_target_cu_t *target_ctx = UE->ho_context->target; + f1_ue_data_t ue_data = cu_get_f1_ue_data(UE->rrc_ue_id); + ue_data.secondary_ue = target_ctx->du_ue_id; + ue_data.du_assoc_id = target_ctx->du->assoc_id; + cu_remove_f1_ue_data(UE->rrc_ue_id); + cu_add_f1_ue_data(UE->rrc_ue_id, &ue_data); + LOG_I(NR_RRC, "UE %d handover: update RNTI from %04x to %04x\n", UE->rrc_ue_id, UE->rnti, target_ctx->new_rnti); + nr_ho_source_cu_t *source_ctx = UE->ho_context->source; + DevAssert(source_ctx->old_rnti == UE->rnti); + UE->rnti = target_ctx->new_rnti; + } } static void rrc_CU_process_ue_modification_required(MessageDef *msg_p, instance_t instance)