From 3d810bc88a6cea5cd616fcc2f2110d821b23b82e Mon Sep 17 00:00:00 2001 From: Francisco Paisana Date: Tue, 24 Aug 2021 16:53:19 +0200 Subject: [PATCH] sched,nr: fix RAR DCI values and extended RAR test --- srsenb/src/stack/mac/nr/sched_nr_helpers.cc | 4 +-- srsenb/test/mac/nr/CMakeLists.txt | 4 ++- srsenb/test/mac/nr/sched_nr_common_test.cc | 28 +++++++++++++++++++++ srsenb/test/mac/nr/sched_nr_common_test.h | 25 ++++++++++++++++++ srsenb/test/mac/nr/sched_nr_rar_test.cc | 8 +++++- 5 files changed, 65 insertions(+), 4 deletions(-) create mode 100644 srsenb/test/mac/nr/sched_nr_common_test.cc create mode 100644 srsenb/test/mac/nr/sched_nr_common_test.h diff --git a/srsenb/src/stack/mac/nr/sched_nr_helpers.cc b/srsenb/src/stack/mac/nr/sched_nr_helpers.cc index f10dc5cdf..02ea342c5 100644 --- a/srsenb/src/stack/mac/nr/sched_nr_helpers.cc +++ b/srsenb/src/stack/mac/nr/sched_nr_helpers.cc @@ -49,7 +49,7 @@ bool fill_dci_rar(prb_interval interv, uint16_t ra_rnti, const bwp_params& bwp_c { dci.mcs = 5; dci.ctx.format = srsran_dci_format_nr_1_0; - dci.ctx.ss_type = srsran_search_space_type_rar; + dci.ctx.ss_type = srsran_search_space_type_common_1; dci.ctx.rnti_type = srsran_rnti_type_ra; dci.ctx.rnti = ra_rnti; dci.ctx.coreset_id = bwp_cfg.cfg.pdcch.ra_search_space.coreset_id; @@ -111,4 +111,4 @@ void fill_ul_dci_ue_fields(const slot_ue& ue, } } // namespace sched_nr_impl -} // namespace srsenb \ No newline at end of file +} // namespace srsenb diff --git a/srsenb/test/mac/nr/CMakeLists.txt b/srsenb/test/mac/nr/CMakeLists.txt index 9af588f18..b322a109e 100644 --- a/srsenb/test/mac/nr/CMakeLists.txt +++ b/srsenb/test/mac/nr/CMakeLists.txt @@ -6,6 +6,8 @@ # the distribution. # +add_library(sched_nr_test_suite sched_nr_common_test.cc sched_nr_ue_ded_test_suite.cc) + add_executable(sched_nr_test sched_nr_test.cc sched_nr_sim_ue.cc sched_nr_ue_ded_test_suite.cc) target_link_libraries(sched_nr_test srsgnb_mac @@ -23,4 +25,4 @@ target_link_libraries(sched_nr_prb_test add_test(sched_nr_prb_test sched_nr_prb_test) add_executable(sched_nr_rar_test sched_nr_rar_test.cc) -target_link_libraries(sched_nr_rar_test srsgnb_mac srsran_common) \ No newline at end of file +target_link_libraries(sched_nr_rar_test srsgnb_mac sched_nr_test_suite srsran_common) \ No newline at end of file diff --git a/srsenb/test/mac/nr/sched_nr_common_test.cc b/srsenb/test/mac/nr/sched_nr_common_test.cc new file mode 100644 index 000000000..07839bae6 --- /dev/null +++ b/srsenb/test/mac/nr/sched_nr_common_test.cc @@ -0,0 +1,28 @@ +/** + * + * \section COPYRIGHT + * + * Copyright 2013-2021 Software Radio Systems Limited + * + * By using this file, you agree to the terms and conditions set + * forth in the LICENSE file which can be found at the top level of + * the distribution. + * + */ + +#include "sched_nr_common_test.h" +#include "srsran/support/srsran_test.h" + +namespace srsenb { + +void test_pdcch_consistency(srsran::const_span dl_pdcchs) +{ + for (const auto& pdcch : dl_pdcchs) { + if (pdcch.dci.ctx.rnti_type == srsran_rnti_type_ra) { + TESTASSERT_EQ(pdcch.dci.ctx.format, srsran_dci_format_nr_1_0); + TESTASSERT_EQ(pdcch.dci.ctx.ss_type, srsran_search_space_type_common_1); + } + } +} + +} // namespace srsenb diff --git a/srsenb/test/mac/nr/sched_nr_common_test.h b/srsenb/test/mac/nr/sched_nr_common_test.h new file mode 100644 index 000000000..74b768311 --- /dev/null +++ b/srsenb/test/mac/nr/sched_nr_common_test.h @@ -0,0 +1,25 @@ +/** + * + * \section COPYRIGHT + * + * Copyright 2013-2021 Software Radio Systems Limited + * + * By using this file, you agree to the terms and conditions set + * forth in the LICENSE file which can be found at the top level of + * the distribution. + * + */ + +#ifndef SRSRAN_SCHED_NR_COMMON_TEST_H +#define SRSRAN_SCHED_NR_COMMON_TEST_H + +#include "srsenb/hdr/stack/mac/nr/sched_nr_pdcch.h" +#include "srsran/adt/span.h" + +namespace srsenb { + +void test_pdcch_consistency(srsran::const_span dl_pdcch); + +} + +#endif // SRSRAN_SCHED_NR_COMMON_TEST_H diff --git a/srsenb/test/mac/nr/sched_nr_rar_test.cc b/srsenb/test/mac/nr/sched_nr_rar_test.cc index cf9b5b431..d15346fad 100644 --- a/srsenb/test/mac/nr/sched_nr_rar_test.cc +++ b/srsenb/test/mac/nr/sched_nr_rar_test.cc @@ -11,6 +11,7 @@ */ #include "sched_nr_cfg_generators.h" +#include "sched_nr_common_test.h" #include "srsenb/hdr/stack/mac/nr/sched_nr_cell.h" #include "srsran/common/test_common.h" #include "srsran/support/srsran_test.h" @@ -53,8 +54,10 @@ void test_single_prach() slot_ues.insert(rnti, u.try_reserve(pdcch_slot, 0)); alloc.new_slot(pdcch_slot); rasched.run_slot(alloc, slot_ues); + const bwp_slot_grid* result = &alloc.res_grid()[alloc.get_pdcch_tti()]; + test_pdcch_consistency(result->dl_pdcchs); ++pdcch_slot; - return &alloc.res_grid()[alloc.get_pdcch_tti()]; + return result; }; // Start Run @@ -64,6 +67,7 @@ void test_single_prach() TESTASSERT(result->dl_pdcchs.empty()); } + // A PRACH arrives... sched_nr_interface::dl_sched_rar_info_t rainfo{}; rainfo.preamble_idx = 10; rainfo.temp_crnti = rnti; @@ -72,6 +76,7 @@ void test_single_prach() TESTASSERT_SUCCESS(rasched.dl_rach_info(rainfo)); uint16_t ra_rnti = 1 + rainfo.ofdm_symbol_idx + 14 * rainfo.prach_slot.slot_idx() + 14 * 80 * rainfo.freq_idx; + // RAR is scheduled while (true) { result = run_slot(); if (result->is_dl()) { @@ -79,6 +84,7 @@ void test_single_prach() const auto& pdcch = result->dl_pdcchs[0]; TESTASSERT_EQ(pdcch.dci.ctx.rnti, ra_rnti); TESTASSERT_EQ(pdcch.dci.ctx.rnti_type, srsran_rnti_type_ra); + TESTASSERT(pdcch_slot < prach_slot + bwp_cfg.cell_cfg.bwps[0].rar_window_size); break; } else { TESTASSERT(result->dl_pdcchs.empty());