2020-11-26 01:25:22 -08:00
|
|
|
/**
|
2020-06-04 04:12:25 -07:00
|
|
|
*
|
2020-11-26 01:25:22 -08:00
|
|
|
* \section COPYRIGHT
|
2020-06-04 04:12:25 -07:00
|
|
|
*
|
2021-03-19 03:45:56 -07:00
|
|
|
* Copyright 2013-2021 Software Radio Systems Limited
|
2020-06-04 04:12:25 -07:00
|
|
|
*
|
2020-11-26 01:25:22 -08: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.
|
2020-06-04 04:12:25 -07:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* File: gnb_stack_nr.h
|
|
|
|
* Description: L2/L3 gNB stack class.
|
|
|
|
*****************************************************************************/
|
|
|
|
|
2021-03-19 03:45:56 -07:00
|
|
|
#ifndef SRSRAN_GNB_STACK_NR_H
|
|
|
|
#define SRSRAN_GNB_STACK_NR_H
|
2020-06-04 04:12:25 -07:00
|
|
|
|
2021-05-14 10:35:57 -07:00
|
|
|
#include "s1ap/s1ap.h"
|
2020-06-04 04:12:25 -07:00
|
|
|
#include "srsenb/hdr/stack/mac/mac_nr.h"
|
|
|
|
#include "srsenb/hdr/stack/rrc/rrc_nr.h"
|
|
|
|
#include "srsenb/hdr/stack/upper/pdcp_nr.h"
|
|
|
|
#include "srsenb/hdr/stack/upper/rlc_nr.h"
|
|
|
|
#include "upper/gtpu.h"
|
|
|
|
#include "upper/sdap.h"
|
|
|
|
|
|
|
|
#include "enb_stack_base.h"
|
|
|
|
#include "srsenb/hdr/enb.h"
|
2021-03-19 03:45:56 -07:00
|
|
|
#include "srsran/interfaces/gnb_interfaces.h"
|
2020-06-04 04:12:25 -07:00
|
|
|
|
|
|
|
// This is needed for GW
|
2021-03-19 03:45:56 -07:00
|
|
|
#include "srsran/interfaces/ue_interfaces.h"
|
2020-06-04 04:12:25 -07:00
|
|
|
#include "srsue/hdr/stack/upper/gw.h"
|
|
|
|
|
|
|
|
namespace srsenb {
|
|
|
|
|
|
|
|
class gnb_stack_nr final : public srsenb::enb_stack_base,
|
|
|
|
public stack_interface_phy_nr,
|
2020-06-11 06:38:14 -07:00
|
|
|
public stack_interface_mac,
|
2020-06-04 04:12:25 -07:00
|
|
|
public srsue::stack_interface_gw,
|
2021-03-19 03:45:56 -07:00
|
|
|
public srsran::thread
|
2020-06-04 04:12:25 -07:00
|
|
|
{
|
|
|
|
public:
|
2021-02-23 02:08:02 -08:00
|
|
|
explicit gnb_stack_nr();
|
2020-06-04 04:12:25 -07:00
|
|
|
~gnb_stack_nr() final;
|
|
|
|
|
|
|
|
int init(const srsenb::stack_args_t& args_, const rrc_nr_cfg_t& rrc_cfg_, phy_interface_stack_nr* phy_);
|
|
|
|
int init(const srsenb::stack_args_t& args_, const rrc_nr_cfg_t& rrc_cfg_);
|
|
|
|
|
|
|
|
// eNB stack base interface
|
|
|
|
void stop() final;
|
|
|
|
std::string get_type() final;
|
|
|
|
bool get_metrics(srsenb::stack_metrics_t* metrics) final;
|
|
|
|
|
2020-03-13 09:13:15 -07:00
|
|
|
// GW srsue stack_interface_gw dummy interface
|
2020-09-15 04:21:39 -07:00
|
|
|
bool is_registered() { return true; };
|
|
|
|
bool start_service_request() { return true; };
|
2020-03-13 09:13:15 -07:00
|
|
|
|
2020-06-04 04:12:25 -07:00
|
|
|
// PHY->MAC interface
|
|
|
|
int sf_indication(const uint32_t tti);
|
2020-06-11 06:38:14 -07:00
|
|
|
int rx_data_indication(rx_data_ind_t& grant);
|
2020-06-04 04:12:25 -07:00
|
|
|
|
|
|
|
// Temporary GW interface
|
2021-03-19 03:45:56 -07:00
|
|
|
void write_sdu(uint32_t lcid, srsran::unique_byte_buffer_t sdu);
|
2021-06-14 04:23:56 -07:00
|
|
|
bool has_active_radio_bearer(uint32_t eps_bearer_id);
|
2020-06-04 04:12:25 -07:00
|
|
|
bool switch_on();
|
|
|
|
void run_tti(uint32_t tti);
|
|
|
|
|
2020-06-11 06:38:14 -07:00
|
|
|
// MAC interface to trigger processing of received PDUs
|
|
|
|
void process_pdus() final;
|
|
|
|
|
2021-05-19 06:38:48 -07:00
|
|
|
void toggle_padding() { srsran::console("padding not available for NR\n"); }
|
2021-06-20 22:59:57 -07:00
|
|
|
int get_dl_sched(uint32_t tti, dl_sched_list_t& dl_sched_res) override;
|
|
|
|
int get_ul_sched(uint32_t tti, ul_sched_list_t& ul_sched_res) override;
|
2021-05-19 06:38:48 -07:00
|
|
|
|
2020-06-04 04:12:25 -07:00
|
|
|
private:
|
|
|
|
void run_thread() final;
|
2020-06-11 06:38:14 -07:00
|
|
|
void run_tti_impl(uint32_t tti);
|
2020-06-04 04:12:25 -07:00
|
|
|
|
|
|
|
// args
|
2021-02-23 02:08:02 -08:00
|
|
|
srsenb::stack_args_t args = {};
|
|
|
|
phy_interface_stack_nr* phy = nullptr;
|
2020-06-04 04:12:25 -07:00
|
|
|
|
2021-03-10 11:41:05 -08:00
|
|
|
srslog::basic_logger& rlc_logger;
|
|
|
|
|
2020-07-08 14:06:15 -07:00
|
|
|
// task scheduling
|
2020-07-08 16:13:55 -07:00
|
|
|
static const int STACK_MAIN_THREAD_PRIO = 4;
|
2021-03-19 03:45:56 -07:00
|
|
|
srsran::task_scheduler task_sched;
|
|
|
|
srsran::task_multiqueue::queue_handle sync_task_queue, ue_task_queue, gw_task_queue, mac_task_queue;
|
2020-06-04 04:12:25 -07:00
|
|
|
|
|
|
|
// derived
|
|
|
|
std::unique_ptr<mac_nr> m_mac;
|
|
|
|
std::unique_ptr<rlc_nr> m_rlc;
|
|
|
|
std::unique_ptr<pdcp_nr> m_pdcp;
|
|
|
|
std::unique_ptr<sdap> m_sdap;
|
|
|
|
std::unique_ptr<rrc_nr> m_rrc;
|
|
|
|
std::unique_ptr<srsue::gw> m_gw;
|
|
|
|
// std::unique_ptr<ngap> m_ngap;
|
|
|
|
// std::unique_ptr<srsenb::gtpu> m_gtpu;
|
|
|
|
|
|
|
|
// state
|
|
|
|
bool running = false;
|
|
|
|
uint32_t current_tti = 10240;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace srsenb
|
|
|
|
|
2021-03-19 03:45:56 -07:00
|
|
|
#endif // SRSRAN_GNB_STACK_NR_H
|