From dbfcc1a7ef1f4f1b5b510add25710e8c8130dba6 Mon Sep 17 00:00:00 2001 From: vijay chadachan Date: Mon, 4 Nov 2024 18:58:01 +0100 Subject: [PATCH] Refactor set_sched_pucch_list to use frame_structure in MAC Co-authored-by: Guido Casati --- .../LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index ad8823d735..9af4462fde 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -2165,18 +2165,18 @@ int get_ulbw_tbslbrm(int scc_bwpsize, const NR_ServingCellConfig_t *servingCellC static void set_sched_pucch_list(NR_UE_sched_ctrl_t *sched_ctrl, const NR_UE_UL_BWP_t *ul_bwp, - const NR_ServingCellConfigCommon_t *scc) + const NR_ServingCellConfigCommon_t *scc, + const frame_structure_t *fs) { const int NTN_gNB_Koffset = get_NTN_Koffset(scc); - const NR_TDD_UL_DL_Pattern_t *tdd = scc->tdd_UL_DL_ConfigurationCommon ? &scc->tdd_UL_DL_ConfigurationCommon->pattern1 : NULL; - const int n_slots_frame = nr_slots_per_frame[ul_bwp->scs]; - const int nr_slots_period = tdd ? n_slots_frame / get_nb_periods_per_frame(tdd->dl_UL_TransmissionPeriodicity) : n_slots_frame; - const int n_ul_slots_period = tdd ? tdd->nrofUplinkSlots + (tdd->nrofUplinkSymbols > 0 ? 1 : 0) : n_slots_frame; + const int n_ul_slots_period = get_ul_slots_per_period(fs); + // PUCCH list size is given by the number of UL slots in the PUCCH period // the length PUCCH period is determined by max_fb_time since we may need to prepare PUCCH for ACK/NACK max_fb_time slots ahead - const int list_size = n_ul_slots_period << (int)ceil(log2((ul_bwp->max_fb_time + NTN_gNB_Koffset) / nr_slots_period + 1)); + const int list_size = n_ul_slots_period << (int)ceil(log2((ul_bwp->max_fb_time + NTN_gNB_Koffset) / fs->numb_slots_period + 1)); + if (!sched_ctrl->sched_pucch) { - sched_ctrl->sched_pucch = calloc(list_size, sizeof(*sched_ctrl->sched_pucch)); + sched_ctrl->sched_pucch = calloc_or_fail(list_size, sizeof(*sched_ctrl->sched_pucch)); sched_ctrl->sched_pucch_size = list_size; } else if (list_size > sched_ctrl->sched_pucch_size) { sched_ctrl->sched_pucch = realloc(sched_ctrl->sched_pucch, list_size * sizeof(*sched_ctrl->sched_pucch)); @@ -2433,7 +2433,7 @@ void configure_UE_BWP(gNB_MAC_INST *nr_mac, NR_UL_DCI_FORMAT_0_0; set_max_fb_time(UL_BWP, DL_BWP); - set_sched_pucch_list(sched_ctrl, UL_BWP, scc); + set_sched_pucch_list(sched_ctrl, UL_BWP, scc, &nr_mac->frame_structure); } if(ra) {