diff --git a/lib/include/srslte/upper/rlc_am_lte.h b/lib/include/srslte/upper/rlc_am_lte.h index d4039be68..244b794de 100644 --- a/lib/include/srslte/upper/rlc_am_lte.h +++ b/lib/include/srslte/upper/rlc_am_lte.h @@ -238,7 +238,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, std::vector& notify_info_vec); + void update_notification_ack_info(const rlc_amd_tx_pdu_t& tx_pdu); void debug_state(); @@ -301,6 +301,7 @@ private: // Tx windows tx_window_t tx_window; std::deque retx_queue; + std::vector notify_info_vec; // Mutexes pthread_mutex_t mutex; diff --git a/lib/src/upper/rlc_am_lte.cc b/lib/src/upper/rlc_am_lte.cc index 44f67a460..ded5b5d3f 100644 --- a/lib/src/upper/rlc_am_lte.cc +++ b/lib/src/upper/rlc_am_lte.cc @@ -172,6 +172,7 @@ rlc_am_lte::rlc_am_lte_tx::rlc_am_lte_tx(rlc_am_lte* parent_) : status_prohibit_timer(parent_->timers->get_unique_timer()) { pthread_mutex_init(&mutex, NULL); + notify_info_vec.reserve(300); } rlc_am_lte::rlc_am_lte_tx::~rlc_am_lte_tx() @@ -1018,9 +1019,8 @@ void rlc_am_lte::rlc_am_lte_tx::handle_control_pdu(uint8_t* payload, uint32_t no } // Handle ACKs and NACKs - bool update_vt_a = true; - uint32_t i = vt_a; - std::vector notify_info_vec; + bool update_vt_a = true; + uint32_t i = vt_a; while (TX_MOD_BASE(i) < TX_MOD_BASE(status.ack_sn) && TX_MOD_BASE(i) < TX_MOD_BASE(vt_s)) { bool nack = false; @@ -1075,7 +1075,7 @@ void rlc_am_lte::rlc_am_lte_tx::handle_control_pdu(uint8_t* payload, uint32_t no // ACKed SNs get marked and removed from tx_window if possible if (tx_window.has_sn(i)) { auto& pdu = tx_window[i]; - update_notification_ack_info(pdu, notify_info_vec); + update_notification_ack_info(pdu); if (update_vt_a) { tx_window.remove_pdu(i); vt_a = (vt_a + 1) % MOD; @@ -1105,6 +1105,7 @@ 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); } + notify_info_vec.clear(); } /* @@ -1112,8 +1113,7 @@ 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, - std::vector& notify_info_vec) +void rlc_am_lte::rlc_am_lte_tx::update_notification_ack_info(const rlc_amd_tx_pdu_t& tx_pdu) { logger.debug("Updating ACK info: RLC SN=%d, number of notified SDU=%ld, number of undelivered SDUs=%ld", tx_pdu.header.sn,