diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 987e6778bf..4a723263dc 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -932,24 +932,17 @@ static void nr_generate_Msg3_retransmission(module_id_t module_idP, } // Fill PDCCH DL DCI PDU - nfapi_nr_dl_dci_pdu_t *dci_pdu = &pdcch_pdu_rel15->dci_pdu[pdcch_pdu_rel15->numDlDci]; + nfapi_nr_dl_dci_pdu_t *dci_pdu = prepare_dci_pdu(pdcch_pdu_rel15, + scc, + ss, + coreset, + aggregation_level, + CCEIndex, + UE->UE_beam_index, + UE->rnti); pdcch_pdu_rel15->numDlDci++; - dci_pdu->RNTI = UE->rnti; - dci_pdu->ScramblingId = *scc->physCellId; - dci_pdu->ScramblingRNTI = 0; - dci_pdu->AggregationLevel = aggregation_level; - dci_pdu->CceIndex = CCEIndex; - dci_pdu->beta_PDCCH_1_0 = 0; - dci_pdu->powerControlOffsetSS = 1; - - dci_pdu->precodingAndBeamforming.num_prgs = 0; - dci_pdu->precodingAndBeamforming.prg_size = 0; - dci_pdu->precodingAndBeamforming.dig_bf_interfaces = 1; - dci_pdu->precodingAndBeamforming.prgs_list[0].pm_idx = 0; - dci_pdu->precodingAndBeamforming.prgs_list[0].dig_bf_interface_list[0].beam_idx = UE->UE_beam_index; - - dci_pdu_rel15_t uldci_payload={0}; + dci_pdu_rel15_t uldci_payload = {0}; config_uldci(sc_info, pusch_pdu, &uldci_payload, @@ -1356,21 +1349,15 @@ static void prepare_dl_pdus(gNB_MAC_INST *nr_mac, pduindex); /* Fill PDCCH DL DCI PDU */ - nfapi_nr_dl_dci_pdu_t *dci_pdu = &pdcch_pdu_rel15->dci_pdu[pdcch_pdu_rel15->numDlDci]; + nfapi_nr_dl_dci_pdu_t *dci_pdu = prepare_dci_pdu(pdcch_pdu_rel15, + scc, + sched_ctrl->search_space, + coreset, + aggregation_level, + CCEIndex, + UE->UE_beam_index, + rnti); pdcch_pdu_rel15->numDlDci++; - dci_pdu->RNTI = rnti; - dci_pdu->ScramblingId = *scc->physCellId; - dci_pdu->ScramblingRNTI = 0; - dci_pdu->AggregationLevel = aggregation_level; - dci_pdu->CceIndex = CCEIndex; - dci_pdu->beta_PDCCH_1_0 = 0; - dci_pdu->powerControlOffsetSS = 1; - - dci_pdu->precodingAndBeamforming.num_prgs = 0; - dci_pdu->precodingAndBeamforming.prg_size = 0; - dci_pdu->precodingAndBeamforming.dig_bf_interfaces = 1; - dci_pdu->precodingAndBeamforming.prgs_list[0].pm_idx = 0; - dci_pdu->precodingAndBeamforming.prgs_list[0].dig_bf_interface_list[0].beam_idx = UE->UE_beam_index; dci_pdu_rel15_t dci_payload = prepare_dci_dl_payload(nr_mac, UE, @@ -1399,7 +1386,7 @@ static void prepare_dl_pdus(gNB_MAC_INST *nr_mac, LOG_D(NR_MAC, "DCI params: rnti 0x%x, rnti_type %d, dci_format %d coreset params: FreqDomainResource %llx, start_symbol %d " "n_symb %d, BWPsize %d\n", - pdcch_pdu_rel15->dci_pdu[0].RNTI, + dci_pdu->RNTI, rnti_type, NR_DL_DCI_FORMAT_1_0, (unsigned long long)pdcch_pdu_rel15->FreqDomainResource, @@ -1410,7 +1397,7 @@ static void prepare_dl_pdus(gNB_MAC_INST *nr_mac, fill_dci_pdu_rel15(&UE->sc_info, dl_bwp, &UE->current_UL_BWP, - &pdcch_pdu_rel15->dci_pdu[pdcch_pdu_rel15->numDlDci - 1], + dci_pdu, &dci_payload, NR_DL_DCI_FORMAT_1_0, rnti_type, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index 2d7f1e9ef5..76e9db4fb3 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -453,21 +453,15 @@ static void nr_fill_nfapi_dl_SIB_pdu(gNB_MAC_INST *gNB_mac, pdsch_pdu_rel15->dlDmrsSymbPos); /* Fill PDCCH DL DCI PDU */ - nfapi_nr_dl_dci_pdu_t *dci_pdu = &pdcch_pdu_rel15->dci_pdu[pdcch_pdu_rel15->numDlDci]; + nfapi_nr_dl_dci_pdu_t *dci_pdu = prepare_dci_pdu(pdcch_pdu_rel15, + scc, + search_space, + coreset, + aggregation_level, + cce_index, + beam_index, + SI_RNTI); pdcch_pdu_rel15->numDlDci++; - dci_pdu->RNTI = SI_RNTI; - dci_pdu->ScramblingId = *scc->physCellId; - dci_pdu->ScramblingRNTI = 0; - dci_pdu->AggregationLevel = aggregation_level; - dci_pdu->CceIndex = cce_index; - dci_pdu->beta_PDCCH_1_0 = 0; - dci_pdu->powerControlOffsetSS = 1; - - dci_pdu->precodingAndBeamforming.num_prgs = 0; - dci_pdu->precodingAndBeamforming.prg_size = 0; - dci_pdu->precodingAndBeamforming.dig_bf_interfaces = 1; - dci_pdu->precodingAndBeamforming.prgs_list[0].pm_idx = 0; - dci_pdu->precodingAndBeamforming.prgs_list[0].dig_bf_interface_list[0].beam_idx = beam_index; /* DCI payload */ int dci_format = NR_DL_DCI_FORMAT_1_0; @@ -486,7 +480,7 @@ static void nr_fill_nfapi_dl_SIB_pdu(gNB_MAC_INST *gNB_mac, fill_dci_pdu_rel15(NULL, NULL, NULL, - &pdcch_pdu_rel15->dci_pdu[pdcch_pdu_rel15->numDlDci - 1], + dci_pdu, &dci_payload, dci_format, rnti_type, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 59164014a3..0ea552e64d 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -1162,31 +1162,15 @@ void nr_schedule_ue_spec(module_id_t module_id, LOG_D(NR_MAC,"Configuring DCI/PDCCH in %d.%d at CCE %d, rnti %x\n", frame,slot,sched_ctrl->cce_index,rnti); /* Fill PDCCH DL DCI PDU */ - nfapi_nr_dl_dci_pdu_t *dci_pdu = &pdcch_pdu->dci_pdu[pdcch_pdu->numDlDci]; + nfapi_nr_dl_dci_pdu_t *dci_pdu = prepare_dci_pdu(pdcch_pdu, + scc, + sched_ctrl->search_space, + sched_ctrl->coreset, + sched_ctrl->aggregation_level, + sched_ctrl->cce_index, + UE->UE_beam_index, + rnti); pdcch_pdu->numDlDci++; - dci_pdu->RNTI = rnti; - - if (sched_ctrl->coreset && - sched_ctrl->search_space && - sched_ctrl->coreset->pdcch_DMRS_ScramblingID && - sched_ctrl->search_space->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_ue_Specific) { - dci_pdu->ScramblingId = *sched_ctrl->coreset->pdcch_DMRS_ScramblingID; - dci_pdu->ScramblingRNTI = rnti; - } else { - dci_pdu->ScramblingId = *scc->physCellId; - dci_pdu->ScramblingRNTI = 0; - } - - dci_pdu->AggregationLevel = sched_ctrl->aggregation_level; - dci_pdu->CceIndex = sched_ctrl->cce_index; - dci_pdu->beta_PDCCH_1_0 = 0; - dci_pdu->powerControlOffsetSS = 1; - - dci_pdu->precodingAndBeamforming.num_prgs = 0; - dci_pdu->precodingAndBeamforming.prg_size = 0; - dci_pdu->precodingAndBeamforming.dig_bf_interfaces = 0; - dci_pdu->precodingAndBeamforming.prgs_list[0].pm_idx = 0; - dci_pdu->precodingAndBeamforming.prgs_list[0].dig_bf_interface_list[0].beam_idx = UE->UE_beam_index; /* DCI payload */ const int rnti_type = TYPE_C_RNTI_; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 7b64cd93db..b894587854 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -809,6 +809,37 @@ int get_mcs_from_bler(const NR_bler_options_t *bler_options, return new_mcs; } +nfapi_nr_dl_dci_pdu_t *prepare_dci_pdu(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu, + const NR_ServingCellConfigCommon_t *scc, + const NR_SearchSpace_t *ss, + const NR_ControlResourceSet_t *coreset, + int aggregation_level, + int cce_index, + int beam_index, + int rnti) +{ + nfapi_nr_dl_dci_pdu_t *dci_pdu = &pdcch_pdu->dci_pdu[pdcch_pdu->numDlDci]; + dci_pdu->RNTI = rnti; + dci_pdu->AggregationLevel = aggregation_level; + dci_pdu->CceIndex = cce_index; + if (coreset->pdcch_DMRS_ScramblingID && + ss->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_ue_Specific) { + dci_pdu->ScramblingId = *coreset->pdcch_DMRS_ScramblingID; + dci_pdu->ScramblingRNTI = rnti; + } else { + dci_pdu->ScramblingId = *scc->physCellId; + dci_pdu->ScramblingRNTI = 0; + } + dci_pdu->beta_PDCCH_1_0 = 0; + dci_pdu->powerControlOffsetSS = 1; + dci_pdu->precodingAndBeamforming.num_prgs = 0; + dci_pdu->precodingAndBeamforming.prg_size = 0; + dci_pdu->precodingAndBeamforming.dig_bf_interfaces = 1; + dci_pdu->precodingAndBeamforming.prgs_list[0].pm_idx = 0; + dci_pdu->precodingAndBeamforming.prgs_list[0].dig_bf_interface_list[0].beam_idx = beam_index; + return dci_pdu; +} + dci_pdu_rel15_t prepare_dci_dl_payload(const gNB_MAC_INST *gNB_mac, const NR_UE_info_t *UE, nr_rnti_type_t rnti_type, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index f00aa988ee..2896de953c 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -2629,26 +2629,15 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, slot_t slot, nfapi_ LOG_D(NR_MAC,"Configuring ULDCI/PDCCH in %d.%d at CCE %d, rnti %04x\n", frame,slot,sched_ctrl->cce_index,rnti); /* Fill PDCCH DL DCI PDU */ - nfapi_nr_dl_dci_pdu_t *dci_pdu = &pdcch_pdu->dci_pdu[pdcch_pdu->numDlDci]; + nfapi_nr_dl_dci_pdu_t *dci_pdu = prepare_dci_pdu(pdcch_pdu, + scc, + ss, + coreset, + sched_ctrl->aggregation_level, + sched_ctrl->cce_index, + UE->UE_beam_index, + rnti); pdcch_pdu->numDlDci++; - dci_pdu->RNTI = rnti; - if (coreset->pdcch_DMRS_ScramblingID && - ss->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_ue_Specific) { - dci_pdu->ScramblingId = *coreset->pdcch_DMRS_ScramblingID; - dci_pdu->ScramblingRNTI = rnti; - } else { - dci_pdu->ScramblingId = *scc->physCellId; - dci_pdu->ScramblingRNTI = 0; - } - dci_pdu->AggregationLevel = sched_ctrl->aggregation_level; - dci_pdu->CceIndex = sched_ctrl->cce_index; - dci_pdu->beta_PDCCH_1_0 = 0; - dci_pdu->powerControlOffsetSS = 1; - dci_pdu->precodingAndBeamforming.num_prgs = 0; - dci_pdu->precodingAndBeamforming.prg_size = 0; - dci_pdu->precodingAndBeamforming.dig_bf_interfaces = 1; - dci_pdu->precodingAndBeamforming.prgs_list[0].pm_idx = 0; - dci_pdu->precodingAndBeamforming.prgs_list[0].dig_bf_interface_list[0].beam_idx = UE->UE_beam_index; dci_pdu_rel15_t uldci_payload; memset(&uldci_payload, 0, sizeof(uldci_payload)); diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index bebf7e4ece..a817378534 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -180,6 +180,15 @@ dci_pdu_rel15_t prepare_dci_dl_payload(const gNB_MAC_INST *gNB_mac, int harq_pid, int tb_scaling, bool is_sib1); +nfapi_nr_dl_dci_pdu_t *prepare_dci_pdu(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu, + const NR_ServingCellConfigCommon_t *scc, + const NR_SearchSpace_t *ss, + const NR_ControlResourceSet_t *coreset, + int aggregation_level, + int cce_index, + int beam_index, + int rnti); + void nr_schedule_pucch(gNB_MAC_INST *nrmac, frame_t frameP, slot_t slotP); void nr_srs_ri_computation(const nfapi_nr_srs_normalized_channel_iq_matrix_t *nr_srs_normalized_channel_iq_matrix,