From f0df1ccb533ef114b4443523da2365b46d1842f2 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Tue, 5 Dec 2023 15:29:18 +0000 Subject: [PATCH] Hotfix: swap UIDs after RRCReestablishment The CellGroup is created considering UID, for example: 'pucchres0->startingPRB = 8 + uid;' and since we keep the CellGroup from the previous RNTI/UID we should keep also the previous UID. Considering the scenario where a UE did successful RRCReestablishment, it was getting uid = 1, and uid = 0 was removed. When another UE connected, it was getting UID = 0 (because 0 was already free), and so the PUCCH 0 resource was conflicting with the first UE. On that occasion, also correct the comment that describes the code, as it was wrong/misleading. --- openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 5157ff453f..a2cff90bd2 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c +++ b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c @@ -553,8 +553,9 @@ void dl_rrc_message_transfer(const f1ap_dl_rrc_message_t *dl_rrc) AssertFatal(*dl_rrc->old_gNB_DU_ue_id != dl_rrc->gNB_DU_ue_id, "logic bug: current and old gNB DU UE ID cannot be the same\n"); /* 38.401 says: "Find UE context based on old gNB-DU UE F1AP ID, replace - * old C-RNTI/PCI with new C-RNTI/PCI". So we delete the new contexts - * below, then change the C-RNTI of the old one to the new one */ + * old C-RNTI/PCI with new C-RNTI/PCI". Below, we do the inverse: we keep + * the new UE context (with new C-RNTI), but set up everything to reuse the + * old config. */ NR_UE_info_t *oldUE = find_nr_UE(&mac->UE_info, *dl_rrc->old_gNB_DU_ue_id); DevAssert(oldUE); pthread_mutex_lock(&mac->sched_lock); @@ -564,6 +565,9 @@ void dl_rrc_message_transfer(const f1ap_dl_rrc_message_t *dl_rrc) UE->CellGroup->spCellConfig = NULL; NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl; NR_ServingCellConfigCommon_t *scc = mac->common_channels[0].ServingCellConfigCommon; + uid_t temp_uid = UE->uid; + UE->uid = oldUE->uid; + oldUE->uid = temp_uid; configure_UE_BWP(mac, scc, sched_ctrl, NULL, UE, -1, -1); nr_mac_prepare_cellgroup_update(mac, UE, oldUE->CellGroup);