remove manual tti counters from the rrc

This commit is contained in:
Francisco Paisana 2020-03-19 18:24:10 +00:00 committed by Francisco Paisana
parent 138347b6b5
commit 45bc123967
10 changed files with 63 additions and 55 deletions

View File

@ -606,8 +606,15 @@ public:
virtual void start_prach_configuration() = 0; virtual void start_prach_configuration() = 0;
}; };
// Generic Task Management + Timer interface for upper stack
class task_handler_interface_lte
{
public:
virtual srslte::timer_handler::unique_timer get_unique_timer() = 0;
};
// STACK interface for RRC // STACK interface for RRC
class stack_interface_rrc class stack_interface_rrc : public task_handler_interface_lte
{ {
public: public:
virtual void start_cell_search() = 0; virtual void start_cell_search() = 0;
@ -628,13 +635,6 @@ class phy_interface_stack_lte : public phy_interface_mac_lte, public phy_interfa
{ {
}; };
// Generic Task Management + Timer interface for upper stack
class task_handler_interface_lte
{
public:
virtual srslte::timer_handler::unique_timer get_unique_timer() = 0;
};
} // namespace srsue } // namespace srsue
#endif // SRSLTE_UE_INTERFACES_H #endif // SRSLTE_UE_INTERFACES_H

View File

@ -274,7 +274,7 @@ class rrc : public rrc_interface_nas,
public srslte::timer_callback public srslte::timer_callback
{ {
public: public:
rrc(srslte::log* rrc_log_, task_handler_interface_lte* task_handler_); rrc(srslte::log* rrc_log_, stack_interface_rrc* stack_);
~rrc(); ~rrc();
void init(phy_interface_rrc_lte* phy_, void init(phy_interface_rrc_lte* phy_,
@ -284,7 +284,6 @@ public:
nas_interface_rrc* nas_, nas_interface_rrc* nas_,
usim_interface_rrc* usim_, usim_interface_rrc* usim_,
gw_interface_rrc* gw_, gw_interface_rrc* gw_,
stack_interface_rrc* stack_,
const rrc_args_t& args_); const rrc_args_t& args_);
void stop(); void stop();
@ -361,17 +360,16 @@ private:
void process_pcch(srslte::unique_byte_buffer_t pdu); void process_pcch(srslte::unique_byte_buffer_t pdu);
task_handler_interface_lte* task_handler = nullptr; stack_interface_rrc* stack = nullptr;
srslte::byte_buffer_pool* pool = nullptr; srslte::byte_buffer_pool* pool = nullptr;
srslte::log* rrc_log = nullptr; srslte::log* rrc_log = nullptr;
phy_interface_rrc_lte* phy = nullptr; phy_interface_rrc_lte* 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;
nas_interface_rrc* nas = nullptr; nas_interface_rrc* nas = nullptr;
usim_interface_rrc* usim = nullptr; usim_interface_rrc* usim = nullptr;
gw_interface_rrc* gw = nullptr; gw_interface_rrc* gw = nullptr;
stack_interface_rrc* stack = nullptr;
srslte::unique_byte_buffer_t dedicated_info_nas; srslte::unique_byte_buffer_t dedicated_info_nas;

View File

@ -240,14 +240,16 @@ public:
explicit go_idle_proc(rrc* rrc_); explicit go_idle_proc(rrc* rrc_);
srslte::proc_outcome_t init(); srslte::proc_outcome_t init();
srslte::proc_outcome_t step(); srslte::proc_outcome_t step();
srslte::proc_outcome_t react(bool timeout);
static const char* name() { return "Go Idle"; } static const char* name() { return "Go Idle"; }
private: private:
bool wait = false;
rrc* rrc_ptr;
static const uint32_t rlc_flush_timeout = 2000; static const uint32_t rlc_flush_timeout = 2000;
uint32_t rlc_flush_counter; rrc* rrc_ptr;
srslte::timer_handler::unique_timer rlc_flush_timer;
bool wait = false;
}; };
class rrc::cell_reselection_proc class rrc::cell_reselection_proc

View File

@ -56,7 +56,6 @@ class ue_stack_lte final : public ue_stack_base,
public stack_interface_gw, public stack_interface_gw,
public stack_interface_mac, public stack_interface_mac,
public stack_interface_rrc, public stack_interface_rrc,
public task_handler_interface_lte,
public srslte::thread public srslte::thread
{ {
public: public:

View File

@ -83,7 +83,8 @@ bool cell_t::is_sib_scheduled(uint32_t sib_index) const
Base functions Base functions
*******************************************************************************/ *******************************************************************************/
rrc::rrc(srslte::log* rrc_log_, task_handler_interface_lte* task_handler_) : rrc::rrc(srslte::log* rrc_log_, stack_interface_rrc* stack_) :
stack(stack_),
state(RRC_STATE_IDLE), state(RRC_STATE_IDLE),
last_state(RRC_STATE_CONNECTED), last_state(RRC_STATE_CONNECTED),
drb_up(false), drb_up(false),
@ -98,8 +99,7 @@ rrc::rrc(srslte::log* rrc_log_, task_handler_interface_lte* task_handler_) :
plmn_searcher(this), plmn_searcher(this),
cell_reselector(this), cell_reselector(this),
connection_reest(this), connection_reest(this),
serving_cell(unique_cell_t(new cell_t())), serving_cell(unique_cell_t(new cell_t()))
task_handler(task_handler_)
{ {
measurements = std::unique_ptr<rrc_meas>(new rrc_meas(rrc_log)); measurements = std::unique_ptr<rrc_meas>(new rrc_meas(rrc_log));
} }
@ -136,7 +136,6 @@ void rrc::init(phy_interface_rrc_lte* phy_,
nas_interface_rrc* nas_, nas_interface_rrc* nas_,
usim_interface_rrc* usim_, usim_interface_rrc* usim_,
gw_interface_rrc* gw_, gw_interface_rrc* gw_,
stack_interface_rrc* stack_,
const rrc_args_t& args_) const rrc_args_t& args_)
{ {
pool = byte_buffer_pool::get_instance(); pool = byte_buffer_pool::get_instance();
@ -147,7 +146,6 @@ void rrc::init(phy_interface_rrc_lte* phy_,
nas = nas_; nas = nas_;
usim = usim_; usim = usim_;
gw = gw_; gw = gw_;
stack = stack_;
args = args_; args = args_;
@ -156,12 +154,12 @@ void rrc::init(phy_interface_rrc_lte* phy_,
security_is_activated = false; security_is_activated = false;
t300 = task_handler->get_unique_timer(); t300 = stack->get_unique_timer();
t301 = task_handler->get_unique_timer(); t301 = stack->get_unique_timer();
t302 = task_handler->get_unique_timer(); t302 = stack->get_unique_timer();
t310 = task_handler->get_unique_timer(); t310 = stack->get_unique_timer();
t311 = task_handler->get_unique_timer(); t311 = stack->get_unique_timer();
t304 = task_handler->get_unique_timer(); t304 = stack->get_unique_timer();
ue_identity_configured = false; ue_identity_configured = false;

View File

@ -337,7 +337,7 @@ void rrc::rrc_meas::var_meas_report_list::set_measId(const uint32_t m
// triggerType event as well as for triggerType periodical // triggerType event as well as for triggerType periodical
if (!varMeasReportList.at(measId).periodic_timer.is_valid() && if (!varMeasReportList.at(measId).periodic_timer.is_valid() &&
(report_cfg.report_amount.to_number() > 1 || report_cfg.report_amount.to_number() == -1)) { (report_cfg.report_amount.to_number() > 1 || report_cfg.report_amount.to_number() == -1)) {
varMeasReportList.at(measId).periodic_timer = rrc_ptr->task_handler->get_unique_timer(); varMeasReportList.at(measId).periodic_timer = rrc_ptr->stack->get_unique_timer();
varMeasReportList.at(measId).periodic_timer.set(report_cfg.report_interv.to_number()); varMeasReportList.at(measId).periodic_timer.set(report_cfg.report_interv.to_number());
} }
varMeasReportList.at(measId).report_cfg = std::move(report_cfg); varMeasReportList.at(measId).report_cfg = std::move(report_cfg);

View File

@ -242,8 +242,8 @@ compute_si_window(uint32_t tti, uint32_t sib_index, uint32_t n, uint32_t T, cons
rrc::si_acquire_proc::si_acquire_proc(rrc* parent_) : rrc::si_acquire_proc::si_acquire_proc(rrc* parent_) :
rrc_ptr(parent_), rrc_ptr(parent_),
log_h(parent_->rrc_log), log_h(parent_->rrc_log),
si_acq_timeout(rrc_ptr->task_handler->get_unique_timer()), si_acq_timeout(rrc_ptr->stack->get_unique_timer()),
si_acq_retry_timer(rrc_ptr->task_handler->get_unique_timer()) si_acq_retry_timer(rrc_ptr->stack->get_unique_timer())
{ {
// SIB acquisition procedure timeout. // SIB acquisition procedure timeout.
// NOTE: The standard does not specify this timeout // NOTE: The standard does not specify this timeout
@ -985,15 +985,24 @@ proc_outcome_t rrc::process_pcch_proc::react(paging_complete e)
* Go Idle procedure * Go Idle procedure
*************************************/ *************************************/
rrc::go_idle_proc::go_idle_proc(srsue::rrc* rrc_) : rrc_ptr(rrc_) {} rrc::go_idle_proc::go_idle_proc(srsue::rrc* rrc_) : rrc_ptr(rrc_)
{
rlc_flush_timer = rrc_ptr->stack->get_unique_timer();
rlc_flush_timer.set(rlc_flush_timeout, [this](uint32_t tid) { rrc_ptr->idle_setter.trigger(true); });
}
proc_outcome_t rrc::go_idle_proc::init() proc_outcome_t rrc::go_idle_proc::init()
{ {
rlc_flush_counter = 0;
Info("Starting...\n"); Info("Starting...\n");
return step(); return step();
} }
srslte::proc_outcome_t rrc::go_idle_proc::react(bool timeout)
{
rrc_ptr->leave_connected();
return proc_outcome_t::success;
}
proc_outcome_t rrc::go_idle_proc::step() proc_outcome_t rrc::go_idle_proc::step()
{ {
if (rrc_ptr->state == RRC_STATE_IDLE) { if (rrc_ptr->state == RRC_STATE_IDLE) {
@ -1003,12 +1012,11 @@ proc_outcome_t rrc::go_idle_proc::step()
// If the RLC SRB1 is not suspended // If the RLC SRB1 is not suspended
// wait for max. 2s for RLC on SRB1 to be flushed // wait for max. 2s for RLC on SRB1 to be flushed
if (rrc_ptr->rlc->is_suspended(RB_ID_SRB1) || not rrc_ptr->rlc->has_data(RB_ID_SRB1) || if (rrc_ptr->rlc->is_suspended(RB_ID_SRB1) || not rrc_ptr->rlc->has_data(RB_ID_SRB1)) {
++rlc_flush_counter > rlc_flush_timeout) {
rrc_ptr->leave_connected(); rrc_ptr->leave_connected();
return proc_outcome_t::success; return proc_outcome_t::success;
} else { } else {
Debug("Postponing transition to RRC IDLE (%d ms < %d ms)\n", rlc_flush_counter, rlc_flush_timeout); Debug("Postponing transition to RRC IDLE (%d ms < %d ms)\n", rlc_flush_timer.time_elapsed(), rlc_flush_timeout);
} }
return proc_outcome_t::yield; return proc_outcome_t::yield;
} }

View File

@ -41,7 +41,7 @@ ue_stack_lte::ue_stack_lte() :
mac(&mac_log), mac(&mac_log),
rrc(&rrc_log, this), rrc(&rrc_log, this),
pdcp(&timers, &pdcp_log), pdcp(&timers, &pdcp_log),
nas(&timers), nas(this),
thread("STACK"), thread("STACK"),
pending_tasks(512), pending_tasks(512),
background_tasks(2), background_tasks(2),
@ -139,7 +139,7 @@ int ue_stack_lte::init(const stack_args_t& args_, srslte::logger* logger_)
rlc.init(&pdcp, &rrc, &timers, 0 /* RB_ID_SRB0 */); rlc.init(&pdcp, &rrc, &timers, 0 /* RB_ID_SRB0 */);
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);
rrc.init(phy, &mac, &rlc, &pdcp, &nas, usim.get(), gw, this, args.rrc); rrc.init(phy, &mac, &rlc, &pdcp, &nas, usim.get(), gw, args.rrc);
running = true; running = true;
start(STACK_MAIN_THREAD_PRIO); start(STACK_MAIN_THREAD_PRIO);
@ -315,9 +315,9 @@ void ue_stack_lte::run_tti_impl(uint32_t tti, uint32_t tti_jump)
uint32_t next_tti = TTI_SUB(tti, (tti_jump - i - 1)); uint32_t next_tti = TTI_SUB(tti, (tti_jump - i - 1));
mac.run_tti(next_tti); mac.run_tti(next_tti);
rrc.run_tti(); rrc.run_tti();
nas.run_tti();
timers.step_all(); timers.step_all();
} }
nas.run_tti();
if (args.have_tti_time_stats) { if (args.have_tti_time_stats) {
std::chrono::nanoseconds dur = tti_tprof.stop(); std::chrono::nanoseconds dur = tti_tprof.stop();

View File

@ -26,10 +26,13 @@
namespace srsue { namespace srsue {
class stack_dummy : public task_handler_interface_lte class stack_dummy : public stack_interface_rrc
{ {
public: public:
srslte::timer_handler::unique_timer get_unique_timer() override { return timers.get_unique_timer(); } srslte::timer_handler::unique_timer get_unique_timer() override { return timers.get_unique_timer(); }
void start_cell_search() override {}
void start_cell_select(const phy_interface_rrc_lte::phy_cell_t* cell) override {}
srslte::tti_point get_current_tti() override { return srslte::tti_point{timers.get_cur_time() % 10240}; }
srslte::timer_handler timers{100}; srslte::timer_handler timers{100};
}; };

View File

@ -108,7 +108,7 @@ private:
class nas_test : public srsue::nas class nas_test : public srsue::nas
{ {
public: public:
nas_test(srslte::timer_handler* t) : srsue::nas(t) {} nas_test(srsue::task_handler_interface_lte* t) : srsue::nas(t) {}
bool is_attached() override { return false; } bool is_attached() override { return false; }
}; };
@ -167,20 +167,20 @@ private:
class rrc_test : public rrc class rrc_test : public rrc
{ {
srslte::timer_handler* timers = nullptr; srsue::stack_dummy* stack = nullptr;
public: public:
rrc_test(srslte::log* log_, stack_dummy* task_handler_) : rrc(log_, task_handler_), timers(&task_handler_->timers) rrc_test(srslte::log* log_, stack_dummy* stack_) : rrc(log_, stack_), stack(stack_)
{ {
pool = srslte::byte_buffer_pool::get_instance(); pool = srslte::byte_buffer_pool::get_instance();
nastest = std::unique_ptr<nas_test>(new nas_test(timers)); nastest = std::unique_ptr<nas_test>(new nas_test(stack));
pdcptest = std::unique_ptr<pdcp_test>(new pdcp_test(log_, timers)); pdcptest = std::unique_ptr<pdcp_test>(new pdcp_test(log_, &stack->timers));
}; };
void init() { rrc::init(&phytest, nullptr, nullptr, pdcptest.get(), nastest.get(), nullptr, nullptr, nullptr, {}); } void init() { rrc::init(&phytest, nullptr, nullptr, pdcptest.get(), nastest.get(), nullptr, nullptr, {}); }
void run_tti(uint32_t tti_) void run_tti(uint32_t tti_)
{ {
timers->step_all(); stack->timers.step_all();
rrc::run_tti(); rrc::run_tti();
} }