From 13bdcb47438ebf7da3f7a2771c8f964fb7491a9b Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Wed, 31 Aug 2022 08:46:42 +0100 Subject: [PATCH 1/3] Implementation of a RA timer to remove UE in the case of Msg4 not be decoded by the UE --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 2 ++ openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c | 11 +++++++++++ openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 1 + openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 1 + 4 files changed, 15 insertions(+) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 745fc1ae2b..e68af6ebed 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -1829,6 +1829,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra nr_clear_ra_proc(module_idP, CC_id, frameP, ra); UE->Msg3_dcch_dtch = true; UE->Msg4_ACKed = true; + UE->ra_timer = 0; remove_front_nr_list(&sched_ctrl->feedback_dl_harq); harq->feedback_slot = -1; @@ -1867,6 +1868,7 @@ void nr_check_Msg4_Ack(module_id_t module_id, int CC_id, frame_t frame, sub_fram if (stats->dl.errors == 0) { LOG_A(NR_MAC, "(UE RNTI 0x%04x) Received Ack of RA-Msg4. CBRA procedure succeeded!\n", ra->rnti); UE->Msg4_ACKed = true; + UE->ra_timer = 0; // Pause scheduling according to: // 3GPP TS 38.331 Section 12 Table 12.1-1: UE performance requirements for RRC procedures for UEs diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index ea25fd436f..df1d20ed9f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -2508,6 +2508,8 @@ NR_UE_info_t *add_new_nr_ue(gNB_MAC_INST *nr_mac, rnti_t rntiP, NR_CellGroupConf "uplinkBWP_ToAddModList has %d BWP!\n", ul_bwp->n_ul_bwp); + UE->ra_timer = 12000 << UE->current_DL_BWP.scs; // TODO: temporary value, 12000 ms from experimental results + /* get Number of HARQ processes for this UE */ // pdsch_servingcellconfig == NULL in SA -> will create default (8) number of HARQ processes create_dl_harq_list(sched_ctrl, dl_bwp->pdsch_servingcellconfig); @@ -2974,6 +2976,15 @@ void nr_mac_update_timers(module_id_t module_id, ups); } } + + // RA timer + if (UE->ra_timer > 0) { + UE->ra_timer--; + if (UE->ra_timer == 0) { + LOG_W(NR_MAC, "Removing UE %04x because RA timer expired\n", UE->rnti); + mac_remove_nr_ue(RC.nrmac[module_id], UE->rnti); + } + } } } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 1ca9fa067e..23922efa71 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -668,6 +668,7 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, if(ra->cfra) { LOG_A(NR_MAC, "(rnti 0x%04x) CFRA procedure succeeded!\n", ra->rnti); + UE->ra_timer = 0; nr_mac_remove_ra_rnti(gnb_mod_idP, ra->rnti); nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP, ra); process_CellGroup(ra->CellGroup, UE_scheduling_control); diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 0543b09e9e..5ca915c838 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -709,6 +709,7 @@ typedef struct { uint8_t UE_beam_index; bool Msg3_dcch_dtch; bool Msg4_ACKed; + uint32_t ra_timer; /// Sched CSI-RS: scheduling decisions NR_gNB_UCI_STATS_t uci_statS; float ul_thr_ue; From 00373ed10b0dce00ccde6bcf8576891b4e607930 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Thu, 1 Sep 2022 08:12:26 +0100 Subject: [PATCH 2/3] Address review comments --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index df1d20ed9f..c2732bdade 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -2508,7 +2508,7 @@ NR_UE_info_t *add_new_nr_ue(gNB_MAC_INST *nr_mac, rnti_t rntiP, NR_CellGroupConf "uplinkBWP_ToAddModList has %d BWP!\n", ul_bwp->n_ul_bwp); - UE->ra_timer = 12000 << UE->current_DL_BWP.scs; // TODO: temporary value, 12000 ms from experimental results + UE->ra_timer = 12000 << UE->current_DL_BWP.scs; // 12000 ms is arbitrary and found to be a good timeout from experiments /* get Number of HARQ processes for this UE */ // pdsch_servingcellconfig == NULL in SA -> will create default (8) number of HARQ processes From 66369a8a4c023301eea1ac27aff5fce19d810d2c Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Thu, 1 Sep 2022 08:29:57 +0100 Subject: [PATCH 3/3] Prevent ra_timer to be enabled when running in phy-test mode When running in this mode there is no RA that will succeed to disable the timer --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index c2732bdade..e4891a44be 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -2508,7 +2508,9 @@ NR_UE_info_t *add_new_nr_ue(gNB_MAC_INST *nr_mac, rnti_t rntiP, NR_CellGroupConf "uplinkBWP_ToAddModList has %d BWP!\n", ul_bwp->n_ul_bwp); - UE->ra_timer = 12000 << UE->current_DL_BWP.scs; // 12000 ms is arbitrary and found to be a good timeout from experiments + if (get_softmodem_params()->phy_test == 0) { + UE->ra_timer = 12000 << UE->current_DL_BWP.scs; // 12000 ms is arbitrary and found to be a good timeout from experiments + } /* get Number of HARQ processes for this UE */ // pdsch_servingcellconfig == NULL in SA -> will create default (8) number of HARQ processes