diff --git a/lib/src/asn1/rrc_nr_utils.cc b/lib/src/asn1/rrc_nr_utils.cc index 51db1b5ed..7321f0490 100644 --- a/lib/src/asn1/rrc_nr_utils.cc +++ b/lib/src/asn1/rrc_nr_utils.cc @@ -378,15 +378,20 @@ bool make_phy_search_space_cfg(const search_space_s& search_space, srsran_search } srsran_search_space.coreset_id = search_space.ctrl_res_set_id; + srsran_search_space.duration = 1; + if (search_space.dur_present) { + srsran_search_space.duration = search_space.dur; + } + if (not search_space.nrof_candidates_present) { asn1::log_warning("nrof_candidates_present option not present"); return false; } - srsran_search_space.nof_candidates[0] = search_space.nrof_candidates.aggregation_level1.value; - srsran_search_space.nof_candidates[1] = search_space.nrof_candidates.aggregation_level2.value; - srsran_search_space.nof_candidates[2] = search_space.nrof_candidates.aggregation_level4.value; - srsran_search_space.nof_candidates[3] = search_space.nrof_candidates.aggregation_level8.value; - srsran_search_space.nof_candidates[4] = search_space.nrof_candidates.aggregation_level16.value; + srsran_search_space.nof_candidates[0] = search_space.nrof_candidates.aggregation_level1.to_number(); + srsran_search_space.nof_candidates[1] = search_space.nrof_candidates.aggregation_level2.to_number(); + srsran_search_space.nof_candidates[2] = search_space.nrof_candidates.aggregation_level4.to_number(); + srsran_search_space.nof_candidates[3] = search_space.nrof_candidates.aggregation_level8.to_number(); + srsran_search_space.nof_candidates[4] = search_space.nrof_candidates.aggregation_level16.to_number(); if (not search_space.search_space_type_present) { asn1::log_warning("nrof_candidates option not present"); @@ -1579,8 +1584,13 @@ bool fill_phy_pdcch_cfg_common(const asn1::rrc_nr::pdcch_cfg_common_s& pdcch_cfg for (const search_space_s& ss : pdcch_cfg.common_search_space_list) { pdcch->search_space_present[ss.search_space_id] = true; make_phy_search_space_cfg(ss, &pdcch->search_space[ss.search_space_id]); + if (pdcch_cfg.ra_search_space_present and pdcch_cfg.ra_search_space == ss.search_space_id) { + pdcch->ra_search_space_present = true; + pdcch->ra_search_space = pdcch->search_space[ss.search_space_id]; + } } } + return true; } diff --git a/srsenb/hdr/stack/rrc/rrc_nr.h b/srsenb/hdr/stack/rrc/rrc_nr.h index 94d40fa9f..6ab39d282 100644 --- a/srsenb/hdr/stack/rrc/rrc_nr.h +++ b/srsenb/hdr/stack/rrc/rrc_nr.h @@ -121,7 +121,7 @@ public: void get_metrics(rrc_ue_metrics_t& ue_metrics) { ue_metrics = {}; /*TODO fill RRC metrics*/ }; // setters - int pack_rrc_reconfiguration(); + int pack_rrc_reconfiguration(); void deactivate_bearers(); private: @@ -210,8 +210,9 @@ private: srsran::task_sched_handle task_sched; // derived - uint32_t slot_dur_ms = 0; - srslog::basic_logger& logger; + uint32_t slot_dur_ms = 0; + srslog::basic_logger& logger; + asn1::rrc_nr::sp_cell_cfg_s base_sp_cell_cfg; // vars std::map > users; diff --git a/srsenb/src/stack/mac/nr/sched_nr_cfg.cc b/srsenb/src/stack/mac/nr/sched_nr_cfg.cc index f077d8edd..0a924b099 100644 --- a/srsenb/src/stack/mac/nr/sched_nr_cfg.cc +++ b/srsenb/src/stack/mac/nr/sched_nr_cfg.cc @@ -46,7 +46,8 @@ bwp_params_t::bwp_params_t(const cell_cfg_t& cell, const sched_args_t& sched_cfg cfg(cell.bwps[bwp_id_]), logger(srslog::fetch_basic_logger(sched_cfg_.logger_name)) { - srsran_assert(bwp_id != 0 or cfg.pdcch.coreset_present[0], "CORESET#0 has to be active for initial BWP"); + srsran_assert(cfg.pdcch.ra_search_space_present, "BWPs without RA search space not supported"); + const uint32_t ra_coreset_id = cfg.pdcch.ra_search_space.coreset_id; P = get_P(cfg.rb_width, cfg.pdsch.rbg_size_cfg_1); N_rbg = get_nof_rbgs(cfg.rb_width, cfg.start_rb, cfg.pdsch.rbg_size_cfg_1); @@ -61,14 +62,13 @@ bwp_params_t::bwp_params_t(const cell_cfg_t& cell, const sched_args_t& sched_cfg } pusch_ra_list.resize(cfg.pusch.nof_common_time_ra); - const uint32_t coreset_id = 0; srsran_sch_grant_nr_t grant; for (uint32_t m = 0; m < cfg.pusch.nof_common_time_ra; ++m) { int ret = - srsran_ra_ul_nr_time(&cfg.pusch, srsran_rnti_type_ra, srsran_search_space_type_rar, coreset_id, m, &grant); + srsran_ra_ul_nr_time(&cfg.pusch, srsran_rnti_type_ra, srsran_search_space_type_rar, ra_coreset_id, m, &grant); srsran_assert(ret == SRSRAN_SUCCESS, "Failed to obtain RA config"); pusch_ra_list[m].msg3_delay = grant.k; - ret = srsran_ra_ul_nr_time(&cfg.pusch, srsran_rnti_type_c, srsran_search_space_type_ue, coreset_id, m, &grant); + ret = srsran_ra_ul_nr_time(&cfg.pusch, srsran_rnti_type_c, srsran_search_space_type_ue, ra_coreset_id, m, &grant); pusch_ra_list[m].K = grant.k; pusch_ra_list[m].S = grant.S; pusch_ra_list[m].L = grant.L; @@ -79,7 +79,7 @@ bwp_params_t::bwp_params_t(const cell_cfg_t& cell, const sched_args_t& sched_cfg for (uint32_t sl = 0; sl < SRSRAN_NOF_SF_X_FRAME; ++sl) { for (uint32_t agg_idx = 0; agg_idx < MAX_NOF_AGGR_LEVELS; ++agg_idx) { rar_cce_list[sl][agg_idx].resize(SRSRAN_SEARCH_SPACE_MAX_NOF_CANDIDATES_NR); - int n = srsran_pdcch_nr_locations_coreset(&cell_cfg.bwps[0].pdcch.coreset[0], + int n = srsran_pdcch_nr_locations_coreset(&cell_cfg.bwps[0].pdcch.coreset[ra_coreset_id], &cell_cfg.bwps[0].pdcch.ra_search_space, 0, agg_idx, diff --git a/srsenb/src/stack/rrc/rrc_nr.cc b/srsenb/src/stack/rrc/rrc_nr.cc index cc23b5bfc..7dc973cc2 100644 --- a/srsenb/src/stack/rrc/rrc_nr.cc +++ b/srsenb/src/stack/rrc/rrc_nr.cc @@ -55,6 +55,19 @@ 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"); + + // Fill rrc_nr_cfg with UE-specific search spaces and coresets + bool ret2 = srsran::fill_phy_pdcch_cfg_common( + base_sp_cell_cfg.recfg_with_sync.sp_cell_cfg_common.dl_cfg_common.init_dl_bwp.pdcch_cfg_common.setup(), + &cfg.cell_list[0].phy_cell.pdcch); + srsran_assert(ret2, "Invalid NR cell configuration."); + ret2 = srsran::fill_phy_pdcch_cfg(base_sp_cell_cfg.sp_cell_cfg_ded.init_dl_bwp.pdcch_cfg.setup(), + &cfg.cell_list[0].phy_cell.pdcch); + srsran_assert(ret2, "Invalid NR cell configuration."); + config_phy(); // if PHY is not yet initialized, config will be stored and applied on initialization config_mac(); @@ -244,24 +257,15 @@ void rrc_nr::config_mac() std::vector sched_cells_cfg = {srsenb::get_default_cells_cfg(1)}; sched_nr_interface::cell_cfg_t& cell = sched_cells_cfg[0]; - // Derive ASN1 from config - asn1::rrc_nr::sp_cell_cfg_s sp_cell; - int ret = fill_sp_cell_cfg_from_enb_cfg(cfg, UE_PSCELL_CC_IDX, sp_cell); - srsran_assert(ret == SRSRAN_SUCCESS, "Failed to configure cell"); - + // Derive cell config from rrc_nr_cfg_t + cell.bwps[0].pdcch = cfg.cell_list[0].phy_cell.pdcch; // Derive cell config from ASN1 - bool ret2 = srsran::make_pdsch_cfg_from_serv_cell(sp_cell.sp_cell_cfg_ded, &cell.bwps[0].pdsch); - srsran_assert(ret2, "Invalid NR cell configuration."); - ret2 = srsran::fill_phy_pdcch_cfg_common( - sp_cell.recfg_with_sync.sp_cell_cfg_common.dl_cfg_common.init_dl_bwp.pdcch_cfg_common.setup(), - &cell.bwps[0].pdcch); - srsran_assert(ret2, "Invalid NR cell configuration."); - ret2 = srsran::fill_phy_pdcch_cfg(sp_cell.sp_cell_cfg_ded.init_dl_bwp.pdcch_cfg.setup(), &cell.bwps[0].pdcch); + bool ret2 = srsran::make_pdsch_cfg_from_serv_cell(base_sp_cell_cfg.sp_cell_cfg_ded, &cell.bwps[0].pdsch); srsran_assert(ret2, "Invalid NR cell configuration."); ret2 = srsran::make_phy_ssb_cfg( - cfg.cell_list[0].phy_cell.carrier, sp_cell.recfg_with_sync.sp_cell_cfg_common, &cell.ssb); + cfg.cell_list[0].phy_cell.carrier, base_sp_cell_cfg.recfg_with_sync.sp_cell_cfg_common, &cell.ssb); srsran_assert(ret2, "Invalid NR cell configuration."); - ret2 = srsran::make_duplex_cfg_from_serv_cell(sp_cell.recfg_with_sync.sp_cell_cfg_common, &cell.duplex); + ret2 = srsran::make_duplex_cfg_from_serv_cell(base_sp_cell_cfg.recfg_with_sync.sp_cell_cfg_common, &cell.duplex); srsran_assert(ret2, "Invalid NR cell configuration."); // FIXME: entire SI configuration, etc needs to be ported to NR @@ -548,7 +552,10 @@ int rrc_nr::sgnb_release_request(uint16_t nr_rnti) *******************************************************************************/ rrc_nr::ue::ue(rrc_nr* parent_, uint16_t rnti_, const sched_nr_ue_cfg_t& uecfg_) : parent(parent_), rnti(rnti_), uecfg(uecfg_) -{} +{ + // Derive UE cfg from rrc_cfg_nr_t + uecfg.phy_cfg.pdcch = parent->cfg.cell_list[0].phy_cell.pdcch; +} void rrc_nr::ue::send_connection_setup() { @@ -1315,11 +1322,6 @@ void rrc_nr::ue::crnti_ce_received() &uecfg.phy_cfg.ssb); srsran::make_duplex_cfg_from_serv_cell(cell_group_cfg.sp_cell_cfg.recfg_with_sync.sp_cell_cfg_common, &uecfg.phy_cfg.duplex); - srsran::fill_phy_pdcch_cfg_common(cell_group_cfg.sp_cell_cfg.recfg_with_sync.sp_cell_cfg_common.dl_cfg_common - .init_dl_bwp.pdcch_cfg_common.setup(), - &uecfg.phy_cfg.pdcch); - srsran::fill_phy_pdcch_cfg(cell_group_cfg.sp_cell_cfg.sp_cell_cfg_ded.init_dl_bwp.pdcch_cfg.setup(), - &uecfg.phy_cfg.pdcch); parent->mac->ue_cfg(rnti, uecfg); }