From 6617b9c558d4a9c0eff56a7e80733d2f5e860808 Mon Sep 17 00:00:00 2001 From: Francisco Date: Tue, 12 Oct 2021 10:48:11 +0100 Subject: [PATCH] nr,sched: simplify command line arg to enable real mac in nr_phy_test --- test/phy/CMakeLists.txt | 11 +++-------- test/phy/dummy_gnb_stack.h | 26 +++++++++++++------------- test/phy/nr_phy_test.cc | 2 +- 3 files changed, 17 insertions(+), 22 deletions(-) diff --git a/test/phy/CMakeLists.txt b/test/phy/CMakeLists.txt index 795b68829..2488cbbf0 100644 --- a/test/phy/CMakeLists.txt +++ b/test/phy/CMakeLists.txt @@ -42,11 +42,6 @@ if (RF_FOUND AND ENABLE_SRSUE AND ENABLE_SRSENB) foreach (NR_PHY_TEST_BW "10MHz" "20MHz") # For dummy and real scheduler foreach (NR_PHY_TEST_MAC_DUMMY "dummymac" "realmac") - if(${NR_PHY_TEST_MAC_DUMMY} EQUAL "dummymac") - set(NR_PHY_TEST_MAC_DUMMY_FLAG true) - else() - set(NR_PHY_TEST_MAC_DUMMY_FLAG false) - endif() # For each supported frame structure foreach (NR_PHY_TEST_DUPLEX "FDD" "6D+4U" "FR1.15-1") set(NR_PHY_TEST_DURATION_MS 50) @@ -61,7 +56,7 @@ if (RF_FOUND AND ENABLE_SRSUE AND ENABLE_SRSENB) --gnb.stack.pdsch.length=52 # Full 10 MHz BW --gnb.stack.pdsch.mcs=27 # Maximum MCS --gnb.stack.pusch.slots=none - --gnb.stack.use_dummy_sched=${NR_PHY_TEST_MAC_DUMMY_FLAG} # Use real/dummy NR MAC + --gnb.stack.use_dummy_mac=${NR_PHY_TEST_MAC_DUMMY} # Use real/dummy NR MAC ${NR_PHY_TEST_COMMON_ARGS} ) endforeach () @@ -75,7 +70,7 @@ if (RF_FOUND AND ENABLE_SRSUE AND ENABLE_SRSENB) --gnb.stack.pusch.start=0 # Start at RB 0 --gnb.stack.pusch.length=52 # Full 10 MHz BW --gnb.stack.pusch.mcs=28 # Maximum MCS - --gnb.stack.use_dummy_sched=${NR_PHY_TEST_MAC_DUMMY_FLAG} # Use real/dummy NR MAC + --gnb.stack.use_dummy_mac=${NR_PHY_TEST_MAC_DUMMY} # Use real/dummy NR MAC ${NR_PHY_TEST_COMMON_ARGS} ) @@ -91,7 +86,7 @@ if (RF_FOUND AND ENABLE_SRSUE AND ENABLE_SRSENB) --gnb.stack.pusch.start=0 # Start at RB 0 --gnb.stack.pusch.length=52 # Full 10 MHz BW --gnb.stack.pusch.mcs=28 # Maximum MCS - --gnb.stack.use_dummy_sched=${NR_PHY_TEST_MAC_DUMMY_FLAG} # Use real/dummy NR MAC + --gnb.stack.use_dummy_mac=${NR_PHY_TEST_MAC_DUMMY} # Use real/dummy NR MAC ${NR_PHY_TEST_COMMON_ARGS} ) endforeach () diff --git a/test/phy/dummy_gnb_stack.h b/test/phy/dummy_gnb_stack.h index 5e2fab7e5..c853b5598 100644 --- a/test/phy/dummy_gnb_stack.h +++ b/test/phy/dummy_gnb_stack.h @@ -61,13 +61,13 @@ public: uint32_t cqi_count = 0; ///< CQI opportunity counter uint32_t cqi_valid_count = 0; ///< Valid CQI counter pucch_metrics_t pucch = {}; - pucch_metrics_t pusch = {}; + pucch_metrics_t pusch = {}; }; private: - srslog::basic_logger& logger = srslog::fetch_basic_logger("GNB STK"); - bool use_dummy_sched = true; - const uint16_t rnti = 0x1234; + srslog::basic_logger& logger = srslog::fetch_basic_logger("GNB STK"); + bool use_dummy_mac = true; + const uint16_t rnti = 0x1234; struct { srsran::circular_array dci_location = {}; uint32_t mcs = 0; @@ -329,8 +329,8 @@ private: public: struct args_t { - srsran::phy_cfg_nr_t phy_cfg; ///< Physical layer configuration - bool use_dummy_sched = true; ///< Use dummy or real NR scheduler + srsran::phy_cfg_nr_t phy_cfg; ///< Physical layer configuration + std::string use_dummy_mac = "dummymac"; ///< Use dummy or real NR scheduler bool wait_preamble = false; ///< Whether a UE is created automatically or the stack waits for a PRACH uint16_t rnti = 0x1234; ///< C-RNTI uint32_t ss_id = 1; ///< Search Space identifier @@ -350,7 +350,7 @@ public: rnti(args.rnti), phy_cfg(args.phy_cfg), ss_id(args.ss_id), - use_dummy_sched(args.use_dummy_sched), + use_dummy_mac(args.use_dummy_mac == "dummymac"), sched_logger(srslog::fetch_basic_logger("MAC")) { logger.set_level(srslog::str_to_basic_level(args.log_level)); @@ -369,7 +369,7 @@ public: mac->cell_cfg(cells_cfg); // add UE to scheduler - if (not use_dummy_sched and not args.wait_preamble) { + if (not use_dummy_mac and not args.wait_preamble) { mac->reserve_rnti(0); srsenb::sched_nr_interface::ue_cfg_t ue_cfg = srsenb::get_default_ue_cfg(1, phy_cfg); @@ -461,7 +461,7 @@ public: logger.set_context(slot_cfg.idx); sched_logger.set_context(slot_cfg.idx); - if (not use_dummy_sched) { + if (not use_dummy_mac) { if (autofill_pdsch_bsr) { mac->rlc_buffer_state(rnti, 0, 10000, 0); } @@ -539,7 +539,7 @@ public: logger.set_context(slot_cfg.idx); sched_logger.set_context(slot_cfg.idx); - if (not use_dummy_sched) { + if (not use_dummy_mac) { int ret = mac->get_ul_sched(slot_cfg, ul_sched); return ret; @@ -618,7 +618,7 @@ public: int pucch_info(const srsran_slot_cfg_t& slot_cfg, const pucch_info_t& pucch_info) override { - if (not use_dummy_sched) { + if (not use_dummy_mac) { mac->pucch_info(slot_cfg, pucch_info); return SRSRAN_SUCCESS; } @@ -655,7 +655,7 @@ public: int pusch_info(const srsran_slot_cfg_t& slot_cfg, pusch_info_t& pusch_info) override { - if (not use_dummy_sched) { + if (not use_dummy_mac) { mac->pusch_info(slot_cfg, pusch_info); } @@ -693,7 +693,7 @@ public: void rach_detected(const rach_info_t& rach_info) override { - if (not use_dummy_sched) { + if (not use_dummy_mac) { mac->rach_detected(rach_info); task_sched.run_pending_tasks(); diff --git a/test/phy/nr_phy_test.cc b/test/phy/nr_phy_test.cc index 57ed9a069..bbc744744 100644 --- a/test/phy/nr_phy_test.cc +++ b/test/phy/nr_phy_test.cc @@ -68,7 +68,7 @@ test_bench::args_t::args_t(int argc, char** argv) ("gnb.stack.pusch.slots", bpo::value(&gnb_stack.pusch.slots)->default_value(gnb_stack.pusch.slots), "Slots enabled for PUSCH") ("gnb.stack.pusch.mcs", bpo::value(&gnb_stack.pusch.mcs)->default_value(gnb_stack.pusch.mcs), "PUSCH scheduling modulation code scheme") ("gnb.stack.log.level", bpo::value(&gnb_stack.log_level)->default_value(gnb_stack.log_level), "Stack log level") - ("gnb.stack.use_dummy_sched", bpo::value(&gnb_stack.use_dummy_sched)->default_value(true), "Use dummy or real NR scheduler") + ("gnb.stack.use_dummy_mac", bpo::value(&gnb_stack.use_dummy_mac)->default_value("dummymac"), "Use dummy or real NR scheduler (dummymac or realmac)") ; options_gnb_phy.add_options()