From c75e31db0340402076c0007a3bfb7015d3c33b55 Mon Sep 17 00:00:00 2001 From: Francisco Paisana Date: Tue, 5 May 2020 11:23:11 +0100 Subject: [PATCH] added random cqi to sched tester --- srsenb/src/stack/mac/scheduler_grid.cc | 2 +- srsenb/test/mac/scheduler_ca_test.cc | 8 ++++---- srsenb/test/mac/scheduler_test_common.cc | 16 ++++++++++------ srsenb/test/mac/scheduler_test_common.h | 6 +++++- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/srsenb/src/stack/mac/scheduler_grid.cc b/srsenb/src/stack/mac/scheduler_grid.cc index 7d5092b04..bfcb76748 100644 --- a/srsenb/src/stack/mac/scheduler_grid.cc +++ b/srsenb/src/stack/mac/scheduler_grid.cc @@ -407,7 +407,7 @@ alloc_outcome_t sf_grid_t::alloc_dl_data(sched_ue* user, const rbgmask_t& user_m uint32_t ue_cc_idx = user->get_cell_index(cc_cfg->enb_cc_idx).second; rbg_range_t r = user->get_required_dl_rbgs(ue_cc_idx); if (r.rbg_min > user_mask.count()) { - log_h->error("The number of RBGs allocated will force segmentation\n"); + log_h->warning("The number of RBGs allocated to rnti=0x%x will force segmentation\n", user->get_rnti()); return alloc_outcome_t::NOF_RB_INVALID; } diff --git a/srsenb/test/mac/scheduler_ca_test.cc b/srsenb/test/mac/scheduler_ca_test.cc index 2918157b3..d5fe6b894 100644 --- a/srsenb/test/mac/scheduler_ca_test.cc +++ b/srsenb/test/mac/scheduler_ca_test.cc @@ -132,16 +132,16 @@ int test_scell_activation(test_scell_activation_params params) TESTASSERT(tester.ue_tester->user_exists(rnti1)); // Event (TTI=prach_tti+msg4_tot_delay): First Tx (Msg4). Goes in SRB0 and contains ConRes - while (not tester.ue_tester->get_user_state(rnti1)->msg3_tti.is_valid() or - tester.ue_tester->get_user_state(rnti1)->msg3_tti.to_uint() > generator.tti_counter) { + while (not tester.ue_tester->get_user_ctxt(rnti1)->msg3_tti.is_valid() or + tester.ue_tester->get_user_ctxt(rnti1)->msg3_tti.to_uint() > generator.tti_counter) { generator.step_tti(); tester.test_next_ttis(generator.tti_events); } generator.step_tti(); generator.add_dl_data(rnti1, msg4_size); tester.test_next_ttis(generator.tti_events); - while (not tester.ue_tester->get_user_state(rnti1)->msg4_tti.is_valid() or - tester.ue_tester->get_user_state(rnti1)->msg4_tti.to_uint() > generator.tti_counter) { + while (not tester.ue_tester->get_user_ctxt(rnti1)->msg4_tti.is_valid() or + tester.ue_tester->get_user_ctxt(rnti1)->msg4_tti.to_uint() > generator.tti_counter) { generator.step_tti(); tester.test_next_ttis(generator.tti_events); } diff --git a/srsenb/test/mac/scheduler_test_common.cc b/srsenb/test/mac/scheduler_test_common.cc index 9edc614ad..454eeae43 100644 --- a/srsenb/test/mac/scheduler_test_common.cc +++ b/srsenb/test/mac/scheduler_test_common.cc @@ -351,6 +351,14 @@ int ue_ctxt_test::new_tti(sched* sched_ptr, srslte::tti_point tti_rx) current_tti_rx = tti_rx; TESTASSERT(fwd_pending_acks(sched_ptr) == SRSLTE_SUCCESS); + if ((tti_rx.to_uint() % cqi_Npd) == cqi_Noffset) { + for (auto& cc : active_ccs) { + sched_ptr->dl_cqi_info( + tti_rx.to_uint(), rnti, cc.enb_cc_idx, std::uniform_int_distribution{5, 24}(get_rand_gen())); + sched_ptr->ul_cqi_info( + tti_rx.to_uint(), rnti, cc.enb_cc_idx, std::uniform_int_distribution{5, 24}(get_rand_gen()), 0); + } + } return SRSLTE_SUCCESS; } @@ -856,11 +864,7 @@ sched_result_stats::user_stats* sched_result_stats::get_user(uint16_t rnti) const sched::ue_cfg_t* common_sched_tester::get_current_ue_cfg(uint16_t rnti) const { - auto it = ue_db.find(rnti); - if (it == ue_db.end()) { - return nullptr; - } - return &it->second.get_ue_cfg(); + return ue_tester->get_user_cfg(rnti); } int common_sched_tester::sim_cfg(sim_sched_args args) @@ -967,7 +971,7 @@ int common_sched_tester::process_tti_events(const tti_ev& tti_ev) bearer_ue_cfg(ue_ev.rnti, 0, ue_ev.bearer_cfg.get()); } - auto* user = ue_tester->get_user_state(ue_ev.rnti); + auto* user = ue_tester->get_user_ctxt(ue_ev.rnti); if (user != nullptr and not user->msg4_tti.is_valid() and user->msg3_tti.is_valid() and user->msg3_tti.to_uint() <= tic.tti_rx()) { diff --git a/srsenb/test/mac/scheduler_test_common.h b/srsenb/test/mac/scheduler_test_common.h index 3c3f78b98..5b21fd9c5 100644 --- a/srsenb/test/mac/scheduler_test_common.h +++ b/srsenb/test/mac/scheduler_test_common.h @@ -171,10 +171,14 @@ public: void new_tti(sched* sched_ptr, uint32_t tti_rx); bool user_exists(uint16_t rnti) const { return users.find(rnti) != users.end(); } - const ue_ctxt_test* get_user_state(uint16_t rnti) const + const ue_ctxt_test* get_user_ctxt(uint16_t rnti) const { return users.count(rnti) > 0 ? &users.find(rnti)->second : nullptr; } + const sched::ue_cfg_t* get_user_cfg(uint16_t rnti) const + { + return users.count(rnti) > 0 ? &users.find(rnti)->second.user_cfg : nullptr; + } /* Config users */ int add_user(uint16_t rnti, uint32_t preamble_idx, const srsenb::sched_interface::ue_cfg_t& ue_cfg);