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.
master
Andre Puschmann 3 years ago
parent b134781d36
commit 26cc6d7886

@ -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;

@ -67,7 +67,6 @@ static int parse_args(all_args_t* args, int argc, char* argv[])
common.add_options()
("ue.radio", bpo::value<string>(&args->rf.type)->default_value("multi"), "Type of the radio [multi]")
("ue.phy", bpo::value<string>(&args->phy.type)->default_value("lte"), "Type of the PHY [lte]")
("ue.stack", bpo::value<string>(&args->stack.type)->default_value("lte"), "Type of the upper stack [lte, nr]")
("rf.srate", bpo::value<double>(&args->rf.srate_hz)->default_value(0.0), "Force Tx and Rx sampling rate in Hz")
("rf.freq_offset", bpo::value<float>(&args->rf.freq_offset)->default_value(0), "(optional) Frequency offset")

@ -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<ue_stack_lte>(new ue_stack_lte);
if (!stack) {
srsran::console("Error creating LTE stack instance.\n");
return SRSRAN_ERROR;
}
stack = std::unique_ptr<ue_stack_lte>(new ue_stack_lte);
if (!stack) {
srsran::console("Error creating LTE stack instance.\n");
return SRSRAN_ERROR;
}
phy = std::unique_ptr<srsue::lte_ttcn3_phy>(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<srsue::lte_ttcn3_phy>(new srsue::lte_ttcn3_phy);
if (!phy) {
srsran::console("Error creating LTE PHY instance.\n");
return SRSRAN_ERROR;
}

@ -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<ue_stack_lte> lte_stack(new ue_stack_lte);
if (!lte_stack) {
srsran::console("Error creating LTE stack instance.\n");
return SRSRAN_ERROR;
}
std::unique_ptr<gw> 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<srsue::phy> lte_phy = std::unique_ptr<srsue::phy>(new srsue::phy);
if (!lte_phy) {
srsran::console("Error creating LTE PHY instance.\n");
return SRSRAN_ERROR;
}
std::unique_ptr<srsran::radio> lte_radio = std::unique_ptr<srsran::radio>(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<ue_stack_lte> 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> 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<srsue::phy> lte_phy = std::unique_ptr<srsue::phy>(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<srsran::radio> lte_radio = std::unique_ptr<srsran::radio>(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<srsue::ue_stack_nr> nr_stack(new srsue::ue_stack_nr());
std::unique_ptr<srsran::radio_null> nr_radio(new srsran::radio_null);
std::unique_ptr<srsue::ue_phy_base> nr_phy;
std::unique_ptr<gw> 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();

Loading…
Cancel
Save