From 9ecb3f516d4b13f401dabcebd9ea25a357c19d47 Mon Sep 17 00:00:00 2001 From: Francisco Date: Tue, 23 Nov 2021 17:57:45 +0000 Subject: [PATCH] nr,gnb,rrc: add helper function to derive rrc cfg parameters for all cells --- srsenb/src/enb_cfg_parser.cc | 16 +++++++--------- srsgnb/hdr/stack/rrc/rrc_nr_config_utils.h | 1 + srsgnb/src/stack/rrc/rrc_nr_config_utils.cc | 8 ++++++++ 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/srsenb/src/enb_cfg_parser.cc b/srsenb/src/enb_cfg_parser.cc index 006a6daef..b9afd5bdf 100644 --- a/srsenb/src/enb_cfg_parser.cc +++ b/srsenb/src/enb_cfg_parser.cc @@ -1486,9 +1486,7 @@ int set_derived_args_nr(all_args_t* args_, rrc_nr_cfg_t* rrc_nr_cfg_, phy_cfg_t* } // Create NR dedicated cell configuration from RRC configuration - for (auto it = rrc_nr_cfg_->cell_list.begin(); it != rrc_nr_cfg_->cell_list.end(); ++it) { - auto& cfg = *it; - + for (auto& cfg : rrc_nr_cfg_->cell_list) { cfg.phy_cell.carrier.max_mimo_layers = args_->enb.nof_ports; // NR cells have the same bandwidth as EUTRA cells, adjust PRB sizes @@ -1507,12 +1505,6 @@ int set_derived_args_nr(all_args_t* args_, rrc_nr_cfg_t* rrc_nr_cfg_, phy_cfg_t* return SRSRAN_ERROR; } - // Derive cross-dependent cell params - if (set_derived_nr_cell_params(rrc_nr_cfg_->is_standalone, cfg) != SRSRAN_SUCCESS) { - ERROR("Failed to derive NR cell params."); - return SRSRAN_ERROR; - } - // phy_cell_cfg.root_seq_idx = cfg.root_seq_idx; // PRACH @@ -1525,6 +1517,12 @@ int set_derived_args_nr(all_args_t* args_, rrc_nr_cfg_t* rrc_nr_cfg_, phy_cfg_t* phy_cfg_->phy_cell_cfg_nr.push_back(cfg.phy_cell); } + // Derive cross-dependent cell params + if (set_derived_nr_rrc_params(*rrc_nr_cfg_) != SRSRAN_SUCCESS) { + ERROR("Failed to derive NR cell params."); + return SRSRAN_ERROR; + } + // MAC-NR PCAP options args_->nr_stack.mac.pcap.enable = args_->stack.mac_pcap.enable; args_->nr_stack.log = args_->stack.log; diff --git a/srsgnb/hdr/stack/rrc/rrc_nr_config_utils.h b/srsgnb/hdr/stack/rrc/rrc_nr_config_utils.h index b69204ebb..3dbb90a32 100644 --- a/srsgnb/hdr/stack/rrc/rrc_nr_config_utils.h +++ b/srsgnb/hdr/stack/rrc/rrc_nr_config_utils.h @@ -20,6 +20,7 @@ namespace srsenb { void generate_default_nr_cell(rrc_cell_cfg_nr_t& cell); int set_derived_nr_cell_params(bool is_sa, rrc_cell_cfg_nr_t& cell); +int set_derived_nr_rrc_params(rrc_nr_cfg_t& rrc_cfg); // Tests to ensure validity of config diff --git a/srsgnb/src/stack/rrc/rrc_nr_config_utils.cc b/srsgnb/src/stack/rrc/rrc_nr_config_utils.cc index ae85a3fbe..d1c008755 100644 --- a/srsgnb/src/stack/rrc/rrc_nr_config_utils.cc +++ b/srsgnb/src/stack/rrc/rrc_nr_config_utils.cc @@ -326,6 +326,14 @@ int set_derived_nr_cell_params(bool is_sa, rrc_cell_cfg_nr_t& cell) return check_nr_cell_cfg_valid(cell, is_sa); } +int set_derived_nr_rrc_params(rrc_nr_cfg_t& rrc_cfg) +{ + for (rrc_cell_cfg_nr_t& cell : rrc_cfg.cell_list) { + HANDLE_ERROR(set_derived_nr_cell_params(rrc_cfg.is_standalone, cell)); + } + return SRSRAN_SUCCESS; +} + int check_nr_cell_cfg_valid(const rrc_cell_cfg_nr_t& cell, bool is_sa) { // verify SSB params are consistent