From d7f6820d1237306c86431f3dc05743967672f131 Mon Sep 17 00:00:00 2001 From: Ismael Gomez Date: Wed, 6 Jun 2018 21:36:52 -0700 Subject: [PATCH] Reorder UE remove procedure to avoid mutex in RLC/PDCP --- srsenb/src/upper/rrc.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/srsenb/src/upper/rrc.cc b/srsenb/src/upper/rrc.cc index 19a8dc073..4a1477a2d 100644 --- a/srsenb/src/upper/rrc.cc +++ b/srsenb/src/upper/rrc.cc @@ -308,16 +308,22 @@ void rrc::rem_user(uint16_t rnti) if (users.count(rnti) == 1) { rrc_log->console("Disconnecting rnti=0x%x.\n", rnti); rrc_log->info("Disconnecting rnti=0x%x.\n", rnti); - /* **Caution** order of removal here is important: from bottom to top */ + + /* First remove MAC and GTPU to stop processing DL/UL traffic for this user + */ mac->ue_rem(rnti); // MAC handles PHY + gtpu->rem_user(rnti); + // Wait enough time pthread_mutex_unlock(&user_mutex); usleep(50000); pthread_mutex_lock(&user_mutex); + // Now remove RLC and PDCP rlc->rem_user(rnti); pdcp->rem_user(rnti); - gtpu->rem_user(rnti); + + // And deallocate resources from RRC users[rnti].sr_free(); users[rnti].cqi_free(); users.erase(rnti);