From b8339031f669cf68a9384aaa25cbc1eac9a6a091 Mon Sep 17 00:00:00 2001 From: Francisco Paisana Date: Thu, 14 May 2020 17:47:15 +0100 Subject: [PATCH] updated code for crnti update during handover and reset of the mac --- srsenb/src/stack/mac/mac.cc | 15 +++++++-------- srsenb/src/stack/mac/ue.cc | 9 +++++++++ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/srsenb/src/stack/mac/mac.cc b/srsenb/src/stack/mac/mac.cc index 6846883d8..85e4f92df 100644 --- a/srsenb/src/stack/mac/mac.cc +++ b/srsenb/src/stack/mac/mac.cc @@ -257,20 +257,19 @@ int mac::ue_rem(uint16_t rnti) // Called after Msg3 int mac::ue_set_crnti(uint16_t temp_crnti, uint16_t crnti, sched_interface::ue_cfg_t* cfg) { - int ret = ue_cfg(crnti, cfg); - if (ret != SRSLTE_SUCCESS) { - return ret; - } srslte::rwlock_read_guard lock(rwlock); - if (temp_crnti == crnti) { + if (temp_crnti != crnti) { // if RNTI is maintained, Msg3 contained a RRC Setup Request - scheduler.dl_mac_buffer_state(crnti, (uint32_t)srslte::dl_sch_lcid::CON_RES_ID); - } else { // C-RNTI corresponds to older user. Handover scenario. phy_h->rem_rnti(crnti); phy_h->add_rnti(crnti, cfg->supported_cc_list[0].enb_cc_idx, false); - scheduler.dl_mac_buffer_state(crnti, (uint32_t)srslte::dl_sch_lcid::CON_RES_ID); + ue_db[crnti]->reset(); + } + int ret = ue_cfg(crnti, cfg); + if (ret != SRSLTE_SUCCESS) { + return ret; } + scheduler.dl_mac_buffer_state(crnti, (uint32_t)srslte::dl_sch_lcid::CON_RES_ID); return ret; } diff --git a/srsenb/src/stack/mac/ue.cc b/srsenb/src/stack/mac/ue.cc index eb6c6879c..16c8cc105 100644 --- a/srsenb/src/stack/mac/ue.cc +++ b/srsenb/src/stack/mac/ue.cc @@ -107,6 +107,15 @@ void ue::reset() srslte_softbuffer_tx_reset(&buffer); } } + + for (auto& cc_buffers : pending_buffers) { + for (auto& harq_buffer : cc_buffers) { + if (harq_buffer) { + pdus.deallocate(harq_buffer); + harq_buffer = nullptr; + } + } + } } /**