From 6bf0f98e7fb0c3217fb06b761e3896d8a6716e9e Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@openairinterface.org> Date: Thu, 18 Aug 2022 19:59:50 +0200 Subject: [PATCH] Skip scheduling of UEs if there are no free HARQs --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 8 ++++++++ openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 6aee81fa672..a35c80b95a6 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -613,6 +613,14 @@ void pf_dl(module_id_t module_id, return; } else { + /* skip this UE if there are no free HARQ processes. This can happen e.g. + * if the UE disconnected in L2sim, in which case the gNB is not notified + * (this can be considered a design flaw) */ + if (sched_ctrl->available_dl_harq.head < 0) { + LOG_D(NR_MAC, "RNTI %04x has no free DL HARQ process, skipping\n", UE->rnti); + continue; + } + /* Check DL buffer and skip this UE if no bytes and no TA necessary */ if (sched_ctrl->num_total_bytes == 0 && frame != (sched_ctrl->ta_frame + 10) % 1024) continue; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 43e88eb9a94..1ca9fa067e1 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -1085,6 +1085,15 @@ void pf_ul(module_id_t module_id, continue; } + + /* skip this UE if there are no free HARQ processes. This can happen e.g. + * if the UE disconnected in L2sim, in which case the gNB is not notified + * (this can be considered a design flaw) */ + if (sched_ctrl->available_ul_harq.head < 0) { + LOG_D(NR_MAC, "RNTI %04x has no free UL HARQ process, skipping\n", UE->rnti); + continue; + } + const int B = max(0, sched_ctrl->estimated_ul_buffer - sched_ctrl->sched_ul_bytes); /* preprocessor computed sched_frame/sched_slot */ const bool do_sched = nr_UE_is_to_be_scheduled(scc, 0, UE, sched_pusch->frame, sched_pusch->slot, nrmac->ulsch_max_frame_inactivity); -- GitLab