From 530b692208b104c7cd98eb78523812d50c26e412 Mon Sep 17 00:00:00 2001 From: francescomani Date: Wed, 11 Feb 2026 18:42:06 +0100 Subject: [PATCH 1/7] simplified version of to_nrarfcn function to remove not necessary checks for band consistency --- common/utils/nr/nr_common.c | 38 +++++-------------- common/utils/nr/nr_common.h | 2 +- openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 2 +- openair1/SIMULATION/NR_PHY/prachsim.c | 6 +-- radio/AW2SORI/oaiori.c | 11 ++---- radio/fhi_72/mplane/yang/create-yang-config.c | 4 +- 6 files changed, 19 insertions(+), 44 deletions(-) diff --git a/common/utils/nr/nr_common.c b/common/utils/nr/nr_common.c index a3a8520c86..1f7c25c2f0 100644 --- a/common/utils/nr/nr_common.c +++ b/common/utils/nr/nr_common.c @@ -595,44 +595,26 @@ void get_delta_arfcn(int i, uint32_t nrarfcn, uint64_t N_OFFs) LOG_E(NR_MAC, "nrarfcn %u is not on the channel raster for step size %lu\n", nrarfcn, nr_bandtable[i].step_size); } -uint32_t to_nrarfcn(int nr_bandP, uint64_t dl_CarrierFreq, uint8_t scs_index, uint32_t bw) +uint32_t to_nrarfcn(uint64_t CarrierFreq) { - uint64_t dl_CarrierFreq_by_1k = dl_CarrierFreq / 1000; - int bw_kHz = bw / 1000; - uint32_t nrarfcn; - int i = get_nr_table_idx(nr_bandP, scs_index); - - LOG_D(NR_MAC, "Searching for nr band %d DL Carrier frequency %llu bw %u\n", nr_bandP, (long long unsigned int)dl_CarrierFreq, bw); - - AssertFatal(dl_CarrierFreq_by_1k >= nr_bandtable[i].dl_min, - "Band %d, bw %u : DL carrier frequency %llu kHz < %llu\n", - nr_bandP, bw, (long long unsigned int)dl_CarrierFreq_by_1k, - (long long unsigned int)nr_bandtable[i].dl_min); - AssertFatal(dl_CarrierFreq_by_1k <= (nr_bandtable[i].dl_max - bw_kHz/2), - "Band %d, dl_CarrierFreq %llu bw %u: DL carrier frequency %llu kHz > %llu\n", - nr_bandP, (long long unsigned int)dl_CarrierFreq,bw, (long long unsigned int)dl_CarrierFreq_by_1k, - (long long unsigned int)(nr_bandtable[i].dl_max - bw_kHz/2)); - + uint64_t CarrierFreq_by_1k = CarrierFreq / 1000; + // FR2 int deltaFglobal = 60; uint32_t N_REF_Offs = 2016667; uint64_t F_REF_Offs_khz = 24250080; - - if (dl_CarrierFreq < 24.25e9) { + // FR1 + if (CarrierFreq < 3e9) { + deltaFglobal = 5; + N_REF_Offs = 0; + F_REF_Offs_khz = 0; + } else if (CarrierFreq < 24.25e9) { deltaFglobal = 15; N_REF_Offs = 600000; F_REF_Offs_khz = 3000000; } - if (dl_CarrierFreq < 3e9) { - deltaFglobal = 5; - N_REF_Offs = 0; - F_REF_Offs_khz = 0; - } // This is equation before Table 5.4.2.1-1 in 38101-1-f30 - // F_REF=F_REF_Offs + deltaF_Global(N_REF-NREF_REF_Offs) - nrarfcn = (((dl_CarrierFreq_by_1k - F_REF_Offs_khz) / deltaFglobal) + N_REF_Offs); - //get_delta_arfcn(i, nrarfcn, nr_bandtable[i].N_OFFs_DL); - + uint32_t nrarfcn = (((CarrierFreq_by_1k - F_REF_Offs_khz) / deltaFglobal) + N_REF_Offs); return nrarfcn; } diff --git a/common/utils/nr/nr_common.h b/common/utils/nr/nr_common.h index ca867fa694..3d9f5fbc7e 100644 --- a/common/utils/nr/nr_common.h +++ b/common/utils/nr/nr_common.h @@ -287,7 +287,7 @@ static inline void warn_higher_threequarter_fs(const int n_rb, const int mu) } uint64_t from_nrarfcn(int nr_bandP, uint8_t scs_index, uint32_t dl_nrarfcn); -uint32_t to_nrarfcn(int nr_bandP, uint64_t dl_CarrierFreq, uint8_t scs_index, uint32_t bw); +uint32_t to_nrarfcn(uint64_t dl_CarrierFreq); int cce_to_reg_interleaving(const int R, int k, int n_shift, const int C, int L, const int N_regs); int get_SLIV(uint8_t S, uint8_t L); diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index c080076b4a..2da33ce205 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -116,7 +116,7 @@ static uint32_t get_ssb_arfcn(NR_DL_FRAME_PARMS *frame_parms) uint32_t band_size_hz = frame_parms->N_RB_DL * 12 * frame_parms->subcarrier_spacing; int ssb_center_sc = frame_parms->ssb_start_subcarrier + 120; // ssb is 20 PRBs -> 240 sub-carriers uint64_t ssb_freq = frame_parms->dl_CarrierFreq - (band_size_hz / 2) + frame_parms->subcarrier_spacing * ssb_center_sc; - return to_nrarfcn(frame_parms->nr_band, ssb_freq, frame_parms->numerology_index, band_size_hz); + return to_nrarfcn(ssb_freq); } void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind, uint8_t pdu_type, diff --git a/openair1/SIMULATION/NR_PHY/prachsim.c b/openair1/SIMULATION/NR_PHY/prachsim.c index 26bf44da8c..4da1accfe8 100644 --- a/openair1/SIMULATION/NR_PHY/prachsim.c +++ b/openair1/SIMULATION/NR_PHY/prachsim.c @@ -433,11 +433,7 @@ int main(int argc, char **argv){ nr_phy_config_request_sim(gNB, N_RB_UL, N_RB_UL, mu, Nid_cell, SSB_positions); - uint64_t absoluteFrequencyPointA = to_nrarfcn(frame_parms->nr_band, - frame_parms->dl_CarrierFreq, - frame_parms->numerology_index, - frame_parms->N_RB_UL*(180e3)*(1 << frame_parms->numerology_index)); - + uint64_t absoluteFrequencyPointA = to_nrarfcn(frame_parms->dl_CarrierFreq); uint8_t frame = 1; uint8_t subframe = 9; uint8_t slot = 10 * frame_parms->slots_per_subframe - 1; diff --git a/radio/AW2SORI/oaiori.c b/radio/AW2SORI/oaiori.c index b17c7e5dfd..0238595662 100644 --- a/radio/AW2SORI/oaiori.c +++ b/radio/AW2SORI/oaiori.c @@ -417,10 +417,7 @@ int aw2s_startstreaming(openair0_device_t *device) return (0); } -uint32_t to_nrarfcn(int nr_bandP, - uint64_t dl_CarrierFreq, - uint8_t scs_index, - uint32_t bw); +uint32_t to_nrarfcn(uint64_t dl_CarrierFreq); int aw2s_oriinit(openair0_device_t *device) { @@ -543,7 +540,7 @@ int aw2s_oriinit(openair0_device_t *device) txParams.TxNRFDD.axcB = 0; txParams.TxNRFDD.chanBW = openair0_cfg->tx_bw/100e3; - txParams.TxNRFDD.AWS_arfcn = to_nrarfcn(openair0_cfg->nr_band,(long long int)openair0_cfg->tx_freq[0],openair0_cfg->nr_scs_for_raster,(uint32_t)openair0_cfg->tx_bw); + txParams.TxNRFDD.AWS_arfcn = to_nrarfcn((long long int)openair0_cfg->tx_freq[0]); txParams.TxNRFDD.maxTxPwr = 430-((int)openair0_cfg->tx_gain[0]*10); } else if (openair0_cfg->duplex_mode == duplex_mode_TDD && openair0_cfg->nr_flag == 0) { @@ -562,7 +559,7 @@ int aw2s_oriinit(openair0_device_t *device) txParams.TxNRTDD.axcW = 1; txParams.TxNRTDD.axcB = 0; txParams.TxNRTDD.chanBW = openair0_cfg->tx_bw/100e3; - txParams.TxNRTDD.AWS_arfcn = to_nrarfcn(openair0_cfg->nr_band,(long long int)openair0_cfg->tx_freq[0],openair0_cfg->nr_scs_for_raster,(uint32_t)openair0_cfg->tx_bw); + txParams.TxNRTDD.AWS_arfcn = to_nrarfcn((long long int)openair0_cfg->tx_freq[0]); txParams.TxNRTDD.maxTxPwr = 430-((int)openair0_cfg->tx_gain[0]*10); printf("AW2S: Configuring for NR TDD, NRARFCN %u, Power %d, BW %d\n", @@ -678,7 +675,7 @@ int aw2s_oriinit(openair0_device_t *device) rxParams.RxNRFDD.axcW = 1; rxParams.RxNRFDD.axcB = 0; rxParams.RxNRFDD.chanBW = txParams.TxNRFDD.chanBW; - rxParams.RxNRFDD.AWS_arfcn = to_nrarfcn(openair0_cfg->nr_band,(long long int)openair0_cfg->rx_freq[0],openair0_cfg->nr_scs_for_raster,openair0_cfg->rx_bw); + rxParams.RxNRFDD.AWS_arfcn = to_nrarfcn((long long int)openair0_cfg->rx_freq[0]); result = ORI_ObjectCreation(ori, rxTypeRef, rxParams, rxParamList, num_rxparams, rxParamResult, &rx0, &RE_result); } else if (openair0_cfg->duplex_mode == duplex_mode_TDD && openair0_cfg->nr_flag == 0) { diff --git a/radio/fhi_72/mplane/yang/create-yang-config.c b/radio/fhi_72/mplane/yang/create-yang-config.c index 8f35888797..69b180bde2 100644 --- a/radio/fhi_72/mplane/yang/create-yang-config.c +++ b/radio/fhi_72/mplane/yang/create-yang-config.c @@ -248,7 +248,7 @@ static bool create_uplane_conf_v2(const ru_session_t *ru_session, const openair0 VERIFY_SUCCESS(ret == LY_SUCCESS, "[MPLANE] Failed to create \"center-of-channel-bandwidth\" node.\n"); char rx_arfcn[16]; - snprintf(rx_arfcn, sizeof(rx_arfcn), "%d", to_nrarfcn(oai->nr_band, oai->rx_freq[0], oai->nr_scs_for_raster, oai->rx_bw)); + snprintf(rx_arfcn, sizeof(rx_arfcn), "%d", to_nrarfcn(oai->rx_freq[0])); ret = lyd_new_term(rx_carrier_node, NULL, "absolute-frequency-center", rx_arfcn, 0, NULL); VERIFY_SUCCESS(ret == LY_SUCCESS, "[MPLANE] Failed to create \"absolute-frequency-center\" node.\n"); @@ -290,7 +290,7 @@ static bool create_uplane_conf_v2(const ru_session_t *ru_session, const openair0 VERIFY_SUCCESS(ret == LY_SUCCESS, "[MPLANE] Failed to create \"center-of-channel-bandwidth\" node.\n"); char tx_arfcn[16]; - snprintf(tx_arfcn, sizeof(tx_arfcn), "%d", to_nrarfcn(oai->nr_band, oai->tx_freq[0], oai->nr_scs_for_raster, oai->tx_bw)); + snprintf(tx_arfcn, sizeof(tx_arfcn), "%d", to_nrarfcn(oai->tx_freq[0])); ret = lyd_new_term(tx_carrier_node, NULL, "absolute-frequency-center", tx_arfcn, 0, NULL); VERIFY_SUCCESS(ret == LY_SUCCESS, "[MPLANE] Failed to create \"absolute-frequency-center\" node.\n"); From 0219e4d3c738f23509336e4d7d2d1c6350e2e46f Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 12 Feb 2026 10:09:01 +0100 Subject: [PATCH 2/7] Remove band number from openair0_config_t --- executables/nr-ru.c | 5 ++--- radio/COMMON/common_lib.h | 2 -- radio/fhi_72/oran-config.c | 1 - 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 397f940745..b2c3c98741 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -1747,13 +1747,12 @@ static void NRRCconfig_RU(configmodule_interface_t *cfg) for (int i = 0; i < ru->num_bands; i++) ru->band[i] = param[RU_BAND_LIST_IDX].iptr[i]; ru->openair0_cfg.nr_flag = *param[RU_NR_FLAG].iptr; - ru->openair0_cfg.nr_band = ru->band[0]; + // TODO remove band from RU? ru->openair0_cfg.nr_scs_for_raster = *param[RU_NR_SCS_FOR_RASTER].iptr; LOG_D(PHY, - "[RU %d] Setting nr_flag %d, nr_band %d, nr_scs_for_raster %d\n", + "[RU %d] Setting nr_flag %d, nr_scs_for_raster %d\n", j, ru->openair0_cfg.nr_flag, - ru->openair0_cfg.nr_band, ru->openair0_cfg.nr_scs_for_raster); ru->openair0_cfg.rxfh_cores[0] = *param[RU_RXFH_CORE_ID].iptr; ru->openair0_cfg.txfh_cores[0] = *param[RU_TXFH_CORE_ID].iptr; diff --git a/radio/COMMON/common_lib.h b/radio/COMMON/common_lib.h index f21a1ffff4..db15a3967d 100644 --- a/radio/COMMON/common_lib.h +++ b/radio/COMMON/common_lib.h @@ -275,8 +275,6 @@ typedef struct openair0_config { recplay_conf_t *recplay_conf; //! Flag to indicate this configuration is for NR int nr_flag; - //! NR band number - int nr_band; //! NR scs for raster int nr_scs_for_raster; //! Core IDs for RX FH diff --git a/radio/fhi_72/oran-config.c b/radio/fhi_72/oran-config.c index 6f8afc092f..0fac6452e6 100644 --- a/radio/fhi_72/oran-config.c +++ b/radio/fhi_72/oran-config.c @@ -902,7 +902,6 @@ static bool set_fh_config(void *mplane_api, int ru_idx, int num_rus, enum xran_c DevAssert(oai0->rx_freq[0] > 0); for (int i = 1; i < oai0->rx_num_channels; ++i) DevAssert(oai0->rx_freq[0] == oai0->rx_freq[i]); - DevAssert(oai0->nr_band > 0); paramdef_t FHconfigs[] = ORAN_FH_DESC; paramlist_def_t FH_ConfigList = {CONFIG_STRING_ORAN_FH}; char aprefix[MAX_OPTNAME_SIZE] = {0}; From f66a7b2108ebabd89aad6c99367e53e6cffea005 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BAben=20Soares=20Silva?= Date: Thu, 19 Feb 2026 11:27:12 +0000 Subject: [PATCH 3/7] Add SSB Case V3 vendor extension TLV to CONFIG.request pack/unpack and to utility functions --- nfapi/open-nFAPI/fapi/src/nr_fapi_p5.c | 19 +++++++++++++++---- nfapi/open-nFAPI/fapi/src/nr_fapi_p5_utils.c | 8 ++++++++ .../nfapi/public_inc/nfapi_nr_interface.h | 1 + .../nfapi/public_inc/nfapi_nr_interface_scf.h | 12 ++++++------ nfapi/tests/p5/nr_fapi_config_request_test.c | 3 +++ 5 files changed, 33 insertions(+), 10 deletions(-) diff --git a/nfapi/open-nFAPI/fapi/src/nr_fapi_p5.c b/nfapi/open-nFAPI/fapi/src/nr_fapi_p5.c index 9bbda9d519..cfdce8df2d 100644 --- a/nfapi/open-nFAPI/fapi/src/nr_fapi_p5.c +++ b/nfapi/open-nFAPI/fapi/src/nr_fapi_p5.c @@ -1229,6 +1229,14 @@ uint8_t pack_nr_config_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *e // only increase if it was set numTLVs += pNfapiMsg->analog_beamforming_ve.analog_bf_vendor_ext.tl.tag == NFAPI_NR_FAPI_ANALOG_BF_VENDOR_EXTENSION_TAG; + retval &= pack_nr_tlv(NFAPI_NR_FAPI_SSB_CASE_VENDOR_EXTENSION_TAG, + &(pNfapiMsg->ssb_table.case_v3), + ppWritePackedMsg, + end, + &pack_uint8_tlv_value); + + numTLVs += pNfapiMsg->ssb_table.case_v3.tl.tag == NFAPI_NR_FAPI_SSB_CASE_VENDOR_EXTENSION_TAG; + pNfapiMsg->num_tlv = numTLVs; retval &= push8(pNfapiMsg->num_tlv, &pNumTLVFields, end); return retval; @@ -1391,10 +1399,13 @@ uint8_t unpack_nr_config_request(uint8_t **ppReadPackedMsg, uint8_t *end, void * #endif {NFAPI_NR_FAPI_NUM_BEAMS_PERIOD_VENDOR_EXTENSION_TAG, &(pNfapiMsg->analog_beamforming_ve.num_beams_period_vendor_ext), - &unpack_uint8_tlv_value}, - {NFAPI_NR_FAPI_ANALOG_BF_VENDOR_EXTENSION_TAG, - &(pNfapiMsg->analog_beamforming_ve.analog_bf_vendor_ext), - &unpack_uint8_tlv_value}, + &unpack_uint8_tlv_value}, + {NFAPI_NR_FAPI_ANALOG_BF_VENDOR_EXTENSION_TAG, + &(pNfapiMsg->analog_beamforming_ve.analog_bf_vendor_ext), + &unpack_uint8_tlv_value}, + {NFAPI_NR_FAPI_SSB_CASE_VENDOR_EXTENSION_TAG, + &(pNfapiMsg->ssb_table.case_v3), + &unpack_uint8_tlv_value}, {NFAPI_NR_CONFIG_RSSI_MEASUREMENT_TAG, &(pNfapiMsg->measurement_config.rssi_measurement), &unpack_uint8_tlv_value}, {NFAPI_NR_CONFIG_BEAMFORMING_TABLE_TAG, NULL, &unpack_dbt_table_tlv_value}, {NFAPI_NR_CONFIG_PRECODING_TABLE_V6_TAG, NULL, &unpack_pm_table_tlv_value}, diff --git a/nfapi/open-nFAPI/fapi/src/nr_fapi_p5_utils.c b/nfapi/open-nFAPI/fapi/src/nr_fapi_p5_utils.c index 1ef65b664c..953b3bbfc4 100644 --- a/nfapi/open-nFAPI/fapi/src/nr_fapi_p5_utils.c +++ b/nfapi/open-nFAPI/fapi/src/nr_fapi_p5_utils.c @@ -240,6 +240,8 @@ bool eq_config_request(const nfapi_nr_config_request_scf_t *unpacked_req, const EQ_TLV(unpacked_req->ssb_table.ssb_beam_id_list[i].beam_id, req->ssb_table.ssb_beam_id_list[i].beam_id); } + EQ_TLV(unpacked_req->ssb_table.case_v3, req->ssb_table.case_v3); + if (req->cell_config.frame_duplex_type.value == 1 /* TDD */) { EQ_TLV(unpacked_req->tdd_table.tdd_period, req->tdd_table.tdd_period); @@ -786,6 +788,8 @@ void copy_config_request(const nfapi_nr_config_request_scf_t *src, nfapi_nr_conf COPY_TLV(dst->ssb_table.ssb_beam_id_list[i].beam_id, src->ssb_table.ssb_beam_id_list[i].beam_id); } + COPY_TLV(dst->ssb_table.case_v3, src->ssb_table.case_v3); + if (src->cell_config.frame_duplex_type.value == 1 /* TDD */) { COPY_TLV(dst->tdd_table.tdd_period, src->tdd_table.tdd_period); @@ -1225,6 +1229,10 @@ void dump_config_request(const nfapi_nr_config_request_scf_t *msg) depth--; INDENTED_TLV_PRINT("ssPBCH Multiple Carriers in a Band", ssb_table->ss_pbch_multiple_carriers_in_a_band); INDENTED_TLV_PRINT("Multiple Cells ssPBCH in a Carrier", ssb_table->multiple_cells_ss_pbch_in_a_carrier); + // Only print if it's filled + if (ssb_table->case_v3.tl.tag == NFAPI_NR_FAPI_SSB_CASE_VENDOR_EXTENSION_TAG) { + INDENTED_TLV_PRINT("SSB Case V3", ssb_table->case_v3); + } /* TDD Table */ const nfapi_nr_tdd_table_t *tdd_table = &msg->tdd_table; if (cell_config->frame_duplex_type.value == 1 /* TDD */) { diff --git a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface.h b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface.h index 2e74fdc800..70f3c2d67f 100644 --- a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface.h +++ b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface.h @@ -31,6 +31,7 @@ #define NFAPI_NR_NFAPI_TIMING_INFO_PERIOD_TAG 0x0120 #define NFAPI_NR_FAPI_NUM_BEAMS_PERIOD_VENDOR_EXTENSION_TAG 0xA000 #define NFAPI_NR_FAPI_ANALOG_BF_VENDOR_EXTENSION_TAG 0xA001 +#define NFAPI_NR_FAPI_SSB_CASE_VENDOR_EXTENSION_TAG 0xA002 typedef struct { uint16_t phy_id; diff --git a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h index fcd1968c25..b7e1cdee9b 100644 --- a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h +++ b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_nr_interface_scf.h @@ -412,15 +412,15 @@ typedef struct typedef struct { nfapi_uint16_tlv_t ssb_offset_point_a;//Offset of lowest subcarrier of lowest resource block used for SS/PBCH block. Given in PRB [38.211, section 4.4.4.2] Value: 0->2199 - nfapi_uint8_tlv_t beta_pss;//PSS EPRE to SSS EPRE in a SS/PBCH block [38.213, sec 4.1] Values: 0 = 0dB - nfapi_uint8_tlv_t ssb_period;//SSB periodicity in msec Value: 0: ms5 1: ms10 2: ms20 3: ms40 4: ms80 5: ms160 - nfapi_uint8_tlv_t ssb_subcarrier_offset;//ssbSubcarrierOffset or 𝑘𝑆𝑆𝐵 (38.211, section 7.4.3.1) Value: 0->31 + nfapi_uint8_tlv_t beta_pss;//PSS EPRE to SSS EPRE in a SS/PBCH block [38.213, sec 4.1] Values: 0 = 0dB + nfapi_uint8_tlv_t ssb_period;//SSB periodicity in msec Value: 0: ms5 1: ms10 2: ms20 3: ms40 4: ms80 5: ms160 + nfapi_uint8_tlv_t ssb_subcarrier_offset;//ssbSubcarrierOffset or 𝑘𝑆𝑆𝐵 (38.211, section 7.4.3.1) Value: 0->31 nfapi_uint32_tlv_t MIB;//MIB payload, where the 24 MSB are used and represent the MIB in [38.331 MIB IE] and represent 0 1 2 3 1 , , , ,..., A− a a a a a [38.212, sec 7.1.1] nfapi_nr_ssb_mask_list_t ssb_mask_list[2]; nfapi_nr_ssb_beam_id_list_t ssb_beam_id_list[64]; - nfapi_uint8_tlv_t ss_pbch_multiple_carriers_in_a_band;//0 = disabled 1 = enabled - nfapi_uint8_tlv_t multiple_cells_ss_pbch_in_a_carrier;//Indicates that multiple cells will be supported in a single carrier 0 = disabled 1 = enabled - + nfapi_uint8_tlv_t ss_pbch_multiple_carriers_in_a_band;//0 = disabled 1 = enabled + nfapi_uint8_tlv_t multiple_cells_ss_pbch_in_a_carrier;//Indicates that multiple cells will be supported in a single carrier 0 = disabled 1 = enabled + nfapi_uint8_tlv_t case_v3; } nfapi_nr_ssb_table_t; //table 3-26 diff --git a/nfapi/tests/p5/nr_fapi_config_request_test.c b/nfapi/tests/p5/nr_fapi_config_request_test.c index ed57a64d62..0564e9e8a3 100644 --- a/nfapi/tests/p5/nr_fapi_config_request_test.c +++ b/nfapi/tests/p5/nr_fapi_config_request_test.c @@ -176,6 +176,9 @@ static void fill_config_request_tlv_tdd_rand(nfapi_nr_config_request_scf_t *nfap nfapi_resp->num_tlv++; } + FILL_TLV(nfapi_resp->ssb_table.case_v3, NFAPI_NR_FAPI_SSB_CASE_VENDOR_EXTENSION_TAG, rand8()); + nfapi_resp->num_tlv++; + FILL_TLV(nfapi_resp->tdd_table.tdd_period, NFAPI_NR_CONFIG_TDD_PERIOD_TAG, 6 /* ms5 */); nfapi_resp->num_tlv++; From 5ed309166b4e8d71a4f3566b7354fb98fdf2e754 Mon Sep 17 00:00:00 2001 From: francescomani Date: Fri, 13 Feb 2026 17:37:33 +0100 Subject: [PATCH 4/7] use FAPI field to set SSB case from upper layers --- common/utils/nr/nr_common.c | 26 +++++ common/utils/nr/nr_common.h | 2 +- .../nfapi/public_inc/fapi_nr_ue_interface.h | 12 +- openair1/PHY/INIT/nr_parms.c | 106 ++---------------- openair2/LAYER2/NR_MAC_UE/config_ue.c | 2 + openair2/LAYER2/NR_MAC_gNB/config.c | 20 ++-- 6 files changed, 55 insertions(+), 113 deletions(-) diff --git a/common/utils/nr/nr_common.c b/common/utils/nr/nr_common.c index 1f7c25c2f0..aba54a07ef 100644 --- a/common/utils/nr/nr_common.c +++ b/common/utils/nr/nr_common.c @@ -152,6 +152,32 @@ int get_smallest_supported_bandwidth_index(int scs, frequency_range_t frequency_ return -1; // not found } +// Table 5.4.3.3-1 38-101 +uint8_t set_ssb_case(int scs, int nr_band) +{ + uint8_t ssb_case = 0; + switch (scs) { + case 0: + ssb_case = 0; // case A + break; + case 1: + if (nr_band == 5 || nr_band == 24 || nr_band == 66 || nr_band == 255) + ssb_case = 1; // case B + else + ssb_case = 2; // case C + break; + case 3: + ssb_case = 3; // case D + break; + case 4: + ssb_case = 4; // case E + break; + default: + AssertFatal(false, "Invalid sub-carrier spacing for SSB\n"); + } + return ssb_case; +} + // Table 5.2-1 NR operating bands in FR1 & FR2 (3GPP TS 38.101) (Rel.17) // Table 5.4.2.3-1 Applicable NR-ARFCN per operating band in FR1 & FR2 (3GPP TS 38.101) // Notes: diff --git a/common/utils/nr/nr_common.h b/common/utils/nr/nr_common.h index 3d9f5fbc7e..93e3296e67 100644 --- a/common/utils/nr/nr_common.h +++ b/common/utils/nr/nr_common.h @@ -288,7 +288,7 @@ static inline void warn_higher_threequarter_fs(const int n_rb, const int mu) uint64_t from_nrarfcn(int nr_bandP, uint8_t scs_index, uint32_t dl_nrarfcn); uint32_t to_nrarfcn(uint64_t dl_CarrierFreq); - +uint8_t set_ssb_case(int scs, int nr_band); int cce_to_reg_interleaving(const int R, int k, int n_shift, const int C, int L, const int N_regs); int get_SLIV(uint8_t S, uint8_t L); void get_coreset_rballoc(const uint8_t *FreqDomainResource, int *n_rb, int *rb_offset); diff --git a/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h b/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h index 481f704da1..1b1b31d74d 100644 --- a/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h +++ b/nfapi/open-nFAPI/nfapi/public_inc/fapi_nr_ue_interface.h @@ -675,15 +675,15 @@ typedef struct typedef struct { uint16_t ssb_offset_point_a;//Offset of lowest subcarrier of lowest resource block used for SS/PBCH block. Given in PRB [38.211, section 4.4.4.2] Value: 0->2199 - uint8_t beta_pss;//PSS EPRE to SSS EPRE in a SS/PBCH block [38.213, sec 4.1] Values: 0 = 0dB - uint8_t ssb_period;//SSB periodicity in msec Value: 0: ms5 1: ms10 2: ms20 3: ms40 4: ms80 5: ms160 - uint8_t ssb_subcarrier_offset;//ssbSubcarrierOffset or 𝑘𝑆𝑆𝐵 (38.211, section 7.4.3.1) Value: 0->31 + uint8_t beta_pss;//PSS EPRE to SSS EPRE in a SS/PBCH block [38.213, sec 4.1] Values: 0 = 0dB + uint8_t ssb_period;//SSB periodicity in msec Value: 0: ms5 1: ms10 2: ms20 3: ms40 4: ms80 5: ms160 + uint8_t ssb_subcarrier_offset;//ssbSubcarrierOffset or 𝑘𝑆𝑆𝐵 (38.211, section 7.4.3.1) Value: 0->31 uint32_t MIB;//MIB payload, where the 24 MSB are used and represent the MIB in [38.331 MIB IE] and represent 0 1 2 3 1 , , , ,..., A− a a a a a [38.212, sec 7.1.1] fapi_nr_ssb_mask_size_2_t ssb_mask_list[2]; fapi_nr_ssb_mask_size_64_t* ssb_beam_id_list;//64 - uint8_t ss_pbch_multiple_carriers_in_a_band;//0 = disabled 1 = enabled - uint8_t multiple_cells_ss_pbch_in_a_carrier;//Indicates that multiple cells will be supported in a single carrier 0 = disabled 1 = enabled - + uint8_t ss_pbch_multiple_carriers_in_a_band;//0 = disabled 1 = enabled + uint8_t multiple_cells_ss_pbch_in_a_carrier;//Indicates that multiple cells will be supported in a single carrier 0 = disabled 1 = enabled + uint8_t ssb_case; // 0: case A 1: case B 2: case C 3: case D 4: case E } fapi_nr_ssb_table_t; typedef struct diff --git a/openair1/PHY/INIT/nr_parms.c b/openair1/PHY/INIT/nr_parms.c index d6043775af..f49493cb32 100644 --- a/openair1/PHY/INIT/nr_parms.c +++ b/openair1/PHY/INIT/nr_parms.c @@ -29,73 +29,6 @@ static const uint32_t nr_subcarrier_spacing[MAX_NUM_SUBCARRIER_SPACING] = {15e3, 30e3, 60e3, 120e3, 240e3}; static const uint16_t nr_slots_per_subframe[MAX_NUM_SUBCARRIER_SPACING] = {1, 2, 4, 8, 16}; -// Table 5.4.3.3-1 38-101 -static const int nr_ssb_table[][3] = { - {1, 15, nr_ssb_type_A}, - {2, 15, nr_ssb_type_A}, - {3, 15, nr_ssb_type_A}, - {5, 15, nr_ssb_type_A}, - {5, 30, nr_ssb_type_B}, - {7, 15, nr_ssb_type_A}, - {8, 15, nr_ssb_type_A}, - {12, 15, nr_ssb_type_A}, - {13, 15, nr_ssb_type_A}, - {14, 15, nr_ssb_type_A}, - {18, 15, nr_ssb_type_A}, - {20, 15, nr_ssb_type_A}, - {24, 15, nr_ssb_type_A}, - {24, 30, nr_ssb_type_B}, - {25, 15, nr_ssb_type_A}, - {26, 15, nr_ssb_type_A}, - {28, 15, nr_ssb_type_A}, - {29, 15, nr_ssb_type_A}, - {30, 15, nr_ssb_type_A}, - {34, 15, nr_ssb_type_A}, - {34, 30, nr_ssb_type_C}, - {38, 15, nr_ssb_type_A}, - {38, 30, nr_ssb_type_C}, - {39, 15, nr_ssb_type_A}, - {39, 30, nr_ssb_type_C}, - {40, 30, nr_ssb_type_C}, - {41, 15, nr_ssb_type_A}, - {41, 30, nr_ssb_type_C}, - {46, 30, nr_ssb_type_C}, - {48, 30, nr_ssb_type_C}, - {50, 30, nr_ssb_type_C}, - {51, 15, nr_ssb_type_A}, - {53, 15, nr_ssb_type_A}, - {53, 30, nr_ssb_type_C}, - {65, 15, nr_ssb_type_A}, - {66, 15, nr_ssb_type_A}, - {66, 30, nr_ssb_type_B}, - {67, 15, nr_ssb_type_A}, - {70, 15, nr_ssb_type_A}, - {71, 15, nr_ssb_type_A}, - {74, 15, nr_ssb_type_A}, - {75, 15, nr_ssb_type_A}, - {76, 15, nr_ssb_type_A}, - {77, 30, nr_ssb_type_C}, - {78, 30, nr_ssb_type_C}, - {79, 30, nr_ssb_type_C}, - {85, 15, nr_ssb_type_A}, - {90, 15, nr_ssb_type_A}, - {90, 30, nr_ssb_type_C}, - {91, 15, nr_ssb_type_A}, - {92, 15, nr_ssb_type_A}, - {93, 15, nr_ssb_type_A}, - {94, 15, nr_ssb_type_A}, - {96, 30, nr_ssb_type_C}, - {100, 15, nr_ssb_type_A}, - {101, 15, nr_ssb_type_A}, - {101, 30, nr_ssb_type_C}, - {102, 30, nr_ssb_type_C}, - {104, 30, nr_ssb_type_C}, - {254, 15, nr_ssb_type_A}, - {254, 30, nr_ssb_type_C}, - {255, 15, nr_ssb_type_A}, - {255, 30, nr_ssb_type_B}, - {256, 15, nr_ssb_type_A}}; - void set_Lmax(NR_DL_FRAME_PARMS *fp) { // definition of Lmax according to ts 38.213 section 4.1 if (fp->dl_CarrierFreq < 6e9) { @@ -150,55 +83,34 @@ int nr_get_ssb_start_symbol(const NR_DL_FRAME_PARMS *fp, uint8_t i_ssb) return symbol; } -void set_scs_parameters (NR_DL_FRAME_PARMS *fp, int mu, int N_RB_DL) +static void set_scs_parameters(NR_DL_FRAME_PARMS *fp, int mu, int N_RB_DL, int ssb_case) { - int idx = 0; switch(mu) { case NR_MU_0: //15kHz scs fp->subcarrier_spacing = nr_subcarrier_spacing[NR_MU_0]; fp->slots_per_subframe = nr_slots_per_subframe[NR_MU_0]; - fp->ssb_type = nr_ssb_type_A; - while (nr_ssb_table[idx][0] != fp->nr_band) - idx++; - AssertFatal(nr_ssb_table[idx][1] == 15,"SCS %d not applicable to band %d\n", - fp->subcarrier_spacing,fp->nr_band); break; - case NR_MU_1: //30kHz scs fp->subcarrier_spacing = nr_subcarrier_spacing[NR_MU_1]; fp->slots_per_subframe = nr_slots_per_subframe[NR_MU_1]; - while(nr_ssb_table[idx][0] != fp->nr_band || - nr_ssb_table[idx][1] != 30) { - AssertFatal(nr_ssb_table[idx][0] <= fp->nr_band, - "SCS %d not applicable to band %d\n", - fp->subcarrier_spacing, - fp->nr_band); - idx++; - } - fp->ssb_type = nr_ssb_table[idx][2]; break; - case NR_MU_2: //60kHz scs fp->subcarrier_spacing = nr_subcarrier_spacing[NR_MU_2]; fp->slots_per_subframe = nr_slots_per_subframe[NR_MU_2]; break; - case NR_MU_3: fp->subcarrier_spacing = nr_subcarrier_spacing[NR_MU_3]; fp->slots_per_subframe = nr_slots_per_subframe[NR_MU_3]; - fp->ssb_type = nr_ssb_type_D; break; - case NR_MU_4: fp->subcarrier_spacing = nr_subcarrier_spacing[NR_MU_4]; fp->slots_per_subframe = nr_slots_per_subframe[NR_MU_4]; - fp->ssb_type = nr_ssb_type_E; break; - default: - AssertFatal(1==0,"Invalid numerology index %d", mu); + AssertFatal(false, "Invalid numerology index %d", mu); } + fp->ssb_type = ssb_case; // Start with FFT size 512 fp->ofdm_symbol_size = 512; @@ -231,7 +143,7 @@ void set_scs_parameters (NR_DL_FRAME_PARMS *fp, int mu, int N_RB_DL) fp->ofdm_symbol_size); } -void sl_set_scs_parameters (NR_DL_FRAME_PARMS *fp, int mu, int N_RB_SL) +void sl_set_scs_parameters(NR_DL_FRAME_PARMS *fp, int mu, int N_RB_SL) { AssertFatal(mu >= NR_MU_0 && mu <= NR_MU_4,"Invalid numerology index %d", mu); @@ -402,7 +314,7 @@ void nr_init_frame_parms(nfapi_nr_config_request_scf_t* cfg, NR_DL_FRAME_PARMS * fp->half_frame_bit = 0; // half frame bit initialized to 0 here fp->numerology_index = mu; - set_scs_parameters(fp, mu, fp->N_RB_DL); + set_scs_parameters(fp, mu, fp->N_RB_DL, cfg->ssb_table.case_v3.value); fp->slots_per_frame = 10* fp->slots_per_subframe; @@ -435,9 +347,7 @@ void nr_init_frame_parms(nfapi_nr_config_request_scf_t* cfg, NR_DL_FRAME_PARMS * fp->print_ue_help_cmdline_log = true; } -int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp, - fapi_nr_config_request_t* config, - uint16_t nr_band) +int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp, fapi_nr_config_request_t* config, uint16_t nr_band) { uint8_t nb_ant_ports_gNB = 1; @@ -488,7 +398,7 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp, fp->Ncp = Ncp; int N_RB = fp->N_RB_DL; - set_scs_parameters(fp, fp->numerology_index, N_RB); + set_scs_parameters(fp, fp->numerology_index, N_RB, config->ssb_table.ssb_case); fp->slots_per_frame = 10* fp->slots_per_subframe; fp->symbols_per_slot = ((Ncp == NORMAL)? 14 : 12); // to redefine for different slot formats @@ -553,7 +463,7 @@ void nr_init_frame_parms_ue_sa(NR_DL_FRAME_PARMS *frame_parms, const nrUE_cell_p frame_parms->frame_type = get_frame_type(frame_parms->nr_band, frame_parms->numerology_index); frame_parms->Ncp = NORMAL; - set_scs_parameters(frame_parms, frame_parms->numerology_index, frame_parms->N_RB_DL); + set_scs_parameters(frame_parms, frame_parms->numerology_index, frame_parms->N_RB_DL, set_ssb_case(mu, nr_band)); set_Lmax(frame_parms); frame_parms->slots_per_frame = 10* frame_parms->slots_per_subframe; diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index b3195894a4..053908e8de 100644 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -229,6 +229,7 @@ static void config_common_ue_sa(NR_UE_MAC_INST_t *mac, NR_ServingCellConfigCommo cfg->ssb_table.ssb_offset_point_a = frequencyInfoDL->offsetToPointA; cfg->ssb_table.ssb_period = scc->ssb_PeriodicityServingCell; cfg->ssb_table.ssb_subcarrier_offset = mac->ssb_subcarrier_offset; + cfg->ssb_table.ssb_case = set_ssb_case(mac->numerology, mac->nr_band); if (mac->frequency_range == FR1){ cfg->ssb_table.ssb_mask_list[0].ssb_mask = ((uint32_t) scc->ssb_PositionsInBurst.inOneGroup.buf[0]) << 24; @@ -546,6 +547,7 @@ static void config_common_ue(NR_UE_MAC_INST_t *mac, NR_ServingCellConfigCommon_t cfg->ssb_table.ssb_period = *scc->ssb_periodicityServingCell; // NSA -> take ssb offset from SCS cfg->ssb_table.ssb_subcarrier_offset = absolute_diff % (12 * scs_scaling); + cfg->ssb_table.ssb_case = set_ssb_case(*scc->ssbSubcarrierSpacing, mac->nr_band); } switch (scc->ssb_PositionsInBurst->present) { diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 005ad05720..eea50555c4 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -397,8 +397,9 @@ static void config_common(gNB_MAC_INST *nrmac, const nr_mac_config_t *config, NR nrmac->common_channels[0].ServingCellConfigCommon = scc; // Carrier configuration - struct NR_FrequencyInfoDL *frequencyInfoDL = scc->downlinkConfigCommon->frequencyInfoDL; - frequency_range_t frequency_range = get_freq_range_from_band(*frequencyInfoDL->frequencyBandList.list.array[0]); + NR_FrequencyInfoDL_t *frequencyInfoDL = scc->downlinkConfigCommon->frequencyInfoDL; + NR_FreqBandIndicatorNR_t nr_band = *frequencyInfoDL->frequencyBandList.list.array[0]; + frequency_range_t frequency_range = get_freq_range_from_band(nr_band); int bw_index = get_supported_band_index(frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing, frequency_range, frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth); @@ -406,7 +407,7 @@ static void config_common(gNB_MAC_INST *nrmac, const nr_mac_config_t *config, NR cfg->carrier_config.dl_bandwidth.tl.tag = NFAPI_NR_CONFIG_DL_BANDWIDTH_TAG; // temporary cfg->num_tlv++; - cfg->carrier_config.dl_frequency.value = from_nrarfcn(*frequencyInfoDL->frequencyBandList.list.array[0], + cfg->carrier_config.dl_frequency.value = from_nrarfcn(nr_band, *scc->ssbSubcarrierSpacing, frequencyInfoDL->absoluteFrequencyPointA) / 1000; // freq in kHz @@ -462,8 +463,7 @@ static void config_common(gNB_MAC_INST *nrmac, const nr_mac_config_t *config, NR } } - NR_FreqBandIndicatorNR_t band = *frequencyInfoDL->frequencyBandList.list.array[0]; - frame_type_t frame_type = get_frame_type(band, *scc->ssbSubcarrierSpacing); + frame_type_t frame_type = get_frame_type(nr_band, *scc->ssbSubcarrierSpacing); nrmac->common_channels[0].frame_type = frame_type; // Cell configuration @@ -508,7 +508,7 @@ static void config_common(gNB_MAC_INST *nrmac, const nr_mac_config_t *config, NR else { // If absent, use SCS as derived from the prach-ConfigurationIndex (for 839) int config_index = rach_ConfigCommon->rach_ConfigGeneric.prach_ConfigurationIndex; - int frame_type = get_frame_type(band, frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing); + int frame_type = get_frame_type(nr_band, frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing); int format = get_nr_prach_format_from_index(config_index, UL_pointA, frame_type) & 0xff; cfg->prach_config.prach_sub_c_spacing.value = get_delta_f_RA_long(format); } @@ -606,6 +606,10 @@ static void config_common(gNB_MAC_INST *nrmac, const nr_mac_config_t *config, NR cfg->ssb_table.ssb_subcarrier_offset.tl.tag = NFAPI_NR_CONFIG_SSB_SUBCARRIER_OFFSET_TAG; cfg->num_tlv++; + cfg->ssb_table.case_v3.value = set_ssb_case(*scc->ssbSubcarrierSpacing, nr_band); + cfg->ssb_table.case_v3.tl.tag = NFAPI_NR_FAPI_SSB_CASE_VENDOR_EXTENSION_TAG; + cfg->num_tlv++; + uint8_t *mib_payload = nrmac->common_channels[0].MIB_pdu; uint32_t mib = (mib_payload[2] << 16) | (mib_payload[1] << 8) | mib_payload[0]; cfg->ssb_table.MIB.tl.tag = NFAPI_NR_CONFIG_MIB_TAG; @@ -742,7 +746,7 @@ static void config_common(gNB_MAC_INST *nrmac, const nr_mac_config_t *config, NR carr_ul - carr_dl, bw, mu, - band, + nr_band, 12 * prb_offset + sc_offset, get_softmodem_params()->threequarter_fs ? "-E" : ""); } else { @@ -751,7 +755,7 @@ static void config_common(gNB_MAC_INST *nrmac, const nr_mac_config_t *config, NR carr_dl, bw, mu, - band, + nr_band, 12 * prb_offset + sc_offset, get_softmodem_params()->threequarter_fs ? "-E" : ""); } From 8180a5db0357de18b30d16135f0bc931d1fdfc40 Mon Sep 17 00:00:00 2001 From: francescomani Date: Sat, 14 Feb 2026 18:20:35 +0100 Subject: [PATCH 5/7] remove L1 nr_band dependence in frame parameters --- executables/nr-ue-ru.c | 6 +++++ executables/nr-ue-ru.h | 2 +- executables/nr-ue.c | 2 +- executables/nr-uesoftmodem.c | 2 +- .../public_inc/sidelink_nr_ue_interface.h | 2 +- openair1/PHY/INIT/nr_init.c | 9 ++++--- openair1/PHY/INIT/nr_parms.c | 25 +++++++++++-------- openair2/LAYER2/NR_MAC_UE/config_ue_sl.c | 7 +++--- 8 files changed, 32 insertions(+), 23 deletions(-) diff --git a/executables/nr-ue-ru.c b/executables/nr-ue-ru.c index 7235ae5c9f..8706b00938 100644 --- a/executables/nr-ue-ru.c +++ b/executables/nr-ue-ru.c @@ -110,6 +110,12 @@ int nrue_get_cell_count(void) return nrue_cell_count; } +int nrue_get_band(const PHY_VARS_NR_UE *UE) +{ + int cell_id = nrue_rus[UE->rf_map.card].used_by_cell; + return nrue_cells[cell_id].band; +} + const nrUE_cell_params_t *nrue_get_cell(int cell_id) { AssertFatal(cell_id >= 0 && cell_id < nrue_cell_count, "Invalid cell ID %d! Cell count = %d\n", cell_id, nrue_cell_count); diff --git a/executables/nr-ue-ru.h b/executables/nr-ue-ru.h index 9fe3fc3bd9..d5a173936b 100644 --- a/executables/nr-ue-ru.h +++ b/executables/nr-ue-ru.h @@ -30,7 +30,7 @@ const nrUE_cell_params_t *nrue_get_cell(int cell_id); NR_DL_FRAME_PARMS *nrue_get_cell_fp(int cell_id); void nrue_set_cell(int cell_id, const nrUE_cell_params_t *cell); void nrue_set_cell_params(configmodule_interface_t *cfg); - +int nrue_get_band(const PHY_VARS_NR_UE *UE); int nrue_get_ru_count(void); const nrUE_RU_params_t *nrue_get_ru(int ru_id); void nrue_set_ru_cell_id(int ru_id, int cell_id); diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 0d1ae421f0..4060662818 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -837,7 +837,7 @@ void *UE_thread(void *arg) // Get list of GSCN in this band for UE's bandwidth and center frequency. LOG_W(PHY, "UE set to scan all GSCN in current bandwidth\n"); syncMsg->numGscn = - get_scan_ssb_first_sc(fp->dl_CarrierFreq, fp->N_RB_DL, fp->nr_band, fp->numerology_index, syncMsg->gscnInfo); + get_scan_ssb_first_sc(fp->dl_CarrierFreq, fp->N_RB_DL, nrue_get_band(UE), fp->numerology_index, syncMsg->gscnInfo); } else { LOG_W(PHY, "SSB position provided\n"); syncMsg->gscnInfo[0] = (nr_gscn_info_t){.ssbFirstSC = fp->ssb_start_subcarrier}; diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index a0e06850b7..08e7bce9fe 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -385,7 +385,7 @@ int main(int argc, char **argv) fapi_nr_config_request_t *nrUE_config = &UE_CC->nrUE_config; nr_init_frame_parms_ue(fp, nrUE_config, mac->nr_band); - cell.band = fp->nr_band; + cell.band = mac->nr_band; cell.rf_frequency = fp->dl_CarrierFreq; cell.rf_freq_offset = fp->ul_CarrierFreq - fp->dl_CarrierFreq; cell.numerology = fp->numerology_index; diff --git a/nfapi/open-nFAPI/nfapi/public_inc/sidelink_nr_ue_interface.h b/nfapi/open-nFAPI/nfapi/public_inc/sidelink_nr_ue_interface.h index 4110d88ed0..cb44cc115a 100644 --- a/nfapi/open-nFAPI/nfapi/public_inc/sidelink_nr_ue_interface.h +++ b/nfapi/open-nFAPI/nfapi/public_inc/sidelink_nr_ue_interface.h @@ -365,7 +365,7 @@ typedef struct //Indicates presence of +/-5Khz shift wrt FREF for V2X reference frequencies. //Possible values: {-1,0,1} int8_t sl_value_N; - + uint32_t band; } sl_nr_carrier_config_t; diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index 1615fc86f3..ef3fd4c7c7 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -313,31 +313,32 @@ void nr_phy_config_request_sim(PHY_VARS_gNB *gNB, gNB_config->carrier_config.num_tx_ant.value = fp->nb_antennas_tx; gNB_config->carrier_config.num_rx_ant.value = fp->nb_antennas_rx; + int nr_band = 78; switch (mu) { case 0: gNB->gNB_config.tdd_table.tdd_period.value = 7; fp->dl_CarrierFreq = 2600000000; fp->ul_CarrierFreq = 2600000000; - fp->nr_band = 38; + nr_band = 38; break; case 1: gNB->gNB_config.tdd_table.tdd_period.value = 6; fp->dl_CarrierFreq = 3600000000; fp->ul_CarrierFreq = 3600000000; - fp->nr_band = 78; + nr_band = 78; break; case 3: gNB->gNB_config.tdd_table.tdd_period.value = 3; fp->dl_CarrierFreq = 27524520000; fp->ul_CarrierFreq = 27524520000; - fp->nr_band = 261; + nr_band = 261; break; default: printf("unsupported numerology %d\n", mu); exit(-1); } - frequency_range_t frequency_range = get_freq_range_from_band(fp->nr_band); + frequency_range_t frequency_range = get_freq_range_from_band(nr_band); int bw_index = get_supported_band_index(mu, frequency_range, N_RB_DL); gNB_config->carrier_config.dl_bandwidth.value = get_supported_bw_mhz(frequency_range, bw_index); diff --git a/openair1/PHY/INIT/nr_parms.c b/openair1/PHY/INIT/nr_parms.c index f49493cb32..95002acbf9 100644 --- a/openair1/PHY/INIT/nr_parms.c +++ b/openair1/PHY/INIT/nr_parms.c @@ -364,7 +364,6 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp, fapi_nr_config_request_t* conf fp->nb_antenna_ports_gNB = nb_ant_ports_gNB; fp->tdd_config = tdd_cfg; fp->Nid_cell = Nid_cell; - fp->nr_band = nr_band; LOG_I(PHY, "Initializing frame parms: set nb_antenna_ports_gNB %d, tdd_config, %d, Nid_cell %d\n", fp->nb_antenna_ports_gNB, fp->tdd_config, fp->Nid_cell); @@ -382,13 +381,21 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp, fapi_nr_config_request_t* conf fp->N_RB_DL = config->carrier_config.dl_grid_size[fp->numerology_index]; fp->N_RB_SL = config->carrier_config.sl_grid_size[fp->numerology_index]; - fp->frame_type = get_frame_type(fp->nr_band, fp->numerology_index); + fp->frame_type = get_frame_type(nr_band, fp->numerology_index); int64_t uplink_frequency_offset = fp->ul_CarrierFreq - fp->dl_CarrierFreq; uplink_frequency_offset *= 1000; - LOG_I(PHY, "Initializing frame parms: DL frequency %lu Hz, UL frequency %lu Hz: band %d, uldl offset %ld Hz\n", fp->dl_CarrierFreq, fp->ul_CarrierFreq, fp->nr_band, uplink_frequency_offset); + LOG_I(PHY, + "Initializing frame parms: DL frequency %lu Hz, UL frequency %lu Hz: band %d, uldl offset %ld Hz\n", + fp->dl_CarrierFreq, + fp->ul_CarrierFreq, + nr_band, + uplink_frequency_offset); - AssertFatal(fp->frame_type==config->cell_config.frame_duplex_type, "Invalid duplex type (frame_type %d,cell_config.frame_duplex_type %d) in config request file for band %d\n", fp->frame_type,config->cell_config.frame_duplex_type,fp->nr_band); + AssertFatal(fp->frame_type == config->cell_config.frame_duplex_type, + "Invalid duplex type (frame_type %d,cell_config.frame_duplex_type %d) in config request file for band %d\n", + fp->frame_type,config->cell_config.frame_duplex_type, + nr_band); LOG_I(PHY,"Initializing frame parms for mu %d, N_RB %d, Ncp %d\n",fp->numerology_index, fp->N_RB_DL, Ncp); @@ -459,8 +466,7 @@ void nr_init_frame_parms_ue_sa(NR_DL_FRAME_PARMS *frame_parms, const nrUE_cell_p frame_parms->N_RB_DL = N_RB_DL; frame_parms->N_RB_UL = frame_parms->N_RB_DL; - frame_parms->nr_band = nr_band; - frame_parms->frame_type = get_frame_type(frame_parms->nr_band, frame_parms->numerology_index); + frame_parms->frame_type = get_frame_type(nr_band, frame_parms->numerology_index); frame_parms->Ncp = NORMAL; set_scs_parameters(frame_parms, frame_parms->numerology_index, frame_parms->N_RB_DL, set_ssb_case(mu, nr_band)); @@ -506,7 +512,6 @@ void nr_dump_frame_parms(NR_DL_FRAME_PARMS *fp) LOG_I(PHY, "fp->Ncp=%d\n", fp->Ncp); LOG_I(PHY, "fp->N_RB_DL=%d\n", fp->N_RB_DL); LOG_I(PHY, "fp->numerology_index=%d\n", fp->numerology_index); - LOG_I(PHY, "fp->nr_band=%d\n", fp->nr_band); LOG_I(PHY, "fp->ofdm_offset_divisor=%d\n", fp->ofdm_offset_divisor); LOG_I(PHY, "fp->threequarter_fs=%d\n", fp->threequarter_fs); LOG_I(PHY, "fp->sl_CarrierFreq=%lu\n", fp->sl_CarrierFreq); @@ -522,8 +527,6 @@ int nr_init_frame_parms_ue_sl(NR_DL_FRAME_PARMS *fp, fp->ofdm_offset_divisor = ofdm_offset_divisor; fp->threequarter_fs = threequarter_fs; - fp->nr_band = get_band(config->sl_carrier_config.sl_frequency, 0, 0, 0); - fp->att_rx = 0; fp->att_tx = 0; fp->nb_antennas_rx = config->sl_carrier_config.sl_num_rx_ant; @@ -535,7 +538,7 @@ int nr_init_frame_parms_ue_sl(NR_DL_FRAME_PARMS *fp, fp->N_RB_UL = fp->N_RB_SL; fp->Ncp = config->sl_bwp_config.sl_cyclic_prefix; - fp->frame_type = get_frame_type(fp->nr_band, fp->numerology_index); + fp->frame_type = get_frame_type(config->sl_carrier_config.band, fp->numerology_index); uint64_t bw_khz = (12 * config->sl_carrier_config.sl_grid_size) * (15 << config->sl_bwp_config.sl_scs); // REfer to section 3GPP spec 38.101 5.4E.2.1 @@ -555,7 +558,7 @@ int nr_init_frame_parms_ue_sl(NR_DL_FRAME_PARMS *fp, fp->dl_CarrierFreq, fp->ul_CarrierFreq, fp->sl_CarrierFreq, - fp->nr_band); + config->sl_carrier_config.band); AssertFatal(fp->frame_type == TDD, "Sidelink bands only support TDD"); diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue_sl.c b/openair2/LAYER2/NR_MAC_UE/config_ue_sl.c index 58db78ea83..e6d872da81 100644 --- a/openair2/LAYER2/NR_MAC_UE/config_ue_sl.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue_sl.c @@ -126,9 +126,9 @@ static void sl_prepare_phy_config(int module_id, AssertFatal(SSB_ARFCN, "sl_AbsoluteFrequencySSB cannot be 0\n"); - LOG_I(NR_MAC, "SIDELINK CONFIGs: AbsFreqSSB:%d, AbsFreqPointA:%d, SL band:%d\n", - SSB_ARFCN,pointA_ARFCN, sl_band); + LOG_I(NR_MAC, "SIDELINK CONFIGs: AbsFreqSSB:%d, AbsFreqPointA:%d, SL band:%d\n", SSB_ARFCN, pointA_ARFCN, sl_band); + phycfg->sl_carrier_config.band = sl_band; //FREQSHIFT_7P5KHZ is DISABLED phycfg->sl_carrier_config.sl_frequency_shift_7p5khz = 0; phycfg->sl_carrier_config.sl_value_N = freqcfg->valueN_r16; @@ -141,8 +141,7 @@ static void sl_prepare_phy_config(int module_id, int bw_index = get_supported_band_index(carriercfg->subcarrierSpacing, FR1, carriercfg->carrierBandwidth); phycfg->sl_carrier_config.sl_bandwidth = get_supported_bw_mhz(FR1, bw_index); - phycfg->sl_carrier_config.sl_frequency = - from_nrarfcn(sl_band,carriercfg->subcarrierSpacing,pointA_ARFCN); // freq in kHz + phycfg->sl_carrier_config.sl_frequency = from_nrarfcn(sl_band, carriercfg->subcarrierSpacing, pointA_ARFCN); // freq in kHz phycfg->sl_carrier_config.sl_grid_size = carriercfg->carrierBandwidth; //For sidelink offset to carrier is 0. hence not used From 3c2853e1c06bf29c881c39ff276b72a34922c37e Mon Sep 17 00:00:00 2001 From: francescomani Date: Sun, 15 Feb 2026 16:38:18 +0100 Subject: [PATCH 6/7] remove RU functios gated by has_ctrl_prt parameter never set in NR code --- executables/nr-ru.c | 298 -------------------------------------------- 1 file changed, 298 deletions(-) diff --git a/executables/nr-ru.c b/executables/nr-ru.c index b2c3c98741..fa397c5bef 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -69,176 +69,6 @@ static int DEFRUTPCORES[] = {-1,-1,-1,-1}; static void NRRCconfig_RU(configmodule_interface_t *cfg); -/*************************************************************/ -/* Functions to attach and configure RRU */ - -int attach_rru(RU_t *ru) -{ - RRU_CONFIG_msg_t rru_config_msg; - int received_capabilities=0; - wait_gNBs(); - - // Wait for capabilities - while (received_capabilities==0) { - rru_config_msg = (RRU_CONFIG_msg_t){.type = RAU_tick, .len = sizeof(rru_config_msg.msg)}; - LOG_D(PHY, "Sending RAU tick to RRU %d\n", ru->idx); - AssertFatal((ru->ifdevice.trx_ctlsend_func(&ru->ifdevice,&rru_config_msg,rru_config_msg.len)!=-1), - "RU %d cannot access remote radio\n",ru->idx); - ssize_t msg_len = rru_config_msg.len + sizeof(RRU_capabilities_t); - // wait for answer with timeout - ssize_t len = ru->ifdevice.trx_ctlrecv_func(&ru->ifdevice, &rru_config_msg, msg_len); - if (len < 0) { - LOG_D(PHY, "Waiting for RRU %d\n", ru->idx); - } else if (rru_config_msg.type == RRU_capabilities) { - AssertFatal(rru_config_msg.len == msg_len, - "Received capabilities with incorrect length (%ld!=%ld)\n", - rru_config_msg.len, - msg_len); - RRU_capabilities_t *cap = (RRU_capabilities_t *)rru_config_msg.msg; - LOG_I(PHY, - "Received capabilities from RRU %d (len %ld/%ld, num_bands %d,max_pdschReferenceSignalPower %d, max_rxgain %d, nb_tx " - "%d, nb_rx %d)\n", - ru->idx, - rru_config_msg.len, - msg_len, - cap->num_bands, - cap->max_pdschReferenceSignalPower[0], - cap->max_rxgain[0], - cap->nb_tx[0], - cap->nb_rx[0]); - received_capabilities=1; - } else { - LOG_E(PHY,"Received incorrect message %d from RRU %d\n",rru_config_msg.type,ru->idx); - } - } - - configure_ru(ru, (RRU_capabilities_t *)rru_config_msg.msg); - rru_config_msg.type = RRU_config; - rru_config_msg.len = sizeof(RRU_CONFIG_msg_t)-MAX_RRU_CONFIG_SIZE+sizeof(RRU_config_t); - RRU_config_t *conf = (RRU_config_t *)rru_config_msg.msg; - LOG_I(PHY, - "Sending Configuration to RRU %d (num_bands %d,band0 %d,txfreq %u,rxfreq %u,att_tx %d,att_rx %d,N_RB_DL %d,N_RB_UL " - "%d,3/4FS %d, prach_FO %d, prach_CI %d)\n", - ru->idx, - conf->num_bands, - conf->band_list[0], - conf->tx_freq[0], - conf->rx_freq[0], - conf->att_tx[0], - conf->att_rx[0], - conf->N_RB_DL[0], - conf->N_RB_UL[0], - conf->threequarter_fs[0], - conf->prach_FreqOffset[0], - conf->prach_ConfigIndex[0]); - AssertFatal((ru->ifdevice.trx_ctlsend_func(&ru->ifdevice,&rru_config_msg,rru_config_msg.len)!=-1), - "RU %d failed send configuration to remote radio\n",ru->idx); - int len = ru->ifdevice.trx_ctlrecv_func(&ru->ifdevice, &rru_config_msg, sizeof(rru_config_msg.msg)); - if (len < 0) { - LOG_I(PHY,"Waiting for RRU %d\n",ru->idx); - } else if (rru_config_msg.type == RRU_config_ok) { - LOG_I(PHY, "RRU_config_ok received\n"); - } else { - LOG_E(PHY,"Received incorrect message %d from RRU %d\n",rru_config_msg.type,ru->idx); - } - - return 0; -} - -int connect_rau(RU_t *ru) { - RRU_CONFIG_msg_t rru_config_msg; - - // wait for RAU_tick - int tick_received = 0; - while (tick_received == 0) { - ssize_t msg_len = sizeof(rru_config_msg.msg); - int len = ru->ifdevice.trx_ctlrecv_func(&ru->ifdevice, &rru_config_msg, msg_len); - if (len < 0) { - LOG_I(PHY,"Waiting for RAU\n"); - } else { - if (rru_config_msg.type == RAU_tick) { - LOG_I(PHY,"Tick received from RAU\n"); - tick_received = 1; - } else - LOG_E(PHY, "Received erroneous message (%d)from RAU, expected RAU_tick\n", rru_config_msg.type); - } - } - - // send capabilities - rru_config_msg.type = RRU_capabilities; - rru_config_msg.len = sizeof(RRU_CONFIG_msg_t)-MAX_RRU_CONFIG_SIZE+sizeof(RRU_capabilities_t); - RRU_capabilities_t *cap = (RRU_capabilities_t *)rru_config_msg.msg; - LOG_I(PHY, - "Sending Capabilities (len %ld, num_bands %d,max_pdschReferenceSignalPower %d, max_rxgain %d, nb_tx %d, nb_rx %d)\n", - rru_config_msg.len, - ru->num_bands, - ru->max_pdschReferenceSignalPower, - ru->max_rxgain, - ru->nb_tx, - ru->nb_rx); - - switch (ru->function) { - case NGFI_RRU_IF4p5: - cap->FH_fmt = OAI_IF4p5_only; - break; - - case NGFI_RRU_IF5: - cap->FH_fmt = OAI_IF5_only; - break; - - case MBP_RRU_IF5: - cap->FH_fmt = MBP_IF5; - break; - - default: - AssertFatal(false, "RU_function is unknown %d\n", RC.ru[0]->function); - break; - } - - cap->num_bands = ru->num_bands; - for (int i = 0; i < ru->num_bands; i++) { - LOG_I(PHY,"Band %d: nb_rx %d nb_tx %d pdschReferenceSignalPower %d rxgain %d\n", - ru->band[i],ru->nb_rx,ru->nb_tx,ru->max_pdschReferenceSignalPower,ru->max_rxgain); - cap->band_list[i] = ru->band[i]; - cap->nb_rx[i] = ru->nb_rx; - cap->nb_tx[i] = ru->nb_tx; - cap->max_pdschReferenceSignalPower[i] = ru->max_pdschReferenceSignalPower; - cap->max_rxgain[i] = ru->max_rxgain; - } - - AssertFatal((ru->ifdevice.trx_ctlsend_func(&ru->ifdevice,&rru_config_msg,rru_config_msg.len)!=-1), - "RU %d failed send capabilities to RAU\n",ru->idx); - // wait for configuration - rru_config_msg.len = sizeof(RRU_CONFIG_msg_t)-MAX_RRU_CONFIG_SIZE+sizeof(RRU_config_t); - - int configuration_received = 0; - while (configuration_received == 0) { - int len = ru->ifdevice.trx_ctlrecv_func(&ru->ifdevice, &rru_config_msg, rru_config_msg.len); - if (len < 0) { - LOG_I(PHY,"Waiting for configuration from RAU\n"); - } else { - RRU_config_t *conf = (RRU_config_t *)rru_config_msg.msg; - LOG_I(PHY, - "Configuration received from RAU (num_bands %d,band0 %d,txfreq %u,rxfreq %u,att_tx %d,att_rx %d,N_RB_DL %d,N_RB_UL " - "%d,3/4FS %d, prach_FO %d, prach_CI %d)\n", - conf->num_bands, - conf->band_list[0], - conf->tx_freq[0], - conf->rx_freq[0], - conf->att_tx[0], - conf->att_rx[0], - conf->N_RB_DL[0], - conf->N_RB_UL[0], - conf->threequarter_fs[0], - conf->prach_FreqOffset[0], - conf->prach_ConfigIndex[0]); - configure_rru(ru, (void *)rru_config_msg.msg); - configuration_received = 1; - } - } - - return 0; -} /*************************************************************/ /* Southbound Fronthaul functions, RCC/RAU */ @@ -1034,15 +864,6 @@ void *ru_thread(void *param) LOG_I(PHY, "Starting IF interface for RU %d, nb_rx %d\n", ru->idx, ru->nb_rx); AssertFatal(ru->nr_start_if(ru, NULL) == 0, "Could not start the IF device\n"); - if (ru->has_ctrl_prt > 0) { - if (ru->if_south == LOCAL_RF) - ret = connect_rau(ru); - else - ret = attach_rru(ru); - - AssertFatal(ret == 0, "Cannot connect to remote radio\n"); - } - } else if (ru->if_south == LOCAL_RF) { // configure RF parameters only ret = openair0_device_load(&ru->rfdevice,&ru->openair0_cfg); AssertFatal(ret==0,"Cannot connect to local radio\n"); @@ -1257,123 +1078,6 @@ void kill_NR_RU_proc(int inst) { LOG_I(PHY, "RU %d RF device stopped\n",ru->idx); } -int check_capabilities(RU_t *ru,RRU_capabilities_t *cap) { - FH_fmt_options_t fmt = cap->FH_fmt; - int i; - LOG_I(PHY,"RRU %d, num_bands %d, looking for band %d\n",ru->idx,cap->num_bands,ru->nr_frame_parms->nr_band); - - for (i=0; inum_bands; i++) { - LOG_I(PHY,"band %d on RRU %d\n",cap->band_list[i],ru->idx); - if (ru->nr_frame_parms->nr_band == cap->band_list[i]) - break; - } - - if (i == cap->num_bands) { - LOG_I(PHY,"Couldn't find target NR band %d on RRU %d\n",ru->nr_frame_parms->nr_band,ru->idx); - return(-1); - } - - switch (ru->if_south) { - case LOCAL_RF: - AssertFatal(1==0, "This RU should not have a local RF, exiting\n"); - return(0); - break; - - case REMOTE_IF5: - if (fmt == OAI_IF5_only || fmt == OAI_IF5_and_IF4p5) - return (0); - break; - - case REMOTE_IF4p5: - if (fmt == OAI_IF4p5_only || fmt == OAI_IF5_and_IF4p5) - return (0); - break; - - case REMOTE_MBP_IF5: - if (fmt == MBP_IF5) - return (0); - break; - - default: - LOG_I(PHY,"No compatible Fronthaul interface found for RRU %d\n", ru->idx); - return(-1); - } - - return(-1); -} - -const char rru_format_options[4][20] = {"OAI_IF5_only", "OAI_IF4p5_only", "OAI_IF5_and_IF4p5", "MBP_IF5"}; -const char rru_formats[3][20] = {"OAI_IF5", "MBP_IF5", "OAI_IF4p5"}; -const char ru_if_formats[4][20] = {"LOCAL_RF", "REMOTE_OAI_IF5", "REMOTE_MBP_IF5", "REMOTE_OAI_IF4p5"}; - -void configure_ru(void *ruu, void *arg) -{ - RU_t *ru = (RU_t *)ruu; - nfapi_nr_config_request_scf_t *cfg = &ru->config; - int ret; - LOG_I(PHY, "Received capabilities from RRU %d\n", ru->idx); - - RRU_capabilities_t *capabilities = (RRU_capabilities_t *)arg; - if (capabilities->FH_fmt < MAX_FH_FMTs) - LOG_I(PHY, "RU FH options %s\n", rru_format_options[capabilities->FH_fmt]); - - ret = check_capabilities(ru,capabilities); - AssertFatal(ret == 0, "Cannot configure RRU %d, check_capabilities returned %d\n", ru->idx, ret); - // take antenna capabilities of RRU - ru->nb_tx = capabilities->nb_tx[0]; - ru->nb_rx = capabilities->nb_rx[0]; - // Pass configuration to RRU - LOG_I(PHY, "Using %s fronthaul (%d), band %d \n",ru_if_formats[ru->if_south],ru->if_south,ru->nr_frame_parms->nr_band); - - // wait for configuration - RRU_config_t *config = (RRU_config_t *)arg; - *config = (RRU_config_t){.FH_fmt = ru->if_south, - .num_bands = 1, - .band_list[0] = ru->nr_frame_parms->nr_band, - .tx_freq[0] = ru->nr_frame_parms->dl_CarrierFreq, - .rx_freq[0] = ru->nr_frame_parms->ul_CarrierFreq, - .att_tx[0] = ru->att_tx, - .att_rx[0] = ru->att_rx, - .N_RB_DL[0] = cfg->carrier_config.dl_grid_size[cfg->ssb_config.scs_common.value].value, - .N_RB_UL[0] = cfg->carrier_config.dl_grid_size[cfg->ssb_config.scs_common.value].value, - .threequarter_fs[0] = ru->nr_frame_parms->threequarter_fs}; - nr_init_frame_parms(&ru->config, ru->nr_frame_parms); - nr_phy_init_RU(ru); -} - -void configure_rru(void *ruu, void *arg) -{ - RRU_config_t *config = (RRU_config_t *)arg; - RU_t *ru = (RU_t *)ruu; - nfapi_nr_config_request_scf_t *cfg = &ru->config; - NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms; - - fp->nr_band = config->band_list[0]; - fp->dl_CarrierFreq = config->tx_freq[0]; - fp->ul_CarrierFreq = config->rx_freq[0]; - - if (fp->dl_CarrierFreq == fp->ul_CarrierFreq) { - cfg->cell_config.frame_duplex_type.value = TDD; - } else - cfg->cell_config.frame_duplex_type.value = FDD; - - ru->att_tx = config->att_tx[0]; - ru->att_rx = config->att_rx[0]; - int mu = cfg->ssb_config.scs_common.value; - cfg->carrier_config.dl_grid_size[mu].value = config->N_RB_DL[0]; - cfg->carrier_config.dl_grid_size[mu].value = config->N_RB_UL[0]; - fp->threequarter_fs = config->threequarter_fs[0]; - - if (ru->function==NGFI_RRU_IF4p5) { - fp->att_rx = ru->att_rx; - fp->att_tx = ru->att_tx; - } - - fill_rf_config(ru,ru->rf_config_file); - nr_init_frame_parms(&ru->config, fp); - nr_phy_init_RU(ru); -} - void set_function_spec_param(RU_t *ru) { switch (ru->if_south) { @@ -1444,7 +1148,6 @@ void set_function_spec_param(RU_t *ru) ru->nr_start_if = nr_start_if; // need to start if interface for IF5 ru->ifdevice.host_type = RAU_HOST; ru->ifdevice.eth_params = &ru->eth_params; - ru->ifdevice.configure_rru = configure_ru; break; @@ -1464,7 +1167,6 @@ void set_function_spec_param(RU_t *ru) ru->nr_start_if = nr_start_if; // need to start if interface for IF4p5 ru->ifdevice.host_type = RAU_HOST; ru->ifdevice.eth_params = &ru->eth_params; - ru->ifdevice.configure_rru = configure_ru; break; default: From 862f84bb68faa3d47db53bf98b66560c7857608a Mon Sep 17 00:00:00 2001 From: francescomani Date: Sun, 15 Feb 2026 16:50:57 +0100 Subject: [PATCH 7/7] remove band from frame parameters and get_band function not used anymore --- common/utils/nr/nr_common.c | 71 ------------------- common/utils/nr/nr_common.h | 1 - openair1/PHY/INIT/nr_init.c | 3 +- .../PHY/INIT/tests/test_nr_frame_params.cpp | 4 -- openair1/PHY/defs_nr_common.h | 2 - 5 files changed, 1 insertion(+), 80 deletions(-) diff --git a/common/utils/nr/nr_common.c b/common/utils/nr/nr_common.c index aba54a07ef..526adfd107 100644 --- a/common/utils/nr/nr_common.c +++ b/common/utils/nr/nr_common.c @@ -419,77 +419,6 @@ bool compare_relative_ul_channel_bw(int nr_band, int scs, int channel_bandwidth, return rel_bw > limit; } -static bool check_delta_duplex(int index, uint64_t dlfreq_khz, uint64_t ulfreq_khz, int64_t dlbw, int64_t ulbw) -{ - int uldl_min_offset = nr_bandtable[index].dl_min - nr_bandtable[index].ul_min; - int txrx_offset = dlfreq_khz - ulfreq_khz; - LOG_I(NR_PHY, "dlfreq:%ld ulfreq:%ld deltaduplex:%d khz, uldl_min_offset:%d khz\n", - dlfreq_khz, ulfreq_khz, txrx_offset, uldl_min_offset); - if (txrx_offset == uldl_min_offset) - return true; - - int band = nr_bandtable[index].band; - - // Refer to section 5.4.4 in spec 38.101-5 - if (band == 256 && txrx_offset >= 165000 && txrx_offset <= 215000) - return true; - if (band == 255 && txrx_offset >= -130500 && txrx_offset <= -72500) - return true; - if (band == 254 && txrx_offset >= 862000 && txrx_offset <= 885000) - return true; - - // Refer to section 5.4.4 in spec 38.101-1 for these bands 24, 91-94, 109 - if (band == 24 && (txrx_offset == -101500 || txrx_offset == -120500)) - return true; - //Delta duplex is also a range for these bands n91-n94, n109. - if ((band >= 91 && band <= 94) || band == 109) { - dlbw = ((dlbw / 1000) + 1) * 1000; - ulbw = ((ulbw / 1000) + 1) * 1000; - int lower_limit = nr_bandtable[index].dl_min - nr_bandtable[index].ul_max + ((dlbw + ulbw) >> 1); - int upper_limit = nr_bandtable[index].dl_max - nr_bandtable[index].ul_min - ((dlbw + ulbw) >> 1); - LOG_I(NR_PHY, "Band %d dlbw:%ld Khz, ulbw: %ld Khz RXTX lower limit:%d khz, upper limit:%d khz\n", - band, dlbw, ulbw, lower_limit, upper_limit); - - if (txrx_offset >= lower_limit && txrx_offset <= upper_limit) - return true; - } - - return false; -} - -uint16_t get_band(uint64_t downlink_frequency, int32_t delta_duplex, int64_t dlbw, int64_t ulbw) -{ - const int64_t dl_freq_khz = downlink_frequency / 1000; - const int32_t delta_duplex_khz = delta_duplex / 1000; - const int64_t ul_freq_khz = dl_freq_khz + delta_duplex_khz; - - uint16_t current_band = 0; - - for (int ind = 0; ind < sizeofArray(nr_bandtable); ind++) { - - if (dl_freq_khz < nr_bandtable[ind].dl_min || dl_freq_khz > nr_bandtable[ind].dl_max) - continue; - - if (ul_freq_khz < nr_bandtable[ind].ul_min || ul_freq_khz > nr_bandtable[ind].ul_max) - continue; - - if (!check_delta_duplex(ind, dl_freq_khz, ul_freq_khz, dlbw, ulbw)) - continue; - - current_band = nr_bandtable[ind].band; - } - - printf("DL frequency %"PRIu64": band %d, UL frequency %"PRIu64"\n", - downlink_frequency, current_band, downlink_frequency+delta_duplex); - - AssertFatal(current_band != 0, - "Can't find EUTRA band for frequency %" PRIu64 " and duplex_spacing %d\n", - downlink_frequency, - delta_duplex); - - return current_band; -} - int NRRIV2BW(int locationAndBandwidth,int N_RB) { int tmp = locationAndBandwidth/N_RB; int tmp2 = locationAndBandwidth%N_RB; diff --git a/common/utils/nr/nr_common.h b/common/utils/nr/nr_common.h index 93e3296e67..087440d13d 100644 --- a/common/utils/nr/nr_common.h +++ b/common/utils/nr/nr_common.h @@ -296,7 +296,6 @@ int get_coreset_num_cces(const uint8_t *FreqDomainResource, int duration); int get_nr_table_idx(int nr_bandP, uint8_t scs_index); int32_t get_delta_duplex(int nr_bandP, uint8_t scs_index); frame_type_t get_frame_type(uint16_t nr_bandP, uint8_t scs_index); -uint16_t get_band(uint64_t downlink_frequency, int32_t delta_duplex, int64_t dlbw, int64_t ulbw); int NRRIV2BW(int locationAndBandwidth,int N_RB); int NRRIV2PRBOFFSET(int locationAndBandwidth,int N_RB); int PRBalloc_to_locationandbandwidth0(int NPRB,int RBstart,int BWPsize); diff --git a/openair1/PHY/INIT/nr_init.c b/openair1/PHY/INIT/nr_init.c index ef3fd4c7c7..d8b34b2598 100644 --- a/openair1/PHY/INIT/nr_init.c +++ b/openair1/PHY/INIT/nr_init.c @@ -367,9 +367,8 @@ void nr_phy_config_request(NR_PHY_Config_t *phy_config) fp->ul_CarrierFreq = ((ul_bw_khz>>1) + gNB_config->carrier_config.uplink_frequency.value)*1000 ; int32_t dlul_offset = fp->ul_CarrierFreq - fp->dl_CarrierFreq; - fp->nr_band = get_band(fp->dl_CarrierFreq, dlul_offset, dl_bw_khz, ul_bw_khz); - LOG_I(PHY, "DL frequency %lu Hz, UL frequency %lu Hz: band %d, uldl offset %d Hz\n", fp->dl_CarrierFreq, fp->ul_CarrierFreq, fp->nr_band, dlul_offset); + LOG_I(PHY, "DL frequency %lu Hz, UL frequency %lu Hz: uldl offset %d Hz\n", fp->dl_CarrierFreq, fp->ul_CarrierFreq, dlul_offset); fp->threequarter_fs = get_softmodem_params()->threequarter_fs; LOG_D(PHY,"Configuring MIB for instance %d, : (Nid_cell %d,DL freq %llu, UL freq %llu)\n", diff --git a/openair1/PHY/INIT/tests/test_nr_frame_params.cpp b/openair1/PHY/INIT/tests/test_nr_frame_params.cpp index acf43ec0b8..4cd742f9f0 100644 --- a/openair1/PHY/INIT/tests/test_nr_frame_params.cpp +++ b/openair1/PHY/INIT/tests/test_nr_frame_params.cpp @@ -101,7 +101,6 @@ TEST(nr_frame_params, test_mu_3) cfg.cell_config.frame_duplex_type.value = TDD; cfg.ssb_config.scs_common.value = mu; fp.dl_CarrierFreq = 27524520000; - fp.nr_band = 261; nr_init_frame_parms(&cfg, &fp); nr_dump_frame_parms(&fp); test_coherence_symbol_api(&fp); @@ -121,7 +120,6 @@ TEST(nr_frame_params, test_mu_2) cfg.cell_config.frame_duplex_type.value = TDD; cfg.ssb_config.scs_common.value = mu; fp.dl_CarrierFreq = 27524520000; - fp.nr_band = 261; nr_init_frame_parms(&cfg, &fp); nr_dump_frame_parms(&fp); test_coherence_symbol_api(&fp); @@ -141,7 +139,6 @@ TEST(nr_frame_params, test_mu_1) cfg.cell_config.frame_duplex_type.value = TDD; cfg.ssb_config.scs_common.value = mu; fp.dl_CarrierFreq = 3600000000; - fp.nr_band = 78; nr_init_frame_parms(&cfg, &fp); nr_dump_frame_parms(&fp); test_coherence_symbol_api(&fp); @@ -161,7 +158,6 @@ TEST(nr_frame_params, test_mu_0) cfg.cell_config.frame_duplex_type.value = TDD; cfg.ssb_config.scs_common.value = mu; fp.dl_CarrierFreq = 2600000000; - fp.nr_band = 38; nr_init_frame_parms(&cfg, &fp); nr_dump_frame_parms(&fp); test_coherence_symbol_api(&fp); diff --git a/openair1/PHY/defs_nr_common.h b/openair1/PHY/defs_nr_common.h index dc2630348c..ca5cb96a22 100644 --- a/openair1/PHY/defs_nr_common.h +++ b/openair1/PHY/defs_nr_common.h @@ -173,8 +173,6 @@ struct NR_DL_FRAME_PARMS { uint8_t N_RBG; /// Total Number of Resource Block Groups SubSets: this is P uint8_t N_RBGS; - /// NR Band - uint16_t nr_band; /// DL carrier frequency uint64_t dl_CarrierFreq; /// UL carrier frequency