Fix srsENB PHY log and reorganized expert args

master
Ismael Gomez 6 years ago committed by Andre Puschmann
parent 126f2efb5c
commit feafec2725

@ -74,24 +74,20 @@ struct enb_files_t {
std::string drb_config;
};
typedef struct {
std::string phy_level;
std::string phy_lib_level;
struct log_args_t {
std::string all_level;
int phy_hex_limit;
int all_hex_limit;
int file_max_size;
std::string filename;
}log_args_t;
};
struct gui_args_t {
bool enable;
};
struct expert_args_t {
phy_args_t phy;
struct general_args_t {
uint32_t rrc_inactivity_timer;
float metrics_period_secs;
bool metrics_csv_enable;
@ -105,13 +101,14 @@ struct expert_args_t {
};
struct all_args_t {
enb_args_t enb;
enb_files_t enb_files;
enb_args_t enb;
enb_files_t enb_files;
srslte::rf_args_t rf;
pcap_args_t pcap;
log_args_t log;
gui_args_t gui;
expert_args_t expert;
pcap_args_t pcap;
log_args_t log;
gui_args_t gui;
general_args_t general;
phy_args_t phy;
stack_args_t stack;
};
@ -163,8 +160,6 @@ private:
srslte::logger* logger = nullptr;
srslte::log_filter log; // Own logger for eNB
srslte::log_filter rf_log;
std::vector<srslte::log_filter*> phy_log;
srslte::log_filter pool_log;
srslte::byte_buffer_pool* pool = nullptr;

@ -41,14 +41,14 @@ typedef struct {
std::string type;
srslte::phy_log_args_t log;
float max_prach_offset_us;
int pusch_max_its;
bool pusch_8bit_decoder;
float tx_amplitude;
int nof_phy_threads;
float max_prach_offset_us;
int pusch_max_its;
bool pusch_8bit_decoder;
float tx_amplitude;
int nof_phy_threads;
std::string equalizer_mode;
float estimator_fil_w;
bool pregenerate_signals;
float estimator_fil_w;
bool pregenerate_signals;
} phy_args_t;
class phy_common

@ -63,9 +63,7 @@ enb::enb() : started(false), pool(srslte::byte_buffer_pool::get_instance(ENB_POO
enb::~enb()
{
for (auto& i : phy_log) {
delete i;
}
}
int enb::init(const all_args_t& args_)
@ -91,17 +89,6 @@ int enb::init(const all_args_t& args_)
logger = &logger_file;
}
// Create array of pointers to phy_logs
for (int i = 0; i < args.expert.phy.nof_phy_threads; i++) {
auto* mylog = new srslte::log_filter;
char tmp[16];
sprintf(tmp, "PHY%d",i);
mylog->init(tmp, logger, true);
mylog->set_level(level(args.log.phy_level));
mylog->set_hex_limit(args.log.phy_hex_limit);
phy_log.push_back(mylog);
}
pool_log.init("POOL", logger);
pool_log.set_level(srslte::LOG_LEVEL_ERROR);
pool->set_log(&pool_log);
@ -131,7 +118,7 @@ int enb::init(const all_args_t& args_)
return SRSLTE_ERROR;
}
if (lte_phy->init(args.expert.phy, phy_cfg, lte_radio.get(), lte_stack.get())) {
if (lte_phy->init(args.phy, phy_cfg, lte_radio.get(), lte_stack.get())) {
log.console("Error initializing PHY.\n");
return SRSLTE_ERROR;
}
@ -204,8 +191,8 @@ int enb::parse_args(const all_args_t& args_)
phy_cfg.pdsch_cnfg.p_b = 1; // Default TM2,3,4
}
rrc_cfg.inactivity_timeout_ms = args.expert.rrc_inactivity_timer;
rrc_cfg.enable_mbsfn = args.expert.enable_mbsfn;
rrc_cfg.inactivity_timeout_ms = args.general.rrc_inactivity_timer;
rrc_cfg.enable_mbsfn = args.general.enable_mbsfn;
// Check number of control symbols
if (cell_cfg.nof_prb < 50 && args.stack.mac.sched.nof_ctrl_symbols != 3) {
@ -218,7 +205,7 @@ int enb::parse_args(const all_args_t& args_)
// Parse EEA preference list
std::vector<std::string> eea_pref_list;
boost::split(eea_pref_list, args.expert.eea_pref_list, boost::is_any_of(","));
boost::split(eea_pref_list, args.general.eea_pref_list, boost::is_any_of(","));
int i = 0;
for (auto it = eea_pref_list.begin(); it != eea_pref_list.end() && i < srslte::CIPHERING_ALGORITHM_ID_N_ITEMS; it++) {
boost::trim_left(*it);
@ -232,14 +219,14 @@ int enb::parse_args(const all_args_t& args_)
rrc_cfg.eea_preference_list[i] = srslte::CIPHERING_ALGORITHM_ID_128_EEA2;
i++;
} else {
fprintf(stderr, "Failed to parse EEA prefence list %s \n", args.expert.eea_pref_list.c_str());
fprintf(stderr, "Failed to parse EEA prefence list %s \n", args.general.eea_pref_list.c_str());
return SRSLTE_ERROR;
}
}
// Parse EIA preference list
std::vector<std::string> eia_pref_list;
boost::split(eia_pref_list, args.expert.eia_pref_list, boost::is_any_of(","));
boost::split(eia_pref_list, args.general.eia_pref_list, boost::is_any_of(","));
i = 0;
for (auto it = eia_pref_list.begin(); it != eia_pref_list.end() && i < srslte::INTEGRITY_ALGORITHM_ID_N_ITEMS; it++) {
boost::trim_left(*it);
@ -253,7 +240,7 @@ int enb::parse_args(const all_args_t& args_)
rrc_cfg.eia_preference_list[i] = srslte::INTEGRITY_ALGORITHM_ID_128_EIA2;
i++;
} else {
fprintf(stderr, "Failed to parse EIA prefence list %s \n", args.expert.eia_pref_list.c_str());
fprintf(stderr, "Failed to parse EIA prefence list %s \n", args.general.eia_pref_list.c_str());
return SRSLTE_ERROR;
}
}

@ -661,7 +661,7 @@ int enb::parse_sibs(all_args_t* args, rrc_cfg_t* rrc_cfg, phy_cfg_t* phy_config_
}
// Update MBSFN list counter. Only 1 supported
if (not args->expert.enable_mbsfn) {
if (not args->general.enable_mbsfn) {
sib2->mbsfn_sf_cfg_list_present = false;
sib2->mbsfn_sf_cfg_list.resize(0);
} else {

@ -102,9 +102,9 @@ void parse_args(all_args_t *args, int argc, char* argv[]) {
("gui.enable", bpo::value<bool>(&args->gui.enable)->default_value(false), "Enable GUI plots")
("log.phy_level", bpo::value<string>(&args->log.phy_level), "PHY log level")
("log.phy_hex_limit", bpo::value<int>(&args->log.phy_hex_limit), "PHY log hex dump limit")
("log.phy_lib_level", bpo::value<string>(&args->log.phy_lib_level)->default_value("none"), "PHY lib log level")
("log.phy_level", bpo::value<string>(&args->phy.log.phy_level), "PHY log level")
("log.phy_hex_limit", bpo::value<int>(&args->phy.log.phy_hex_limit), "PHY log hex dump limit")
("log.phy_lib_level", bpo::value<string>(&args->phy.log.phy_lib_level)->default_value("none"), "PHY lib log level")
("log.mac_level", bpo::value<string>(&args->stack.log.mac_level), "MAC log level")
("log.mac_hex_limit", bpo::value<int>(&args->stack.log.mac_hex_limit), "MAC log hex dump limit")
("log.rlc_level", bpo::value<string>(&args->stack.log.rlc_level), "RLC log level")
@ -132,25 +132,25 @@ void parse_args(all_args_t *args, int argc, char* argv[]) {
("scheduler.nof_ctrl_symbols", bpo::value<int>(&args->stack.mac.sched.nof_ctrl_symbols)->default_value(3), "Number of control symbols")
/* Expert section */
("expert.metrics_period_secs", bpo::value<float>(&args->expert.metrics_period_secs)->default_value(1.0), "Periodicity for metrics in seconds")
("expert.metrics_csv_enable", bpo::value<bool>(&args->expert.metrics_csv_enable)->default_value(false), "Write metrics to CSV file")
("expert.metrics_csv_filename", bpo::value<string>(&args->expert.metrics_csv_filename)->default_value("/tmp/enb_metrics.csv"), "Metrics CSV filename")
("expert.pregenerate_signals", bpo::value<bool>(&args->expert.phy.pregenerate_signals)->default_value(false), "Pregenerate uplink signals after attach. Improves CPU performance.")
("expert.pusch_max_its", bpo::value<int>(&args->expert.phy.pusch_max_its)->default_value(8), "Maximum number of turbo decoder iterations")
("expert.pusch_8bit_decoder", bpo::value<bool>(&args->expert.phy.pusch_8bit_decoder)->default_value(false), "Use 8-bit for LLR representation and turbo decoder trellis computation (Experimental)")
("expert.tx_amplitude", bpo::value<float>(&args->expert.phy.tx_amplitude)->default_value(0.6), "Transmit amplitude factor")
("expert.nof_phy_threads", bpo::value<int>(&args->expert.phy.nof_phy_threads)->default_value(3), "Number of PHY threads")
("expert.metrics_period_secs", bpo::value<float>(&args->general.metrics_period_secs)->default_value(1.0), "Periodicity for metrics in seconds")
("expert.metrics_csv_enable", bpo::value<bool>(&args->general.metrics_csv_enable)->default_value(false), "Write metrics to CSV file")
("expert.metrics_csv_filename", bpo::value<string>(&args->general.metrics_csv_filename)->default_value("/tmp/enb_metrics.csv"), "Metrics CSV filename")
("expert.pregenerate_signals", bpo::value<bool>(&args->phy.pregenerate_signals)->default_value(false), "Pregenerate uplink signals after attach. Improves CPU performance.")
("expert.pusch_max_its", bpo::value<int>(&args->phy.pusch_max_its)->default_value(8), "Maximum number of turbo decoder iterations")
("expert.pusch_8bit_decoder", bpo::value<bool>(&args->phy.pusch_8bit_decoder)->default_value(false), "Use 8-bit for LLR representation and turbo decoder trellis computation (Experimental)")
("expert.tx_amplitude", bpo::value<float>(&args->phy.tx_amplitude)->default_value(0.6), "Transmit amplitude factor")
("expert.nof_phy_threads", bpo::value<int>(&args->phy.nof_phy_threads)->default_value(3), "Number of PHY threads")
("expert.link_failure_nof_err", bpo::value<int>(&args->stack.mac.link_failure_nof_err)->default_value(100), "Number of PUSCH failures after which a radio-link failure is triggered")
("expert.max_prach_offset_us", bpo::value<float>(&args->expert.phy.max_prach_offset_us)->default_value(30), "Maximum allowed RACH offset (in us)")
("expert.equalizer_mode", bpo::value<string>(&args->expert.phy.equalizer_mode)->default_value("mmse"), "Equalizer mode")
("expert.estimator_fil_w", bpo::value<float>(&args->expert.phy.estimator_fil_w)->default_value(0.1), "Chooses the coefficients for the 3-tap channel estimator centered filter.")
("expert.rrc_inactivity_timer", bpo::value<uint32_t>(&args->expert.rrc_inactivity_timer)->default_value(60000), "Inactivity timer in ms")
("expert.enable_mbsfn", bpo::value<bool>(&args->expert.enable_mbsfn)->default_value(false), "Enables MBMS in the eNB")
("expert.print_buffer_state", bpo::value<bool>(&args->expert.print_buffer_state)->default_value(false), "Prints on the console the buffer state every 10 seconds")
("expert.m1u_multiaddr", bpo::value<string>(&args->expert.m1u_multiaddr)->default_value("239.255.0.1"), "M1-U Multicast address the eNB joins.")
("expert.m1u_if_addr", bpo::value<string>(&args->expert.m1u_if_addr)->default_value("127.0.1.201"), "IP address of the interface the eNB will listen for M1-U traffic.")
("expert.eea_pref_list", bpo::value<string>(&args->expert.eea_pref_list)->default_value("EEA0, EEA2, EEA1"), "Ordered preference list for the selection of encryption algorithm (EEA) (default: EEA0, EEA2, EEA1).")
("expert.eia_pref_list", bpo::value<string>(&args->expert.eia_pref_list)->default_value("EIA2, EIA1, EIA0"), "Ordered preference list for the selection of integrity algorithm (EIA) (default: EIA2, EIA1, EIA0).")
("expert.max_prach_offset_us", bpo::value<float>(&args->phy.max_prach_offset_us)->default_value(30), "Maximum allowed RACH offset (in us)")
("expert.equalizer_mode", bpo::value<string>(&args->phy.equalizer_mode)->default_value("mmse"), "Equalizer mode")
("expert.estimator_fil_w", bpo::value<float>(&args->phy.estimator_fil_w)->default_value(0.1), "Chooses the coefficients for the 3-tap channel estimator centered filter.")
("expert.rrc_inactivity_timer", bpo::value<uint32_t>(&args->general.rrc_inactivity_timer)->default_value(60000), "Inactivity timer in ms")
("expert.enable_mbsfn", bpo::value<bool>(&args->general.enable_mbsfn)->default_value(false), "Enables MBMS in the eNB")
("expert.print_buffer_state", bpo::value<bool>(&args->general.print_buffer_state)->default_value(false), "Prints on the console the buffer state every 10 seconds")
("expert.m1u_multiaddr", bpo::value<string>(&args->general.m1u_multiaddr)->default_value("239.255.0.1"), "M1-U Multicast address the eNB joins.")
("expert.m1u_if_addr", bpo::value<string>(&args->general.m1u_if_addr)->default_value("127.0.1.201"), "IP address of the interface the eNB will listen for M1-U traffic.")
("expert.eea_pref_list", bpo::value<string>(&args->general.eea_pref_list)->default_value("EEA0, EEA2, EEA1"), "Ordered preference list for the selection of encryption algorithm (EEA) (default: EEA0, EEA2, EEA1).")
("expert.eia_pref_list", bpo::value<string>(&args->general.eia_pref_list)->default_value("EIA2, EIA1, EIA0"), "Ordered preference list for the selection of integrity algorithm (EIA) (default: EIA2, EIA1, EIA0).")
;
// Positional options - config file location
@ -261,7 +261,7 @@ void parse_args(all_args_t *args, int argc, char* argv[]) {
exit(1);
}
}
if (args->expert.enable_mbsfn) {
if (args->general.enable_mbsfn) {
if (args->stack.mac.sched.nof_ctrl_symbols == 3) {
fprintf(stderr,
"nof_ctrl_symbols = %d, While using MBMS, please set number of control symbols to either 1 or 2, "
@ -274,10 +274,10 @@ void parse_args(all_args_t *args, int argc, char* argv[]) {
// Apply all_level to any unset layers
if (vm.count("log.all_level")) {
if(!vm.count("log.phy_level")) {
args->log.phy_level = args->log.all_level;
args->phy.log.phy_level = args->log.all_level;
}
if (!vm.count("log.phy_lib_level")) {
args->log.phy_lib_level = args->log.all_level;
args->phy.log.phy_lib_level = args->log.all_level;
}
if(!vm.count("log.mac_level")) {
args->stack.log.mac_level = args->log.all_level;
@ -399,12 +399,12 @@ int main(int argc, char *argv[])
return SRSLTE_ERROR;
}
metricshub.init(enb, args.expert.metrics_period_secs);
metricshub.init(enb, args.general.metrics_period_secs);
metricshub.add_listener(&metrics_screen);
metrics_screen.set_handle(enb);
srsenb::metrics_csv metrics_file(args.expert.metrics_csv_filename);
if (args.expert.metrics_csv_enable) {
srsenb::metrics_csv metrics_file(args.general.metrics_csv_filename);
if (args.general.metrics_csv_enable) {
metricshub.add_listener(&metrics_file);
metrics_file.set_handle(enb);
}
@ -421,7 +421,7 @@ int main(int argc, char *argv[])
}
int cnt=0;
while (running) {
if (args.expert.print_buffer_state) {
if (args.general.print_buffer_state) {
cnt++;
if (cnt==1000) {
cnt=0;

@ -43,15 +43,14 @@ typedef _Complex float cf_t;
class phy : public ue_lte_phy_base, public thread
{
public:
phy() : workers_pool(MAX_WORKERS), common(MAX_WORKERS), thread("PHY"){};
phy(srslte::logger* logger_) : logger(logger_), workers_pool(MAX_WORKERS), common(MAX_WORKERS), thread("PHY"){};
~phy() { stop(); }
// Init defined in base class
int init(const phy_args_t& args_, srslte::logger* logger_) final;
int init(const phy_args_t& args_) final;
// Init for LTE PHYs
int init(const phy_args_t& args_,
srslte::logger* logger_,
stack_interface_phy_lte* stack_,
srslte::radio_interface_phy* radio_) final;

@ -27,6 +27,7 @@
#ifndef SRSUE_UE_LTE_PHY_BASE_H
#define SRSUE_UE_LTE_PHY_BASE_H
#include "srslte/common/log_filter.h"
#include "srsue/hdr/phy/ue_phy_base.h"
namespace srsue {
@ -39,12 +40,9 @@ public:
virtual std::string get_type() = 0;
virtual int init(const phy_args_t& args_, srslte::logger* logger_) = 0;
virtual int init(const phy_args_t& args_,
srslte::logger* logger_,
stack_interface_phy_lte* stack_,
srslte::radio_interface_phy* radio_) = 0;
virtual void stop() = 0;
virtual int init(const phy_args_t& args_) = 0;
virtual int init(const phy_args_t& args_, stack_interface_phy_lte* stack_, srslte::radio_interface_phy* radio_) = 0;
virtual void stop() = 0;
virtual void set_earfcn(std::vector<uint32_t> earfcns) = 0;

@ -41,7 +41,7 @@ public:
virtual std::string get_type() = 0;
virtual int init(const phy_args_t& args_, srslte::logger* logger_) = 0;
virtual int init(const phy_args_t& args_) = 0;
virtual void stop() = 0;

@ -102,26 +102,23 @@ bool phy::check_args(const phy_args_t& args)
}
int phy::init(const phy_args_t& args_,
srslte::logger* logger_,
stack_interface_phy_lte* stack_,
srslte::radio_interface_phy* radio_)
{
stack = stack_;
radio = radio_;
init(args_, logger_);
init(args_);
return SRSLTE_SUCCESS;
}
int phy::init(const phy_args_t& args_, srslte::logger* logger_)
int phy::init(const phy_args_t& args_)
{
mlockall(MCL_CURRENT | MCL_FUTURE);
args = args_;
logger = logger_;
set_earfcn(args.earfcn_list);
// Force frequency if given as argument

@ -86,7 +86,7 @@ int ue::init(const all_args_t& args_, srslte::logger* logger_)
return SRSLTE_ERROR;
}
std::unique_ptr<srsue::phy> lte_phy = std::unique_ptr<srsue::phy>(new srsue::phy());
std::unique_ptr<srsue::phy> lte_phy = std::unique_ptr<srsue::phy>(new srsue::phy(logger));
if (!lte_phy) {
log.console("Error creating LTE PHY instance.\n");
return SRSLTE_ERROR;
@ -104,7 +104,7 @@ int ue::init(const all_args_t& args_, srslte::logger* logger_)
return SRSLTE_ERROR;
}
if (lte_phy->init(args.phy, logger, lte_stack.get(), lte_radio.get())) {
if (lte_phy->init(args.phy, lte_stack.get(), lte_radio.get())) {
log.console("Error initializing PHY.\n");
return SRSLTE_ERROR;
}

Loading…
Cancel
Save