From abe4f4c7ebae22b6719c28483a8b55d40cecc485 Mon Sep 17 00:00:00 2001 From: Francisco Date: Sat, 20 Feb 2021 19:39:39 +0000 Subject: [PATCH] use tx_window to store the map of rlc sn to pdcp sns --- lib/include/srslte/upper/rlc_am_lte.h | 22 ++++++++++++++-------- lib/src/upper/rlc_am_lte.cc | 13 +++++-------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/lib/include/srslte/upper/rlc_am_lte.h b/lib/include/srslte/upper/rlc_am_lte.h index f93284744..d514a1f79 100644 --- a/lib/include/srslte/upper/rlc_am_lte.h +++ b/lib/include/srslte/upper/rlc_am_lte.h @@ -41,11 +41,12 @@ struct rlc_amd_rx_pdu_segments_t { }; struct rlc_amd_tx_pdu_t { - rlc_amd_pdu_header_t header; - unique_byte_buffer_t buf; - uint32_t retx_count; - uint32_t rlc_sn; - bool is_acked; + rlc_amd_pdu_header_t header; + unique_byte_buffer_t buf; + std::vector pdcp_sns; + uint32_t retx_count; + uint32_t rlc_sn; + bool is_acked; }; struct rlc_amd_retx_t { @@ -69,7 +70,13 @@ struct pdcp_sdu_info_t { }; struct tx_window_t { - tx_window_t() { std::fill(active_flag.begin(), active_flag.end(), false); } + tx_window_t() + { + std::fill(active_flag.begin(), active_flag.end(), false); + for (size_t i = 0; i < window.size(); ++i) { + window[i].pdcp_sns.reserve(5); + } + } void add_pdu(size_t sn) { assert(not active_flag[sn]); @@ -241,8 +248,7 @@ private: srslte::timer_handler::unique_timer status_prohibit_timer; // SDU info for PDCP notifications - std::unordered_map undelivered_sdu_info_queue; - std::unordered_map > rlc_sn_to_pdcp_sn_map; + std::unordered_map undelivered_sdu_info_queue; // 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 98080d0a1..215f069fc 100644 --- a/lib/src/upper/rlc_am_lte.cc +++ b/lib/src/upper/rlc_am_lte.cc @@ -13,7 +13,6 @@ #include "srslte/upper/rlc_am_lte.h" #include -#include #define MOD 1024 #define RX_MOD_BASE(x) (((x)-vr_r) % 1024) @@ -245,7 +244,6 @@ void rlc_am_lte::rlc_am_lte_tx::stop() // Drop all SDU info in queue undelivered_sdu_info_queue.clear(); - rlc_sn_to_pdcp_sn_map.clear(); pthread_mutex_unlock(&mutex); } @@ -875,7 +873,7 @@ int rlc_am_lte::rlc_am_lte_tx::build_data_pdu(uint8_t* payload, uint32_t nof_byt return 0; } undelivered_sdu_info_queue.at(tx_sdu->md.pdcp_sn).rlc_sn_info_list.push_back({header.sn, false}); - rlc_sn_to_pdcp_sn_map[header.sn].push_back(tx_sdu->md.pdcp_sn); + tx_window[header.sn].pdcp_sns.push_back(tx_sdu->md.pdcp_sn); if (tx_sdu->N_bytes == 0) { logger.debug("%s Complete SDU scheduled for tx.", RB_NAME); undelivered_sdu_info_queue[tx_sdu->md.pdcp_sn].fully_txed = true; @@ -922,7 +920,7 @@ int rlc_am_lte::rlc_am_lte_tx::build_data_pdu(uint8_t* payload, uint32_t nof_byt return 0; } info_it->second.rlc_sn_info_list.push_back({header.sn, false}); - rlc_sn_to_pdcp_sn_map[header.sn].push_back(tx_sdu->md.pdcp_sn); + tx_window[header.sn].pdcp_sns.push_back(tx_sdu->md.pdcp_sn); if (tx_sdu->N_bytes == 0) { logger.debug("%s Complete SDU scheduled for tx. PDCP SN=%d", RB_NAME, tx_sdu->md.pdcp_sn); info_it->second.fully_txed = true; @@ -1121,11 +1119,10 @@ void rlc_am_lte::rlc_am_lte_tx::update_notification_ack_info(const rlc_amd_tx_pd notify_info_vec.size(), undelivered_sdu_info_queue.size()); // Iterate over all undelivered SDUs - auto it = rlc_sn_to_pdcp_sn_map.find(tx_pdu.header.sn); - if (it == rlc_sn_to_pdcp_sn_map.end()) { + if (not tx_window.has_sn(tx_pdu.header.sn)) { return; } - std::vector& pdcp_sns = it->second; + std::vector& pdcp_sns = tx_window[tx_pdu.header.sn].pdcp_sns; for (uint32_t pdcp_sn : pdcp_sns) { // Iterate over all SNs that were TX'ed auto& info = undelivered_sdu_info_queue[pdcp_sn]; @@ -1146,7 +1143,7 @@ void rlc_am_lte::rlc_am_lte_tx::update_notification_ack_info(const rlc_amd_tx_pd } } } - rlc_sn_to_pdcp_sn_map.erase(it); + pdcp_sns.clear(); } void rlc_am_lte::rlc_am_lte_tx::debug_state()