From 40d79342672e4611ebffdb7db3c3a212ee6df8f1 Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Sat, 20 Feb 2021 22:22:16 +0100 Subject: [PATCH] rlc: call PDCP notify without holding Tx lock move notify_info_vec as stack variable and unlock mutex before calling PDCP notify --- lib/include/srslte/upper/rlc_am_lte.h | 3 +-- lib/src/upper/rlc_am_lte.cc | 14 +++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/include/srslte/upper/rlc_am_lte.h b/lib/include/srslte/upper/rlc_am_lte.h index c815e1995..26fe7f59d 100644 --- a/lib/include/srslte/upper/rlc_am_lte.h +++ b/lib/include/srslte/upper/rlc_am_lte.h @@ -134,7 +134,7 @@ private: int build_retx_pdu(uint8_t* payload, uint32_t nof_bytes); int build_segment(uint8_t* payload, uint32_t nof_bytes, rlc_amd_retx_t retx); int build_data_pdu(uint8_t* payload, uint32_t nof_bytes); - void update_notification_ack_info(const rlc_amd_tx_pdu_t& tx_pdu); + void update_notification_ack_info(const rlc_amd_tx_pdu_t& tx_pdu, std::vector& notify_info_vec); void debug_state(); @@ -191,7 +191,6 @@ private: // SDU info for PDCP notifications std::unordered_map undelivered_sdu_info_queue; std::unordered_map > rlc_sn_to_pdcp_sn_map; - std::vector notify_info_vec; // Callback function for buffer status report bsr_callback_t bsr_callback; diff --git a/lib/src/upper/rlc_am_lte.cc b/lib/src/upper/rlc_am_lte.cc index 5ce99faaf..33b7d13d2 100644 --- a/lib/src/upper/rlc_am_lte.cc +++ b/lib/src/upper/rlc_am_lte.cc @@ -1020,7 +1020,7 @@ void rlc_am_lte::rlc_am_lte_tx::handle_control_pdu(uint8_t* payload, uint32_t no std::map::iterator it; bool update_vt_a = true; uint32_t i = vt_a; - notify_info_vec.clear(); + std::vector notify_info_vec; while (TX_MOD_BASE(i) < TX_MOD_BASE(status.ack_sn) && TX_MOD_BASE(i) < TX_MOD_BASE(vt_s)) { bool nack = false; @@ -1078,7 +1078,7 @@ void rlc_am_lte::rlc_am_lte_tx::handle_control_pdu(uint8_t* payload, uint32_t no if (tx_window.count(i) > 0) { it = tx_window.find(i); if (it != tx_window.end()) { - update_notification_ack_info(it->second); + update_notification_ack_info(it->second, notify_info_vec); if (update_vt_a) { tx_window.erase(it); vt_a = (vt_a + 1) % MOD; @@ -1091,8 +1091,6 @@ void rlc_am_lte::rlc_am_lte_tx::handle_control_pdu(uint8_t* payload, uint32_t no } if (not notify_info_vec.empty()) { - parent->pdcp->notify_delivery(parent->lcid, notify_info_vec); - // Remove all SDUs that were fully acked for (uint32_t acked_pdcp_sn : notify_info_vec) { logger.debug("Erasing SDU info: PDCP_SN=%d", acked_pdcp_sn); @@ -1106,6 +1104,11 @@ void rlc_am_lte::rlc_am_lte_tx::handle_control_pdu(uint8_t* payload, uint32_t no debug_state(); pthread_mutex_unlock(&mutex); + + // Notify PDCP without holding Tx mutex + if (not notify_info_vec.empty()) { + parent->pdcp->notify_delivery(parent->lcid, notify_info_vec); + } } /* @@ -1113,7 +1116,8 @@ void rlc_am_lte::rlc_am_lte_tx::handle_control_pdu(uint8_t* payload, uint32_t no * @tx_pdu: RLC PDU that was ack'ed. * @notify_info_vec: Vector which will keep track of the PDCP PDU SNs that have been fully ack'ed. */ -void rlc_am_lte::rlc_am_lte_tx::update_notification_ack_info(const rlc_amd_tx_pdu_t& tx_pdu) +void rlc_am_lte::rlc_am_lte_tx::update_notification_ack_info(const rlc_amd_tx_pdu_t& tx_pdu, + std::vector& notify_info_vec) { logger.debug("Updating ACK info: RLC SN=%d, number of notified SDU=%ld, number of undelivered SDUs=%ld", tx_pdu.header.sn,