From 07d1f14fab51fb211e82d6457202ced3f865862a Mon Sep 17 00:00:00 2001 From: yagoda Date: Wed, 5 Apr 2023 13:17:33 +0200 Subject: [PATCH] eMBMS: pushing bsr update to task queue to avoid potential deadlock --- srsenb/src/stack/mac/mac.cc | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/srsenb/src/stack/mac/mac.cc b/srsenb/src/stack/mac/mac.cc index 17e036880..9b22381f7 100644 --- a/srsenb/src/stack/mac/mac.cc +++ b/srsenb/src/stack/mac/mac.cc @@ -130,17 +130,20 @@ void mac::start_pcap_net(srsran::mac_pcap_net* pcap_net_) int mac::rlc_buffer_state(uint16_t rnti, uint32_t lc_id, uint32_t tx_queue, uint32_t retx_queue) { - srsran::rwlock_read_guard lock(rwlock); int ret = -1; if (check_ue_active(rnti)) { if (rnti != SRSRAN_MRNTI) { + srsran::rwlock_write_guard lock(rwlock); ret = scheduler.dl_rlc_buffer_state(rnti, lc_id, tx_queue, retx_queue); } else { - for (uint32_t i = 0; i < mch.num_mtch_sched; i++) { - if (lc_id == mch.mtch_sched[i].lcid) { - mch.mtch_sched[i].lcid_buffer_size = tx_queue; + task_sched.defer_callback(0, [this, tx_queue, lc_id]() { + srsran::rwlock_write_guard lock(rwlock); + for (uint32_t i = 0; i < mch.num_mtch_sched; i++) { + if (lc_id == mch.mtch_sched[i].lcid) { + mch.mtch_sched[i].lcid_buffer_size = tx_queue; + } } - } + }); ret = 0; } }