From 344bdf3165d816ea96a6310f0b9ad81fabe1fd11 Mon Sep 17 00:00:00 2001 From: Francisco Date: Wed, 7 Apr 2021 14:51:00 +0100 Subject: [PATCH] allocation of UE rlc and pdcp classes in the ue dedicated memory pool --- srsenb/hdr/stack/upper/pdcp.h | 9 +++++---- srsenb/hdr/stack/upper/rlc.h | 5 +++-- srsenb/src/stack/upper/pdcp.cc | 7 +++---- srsenb/src/stack/upper/rlc.cc | 2 +- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/srsenb/hdr/stack/upper/pdcp.h b/srsenb/hdr/stack/upper/pdcp.h index 1d5c3c21a..ab77a2a82 100644 --- a/srsenb/hdr/stack/upper/pdcp.h +++ b/srsenb/hdr/stack/upper/pdcp.h @@ -10,6 +10,7 @@ * */ +#include "srsenb/hdr/common/rnti_pool.h" #include "srsran/common/timers.h" #include "srsran/interfaces/enb_metrics_interface.h" #include "srsran/interfaces/enb_pdcp_interfaces.h" @@ -104,10 +105,10 @@ private: class user_interface { public: - user_interface_rlc rlc_itf; - user_interface_gtpu gtpu_itf; - user_interface_rrc rrc_itf; - srsran::pdcp* pdcp; + user_interface_rlc rlc_itf; + user_interface_gtpu gtpu_itf; + user_interface_rrc rrc_itf; + unique_rnti_ptr pdcp; }; void clear_user(user_interface* ue); diff --git a/srsenb/hdr/stack/upper/rlc.h b/srsenb/hdr/stack/upper/rlc.h index 58c5f5a33..995195380 100644 --- a/srsenb/hdr/stack/upper/rlc.h +++ b/srsenb/hdr/stack/upper/rlc.h @@ -10,6 +10,7 @@ * */ +#include "srsenb/hdr/common/rnti_pool.h" #include "srsran/interfaces/enb_metrics_interface.h" #include "srsran/interfaces/enb_rlc_interfaces.h" #include "srsran/interfaces/ue_interfaces.h" @@ -38,7 +39,7 @@ class rlc : public rlc_interface_mac, public rlc_interface_rrc, public rlc_inter public: explicit rlc(srslog::basic_logger& logger) : logger(logger) {} void - init(pdcp_interface_rlc* pdcp_, rrc_interface_rlc* rrc_, mac_interface_rlc* mac_, srsran::timer_handler* timers_); + init(pdcp_interface_rlc* pdcp_, rrc_interface_rlc* rrc_, mac_interface_rlc* mac_, srsran::timer_handler* timers_); void stop(); void get_metrics(rlc_metrics_t& m, const uint32_t nof_tti); @@ -83,7 +84,7 @@ private: srsenb::pdcp_interface_rlc* pdcp; srsenb::rrc_interface_rlc* rrc; - std::unique_ptr rlc; + unique_rnti_ptr rlc; srsenb::rlc* parent; }; diff --git a/srsenb/src/stack/upper/pdcp.cc b/srsenb/src/stack/upper/pdcp.cc index b53ab20ce..0c519b1e2 100644 --- a/srsenb/src/stack/upper/pdcp.cc +++ b/srsenb/src/stack/upper/pdcp.cc @@ -40,7 +40,7 @@ void pdcp::stop() void pdcp::add_user(uint16_t rnti) { if (users.count(rnti) == 0) { - srsran::pdcp* obj = new srsran::pdcp(task_sched, logger.id().c_str()); + unique_rnti_ptr obj = make_rnti_obj(rnti, task_sched, logger.id().c_str()); obj->init(&users[rnti].rlc_itf, &users[rnti].rrc_itf, &users[rnti].gtpu_itf); users[rnti].rlc_itf.rnti = rnti; users[rnti].gtpu_itf.rnti = rnti; @@ -49,7 +49,7 @@ void pdcp::add_user(uint16_t rnti) users[rnti].rrc_itf.rrc = rrc; users[rnti].rlc_itf.rlc = rlc; users[rnti].gtpu_itf.gtpu = gtpu; - users[rnti].pdcp = obj; + users[rnti].pdcp = std::move(obj); } } @@ -57,8 +57,7 @@ void pdcp::add_user(uint16_t rnti) void pdcp::clear_user(user_interface* ue) { ue->pdcp->stop(); - delete ue->pdcp; - ue->pdcp = NULL; + ue->pdcp.reset(); } void pdcp::rem_user(uint16_t rnti) diff --git a/srsenb/src/stack/upper/rlc.cc b/srsenb/src/stack/upper/rlc.cc index ff09a9e14..14be4ddf4 100644 --- a/srsenb/src/stack/upper/rlc.cc +++ b/srsenb/src/stack/upper/rlc.cc @@ -56,7 +56,7 @@ void rlc::add_user(uint16_t rnti) { pthread_rwlock_rdlock(&rwlock); if (users.count(rnti) == 0) { - std::unique_ptr obj(new srsran::rlc(logger.id().c_str())); + auto obj = make_rnti_obj(rnti, logger.id().c_str()); obj->init(&users[rnti], &users[rnti], timers,