diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 97d0feda67..dcc17ec2c0 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -1283,6 +1283,20 @@ static rrc_gNB_ue_context_t *rrc_gNB_get_ue_context_source_cell(gNB_RRC_INST *rr return NULL; } +/** + * @brief Rollback F1-U DL TL and TEID in RRC + */ +static void f1u_dl_gtp_rollback(gNB_RRC_UE_t *UE) +{ + DevAssert(UE != NULL); + DevAssert(UE->ho_context->source != NULL); + + FOR_EACH_SEQ_ARR(drb_t *, drb, &UE->drbs) { + drb->du_tunnel_config = UE->ho_context->source->old_du_tunnel_config; + LOG_W(NR_RRC, "DRB id %d rollback to tunnel TEID %x\n", drb->drb_id, drb->du_tunnel_config.teid); + } +} + static void rrc_handle_RRCReestablishmentRequest(gNB_RRC_INST *rrc, sctp_assoc_t assoc_id, const NR_RRCReestablishmentRequest_IEs_t *req, @@ -1361,6 +1375,7 @@ static void rrc_handle_RRCReestablishmentRequest(gNB_RRC_INST *rrc, } source_ctx->ho_cancel(rrc, UE); + f1u_dl_gtp_rollback(UE); /* we need the original CellGroupConfig */ ASN_STRUCT_FREE(asn_DEF_NR_CellGroupConfig, UE->masterCellGroup); diff --git a/openair2/RRC/NR/rrc_gNB_mobility.c b/openair2/RRC/NR/rrc_gNB_mobility.c index 552cc881d6..bfe5dece8c 100644 --- a/openair2/RRC/NR/rrc_gNB_mobility.c +++ b/openair2/RRC/NR/rrc_gNB_mobility.c @@ -160,6 +160,12 @@ static void nr_initiate_handover(const gNB_RRC_INST *rrc, ho_ctx->source->du_ue_id = ue_data.secondary_ue; ho_ctx->source->old_rnti = ue->rnti; + // Save the GTP-U tunnel info for source DU before process UE context setup request/response + // since tunnel info will be updated by calling store_du_f1u_tunnel() in rrc_CU_process_ue_context_setup_response() + FOR_EACH_SEQ_ARR(drb_t *, drb, &ue->drbs) { + ho_ctx->source->old_du_tunnel_config = drb->du_tunnel_config; + } + int result = asn_copy(&asn_DEF_NR_CellGroupConfig, (void **)&ho_ctx->source->old_cellGroupConfig, ue->masterCellGroup); AssertFatal(result == 0, "error during asn_copy() of CellGroupConfig\n"); } diff --git a/openair2/RRC/NR/rrc_gNB_mobility.h b/openair2/RRC/NR/rrc_gNB_mobility.h index 7010cc83ba..bd0fd8e22c 100644 --- a/openair2/RRC/NR/rrc_gNB_mobility.h +++ b/openair2/RRC/NR/rrc_gNB_mobility.h @@ -56,6 +56,8 @@ typedef struct nr_ho_source_cu { ho_cancel_t ho_cancel; /// status transfer ho_status_transfer_t ho_status_transfer; + /// old (source) downlink tunnel + gtpu_tunnel_t old_du_tunnel_config; } nr_ho_source_cu_t; /* acknowledgement of handover request. buf+len is the RRC Reconfiguration */