From 63327ce31af45799719ea28303377a054e1f0bb6 Mon Sep 17 00:00:00 2001 From: francescomani Date: Tue, 28 Jun 2022 17:39:53 +0200 Subject: [PATCH] compute pmi at the same time as layers --- .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 19 +++++++--------- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 22 +++++++++++-------- .../LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 1 - openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 7 +++--- openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 2 +- 5 files changed, 25 insertions(+), 26 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 451030c590..04e888d5ea 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -397,6 +397,7 @@ bool allocate_dl_retransmission(module_id_t module_id, // we need to verify if it is not decreased // othwise it wouldn't be possible to transmit the same TBS int layers = (curInfo->nrOfLayers < retInfo->nrOfLayers) ? curInfo->nrOfLayers : retInfo->nrOfLayers; + int pm_index = (curInfo->nrOfLayers < retInfo->nrOfLayers) ? curInfo->pm_index : retInfo->pm_index; const int coresetid = sched_ctrl->coreset->controlResourceSetId; const uint16_t bwpSize = coresetid == 0 ? RC.nrmac[module_id]->cset0_bwp_size : dl_bwp->BWPSize; @@ -472,6 +473,7 @@ bool allocate_dl_retransmission(module_id_t module_id, retInfo->rbSize = new_rbSize; retInfo->time_domain_allocation = tda; retInfo->nrOfLayers = layers; + retInfo->pm_index = pm_index; retInfo->dmrs_parms = temp_dmrs; retInfo->tda_info = temp_tda; } @@ -621,6 +623,10 @@ void pf_dl(module_id_t module_id, else sched_pdsch->mcs = get_mcs_from_bler(bo, stats, &sched_ctrl->dl_bler_stats, max_mcs, frame); sched_pdsch->nrOfLayers = get_dl_nrOfLayers(sched_ctrl, current_BWP->dci_format); + sched_pdsch->pm_index = set_pm_index(UE, + sched_ctrl, + sched_pdsch->nrOfLayers, + mac->xp_pdsch_antenna_ports); const uint8_t Qm = nr_get_Qm_dl(sched_pdsch->mcs, current_BWP->mcsTableIdx); const uint16_t R = nr_get_code_rate_dl(sched_pdsch->mcs, current_BWP->mcsTableIdx); uint32_t tbs = nr_compute_tbs(Qm, @@ -1032,17 +1038,8 @@ void nr_schedule_ue_spec(module_id_t module_id, pdsch_pdu->StartSymbolIndex = tda_info->startSymbolIndex; pdsch_pdu->NrOfSymbols = tda_info->nrOfSymbols; // Precoding - if (sched_ctrl->set_pmi) { - const int report_id = sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.csi_report_id; - nr_csi_report_t *csi_report = &UE->csi_report_template[report_id]; - pdsch_pdu->precodingAndBeamforming.prg_size = pdsch_pdu->rbSize; - pdsch_pdu->precodingAndBeamforming.prgs_list[0].pm_idx = set_pm_index(sched_ctrl, - nrOfLayers, - csi_report->N1, - csi_report->N2, - gNB_mac->xp_pdsch_antenna_ports, - csi_report->codebook_mode); - } + pdsch_pdu->precodingAndBeamforming.prg_size = pdsch_pdu->rbSize; + pdsch_pdu->precodingAndBeamforming.prgs_list[0].pm_idx = sched_pdsch->pm_index; // TBS_LBRM according to section 5.4.2.1 of 38.212 // TODO: verify the case where pdsch_servingcellconfig is NULL, in which case // in principle maxMIMO_layers should be given by the maximum number of layers diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 0e5384c1c4..64a1b43e56 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -153,23 +153,27 @@ uint8_t get_dl_nrOfLayers(NR_UE_sched_ctrl_t *sched_ctrl, nr_dci_format_t dci_fo } -uint16_t set_pm_index(NR_UE_sched_ctrl_t *sched_ctrl, +uint16_t set_pm_index(NR_UE_info_t *UE, + NR_UE_sched_ctrl_t *sched_ctrl, int layers, - int N1, int N2, - int xp_pdsch_antenna_ports, - int codebook_mode) { + int xp_pdsch_antenna_ports) { + + if (layers == 1) return 0; + + const int report_id = sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.csi_report_id; + const nr_csi_report_t *csi_report = &UE->csi_report_template[report_id]; + const int N1 = csi_report->N1; + const int N2 = csi_report->N2; + const int antenna_ports = (N1*N2)<<1; - int antenna_ports = (N1*N2)<<1; if (xp_pdsch_antenna_ports == 1 && antenna_ports>1) return 0; //identity matrix (basic 5G configuration handled by PMI report is with XP antennas) - int x1 = sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.pmi_x1; - int x2 = sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.pmi_x2; + const int x1 = sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.pmi_x1; + const int x2 = sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.pmi_x2; LOG_D(NR_MAC,"PMI report: x1 %d x2 %d\n",x1,x2); - sched_ctrl->set_pmi = false; - if (antenna_ports == 2) return x2; else diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 7f4311c10d..136ca52b23 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -707,7 +707,6 @@ uint8_t evaluate_pmi_report(uint8_t *payload, sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.pmi_x1, sched_ctrl->CSI_report.cri_ri_li_pmi_cqi_report.pmi_x2); - sched_ctrl->set_pmi = true; return tot_bitlen; } diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index f2760a3504..b0bd3183fd 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -462,11 +462,10 @@ void set_dl_dmrs_params(NR_pdsch_dmrs_t *dmrs, NR_pdsch_tda_info_t *tda_info, int Layers); -uint16_t set_pm_index(NR_UE_sched_ctrl_t *sched_ctrl, +uint16_t set_pm_index(NR_UE_info_t *UE, + NR_UE_sched_ctrl_t *sched_ctrl, int layers, - int N1, int N2, - int xp_pdsch_antenna_ports, - int codebook_mode); + int xp_pdsch_antenna_ports); uint8_t get_mcs_from_cqi(int mcs_table, int cqi_table, int cqi_idx); diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 32466e9fe0..14f88537a0 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -462,6 +462,7 @@ typedef struct NR_sched_pdsch { /// NR_pdsch_semi_static_t has precedence int time_domain_allocation; + uint16_t pm_index; uint8_t nrOfLayers; NR_pdsch_dmrs_t dmrs_parms; NR_pdsch_tda_info_t tda_info; @@ -629,7 +630,6 @@ typedef struct { int ul_failure; struct CSI_Report CSI_report; bool SR; - bool set_pmi; /// information about every HARQ process NR_UE_harq_t harq_processes[NR_MAX_NB_HARQ_PROCESSES]; /// HARQ processes that are free