Commit ce9b316d authored by Cedric Roux's avatar Cedric Roux

Merge branch 'bugfix-164' into develop_integration_wk01

parents 02ecf9fd 6b79dc9a
...@@ -81,13 +81,13 @@ ...@@ -81,13 +81,13 @@
#define ITTI_DEBUG_ISSUES (1<<5) #define ITTI_DEBUG_ISSUES (1<<5)
#define ITTI_DEBUG_MP_STATISTICS (1<<6) #define ITTI_DEBUG_MP_STATISTICS (1<<6)
const int itti_debug = ITTI_DEBUG_ISSUES | ITTI_DEBUG_MP_STATISTICS; const int itti_debug = (ITTI_DEBUG_ISSUES | ITTI_DEBUG_MP_STATISTICS);
/* Don't flush if using RTAI */ /* Don't flush if using RTAI */
#ifdef RTAI #ifdef RTAI
# define ITTI_DEBUG(m, x, args...) do { if ((m) & itti_debug) rt_log_debug (x, ##args); } while(0); # define ITTI_DEBUG(m, x, args...) do { if ((m) & itti_debug) rt_log_debug (x, ##args); } while(0);
#else #else
# define ITTI_DEBUG(m, x, args...) do { if ((m) & itti_debug) fprintf(stdout, "[ITTI][D]"x, ##args); fflush (stdout); } while(0); # define ITTI_DEBUG(m, x, args...) do { if ((m) & itti_debug) {fprintf(stdout, "[ITTI][D]"x, ##args); fflush (stdout);} } while(0);
#endif #endif
#define ITTI_ERROR(x, args...) do { fprintf(stdout, "[ITTI][E]"x, ##args); fflush (stdout); } while(0); #define ITTI_ERROR(x, args...) do { fprintf(stdout, "[ITTI][E]"x, ##args); fflush (stdout); } while(0);
......
...@@ -347,6 +347,8 @@ typedef struct eNB_proc_t_s { ...@@ -347,6 +347,8 @@ typedef struct eNB_proc_t_s {
/// Context data structure for RX/TX portion of subframe processing /// Context data structure for RX/TX portion of subframe processing
typedef struct { typedef struct {
/// index of the current UE RX/TX proc
int proc_id;
/// Component Carrier index /// Component Carrier index
uint8_t CC_id; uint8_t CC_id;
/// timestamp transmitted to HW /// timestamp transmitted to HW
......
...@@ -1638,6 +1638,7 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin ...@@ -1638,6 +1638,7 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
if(ue->ulsch[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag) if(ue->ulsch[eNB_id]->harq_processes[harq_pid]->subframe_scheduling_flag)
{ {
LOG_D(PHY,"PUSCH is programmed on this subframe [pid %d] AbsSuframe %d.%d ==> Skip PUCCH transmission \n",harq_pid,frame_tx,subframe_tx); LOG_D(PHY,"PUSCH is programmed on this subframe [pid %d] AbsSuframe %d.%d ==> Skip PUCCH transmission \n",harq_pid,frame_tx,subframe_tx);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PUCCH,VCD_FUNCTION_OUT);
return; return;
} }
...@@ -1948,6 +1949,9 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin ...@@ -1948,6 +1949,9 @@ void ue_pucch_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uin
ue->generate_ul_signal[eNB_id] = 1; ue->generate_ul_signal[eNB_id] = 1;
} }
} }
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PUCCH,VCD_FUNCTION_OUT);
} }
void phy_procedures_UE_TX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag,runmode_t mode,relaying_type_t r_type) { void phy_procedures_UE_TX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag,runmode_t mode,relaying_type_t r_type) {
......
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
*/ */
#define PDCP_C #define PDCP_C
//#define DEBUG_PDCP_FIFO_FLUSH_SDU
#ifndef USER_MODE #ifndef USER_MODE
#include <rtai_fifos.h> #include <rtai_fifos.h>
#endif #endif
...@@ -160,7 +162,7 @@ boolean_t pdcp_data_req( ...@@ -160,7 +162,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 +203,7 @@ boolean_t pdcp_data_req( ...@@ -201,7 +203,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 +262,7 @@ boolean_t pdcp_data_req( ...@@ -260,7 +262,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 +512,7 @@ pdcp_data_ind( ...@@ -510,7 +512,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 +569,7 @@ pdcp_data_ind( ...@@ -567,7 +569,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 +600,7 @@ pdcp_data_ind( ...@@ -598,7 +600,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 +647,9 @@ pdcp_data_ind( ...@@ -645,9 +647,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 +724,7 @@ pdcp_data_ind( ...@@ -722,7 +724,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 +741,7 @@ pdcp_data_ind( ...@@ -739,7 +741,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 +796,7 @@ pdcp_data_ind( ...@@ -794,7 +796,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 ) {
...@@ -806,6 +808,7 @@ pdcp_data_ind( ...@@ -806,6 +808,7 @@ pdcp_data_ind(
*/ */
memset(new_sdu_p->data, 0, sizeof (pdcp_data_ind_header_t)); memset(new_sdu_p->data, 0, sizeof (pdcp_data_ind_header_t));
((pdcp_data_ind_header_t *) new_sdu_p->data)->data_size = sdu_buffer_sizeP - payload_offset; ((pdcp_data_ind_header_t *) new_sdu_p->data)->data_size = sdu_buffer_sizeP - payload_offset;
AssertFatal((sdu_buffer_sizeP - payload_offset >= 0), "invalid PDCP SDU size!");
// Here there is no virtualization possible // Here there is no virtualization possible
// set ((pdcp_data_ind_header_t *) new_sdu_p->data)->inst for IP layer here // set ((pdcp_data_ind_header_t *) new_sdu_p->data)->inst for IP layer here
...@@ -820,6 +823,11 @@ pdcp_data_ind( ...@@ -820,6 +823,11 @@ pdcp_data_ind(
((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = ctxt_pP->module_id - oai_emulation.info.first_enb_local; ((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = ctxt_pP->module_id - oai_emulation.info.first_enb_local;
#endif #endif
} }
#ifdef DEBUG_PDCP_FIFO_FLUSH_SDU
static uint32_t pdcp_inst = 0;
((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = pdcp_inst++;
LOG_D(PDCP, "inst=%d size=%d\n", ((pdcp_data_ind_header_t*) new_sdu_p->data)->inst, ((pdcp_data_ind_header_t *) new_sdu_p->data)->data_size);
#endif
memcpy(&new_sdu_p->data[sizeof (pdcp_data_ind_header_t)], \ memcpy(&new_sdu_p->data[sizeof (pdcp_data_ind_header_t)], \
&sdu_buffer_pP->data[payload_offset], \ &sdu_buffer_pP->data[payload_offset], \
...@@ -856,7 +864,7 @@ pdcp_data_ind( ...@@ -856,7 +864,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;
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#define PDCP_FIFO_C #define PDCP_FIFO_C
#define PDCP_DEBUG 1 #define PDCP_DEBUG 1
//#define DEBUG_PDCP_FIFO_FLUSH_SDU
#ifndef OAI_EMU #ifndef OAI_EMU
extern int otg_enabled; extern int otg_enabled;
...@@ -40,6 +41,7 @@ extern int otg_enabled; ...@@ -40,6 +41,7 @@ extern int otg_enabled;
#include "pdcp_primitives.h" #include "pdcp_primitives.h"
#ifdef USER_MODE #ifdef USER_MODE
#include <pthread.h>
#include <errno.h> #include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
...@@ -59,6 +61,7 @@ extern int otg_enabled; ...@@ -59,6 +61,7 @@ extern int otg_enabled;
#include "UTIL/LOG/log.h" #include "UTIL/LOG/log.h"
#include "UTIL/OTG/otg_tx.h" #include "UTIL/OTG/otg_tx.h"
#include "UTIL/FIFO/pad_list.h" #include "UTIL/FIFO/pad_list.h"
#include "UTIL/LOG/vcd_signal_dumper.h"
#include "platform_constants.h" #include "platform_constants.h"
#include "msc.h" #include "msc.h"
...@@ -88,6 +91,21 @@ extern Packet_OTG_List_t *otg_pdcp_buffer; ...@@ -88,6 +91,21 @@ extern Packet_OTG_List_t *otg_pdcp_buffer;
# include "gtpv1u_eNB_task.h" # include "gtpv1u_eNB_task.h"
#endif #endif
/* Prevent de-queueing the same PDCP SDU from the queue twice
* by multiple threads. This has happened in TDD when thread-odd
* is flushing a PDCP SDU after UE_RX() processing; whereas
* thread-even is at a special-subframe, skips the UE_RX() process
* and goes straight to the PDCP SDU flushing. The 2nd flushing
* dequeues the same SDU again causing unexpected behavior.
*
* comment out the MACRO below to disable this protection
*/
#define PDCP_SDU_FLUSH_LOCK
#ifdef PDCP_SDU_FLUSH_LOCK
static pthread_mutex_t mtex = PTHREAD_MUTEX_INITIALIZER;
#endif
pdcp_data_req_header_t pdcp_read_header_g; pdcp_data_req_header_t pdcp_read_header_g;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -95,6 +113,42 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const ctxt_pP) ...@@ -95,6 +113,42 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const ctxt_pP)
{ {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
//#if defined(PDCP_USE_NETLINK) && defined(LINUX)
int ret = 0;
//#endif
#ifdef DEBUG_PDCP_FIFO_FLUSH_SDU
#define THREAD_NAME_LEN 16
static char threadname[THREAD_NAME_LEN];
ret = pthread_getname_np(pthread_self(), threadname, THREAD_NAME_LEN);
if (ret != 0)
{
perror("pthread_getname_np : ");
exit_fun("Error getting thread name");
}
#undef THREAD_NAME_LEN
#endif
#ifdef PDCP_SDU_FLUSH_LOCK
ret = pthread_mutex_trylock(&mtex);
if (ret == EBUSY) {
#ifdef DEBUG_PDCP_FIFO_FLUSH_SDU
LOG_W(PDCP, "[%s] at SFN/SF=%d/%d wait for PDCP FIFO to be unlocked\n",
threadname, ctxt_pP->frame, ctxt_pP->subframe);
#endif
if (pthread_mutex_lock(&mtex)) {
exit_fun("PDCP_SDU_FLUSH_LOCK lock error!");
}
#ifdef DEBUG_PDCP_FIFO_FLUSH_SDU
LOG_I(PDCP, "[%s] at SFN/SF=%d/%d PDCP FIFO is unlocked\n",
threadname, ctxt_pP->frame, ctxt_pP->subframe);
#endif
} else if (ret != 0) {
exit_fun("PDCP_SDU_FLUSH_LOCK trylock error!");
}
#endif
mem_block_t *sdu_p = list_get_head (&pdcp_sdu_list); mem_block_t *sdu_p = list_get_head (&pdcp_sdu_list);
int bytes_wrote = 0; int bytes_wrote = 0;
int pdcp_nb_sdu_sent = 0; int pdcp_nb_sdu_sent = 0;
...@@ -103,15 +157,19 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const ctxt_pP) ...@@ -103,15 +157,19 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const ctxt_pP)
//MessageDef *message_p = NULL; //MessageDef *message_p = NULL;
#endif #endif
#if defined(PDCP_USE_NETLINK) && defined(LINUX) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_FLUSH, 1 );
int ret = 0;
#endif
while (sdu_p && cont) { while (sdu_p && cont) {
#ifdef DEBUG_PDCP_FIFO_FLUSH_SDU
LOG_D(PDCP, "[%s] SFN/SF=%d/%d inst=%d size=%d\n",
threadname, ctxt_pP->frame, ctxt_pP->subframe,
((pdcp_data_ind_header_t*) sdu_p->data)->inst,
((pdcp_data_ind_header_t *) sdu_p->data)->data_size);
#else
#if ! defined(OAI_EMU) #if ! defined(OAI_EMU)
((pdcp_data_ind_header_t *)(sdu_p->data))->inst = 0; ((pdcp_data_ind_header_t *)(sdu_p->data))->inst = 0;
#endif #endif
#endif
#if defined(LINK_ENB_PDCP_TO_GTPV1U) #if defined(LINK_ENB_PDCP_TO_GTPV1U)
...@@ -126,7 +184,7 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const ctxt_pP) ...@@ -126,7 +184,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);
...@@ -175,6 +233,7 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const ctxt_pP) ...@@ -175,6 +233,7 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const ctxt_pP)
if (!pdcp_output_header_bytes_to_write) { // continue with sdu if (!pdcp_output_header_bytes_to_write) { // continue with sdu
pdcp_output_sdu_bytes_to_write = ((pdcp_data_ind_header_t *) sdu_p->data)->data_size; pdcp_output_sdu_bytes_to_write = ((pdcp_data_ind_header_t *) sdu_p->data)->data_size;
AssertFatal(pdcp_output_sdu_bytes_to_write >= 0, "invalid data_size!");
#ifdef PDCP_USE_RT_FIFO #ifdef PDCP_USE_RT_FIFO
bytes_wrote = rtf_put (PDCP2PDCP_USE_RT_FIFO, &(sdu->data[sizeof (pdcp_data_ind_header_t)]), pdcp_output_sdu_bytes_to_write); bytes_wrote = rtf_put (PDCP2PDCP_USE_RT_FIFO, &(sdu->data[sizeof (pdcp_data_ind_header_t)]), pdcp_output_sdu_bytes_to_write);
...@@ -184,7 +243,11 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const ctxt_pP) ...@@ -184,7 +243,11 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const ctxt_pP)
#ifdef LINUX #ifdef LINUX
memcpy(NLMSG_DATA(nas_nlh_tx)+sizeof(pdcp_data_ind_header_t), &(sdu_p->data[sizeof (pdcp_data_ind_header_t)]), pdcp_output_sdu_bytes_to_write); memcpy(NLMSG_DATA(nas_nlh_tx)+sizeof(pdcp_data_ind_header_t), &(sdu_p->data[sizeof (pdcp_data_ind_header_t)]), pdcp_output_sdu_bytes_to_write);
nas_nlh_tx->nlmsg_len += pdcp_output_sdu_bytes_to_write; nas_nlh_tx->nlmsg_len += pdcp_output_sdu_bytes_to_write;
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_UE_PDCP_FLUSH_SIZE, pdcp_output_sdu_bytes_to_write);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_FLUSH_BUFFER, 1 );
ret = sendmsg(nas_sock_fd,&nas_msg_tx,0); ret = sendmsg(nas_sock_fd,&nas_msg_tx,0);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_FLUSH_BUFFER, 0 );
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_UE_PDCP_FLUSH_ERR, ret );
if (ret<0) { if (ret<0) {
LOG_E(PDCP, "[PDCP_FIFOS] sendmsg returns %d (errno: %d)\n", ret, errno); LOG_E(PDCP, "[PDCP_FIFOS] sendmsg returns %d (errno: %d)\n", ret, errno);
...@@ -238,17 +301,22 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const ctxt_pP) ...@@ -238,17 +301,22 @@ 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);
} else {
LOG_D(PDCP, "1 skip free_mem_block: pdcp_output_sdu_bytes_to_write = %d\n", pdcp_output_sdu_bytes_to_write);
AssertFatal(pdcp_output_sdu_bytes_to_write > 0, "pdcp_output_sdu_bytes_to_write cannot be negative!");
} }
} else { } else {
LOG_W(PDCP, "RADIO->IP SEND SDU CONGESTION!\n"); LOG_W(PDCP, "2: RADIO->IP SEND SDU CONGESTION!\n");
} }
} else { } else {
LOG_W(PDCP, "RADIO->IP SEND SDU CONGESTION!\n"); LOG_W(PDCP, "3: RADIO->IP SEND SDU CONGESTION!\n");
} }
} else {
LOG_D(PDCP, "4 skip free_mem_block: bytes_wrote = %d\n", bytes_wrote);
} }
} else { } else {
// continue writing sdu // continue writing sdu
...@@ -266,15 +334,20 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const ctxt_pP) ...@@ -266,15 +334,20 @@ 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);
// LOG_D(PDCP, "rb sent a sdu from rab\n"); // LOG_D(PDCP, "rb sent a sdu from rab\n");
} else {
LOG_D(PDCP, "5 skip free_mem_block: pdcp_output_sdu_bytes_to_write = %d\n", pdcp_output_sdu_bytes_to_write);
} }
} else {
LOG_D(PDCP, "6 skip free_mem_block: bytes_wrote = %d\n", bytes_wrote);
} }
} }
} }
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_FLUSH, 0 );
#ifdef PDCP_USE_RT_FIFO #ifdef PDCP_USE_RT_FIFO
...@@ -295,6 +368,10 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const ctxt_pP) ...@@ -295,6 +368,10 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const ctxt_pP)
#endif //PDCP_USE_RT_FIFO #endif //PDCP_USE_RT_FIFO
#ifdef PDCP_SDU_FLUSH_LOCK
if (pthread_mutex_unlock(&mtex)) exit_fun("PDCP_SDU_FLUSH_LOCK unlock error!");
#endif
return pdcp_nb_sdu_sent; return pdcp_nb_sdu_sent;
} }
...@@ -429,7 +506,10 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) ...@@ -429,7 +506,10 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP)
int rlc_data_req_flag = 3; int rlc_data_req_flag = 3;
while ((len > 0) && (rlc_data_req_flag !=0)) { while ((len > 0) && (rlc_data_req_flag !=0)) {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ, 1 );
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ_BUFFER, 1 );
len = recvmsg(nas_sock_fd, &nas_msg_rx, 0); len = recvmsg(nas_sock_fd, &nas_msg_rx, 0);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ_BUFFER, 0 );
if (len<=0) { if (len<=0) {
// nothing in pdcp NAS socket // nothing in pdcp NAS socket
...@@ -707,6 +787,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) ...@@ -707,6 +787,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP)
} }
} }
} }
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ, 0 );
} }
return len; return len;
......
...@@ -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); rlc_pP->buffer_occupancy -= (sdu_mngt_p->sdu_size >> 3);
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->current_sdu_index = (rlc_pP->current_sdu_index + 1) % rlc_pP->size_input_sdus_buffer; rlc_pP->current_sdu_index = (rlc_pP->current_sdu_index + 1) % rlc_pP->size_input_sdus_buffer;
rlc_pP->nb_sdu -= 1; rlc_pP->nb_sdu -= 1;
...@@ -142,7 +142,7 @@ rlc_tm_rx ( ...@@ -142,7 +142,7 @@ rlc_tm_rx (
((struct rlc_tm_rx_pdu_management *) (tb_p->data))->first_byte = first_byte_p; ((struct rlc_tm_rx_pdu_management *) (tb_p->data))->first_byte = first_byte_p;
rlc_tm_send_sdu (ctxt_pP, rlc_p, (((struct mac_tb_ind *) (tb_p->data))->error_indication), first_byte_p, data_indP.tb_size); rlc_tm_send_sdu (ctxt_pP, rlc_p, (((struct mac_tb_ind *) (tb_p->data))->error_indication), first_byte_p, data_indP.tb_size);
free_mem_block (tb_p); free_mem_block (tb_p, __func__);
} }
} }
...@@ -235,6 +235,6 @@ rlc_tm_data_req ( ...@@ -235,6 +235,6 @@ rlc_tm_data_req (
rlc_p->input_sdus[rlc_p->next_sdu_index] = sdu_pP; rlc_p->input_sdus[rlc_p->next_sdu_index] = sdu_pP;
rlc_p->next_sdu_index = (rlc_p->next_sdu_index + 1) % rlc_p->size_input_sdus_buffer; rlc_p->next_sdu_index = (rlc_p->next_sdu_index + 1) % rlc_p->size_input_sdus_buffer;
} else { } else {
free_mem_block (sdu_pP); free_mem_block (sdu_pP, __func__);
} }
} }
...@@ -82,7 +82,7 @@ void rlc_tm_init ( ...@@ -82,7 +82,7 @@ void rlc_tm_init (
rlcP->size_input_sdus_buffer = 16; rlcP->size_input_sdus_buffer = 16;
if ((rlcP->input_sdus_alloc == NULL) && (rlcP->size_input_sdus_buffer > 0)) { if ((rlcP->input_sdus_alloc == NULL) && (rlcP->size_input_sdus_buffer > 0)) {
rlcP->input_sdus_alloc = get_free_mem_block (rlcP->size_input_sdus_buffer * sizeof (void *)); rlcP->input_sdus_alloc = get_free_mem_block (rlcP->size_input_sdus_buffer * sizeof (void *), __func__);
rlcP->input_sdus = (mem_block_t **) (rlcP->input_sdus_alloc->data); rlcP->input_sdus = (mem_block_t **) (rlcP->input_sdus_alloc->data);
memset (rlcP->input_sdus, 0, rlcP->size_input_sdus_buffer * sizeof (void *)); memset (rlcP->input_sdus, 0, rlcP->size_input_sdus_buffer * sizeof (void *));
} }
...@@ -114,17 +114,17 @@ rlc_tm_cleanup ( ...@@ -114,17 +114,17 @@ rlc_tm_cleanup (
if (rlcP->input_sdus_alloc) { if (rlcP->input_sdus_alloc) {
for (index = 0; index < rlcP->size_input_sdus_buffer; index++) { for (index = 0; index < rlcP->size_input_sdus_buffer; index++) {
if (rlcP->input_sdus[index]) { if (rlcP->input_sdus[index]) {
free_mem_block (rlcP->input_sdus[index]); free_mem_block (rlcP->input_sdus[index], __func__);
} }
} }
free_mem_block (rlcP->input_sdus_alloc); free_mem_block (rlcP->input_sdus_alloc, __func__);
rlcP->input_sdus_alloc = NULL; rlcP->input_sdus_alloc = NULL;
} }
// RX SIDE // RX SIDE
if ((rlcP->output_sdu_in_construction)) { if ((rlcP->output_sdu_in_construction)) {
free_mem_block (rlcP->output_sdu_in_construction); free_mem_block (rlcP->output_sdu_in_construction, __func__);
} }
memset(rlcP, 0, sizeof(rlc_tm_entity_t)); memset(rlcP, 0, sizeof(rlc_tm_entity_t));
......
...@@ -334,13 +334,13 @@ rlc_um_cleanup ( ...@@ -334,13 +334,13 @@ rlc_um_cleanup (
list_free (&rlc_pP->pdus_from_mac_layer); list_free (&rlc_pP->pdus_from_mac_layer);
if ((rlc_pP->output_sdu_in_construction)) { if ((rlc_pP->output_sdu_in_construction)) {
free_mem_block (rlc_pP->output_sdu_in_construction); free_mem_block (rlc_pP->output_sdu_in_construction, __func__);
} }
if (rlc_pP->dar_buffer) { if (rlc_pP->dar_buffer) {
for (index = 0; index < 1024; index++) { for (index = 0; index < 1024; index++) {
if (rlc_pP->dar_buffer[index]) { if (rlc_pP->dar_buffer[index]) {
free_mem_block (rlc_pP->dar_buffer[index]); free_mem_block (rlc_pP->dar_buffer[index], __func__);
} }
} }
......
...@@ -273,6 +273,7 @@ rlc_um_try_reassembly( ...@@ -273,6 +273,7 @@ rlc_um_try_reassembly(
__LINE__); __LINE__);
#endif #endif
} }
AssertFatal(size >= 0, "invalid size!");
if (e == RLC_E_FIXED_PART_DATA_FIELD_FOLLOW) { if (e == RLC_E_FIXED_PART_DATA_FIELD_FOLLOW) {
switch (fi) { switch (fi) {
...@@ -544,7 +545,7 @@ rlc_um_try_reassembly( ...@@ -544,7 +545,7 @@ rlc_um_try_reassembly(
__FILE__, __FILE__,
__LINE__); __LINE__);
#endif #endif
free_mem_block(rlc_pP->dar_buffer[sn]); free_mem_block(rlc_pP->dar_buffer[sn], __func__);
rlc_pP->dar_buffer[sn] = NULL; rlc_pP->dar_buffer[sn] = NULL;
} else { } else {
rlc_pP->last_reassemblied_missing_sn = sn; rlc_pP->last_reassemblied_missing_sn = sn;
...@@ -957,7 +958,7 @@ rlc_um_receive_process_dar ( ...@@ -957,7 +958,7 @@ rlc_um_receive_process_dar (
} else if (rlc_pP->rx_sn_length == 5) { } else if (rlc_pP->rx_sn_length == 5) {
sn = pdu_pP->b1 & 0x1F; sn = pdu_pP->b1 & 0x1F;
} else { } else {
free_mem_block(pdu_mem_pP); free_mem_block(pdu_mem_pP, __func__);
} }
RLC_UM_MUTEX_LOCK(&rlc_pP->lock_dar_buffer, ctxt_pP, rlc_pP); RLC_UM_MUTEX_LOCK(&rlc_pP->lock_dar_buffer, ctxt_pP, rlc_pP);
...@@ -982,7 +983,7 @@ rlc_um_receive_process_dar ( ...@@ -982,7 +983,7 @@ rlc_um_receive_process_dar (
#endif #endif
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_sizeP; rlc_pP->stat_rx_data_bytes_out_of_window += tb_sizeP;
free_mem_block(pdu_mem_pP); free_mem_block(pdu_mem_pP, __func__);
pdu_mem_pP = NULL; pdu_mem_pP = NULL;
RLC_UM_MUTEX_UNLOCK(&rlc_pP->lock_dar_buffer); RLC_UM_MUTEX_UNLOCK(&rlc_pP->lock_dar_buffer);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_UM_RECEIVE_PROCESS_DAR, VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_UM_RECEIVE_PROCESS_DAR, VCD_FUNCTION_OUT);
...@@ -1001,7 +1002,7 @@ rlc_um_receive_process_dar ( ...@@ -1001,7 +1002,7 @@ rlc_um_receive_process_dar (
//discard the PDU //discard the PDU
rlc_pP->stat_rx_data_pdus_duplicate += 1; rlc_pP->stat_rx_data_pdus_duplicate += 1;
rlc_pP->stat_rx_data_bytes_duplicate += tb_sizeP; rlc_pP->stat_rx_data_bytes_duplicate += tb_sizeP;
free_mem_block(pdu_mem_pP); free_mem_block(pdu_mem_pP, __func__);
pdu_mem_pP = NULL; pdu_mem_pP = NULL;
RLC_UM_MUTEX_UNLOCK(&rlc_pP->lock_dar_buffer); RLC_UM_MUTEX_UNLOCK(&rlc_pP->lock_dar_buffer);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_UM_RECEIVE_PROCESS_DAR, VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_UM_RECEIVE_PROCESS_DAR, VCD_FUNCTION_OUT);
...@@ -1017,7 +1018,7 @@ rlc_um_receive_process_dar ( ...@@ -1017,7 +1018,7 @@ rlc_um_receive_process_dar (
sn); sn);
#endif #endif
mem_block_t *pdu = rlc_um_remove_pdu_from_dar_buffer(ctxt_pP, rlc_pP, sn); mem_block_t *pdu = rlc_um_remove_pdu_from_dar_buffer(ctxt_pP, rlc_pP, sn);
free_mem_block(pdu); free_mem_block(pdu, __func__);
} }
rlc_um_store_pdu_in_dar_buffer(ctxt_pP, rlc_pP, pdu_mem_pP, sn); rlc_um_store_pdu_in_dar_buffer(ctxt_pP, rlc_pP, pdu_mem_pP, sn);
......
...@@ -69,7 +69,7 @@ rlc_um_reassembly (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP ...@@ -69,7 +69,7 @@ rlc_um_reassembly (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP
if (rlc_pP->output_sdu_in_construction == NULL) { if (rlc_pP->output_sdu_in_construction == NULL) {
// msg("[RLC_UM_LITE] Getting mem_block ...\n"); // msg("[RLC_UM_LITE] Getting mem_block ...\n");
rlc_pP->output_sdu_in_construction = get_free_mem_block (sdu_max_size); rlc_pP->output_sdu_in_construction = get_free_mem_block (sdu_max_size, __func__);
rlc_pP->output_sdu_size_to_write = 0; rlc_pP->output_sdu_size_to_write = 0;
} }
......
...@@ -115,7 +115,7 @@ rlc_um_segment_10 (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP ...@@ -115,7 +115,7 @@ rlc_um_segment_10 (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP
#endif #endif
} }
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__))) {
#if TRACE_RLC_UM_SEGMENT #if TRACE_RLC_UM_SEGMENT
LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT" ERROR COULD NOT GET NEW PDU, EXIT\n", LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT" ERROR COULD NOT GET NEW PDU, EXIT\n",
PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP)); PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP));
...@@ -291,7 +291,7 @@ rlc_um_segment_10 (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP ...@@ -291,7 +291,7 @@ rlc_um_segment_10 (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP
// free SDU // free SDU
rlc_pP->buffer_occupancy -= sdu_mngt_p->sdu_remaining_size; rlc_pP->buffer_occupancy -= sdu_mngt_p->sdu_remaining_size;
sdu_in_buffer = list_remove_head(&rlc_pP->input_sdus); sdu_in_buffer = list_remove_head(&rlc_pP->input_sdus);
free_mem_block (sdu_in_buffer); free_mem_block (sdu_in_buffer, __func__);
sdu_in_buffer = list_get_head(&rlc_pP->input_sdus); sdu_in_buffer = list_get_head(&rlc_pP->input_sdus);
sdu_mngt_p = NULL; sdu_mngt_p = NULL;
...@@ -356,7 +356,7 @@ rlc_um_segment_10 (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP ...@@ -356,7 +356,7 @@ rlc_um_segment_10 (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP
// free SDU // free SDU
rlc_pP->buffer_occupancy -= sdu_mngt_p->sdu_remaining_size; rlc_pP->buffer_occupancy -= sdu_mngt_p->sdu_remaining_size;
sdu_in_buffer = list_remove_head(&rlc_pP->input_sdus); sdu_in_buffer = list_remove_head(&rlc_pP->input_sdus);
free_mem_block (sdu_in_buffer); free_mem_block (sdu_in_buffer, __func__);
sdu_in_buffer = list_get_head(&rlc_pP->input_sdus); sdu_in_buffer = list_get_head(&rlc_pP->input_sdus);
sdu_mngt_p = NULL; sdu_mngt_p = NULL;
...@@ -380,7 +380,7 @@ rlc_um_segment_10 (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP ...@@ -380,7 +380,7 @@ rlc_um_segment_10 (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP
// free SDU // free SDU
rlc_pP->buffer_occupancy -= sdu_mngt_p->sdu_remaining_size; rlc_pP->buffer_occupancy -= sdu_mngt_p->sdu_remaining_size;
sdu_in_buffer = list_remove_head(&rlc_pP->input_sdus); sdu_in_buffer = list_remove_head(&rlc_pP->input_sdus);
free_mem_block (sdu_in_buffer); free_mem_block (sdu_in_buffer, __func__);
sdu_in_buffer = list_get_head(&rlc_pP->input_sdus); sdu_in_buffer = list_get_head(&rlc_pP->input_sdus);
sdu_mngt_p = NULL; sdu_mngt_p = NULL;
...@@ -503,7 +503,7 @@ rlc_um_segment_5 (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP) ...@@ -503,7 +503,7 @@ rlc_um_segment_5 (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP)
#endif #endif
} }
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__))) {
#if TRACE_RLC_UM_SEGMENT #if TRACE_RLC_UM_SEGMENT
LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT" ERROR COULD NOT GET NEW PDU, EXIT\n", LOG_E(RLC, PROTOCOL_RLC_UM_CTXT_FMT" ERROR COULD NOT GET NEW PDU, EXIT\n",
PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP)); PROTOCOL_RLC_UM_CTXT_ARGS(ctxt_pP,rlc_pP));
...@@ -679,7 +679,7 @@ rlc_um_segment_5 (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP) ...@@ -679,7 +679,7 @@ rlc_um_segment_5 (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP)
// free SDU // free SDU
rlc_pP->buffer_occupancy -= sdu_mngt_p->sdu_remaining_size; rlc_pP->buffer_occupancy -= sdu_mngt_p->sdu_remaining_size;
sdu_in_buffer = list_remove_head(&rlc_pP->input_sdus); sdu_in_buffer = list_remove_head(&rlc_pP->input_sdus);
free_mem_block (sdu_in_buffer); free_mem_block (sdu_in_buffer, __func__);
sdu_in_buffer = list_get_head(&rlc_pP->input_sdus); sdu_in_buffer = list_get_head(&rlc_pP->input_sdus);
sdu_mngt_p = NULL; sdu_mngt_p = NULL;
...@@ -743,7 +743,7 @@ rlc_um_segment_5 (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP) ...@@ -743,7 +743,7 @@ rlc_um_segment_5 (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP)
// free SDU // free SDU
rlc_pP->buffer_occupancy -= sdu_mngt_p->sdu_remaining_size; rlc_pP->buffer_occupancy -= sdu_mngt_p->sdu_remaining_size;
sdu_in_buffer = list_remove_head(&rlc_pP->input_sdus); sdu_in_buffer = list_remove_head(&rlc_pP->input_sdus);
free_mem_block (sdu_in_buffer); free_mem_block (sdu_in_buffer, __func__);
sdu_in_buffer = list_get_head(&rlc_pP->input_sdus); sdu_in_buffer = list_get_head(&rlc_pP->input_sdus);
sdu_mngt_p = NULL; sdu_mngt_p = NULL;
...@@ -765,7 +765,7 @@ rlc_um_segment_5 (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP) ...@@ -765,7 +765,7 @@ rlc_um_segment_5 (const protocol_ctxt_t* const ctxt_pP, rlc_um_entity_t *rlc_pP)
// free SDU // free SDU
rlc_pP->buffer_occupancy -= sdu_mngt_p->sdu_remaining_size; rlc_pP->buffer_occupancy -= sdu_mngt_p->sdu_remaining_size;
sdu_in_buffer = list_remove_head(&rlc_pP->input_sdus); sdu_in_buffer = list_remove_head(&rlc_pP->input_sdus);
free_mem_block (sdu_in_buffer); free_mem_block (sdu_in_buffer, __func__);
sdu_in_buffer = list_get_head(&rlc_pP->input_sdus); sdu_in_buffer = list_get_head(&rlc_pP->input_sdus);
sdu_mngt_p = NULL; sdu_mngt_p = NULL;
} }
......
...@@ -301,7 +301,7 @@ void rlc_um_v9_3_0_test_send_sdu(rlc_um_entity_t *um_txP, int sdu_indexP) ...@@ -301,7 +301,7 @@ void rlc_um_v9_3_0_test_send_sdu(rlc_um_entity_t *um_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_um_data_req_alloc)); sdu = get_free_mem_block (strlen(g_sdus[sdu_indexP]) + 1 + sizeof (struct rlc_um_data_req_alloc), __func__);
if (sdu != NULL) { if (sdu != NULL) {
// PROCESS OF COMPRESSION HERE: // PROCESS OF COMPRESSION HERE:
...@@ -405,12 +405,12 @@ void rlc_um_v9_3_0_test_mac_rlc_loop (struct mac_data_ind* data_indP, struct ma ...@@ -405,12 +405,12 @@ void rlc_um_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__);
memset(tb_dst->data, 0, sizeof (mac_rlc_max_rx_header_size_t) + tb_size); memset(tb_dst->data, 0, sizeof (mac_rlc_max_rx_header_size_t) + tb_size);
if (tb_dst != NULL) { if (tb_dst != NULL) {
//printf("[RLC-LOOP] Testing tb_dst (1)\n"); //printf("[RLC-LOOP] Testing tb_dst (1)\n");
check_free_mem_block(tb_dst); check_free_mem_block(tb_dst, __func__);
tb_dst->next = NULL; tb_dst->next = NULL;
((struct mac_tb_ind *) (tb_dst->data))->first_bit = 0; ((struct mac_tb_ind *) (tb_dst->data))->first_bit = 0;
((struct mac_tb_ind *) (tb_dst->data))->data_ptr = &tb_dst->data[sizeof (mac_rlc_max_rx_header_size_t)]; ((struct mac_tb_ind *) (tb_dst->data))->data_ptr = &tb_dst->data[sizeof (mac_rlc_max_rx_header_size_t)];
...@@ -424,7 +424,7 @@ void rlc_um_v9_3_0_test_mac_rlc_loop (struct mac_data_ind* data_indP, struct ma ...@@ -424,7 +424,7 @@ void rlc_um_v9_3_0_test_mac_rlc_loop (struct mac_data_ind* data_indP, struct ma
list_add_tail_eurecom(tb_dst, &data_indP->data); list_add_tail_eurecom(tb_dst, &data_indP->data);
data_indP->no_tb += 1; data_indP->no_tb += 1;
//printf("[RLC-LOOP] Testing tb_dst (2)\n"); //printf("[RLC-LOOP] Testing tb_dst (2)\n");
check_free_mem_block(tb_dst); check_free_mem_block(tb_dst, __func__);
} else { } else {
printf("Out of memory error\n"); printf("Out of memory error\n");
exit(-1); exit(-1);
...@@ -437,9 +437,9 @@ void rlc_um_v9_3_0_test_mac_rlc_loop (struct mac_data_ind* data_indP, struct ma ...@@ -437,9 +437,9 @@ void rlc_um_v9_3_0_test_mac_rlc_loop (struct mac_data_ind* data_indP, struct ma
//printf("[RLC-LOOP] Testing tb_src\n"); //printf("[RLC-LOOP] Testing tb_src\n");
check_free_mem_block(tb_src); check_free_mem_block(tb_src, __func__);
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);
...@@ -578,13 +578,13 @@ void rlc_um_v9_3_0_test_data_ind (module_id_t module_idP, rb_id_t rb_idP, sdu_si ...@@ -578,13 +578,13 @@ void rlc_um_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);
} else { } else {
for (i = 0; i < 37; i++) { for (i = 0; i < 37; i++) {
...@@ -592,13 +592,13 @@ void rlc_um_v9_3_0_test_data_ind (module_id_t module_idP, rb_id_t rb_idP, sdu_si ...@@ -592,13 +592,13 @@ void rlc_um_v9_3_0_test_data_ind (module_id_t module_idP, rb_id_t rb_idP, sdu_si
printf("[FRAME %05d][RLC][MOD %02d][RB %02d] RX SDU %d %04d bytes\n",g_frame,module_idP, rb_idP, i, sizeP); printf("[FRAME %05d][RLC][MOD %02d][RB %02d] RX SDU %d %04d bytes\n",g_frame,module_idP, rb_idP, i, sizeP);
assert(TEST_MAX_SEND_SDU > g_send_id_read_index[rb_idP]); assert(TEST_MAX_SEND_SDU > g_send_id_read_index[rb_idP]);
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__);
return; return;
} }
} }
......
...@@ -44,7 +44,7 @@ rlc_um_test_send_sdu (rlc_um_entity_t* rlcP, uint32_t frame, unsigned int s ...@@ -44,7 +44,7 @@ rlc_um_test_send_sdu (rlc_um_entity_t* rlcP, uint32_t frame, unsigned int s
switch (sdu_typeP) { switch (sdu_typeP) {
case RLC_UM_TEST_SDU_TYPE_TCPIP: case RLC_UM_TEST_SDU_TYPE_TCPIP:
sdu_mem = get_free_mem_block (strlen(tcip_sdu)+ 1 + sizeof (struct rlc_um_data_req_alloc)); sdu_mem = get_free_mem_block (strlen(tcip_sdu)+ 1 + sizeof (struct rlc_um_data_req_alloc), __func__);
if (sdu_mem != NULL) { if (sdu_mem != NULL) {
memset (sdu_mem->data, 0, sizeof (struct rlc_um_data_req_alloc)); memset (sdu_mem->data, 0, sizeof (struct rlc_um_data_req_alloc));
...@@ -59,7 +59,7 @@ rlc_um_test_send_sdu (rlc_um_entity_t* rlcP, uint32_t frame, unsigned int s ...@@ -59,7 +59,7 @@ rlc_um_test_send_sdu (rlc_um_entity_t* rlcP, uint32_t frame, unsigned int s
break; break;
case RLC_UM_TEST_SDU_TYPE_VOIP: case RLC_UM_TEST_SDU_TYPE_VOIP:
sdu_mem = get_free_mem_block (strlen(voip_sdu)+ 1 + sizeof (struct rlc_um_data_req_alloc)); sdu_mem = get_free_mem_block (strlen(voip_sdu)+ 1 + sizeof (struct rlc_um_data_req_alloc), __func__);
if (sdu_mem != NULL) { if (sdu_mem != NULL) {
memset (sdu_mem->data, 0, sizeof (struct rlc_um_data_req_alloc)); memset (sdu_mem->data, 0, sizeof (struct rlc_um_data_req_alloc));
...@@ -74,7 +74,7 @@ rlc_um_test_send_sdu (rlc_um_entity_t* rlcP, uint32_t frame, unsigned int s ...@@ -74,7 +74,7 @@ rlc_um_test_send_sdu (rlc_um_entity_t* rlcP, uint32_t frame, unsigned int s
break; break;
case RLC_UM_TEST_SDU_TYPE_SMALL: case RLC_UM_TEST_SDU_TYPE_SMALL:
sdu_mem = get_free_mem_block (strlen(very_small_sdu)+ 1 + sizeof (struct rlc_um_data_req_alloc)); sdu_mem = get_free_mem_block (strlen(very_small_sdu)+ 1 + sizeof (struct rlc_um_data_req_alloc), __func__);
if (sdu_mem != NULL) { if (sdu_mem != NULL) {
memset (sdu_mem->data, 0, sizeof (struct rlc_um_data_req_alloc)); memset (sdu_mem->data, 0, sizeof (struct rlc_um_data_req_alloc));
......
...@@ -413,7 +413,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP, ...@@ -413,7 +413,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP,
switch (rlc_mode) { switch (rlc_mode) {
case RLC_MODE_NONE: case RLC_MODE_NONE:
free_mem_block(sdu_pP); free_mem_block(sdu_pP, __func__);
LOG_E(RLC, PROTOCOL_CTXT_FMT" Received RLC_MODE_NONE as rlc_type for rb_id %u\n", LOG_E(RLC, PROTOCOL_CTXT_FMT" Received RLC_MODE_NONE as rlc_type for rb_id %u\n",
PROTOCOL_CTXT_ARGS(ctxt_pP), PROTOCOL_CTXT_ARGS(ctxt_pP),
rb_idP); rb_idP);
...@@ -424,7 +424,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP, ...@@ -424,7 +424,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP,
#ifdef DEBUG_RLC_DATA_REQ #ifdef DEBUG_RLC_DATA_REQ
msg("RLC_MODE_AM\n"); msg("RLC_MODE_AM\n");
#endif #endif
new_sdu_p = get_free_mem_block (sdu_sizeP + sizeof (struct rlc_am_data_req_alloc)); new_sdu_p = get_free_mem_block (sdu_sizeP + sizeof (struct rlc_am_data_req_alloc), __func__);
if (new_sdu_p != NULL) { if (new_sdu_p != NULL) {
// PROCESS OF COMPRESSION HERE: // PROCESS OF COMPRESSION HERE:
...@@ -435,7 +435,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP, ...@@ -435,7 +435,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP,
((struct rlc_am_data_req *) (new_sdu_p->data))->conf = confirmP; ((struct rlc_am_data_req *) (new_sdu_p->data))->conf = confirmP;
((struct rlc_am_data_req *) (new_sdu_p->data))->mui = muiP; ((struct rlc_am_data_req *) (new_sdu_p->data))->mui = muiP;
((struct rlc_am_data_req *) (new_sdu_p->data))->data_offset = sizeof (struct rlc_am_data_req_alloc); ((struct rlc_am_data_req *) (new_sdu_p->data))->data_offset = sizeof (struct rlc_am_data_req_alloc);
free_mem_block(sdu_pP); free_mem_block(sdu_pP, __func__);
rlc_am_data_req(ctxt_pP, &rlc_union_p->rlc.am, new_sdu_p); rlc_am_data_req(ctxt_pP, &rlc_union_p->rlc.am, new_sdu_p);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
return RLC_OP_STATUS_OK; return RLC_OP_STATUS_OK;
...@@ -447,7 +447,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP, ...@@ -447,7 +447,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP,
break; break;
case RLC_MODE_UM: case RLC_MODE_UM:
new_sdu_p = get_free_mem_block (sdu_sizeP + sizeof (struct rlc_um_data_req_alloc)); new_sdu_p = get_free_mem_block (sdu_sizeP + sizeof (struct rlc_um_data_req_alloc), __func__);
if (new_sdu_p != NULL) { if (new_sdu_p != NULL) {
// PROCESS OF COMPRESSION HERE: // PROCESS OF COMPRESSION HERE:
...@@ -456,11 +456,11 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP, ...@@ -456,11 +456,11 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP,
((struct rlc_um_data_req *) (new_sdu_p->data))->data_size = sdu_sizeP; ((struct rlc_um_data_req *) (new_sdu_p->data))->data_size = sdu_sizeP;
((struct rlc_um_data_req *) (new_sdu_p->data))->data_offset = sizeof (struct rlc_um_data_req_alloc); ((struct rlc_um_data_req *) (new_sdu_p->data))->data_offset = sizeof (struct rlc_um_data_req_alloc);
free_mem_block(sdu_pP); free_mem_block(sdu_pP, __func__);
rlc_um_data_req(ctxt_pP, &rlc_union_p->rlc.um, new_sdu_p); rlc_um_data_req(ctxt_pP, &rlc_union_p->rlc.um, new_sdu_p);
//free_mem_block(new_sdu); //free_mem_block(new_sdu, __func__);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
return RLC_OP_STATUS_OK; return RLC_OP_STATUS_OK;
} else { } else {
...@@ -471,7 +471,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP, ...@@ -471,7 +471,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP,
break; break;
case RLC_MODE_TM: case RLC_MODE_TM:
new_sdu_p = get_free_mem_block (sdu_sizeP + sizeof (struct rlc_tm_data_req_alloc)); new_sdu_p = get_free_mem_block (sdu_sizeP + sizeof (struct rlc_tm_data_req_alloc), __func__);
if (new_sdu_p != NULL) { if (new_sdu_p != NULL) {
// PROCESS OF COMPRESSION HERE: // PROCESS OF COMPRESSION HERE:
...@@ -480,7 +480,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP, ...@@ -480,7 +480,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP,
((struct rlc_tm_data_req *) (new_sdu_p->data))->data_size = sdu_sizeP; ((struct rlc_tm_data_req *) (new_sdu_p->data))->data_size = sdu_sizeP;
((struct rlc_tm_data_req *) (new_sdu_p->data))->data_offset = sizeof (struct rlc_tm_data_req_alloc); ((struct rlc_tm_data_req *) (new_sdu_p->data))->data_offset = sizeof (struct rlc_tm_data_req_alloc);
free_mem_block(sdu_pP); free_mem_block(sdu_pP, __func__);
rlc_tm_data_req(ctxt_pP, &rlc_union_p->rlc.tm, new_sdu_p); rlc_tm_data_req(ctxt_pP, &rlc_union_p->rlc.tm, new_sdu_p);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
return RLC_OP_STATUS_OK; return RLC_OP_STATUS_OK;
...@@ -493,7 +493,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP, ...@@ -493,7 +493,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP,
break; break;
default: default:
free_mem_block(sdu_pP); free_mem_block(sdu_pP, __func__);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
return RLC_OP_STATUS_INTERNAL_ERROR; return RLC_OP_STATUS_INTERNAL_ERROR;
...@@ -505,7 +505,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP, ...@@ -505,7 +505,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP,
if (sdu_pP != NULL) { if (sdu_pP != NULL) {
if (sdu_sizeP > 0) { if (sdu_sizeP > 0) {
LOG_I(RLC,"received a packet with size %d for MBMS \n", sdu_sizeP); LOG_I(RLC,"received a packet with size %d for MBMS \n", sdu_sizeP);
new_sdu_p = get_free_mem_block (sdu_sizeP + sizeof (struct rlc_um_data_req_alloc)); new_sdu_p = get_free_mem_block (sdu_sizeP + sizeof (struct rlc_um_data_req_alloc), __func__);
if (new_sdu_p != NULL) { if (new_sdu_p != NULL) {
// PROCESS OF COMPRESSION HERE: // PROCESS OF COMPRESSION HERE:
...@@ -513,10 +513,10 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP, ...@@ -513,10 +513,10 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP,
memcpy (&new_sdu_p->data[sizeof (struct rlc_um_data_req_alloc)], &sdu_pP->data[0], sdu_sizeP); memcpy (&new_sdu_p->data[sizeof (struct rlc_um_data_req_alloc)], &sdu_pP->data[0], sdu_sizeP);
((struct rlc_um_data_req *) (new_sdu_p->data))->data_size = sdu_sizeP; ((struct rlc_um_data_req *) (new_sdu_p->data))->data_size = sdu_sizeP;
((struct rlc_um_data_req *) (new_sdu_p->data))->data_offset = sizeof (struct rlc_um_data_req_alloc); ((struct rlc_um_data_req *) (new_sdu_p->data))->data_offset = sizeof (struct rlc_um_data_req_alloc);
free_mem_block(sdu_pP); free_mem_block(sdu_pP, __func__);
rlc_um_data_req(ctxt_pP, &rlc_union_p->rlc.um, new_sdu_p); rlc_um_data_req(ctxt_pP, &rlc_union_p->rlc.um, new_sdu_p);
//free_mem_block(new_sdu); //free_mem_block(new_sdu, __func__);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
return RLC_OP_STATUS_OK; return RLC_OP_STATUS_OK;
} else { } else {
...@@ -537,7 +537,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP, ...@@ -537,7 +537,7 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t* const ctxt_pP,
} }
else /* MBMS_flag != 0 */ else /* MBMS_flag != 0 */
{ {
free_mem_block(sdu_pP); free_mem_block(sdu_pP, __func__);
LOG_E(RLC, "MBMS_flag != 0 while Rel10 is not defined...\n"); LOG_E(RLC, "MBMS_flag != 0 while Rel10 is not defined...\n");
//handle_event(ERROR,"FILE %s FONCTION rlc_data_req() LINE %s : parameter module_id out of bounds :%d\n", __FILE__, __LINE__, module_idP); //handle_event(ERROR,"FILE %s FONCTION rlc_data_req() LINE %s : parameter module_id out of bounds :%d\n", __FILE__, __LINE__, module_idP);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RLC_DATA_REQ,VCD_FUNCTION_OUT);
......
...@@ -57,7 +57,7 @@ struct mac_data_ind mac_rlc_deserialize_tb ( ...@@ -57,7 +57,7 @@ struct mac_data_ind mac_rlc_deserialize_tb (
list_init(&data_ind.data, NULL); list_init(&data_ind.data, NULL);
while (num_tbP > 0) { while (num_tbP > 0) {
tb_p = get_free_mem_block(sizeof (mac_rlc_max_rx_header_size_t) + tb_sizeP); tb_p = get_free_mem_block(sizeof (mac_rlc_max_rx_header_size_t) + tb_sizeP, __func__);
if (tb_p != NULL) { if (tb_p != NULL) {
((struct mac_tb_ind *) (tb_p->data))->first_bit = 0; ((struct mac_tb_ind *) (tb_p->data))->first_bit = 0;
...@@ -110,7 +110,7 @@ tbs_size_t mac_rlc_serialize_tb (char* buffer_pP, list_t transport_blocksP) ...@@ -110,7 +110,7 @@ tbs_size_t mac_rlc_serialize_tb (char* buffer_pP, list_t transport_blocksP)
#endif #endif
memcpy(&buffer_pP[tbs_size], &((struct mac_tb_req *) (tb_p->data))->data_ptr[0], tb_size); memcpy(&buffer_pP[tbs_size], &((struct mac_tb_req *) (tb_p->data))->data_ptr[0], tb_size);
tbs_size = tbs_size + tb_size; tbs_size = tbs_size + tb_size;
free_mem_block(tb_p); free_mem_block(tb_p, __func__);
} }
} }
......
...@@ -786,7 +786,7 @@ rlc_op_status_t rrc_rlc_data_req ( ...@@ -786,7 +786,7 @@ rlc_op_status_t rrc_rlc_data_req (
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
mem_block_t* sdu; mem_block_t* sdu;
sdu = get_free_mem_block(sdu_sizeP); sdu = get_free_mem_block(sdu_sizeP, __func__);
if (sdu != NULL) { if (sdu != NULL) {
memcpy (sdu->data, sduP, sdu_sizeP); memcpy (sdu->data, sduP, sdu_sizeP);
......
...@@ -98,7 +98,7 @@ extern UE_MAC_INST *UE_mac_inst; ...@@ -98,7 +98,7 @@ extern UE_MAC_INST *UE_mac_inst;
extern void *bigphys_malloc(int); extern void *bigphys_malloc(int);
#endif #endif
#define XER_PRINT //#define XER_PRINT
extern int8_t dB_fixed2(uint32_t x,uint32_t y); extern int8_t dB_fixed2(uint32_t x,uint32_t y);
......
...@@ -59,7 +59,7 @@ list_free (list_t * listP) ...@@ -59,7 +59,7 @@ list_free (list_t * listP)
mem_block_t *le; mem_block_t *le;
while ((le = list_remove_head (listP))) { while ((le = list_remove_head (listP))) {
free_mem_block (le); free_mem_block (le, __func__);
} }
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
......
...@@ -75,7 +75,7 @@ list2_free (list2_t * listP) ...@@ -75,7 +75,7 @@ list2_free (list2_t * listP)
mem_block_t *le; mem_block_t *le;
while ((le = list2_remove_head (listP))) { while ((le = list2_remove_head (listP))) {
free_mem_block (le); free_mem_block (le, __func__);
} }
} }
......
...@@ -174,8 +174,12 @@ const char* eurecomVariablesNames[] = { ...@@ -174,8 +174,12 @@ const char* eurecomVariablesNames[] = {
"ue0_SFN5", "ue0_SFN5",
"ue0_SFN6", "ue0_SFN6",
"ue0_SFN7", "ue0_SFN7",
"ue_pdcp_flush_size",
"ue_pdcp_flush_err",
"ue0_trx_read_ns", "ue0_trx_read_ns",
"ue0_trx_write_ns", "ue0_trx_write_ns",
"ue0_trx_read_ns_missing",
"ue0_trx_write_ns_missing"
}; };
const char* eurecomFunctionsNames[] = { const char* eurecomFunctionsNames[] = {
...@@ -192,7 +196,8 @@ const char* eurecomFunctionsNames[] = { ...@@ -192,7 +196,8 @@ const char* eurecomFunctionsNames[] = {
"ue_thread_rxtx1", "ue_thread_rxtx1",
"trx_read_sf9", "trx_read_sf9",
"trx_write_sf9", "trx_write_sf9",
"ue_signal_cond_rxtx", "ue_signal_cond_rxtx0",
"ue_signal_cond_rxtx1",
"ue_wait_cond_rxtx0", "ue_wait_cond_rxtx0",
"ue_wait_cond_rxtx1", "ue_wait_cond_rxtx1",
"ue_lock_mutex_rxtx_for_cond_wait0", "ue_lock_mutex_rxtx_for_cond_wait0",
...@@ -338,6 +343,10 @@ const char* eurecomFunctionsNames[] = { ...@@ -338,6 +343,10 @@ const char* eurecomFunctionsNames[] = {
"pdcp_data_ind", "pdcp_data_ind",
"pdcp_apply_security", "pdcp_apply_security",
"pdcp_validate_security", "pdcp_validate_security",
"pdcp_fifo_read",
"pdcp_fifo_read_buffer",
"pdcp_fifo_flush",
"pdcp_fifo_flush_buffer",
/* RRC signals */ /* RRC signals */
"rrc_rx_tx", "rrc_rx_tx",
"rrc_mac_config_req", "rrc_mac_config_req",
......
...@@ -146,8 +146,12 @@ typedef enum { ...@@ -146,8 +146,12 @@ typedef enum {
VCD_SIGNAL_DUMPER_VARIABLES_UE0_SFN5, VCD_SIGNAL_DUMPER_VARIABLES_UE0_SFN5,
VCD_SIGNAL_DUMPER_VARIABLES_UE0_SFN6, VCD_SIGNAL_DUMPER_VARIABLES_UE0_SFN6,
VCD_SIGNAL_DUMPER_VARIABLES_UE0_SFN7, VCD_SIGNAL_DUMPER_VARIABLES_UE0_SFN7,
VCD_SIGNAL_DUMPER_VARIABLES_UE_PDCP_FLUSH_SIZE,
VCD_SIGNAL_DUMPER_VARIABLES_UE_PDCP_FLUSH_ERR,
VCD_SIGNAL_DUMPER_VARIABLES_UE0_TRX_READ_NS, VCD_SIGNAL_DUMPER_VARIABLES_UE0_TRX_READ_NS,
VCD_SIGNAL_DUMPER_VARIABLES_UE0_TRX_WRITE_NS, VCD_SIGNAL_DUMPER_VARIABLES_UE0_TRX_WRITE_NS,
VCD_SIGNAL_DUMPER_VARIABLES_UE0_TRX_READ_NS_MISSING,
VCD_SIGNAL_DUMPER_VARIABLES_UE0_TRX_WRITE_NS_MISSING,
VCD_SIGNAL_DUMPER_VARIABLES_LAST, VCD_SIGNAL_DUMPER_VARIABLES_LAST,
VCD_SIGNAL_DUMPER_VARIABLES_END = VCD_SIGNAL_DUMPER_VARIABLES_LAST, VCD_SIGNAL_DUMPER_VARIABLES_END = VCD_SIGNAL_DUMPER_VARIABLES_LAST,
} vcd_signal_dump_variables; } vcd_signal_dump_variables;
...@@ -166,7 +170,8 @@ typedef enum { ...@@ -166,7 +170,8 @@ typedef enum {
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_THREAD_RXTX1, VCD_SIGNAL_DUMPER_FUNCTIONS_UE_THREAD_RXTX1,
VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ_SF9, VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ_SF9,
VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_SF9, VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE_SF9,
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SIGNAL_COND_RXTX, VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SIGNAL_COND_RXTX0,
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SIGNAL_COND_RXTX1,
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_WAIT_COND_RXTX0, VCD_SIGNAL_DUMPER_FUNCTIONS_UE_WAIT_COND_RXTX0,
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_WAIT_COND_RXTX1, VCD_SIGNAL_DUMPER_FUNCTIONS_UE_WAIT_COND_RXTX1,
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_LOCK_MUTEX_RXTX_FOR_COND_WAIT0, VCD_SIGNAL_DUMPER_FUNCTIONS_UE_LOCK_MUTEX_RXTX_FOR_COND_WAIT0,
...@@ -311,6 +316,10 @@ typedef enum { ...@@ -311,6 +316,10 @@ typedef enum {
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_IND, VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_DATA_IND,
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_APPLY_SECURITY, VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_APPLY_SECURITY,
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_VALIDATE_SECURITY, VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_VALIDATE_SECURITY,
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ,
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_READ_BUFFER,
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_FLUSH,
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_FIFO_FLUSH_BUFFER,
/* RRC signals */ /* RRC signals */
VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX, VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,
......
...@@ -55,7 +55,7 @@ static pthread_mutex_t mtex = PTHREAD_MUTEX_INITIALIZER; ...@@ -55,7 +55,7 @@ static pthread_mutex_t mtex = PTHREAD_MUTEX_INITIALIZER;
//#define DEBUG_MEM_MNGT_ALLOC //#define DEBUG_MEM_MNGT_ALLOC
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#if defined(USER_MODE) && defined(DEBUG_MEM_MNGT_ALLOC) #if defined(USER_MODE) && defined(DEBUG_MEM_MNGT_ALLOC)
uint32_t counters[11] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; uint32_t counters[14] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
#endif #endif
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
/* /*
...@@ -173,7 +173,7 @@ pool_buffer_clean (void *arg) ...@@ -173,7 +173,7 @@ pool_buffer_clean (void *arg)
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void void
free_mem_block (mem_block_t * leP) free_mem_block (mem_block_t * leP, const char* caller)
{ {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -197,6 +197,11 @@ free_mem_block (mem_block_t * leP) ...@@ -197,6 +197,11 @@ free_mem_block (mem_block_t * leP)
list_add_tail_eurecom (leP, &mem_block_var.mem_lists[leP->pool_id]); list_add_tail_eurecom (leP, &mem_block_var.mem_lists[leP->pool_id]);
#ifdef DEBUG_MEM_MNGT_ALLOC #ifdef DEBUG_MEM_MNGT_ALLOC
counters[leP->pool_id] -= 1; counters[leP->pool_id] -= 1;
msg ("[%s][MEM_MNGT][INFO] after pool[%2d] freed: counters = {%2d %2d %2d %2d %2d %2d %2d %2d %2d %2d %2d %2d}\n",
caller, leP->pool_id,
counters[0],counters[1],counters[2],counters[3],counters[4],
counters[5],counters[6],counters[7],counters[8],counters[9],
counters[10],counters[11]);
#endif #endif
leP = NULL; // this prevent from freeing the block twice leP = NULL; // this prevent from freeing the block twice
} else { } else {
...@@ -210,7 +215,7 @@ free_mem_block (mem_block_t * leP) ...@@ -210,7 +215,7 @@ free_mem_block (mem_block_t * leP)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
mem_block_t * mem_block_t *
get_free_mem_block (uint32_t sizeP) get_free_mem_block (uint32_t sizeP, const char* caller)
{ {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
mem_block_t *le = NULL; mem_block_t *le = NULL;
...@@ -242,11 +247,19 @@ get_free_mem_block (uint32_t sizeP) ...@@ -242,11 +247,19 @@ get_free_mem_block (uint32_t sizeP)
if ((le = list_remove_head (&mem_block_var.mem_lists[pool_selected]))) { if ((le = list_remove_head (&mem_block_var.mem_lists[pool_selected]))) {
#ifdef DEBUG_MEM_MNGT_ALLOC #ifdef DEBUG_MEM_MNGT_ALLOC
counters[pool_selected] += 1; counters[pool_selected] += 1;
msg ("[%s][MEM_MNGT][INFO] after pool[%2d] allocated: counters = {%2d %2d %2d %2d %2d %2d %2d %2d %2d %2d %2d %2d}\n",
caller,
pool_selected,
counters[0],counters[1],counters[2],counters[3],counters[4],
counters[5],counters[6],counters[7],counters[8],counters[9],
counters[10],counters[11]);
#endif #endif
#ifdef DEBUG_MEM_MNGT_ALLOC_SIZE #ifdef DEBUG_MEM_MNGT_ALLOC_SIZE
msg ("[MEM_MNGT][INFO] ALLOC MEM_BLOCK SIZE %d bytes pool %d (%p)\n", sizeP, pool_selected,le); msg ("[MEM_MNGT][INFO] ALLOC MEM_BLOCK SIZE %d bytes pool %d (%p)\n", sizeP, pool_selected,le);
#endif #endif
AssertFatal(le->pool_id == pool_selected, "Unexpected pool ID!");
#ifdef MEMBLOCK_BIG_LOCK #ifdef MEMBLOCK_BIG_LOCK
if (pthread_mutex_unlock(&mtex)) abort(); if (pthread_mutex_unlock(&mtex)) abort();
#endif #endif
...@@ -263,6 +276,7 @@ get_free_mem_block (uint32_t sizeP) ...@@ -263,6 +276,7 @@ get_free_mem_block (uint32_t sizeP)
#endif #endif
} while (pool_selected++ < 12); } while (pool_selected++ < 12);
LOG_E(PHY, "[MEM_MNGT][ERROR][FATAL] failed allocating MEM_BLOCK size %d byes (pool_selected=%d size=%d)\n", sizeP, pool_selected, size);
display_mem_load(); display_mem_load();
mac_xface->macphy_exit("[MEM_MNGT][ERROR][FATAL] get_free_mem_block failed"); mac_xface->macphy_exit("[MEM_MNGT][ERROR][FATAL] get_free_mem_block failed");
...@@ -287,6 +301,13 @@ get_free_copy_mem_block (void) ...@@ -287,6 +301,13 @@ get_free_copy_mem_block (void)
if ((le = list_remove_head (&mem_block_var.mem_lists[MEM_MNGT_POOL_ID_COPY]))) { if ((le = list_remove_head (&mem_block_var.mem_lists[MEM_MNGT_POOL_ID_COPY]))) {
#ifdef DEBUG_MEM_MNGT_ALLOC_SIZE #ifdef DEBUG_MEM_MNGT_ALLOC_SIZE
msg ("[MEM_MNGT][INFO] ALLOC COPY MEM BLOCK (%p)\n",le); msg ("[MEM_MNGT][INFO] ALLOC COPY MEM BLOCK (%p)\n",le);
#endif
#ifdef DEBUG_MEM_MNGT_ALLOC
counters[MEM_MNGT_POOL_ID_COPY] += 1;
msg ("[MEM_MNGT][INFO] pool counters = {%2d %2d %2d %2d %2d %2d %2d %2d %2d %2d %2d %2d}\n",
counters[0],counters[1],counters[2],counters[3],counters[4],
counters[5],counters[6],counters[7],counters[8],counters[9],
counters[10],counters[11]);
#endif #endif
return le; return le;
} else { } else {
......
...@@ -55,8 +55,8 @@ typedef struct mem_block_t { ...@@ -55,8 +55,8 @@ typedef struct mem_block_t {
public_mem_block(void *pool_buffer_init (void);) public_mem_block(void *pool_buffer_init (void);)
public_mem_block(void *pool_buffer_clean (void *arg);) public_mem_block(void *pool_buffer_clean (void *arg);)
public_mem_block(void free_mem_block (mem_block_t * leP);) public_mem_block(void free_mem_block (mem_block_t * leP, const char* caller);)
public_mem_block(mem_block_t* get_free_mem_block (uint32_t sizeP);) public_mem_block(mem_block_t* get_free_mem_block (uint32_t sizeP, const char* caller);)
public_mem_block(mem_block_t *get_free_copy_mem_block (void);) public_mem_block(mem_block_t *get_free_copy_mem_block (void);)
public_mem_block(mem_block_t *get_free_copy_mem_block_up (void);) public_mem_block(mem_block_t *get_free_copy_mem_block_up (void);)
public_mem_block(mem_block_t *copy_mem_block (mem_block_t * leP, mem_block_t * destP);) public_mem_block(mem_block_t *copy_mem_block (mem_block_t * leP, mem_block_t * destP);)
......
...@@ -161,7 +161,7 @@ pool_buffer_clean (void *arg) ...@@ -161,7 +161,7 @@ pool_buffer_clean (void *arg)
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void void
free_mem_block (mem_block_t * leP) free_mem_block (mem_block_t * leP, __func__)
{ {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -171,10 +171,10 @@ free_mem_block (mem_block_t * leP) ...@@ -171,10 +171,10 @@ free_mem_block (mem_block_t * leP)
} }
#ifdef DEBUG_MEM_MNGT_FREE #ifdef DEBUG_MEM_MNGT_FREE
msg ("[MEM_MNGT][FREE] free_mem_block() %p pool: %d\n", leP, leP->pool_id); msg ("[MEM_MNGT][FREE] free_mem_block() %p pool: %d\n", leP, leP->pool_id, __func__);
#endif #endif
#ifdef DEBUG_MEM_MNGT_ALLOC #ifdef DEBUG_MEM_MNGT_ALLOC
check_free_mem_block (leP); check_free_mem_block (leP, __func__);
#endif #endif
if (leP->pool_id <= MEM_MNGT_POOL_ID_COPY) { if (leP->pool_id <= MEM_MNGT_POOL_ID_COPY) {
...@@ -184,14 +184,14 @@ free_mem_block (mem_block_t * leP) ...@@ -184,14 +184,14 @@ free_mem_block (mem_block_t * leP)
#endif #endif
leP = NULL; // this prevent from freeing the block twice leP = NULL; // this prevent from freeing the block twice
} else { } else {
msg ("[MEM_MNGT][FREE] ERROR free_mem_block() unknown pool_id : %d\n", leP->pool_id); msg ("[MEM_MNGT][FREE] ERROR free_mem_block() unknown pool_id : %d\n", leP->pool_id, __func__);
} }
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
mem_block_t * mem_block_t *
get_free_mem_block (uint16_t sizeP) get_free_mem_block (uint16_t sizeP, __func__)
{ {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
mem_block_t *le = NULL; mem_block_t *le = NULL;
...@@ -414,7 +414,7 @@ check_mem_area (void *arg) ...@@ -414,7 +414,7 @@ check_mem_area (void *arg)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void void
check_free_mem_block (mem_block_t * leP) check_free_mem_block (mem_block_t * leP, __func__)
{ {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
int block_index; int block_index;
......
...@@ -54,7 +54,7 @@ umts_timer_check_time_out (list2_t * atimer_listP, uint32_t current_frame_tick_m ...@@ -54,7 +54,7 @@ umts_timer_check_time_out (list2_t * atimer_listP, uint32_t current_frame_tick_m
mem_unit = list2_remove_head (atimer_listP); mem_unit = list2_remove_head (atimer_listP);
(*(timer->proc)) (timer->protocol, timer->timer_id); (*(timer->proc)) (timer->protocol, timer->timer_id);
free_mem_block (mem_unit); free_mem_block (mem_unit, __func__);
mem_unit = atimer_listP->head; mem_unit = atimer_listP->head;
} else { } else {
...@@ -74,7 +74,7 @@ umts_timer_delete_timer (list2_t * atimer_listP, void *timer_idP) ...@@ -74,7 +74,7 @@ umts_timer_delete_timer (list2_t * atimer_listP, void *timer_idP)
while ((mem_unit)) { while ((mem_unit)) {
if (((struct timer_unit *) (mem_unit->data))->timer_id == timer_idP) { if (((struct timer_unit *) (mem_unit->data))->timer_id == timer_idP) {
list2_remove_element (mem_unit, atimer_listP); list2_remove_element (mem_unit, atimer_listP);
free_mem_block (mem_unit); free_mem_block (mem_unit, __func__);
return; return;
} }
...@@ -93,7 +93,7 @@ umts_add_timer_list_up (list2_t * atimer_listP, void (*procP) (void *, void *), ...@@ -93,7 +93,7 @@ umts_add_timer_list_up (list2_t * atimer_listP, void (*procP) (void *, void *),
int32_t remaining_time; int32_t remaining_time;
uint8_t inserted = 0; uint8_t inserted = 0;
mb = get_free_mem_block (sizeof (struct timer_unit)); mb = get_free_mem_block (sizeof (struct timer_unit), __func__);
((struct timer_unit *) (mb->data))->proc = procP; ((struct timer_unit *) (mb->data))->proc = procP;
((struct timer_unit *) (mb->data))->protocol = protocolP; ((struct timer_unit *) (mb->data))->protocol = protocolP;
((struct timer_unit *) (mb->data))->timer_id = timer_idP; ((struct timer_unit *) (mb->data))->timer_id = timer_idP;
...@@ -166,7 +166,7 @@ umts_stop_all_timers_except (list2_t * atimer_listP, void (*procP) (void *, void ...@@ -166,7 +166,7 @@ umts_stop_all_timers_except (list2_t * atimer_listP, void (*procP) (void *, void
mem_unit_to_delete = mem_unit; mem_unit_to_delete = mem_unit;
mem_unit = mem_unit->next; mem_unit = mem_unit->next;
list2_remove_element (mem_unit_to_delete, atimer_listP); list2_remove_element (mem_unit_to_delete, atimer_listP);
free_mem_block (mem_unit_to_delete); free_mem_block (mem_unit_to_delete, __func__);
} else { } else {
mem_unit = mem_unit->next; mem_unit = mem_unit->next;
} }
......
...@@ -53,6 +53,8 @@ Description Defines the layer 3 messages supported by the NAS sublayer ...@@ -53,6 +53,8 @@ Description Defines the layer 3 messages supported by the NAS sublayer
#include "secu_defs.h" #include "secu_defs.h"
#include "emmData.h" #include "emmData.h"
//#define DEBUG_NAS_MESSAGE
/****************************************************************************/ /****************************************************************************/
/**************** E X T E R N A L D E F I N I T I O N S ****************/ /**************** E X T E R N A L D E F I N I T I O N S ****************/
/****************************************************************************/ /****************************************************************************/
...@@ -1312,6 +1314,7 @@ static uint32_t _nas_message_get_mac( ...@@ -1312,6 +1314,7 @@ static uint32_t _nas_message_get_mac(
(direction == SECU_DIRECTION_UPLINK) ? emm_security_context->ul_count.seq_num:emm_security_context->dl_count.seq_num, (direction == SECU_DIRECTION_UPLINK) ? emm_security_context->ul_count.seq_num:emm_security_context->dl_count.seq_num,
count); count);
#ifdef DEBUG_NAS_MESSAGE
fprintf(stderr, "\n[NAS]\t"); fprintf(stderr, "\n[NAS]\t");
for (i=0; i < length; i++) { for (i=0; i < length; i++) {
...@@ -1331,6 +1334,7 @@ static uint32_t _nas_message_get_mac( ...@@ -1331,6 +1334,7 @@ static uint32_t _nas_message_get_mac(
fprintf(stderr, "\n"); fprintf(stderr, "\n");
fflush(stderr); fflush(stderr);
#endif
stream_cipher.key = emm_security_context->knas_int.value; stream_cipher.key = emm_security_context->knas_int.value;
stream_cipher.key_length = AUTH_KNAS_INT_SIZE; stream_cipher.key_length = AUTH_KNAS_INT_SIZE;
......
This diff is collapsed.
...@@ -132,7 +132,7 @@ void pdcp_rlc_test_mac_rlc_loop (struct mac_data_ind *data_indP, struct mac_dat ...@@ -132,7 +132,7 @@ void pdcp_rlc_test_mac_rlc_loop (struct mac_data_ind *data_indP, struct mac_dat
*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;
...@@ -156,7 +156,7 @@ void pdcp_rlc_test_mac_rlc_loop (struct mac_data_ind *data_indP, struct mac_dat ...@@ -156,7 +156,7 @@ void pdcp_rlc_test_mac_rlc_loop (struct mac_data_ind *data_indP, struct mac_dat
*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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment