From d05b03e43adc53b2f0512dbf22d1ba6ec0f75683 Mon Sep 17 00:00:00 2001 From: Ismael Gomez Date: Tue, 6 Jun 2017 20:04:19 +0200 Subject: [PATCH] added buffer pool function call name debug feature --- lib/examples/pdsch_ue.c | 2 +- lib/include/srslte/common/buffer_pool.h | 23 ++++++++++++++++++++--- lib/include/srslte/common/common.h | 14 ++++++++++++++ lib/include/srslte/common/pdu_queue.h | 4 ++++ lib/src/phy/phch/pdcch.c | 7 +++++++ lib/src/upper/gw.cc | 4 ++-- lib/src/upper/rlc.cc | 6 +++--- lib/src/upper/rlc_am.cc | 14 +++++++------- lib/src/upper/rlc_tm.cc | 2 +- lib/src/upper/rlc_um.cc | 14 +++++++------- srsenb/src/upper/gtpu.cc | 4 ++-- srsenb/src/upper/rrc.cc | 8 ++++---- srsenb/src/upper/s1ap.cc | 10 +++++----- srsenb/test/upper/ip_test.cc | 6 +++--- srsue/src/upper/nas.cc | 4 ++-- srsue/src/upper/rrc.cc | 10 +++++----- srsue/test/upper/ip_test.cc | 6 +++--- srsue/test/upper/nas_test.cc | 2 +- 18 files changed, 91 insertions(+), 49 deletions(-) diff --git a/lib/examples/pdsch_ue.c b/lib/examples/pdsch_ue.c index 72dc36731..f7487c529 100644 --- a/lib/examples/pdsch_ue.c +++ b/lib/examples/pdsch_ue.c @@ -558,7 +558,7 @@ int main(int argc, char **argv) { if ((srslte_ue_sync_get_sfidx(&ue_sync) == 5 && (sfn%2)==0)) { decode_pdsch = true; } else { - decode_pdsch = false; + decode_pdsch = true; } } if (decode_pdsch) { diff --git a/lib/include/srslte/common/buffer_pool.h b/lib/include/srslte/common/buffer_pool.h index 761f74933..182c287e3 100644 --- a/lib/include/srslte/common/buffer_pool.h +++ b/lib/include/srslte/common/buffer_pool.h @@ -72,8 +72,16 @@ public: } } + void print_all_buffers() + { + printf("%d buffers in queue\n", (int) used.size()); + for (uint32_t i=0;idebug_name?used[i]->debug_name:"Undefined"); + } + } - buffer_t* allocate() + + buffer_t* allocate(const char *debug_name = NULL) { pthread_mutex_lock(&mutex); buffer_t* b = NULL; @@ -87,9 +95,18 @@ public: if (available.size() < capacity/20) { printf("Warning buffer pool capacity is %f %%\n", (float) available.size()/capacity); } +#ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED + if (debug_name) { + strncpy(b->debug_name, debug_name, 128); + } +#endif } else { printf("Error - buffer pool is empty\n"); + +#ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED + print_all_buffers(); +#endif } pthread_mutex_unlock(&mutex); @@ -134,8 +151,8 @@ public: ~byte_buffer_pool() { delete pool; } - byte_buffer_t* allocate() { - return pool->allocate(); + byte_buffer_t* allocate(const char *debug_name = NULL) { + return pool->allocate(debug_name); } void deallocate(byte_buffer_t *b) { b->reset(); diff --git a/lib/include/srslte/common/common.h b/lib/include/srslte/common/common.h index 8a8dec588..d8e64b523 100644 --- a/lib/include/srslte/common/common.h +++ b/lib/include/srslte/common/common.h @@ -50,6 +50,14 @@ #define SRSUE_MAX_BUFFER_SIZE_BYTES 12756 #define SRSUE_BUFFER_HEADER_OFFSET 1024 +#define SRSLTE_BUFFER_POOL_LOG_ENABLED + +#ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED +#define pool_allocate (pool->allocate(__FUNCTION__)) +#else +#define pool_allocate (pool->allocate()) +#endif + #include "srslte/srslte.h" /******************************************************************************* @@ -112,6 +120,9 @@ public: uint32_t N_bytes; uint8_t buffer[SRSUE_MAX_BUFFER_SIZE_BYTES]; uint8_t *msg; +#ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED + char debug_name[128]; +#endif byte_buffer_t():N_bytes(0) { @@ -181,6 +192,9 @@ struct bit_buffer_t{ uint32_t N_bits; uint8_t buffer[SRSUE_MAX_BUFFER_SIZE_BITS]; uint8_t *msg; +#ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED + char debug_name[128]; +#endif bit_buffer_t():N_bits(0) { diff --git a/lib/include/srslte/common/pdu_queue.h b/lib/include/srslte/common/pdu_queue.h index 2aaa20c07..40e0f2dd2 100644 --- a/lib/include/srslte/common/pdu_queue.h +++ b/lib/include/srslte/common/pdu_queue.h @@ -64,6 +64,10 @@ private: uint8_t ptr[MAX_PDU_LEN]; uint32_t len; uint32_t tstamp; + #ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED + char debug_name[128]; + #endif + } pdu_t; block_queue pdu_q; diff --git a/lib/src/phy/phch/pdcch.c b/lib/src/phy/phch/pdcch.c index cfdb19621..6ff788cec 100644 --- a/lib/src/phy/phch/pdcch.c +++ b/lib/src/phy/phch/pdcch.c @@ -473,6 +473,13 @@ int srslte_pdcch_extract_llr_multi(srslte_pdcch_t *q, cf_t *sf_symbols[SRSLTE_MA /* descramble */ srslte_scrambling_f_offset(&q->seq[nsubframe], q->llr, 0, e_bits); + float mean = 0; + for (int i=0;illr[i]); + } + mean /= e_bits; + printf("power %f\n",mean); + ret = SRSLTE_SUCCESS; } return ret; diff --git a/lib/src/upper/gw.cc b/lib/src/upper/gw.cc index a5ef8f342..490840f89 100644 --- a/lib/src/upper/gw.cc +++ b/lib/src/upper/gw.cc @@ -222,7 +222,7 @@ void gw::run_thread() struct iphdr *ip_pkt; uint32 idx = 0; int32 N_bytes; - byte_buffer_t *pdu = pool->allocate(); + byte_buffer_t *pdu = pool_allocate; gw_log->info("GW IP packet receiver thread run_enable\n"); @@ -264,7 +264,7 @@ void gw::run_thread() pdcp->write_sdu(RB_ID_DRB1, pdu); do { - pdu = pool->allocate(); + pdu = pool_allocate; if (!pdu) { printf("Not enough buffers in pool\n"); usleep(100000); diff --git a/lib/src/upper/rlc.cc b/lib/src/upper/rlc.cc index ef3b6c325..0213d98d7 100644 --- a/lib/src/upper/rlc.cc +++ b/lib/src/upper/rlc.cc @@ -152,7 +152,7 @@ void rlc::write_pdu_bcch_bch(uint8_t *payload, uint32_t nof_bytes) { rlc_log->info_hex(payload, nof_bytes, "BCCH BCH message received."); dl_tput_bytes[0] += nof_bytes; - byte_buffer_t *buf = pool->allocate(); + byte_buffer_t *buf = pool_allocate; memcpy(buf->msg, payload, nof_bytes); buf->N_bytes = nof_bytes; buf->set_timestamp(); @@ -163,7 +163,7 @@ void rlc::write_pdu_bcch_dlsch(uint8_t *payload, uint32_t nof_bytes) { rlc_log->info_hex(payload, nof_bytes, "BCCH TXSCH message received."); dl_tput_bytes[0] += nof_bytes; - byte_buffer_t *buf = pool->allocate(); + byte_buffer_t *buf = pool_allocate; memcpy(buf->msg, payload, nof_bytes); buf->N_bytes = nof_bytes; buf->set_timestamp(); @@ -174,7 +174,7 @@ void rlc::write_pdu_pcch(uint8_t *payload, uint32_t nof_bytes) { rlc_log->info_hex(payload, nof_bytes, "PCCH message received."); dl_tput_bytes[0] += nof_bytes; - byte_buffer_t *buf = pool->allocate(); + byte_buffer_t *buf = pool_allocate; memcpy(buf->msg, payload, nof_bytes); buf->N_bytes = nof_bytes; buf->set_timestamp(); diff --git a/lib/src/upper/rlc_am.cc b/lib/src/upper/rlc_am.cc index 275761a6c..9c3b2217e 100644 --- a/lib/src/upper/rlc_am.cc +++ b/lib/src/upper/rlc_am.cc @@ -579,7 +579,7 @@ int rlc_am::build_data_pdu(uint8_t *payload, uint32_t nof_bytes) return 0; } - byte_buffer_t *pdu = pool->allocate(); + byte_buffer_t *pdu = pool_allocate; if (!pdu) { log->console("Fatal Error: Could not allocate PDU in build_data_pdu()\n"); exit(-1); @@ -739,7 +739,7 @@ void rlc_am::handle_data_pdu(uint8_t *payload, uint32_t nof_bytes, rlc_amd_pdu_h // Write to rx window rlc_amd_rx_pdu_t pdu; - pdu.buf = pool->allocate(); + pdu.buf = pool_allocate; if (!pdu.buf) { log->console("Fatal Error: Could not allocate PDU in handle_data_pdu()\n"); exit(-1); @@ -825,7 +825,7 @@ void rlc_am::handle_data_pdu_segment(uint8_t *payload, uint32_t nof_bytes, rlc_a } rlc_amd_rx_pdu_t segment; - segment.buf = pool->allocate(); + segment.buf = pool_allocate; if (!segment.buf) { log->console("Fatal Error: Could not allocate PDU in handle_data_pdu_segment()\n"); exit(-1); @@ -956,7 +956,7 @@ void rlc_am::handle_control_pdu(uint8_t *payload, uint32_t nof_bytes) void rlc_am::reassemble_rx_sdus() { if(!rx_sdu) { - rx_sdu = pool->allocate(); + rx_sdu = pool_allocate; if (!rx_sdu) { log->console("Fatal Error: Could not allocate PDU in reassemble_rx_sdus() (1)\n"); exit(-1); @@ -976,7 +976,7 @@ void rlc_am::reassemble_rx_sdus() log->info_hex(rx_sdu->msg, rx_sdu->N_bytes, "%s Rx SDU", rb_id_text[lcid]); rx_sdu->set_timestamp(); pdcp->write_pdu(lcid, rx_sdu); - rx_sdu = pool->allocate(); + rx_sdu = pool_allocate; if (!rx_sdu) { log->console("Fatal Error: Could not allocate PDU in reassemble_rx_sdus() (2)\n"); exit(-1); @@ -992,7 +992,7 @@ void rlc_am::reassemble_rx_sdus() log->info_hex(rx_sdu->msg, rx_sdu->N_bytes, "%s Rx SDU", rb_id_text[lcid]); rx_sdu->set_timestamp(); pdcp->write_pdu(lcid, rx_sdu); - rx_sdu = pool->allocate(); + rx_sdu = pool_allocate; if (!rx_sdu) { log->console("Fatal Error: Could not allocate PDU in reassemble_rx_sdus() (3)\n"); exit(-1); @@ -1094,7 +1094,7 @@ bool rlc_am::add_segment_and_check(rlc_amd_rx_pdu_segments_t *pdu, rlc_amd_rx_pd } // Copy data - byte_buffer_t *full_pdu = pool->allocate(); + byte_buffer_t *full_pdu = pool_allocate; if (!full_pdu) { log->console("Fatal Error: Could not allocate PDU in add_segment_and_check()\n"); exit(-1); diff --git a/lib/src/upper/rlc_tm.cc b/lib/src/upper/rlc_tm.cc index c4cddd863..a515a77a5 100644 --- a/lib/src/upper/rlc_tm.cc +++ b/lib/src/upper/rlc_tm.cc @@ -115,7 +115,7 @@ int rlc_tm::read_pdu(uint8_t *payload, uint32_t nof_bytes) void rlc_tm:: write_pdu(uint8_t *payload, uint32_t nof_bytes) { - byte_buffer_t *buf = pool->allocate(); + byte_buffer_t *buf = pool_allocate; memcpy(buf->msg, payload, nof_bytes); buf->N_bytes = nof_bytes; buf->set_timestamp(); diff --git a/lib/src/upper/rlc_um.cc b/lib/src/upper/rlc_um.cc index 83cededc3..78fc0a68b 100644 --- a/lib/src/upper/rlc_um.cc +++ b/lib/src/upper/rlc_um.cc @@ -264,7 +264,7 @@ int rlc_um::build_data_pdu(uint8_t *payload, uint32_t nof_bytes) return 0; } - byte_buffer_t *pdu = pool->allocate(); + byte_buffer_t *pdu = pool_allocate; if(!pdu || pdu->N_bytes != 0) { log->error("Failed to allocate PDU buffer\n"); @@ -387,7 +387,7 @@ void rlc_um::handle_data_pdu(uint8_t *payload, uint32_t nof_bytes) // Write to rx window rlc_umd_pdu_t pdu; - pdu.buf = pool->allocate(); + pdu.buf = pool_allocate; if (!pdu.buf) { log->error("Discarting packet: no space in buffer pool\n"); return; @@ -435,7 +435,7 @@ void rlc_um::handle_data_pdu(uint8_t *payload, uint32_t nof_bytes) void rlc_um::reassemble_rx_sdus() { if(!rx_sdu) - rx_sdu = pool->allocate(); + rx_sdu = pool_allocate; // First catch up with lower edge of reordering window while(!inside_reordering_window(vr_ur)) @@ -459,7 +459,7 @@ void rlc_um::reassemble_rx_sdus() log->info_hex(rx_sdu->msg, rx_sdu->N_bytes, "%s Rx SDU vr_ur=%d, i=%d (lower edge middle segments)", rb_id_text[lcid], vr_ur, i); rx_sdu->set_timestamp(); pdcp->write_pdu(lcid, rx_sdu); - rx_sdu = pool->allocate(); + rx_sdu = pool_allocate; } pdu_lost = false; } @@ -479,7 +479,7 @@ void rlc_um::reassemble_rx_sdus() log->info_hex(rx_sdu->msg, rx_sdu->N_bytes, "%s Rx SDU vr_ur=%d (lower edge last segments)", rb_id_text[lcid], vr_ur); rx_sdu->set_timestamp(); pdcp->write_pdu(lcid, rx_sdu); - rx_sdu = pool->allocate(); + rx_sdu = pool_allocate; } pdu_lost = false; } @@ -513,7 +513,7 @@ void rlc_um::reassemble_rx_sdus() log->info_hex(rx_sdu->msg, rx_sdu->N_bytes, "%s Rx SDU vr_ur=%d, i=%d, (update vr_ur middle segments)", rb_id_text[lcid], vr_ur, i); rx_sdu->set_timestamp(); pdcp->write_pdu(lcid, rx_sdu); - rx_sdu = pool->allocate(); + rx_sdu = pool_allocate; } pdu_lost = false; } @@ -533,7 +533,7 @@ void rlc_um::reassemble_rx_sdus() log->info_hex(rx_sdu->msg, rx_sdu->N_bytes, "%s Rx SDU vr_ur=%d (update vr_ur last segments)", rb_id_text[lcid], vr_ur); rx_sdu->set_timestamp(); pdcp->write_pdu(lcid, rx_sdu); - rx_sdu = pool->allocate(); + rx_sdu = pool_allocate; } pdu_lost = false; } diff --git a/srsenb/src/upper/gtpu.cc b/srsenb/src/upper/gtpu.cc index 0a0fe5146..83f7a1b75 100644 --- a/srsenb/src/upper/gtpu.cc +++ b/srsenb/src/upper/gtpu.cc @@ -141,7 +141,7 @@ void gtpu::rem_user(uint16_t rnti) void gtpu::run_thread() { - byte_buffer_t *pdu = pool->allocate(); + byte_buffer_t *pdu = pool_allocate; run_enable = true; running=true; @@ -176,7 +176,7 @@ void gtpu::run_thread() pdcp->write_sdu(rnti, lcid, pdu); do { - pdu = pool->allocate(); + pdu = pool_allocate; if (!pdu) { gtpu_log->console("GTPU Buffer pool empty. Trying again...\n"); usleep(10000); diff --git a/srsenb/src/upper/rrc.cc b/srsenb/src/upper/rrc.cc index f6f90f505..aa6ca4127 100644 --- a/srsenb/src/upper/rrc.cc +++ b/srsenb/src/upper/rrc.cc @@ -245,7 +245,7 @@ void rrc::upd_user(uint16_t new_rnti, uint16_t old_rnti) // Send Reconfiguration to old_rnti if is RRC_CONNECT or RRC Release if already released here if (users.count(old_rnti) == 1) { if (users[old_rnti].is_connected()) { - users[old_rnti].send_connection_reconf_upd(pool->allocate()); + users[old_rnti].send_connection_reconf_upd(pool_allocate); } else { users[old_rnti].send_connection_release(); } @@ -1336,7 +1336,7 @@ void rrc::ue::send_connection_reconf(srslte::byte_buffer_t *pdu) void rrc::ue::send_connection_reconf_new_bearer(LIBLTE_S1AP_E_RABTOBESETUPLISTBEARERSUREQ_STRUCT *e) { - srslte::byte_buffer_t *pdu = parent->pool->allocate(); + srslte::byte_buffer_t *pdu = parent->pool->allocate(__FUNCTION__); LIBLTE_RRC_DL_DCCH_MSG_STRUCT dl_dcch_msg; dl_dcch_msg.msg_type = LIBLTE_RRC_DL_DCCH_MSG_TYPE_RRC_CON_RECONFIG; @@ -1421,7 +1421,7 @@ void rrc::ue::send_ue_cap_enquiry() void rrc::ue::send_dl_ccch(LIBLTE_RRC_DL_CCCH_MSG_STRUCT *dl_ccch_msg) { // Allocate a new PDU buffer, pack the message and send to PDCP - byte_buffer_t *pdu = parent->pool->allocate(); + byte_buffer_t *pdu = parent->pool->allocate(__FUNCTION__); if (pdu) { liblte_rrc_pack_dl_ccch_msg(dl_ccch_msg, (LIBLTE_BIT_MSG_STRUCT*) &parent->bit_buf); srslte_bit_pack_vector(parent->bit_buf.msg, pdu->msg, parent->bit_buf.N_bits); @@ -1441,7 +1441,7 @@ void rrc::ue::send_dl_ccch(LIBLTE_RRC_DL_CCCH_MSG_STRUCT *dl_ccch_msg) void rrc::ue::send_dl_dcch(LIBLTE_RRC_DL_DCCH_MSG_STRUCT *dl_dcch_msg, byte_buffer_t *pdu) { if (!pdu) { - pdu = parent->pool->allocate(); + pdu = parent->pool->allocate(__FUNCTION__); } if (pdu) { liblte_rrc_pack_dl_dcch_msg(dl_dcch_msg, (LIBLTE_BIT_MSG_STRUCT*) &parent->bit_buf); diff --git a/srsenb/src/upper/s1ap.cc b/srsenb/src/upper/s1ap.cc index 00766db36..bbc7797d1 100644 --- a/srsenb/src/upper/s1ap.cc +++ b/srsenb/src/upper/s1ap.cc @@ -87,7 +87,7 @@ void s1ap::get_metrics(s1ap_metrics_t &m) void s1ap::run_thread() { - srslte::byte_buffer_t *pdu = pool->allocate(); + srslte::byte_buffer_t *pdu = pool_allocate; uint32_t sz = SRSUE_MAX_BUFFER_SIZE_BYTES - SRSUE_BUFFER_HEADER_OFFSET; running = true; @@ -512,7 +512,7 @@ bool s1ap::handle_dlnastransport(LIBLTE_S1AP_MESSAGE_DOWNLINKNASTRANSPORT_STRUCT s1ap_log->warning("Not handling SubscriberProfileIDforRFP\n"); } - srslte::byte_buffer_t *pdu = pool->allocate(); + srslte::byte_buffer_t *pdu = pool_allocate; memcpy(pdu->msg, msg->NAS_PDU.buffer, msg->NAS_PDU.n_octets); pdu->N_bytes = msg->NAS_PDU.n_octets; rrc->write_dl_info(rnti, pdu); @@ -848,7 +848,7 @@ bool s1ap::send_initial_ctxt_setup_response(uint16_t rnti, LIBLTE_S1AP_MESSAGE_I if(!mme_connected) { return false; } - srslte::byte_buffer_t *buf = pool->allocate(); + srslte::byte_buffer_t *buf = pool_allocate; LIBLTE_S1AP_S1AP_PDU_STRUCT tx_pdu; tx_pdu.ext = false; @@ -894,7 +894,7 @@ bool s1ap::send_erab_setup_response(uint16_t rnti, LIBLTE_S1AP_MESSAGE_E_RABSETU if(!mme_connected) { return false; } - srslte::byte_buffer_t *buf = pool->allocate(); + srslte::byte_buffer_t *buf = pool_allocate; LIBLTE_S1AP_S1AP_PDU_STRUCT tx_pdu; tx_pdu.ext = false; @@ -940,7 +940,7 @@ bool s1ap::send_initial_ctxt_setup_failure(uint16_t rnti) if(!mme_connected) { return false; } - srslte::byte_buffer_t *buf = pool->allocate(); + srslte::byte_buffer_t *buf = pool_allocate; LIBLTE_S1AP_S1AP_PDU_STRUCT tx_pdu; tx_pdu.ext = false; tx_pdu.choice_type = LIBLTE_S1AP_S1AP_PDU_CHOICE_UNSUCCESSFULOUTCOME; diff --git a/srsenb/test/upper/ip_test.cc b/srsenb/test/upper/ip_test.cc index 5261e7ef5..f0bbf7fc2 100644 --- a/srsenb/test/upper/ip_test.cc +++ b/srsenb/test/upper/ip_test.cc @@ -212,7 +212,7 @@ public: // Send dummy ConnectionSetup. MAC will send contention resolution ID automatically. log_h->info("Sending ConnectionSetup\n"); - sdu = pool->allocate(); + sdu = pool_allocate; sdu->msg[0] = 0xab; sdu->N_bytes = 1; rlc->write_sdu(0, sdu); @@ -273,7 +273,7 @@ private: struct iphdr *ip_pkt; uint32_t idx = 0; int32_t N_bytes = 0; - srslte::byte_buffer_t *pdu = pool->allocate(); + srslte::byte_buffer_t *pdu = pool_allocate; log_h->info("TUN/TAP reader thread running\n"); @@ -304,7 +304,7 @@ private: // Indicate RLC status to mac mac->rlc_buffer_state(rnti, LCID, rlc->get_buffer_state(LCID), 0); - pdu = pool->allocate(); + pdu = pool_allocate; idx = 0; } else{ idx += N_bytes; diff --git a/srsue/src/upper/nas.cc b/srsue/src/upper/nas.cc index 6e1407ef4..15dc154ae 100644 --- a/srsue/src/upper/nas.cc +++ b/srsue/src/upper/nas.cc @@ -527,7 +527,7 @@ void nas::parse_emm_information(uint32_t lcid, byte_buffer_t *pdu) void nas::send_attach_request() { LIBLTE_MME_ATTACH_REQUEST_MSG_STRUCT attach_req; - byte_buffer_t *msg = pool->allocate(); + byte_buffer_t *msg = pool_allocate; u_int32_t i; attach_req.eps_attach_type = LIBLTE_MME_EPS_ATTACH_TYPE_EPS_ATTACH; @@ -601,7 +601,7 @@ void nas::send_identity_response(){} void nas::send_service_request() { - byte_buffer_t *msg = pool->allocate(); + byte_buffer_t *msg = pool_allocate; count_ul++; // Pack the service request message directly diff --git a/srsue/src/upper/rrc.cc b/srsue/src/upper/rrc.cc index f91ef6dba..643cfaf86 100644 --- a/srsue/src/upper/rrc.cc +++ b/srsue/src/upper/rrc.cc @@ -400,7 +400,7 @@ void rrc::send_con_request() bit_buf.msg[bit_buf.N_bits + i] = 0; bit_buf.N_bits += 8 - (bit_buf.N_bits % 8); } - byte_buffer_t *pdcp_buf = pool->allocate(); + byte_buffer_t *pdcp_buf = pool_allocate; srslte_bit_pack_vector(bit_buf.msg, pdcp_buf->msg, bit_buf.N_bits); pdcp_buf->N_bytes = bit_buf.N_bits/8; pdcp_buf->set_timestamp(); @@ -494,7 +494,7 @@ void rrc::send_con_restablish_request() bit_buf.msg[bit_buf.N_bits + i] = 0; bit_buf.N_bits += 8 - (bit_buf.N_bits % 8); } - byte_buffer_t *pdcp_buf = pool->allocate(); + byte_buffer_t *pdcp_buf = pool_allocate; srslte_bit_pack_vector(bit_buf.msg, pdcp_buf->msg, bit_buf.N_bits); pdcp_buf->N_bytes = bit_buf.N_bits/8; @@ -531,7 +531,7 @@ void rrc::send_con_restablish_complete() bit_buf.msg[bit_buf.N_bits + i] = 0; bit_buf.N_bits += 8 - (bit_buf.N_bits % 8); } - byte_buffer_t *pdcp_buf = pool->allocate(); + byte_buffer_t *pdcp_buf = pool_allocate; srslte_bit_pack_vector(bit_buf.msg, pdcp_buf->msg, bit_buf.N_bits); pdcp_buf->N_bytes = bit_buf.N_bits/8; @@ -562,7 +562,7 @@ void rrc::send_con_setup_complete(byte_buffer_t *nas_msg) bit_buf.msg[bit_buf.N_bits + i] = 0; bit_buf.N_bits += 8 - (bit_buf.N_bits % 8); } - byte_buffer_t *pdcp_buf = pool->allocate(); + byte_buffer_t *pdcp_buf = pool_allocate; srslte_bit_pack_vector(bit_buf.msg, pdcp_buf->msg, bit_buf.N_bits); pdcp_buf->N_bytes = bit_buf.N_bits/8; pdcp_buf->set_timestamp(); @@ -1309,7 +1309,7 @@ void rrc::handle_rrc_con_reconfig(uint32_t lcid, LIBLTE_RRC_CONNECTION_RECONFIGU byte_buffer_t *nas_sdu; for(i=0;iN_ded_info_nas;i++) { - nas_sdu = pool->allocate(); + nas_sdu = pool_allocate; memcpy(nas_sdu->msg, &reconfig->ded_info_nas_list[i].msg, reconfig->ded_info_nas_list[i].N_bytes); nas_sdu->N_bytes = reconfig->ded_info_nas_list[i].N_bytes; nas->write_pdu(lcid, nas_sdu); diff --git a/srsue/test/upper/ip_test.cc b/srsue/test/upper/ip_test.cc index 63deedc45..f38b6bcd0 100644 --- a/srsue/test/upper/ip_test.cc +++ b/srsue/test/upper/ip_test.cc @@ -245,7 +245,7 @@ public: mac->bcch_stop_rx(); apply_sib2_configs(); - srslte::byte_buffer_t *sdu = pool->allocate(); + srslte::byte_buffer_t *sdu = pool_allocate; assert(sdu); // Send Msg3 @@ -364,7 +364,7 @@ private: struct iphdr *ip_pkt; uint32_t idx = 0; int32_t N_bytes; - srslte::byte_buffer_t *pdu = pool->allocate(); + srslte::byte_buffer_t *pdu = pool_allocate; log_h->info("TUN/TAP reader thread running\n"); @@ -388,7 +388,7 @@ private: pdu->set_timestamp(); rlc->write_sdu(LCID, pdu); - pdu = pool->allocate(); + pdu = pool_allocate; idx = 0; } else{ idx += N_bytes; diff --git a/srsue/test/upper/nas_test.cc b/srsue/test/upper/nas_test.cc index 0af342dca..6aa9f29e5 100644 --- a/srsue/test/upper/nas_test.cc +++ b/srsue/test/upper/nas_test.cc @@ -152,7 +152,7 @@ int main(int argc, char **argv) - byte_buffer_t* tmp = pool->allocate(); + byte_buffer_t* tmp = pool_allocate; memcpy(tmp->msg, &pdu1[0], PDU1_LEN); tmp->N_bytes = PDU1_LEN;