diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 165251e9f4..b1081ee631 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -1630,7 +1630,7 @@ static void nr_generate_Msg3_dcch_dtch_response(module_id_t module_idP, return; // UE is known by the network, C-RNTI to be used instead of TC-RNTI - int rnti = ra->crnti; + int rnti = ra->rnti; NR_UE_info_t *UE = find_nr_UE(&nr_mac->UE_info, rnti); if (!UE) { @@ -1731,10 +1731,6 @@ static void nr_generate_Msg3_dcch_dtch_response(module_id_t module_idP, return; } - // Remove UE associated to TC-RNTI - mac_remove_nr_ue(nr_mac, ra->rnti); - - // If the UE used MSG3 to transfer a DCCH or DTCH message, then contention resolution is successful if the UE receives a PDCCH transmission which has its CRC bits scrambled by the C-RNTI // Just send padding LCID uint8_t buf[tb_size]; @@ -2113,7 +2109,6 @@ void nr_clear_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP, NR_RA_t ra->timing_offset = 0; ra->RRC_timer = 20; ra->msg3_round = 0; - ra->crnti = 0; if(ra->cfra == false) { ra->rnti = 0; } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 18693ac20e..1f612e0ecd 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -223,7 +223,13 @@ static int nr_process_mac_pdu(instance_t module_idP, for (int i = 0; i < NR_NB_RA_PROC_MAX; i++) { NR_RA_t *ra = &RC.nrmac[module_idP]->common_channels[CC_id].ra[i]; if (ra->state >= WAIT_Msg3 && ra->rnti == UE->rnti) { - ra->crnti = ((pduP[1]&0xFF)<<8)|(pduP[2]&0xFF); + // remove UE context just created after Msg.3 in some milliseconds + // as the UE is one already known (not now, as the UE context is + // still needed for the moment) + nr_mac_trigger_release_timer(&UE->UE_sched_ctrl, UE->current_UL_BWP.scs); + //mac_remove_nr_ue(RC.nrmac[module_idP], ra->rnti); + // this UE is the one identified by the RNTI in pduP + ra->rnti = ((pduP[1]&0xFF)<<8)|(pduP[2]&0xFF); ra->state = Msg3_dcch_dtch; break; } @@ -779,13 +785,13 @@ static void _nr_rx_sdu(const module_id_t gnb_mod_idP, if (ra->state == Msg3_dcch_dtch) { // Check if the UE identified by C-RNTI still exists at the gNB - NR_UE_info_t * UE_C = find_nr_UE(&gNB_mac->UE_info, ra->crnti); + NR_UE_info_t * UE_C = find_nr_UE(&gNB_mac->UE_info, ra->rnti); if (!UE_C) { // The UE identified by C-RNTI no longer exists at the gNB // Let's abort the current RA, so the UE will trigger a new RA later but using RRCSetupRequest instead. A better solution may be implemented mac_remove_nr_ue(gNB_mac, ra->rnti); nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra); - LOG_W(NR_MAC, "No UE found with C-RNTI %04x, ignoring Msg.3 to have UE come back with new RA attempt\n", ra->crnti); + LOG_W(NR_MAC, "No UE found with C-RNTI %04x, ignoring Msg.3 to have UE come back with new RA attempt\n", ra->rnti); return; } else { // The UE identified by C-RNTI still exists at the gNB 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 404eebc3b5..e78b66fded 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c +++ b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c @@ -287,7 +287,7 @@ void ue_context_modification_refuse(const f1ap_ue_context_modif_refuse_t *refuse NR_COMMON_channels_t *cc = &mac->common_channels[CC_id]; for (int i = 0; i < NR_NB_RA_PROC_MAX; i++) { NR_RA_t *ra = &cc->ra[i]; - if (ra->crnti == UE->rnti) + if (ra->rnti == UE->rnti) nr_clear_ra_proc(0, CC_id, 0 /* frame */, ra); } NR_SCHED_UNLOCK(&mac->sched_lock); diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 2197871845..4bec3664c8 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -204,8 +204,6 @@ typedef struct { NR_CellGroupConfig_t *CellGroup; /// Preambles for contention-free access NR_preamble_ue_t preambles; - /// NSA: the UEs C-RNTI to use - rnti_t crnti; /// CFRA flag bool cfra; // BWP for RA