Refactor nr_UE_is_to_be_scheduled to use new get_first_ul_slot function

Co-authored-by: Guido Casati <guido.casati@firecell.io>
This commit is contained in:
vijay chadachan
2025-01-28 10:07:31 +01:00
committed by Guido Casati
co-authored by Guido Casati
parent 00f1d52f92
commit 1d8a590328
@@ -1522,25 +1522,21 @@ long get_K2(NR_PUSCH_TimeDomainResourceAllocationList_t *tdaList,
return 3 + NTN_gNB_Koffset; 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 int now = frame * n + slot;
const NR_UE_sched_ctrl_t *sched_ctrl =&UE->UE_sched_ctrl; const NR_UE_sched_ctrl_t *sched_ctrl =&UE->UE_sched_ctrl;
/**
const NR_TDD_UL_DL_Pattern_t *tdd = * Force the default transmission in a full slot as early
scc->tdd_UL_DL_ConfigurationCommon ? &scc->tdd_UL_DL_ConfigurationCommon->pattern1 : NULL; * as possible in the UL portion of TDD period (last_ul_slot) */
int num_slots_per_period; int num_slots_per_period = fs->numb_slots_period;
int last_ul_slot; int last_ul_slot = fs->is_tdd ? get_first_ul_slot(fs, false) : sched_ctrl->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;
}
const int last_ul_sched = sched_ctrl->last_ul_frame * n + 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); const int diff = (now - last_ul_sched + 1024 * n) % (1024 * n);
/* UE is to be scheduled if /* 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); const int B = max(0, sched_ctrl->estimated_ul_buffer - sched_ctrl->sched_ul_bytes);
/* preprocessor computed sched_frame/sched_slot */ /* 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"); 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)) { if ((B == 0 && !do_sched) || nr_timer_is_active(&sched_ctrl->transm_interrupt)) {