added buffer pool function call name debug feature

master
Ismael Gomez 8 years ago
parent 2da8b1f93b
commit d05b03e43a

@ -558,7 +558,7 @@ int main(int argc, char **argv) {
if ((srslte_ue_sync_get_sfidx(&ue_sync) == 5 && (sfn%2)==0)) { if ((srslte_ue_sync_get_sfidx(&ue_sync) == 5 && (sfn%2)==0)) {
decode_pdsch = true; decode_pdsch = true;
} else { } else {
decode_pdsch = false; decode_pdsch = true;
} }
} }
if (decode_pdsch) { if (decode_pdsch) {

@ -72,8 +72,16 @@ public:
} }
} }
void print_all_buffers()
{
printf("%d buffers in queue\n", (int) used.size());
for (uint32_t i=0;i<used.size();i++) {
printf("%s\n", used[i]->debug_name?used[i]->debug_name:"Undefined");
}
}
buffer_t* allocate()
buffer_t* allocate(const char *debug_name = NULL)
{ {
pthread_mutex_lock(&mutex); pthread_mutex_lock(&mutex);
buffer_t* b = NULL; buffer_t* b = NULL;
@ -87,9 +95,18 @@ public:
if (available.size() < capacity/20) { if (available.size() < capacity/20) {
printf("Warning buffer pool capacity is %f %%\n", (float) available.size()/capacity); 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 { } else {
printf("Error - buffer pool is empty\n"); printf("Error - buffer pool is empty\n");
#ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED
print_all_buffers();
#endif
} }
pthread_mutex_unlock(&mutex); pthread_mutex_unlock(&mutex);
@ -134,8 +151,8 @@ public:
~byte_buffer_pool() { ~byte_buffer_pool() {
delete pool; delete pool;
} }
byte_buffer_t* allocate() { byte_buffer_t* allocate(const char *debug_name = NULL) {
return pool->allocate(); return pool->allocate(debug_name);
} }
void deallocate(byte_buffer_t *b) { void deallocate(byte_buffer_t *b) {
b->reset(); b->reset();

@ -50,6 +50,14 @@
#define SRSUE_MAX_BUFFER_SIZE_BYTES 12756 #define SRSUE_MAX_BUFFER_SIZE_BYTES 12756
#define SRSUE_BUFFER_HEADER_OFFSET 1024 #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" #include "srslte/srslte.h"
/******************************************************************************* /*******************************************************************************
@ -112,6 +120,9 @@ public:
uint32_t N_bytes; uint32_t N_bytes;
uint8_t buffer[SRSUE_MAX_BUFFER_SIZE_BYTES]; uint8_t buffer[SRSUE_MAX_BUFFER_SIZE_BYTES];
uint8_t *msg; uint8_t *msg;
#ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED
char debug_name[128];
#endif
byte_buffer_t():N_bytes(0) byte_buffer_t():N_bytes(0)
{ {
@ -181,6 +192,9 @@ struct bit_buffer_t{
uint32_t N_bits; uint32_t N_bits;
uint8_t buffer[SRSUE_MAX_BUFFER_SIZE_BITS]; uint8_t buffer[SRSUE_MAX_BUFFER_SIZE_BITS];
uint8_t *msg; uint8_t *msg;
#ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED
char debug_name[128];
#endif
bit_buffer_t():N_bits(0) bit_buffer_t():N_bits(0)
{ {

@ -64,6 +64,10 @@ private:
uint8_t ptr[MAX_PDU_LEN]; uint8_t ptr[MAX_PDU_LEN];
uint32_t len; uint32_t len;
uint32_t tstamp; uint32_t tstamp;
#ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED
char debug_name[128];
#endif
} pdu_t; } pdu_t;
block_queue<pdu_t*> pdu_q; block_queue<pdu_t*> pdu_q;

@ -473,6 +473,13 @@ int srslte_pdcch_extract_llr_multi(srslte_pdcch_t *q, cf_t *sf_symbols[SRSLTE_MA
/* descramble */ /* descramble */
srslte_scrambling_f_offset(&q->seq[nsubframe], q->llr, 0, e_bits); srslte_scrambling_f_offset(&q->seq[nsubframe], q->llr, 0, e_bits);
float mean = 0;
for (int i=0;i<e_bits;i++) {
mean += fabsf(q->llr[i]);
}
mean /= e_bits;
printf("power %f\n",mean);
ret = SRSLTE_SUCCESS; ret = SRSLTE_SUCCESS;
} }
return ret; return ret;

@ -222,7 +222,7 @@ void gw::run_thread()
struct iphdr *ip_pkt; struct iphdr *ip_pkt;
uint32 idx = 0; uint32 idx = 0;
int32 N_bytes; 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"); 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); pdcp->write_sdu(RB_ID_DRB1, pdu);
do { do {
pdu = pool->allocate(); pdu = pool_allocate;
if (!pdu) { if (!pdu) {
printf("Not enough buffers in pool\n"); printf("Not enough buffers in pool\n");
usleep(100000); usleep(100000);

@ -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."); rlc_log->info_hex(payload, nof_bytes, "BCCH BCH message received.");
dl_tput_bytes[0] += nof_bytes; dl_tput_bytes[0] += nof_bytes;
byte_buffer_t *buf = pool->allocate(); byte_buffer_t *buf = pool_allocate;
memcpy(buf->msg, payload, nof_bytes); memcpy(buf->msg, payload, nof_bytes);
buf->N_bytes = nof_bytes; buf->N_bytes = nof_bytes;
buf->set_timestamp(); 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."); rlc_log->info_hex(payload, nof_bytes, "BCCH TXSCH message received.");
dl_tput_bytes[0] += nof_bytes; dl_tput_bytes[0] += nof_bytes;
byte_buffer_t *buf = pool->allocate(); byte_buffer_t *buf = pool_allocate;
memcpy(buf->msg, payload, nof_bytes); memcpy(buf->msg, payload, nof_bytes);
buf->N_bytes = nof_bytes; buf->N_bytes = nof_bytes;
buf->set_timestamp(); 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."); rlc_log->info_hex(payload, nof_bytes, "PCCH message received.");
dl_tput_bytes[0] += nof_bytes; dl_tput_bytes[0] += nof_bytes;
byte_buffer_t *buf = pool->allocate(); byte_buffer_t *buf = pool_allocate;
memcpy(buf->msg, payload, nof_bytes); memcpy(buf->msg, payload, nof_bytes);
buf->N_bytes = nof_bytes; buf->N_bytes = nof_bytes;
buf->set_timestamp(); buf->set_timestamp();

@ -579,7 +579,7 @@ int rlc_am::build_data_pdu(uint8_t *payload, uint32_t nof_bytes)
return 0; return 0;
} }
byte_buffer_t *pdu = pool->allocate(); byte_buffer_t *pdu = pool_allocate;
if (!pdu) { if (!pdu) {
log->console("Fatal Error: Could not allocate PDU in build_data_pdu()\n"); log->console("Fatal Error: Could not allocate PDU in build_data_pdu()\n");
exit(-1); 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 // Write to rx window
rlc_amd_rx_pdu_t pdu; rlc_amd_rx_pdu_t pdu;
pdu.buf = pool->allocate(); pdu.buf = pool_allocate;
if (!pdu.buf) { if (!pdu.buf) {
log->console("Fatal Error: Could not allocate PDU in handle_data_pdu()\n"); log->console("Fatal Error: Could not allocate PDU in handle_data_pdu()\n");
exit(-1); 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; rlc_amd_rx_pdu_t segment;
segment.buf = pool->allocate(); segment.buf = pool_allocate;
if (!segment.buf) { if (!segment.buf) {
log->console("Fatal Error: Could not allocate PDU in handle_data_pdu_segment()\n"); log->console("Fatal Error: Could not allocate PDU in handle_data_pdu_segment()\n");
exit(-1); 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() void rlc_am::reassemble_rx_sdus()
{ {
if(!rx_sdu) { if(!rx_sdu) {
rx_sdu = pool->allocate(); rx_sdu = pool_allocate;
if (!rx_sdu) { if (!rx_sdu) {
log->console("Fatal Error: Could not allocate PDU in reassemble_rx_sdus() (1)\n"); log->console("Fatal Error: Could not allocate PDU in reassemble_rx_sdus() (1)\n");
exit(-1); 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]); log->info_hex(rx_sdu->msg, rx_sdu->N_bytes, "%s Rx SDU", rb_id_text[lcid]);
rx_sdu->set_timestamp(); rx_sdu->set_timestamp();
pdcp->write_pdu(lcid, rx_sdu); pdcp->write_pdu(lcid, rx_sdu);
rx_sdu = pool->allocate(); rx_sdu = pool_allocate;
if (!rx_sdu) { if (!rx_sdu) {
log->console("Fatal Error: Could not allocate PDU in reassemble_rx_sdus() (2)\n"); log->console("Fatal Error: Could not allocate PDU in reassemble_rx_sdus() (2)\n");
exit(-1); 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]); log->info_hex(rx_sdu->msg, rx_sdu->N_bytes, "%s Rx SDU", rb_id_text[lcid]);
rx_sdu->set_timestamp(); rx_sdu->set_timestamp();
pdcp->write_pdu(lcid, rx_sdu); pdcp->write_pdu(lcid, rx_sdu);
rx_sdu = pool->allocate(); rx_sdu = pool_allocate;
if (!rx_sdu) { if (!rx_sdu) {
log->console("Fatal Error: Could not allocate PDU in reassemble_rx_sdus() (3)\n"); log->console("Fatal Error: Could not allocate PDU in reassemble_rx_sdus() (3)\n");
exit(-1); 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 // Copy data
byte_buffer_t *full_pdu = pool->allocate(); byte_buffer_t *full_pdu = pool_allocate;
if (!full_pdu) { if (!full_pdu) {
log->console("Fatal Error: Could not allocate PDU in add_segment_and_check()\n"); log->console("Fatal Error: Could not allocate PDU in add_segment_and_check()\n");
exit(-1); exit(-1);

@ -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) 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); memcpy(buf->msg, payload, nof_bytes);
buf->N_bytes = nof_bytes; buf->N_bytes = nof_bytes;
buf->set_timestamp(); buf->set_timestamp();

@ -264,7 +264,7 @@ int rlc_um::build_data_pdu(uint8_t *payload, uint32_t nof_bytes)
return 0; return 0;
} }
byte_buffer_t *pdu = pool->allocate(); byte_buffer_t *pdu = pool_allocate;
if(!pdu || pdu->N_bytes != 0) if(!pdu || pdu->N_bytes != 0)
{ {
log->error("Failed to allocate PDU buffer\n"); 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 // Write to rx window
rlc_umd_pdu_t pdu; rlc_umd_pdu_t pdu;
pdu.buf = pool->allocate(); pdu.buf = pool_allocate;
if (!pdu.buf) { if (!pdu.buf) {
log->error("Discarting packet: no space in buffer pool\n"); log->error("Discarting packet: no space in buffer pool\n");
return; return;
@ -435,7 +435,7 @@ void rlc_um::handle_data_pdu(uint8_t *payload, uint32_t nof_bytes)
void rlc_um::reassemble_rx_sdus() void rlc_um::reassemble_rx_sdus()
{ {
if(!rx_sdu) if(!rx_sdu)
rx_sdu = pool->allocate(); rx_sdu = pool_allocate;
// First catch up with lower edge of reordering window // First catch up with lower edge of reordering window
while(!inside_reordering_window(vr_ur)) 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); 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(); rx_sdu->set_timestamp();
pdcp->write_pdu(lcid, rx_sdu); pdcp->write_pdu(lcid, rx_sdu);
rx_sdu = pool->allocate(); rx_sdu = pool_allocate;
} }
pdu_lost = false; 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); 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(); rx_sdu->set_timestamp();
pdcp->write_pdu(lcid, rx_sdu); pdcp->write_pdu(lcid, rx_sdu);
rx_sdu = pool->allocate(); rx_sdu = pool_allocate;
} }
pdu_lost = false; 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); 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(); rx_sdu->set_timestamp();
pdcp->write_pdu(lcid, rx_sdu); pdcp->write_pdu(lcid, rx_sdu);
rx_sdu = pool->allocate(); rx_sdu = pool_allocate;
} }
pdu_lost = false; 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); 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(); rx_sdu->set_timestamp();
pdcp->write_pdu(lcid, rx_sdu); pdcp->write_pdu(lcid, rx_sdu);
rx_sdu = pool->allocate(); rx_sdu = pool_allocate;
} }
pdu_lost = false; pdu_lost = false;
} }

@ -141,7 +141,7 @@ void gtpu::rem_user(uint16_t rnti)
void gtpu::run_thread() void gtpu::run_thread()
{ {
byte_buffer_t *pdu = pool->allocate(); byte_buffer_t *pdu = pool_allocate;
run_enable = true; run_enable = true;
running=true; running=true;
@ -176,7 +176,7 @@ void gtpu::run_thread()
pdcp->write_sdu(rnti, lcid, pdu); pdcp->write_sdu(rnti, lcid, pdu);
do { do {
pdu = pool->allocate(); pdu = pool_allocate;
if (!pdu) { if (!pdu) {
gtpu_log->console("GTPU Buffer pool empty. Trying again...\n"); gtpu_log->console("GTPU Buffer pool empty. Trying again...\n");
usleep(10000); usleep(10000);

@ -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 // Send Reconfiguration to old_rnti if is RRC_CONNECT or RRC Release if already released here
if (users.count(old_rnti) == 1) { if (users.count(old_rnti) == 1) {
if (users[old_rnti].is_connected()) { 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 { } else {
users[old_rnti].send_connection_release(); 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) 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; LIBLTE_RRC_DL_DCCH_MSG_STRUCT dl_dcch_msg;
dl_dcch_msg.msg_type = LIBLTE_RRC_DL_DCCH_MSG_TYPE_RRC_CON_RECONFIG; 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) 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 // 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) { if (pdu) {
liblte_rrc_pack_dl_ccch_msg(dl_ccch_msg, (LIBLTE_BIT_MSG_STRUCT*) &parent->bit_buf); 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); 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) void rrc::ue::send_dl_dcch(LIBLTE_RRC_DL_DCCH_MSG_STRUCT *dl_dcch_msg, byte_buffer_t *pdu)
{ {
if (!pdu) { if (!pdu) {
pdu = parent->pool->allocate(); pdu = parent->pool->allocate(__FUNCTION__);
} }
if (pdu) { if (pdu) {
liblte_rrc_pack_dl_dcch_msg(dl_dcch_msg, (LIBLTE_BIT_MSG_STRUCT*) &parent->bit_buf); liblte_rrc_pack_dl_dcch_msg(dl_dcch_msg, (LIBLTE_BIT_MSG_STRUCT*) &parent->bit_buf);

@ -87,7 +87,7 @@ void s1ap::get_metrics(s1ap_metrics_t &m)
void s1ap::run_thread() 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; uint32_t sz = SRSUE_MAX_BUFFER_SIZE_BYTES - SRSUE_BUFFER_HEADER_OFFSET;
running = true; running = true;
@ -512,7 +512,7 @@ bool s1ap::handle_dlnastransport(LIBLTE_S1AP_MESSAGE_DOWNLINKNASTRANSPORT_STRUCT
s1ap_log->warning("Not handling SubscriberProfileIDforRFP\n"); 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); memcpy(pdu->msg, msg->NAS_PDU.buffer, msg->NAS_PDU.n_octets);
pdu->N_bytes = msg->NAS_PDU.n_octets; pdu->N_bytes = msg->NAS_PDU.n_octets;
rrc->write_dl_info(rnti, pdu); 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) { if(!mme_connected) {
return false; return false;
} }
srslte::byte_buffer_t *buf = pool->allocate(); srslte::byte_buffer_t *buf = pool_allocate;
LIBLTE_S1AP_S1AP_PDU_STRUCT tx_pdu; LIBLTE_S1AP_S1AP_PDU_STRUCT tx_pdu;
tx_pdu.ext = false; 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) { if(!mme_connected) {
return false; return false;
} }
srslte::byte_buffer_t *buf = pool->allocate(); srslte::byte_buffer_t *buf = pool_allocate;
LIBLTE_S1AP_S1AP_PDU_STRUCT tx_pdu; LIBLTE_S1AP_S1AP_PDU_STRUCT tx_pdu;
tx_pdu.ext = false; tx_pdu.ext = false;
@ -940,7 +940,7 @@ bool s1ap::send_initial_ctxt_setup_failure(uint16_t rnti)
if(!mme_connected) { if(!mme_connected) {
return false; return false;
} }
srslte::byte_buffer_t *buf = pool->allocate(); srslte::byte_buffer_t *buf = pool_allocate;
LIBLTE_S1AP_S1AP_PDU_STRUCT tx_pdu; LIBLTE_S1AP_S1AP_PDU_STRUCT tx_pdu;
tx_pdu.ext = false; tx_pdu.ext = false;
tx_pdu.choice_type = LIBLTE_S1AP_S1AP_PDU_CHOICE_UNSUCCESSFULOUTCOME; tx_pdu.choice_type = LIBLTE_S1AP_S1AP_PDU_CHOICE_UNSUCCESSFULOUTCOME;

@ -212,7 +212,7 @@ public:
// Send dummy ConnectionSetup. MAC will send contention resolution ID automatically. // Send dummy ConnectionSetup. MAC will send contention resolution ID automatically.
log_h->info("Sending ConnectionSetup\n"); log_h->info("Sending ConnectionSetup\n");
sdu = pool->allocate(); sdu = pool_allocate;
sdu->msg[0] = 0xab; sdu->msg[0] = 0xab;
sdu->N_bytes = 1; sdu->N_bytes = 1;
rlc->write_sdu(0, sdu); rlc->write_sdu(0, sdu);
@ -273,7 +273,7 @@ private:
struct iphdr *ip_pkt; struct iphdr *ip_pkt;
uint32_t idx = 0; uint32_t idx = 0;
int32_t N_bytes = 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"); log_h->info("TUN/TAP reader thread running\n");
@ -304,7 +304,7 @@ private:
// Indicate RLC status to mac // Indicate RLC status to mac
mac->rlc_buffer_state(rnti, LCID, rlc->get_buffer_state(LCID), 0); mac->rlc_buffer_state(rnti, LCID, rlc->get_buffer_state(LCID), 0);
pdu = pool->allocate(); pdu = pool_allocate;
idx = 0; idx = 0;
} else{ } else{
idx += N_bytes; idx += N_bytes;

@ -527,7 +527,7 @@ void nas::parse_emm_information(uint32_t lcid, byte_buffer_t *pdu)
void nas::send_attach_request() void nas::send_attach_request()
{ {
LIBLTE_MME_ATTACH_REQUEST_MSG_STRUCT attach_req; LIBLTE_MME_ATTACH_REQUEST_MSG_STRUCT attach_req;
byte_buffer_t *msg = pool->allocate(); byte_buffer_t *msg = pool_allocate;
u_int32_t i; u_int32_t i;
attach_req.eps_attach_type = LIBLTE_MME_EPS_ATTACH_TYPE_EPS_ATTACH; 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() void nas::send_service_request()
{ {
byte_buffer_t *msg = pool->allocate(); byte_buffer_t *msg = pool_allocate;
count_ul++; count_ul++;
// Pack the service request message directly // Pack the service request message directly

@ -400,7 +400,7 @@ void rrc::send_con_request()
bit_buf.msg[bit_buf.N_bits + i] = 0; bit_buf.msg[bit_buf.N_bits + i] = 0;
bit_buf.N_bits += 8 - (bit_buf.N_bits % 8); 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); 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->N_bytes = bit_buf.N_bits/8;
pdcp_buf->set_timestamp(); 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.msg[bit_buf.N_bits + i] = 0;
bit_buf.N_bits += 8 - (bit_buf.N_bits % 8); 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); 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->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.msg[bit_buf.N_bits + i] = 0;
bit_buf.N_bits += 8 - (bit_buf.N_bits % 8); 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); 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->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.msg[bit_buf.N_bits + i] = 0;
bit_buf.N_bits += 8 - (bit_buf.N_bits % 8); 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); 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->N_bytes = bit_buf.N_bits/8;
pdcp_buf->set_timestamp(); 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; byte_buffer_t *nas_sdu;
for(i=0;i<reconfig->N_ded_info_nas;i++) for(i=0;i<reconfig->N_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); 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_sdu->N_bytes = reconfig->ded_info_nas_list[i].N_bytes;
nas->write_pdu(lcid, nas_sdu); nas->write_pdu(lcid, nas_sdu);

@ -245,7 +245,7 @@ public:
mac->bcch_stop_rx(); mac->bcch_stop_rx();
apply_sib2_configs(); apply_sib2_configs();
srslte::byte_buffer_t *sdu = pool->allocate(); srslte::byte_buffer_t *sdu = pool_allocate;
assert(sdu); assert(sdu);
// Send Msg3 // Send Msg3
@ -364,7 +364,7 @@ private:
struct iphdr *ip_pkt; struct iphdr *ip_pkt;
uint32_t idx = 0; uint32_t idx = 0;
int32_t N_bytes; 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"); log_h->info("TUN/TAP reader thread running\n");
@ -388,7 +388,7 @@ private:
pdu->set_timestamp(); pdu->set_timestamp();
rlc->write_sdu(LCID, pdu); rlc->write_sdu(LCID, pdu);
pdu = pool->allocate(); pdu = pool_allocate;
idx = 0; idx = 0;
} else{ } else{
idx += N_bytes; idx += N_bytes;

@ -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); memcpy(tmp->msg, &pdu1[0], PDU1_LEN);
tmp->N_bytes = PDU1_LEN; tmp->N_bytes = PDU1_LEN;

Loading…
Cancel
Save