Commit cabff5b7 authored by laurent's avatar laurent

fix itti issue in memory management

parent 9205b4d0
...@@ -91,8 +91,16 @@ task_list_t tasks[TASK_MAX]; ...@@ -91,8 +91,16 @@ task_list_t tasks[TASK_MAX];
return (EXIT_SUCCESS); 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 *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.messageId = message_id;
temp->ittiMsgHeader.originTaskId = origin_task_id; temp->ittiMsgHeader.originTaskId = origin_task_id;
temp->ittiMsgHeader.ittiMsgSize = size; temp->ittiMsgHeader.ittiMsgSize = size;
...@@ -100,7 +108,7 @@ task_list_t tasks[TASK_MAX]; ...@@ -100,7 +108,7 @@ task_list_t tasks[TASK_MAX];
} }
MessageDef *itti_alloc_new_message(task_id_t origin_task_id, MessagesIds message_id) { 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); MessageDef *temp = (MessageDef *)itti_malloc (origin_task_id, TASK_UNKNOWN, size);
temp->ittiMsgHeader.messageId = message_id; temp->ittiMsgHeader.messageId = message_id;
temp->ittiMsgHeader.originTaskId = origin_task_id; temp->ittiMsgHeader.originTaskId = origin_task_id;
......
...@@ -80,6 +80,7 @@ int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; ...@@ -80,6 +80,7 @@ int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
int split73; int split73;
char * split73_config; char * split73_config;
int split73; int split73;
int usrp_tx_thread = 0;
static void *ru_thread( void *param ); static void *ru_thread( void *param );
void kill_RU_proc(RU_t *ru) { void kill_RU_proc(RU_t *ru) {
...@@ -1152,6 +1153,7 @@ int restart_L1L2(module_id_t enb_id) { ...@@ -1152,6 +1153,7 @@ int restart_L1L2(module_id_t enb_id) {
} }
int main ( int argc, char **argv ) { int main ( int argc, char **argv ) {
//mtrace();
int i; int i;
int CC_id = 0; int CC_id = 0;
int node_type = ngran_eNB; int node_type = ngran_eNB;
......
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