diff --git a/lib/include/srslte/upper/rlc_common.h b/lib/include/srslte/upper/rlc_common.h index a5b2e0403..c9655efae 100644 --- a/lib/include/srslte/upper/rlc_common.h +++ b/lib/include/srslte/upper/rlc_common.h @@ -163,6 +163,7 @@ public: srslte::mac_interface_timers *mac_timers_) = 0; virtual void configure(srslte_rlc_config_t cnfg) = 0; virtual void stop() = 0; + virtual void reestablish() = 0; virtual void empty_queue() = 0; virtual rlc_mode_t get_mode() = 0; diff --git a/lib/include/srslte/upper/rlc_tm.h b/lib/include/srslte/upper/rlc_tm.h index 774011292..d78ab59c4 100644 --- a/lib/include/srslte/upper/rlc_tm.h +++ b/lib/include/srslte/upper/rlc_tm.h @@ -49,6 +49,7 @@ public: mac_interface_timers *mac_timers); void configure(srslte_rlc_config_t cnfg); void stop(); + void reestablish(); void empty_queue(); rlc_mode_t get_mode(); diff --git a/lib/include/srslte/upper/rlc_um.h b/lib/include/srslte/upper/rlc_um.h index 864edaded..f099f60cf 100644 --- a/lib/include/srslte/upper/rlc_um.h +++ b/lib/include/srslte/upper/rlc_um.h @@ -57,6 +57,7 @@ public: srsue::rrc_interface_rlc *rrc_, mac_interface_timers *mac_timers_); void configure(srslte_rlc_config_t cnfg); + void reestablish(); void stop(); void empty_queue(); bool is_mrb(); diff --git a/lib/src/upper/rlc.cc b/lib/src/upper/rlc.cc index 7fa514e08..c24f0076b 100644 --- a/lib/src/upper/rlc.cc +++ b/lib/src/upper/rlc.cc @@ -130,11 +130,7 @@ void rlc::reestablish() { // defaul lcid=0 is created void rlc::reset() { - for(uint32_t i=0; ideallocate(buf); } + tx_sdu_queue.reset(); +} + +void rlc_am::reestablish() { + stop(); + tx_enabled = true; } void rlc_am::stop() diff --git a/lib/src/upper/rlc_entity.cc b/lib/src/upper/rlc_entity.cc index 4d0573043..783a14982 100644 --- a/lib/src/upper/rlc_entity.cc +++ b/lib/src/upper/rlc_entity.cc @@ -87,7 +87,7 @@ void rlc_entity::configure(srslte_rlc_config_t cnfg) // Reestablishment stops the entity but does not destroy it. Mode will not change void rlc_entity::reestablish() { - rlc->stop(); + rlc->reestablish(); } // A call to stop() stops the entity and clears deletes the instance. Next time this entity can be used for other mode. diff --git a/lib/src/upper/rlc_tm.cc b/lib/src/upper/rlc_tm.cc index c24c1ce29..988acf2af 100644 --- a/lib/src/upper/rlc_tm.cc +++ b/lib/src/upper/rlc_tm.cc @@ -68,6 +68,12 @@ void rlc_tm::empty_queue() while(ul_queue.try_read(&buf)) { pool->deallocate(buf); } + ul_queue.reset(); +} + +void rlc_tm::reestablish() { + stop(); + tx_enabled = true; } void rlc_tm::stop() diff --git a/lib/src/upper/rlc_um.cc b/lib/src/upper/rlc_um.cc index 4ddf4b2b0..f0466c9e1 100644 --- a/lib/src/upper/rlc_um.cc +++ b/lib/src/upper/rlc_um.cc @@ -122,6 +122,7 @@ void rlc_um::empty_queue() { while(tx_sdu_queue.try_read(&buf)) { pool->deallocate(buf); } + tx_sdu_queue.reset(); } bool rlc_um::is_mrb() @@ -129,6 +130,11 @@ bool rlc_um::is_mrb() return cfg.is_mrb; } +void rlc_um::reestablish() { + stop(); + tx_enabled = true; +} + void rlc_um::stop() { // Empty tx_sdu_queue before locking the mutex