remove allocations from rlc_am_tx::handle_control_pdu

master
Francisco 4 years ago committed by Francisco Paisana
parent cc0c091a39
commit 138685399e

@ -238,7 +238,7 @@ private:
int build_retx_pdu(uint8_t* payload, uint32_t nof_bytes); 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_segment(uint8_t* payload, uint32_t nof_bytes, rlc_amd_retx_t retx);
int build_data_pdu(uint8_t* payload, uint32_t nof_bytes); 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<uint32_t>& notify_info_vec); void update_notification_ack_info(const rlc_amd_tx_pdu_t& tx_pdu);
void debug_state(); void debug_state();
@ -301,6 +301,7 @@ private:
// Tx windows // Tx windows
tx_window_t tx_window; tx_window_t tx_window;
std::deque<rlc_amd_retx_t> retx_queue; std::deque<rlc_amd_retx_t> retx_queue;
std::vector<uint32_t> notify_info_vec;
// Mutexes // Mutexes
pthread_mutex_t mutex; pthread_mutex_t mutex;

@ -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()) status_prohibit_timer(parent_->timers->get_unique_timer())
{ {
pthread_mutex_init(&mutex, NULL); pthread_mutex_init(&mutex, NULL);
notify_info_vec.reserve(300);
} }
rlc_am_lte::rlc_am_lte_tx::~rlc_am_lte_tx() rlc_am_lte::rlc_am_lte_tx::~rlc_am_lte_tx()
@ -1020,7 +1021,6 @@ void rlc_am_lte::rlc_am_lte_tx::handle_control_pdu(uint8_t* payload, uint32_t no
// Handle ACKs and NACKs // Handle ACKs and NACKs
bool update_vt_a = true; bool update_vt_a = true;
uint32_t i = vt_a; uint32_t i = vt_a;
std::vector<uint32_t> notify_info_vec;
while (TX_MOD_BASE(i) < TX_MOD_BASE(status.ack_sn) && TX_MOD_BASE(i) < TX_MOD_BASE(vt_s)) { while (TX_MOD_BASE(i) < TX_MOD_BASE(status.ack_sn) && TX_MOD_BASE(i) < TX_MOD_BASE(vt_s)) {
bool nack = false; 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 // ACKed SNs get marked and removed from tx_window if possible
if (tx_window.has_sn(i)) { if (tx_window.has_sn(i)) {
auto& pdu = tx_window[i]; auto& pdu = tx_window[i];
update_notification_ack_info(pdu, notify_info_vec); update_notification_ack_info(pdu);
if (update_vt_a) { if (update_vt_a) {
tx_window.remove_pdu(i); tx_window.remove_pdu(i);
vt_a = (vt_a + 1) % MOD; 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()) { if (not notify_info_vec.empty()) {
parent->pdcp->notify_delivery(parent->lcid, notify_info_vec); 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. * @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. * @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<uint32_t>& notify_info_vec)
{ {
logger.debug("Updating ACK info: RLC SN=%d, number of notified SDU=%ld, number of undelivered SDUs=%ld", logger.debug("Updating ACK info: RLC SN=%d, number of notified SDU=%ld, number of undelivered SDUs=%ld",
tx_pdu.header.sn, tx_pdu.header.sn,

Loading…
Cancel
Save