From 0349949ccec2a938f95db51cac9e43de4043ee6f Mon Sep 17 00:00:00 2001 From: Francisco Date: Tue, 25 May 2021 11:37:11 +0100 Subject: [PATCH] bugfix, handover: disable inactivity timer during s1 handover in target enb --- srsenb/hdr/stack/rrc/rrc_ue.h | 15 +++++++-------- srsenb/src/stack/rrc/rrc_mobility.cc | 1 + srsenb/src/stack/rrc/rrc_ue.cc | 22 +++++++++++++--------- 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/srsenb/hdr/stack/rrc/rrc_ue.h b/srsenb/hdr/stack/rrc/rrc_ue.h index 236dc0cb7..4386caa03 100644 --- a/srsenb/hdr/stack/rrc/rrc_ue.h +++ b/srsenb/hdr/stack/rrc/rrc_ue.h @@ -25,6 +25,11 @@ class rrc::ue { public: class rrc_mobility; + enum activity_timeout_type_t { + MSG3_RX_TIMEOUT = 0, ///< Msg3 has its own timeout to quickly remove fake UEs from random PRACHs + UE_INACTIVITY_TIMEOUT, ///< UE inactivity timeout (usually bigger than reestablishment timeout) + nulltype + }; ue(rrc* outer_rrc, uint16_t rnti, const sched_interface::ue_cfg_t& ue_cfg); ~ue(); @@ -32,15 +37,9 @@ public: bool is_connected(); bool is_idle(); - typedef enum { - MSG3_RX_TIMEOUT = 0, ///< Msg3 has its own timeout to quickly remove fake UEs from random PRACHs - UE_INACTIVITY_TIMEOUT, ///< UE inactivity timeout (usually bigger than reestablishment timeout) - nulltype - } activity_timeout_type_t; - std::string to_string(const activity_timeout_type_t& type); - void set_activity_timeout(const activity_timeout_type_t type); - void set_activity(); + void set_activity_timeout(activity_timeout_type_t type); + void set_activity(bool enabled = true); void set_radiolink_dl_state(bool crc_res); void set_radiolink_ul_state(bool crc_res); void activity_timer_expired(const activity_timeout_type_t type); diff --git a/srsenb/src/stack/rrc/rrc_mobility.cc b/srsenb/src/stack/rrc/rrc_mobility.cc index 797def2b9..475396540 100644 --- a/srsenb/src/stack/rrc/rrc_mobility.cc +++ b/srsenb/src/stack/rrc/rrc_mobility.cc @@ -176,6 +176,7 @@ uint16_t rrc::start_ho_ue_resource_alloc(const asn1::s1ap::ho_request_s& ue* ue_ptr = it->second.get(); // Reset activity timer (Response is not expected) ue_ptr->set_activity_timeout(ue::UE_INACTIVITY_TIMEOUT); + ue_ptr->set_activity(false); // /* Setup e-RABs & DRBs / establish an UL/DL S1 bearer to the S-GW */ // if (not setup_ue_erabs(rnti, msg)) { diff --git a/srsenb/src/stack/rrc/rrc_ue.cc b/srsenb/src/stack/rrc/rrc_ue.cc index e335f79d7..1d7040873 100644 --- a/srsenb/src/stack/rrc/rrc_ue.cc +++ b/srsenb/src/stack/rrc/rrc_ue.cc @@ -100,11 +100,19 @@ void rrc::ue::get_metrics(rrc_ue_metrics_t& ue_metrics) const } } -void rrc::ue::set_activity() +void rrc::ue::set_activity(bool enabled) { if (rnti == SRSRAN_MRNTI) { return; } + if (not enabled) { + if (activity_timer.is_running()) { + parent->logger.debug("Inactivity timer interrupted for rnti=0x%x", rnti); + } + activity_timer.stop(); + return; + } + // re-start activity timer with current timeout value activity_timer.run(); parent->logger.debug("Activity registered for rnti=0x%x (timeout_value=%dms)", rnti, activity_timer.duration()); @@ -236,28 +244,24 @@ void rrc::ue::max_rlc_retx_reached() rlc_rlf_timer.run(); } -void rrc::ue::set_activity_timeout(const activity_timeout_type_t type) +void rrc::ue::set_activity_timeout(activity_timeout_type_t type) { - uint32_t deadline_s = 0; uint32_t deadline_ms = 0; switch (type) { case MSG3_RX_TIMEOUT: - deadline_s = 0; deadline_ms = static_cast( (get_ue_cc_cfg(UE_PCELL_CC_IDX)->sib2.rr_cfg_common.rach_cfg_common.max_harq_msg3_tx + 1) * 16); break; case UE_INACTIVITY_TIMEOUT: - deadline_s = parent->cfg.inactivity_timeout_ms / 1000; - deadline_ms = parent->cfg.inactivity_timeout_ms % 1000; + deadline_ms = parent->cfg.inactivity_timeout_ms; break; default: parent->logger.error("Unknown timeout type %d", type); } - uint32_t deadline = deadline_s * 1e3 + deadline_ms; - activity_timer.set(deadline, [this, type](uint32_t tid) { activity_timer_expired(type); }); - parent->logger.debug("Setting timer for %s for rnti=0x%x to %dms", to_string(type).c_str(), rnti, deadline); + activity_timer.set(deadline_ms, [this, type](uint32_t tid) { activity_timer_expired(type); }); + parent->logger.debug("Setting timer for %s for rnti=0x%x to %dms", to_string(type).c_str(), rnti, deadline_ms); set_activity(); }