diff --git a/common/utils/nr/nr_common.c b/common/utils/nr/nr_common.c index 9867c879d1..64aabab0a4 100644 --- a/common/utils/nr/nr_common.c +++ b/common/utils/nr/nr_common.c @@ -105,7 +105,6 @@ int get_supported_band_index(int scs, frequency_range_t freq_range, int n_rbs) return (-1); // not found } - // Table 5.2-1 NR operating bands in FR1 & FR2 (3GPP TS 38.101) // Table 5.4.2.3-1 Applicable NR-ARFCN per operating band in FR1 & FR2 (3GPP TS 38.101) // Notes: @@ -179,8 +178,9 @@ const nr_bandentry_t nr_bandtable[] = { {261,27500040,28350000,27500040,28350000, 2,2070833, 120} }; -int get_supported_bw_mhz(frequency_range_t frequency_range, int bw_index) +int get_supported_bw_mhz(frequency_range_t frequency_range, int scs, int nb_rb) { + int bw_index = get_supported_band_index(scs, frequency_range, nb_rb); if (frequency_range == FR1) { switch (bw_index) { case 0 : @@ -232,8 +232,8 @@ bool compare_relative_ul_channel_bw(int nr_band, int scs, int nb_ul, frame_type_ // 38.101-1 section 6.2.2 // Relative channel bandwidth <= 4% for TDD bands and <= 3% for FDD bands int index = get_nr_table_idx(nr_band, scs); - int bw_index = get_supported_band_index(scs, nr_band > 256 ? FR2 : FR1, nb_ul); - int band_size_khz = get_supported_bw_mhz(nr_band > 256 ? FR2 : FR1, bw_index) * 1000; + + int band_size_khz = get_supported_bw_mhz(nr_band > 256 ? FR2 : FR1, scs, nb_ul) * 1000; float limit = frame_type == TDD ? 0.04 : 0.03; float rel_bw = (float) (2 * band_size_khz) / (float) (nr_bandtable[index].ul_max + nr_bandtable[index].ul_min); return rel_bw <= limit; diff --git a/common/utils/nr/nr_common.h b/common/utils/nr/nr_common.h index fb3abd1247..d7628ef2aa 100644 --- a/common/utils/nr/nr_common.h +++ b/common/utils/nr/nr_common.h @@ -206,7 +206,7 @@ uint16_t SL_to_bitmap(int startSymbolIndex, int nrOfSymbols); int get_nb_periods_per_frame(uint8_t tdd_period); long rrc_get_max_nr_csrs(const int max_rbs, long b_SRS); bool compare_relative_ul_channel_bw(int nr_band, int scs, int nb_ul, frame_type_t frame_type); -int get_supported_bw_mhz(frequency_range_t frequency_range, int bw_index); +int get_supported_bw_mhz(frequency_range_t frequency_range, int scs, int nb_rb); int get_supported_band_index(int scs, frequency_range_t freq_range, int n_rbs); void get_samplerate_and_bw(int mu, int n_rb, diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index c688b20e21..0470abcf49 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -515,8 +515,7 @@ void nr_phy_config_request_sim(PHY_VARS_gNB *gNB, } fp->threequarter_fs = 0; - int bw_index = get_supported_band_index(mu, fp->nr_band > 256 ? FR2 : FR1, N_RB_DL); - gNB_config->carrier_config.dl_bandwidth.value = get_supported_bw_mhz(fp->nr_band > 256 ? FR2 : FR1, bw_index); + gNB_config->carrier_config.dl_bandwidth.value = get_supported_bw_mhz(fp->nr_band > 256 ? FR2 : FR1, mu, N_RB_DL); nr_init_frame_parms(gNB_config, fp); diff --git a/openair1/SIMULATION/NR_PHY/pbchsim.c b/openair1/SIMULATION/NR_PHY/pbchsim.c index acfa696b24..f573883b0a 100644 --- a/openair1/SIMULATION/NR_PHY/pbchsim.c +++ b/openair1/SIMULATION/NR_PHY/pbchsim.c @@ -162,8 +162,7 @@ void nr_phy_config_request_sim_pbchsim(PHY_VARS_gNB *gNB, else fp->nr_band = 78; fp->threequarter_fs= 0; - int bw_index = get_supported_band_index(mu, fp->nr_band > 256 ? FR2 : FR1, N_RB_DL); - gNB_config->carrier_config.dl_bandwidth.value = get_supported_bw_mhz(fp->nr_band > 256 ? FR2 : FR1, bw_index); + gNB_config->carrier_config.dl_bandwidth.value = get_supported_bw_mhz(fp->nr_band > 256 ? FR2 : FR1, mu, N_RB_DL); fp->ofdm_offset_divisor = UINT_MAX; nr_init_frame_parms(gNB_config, fp); diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index c5f3daf88f..95da550dd1 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -5158,6 +5158,59 @@ uint16_t nr_get_csi_bitlen(nr_csi_report_t *csi_report_template, uint8_t csi_rep return csi_bitlen; } +bool supported_bw_comparison(int bw_mhz, NR_SupportedBandwidth_t *supported_BW, long *support_90mhz) +{ + if (bw_mhz == 90) + return support_90mhz ? true : false; + switch (supported_BW->present) { + case NR_SupportedBandwidth_PR_fr1 : + switch (supported_BW->choice.fr1) { + case NR_SupportedBandwidth__fr1_mhz5 : + return bw_mhz == 5; + case NR_SupportedBandwidth__fr1_mhz10 : + return bw_mhz == 10; + case NR_SupportedBandwidth__fr1_mhz15 : + return bw_mhz == 15; + case NR_SupportedBandwidth__fr1_mhz20 : + return bw_mhz == 20; + case NR_SupportedBandwidth__fr1_mhz25 : + return bw_mhz == 25; + case NR_SupportedBandwidth__fr1_mhz30 : + return bw_mhz == 30; + case NR_SupportedBandwidth__fr1_mhz40 : + return bw_mhz == 40; + case NR_SupportedBandwidth__fr1_mhz50 : + return bw_mhz == 50; + case NR_SupportedBandwidth__fr1_mhz60 : + return bw_mhz == 60; + case NR_SupportedBandwidth__fr1_mhz80 : + return bw_mhz == 80; + case NR_SupportedBandwidth__fr1_mhz100 : + return bw_mhz == 100; + default : + AssertFatal(false, "Invalid FR1 supported band\n"); + } + break; + case NR_SupportedBandwidth_PR_fr2 : + switch (supported_BW->choice.fr2) { + case NR_SupportedBandwidth__fr2_mhz50 : + return bw_mhz == 50; + case NR_SupportedBandwidth__fr2_mhz100 : + return bw_mhz == 100; + case NR_SupportedBandwidth__fr2_mhz200 : + return bw_mhz == 200; + case NR_SupportedBandwidth__fr2_mhz400 : + return bw_mhz == 400; + default : + AssertFatal(false, "Invalid FR2 supported band\n"); + } + break; + default : + AssertFatal(false, "Invalid BW type\n"); + } + return false; +} + uint16_t compute_PDU_length(uint32_t num_TLV, uint16_t total_length) { uint8_t pdu_length = 8; // 2 bytes PDU_Length + 2 bytes PDU_Index + 4 bytes num_TLV diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h index 60af5706ae..8fce9ee559 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h @@ -33,6 +33,7 @@ #include "NR_MIB.h" #include "NR_CellGroupConfig.h" +#include "NR_UE-NR-Capability.h" #include "nr_mac.h" #include "common/utils/nr/nr_common.h" @@ -316,4 +317,6 @@ uint16_t compute_PDU_length(uint32_t num_TLV, uint16_t total_length); rnti_t nr_get_ra_rnti(uint8_t s_id, uint8_t t_id, uint8_t f_id, uint8_t ul_carrier_id); +bool supported_bw_comparison(int bw_mhz, NR_SupportedBandwidth_t *supported_BW, long *support_90mhz); + #endif diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index 0511573be9..c2f5257981 100644 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -118,10 +118,9 @@ static void config_common_ue_sa(NR_UE_MAC_INST_t *mac, NR_FrequencyInfoDL_SIB_t *frequencyInfoDL = &scc->downlinkConfigCommon.frequencyInfoDL; AssertFatal(frequencyInfoDL->frequencyBandList.list.array[0]->freqBandIndicatorNR, "Field mandatory present for DL in SIB1\n"); mac->nr_band = *frequencyInfoDL->frequencyBandList.list.array[0]->freqBandIndicatorNR; - int bw_index = get_supported_band_index(frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, - mac->nr_band > 256 ? FR2 : FR1, - frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth); - cfg->carrier_config.dl_bandwidth = get_supported_bw_mhz(mac->frequency_range, bw_index); + cfg->carrier_config.dl_bandwidth = get_supported_bw_mhz(mac->frequency_range, + frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, + frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth); uint64_t dl_bw_khz = (12 * frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth) * (15 << frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing); @@ -140,10 +139,9 @@ static void config_common_ue_sa(NR_UE_MAC_INST_t *mac, NR_FrequencyInfoUL_SIB_t *frequencyInfoUL = &scc->uplinkConfigCommon->frequencyInfoUL; mac->p_Max = frequencyInfoUL->p_Max ? *frequencyInfoUL->p_Max : INT_MIN; - bw_index = get_supported_band_index(frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, - mac->nr_band > 256 ? FR2 : FR1, - frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth); - cfg->carrier_config.uplink_bandwidth = get_supported_bw_mhz(mac->frequency_range, bw_index); + cfg->carrier_config.uplink_bandwidth = get_supported_bw_mhz(mac->frequency_range, + frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, + frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth); if (frequencyInfoUL->absoluteFrequencyPointA == NULL) cfg->carrier_config.uplink_frequency = cfg->carrier_config.dl_frequency; @@ -262,10 +260,9 @@ static void config_common_ue(NR_UE_MAC_INST_t *mac, mac->frame_type = get_frame_type(mac->nr_band, get_softmodem_params()->numerology); mac->frequency_range = mac->nr_band < 256 ? FR1 : FR2; - int bw_index = get_supported_band_index(frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, - mac->nr_band > 256 ? FR2 : FR1, - frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth); - cfg->carrier_config.dl_bandwidth = get_supported_bw_mhz(mac->frequency_range, bw_index); + cfg->carrier_config.dl_bandwidth = get_supported_bw_mhz(mac->frequency_range, + frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, + frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth); cfg->carrier_config.dl_frequency = from_nrarfcn(mac->nr_band, *scc->ssbSubcarrierSpacing, @@ -287,10 +284,9 @@ static void config_common_ue(NR_UE_MAC_INST_t *mac, NR_FrequencyInfoUL_t *frequencyInfoUL = scc->uplinkConfigCommon->frequencyInfoUL; mac->p_Max = frequencyInfoUL->p_Max ? *frequencyInfoUL->p_Max : INT_MIN; - int bw_index = get_supported_band_index(frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, - *frequencyInfoUL->frequencyBandList->list.array[0] > 256 ? FR2 : FR1, - frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth); - cfg->carrier_config.uplink_bandwidth = get_supported_bw_mhz(mac->frequency_range, bw_index); + cfg->carrier_config.uplink_bandwidth = get_supported_bw_mhz(mac->frequency_range, + frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, + frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth); long *UL_pointA = NULL; if (frequencyInfoUL->absoluteFrequencyPointA) @@ -2139,18 +2135,8 @@ static void handle_mac_uecap_info(NR_UE_MAC_INST_t *mac, NR_UE_NR_Capability_t * NR_FeatureSetDownlinkPerCC_t *fs_dl_cc = fs_dlcc_list->list.array[i]; if (mac->current_DL_BWP->scs != fs_dl_cc->supportedSubcarrierSpacingDL) continue; - int uecap_bw_index; - if (fs_dl_cc->supportedBandwidthDL.present == NR_SupportedBandwidth_PR_fr1) { - uecap_bw_index = fs_dl_cc->supportedBandwidthDL.choice.fr1; - // 90 MHz option is indicated by a separate pointer in case indicated supported BW is 100MHz - // so we need to increase the index by 1 unit to point to 100 MHz if not 90MHz - if (uecap_bw_index == NR_SupportedBandwidth__fr1_mhz100 && !fs_dl_cc->channelBW_90mhz) - uecap_bw_index++; - } - else - uecap_bw_index = fs_dl_cc->supportedBandwidthDL.choice.fr2; int dl_bw_mhz = mac->phy_config.config_req.carrier_config.dl_bandwidth; - if (dl_bw_mhz != get_supported_bw_mhz(mac->frequency_range, uecap_bw_index)) + if (!supported_bw_comparison(dl_bw_mhz, &fs_dl_cc->supportedBandwidthDL, fs_dl_cc->channelBW_90mhz)) continue; if (fs_dl_cc->maxNumberMIMO_LayersPDSCH) mac->uecap_maxMIMO_PDSCH_layers = 2 << *fs_dl_cc->maxNumberMIMO_LayersPDSCH; @@ -2162,18 +2148,8 @@ static void handle_mac_uecap_info(NR_UE_MAC_INST_t *mac, NR_UE_NR_Capability_t * NR_FeatureSetUplinkPerCC_t *fs_ul_cc = fs_ulcc_list->list.array[i]; if (mac->current_UL_BWP->scs != fs_ul_cc->supportedSubcarrierSpacingUL) continue; - int uecap_bw_index; - if (fs_ul_cc->supportedBandwidthUL.present == NR_SupportedBandwidth_PR_fr1) { - uecap_bw_index = fs_ul_cc->supportedBandwidthUL.choice.fr1; - // 90 MHz option is indicated by a separate pointer in case indicated supported BW is 100MHz - // so we need to increase the index by 1 unit to point to 100 MHz if not 90MHz - if (uecap_bw_index == NR_SupportedBandwidth__fr1_mhz100 && !fs_ul_cc->channelBW_90mhz) - uecap_bw_index++; - } - else - uecap_bw_index = fs_ul_cc->supportedBandwidthUL.choice.fr2; int ul_bw_mhz = mac->phy_config.config_req.carrier_config.uplink_bandwidth; - if (ul_bw_mhz != get_supported_bw_mhz(mac->frequency_range, uecap_bw_index)) + if (!supported_bw_comparison(ul_bw_mhz, &fs_ul_cc->supportedBandwidthUL, fs_ul_cc->channelBW_90mhz)) continue; if (fs_ul_cc->maxNumberMIMO_LayersNonCB_PUSCH) mac->uecap_maxMIMO_PUSCH_layers_nocb = 1 << *fs_ul_cc->maxNumberMIMO_LayersNonCB_PUSCH; diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue_sl.c b/openair2/LAYER2/NR_MAC_UE/config_ue_sl.c index 73fb6782ae..044ad3b255 100644 --- a/openair2/LAYER2/NR_MAC_UE/config_ue_sl.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue_sl.c @@ -140,10 +140,7 @@ static void sl_prepare_phy_config(int module_id, AssertFatal(carriercfg, "SCS_SpecificCarrier cannot be NULL"); - int bw_index = get_supported_band_index(carriercfg->subcarrierSpacing, - sl_band > 256 ? FR2 : FR1, - carriercfg->carrierBandwidth); - phycfg->sl_carrier_config.sl_bandwidth = get_supported_bw_mhz(FR1, bw_index); + phycfg->sl_carrier_config.sl_bandwidth = get_supported_bw_mhz(FR1, carriercfg->subcarrierSpacing, carriercfg->carrierBandwidth); phycfg->sl_carrier_config.sl_frequency = from_nrarfcn(sl_band,carriercfg->subcarrierSpacing,pointA_ARFCN); // freq in kHz diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 17fb37edba..5d3985b2d3 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -340,11 +340,9 @@ static void config_common(gNB_MAC_INST *nrmac, nr_pdsch_AntennaPorts_t pdsch_Ant // Carrier configuration struct NR_FrequencyInfoDL *frequencyInfoDL = scc->downlinkConfigCommon->frequencyInfoDL; - int bw_index = get_supported_band_index(frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, - *frequencyInfoDL->frequencyBandList.list.array[0] > 256 ? FR2 : FR1, - frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth); - cfg->carrier_config.dl_bandwidth.value = - get_supported_bw_mhz(*frequencyInfoDL->frequencyBandList.list.array[0] > 256 ? FR2 : FR1, bw_index); + cfg->carrier_config.dl_bandwidth.value = get_supported_bw_mhz(*frequencyInfoDL->frequencyBandList.list.array[0] > 256 ? FR2 : FR1, + frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, + frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth); cfg->carrier_config.dl_bandwidth.tl.tag = NFAPI_NR_CONFIG_DL_BANDWIDTH_TAG; // temporary cfg->num_tlv++; LOG_I(NR_MAC, "DL_Bandwidth:%d\n", cfg->carrier_config.dl_bandwidth.value); @@ -370,11 +368,9 @@ static void config_common(gNB_MAC_INST *nrmac, nr_pdsch_AntennaPorts_t pdsch_Ant } } struct NR_FrequencyInfoUL *frequencyInfoUL = scc->uplinkConfigCommon->frequencyInfoUL; - bw_index = get_supported_band_index(frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, - *frequencyInfoUL->frequencyBandList->list.array[0] > 256 ? FR2 : FR1, - frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth); - cfg->carrier_config.uplink_bandwidth.value = - get_supported_bw_mhz(*frequencyInfoUL->frequencyBandList->list.array[0] > 256 ? FR2 : FR1, bw_index); + cfg->carrier_config.uplink_bandwidth.value = get_supported_bw_mhz(*frequencyInfoUL->frequencyBandList->list.array[0] > 256 ? FR2 : FR1, + frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, + frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth); cfg->carrier_config.uplink_bandwidth.tl.tag = NFAPI_NR_CONFIG_UPLINK_BANDWIDTH_TAG; // temporary cfg->num_tlv++; LOG_I(NR_MAC, "DL_Bandwidth:%d\n", cfg->carrier_config.uplink_bandwidth.value); diff --git a/openair2/RRC/NR/nr_rrc_config.c b/openair2/RRC/NR/nr_rrc_config.c index f631563044..b6a5d45ff9 100644 --- a/openair2/RRC/NR/nr_rrc_config.c +++ b/openair2/RRC/NR/nr_rrc_config.c @@ -526,18 +526,12 @@ void set_dl_maxmimolayers(NR_PDSCH_ServingCellConfig_t *pdsch_servingcellconfig, NR_FeatureSets_t *fs = uecap ? uecap->featureSets : NULL; if (fs) { - const int bw_index = get_supported_band_index(scs, freq_range, bw_size); - AssertFatal(bw_index >= 0, "BW corresponding to %d PRBs not found\n", bw_size); + const int bw_mhz = get_supported_bw_mhz(freq_range, scs, bw_size); // go through UL feature sets and look for one with current SCS for (int i = 0; i < fs->featureSetsDownlinkPerCC->list.count; i++) { NR_FeatureSetDownlinkPerCC_t *dl_fs = fs->featureSetsDownlinkPerCC->list.array[i]; - long supported_bw; - if (freq_range == FR1) - supported_bw = dl_fs->supportedBandwidthDL.choice.fr1; - else - supported_bw = dl_fs->supportedBandwidthDL.choice.fr2; if (scs == dl_fs->supportedSubcarrierSpacingDL && - bw_index == supported_bw && + 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); *pdsch_servingcellconfig->ext1->maxMIMO_Layers = NR_MAX_SUPPORTED_DL_LAYERS < ue_supported_layers ? NR_MAX_SUPPORTED_DL_LAYERS : ue_supported_layers; @@ -776,38 +770,42 @@ void prepare_sim_uecap(NR_UE_NR_Capability_t *cap, int numerology, int rbsize, int mcs_table_dl, - int mcs_table_ul) { - + int mcs_table_ul) +{ NR_Phy_Parameters_t *phy_Parameters = &cap->phy_Parameters; int band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; - NR_BandNR_t *nr_bandnr = CALLOC(1,sizeof(NR_BandNR_t)); + NR_BandNR_t *nr_bandnr = calloc(1, sizeof(NR_BandNR_t)); nr_bandnr->bandNR = band; asn1cSeqAdd(&cap->rf_Parameters.supportedBandListNR.list, nr_bandnr); NR_BandNR_t *bandNRinfo = cap->rf_Parameters.supportedBandListNR.list.array[0]; if (mcs_table_ul == 1) { - bandNRinfo->pusch_256QAM = CALLOC(1,sizeof(*bandNRinfo->pusch_256QAM)); + bandNRinfo->pusch_256QAM = calloc(1,sizeof(*bandNRinfo->pusch_256QAM)); *bandNRinfo->pusch_256QAM = NR_BandNR__pusch_256QAM_supported; } if (mcs_table_dl == 1) { const frequency_range_t freq_range = band < 257 ? FR1 : FR2; - int bw = get_supported_band_index(numerology, freq_range, rbsize); if (freq_range == FR2) { - bandNRinfo->pdsch_256QAM_FR2 = CALLOC(1,sizeof(*bandNRinfo->pdsch_256QAM_FR2)); + bandNRinfo->pdsch_256QAM_FR2 = calloc(1, sizeof(*bandNRinfo->pdsch_256QAM_FR2)); *bandNRinfo->pdsch_256QAM_FR2 = NR_BandNR__pdsch_256QAM_FR2_supported; } else{ - phy_Parameters->phy_ParametersFR1 = CALLOC(1,sizeof(*phy_Parameters->phy_ParametersFR1)); + phy_Parameters->phy_ParametersFR1 = calloc(1, sizeof(*phy_Parameters->phy_ParametersFR1)); NR_Phy_ParametersFR1_t *phy_fr1 = phy_Parameters->phy_ParametersFR1; - phy_fr1->pdsch_256QAM_FR1 = CALLOC(1,sizeof(*phy_fr1->pdsch_256QAM_FR1)); + phy_fr1->pdsch_256QAM_FR1 = calloc(1, sizeof(*phy_fr1->pdsch_256QAM_FR1)); *phy_fr1->pdsch_256QAM_FR1 = NR_Phy_ParametersFR1__pdsch_256QAM_FR1_supported; } - cap->featureSets = CALLOC(1,sizeof(*cap->featureSets)); + cap->featureSets = calloc(1, sizeof(*cap->featureSets)); NR_FeatureSets_t *fs=cap->featureSets; - fs->featureSetsDownlinkPerCC = CALLOC(1,sizeof(*fs->featureSetsDownlinkPerCC)); - NR_FeatureSetDownlinkPerCC_t *fs_cc = CALLOC(1,sizeof(NR_FeatureSetDownlinkPerCC_t)); + fs->featureSetsDownlinkPerCC = calloc(1, sizeof(*fs->featureSetsDownlinkPerCC)); + NR_FeatureSetDownlinkPerCC_t *fs_cc = calloc(1, sizeof(*fs_cc)); fs_cc->supportedSubcarrierSpacingDL = numerology; + int bw = get_supported_band_index(numerology, freq_range, rbsize); + if (bw == 10) // 90MHz + fs_cc->channelBW_90mhz = calloc(1, sizeof(*fs_cc->channelBW_90mhz)); + if (bw == 11) // 100MHz + bw--; if(freq_range == FR2) { fs_cc->supportedBandwidthDL.present = NR_SupportedBandwidth_PR_fr2; fs_cc->supportedBandwidthDL.choice.fr2 = bw; @@ -816,12 +814,12 @@ void prepare_sim_uecap(NR_UE_NR_Capability_t *cap, fs_cc->supportedBandwidthDL.present = NR_SupportedBandwidth_PR_fr1; fs_cc->supportedBandwidthDL.choice.fr1 = bw; } - fs_cc->supportedModulationOrderDL = CALLOC(1,sizeof(*fs_cc->supportedModulationOrderDL)); + fs_cc->supportedModulationOrderDL = calloc(1, sizeof(*fs_cc->supportedModulationOrderDL)); *fs_cc->supportedModulationOrderDL = NR_ModulationOrder_qam256; asn1cSeqAdd(&fs->featureSetsDownlinkPerCC->list, fs_cc); } - phy_Parameters->phy_ParametersFRX_Diff = CALLOC(1,sizeof(*phy_Parameters->phy_ParametersFRX_Diff)); + phy_Parameters->phy_ParametersFRX_Diff = calloc(1, sizeof(*phy_Parameters->phy_ParametersFRX_Diff)); phy_Parameters->phy_ParametersFRX_Diff->pucch_F0_2WithoutFH = NULL; } diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 0d745fb798..7e87835f01 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -227,8 +227,7 @@ static int get_ssb_arfcn(const f1ap_served_cell_info_t *cell_info, const NR_MIB_ else AssertFatal(false, "Invalid absoluteFrequencyPointA: %u\n", dl_arfcn); - int bw_index = get_supported_band_index(scs, band > 256 ? FR2 : FR1, get_dl_bw(cell_info)); - int band_size_hz = get_supported_bw_mhz(band > 256 ? FR2 : FR1, bw_index) * 1000 * 1000; + int band_size_hz = get_supported_bw_mhz(band > 256 ? FR2 : FR1, scs, get_dl_bw(cell_info)) * 1000 * 1000; uint32_t ssb_arfcn = to_nrarfcn(band, freqssb, scs, band_size_hz); LOG_D(NR_RRC,