From 1e610af168374a69cebc07fe3ffd014182458399 Mon Sep 17 00:00:00 2001 From: francescomani Date: Tue, 14 Oct 2025 14:23:52 +0200 Subject: [PATCH] taking into account maximum number of layers for PDSCH supported by the UE for TBSlbrm --- .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 8 +++- openair2/LAYER2/NR_MAC_gNB/nr_radio_config.c | 38 ++++++++++--------- openair2/LAYER2/NR_MAC_gNB/nr_radio_config.h | 2 +- 3 files changed, 28 insertions(+), 20 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index fd1cf7f9f3..86eed9d575 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -1113,7 +1113,12 @@ void post_process_dlsch(gNB_MAC_INST *nr_mac, post_process_pdsch_t *pdsch, NR_UE // TODO: verify the case where maxMIMO_Layers is NULL, in which case // in principle maxMIMO_layers should be given by the maximum number of layers // for PDSCH supported by the UE for the serving cell (5.4.2.1 of 38.212) - long maxMIMO_Layers = UE->sc_info.maxMIMO_Layers_PDSCH ? *UE->sc_info.maxMIMO_Layers_PDSCH : 1; + long ue_supp_nl = ue_supported_dl_layers(scc, UE->capability); + long maxMIMO_Layers = UE->sc_info.maxMIMO_Layers_PDSCH ? *UE->sc_info.maxMIMO_Layers_PDSCH : ue_supp_nl; + if (maxMIMO_Layers < 1) { + LOG_D(NR_MAC, "Both maxMIMO_Layers_PDSCH and UE supported layers are not present, defaulting to 1\n"); + maxMIMO_Layers = 1; + } const int nl_tbslbrm = min(maxMIMO_Layers, 4); nfapi_nr_dl_tti_pdsch_pdu_rel15_t *pdsch_pdu = prepare_pdsch_pdu(dl_tti_pdsch_pdu, nr_mac, @@ -1395,5 +1400,4 @@ void nr_schedule_ue_spec(module_id_t module_id, /* PREPROCESSOR */ gNB_mac->pre_processor_dl(gNB_mac, &pdsch); - } diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_radio_config.c b/openair2/LAYER2/NR_MAC_gNB/nr_radio_config.c index dff2f2b663..4ba5cc6fd9 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_radio_config.c +++ b/openair2/LAYER2/NR_MAC_gNB/nr_radio_config.c @@ -585,22 +585,13 @@ static void config_csiim(int do_csirs, } -void set_dl_maxmimolayers(NR_PDSCH_ServingCellConfig_t *pdsch_servingcellconfig, - const NR_ServingCellConfigCommon_t *scc, - const NR_UE_NR_Capability_t *uecap, - int maxMIMO_layers) +long ue_supported_dl_layers(const NR_ServingCellConfigCommon_t *scc, const NR_UE_NR_Capability_t *uecap) { - if(!pdsch_servingcellconfig->ext1) - pdsch_servingcellconfig->ext1=calloc(1,sizeof(*pdsch_servingcellconfig->ext1)); - if(!pdsch_servingcellconfig->ext1->maxMIMO_Layers) - pdsch_servingcellconfig->ext1->maxMIMO_Layers = calloc(1,sizeof(*pdsch_servingcellconfig->ext1->maxMIMO_Layers)); - NR_SCS_SpecificCarrier_t *scs_carrier = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]; int band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; const frequency_range_t freq_range = get_freq_range_from_band(band); const int scs = scs_carrier->subcarrierSpacing; const int bw_size = scs_carrier->carrierBandwidth; - NR_FeatureSets_t *fs = uecap ? uecap->featureSets : NULL; if (fs) { const int bw_mhz = get_supported_bw_mhz(freq_range, get_supported_band_index(scs, freq_range, bw_size)); @@ -610,16 +601,29 @@ void set_dl_maxmimolayers(NR_PDSCH_ServingCellConfig_t *pdsch_servingcellconfig, if (scs == dl_fs->supportedSubcarrierSpacingDL && supported_bw_comparison(bw_mhz, &dl_fs->supportedBandwidthDL, dl_fs->channelBW_90mhz) && dl_fs->maxNumberMIMO_LayersPDSCH) { - long ue_supported_layers = (2 << *dl_fs->maxNumberMIMO_LayersPDSCH); - if (maxMIMO_layers == -1) - *pdsch_servingcellconfig->ext1->maxMIMO_Layers = NR_MAX_SUPPORTED_DL_LAYERS < ue_supported_layers ? NR_MAX_SUPPORTED_DL_LAYERS : ue_supported_layers; - else - *pdsch_servingcellconfig->ext1->maxMIMO_Layers = maxMIMO_layers < ue_supported_layers ? maxMIMO_layers : ue_supported_layers; - return; + return (2 << *dl_fs->maxNumberMIMO_LayersPDSCH); } } } - *pdsch_servingcellconfig->ext1->maxMIMO_Layers = 2; + return -1; +} + +static void set_dl_maxmimolayers(NR_PDSCH_ServingCellConfig_t *pdsch_servingcellconfig, + const NR_ServingCellConfigCommon_t *scc, + const NR_UE_NR_Capability_t *uecap, + int maxMIMO_layers) +{ + if(!pdsch_servingcellconfig->ext1) + pdsch_servingcellconfig->ext1 = calloc(1, sizeof(*pdsch_servingcellconfig->ext1)); + if(!pdsch_servingcellconfig->ext1->maxMIMO_Layers) + pdsch_servingcellconfig->ext1->maxMIMO_Layers = calloc(1, sizeof(*pdsch_servingcellconfig->ext1->maxMIMO_Layers)); + + long l = ue_supported_dl_layers(scc, uecap); + long ue_supported_layers = l > 1 ? l : 2; // min UE supported layers = 2 + if (maxMIMO_layers == -1) + *pdsch_servingcellconfig->ext1->maxMIMO_Layers = min(NR_MAX_SUPPORTED_DL_LAYERS, ue_supported_layers); + else + *pdsch_servingcellconfig->ext1->maxMIMO_Layers = min(maxMIMO_layers, ue_supported_layers); } // TODO: Implement to b_SRS = 1 and b_SRS = 2 diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_radio_config.h b/openair2/LAYER2/NR_MAC_gNB/nr_radio_config.h index 466f18c0de..9a556dc5ea 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_radio_config.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_radio_config.h @@ -134,5 +134,5 @@ NR_CellGroupConfig_t * update_cellGroupConfig_for_BWP_switch(NR_CellGroupConfig_ NR_MeasurementTimingConfiguration_t *get_nr_mtc(uint8_t *buf, uint32_t len); measgap_config_t create_measgap_config(const NR_MeasurementTimingConfiguration_t *mtc, int scs, int min_rxtxtime); int encode_measgap_config(const measgap_config_t *c, uint8_t *buf); - +long ue_supported_dl_layers(const NR_ServingCellConfigCommon_t *scc, const NR_UE_NR_Capability_t *uecap); #endif