From 7ccc7d1d208a92b779fde8abaeb58f67a2ba95ac Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Mon, 25 Nov 2019 12:04:31 +0000 Subject: [PATCH] Starting to notify RLC upon PDCP discard (NR) --- lib/include/srslte/upper/pdcp_entity_nr.h | 20 +++++++++++++++++++- lib/src/upper/pdcp_entity_nr.cc | 19 ++++++++++++++++--- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/lib/include/srslte/upper/pdcp_entity_nr.h b/lib/include/srslte/upper/pdcp_entity_nr.h index b00f33b9c..3beb1c2ec 100644 --- a/lib/include/srslte/upper/pdcp_entity_nr.h +++ b/lib/include/srslte/upper/pdcp_entity_nr.h @@ -96,10 +96,12 @@ private: void pass_to_upper_layers(unique_byte_buffer_t pdu); // Reodering callback (t-Reordering) - class reordering_callback; std::unique_ptr reordering_fnc; + // Discard callback (discardTimer) + class discard_callback; + // COUNT overflow protection bool tx_overflow = false; bool rx_overflow = false; @@ -119,6 +121,22 @@ private: pdcp_entity_nr* parent; }; +// Discard callback (discardTimer) +class pdcp_entity_nr::discard_callback +{ +public: + discard_callback(pdcp_entity_nr* parent_, uint32_t sn_) + { + parent = parent_; + discard_sn = sn_; + }; + void operator()(uint32_t timer_id); + +private: + pdcp_entity_nr* parent; + uint32_t sn; +}; + /* * Helpers */ diff --git a/lib/src/upper/pdcp_entity_nr.cc b/lib/src/upper/pdcp_entity_nr.cc index 3bc8fe060..50e2c1a74 100644 --- a/lib/src/upper/pdcp_entity_nr.cc +++ b/lib/src/upper/pdcp_entity_nr.cc @@ -307,9 +307,6 @@ void pdcp_entity_nr::append_mac(const unique_byte_buffer_t& sdu, uint8_t* mac) sdu->N_bytes += 4; } -/* - * Reordering Helpers - */ // Deliver all consecutivly associated COUNTs. // Update RX_NEXT after submitting to higher layers void pdcp_entity_nr::deliver_all_consecutive_counts() @@ -336,6 +333,9 @@ void pdcp_entity_nr::deliver_all_consecutive_counts() } } +/* + * Reordering Timer Callback + */ void pdcp_entity_nr::reordering_callback::operator()(uint32_t timer_id) { parent->log->debug("Reordering timer expired\n"); @@ -357,4 +357,17 @@ void pdcp_entity_nr::reordering_callback::operator()(uint32_t timer_id) } return; } + +/* + * Discard Timer Callback + */ +void pdcp_entity_nr::discard_callback::operator()(uint32_t timer_id) +{ + parent->log->debug("Discard timer expired for PDU with SN = %d\n", discard_sn); + + // Notify the RLC of the discard. It's the RLC to actually discard, if no segment was transmitted yet. + parent->rlc->discard_sdu(discard_sn); + return; +} + } // namespace srslte