diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 6aee81fa67237e4c6cb24e3c699fb630a034e13e..a35c80b95a6f0016f32b739b3a46a7ceb2521ff3 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 43e88eb9a943ae22f21c56cb29e52680f4c2ccf1..1ca9fa067e10454247cdeaa2a0eee672a335ee23 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);