diff --git a/lib/include/srsran/interfaces/ue_interfaces.h b/lib/include/srsran/interfaces/ue_interfaces.h index b55a5266b..f267c5b9e 100644 --- a/lib/include/srsran/interfaces/ue_interfaces.h +++ b/lib/include/srsran/interfaces/ue_interfaces.h @@ -31,6 +31,7 @@ public: virtual srsran::tti_point get_current_tti() = 0; virtual void add_eps_bearer(uint8_t eps_bearer_id, srsran::srsran_rat_t rat, uint32_t lcid) = 0; virtual void remove_eps_bearer(uint8_t eps_bearer_id) = 0; + virtual void reset_eps_bearers() = 0; }; // Combined interface for PHY to access stack (MAC and RRC) diff --git a/srsue/hdr/stack/bearer_manager.h b/srsue/hdr/stack/bearer_manager.h index b954bd6e8..7e2d3d779 100644 --- a/srsue/hdr/stack/bearer_manager.h +++ b/srsue/hdr/stack/bearer_manager.h @@ -45,9 +45,12 @@ public: /// Registers EPS bearer with PDCP RAT type and LCID void add_eps_bearer(uint8_t eps_bearer_id, srsran::srsran_rat_t rat, uint32_t lcid); - /// EPS bearer is removed from map when the associated DRB is deleted (e.g. after connection release) + /// Single EPS bearer is removed from map when the associated DRB is deleted void remove_eps_bearer(uint8_t eps_bearer_id); + /// All registered bearer are removed (e.g. after connection release) + void reset(); + // GW interface bool has_active_radio_bearer(uint32_t eps_bearer_id); diff --git a/srsue/hdr/stack/ue_stack_lte.h b/srsue/hdr/stack/ue_stack_lte.h index 2c81c017b..4f9d5f1b2 100644 --- a/srsue/hdr/stack/ue_stack_lte.h +++ b/srsue/hdr/stack/ue_stack_lte.h @@ -167,6 +167,7 @@ public: tti_point get_current_tti() final { return current_tti; } void add_eps_bearer(uint8_t eps_bearer_id, srsran::srsran_rat_t rat, uint32_t lcid) final; void remove_eps_bearer(uint8_t eps_bearer_id) final; + void reset_eps_bearers() final; srsran::ext_task_sched_handle get_task_sched() { return {&task_sched}; } diff --git a/srsue/hdr/stack/ue_stack_nr.h b/srsue/hdr/stack/ue_stack_nr.h index dbb4cf0cb..6e5189c81 100644 --- a/srsue/hdr/stack/ue_stack_nr.h +++ b/srsue/hdr/stack/ue_stack_nr.h @@ -106,9 +106,10 @@ public: bool has_active_radio_bearer(uint32_t eps_bearer_id) final { return true; /* TODO: add EPS to LCID mapping */ } // Interface for RRC - srsran::tti_point get_current_tti() { return srsran::tti_point{0}; }; - void add_eps_bearer(uint8_t eps_bearer_id, srsran::srsran_rat_t rat, uint32_t lcid) final{}; - void remove_eps_bearer(uint8_t eps_bearer_id) final{}; + srsran::tti_point get_current_tti() { return srsran::tti_point{0}; } + void add_eps_bearer(uint8_t eps_bearer_id, srsran::srsran_rat_t rat, uint32_t lcid) final {} + void remove_eps_bearer(uint8_t eps_bearer_id) final {} + void reset_eps_bearers() final {} private: void run_thread() final; diff --git a/srsue/src/stack/bearer_manager.cc b/srsue/src/stack/bearer_manager.cc index 9b2d4c87e..862fd1ba5 100644 --- a/srsue/src/stack/bearer_manager.cc +++ b/srsue/src/stack/bearer_manager.cc @@ -36,7 +36,6 @@ void bearer_manager::add_eps_bearer(uint8_t eps_bearer_id, srsran::srsran_rat_t logger.info("Registered EPS bearer ID %d for lcid=%d over %s-PDCP", eps_bearer_id, lcid, to_string(rat).c_str()); } -/// EPS bearer is removed from map when the associated DRB is deleted (e.g. after connection release) void bearer_manager::remove_eps_bearer(uint8_t eps_bearer_id) { srsran::rwlock_write_guard rw_lock(rwlock); @@ -49,6 +48,13 @@ void bearer_manager::remove_eps_bearer(uint8_t eps_bearer_id) logger.info("Removed mapping for EPS bearer ID %d", eps_bearer_id); } +void bearer_manager::reset() +{ + srsran::rwlock_write_guard rw_lock(rwlock); + eps_rb_map.clear(); + logger.info("Reset EPS bearer manager"); +} + // GW interface bool bearer_manager::has_active_radio_bearer(uint32_t eps_bearer_id) { diff --git a/srsue/src/stack/rrc/rrc.cc b/srsue/src/stack/rrc/rrc.cc index b97956247..eb6ea061a 100644 --- a/srsue/src/stack/rrc/rrc.cc +++ b/srsue/src/stack/rrc/rrc.cc @@ -1120,6 +1120,7 @@ void rrc::leave_connected() rlc->reset(); pdcp->reset(); set_mac_default(); + stack->reset_eps_bearers(); // 1> indicate the release of the RRC connection to upper layers together with the release cause; nas->left_rrc_connected(); diff --git a/srsue/src/stack/ue_stack_lte.cc b/srsue/src/stack/ue_stack_lte.cc index 40f0eb0a9..94adee7dd 100644 --- a/srsue/src/stack/ue_stack_lte.cc +++ b/srsue/src/stack/ue_stack_lte.cc @@ -391,6 +391,11 @@ bool ue_stack_lte::has_active_radio_bearer(uint32_t eps_bearer_id) return bearers.has_active_radio_bearer(eps_bearer_id); } +void ue_stack_lte::reset_eps_bearers() +{ + bearers.reset(); +} + /** * Check whether nas is attached * @return bool wether NAS is in EMM_REGISTERED