From cc33856ba863bba69372a5c25945a2fad8b7dec1 Mon Sep 17 00:00:00 2001 From: luis_pereira87 Date: Wed, 15 Jun 2022 17:24:47 +0100 Subject: [PATCH] Reset HARQ processes after RA when Msg3 carries a DCCH or DTCH message. Reset ul_failure flag only after sending Msg4 otherwise gNB starts scheduling too early --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 4 +++ .../NR_MAC_gNB/gNB_scheduler_primitives.c | 34 +++++++++++++++++++ .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 8 +++-- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 4 +++ 4 files changed, 47 insertions(+), 3 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 2486887fd2..6daa68afed 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -1975,6 +1975,10 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra sched_ctrl->rrc_processing_timer = (delay_ms << genericParameters->subcarrierSpacing); LOG_I(NR_MAC, "(%d.%d) Activating RRC processing timer for UE %04x with %d ms\n", frameP, slotP, UE->rnti, delay_ms); + + // Reset uplink failure flags/counters/timers at MAC so gNB will resume again scheduling resources for this UE + UE->UE_sched_ctrl.pusch_consecutive_dtx_cnt = 0; + UE->UE_sched_ctrl.ul_failure = 0; } else { ra->state = WAIT_Msg4_ACK; LOG_D(NR_MAC,"[gNB %d][RAPROC] Frame %d, Subframe %d: RA state %d\n", module_idP, frameP, slotP, ra->state); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 43ad09f45e..ed9e6b2450 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -2492,6 +2492,40 @@ void create_dl_harq_list(NR_UE_sched_ctrl_t *sched_ctrl, } } +void reset_dl_harq_list(NR_UE_sched_ctrl_t *sched_ctrl) { + int harq; + while ((harq = sched_ctrl->feedback_dl_harq.head) >= 0) { + remove_front_nr_list(&sched_ctrl->feedback_dl_harq); + add_tail_nr_list(&sched_ctrl->available_dl_harq, harq); + } + + while ((harq = sched_ctrl->retrans_dl_harq.head) >= 0) { + remove_front_nr_list(&sched_ctrl->retrans_dl_harq); + add_tail_nr_list(&sched_ctrl->available_dl_harq, harq); + } + + for (int i = 0; i < NR_MAX_NB_HARQ_PROCESSES; i++) { + sched_ctrl->harq_processes[i].is_waiting = false; + } +} + +void reset_ul_harq_list(NR_UE_sched_ctrl_t *sched_ctrl) { + int harq; + while ((harq = sched_ctrl->feedback_ul_harq.head) >= 0) { + remove_front_nr_list(&sched_ctrl->feedback_ul_harq); + add_tail_nr_list(&sched_ctrl->available_ul_harq, harq); + } + + while ((harq = sched_ctrl->retrans_ul_harq.head) >= 0) { + remove_front_nr_list(&sched_ctrl->retrans_ul_harq); + add_tail_nr_list(&sched_ctrl->available_ul_harq, harq); + } + + for (int i = 0; i < NR_MAX_NB_HARQ_PROCESSES; i++) { + sched_ctrl->ul_harq_processes[i].is_waiting = false; + } +} + void mac_remove_nr_ue(gNB_MAC_INST *nr_mac, rnti_t rnti) { NR_UEs_t *UE_info = &nr_mac->UE_info; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 495ca765e6..fe921a6d2a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -710,10 +710,12 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, return; } else { // The UE identified by C-RNTI still exists at the gNB - // Reset uplink failure flags/counters/timers at MAC and at RRC so gNB will resume again scheduling resources for this UE - UE_C->UE_sched_ctrl.pusch_consecutive_dtx_cnt = 0; - UE_C->UE_sched_ctrl.ul_failure = 0; + // Reset uplink failure flags/counters/timers at RRC nr_mac_gNB_rrc_ul_failure_reset(gnb_mod_idP, frameP, slotP, ra->crnti); + + // Reset HARQ processes + reset_dl_harq_list(&UE_C->UE_sched_ctrl); + reset_ul_harq_list(&UE_C->UE_sched_ctrl); } } LOG_I(NR_MAC, "Scheduling RA-Msg4 for TC_RNTI 0x%04x (state %d, frame %d, slot %d)\n", diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index b6774756c9..7911275f70 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -472,6 +472,10 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, void create_dl_harq_list(NR_UE_sched_ctrl_t *sched_ctrl, const NR_PDSCH_ServingCellConfig_t *pdsch); +void reset_dl_harq_list(NR_UE_sched_ctrl_t *sched_ctrl); + +void reset_ul_harq_list(NR_UE_sched_ctrl_t *sched_ctrl); + void handle_nr_ul_harq(const int CC_idP, module_id_t mod_id, frame_t frame,