From 4856c17770e51837300303dc076571eb9cb64ee0 Mon Sep 17 00:00:00 2001 From: francescomani Date: Thu, 18 Aug 2022 08:50:40 +0200 Subject: [PATCH] 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;