diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c index cb26703566..2a2760e7a7 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c +++ b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c @@ -687,6 +687,12 @@ void dl_rrc_message_transfer(const f1ap_dl_rrc_message_t *dl_rrc) nr_mac_enable_ue_rrc_processing_timer(mac, UE, /* apply_cellGroup = */ true); NR_SCHED_UNLOCK(&mac->sched_lock); UE->expect_reconfiguration = false; + /* Re-establish RLC for all remaining bearers */ + if (UE->reestablish_rlc) { + for (int i = 1; i < UE->UE_sched_ctrl.dl_lc_num; ++i) + nr_rlc_reestablish_entity(dl_rrc->gNB_DU_ue_id, UE->UE_sched_ctrl.dl_lc_ids[i]); + UE->reestablish_rlc = false; + } } if (dl_rrc->old_gNB_DU_ue_id != NULL) { @@ -716,6 +722,9 @@ void dl_rrc_message_transfer(const f1ap_dl_rrc_message_t *dl_rrc) pthread_mutex_unlock(&mac->sched_lock); nr_rlc_remove_ue(dl_rrc->gNB_DU_ue_id); nr_rlc_update_id(*dl_rrc->old_gNB_DU_ue_id, dl_rrc->gNB_DU_ue_id); + /* Set flag to trigger RLC re-establishment + * for remaining RBs in next RRCReconfiguration */ + UE->reestablish_rlc = true; /* 38.331 clause 5.3.7.4: apply the specified configuration defined in 9.2.1 for SRB1 */ nr_rlc_reconfigure_entity(dl_rrc->gNB_DU_ue_id, 1, NULL); instance_t f1inst = get_f1_gtp_instance(); diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index e162ecbff5..a35911d3ce 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -683,6 +683,8 @@ typedef struct { NR_CellGroupConfig_t *CellGroup; /// CellGroupConfig that is to be activated after the next reconfiguration bool expect_reconfiguration; + /// reestablishRLC has to be signaled in RRCreconfiguration + bool reestablish_rlc; NR_CellGroupConfig_t *reconfigCellGroup; bool apply_cellgroup; NR_UE_NR_Capability_t *capability; diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index 61adacab69..f08964dabc 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -650,7 +650,7 @@ void nr_rlc_reestablish_entity(int ue_id, int lc_id) nr_rlc_entity_t *rb = get_rlc_entity_from_lcid(ue, lc_id); if (rb != NULL) { - LOG_D(RLC, "%s: RB found! (channel ID %d), re-establish RLC\n", __func__, lc_id); + LOG_D(RLC, "RB found! (channel ID %d), re-establish RLC\n", lc_id); rb->reestablishment(rb); } else { LOG_E(RLC, "no RLC entity found (channel ID %d) for reestablishment\n", lc_id); @@ -1065,12 +1065,11 @@ bool nr_rlc_update_id(int from_id, int to_id) } ue->ue_id = to_id; LOG_I(RLC, "Update old UE ID %d context to ID %d\n", from_id, to_id); - for (int i = 0; i < sizeof(ue->srb) / sizeof(ue->srb[0]); ++i) - if (ue->srb[i]) - ue->srb[i]->reestablishment(ue->srb[i]); - for (int i = 0; i < sizeof(ue->drb) / sizeof(ue->drb[0]); ++i) - if (ue->drb[i]) - ue->drb[i]->reestablishment(ue->drb[i]); + /* re-establish RLC for SRB1: according to 5.3.7.4 of TS 38.331 */ + if (ue->srb[0]) { + LOG_I(RLC, "Re-establish RLC for SRB 1\n"); + ue->srb[0]->reestablishment(ue->srb[0]); + } nr_rlc_manager_unlock(nr_rlc_ue_manager); return true; } diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 2df6228c6a..abaf8d05a8 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -1080,6 +1080,10 @@ static void rrc_gNB_process_RRCReestablishmentComplete(const protocol_ctxt_t *co for (i = 1; i < ue_p->masterCellGroup->rlc_BearerToAddModList->list.count; ++i) asn1cSeqAdd(&cellGroupConfig->rlc_BearerToAddModList->list, ue_p->masterCellGroup->rlc_BearerToAddModList->list.array[i]); + /* + * At this stage, PDCP entity are re-established and reestablishRLC is flagged + * with RRCReconfiguration to complete RLC re-establishment of remaining bearers + */ for (i = 0; i < cellGroupConfig->rlc_BearerToAddModList->list.count; i++) { asn1cCallocOne(cellGroupConfig->rlc_BearerToAddModList->list.array[i]->reestablishRLC, NR_RLC_BearerConfig__reestablishRLC_true);