From 8a34a3c41aceeb67bc23617f918669cbbed05144 Mon Sep 17 00:00:00 2001 From: Francisco Paisana Date: Wed, 14 Jul 2021 17:01:02 +0100 Subject: [PATCH] sched,nr: fix compilation issues in centos7 and removed unused variables --- srsenb/hdr/stack/mac/nr/sched_nr_cfg.h | 3 ++- srsenb/hdr/stack/mac/nr/sched_nr_ue.h | 1 - srsenb/src/stack/mac/nr/sched_nr_helpers.cc | 2 +- srsenb/src/stack/mac/nr/sched_nr_pdcch.cc | 4 ++++ srsenb/src/stack/mac/nr/sched_nr_rb_grid.cc | 5 +++++ srsenb/test/mac/nr/sched_nr_test.cc | 8 ++++---- 6 files changed, 16 insertions(+), 7 deletions(-) diff --git a/srsenb/hdr/stack/mac/nr/sched_nr_cfg.h b/srsenb/hdr/stack/mac/nr/sched_nr_cfg.h index 043df2914..8ec8bfe37 100644 --- a/srsenb/hdr/stack/mac/nr/sched_nr_cfg.h +++ b/srsenb/hdr/stack/mac/nr/sched_nr_cfg.h @@ -95,6 +95,7 @@ public: const ue_cfg_t* ue_cfg() const { return cfg_; } const srsran::phy_cfg_nr_t& phy() const { return cfg_->phy_cfg; } + const bwp_params& active_bwp() const { return *bwp_cfg; } const bwp_cce_pos_list& cce_pos_list(uint32_t search_id) const { return cce_positions_list[ss_id_to_cce_idx[search_id]]; @@ -102,8 +103,8 @@ public: private: uint16_t rnti = SRSRAN_INVALID_RNTI; - const bwp_params* bwp_cfg = nullptr; const ue_cfg_t* cfg_ = nullptr; + const bwp_params* bwp_cfg = nullptr; std::vector cce_positions_list; std::array ss_id_to_cce_idx; diff --git a/srsenb/hdr/stack/mac/nr/sched_nr_ue.h b/srsenb/hdr/stack/mac/nr/sched_nr_ue.h index d7fc633dc..97ece0a45 100644 --- a/srsenb/hdr/stack/mac/nr/sched_nr_ue.h +++ b/srsenb/hdr/stack/mac/nr/sched_nr_ue.h @@ -46,7 +46,6 @@ public: // UE parameters that are sector specific const ue_cc_cfg_t* cc_cfg = nullptr; - uint32_t bwp_id; tti_point pdcch_tti; tti_point pdsch_tti; tti_point pusch_tti; diff --git a/srsenb/src/stack/mac/nr/sched_nr_helpers.cc b/srsenb/src/stack/mac/nr/sched_nr_helpers.cc index e9b44bf7f..cc9469fa7 100644 --- a/srsenb/src/stack/mac/nr/sched_nr_helpers.cc +++ b/srsenb/src/stack/mac/nr/sched_nr_helpers.cc @@ -30,7 +30,7 @@ void fill_dci_common(const slot_ue& ue, const bwp_params& bwp_cfg, DciDlOrUl& dc { const static uint32_t rv_idx[4] = {0, 2, 3, 1}; - dci.bwp_id = ue.bwp_id; + dci.bwp_id = ue.cfg->active_bwp().bwp_id; dci.cc_id = ue.cc; dci.tpc = 1; // harq diff --git a/srsenb/src/stack/mac/nr/sched_nr_pdcch.cc b/srsenb/src/stack/mac/nr/sched_nr_pdcch.cc index 87371aed4..2c59d6257 100644 --- a/srsenb/src/stack/mac/nr/sched_nr_pdcch.cc +++ b/srsenb/src/stack/mac/nr/sched_nr_pdcch.cc @@ -32,6 +32,10 @@ coreset_region::coreset_region(const bwp_params& bwp_cfg_, nof_freq_res = std::count(res_active, res_active + SRSRAN_CORESET_FREQ_DOMAIN_RES_SIZE, true); srsran_assert(get_td_symbols() <= SRSRAN_CORESET_DURATION_MAX, "Possible number of time-domain OFDM symbols in CORESET must be within {1,2,3}"); + srsran_assert(nof_freq_res <= bwp_cfg_.cell_cfg.carrier.nof_prb, + "The number of frequency resources=%d of coreset_id=%d exceeds BWP bandwidth", + nof_freq_res, + coreset_id); } void coreset_region::reset() diff --git a/srsenb/src/stack/mac/nr/sched_nr_rb_grid.cc b/srsenb/src/stack/mac/nr/sched_nr_rb_grid.cc index 89df24dcc..65d90064d 100644 --- a/srsenb/src/stack/mac/nr/sched_nr_rb_grid.cc +++ b/srsenb/src/stack/mac/nr/sched_nr_rb_grid.cc @@ -119,6 +119,11 @@ alloc_result bwp_slot_allocator::alloc_rar(uint32_t alloc_result bwp_slot_allocator::alloc_pdsch(slot_ue& ue, const prb_grant& dl_grant) { + if (ue.cfg->active_bwp().bwp_id != bwp_grid.cfg->bwp_id) { + logger.warning( + "SCHED: Trying to allocate PDSCH for rnti=0x%x in inactive BWP id=%d", ue.rnti, ue.cfg->active_bwp().bwp_id); + return alloc_result::no_rnti_opportunity; + } if (ue.h_dl == nullptr) { logger.warning("SCHED: Trying to allocate PDSCH for rnti=0x%x with no available HARQs", ue.rnti); return alloc_result::no_rnti_opportunity; diff --git a/srsenb/test/mac/nr/sched_nr_test.cc b/srsenb/test/mac/nr/sched_nr_test.cc index 8d9f18b06..39fb16437 100644 --- a/srsenb/test/mac/nr/sched_nr_test.cc +++ b/srsenb/test/mac/nr/sched_nr_test.cc @@ -200,7 +200,7 @@ void sched_nr_cfg_parallel_cc_test() sched_nr_interface::ue_cfg_t uecfg = get_default_ue_cfg(cells_cfg.size()); sched_tester.add_user(0x46, uecfg, 0); - std::vector > nano_count(nof_sectors); + std::array, SRSRAN_MAX_CARRIERS> nano_count{}; for (uint32_t nof_ttis = 0; nof_ttis < max_nof_ttis; ++nof_ttis) { tti_point tti_rx(nof_ttis % 10240); tti_point tti_tx = tti_rx + TX_ENB_DELAY; @@ -229,7 +229,7 @@ void sched_nr_cfg_parallel_cc_test() TESTASSERT(tasks.pdsch_count == (int)(max_nof_ttis * nof_sectors * 0.6)); double final_avg_usec = 0; - for (uint32_t i = 0; i < nano_count.size(); ++i) { + for (uint32_t i = 0; i < nof_sectors; ++i) { final_avg_usec += nano_count[i]; } final_avg_usec = final_avg_usec / 1000.0 / max_nof_ttis / nof_sectors; @@ -251,7 +251,7 @@ void sched_nr_cfg_parallel_sf_test() sched_nr_interface::ue_cfg_t uecfg = get_default_ue_cfg(cells_cfg.size()); sched_tester.add_user(0x46, uecfg, 0); - std::vector > nano_count(nof_sectors); + std::array, SRSRAN_MAX_CARRIERS> nano_count{}; for (uint32_t nof_ttis = 0; nof_ttis < max_nof_ttis; ++nof_ttis) { tti_point tti_rx(nof_ttis % 10240); tti_point tti_tx = tti_rx + TX_ENB_DELAY; @@ -279,7 +279,7 @@ void sched_nr_cfg_parallel_sf_test() tasks.print_results(); double final_avg_usec = 0; - for (uint32_t i = 0; i < nano_count.size(); ++i) { + for (uint32_t i = 0; i < nof_sectors; ++i) { final_avg_usec += nano_count[i]; } final_avg_usec = final_avg_usec / 1000.0 / max_nof_ttis / nof_sectors;