Commit cefa1465 authored by winckel's avatar winckel

Modified ITTI to create one message queue for each task and sub task.

Still only one thread is created by task.

pre-ci ok.

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4350 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent cc7f3775
This diff is collapsed.
......@@ -86,6 +86,12 @@ enum task_priorities {
TASK_PRIORITY_MIN = 10,
};
typedef struct task_info_s {
thread_id_t thread;
/* Printable name */
const char * const name;
} task_info_t;
/** \brief Send a broadcast message to every task
\param message_p Pointer to the message to send
@returns < 0 on failure, 0 otherwise
......@@ -129,12 +135,11 @@ int itti_get_events(task_id_t task_id, struct epoll_event **events);
**/
void itti_receive_msg(task_id_t task_id, MessageDef **received_msg);
/** \brief Try to retrieves a message in the queue associated to task_id and matching requested instance.
/** \brief Try to retrieves a message in the queue associated to task_id.
\param task_id Task ID of the receiving task
\param instance Instance of the task used for virtualization
\param received_msg Pointer to the allocated message
**/
void itti_poll_msg(task_id_t task_id, instance_t instance, MessageDef **received_msg);
void itti_poll_msg(task_id_t task_id, MessageDef **received_msg);
/** \brief Start thread associated to the task
* \param task_id task to start
......
......@@ -29,7 +29,7 @@
*******************************************************************************/
/** @brief Intertask Interface Signal Dumper
* Allows users to connect their itti_debugger to this process and dump
* Allows users to connect their itti_analyzer to this process and dump
* signals exchanged between tasks.
* @author Sebastien Roux <sebastien.roux@eurecom.fr>
*/
......
......@@ -54,11 +54,11 @@ const char * const messages_definition_xml = {
#include "messages_xml.h"
};
/* Map thread id to printable name. */
const char * const threads_name[] = {
"unused",
#define TASK_DEF(tHREADiD, pRIO) #tHREADiD,
#define SUB_TASK_DEF(tHREADiD, sUBtASKiD)
/* Map task id to printable name. */
const task_info_t tasks_info[] = {
{0, "TASK_UNKNOWN"},
#define TASK_DEF(tHREADiD, pRIO) {tHREADiD##_THREAD, #tHREADiD},
#define SUB_TASK_DEF(tHREADiD, sUBtASKiD) {sUBtASKiD##_THREAD, #sUBtASKiD},
#include <tasks_def.h>
#undef SUB_TASK_DEF
#undef TASK_DEF
......@@ -79,7 +79,7 @@ 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,
int itti_init(task_id_t task_max, thread_id_t thread_max, MessagesIds messages_id_max, const task_info_t *tasks_info,
const message_info_t *messages_info, const char * const messages_definition_xml,
const char * const dump_file_name);
......
......@@ -56,12 +56,7 @@
#define TASK_SUB_TASK_ID_LENGTH 8
/* Defines to extract task ID fields */
#define TASK_GET_THREAD_ID(tASKiD) UL_FIELD_EXTRACT(tASKiD, TASK_THREAD_ID_OFFSET, TASK_THREAD_ID_LENGTH)
#define TASK_GET_SUB_TASK_ID(tASKiD) UL_FIELD_EXTRACT(tASKiD, TASK_SUB_TASK_ID_OFFSET, TASK_SUB_TASK_ID_LENGTH)
/* Defines to shift task ID fields */
#define TASK_SHIFT_THREAD_ID(tHREADiD) UL_BIT_SHIFT(tHREADiD, TASK_THREAD_ID_OFFSET)
#define TASK_SHIFT_SUB_TASK_ID(sUBtASKiD) UL_BIT_SHIFT(sUBtASKiD, TASK_SUB_TASK_ID_OFFSET)
#define TASK_GET_THREAD_ID(tASKiD) (itti_desc.tasks_info[tASKiD].thread)
#include <messages_types.h>
......@@ -86,29 +81,31 @@ typedef enum
#undef SUB_TASK_DEF
#undef TASK_DEF
THREAD_MAX, THREAD_END = THREAD_MAX,
THREAD_MAX,
} thread_id_t;
//! Sub-tasks id, to defined offset form thread id
typedef enum
{
#define TASK_DEF(tHREADiD, pRIO) SUB_TASK_INIT_##tHREADiD = 0,
#define SUB_TASK_DEF(tHREADiD, sUBtASKiD) SUB_TASK_OFFSET_##sUBtASKiD,
#define TASK_DEF(tHREADiD, pRIO) tHREADiD##_THREAD = THREAD_##tHREADiD,
#define SUB_TASK_DEF(tHREADiD, sUBtASKiD) sUBtASKiD##_THREAD = THREAD_##tHREADiD,
#include <tasks_def.h>
#undef SUB_TASK_DEF
#undef TASK_DEF
} sub_task_id_t;
} task_thread_id_t;
//! Tasks id of each task
typedef enum
{
#define TASK_DEF(tHREADiD, pRIO) tHREADiD = TASK_SHIFT_THREAD_ID(THREAD_##tHREADiD),
#define SUB_TASK_DEF(tHREADiD, sUBtASKiD) sUBtASKiD = (TASK_SHIFT_THREAD_ID(THREAD_##tHREADiD) | TASK_SHIFT_SUB_TASK_ID(SUB_TASK_OFFSET_##sUBtASKiD)),
TASK_FIRST = 1, TASK_UNKNOWN = 0,
#define TASK_DEF(tHREADiD, pRIO) tHREADiD,
#define SUB_TASK_DEF(tHREADiD, sUBtASKiD) sUBtASKiD,
#include <tasks_def.h>
#undef SUB_TASK_DEF
#undef TASK_DEF
TASK_UNKNOWN = 0xFFFF,
TASK_MAX,
} task_id_t;
typedef union msg_s
......
......@@ -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, NULL));
CHECK_INIT_RETURN(itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info, messages_definition_xml, NULL));
CHECK_INIT_RETURN(nas_init(&mme_config));
CHECK_INIT_RETURN(sctp_init(&mme_config));
......
......@@ -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, NULL));
CHECK_INIT_RETURN(itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info, messages_definition_xml, NULL));
CHECK_INIT_RETURN(nas_init(&mme_config));
CHECK_INIT_RETURN(sctp_init(&mme_config));
......
......@@ -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, NULL));
CHECK_INIT_RETURN(itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info, messages_definition_xml, NULL));
CHECK_INIT_RETURN(udp_init(&mme_config));
CHECK_INIT_RETURN(s11_sgw_init(&mme_config));
......
......@@ -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, NULL);
itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info, messages_definition_xml, NULL);
sctp_init(&mme_config);
udp_init(&mme_config);
s1ap_mme_init(&mme_config);
......
......@@ -4212,7 +4212,7 @@ void eNB_dlsch_ulsch_scheduler(u8 Mod_id,u8 cooperation_flag, u32 frame, u8 subf
#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);
itti_poll_msg (TASK_MAC_ENB, &msg_p);
if (msg_p != NULL) {
msg_name = ITTI_MSG_NAME (msg_p);
......
......@@ -1289,7 +1289,7 @@ UE_L2_STATE_t ue_scheduler(u8 Mod_id,u32 frame, u8 subframe, lte_subframe_t dire
#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);
itti_poll_msg (TASK_MAC_UE, &msg_p);
if (msg_p != NULL) {
msg_name = ITTI_MSG_NAME (msg_p);
......
......@@ -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 (eNB_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, INSTANCE_ALL, &msg_p);
itti_poll_msg (eNB_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, &msg_p);
if (msg_p != NULL) {
msg_name = ITTI_MSG_NAME (msg_p);
......
......@@ -430,7 +430,7 @@ void *l2l1_task(void *args_p) {
#if defined(ENABLE_ITTI)
do {
// Checks if a message has been sent to L2L1 task
itti_poll_msg (TASK_L2L1, INSTANCE_ALL, &message_p);
itti_poll_msg (TASK_L2L1, &message_p);
if (message_p != NULL) {
switch (message_p->header.messageId) {
......@@ -936,7 +936,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, oai_emulation.info.itti_dump_file);
itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info, messages_definition_xml, oai_emulation.info.itti_dump_file);
#endif
#ifdef OPENAIR2
......
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