diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 7b9ad1ed3b..03ec701880 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -2208,6 +2208,67 @@ 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, bool dci_00_10) +{ + int nrofHARQ = get_nrofHARQ_ProcessesForPDSCH(sc_info); + // limit the number of HARQ PIDs to 16 in case of common search space + if (dci_00_10 && nrofHARQ > 16) + nrofHARQ = 16; + // 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, bool dci_00_10) +{ + int nrofHARQ = get_nrofHARQ_ProcessesForPUSCH(sc_info); + // limit the number of HARQ PIDs to 16 in case of common search space + if (dci_00_10 && nrofHARQ > 16) + nrofHARQ = 16; + 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, @@ -2397,8 +2458,6 @@ void configure_UE_BWP(gNB_MAC_INST *nr_mac, sc_info->nrofHARQ_ProcessesForPUSCH_r17 = pusch_servingcellconfig->ext3->nrofHARQ_ProcessesForPUSCH_r17; } } - create_dl_harq_list(sched_ctrl, sc_info); - create_ul_harq_list(sched_ctrl, sc_info); } if (CellGroup && CellGroup->physicalCellGroupConfig) @@ -2461,6 +2520,10 @@ void configure_UE_BWP(gNB_MAC_INST *nr_mac, DL_BWP->dci_format = NR_DL_DCI_FORMAT_1_0; } + bool format_00_10 = DL_BWP->dci_format == NR_DL_DCI_FORMAT_1_0; // if DL is 10 UL is surely 00 + create_dl_harq_list(sched_ctrl, sc_info, format_00_10); + create_ul_harq_list(sched_ctrl, sc_info, format_00_10); + set_max_fb_time(UL_BWP, DL_BWP); set_sched_pucch_list(sched_ctrl, UL_BWP, scc, &nr_mac->frame_structure); @@ -2522,11 +2585,6 @@ NR_UE_info_t *get_new_nr_ue_inst(uid_allocator_t *uia, rnti_t rnti, NR_CellGroup /* Set default BWPs */ AssertFatal(UE->sc_info.n_ul_bwp <= NR_MAX_NUM_BWP, "uplinkBWP_ToAddModList has %d BWP!\n", UE->sc_info.n_ul_bwp); - /* get Number of HARQ processes for this UE */ - // pdsch_servingcellconfig == NULL in SA -> will create default (8) number of HARQ processes - create_dl_harq_list(sched_ctrl, &UE->sc_info); - create_ul_harq_list(sched_ctrl, &UE->sc_info); - // initialize LCID structure seq_arr_init(&sched_ctrl->lc_config, sizeof(nr_lc_config_t)); return UE; @@ -2615,61 +2673,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);