From b8b8740258cfb02e4b3dc7c1b41b3271b532b7a6 Mon Sep 17 00:00:00 2001 From: Francisco Paisana Date: Thu, 27 Feb 2020 16:29:51 +0000 Subject: [PATCH] fix wraparound in si proc and error in scell parsing --- srsenb/hdr/parser.h | 6 +++--- srsenb/src/stack/rrc/rrc.cc | 12 +++++++----- srsue/src/stack/rrc/rrc_procedures.cc | 9 +++++++-- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/srsenb/hdr/parser.h b/srsenb/hdr/parser.h index 7bd8cf8b2..413a930af 100644 --- a/srsenb/hdr/parser.h +++ b/srsenb/hdr/parser.h @@ -373,11 +373,11 @@ int parse_default_field(T& obj, template int parse_bounded_number(T& number, Setting& fieldroot, T num_min, T num_max) { - T num = (T)fieldroot; - if (num < num_min or num > num_max) { + number = (T)fieldroot; + if (number < num_min or number > num_max) { std::cout << "Parser Warning: Value of " << fieldroot.getName() << " must be within bound [" << num_min << ", " << num_max << "]\n"; - num = (num > num_max) ? num_max : num_min; + number = (number > num_max) ? num_max : num_min; } return 0; } diff --git a/srsenb/src/stack/rrc/rrc.cc b/srsenb/src/stack/rrc/rrc.cc index 657c21025..755497914 100644 --- a/srsenb/src/stack/rrc/rrc.cc +++ b/srsenb/src/stack/rrc/rrc.cc @@ -799,7 +799,7 @@ void rrc::config_mac() item.cell = cfg.cell; // copy secondary cell list info - sched_cfg[ccidx].scell_list.resize(cfg.cell_list[ccidx].scell_list.size()); + sched_cfg[ccidx].scell_list.reserve(cfg.cell_list[ccidx].scell_list.size()); for (uint32_t scidx = 0; scidx < cfg.cell_list[ccidx].scell_list.size(); ++scidx) { const auto& scellitem = cfg.cell_list[ccidx].scell_list[scidx]; // search enb_cc_idx specific to cell_id @@ -808,11 +808,13 @@ void rrc::config_mac() }); if (it == cfg.cell_list.end()) { rrc_log->warning("Secondary cell 0x%x not configured\n", scellitem.cell_id); + continue; } - uint32_t scell_enb_idx = it - cfg.cell_list.begin(); - sched_cfg[ccidx].scell_list[scidx].enb_cc_idx = scell_enb_idx; - sched_cfg[ccidx].scell_list[scidx].ul_allowed = scellitem.ul_allowed; - sched_cfg[ccidx].scell_list[scidx].cross_carrier_scheduling = scellitem.cross_carrier_sched; + sched_interface::cell_cfg_t::scell_cfg_t scellcfg; + scellcfg.enb_cc_idx = it - cfg.cell_list.begin(); + scellcfg.ul_allowed = scellitem.ul_allowed; + scellcfg.cross_carrier_scheduling = scellitem.cross_carrier_sched; + sched_cfg[ccidx].scell_list.push_back(std::move(scellcfg)); } } diff --git a/srsue/src/stack/rrc/rrc_procedures.cc b/srsue/src/stack/rrc/rrc_procedures.cc index 6e6d7cb07..9cf6285d3 100644 --- a/srsue/src/stack/rrc/rrc_procedures.cc +++ b/srsue/src/stack/rrc/rrc_procedures.cc @@ -309,8 +309,13 @@ void rrc::si_acquire_proc::start_si_acquire() rrc_ptr->mac->bcch_start_rx(si_win_start, si_win_len); // start window retry timer - uint32_t retry_period = (sib_index == 0) ? sib1_periodicity : period * nof_sib_harq_retxs; - si_acq_retry_timer.set(retry_period + (si_win_start - tti)); + uint32_t retry_period = (sib_index == 0) ? sib1_periodicity : period * nof_sib_harq_retxs; + uint32_t tics_until_si_win_start = srslte_tti_interval(si_win_start, tti); + if (tics_until_si_win_start > 10240 / 2) { + Error("The SI Window start was incorrectly calculated. si_win_start=%d, tti=%d\n", si_win_start, tti); + } + uint32_t tics_until_si_retry = retry_period + tics_until_si_win_start; + si_acq_retry_timer.set(tics_until_si_retry); si_acq_retry_timer.run(); Info("Instructed MAC to search for SIB%d, win_start=%d, win_len=%d, period=%d, sched_index=%d\n",