diff --git a/lib/include/srslte/common/buffer_pool.h b/lib/include/srslte/common/buffer_pool.h index 0a87c0df1..1a7241797 100644 --- a/lib/include/srslte/common/buffer_pool.h +++ b/lib/include/srslte/common/buffer_pool.h @@ -38,6 +38,7 @@ INCLUDES *******************************************************************************/ +#include "srslte/common/log.h" #include "srslte/common/common.h" namespace srslte { @@ -169,6 +170,7 @@ public: static byte_buffer_pool* get_instance(int capacity = -1); static void cleanup(void); byte_buffer_pool(int capacity = -1) { + log = NULL; pool = new buffer_pool(capacity); } ~byte_buffer_pool() { @@ -177,13 +179,20 @@ public: byte_buffer_t* allocate(const char *debug_name = NULL) { return pool->allocate(debug_name); } + void set_log(srslte::log *log) { + this->log = log; + } void deallocate(byte_buffer_t *b) { if(!b) { return; } b->reset(); if (!pool->deallocate(b)) { - printf("Error deallocating PDU: Addr=0x%lx not found in pool\n", (uint64_t) b); + if (log) { + log->error("Deallocating PDU: Addr=0x%lx, name=%s not found in pool\n", (uint64_t) b, b->debug_name); + } else { + printf("Error deallocating PDU: Addr=0x%lx, name=%s not found in pool\n", (uint64_t) b, b->debug_name); + } } b = NULL; } @@ -191,6 +200,7 @@ public: pool->print_all_buffers(); } private: + srslte::log *log; buffer_pool *pool; }; diff --git a/lib/src/upper/rlc_um.cc b/lib/src/upper/rlc_um.cc index f0466c9e1..77c40aa36 100644 --- a/lib/src/upper/rlc_um.cc +++ b/lib/src/upper/rlc_um.cc @@ -67,6 +67,10 @@ rlc_um::~rlc_um() { pthread_mutex_destroy(&mutex); pool = NULL; + if (mac_timers && reordering_timer) { + mac_timers->timer_release_id(reordering_timer_id); + reordering_timer = NULL; + } } void rlc_um::init(srslte::log *log_, @@ -169,10 +173,6 @@ void rlc_um::stop() rx_window.clear(); pthread_mutex_unlock(&mutex); - if (mac_timers && reordering_timer) { - mac_timers->timer_release_id(reordering_timer_id); - reordering_timer = NULL; - } } rlc_mode_t rlc_um::get_mode() diff --git a/srsenb/hdr/enb.h b/srsenb/hdr/enb.h index b483d021b..08f75bc1e 100644 --- a/srsenb/hdr/enb.h +++ b/srsenb/hdr/enb.h @@ -201,6 +201,7 @@ private: srslte::log_filter rrc_log; srslte::log_filter gtpu_log; srslte::log_filter s1ap_log; + srslte::log_filter pool_log; srslte::byte_buffer_pool *pool; diff --git a/srsenb/src/enb.cc b/srsenb/src/enb.cc index c5660e0f0..911fb1d48 100644 --- a/srsenb/src/enb.cc +++ b/srsenb/src/enb.cc @@ -99,6 +99,10 @@ bool enb::init(all_args_t *args_) gtpu_log.init("GTPU", logger); s1ap_log.init("S1AP", logger); + pool_log.init("POOL", logger); + pool_log.set_level(srslte::LOG_LEVEL_ERROR); + pool->set_log(&pool_log); + // Init logs rf_log.set_level(srslte::LOG_LEVEL_INFO); for (int i=0;iexpert.phy.nof_phy_threads;i++) { diff --git a/srsue/hdr/ue.h b/srsue/hdr/ue.h index 7d33749b1..b45c079c5 100644 --- a/srsue/hdr/ue.h +++ b/srsue/hdr/ue.h @@ -115,6 +115,7 @@ private: srslte::log_filter nas_log; srslte::log_filter gw_log; srslte::log_filter usim_log; + srslte::log_filter pool_log; all_args_t *args; bool started; diff --git a/srsue/src/ue.cc b/srsue/src/ue.cc index 1218a322c..d75b2f941 100644 --- a/srsue/src/ue.cc +++ b/srsue/src/ue.cc @@ -89,6 +89,10 @@ bool ue::init(all_args_t *args_) { gw_log.init("GW ", logger); usim_log.init("USIM", logger); + pool_log.init("POOL", logger); + pool_log.set_level(srslte::LOG_LEVEL_ERROR); + byte_buffer_pool::get_instance()->set_log(&pool_log); + // Init logs rf_log.set_level(srslte::LOG_LEVEL_INFO); rf_log.info("Starting UE\n");