diff --git a/lib/include/srsran/interfaces/ue_nr_interfaces.h b/lib/include/srsran/interfaces/ue_nr_interfaces.h index b67fe3372..f43a6f354 100644 --- a/lib/include/srsran/interfaces/ue_nr_interfaces.h +++ b/lib/include/srsran/interfaces/ue_nr_interfaces.h @@ -146,6 +146,7 @@ public: class mac_interface_rrc_nr { public: + virtual void reset() = 0; // Config calls that return SRSRAN_SUCCESS or SRSRAN_ERROR virtual int setup_lcid(const srsran::logical_channel_config_t& config) = 0; virtual int set_config(const srsran::bsr_cfg_nr_t& bsr_cfg) = 0; diff --git a/lib/include/srsran/interfaces/ue_rrc_interfaces.h b/lib/include/srsran/interfaces/ue_rrc_interfaces.h index f3796fa35..01e8d26b9 100644 --- a/lib/include/srsran/interfaces/ue_rrc_interfaces.h +++ b/lib/include/srsran/interfaces/ue_rrc_interfaces.h @@ -110,6 +110,7 @@ public: uint32_t sk_counter_r15, bool nr_radio_bearer_cfg1_r15_present, asn1::dyn_octstring nr_radio_bearer_cfg1_r15) = 0; + virtual void rrc_release() = 0; virtual bool is_config_pending() = 0; }; diff --git a/srsue/hdr/stack/mac_nr/mac_nr.h b/srsue/hdr/stack/mac_nr/mac_nr.h index ee32663d5..9eb944b1a 100644 --- a/srsue/hdr/stack/mac_nr/mac_nr.h +++ b/srsue/hdr/stack/mac_nr/mac_nr.h @@ -48,7 +48,6 @@ public: int init(const mac_nr_args_t& args_, phy_interface_mac_nr* phy_, rlc_interface_mac* rlc_, rrc_interface_mac* rrc_); void stop(); - void reset(); void run_tti(const uint32_t tti); void start_pcap(srsran::mac_pcap* pcap_); @@ -75,6 +74,7 @@ public: void get_metrics(mac_metrics_t* metrics); /// Interface for RRC (RRC -> MAC) + void reset(); int setup_lcid(const srsran::logical_channel_config_t& config); int set_config(const srsran::bsr_cfg_nr_t& bsr_cfg); int set_config(const srsran::sr_cfg_nr_t& sr_cfg); diff --git a/srsue/hdr/stack/rrc/rrc_nr.h b/srsue/hdr/stack/rrc/rrc_nr.h index 011922934..177cf8fc0 100644 --- a/srsue/hdr/stack/rrc/rrc_nr.h +++ b/srsue/hdr/stack/rrc/rrc_nr.h @@ -113,6 +113,7 @@ public: uint32_t sk_counter_r15, bool nr_radio_bearer_cfg1_r15_present, asn1::dyn_octstring nr_radio_bearer_cfg1_r15); + void rrc_release(); bool configure_sk_counter(uint16_t sk_counter); bool is_config_pending(); // STACK interface diff --git a/srsue/src/stack/mac_nr/mac_nr.cc b/srsue/src/stack/mac_nr/mac_nr.cc index a5d0fd09b..9a20de119 100644 --- a/srsue/src/stack/mac_nr/mac_nr.cc +++ b/srsue/src/stack/mac_nr/mac_nr.cc @@ -97,6 +97,11 @@ void mac_nr::stop() void mac_nr::reset() { logger.info("Resetting MAC-NR"); + + proc_bsr.reset(); + proc_sr.reset(); + proc_ra.reset(); + mux.reset(); } void mac_nr::run_tti(const uint32_t tti) diff --git a/srsue/src/stack/mac_nr/mux_nr.cc b/srsue/src/stack/mac_nr/mux_nr.cc index 0c7da9923..001dea03f 100644 --- a/srsue/src/stack/mac_nr/mux_nr.cc +++ b/srsue/src/stack/mac_nr/mux_nr.cc @@ -35,6 +35,12 @@ int32_t mux_nr::init(rlc_interface_mac* rlc_) return SRSRAN_SUCCESS; } +void mux_nr::reset() +{ + std::lock_guard lock(mutex); + this->logical_channels.clear(); +} + int mux_nr::setup_lcid(const srsran::logical_channel_config_t& config) { std::lock_guard lock(mutex); diff --git a/srsue/src/stack/mac_nr/proc_bsr_nr.cc b/srsue/src/stack/mac_nr/proc_bsr_nr.cc index b292476a9..b06e0ca44 100644 --- a/srsue/src/stack/mac_nr/proc_bsr_nr.cc +++ b/srsue/src/stack/mac_nr/proc_bsr_nr.cc @@ -63,6 +63,8 @@ void proc_bsr_nr::reset() timer_periodic.stop(); timer_retx.stop(); + lcg_priorities.clear(); + triggered_bsr_type = NONE; } diff --git a/srsue/src/stack/rrc/rrc.cc b/srsue/src/stack/rrc/rrc.cc index 6a6e3b6c6..c9fefe1e8 100644 --- a/srsue/src/stack/rrc/rrc.cc +++ b/srsue/src/stack/rrc/rrc.cc @@ -1134,6 +1134,10 @@ void rrc::rrc_connection_release(const std::string& cause) // Save idleModeMobilityControlInfo, etc. srsran::console("Received RRC Connection Release (releaseCause: %s)\n", cause.c_str()); + if (has_nr_dc()) { + rrc_nr->rrc_release(); + } + // delay actions by 60ms as per 5.3.8.3 task_sched.defer_callback(60, [this]() { start_go_idle(); }); } diff --git a/srsue/src/stack/rrc/rrc_nr.cc b/srsue/src/stack/rrc/rrc_nr.cc index 39a7db192..f1be64467 100644 --- a/srsue/src/stack/rrc/rrc_nr.cc +++ b/srsue/src/stack/rrc/rrc_nr.cc @@ -362,6 +362,13 @@ bool rrc_nr::rrc_reconfiguration(bool endc_release_and_add_r15, return true; } +void rrc_nr::rrc_release() +{ + rlc->reset(); + pdcp->reset(); + mac->reset(); +} + int rrc_nr::get_nr_capabilities(srsran::byte_buffer_t* nr_caps_pdu) { struct ue_nr_cap_s nr_cap; diff --git a/srsue/src/stack/rrc/test/rrc_meas_test.cc b/srsue/src/stack/rrc/test/rrc_meas_test.cc index e84022896..bf610fd65 100644 --- a/srsue/src/stack/rrc/test/rrc_meas_test.cc +++ b/srsue/src/stack/rrc/test/rrc_meas_test.cc @@ -180,7 +180,8 @@ public: asn1::dyn_octstring nr_radio_bearer_cfg1_r15) override { return false; - }; + } + void rrc_release() override {} bool is_config_pending() override { return false; }; }; diff --git a/srsue/src/stack/rrc/test/ue_rrc_nr_test.cc b/srsue/src/stack/rrc/test/ue_rrc_nr_test.cc index c58dc050e..87a1c4345 100644 --- a/srsue/src/stack/rrc/test/ue_rrc_nr_test.cc +++ b/srsue/src/stack/rrc/test/ue_rrc_nr_test.cc @@ -27,6 +27,7 @@ class dummy_phy : public phy_interface_rrc_nr class dummy_mac : public mac_interface_rrc_nr { + void reset() {} int setup_lcid(const srsran::logical_channel_config_t& config) { return SRSRAN_SUCCESS; } int set_config(const srsran::bsr_cfg_nr_t& bsr_cfg) { return SRSRAN_SUCCESS; } int set_config(const srsran::sr_cfg_nr_t& sr_cfg) { return SRSRAN_SUCCESS; } @@ -62,7 +63,7 @@ class dummy_rlc : public rlc_interface_rrc class dummy_pdcp : public pdcp_interface_rrc { - void set_enabled(uint32_t lcid, bool enabled) {}; + void set_enabled(uint32_t lcid, bool enabled){}; void reestablish(){}; void reestablish(uint32_t lcid){}; void reset(){};