From e6af64c147c7dd00bbb954bdb45fafddc72059d3 Mon Sep 17 00:00:00 2001 From: Francisco Date: Fri, 21 Jan 2022 13:48:39 +0000 Subject: [PATCH] rrc,nr: removal of ssb config from the rrc_nr_cfg_t --- srsgnb/hdr/stack/rrc/rrc_nr_config.h | 24 ++++++------ srsgnb/hdr/stack/rrc/rrc_nr_du_manager.h | 10 ++++- srsgnb/src/stack/rrc/cell_asn1_config.cc | 19 +++++----- srsgnb/src/stack/rrc/rrc_nr.cc | 29 +++++++++------ srsgnb/src/stack/rrc/rrc_nr_config_utils.cc | 41 +++++++-------------- 5 files changed, 61 insertions(+), 62 deletions(-) diff --git a/srsgnb/hdr/stack/rrc/rrc_nr_config.h b/srsgnb/hdr/stack/rrc/rrc_nr_config.h index dc38c1659..0bf40b583 100644 --- a/srsgnb/hdr/stack/rrc/rrc_nr_config.h +++ b/srsgnb/hdr/stack/rrc/rrc_nr_config.h @@ -32,17 +32,19 @@ struct rrc_nr_cfg_sr_t { // Cell/Sector configuration for NR cells struct rrc_cell_cfg_nr_t { - phy_cell_cfg_nr_t phy_cell; // already contains all PHY-related parameters (i.e. RF port, PCI, etc.) - uint32_t tac; // Tracking area code - uint32_t dl_arfcn; // DL freq already included in phy_cell - uint32_t ul_arfcn; // UL freq also in phy_cell - uint32_t dl_absolute_freq_point_a; // derived from DL ARFCN - uint32_t ul_absolute_freq_point_a; // derived from UL ARFCN - uint32_t ssb_absolute_freq_point; // derived from DL ARFCN (SSB arfcn) - uint32_t band; - uint32_t coreset0_idx; // Table 13-{1,...15} row index - srsran_duplex_mode_t duplex_mode; - srsran_ssb_cfg_t ssb_cfg; + phy_cell_cfg_nr_t phy_cell; // already contains all PHY-related parameters (i.e. RF port, PCI, etc.) + uint32_t tac; // Tracking area code + uint32_t dl_arfcn; // DL freq already included in phy_cell + uint32_t ul_arfcn; // UL freq also in phy_cell + uint32_t dl_absolute_freq_point_a; // derived from DL ARFCN + uint32_t ul_absolute_freq_point_a; // derived from UL ARFCN + uint32_t band; + uint32_t coreset0_idx; // Table 13-{1,...15} row index + srsran_duplex_mode_t duplex_mode; + double ssb_freq_hz; + uint32_t ssb_absolute_freq_point; // derived from DL ARFCN (SSB arfcn) + srsran_subcarrier_spacing_t ssb_scs; + srsran_ssb_patern_t ssb_pattern; }; typedef std::vector rrc_cell_list_nr_t; diff --git a/srsgnb/hdr/stack/rrc/rrc_nr_du_manager.h b/srsgnb/hdr/stack/rrc/rrc_nr_du_manager.h index eef6e75aa..05e063e4f 100644 --- a/srsgnb/hdr/stack/rrc/rrc_nr_du_manager.h +++ b/srsgnb/hdr/stack/rrc/rrc_nr_du_manager.h @@ -31,6 +31,11 @@ public: asn1::rrc_nr::sib1_s sib1; srsran::unique_byte_buffer_t packed_sib1; + const asn1::rrc_nr::serving_cell_cfg_common_sib_s& serv_cell_cfg_common() const + { + return sib1.serving_cell_cfg_common; + } + /// SI messages (index=0 for SIB1) srsran::const_byte_span packed_si_msg(uint32_t idx) { return srsran::make_span(packed_sib1); } size_t nof_si_msgs() const { return 1; } @@ -39,9 +44,11 @@ public: class du_config_manager { public: - du_config_manager(const rrc_nr_cfg_t& cfg); + explicit du_config_manager(const rrc_nr_cfg_t& cfg); ~du_config_manager(); + const rrc_nr_cfg_t& cfg; + int add_cell(); const du_cell_config& cell(uint32_t cc) const @@ -51,7 +58,6 @@ public: } private: - const rrc_nr_cfg_t& cfg; srslog::basic_logger& logger; std::vector > cells; diff --git a/srsgnb/src/stack/rrc/cell_asn1_config.cc b/srsgnb/src/stack/rrc/cell_asn1_config.cc index 94d225749..1dce59a6d 100644 --- a/srsgnb/src/stack/rrc/cell_asn1_config.cc +++ b/srsgnb/src/stack/rrc/cell_asn1_config.cc @@ -868,18 +868,15 @@ int fill_serv_cell_common_from_enb_cfg(const rrc_nr_cfg_t& cfg, uint32_t cc, ser serv_common.ss_pbch_block_pwr = cell_cfg.phy_cell.pdsch.rs_power; serv_common.n_timing_advance_offset_present = true; - serv_common.n_timing_advance_offset = asn1::rrc_nr::serving_cell_cfg_common_s::n_timing_advance_offset_opts::n0; + serv_common.n_timing_advance_offset = serving_cell_cfg_common_s::n_timing_advance_offset_opts::n0; serv_common.n_timing_advance_offset_present = true; - serv_common.dmrs_type_a_position = asn1::rrc_nr::serving_cell_cfg_common_s::dmrs_type_a_position_opts::pos2; + serv_common.dmrs_type_a_position = serving_cell_cfg_common_s::dmrs_type_a_position_opts::pos2; serv_common.pci_present = true; serv_common.pci = cell_cfg.phy_cell.carrier.pci; serv_common.ssb_periodicity_serving_cell_present = true; - if (not asn1::number_to_enum(serv_common.ssb_periodicity_serving_cell, cell_cfg.ssb_cfg.periodicity_ms)) { - get_logger(cfg).error("Config Error: Invalid SSB periodicity = %d\n", cell_cfg.ssb_cfg.periodicity_ms); - return SRSRAN_ERROR; - } + serv_common.ssb_periodicity_serving_cell.value = serving_cell_cfg_common_s::ssb_periodicity_serving_cell_opts::ms10; // Fill SSB config serv_common.ssb_positions_in_burst_present = true; @@ -1136,7 +1133,7 @@ void fill_dl_cfg_common_sib(const rrc_cell_cfg_nr_t& cell_cfg, dl_cfg_common_sib cfg.freq_info_dl.freq_band_list.resize(1); cfg.freq_info_dl.freq_band_list[0].freq_band_ind_nr_present = true; cfg.freq_info_dl.freq_band_list[0].freq_band_ind_nr = cell_cfg.band; - double ssb_freq_start = cell_cfg.ssb_cfg.ssb_freq_hz - SRSRAN_SSB_BW_SUBC * scs_hz / 2; + double ssb_freq_start = cell_cfg.ssb_freq_hz - SRSRAN_SSB_BW_SUBC * scs_hz / 2; double offset_point_a_hz = ssb_freq_start - band_helper.nr_arfcn_to_freq(cell_cfg.dl_absolute_freq_point_a); uint32_t offset_point_a_prbs = offset_point_a_hz / prb_bw; cfg.freq_info_dl.offset_to_point_a = offset_point_a_prbs; @@ -1207,7 +1204,7 @@ void fill_ul_cfg_common_sib(const rrc_cell_cfg_nr_t& cell_cfg, ul_cfg_common_sib cfg.time_align_timer_common.value = time_align_timer_opts::infinity; } -void fill_serv_cell_cfg_common_sib(const rrc_cell_cfg_nr_t& cell_cfg, serving_cell_cfg_common_sib_s& cfg) +int fill_serv_cell_cfg_common_sib(const rrc_cell_cfg_nr_t& cell_cfg, serving_cell_cfg_common_sib_s& cfg) { fill_dl_cfg_common_sib(cell_cfg, cfg.dl_cfg_common); @@ -1216,7 +1213,7 @@ void fill_serv_cell_cfg_common_sib(const rrc_cell_cfg_nr_t& cell_cfg, serving_ce cfg.ssb_positions_in_burst.in_one_group.from_number(0x80); - cfg.ssb_periodicity_serving_cell.value = serving_cell_cfg_common_sib_s::ssb_periodicity_serving_cell_opts::ms20; + cfg.ssb_periodicity_serving_cell.value = serving_cell_cfg_common_sib_s::ssb_periodicity_serving_cell_opts::ms10; // TDD UL-DL config if (cell_cfg.duplex_mode == SRSRAN_DUPLEX_MODE_TDD) { @@ -1225,6 +1222,8 @@ void fill_serv_cell_cfg_common_sib(const rrc_cell_cfg_nr_t& cell_cfg, serving_ce } cfg.ss_pbch_block_pwr = cell_cfg.phy_cell.pdsch.rs_power; + + return SRSRAN_SUCCESS; } int fill_sib1_from_enb_cfg(const rrc_nr_cfg_t& cfg, uint32_t cc, asn1::rrc_nr::sib1_s& sib1) @@ -1269,7 +1268,7 @@ int fill_sib1_from_enb_cfg(const rrc_nr_cfg_t& cfg, uint32_t cc, asn1::rrc_nr::s // sib1.si_sched_info.sched_info_list[0].sib_map_info[0].value_tag = 0; sib1.serving_cell_cfg_common_present = true; - fill_serv_cell_cfg_common_sib(cell_cfg, sib1.serving_cell_cfg_common); + HANDLE_ERROR(fill_serv_cell_cfg_common_sib(cell_cfg, sib1.serving_cell_cfg_common)); sib1.ue_timers_and_consts_present = true; sib1.ue_timers_and_consts.t300.value = ue_timers_and_consts_s::t300_opts::ms1000; diff --git a/srsgnb/src/stack/rrc/rrc_nr.cc b/srsgnb/src/stack/rrc/rrc_nr.cc index b241958a6..676ba17b7 100644 --- a/srsgnb/src/stack/rrc/rrc_nr.cc +++ b/srsgnb/src/stack/rrc/rrc_nr.cc @@ -95,13 +95,13 @@ int rrc_nr::init(const rrc_nr_cfg_t& cfg_, int ret = fill_sp_cell_cfg_from_enb_cfg(cfg, UE_PSCELL_CC_IDX, base_sp_cell_cfg); srsran_assert(ret == SRSRAN_SUCCESS, "Failed to configure cell"); - pdcch_cfg_common_s* asn1_pdcch; + const pdcch_cfg_common_s* asn1_pdcch; if (not cfg.is_standalone) { // Fill rrc_nr_cfg with UE-specific search spaces and coresets asn1_pdcch = &base_sp_cell_cfg.recfg_with_sync.sp_cell_cfg_common.dl_cfg_common.init_dl_bwp.pdcch_cfg_common.setup(); } else { - asn1_pdcch = &cell_ctxt->sib1.serving_cell_cfg_common.dl_cfg_common.init_dl_bwp.pdcch_cfg_common.setup(); + asn1_pdcch = &du_cfg->cell(0).serv_cell_cfg_common().dl_cfg_common.init_dl_bwp.pdcch_cfg_common.setup(); } srsran_assert(check_nr_phy_cell_cfg_valid(cfg.cell_list[0].phy_cell) == SRSRAN_SUCCESS, "Invalid PhyCell Config"); @@ -290,7 +290,13 @@ void rrc_nr::config_phy() common_cfg.pdcch = cfg.cell_list[0].phy_cell.pdcch; common_cfg.prach = cfg.cell_list[0].phy_cell.prach; common_cfg.duplex_mode = cfg.cell_list[0].duplex_mode; - common_cfg.ssb = cfg.cell_list[0].ssb_cfg; + common_cfg.ssb = {}; + common_cfg.ssb.center_freq_hz = cfg.cell_list[0].phy_cell.dl_freq_hz; + common_cfg.ssb.ssb_freq_hz = cfg.cell_list[0].ssb_freq_hz; + common_cfg.ssb.scs = cfg.cell_list[0].ssb_scs; + common_cfg.ssb.pattern = cfg.cell_list[0].ssb_pattern; + common_cfg.ssb.duplex_mode = cfg.cell_list[0].duplex_mode; + common_cfg.ssb.periodicity_ms = du_cfg->cell(0).serv_cell_cfg_common().ssb_periodicity_serving_cell.to_number(); if (phy->set_common_cfg(common_cfg) < SRSRAN_SUCCESS) { logger.error("Couldn't set common PHY config"); return; @@ -320,12 +326,12 @@ void rrc_nr::config_mac() cell.ssb_center_freq_hz = cfg.cell_list[cc].phy_cell.carrier.ssb_center_freq_hz; cell.dmrs_type_a_position = du_cfg->cell(cc).mib.dmrs_type_a_position; cell.pdcch_cfg_sib1 = du_cfg->cell(cc).mib.pdcch_cfg_sib1; - if (du_cfg->cell(cc).sib1.serving_cell_cfg_common.tdd_ul_dl_cfg_common_present) { - cell.tdd_ul_dl_cfg_common.emplace(du_cfg->cell(cc).sib1.serving_cell_cfg_common.tdd_ul_dl_cfg_common); + if (du_cfg->cell(cc).serv_cell_cfg_common().tdd_ul_dl_cfg_common_present) { + cell.tdd_ul_dl_cfg_common.emplace(du_cfg->cell(cc).serv_cell_cfg_common().tdd_ul_dl_cfg_common); } - cell.dl_cfg_common = du_cfg->cell(cc).sib1.serving_cell_cfg_common.dl_cfg_common; - cell.ul_cfg_common = du_cfg->cell(cc).sib1.serving_cell_cfg_common.ul_cfg_common; - cell.ss_pbch_block_power = du_cfg->cell(cc).sib1.serving_cell_cfg_common.ss_pbch_block_pwr; + cell.dl_cfg_common = du_cfg->cell(cc).serv_cell_cfg_common().dl_cfg_common; + cell.ul_cfg_common = du_cfg->cell(cc).serv_cell_cfg_common().ul_cfg_common; + cell.ss_pbch_block_power = du_cfg->cell(cc).serv_cell_cfg_common().ss_pbch_block_pwr; if (not cfg.is_standalone) { const serving_cell_cfg_common_s& serv_cell = base_sp_cell_cfg.recfg_with_sync.sp_cell_cfg_common; // Derive cell config from ASN1 @@ -335,11 +341,10 @@ void rrc_nr::config_mac() cell.ssb_periodicity_ms = serv_cell.ssb_periodicity_serving_cell.to_number(); cell.ssb_scs = serv_cell.ssb_subcarrier_spacing; } else { - const serving_cell_cfg_common_sib_s& serv_cell = cell_ctxt->sib1.serving_cell_cfg_common; - cell.bwps[0].pdsch.p_zp_csi_rs_set = {}; + cell.bwps[0].pdsch.p_zp_csi_rs_set = {}; bzero(cell.bwps[0].pdsch.nzp_csi_rs_sets, sizeof(cell.bwps[0].pdsch.nzp_csi_rs_sets)); - cell.ssb_positions_in_burst = serv_cell.ssb_positions_in_burst; - cell.ssb_periodicity_ms = serv_cell.ssb_periodicity_serving_cell.to_number(); + cell.ssb_positions_in_burst = du_cfg->cell(cc).serv_cell_cfg_common().ssb_positions_in_burst; + cell.ssb_periodicity_ms = du_cfg->cell(cc).serv_cell_cfg_common().ssb_periodicity_serving_cell.to_number(); cell.ssb_scs.value = (subcarrier_spacing_e::options)cfg.cell_list[0].phy_cell.carrier.scs; } diff --git a/srsgnb/src/stack/rrc/rrc_nr_config_utils.cc b/srsgnb/src/stack/rrc/rrc_nr_config_utils.cc index d1c008755..77ac0e6dd 100644 --- a/srsgnb/src/stack/rrc/rrc_nr_config_utils.cc +++ b/srsgnb/src/stack/rrc/rrc_nr_config_utils.cc @@ -108,7 +108,7 @@ int derive_coreset0_params(rrc_cell_cfg_nr_t& cell) (ssb_abs_freq_Hz > pointA_abs_freq_Hz) ? (uint32_t)(ssb_abs_freq_Hz - pointA_abs_freq_Hz) : 0; int ret = srsran_coreset_zero(cell.phy_cell.carrier.pci, ssb_pointA_freq_offset_Hz, - cell.ssb_cfg.scs, + cell.ssb_scs, cell.phy_cell.carrier.scs, cell.coreset0_idx, &cell.phy_cell.pdcch.coreset[0]); @@ -122,7 +122,7 @@ int derive_ssb_params(bool is_sa, srsran_subcarrier_spacing_t pdcch_scs, uint32_t coreset0_idx, uint32_t nof_prb, - srsran_ssb_cfg_t& ssb) + rrc_cell_cfg_nr_t& cell) { // Verify essential parameters are specified and valid ERROR_IF_NOT(dl_arfcn > 0, "Invalid DL ARFCN=%d", dl_arfcn); @@ -136,20 +136,17 @@ int derive_ssb_params(bool is_sa, double dl_freq_hz = band_helper.nr_arfcn_to_freq(dl_arfcn); uint32_t dl_absolute_freq_point_a = band_helper.get_abs_freq_point_a_arfcn(nof_prb, dl_arfcn); - ssb.center_freq_hz = dl_freq_hz; - ssb.duplex_mode = band_helper.get_duplex_mode(band); - // derive SSB pattern and scs - ssb.pattern = band_helper.get_ssb_pattern(band, srsran_subcarrier_spacing_15kHz); - if (ssb.pattern == SRSRAN_SSB_PATTERN_A) { + cell.ssb_pattern = band_helper.get_ssb_pattern(band, srsran_subcarrier_spacing_15kHz); + if (cell.ssb_pattern == SRSRAN_SSB_PATTERN_A) { // 15kHz SSB SCS - ssb.scs = srsran_subcarrier_spacing_15kHz; + cell.ssb_scs = srsran_subcarrier_spacing_15kHz; } else { // try to optain SSB pattern for same band with 30kHz SCS - ssb.pattern = band_helper.get_ssb_pattern(band, srsran_subcarrier_spacing_30kHz); - if (ssb.pattern == SRSRAN_SSB_PATTERN_B || ssb.pattern == SRSRAN_SSB_PATTERN_C) { + cell.ssb_pattern = band_helper.get_ssb_pattern(band, srsran_subcarrier_spacing_30kHz); + if (cell.ssb_pattern == SRSRAN_SSB_PATTERN_B || cell.ssb_pattern == SRSRAN_SSB_PATTERN_C) { // SSB SCS is 30 kHz - ssb.scs = srsran_subcarrier_spacing_30kHz; + cell.ssb_scs = srsran_subcarrier_spacing_30kHz; } else { srsran_terminate("Can't derive SSB pattern from band %d", band); } @@ -159,29 +156,20 @@ int derive_ssb_params(bool is_sa, int coreset0_rb_offset = 0; if (is_sa) { // Get offset in RBs between CORESET#0 and SSB - coreset0_rb_offset = srsran_coreset0_ssb_offset(coreset0_idx, ssb.scs, pdcch_scs); + coreset0_rb_offset = srsran_coreset0_ssb_offset(coreset0_idx, cell.ssb_scs, pdcch_scs); ERROR_IF_NOT(coreset0_rb_offset >= 0, "Failed to compute RB offset between CORESET#0 and SSB"); } else { // TODO: Verify if specified SSB frequency is valid } uint32_t ssb_abs_freq_point = - band_helper.get_abs_freq_ssb_arfcn(band, ssb.scs, dl_absolute_freq_point_a, coreset0_rb_offset); + band_helper.get_abs_freq_ssb_arfcn(band, cell.ssb_scs, dl_absolute_freq_point_a, coreset0_rb_offset); ERROR_IF_NOT(ssb_abs_freq_point > 0, "Can't derive SSB freq point for dl_arfcn=%d and band %d", band_helper.freq_to_nr_arfcn(dl_freq_hz), band); // Convert to frequency for PHY - ssb.ssb_freq_hz = band_helper.nr_arfcn_to_freq(ssb_abs_freq_point); - - ssb.periodicity_ms = 10; // TODO: make a param - ssb.beta_pss = 0.0; - ssb.beta_sss = 0.0; - ssb.beta_pbch = 0.0; - ssb.beta_pbch_dmrs = 0.0; - // set by PHY layer in worker_pool::set_common_cfg - ssb.srate_hz = 0.0; - ssb.scaling = 0.0; + cell.ssb_freq_hz = band_helper.nr_arfcn_to_freq(ssb_abs_freq_point); return SRSRAN_SUCCESS; } @@ -250,9 +238,9 @@ int set_derived_nr_cell_params(bool is_sa, rrc_cell_cfg_nr_t& cell) cell.phy_cell.carrier.scs, cell.coreset0_idx, cell.phy_cell.carrier.nof_prb, - cell.ssb_cfg); - cell.phy_cell.carrier.ssb_center_freq_hz = cell.ssb_cfg.ssb_freq_hz; - cell.ssb_absolute_freq_point = band_helper.freq_to_nr_arfcn(cell.ssb_cfg.ssb_freq_hz); + cell); + cell.phy_cell.carrier.ssb_center_freq_hz = cell.ssb_freq_hz; + cell.ssb_absolute_freq_point = band_helper.freq_to_nr_arfcn(cell.ssb_freq_hz); // Derive remaining config params if (is_sa) { @@ -337,7 +325,6 @@ int set_derived_nr_rrc_params(rrc_nr_cfg_t& rrc_cfg) int check_nr_cell_cfg_valid(const rrc_cell_cfg_nr_t& cell, bool is_sa) { // verify SSB params are consistent - ERROR_IF_NOT(cell.ssb_cfg.center_freq_hz == cell.phy_cell.dl_freq_hz, "Invalid SSB param generation"); HANDLE_ERROR(check_nr_phy_cell_cfg_valid(cell.phy_cell)); if (is_sa) {