From f02694dd3ef2fe2002b1cb8da2af07252e760e0c Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Thu, 11 Mar 2021 12:17:33 +0000 Subject: [PATCH] PDCP status report: Fix issue in keeping track of Rx'ed COUNTs after eNB reestablishment. Fixed issue in logic that limits the size of the rx_counts info vector. --- lib/include/srslte/upper/pdcp_entity_base.h | 4 +-- lib/include/srslte/upper/pdcp_entity_lte.h | 2 +- lib/include/srslte/upper/pdcp_entity_nr.h | 2 +- lib/src/upper/pdcp.cc | 2 +- lib/src/upper/pdcp_entity_lte.cc | 30 ++++++++++++++++++--- lib/src/upper/pdcp_entity_nr.cc | 2 +- lib/test/upper/pdcp_lte_test.h | 2 +- 7 files changed, 34 insertions(+), 10 deletions(-) diff --git a/lib/include/srslte/upper/pdcp_entity_base.h b/lib/include/srslte/upper/pdcp_entity_base.h index 278a507f7..632aa2505 100644 --- a/lib/include/srslte/upper/pdcp_entity_base.h +++ b/lib/include/srslte/upper/pdcp_entity_base.h @@ -115,8 +115,8 @@ public: virtual void notify_delivery(const pdcp_sn_vector_t& pdcp_sns) = 0; virtual void notify_failure(const pdcp_sn_vector_t& pdcp_sns) = 0; - virtual void get_bearer_state(pdcp_lte_state_t* state) = 0; - virtual void set_bearer_state(const pdcp_lte_state_t& state) = 0; + virtual void get_bearer_state(pdcp_lte_state_t* state) = 0; + virtual void set_bearer_state(const pdcp_lte_state_t& state, bool set_fmc) = 0; virtual std::map get_buffered_pdus() = 0; diff --git a/lib/include/srslte/upper/pdcp_entity_lte.h b/lib/include/srslte/upper/pdcp_entity_lte.h index 81db900d3..6ab00d07e 100644 --- a/lib/include/srslte/upper/pdcp_entity_lte.h +++ b/lib/include/srslte/upper/pdcp_entity_lte.h @@ -137,7 +137,7 @@ public: // Internal state getters/setters void get_bearer_state(pdcp_lte_state_t* state) override; - void set_bearer_state(const pdcp_lte_state_t& state) override; + void set_bearer_state(const pdcp_lte_state_t& state, bool set_fmc) override; // Metrics helpers pdcp_bearer_metrics_t get_metrics() override; diff --git a/lib/include/srslte/upper/pdcp_entity_nr.h b/lib/include/srslte/upper/pdcp_entity_nr.h index 967aa1035..893772f61 100644 --- a/lib/include/srslte/upper/pdcp_entity_nr.h +++ b/lib/include/srslte/upper/pdcp_entity_nr.h @@ -60,7 +60,7 @@ public: void set_rx_reord(uint32_t rx_reord_) { rx_reord = rx_reord_; } void get_bearer_state(pdcp_lte_state_t* state) override; - void set_bearer_state(const pdcp_lte_state_t& state) override; + void set_bearer_state(const pdcp_lte_state_t& state, bool set_fmc) override; void send_status_report() override {} pdcp_bearer_metrics_t get_metrics() override; diff --git a/lib/src/upper/pdcp.cc b/lib/src/upper/pdcp.cc index 17f3371dc..faee2cd09 100644 --- a/lib/src/upper/pdcp.cc +++ b/lib/src/upper/pdcp.cc @@ -237,7 +237,7 @@ bool pdcp::set_bearer_state(uint32_t lcid, const srslte::pdcp_lte_state_t& state if (not valid_lcid(lcid)) { return false; } - pdcp_array[lcid]->set_bearer_state(state); + pdcp_array[lcid]->set_bearer_state(state, true); return true; } diff --git a/lib/src/upper/pdcp_entity_lte.cc b/lib/src/upper/pdcp_entity_lte.cc index 792d6e8bc..68ed25c94 100644 --- a/lib/src/upper/pdcp_entity_lte.cc +++ b/lib/src/upper/pdcp_entity_lte.cc @@ -414,7 +414,9 @@ void pdcp_entity_lte::handle_am_drb_pdu(srslte::unique_byte_buffer_t pdu) void pdcp_entity_lte::update_rx_counts_queue(uint32_t rx_count) { - std::sort(rx_counts_info.begin(), rx_counts_info.end(), std::greater()); + if (rx_count < fmc) { + return; + } // Update largest RX_COUNT if (rx_count > largest_rx_count) { @@ -431,16 +433,35 @@ void pdcp_entity_lte::update_rx_counts_queue(uint32_t rx_count) } } else { rx_counts_info.push_back(rx_count); + std::sort(rx_counts_info.begin(), rx_counts_info.end(), std::greater()); } // If the size of the rx_vector_info is getting very large // Consider the FMC as lost and update the vector. if (rx_counts_info.size() > reordering_window) { - fmc++; + logger.debug("Queue too large. Updating. Old FMC=%d, Old back=%d, old queue_size=%d", + fmc, + rx_counts_info.back(), + rx_counts_info.size()); + fmc = rx_counts_info.back(); while (not rx_counts_info.empty() && rx_counts_info.back() == fmc) { rx_counts_info.pop_back(); fmc++; } + logger.debug("Queue too large. Updating. New FMC=%d, new back=%d, new queue_size=%d", + fmc, + rx_counts_info.back(), + rx_counts_info.size()); + } + + if (rx_counts_info.empty()) { + logger.info("Updated RX_COUNT info with SDU COUNT=%d, queue_size=%d, FMC=%d", rx_count, rx_counts_info.size(), fmc); + } else { + logger.info("Updated RX_COUNT info with SDU COUNT=%d, queue_size=%d, FMC=%d, back=%d", + rx_count, + rx_counts_info.size(), + fmc, + rx_counts_info.back()); } } /**************************************************************************** @@ -765,9 +786,12 @@ void pdcp_entity_lte::get_bearer_state(pdcp_lte_state_t* state) *state = st; } -void pdcp_entity_lte::set_bearer_state(const pdcp_lte_state_t& state) +void pdcp_entity_lte::set_bearer_state(const pdcp_lte_state_t& state, bool set_fmc) { st = state; + if (set_fmc) { + fmc = COUNT(st.rx_hfn, st.last_submitted_pdcp_rx_sn); + } } std::map pdcp_entity_lte::get_buffered_pdus() diff --git a/lib/src/upper/pdcp_entity_nr.cc b/lib/src/upper/pdcp_entity_nr.cc index 7cd034d84..610163c04 100644 --- a/lib/src/upper/pdcp_entity_nr.cc +++ b/lib/src/upper/pdcp_entity_nr.cc @@ -286,7 +286,7 @@ void pdcp_entity_nr::get_bearer_state(pdcp_lte_state_t* state) // TODO } -void pdcp_entity_nr::set_bearer_state(const pdcp_lte_state_t& state) +void pdcp_entity_nr::set_bearer_state(const pdcp_lte_state_t& state, bool set_fmc) { // TODO } diff --git a/lib/test/upper/pdcp_lte_test.h b/lib/test/upper/pdcp_lte_test.h index 9f44b0831..df40b4ba7 100644 --- a/lib/test/upper/pdcp_lte_test.h +++ b/lib/test/upper/pdcp_lte_test.h @@ -67,7 +67,7 @@ public: pdcp.enable_encryption(srslte::DIRECTION_TXRX); } - void set_pdcp_initial_state(const srslte::pdcp_lte_state_t& init_state) { pdcp.set_bearer_state(init_state); } + void set_pdcp_initial_state(const srslte::pdcp_lte_state_t& init_state) { pdcp.set_bearer_state(init_state, false); } rlc_dummy rlc; rrc_dummy rrc;