From e9fcb10c9e888dd56a7cf662092f7f1e374a61d9 Mon Sep 17 00:00:00 2001 From: Ismael Gomez Date: Wed, 2 May 2018 12:15:23 +0200 Subject: [PATCH] Deallocate SCH pdu on demux instead of pdu_queue --- lib/include/srslte/common/buffer_pool.h | 4 ++++ lib/src/common/pdu_queue.cc | 5 ----- srsue/src/mac/demux.cc | 2 ++ 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/include/srslte/common/buffer_pool.h b/lib/include/srslte/common/buffer_pool.h index 1895c8330..eee04caa8 100644 --- a/lib/include/srslte/common/buffer_pool.h +++ b/lib/include/srslte/common/buffer_pool.h @@ -93,6 +93,10 @@ public: #endif } + uint32_t nof_available_pdus() { + return available.size(); + } + bool is_almost_empty() { return available.size() < capacity/20; } diff --git a/lib/src/common/pdu_queue.cc b/lib/src/common/pdu_queue.cc index 9b5e83c7b..8e9656116 100644 --- a/lib/src/common/pdu_queue.cc +++ b/lib/src/common/pdu_queue.cc @@ -96,11 +96,6 @@ bool pdu_queue::process_pdus() if (callback) { callback->process_pdu(pdu->ptr, pdu->len, pdu->channel, pdu->tstamp); } - if (pdu->channel == DCH) { - if (!pool.deallocate(pdu)) { - log_h->warning("Error deallocating from buffer pool in process_pdus(): buffer not created in this pool.\n"); - } - } cnt++; have_data = true; } diff --git a/srsue/src/mac/demux.cc b/srsue/src/mac/demux.cc index 640b78bd5..dd481c76c 100644 --- a/srsue/src/mac/demux.cc +++ b/srsue/src/mac/demux.cc @@ -148,6 +148,8 @@ void demux::process_pdu(uint8_t *mac_pdu, uint32_t nof_bytes, srslte::pdu_queue: process_sch_pdu(&mac_msg); //srslte_vec_fprint_byte(stdout, mac_pdu, nof_bytes); + + pdus.deallocate(mac_pdu); break; case srslte::pdu_queue::BCH: rlc->write_pdu_bcch_dlsch(mac_pdu, nof_bytes);