diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 7b9ad1ed3b..8d7e1674f9 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -2208,6 +2208,61 @@ static void set_sched_pucch_list(NR_UE_sched_ctrl_t *sched_ctrl, } } +static void create_dl_harq_list(NR_UE_sched_ctrl_t *sched_ctrl, const NR_UE_ServingCell_Info_t *sc_info) +{ + const int nrofHARQ = get_nrofHARQ_ProcessesForPDSCH(sc_info); + // add all available DL HARQ processes for this UE + AssertFatal(sched_ctrl->available_dl_harq.len == sched_ctrl->feedback_dl_harq.len + && sched_ctrl->available_dl_harq.len == sched_ctrl->retrans_dl_harq.len, + "HARQ lists have different lengths (%d/%d/%d)\n", + sched_ctrl->available_dl_harq.len, + sched_ctrl->feedback_dl_harq.len, + sched_ctrl->retrans_dl_harq.len); + if (sched_ctrl->available_dl_harq.len == 0) { + create_nr_list(&sched_ctrl->available_dl_harq, nrofHARQ); + for (int harq = 0; harq < nrofHARQ; harq++) + add_tail_nr_list(&sched_ctrl->available_dl_harq, harq); + create_nr_list(&sched_ctrl->feedback_dl_harq, nrofHARQ); + create_nr_list(&sched_ctrl->retrans_dl_harq, nrofHARQ); + } else if (sched_ctrl->available_dl_harq.len == nrofHARQ) { + LOG_D(NR_MAC, "nrofHARQ %d already configured\n", nrofHARQ); + } else { + const int old_nrofHARQ = sched_ctrl->available_dl_harq.len; + AssertFatal(nrofHARQ > old_nrofHARQ, + "cannot resize HARQ list to be smaller (nrofHARQ %d, old_nrofHARQ %d)\n", + nrofHARQ, old_nrofHARQ); + resize_nr_list(&sched_ctrl->available_dl_harq, nrofHARQ); + for (int harq = old_nrofHARQ; harq < nrofHARQ; harq++) + add_tail_nr_list(&sched_ctrl->available_dl_harq, harq); + resize_nr_list(&sched_ctrl->feedback_dl_harq, nrofHARQ); + resize_nr_list(&sched_ctrl->retrans_dl_harq, nrofHARQ); + } +} + +static void create_ul_harq_list(NR_UE_sched_ctrl_t *sched_ctrl, const NR_UE_ServingCell_Info_t *sc_info) +{ + int nrofHARQ = get_nrofHARQ_ProcessesForPUSCH(sc_info); + if (sched_ctrl->available_ul_harq.len == 0) { + create_nr_list(&sched_ctrl->available_ul_harq, nrofHARQ); + for (int harq = 0; harq < nrofHARQ; harq++) + add_tail_nr_list(&sched_ctrl->available_ul_harq, harq); + create_nr_list(&sched_ctrl->feedback_ul_harq, nrofHARQ); + create_nr_list(&sched_ctrl->retrans_ul_harq, nrofHARQ); + } else if (sched_ctrl->available_ul_harq.len == nrofHARQ) { + LOG_D(NR_MAC, "nrofHARQ %d already configured\n", nrofHARQ); + } else { + const int old_nrofHARQ = sched_ctrl->available_ul_harq.len; + AssertFatal(nrofHARQ > old_nrofHARQ, + "cannot resize HARQ list to be smaller (nrofHARQ %d, old_nrofHARQ %d)\n", + nrofHARQ, old_nrofHARQ); + resize_nr_list(&sched_ctrl->available_ul_harq, nrofHARQ); + for (int harq = old_nrofHARQ; harq < nrofHARQ; harq++) + add_tail_nr_list(&sched_ctrl->available_ul_harq, harq); + resize_nr_list(&sched_ctrl->feedback_ul_harq, nrofHARQ); + resize_nr_list(&sched_ctrl->retrans_ul_harq, nrofHARQ); + } +} + // main function to configure parameters of current BWP void configure_UE_BWP(gNB_MAC_INST *nr_mac, NR_ServingCellConfigCommon_t *scc, @@ -2615,61 +2670,6 @@ void free_sched_pucch_list(NR_UE_sched_ctrl_t *sched_ctrl) free(sched_ctrl->sched_pucch); } -void create_dl_harq_list(NR_UE_sched_ctrl_t *sched_ctrl, const NR_UE_ServingCell_Info_t *sc_info) -{ - const int nrofHARQ = get_nrofHARQ_ProcessesForPDSCH(sc_info); - // add all available DL HARQ processes for this UE - AssertFatal(sched_ctrl->available_dl_harq.len == sched_ctrl->feedback_dl_harq.len - && sched_ctrl->available_dl_harq.len == sched_ctrl->retrans_dl_harq.len, - "HARQ lists have different lengths (%d/%d/%d)\n", - sched_ctrl->available_dl_harq.len, - sched_ctrl->feedback_dl_harq.len, - sched_ctrl->retrans_dl_harq.len); - if (sched_ctrl->available_dl_harq.len == 0) { - create_nr_list(&sched_ctrl->available_dl_harq, nrofHARQ); - for (int harq = 0; harq < nrofHARQ; harq++) - add_tail_nr_list(&sched_ctrl->available_dl_harq, harq); - create_nr_list(&sched_ctrl->feedback_dl_harq, nrofHARQ); - create_nr_list(&sched_ctrl->retrans_dl_harq, nrofHARQ); - } else if (sched_ctrl->available_dl_harq.len == nrofHARQ) { - LOG_D(NR_MAC, "nrofHARQ %d already configured\n", nrofHARQ); - } else { - const int old_nrofHARQ = sched_ctrl->available_dl_harq.len; - AssertFatal(nrofHARQ > old_nrofHARQ, - "cannot resize HARQ list to be smaller (nrofHARQ %d, old_nrofHARQ %d)\n", - nrofHARQ, old_nrofHARQ); - resize_nr_list(&sched_ctrl->available_dl_harq, nrofHARQ); - for (int harq = old_nrofHARQ; harq < nrofHARQ; harq++) - add_tail_nr_list(&sched_ctrl->available_dl_harq, harq); - resize_nr_list(&sched_ctrl->feedback_dl_harq, nrofHARQ); - resize_nr_list(&sched_ctrl->retrans_dl_harq, nrofHARQ); - } -} - -void create_ul_harq_list(NR_UE_sched_ctrl_t *sched_ctrl, const NR_UE_ServingCell_Info_t *sc_info) -{ - int nrofHARQ = get_nrofHARQ_ProcessesForPUSCH(sc_info); - if (sched_ctrl->available_ul_harq.len == 0) { - create_nr_list(&sched_ctrl->available_ul_harq, nrofHARQ); - for (int harq = 0; harq < nrofHARQ; harq++) - add_tail_nr_list(&sched_ctrl->available_ul_harq, harq); - create_nr_list(&sched_ctrl->feedback_ul_harq, nrofHARQ); - create_nr_list(&sched_ctrl->retrans_ul_harq, nrofHARQ); - } else if (sched_ctrl->available_ul_harq.len == nrofHARQ) { - LOG_D(NR_MAC, "nrofHARQ %d already configured\n", nrofHARQ); - } else { - const int old_nrofHARQ = sched_ctrl->available_ul_harq.len; - AssertFatal(nrofHARQ > old_nrofHARQ, - "cannot resize HARQ list to be smaller (nrofHARQ %d, old_nrofHARQ %d)\n", - nrofHARQ, old_nrofHARQ); - resize_nr_list(&sched_ctrl->available_ul_harq, nrofHARQ); - for (int harq = old_nrofHARQ; harq < nrofHARQ; harq++) - add_tail_nr_list(&sched_ctrl->available_ul_harq, harq); - resize_nr_list(&sched_ctrl->feedback_ul_harq, nrofHARQ); - resize_nr_list(&sched_ctrl->retrans_ul_harq, nrofHARQ); - } -} - void reset_dl_harq_list(NR_UE_sched_ctrl_t *sched_ctrl) { int harq; while ((harq = sched_ctrl->feedback_dl_harq.head) >= 0) { diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 3ac09ce98a..c78c061820 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -348,10 +348,6 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, const uint8_t ul_cqi, const uint16_t rssi); -void create_dl_harq_list(NR_UE_sched_ctrl_t *sched_ctrl, const NR_UE_ServingCell_Info_t *sc_info); - -void create_ul_harq_list(NR_UE_sched_ctrl_t *sched_ctrl, const NR_UE_ServingCell_Info_t *sc_info); - void reset_dl_harq_list(NR_UE_sched_ctrl_t *sched_ctrl); void reset_ul_harq_list(NR_UE_sched_ctrl_t *sched_ctrl);