Added infrastrukture for measurements

Init rrc_nr as part of the LTE stack
This commit is contained in:
David Rupprecht 2020-12-15 11:04:42 +01:00 committed by Andre Puschmann
parent 4305929ec7
commit f7d313147a
10 changed files with 83 additions and 46 deletions

View File

@ -151,7 +151,7 @@ typedef struct {
} phy_meas_nr_t; } phy_meas_nr_t;
// RRC interface for RRC NR // RRC interface for RRC NR
class rrc_interface_rrc_nr class rrc_eutra_interface_rrc_nr
{ {
public: public:
virtual void new_cell_meas_nr(const std::vector<phy_meas_nr_t>& meas) = 0; 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: public:
virtual void get_eutra_nr_capabilities(srslte::byte_buffer_t* eutra_nr_caps) = 0; 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 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 // PDCP interface for RLC

View File

@ -63,7 +63,7 @@ class rrc : public rrc_interface_nas,
public rrc_interface_mac, public rrc_interface_mac,
public rrc_interface_pdcp, public rrc_interface_pdcp,
#ifdef HAVE_5GNR #ifdef HAVE_5GNR
public rrc_interface_rrc_nr, public rrc_eutra_interface_rrc_nr,
#endif #endif
public rrc_interface_rlc, public rrc_interface_rlc,
public srslte::timer_callback public srslte::timer_callback

View File

@ -45,17 +45,18 @@ class rrc_nr final : public rrc_interface_phy_nr,
public srslte::timer_callback public srslte::timer_callback
{ {
public: public:
rrc_nr(); rrc_nr(srslte::task_sched_handle task_sched_);
~rrc_nr(); ~rrc_nr();
void init(phy_interface_rrc_nr* phy_, void init(phy_interface_rrc_nr* phy_,
mac_interface_rrc_nr* mac_, mac_interface_rrc_nr* mac_,
rlc_interface_rrc* rlc_, rlc_interface_rrc* rlc_,
pdcp_interface_rrc* pdcp_, pdcp_interface_rrc* pdcp_,
gw_interface_rrc* gw_, gw_interface_rrc* gw_,
srslte::timer_handler* timers_, rrc_eutra_interface_rrc_nr* rrc_eutra_,
stack_interface_rrc* stack_, srslte::timer_handler* timers_,
const rrc_nr_args_t& args_); stack_interface_rrc* stack_,
const rrc_nr_args_t& args_);
void stop(); void stop();
@ -93,11 +94,13 @@ public:
// RRC (LTE) interface // RRC (LTE) interface
void get_eutra_nr_capabilities(srslte::byte_buffer_t* eutra_nr_caps); void get_eutra_nr_capabilities(srslte::byte_buffer_t* eutra_nr_caps);
void get_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 // STACK interface
void cell_search_completed(const rrc_interface_phy_lte::cell_search_ret_t& cs_ret, const phy_cell_t& found_cell); void cell_search_completed(const rrc_interface_phy_lte::cell_search_ret_t& cs_ret, const phy_cell_t& found_cell);
private: private:
srslte::task_sched_handle task_sched;
struct cmd_msg_t { struct cmd_msg_t {
enum { PDU, PCCH, PDU_MCH, RLF, PDU_BCCH_DLSCH, STOP } command; enum { PDU, PCCH, PDU_MCH, RLF, PDU_BCCH_DLSCH, STOP } command;
srslte::unique_byte_buffer_t pdu; srslte::unique_byte_buffer_t pdu;
@ -109,10 +112,11 @@ private:
phy_interface_rrc_nr* phy = nullptr; phy_interface_rrc_nr* phy = nullptr;
// mac_interface_rrc* mac = nullptr; // mac_interface_rrc* mac = nullptr;
rlc_interface_rrc* rlc = nullptr; rlc_interface_rrc* rlc = nullptr;
pdcp_interface_rrc* pdcp = nullptr; pdcp_interface_rrc* pdcp = nullptr;
gw_interface_rrc* gw = nullptr; gw_interface_rrc* gw = nullptr;
stack_interface_rrc* stack = nullptr; rrc_eutra_interface_rrc_nr* rrc_eutra = nullptr;
stack_interface_rrc* stack = nullptr;
srslte::log_ref log_h; srslte::log_ref log_h;

View File

@ -58,6 +58,7 @@ typedef struct {
stack_log_args_t log; stack_log_args_t log;
usim_args_t usim; usim_args_t usim;
rrc_args_t rrc; rrc_args_t rrc;
rrc_nr_args_t rrc_nr;
std::string ue_category_str; std::string ue_category_str;
nas_args_t nas; nas_args_t nas;
gw_args_t gw; gw_args_t gw;

View File

@ -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); rrc_ptr->phy->set_cells_to_meas(obj.meas_obj.meas_obj_eutra().carrier_freq, neighbour_pcis);
break; break;
} }
case meas_obj_to_add_mod_s::meas_obj_c_::types_opts::meas_obj_nr_r15: #ifdef HAVE_5GNR
// Todo NR 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: default:
log_h->error("Not supported\n"); log_h->error("Not supported\n");
break; break;

View File

@ -18,30 +18,32 @@ namespace srsue {
const char* rrc_nr::rrc_nr_state_text[] = {"IDLE", "CONNECTED", "CONNECTED-INACTIVE"}; 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; rrc_nr::~rrc_nr() = default;
void rrc_nr::init(phy_interface_rrc_nr* phy_, void rrc_nr::init(phy_interface_rrc_nr* phy_,
mac_interface_rrc_nr* mac_, mac_interface_rrc_nr* mac_,
rlc_interface_rrc* rlc_, rlc_interface_rrc* rlc_,
pdcp_interface_rrc* pdcp_, pdcp_interface_rrc* pdcp_,
gw_interface_rrc* gw_, gw_interface_rrc* gw_,
srslte::timer_handler* timers_, rrc_eutra_interface_rrc_nr* rrc_eutra_,
stack_interface_rrc* stack_, srslte::timer_handler* timers_,
const rrc_nr_args_t& args_) stack_interface_rrc* stack_,
const rrc_nr_args_t& args_)
{ {
phy = phy_; phy = phy_;
rlc = rlc_; rlc = rlc_;
pdcp = pdcp_; pdcp = pdcp_;
gw = gw_; gw = gw_;
timers = timers_; rrc_eutra = rrc_eutra_;
stack = stack_; timers = timers_;
args = args_; stack = stack_;
args = args_;
log_h->info("Creating dummy DRB on LCID=%d\n", args.coreless.drb_lcid); 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); 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_config_t pdcp_cnfg{args.coreless.drb_lcid,
srslte::PDCP_RB_IS_DRB, 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_t_reordering_t::ms500,
srslte::pdcp_discard_timer_t ::ms100}; 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; running = true;
} }
@ -64,7 +66,10 @@ void rrc_nr::stop()
void rrc_nr::get_metrics(rrc_nr_metrics_t& m) {} void rrc_nr::get_metrics(rrc_nr_metrics_t& m) {}
// Timeout callback interface // 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) {} 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(); 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); log_h->debug_hex(nr_caps_pdu->msg, nr_caps_pdu->N_bytes, "NR capabilities (%u B)\n", nr_caps_pdu->N_bytes);
return; 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 // RLC interface

View File

@ -32,7 +32,7 @@ ue_stack_lte::ue_stack_lte() :
mac("MAC", &task_sched), mac("MAC", &task_sched),
rrc(this, &task_sched), rrc(this, &task_sched),
#ifdef HAVE_5GNR #ifdef HAVE_5GNR
rrc_nr(), rrc_nr(&task_sched),
#endif #endif
pdcp(&task_sched, "PDCP"), pdcp(&task_sched, "PDCP"),
nas(&task_sched), 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); pdcp.init(&rlc, &rrc, gw);
nas.init(usim.get(), &rrc, gw, args.nas); nas.init(usim.get(), &rrc, gw, args.nas);
#ifdef HAVE_5GNR #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); rrc.init(phy, &mac, &rlc, &pdcp, &nas, usim.get(), gw, &rrc_nr, args.rrc);
#else #else
rrc.init(phy, &mac, &rlc, &pdcp, &nas, usim.get(), gw, args.rrc); rrc.init(phy, &mac, &rlc, &pdcp, &nas, usim.get(), gw, args.rrc);

View File

@ -28,7 +28,7 @@ ue_stack_nr::ue_stack_nr(srslte::logger* logger_) :
mac.reset(new mac_nr(&task_sched)); mac.reset(new mac_nr(&task_sched));
pdcp.reset(new srslte::pdcp(&task_sched, "PDCP")); pdcp.reset(new srslte::pdcp(&task_sched, "PDCP"));
rlc.reset(new srslte::rlc("RLC")); 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 // setup logging for pool, RLC and PDCP
pool_log->set_level(srslte::LOG_LEVEL_ERROR); 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.log_hex_limit = args.log.rrc_hex_limit;
rrc_args.coreless.drb_lcid = 4; rrc_args.coreless.drb_lcid = 4;
rrc_args.coreless.ip_addr = "192.168.1.3"; 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; running = true;
start(STACK_MAIN_THREAD_PRIO); start(STACK_MAIN_THREAD_PRIO);

View File

@ -18,6 +18,7 @@
#include "srslte/upper/pdcp.h" #include "srslte/upper/pdcp.h"
#include "srsue/hdr/stack/rrc/rrc.h" #include "srsue/hdr/stack/rrc/rrc.h"
#include "srsue/hdr/stack/rrc/rrc_meas.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 "srsue/hdr/stack/upper/nas.h"
#include <iostream> #include <iostream>
@ -161,6 +162,15 @@ public:
void reset() override {} 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 class nas_test : public srsue::nas
{ {
public: public:
@ -229,12 +239,16 @@ public:
rrc_test(srslte::log_ref log_, stack_test_dummy* stack_) : rrc_test(srslte::log_ref log_, stack_test_dummy* stack_) :
rrc(stack_, &stack_->task_sched), stack(stack_), mactest(this, &stack_->task_sched) rrc(stack_, &stack_->task_sched), stack(stack_), mactest(this, &stack_->task_sched)
{ {
pool = srslte::byte_buffer_pool::get_instance(); pool = srslte::byte_buffer_pool::get_instance();
nastest = std::unique_ptr<nas_test>(new nas_test(&stack->task_sched)); 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)); 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 #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 #else
void init() { rrc::init(&phytest, &mactest, nullptr, pdcptest.get(), nastest.get(), nullptr, nullptr, {}); } void init() { rrc::init(&phytest, &mactest, nullptr, pdcptest.get(), nastest.get(), nullptr, nullptr, {}); }
#endif #endif
@ -347,6 +361,7 @@ public:
private: private:
std::unique_ptr<pdcp_test> pdcptest; std::unique_ptr<pdcp_test> pdcptest;
std::unique_ptr<nas_test> nastest; std::unique_ptr<nas_test> nastest;
std::unique_ptr<rrc_nr_test> rrcnrtest;
uint32_t tti = 0; uint32_t tti = 0;
srslte::byte_buffer_pool* pool = nullptr; srslte::byte_buffer_pool* pool = nullptr;
}; };

View File

@ -21,9 +21,10 @@ int rrc_nr_cap_request_test()
srslte::log_ref rrc_log("RRC"); srslte::log_ref rrc_log("RRC");
rrc_log->set_level(srslte::LOG_LEVEL_DEBUG); rrc_log->set_level(srslte::LOG_LEVEL_DEBUG);
rrc_log->set_hex_limit(-1); rrc_log->set_hex_limit(-1);
srslte::task_scheduler task_sched{512, 0, 100};
rrc_nr rrc_nr; srslte::task_sched_handle task_sched_handle(&task_sched);
srslte::byte_buffer_t caps; rrc_nr rrc_nr(task_sched_handle);
srslte::byte_buffer_t caps;
rrc_nr.get_eutra_nr_capabilities(&caps); rrc_nr.get_eutra_nr_capabilities(&caps);
rrc_nr.get_nr_capabilities(&caps); rrc_nr.get_nr_capabilities(&caps);
return SRSLTE_SUCCESS; return SRSLTE_SUCCESS;