diff --git a/srsenb/src/stack/rrc/rrc_bearer_cfg.cc b/srsenb/src/stack/rrc/rrc_bearer_cfg.cc index ff0381d89..f3068bdf8 100644 --- a/srsenb/src/stack/rrc/rrc_bearer_cfg.cc +++ b/srsenb/src/stack/rrc/rrc_bearer_cfg.cc @@ -311,6 +311,8 @@ int bearer_cfg_handler::release_erab(uint8_t erab_id) srsran::rem_rrc_obj_id(current_drbs, drb_id); + rem_gtpu_bearer(erab_id); + erabs.erase(it); erab_info_list.erase(erab_id); @@ -319,8 +321,6 @@ int bearer_cfg_handler::release_erab(uint8_t erab_id) void bearer_cfg_handler::release_erabs() { - // TODO: notify GTPU layer for each ERAB - erabs.clear(); while (not erabs.empty()) { release_erab(erabs.begin()->first); } @@ -387,13 +387,7 @@ srsran::expected bearer_cfg_handler::add_gtpu_bearer(uint32_t void bearer_cfg_handler::rem_gtpu_bearer(uint32_t erab_id) { - auto it = erabs.find(erab_id); - if (it != erabs.end()) { - // Map e.g. E-RAB 5 to LCID 3 (==DRB1) - gtpu->rem_bearer(rnti, erab_id - 2); - } else { - logger->error("Removing erab_id=%d to GTPU\n", erab_id); - } + gtpu->rem_bearer(rnti, erab_id - 2); } void bearer_cfg_handler::fill_pending_nas_info(asn1::rrc::rrc_conn_recfg_r8_ies_s* msg) diff --git a/srsenb/src/stack/upper/gtpu.cc b/srsenb/src/stack/upper/gtpu.cc index 91d8d560b..33e6b03e8 100644 --- a/srsenb/src/stack/upper/gtpu.cc +++ b/srsenb/src/stack/upper/gtpu.cc @@ -160,22 +160,20 @@ bool gtpu_tunnel_manager::remove_tunnel(uint32_t teidin) bool gtpu_tunnel_manager::remove_bearer(uint16_t rnti, uint32_t lcid) { - srsran::span to_rem = find_rnti_lcid_tunnels(rnti, lcid); - if (to_rem.empty()) { - return false; - } logger.info("Removing rnti=0x%x,lcid=%d", rnti, lcid); - - for (lcid_tunnel& lcid_tun : to_rem) { - bool ret = tunnels.erase(lcid_tun.teid); + bool removed = false; + for (srsran::span to_rem = find_rnti_lcid_tunnels(rnti, lcid); not to_rem.empty(); + to_rem = find_rnti_lcid_tunnels(rnti, lcid)) { + uint32_t teid = to_rem.front().teid; + bool ret = remove_tunnel(teid); srsran_expect(ret, "Inconsistency detected between internal data structures for rnti=0x%x,lcid=%d," TEID_IN_FMT, rnti, lcid, - lcid_tun.teid); + teid); + removed |= ret; } - ue_teidin_db[rnti].erase(to_rem.begin(), to_rem.end()); - return true; + return removed; } bool gtpu_tunnel_manager::remove_rnti(uint16_t rnti)