Reorder UE remove procedure to avoid mutex in RLC/PDCP

master
Ismael Gomez 7 years ago
parent ca9047e555
commit d7f6820d12

@ -308,16 +308,22 @@ void rrc::rem_user(uint16_t rnti)
if (users.count(rnti) == 1) { if (users.count(rnti) == 1) {
rrc_log->console("Disconnecting rnti=0x%x.\n", rnti); rrc_log->console("Disconnecting rnti=0x%x.\n", rnti);
rrc_log->info("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 mac->ue_rem(rnti); // MAC handles PHY
gtpu->rem_user(rnti);
// Wait enough time
pthread_mutex_unlock(&user_mutex); pthread_mutex_unlock(&user_mutex);
usleep(50000); usleep(50000);
pthread_mutex_lock(&user_mutex); pthread_mutex_lock(&user_mutex);
// Now remove RLC and PDCP
rlc->rem_user(rnti); rlc->rem_user(rnti);
pdcp->rem_user(rnti); pdcp->rem_user(rnti);
gtpu->rem_user(rnti);
// And deallocate resources from RRC
users[rnti].sr_free(); users[rnti].sr_free();
users[rnti].cqi_free(); users[rnti].cqi_free();
users.erase(rnti); users.erase(rnti);

Loading…
Cancel
Save