diff --git a/common/utils/itti/intertask_interface.c b/common/utils/itti/intertask_interface.c index a4478f6f8722069ebb76b4f95f06e78aa15c5436..4fe5667c818342ed3f6140c6403174c166ce244c 100644 --- a/common/utils/itti/intertask_interface.c +++ b/common/utils/itti/intertask_interface.c @@ -118,13 +118,13 @@ static inline uint32_t itti_get_message_priority(MessagesIds message_id) { return (itti_desc.messages_info[message_id].priority); } -char *itti_get_message_name(MessagesIds message_id) { +const char *itti_get_message_name(MessagesIds message_id) { DevCheck(message_id < itti_desc.messages_id_max, message_id, itti_desc.messages_id_max, 0); return (itti_desc.messages_info[message_id].name); } -char *itti_get_task_name(task_id_t task_id) +const char *itti_get_task_name(task_id_t task_id) { thread_id_t thread_id = TASK_GET_THREAD_ID(task_id); @@ -390,7 +390,7 @@ void itti_terminate_tasks(task_id_t task_id) { } int itti_init(thread_id_t thread_max, MessagesIds messages_id_max, const char * const *threads_name, - const message_info_t *messages_info, const char * const messages_definition_xml) { + const message_info_t *messages_info, const char * const messages_definition_xml, const char * const dump_file_name) { int i; itti_desc.message_number = 0; @@ -420,7 +420,7 @@ int itti_init(thread_id_t thread_max, MessagesIds messages_id_max, const char * pthread_cond_init (&itti_desc.tasks[i].message_queue_cond_var, NULL); itti_desc.tasks[i].task_state = TASK_STATE_NOT_CONFIGURED; } - itti_dump_init (messages_definition_xml); + itti_dump_init (messages_definition_xml, dump_file_name); CHECK_INIT_RETURN(timer_init ()); diff --git a/common/utils/itti/intertask_interface.h b/common/utils/itti/intertask_interface.h index 66a6e1118ad6303fc6a5ce23be943683491860b5..b5ed8dce316e015d55f89def6d21db81a52d400b 100644 --- a/common/utils/itti/intertask_interface.h +++ b/common/utils/itti/intertask_interface.h @@ -69,7 +69,7 @@ typedef struct message_info_s { /* Message payload size */ MessageHeaderSize size; /* Printable name */ - char *name; + const char * const name; } message_info_t; enum task_priorities { @@ -137,12 +137,12 @@ void itti_terminate_tasks(task_id_t task_id); /** \brief Return the printable string associated with the message * \param message_id Id of the message **/ -char *itti_get_message_name(MessagesIds message_id); +const char *itti_get_message_name(MessagesIds message_id); /** \brief Return the printable string associated with a task id * \param thread_id Id of the task **/ -char *itti_get_task_name(task_id_t task_id); +const char *itti_get_task_name(task_id_t task_id); /** \brief Alloc and memset(0) a new itti message. * \param origin_task_id Task ID of the sending task diff --git a/common/utils/itti/intertask_interface_dump.c b/common/utils/itti/intertask_interface_dump.c index 3721589ae12bd5461e41d4a4cb7521d9cf222208..36df03c11d8f301e58a98f80b5308ce47c226bb6 100644 --- a/common/utils/itti/intertask_interface_dump.c +++ b/common/utils/itti/intertask_interface_dump.c @@ -100,8 +100,6 @@ typedef struct itti_desc_s { itti_client_desc_t itti_clients[ITTI_DUMP_MAX_CON]; } itti_desc_t; -static itti_desc_t itti_queue; - /* Message sent is an intertask dump type */ #define ITTI_DUMP_MESSAGE_TYPE 0x1 #define ITTI_STATISTIC_MESSAGE_TYPE 0x2 @@ -127,6 +125,9 @@ typedef struct { } itti_statistic_message_t; +static itti_desc_t itti_queue; +static FILE *dump_file; + static int itti_dump_send_message(int sd, itti_queue_item_t *message); static int itti_dump_handle_new_connection(int sd, const char *xml_definition, uint32_t xml_definition_length); @@ -271,6 +272,20 @@ int itti_dump_queue_message(message_number_t message_number, STAILQ_INSERT_TAIL(&itti_queue.itti_message_queue, new, entry); itti_queue.itti_queue_last = new; + if (dump_file != NULL) + { + itti_socket_header_t header; + + header.message_size = sizeof(itti_dump_message_t) + message_size; + header.message_type = ITTI_DUMP_MESSAGE_TYPE; + + fwrite (&header, sizeof(itti_socket_header_t), 1, dump_file); + fwrite (&new->message_number, sizeof(new->message_number), 1, dump_file); + fwrite (new->message_name, sizeof(new->message_name), 1, dump_file); + fwrite (&new->data_size, sizeof(new->data_size), 1, dump_file); + fwrite (new->data, new->data_size, 1, dump_file); + } + /* Release the mutex */ pthread_mutex_unlock(&itti_queue.queue_mutex); @@ -500,10 +515,31 @@ int itti_dump_handle_new_connection(int sd, const char *xml_definition, uint32_t return 0; } -int itti_dump_init(const char * const messages_definition_xml) +int itti_dump_init(const char * const messages_definition_xml, const char * const dump_file_name) { int i; + if (dump_file_name != NULL) + { + dump_file = fopen(dump_file_name, "w"); + + if (dump_file == NULL) + { + ITTI_ERROR("can not open dump file \"%s\" (%d:%s)\n", dump_file_name, errno, strerror(errno)); + } + else + { + uint32_t message_size = strlen(messages_definition_xml); + itti_socket_header_t header; + + header.message_size = sizeof(itti_dump_message_t) + message_size; + header.message_type = ITTI_DUMP_XML_DEFINITION; + + fwrite (&header, sizeof(itti_socket_header_t), 1, dump_file); + fwrite (messages_definition_xml, message_size, 1, dump_file); + } + } + memset(&itti_queue, 0, sizeof(itti_desc_t)); pthread_mutex_init(&itti_queue.queue_mutex, NULL); diff --git a/common/utils/itti/intertask_interface_dump.h b/common/utils/itti/intertask_interface_dump.h index 071e811cf6f5a28573bee307d1ed7417186d0d5d..3da638f5d16b7bb5d4d0892139cf8d752e85d7f0 100644 --- a/common/utils/itti/intertask_interface_dump.h +++ b/common/utils/itti/intertask_interface_dump.h @@ -31,11 +31,9 @@ #ifndef INTERTASK_INTERFACE_DUMP_H_ #define INTERTASK_INTERFACE_DUMP_H_ -int itti_dump_queue_message(message_number_t message_number, - MessageDef *message_p, - const char *message_name, - const uint32_t message_size); +int itti_dump_queue_message(message_number_t message_number, MessageDef *message_p, const char *message_name, + const uint32_t message_size); -int itti_dump_init(const char * const messages_definition_xml); +int itti_dump_init(const char * const messages_definition_xml, const char * const dump_file_name); #endif /* INTERTASK_INTERFACE_DUMP_H_ */ diff --git a/common/utils/itti/intertask_interface_init.h b/common/utils/itti/intertask_interface_init.h index 809022ad24e415f780dfdcd8a56cec69a98fbbb2..26bbcb3b5605eee6dd9d85969bc1448c2ca7e927 100644 --- a/common/utils/itti/intertask_interface_init.h +++ b/common/utils/itti/intertask_interface_init.h @@ -79,9 +79,9 @@ const message_info_t messages_info[] = { * \param threads_name Pointer on the threads name information as created by this include file * \param messages_info Pointer on messages information as created by this include file **/ -int itti_init(thread_id_t thread_max, MessagesIds messages_id_max, - const char * const *threads_name, const message_info_t *messages_info, - const char * const messages_definition_xml); +int itti_init(thread_id_t thread_max, MessagesIds messages_id_max, const char * const *threads_name, + const message_info_t *messages_info, const char * const messages_definition_xml, + const char * const dump_file_name); #endif /* INTERTASK_INTERFACE_INIT_H_ */ /* @} */ diff --git a/openair-cn/OAISIM_MME/oaisim_mme.c b/openair-cn/OAISIM_MME/oaisim_mme.c index 13bd51f89fd60b450af19901dd147f2916c8f4ae..ba81970559557df7e65db1c4d3fe9a7633f71a8e 100644 --- a/openair-cn/OAISIM_MME/oaisim_mme.c +++ b/openair-cn/OAISIM_MME/oaisim_mme.c @@ -68,7 +68,7 @@ int main(int argc, char *argv[]) /* Calling each layer init function */ CHECK_INIT_RETURN(log_init(&mme_config, oai_mme_log_specific)); - CHECK_INIT_RETURN(itti_init(THREAD_MAX, MESSAGES_ID_MAX, threads_name, messages_info, messages_definition_xml)); + CHECK_INIT_RETURN(itti_init(THREAD_MAX, MESSAGES_ID_MAX, threads_name, messages_info, messages_definition_xml, NULL)); CHECK_INIT_RETURN(nas_init(&mme_config)); CHECK_INIT_RETURN(sctp_init(&mme_config)); diff --git a/openair-cn/OAI_EPC/oai_epc.c b/openair-cn/OAI_EPC/oai_epc.c index 0ef1633d5c6158d662ca1ffefd8c03fba8f3e46f..0d44426893668893304ebdac981f847f7e3c5e88 100644 --- a/openair-cn/OAI_EPC/oai_epc.c +++ b/openair-cn/OAI_EPC/oai_epc.c @@ -74,7 +74,7 @@ int main(int argc, char *argv[]) /* Calling each layer init function */ CHECK_INIT_RETURN(log_init(&mme_config, oai_epc_log_specific)); - CHECK_INIT_RETURN(itti_init(THREAD_MAX, MESSAGES_ID_MAX, threads_name, messages_info, messages_definition_xml)); + CHECK_INIT_RETURN(itti_init(THREAD_MAX, MESSAGES_ID_MAX, threads_name, messages_info, messages_definition_xml, NULL)); CHECK_INIT_RETURN(nas_init(&mme_config)); CHECK_INIT_RETURN(sctp_init(&mme_config)); diff --git a/openair-cn/OAI_SGW/oai_sgw.c b/openair-cn/OAI_SGW/oai_sgw.c index b9ce26dea1fd2274b3e3cb0fef3e9e809a9e3794..76dd4955ee6c5cdfa0412a0ea39cbc5fddd64b02 100644 --- a/openair-cn/OAI_SGW/oai_sgw.c +++ b/openair-cn/OAI_SGW/oai_sgw.c @@ -60,7 +60,7 @@ int main(int argc, char *argv[]) /* Calling each layer init function */ CHECK_INIT_RETURN(log_init(&mme_config, oai_sgw_log_specific)); - CHECK_INIT_RETURN(itti_init(THREAD_MAX, MESSAGES_ID_MAX, threads_name, messages_info, messages_definition_xml)); + CHECK_INIT_RETURN(itti_init(THREAD_MAX, MESSAGES_ID_MAX, threads_name, messages_info, messages_definition_xml, NULL)); CHECK_INIT_RETURN(udp_init(&mme_config)); CHECK_INIT_RETURN(s11_sgw_init(&mme_config)); diff --git a/openair-cn/TEST/oaisim_mme_itti_test.c b/openair-cn/TEST/oaisim_mme_itti_test.c index 1896dbf2045c3a944991e0d4d841d92b2983a701..f72bbc075ab86531de55da3d87a5b4b7969f4faa 100644 --- a/openair-cn/TEST/oaisim_mme_itti_test.c +++ b/openair-cn/TEST/oaisim_mme_itti_test.c @@ -78,7 +78,7 @@ int main(int argc, char *argv[]) /* Calling each layer init function */ log_init(&mme_config); - itti_init(THREAD_MAX, MESSAGES_ID_MAX, threads_name, messages_info, messages_definition_xml); + itti_init(THREAD_MAX, MESSAGES_ID_MAX, threads_name, messages_info, messages_definition_xml, NULL); sctp_init(&mme_config); udp_init(&mme_config); s1ap_mme_init(&mme_config); diff --git a/openair2/COMMON/rrc_messages_def.h b/openair2/COMMON/rrc_messages_def.h index f38289aa99b1fee14be56a4f54edcb470e1f9cc0..8312db19bf913e1f22593f6dc5abb43ca9e9766e 100644 --- a/openair2/COMMON/rrc_messages_def.h +++ b/openair2/COMMON/rrc_messages_def.h @@ -11,6 +11,8 @@ MESSAGE_DEF(RRC_UE_EUTRA_CAPABILITY, MESSAGE_PRIORITY_MED_PLUS, RrcUeEutraCap // Messages from MAC layer MESSAGE_DEF(RRC_MAC_IN_SYNC_IND, MESSAGE_PRIORITY_MED_PLUS, RrcMacInSyncInd, rrc_mac_in_sync_ind) MESSAGE_DEF(RRC_MAC_OUT_OF_SYNC_IND, MESSAGE_PRIORITY_MED_PLUS, RrcMacOutOfSyncInd, rrc_mac_out_of_sync_ind) + +MESSAGE_DEF(RRC_MAC_BCCH_DATA_REQ, MESSAGE_PRIORITY_MED_PLUS, RrcMacBcchDataReq, rrc_mac_bcch_data_req) MESSAGE_DEF(RRC_MAC_BCCH_DATA_IND, MESSAGE_PRIORITY_MED_PLUS, RrcMacBcchDataInd, rrc_mac_bcch_data_ind) MESSAGE_DEF(RRC_MAC_CCCH_DATA_IND, MESSAGE_PRIORITY_MED_PLUS, RrcMacCcchDataInd, rrc_mac_ccch_data_ind) MESSAGE_DEF(RRC_MAC_CCCH_SUCCESS_IND, MESSAGE_PRIORITY_MED_PLUS, RrcMacCcchSuccessInd, rrc_mac_ccch_success_ind) diff --git a/openair2/COMMON/rrc_messages_types.h b/openair2/COMMON/rrc_messages_types.h index 4da612336254ac232bcdd4acddb59318956255a7..9114bca1df0f8d201a3832029fe6c85b47884bb9 100644 --- a/openair2/COMMON/rrc_messages_types.h +++ b/openair2/COMMON/rrc_messages_types.h @@ -15,6 +15,8 @@ #define RRC_MAC_IN_SYNC_IND(mSGpTR) (mSGpTR)->msg.rrc_mac_in_sync_ind #define RRC_MAC_OUT_OF_SYNC_IND(mSGpTR) (mSGpTR)->msg.rrc_mac_out_of_sync_ind + +#define RRC_MAC_BCCH_DATA_REQ(mSGpTR) (mSGpTR)->msg.rrc_mac_bcch_data_req #define RRC_MAC_BCCH_DATA_IND(mSGpTR) (mSGpTR)->msg.rrc_mac_bcch_data_ind #define RRC_MAC_CCCH_DATA_IND(mSGpTR) (mSGpTR)->msg.rrc_mac_ccch_data_ind #define RRC_MAC_CCCH_SUCCESS_IND(mSGpTR) (mSGpTR)->msg.rrc_mac_ccch_success_ind @@ -35,6 +37,13 @@ typedef struct { typedef RrcMacInSyncInd RrcMacOutOfSyncInd; +typedef struct { + uint32_t frame; + uint32_t sdu_size; + uint8_t *sdu_p; + uint8_t enb_index; +} RrcMacBcchDataReq; + typedef struct { uint32_t frame; uint32_t sdu_size; diff --git a/openair2/COMMON/tasks_def.h b/openair2/COMMON/tasks_def.h index b3823923ba22fb042a5907cd479e04656a4518e4..dd05551958cd56a1317b7462a81d45270d18a274 100644 --- a/openair2/COMMON/tasks_def.h +++ b/openair2/COMMON/tasks_def.h @@ -6,10 +6,17 @@ TASK_DEF(TASK_TIMER, TASK_PRIORITY_MAX) /// Layer 2 and Layer 1 task supporting all the synchronous processing TASK_DEF(TASK_L2L1, TASK_PRIORITY_MAX_LEAST) //// Layer 2 and Layer 1 sub-tasks -SUB_TASK_DEF(TASK_L2L1, TASK_PDCP) -SUB_TASK_DEF(TASK_L2L1, TASK_RLC) -SUB_TASK_DEF(TASK_L2L1, TASK_MAC) -SUB_TASK_DEF(TASK_L2L1, TASK_PHY) +SUB_TASK_DEF(TASK_L2L1, TASK_PDCP_UE) +SUB_TASK_DEF(TASK_L2L1, TASK_PDCP_ENB) + +SUB_TASK_DEF(TASK_L2L1, TASK_RLC_UE) +SUB_TASK_DEF(TASK_L2L1, TASK_RLC_ENB) + +SUB_TASK_DEF(TASK_L2L1, TASK_MAC_UE) +SUB_TASK_DEF(TASK_L2L1, TASK_MAC_ENB) + +SUB_TASK_DEF(TASK_L2L1, TASK_PHY_UE) +SUB_TASK_DEF(TASK_L2L1, TASK_PHY_ENB) /// Radio Resource Control task for UE TASK_DEF(TASK_RRC_UE, TASK_PRIORITY_MED) diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index d24399ca305114d5a7d248414f9eba6763a8526a..45b773960a5c3672018346a3165efc6a68cca8de 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -59,6 +59,10 @@ //#include "LAYER2/MAC/pre_processor.c" #include "pdcp.h" +#if defined(ENABLE_ITTI) +# include "intertask_interface.h" +#endif + #define ENABLE_MAC_PAYLOAD_DEBUG #define DEBUG_eNB_SCHEDULER 1 //#define DEBUG_HEADER_PARSING 1 @@ -4194,13 +4198,47 @@ void eNB_dlsch_ulsch_scheduler(u8 Mod_id,u8 cooperation_flag, u32 frame, u8 subf #ifdef EXMIMO int ret; #endif +#if defined(ENABLE_ITTI) + MessageDef *msg_p; + const char *msg_name; + instance_t instance; +#endif DCI_PDU *DCI_pdu= &eNB_mac_inst[Mod_id].DCI_pdu; // LOG_D(MAC,"[eNB %d] Frame %d, Subframe %d, entering MAC scheduler\n",Mod_id, frame, subframe); vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER,1); - // clear DCI and BCCH contents before scheduling +#if defined(ENABLE_ITTI) + do { + // Checks if a message has been sent to MAC sub-task + itti_poll_msg (TASK_MAC_ENB, INSTANCE_ALL, &msg_p); + + if (msg_p != NULL) { + msg_name = ITTI_MSG_NAME (msg_p); + instance = ITTI_MSG_INSTANCE (msg_p); + + switch (msg_p->header.messageId) { + case RRC_MAC_BCCH_DATA_REQ: + LOG_D(MAC, "Received %s from %s: instance %d, frame %d, eNB_index %d\n", + msg_name, ITTI_MSG_ORIGIN_NAME(msg_p), instance, + RRC_MAC_BCCH_DATA_REQ (msg_p).frame, RRC_MAC_BCCH_DATA_REQ (msg_p).enb_index); + + // Message buffer has been processed, free it now. + free (RRC_MAC_BCCH_DATA_REQ (msg_p).sdu_p); + break; + + default: + LOG_E(MAC, "Received unexpected message %s\n", msg_name)); + break; + } + + free (msg_p); + } + } while(msg_p != NULL); +#endif + +// clear DCI and BCCH contents before scheduling DCI_pdu->Num_common_dci = 0; DCI_pdu->Num_ue_spec_dci = 0; eNB_mac_inst[Mod_id].bcch_active = 0; diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index 957a2a51aeaa8046487d9e24c3dcfaf1f41a02cb..a59d486cab7f6f1147de006202f86200adafe544 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -65,6 +65,10 @@ #endif #include "pdcp.h" +#if defined(ENABLE_ITTI) +# include "intertask_interface.h" +#endif + #define DEBUG_HEADER_PARSING 1 #define ENABLE_MAC_PAYLOAD_DEBUG @@ -1273,9 +1277,35 @@ UE_L2_STATE_t ue_scheduler(u8 Mod_id,u32 frame, u8 subframe, lte_subframe_t dire // s8 lcg_id; struct RACH_ConfigCommon *rach_ConfigCommon = (struct RACH_ConfigCommon *)NULL; int ret; +#if defined(ENABLE_ITTI) + MessageDef *msg_p; + const char *msg_name; + instance_t instance; +#endif vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SCHEDULER, VCD_FUNCTION_IN); +#if defined(ENABLE_ITTI) + do { + // Checks if a message has been sent to MAC sub-task + itti_poll_msg (TASK_MAC_UE, INSTANCE_ALL, &msg_p); + + if (msg_p != NULL) { + msg_name = ITTI_MSG_NAME (msg_p); + instance = ITTI_MSG_INSTANCE (msg_p); + + switch (msg_p->header.messageId) { + + default: + LOG_E(MAC, "Received unexpected message %s\n", msg_name); + break; + } + + free (msg_p); + } + } while(msg_p != NULL); +#endif + //Mac_rlc_xface->frame=frame; //Rrc_xface->Frame_index=Mac_rlc_xface->frame; //if (subframe%5 == 0) diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index aa67136792452d472a7779e5c29f5ffd04759ce4..74b29eb070ced3d634e585e547b2ecca5b363c4d 100755 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -477,7 +477,7 @@ void pdcp_run (u32_t frame, u8 eNB_flag, u8 UE_index, u8 eNB_index) { //----------------------------------------------------------------------------- #if defined(ENABLE_ITTI) MessageDef *msg_p; - char *msg_name; + const char *msg_name; instance_t instance; #endif @@ -500,7 +500,7 @@ void pdcp_run (u32_t frame, u8 eNB_flag, u8 UE_index, u8 eNB_index) { #if defined(ENABLE_ITTI) do { // Checks if a message has been sent to PDCP sub-task - itti_poll_msg (TASK_PDCP, INSTANCE_ALL, &msg_p); + itti_poll_msg (eNB_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, INSTANCE_ALL, &msg_p); if (msg_p != NULL) { msg_name = ITTI_MSG_NAME (msg_p); @@ -523,7 +523,7 @@ void pdcp_run (u32_t frame, u8 eNB_flag, u8 UE_index, u8 eNB_index) { break; default: - LOG_E(PDCP, "Received unexpected message %s\n", itti_get_message_name(msg_p->header.messageId)); + LOG_E(PDCP, "Received unexpected message %s\n", msg_name); break; } diff --git a/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.c b/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.c index 7a63853c4207584866403fdd5232631f5704313a..d674a324e25b42a851f58ca9a092c3066bb97da9 100644 --- a/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.c +++ b/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.c @@ -95,8 +95,10 @@ s8 mac_rrc_data_req(u8 Mod_id, u32 frame, u16 Srb_id, u8 Nb_tb,u8 *Buffer,u8 eNB return(mac_rrc_lite_data_req(Mod_id,frame,Srb_id,Nb_tb,Buffer,eNB_flag,eNB_index,mbsfn_sync_area)); #endif //CELLULAR } - + +/********************************************************************************************************************/ s8 mac_rrc_data_ind(u8 Mod_id, u32 frame, u16 Srb_id, u8 *Sdu,u16 Sdu_len,u8 eNB_flag, u8 eNB_index,u8 mbsfn_sync_area){ +/********************************************************************************************************************/ #ifdef CELLULAR return(rrc_L2_mac_data_ind_rx(Mod_id, Srb_id, Sdu, Sdu_len, eNB_index)); #else diff --git a/openair2/RRC/LITE/L2_interface.c b/openair2/RRC/LITE/L2_interface.c index db7de315b024470b5ad2c8b75b267825d1c2f0c7..ce0da8a544646cb24d32977e2500c12546149315 100644 --- a/openair2/RRC/LITE/L2_interface.c +++ b/openair2/RRC/LITE/L2_interface.c @@ -85,7 +85,27 @@ s8 mac_rrc_lite_data_req(u8 Mod_id, u32 frame, u16 Srb_id, u8 Nb_tb, u8 *Buffer, mac_xface->macphy_exit(""); } if ((frame%2) == 0) { - memcpy(&Buffer[0],eNB_rrc_inst[Mod_id].SIB1,eNB_rrc_inst[Mod_id].sizeof_SIB1); + memcpy(&Buffer[0],eNB_rrc_inst[Mod_id].SIB1,eNB_rrc_inst[Mod_id].sizeof_SIB1); + +#if defined(ENABLE_ITTI) + { + MessageDef *message_p; + // Uses a new buffer to avoid issue with MAC buffer content that could be changed by MAC (asynchronous message handling). + u8 *message_buffer; + + message_buffer = malloc (eNB_rrc_inst[Mod_id].sizeof_SIB1); + memcpy (message_buffer, eNB_rrc_inst[Mod_id].SIB1, eNB_rrc_inst[Mod_id].sizeof_SIB1); + + message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_BCCH_DATA_REQ); + RRC_MAC_BCCH_DATA_IND (message_p).frame = frame; + RRC_MAC_BCCH_DATA_IND (message_p).sdu_size = eNB_rrc_inst[Mod_id].sizeof_SIB1; + RRC_MAC_BCCH_DATA_IND (message_p).sdu_p = message_buffer; + RRC_MAC_BCCH_DATA_IND (message_p).enb_index = eNB_index; + + itti_send_msg_to_task (TASK_MAC_ENB, Mod_id, message_p); + } +#endif + #ifdef DEBUG_RRC LOG_D(RRC,"[eNB %d] Frame %d : BCCH request => SIB 1\n",Mod_id,frame); for (i=0;i<eNB_rrc_inst[Mod_id].sizeof_SIB1;i++) @@ -97,6 +117,26 @@ s8 mac_rrc_lite_data_req(u8 Mod_id, u32 frame, u16 Srb_id, u8 Nb_tb, u8 *Buffer, } // All RFN mod 8 transmit SIB2-3 in SF 5 else if ((frame%8) == 1){ memcpy(&Buffer[0],eNB_rrc_inst[Mod_id].SIB23,eNB_rrc_inst[Mod_id].sizeof_SIB23); + +#if defined(ENABLE_ITTI) + { + MessageDef *message_p; + // Uses a new buffer to avoid issue with MAC buffer content that could be changed by MAC (asynchronous message handling). + u8 *message_buffer; + + message_buffer = malloc (eNB_rrc_inst[Mod_id].sizeof_SIB23); + memcpy (message_buffer, eNB_rrc_inst[Mod_id].SIB23, eNB_rrc_inst[Mod_id].sizeof_SIB23); + + message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_BCCH_DATA_REQ); + RRC_MAC_BCCH_DATA_IND (message_p).frame = frame; + RRC_MAC_BCCH_DATA_IND (message_p).sdu_size = eNB_rrc_inst[Mod_id].sizeof_SIB23; + RRC_MAC_BCCH_DATA_IND (message_p).sdu_p = message_buffer; + RRC_MAC_BCCH_DATA_IND (message_p).enb_index = eNB_index; + + itti_send_msg_to_task (TASK_MAC_ENB, Mod_id, message_p); + } +#endif + #ifdef DEBUG_RRC LOG_D(RRC,"[eNB %d] Frame %d BCCH request => SIB 2-3\n",Mod_id,frame); for (i=0;i<eNB_rrc_inst[Mod_id].sizeof_SIB23;i++) @@ -201,7 +241,7 @@ s8 mac_rrc_lite_data_ind(u8 Mod_id, u32 frame, u16 Srb_id, u8 *Sdu, u16 sdu_size message_buffer = malloc (sdu_size); memcpy (message_buffer, Sdu, sdu_size); - message_p = itti_alloc_new_message (TASK_MAC, RRC_MAC_BCCH_DATA_IND); + message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_BCCH_DATA_IND); RRC_MAC_BCCH_DATA_IND (message_p).frame = frame; RRC_MAC_BCCH_DATA_IND (message_p).sdu_size = sdu_size; RRC_MAC_BCCH_DATA_IND (message_p).sdu_p = message_buffer; @@ -267,7 +307,7 @@ s8 mac_rrc_lite_data_ind(u8 Mod_id, u32 frame, u16 Srb_id, u8 *Sdu, u16 sdu_size message_buffer = malloc (sdu_size); memcpy (message_buffer, Sdu, sdu_size); - message_p = itti_alloc_new_message (TASK_MAC, RRC_MAC_CCCH_DATA_IND); + message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_CCCH_DATA_IND); RRC_MAC_CCCH_DATA_IND (message_p).frame = frame; RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = sdu_size; RRC_MAC_CCCH_DATA_IND (message_p).sdu_p = message_buffer; @@ -299,7 +339,7 @@ s8 mac_rrc_lite_data_ind(u8 Mod_id, u32 frame, u16 Srb_id, u8 *Sdu, u16 sdu_size message_buffer = malloc (sdu_size); memcpy (message_buffer, Sdu, sdu_size); - message_p = itti_alloc_new_message (TASK_MAC, RRC_MAC_MCCH_DATA_IND); + message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_MCCH_DATA_IND); RRC_MAC_MCCH_DATA_IND (message_p).frame = frame; RRC_MAC_MCCH_DATA_IND (message_p).sdu_size = sdu_size; RRC_MAC_MCCH_DATA_IND (message_p).sdu_p = message_buffer; @@ -329,7 +369,7 @@ s8 mac_rrc_lite_data_ind(u8 Mod_id, u32 frame, u16 Srb_id, u8 *Sdu, u16 sdu_size message_buffer = malloc (sdu_size); memcpy (message_buffer, Sdu, sdu_size); - message_p = itti_alloc_new_message (TASK_MAC, RRC_MAC_CCCH_DATA_IND); + message_p = itti_alloc_new_message (TASK_MAC_ENB, RRC_MAC_CCCH_DATA_IND); RRC_MAC_CCCH_DATA_IND (message_p).frame = frame; RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = sdu_size; RRC_MAC_CCCH_DATA_IND (message_p).sdu_p = message_buffer; @@ -376,7 +416,7 @@ u8 rrc_lite_data_req(u8 Mod_id, u32 frame, u8 eNB_flag, unsigned int rb_id, u32 RRC_DCCH_DATA_REQ (message_p).sdu_p = message_buffer; RRC_DCCH_DATA_REQ (message_p).mode = mode; - itti_send_msg_to_task (TASK_PDCP, Mod_id, message_p); + itti_send_msg_to_task (eNB_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, Mod_id, message_p); return TRUE; // TODO should be changed to a CNF message later, currently RRC lite does not used the returned value anyway. } @@ -405,7 +445,7 @@ void rrc_lite_data_ind( u8 Mod_id, u32 frame, u8 eNB_flag,u32 Srb_id, u32 sdu_si message_buffer = malloc (sdu_size); memcpy (message_buffer, Buffer, sdu_size); - message_p = itti_alloc_new_message (TASK_PDCP, RRC_DCCH_DATA_IND); + message_p = itti_alloc_new_message (eNB_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, RRC_DCCH_DATA_IND); RRC_DCCH_DATA_IND (message_p).frame = frame; RRC_DCCH_DATA_IND (message_p).dcch_index = DCCH_index; RRC_DCCH_DATA_IND (message_p).sdu_size = sdu_size; @@ -436,7 +476,7 @@ void rrc_lite_in_sync_ind(u8 Mod_id, u32 frame, u16 eNB_index) { { MessageDef *message_p; - message_p = itti_alloc_new_message (TASK_MAC, RRC_MAC_IN_SYNC_IND); + message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_IN_SYNC_IND); RRC_MAC_IN_SYNC_IND (message_p).frame = frame; RRC_MAC_IN_SYNC_IND (message_p).enb_index = eNB_index; @@ -465,7 +505,7 @@ void rrc_lite_out_of_sync_ind(u8 Mod_id, u32 frame, u16 eNB_index){ { MessageDef *message_p; - message_p = itti_alloc_new_message (TASK_MAC, RRC_MAC_OUT_OF_SYNC_IND); + message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_OUT_OF_SYNC_IND); RRC_MAC_OUT_OF_SYNC_IND (message_p).frame = frame; RRC_MAC_OUT_OF_SYNC_IND (message_p).enb_index = eNB_index; @@ -492,7 +532,7 @@ int mac_ue_ccch_success_ind(u8 Mod_id, u8 eNB_index) { { MessageDef *message_p; - message_p = itti_alloc_new_message (TASK_MAC, RRC_MAC_CCCH_SUCCESS_IND); + message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_CCCH_SUCCESS_IND); RRC_MAC_CCCH_SUCCESS_IND (message_p).enb_index = eNB_index; itti_send_msg_to_task (TASK_RRC_UE, Mod_id - NB_eNB_INST, message_p); diff --git a/openair2/RRC/LITE/rrc_UE.c b/openair2/RRC/LITE/rrc_UE.c index eff18b7e8e7fc82c2ecae5ff250bc9f84db2fa5a..f2a9ffc4e7f5c25a1ddb86b55c5f94c6b33e4656 100644 --- a/openair2/RRC/LITE/rrc_UE.c +++ b/openair2/RRC/LITE/rrc_UE.c @@ -1758,7 +1758,7 @@ EXPORT_SYMBOL(Rlc_info_am_config); #if defined(ENABLE_ITTI) void *rrc_ue_task(void *args_p) { MessageDef *msg_p; - char *msg_name; + const char *msg_name; instance_t instance; SRB_INFO *srb_info_p; diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LITE/rrc_eNB.c index de397213d8f20f3d739692d9a617de2d5fbcbefa..6d21563d7eb014fd4152850d4b648f0f4d95c8e4 100644 --- a/openair2/RRC/LITE/rrc_eNB.c +++ b/openair2/RRC/LITE/rrc_eNB.c @@ -1992,7 +1992,7 @@ EXPORT_SYMBOL (Rlc_info_am_config); #if defined(ENABLE_ITTI) void *rrc_enb_task(void *args_p) { MessageDef *msg_p; - char *msg_name; + const char *msg_name; instance_t instance; SRB_INFO *srb_info_p; diff --git a/targets/SIMU/USER/oaisim.c b/targets/SIMU/USER/oaisim.c index fcef8c7b76197bf8619113600b0fceefa8785fb7..a39dbf92e47a739d48c99c2ac29482c07eaf56b0 100644 --- a/targets/SIMU/USER/oaisim.c +++ b/targets/SIMU/USER/oaisim.c @@ -892,7 +892,7 @@ int main(int argc, char **argv) { } #if defined(ENABLE_ITTI) - itti_init(THREAD_MAX, MESSAGES_ID_MAX, threads_name, messages_info, messages_definition_xml); + itti_init(THREAD_MAX, MESSAGES_ID_MAX, threads_name, messages_info, messages_definition_xml, oai_emulation.info.itti_dump_file); #endif #ifdef OPENAIR2 diff --git a/targets/SIMU/USER/oaisim_functions.c b/targets/SIMU/USER/oaisim_functions.c index 60b5ed9984457c1def01f7789c2207e559180d51..7bdda0f7c10e07e00812b108d572175c8db02c60 100644 --- a/targets/SIMU/USER/oaisim_functions.c +++ b/targets/SIMU/USER/oaisim_functions.c @@ -114,7 +114,7 @@ void get_simulation_options(int argc, char *argv[]) { {NULL, 0, NULL, 0} }; - while ((c = getopt_long (argc, argv, "aA:b:B:c:C:D:d:eE:f:FGg:hi:IJ:j:k:L:l:m:M:n:N:oO:p:P:Q:rR:s:S:t:T:u:U:vVw:W:x:X:y:Y:z:Z:", long_options, &option_index)) != -1) { + while ((c = getopt_long (argc, argv, "aA:b:B:c:C:D:d:eE:f:FGg:hi:IJ:j:k:K:L:l:m:M:n:N:oO:p:P:Q:rR:s:S:t:T:u:U:vVw:W:x:X:y:Y:z:Z:", long_options, &option_index)) != -1) { switch (c) { case 0: if (! strcmp(long_options[option_index].name, "pdcp_period")) { @@ -214,6 +214,9 @@ void get_simulation_options(int argc, char *argv[]) { LOG_E(EMU,"[SIM] Option k is no longer supported on the command line. Please specify your channel model in the xml template\n"); exit(-1); break; + case 'K': + oai_emulation.info.itti_dump_file = optarg; + break; case 't': //Td = atof (optarg); LOG_E(EMU,"[SIM] Option t is no longer supported on the command line. Please specify your channel model in the xml template\n");