Commit dabdf793 authored by Wilson's avatar Wilson
Browse files

add more logs to debug memory leak problem

parent afeb2566
...@@ -160,7 +160,7 @@ boolean_t pdcp_data_req( ...@@ -160,7 +160,7 @@ boolean_t pdcp_data_req(
if (modeP == PDCP_TRANSMISSION_MODE_TRANSPARENT) { if (modeP == PDCP_TRANSMISSION_MODE_TRANSPARENT) {
LOG_D(PDCP, " [TM] Asking for a new mem_block of size %d\n",sdu_buffer_sizeP); LOG_D(PDCP, " [TM] Asking for a new mem_block of size %d\n",sdu_buffer_sizeP);
pdcp_pdu_p = get_free_mem_block(sdu_buffer_sizeP); pdcp_pdu_p = get_free_mem_block(sdu_buffer_sizeP, __func__);
if (pdcp_pdu_p != NULL) { if (pdcp_pdu_p != NULL) {
memcpy(&pdcp_pdu_p->data[0], sdu_buffer_pP, sdu_buffer_sizeP); memcpy(&pdcp_pdu_p->data[0], sdu_buffer_pP, sdu_buffer_sizeP);
...@@ -201,7 +201,7 @@ boolean_t pdcp_data_req( ...@@ -201,7 +201,7 @@ boolean_t pdcp_data_req(
/* /*
* Allocate a new block for the new PDU (i.e. PDU header and SDU payload) * Allocate a new block for the new PDU (i.e. PDU header and SDU payload)
*/ */
pdcp_pdu_p = get_free_mem_block(pdcp_pdu_size); pdcp_pdu_p = get_free_mem_block(pdcp_pdu_size, __func__);
if (pdcp_pdu_p != NULL) { if (pdcp_pdu_p != NULL) {
/* /*
...@@ -260,7 +260,7 @@ boolean_t pdcp_data_req( ...@@ -260,7 +260,7 @@ boolean_t pdcp_data_req(
PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP,pdcp_p), PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP,pdcp_p),
current_sn); current_sn);
free_mem_block(pdcp_pdu_p); free_mem_block(pdcp_pdu_p, __func__);
if (ctxt_pP->enb_flag == ENB_FLAG_NO) { if (ctxt_pP->enb_flag == ENB_FLAG_NO) {
stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_req); stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_req);
...@@ -510,7 +510,7 @@ pdcp_data_ind( ...@@ -510,7 +510,7 @@ pdcp_data_ind(
PROTOCOL_CTXT_FMT"Could not get PDCP instance key 0x%"PRIx64"\n", PROTOCOL_CTXT_FMT"Could not get PDCP instance key 0x%"PRIx64"\n",
PROTOCOL_CTXT_ARGS(ctxt_pP), PROTOCOL_CTXT_ARGS(ctxt_pP),
key); key);
free_mem_block(sdu_buffer_pP); free_mem_block(sdu_buffer_pP, __func__);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_IND,VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_IND,VCD_FUNCTION_OUT);
return FALSE; return FALSE;
} }
...@@ -567,7 +567,7 @@ pdcp_data_ind( ...@@ -567,7 +567,7 @@ pdcp_data_ind(
PROTOCOL_PDCP_CTXT_FMT"Incoming (from RLC) SDU is short of size (size:%d)! Ignoring...\n", PROTOCOL_PDCP_CTXT_FMT"Incoming (from RLC) SDU is short of size (size:%d)! Ignoring...\n",
PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP, pdcp_p), PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP, pdcp_p),
sdu_buffer_sizeP); sdu_buffer_sizeP);
free_mem_block(sdu_buffer_pP); free_mem_block(sdu_buffer_pP, __func__);
if (ctxt_pP->enb_flag) { if (ctxt_pP->enb_flag) {
stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_ind); stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_ind);
...@@ -598,7 +598,7 @@ pdcp_data_ind( ...@@ -598,7 +598,7 @@ pdcp_data_ind(
*/ */
#if 0 #if 0
LOG_D(PDCP, "Ignoring PDU...\n"); LOG_D(PDCP, "Ignoring PDU...\n");
free_mem_block(sdu_buffer); free_mem_block(sdu_buffer, __func__);
return FALSE; return FALSE;
#else #else
//LOG_W(PDCP, "Delivering out-of-order SDU to upper layer...\n"); //LOG_W(PDCP, "Delivering out-of-order SDU to upper layer...\n");
...@@ -645,9 +645,9 @@ pdcp_data_ind( ...@@ -645,9 +645,9 @@ pdcp_data_ind(
rb_id, rb_id,
sdu_buffer_sizeP - pdcp_header_len - pdcp_tailer_len, sdu_buffer_sizeP - pdcp_header_len - pdcp_tailer_len,
(uint8_t*)&sdu_buffer_pP->data[pdcp_header_len]); (uint8_t*)&sdu_buffer_pP->data[pdcp_header_len]);
free_mem_block(sdu_buffer_pP); free_mem_block(sdu_buffer_pP, __func__);
// free_mem_block(new_sdu); // free_mem_block(new_sdu, __func__);
if (ctxt_pP->enb_flag) { if (ctxt_pP->enb_flag) {
stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_ind); stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_ind);
} else { } else {
...@@ -722,7 +722,7 @@ pdcp_data_ind( ...@@ -722,7 +722,7 @@ pdcp_data_ind(
ctime, ctime,
(const char*)(&sdu_buffer_pP->data[payload_offset]), (const char*)(&sdu_buffer_pP->data[payload_offset]),
sdu_buffer_sizeP - payload_offset ) == 0 ) { sdu_buffer_sizeP - payload_offset ) == 0 ) {
free_mem_block(sdu_buffer_pP); free_mem_block(sdu_buffer_pP, __func__);
if (ctxt_pP->enb_flag) { if (ctxt_pP->enb_flag) {
stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_ind); stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_ind);
...@@ -739,7 +739,7 @@ pdcp_data_ind( ...@@ -739,7 +739,7 @@ pdcp_data_ind(
if (otg_enabled==1) { if (otg_enabled==1) {
LOG_D(OTG,"Discarding received packed\n"); LOG_D(OTG,"Discarding received packed\n");
free_mem_block(sdu_buffer_pP); free_mem_block(sdu_buffer_pP, __func__);
if (ctxt_pP->enb_flag) { if (ctxt_pP->enb_flag) {
stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_ind); stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_ind);
...@@ -794,7 +794,7 @@ pdcp_data_ind( ...@@ -794,7 +794,7 @@ pdcp_data_ind(
#endif #endif
if (FALSE == packet_forwarded) { if (FALSE == packet_forwarded) {
new_sdu_p = get_free_mem_block(sdu_buffer_sizeP - payload_offset + sizeof (pdcp_data_ind_header_t)); new_sdu_p = get_free_mem_block(sdu_buffer_sizeP - payload_offset + sizeof (pdcp_data_ind_header_t), __func__);
if (new_sdu_p) { if (new_sdu_p) {
if (pdcp_p->rlc_mode == RLC_MODE_AM ) { if (pdcp_p->rlc_mode == RLC_MODE_AM ) {
...@@ -856,7 +856,7 @@ pdcp_data_ind( ...@@ -856,7 +856,7 @@ pdcp_data_ind(
#endif #endif
free_mem_block(sdu_buffer_pP); free_mem_block(sdu_buffer_pP, __func__);
if (ctxt_pP->enb_flag) { if (ctxt_pP->enb_flag) {
stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_ind); stop_meas(&eNB_pdcp_stats[ctxt_pP->module_id].data_ind);
......
...@@ -44,7 +44,7 @@ configure_pdcp_req (struct pdcp_entity *pdcpP, void *rlcP, uint8_t rlc_sap_typeP ...@@ -44,7 +44,7 @@ configure_pdcp_req (struct pdcp_entity *pdcpP, void *rlcP, uint8_t rlc_sap_typeP
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
mem_block *mb; mem_block *mb;
mb = get_free_mem_block (sizeof (struct cpdcp_primitive)); mb = get_free_mem_block (sizeof (struct cpdcp_primitive), __func__);
((struct cpdcp_primitive *) mb->data)->type = CPDCP_CONFIG_REQ; ((struct cpdcp_primitive *) mb->data)->type = CPDCP_CONFIG_REQ;
((struct cpdcp_primitive *) mb->data)->primitive.config_req.rlc_sap = rlcP; ((struct cpdcp_primitive *) mb->data)->primitive.config_req.rlc_sap = rlcP;
((struct cpdcp_primitive *) mb->data)->primitive.config_req.rlc_type_sap = rlc_sap_typeP; ((struct cpdcp_primitive *) mb->data)->primitive.config_req.rlc_type_sap = rlc_sap_typeP;
......
...@@ -128,7 +128,7 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const ctxt_pP) ...@@ -128,7 +128,7 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const ctxt_pP)
((pdcp_data_ind_header_t *)(sdu_p->data))->data_size); ((pdcp_data_ind_header_t *)(sdu_p->data))->data_size);
list_remove_head (&pdcp_sdu_list); list_remove_head (&pdcp_sdu_list);
free_mem_block (sdu_p); free_mem_block (sdu_p, __func__);
cont = 1; cont = 1;
pdcp_nb_sdu_sent += 1; pdcp_nb_sdu_sent += 1;
sdu_p = list_get_head (&pdcp_sdu_list); sdu_p = list_get_head (&pdcp_sdu_list);
...@@ -244,7 +244,7 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const ctxt_pP) ...@@ -244,7 +244,7 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const ctxt_pP)
((pdcp_data_ind_header_t *)(sdu_p->data))->rb_id); ((pdcp_data_ind_header_t *)(sdu_p->data))->rb_id);
list_remove_head (&pdcp_sdu_list); list_remove_head (&pdcp_sdu_list);
free_mem_block (sdu_p); free_mem_block (sdu_p, __func__);
cont = 1; cont = 1;
pdcp_nb_sdu_sent += 1; pdcp_nb_sdu_sent += 1;
sdu_p = list_get_head (&pdcp_sdu_list); sdu_p = list_get_head (&pdcp_sdu_list);
...@@ -272,7 +272,7 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const ctxt_pP) ...@@ -272,7 +272,7 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const ctxt_pP)
if (!pdcp_output_sdu_bytes_to_write) { // OK finish with this SDU if (!pdcp_output_sdu_bytes_to_write) { // OK finish with this SDU
//PRINT_RB_SEND_OUTPUT_SDU ("[PDCP] RADIO->IP SEND SDU\n"); //PRINT_RB_SEND_OUTPUT_SDU ("[PDCP] RADIO->IP SEND SDU\n");
list_remove_head (&pdcp_sdu_list); list_remove_head (&pdcp_sdu_list);
free_mem_block (sdu_p); free_mem_block (sdu_p, __func__);
cont = 1; cont = 1;
pdcp_nb_sdu_sent += 1; pdcp_nb_sdu_sent += 1;
sdu_p = list_get_head (&pdcp_sdu_list); sdu_p = list_get_head (&pdcp_sdu_list);
......
...@@ -1280,7 +1280,7 @@ rlc_am_data_req ( ...@@ -1280,7 +1280,7 @@ rlc_am_data_req (
l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].mem_block, l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].flags.segmented); l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].mem_block, l_rlc_p->input_sdus[l_rlc_p->next_sdu_index].flags.segmented);
l_rlc_p->stat_tx_pdcp_sdu_discarded += 1; l_rlc_p->stat_tx_pdcp_sdu_discarded += 1;
l_rlc_p->stat_tx_pdcp_bytes_discarded += ((struct rlc_am_data_req *) (sdu_pP->data))->data_size; l_rlc_p->stat_tx_pdcp_bytes_discarded += ((struct rlc_am_data_req *) (sdu_pP->data))->data_size;
free_mem_block (sdu_pP); free_mem_block (sdu_pP, __func__);
#if STOP_ON_IP_TRAFFIC_OVERLOAD #if STOP_ON_IP_TRAFFIC_OVERLOAD
AssertFatal(0, PROTOCOL_RLC_AM_CTXT_FMT" RLC_AM_DATA_REQ size %d Bytes, SDU DROPPED, INPUT BUFFER OVERFLOW NB SDU %d current_sdu_index=%d next_sdu_index=%d \n", AssertFatal(0, PROTOCOL_RLC_AM_CTXT_FMT" RLC_AM_DATA_REQ size %d Bytes, SDU DROPPED, INPUT BUFFER OVERFLOW NB SDU %d current_sdu_index=%d next_sdu_index=%d \n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,l_rlc_p), PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,l_rlc_p),
......
...@@ -42,7 +42,7 @@ void rlc_am_free_in_sdu( ...@@ -42,7 +42,7 @@ void rlc_am_free_in_sdu(
{ {
if (index_in_bufferP <= RLC_AM_SDU_CONTROL_BUFFER_SIZE) { if (index_in_bufferP <= RLC_AM_SDU_CONTROL_BUFFER_SIZE) {
if (rlcP->input_sdus[index_in_bufferP].mem_block != NULL) { if (rlcP->input_sdus[index_in_bufferP].mem_block != NULL) {
free_mem_block(rlcP->input_sdus[index_in_bufferP].mem_block); free_mem_block(rlcP->input_sdus[index_in_bufferP].mem_block, __func__);
rlcP->input_sdus[index_in_bufferP].mem_block = NULL; rlcP->input_sdus[index_in_bufferP].mem_block = NULL;
rlcP->nb_sdu_no_segmented -= 1; rlcP->nb_sdu_no_segmented -= 1;
rlcP->input_sdus[index_in_bufferP].sdu_remaining_size = 0; rlcP->input_sdus[index_in_bufferP].sdu_remaining_size = 0;
...@@ -81,7 +81,7 @@ rlc_am_free_in_sdu_data( ...@@ -81,7 +81,7 @@ rlc_am_free_in_sdu_data(
{ {
if (index_in_bufferP <= RLC_AM_SDU_CONTROL_BUFFER_SIZE) { if (index_in_bufferP <= RLC_AM_SDU_CONTROL_BUFFER_SIZE) {
if (rlcP->input_sdus[index_in_bufferP].mem_block != NULL) { if (rlcP->input_sdus[index_in_bufferP].mem_block != NULL) {
free_mem_block(rlcP->input_sdus[index_in_bufferP].mem_block); free_mem_block(rlcP->input_sdus[index_in_bufferP].mem_block, __func__);
rlcP->input_sdus[index_in_bufferP].mem_block = NULL; rlcP->input_sdus[index_in_bufferP].mem_block = NULL;
rlcP->input_sdus[index_in_bufferP].sdu_remaining_size = 0; rlcP->input_sdus[index_in_bufferP].sdu_remaining_size = 0;
rlcP->nb_sdu_no_segmented -= 1; rlcP->nb_sdu_no_segmented -= 1;
......
...@@ -152,7 +152,7 @@ rlc_am_cleanup( ...@@ -152,7 +152,7 @@ rlc_am_cleanup(
if (rlc_pP->output_sdu_in_construction != NULL) { if (rlc_pP->output_sdu_in_construction != NULL) {
free_mem_block(rlc_pP->output_sdu_in_construction); free_mem_block(rlc_pP->output_sdu_in_construction, __func__);
rlc_pP->output_sdu_in_construction = NULL; rlc_pP->output_sdu_in_construction = NULL;
} }
...@@ -161,7 +161,7 @@ rlc_am_cleanup( ...@@ -161,7 +161,7 @@ rlc_am_cleanup(
if (rlc_pP->input_sdus != NULL) { if (rlc_pP->input_sdus != NULL) {
for (i=0; i < RLC_AM_SDU_CONTROL_BUFFER_SIZE; i++) { for (i=0; i < RLC_AM_SDU_CONTROL_BUFFER_SIZE; i++) {
if (rlc_pP->input_sdus[i].mem_block != NULL) { if (rlc_pP->input_sdus[i].mem_block != NULL) {
free_mem_block(rlc_pP->input_sdus[i].mem_block); free_mem_block(rlc_pP->input_sdus[i].mem_block, __func__);
rlc_pP->input_sdus[i].mem_block = NULL; rlc_pP->input_sdus[i].mem_block = NULL;
} }
} }
...@@ -175,7 +175,7 @@ rlc_am_cleanup( ...@@ -175,7 +175,7 @@ rlc_am_cleanup(
if (rlc_pP->pdu_retrans_buffer != NULL) { if (rlc_pP->pdu_retrans_buffer != NULL) {
for (i=0; i < RLC_AM_PDU_RETRANSMISSION_BUFFER_SIZE; i++) { for (i=0; i < RLC_AM_PDU_RETRANSMISSION_BUFFER_SIZE; i++) {
if (rlc_pP->pdu_retrans_buffer[i].mem_block != NULL) { if (rlc_pP->pdu_retrans_buffer[i].mem_block != NULL) {
free_mem_block(rlc_pP->pdu_retrans_buffer[i].mem_block); free_mem_block(rlc_pP->pdu_retrans_buffer[i].mem_block, __func__);
rlc_pP->pdu_retrans_buffer[i].mem_block = NULL; rlc_pP->pdu_retrans_buffer[i].mem_block = NULL;
} }
} }
......
...@@ -55,7 +55,7 @@ rlc_am_reassembly ( ...@@ -55,7 +55,7 @@ rlc_am_reassembly (
lengthP); lengthP);
if (rlc_pP->output_sdu_in_construction == NULL) { if (rlc_pP->output_sdu_in_construction == NULL) {
rlc_pP->output_sdu_in_construction = get_free_mem_block (RLC_SDU_MAX_SIZE); rlc_pP->output_sdu_in_construction = get_free_mem_block (RLC_SDU_MAX_SIZE, __func__);
rlc_pP->output_sdu_size_to_write = 0; rlc_pP->output_sdu_size_to_write = 0;
assert(rlc_pP->output_sdu_in_construction != NULL); assert(rlc_pP->output_sdu_in_construction != NULL);
} }
...@@ -197,7 +197,7 @@ rlc_am_send_sdu ( ...@@ -197,7 +197,7 @@ rlc_am_send_sdu (
LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND_SDU] ERROR SIZE <= 0 ... DO NOTHING, SET SDU SIZE TO 0\n", LOG_E(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEND_SDU] ERROR SIZE <= 0 ... DO NOTHING, SET SDU SIZE TO 0\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP)); PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
//msg("[RLC_AM][MOD %d] Freeing mem_block ...\n", rlc_pP->module_id); //msg("[RLC_AM][MOD %d] Freeing mem_block ...\n", rlc_pP->module_id);
//free_mem_block (rlc_pP->output_sdu_in_construction); //free_mem_block (rlc_pP->output_sdu_in_construction, __func__);
AssertFatal(3==4, AssertFatal(3==4,
PROTOCOL_RLC_AM_CTXT_FMT" SEND SDU REQUESTED %d bytes", PROTOCOL_RLC_AM_CTXT_FMT" SEND SDU REQUESTED %d bytes",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
...@@ -397,5 +397,5 @@ rlc_am_reassemble_pdu( ...@@ -397,5 +397,5 @@ rlc_am_reassemble_pdu(
} }
} }
free_mem_block(tb_pP); free_mem_block(tb_pP, __func__);
} }
...@@ -346,7 +346,7 @@ rlc_am_receive_process_data_pdu ( ...@@ -346,7 +346,7 @@ rlc_am_receive_process_data_pdu (
if (rlc_am_rx_list_insert_pdu(ctxt_pP, rlc_pP,tb_pP) < 0) { if (rlc_am_rx_list_insert_pdu(ctxt_pP, rlc_pP,tb_pP) < 0) {
rlc_pP->stat_rx_data_pdu_dropped += 1; rlc_pP->stat_rx_data_pdu_dropped += 1;
rlc_pP->stat_rx_data_bytes_dropped += tb_size_in_bytesP; rlc_pP->stat_rx_data_bytes_dropped += tb_size_in_bytesP;
free_mem_block (tb_pP); free_mem_block (tb_pP, __func__);
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[PROCESS RX PDU] PDU DISCARDED, STATUS REQUESTED:\n", LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[PROCESS RX PDU] PDU DISCARDED, STATUS REQUESTED:\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP)); PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
rlc_pP->status_requested = 1; rlc_pP->status_requested = 1;
...@@ -437,12 +437,12 @@ rlc_am_receive_process_data_pdu ( ...@@ -437,12 +437,12 @@ rlc_am_receive_process_data_pdu (
} else { } else {
rlc_pP->stat_rx_data_pdu_out_of_window += 1; rlc_pP->stat_rx_data_pdu_out_of_window += 1;
rlc_pP->stat_rx_data_bytes_out_of_window += tb_size_in_bytesP; rlc_pP->stat_rx_data_bytes_out_of_window += tb_size_in_bytesP;
free_mem_block (tb_pP); free_mem_block (tb_pP, __func__);
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[PROCESS RX PDU] PDU OUT OF RX WINDOW, DISCARDED, STATUS REQUESTED:\n", LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[PROCESS RX PDU] PDU OUT OF RX WINDOW, DISCARDED, STATUS REQUESTED:\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP)); PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
rlc_pP->status_requested = 1; rlc_pP->status_requested = 1;
} }
} else { } else {
free_mem_block (tb_pP); free_mem_block (tb_pP, __func__);
} }
} }
...@@ -143,7 +143,7 @@ void rlc_am_ack_pdu ( ...@@ -143,7 +143,7 @@ void rlc_am_ack_pdu (
if ((rlc_pP->pdu_retrans_buffer[snP].flags.ack == 0) && (mb_p != NULL)) { if ((rlc_pP->pdu_retrans_buffer[snP].flags.ack == 0) && (mb_p != NULL)) {
//if (mb_pP != NULL) { //if (mb_pP != NULL) {
free_mem_block(mb_p); free_mem_block(mb_p, __func__);
rlc_pP->pdu_retrans_buffer[snP].mem_block = NULL; rlc_pP->pdu_retrans_buffer[snP].mem_block = NULL;
LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[ACK-PDU] ACK PDU SN %05d previous retx_count %d \n", LOG_D(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[ACK-PDU] ACK PDU SN %05d previous retx_count %d \n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP), PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
...@@ -235,7 +235,7 @@ void rlc_am_ack_pdu ( ...@@ -235,7 +235,7 @@ void rlc_am_ack_pdu (
snP); snP);
if (mb_p != NULL) { if (mb_p != NULL) {
free_mem_block(mb_p); free_mem_block(mb_p, __func__);
rlc_pP->pdu_retrans_buffer[snP].mem_block = NULL; rlc_pP->pdu_retrans_buffer[snP].mem_block = NULL;
} }
...@@ -275,7 +275,7 @@ mem_block_t* rlc_am_retransmit_get_copy ( ...@@ -275,7 +275,7 @@ mem_block_t* rlc_am_retransmit_get_copy (
rlc_am_tx_data_pdu_management_t *pdu_mngt = &rlc_pP->pdu_retrans_buffer[snP % RLC_AM_PDU_RETRANSMISSION_BUFFER_SIZE]; rlc_am_tx_data_pdu_management_t *pdu_mngt = &rlc_pP->pdu_retrans_buffer[snP % RLC_AM_PDU_RETRANSMISSION_BUFFER_SIZE];
int size = pdu_mngt->header_and_payload_size + sizeof(struct mac_tb_req); int size = pdu_mngt->header_and_payload_size + sizeof(struct mac_tb_req);
mem_block_t* mb_copy = get_free_mem_block(size); mem_block_t* mb_copy = get_free_mem_block(size, __func__);
memcpy(mb_copy->data, mb_original_p->data, size); memcpy(mb_copy->data, mb_original_p->data, size);
rlc_am_pdu_sn_10_t *pdu_p = (rlc_am_pdu_sn_10_t*) (&mb_copy->data[sizeof(struct mac_tb_req)]); rlc_am_pdu_sn_10_t *pdu_p = (rlc_am_pdu_sn_10_t*) (&mb_copy->data[sizeof(struct mac_tb_req)]);
...@@ -343,7 +343,7 @@ mem_block_t* rlc_am_retransmit_get_subsegment( ...@@ -343,7 +343,7 @@ mem_block_t* rlc_am_retransmit_get_subsegment(
mem_block_t* mb_original_p = rlc_pP->pdu_retrans_buffer[snP].mem_block; mem_block_t* mb_original_p = rlc_pP->pdu_retrans_buffer[snP].mem_block;
if (mb_original_p != NULL) { if (mb_original_p != NULL) {
mem_block_t* mb_sub_segment_p = get_free_mem_block(*sizeP + sizeof(struct mac_tb_req)); mem_block_t* mb_sub_segment_p = get_free_mem_block(*sizeP + sizeof(struct mac_tb_req), __func__);
rlc_am_pdu_sn_10_t* pdu_original_p = (rlc_am_pdu_sn_10_t*) (&mb_original_p->data[sizeof(struct mac_tb_req)]); rlc_am_pdu_sn_10_t* pdu_original_p = (rlc_am_pdu_sn_10_t*) (&mb_original_p->data[sizeof(struct mac_tb_req)]);
rlc_am_pdu_sn_10_t* pdu_sub_segment_p = (rlc_am_pdu_sn_10_t*) (&mb_sub_segment_p->data[sizeof(struct mac_tb_req)]); rlc_am_pdu_sn_10_t* pdu_sub_segment_p = (rlc_am_pdu_sn_10_t*) (&mb_sub_segment_p->data[sizeof(struct mac_tb_req)]);
rlc_am_pdu_info_t pdu_info; rlc_am_pdu_info_t pdu_info;
......
...@@ -197,7 +197,7 @@ void rlc_am_segment_10 ( ...@@ -197,7 +197,7 @@ void rlc_am_segment_10 (
data_pdu_size); data_pdu_size);
} }
if (!(pdu_mem_p = get_free_mem_block (data_pdu_size + sizeof(struct mac_tb_req)))) { if (!(pdu_mem_p = get_free_mem_block (data_pdu_size + sizeof(struct mac_tb_req), __func__))) {
LOG_C(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEGMENT] ERROR COULD NOT GET NEW PDU, EXIT\n", LOG_C(RLC, PROTOCOL_RLC_AM_CTXT_FMT"[SEGMENT] ERROR COULD NOT GET NEW PDU, EXIT\n",
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP)); PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP));
RLC_AM_MUTEX_UNLOCK(&rlc_pP->lock_input_sdus); RLC_AM_MUTEX_UNLOCK(&rlc_pP->lock_input_sdus);
...@@ -366,7 +366,7 @@ void rlc_am_segment_10 ( ...@@ -366,7 +366,7 @@ void rlc_am_segment_10 (
// free SDU // free SDU
rlc_pP->sdu_buffer_occupancy -= sdu_mngt_p->sdu_remaining_size; rlc_pP->sdu_buffer_occupancy -= sdu_mngt_p->sdu_remaining_size;
rlc_am_free_in_sdu_data(ctxt_pP, rlc_pP, rlc_pP->current_sdu_index); rlc_am_free_in_sdu_data(ctxt_pP, rlc_pP, rlc_pP->current_sdu_index);
//free_mem_block (rlc_pP->input_sdus[rlc_pP->current_sdu_index]); //free_mem_block (rlc_pP->input_sdus[rlc_pP->current_sdu_index], __func__);
//rlc_pP->input_sdus[rlc_pP->current_sdu_index] = NULL; //rlc_pP->input_sdus[rlc_pP->current_sdu_index] = NULL;
//rlc_pP->nb_sdu -= 1; //rlc_pP->nb_sdu -= 1;
rlc_pP->current_sdu_index = (rlc_pP->current_sdu_index + 1) % RLC_AM_SDU_CONTROL_BUFFER_SIZE; rlc_pP->current_sdu_index = (rlc_pP->current_sdu_index + 1) % RLC_AM_SDU_CONTROL_BUFFER_SIZE;
...@@ -445,7 +445,7 @@ void rlc_am_segment_10 ( ...@@ -445,7 +445,7 @@ void rlc_am_segment_10 (
sdu_mngt_p->sdu_remaining_size = 0; sdu_mngt_p->sdu_remaining_size = 0;
rlc_am_free_in_sdu_data(ctxt_pP, rlc_pP, rlc_pP->current_sdu_index); rlc_am_free_in_sdu_data(ctxt_pP, rlc_pP, rlc_pP->current_sdu_index);
//free_mem_block (rlc_pP->input_sdus[rlc_pP->current_sdu_index]); //free_mem_block (rlc_pP->input_sdus[rlc_pP->current_sdu_index], __func__);
//rlc_pP->input_sdus[rlc_pP->current_sdu_index] = NULL; //rlc_pP->input_sdus[rlc_pP->current_sdu_index] = NULL;
//rlc_pP->nb_sdu -= 1; //rlc_pP->nb_sdu -= 1;
rlc_pP->current_sdu_index = (rlc_pP->current_sdu_index + 1) % RLC_AM_SDU_CONTROL_BUFFER_SIZE; rlc_pP->current_sdu_index = (rlc_pP->current_sdu_index + 1) % RLC_AM_SDU_CONTROL_BUFFER_SIZE;
......
...@@ -370,7 +370,7 @@ rlc_am_receive_process_control_pdu( ...@@ -370,7 +370,7 @@ rlc_am_receive_process_control_pdu(
*first_byte_ppP = (uint8_t*)((uint64_t)*first_byte_ppP + initial_pdu_size - *tb_size_in_bytes_pP); *first_byte_ppP = (uint8_t*)((uint64_t)*first_byte_ppP + initial_pdu_size - *tb_size_in_bytes_pP);
free_mem_block(tb_pP); free_mem_block(tb_pP, __func__);
rlc_am_tx_buffer_display(ctxt_pP, rlc_pP, NULL); rlc_am_tx_buffer_display(ctxt_pP, rlc_pP, NULL);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -730,7 +730,7 @@ end_push_nack: ...@@ -730,7 +730,7 @@ end_push_nack:
__LINE__, __LINE__,
pdu_size); pdu_size);
#endif #endif
tb_p = get_free_mem_block(sizeof(struct mac_tb_req) + pdu_size); tb_p = get_free_mem_block(sizeof(struct mac_tb_req) + pdu_size, __func__);
memset(tb_p->data, 0, sizeof(struct mac_tb_req) + pdu_size); memset(tb_p->data, 0, sizeof(struct mac_tb_req) + pdu_size);
//estimation only ((struct mac_tb_req*)(tb_p->data))->tb_size = pdu_size; //estimation only ((struct mac_tb_req*)(tb_p->data))->tb_size = pdu_size;
((struct mac_tb_req*)(tb_p->data))->data_ptr = (uint8_t*)&(tb_p->data[sizeof(struct mac_tb_req)]); ((struct mac_tb_req*)(tb_p->data))->data_ptr = (uint8_t*)&(tb_p->data[sizeof(struct mac_tb_req)]);
......
...@@ -516,7 +516,7 @@ void rlc_am_v9_3_0_test_send_sdu(rlc_am_entity_t *am_txP, int sdu_indexP) ...@@ -516,7 +516,7 @@ void rlc_am_v9_3_0_test_send_sdu(rlc_am_entity_t *am_txP, int sdu_indexP)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
{ {
mem_block_t *sdu; mem_block_t *sdu;
sdu = get_free_mem_block (strlen(g_sdus[sdu_indexP]) + 1 + sizeof (struct rlc_am_data_req_alloc)); sdu = get_free_mem_block (strlen(g_sdus[sdu_indexP]) + 1 + sizeof (struct rlc_am_data_req_alloc), __func__);
if (sdu != NULL) { if (sdu != NULL) {
// PROCESS OF COMPRESSION HERE: // PROCESS OF COMPRESSION HERE:
...@@ -561,7 +561,7 @@ void rlc_am_v9_3_0_test_mac_rlc_loop (struct mac_data_ind *data_indP, struct ma ...@@ -561,7 +561,7 @@ void rlc_am_v9_3_0_test_mac_rlc_loop (struct mac_data_ind *data_indP, struct ma
*tx_packetsP = *tx_packetsP + 1; *tx_packetsP = *tx_packetsP + 1;
if (*drop_countP == 0) { if (*drop_countP == 0) {
tb_dst = get_free_mem_block(sizeof (mac_rlc_max_rx_header_size_t) + tb_size); tb_dst = get_free_mem_block(sizeof (mac_rlc_max_rx_header_size_t) + tb_size, __func__);
if (tb_dst != NULL) { if (tb_dst != NULL) {
((struct mac_tb_ind *) (tb_dst->data))->first_bit = 0; ((struct mac_tb_ind *) (tb_dst->data))->first_bit = 0;
...@@ -585,7 +585,7 @@ void rlc_am_v9_3_0_test_mac_rlc_loop (struct mac_data_ind *data_indP, struct ma ...@@ -585,7 +585,7 @@ void rlc_am_v9_3_0_test_mac_rlc_loop (struct mac_data_ind *data_indP, struct ma
*dropped_tx_packetsP = *dropped_tx_packetsP + 1; *dropped_tx_packetsP = *dropped_tx_packetsP + 1;
} }
free_mem_block(tb_src); free_mem_block(tb_src, __func__);
if (data_indP->no_tb > 0) { if (data_indP->no_tb > 0) {
printf("[RLC-LOOP] Exchange %d TBs\n",data_indP->no_tb); printf("[RLC-LOOP] Exchange %d TBs\n",data_indP->no_tb);
...@@ -673,13 +673,13 @@ void rlc_am_v9_3_0_test_data_ind (module_id_t module_idP, rb_id_t rb_idP, sdu_si ...@@ -673,13 +673,13 @@ void rlc_am_v9_3_0_test_data_ind (module_id_t module_idP, rb_id_t rb_idP, sdu_si
assert(g_send_sdu_ids[g_send_id_read_index[rb_idP]][rb_idP^1] == i); assert(g_send_sdu_ids[g_send_id_read_index[rb_idP]][rb_idP^1] == i);
g_send_id_read_index[rb_idP] += 1; g_send_id_read_index[rb_idP] += 1;
free_mem_block(sduP); free_mem_block(sduP, __func__);
return; return;
} }
} }
printf("[FRAME %05d][RLC][MOD %d][RB %d] RX UNKNOWN SDU %04d bytes\n",g_frame,module_idP, rb_idP, sizeP); printf("[FRAME %05d][RLC][MOD %d][RB %d] RX UNKNOWN SDU %04d bytes\n",g_frame,module_idP, rb_idP, sizeP);
free_mem_block(sduP); free_mem_block(sduP, __func__);
assert(1==2); assert(1==2);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
......
...@@ -51,7 +51,7 @@ rlc_tm_send_sdu ( ...@@ -51,7 +51,7 @@ rlc_tm_send_sdu (
length_in_bytes = (length_in_bitsP + 7) >> 3; length_in_bytes = (length_in_bitsP + 7) >> 3;
if (rlc_pP->output_sdu_in_construction == NULL) { if (rlc_pP->output_sdu_in_construction == NULL) {
rlc_pP->output_sdu_in_construction = get_free_mem_block (length_in_bytes); rlc_pP->output_sdu_in_construction = get_free_mem_block (length_in_bytes, __func__);
} }
if ((rlc_pP->output_sdu_in_construction)) { if ((rlc_pP->output_sdu_in_construction)) {
...@@ -97,7 +97,7 @@ rlc_tm_no_segment ( ...@@ -97,7 +97,7 @@ rlc_tm_no_segment (
sdu_mngt_p = ((struct rlc_tm_tx_sdu_management *) (rlc_pP->input_sdus[rlc_pP->current_sdu_index]->data)); sdu_mngt_p = ((struct rlc_tm_tx_sdu_management *) (rlc_pP->input_sdus[rlc_pP->current_sdu_index]->data));
if (!(pdu_p = get_free_mem_block (((rlc_pP->rlc_pdu_size + 7) >> 3) + sizeof (struct rlc_tm_tx_data_pdu_struct) + GUARD_CRC_LIH_SIZE))) { if (!(pdu_p = get_free_mem_block (((rlc_pP->rlc_pdu_size + 7) >> 3) + sizeof (struct rlc_tm_tx_data_pdu_struct) + GUARD_CRC_LIH_SIZE, __func__))) {
LOG_D(RLC, PROTOCOL_RLC_TM_CTXT_FMT"[SEGMENT] ERROR COULD NOT GET NEW PDU, EXIT\n", LOG_D(RLC, PROTOCOL_RLC_TM_CTXT_FMT"[SEGMENT] ERROR COULD NOT GET NEW PDU, EXIT\n",
PROTOCOL_RLC_TM_CTXT_ARGS(ctxt_pP, rlc_pP)); PROTOCOL_RLC_TM_CTXT_ARGS(ctxt_pP, rlc_pP));
return; return;
...@@ -116,7 +116,7 @@ rlc_tm_no_segment ( ...@@ -116,7 +116,7 @@ rlc_tm_no_segment (
list_add_tail_eurecom (pdu_p, &rlc_pP->pdus_to_mac_layer); list_add_tail_eurecom (pdu_p, &rlc_pP->pdus_to_mac_layer);
rlc_pP->buffer_occupancy -= (sdu_mngt_p->sdu_size >> 3);