From 26cc6d7886198619745a4cb3d8df1cf49b12d656 Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Tue, 21 Sep 2021 12:12:55 +0200 Subject: [PATCH] ue: remove stack type parameter for the moment we always use the LTE stack (also for NSA mode). For SA we likely pick a smarter approach to pick the stack type, i.e. using the ARFCN specified in the config. --- srsue/hdr/stack/ue_stack_base.h | 1 - srsue/src/main.cc | 1 - srsue/src/test/ttcn3/src/ttcn3_ue.cc | 22 ++-- srsue/src/ue.cc | 146 ++++++++++----------------- 4 files changed, 62 insertions(+), 108 deletions(-) diff --git a/srsue/hdr/stack/ue_stack_base.h b/srsue/hdr/stack/ue_stack_base.h index d03321763..1fa5f35ce 100644 --- a/srsue/hdr/stack/ue_stack_base.h +++ b/srsue/hdr/stack/ue_stack_base.h @@ -56,7 +56,6 @@ typedef struct { } stack_log_args_t; typedef struct { - std::string type; pkt_trace_args_t pkt_trace; stack_log_args_t log; usim_args_t usim; diff --git a/srsue/src/main.cc b/srsue/src/main.cc index fa1f9825f..e63afe241 100644 --- a/srsue/src/main.cc +++ b/srsue/src/main.cc @@ -67,7 +67,6 @@ static int parse_args(all_args_t* args, int argc, char* argv[]) common.add_options() ("ue.radio", bpo::value(&args->rf.type)->default_value("multi"), "Type of the radio [multi]") ("ue.phy", bpo::value(&args->phy.type)->default_value("lte"), "Type of the PHY [lte]") - ("ue.stack", bpo::value(&args->stack.type)->default_value("lte"), "Type of the upper stack [lte, nr]") ("rf.srate", bpo::value(&args->rf.srate_hz)->default_value(0.0), "Force Tx and Rx sampling rate in Hz") ("rf.freq_offset", bpo::value(&args->rf.freq_offset)->default_value(0), "(optional) Frequency offset") diff --git a/srsue/src/test/ttcn3/src/ttcn3_ue.cc b/srsue/src/test/ttcn3/src/ttcn3_ue.cc index 568f9d98d..4cea8d901 100644 --- a/srsue/src/test/ttcn3/src/ttcn3_ue.cc +++ b/srsue/src/test/ttcn3/src/ttcn3_ue.cc @@ -50,24 +50,18 @@ int ttcn3_ue::init(all_args_t args, syssim_interface_phy* syssim_, const std::st args.phy.dl_earfcn = "3400"; args.rf.type = "none"; - args.stack.type = "lte"; args.phy.type = "lte_ttcn3"; // Instantiate layers and stack together our UE - if (args.stack.type == "lte") { - stack = std::unique_ptr(new ue_stack_lte); - if (!stack) { - srsran::console("Error creating LTE stack instance.\n"); - return SRSRAN_ERROR; - } + stack = std::unique_ptr(new ue_stack_lte); + if (!stack) { + srsran::console("Error creating LTE stack instance.\n"); + return SRSRAN_ERROR; + } - phy = std::unique_ptr(new srsue::lte_ttcn3_phy); - if (!phy) { - srsran::console("Error creating LTE PHY instance.\n"); - return SRSRAN_ERROR; - } - } else { - srsran::console("Invalid stack type %s. Supported values are [lte].\n", args.stack.type.c_str()); + phy = std::unique_ptr(new srsue::lte_ttcn3_phy); + if (!phy) { + srsran::console("Error creating LTE PHY instance.\n"); return SRSRAN_ERROR; } diff --git a/srsue/src/ue.cc b/srsue/src/ue.cc index 9a3594ae2..d2ef6e5d0 100644 --- a/srsue/src/ue.cc +++ b/srsue/src/ue.cc @@ -54,109 +54,71 @@ int ue::init(const all_args_t& args_) } // Instantiate layers and stack together our UE - if (args.stack.type == "lte") { - std::unique_ptr lte_stack(new ue_stack_lte); - if (!lte_stack) { - srsran::console("Error creating LTE stack instance.\n"); - return SRSRAN_ERROR; - } - - std::unique_ptr gw_ptr(new gw(srslog::fetch_basic_logger("GW"))); - if (!gw_ptr) { - srsran::console("Error creating a GW instance.\n"); - return SRSRAN_ERROR; - } - - std::unique_ptr lte_phy = std::unique_ptr(new srsue::phy); - if (!lte_phy) { - srsran::console("Error creating LTE PHY instance.\n"); - return SRSRAN_ERROR; - } - - std::unique_ptr lte_radio = std::unique_ptr(new srsran::radio); - if (!lte_radio) { - srsran::console("Error creating radio multi instance.\n"); - return SRSRAN_ERROR; - } - - // init layers - if (lte_radio->init(args.rf, lte_phy.get())) { - srsran::console("Error initializing radio.\n"); - return SRSRAN_ERROR; - } - - // from here onwards do not exit immediately if something goes wrong as sub-layers may already use interfaces - if (lte_phy->init(args.phy, lte_stack.get(), lte_radio.get())) { - srsran::console("Error initializing PHY.\n"); - ret = SRSRAN_ERROR; - } + std::unique_ptr lte_stack(new ue_stack_lte); + if (!lte_stack) { + srsran::console("Error creating LTE stack instance.\n"); + return SRSRAN_ERROR; + } - srsue::phy_args_nr_t phy_args_nr = {}; - phy_args_nr.max_nof_prb = args.phy.nr_max_nof_prb; - phy_args_nr.rf_channel_offset = args.phy.nof_lte_carriers; - phy_args_nr.nof_carriers = args.phy.nof_nr_carriers; - phy_args_nr.nof_phy_threads = args.phy.nof_phy_threads; - phy_args_nr.worker_cpu_mask = args.phy.worker_cpu_mask; - phy_args_nr.log = args.phy.log; - phy_args_nr.store_pdsch_ko = args.phy.nr_store_pdsch_ko; - if (lte_phy->init(phy_args_nr, lte_stack.get(), lte_radio.get())) { - srsran::console("Error initializing NR PHY.\n"); - ret = SRSRAN_ERROR; - } + std::unique_ptr gw_ptr(new gw(srslog::fetch_basic_logger("GW"))); + if (!gw_ptr) { + srsran::console("Error creating a GW instance.\n"); + return SRSRAN_ERROR; + } - if (lte_stack->init(args.stack, lte_phy.get(), lte_phy.get(), gw_ptr.get())) { - srsran::console("Error initializing stack.\n"); - ret = SRSRAN_ERROR; - } + std::unique_ptr lte_phy = std::unique_ptr(new srsue::phy); + if (!lte_phy) { + srsran::console("Error creating LTE PHY instance.\n"); + return SRSRAN_ERROR; + } - if (gw_ptr->init(args.gw, lte_stack.get())) { - srsran::console("Error initializing GW.\n"); - ret = SRSRAN_ERROR; - } + std::unique_ptr lte_radio = std::unique_ptr(new srsran::radio); + if (!lte_radio) { + srsran::console("Error creating radio multi instance.\n"); + return SRSRAN_ERROR; + } - // move ownership - stack = std::move(lte_stack); - gw_inst = std::move(gw_ptr); - phy = std::move(lte_phy); - radio = std::move(lte_radio); - } else if (args.stack.type == "nr") { - logger.info("Initializing NR stack"); - std::unique_ptr nr_stack(new srsue::ue_stack_nr()); - std::unique_ptr nr_radio(new srsran::radio_null); - std::unique_ptr nr_phy; - std::unique_ptr gw_ptr(new gw(srslog::fetch_basic_logger("GW"))); - - // Init layers - if (nr_radio->init(args.rf, nullptr)) { - srsran::console("Error initializing radio.\n"); - return SRSRAN_ERROR; - } + // init layers + if (lte_radio->init(args.rf, lte_phy.get())) { + srsran::console("Error initializing radio.\n"); + return SRSRAN_ERROR; + } - if (nr_phy->init(args.phy)) { - srsran::console("Error initializing PHY.\n"); - return SRSRAN_ERROR; - } + // from here onwards do not exit immediately if something goes wrong as sub-layers may already use interfaces + if (lte_phy->init(args.phy, lte_stack.get(), lte_radio.get())) { + srsran::console("Error initializing PHY.\n"); + ret = SRSRAN_ERROR; + } - if (nr_stack->init(args.stack)) { - srsran::console("Error initializing stack.\n"); - return SRSRAN_ERROR; - } + srsue::phy_args_nr_t phy_args_nr = {}; + phy_args_nr.max_nof_prb = args.phy.nr_max_nof_prb; + phy_args_nr.rf_channel_offset = args.phy.nof_lte_carriers; + phy_args_nr.nof_carriers = args.phy.nof_nr_carriers; + phy_args_nr.nof_phy_threads = args.phy.nof_phy_threads; + phy_args_nr.worker_cpu_mask = args.phy.worker_cpu_mask; + phy_args_nr.log = args.phy.log; + phy_args_nr.store_pdsch_ko = args.phy.nr_store_pdsch_ko; + if (lte_phy->init(phy_args_nr, lte_stack.get(), lte_radio.get())) { + srsran::console("Error initializing NR PHY.\n"); + ret = SRSRAN_ERROR; + } - if (gw_ptr->init(args.gw, nr_stack.get())) { - srsran::console("Error initializing GW.\n"); - return SRSRAN_ERROR; - } + if (lte_stack->init(args.stack, lte_phy.get(), lte_phy.get(), gw_ptr.get())) { + srsran::console("Error initializing stack.\n"); + ret = SRSRAN_ERROR; + } - // move ownership - stack = std::move(nr_stack); - gw_inst = std::move(gw_ptr); - phy = std::move(nr_phy); - radio = std::move(nr_radio); - } else { - srsran::console("Invalid stack type %s. Supported values are [lte].\n", args.stack.type.c_str()); + if (gw_ptr->init(args.gw, lte_stack.get())) { + srsran::console("Error initializing GW.\n"); ret = SRSRAN_ERROR; } + // move ownership + stack = std::move(lte_stack); + gw_inst = std::move(gw_ptr); + phy = std::move(lte_phy); + radio = std::move(lte_radio); + if (phy) { srsran::console("Waiting PHY to initialize ... "); phy->wait_initialize();