From cabff5b73b8827c2b7f3a417a19a08f0c4776a4b Mon Sep 17 00:00:00 2001 From: laurent <laurent.thomas@open-cells.com> Date: Fri, 3 Jul 2020 14:57:27 +0200 Subject: [PATCH] fix itti issue in memory management --- common/utils/ocp_itti/intertask_interface.cpp | 12 ++++++++++-- executables/main-ocp.c | 2 ++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/common/utils/ocp_itti/intertask_interface.cpp b/common/utils/ocp_itti/intertask_interface.cpp index 3d4d356dcf6..22933fdd5be 100644 --- a/common/utils/ocp_itti/intertask_interface.cpp +++ b/common/utils/ocp_itti/intertask_interface.cpp @@ -91,8 +91,16 @@ task_list_t tasks[TASK_MAX]; return (EXIT_SUCCESS); } + // in the two following functions, the +32 in malloc is there to deal with gcc memory alignment + // because a struct size can be larger than sum(sizeof(struct components)) + // We should remove the itti principle of a huge union for all types of messages in paramter "msg_t ittiMsg" + // to use a more C classical pointer casting "void * ittiMsg", later casted in the right struct + // but we would have to change all legacy macros, as per this example + // #define S1AP_REGISTER_ENB_REQ(mSGpTR) (mSGpTR)->ittiMsg.s1ap_register_enb_req + // would become + // #define S1AP_REGISTER_ENB_REQ(mSGpTR) (s1ap_register_enb_req) mSGpTR)->ittiMsg MessageDef *itti_alloc_new_message_sized(task_id_t origin_task_id, MessagesIds message_id, MessageHeaderSize size) { - MessageDef *temp = (MessageDef *)itti_malloc (origin_task_id, TASK_UNKNOWN, sizeof(MessageHeader) + size); + MessageDef *temp = (MessageDef *)itti_malloc (origin_task_id, TASK_UNKNOWN, sizeof(MessageHeader) +32 + size); temp->ittiMsgHeader.messageId = message_id; temp->ittiMsgHeader.originTaskId = origin_task_id; temp->ittiMsgHeader.ittiMsgSize = size; @@ -100,7 +108,7 @@ task_list_t tasks[TASK_MAX]; } MessageDef *itti_alloc_new_message(task_id_t origin_task_id, MessagesIds message_id) { - int size=sizeof(MessageHeader) + messages_info[message_id].size; + int size=sizeof(MessageHeader) + 32 + messages_info[message_id].size; MessageDef *temp = (MessageDef *)itti_malloc (origin_task_id, TASK_UNKNOWN, size); temp->ittiMsgHeader.messageId = message_id; temp->ittiMsgHeader.originTaskId = origin_task_id; diff --git a/executables/main-ocp.c b/executables/main-ocp.c index d2ee9418dca..e4e42b4f23b 100644 --- a/executables/main-ocp.c +++ b/executables/main-ocp.c @@ -80,6 +80,7 @@ int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; int split73; char * split73_config; int split73; +int usrp_tx_thread = 0; static void *ru_thread( void *param ); void kill_RU_proc(RU_t *ru) { @@ -1152,6 +1153,7 @@ int restart_L1L2(module_id_t enb_id) { } int main ( int argc, char **argv ) { + //mtrace(); int i; int CC_id = 0; int node_type = ngran_eNB; -- GitLab