From b5afe14d1325d4df553f812e8ba7375d4bf23dc6 Mon Sep 17 00:00:00 2001 From: winckel <winckel@eurecom.fr> Date: Fri, 8 Nov 2013 13:05:38 +0000 Subject: [PATCH] Replaced global ITTI queue size limit with a by task size limit. git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4352 818b1a75-f10b-46b9-bf7c-635c3b92a50f --- common/utils/itti/intertask_interface.c | 11 +++---- common/utils/itti/intertask_interface.h | 12 ++++--- common/utils/itti/intertask_interface_init.h | 6 ++-- common/utils/itti/intertask_interface_types.h | 12 +++---- common/utils/itti/tasks_def.h | 2 +- openair-cn/COMMON/intertask_interface_conf.h | 2 +- openair-cn/COMMON/tasks_def.h | 22 ++++++------- openair2/COMMON/intertask_interface_conf.h | 2 +- openair2/COMMON/tasks_def.h | 32 +++++++++---------- 9 files changed, 50 insertions(+), 51 deletions(-) diff --git a/common/utils/itti/intertask_interface.c b/common/utils/itti/intertask_interface.c index d09110d442..5b042baf12 100644 --- a/common/utils/itti/intertask_interface.c +++ b/common/utils/itti/intertask_interface.c @@ -250,9 +250,8 @@ int itti_send_msg_to_task(task_id_t task_id, instance_t instance, MessageDef *me pthread_mutex_lock (&itti_desc.tasks[task_id].message_queue_mutex); /* Check the number of messages in the queue */ - DevCheck((itti_desc.tasks[task_id].message_in_queue * sizeof(MessageDef)) < ITTI_QUEUE_SIZE_PER_TASK, - (itti_desc.tasks[task_id].message_in_queue * sizeof(MessageDef)), ITTI_QUEUE_SIZE_PER_TASK, - itti_desc.tasks[task_id].message_in_queue); + DevCheck(itti_desc.tasks[task_id].message_in_queue < itti_desc.tasks_info[task_id].queue_size, + task_id, itti_desc.tasks[task_id].message_in_queue, itti_desc.tasks_info[task_id].queue_size); #endif /* Allocate new list element */ @@ -604,10 +603,8 @@ int itti_init(task_id_t task_max, thread_id_t thread_max, MessagesIds messages_i for (i = TASK_FIRST; i < itti_desc.task_max; i++) { #if defined(ENABLE_EVENT_FD) - ITTI_DEBUG("Creating queue of message of size %u\n", - ITTI_QUEUE_SIZE_PER_TASK / (sizeof(MessageDef) + sizeof(struct message_list_s))); - if (lfds611_queue_new(&itti_desc.tasks[i].message_queue, - ITTI_QUEUE_SIZE_PER_TASK / (sizeof(MessageDef) + sizeof(struct message_list_s))) < 0) + ITTI_DEBUG("Creating queue of message of size %u\n", itti_desc.tasks_info[i].queue_size); + if (lfds611_queue_new(&itti_desc.tasks[i].message_queue, itti_desc.tasks_info[i].queue_size) < 0) { ITTI_ERROR("lfds611_queue_new failed for task %u\n", i); DevAssert(0 == 1); diff --git a/common/utils/itti/intertask_interface.h b/common/utils/itti/intertask_interface.h index f046fc1060..1a217556e8 100644 --- a/common/utils/itti/intertask_interface.h +++ b/common/utils/itti/intertask_interface.h @@ -57,7 +57,7 @@ typedef unsigned long message_number_t; #define MESSAGE_NUMBER_SIZE (sizeof(unsigned long)) -enum message_priorities { +typedef enum message_priorities_e { MESSAGE_PRIORITY_MAX = 100, MESSAGE_PRIORITY_MAX_LEAST = 85, MESSAGE_PRIORITY_MED_PLUS = 70, @@ -65,18 +65,18 @@ enum message_priorities { MESSAGE_PRIORITY_MED_LEAST = 40, MESSAGE_PRIORITY_MIN_PLUS = 25, MESSAGE_PRIORITY_MIN = 10, -}; +} message_priorities_t; typedef struct message_info_s { task_id_t id; - uint32_t priority; + message_priorities_t priority; /* Message payload size */ MessageHeaderSize size; /* Printable name */ const char * const name; } message_info_t; -enum task_priorities { +typedef enum task_priorities_e { TASK_PRIORITY_MAX = 100, TASK_PRIORITY_MAX_LEAST = 85, TASK_PRIORITY_MED_PLUS = 70, @@ -84,10 +84,12 @@ enum task_priorities { TASK_PRIORITY_MED_LEAST = 40, TASK_PRIORITY_MIN_PLUS = 25, TASK_PRIORITY_MIN = 10, -}; +} task_priorities_t; typedef struct task_info_s { thread_id_t thread; + task_priorities_t priority; + unsigned int queue_size; /* Printable name */ const char * const name; } task_info_t; diff --git a/common/utils/itti/intertask_interface_init.h b/common/utils/itti/intertask_interface_init.h index 70a88ad3e2..9fd6bb3858 100644 --- a/common/utils/itti/intertask_interface_init.h +++ b/common/utils/itti/intertask_interface_init.h @@ -56,9 +56,9 @@ const char * const messages_definition_xml = { /* 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}, + {0, 0, 0, "TASK_UNKNOWN"}, +#define TASK_DEF(tHREADiD, pRIO, qUEUEsIZE) { tHREADiD##_THREAD, pRIO, qUEUEsIZE, #tHREADiD }, +#define SUB_TASK_DEF(tHREADiD, sUBtASKiD, qUEUEsIZE) { sUBtASKiD##_THREAD, 0, qUEUEsIZE, #sUBtASKiD }, #include <tasks_def.h> #undef SUB_TASK_DEF #undef TASK_DEF diff --git a/common/utils/itti/intertask_interface_types.h b/common/utils/itti/intertask_interface_types.h index 7a22dfd4c4..f7c8d4e582 100644 --- a/common/utils/itti/intertask_interface_types.h +++ b/common/utils/itti/intertask_interface_types.h @@ -75,8 +75,8 @@ typedef enum { THREAD_FIRST = 1, THREAD_NULL = 0, -#define TASK_DEF(tHREADiD, pRIO) THREAD_##tHREADiD, -#define SUB_TASK_DEF(tHREADiD, sUBtASKiD) +#define TASK_DEF(tHREADiD, pRIO, qUEUEsIZE) THREAD_##tHREADiD, +#define SUB_TASK_DEF(tHREADiD, sUBtASKiD, qUEUEsIZE) #include <tasks_def.h> #undef SUB_TASK_DEF #undef TASK_DEF @@ -87,8 +87,8 @@ typedef enum //! Sub-tasks id, to defined offset form thread id typedef enum { -#define TASK_DEF(tHREADiD, pRIO) tHREADiD##_THREAD = THREAD_##tHREADiD, -#define SUB_TASK_DEF(tHREADiD, sUBtASKiD) sUBtASKiD##_THREAD = THREAD_##tHREADiD, +#define TASK_DEF(tHREADiD, pRIO, qUEUEsIZE) tHREADiD##_THREAD = THREAD_##tHREADiD, +#define SUB_TASK_DEF(tHREADiD, sUBtASKiD, qUEUEsIZE) sUBtASKiD##_THREAD = THREAD_##tHREADiD, #include <tasks_def.h> #undef SUB_TASK_DEF #undef TASK_DEF @@ -99,8 +99,8 @@ typedef enum { TASK_FIRST = 1, TASK_UNKNOWN = 0, -#define TASK_DEF(tHREADiD, pRIO) tHREADiD, -#define SUB_TASK_DEF(tHREADiD, sUBtASKiD) sUBtASKiD, +#define TASK_DEF(tHREADiD, pRIO, qUEUEsIZE) tHREADiD, +#define SUB_TASK_DEF(tHREADiD, sUBtASKiD, qUEUEsIZE) sUBtASKiD, #include <tasks_def.h> #undef SUB_TASK_DEF #undef TASK_DEF diff --git a/common/utils/itti/tasks_def.h b/common/utils/itti/tasks_def.h index 09de9ca470..e762a77b9d 100644 --- a/common/utils/itti/tasks_def.h +++ b/common/utils/itti/tasks_def.h @@ -1,4 +1,4 @@ // This task is mandatory and must always be placed in first position -TASK_DEF(TASK_TIMER, TASK_PRIORITY_MED) +TASK_DEF(TASK_TIMER, TASK_PRIORITY_MED, 10) // Dummy file for the generic intertask interface definition. Actual definition should be in top level build directory. diff --git a/openair-cn/COMMON/intertask_interface_conf.h b/openair-cn/COMMON/intertask_interface_conf.h index 0b906a1c44..b58cc716a5 100644 --- a/openair-cn/COMMON/intertask_interface_conf.h +++ b/openair-cn/COMMON/intertask_interface_conf.h @@ -42,8 +42,8 @@ * Intertask Interface Constants ******************************************************************************/ -#define ITTI_QUEUE_SIZE_PER_TASK (5 * 1024 * 1024) /* Limit the queue size to 5M */ #define ITTI_PORT (10007) + /* This is the queue size for signal dumper */ #define ITTI_QUEUE_SIZE_MAX (1 * 1024 * 1024) /* 1 MBytes */ #define ITTI_DUMP_MAX_CON (5) /* Max connections in parallel */ diff --git a/openair-cn/COMMON/tasks_def.h b/openair-cn/COMMON/tasks_def.h index 40461db8ce..d3c626d6ad 100644 --- a/openair-cn/COMMON/tasks_def.h +++ b/openair-cn/COMMON/tasks_def.h @@ -1,25 +1,25 @@ // This task is mandatory and must always be placed in first position -TASK_DEF(TASK_TIMER, TASK_PRIORITY_MED) +TASK_DEF(TASK_TIMER, TASK_PRIORITY_MED, 10) // Other possible tasks in the process /// GTPV1-U task -TASK_DEF(TASK_GTPV1_U, TASK_PRIORITY_MED) +TASK_DEF(TASK_GTPV1_U, TASK_PRIORITY_MED, 200) /// FW_IP task -TASK_DEF(TASK_FW_IP, TASK_PRIORITY_MED) +TASK_DEF(TASK_FW_IP, TASK_PRIORITY_MED, 200) /// MME Applicative task -TASK_DEF(TASK_MME_APP, TASK_PRIORITY_MED) +TASK_DEF(TASK_MME_APP, TASK_PRIORITY_MED, 200) /// NAS task -TASK_DEF(TASK_NAS, TASK_PRIORITY_MED) +TASK_DEF(TASK_NAS, TASK_PRIORITY_MED, 200) /// S1AP task -TASK_DEF(TASK_S11, TASK_PRIORITY_MED) +TASK_DEF(TASK_S11, TASK_PRIORITY_MED, 200) /// S1AP task -TASK_DEF(TASK_S1AP, TASK_PRIORITY_MED) +TASK_DEF(TASK_S1AP, TASK_PRIORITY_MED, 200) /// S6a task -TASK_DEF(TASK_S6A, TASK_PRIORITY_MED) +TASK_DEF(TASK_S6A, TASK_PRIORITY_MED, 200) /// SCTP task -TASK_DEF(TASK_SCTP, TASK_PRIORITY_MED) +TASK_DEF(TASK_SCTP, TASK_PRIORITY_MED, 200) /// Serving and Proxy Gateway Application task -TASK_DEF(TASK_SPGW_APP, TASK_PRIORITY_MED) +TASK_DEF(TASK_SPGW_APP, TASK_PRIORITY_MED, 200) /// UDP task -TASK_DEF(TASK_UDP, TASK_PRIORITY_MED) +TASK_DEF(TASK_UDP, TASK_PRIORITY_MED, 200) diff --git a/openair2/COMMON/intertask_interface_conf.h b/openair2/COMMON/intertask_interface_conf.h index bdf0d51f7e..230e8c90c9 100644 --- a/openair2/COMMON/intertask_interface_conf.h +++ b/openair2/COMMON/intertask_interface_conf.h @@ -42,8 +42,8 @@ * Intertask Interface Constants ******************************************************************************/ -#define ITTI_QUEUE_SIZE_PER_TASK (5 * 1024 * 1024) /* Limit the queue size to 5M */ #define ITTI_PORT (10006) + /* This is the queue size for signal dumper */ #define ITTI_QUEUE_SIZE_MAX (1 * 1024 * 1024) /* 1 MBytes */ #define ITTI_DUMP_MAX_CON (5) /* Max connections in parallel */ diff --git a/openair2/COMMON/tasks_def.h b/openair2/COMMON/tasks_def.h index 8d96472653..0240673682 100644 --- a/openair2/COMMON/tasks_def.h +++ b/openair2/COMMON/tasks_def.h @@ -1,36 +1,36 @@ // This task is mandatory and must always be placed in first position -TASK_DEF(TASK_TIMER, TASK_PRIORITY_MAX) +TASK_DEF(TASK_TIMER, TASK_PRIORITY_MAX, 10) // Other possible tasks in the process /// 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, 10) //// Layer 2 and Layer 1 sub-tasks -SUB_TASK_DEF(TASK_L2L1, TASK_PDCP_UE) -SUB_TASK_DEF(TASK_L2L1, TASK_PDCP_ENB) +SUB_TASK_DEF(TASK_L2L1, TASK_PDCP_UE, 200) +SUB_TASK_DEF(TASK_L2L1, TASK_PDCP_ENB, 200) -SUB_TASK_DEF(TASK_L2L1, TASK_RLC_UE) -SUB_TASK_DEF(TASK_L2L1, TASK_RLC_ENB) +SUB_TASK_DEF(TASK_L2L1, TASK_RLC_UE, 200) +SUB_TASK_DEF(TASK_L2L1, TASK_RLC_ENB, 200) -SUB_TASK_DEF(TASK_L2L1, TASK_MAC_UE) -SUB_TASK_DEF(TASK_L2L1, TASK_MAC_ENB) +SUB_TASK_DEF(TASK_L2L1, TASK_MAC_UE, 200) +SUB_TASK_DEF(TASK_L2L1, TASK_MAC_ENB, 200) -SUB_TASK_DEF(TASK_L2L1, TASK_PHY_UE) -SUB_TASK_DEF(TASK_L2L1, TASK_PHY_ENB) +SUB_TASK_DEF(TASK_L2L1, TASK_PHY_UE, 200) +SUB_TASK_DEF(TASK_L2L1, TASK_PHY_ENB, 200) /// Radio Resource Control task for UE -TASK_DEF(TASK_RRC_UE, TASK_PRIORITY_MED) +TASK_DEF(TASK_RRC_UE, TASK_PRIORITY_MED, 200) /// Radio Resource Control task for eNodeB -TASK_DEF(TASK_RRC_ENB, TASK_PRIORITY_MED) +TASK_DEF(TASK_RRC_ENB, TASK_PRIORITY_MED, 200) /// Bearers Manager task -TASK_DEF(TASK_BM, TASK_PRIORITY_MED) +TASK_DEF(TASK_BM, TASK_PRIORITY_MED, 200) /// Non Access Stratum task for UE -TASK_DEF(TASK_NAS_UE, TASK_PRIORITY_MED) +TASK_DEF(TASK_NAS_UE, TASK_PRIORITY_MED, 200) /// S1ap task for eNodeB -TASK_DEF(TASK_S1AP, TASK_PRIORITY_MED) +TASK_DEF(TASK_S1AP, TASK_PRIORITY_MED, 200) /// Sctp task for eNodeB (Used by both S1AP and X2AP) -TASK_DEF(TASK_SCTP, TASK_PRIORITY_MED) +TASK_DEF(TASK_SCTP, TASK_PRIORITY_MED, 200) -- GitLab