diff --git a/srsgnb/hdr/stack/rrc/rrc_nr.h b/srsgnb/hdr/stack/rrc/rrc_nr.h index 969671baa..85508d457 100644 --- a/srsgnb/hdr/stack/rrc/rrc_nr.h +++ b/srsgnb/hdr/stack/rrc/rrc_nr.h @@ -138,16 +138,13 @@ private: srsran::task_sched_handle task_sched; // derived - uint32_t slot_dur_ms = 0; - srslog::basic_logger& logger; - asn1::rrc_nr::sp_cell_cfg_s base_sp_cell_cfg; + uint32_t slot_dur_ms = 0; + srslog::basic_logger& logger; // vars std::unique_ptr du_cfg; struct cell_ctxt_t { - asn1::rrc_nr::sib1_s sib1; asn1::rrc_nr::sys_info_ies_s::sib_type_and_info_l_ sibs; - srsran::unique_byte_buffer_t mib_buffer = nullptr; std::vector sib_buffer; std::unique_ptr master_cell_group; srsran::phy_cfg_nr_t default_phy_ue_cfg_nr; diff --git a/srsgnb/src/stack/rrc/cell_asn1_config.cc b/srsgnb/src/stack/rrc/cell_asn1_config.cc index d50f1d3d8..a79188f0c 100644 --- a/srsgnb/src/stack/rrc/cell_asn1_config.cc +++ b/srsgnb/src/stack/rrc/cell_asn1_config.cc @@ -909,7 +909,9 @@ int fill_recfg_with_sync_from_enb_cfg(const rrc_nr_cfg_t& cfg, uint32_t cc, recf /// Fill spCellConfig with gNB config int fill_sp_cell_cfg_from_enb_cfg(const rrc_nr_cfg_t& cfg, uint32_t cc, sp_cell_cfg_s& sp_cell) { - sp_cell.recfg_with_sync_present = true; + if (not cfg.is_standalone) { + sp_cell.recfg_with_sync_present = true; + } HANDLE_ERROR(fill_recfg_with_sync_from_enb_cfg(cfg, cc, sp_cell.recfg_with_sync)); sp_cell.sp_cell_cfg_ded_present = true; @@ -1037,7 +1039,6 @@ int fill_master_cell_cfg_from_enb_cfg(const rrc_nr_cfg_t& cfg, uint32_t cc, asn1 // spCellConfig -- Need M out.sp_cell_cfg_present = true; fill_sp_cell_cfg_from_enb_cfg(cfg, cc, out.sp_cell_cfg); - out.sp_cell_cfg.recfg_with_sync_present = false; return SRSRAN_SUCCESS; } diff --git a/srsgnb/src/stack/rrc/rrc_nr.cc b/srsgnb/src/stack/rrc/rrc_nr.cc index 6e7a62e3c..160637b4c 100644 --- a/srsgnb/src/stack/rrc/rrc_nr.cc +++ b/srsgnb/src/stack/rrc/rrc_nr.cc @@ -77,12 +77,10 @@ int rrc_nr::init(const rrc_nr_cfg_t& cfg_, // Generate cell config structs cell_ctxt.reset(new cell_ctxt_t()); - if (cfg.is_standalone) { - std::unique_ptr master_cell_group{new cell_group_cfg_s()}; - int ret = fill_master_cell_cfg_from_enb_cfg(cfg, 0, *master_cell_group); - srsran_assert(ret == SRSRAN_SUCCESS, "Failed to configure MasterCellGroup"); - cell_ctxt->master_cell_group = std::move(master_cell_group); - } + std::unique_ptr master_cell_group{new cell_group_cfg_s()}; + int ret = fill_master_cell_cfg_from_enb_cfg(cfg, 0, *master_cell_group); + srsran_assert(ret == SRSRAN_SUCCESS, "Failed to configure MasterCellGroup"); + cell_ctxt->master_cell_group = std::move(master_cell_group); // derived slot_dur_ms = 1; @@ -92,12 +90,6 @@ int rrc_nr::init(const rrc_nr_cfg_t& cfg_, return SRSRAN_ERROR; } - // Fill base ASN1 cell config. - 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"); - - const pdcch_cfg_common_s* 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"); config_phy(); // if PHY is not yet initialized, config will be stored and applied on initialization @@ -327,19 +319,17 @@ void rrc_nr::config_mac() 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; + bool valid_cfg = srsran::make_pdsch_cfg_from_serv_cell(cell_ctxt->master_cell_group->sp_cell_cfg.sp_cell_cfg_ded, + &cell.bwps[0].pdsch); + srsran_assert(valid_cfg, "Invalid NR cell configuration."); if (not cfg.is_standalone) { - const serving_cell_cfg_common_s& serv_cell = base_sp_cell_cfg.recfg_with_sync.sp_cell_cfg_common; + const serving_cell_cfg_common_s& serv_cell = + cell_ctxt->master_cell_group->sp_cell_cfg.recfg_with_sync.sp_cell_cfg_common; // Derive cell config from ASN1 - bool valid_cfg = srsran::make_pdsch_cfg_from_serv_cell(base_sp_cell_cfg.sp_cell_cfg_ded, &cell.bwps[0].pdsch); - srsran_assert(valid_cfg, "Invalid NR cell configuration."); cell.ssb_positions_in_burst.in_one_group.set(0, true); cell.ssb_periodicity_ms = serv_cell.ssb_periodicity_serving_cell.to_number(); cell.ssb_scs = serv_cell.ssb_subcarrier_spacing; } else { - cell.bwps[0].pdsch.p_zp_csi_rs_set = {}; - bool valid_cfg = srsran::make_pdsch_cfg_from_serv_cell(cell_ctxt->master_cell_group->sp_cell_cfg.sp_cell_cfg_ded, - &cell.bwps[0].pdsch); - srsran_assert(valid_cfg, "Invalid NR cell configuration."); 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; @@ -353,8 +343,8 @@ void rrc_nr::config_mac() cell.sibs[i].period_rf = 16; // SIB1 is always 16 rf cell.sibs[i].si_window_slots = 160; } else { - cell.sibs[i].period_rf = cell_ctxt->sib1.si_sched_info.sched_info_list[i - 1].si_periodicity.to_number(); - cell.sibs[i].si_window_slots = cell_ctxt->sib1.si_sched_info.si_win_len.to_number(); + cell.sibs[i].period_rf = du_cfg->cell(0).sib1.si_sched_info.sched_info_list[i - 1].si_periodicity.to_number(); + cell.sibs[i].si_window_slots = du_cfg->cell(0).sib1.si_sched_info.si_win_len.to_number(); } } @@ -372,8 +362,7 @@ int32_t rrc_nr::generate_sibs() } // SIB1 packing - fill_sib1_from_enb_cfg(cfg, 0, cell_ctxt->sib1); - si_sched_info_s::sched_info_list_l_& sched_info = cell_ctxt->sib1.si_sched_info.sched_info_list; + const si_sched_info_s::sched_info_list_l_& sched_info = du_cfg->cell(0).sib1.si_sched_info.sched_info_list; // SI messages packing cell_ctxt->sibs.resize(1); @@ -383,12 +372,12 @@ int32_t rrc_nr::generate_sibs() // msg is array of SI messages, each SI message msg[i] may contain multiple SIBs // all SIBs in a SI message msg[i] share the same periodicity const uint32_t nof_messages = - cell_ctxt->sib1.si_sched_info_present ? cell_ctxt->sib1.si_sched_info.sched_info_list.size() : 0; + du_cfg->cell(0).sib1.si_sched_info_present ? du_cfg->cell(0).sib1.si_sched_info.sched_info_list.size() : 0; cell_ctxt->sib_buffer.reserve(nof_messages + 1); asn1::dyn_array msg(nof_messages + 1); // Copy SIB1 to first SI message - msg[0].msg.set_c1().set_sib_type1() = cell_ctxt->sib1; + msg[0].msg.set_c1().set_sib_type1() = du_cfg->cell(0).sib1; // Copy rest of SIBs for (uint32_t sched_info_elem = 0; sched_info_elem < nof_messages; sched_info_elem++) { @@ -431,10 +420,10 @@ int32_t rrc_nr::generate_sibs() int rrc_nr::read_pdu_bcch_bch(const uint32_t tti, srsran::byte_buffer_t& buffer) { - if (cell_ctxt->mib_buffer == nullptr || buffer.get_tailroom() < cell_ctxt->mib_buffer->N_bytes) { + if (du_cfg->cell(0).packed_mib == nullptr || buffer.get_tailroom() < du_cfg->cell(0).packed_mib->N_bytes) { return SRSRAN_ERROR; } - buffer = *cell_ctxt->mib_buffer; + buffer = *du_cfg->cell(0).packed_mib; return SRSRAN_SUCCESS; }