Commit 5260b60d authored by winckel's avatar winckel

Added a command line option "-K file_name" to save ITTI logs directly.

Created "RRC_MAC_BCCH_DATA_REQ" message.
Separated L2L1 sub task by eNB/UE to separate messages handling in PDCP and MAC.
Added ITTI messages poll in MAC sub tasks.

pre-ci ok.

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4300 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 0299db1f
...@@ -118,13 +118,13 @@ static inline uint32_t itti_get_message_priority(MessagesIds message_id) { ...@@ -118,13 +118,13 @@ static inline uint32_t itti_get_message_priority(MessagesIds message_id) {
return (itti_desc.messages_info[message_id].priority); 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); DevCheck(message_id < itti_desc.messages_id_max, message_id, itti_desc.messages_id_max, 0);
return (itti_desc.messages_info[message_id].name); 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); thread_id_t thread_id = TASK_GET_THREAD_ID(task_id);
...@@ -390,7 +390,7 @@ void itti_terminate_tasks(task_id_t 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, 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; int i;
itti_desc.message_number = 0; itti_desc.message_number = 0;
...@@ -420,7 +420,7 @@ int itti_init(thread_id_t thread_max, MessagesIds messages_id_max, const char * ...@@ -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); pthread_cond_init (&itti_desc.tasks[i].message_queue_cond_var, NULL);
itti_desc.tasks[i].task_state = TASK_STATE_NOT_CONFIGURED; 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 ()); CHECK_INIT_RETURN(timer_init ());
......
...@@ -69,7 +69,7 @@ typedef struct message_info_s { ...@@ -69,7 +69,7 @@ typedef struct message_info_s {
/* Message payload size */ /* Message payload size */
MessageHeaderSize size; MessageHeaderSize size;
/* Printable name */ /* Printable name */
char *name; const char * const name;
} message_info_t; } message_info_t;
enum task_priorities { enum task_priorities {
...@@ -137,12 +137,12 @@ void itti_terminate_tasks(task_id_t task_id); ...@@ -137,12 +137,12 @@ void itti_terminate_tasks(task_id_t task_id);
/** \brief Return the printable string associated with the message /** \brief Return the printable string associated with the message
* \param message_id Id of 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 /** \brief Return the printable string associated with a task id
* \param thread_id Id of the task * \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. /** \brief Alloc and memset(0) a new itti message.
* \param origin_task_id Task ID of the sending task * \param origin_task_id Task ID of the sending task
......
...@@ -100,8 +100,6 @@ typedef struct itti_desc_s { ...@@ -100,8 +100,6 @@ typedef struct itti_desc_s {
itti_client_desc_t itti_clients[ITTI_DUMP_MAX_CON]; itti_client_desc_t itti_clients[ITTI_DUMP_MAX_CON];
} itti_desc_t; } itti_desc_t;
static itti_desc_t itti_queue;
/* Message sent is an intertask dump type */ /* Message sent is an intertask dump type */
#define ITTI_DUMP_MESSAGE_TYPE 0x1 #define ITTI_DUMP_MESSAGE_TYPE 0x1
#define ITTI_STATISTIC_MESSAGE_TYPE 0x2 #define ITTI_STATISTIC_MESSAGE_TYPE 0x2
...@@ -127,6 +125,9 @@ typedef struct { ...@@ -127,6 +125,9 @@ typedef struct {
} itti_statistic_message_t; } 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_send_message(int sd, itti_queue_item_t *message);
static int itti_dump_handle_new_connection(int sd, const char *xml_definition, static int itti_dump_handle_new_connection(int sd, const char *xml_definition,
uint32_t xml_definition_length); uint32_t xml_definition_length);
...@@ -271,6 +272,20 @@ int itti_dump_queue_message(message_number_t message_number, ...@@ -271,6 +272,20 @@ int itti_dump_queue_message(message_number_t message_number,
STAILQ_INSERT_TAIL(&itti_queue.itti_message_queue, new, entry); STAILQ_INSERT_TAIL(&itti_queue.itti_message_queue, new, entry);
itti_queue.itti_queue_last = new; 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 */ /* Release the mutex */
pthread_mutex_unlock(&itti_queue.queue_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 ...@@ -500,10 +515,31 @@ int itti_dump_handle_new_connection(int sd, const char *xml_definition, uint32_t
return 0; 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; 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)); memset(&itti_queue, 0, sizeof(itti_desc_t));
pthread_mutex_init(&itti_queue.queue_mutex, NULL); pthread_mutex_init(&itti_queue.queue_mutex, NULL);
......
...@@ -31,11 +31,9 @@ ...@@ -31,11 +31,9 @@
#ifndef INTERTASK_INTERFACE_DUMP_H_ #ifndef INTERTASK_INTERFACE_DUMP_H_
#define INTERTASK_INTERFACE_DUMP_H_ #define INTERTASK_INTERFACE_DUMP_H_
int itti_dump_queue_message(message_number_t message_number, int itti_dump_queue_message(message_number_t message_number, MessageDef *message_p, const char *message_name,
MessageDef *message_p, const uint32_t message_size);
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_ */ #endif /* INTERTASK_INTERFACE_DUMP_H_ */
...@@ -79,9 +79,9 @@ const message_info_t messages_info[] = { ...@@ -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 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 * \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, int itti_init(thread_id_t thread_max, MessagesIds messages_id_max, const char * const *threads_name,
const char * const *threads_name, const message_info_t *messages_info, const message_info_t *messages_info, const char * const messages_definition_xml,
const char * const messages_definition_xml); const char * const dump_file_name);
#endif /* INTERTASK_INTERFACE_INIT_H_ */ #endif /* INTERTASK_INTERFACE_INIT_H_ */
/* @} */ /* @} */
...@@ -68,7 +68,7 @@ int main(int argc, char *argv[]) ...@@ -68,7 +68,7 @@ int main(int argc, char *argv[])
/* Calling each layer init function */ /* Calling each layer init function */
CHECK_INIT_RETURN(log_init(&mme_config, oai_mme_log_specific)); 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(nas_init(&mme_config));
CHECK_INIT_RETURN(sctp_init(&mme_config)); CHECK_INIT_RETURN(sctp_init(&mme_config));
......
...@@ -74,7 +74,7 @@ int main(int argc, char *argv[]) ...@@ -74,7 +74,7 @@ int main(int argc, char *argv[])
/* Calling each layer init function */ /* Calling each layer init function */
CHECK_INIT_RETURN(log_init(&mme_config, oai_epc_log_specific)); 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(nas_init(&mme_config));
CHECK_INIT_RETURN(sctp_init(&mme_config)); CHECK_INIT_RETURN(sctp_init(&mme_config));
......
...@@ -60,7 +60,7 @@ int main(int argc, char *argv[]) ...@@ -60,7 +60,7 @@ int main(int argc, char *argv[])
/* Calling each layer init function */ /* Calling each layer init function */
CHECK_INIT_RETURN(log_init(&mme_config, oai_sgw_log_specific)); 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(udp_init(&mme_config));
CHECK_INIT_RETURN(s11_sgw_init(&mme_config)); CHECK_INIT_RETURN(s11_sgw_init(&mme_config));
......
...@@ -78,7 +78,7 @@ int main(int argc, char *argv[]) ...@@ -78,7 +78,7 @@ int main(int argc, char *argv[])
/* Calling each layer init function */ /* Calling each layer init function */
log_init(&mme_config); 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); sctp_init(&mme_config);
udp_init(&mme_config); udp_init(&mme_config);
s1ap_mme_init(&mme_config); s1ap_mme_init(&mme_config);
......
...@@ -11,6 +11,8 @@ MESSAGE_DEF(RRC_UE_EUTRA_CAPABILITY, MESSAGE_PRIORITY_MED_PLUS, RrcUeEutraCap ...@@ -11,6 +11,8 @@ MESSAGE_DEF(RRC_UE_EUTRA_CAPABILITY, MESSAGE_PRIORITY_MED_PLUS, RrcUeEutraCap
// Messages from MAC layer // 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_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_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_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_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) MESSAGE_DEF(RRC_MAC_CCCH_SUCCESS_IND, MESSAGE_PRIORITY_MED_PLUS, RrcMacCcchSuccessInd, rrc_mac_ccch_success_ind)
......
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
#define RRC_MAC_IN_SYNC_IND(mSGpTR) (mSGpTR)->msg.rrc_mac_in_sync_ind #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_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_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_DATA_IND(mSGpTR) (mSGpTR)->msg.rrc_mac_ccch_data_ind
#define RRC_MAC_CCCH_SUCCESS_IND(mSGpTR) (mSGpTR)->msg.rrc_mac_ccch_success_ind #define RRC_MAC_CCCH_SUCCESS_IND(mSGpTR) (mSGpTR)->msg.rrc_mac_ccch_success_ind
...@@ -35,6 +37,13 @@ typedef struct { ...@@ -35,6 +37,13 @@ typedef struct {
typedef RrcMacInSyncInd RrcMacOutOfSyncInd; typedef RrcMacInSyncInd RrcMacOutOfSyncInd;
typedef struct {
uint32_t frame;
uint32_t sdu_size;
uint8_t *sdu_p;
uint8_t enb_index;
} RrcMacBcchDataReq;
typedef struct { typedef struct {
uint32_t frame; uint32_t frame;
uint32_t sdu_size; uint32_t sdu_size;
......
...@@ -6,10 +6,17 @@ TASK_DEF(TASK_TIMER, TASK_PRIORITY_MAX) ...@@ -6,10 +6,17 @@ TASK_DEF(TASK_TIMER, TASK_PRIORITY_MAX)
/// Layer 2 and Layer 1 task supporting all the synchronous processing /// Layer 2 and Layer 1 task supporting all the synchronous processing
TASK_DEF(TASK_L2L1, TASK_PRIORITY_MAX_LEAST) TASK_DEF(TASK_L2L1, TASK_PRIORITY_MAX_LEAST)
//// Layer 2 and Layer 1 sub-tasks //// Layer 2 and Layer 1 sub-tasks
SUB_TASK_DEF(TASK_L2L1, TASK_PDCP) SUB_TASK_DEF(TASK_L2L1, TASK_PDCP_UE)
SUB_TASK_DEF(TASK_L2L1, TASK_RLC) SUB_TASK_DEF(TASK_L2L1, TASK_PDCP_ENB)
SUB_TASK_DEF(TASK_L2L1, TASK_MAC)
SUB_TASK_DEF(TASK_L2L1, TASK_PHY) 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 /// Radio Resource Control task for UE
TASK_DEF(TASK_RRC_UE, TASK_PRIORITY_MED) TASK_DEF(TASK_RRC_UE, TASK_PRIORITY_MED)
......
...@@ -59,6 +59,10 @@ ...@@ -59,6 +59,10 @@
//#include "LAYER2/MAC/pre_processor.c" //#include "LAYER2/MAC/pre_processor.c"
#include "pdcp.h" #include "pdcp.h"
#if defined(ENABLE_ITTI)
# include "intertask_interface.h"
#endif
#define ENABLE_MAC_PAYLOAD_DEBUG #define ENABLE_MAC_PAYLOAD_DEBUG
#define DEBUG_eNB_SCHEDULER 1 #define DEBUG_eNB_SCHEDULER 1
//#define DEBUG_HEADER_PARSING 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 ...@@ -4194,13 +4198,47 @@ void eNB_dlsch_ulsch_scheduler(u8 Mod_id,u8 cooperation_flag, u32 frame, u8 subf
#ifdef EXMIMO #ifdef EXMIMO
int ret; int ret;
#endif #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; 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); // 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); 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_common_dci = 0;
DCI_pdu->Num_ue_spec_dci = 0; DCI_pdu->Num_ue_spec_dci = 0;
eNB_mac_inst[Mod_id].bcch_active = 0; eNB_mac_inst[Mod_id].bcch_active = 0;
......
...@@ -65,6 +65,10 @@ ...@@ -65,6 +65,10 @@
#endif #endif
#include "pdcp.h" #include "pdcp.h"
#if defined(ENABLE_ITTI)
# include "intertask_interface.h"
#endif
#define DEBUG_HEADER_PARSING 1 #define DEBUG_HEADER_PARSING 1
#define ENABLE_MAC_PAYLOAD_DEBUG #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 ...@@ -1273,9 +1277,35 @@ UE_L2_STATE_t ue_scheduler(u8 Mod_id,u32 frame, u8 subframe, lte_subframe_t dire
// s8 lcg_id; // s8 lcg_id;
struct RACH_ConfigCommon *rach_ConfigCommon = (struct RACH_ConfigCommon *)NULL; struct RACH_ConfigCommon *rach_ConfigCommon = (struct RACH_ConfigCommon *)NULL;
int ret; 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); 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; //Mac_rlc_xface->frame=frame;
//Rrc_xface->Frame_index=Mac_rlc_xface->frame; //Rrc_xface->Frame_index=Mac_rlc_xface->frame;
//if (subframe%5 == 0) //if (subframe%5 == 0)
......
...@@ -477,7 +477,7 @@ void pdcp_run (u32_t frame, u8 eNB_flag, u8 UE_index, u8 eNB_index) { ...@@ -477,7 +477,7 @@ void pdcp_run (u32_t frame, u8 eNB_flag, u8 UE_index, u8 eNB_index) {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
MessageDef *msg_p; MessageDef *msg_p;
char *msg_name; const char *msg_name;
instance_t instance; instance_t instance;
#endif #endif
...@@ -500,7 +500,7 @@ void pdcp_run (u32_t frame, u8 eNB_flag, u8 UE_index, u8 eNB_index) { ...@@ -500,7 +500,7 @@ void pdcp_run (u32_t frame, u8 eNB_flag, u8 UE_index, u8 eNB_index) {
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
do { do {
// Checks if a message has been sent to PDCP sub-task // 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) { if (msg_p != NULL) {
msg_name = ITTI_MSG_NAME (msg_p); 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) { ...@@ -523,7 +523,7 @@ void pdcp_run (u32_t frame, u8 eNB_flag, u8 UE_index, u8 eNB_index) {
break; break;
default: 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; break;
} }
......
...@@ -95,8 +95,10 @@ s8 mac_rrc_data_req(u8 Mod_id, u32 frame, u16 Srb_id, u8 Nb_tb,u8 *Buffer,u8 eNB ...@@ -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)); return(mac_rrc_lite_data_req(Mod_id,frame,Srb_id,Nb_tb,Buffer,eNB_flag,eNB_index,mbsfn_sync_area));
#endif //CELLULAR #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){ 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 #ifdef CELLULAR
return(rrc_L2_mac_data_ind_rx(Mod_id, Srb_id, Sdu, Sdu_len, eNB_index)); return(rrc_L2_mac_data_ind_rx(Mod_id, Srb_id, Sdu, Sdu_len, eNB_index));
#else #else
......
...@@ -85,7 +85,27 @@ s8 mac_rrc_lite_data_req(u8 Mod_id, u32 frame, u16 Srb_id, u8 Nb_tb, u8 *Buffer, ...@@ -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(""); mac_xface->macphy_exit("");
} }
if ((frame%2) == 0) { 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 #ifdef DEBUG_RRC
LOG_D(RRC,"[eNB %d] Frame %d : BCCH request => SIB 1\n",Mod_id,frame); 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++) 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, ...@@ -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 } // All RFN mod 8 transmit SIB2-3 in SF 5
else if ((frame%8) == 1){ else if ((frame%8) == 1){
memcpy(&Buffer[0],eNB_rrc_inst[Mod_id].SIB23,eNB_rrc_inst[Mod_id].sizeof_SIB23); 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 #ifdef DEBUG_RRC
LOG_D(RRC,"[eNB %d] Frame %d BCCH request => SIB 2-3\n",Mod_id,frame); 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++) 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 ...@@ -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); message_buffer = malloc (sdu_size);
memcpy (message_buffer, Sdu, 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).frame = frame;
RRC_MAC_BCCH_DATA_IND (message_p).sdu_size = sdu_size; RRC_MAC_BCCH_DATA_IND (message_p).sdu_size = sdu_size;
RRC_MAC_BCCH_DATA_IND (message_p).sdu_p = message_buffer; 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 ...@@ -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); message_buffer = malloc (sdu_size);
memcpy (message_buffer, Sdu, 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).frame = frame;
RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = sdu_size; RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = sdu_size;
RRC_MAC_CCCH_DATA_IND (message_p).sdu_p = message_buffer; 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 ...@@ -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); message_buffer = malloc (sdu_size);
memcpy (message_buffer, Sdu, 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).frame = frame;
RRC_MAC_MCCH_DATA_IND (message_p).sdu_size = sdu_size; RRC_MAC_MCCH_DATA_IND (message_p).sdu_size = sdu_size;
RRC_MAC_MCCH_DATA_IND (message_p).sdu_p = message_buffer; 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 ...@@ -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); message_buffer = malloc (sdu_size);
memcpy (message_buffer, Sdu, 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).frame = frame;
RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = sdu_size; RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = sdu_size;
RRC_MAC_CCCH_DATA_IND (message_p).sdu_p = message_buffer; 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 ...@@ -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).sdu_p = message_buffer;
RRC_DCCH_DATA_REQ (message_p).mode = mode; 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. 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 ...@@ -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); message_buffer = malloc (sdu_size);
memcpy (message_buffer, Buffer, 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).frame = frame;
RRC_DCCH_DATA_IND (message_p).dcch_index = DCCH_index; RRC_DCCH_DATA_IND (message_p).dcch_index = DCCH_index;
RRC_DCCH_DATA_IND (message_p).sdu_size = sdu_size; 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) { ...@@ -436,7 +476,7 @@ void rrc_lite_in_sync_ind(u8 Mod_id, u32 frame, u16 eNB_index) {
{ {
MessageDef *message_p; 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).frame = frame;
RRC_MAC_IN_SYNC_IND (message_p).enb_index = eNB_index;