From 2f8fd7a4835547d4cc2194cfc58e4f6427212742 Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Thu, 28 Apr 2022 14:12:40 +0100 Subject: [PATCH] lib,rlc_am_nr: add stop() method to TX entity --- lib/include/srsran/rlc/rlc_am_nr.h | 1 + lib/src/rlc/rlc_am_nr.cc | 28 +++++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/lib/include/srsran/rlc/rlc_am_nr.h b/lib/include/srsran/rlc/rlc_am_nr.h index 425c71455..2ce60bff2 100644 --- a/lib/include/srsran/rlc/rlc_am_nr.h +++ b/lib/include/srsran/rlc/rlc_am_nr.h @@ -98,6 +98,7 @@ public: void reestablish() final; void stop() final; + void stop_no_lock(); int write_sdu(unique_byte_buffer_t sdu); void empty_queue() final; diff --git a/lib/src/rlc/rlc_am_nr.cc b/lib/src/rlc/rlc_am_nr.cc index 204d4f2c2..95bd7f82f 100644 --- a/lib/src/rlc/rlc_am_nr.cc +++ b/lib/src/rlc/rlc_am_nr.cc @@ -1167,7 +1167,33 @@ void rlc_am_nr_tx::empty_queue_no_lock() unique_byte_buffer_t buf = tx_sdu_queue.read(); } } -void rlc_am_nr_tx::stop() {} + +void rlc_am_nr_tx::stop() +{ + std::lock_guard lock(mutex); + stop_no_lock(); +} + +void rlc_am_nr_tx::stop_no_lock() +{ + empty_queue_no_lock(); + + if (parent->timers != nullptr && poll_retransmit_timer.is_valid()) { + poll_retransmit_timer.stop(); + } + + st = {}; + + sdu_under_segmentation_sn = INVALID_RLC_SN; + + // Drop all messages in TX window + tx_window->clear(); + + // Drop all messages in RETX queue + retx_queue->clear(); + + tx_enabled = false; +} void rlc_am_nr_tx::timer_expired(uint32_t timeout_id) {