From ad03a147d3887034a27033e3f7974be517912dc3 Mon Sep 17 00:00:00 2001 From: Francisco Date: Mon, 10 May 2021 14:02:11 +0100 Subject: [PATCH] avoid logging error message when UE sends CRNTI MAC CE for old rnti whose context has already been erased --- srsenb/hdr/stack/mac/sched.h | 2 +- srsenb/src/stack/mac/sched.cc | 15 +++++++++------ srsenb/src/stack/mac/ue.cc | 6 +++++- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/srsenb/hdr/stack/mac/sched.h b/srsenb/hdr/stack/mac/sched.h index dc26d9015..e89b47acd 100644 --- a/srsenb/hdr/stack/mac/sched.h +++ b/srsenb/hdr/stack/mac/sched.h @@ -93,7 +93,7 @@ protected: bool is_generated(srsran::tti_point, uint32_t enb_cc_idx) const; // Helper methods template - int ue_db_access_locked(uint16_t rnti, Func&& f, const char* func_name = nullptr); + int ue_db_access_locked(uint16_t rnti, Func&& f, const char* func_name = nullptr, bool log_fail = true); // args rrc_interface_mac* rrc = nullptr; diff --git a/srsenb/src/stack/mac/sched.cc b/srsenb/src/stack/mac/sched.cc index 55fad203d..f3616ff45 100644 --- a/srsenb/src/stack/mac/sched.cc +++ b/srsenb/src/stack/mac/sched.cc @@ -134,7 +134,8 @@ int sched::ue_rem(uint16_t rnti) bool sched::ue_exists(uint16_t rnti) { - return ue_db_access_locked(rnti, [](sched_ue& ue) {}) >= 0; + return ue_db_access_locked( + rnti, [](sched_ue& ue) {}, nullptr, false) >= 0; } void sched::phy_config_enabled(uint16_t rnti, bool enabled) @@ -360,17 +361,19 @@ bool sched::is_generated(srsran::tti_point tti_rx, uint32_t enb_cc_idx) const // Common way to access ue_db elements in a read locking way template -int sched::ue_db_access_locked(uint16_t rnti, Func&& f, const char* func_name) +int sched::ue_db_access_locked(uint16_t rnti, Func&& f, const char* func_name, bool log_fail) { std::lock_guard lock(sched_mutex); auto it = ue_db.find(rnti); if (it != ue_db.end()) { f(*it->second); } else { - if (func_name != nullptr) { - Error("User rnti=0x%x not found. Failed to call %s.", rnti, func_name); - } else { - Error("User rnti=0x%x not found.", rnti); + if (log_fail) { + if (func_name != nullptr) { + Error("SCHED: User rnti=0x%x not found. Failed to call %s.", rnti, func_name); + } else { + Error("SCHED: User rnti=0x%x not found.", rnti); + } } return SRSRAN_ERROR; } diff --git a/srsenb/src/stack/mac/ue.cc b/srsenb/src/stack/mac/ue.cc index 1da5f75f2..d8d82b82e 100644 --- a/srsenb/src/stack/mac/ue.cc +++ b/srsenb/src/stack/mac/ue.cc @@ -477,7 +477,11 @@ bool ue::process_ce(srsran::sch_subh* subh) rrc->upd_user(rnti, old_rnti); rnti = old_rnti; } else { - logger.error("Updating user C-RNTI: rnti=0x%x already released", old_rnti); + logger.warning("Updating user C-RNTI: rnti=0x%x already released.", old_rnti); + // Disable scheduling for all bearers. The new rnti will be removed on msg3 timer expiry in the RRC + for (uint32_t lcid = 0; lcid < sched_interface::MAX_LC; ++lcid) { + sched->bearer_ue_rem(rnti, lcid); + } } break; case srsran::ul_sch_lcid::TRUNC_BSR: