From 1d8a5903284c8523bbecdd4eda24507d374c2283 Mon Sep 17 00:00:00 2001 From: vijay chadachan Date: Tue, 7 Jan 2025 11:33:50 +0100 Subject: [PATCH] Refactor nr_UE_is_to_be_scheduled to use new get_first_ul_slot function Co-authored-by: Guido Casati --- .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 6de3b61527..1048982539 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -1522,25 +1522,21 @@ long get_K2(NR_PUSCH_TimeDomainResourceAllocationList_t *tdaList, return 3 + NTN_gNB_Koffset; } -static bool nr_UE_is_to_be_scheduled(const NR_ServingCellConfigCommon_t *scc, int CC_id, NR_UE_info_t* UE, frame_t frame, sub_frame_t slot, uint32_t ulsch_max_frame_inactivity) +static bool nr_UE_is_to_be_scheduled(const frame_structure_t *fs, + NR_UE_info_t *UE, + frame_t frame, + sub_frame_t slot, + uint32_t ulsch_max_frame_inactivity) { - const int n = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; + const int n = fs->numb_slots_frame; const int now = frame * n + slot; const NR_UE_sched_ctrl_t *sched_ctrl =&UE->UE_sched_ctrl; - - const NR_TDD_UL_DL_Pattern_t *tdd = - scc->tdd_UL_DL_ConfigurationCommon ? &scc->tdd_UL_DL_ConfigurationCommon->pattern1 : NULL; - int num_slots_per_period; - int last_ul_slot; - if (tdd) { // Force the default transmission in a full slot as early as possible in the UL portion of TDD period (last_ul_slot) - num_slots_per_period = n / get_nb_periods_per_frame(tdd->dl_UL_TransmissionPeriodicity); - last_ul_slot = 1 + tdd->nrofDownlinkSlots; - } else { - num_slots_per_period = n; - last_ul_slot = sched_ctrl->last_ul_slot; - } - + /** + * Force the default transmission in a full slot as early + * as possible in the UL portion of TDD period (last_ul_slot) */ + int num_slots_per_period = fs->numb_slots_period; + int last_ul_slot = fs->is_tdd ? get_first_ul_slot(fs, false) : sched_ctrl->last_ul_slot; const int last_ul_sched = sched_ctrl->last_ul_frame * n + last_ul_slot; const int diff = (now - last_ul_sched + 1024 * n) % (1024 * n); /* UE is to be scheduled if @@ -1896,7 +1892,11 @@ static void pf_ul(module_id_t module_id, 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_frame, sched_slot, nrmac->ulsch_max_frame_inactivity); + const bool do_sched = nr_UE_is_to_be_scheduled(&nrmac->frame_structure, + UE, + sched_frame, + sched_slot, + nrmac->ulsch_max_frame_inactivity); LOG_D(NR_MAC,"pf_ul: do_sched UE %04x => %s\n", UE->rnti, do_sched ? "yes" : "no"); if ((B == 0 && !do_sched) || nr_timer_is_active(&sched_ctrl->transm_interrupt)) {