From 4856c17770e51837300303dc076571eb9cb64ee0 Mon Sep 17 00:00:00 2001 From: francescomani Date: Thu, 18 Aug 2022 08:50:40 +0200 Subject: [PATCH 1/7] harmonization of RSRP meas config --- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 1 + openair2/RRC/NR/MESSAGES/asn1_msg.c | 67 +----------- openair2/RRC/NR/nr_rrc_config.c | 109 ++++++++++++++++++- openair2/RRC/NR/nr_rrc_config.h | 6 + openair2/RRC/NR/rrc_gNB_reconfig.c | 67 +----------- 5 files changed, 127 insertions(+), 123 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index f5d694d98f..34126c852a 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -2530,6 +2530,7 @@ uint8_t nr_get_csi_measurements(NR_UE_MAC_INST_t *mac, const int n_slots_frame = nr_slots_per_frame[scs]; if (((n_slots_frame*frame + slot - offset)%period) == 0 && pucch_Config) { + LOG_D(NR_MAC, "Preparing CSI report in frame %d slot %d CSI report ID %d\n", frame, slot, csi_report_id); NR_PUCCH_CSI_Resource_t *pucchcsires = csirep->reportConfigType.choice.periodic->pucch_CSI_ResourceList.list.array[0]; NR_PUCCH_ResourceSet_t *pucchresset = pucch_Config->resourceSetToAddModList->list.array[1]; // set with formats >1 int n = pucchresset->resourceList.list.count; diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 2729a78b33..9b15967486 100755 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -1070,68 +1070,13 @@ void fill_initial_SpCellConfig(int uid, csirep1->ext1 = NULL; ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ReportConfigToAddModList->list,csirep1); } - - LOG_D(NR_RRC,"Filling CSI Report Config for CRI_RSRP\n"); - NR_CSI_ReportConfig_t *csirep2 = calloc(1,sizeof(*csirep2)); - csirep2->reportConfigId=bwp_id+10; - csirep2->carrier=NULL; - csirep2->resourcesForChannelMeasurement=bwp_id; - csirep2->csi_IM_ResourcesForInterference=NULL; - csirep2->nzp_CSI_RS_ResourcesForInterference=NULL; - csirep2->reportConfigType.present = NR_CSI_ReportConfig__reportConfigType_PR_periodic; - csirep2->reportConfigType.choice.periodic = calloc(1,sizeof(*csirep2->reportConfigType.choice.periodic)); - csirep2->reportConfigType.choice.periodic->reportSlotConfig.present=NR_CSI_ReportPeriodicityAndOffset_PR_slots320; - csirep2->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320 = (37 + (20 * uid)) % 320; - ASN_SEQUENCE_ADD(&csirep2->reportConfigType.choice.periodic->pucch_CSI_ResourceList.list,pucchcsires1); - csirep2->reportQuantity.present = NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP; - csirep2->reportQuantity.choice.cri_RSRP=(NULL_t)0; - csirep2->reportFreqConfiguration = calloc(1,sizeof(*csirep2->reportFreqConfiguration)); - csirep2->reportFreqConfiguration->cqi_FormatIndicator = NULL; - csirep2->reportFreqConfiguration->pmi_FormatIndicator=NULL; - csirep2->reportFreqConfiguration->csi_ReportingBand=NULL; - csirep2->timeRestrictionForChannelMeasurements= NR_CSI_ReportConfig__timeRestrictionForChannelMeasurements_configured; - csirep2->timeRestrictionForInterferenceMeasurements=NR_CSI_ReportConfig__timeRestrictionForInterferenceMeasurements_configured; - csirep2->codebookConfig=NULL; - csirep2->dummy = NULL; - csirep2->groupBasedBeamReporting.present = NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled; - csirep2->groupBasedBeamReporting.choice.disabled=calloc(1,sizeof(*csirep2->groupBasedBeamReporting.choice.disabled)); - csirep2->groupBasedBeamReporting.choice.disabled->nrofReportedRS=calloc(1,sizeof(*csirep2->groupBasedBeamReporting.choice.disabled->nrofReportedRS)); - *csirep2->groupBasedBeamReporting.choice.disabled->nrofReportedRS=NR_CSI_ReportConfig__groupBasedBeamReporting__disabled__nrofReportedRS_n1; - csirep2->cqi_Table = NULL; - csirep2->subbandSize = NR_CSI_ReportConfig__subbandSize_value1; - csirep2->non_PMI_PortIndication = NULL; - csirep2->ext1 = NULL; - ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ReportConfigToAddModList->list,csirep2); - } - else{ - NR_CSI_ReportConfig_t *csirep3 = calloc(1,sizeof(*csirep3)); - csirep3->reportConfigId=bwp_id+10; - csirep3->carrier=NULL; - csirep3->resourcesForChannelMeasurement=bwp_id+20; - csirep3->csi_IM_ResourcesForInterference=NULL; - csirep3->nzp_CSI_RS_ResourcesForInterference=NULL; - csirep3->reportConfigType.present = NR_CSI_ReportConfig__reportConfigType_PR_periodic; - csirep3->reportConfigType.choice.periodic = calloc(1,sizeof(*csirep3->reportConfigType.choice.periodic)); - csirep3->reportConfigType.choice.periodic->reportSlotConfig.present=NR_CSI_ReportPeriodicityAndOffset_PR_slots320; - csirep3->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320 = 37 + (20 * uid) % 320; - ASN_SEQUENCE_ADD(&csirep3->reportConfigType.choice.periodic->pucch_CSI_ResourceList.list,pucchcsires1); - csirep3->reportQuantity.present = NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP; - csirep3->reportQuantity.choice.ssb_Index_RSRP=(NULL_t)0; - csirep3->reportFreqConfiguration = NULL; - csirep3->timeRestrictionForChannelMeasurements= NR_CSI_ReportConfig__timeRestrictionForChannelMeasurements_configured; - csirep3->timeRestrictionForInterferenceMeasurements=NR_CSI_ReportConfig__timeRestrictionForInterferenceMeasurements_configured; - csirep3->codebookConfig= NULL; - csirep3->dummy = NULL; - csirep3->groupBasedBeamReporting.present = NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled; - csirep3->groupBasedBeamReporting.choice.disabled=calloc(1,sizeof(*csirep3->groupBasedBeamReporting.choice.disabled)); - csirep3->groupBasedBeamReporting.choice.disabled->nrofReportedRS = calloc(1,sizeof(*csirep3->groupBasedBeamReporting.choice.disabled->nrofReportedRS)); - *csirep3->groupBasedBeamReporting.choice.disabled->nrofReportedRS=NR_CSI_ReportConfig__groupBasedBeamReporting__disabled__nrofReportedRS_n1; - csirep3->cqi_Table = NULL; - csirep3->subbandSize = NR_CSI_ReportConfig__subbandSize_value1; - csirep3->non_PMI_PortIndication = NULL; - csirep3->ext1 = NULL; - ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ReportConfigToAddModList->list,csirep3); } + conig_rsrp_meas_report(csi_MeasConfig, + scc, + pucchcsires1, + configuration->do_CSIRS, + bwp_id+10, + uid); } pdsch_servingcellconfig->codeBlockGroupTransmission = NULL; pdsch_servingcellconfig->xOverhead = NULL; diff --git a/openair2/RRC/NR/nr_rrc_config.c b/openair2/RRC/NR/nr_rrc_config.c index af12637ae9..5a2f3920f0 100644 --- a/openair2/RRC/NR/nr_rrc_config.c +++ b/openair2/RRC/NR/nr_rrc_config.c @@ -762,7 +762,7 @@ void set_pucch_power_config(NR_PUCCH_Config_t *pucch_Config, int do_csirs) { } static void set_SR_periodandoffset(NR_SchedulingRequestResourceConfig_t *schedulingRequestResourceConfig, - const NR_ServingCellConfigCommon_t *scc) + const NR_ServingCellConfigCommon_t *scc) { const NR_TDD_UL_DL_Pattern_t *tdd = scc->tdd_UL_DL_ConfigurationCommon ? &scc->tdd_UL_DL_ConfigurationCommon->pattern1 : NULL; int sr_slot = 1; // in FDD SR in slot 1 @@ -1208,3 +1208,110 @@ void set_phr_config(NR_MAC_CellGroupConfig_t *mac_CellGroupConfig) mac_CellGroupConfig->phr_Config->choice.setup->phr_Tx_PowerFactorChange = NR_PHR_Config__phr_Tx_PowerFactorChange_dB1; } +void set_csi_meas_periodicity(const NR_ServingCellConfigCommon_t *scc, + NR_CSI_ReportConfig_t *csirep, + int uid, + bool is_rsrp) +{ + + 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 = slotsperframe[*scc->ssbSubcarrierSpacing]; + const int n_ul_slots_period = tdd ? (tdd->nrofUplinkSlots + (tdd->nrofUplinkSymbols>0)) : + n_slots_frame; + const int n_slots_period = tdd ? n_slots_frame / get_nb_periods_per_frame(tdd->dl_UL_TransmissionPeriodicity) : n_slots_frame; + const int ideal_period = MAX_MOBILES_PER_GNB*2*n_slots_period/n_ul_slots_period; // 2 reports per UE + AssertFatal(ideal_period<320,"Not enough UL slots to accomodate all possible UEs. Need to rework the implementation\n"); + const int first_ul_slot_period = tdd ? tdd->nrofDownlinkSlots : 0; + const int idx = (uid<<1)+is_rsrp; + const int offset = first_ul_slot_period + idx%n_ul_slots_period + (idx/n_ul_slots_period)*n_slots_period; + + if (ideal_period<5) { + csirep->reportConfigType.choice.periodic->reportSlotConfig.present=NR_CSI_ReportPeriodicityAndOffset_PR_slots4; + csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots4 = offset; + } + else if (ideal_period<6) { + csirep->reportConfigType.choice.periodic->reportSlotConfig.present=NR_CSI_ReportPeriodicityAndOffset_PR_slots5; + csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots5 = offset; + } + else if (ideal_period<9) { + csirep->reportConfigType.choice.periodic->reportSlotConfig.present=NR_CSI_ReportPeriodicityAndOffset_PR_slots8; + csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots8 = offset; + } + else if (ideal_period<11) { + csirep->reportConfigType.choice.periodic->reportSlotConfig.present=NR_CSI_ReportPeriodicityAndOffset_PR_slots10; + csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots10 = offset; + } + else if (ideal_period<17) { + csirep->reportConfigType.choice.periodic->reportSlotConfig.present=NR_CSI_ReportPeriodicityAndOffset_PR_slots16; + csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots16 = offset; + } + else if (ideal_period<21) { + csirep->reportConfigType.choice.periodic->reportSlotConfig.present=NR_CSI_ReportPeriodicityAndOffset_PR_slots20; + csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots20 = offset; + } + else if (ideal_period<41) { + csirep->reportConfigType.choice.periodic->reportSlotConfig.present=NR_CSI_ReportPeriodicityAndOffset_PR_slots40; + csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots40 = offset; + } + else if (ideal_period<81) { + csirep->reportConfigType.choice.periodic->reportSlotConfig.present=NR_CSI_ReportPeriodicityAndOffset_PR_slots80; + csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots80 = offset; + } + else if (ideal_period<161) { + csirep->reportConfigType.choice.periodic->reportSlotConfig.present=NR_CSI_ReportPeriodicityAndOffset_PR_slots160; + csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots160 = offset; + } + else { + csirep->reportConfigType.choice.periodic->reportSlotConfig.present=NR_CSI_ReportPeriodicityAndOffset_PR_slots320; + csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320 = offset; + } +} + +void conig_rsrp_meas_report(NR_CSI_MeasConfig_t *csi_MeasConfig, + const NR_ServingCellConfigCommon_t *servingcellconfigcommon, + NR_PUCCH_CSI_Resource_t *pucchcsires, + int do_csi, // if rsrp is based on CSI or SSB + int rep_id, + int uid) +{ + + NR_CSI_ReportConfig_t *csirep = calloc(1,sizeof(*csirep)); + csirep->reportConfigId=rep_id; + csirep->carrier=NULL; + int resource_id = -1; + for (int csi_list=0; csi_listcsi_ResourceConfigToAddModList->list.count; csi_list++) { + NR_CSI_ResourceConfig_t *csires = csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_list]; + if(csires->csi_RS_ResourceSetList.present == NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB) { + if(do_csi) { + if (csires->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList) + resource_id = csires->csi_ResourceConfigId; + } + else { + if (csires->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList) + resource_id = csires->csi_ResourceConfigId; + } + } + } + AssertFatal(resource_id>-1,"No resource for RSRP found\n"); + csirep->resourcesForChannelMeasurement=resource_id; + csirep->csi_IM_ResourcesForInterference=NULL; + csirep->nzp_CSI_RS_ResourcesForInterference=NULL; + csirep->reportConfigType.present = NR_CSI_ReportConfig__reportConfigType_PR_periodic; + csirep->reportConfigType.choice.periodic = calloc(1,sizeof(*csirep->reportConfigType.choice.periodic)); + set_csi_meas_periodicity(servingcellconfigcommon, csirep, uid, true); + ASN_SEQUENCE_ADD(&csirep->reportConfigType.choice.periodic->pucch_CSI_ResourceList.list,pucchcsires); + if(do_csi) { + csirep->reportQuantity.present = NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP; + csirep->reportQuantity.choice.cri_RSRP=(NULL_t)0; + } + else { + csirep->reportQuantity.present = NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP; + csirep->reportQuantity.choice.ssb_Index_RSRP=(NULL_t)0; + } + csirep->groupBasedBeamReporting.present = NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled; + csirep->groupBasedBeamReporting.choice.disabled=calloc(1,sizeof(*csirep->groupBasedBeamReporting.choice.disabled)); + csirep->groupBasedBeamReporting.choice.disabled->nrofReportedRS = calloc(1,sizeof(*csirep->groupBasedBeamReporting.choice.disabled->nrofReportedRS)); + *csirep->groupBasedBeamReporting.choice.disabled->nrofReportedRS=NR_CSI_ReportConfig__groupBasedBeamReporting__disabled__nrofReportedRS_n1; + ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ReportConfigToAddModList->list,csirep); +} + diff --git a/openair2/RRC/NR/nr_rrc_config.h b/openair2/RRC/NR/nr_rrc_config.h index f9c0675551..386fb24ec2 100644 --- a/openair2/RRC/NR/nr_rrc_config.h +++ b/openair2/RRC/NR/nr_rrc_config.h @@ -58,6 +58,12 @@ void set_dl_DataToUL_ACK(NR_PUCCH_Config_t *pucch_Config, int min_feedback_time) void set_pucch_power_config(NR_PUCCH_Config_t *pucch_Config, int do_csirs); void scheduling_request_config(const NR_ServingCellConfigCommon_t *scc, NR_PUCCH_Config_t *pucch_Config); +void conig_rsrp_meas_report(NR_CSI_MeasConfig_t *csi_MeasConfig, + const NR_ServingCellConfigCommon_t *servingcellconfigcommon, + NR_PUCCH_CSI_Resource_t *pucchcsires, + int do_csi, + int rep_id, + int uid); void config_csirs(const NR_ServingCellConfigCommon_t *servingcellconfigcommon, NR_CSI_MeasConfig_t *csi_MeasConfig, int uid, diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index 1fe4cb30e9..c5ff463e70 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -500,68 +500,13 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco csirep1->ext1 = NULL; ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ReportConfigToAddModList->list,csirep1); } + conig_rsrp_meas_report(csi_MeasConfig, + servingcellconfigcommon, + pucchcsires1, + do_csirs, + bwp->bwp_Id+10, + uid); - if (do_csirs) { - NR_CSI_ReportConfig_t *csirep2 = calloc(1,sizeof(*csirep2)); - csirep2->reportConfigId=bwp->bwp_Id+10; - csirep2->carrier=NULL; - csirep2->resourcesForChannelMeasurement=bwp->bwp_Id; - csirep2->csi_IM_ResourcesForInterference=NULL; - csirep2->nzp_CSI_RS_ResourcesForInterference=NULL; - csirep2->reportConfigType.present = NR_CSI_ReportConfig__reportConfigType_PR_periodic; - csirep2->reportConfigType.choice.periodic = calloc(1,sizeof(*csirep2->reportConfigType.choice.periodic)); - csirep2->reportConfigType.choice.periodic->reportSlotConfig.present=NR_CSI_ReportPeriodicityAndOffset_PR_slots320; - csirep2->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320 = 39 + (20 * uid) % 320; - ASN_SEQUENCE_ADD(&csirep2->reportConfigType.choice.periodic->pucch_CSI_ResourceList.list,pucchcsires1); - csirep2->reportQuantity.present = NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP; - csirep2->reportQuantity.choice.cri_RSRP=(NULL_t)0; - csirep2->reportFreqConfiguration = calloc(1,sizeof(*csirep2->reportFreqConfiguration)); - csirep2->reportFreqConfiguration->cqi_FormatIndicator = NULL; - csirep2->reportFreqConfiguration->pmi_FormatIndicator=NULL; - csirep2->reportFreqConfiguration->csi_ReportingBand=NULL; - csirep2->timeRestrictionForChannelMeasurements= NR_CSI_ReportConfig__timeRestrictionForChannelMeasurements_configured; - csirep2->timeRestrictionForInterferenceMeasurements=NR_CSI_ReportConfig__timeRestrictionForInterferenceMeasurements_configured; - csirep2->codebookConfig=NULL; - csirep2->dummy = NULL; - csirep2->groupBasedBeamReporting.present = NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled; - csirep2->groupBasedBeamReporting.choice.disabled=calloc(1,sizeof(*csirep2->groupBasedBeamReporting.choice.disabled)); - csirep2->groupBasedBeamReporting.choice.disabled->nrofReportedRS = calloc(1,sizeof(*csirep2->groupBasedBeamReporting.choice.disabled->nrofReportedRS)); - *csirep2->groupBasedBeamReporting.choice.disabled->nrofReportedRS=NR_CSI_ReportConfig__groupBasedBeamReporting__disabled__nrofReportedRS_n1; - csirep2->cqi_Table = NULL; - csirep2->subbandSize = NR_CSI_ReportConfig__subbandSize_value1; - csirep2->non_PMI_PortIndication = NULL; - csirep2->ext1 = NULL; - ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ReportConfigToAddModList->list,csirep2); - } - else{ - NR_CSI_ReportConfig_t *csirep2 = calloc(1,sizeof(*csirep2)); - csirep2->reportConfigId=bwp->bwp_Id+10; - csirep2->carrier=NULL; - csirep2->resourcesForChannelMeasurement=bwp->bwp_Id+20; - csirep2->csi_IM_ResourcesForInterference=NULL; - csirep2->nzp_CSI_RS_ResourcesForInterference=NULL; - csirep2->reportConfigType.present = NR_CSI_ReportConfig__reportConfigType_PR_periodic; - csirep2->reportConfigType.choice.periodic = calloc(1,sizeof(*csirep2->reportConfigType.choice.periodic)); - csirep2->reportConfigType.choice.periodic->reportSlotConfig.present=NR_CSI_ReportPeriodicityAndOffset_PR_slots320; - csirep2->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320 = 39 + (20 * uid) % 320; - ASN_SEQUENCE_ADD(&csirep2->reportConfigType.choice.periodic->pucch_CSI_ResourceList.list,pucchcsires1); - csirep2->reportQuantity.present = NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP; - csirep2->reportQuantity.choice.ssb_Index_RSRP=(NULL_t)0; - csirep2->reportFreqConfiguration = NULL; - csirep2->timeRestrictionForChannelMeasurements= NR_CSI_ReportConfig__timeRestrictionForChannelMeasurements_configured; - csirep2->timeRestrictionForInterferenceMeasurements=NR_CSI_ReportConfig__timeRestrictionForInterferenceMeasurements_configured; - csirep2->codebookConfig= NULL; - csirep2->dummy = NULL; - csirep2->groupBasedBeamReporting.present = NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled; - csirep2->groupBasedBeamReporting.choice.disabled=calloc(1,sizeof(*csirep2->groupBasedBeamReporting.choice.disabled)); - csirep2->groupBasedBeamReporting.choice.disabled->nrofReportedRS = calloc(1,sizeof(*csirep2->groupBasedBeamReporting.choice.disabled->nrofReportedRS)); - *csirep2->groupBasedBeamReporting.choice.disabled->nrofReportedRS=NR_CSI_ReportConfig__groupBasedBeamReporting__disabled__nrofReportedRS_n1; - csirep2->cqi_Table = NULL; - csirep2->subbandSize = NR_CSI_ReportConfig__subbandSize_value1; - csirep2->non_PMI_PortIndication = NULL; - csirep2->ext1 = NULL; - ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ReportConfigToAddModList->list,csirep2); - } } secondaryCellGroup->spCellConfig->spCellConfigDedicated->sCellDeactivationTimer=NULL; secondaryCellGroup->spCellConfig->spCellConfigDedicated->crossCarrierSchedulingConfig=NULL; From 0dc4959741a117ee8e5ee8e19ea3f22a8b660708 Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 29 Aug 2022 15:29:59 +0200 Subject: [PATCH 2/7] CSI MIMO meas harmonization --- openair2/RRC/NR/MESSAGES/asn1_msg.c | 76 ++---------- openair2/RRC/NR/nr_rrc_config.c | 182 ++++++++++++++++++++++++++++ openair2/RRC/NR/nr_rrc_config.h | 8 ++ openair2/RRC/NR/nr_rrc_proto.h | 2 + openair2/RRC/NR/rrc_gNB_reconfig.c | 99 ++------------- 5 files changed, 214 insertions(+), 153 deletions(-) diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 9b15967486..5e64a071d8 100755 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -984,7 +984,8 @@ void fill_initial_SpCellConfig(int uid, pucchcsires1->uplinkBandwidthPartId=bwp_id; pucchcsires1->pucch_Resource=2; - if (configuration->do_CSIRS && pdsch_AntennaPorts > 1) { + if(configuration->do_CSIRS) { + NR_CSI_ResourceConfig_t *csires0 = calloc(1,sizeof(*csires0)); csires0->csi_ResourceConfigId = bwp_id; csires0->csi_RS_ResourceSetList.present = NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB; @@ -996,6 +997,9 @@ void fill_initial_SpCellConfig(int uid, csires0->bwp_Id = bwp_id; csires0->resourceType = NR_CSI_ResourceConfig__resourceType_periodic; ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ResourceConfigToAddModList->list,csires0); + } + + if (configuration->do_CSIRS && pdsch_AntennaPorts > 1) { NR_CSI_ResourceConfig_t *csires2 = calloc(1,sizeof(*csires2)); csires2->csi_ResourceConfigId = bwp_id+10; @@ -1008,68 +1012,14 @@ void fill_initial_SpCellConfig(int uid, csires2->resourceType = NR_CSI_ResourceConfig__resourceType_periodic; ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ResourceConfigToAddModList->list,csires2); - if (pdsch_AntennaPorts > 1) { - LOG_D(NR_RRC,"Filling CSI Report Config for RI_PMI_CQI\n"); - NR_CSI_ReportConfig_t *csirep1 = calloc(1,sizeof(*csirep1)); - csirep1->reportConfigId=0; - csirep1->carrier=NULL; - csirep1->resourcesForChannelMeasurement=bwp_id; - csirep1->csi_IM_ResourcesForInterference=calloc(1,sizeof(*csirep1->csi_IM_ResourcesForInterference)); - *csirep1->csi_IM_ResourcesForInterference=bwp_id+10; - csirep1->nzp_CSI_RS_ResourcesForInterference=NULL; - csirep1->reportConfigType.present = NR_CSI_ReportConfig__reportConfigType_PR_periodic; - csirep1->reportConfigType.choice.periodic = calloc(1,sizeof(*csirep1->reportConfigType.choice.periodic)); - csirep1->reportConfigType.choice.periodic->reportSlotConfig.present=NR_CSI_ReportPeriodicityAndOffset_PR_slots320; - csirep1->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320 = (7 + (20 * uid)) % 320; - ASN_SEQUENCE_ADD(&csirep1->reportConfigType.choice.periodic->pucch_CSI_ResourceList.list,pucchcsires1); - csirep1->reportQuantity.present = NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI; - csirep1->reportQuantity.choice.cri_RI_PMI_CQI=(NULL_t)0; - csirep1->reportFreqConfiguration = calloc(1,sizeof(*csirep1->reportFreqConfiguration)); - csirep1->reportFreqConfiguration->cqi_FormatIndicator = calloc(1,sizeof(*csirep1->reportFreqConfiguration->cqi_FormatIndicator)); - *csirep1->reportFreqConfiguration->cqi_FormatIndicator=NR_CSI_ReportConfig__reportFreqConfiguration__cqi_FormatIndicator_widebandCQI; - csirep1->reportFreqConfiguration->pmi_FormatIndicator = calloc(1,sizeof(*csirep1->reportFreqConfiguration->pmi_FormatIndicator)); - *csirep1->reportFreqConfiguration->pmi_FormatIndicator=NR_CSI_ReportConfig__reportFreqConfiguration__pmi_FormatIndicator_widebandPMI; - csirep1->reportFreqConfiguration->csi_ReportingBand = NULL; - /*calloc(1,sizeof(*csirep1->reportFreqConfiguration->csi_ReportingBand)); - csirep1->reportFreqConfiguration->csi_ReportingBand->present = NR_CSI_ReportConfig__reportFreqConfiguration__csi_ReportingBand_PR_subbands7; - csirep1->reportFreqConfiguration->csi_ReportingBand->choice.subbands7.size=1; - csirep1->reportFreqConfiguration->csi_ReportingBand->choice.subbands7.bits_unused=1; - csirep1->reportFreqConfiguration->csi_ReportingBand->choice.subbands7.buf=malloc(1); - csirep1->reportFreqConfiguration->csi_ReportingBand->choice.subbands7.buf[0]=254;*/ - csirep1->timeRestrictionForChannelMeasurements= NR_CSI_ReportConfig__timeRestrictionForChannelMeasurements_notConfigured; - csirep1->timeRestrictionForInterferenceMeasurements=NR_CSI_ReportConfig__timeRestrictionForInterferenceMeasurements_notConfigured; - csirep1->codebookConfig=calloc(1,sizeof(*csirep1->codebookConfig)); - csirep1->codebookConfig->codebookType.present = NR_CodebookConfig__codebookType_PR_type1; - csirep1->codebookConfig->codebookType.choice.type1 = calloc(1,sizeof(*csirep1->codebookConfig->codebookType.choice.type1)); - csirep1->codebookConfig->codebookType.choice.type1->subType.present=NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel; - csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel=calloc(1,sizeof(*csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel)); - struct NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel *singlePanelConfig = csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel; - singlePanelConfig->nrOfAntennaPorts.present = NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_two; - singlePanelConfig->nrOfAntennaPorts.choice.two = calloc(1,sizeof(*singlePanelConfig->nrOfAntennaPorts.choice.two)); - singlePanelConfig->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.size=1; - singlePanelConfig->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.bits_unused=2; - singlePanelConfig->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.buf=malloc(1); - singlePanelConfig->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.buf[0]=0xfc; - singlePanelConfig->typeI_SinglePanel_ri_Restriction.size=1; - singlePanelConfig->typeI_SinglePanel_ri_Restriction.bits_unused=0; - singlePanelConfig->typeI_SinglePanel_ri_Restriction.buf=malloc(1); - singlePanelConfig->typeI_SinglePanel_ri_Restriction.buf[0]=0x03; - csirep1->codebookConfig->codebookType.choice.type1->codebookMode=1; - csirep1->dummy = NULL; - csirep1->groupBasedBeamReporting.present = NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled; - csirep1->groupBasedBeamReporting.choice.disabled=calloc(1,sizeof(*csirep1->groupBasedBeamReporting.choice.disabled)); - //csirep1->groupBasedBeamReporting.choice.disabled->nrofReportedRS = calloc(1,sizeof(*csirep1->groupBasedBeamReporting.choice.disabled->nrofReportedRS)); - //*csirep1->groupBasedBeamReporting.choice.disabled->nrofReportedRS=NR_CSI_ReportConfig__groupBasedBeamReporting__disabled__nrofReportedRS_n1; - csirep1->cqi_Table = calloc(1,sizeof(*csirep1->cqi_Table)); - if(pdsch_Config->choice.setup->mcs_Table!=NULL) - *csirep1->cqi_Table = NR_CSI_ReportConfig__cqi_Table_table2; - else - *csirep1->cqi_Table = NR_CSI_ReportConfig__cqi_Table_table1; - csirep1->subbandSize = NR_CSI_ReportConfig__subbandSize_value2; - csirep1->non_PMI_PortIndication = NULL; - csirep1->ext1 = NULL; - ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ReportConfigToAddModList->list,csirep1); - } + config_csi_meas_report(csi_MeasConfig, + scc, + pucchcsires1, + pdsch_Config, + &configuration->pdsch_AntennaPorts, + NR_MAX_SUPPORTED_DL_LAYERS, + bwp_id, + uid); } conig_rsrp_meas_report(csi_MeasConfig, scc, diff --git a/openair2/RRC/NR/nr_rrc_config.c b/openair2/RRC/NR/nr_rrc_config.c index 5a2f3920f0..0c4dd0eb71 100644 --- a/openair2/RRC/NR/nr_rrc_config.c +++ b/openair2/RRC/NR/nr_rrc_config.c @@ -1267,6 +1267,188 @@ void set_csi_meas_periodicity(const NR_ServingCellConfigCommon_t *scc, } } +void config_csi_codebook(const rrc_pdsch_AntennaPorts_t* antennaports, + const int max_layers, + struct NR_CodebookConfig *codebookConfig) +{ + + const int num_ant_ports = antennaports->N1 * antennaports->N2 * antennaports->XP; + codebookConfig->codebookType.present = NR_CodebookConfig__codebookType_PR_type1; + codebookConfig->codebookType.choice.type1 = calloc(1,sizeof(*codebookConfig->codebookType.choice.type1)); + // Single panel configuration + codebookConfig->codebookType.choice.type1->subType.present=NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel; + codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel=calloc(1,sizeof(*codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel)); + struct NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel *singlePanelConfig = codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel; + singlePanelConfig->typeI_SinglePanel_ri_Restriction.size=1; + singlePanelConfig->typeI_SinglePanel_ri_Restriction.bits_unused=0; + singlePanelConfig->typeI_SinglePanel_ri_Restriction.buf=malloc(1); + singlePanelConfig->typeI_SinglePanel_ri_Restriction.buf[0]=(1<nrOfAntennaPorts.present = NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_two; + singlePanelConfig->nrOfAntennaPorts.choice.two = calloc(1,sizeof(*singlePanelConfig->nrOfAntennaPorts.choice.two)); + singlePanelConfig->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.size = 1; + singlePanelConfig->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.bits_unused = 2; + singlePanelConfig->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.buf = calloc(1, sizeof(uint8_t)); + singlePanelConfig->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.buf[0] = 0xfc; // no restriction (all 6 bits enabled) + } else { + singlePanelConfig->nrOfAntennaPorts.present = NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_moreThanTwo; + singlePanelConfig->nrOfAntennaPorts.choice.moreThanTwo = calloc(1,sizeof(*singlePanelConfig->nrOfAntennaPorts.choice.moreThanTwo)); + struct NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo *moreThanTwo = singlePanelConfig->nrOfAntennaPorts.choice.moreThanTwo; + switch (num_ant_ports) { + case 4: + moreThanTwo->n1_n2.present = NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_two_one_TypeI_SinglePanel_Restriction; + moreThanTwo->n1_n2.choice.two_one_TypeI_SinglePanel_Restriction.size = 1; + moreThanTwo->n1_n2.choice.two_one_TypeI_SinglePanel_Restriction.bits_unused = 0; + moreThanTwo->n1_n2.choice.two_one_TypeI_SinglePanel_Restriction.buf = calloc(1, sizeof(uint8_t)); + moreThanTwo->n1_n2.choice.two_one_TypeI_SinglePanel_Restriction.buf[0] = 0xff; // TODO verify the meaning of this parameter + break; + case 8: + if (antennaports->N1 == 2) { + AssertFatal(antennaports->N2 == 2, "N1 and N2 not in accordace with the specifications\n"); + moreThanTwo->n1_n2.present = NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_two_two_TypeI_SinglePanel_Restriction; + moreThanTwo->n1_n2.choice.two_two_TypeI_SinglePanel_Restriction.size = 8; + moreThanTwo->n1_n2.choice.two_two_TypeI_SinglePanel_Restriction.bits_unused = 0; + moreThanTwo->n1_n2.choice.two_two_TypeI_SinglePanel_Restriction.buf = calloc(8, sizeof(uint8_t)); + for(int i=0; i<8; i++) + moreThanTwo->n1_n2.choice.two_two_TypeI_SinglePanel_Restriction.buf[i] = 0xff; // TODO verify the meaning of this parameter + } + else if (antennaports->N1 == 4) { + AssertFatal(antennaports->N2 == 1, "N1 and N2 not in accordace with the specifications\n"); + moreThanTwo->n1_n2.present = NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_one_TypeI_SinglePanel_Restriction; + moreThanTwo->n1_n2.choice.four_one_TypeI_SinglePanel_Restriction.size = 2; + moreThanTwo->n1_n2.choice.four_one_TypeI_SinglePanel_Restriction.bits_unused = 0; + moreThanTwo->n1_n2.choice.four_one_TypeI_SinglePanel_Restriction.buf = calloc(2, sizeof(uint8_t)); + for(int i=0; i<2; i++) + moreThanTwo->n1_n2.choice.four_one_TypeI_SinglePanel_Restriction.buf[i] = 0xff; // TODO verify the meaning of this parameter + } + else + AssertFatal(1==0,"N1 %d and N2 %d not supported for %d antenna ports\n", + antennaports->N1, + antennaports->N2, + num_ant_ports); + break; + case 12: + if (antennaports->N1 == 3) { + AssertFatal(antennaports->N2 == 2, "N1 and N2 not in accordace with the specifications\n"); + moreThanTwo->n1_n2.present = NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_three_two_TypeI_SinglePanel_Restriction; + moreThanTwo->n1_n2.choice.three_two_TypeI_SinglePanel_Restriction.size = 12; + moreThanTwo->n1_n2.choice.three_two_TypeI_SinglePanel_Restriction.bits_unused = 0; + moreThanTwo->n1_n2.choice.three_two_TypeI_SinglePanel_Restriction.buf = calloc(12, sizeof(uint8_t)); + for(int i=0; i<12; i++) + moreThanTwo->n1_n2.choice.three_two_TypeI_SinglePanel_Restriction.buf[i] = 0xff; // TODO verify the meaning of this parameter + } + else if (antennaports->N1 == 6) { + AssertFatal(antennaports->N2 == 1, "N1 and N2 not in accordace with the specifications\n"); + moreThanTwo->n1_n2.present = NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_six_one_TypeI_SinglePanel_Restriction; + moreThanTwo->n1_n2.choice.six_one_TypeI_SinglePanel_Restriction.size = 3; + moreThanTwo->n1_n2.choice.six_one_TypeI_SinglePanel_Restriction.bits_unused = 0; + moreThanTwo->n1_n2.choice.six_one_TypeI_SinglePanel_Restriction.buf = calloc(3, sizeof(uint8_t)); + for(int i=0; i<3; i++) + moreThanTwo->n1_n2.choice.six_one_TypeI_SinglePanel_Restriction.buf[i] = 0xff; // TODO verify the meaning of this parameter + } + else + AssertFatal(1==0,"N1 %d and N2 %d not supported for %d antenna ports\n", + antennaports->N1, + antennaports->N2, + num_ant_ports); + break; + case 16: + if (antennaports->N1 == 4) { + AssertFatal(antennaports->N2 == 2, "N1 and N2 not in accordace with the specifications\n"); + moreThanTwo->n1_n2.present = NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_two_TypeI_SinglePanel_Restriction; + moreThanTwo->n1_n2.choice.four_two_TypeI_SinglePanel_Restriction.size = 16; + moreThanTwo->n1_n2.choice.four_two_TypeI_SinglePanel_Restriction.bits_unused = 0; + moreThanTwo->n1_n2.choice.four_two_TypeI_SinglePanel_Restriction.buf = calloc(16, sizeof(uint8_t)); + for(int i=0; i<16; i++) + moreThanTwo->n1_n2.choice.four_two_TypeI_SinglePanel_Restriction.buf[i] = 0xff; // TODO verify the meaning of this parameter + } + else if (antennaports->N1 == 8) { + AssertFatal(antennaports->N2 == 1, "N1 and N2 not in accordace with the specifications\n"); + moreThanTwo->n1_n2.present = NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_eight_one_TypeI_SinglePanel_Restriction; + moreThanTwo->n1_n2.choice.eight_one_TypeI_SinglePanel_Restriction.size = 4; + moreThanTwo->n1_n2.choice.eight_one_TypeI_SinglePanel_Restriction.bits_unused = 0; + moreThanTwo->n1_n2.choice.eight_one_TypeI_SinglePanel_Restriction.buf = calloc(4, sizeof(uint8_t)); + for(int i=0; i<4; i++) + moreThanTwo->n1_n2.choice.eight_one_TypeI_SinglePanel_Restriction.buf[i] = 0xff; // TODO verify the meaning of this parameter + } + else + AssertFatal(1==0,"N1 %d and N2 %d not supported for %d antenna ports\n", + antennaports->N1, + antennaports->N2, + num_ant_ports); + break; + default: + AssertFatal(1==0,"%d antenna ports not supported\n",num_ant_ports); + } + } + codebookConfig->codebookType.choice.type1->codebookMode=1; +} + +void config_csi_meas_report(NR_CSI_MeasConfig_t *csi_MeasConfig, + const NR_ServingCellConfigCommon_t *servingcellconfigcommon, + NR_PUCCH_CSI_Resource_t *pucchcsires, + struct NR_SetupRelease_PDSCH_Config *pdsch_Config, + const rrc_pdsch_AntennaPorts_t* antennaports, + const int max_layers, + int rep_id, + int uid) +{ + + NR_CSI_ReportConfig_t *csirep = calloc(1,sizeof(*csirep)); + csirep->reportConfigId=rep_id; + csirep->carrier=NULL; + int resource_id = -1; + int im_id = -1; + for (int csi_list=0; csi_listcsi_ResourceConfigToAddModList->list.count; csi_list++) { + NR_CSI_ResourceConfig_t *csires = csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_list]; + if(csires->csi_RS_ResourceSetList.present == NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB) { + if (csires->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList) { + resource_id = csires->csi_ResourceConfigId; + } + } + if(csires->csi_RS_ResourceSetList.present == NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_csi_IM_ResourceSetList) { + if(csires->csi_RS_ResourceSetList.choice.csi_IM_ResourceSetList) { + im_id = csires->csi_ResourceConfigId; + } + } + } + AssertFatal(resource_id>-1,"No resource for CSI measurements found\n"); + AssertFatal(im_id>-1,"No resource for IM measurements found\n"); + csirep->resourcesForChannelMeasurement=resource_id; + csirep->csi_IM_ResourcesForInterference=calloc(1,sizeof(*csirep->csi_IM_ResourcesForInterference)); + *csirep->csi_IM_ResourcesForInterference=im_id; + csirep->nzp_CSI_RS_ResourcesForInterference=NULL; + csirep->reportConfigType.present = NR_CSI_ReportConfig__reportConfigType_PR_periodic; + csirep->reportConfigType.choice.periodic = calloc(1,sizeof(*csirep->reportConfigType.choice.periodic)); + set_csi_meas_periodicity(servingcellconfigcommon, csirep, uid, false); + ASN_SEQUENCE_ADD(&csirep->reportConfigType.choice.periodic->pucch_CSI_ResourceList.list,pucchcsires); + csirep->reportQuantity.present = NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI; + csirep->reportQuantity.choice.cri_RI_PMI_CQI=(NULL_t)0; + csirep->reportFreqConfiguration = calloc(1,sizeof(*csirep->reportFreqConfiguration)); + // Wideband configuration + csirep->reportFreqConfiguration->cqi_FormatIndicator = calloc(1,sizeof(*csirep->reportFreqConfiguration->cqi_FormatIndicator)); + *csirep->reportFreqConfiguration->cqi_FormatIndicator=NR_CSI_ReportConfig__reportFreqConfiguration__cqi_FormatIndicator_widebandCQI; + csirep->reportFreqConfiguration->pmi_FormatIndicator = calloc(1,sizeof(*csirep->reportFreqConfiguration->pmi_FormatIndicator)); + *csirep->reportFreqConfiguration->pmi_FormatIndicator=NR_CSI_ReportConfig__reportFreqConfiguration__pmi_FormatIndicator_widebandPMI; + csirep->reportFreqConfiguration->csi_ReportingBand = NULL; + csirep->timeRestrictionForChannelMeasurements= NR_CSI_ReportConfig__timeRestrictionForChannelMeasurements_notConfigured; + csirep->timeRestrictionForInterferenceMeasurements=NR_CSI_ReportConfig__timeRestrictionForInterferenceMeasurements_notConfigured; + csirep->codebookConfig=calloc(1,sizeof(*csirep->codebookConfig)); + config_csi_codebook(antennaports, max_layers, csirep->codebookConfig); + csirep->dummy = NULL; + csirep->groupBasedBeamReporting.present = NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled; + csirep->groupBasedBeamReporting.choice.disabled=calloc(1,sizeof(*csirep->groupBasedBeamReporting.choice.disabled)); + csirep->cqi_Table = calloc(1,sizeof(*csirep->cqi_Table)); + if(pdsch_Config->choice.setup->mcs_Table!=NULL) + *csirep->cqi_Table = NR_CSI_ReportConfig__cqi_Table_table2; + else + *csirep->cqi_Table = NR_CSI_ReportConfig__cqi_Table_table1; + csirep->subbandSize = NR_CSI_ReportConfig__subbandSize_value2; + csirep->non_PMI_PortIndication = NULL; + csirep->ext1 = NULL; + ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ReportConfigToAddModList->list,csirep); +} + void conig_rsrp_meas_report(NR_CSI_MeasConfig_t *csi_MeasConfig, const NR_ServingCellConfigCommon_t *servingcellconfigcommon, NR_PUCCH_CSI_Resource_t *pucchcsires, diff --git a/openair2/RRC/NR/nr_rrc_config.h b/openair2/RRC/NR/nr_rrc_config.h index 386fb24ec2..89bda83680 100644 --- a/openair2/RRC/NR/nr_rrc_config.h +++ b/openair2/RRC/NR/nr_rrc_config.h @@ -64,6 +64,14 @@ void conig_rsrp_meas_report(NR_CSI_MeasConfig_t *csi_MeasConfig, int do_csi, int rep_id, int uid); +void config_csi_meas_report(NR_CSI_MeasConfig_t *csi_MeasConfig, + const NR_ServingCellConfigCommon_t *servingcellconfigcommon, + NR_PUCCH_CSI_Resource_t *pucchcsires, + struct NR_SetupRelease_PDSCH_Config *pdsch_Config, + const rrc_pdsch_AntennaPorts_t* antennaports, + const int max_layers, + int rep_id, + int uid); void config_csirs(const NR_ServingCellConfigCommon_t *servingcellconfigcommon, NR_CSI_MeasConfig_t *csi_MeasConfig, int uid, diff --git a/openair2/RRC/NR/nr_rrc_proto.h b/openair2/RRC/NR/nr_rrc_proto.h index b90cf4dfa4..0b96fd0120 100644 --- a/openair2/RRC/NR/nr_rrc_proto.h +++ b/openair2/RRC/NR/nr_rrc_proto.h @@ -41,6 +41,8 @@ #include "NR_CG-ConfigInfo.h" #include "NR_SecurityConfig.h" +#define NR_MAX_SUPPORTED_DL_LAYERS 2 + int rrc_init_nr_global_param(void); void rrc_config_nr_buffer(NR_SRB_INFO* Srb_info, diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index c5ff463e70..37f7b14684 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -331,7 +331,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco pdsch_servingcellconfig->pucch_Cell= NULL; pdsch_servingcellconfig->ext1=calloc(1,sizeof(*pdsch_servingcellconfig->ext1)); pdsch_servingcellconfig->ext1->maxMIMO_Layers = calloc(1,sizeof(*pdsch_servingcellconfig->ext1->maxMIMO_Layers)); - *pdsch_servingcellconfig->ext1->maxMIMO_Layers = dl_antenna_ports; + *pdsch_servingcellconfig->ext1->maxMIMO_Layers = NR_MAX_SUPPORTED_DL_LAYERS; pdsch_servingcellconfig->ext1->processingType2Enabled = NULL; secondaryCellGroup->spCellConfig->spCellConfigDedicated->csi_MeasConfig=NULL; @@ -411,95 +411,14 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco pucchcsires1->uplinkBandwidthPartId = bwp->bwp_Id; pucchcsires1->pucch_Resource=2; - if (do_csirs && dl_antenna_ports > 1) { - NR_CSI_ReportConfig_t *csirep1 = calloc(1,sizeof(*csirep1)); - csirep1->reportConfigId=bwp->bwp_Id; - csirep1->carrier=NULL; - csirep1->resourcesForChannelMeasurement=bwp->bwp_Id; - csirep1->csi_IM_ResourcesForInterference=calloc(1,sizeof(*csirep1->csi_IM_ResourcesForInterference)); - *csirep1->csi_IM_ResourcesForInterference=bwp->bwp_Id+10; - csirep1->nzp_CSI_RS_ResourcesForInterference=NULL; - csirep1->reportConfigType.present = NR_CSI_ReportConfig__reportConfigType_PR_periodic; - csirep1->reportConfigType.choice.periodic = calloc(1,sizeof(*csirep1->reportConfigType.choice.periodic)); - csirep1->reportConfigType.choice.periodic->reportSlotConfig.present=NR_CSI_ReportPeriodicityAndOffset_PR_slots320; - csirep1->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320 = 9 + (20 * uid) % 320; - ASN_SEQUENCE_ADD(&csirep1->reportConfigType.choice.periodic->pucch_CSI_ResourceList.list,pucchcsires1); - csirep1->reportQuantity.present = NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI; - csirep1->reportQuantity.choice.cri_RI_PMI_CQI=(NULL_t)0; - csirep1->reportFreqConfiguration = calloc(1,sizeof(*csirep1->reportFreqConfiguration)); - csirep1->reportFreqConfiguration->cqi_FormatIndicator = calloc(1,sizeof(*csirep1->reportFreqConfiguration->cqi_FormatIndicator)); - *csirep1->reportFreqConfiguration->cqi_FormatIndicator=NR_CSI_ReportConfig__reportFreqConfiguration__cqi_FormatIndicator_widebandCQI; - csirep1->reportFreqConfiguration->pmi_FormatIndicator = calloc(1,sizeof(*csirep1->reportFreqConfiguration->pmi_FormatIndicator)); - *csirep1->reportFreqConfiguration->pmi_FormatIndicator=NR_CSI_ReportConfig__reportFreqConfiguration__pmi_FormatIndicator_widebandPMI; - csirep1->reportFreqConfiguration->csi_ReportingBand = calloc(1,sizeof(*csirep1->reportFreqConfiguration->csi_ReportingBand)); - csirep1->reportFreqConfiguration->csi_ReportingBand->present = NR_CSI_ReportConfig__reportFreqConfiguration__csi_ReportingBand_PR_subbands7; - csirep1->reportFreqConfiguration->csi_ReportingBand->choice.subbands7.size=1; - csirep1->reportFreqConfiguration->csi_ReportingBand->choice.subbands7.bits_unused=1; - csirep1->reportFreqConfiguration->csi_ReportingBand->choice.subbands7.buf=malloc(1); - csirep1->reportFreqConfiguration->csi_ReportingBand->choice.subbands7.buf[0]=254; - csirep1->timeRestrictionForChannelMeasurements= NR_CSI_ReportConfig__timeRestrictionForChannelMeasurements_configured; - csirep1->timeRestrictionForInterferenceMeasurements=NR_CSI_ReportConfig__timeRestrictionForInterferenceMeasurements_configured; - csirep1->codebookConfig=calloc(1,sizeof(*csirep1->codebookConfig)); - csirep1->codebookConfig->codebookType.present = NR_CodebookConfig__codebookType_PR_type1; - csirep1->codebookConfig->codebookType.choice.type1 = calloc(1,sizeof(*csirep1->codebookConfig->codebookType.choice.type1)); - csirep1->codebookConfig->codebookType.choice.type1->subType.present=NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel; - csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel=calloc(1,sizeof(*csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel)); - struct NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel *singlePanelConfig = csirep1->codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel; - if (dl_antenna_ports == 2) { - singlePanelConfig->nrOfAntennaPorts.present = NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_two; - singlePanelConfig->nrOfAntennaPorts.choice.two = calloc(1,sizeof(*singlePanelConfig->nrOfAntennaPorts.choice.two)); - singlePanelConfig->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.size=1; - singlePanelConfig->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.bits_unused=2; - singlePanelConfig->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.buf=malloc(1); - singlePanelConfig->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.buf[0]=0xfc; - singlePanelConfig->typeI_SinglePanel_ri_Restriction.size=1; - singlePanelConfig->typeI_SinglePanel_ri_Restriction.bits_unused=0; - singlePanelConfig->typeI_SinglePanel_ri_Restriction.buf=malloc(1); - singlePanelConfig->typeI_SinglePanel_ri_Restriction.buf[0]=0x03; - csirep1->codebookConfig->codebookType.choice.type1->codebookMode=1; - } else if (dl_antenna_ports < 16) { - singlePanelConfig->nrOfAntennaPorts.present = NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_moreThanTwo; - singlePanelConfig->nrOfAntennaPorts.choice.moreThanTwo = calloc(1,sizeof(*singlePanelConfig->nrOfAntennaPorts.choice.moreThanTwo)); - if(dl_antenna_ports == 4) - singlePanelConfig->nrOfAntennaPorts.choice.moreThanTwo->n1_n2.present= - NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_two_one_TypeI_SinglePanel_Restriction; - else if(dl_antenna_ports == 8) - singlePanelConfig->nrOfAntennaPorts.choice.moreThanTwo->n1_n2.present= - NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_one_TypeI_SinglePanel_Restriction; - else if(dl_antenna_ports == 12) - singlePanelConfig->nrOfAntennaPorts.choice.moreThanTwo->n1_n2.present= - NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_six_one_TypeI_SinglePanel_Restriction; - else//default - singlePanelConfig->nrOfAntennaPorts.choice.moreThanTwo->n1_n2.present= - NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_two_one_TypeI_SinglePanel_Restriction; - - /*singlePanelConfig->nrOfAntennaPorts.choice.moreThanTwo->n1_n2.choice.two_one_TypeI_SinglePanel_Restriction.size=1; - singlePanelConfig->nrOfAntennaPorts.choice.moreThanTwo->n1_n2.choice.two_one_TypeI_SinglePanel_Restriction.bits_unused=1; - singlePanelConfig->nrOfAntennaPorts.choice.moreThanTwo->n1_n2.choice.two_one_TypeI_SinglePanel_Restriction.buf=malloc(1); - singlePanelConfig->nrOfAntennaPorts.choice.moreThanTwo->n1_n2.choice.two_one_TypeI_SinglePanel_Restriction.buf[0]=0xc0; //'00000011'B - singlePanelConfig->nrOfAntennaPorts.choice.moreThanTwo->typeI_SinglePanel_codebookSubsetRestriction_i2->size = 1; - singlePanelConfig->nrOfAntennaPorts.choice.moreThanTwo->typeI_SinglePanel_codebookSubsetRestriction_i2->bits_unused=1; - singlePanelConfig->nrOfAntennaPorts.choice.moreThanTwo->typeI_SinglePanel_codebookSubsetRestriction_i2->buf=malloc(1); - singlePanelConfig->nrOfAntennaPorts.choice.moreThanTwo->typeI_SinglePanel_codebookSubsetRestriction_i2->buf[0]=0xc0;*/ - csirep1->codebookConfig->codebookType.choice.type1->codebookMode=1; - } else {//32 antennas are Not implemented yet - csirep1->codebookConfig->codebookType.choice.type1->codebookMode=2; - } - csirep1->dummy = NULL; - csirep1->groupBasedBeamReporting.present = NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled; - csirep1->groupBasedBeamReporting.choice.disabled=calloc(1,sizeof(*csirep1->groupBasedBeamReporting.choice.disabled)); - //csirep1->groupBasedBeamReporting.choice.disabled->nrofReportedRS = calloc(1,sizeof(*csirep1->groupBasedBeamReporting.choice.disabled->nrofReportedRS)); - //*csirep1->groupBasedBeamReporting.choice.disabled->nrofReportedRS=NR_CSI_ReportConfig__groupBasedBeamReporting__disabled__nrofReportedRS_n1; - csirep1->cqi_Table = calloc(1,sizeof(*csirep1->cqi_Table)); - if(bwp->bwp_Dedicated->pdsch_Config->choice.setup->mcs_Table!=NULL) - *csirep1->cqi_Table = NR_CSI_ReportConfig__cqi_Table_table2; - else - *csirep1->cqi_Table = NR_CSI_ReportConfig__cqi_Table_table1; - csirep1->subbandSize = NR_CSI_ReportConfig__subbandSize_value2; - csirep1->non_PMI_PortIndication = NULL; - csirep1->ext1 = NULL; - ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ReportConfigToAddModList->list,csirep1); - } + config_csi_meas_report(csi_MeasConfig, + servingcellconfigcommon, + pucchcsires1, + bwp->bwp_Dedicated->pdsch_Config, + pdschap, + NR_MAX_SUPPORTED_DL_LAYERS, + bwp->bwp_Id, + uid); conig_rsrp_meas_report(csi_MeasConfig, servingcellconfigcommon, pucchcsires1, From 0f4299825830ff0fe984a1be4334fac2dd249dea Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 31 Oct 2022 09:13:37 +0100 Subject: [PATCH 3/7] bugfix --- openair2/RRC/NR/nr_rrc_config.c | 9 ++++++--- openair2/RRC/NR/nr_rrc_proto.h | 5 +++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/openair2/RRC/NR/nr_rrc_config.c b/openair2/RRC/NR/nr_rrc_config.c index 0c4dd0eb71..3f6a0c3374 100644 --- a/openair2/RRC/NR/nr_rrc_config.c +++ b/openair2/RRC/NR/nr_rrc_config.c @@ -1412,8 +1412,9 @@ void config_csi_meas_report(NR_CSI_MeasConfig_t *csi_MeasConfig, } } } - AssertFatal(resource_id>-1,"No resource for CSI measurements found\n"); - AssertFatal(im_id>-1,"No resource for IM measurements found\n"); + // if there are no associated resources, do not configure + if(resource_id < 0 || im_id < 0) + return; csirep->resourcesForChannelMeasurement=resource_id; csirep->csi_IM_ResourcesForInterference=calloc(1,sizeof(*csirep->csi_IM_ResourcesForInterference)); *csirep->csi_IM_ResourcesForInterference=im_id; @@ -1474,7 +1475,9 @@ void conig_rsrp_meas_report(NR_CSI_MeasConfig_t *csi_MeasConfig, } } } - AssertFatal(resource_id>-1,"No resource for RSRP found\n"); + // if there are no associated resources, do not configure + if(resource_id < 0) + return; csirep->resourcesForChannelMeasurement=resource_id; csirep->csi_IM_ResourcesForInterference=NULL; csirep->nzp_CSI_RS_ResourcesForInterference=NULL; diff --git a/openair2/RRC/NR/nr_rrc_proto.h b/openair2/RRC/NR/nr_rrc_proto.h index 0b96fd0120..4fee44419f 100644 --- a/openair2/RRC/NR/nr_rrc_proto.h +++ b/openair2/RRC/NR/nr_rrc_proto.h @@ -31,6 +31,9 @@ * @{ */ +#ifndef __NR_RRC_PROTO_H__ +#define __NR_RRC_PROTO_H__ + #include "RRC/NR/nr_rrc_defs.h" #include "flexran_agent_extern.h" #include "NR_RRCReconfiguration.h" @@ -220,3 +223,5 @@ bool nr_rrc_pdcp_config_asn1_req(const protocol_ctxt_t *const ctxt_pP, LTE_PMCH_InfoList_r9_t *pmch_InfoList_r9, rb_id_t *const defaultDRB, struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list); + +#endif From 1708092aec880bc865b118f385c84b16165a73fd Mon Sep 17 00:00:00 2001 From: francescomani Date: Thu, 3 Nov 2022 14:24:57 +0100 Subject: [PATCH 4/7] assertion to avoid wrong CSI report slot configuration --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 2ff7196679..cbe22dcf36 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -217,6 +217,8 @@ void nr_csi_meas_reporting(int Mod_idP, if ((sched_frame*n_slots_frame + sched_slot - offset)%period != 0) continue; + AssertFatal(is_xlsch_in_slot(RC.nrmac[Mod_idP]->ulsch_slot_bitmap[sched_slot / 64], sched_slot), + "CSI reporting slot %d is not set for an uplink slot\n", sched_slot); LOG_D(NR_MAC, "CSI reporting in frame %d slot %d CSI report ID %ld\n", sched_frame, sched_slot, csirep->reportConfigId); const NR_PUCCH_ResourceSet_t *pucchresset = pucch_Config->resourceSetToAddModList->list.array[1]; // set with formats >1 From 8303ddcf6fbc5f1316e2bf570a69908740dfbd70 Mon Sep 17 00:00:00 2001 From: francescomani Date: Thu, 24 Nov 2022 15:23:41 +0100 Subject: [PATCH 5/7] fixes --- openair2/RRC/NR/MESSAGES/asn1_msg.c | 12 ++++++------ openair2/RRC/NR/nr_rrc_config.c | 18 ++++++++++-------- openair2/RRC/NR/nr_rrc_config.h | 12 ++++++------ openair2/RRC/NR/rrc_gNB_reconfig.c | 12 ++++++------ 4 files changed, 28 insertions(+), 26 deletions(-) diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 5e64a071d8..cbbc81e52b 100755 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -1021,12 +1021,12 @@ void fill_initial_SpCellConfig(int uid, bwp_id, uid); } - conig_rsrp_meas_report(csi_MeasConfig, - scc, - pucchcsires1, - configuration->do_CSIRS, - bwp_id+10, - uid); + config_rsrp_meas_report(csi_MeasConfig, + scc, + pucchcsires1, + configuration->do_CSIRS, + bwp_id+10, + uid); } pdsch_servingcellconfig->codeBlockGroupTransmission = NULL; pdsch_servingcellconfig->xOverhead = NULL; diff --git a/openair2/RRC/NR/nr_rrc_config.c b/openair2/RRC/NR/nr_rrc_config.c index 3f6a0c3374..c7036448f0 100644 --- a/openair2/RRC/NR/nr_rrc_config.c +++ b/openair2/RRC/NR/nr_rrc_config.c @@ -283,7 +283,8 @@ void config_csiim(int do_csirs, int dl_antenna_ports, int curr_bwp, NR_CSI_MeasConfig_t *csi_MeasConfig, int id) { if (do_csirs && dl_antenna_ports > 1) { - csi_MeasConfig->csi_IM_ResourceToAddModList = calloc(1,sizeof(*csi_MeasConfig->csi_IM_ResourceToAddModList)); + if(!csi_MeasConfig->csi_IM_ResourceToAddModList) + csi_MeasConfig->csi_IM_ResourceToAddModList = calloc(1,sizeof(*csi_MeasConfig->csi_IM_ResourceToAddModList)); NR_CSI_IM_Resource_t *imres = calloc(1,sizeof(*imres)); imres->csi_IM_ResourceId = id; NR_NZP_CSI_RS_Resource_t *nzpcsi = NULL; @@ -309,7 +310,8 @@ void config_csiim(int do_csirs, int dl_antenna_ports, int curr_bwp, imres->periodicityAndOffset->present = nzpcsi->periodicityAndOffset->present; set_csiim_offset(imres->periodicityAndOffset, nzpcsi->periodicityAndOffset); ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_IM_ResourceToAddModList->list,imres); - csi_MeasConfig->csi_IM_ResourceSetToAddModList = calloc(1,sizeof(*csi_MeasConfig->csi_IM_ResourceSetToAddModList)); + if(!csi_MeasConfig->csi_IM_ResourceSetToAddModList) + csi_MeasConfig->csi_IM_ResourceSetToAddModList = calloc(1,sizeof(*csi_MeasConfig->csi_IM_ResourceSetToAddModList)); NR_CSI_IM_ResourceSet_t *imset = calloc(1,sizeof(*imset)); imset->csi_IM_ResourceSetId = id; NR_CSI_IM_ResourceId_t *res = calloc(1,sizeof(*res)); @@ -1450,12 +1452,12 @@ void config_csi_meas_report(NR_CSI_MeasConfig_t *csi_MeasConfig, ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ReportConfigToAddModList->list,csirep); } -void conig_rsrp_meas_report(NR_CSI_MeasConfig_t *csi_MeasConfig, - const NR_ServingCellConfigCommon_t *servingcellconfigcommon, - NR_PUCCH_CSI_Resource_t *pucchcsires, - int do_csi, // if rsrp is based on CSI or SSB - int rep_id, - int uid) +void config_rsrp_meas_report(NR_CSI_MeasConfig_t *csi_MeasConfig, + const NR_ServingCellConfigCommon_t *servingcellconfigcommon, + NR_PUCCH_CSI_Resource_t *pucchcsires, + int do_csi, // if rsrp is based on CSI or SSB + int rep_id, + int uid) { NR_CSI_ReportConfig_t *csirep = calloc(1,sizeof(*csirep)); diff --git a/openair2/RRC/NR/nr_rrc_config.h b/openair2/RRC/NR/nr_rrc_config.h index 89bda83680..ada634d50f 100644 --- a/openair2/RRC/NR/nr_rrc_config.h +++ b/openair2/RRC/NR/nr_rrc_config.h @@ -58,12 +58,12 @@ void set_dl_DataToUL_ACK(NR_PUCCH_Config_t *pucch_Config, int min_feedback_time) void set_pucch_power_config(NR_PUCCH_Config_t *pucch_Config, int do_csirs); void scheduling_request_config(const NR_ServingCellConfigCommon_t *scc, NR_PUCCH_Config_t *pucch_Config); -void conig_rsrp_meas_report(NR_CSI_MeasConfig_t *csi_MeasConfig, - const NR_ServingCellConfigCommon_t *servingcellconfigcommon, - NR_PUCCH_CSI_Resource_t *pucchcsires, - int do_csi, - int rep_id, - int uid); +void config_rsrp_meas_report(NR_CSI_MeasConfig_t *csi_MeasConfig, + const NR_ServingCellConfigCommon_t *servingcellconfigcommon, + NR_PUCCH_CSI_Resource_t *pucchcsires, + int do_csi, + int rep_id, + int uid); void config_csi_meas_report(NR_CSI_MeasConfig_t *csi_MeasConfig, const NR_ServingCellConfigCommon_t *servingcellconfigcommon, NR_PUCCH_CSI_Resource_t *pucchcsires, diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index 37f7b14684..7764185d9c 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -419,12 +419,12 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco NR_MAX_SUPPORTED_DL_LAYERS, bwp->bwp_Id, uid); - conig_rsrp_meas_report(csi_MeasConfig, - servingcellconfigcommon, - pucchcsires1, - do_csirs, - bwp->bwp_Id+10, - uid); + config_rsrp_meas_report(csi_MeasConfig, + servingcellconfigcommon, + pucchcsires1, + do_csirs, + bwp->bwp_Id+10, + uid); } secondaryCellGroup->spCellConfig->spCellConfigDedicated->sCellDeactivationTimer=NULL; From 0ab8c8d9762b363f63e5c1ec6b7b4ea5775ec0c0 Mon Sep 17 00:00:00 2001 From: francescomani Date: Tue, 29 Nov 2022 12:26:44 +0100 Subject: [PATCH 6/7] use SSB for reference until we have a better implementation of BWP --- openair2/RRC/NR/nr_rrc_config.c | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/openair2/RRC/NR/nr_rrc_config.c b/openair2/RRC/NR/nr_rrc_config.c index c7036448f0..955bb328d6 100644 --- a/openair2/RRC/NR/nr_rrc_config.c +++ b/openair2/RRC/NR/nr_rrc_config.c @@ -487,8 +487,9 @@ void config_srs(NR_SetupRelease_SRS_Config_t *setup_release_srs_Config, srs_res0->sequenceId = 40; srs_res0->spatialRelationInfo = calloc(1,sizeof(*srs_res0->spatialRelationInfo)); srs_res0->spatialRelationInfo->servingCellId = NULL; - srs_res0->spatialRelationInfo->referenceSignal.present = NR_SRS_SpatialRelationInfo__referenceSignal_PR_csi_RS_Index; - srs_res0->spatialRelationInfo->referenceSignal.choice.csi_RS_Index = 0; + // TODO include CSI as reference signal when BWPs are handled properly + srs_res0->spatialRelationInfo->referenceSignal.present = NR_SRS_SpatialRelationInfo__referenceSignal_PR_ssb_Index; + srs_res0->spatialRelationInfo->referenceSignal.choice.ssb_Index = 0; ASN_SEQUENCE_ADD(&srs_Config->srs_ResourceToAddModList->list,srs_res0); } @@ -728,14 +729,9 @@ void set_pucch_power_config(NR_PUCCH_Config_t *pucch_Config, int do_csirs) { pucch_Config->pucch_PowerControl->pathlossReferenceRSs = calloc(1,sizeof(*pucch_Config->pucch_PowerControl->pathlossReferenceRSs)); struct NR_PUCCH_PathlossReferenceRS *PL_ref_RS = calloc(1,sizeof(*PL_ref_RS)); PL_ref_RS->pucch_PathlossReferenceRS_Id = 0; - if(do_csirs) { - PL_ref_RS->referenceSignal.present = NR_PUCCH_PathlossReferenceRS__referenceSignal_PR_csi_RS_Index; - PL_ref_RS->referenceSignal.choice.csi_RS_Index = 0; - } - else { - PL_ref_RS->referenceSignal.present = NR_PUCCH_PathlossReferenceRS__referenceSignal_PR_ssb_Index; - PL_ref_RS->referenceSignal.choice.ssb_Index = 0; - } + // TODO include CSI as reference signal when BWPs are handled properly + PL_ref_RS->referenceSignal.present = NR_PUCCH_PathlossReferenceRS__referenceSignal_PR_ssb_Index; + PL_ref_RS->referenceSignal.choice.ssb_Index = 0; ASN_SEQUENCE_ADD(&pucch_Config->pucch_PowerControl->pathlossReferenceRSs->list,PL_ref_RS); pucch_Config->pucch_PowerControl->deltaF_PUCCH_f0 = calloc(1,sizeof(*pucch_Config->pucch_PowerControl->deltaF_PUCCH_f0)); @@ -748,14 +744,10 @@ void set_pucch_power_config(NR_PUCCH_Config_t *pucch_Config, int do_csirs) { NR_PUCCH_SpatialRelationInfo_t *pucchspatial = calloc(1,sizeof(*pucchspatial)); pucchspatial->pucch_SpatialRelationInfoId = 1; pucchspatial->servingCellId = NULL; - if(do_csirs) { - pucchspatial->referenceSignal.present = NR_PUCCH_SpatialRelationInfo__referenceSignal_PR_csi_RS_Index; - pucchspatial->referenceSignal.choice.csi_RS_Index = 0; - } - else { - pucchspatial->referenceSignal.present = NR_PUCCH_SpatialRelationInfo__referenceSignal_PR_ssb_Index; - pucchspatial->referenceSignal.choice.ssb_Index = 0; - } + // TODO include CSI as reference signal when BWPs are handled properly + pucchspatial->referenceSignal.present = NR_PUCCH_SpatialRelationInfo__referenceSignal_PR_ssb_Index; + pucchspatial->referenceSignal.choice.ssb_Index = 0; + pucchspatial->pucch_PathlossReferenceRS_Id = PL_ref_RS->pucch_PathlossReferenceRS_Id; pucchspatial->p0_PUCCH_Id = p00->p0_PUCCH_Id; From ba28a365c083fc871e991397ef8d0c8c30128e1f Mon Sep 17 00:00:00 2001 From: francescomani Date: Tue, 6 Dec 2022 09:18:22 +0100 Subject: [PATCH 7/7] clang formatting --- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 1 - .../LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 3 +- openair2/RRC/NR/MESSAGES/asn1_msg.c | 20 +- openair2/RRC/NR/nr_rrc_config.c | 257 ++++++++---------- openair2/RRC/NR/nr_rrc_config.h | 9 +- openair2/RRC/NR/rrc_gNB_reconfig.c | 17 +- 6 files changed, 117 insertions(+), 190 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 34126c852a..adacd952f2 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -2529,7 +2529,6 @@ uint8_t nr_get_csi_measurements(NR_UE_MAC_INST_t *mac, const int n_slots_frame = nr_slots_per_frame[scs]; if (((n_slots_frame*frame + slot - offset)%period) == 0 && pucch_Config) { - LOG_D(NR_MAC, "Preparing CSI report in frame %d slot %d CSI report ID %d\n", frame, slot, csi_report_id); NR_PUCCH_CSI_Resource_t *pucchcsires = csirep->reportConfigType.choice.periodic->pucch_CSI_ResourceList.list.array[0]; NR_PUCCH_ResourceSet_t *pucchresset = pucch_Config->resourceSetToAddModList->list.array[1]; // set with formats >1 diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index cbe22dcf36..a9386e6c23 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -217,8 +217,7 @@ void nr_csi_meas_reporting(int Mod_idP, if ((sched_frame*n_slots_frame + sched_slot - offset)%period != 0) continue; - AssertFatal(is_xlsch_in_slot(RC.nrmac[Mod_idP]->ulsch_slot_bitmap[sched_slot / 64], sched_slot), - "CSI reporting slot %d is not set for an uplink slot\n", sched_slot); + AssertFatal(is_xlsch_in_slot(RC.nrmac[Mod_idP]->ulsch_slot_bitmap[sched_slot / 64], sched_slot), "CSI reporting slot %d is not set for an uplink slot\n", sched_slot); LOG_D(NR_MAC, "CSI reporting in frame %d slot %d CSI report ID %ld\n", sched_frame, sched_slot, csirep->reportConfigId); const NR_PUCCH_ResourceSet_t *pucchresset = pucch_Config->resourceSetToAddModList->list.array[1]; // set with formats >1 diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index cbbc81e52b..56ace08e35 100755 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -984,8 +984,7 @@ void fill_initial_SpCellConfig(int uid, pucchcsires1->uplinkBandwidthPartId=bwp_id; pucchcsires1->pucch_Resource=2; - if(configuration->do_CSIRS) { - + if (configuration->do_CSIRS) { NR_CSI_ResourceConfig_t *csires0 = calloc(1,sizeof(*csires0)); csires0->csi_ResourceConfigId = bwp_id; csires0->csi_RS_ResourceSetList.present = NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB; @@ -1000,7 +999,6 @@ void fill_initial_SpCellConfig(int uid, } if (configuration->do_CSIRS && pdsch_AntennaPorts > 1) { - NR_CSI_ResourceConfig_t *csires2 = calloc(1,sizeof(*csires2)); csires2->csi_ResourceConfigId = bwp_id+10; csires2->csi_RS_ResourceSetList.present = NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_csi_IM_ResourceSetList; @@ -1012,21 +1010,9 @@ void fill_initial_SpCellConfig(int uid, csires2->resourceType = NR_CSI_ResourceConfig__resourceType_periodic; ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ResourceConfigToAddModList->list,csires2); - config_csi_meas_report(csi_MeasConfig, - scc, - pucchcsires1, - pdsch_Config, - &configuration->pdsch_AntennaPorts, - NR_MAX_SUPPORTED_DL_LAYERS, - bwp_id, - uid); + config_csi_meas_report(csi_MeasConfig, scc, pucchcsires1, pdsch_Config, &configuration->pdsch_AntennaPorts, NR_MAX_SUPPORTED_DL_LAYERS, bwp_id, uid); } - config_rsrp_meas_report(csi_MeasConfig, - scc, - pucchcsires1, - configuration->do_CSIRS, - bwp_id+10, - uid); + config_rsrp_meas_report(csi_MeasConfig, scc, pucchcsires1, configuration->do_CSIRS, bwp_id + 10, uid); } pdsch_servingcellconfig->codeBlockGroupTransmission = NULL; pdsch_servingcellconfig->xOverhead = NULL; diff --git a/openair2/RRC/NR/nr_rrc_config.c b/openair2/RRC/NR/nr_rrc_config.c index 955bb328d6..104a936b7c 100644 --- a/openair2/RRC/NR/nr_rrc_config.c +++ b/openair2/RRC/NR/nr_rrc_config.c @@ -283,8 +283,8 @@ void config_csiim(int do_csirs, int dl_antenna_ports, int curr_bwp, NR_CSI_MeasConfig_t *csi_MeasConfig, int id) { if (do_csirs && dl_antenna_ports > 1) { - if(!csi_MeasConfig->csi_IM_ResourceToAddModList) - csi_MeasConfig->csi_IM_ResourceToAddModList = calloc(1,sizeof(*csi_MeasConfig->csi_IM_ResourceToAddModList)); + if (!csi_MeasConfig->csi_IM_ResourceToAddModList) + csi_MeasConfig->csi_IM_ResourceToAddModList = calloc(1, sizeof(*csi_MeasConfig->csi_IM_ResourceToAddModList)); NR_CSI_IM_Resource_t *imres = calloc(1,sizeof(*imres)); imres->csi_IM_ResourceId = id; NR_NZP_CSI_RS_Resource_t *nzpcsi = NULL; @@ -310,8 +310,8 @@ void config_csiim(int do_csirs, int dl_antenna_ports, int curr_bwp, imres->periodicityAndOffset->present = nzpcsi->periodicityAndOffset->present; set_csiim_offset(imres->periodicityAndOffset, nzpcsi->periodicityAndOffset); ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_IM_ResourceToAddModList->list,imres); - if(!csi_MeasConfig->csi_IM_ResourceSetToAddModList) - csi_MeasConfig->csi_IM_ResourceSetToAddModList = calloc(1,sizeof(*csi_MeasConfig->csi_IM_ResourceSetToAddModList)); + if (!csi_MeasConfig->csi_IM_ResourceSetToAddModList) + csi_MeasConfig->csi_IM_ResourceSetToAddModList = calloc(1, sizeof(*csi_MeasConfig->csi_IM_ResourceSetToAddModList)); NR_CSI_IM_ResourceSet_t *imset = calloc(1,sizeof(*imset)); imset->csi_IM_ResourceSetId = id; NR_CSI_IM_ResourceId_t *res = calloc(1,sizeof(*res)); @@ -748,15 +748,13 @@ void set_pucch_power_config(NR_PUCCH_Config_t *pucch_Config, int do_csirs) { pucchspatial->referenceSignal.present = NR_PUCCH_SpatialRelationInfo__referenceSignal_PR_ssb_Index; pucchspatial->referenceSignal.choice.ssb_Index = 0; - pucchspatial->pucch_PathlossReferenceRS_Id = PL_ref_RS->pucch_PathlossReferenceRS_Id; pucchspatial->p0_PUCCH_Id = p00->p0_PUCCH_Id; pucchspatial->closedLoopIndex = NR_PUCCH_SpatialRelationInfo__closedLoopIndex_i0; ASN_SEQUENCE_ADD(&pucch_Config->spatialRelationInfoToAddModList->list,pucchspatial); } -static void set_SR_periodandoffset(NR_SchedulingRequestResourceConfig_t *schedulingRequestResourceConfig, - const NR_ServingCellConfigCommon_t *scc) +static void set_SR_periodandoffset(NR_SchedulingRequestResourceConfig_t *schedulingRequestResourceConfig, const NR_ServingCellConfigCommon_t *scc) { const NR_TDD_UL_DL_Pattern_t *tdd = scc->tdd_UL_DL_ConfigurationCommon ? &scc->tdd_UL_DL_ConfigurationCommon->pattern1 : NULL; int sr_slot = 1; // in FDD SR in slot 1 @@ -1202,91 +1200,74 @@ void set_phr_config(NR_MAC_CellGroupConfig_t *mac_CellGroupConfig) mac_CellGroupConfig->phr_Config->choice.setup->phr_Tx_PowerFactorChange = NR_PHR_Config__phr_Tx_PowerFactorChange_dB1; } -void set_csi_meas_periodicity(const NR_ServingCellConfigCommon_t *scc, - NR_CSI_ReportConfig_t *csirep, - int uid, - bool is_rsrp) +void set_csi_meas_periodicity(const NR_ServingCellConfigCommon_t *scc, NR_CSI_ReportConfig_t *csirep, int uid, bool is_rsrp) { - 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 = slotsperframe[*scc->ssbSubcarrierSpacing]; - const int n_ul_slots_period = tdd ? (tdd->nrofUplinkSlots + (tdd->nrofUplinkSymbols>0)) : - n_slots_frame; + const int n_ul_slots_period = tdd ? (tdd->nrofUplinkSlots + (tdd->nrofUplinkSymbols > 0)) : n_slots_frame; const int n_slots_period = tdd ? n_slots_frame / get_nb_periods_per_frame(tdd->dl_UL_TransmissionPeriodicity) : n_slots_frame; - const int ideal_period = MAX_MOBILES_PER_GNB*2*n_slots_period/n_ul_slots_period; // 2 reports per UE - AssertFatal(ideal_period<320,"Not enough UL slots to accomodate all possible UEs. Need to rework the implementation\n"); + const int ideal_period = MAX_MOBILES_PER_GNB * 2 * n_slots_period / n_ul_slots_period; // 2 reports per UE + AssertFatal(ideal_period < 320, "Not enough UL slots to accomodate all possible UEs. Need to rework the implementation\n"); const int first_ul_slot_period = tdd ? tdd->nrofDownlinkSlots : 0; - const int idx = (uid<<1)+is_rsrp; - const int offset = first_ul_slot_period + idx%n_ul_slots_period + (idx/n_ul_slots_period)*n_slots_period; + const int idx = (uid << 1) + is_rsrp; + const int offset = first_ul_slot_period + idx % n_ul_slots_period + (idx / n_ul_slots_period) * n_slots_period; - if (ideal_period<5) { - csirep->reportConfigType.choice.periodic->reportSlotConfig.present=NR_CSI_ReportPeriodicityAndOffset_PR_slots4; + if (ideal_period < 5) { + csirep->reportConfigType.choice.periodic->reportSlotConfig.present = NR_CSI_ReportPeriodicityAndOffset_PR_slots4; csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots4 = offset; - } - else if (ideal_period<6) { - csirep->reportConfigType.choice.periodic->reportSlotConfig.present=NR_CSI_ReportPeriodicityAndOffset_PR_slots5; + } else if (ideal_period < 6) { + csirep->reportConfigType.choice.periodic->reportSlotConfig.present = NR_CSI_ReportPeriodicityAndOffset_PR_slots5; csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots5 = offset; - } - else if (ideal_period<9) { - csirep->reportConfigType.choice.periodic->reportSlotConfig.present=NR_CSI_ReportPeriodicityAndOffset_PR_slots8; + } else if (ideal_period < 9) { + csirep->reportConfigType.choice.periodic->reportSlotConfig.present = NR_CSI_ReportPeriodicityAndOffset_PR_slots8; csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots8 = offset; - } - else if (ideal_period<11) { - csirep->reportConfigType.choice.periodic->reportSlotConfig.present=NR_CSI_ReportPeriodicityAndOffset_PR_slots10; + } else if (ideal_period < 11) { + csirep->reportConfigType.choice.periodic->reportSlotConfig.present = NR_CSI_ReportPeriodicityAndOffset_PR_slots10; csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots10 = offset; - } - else if (ideal_period<17) { - csirep->reportConfigType.choice.periodic->reportSlotConfig.present=NR_CSI_ReportPeriodicityAndOffset_PR_slots16; + } else if (ideal_period < 17) { + csirep->reportConfigType.choice.periodic->reportSlotConfig.present = NR_CSI_ReportPeriodicityAndOffset_PR_slots16; csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots16 = offset; - } - else if (ideal_period<21) { - csirep->reportConfigType.choice.periodic->reportSlotConfig.present=NR_CSI_ReportPeriodicityAndOffset_PR_slots20; + } else if (ideal_period < 21) { + csirep->reportConfigType.choice.periodic->reportSlotConfig.present = NR_CSI_ReportPeriodicityAndOffset_PR_slots20; csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots20 = offset; - } - else if (ideal_period<41) { - csirep->reportConfigType.choice.periodic->reportSlotConfig.present=NR_CSI_ReportPeriodicityAndOffset_PR_slots40; + } else if (ideal_period < 41) { + csirep->reportConfigType.choice.periodic->reportSlotConfig.present = NR_CSI_ReportPeriodicityAndOffset_PR_slots40; csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots40 = offset; - } - else if (ideal_period<81) { - csirep->reportConfigType.choice.periodic->reportSlotConfig.present=NR_CSI_ReportPeriodicityAndOffset_PR_slots80; + } else if (ideal_period < 81) { + csirep->reportConfigType.choice.periodic->reportSlotConfig.present = NR_CSI_ReportPeriodicityAndOffset_PR_slots80; csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots80 = offset; - } - else if (ideal_period<161) { - csirep->reportConfigType.choice.periodic->reportSlotConfig.present=NR_CSI_ReportPeriodicityAndOffset_PR_slots160; + } else if (ideal_period < 161) { + csirep->reportConfigType.choice.periodic->reportSlotConfig.present = NR_CSI_ReportPeriodicityAndOffset_PR_slots160; csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots160 = offset; - } - else { - csirep->reportConfigType.choice.periodic->reportSlotConfig.present=NR_CSI_ReportPeriodicityAndOffset_PR_slots320; + } else { + csirep->reportConfigType.choice.periodic->reportSlotConfig.present = NR_CSI_ReportPeriodicityAndOffset_PR_slots320; csirep->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320 = offset; } } -void config_csi_codebook(const rrc_pdsch_AntennaPorts_t* antennaports, - const int max_layers, - struct NR_CodebookConfig *codebookConfig) +void config_csi_codebook(const rrc_pdsch_AntennaPorts_t *antennaports, const int max_layers, struct NR_CodebookConfig *codebookConfig) { - const int num_ant_ports = antennaports->N1 * antennaports->N2 * antennaports->XP; codebookConfig->codebookType.present = NR_CodebookConfig__codebookType_PR_type1; - codebookConfig->codebookType.choice.type1 = calloc(1,sizeof(*codebookConfig->codebookType.choice.type1)); + codebookConfig->codebookType.choice.type1 = calloc(1, sizeof(*codebookConfig->codebookType.choice.type1)); // Single panel configuration - codebookConfig->codebookType.choice.type1->subType.present=NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel; - codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel=calloc(1,sizeof(*codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel)); + codebookConfig->codebookType.choice.type1->subType.present = NR_CodebookConfig__codebookType__type1__subType_PR_typeI_SinglePanel; + codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel = calloc(1, sizeof(*codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel)); struct NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel *singlePanelConfig = codebookConfig->codebookType.choice.type1->subType.choice.typeI_SinglePanel; - singlePanelConfig->typeI_SinglePanel_ri_Restriction.size=1; - singlePanelConfig->typeI_SinglePanel_ri_Restriction.bits_unused=0; - singlePanelConfig->typeI_SinglePanel_ri_Restriction.buf=malloc(1); - singlePanelConfig->typeI_SinglePanel_ri_Restriction.buf[0]=(1<typeI_SinglePanel_ri_Restriction.size = 1; + singlePanelConfig->typeI_SinglePanel_ri_Restriction.bits_unused = 0; + singlePanelConfig->typeI_SinglePanel_ri_Restriction.buf = malloc(1); + singlePanelConfig->typeI_SinglePanel_ri_Restriction.buf[0] = (1 << max_layers) - 1; // max_layers bit set to 1 + if (num_ant_ports == 2) { singlePanelConfig->nrOfAntennaPorts.present = NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_two; - singlePanelConfig->nrOfAntennaPorts.choice.two = calloc(1,sizeof(*singlePanelConfig->nrOfAntennaPorts.choice.two)); + singlePanelConfig->nrOfAntennaPorts.choice.two = calloc(1, sizeof(*singlePanelConfig->nrOfAntennaPorts.choice.two)); singlePanelConfig->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.size = 1; singlePanelConfig->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.bits_unused = 2; singlePanelConfig->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.buf = calloc(1, sizeof(uint8_t)); singlePanelConfig->nrOfAntennaPorts.choice.two->twoTX_CodebookSubsetRestriction.buf[0] = 0xfc; // no restriction (all 6 bits enabled) } else { singlePanelConfig->nrOfAntennaPorts.present = NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts_PR_moreThanTwo; - singlePanelConfig->nrOfAntennaPorts.choice.moreThanTwo = calloc(1,sizeof(*singlePanelConfig->nrOfAntennaPorts.choice.moreThanTwo)); + singlePanelConfig->nrOfAntennaPorts.choice.moreThanTwo = calloc(1, sizeof(*singlePanelConfig->nrOfAntennaPorts.choice.moreThanTwo)); struct NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo *moreThanTwo = singlePanelConfig->nrOfAntennaPorts.choice.moreThanTwo; switch (num_ant_ports) { case 4: @@ -1303,23 +1284,18 @@ void config_csi_codebook(const rrc_pdsch_AntennaPorts_t* antennaports, moreThanTwo->n1_n2.choice.two_two_TypeI_SinglePanel_Restriction.size = 8; moreThanTwo->n1_n2.choice.two_two_TypeI_SinglePanel_Restriction.bits_unused = 0; moreThanTwo->n1_n2.choice.two_two_TypeI_SinglePanel_Restriction.buf = calloc(8, sizeof(uint8_t)); - for(int i=0; i<8; i++) + for (int i = 0; i < 8; i++) moreThanTwo->n1_n2.choice.two_two_TypeI_SinglePanel_Restriction.buf[i] = 0xff; // TODO verify the meaning of this parameter - } - else if (antennaports->N1 == 4) { + } else if (antennaports->N1 == 4) { AssertFatal(antennaports->N2 == 1, "N1 and N2 not in accordace with the specifications\n"); moreThanTwo->n1_n2.present = NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_one_TypeI_SinglePanel_Restriction; moreThanTwo->n1_n2.choice.four_one_TypeI_SinglePanel_Restriction.size = 2; moreThanTwo->n1_n2.choice.four_one_TypeI_SinglePanel_Restriction.bits_unused = 0; moreThanTwo->n1_n2.choice.four_one_TypeI_SinglePanel_Restriction.buf = calloc(2, sizeof(uint8_t)); - for(int i=0; i<2; i++) + for (int i = 0; i < 2; i++) moreThanTwo->n1_n2.choice.four_one_TypeI_SinglePanel_Restriction.buf[i] = 0xff; // TODO verify the meaning of this parameter - } - else - AssertFatal(1==0,"N1 %d and N2 %d not supported for %d antenna ports\n", - antennaports->N1, - antennaports->N2, - num_ant_ports); + } else + AssertFatal(1 == 0, "N1 %d and N2 %d not supported for %d antenna ports\n", antennaports->N1, antennaports->N2, num_ant_ports); break; case 12: if (antennaports->N1 == 3) { @@ -1328,120 +1304,109 @@ void config_csi_codebook(const rrc_pdsch_AntennaPorts_t* antennaports, moreThanTwo->n1_n2.choice.three_two_TypeI_SinglePanel_Restriction.size = 12; moreThanTwo->n1_n2.choice.three_two_TypeI_SinglePanel_Restriction.bits_unused = 0; moreThanTwo->n1_n2.choice.three_two_TypeI_SinglePanel_Restriction.buf = calloc(12, sizeof(uint8_t)); - for(int i=0; i<12; i++) + for (int i = 0; i < 12; i++) moreThanTwo->n1_n2.choice.three_two_TypeI_SinglePanel_Restriction.buf[i] = 0xff; // TODO verify the meaning of this parameter - } - else if (antennaports->N1 == 6) { + } else if (antennaports->N1 == 6) { AssertFatal(antennaports->N2 == 1, "N1 and N2 not in accordace with the specifications\n"); moreThanTwo->n1_n2.present = NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_six_one_TypeI_SinglePanel_Restriction; moreThanTwo->n1_n2.choice.six_one_TypeI_SinglePanel_Restriction.size = 3; moreThanTwo->n1_n2.choice.six_one_TypeI_SinglePanel_Restriction.bits_unused = 0; moreThanTwo->n1_n2.choice.six_one_TypeI_SinglePanel_Restriction.buf = calloc(3, sizeof(uint8_t)); - for(int i=0; i<3; i++) + for (int i = 0; i < 3; i++) moreThanTwo->n1_n2.choice.six_one_TypeI_SinglePanel_Restriction.buf[i] = 0xff; // TODO verify the meaning of this parameter - } - else - AssertFatal(1==0,"N1 %d and N2 %d not supported for %d antenna ports\n", - antennaports->N1, - antennaports->N2, - num_ant_ports); + } else + AssertFatal(1 == 0, "N1 %d and N2 %d not supported for %d antenna ports\n", antennaports->N1, antennaports->N2, num_ant_ports); break; - case 16: + case 16: if (antennaports->N1 == 4) { AssertFatal(antennaports->N2 == 2, "N1 and N2 not in accordace with the specifications\n"); moreThanTwo->n1_n2.present = NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_four_two_TypeI_SinglePanel_Restriction; moreThanTwo->n1_n2.choice.four_two_TypeI_SinglePanel_Restriction.size = 16; moreThanTwo->n1_n2.choice.four_two_TypeI_SinglePanel_Restriction.bits_unused = 0; moreThanTwo->n1_n2.choice.four_two_TypeI_SinglePanel_Restriction.buf = calloc(16, sizeof(uint8_t)); - for(int i=0; i<16; i++) + for (int i = 0; i < 16; i++) moreThanTwo->n1_n2.choice.four_two_TypeI_SinglePanel_Restriction.buf[i] = 0xff; // TODO verify the meaning of this parameter - } - else if (antennaports->N1 == 8) { + } else if (antennaports->N1 == 8) { AssertFatal(antennaports->N2 == 1, "N1 and N2 not in accordace with the specifications\n"); moreThanTwo->n1_n2.present = NR_CodebookConfig__codebookType__type1__subType__typeI_SinglePanel__nrOfAntennaPorts__moreThanTwo__n1_n2_PR_eight_one_TypeI_SinglePanel_Restriction; moreThanTwo->n1_n2.choice.eight_one_TypeI_SinglePanel_Restriction.size = 4; moreThanTwo->n1_n2.choice.eight_one_TypeI_SinglePanel_Restriction.bits_unused = 0; moreThanTwo->n1_n2.choice.eight_one_TypeI_SinglePanel_Restriction.buf = calloc(4, sizeof(uint8_t)); - for(int i=0; i<4; i++) + for (int i = 0; i < 4; i++) moreThanTwo->n1_n2.choice.eight_one_TypeI_SinglePanel_Restriction.buf[i] = 0xff; // TODO verify the meaning of this parameter - } - else - AssertFatal(1==0,"N1 %d and N2 %d not supported for %d antenna ports\n", - antennaports->N1, - antennaports->N2, - num_ant_ports); + } else + AssertFatal(1 == 0, "N1 %d and N2 %d not supported for %d antenna ports\n", antennaports->N1, antennaports->N2, num_ant_ports); break; default: - AssertFatal(1==0,"%d antenna ports not supported\n",num_ant_ports); + AssertFatal(1 == 0, "%d antenna ports not supported\n", num_ant_ports); } } - codebookConfig->codebookType.choice.type1->codebookMode=1; + codebookConfig->codebookType.choice.type1->codebookMode = 1; } void config_csi_meas_report(NR_CSI_MeasConfig_t *csi_MeasConfig, const NR_ServingCellConfigCommon_t *servingcellconfigcommon, NR_PUCCH_CSI_Resource_t *pucchcsires, struct NR_SetupRelease_PDSCH_Config *pdsch_Config, - const rrc_pdsch_AntennaPorts_t* antennaports, + const rrc_pdsch_AntennaPorts_t *antennaports, const int max_layers, int rep_id, int uid) { - - NR_CSI_ReportConfig_t *csirep = calloc(1,sizeof(*csirep)); - csirep->reportConfigId=rep_id; - csirep->carrier=NULL; + NR_CSI_ReportConfig_t *csirep = calloc(1, sizeof(*csirep)); + csirep->reportConfigId = rep_id; + csirep->carrier = NULL; int resource_id = -1; int im_id = -1; - for (int csi_list=0; csi_listcsi_ResourceConfigToAddModList->list.count; csi_list++) { + for (int csi_list = 0; csi_list < csi_MeasConfig->csi_ResourceConfigToAddModList->list.count; csi_list++) { NR_CSI_ResourceConfig_t *csires = csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_list]; - if(csires->csi_RS_ResourceSetList.present == NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB) { + if (csires->csi_RS_ResourceSetList.present == NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB) { if (csires->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList) { resource_id = csires->csi_ResourceConfigId; } } - if(csires->csi_RS_ResourceSetList.present == NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_csi_IM_ResourceSetList) { - if(csires->csi_RS_ResourceSetList.choice.csi_IM_ResourceSetList) { + if (csires->csi_RS_ResourceSetList.present == NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_csi_IM_ResourceSetList) { + if (csires->csi_RS_ResourceSetList.choice.csi_IM_ResourceSetList) { im_id = csires->csi_ResourceConfigId; } } } // if there are no associated resources, do not configure - if(resource_id < 0 || im_id < 0) + if (resource_id < 0 || im_id < 0) return; - csirep->resourcesForChannelMeasurement=resource_id; - csirep->csi_IM_ResourcesForInterference=calloc(1,sizeof(*csirep->csi_IM_ResourcesForInterference)); - *csirep->csi_IM_ResourcesForInterference=im_id; - csirep->nzp_CSI_RS_ResourcesForInterference=NULL; + csirep->resourcesForChannelMeasurement = resource_id; + csirep->csi_IM_ResourcesForInterference = calloc(1, sizeof(*csirep->csi_IM_ResourcesForInterference)); + *csirep->csi_IM_ResourcesForInterference = im_id; + csirep->nzp_CSI_RS_ResourcesForInterference = NULL; csirep->reportConfigType.present = NR_CSI_ReportConfig__reportConfigType_PR_periodic; - csirep->reportConfigType.choice.periodic = calloc(1,sizeof(*csirep->reportConfigType.choice.periodic)); + csirep->reportConfigType.choice.periodic = calloc(1, sizeof(*csirep->reportConfigType.choice.periodic)); set_csi_meas_periodicity(servingcellconfigcommon, csirep, uid, false); - ASN_SEQUENCE_ADD(&csirep->reportConfigType.choice.periodic->pucch_CSI_ResourceList.list,pucchcsires); + ASN_SEQUENCE_ADD(&csirep->reportConfigType.choice.periodic->pucch_CSI_ResourceList.list, pucchcsires); csirep->reportQuantity.present = NR_CSI_ReportConfig__reportQuantity_PR_cri_RI_PMI_CQI; - csirep->reportQuantity.choice.cri_RI_PMI_CQI=(NULL_t)0; - csirep->reportFreqConfiguration = calloc(1,sizeof(*csirep->reportFreqConfiguration)); + csirep->reportQuantity.choice.cri_RI_PMI_CQI = (NULL_t)0; + csirep->reportFreqConfiguration = calloc(1, sizeof(*csirep->reportFreqConfiguration)); // Wideband configuration - csirep->reportFreqConfiguration->cqi_FormatIndicator = calloc(1,sizeof(*csirep->reportFreqConfiguration->cqi_FormatIndicator)); - *csirep->reportFreqConfiguration->cqi_FormatIndicator=NR_CSI_ReportConfig__reportFreqConfiguration__cqi_FormatIndicator_widebandCQI; - csirep->reportFreqConfiguration->pmi_FormatIndicator = calloc(1,sizeof(*csirep->reportFreqConfiguration->pmi_FormatIndicator)); - *csirep->reportFreqConfiguration->pmi_FormatIndicator=NR_CSI_ReportConfig__reportFreqConfiguration__pmi_FormatIndicator_widebandPMI; + csirep->reportFreqConfiguration->cqi_FormatIndicator = calloc(1, sizeof(*csirep->reportFreqConfiguration->cqi_FormatIndicator)); + *csirep->reportFreqConfiguration->cqi_FormatIndicator = NR_CSI_ReportConfig__reportFreqConfiguration__cqi_FormatIndicator_widebandCQI; + csirep->reportFreqConfiguration->pmi_FormatIndicator = calloc(1, sizeof(*csirep->reportFreqConfiguration->pmi_FormatIndicator)); + *csirep->reportFreqConfiguration->pmi_FormatIndicator = NR_CSI_ReportConfig__reportFreqConfiguration__pmi_FormatIndicator_widebandPMI; csirep->reportFreqConfiguration->csi_ReportingBand = NULL; - csirep->timeRestrictionForChannelMeasurements= NR_CSI_ReportConfig__timeRestrictionForChannelMeasurements_notConfigured; - csirep->timeRestrictionForInterferenceMeasurements=NR_CSI_ReportConfig__timeRestrictionForInterferenceMeasurements_notConfigured; - csirep->codebookConfig=calloc(1,sizeof(*csirep->codebookConfig)); + csirep->timeRestrictionForChannelMeasurements = NR_CSI_ReportConfig__timeRestrictionForChannelMeasurements_notConfigured; + csirep->timeRestrictionForInterferenceMeasurements = NR_CSI_ReportConfig__timeRestrictionForInterferenceMeasurements_notConfigured; + csirep->codebookConfig = calloc(1, sizeof(*csirep->codebookConfig)); config_csi_codebook(antennaports, max_layers, csirep->codebookConfig); csirep->dummy = NULL; csirep->groupBasedBeamReporting.present = NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled; - csirep->groupBasedBeamReporting.choice.disabled=calloc(1,sizeof(*csirep->groupBasedBeamReporting.choice.disabled)); - csirep->cqi_Table = calloc(1,sizeof(*csirep->cqi_Table)); - if(pdsch_Config->choice.setup->mcs_Table!=NULL) + csirep->groupBasedBeamReporting.choice.disabled = calloc(1, sizeof(*csirep->groupBasedBeamReporting.choice.disabled)); + csirep->cqi_Table = calloc(1, sizeof(*csirep->cqi_Table)); + if (pdsch_Config->choice.setup->mcs_Table != NULL) *csirep->cqi_Table = NR_CSI_ReportConfig__cqi_Table_table2; else *csirep->cqi_Table = NR_CSI_ReportConfig__cqi_Table_table1; csirep->subbandSize = NR_CSI_ReportConfig__subbandSize_value2; csirep->non_PMI_PortIndication = NULL; csirep->ext1 = NULL; - ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ReportConfigToAddModList->list,csirep); + ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ReportConfigToAddModList->list, csirep); } void config_rsrp_meas_report(NR_CSI_MeasConfig_t *csi_MeasConfig, @@ -1451,46 +1416,42 @@ void config_rsrp_meas_report(NR_CSI_MeasConfig_t *csi_MeasConfig, int rep_id, int uid) { - - NR_CSI_ReportConfig_t *csirep = calloc(1,sizeof(*csirep)); - csirep->reportConfigId=rep_id; - csirep->carrier=NULL; + NR_CSI_ReportConfig_t *csirep = calloc(1, sizeof(*csirep)); + csirep->reportConfigId = rep_id; + csirep->carrier = NULL; int resource_id = -1; - for (int csi_list=0; csi_listcsi_ResourceConfigToAddModList->list.count; csi_list++) { + for (int csi_list = 0; csi_list < csi_MeasConfig->csi_ResourceConfigToAddModList->list.count; csi_list++) { NR_CSI_ResourceConfig_t *csires = csi_MeasConfig->csi_ResourceConfigToAddModList->list.array[csi_list]; - if(csires->csi_RS_ResourceSetList.present == NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB) { - if(do_csi) { + if (csires->csi_RS_ResourceSetList.present == NR_CSI_ResourceConfig__csi_RS_ResourceSetList_PR_nzp_CSI_RS_SSB) { + if (do_csi) { if (csires->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->nzp_CSI_RS_ResourceSetList) resource_id = csires->csi_ResourceConfigId; - } - else { + } else { if (csires->csi_RS_ResourceSetList.choice.nzp_CSI_RS_SSB->csi_SSB_ResourceSetList) resource_id = csires->csi_ResourceConfigId; } } } // if there are no associated resources, do not configure - if(resource_id < 0) + if (resource_id < 0) return; - csirep->resourcesForChannelMeasurement=resource_id; - csirep->csi_IM_ResourcesForInterference=NULL; - csirep->nzp_CSI_RS_ResourcesForInterference=NULL; + csirep->resourcesForChannelMeasurement = resource_id; + csirep->csi_IM_ResourcesForInterference = NULL; + csirep->nzp_CSI_RS_ResourcesForInterference = NULL; csirep->reportConfigType.present = NR_CSI_ReportConfig__reportConfigType_PR_periodic; - csirep->reportConfigType.choice.periodic = calloc(1,sizeof(*csirep->reportConfigType.choice.periodic)); + csirep->reportConfigType.choice.periodic = calloc(1, sizeof(*csirep->reportConfigType.choice.periodic)); set_csi_meas_periodicity(servingcellconfigcommon, csirep, uid, true); - ASN_SEQUENCE_ADD(&csirep->reportConfigType.choice.periodic->pucch_CSI_ResourceList.list,pucchcsires); - if(do_csi) { + ASN_SEQUENCE_ADD(&csirep->reportConfigType.choice.periodic->pucch_CSI_ResourceList.list, pucchcsires); + if (do_csi) { csirep->reportQuantity.present = NR_CSI_ReportConfig__reportQuantity_PR_cri_RSRP; - csirep->reportQuantity.choice.cri_RSRP=(NULL_t)0; - } - else { + csirep->reportQuantity.choice.cri_RSRP = (NULL_t)0; + } else { csirep->reportQuantity.present = NR_CSI_ReportConfig__reportQuantity_PR_ssb_Index_RSRP; - csirep->reportQuantity.choice.ssb_Index_RSRP=(NULL_t)0; + csirep->reportQuantity.choice.ssb_Index_RSRP = (NULL_t)0; } csirep->groupBasedBeamReporting.present = NR_CSI_ReportConfig__groupBasedBeamReporting_PR_disabled; - csirep->groupBasedBeamReporting.choice.disabled=calloc(1,sizeof(*csirep->groupBasedBeamReporting.choice.disabled)); - csirep->groupBasedBeamReporting.choice.disabled->nrofReportedRS = calloc(1,sizeof(*csirep->groupBasedBeamReporting.choice.disabled->nrofReportedRS)); - *csirep->groupBasedBeamReporting.choice.disabled->nrofReportedRS=NR_CSI_ReportConfig__groupBasedBeamReporting__disabled__nrofReportedRS_n1; - ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ReportConfigToAddModList->list,csirep); + csirep->groupBasedBeamReporting.choice.disabled = calloc(1, sizeof(*csirep->groupBasedBeamReporting.choice.disabled)); + csirep->groupBasedBeamReporting.choice.disabled->nrofReportedRS = calloc(1, sizeof(*csirep->groupBasedBeamReporting.choice.disabled->nrofReportedRS)); + *csirep->groupBasedBeamReporting.choice.disabled->nrofReportedRS = NR_CSI_ReportConfig__groupBasedBeamReporting__disabled__nrofReportedRS_n1; + ASN_SEQUENCE_ADD(&csi_MeasConfig->csi_ReportConfigToAddModList->list, csirep); } - diff --git a/openair2/RRC/NR/nr_rrc_config.h b/openair2/RRC/NR/nr_rrc_config.h index ada634d50f..7838b1296e 100644 --- a/openair2/RRC/NR/nr_rrc_config.h +++ b/openair2/RRC/NR/nr_rrc_config.h @@ -58,17 +58,12 @@ void set_dl_DataToUL_ACK(NR_PUCCH_Config_t *pucch_Config, int min_feedback_time) void set_pucch_power_config(NR_PUCCH_Config_t *pucch_Config, int do_csirs); void scheduling_request_config(const NR_ServingCellConfigCommon_t *scc, NR_PUCCH_Config_t *pucch_Config); -void config_rsrp_meas_report(NR_CSI_MeasConfig_t *csi_MeasConfig, - const NR_ServingCellConfigCommon_t *servingcellconfigcommon, - NR_PUCCH_CSI_Resource_t *pucchcsires, - int do_csi, - int rep_id, - int uid); +void config_rsrp_meas_report(NR_CSI_MeasConfig_t *csi_MeasConfig, const NR_ServingCellConfigCommon_t *servingcellconfigcommon, NR_PUCCH_CSI_Resource_t *pucchcsires, int do_csi, int rep_id, int uid); void config_csi_meas_report(NR_CSI_MeasConfig_t *csi_MeasConfig, const NR_ServingCellConfigCommon_t *servingcellconfigcommon, NR_PUCCH_CSI_Resource_t *pucchcsires, struct NR_SetupRelease_PDSCH_Config *pdsch_Config, - const rrc_pdsch_AntennaPorts_t* antennaports, + const rrc_pdsch_AntennaPorts_t *antennaports, const int max_layers, int rep_id, int uid); diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index 7764185d9c..9185385252 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -411,21 +411,8 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco pucchcsires1->uplinkBandwidthPartId = bwp->bwp_Id; pucchcsires1->pucch_Resource=2; - config_csi_meas_report(csi_MeasConfig, - servingcellconfigcommon, - pucchcsires1, - bwp->bwp_Dedicated->pdsch_Config, - pdschap, - NR_MAX_SUPPORTED_DL_LAYERS, - bwp->bwp_Id, - uid); - config_rsrp_meas_report(csi_MeasConfig, - servingcellconfigcommon, - pucchcsires1, - do_csirs, - bwp->bwp_Id+10, - uid); - + config_csi_meas_report(csi_MeasConfig, servingcellconfigcommon, pucchcsires1, bwp->bwp_Dedicated->pdsch_Config, pdschap, NR_MAX_SUPPORTED_DL_LAYERS, bwp->bwp_Id, uid); + config_rsrp_meas_report(csi_MeasConfig, servingcellconfigcommon, pucchcsires1, do_csirs, bwp->bwp_Id + 10, uid); } secondaryCellGroup->spCellConfig->spCellConfigDedicated->sCellDeactivationTimer=NULL; secondaryCellGroup->spCellConfig->spCellConfigDedicated->crossCarrierSchedulingConfig=NULL;