diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index ec243fcd86..ad8823d735 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -2163,6 +2163,31 @@ int get_ulbw_tbslbrm(int scc_bwpsize, const NR_ServingCellConfig_t *servingCellC return bw; } +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 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; + // 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)); + if (!sched_ctrl->sched_pucch) { + sched_ctrl->sched_pucch = calloc(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)); + for (int i = sched_ctrl->sched_pucch_size; i < list_size; i++) { + NR_sched_pucch_t *curr_pucch = &sched_ctrl->sched_pucch[i]; + memset(curr_pucch, 0, sizeof(*curr_pucch)); + } + sched_ctrl->sched_pucch_size = list_size; + } +} + // main function to configure parameters of current BWP void configure_UE_BWP(gNB_MAC_INST *nr_mac, NR_ServingCellConfigCommon_t *scc, @@ -2540,32 +2565,6 @@ NR_UE_info_t *add_new_nr_ue(gNB_MAC_INST *nr_mac, rnti_t rntiP, NR_CellGroupConf return (UE); } -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 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; - // 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)); - if(!sched_ctrl->sched_pucch) { - sched_ctrl->sched_pucch = calloc(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)); - for(int i=sched_ctrl->sched_pucch_size; isched_pucch[i]; - memset(curr_pucch, 0, sizeof(*curr_pucch)); - } - sched_ctrl->sched_pucch_size = list_size; - } -} - void free_sched_pucch_list(NR_UE_sched_ctrl_t *sched_ctrl) { free(sched_ctrl->sched_pucch); diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 5602cc2f80..c2463201d1 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -412,9 +412,6 @@ uint8_t get_mcs_from_cqi(int mcs_table, int cqi_table, int cqi_idx); uint8_t get_dl_nrOfLayers(const NR_UE_sched_ctrl_t *sched_ctrl, const nr_dci_format_t dci_format); -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); void free_sched_pucch_list(NR_UE_sched_ctrl_t *sched_ctrl); int get_dl_tda(const gNB_MAC_INST *nrmac, int slot);