mirror of https://github.com/PentHertz/srsLTE.git
Added infrastrukture for measurements
Init rrc_nr as part of the LTE stack
This commit is contained in:
parent
4305929ec7
commit
f7d313147a
|
@ -151,7 +151,7 @@ typedef struct {
|
|||
} phy_meas_nr_t;
|
||||
|
||||
// RRC interface for RRC NR
|
||||
class rrc_interface_rrc_nr
|
||||
class rrc_eutra_interface_rrc_nr
|
||||
{
|
||||
public:
|
||||
virtual void new_cell_meas_nr(const std::vector<phy_meas_nr_t>& meas) = 0;
|
||||
|
@ -266,6 +266,7 @@ class rrc_nr_interface_rrc
|
|||
public:
|
||||
virtual void get_eutra_nr_capabilities(srslte::byte_buffer_t* eutra_nr_caps) = 0;
|
||||
virtual void get_nr_capabilities(srslte::byte_buffer_t* nr_cap) = 0;
|
||||
virtual void phy_set_cells_to_meas(uint32_t carrier_freq_r15) = 0;
|
||||
};
|
||||
|
||||
// PDCP interface for RLC
|
||||
|
|
|
@ -63,7 +63,7 @@ class rrc : public rrc_interface_nas,
|
|||
public rrc_interface_mac,
|
||||
public rrc_interface_pdcp,
|
||||
#ifdef HAVE_5GNR
|
||||
public rrc_interface_rrc_nr,
|
||||
public rrc_eutra_interface_rrc_nr,
|
||||
#endif
|
||||
public rrc_interface_rlc,
|
||||
public srslte::timer_callback
|
||||
|
|
|
@ -45,7 +45,7 @@ class rrc_nr final : public rrc_interface_phy_nr,
|
|||
public srslte::timer_callback
|
||||
{
|
||||
public:
|
||||
rrc_nr();
|
||||
rrc_nr(srslte::task_sched_handle task_sched_);
|
||||
~rrc_nr();
|
||||
|
||||
void init(phy_interface_rrc_nr* phy_,
|
||||
|
@ -53,6 +53,7 @@ public:
|
|||
rlc_interface_rrc* rlc_,
|
||||
pdcp_interface_rrc* pdcp_,
|
||||
gw_interface_rrc* gw_,
|
||||
rrc_eutra_interface_rrc_nr* rrc_eutra_,
|
||||
srslte::timer_handler* timers_,
|
||||
stack_interface_rrc* stack_,
|
||||
const rrc_nr_args_t& args_);
|
||||
|
@ -93,11 +94,13 @@ public:
|
|||
// RRC (LTE) interface
|
||||
void get_eutra_nr_capabilities(srslte::byte_buffer_t* eutra_nr_caps);
|
||||
void get_nr_capabilities(srslte::byte_buffer_t* eutra_nr_caps);
|
||||
void phy_set_cells_to_meas(uint32_t carrier_freq_r15);
|
||||
|
||||
// STACK interface
|
||||
void cell_search_completed(const rrc_interface_phy_lte::cell_search_ret_t& cs_ret, const phy_cell_t& found_cell);
|
||||
|
||||
private:
|
||||
srslte::task_sched_handle task_sched;
|
||||
struct cmd_msg_t {
|
||||
enum { PDU, PCCH, PDU_MCH, RLF, PDU_BCCH_DLSCH, STOP } command;
|
||||
srslte::unique_byte_buffer_t pdu;
|
||||
|
@ -112,6 +115,7 @@ private:
|
|||
rlc_interface_rrc* rlc = nullptr;
|
||||
pdcp_interface_rrc* pdcp = nullptr;
|
||||
gw_interface_rrc* gw = nullptr;
|
||||
rrc_eutra_interface_rrc_nr* rrc_eutra = nullptr;
|
||||
stack_interface_rrc* stack = nullptr;
|
||||
|
||||
srslte::log_ref log_h;
|
||||
|
|
|
@ -58,6 +58,7 @@ typedef struct {
|
|||
stack_log_args_t log;
|
||||
usim_args_t usim;
|
||||
rrc_args_t rrc;
|
||||
rrc_nr_args_t rrc_nr;
|
||||
std::string ue_category_str;
|
||||
nas_args_t nas;
|
||||
gw_args_t gw;
|
||||
|
|
|
@ -84,8 +84,12 @@ void rrc::rrc_meas::update_phy()
|
|||
rrc_ptr->phy->set_cells_to_meas(obj.meas_obj.meas_obj_eutra().carrier_freq, neighbour_pcis);
|
||||
break;
|
||||
}
|
||||
case meas_obj_to_add_mod_s::meas_obj_c_::types_opts::meas_obj_nr_r15:
|
||||
// Todo NR
|
||||
#ifdef HAVE_5GNR
|
||||
case meas_obj_to_add_mod_s::meas_obj_c_::types_opts::meas_obj_nr_r15: {
|
||||
rrc_ptr->rrc_nr->phy_set_cells_to_meas(obj.meas_obj.meas_obj_nr_r15().carrier_freq_r15);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
log_h->error("Not supported\n");
|
||||
break;
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace srsue {
|
|||
|
||||
const char* rrc_nr::rrc_nr_state_text[] = {"IDLE", "CONNECTED", "CONNECTED-INACTIVE"};
|
||||
|
||||
rrc_nr::rrc_nr() : log_h("RRC") {}
|
||||
rrc_nr::rrc_nr(srslte::task_sched_handle task_sched_) : log_h("RRC"), task_sched(task_sched_) {}
|
||||
|
||||
rrc_nr::~rrc_nr() = default;
|
||||
|
||||
|
@ -27,6 +27,7 @@ void rrc_nr::init(phy_interface_rrc_nr* phy_,
|
|||
rlc_interface_rrc* rlc_,
|
||||
pdcp_interface_rrc* pdcp_,
|
||||
gw_interface_rrc* gw_,
|
||||
rrc_eutra_interface_rrc_nr* rrc_eutra_,
|
||||
srslte::timer_handler* timers_,
|
||||
stack_interface_rrc* stack_,
|
||||
const rrc_nr_args_t& args_)
|
||||
|
@ -35,13 +36,14 @@ void rrc_nr::init(phy_interface_rrc_nr* phy_,
|
|||
rlc = rlc_;
|
||||
pdcp = pdcp_;
|
||||
gw = gw_;
|
||||
rrc_eutra = rrc_eutra_;
|
||||
timers = timers_;
|
||||
stack = stack_;
|
||||
args = args_;
|
||||
|
||||
log_h->info("Creating dummy DRB on LCID=%d\n", args.coreless.drb_lcid);
|
||||
srslte::rlc_config_t rlc_cnfg = srslte::rlc_config_t::default_rlc_um_nr_config(6);
|
||||
rlc->add_bearer(args.coreless.drb_lcid, rlc_cnfg);
|
||||
// rlc->add_bearer(args.coreless.drb_lcid, rlc_cnfg);
|
||||
|
||||
srslte::pdcp_config_t pdcp_cnfg{args.coreless.drb_lcid,
|
||||
srslte::PDCP_RB_IS_DRB,
|
||||
|
@ -51,7 +53,7 @@ void rrc_nr::init(phy_interface_rrc_nr* phy_,
|
|||
srslte::pdcp_t_reordering_t::ms500,
|
||||
srslte::pdcp_discard_timer_t ::ms100};
|
||||
|
||||
pdcp->add_bearer(args.coreless.drb_lcid, pdcp_cnfg);
|
||||
// pdcp->add_bearer(args.coreless.drb_lcid, pdcp_cnfg);
|
||||
|
||||
running = true;
|
||||
}
|
||||
|
@ -64,7 +66,10 @@ void rrc_nr::stop()
|
|||
void rrc_nr::get_metrics(rrc_nr_metrics_t& m) {}
|
||||
|
||||
// Timeout callback interface
|
||||
void rrc_nr::timer_expired(uint32_t timeout_id) {}
|
||||
void rrc_nr::timer_expired(uint32_t timeout_id)
|
||||
{
|
||||
log_h->debug("[NR] Handling Timer Expired\n");
|
||||
}
|
||||
|
||||
void rrc_nr::srslte_rrc_log(const char* str) {}
|
||||
|
||||
|
@ -234,6 +239,11 @@ void rrc_nr::get_nr_capabilities(srslte::byte_buffer_t* nr_caps_pdu)
|
|||
nr_caps_pdu->N_bytes = bref.distance_bytes();
|
||||
log_h->debug_hex(nr_caps_pdu->msg, nr_caps_pdu->N_bytes, "NR capabilities (%u B)\n", nr_caps_pdu->N_bytes);
|
||||
return;
|
||||
};
|
||||
|
||||
void rrc_nr::phy_set_cells_to_meas(uint32_t carrier_freq_r15)
|
||||
{
|
||||
log_h->debug("[NR] Measuring phy cell %d \n", carrier_freq_r15);
|
||||
}
|
||||
|
||||
// RLC interface
|
||||
|
|
|
@ -32,7 +32,7 @@ ue_stack_lte::ue_stack_lte() :
|
|||
mac("MAC", &task_sched),
|
||||
rrc(this, &task_sched),
|
||||
#ifdef HAVE_5GNR
|
||||
rrc_nr(),
|
||||
rrc_nr(&task_sched),
|
||||
#endif
|
||||
pdcp(&task_sched, "PDCP"),
|
||||
nas(&task_sched),
|
||||
|
@ -122,6 +122,7 @@ int ue_stack_lte::init(const stack_args_t& args_, srslte::logger* logger_)
|
|||
pdcp.init(&rlc, &rrc, gw);
|
||||
nas.init(usim.get(), &rrc, gw, args.nas);
|
||||
#ifdef HAVE_5GNR
|
||||
rrc_nr.init(nullptr, nullptr, nullptr, nullptr, gw, &rrc, task_sched.get_timer_handler(), nullptr, args.rrc_nr);
|
||||
rrc.init(phy, &mac, &rlc, &pdcp, &nas, usim.get(), gw, &rrc_nr, args.rrc);
|
||||
#else
|
||||
rrc.init(phy, &mac, &rlc, &pdcp, &nas, usim.get(), gw, args.rrc);
|
||||
|
|
|
@ -28,7 +28,7 @@ ue_stack_nr::ue_stack_nr(srslte::logger* logger_) :
|
|||
mac.reset(new mac_nr(&task_sched));
|
||||
pdcp.reset(new srslte::pdcp(&task_sched, "PDCP"));
|
||||
rlc.reset(new srslte::rlc("RLC"));
|
||||
rrc.reset(new rrc_nr());
|
||||
rrc.reset(new rrc_nr(&task_sched));
|
||||
|
||||
// setup logging for pool, RLC and PDCP
|
||||
pool_log->set_level(srslte::LOG_LEVEL_ERROR);
|
||||
|
@ -83,7 +83,7 @@ int ue_stack_nr::init(const stack_args_t& args_)
|
|||
rrc_args.log_hex_limit = args.log.rrc_hex_limit;
|
||||
rrc_args.coreless.drb_lcid = 4;
|
||||
rrc_args.coreless.ip_addr = "192.168.1.3";
|
||||
rrc->init(phy, mac.get(), rlc.get(), pdcp.get(), gw, task_sched.get_timer_handler(), this, rrc_args);
|
||||
rrc->init(phy, mac.get(), rlc.get(), pdcp.get(), gw, nullptr, task_sched.get_timer_handler(), this, rrc_args);
|
||||
|
||||
running = true;
|
||||
start(STACK_MAIN_THREAD_PRIO);
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "srslte/upper/pdcp.h"
|
||||
#include "srsue/hdr/stack/rrc/rrc.h"
|
||||
#include "srsue/hdr/stack/rrc/rrc_meas.h"
|
||||
#include "srsue/hdr/stack/rrc/rrc_nr.h"
|
||||
#include "srsue/hdr/stack/upper/nas.h"
|
||||
#include <iostream>
|
||||
|
||||
|
@ -161,6 +162,15 @@ public:
|
|||
void reset() override {}
|
||||
};
|
||||
|
||||
class rrc_nr_test final : public srsue::rrc_nr_interface_rrc
|
||||
{
|
||||
public:
|
||||
~rrc_nr_test() = default;
|
||||
void get_eutra_nr_capabilities(srslte::byte_buffer_t* eutra_nr_caps) override{};
|
||||
void get_nr_capabilities(srslte::byte_buffer_t* nr_cap) override{};
|
||||
void phy_set_cells_to_meas(uint32_t carrier_freq_r15) override{};
|
||||
};
|
||||
|
||||
class nas_test : public srsue::nas
|
||||
{
|
||||
public:
|
||||
|
@ -232,9 +242,13 @@ public:
|
|||
pool = srslte::byte_buffer_pool::get_instance();
|
||||
nastest = std::unique_ptr<nas_test>(new nas_test(&stack->task_sched));
|
||||
pdcptest = std::unique_ptr<pdcp_test>(new pdcp_test(log_->get_service_name().c_str(), &stack->task_sched));
|
||||
rrcnrtest = std::unique_ptr<rrc_nr_test>(new rrc_nr_test());
|
||||
}
|
||||
#ifdef HAVE_5GNR
|
||||
void init() { rrc::init(&phytest, &mactest, nullptr, pdcptest.get(), nastest.get(), nullptr, nullptr, nullptr, {}); }
|
||||
void init()
|
||||
{
|
||||
rrc::init(&phytest, &mactest, nullptr, pdcptest.get(), nastest.get(), nullptr, nullptr, rrcnrtest.get(), {});
|
||||
}
|
||||
#else
|
||||
void init() { rrc::init(&phytest, &mactest, nullptr, pdcptest.get(), nastest.get(), nullptr, nullptr, {}); }
|
||||
#endif
|
||||
|
@ -347,6 +361,7 @@ public:
|
|||
private:
|
||||
std::unique_ptr<pdcp_test> pdcptest;
|
||||
std::unique_ptr<nas_test> nastest;
|
||||
std::unique_ptr<rrc_nr_test> rrcnrtest;
|
||||
uint32_t tti = 0;
|
||||
srslte::byte_buffer_pool* pool = nullptr;
|
||||
};
|
||||
|
|
|
@ -21,8 +21,9 @@ int rrc_nr_cap_request_test()
|
|||
srslte::log_ref rrc_log("RRC");
|
||||
rrc_log->set_level(srslte::LOG_LEVEL_DEBUG);
|
||||
rrc_log->set_hex_limit(-1);
|
||||
|
||||
rrc_nr rrc_nr;
|
||||
srslte::task_scheduler task_sched{512, 0, 100};
|
||||
srslte::task_sched_handle task_sched_handle(&task_sched);
|
||||
rrc_nr rrc_nr(task_sched_handle);
|
||||
srslte::byte_buffer_t caps;
|
||||
rrc_nr.get_eutra_nr_capabilities(&caps);
|
||||
rrc_nr.get_nr_capabilities(&caps);
|
||||
|
|
Loading…
Reference in New Issue