From 6fedec8223f2225ba975df4264a890108955c579 Mon Sep 17 00:00:00 2001 From: Francisco Paisana Date: Fri, 10 Apr 2020 20:36:25 +0100 Subject: [PATCH] avoid dangling scells --- srsenb/rr.conf.example | 2 +- srsenb/src/enb_cfg_parser.cc | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/srsenb/rr.conf.example b/srsenb/rr.conf.example index 4acc6ae67..247ed19b1 100644 --- a/srsenb/rr.conf.example +++ b/srsenb/rr.conf.example @@ -64,7 +64,7 @@ cell_list = // CA cells scell_list = ( - {cell_id = 0x02; cross_carrier_scheduling = false; scheduling_cell_id = 0x02; ul_allowed = true} + // {cell_id = 0x02; cross_carrier_scheduling = false; scheduling_cell_id = 0x02; ul_allowed = true} ) // Cells available for handover diff --git a/srsenb/src/enb_cfg_parser.cc b/srsenb/src/enb_cfg_parser.cc index 0eccac1f2..ff2b6f911 100644 --- a/srsenb/src/enb_cfg_parser.cc +++ b/srsenb/src/enb_cfg_parser.cc @@ -922,6 +922,22 @@ int set_derived_args(all_args_t* args_, rrc_cfg_t* rrc_cfg_, phy_cfg_t* phy_cfg_ } phy_cell_cfg.ul_freq_hz = 1e6 * srslte_band_fu(cfg.ul_earfcn); } + + for (auto scell_it = cfg.scell_list.begin(); scell_it != cfg.scell_list.end();) { + auto cell_it = std::find_if(rrc_cfg_->cell_list.begin(), + rrc_cfg_->cell_list.end(), + [scell_it](const cell_cfg_t& c) { return scell_it->cell_id == c.cell_id; }); + if (cell_it == rrc_cfg_->cell_list.end()) { + ERROR("Scell with cell_id=0x%x is not present in rr.conf. Ignoring it.\n", scell_it->cell_id); + scell_it = cfg.scell_list.erase(scell_it); + } else if (cell_it->cell_id == cfg.cell_id) { + ERROR("A cell cannot have an scell with the same cell_id=0x%x\n", cfg.cell_id); + return SRSLTE_ERROR; + } else { + scell_it++; + } + } + phy_cfg_->phy_cell_cfg.push_back(phy_cell_cfg); }