srsLTE/srsenb/hdr/enb.h

182 lines
4.6 KiB
C
Raw Normal View History

/**
2017-06-02 03:46:06 -07:00
*
* \section COPYRIGHT
2017-06-02 03:46:06 -07:00
*
2021-03-19 03:45:56 -07:00
* Copyright 2013-2021 Software Radio Systems Limited
2017-06-02 03:46:06 -07:00
*
* 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.
2017-06-02 03:46:06 -07:00
*
*/
2017-06-01 03:25:57 -07:00
/******************************************************************************
* File: enb.h
* Description: Top-level eNodeB class. Creates and links all
* layers and helpers.
*****************************************************************************/
2018-03-31 10:04:04 -07:00
#ifndef SRSENB_ENB_H
#define SRSENB_ENB_H
2017-06-01 03:25:57 -07:00
#include <pthread.h>
2017-06-01 03:25:57 -07:00
#include <stdarg.h>
#include <string>
#include "phy/phy.h"
2021-03-19 03:45:56 -07:00
#include "srsran/radio/radio.h"
2017-06-01 03:25:57 -07:00
#include "srsenb/hdr/phy/enb_phy_base.h"
#include "srsenb/hdr/stack/enb_stack_base.h"
#include "srsenb/hdr/stack/rrc/rrc_config.h"
#include "srsenb/hdr/stack/gnb_stack_nr.h"
#include "srsenb/hdr/stack/mac/sched_interface.h"
2021-03-19 03:45:56 -07:00
#include "srsran/common/bcd_helpers.h"
#include "srsran/common/buffer_pool.h"
#include "srsran/common/interfaces_common.h"
#include "srsran/common/mac_pcap.h"
#include "srsran/common/security.h"
#include "srsran/interfaces/enb_command_interface.h"
#include "srsran/interfaces/enb_metrics_interface.h"
#include "srsran/interfaces/enb_time_interface.h"
#include "srsran/interfaces/enb_x2_interfaces.h"
2021-03-19 03:45:56 -07:00
#include "srsran/interfaces/ue_interfaces.h"
#include "srsran/srslog/srslog.h"
#include "srsran/system/sys_metrics_processor.h"
2017-06-01 03:25:57 -07:00
namespace srsenb {
/*******************************************************************************
eNodeB Parameters
*******************************************************************************/
struct enb_args_t {
uint32_t enb_id;
uint32_t dl_earfcn; // By default the EARFCN from rr.conf's cell list are used but this value can be used for single
// cell eNB
uint32_t n_prb;
uint32_t nof_ports;
uint32_t transmission_mode;
float p_a;
};
2017-06-01 03:25:57 -07:00
struct enb_files_t {
2017-06-01 03:25:57 -07:00
std::string sib_config;
std::string rr_config;
std::string rb_config;
};
2017-06-01 03:25:57 -07:00
struct log_args_t {
std::string all_level;
int phy_hex_limit;
int all_hex_limit;
int file_max_size;
std::string filename;
};
2017-06-01 03:25:57 -07:00
struct gui_args_t {
bool enable;
};
2017-06-01 03:25:57 -07:00
struct general_args_t {
uint32_t rrc_inactivity_timer;
2018-11-20 02:59:04 -08:00
float metrics_period_secs;
bool metrics_csv_enable;
std::string metrics_csv_filename;
bool report_json_enable;
std::string report_json_filename;
bool report_json_asn1_oct;
bool alarms_log_enable;
std::string alarms_filename;
2018-11-20 02:59:04 -08:00
bool print_buffer_state;
bool tracing_enable;
std::size_t tracing_buffcapacity;
std::string tracing_filename;
2019-02-15 04:45:00 -08:00
std::string eia_pref_list;
std::string eea_pref_list;
2021-03-31 07:47:10 -07:00
uint32_t max_mac_dl_kos;
uint32_t max_mac_ul_kos;
uint32_t gtpu_indirect_tunnel_timeout;
uint32_t rlf_release_timer_ms;
};
2017-06-01 03:25:57 -07:00
struct all_args_t {
enb_args_t enb;
enb_files_t enb_files;
2021-03-19 03:45:56 -07:00
srsran::rf_args_t rf;
log_args_t log;
gui_args_t gui;
general_args_t general;
phy_args_t phy;
stack_args_t stack;
gnb_stack_args_t nr_stack;
};
2017-06-01 03:25:57 -07:00
struct rrc_cfg_t;
2017-06-01 03:25:57 -07:00
/*******************************************************************************
Main eNB class
2017-06-01 03:25:57 -07:00
*******************************************************************************/
class enb : public enb_metrics_interface, enb_command_interface, enb_time_interface
{
2017-06-01 03:25:57 -07:00
public:
2021-01-28 03:17:18 -08:00
enb(srslog::sink& log_sink);
2017-09-05 07:51:44 -07:00
virtual ~enb();
2017-06-01 03:25:57 -07:00
int init(const all_args_t& args_);
2017-09-05 07:51:44 -07:00
2017-06-01 03:25:57 -07:00
void stop();
2017-09-05 07:51:44 -07:00
2017-06-01 03:25:57 -07:00
void start_plot();
2017-09-05 07:51:44 -07:00
2018-05-10 07:40:37 -07:00
void print_pool();
2017-06-01 03:25:57 -07:00
// eNodeB metrics interface
bool get_metrics(enb_metrics_t* m) override;
// eNodeB command interface
void cmd_cell_gain(uint32_t cell_id, float gain) override;
2017-06-01 03:25:57 -07:00
2021-05-19 06:38:48 -07:00
void toggle_padding() override;
void tti_clock() override;
2017-06-01 03:25:57 -07:00
private:
const static int ENB_POOL_SIZE = 1024 * 10;
2018-07-06 06:30:51 -07:00
int parse_args(const all_args_t& args_, rrc_cfg_t& rrc_cfg_, rrc_nr_cfg_t& rrc_cfg_nr_);
2021-01-28 03:17:18 -08:00
srslog::sink& log_sink;
srslog::basic_logger& enb_log;
all_args_t args = {};
std::atomic<bool> started = {false};
2017-06-01 03:25:57 -07:00
phy_cfg_t phy_cfg = {};
rrc_cfg_t rrc_cfg = {};
rrc_nr_cfg_t rrc_nr_cfg = {};
// eNB components
std::unique_ptr<x2_interface> x2;
std::unique_ptr<enb_stack_base> eutra_stack = nullptr;
std::unique_ptr<enb_stack_base> nr_stack = nullptr;
std::unique_ptr<srsran::radio_base> radio = nullptr;
std::unique_ptr<enb_phy_base> phy = nullptr;
2017-06-01 03:25:57 -07:00
// System metrics processor.
2021-03-19 03:45:56 -07:00
srsran::sys_metrics_processor sys_proc;
2018-10-01 12:43:42 -07:00
std::string get_build_mode();
std::string get_build_info();
std::string get_build_string();
2017-06-01 03:25:57 -07:00
};
} // namespace srsenb
2018-03-31 10:04:04 -07:00
#endif // SRSENB_ENB_H