Commit 6102fa4b authored by Cedric Roux's avatar Cedric Roux

- Fix some performances issues for softmodem

- Remove eventfd if task has only polling mode
- Created dummy thread to convert eventfd from RT thread to non RT threads
- Added eNB app to softmodem
- Set poll mode for itti dumper thread in softmodem
- Disable timers for softmodem

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4545 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 18f113c4
This diff is collapsed.
......@@ -38,6 +38,10 @@
# include <sys/epoll.h>
#endif
#ifdef RTAI
# include <rtai_sem.h>
#endif
#ifndef INTERTASK_INTERFACE_H_
#define INTERTASK_INTERFACE_H_
......@@ -91,6 +95,7 @@ typedef enum task_priorities_e {
typedef struct task_info_s {
thread_id_t thread;
task_id_t parent_task;
task_priorities_t priority;
unsigned int queue_size;
/* Printable name */
......
......@@ -56,9 +56,9 @@ const char * const messages_definition_xml = {
/* Map task id to printable name. */
const task_info_t tasks_info[] = {
{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 },
{0, TASK_UNKNOWN, 0, 0, "TASK_UNKNOWN"},
#define TASK_DEF(tHREADiD, pRIO, qUEUEsIZE) { tHREADiD##_THREAD, TASK_UNKNOWN, pRIO, qUEUEsIZE, #tHREADiD },
#define SUB_TASK_DEF(tHREADiD, sUBtASKiD, qUEUEsIZE) { sUBtASKiD##_THREAD, tHREADiD##_THREAD, 0, qUEUEsIZE, #sUBtASKiD },
#include <tasks_def.h>
#undef SUB_TASK_DEF
#undef TASK_DEF
......
......@@ -57,6 +57,7 @@
/* Defines to extract task ID fields */
#define TASK_GET_THREAD_ID(tASKiD) (itti_desc.tasks_info[tASKiD].thread)
#define TASK_GET_PARENT_TASK_ID(tASKiD) (itti_desc.tasks_info[tASKiD].parent_task)
/* Extract the instance from a message */
#define ITTI_MESSAGE_GET_INSTANCE(mESSAGE) ((mESSAGE)->ittiMsgHeader.instance)
......
......@@ -80,6 +80,7 @@ do { \
int timer_handle_signal(siginfo_t *info)
{
#if !defined(RTAI)
struct timer_elm_s *timer_p;
MessageDef *message_p;
timer_has_expired_t *timer_expired_p;
......@@ -121,6 +122,7 @@ int timer_handle_signal(siginfo_t *info)
free(message_p);
return -1;
}
#endif
return 0;
}
......@@ -134,6 +136,7 @@ int timer_setup(
void *timer_arg,
long *timer_id)
{
#if !defined(RTAI)
struct sigevent se;
struct itimerspec its;
struct timer_elm_s *timer_p;
......@@ -201,14 +204,16 @@ int timer_setup(
pthread_mutex_lock(&timer_desc.timer_list_mutex);
STAILQ_INSERT_TAIL(&timer_desc.timer_queue, timer_p, entries);
pthread_mutex_unlock(&timer_desc.timer_list_mutex);
#endif
return 0;
}
int timer_remove(long timer_id)
{
struct timer_elm_s *timer_p;
int rc = 0;
#if !defined(RTAI)
struct timer_elm_s *timer_p;
TMR_DEBUG("Removing timer 0x%lx\n", timer_id);
......@@ -231,6 +236,7 @@ int timer_remove(long timer_id)
}
free(timer_p);
timer_p = NULL;
#endif
return rc;
}
......
......@@ -4,7 +4,7 @@ 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, 10)
TASK_DEF(TASK_L2L1, TASK_PRIORITY_MAX_LEAST, 1000)
//// Layer 2 and Layer 1 sub-tasks
SUB_TASK_DEF(TASK_L2L1, TASK_PDCP_UE, 200)
SUB_TASK_DEF(TASK_L2L1, TASK_PDCP_ENB, 200)
......
......@@ -79,7 +79,13 @@ const char* eurecomVariablesNames[] = {
"frame_number",
"slot_number",
"daq_mbox",
"diff2"
"diff2",
"itti_send_msg",
"itti_send_msg_end",
"itti_poll_msg",
"itti_poll_msg_end",
"itti_recv_msg",
"itti_recv_msg_end"
};
const char* eurecomFunctionsNames[] = {
......@@ -154,6 +160,7 @@ const char* eurecomFunctionsNames[] = {
"phy_eNB_dlsch_scramblig",
"pdcp_apply_security",
"pdcp_validate_security",
"itti_dump_enqueue_message",
"test"
};
......
......@@ -49,6 +49,12 @@ typedef enum
VCD_SIGNAL_DUMPER_VARIABLES_SLOT_NUMBER,
VCD_SIGNAL_DUMPER_VARIABLES_DAQ_MBOX,
VCD_SIGNAL_DUMPER_VARIABLES_DIFF,
VCD_SIGNAL_DUMPER_VARIABLE_ITTI_SEND_MSG,
VCD_SIGNAL_DUMPER_VARIABLE_ITTI_SEND_MSG_END,
VCD_SIGNAL_DUMPER_VARIABLE_ITTI_POLL_MSG,
VCD_SIGNAL_DUMPER_VARIABLE_ITTI_POLL_MSG_END,
VCD_SIGNAL_DUMPER_VARIABLE_ITTI_RECV_MSG,
VCD_SIGNAL_DUMPER_VARIABLE_ITTI_RECV_MSG_END,
VCD_SIGNAL_DUMPER_VARIABLES_LAST,
VCD_SIGNAL_DUMPER_VARIABLES_END = VCD_SIGNAL_DUMPER_VARIABLES_LAST,
} vcd_signal_dump_variables;
......@@ -116,8 +122,8 @@ typedef enum
VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_UE_DECODE_SIB1,
VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_UE_DECODE_SI,
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_UE_CONFIG_SIB2,
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_UE_COMPUTE_PRACH,
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_ULSCH_DECODING,
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_UE_COMPUTE_PRACH,
VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_ULSCH_DECODING,
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_MODULATION,
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_ENCODING,
VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_SCRAMBLING,
......@@ -126,6 +132,7 @@ typedef enum
VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_SCRAMBLING,
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_APPLY_SECURITY,
VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_VALIDATE_SECURITY,
VCD_SIGNAL_DUMPER_FUNCTIONS_ITTI_DUMP_ENQUEUE_MESSAGE,
VCD_SIGNAL_DUMPER_FUNCTIONS_TEST,
VCD_SIGNAL_DUMPER_FUNCTIONS_LAST,
VCD_SIGNAL_DUMPER_FUNCTIONS_END = VCD_SIGNAL_DUMPER_FUNCTIONS_LAST,
......
......@@ -98,7 +98,7 @@ CFLAGS += -DOPENAIR2 -DNO_RRM -DPUCCH -DMAC_CONTEXT=1
endif
ifdef ENABLE_ITTI
OBJ += $(UTILS_OBJS)
RTAI_OBJ += $(UTILS_OBJS)
endif
CFLAGS += $(L2_incl) $(UTIL_incl) $(UTILS_incl)
......@@ -174,6 +174,12 @@ $(LFDS_LIB):
$(RTAI_OBJ): %.o : %.c
@echo Compiling $< ...
@$(CC) -c $(CFLAGS) $(EXTRA_CFLAGS) $(RTAI_CFLAGS) -o $@ $<
@$(CC) -MM $(CFLAGS) $(EXTRA_CFLAGS) $(RTAI_CFLAGS) $< > $*.d
@mv -f $*.d $*.d.tmp
@sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d
@sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \
sed -e 's/^ *//' -e 's/$$/:/' >> $*.d
@rm -f $*.d.tmp
ifdef ENABLE_ITTI
$(OBJ) $(RTAI_OBJ): $(ITTI_MESSAGES_H)
......@@ -201,7 +207,7 @@ synctest: $(OBJ) $(ASN1_MSG_OBJS1) $(RTAI_OBJ)
lte-softmodem: $(OBJ) $(ASN1_MSG_OBJS1) $(RTAI_OBJ) $(SHARED_DEPENDENCIES)
@echo Linking $@
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(OBJ) $(RTAI_OBJ) $(ASN1_MSG_OBJS1) -o lte-softmodem $(LDFLAGS) $(LIBS)
@$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(OBJ) $(RTAI_OBJ) $(ASN1_MSG_OBJS1) -o lte-softmodem $(LDFLAGS) $(LIBS)
lte-softmodem-usrp: $(OBJ) $(ASN1_MSG_OBJS1) $(RTAI_OBJ) $(USRP_OBJ) $(SHARED_DEPENDENCIES)
@echo Linking $@
......
......@@ -52,6 +52,7 @@
#include <getopt.h>
#include "rt_wrapper.h"
#include "assertions.h"
#ifdef EMOS
#include <gps.h>
......@@ -148,7 +149,7 @@ exmimo_config_t *p_exmimo_config;
exmimo_id_t *p_exmimo_id;
volatile unsigned int *DAQ_MBOX;
int oai_exit = 0;
volatile int oai_exit = 0;
//int time_offset[4] = {-138,-138,-138,-138};
//int time_offset[4] = {-145,-145,-145,-145};
......@@ -456,6 +457,32 @@ void *emos_thread (void *arg)
}
#endif
#if defined(ENABLE_ITTI)
void *dummy_l2l1_task(void *arg)
{
ssize_t ret = 0;
MessageDef *received_msg;
itti_mark_task_ready(TASK_L2L1);
while (!oai_exit)
{
usleep(100);
do {
itti_poll_msg(TASK_L2L1, &received_msg);
if (received_msg != NULL) {
itti_send_msg_to_task(ITTI_MSG_DESTINATION_ID(received_msg),
ITTI_MSG_INSTANCE(received_msg),
received_msg);
}
} while(received_msg != NULL);
}
return NULL;
}
#endif
/* This is the main eNB thread. It gets woken up by the kernel driver using the RTAI message mechanism (rt_send and rt_receive). */
static void *eNB_thread(void *arg)
{
......@@ -510,8 +537,12 @@ static void *eNB_thread(void *arg)
// at the eNB, even slots have double as much time since most of the processing is done here and almost nothing in odd slots
LOG_D(HW,"eNB Frame %d, time %llu: missed slot, proceeding with next one (slot %d, hw_slot %d, diff %d)\n",frame, rt_get_time_ns(), slot, hw_slot, diff);
slot++;
if (frame>0)
if (frame>0) {
oai_exit=1;
#if defined(ENABLE_ITTI)
itti_send_terminate_message(TASK_L2L1);
#endif
}
if (slot==20){
slot=0;
frame++;
......@@ -915,84 +946,75 @@ static void *UE_thread(void *arg)
return 0;
}
/* DUmmy l2l1 task */
void *l2l1_task(void *args_p) {
#if defined(ENABLE_ITTI)
MessageDef *message_p;
itti_mark_task_ready (TASK_L2L1);
# if defined(ENABLE_USE_MME)
/* Trying to register each eNB */
void *eNB_app_task(void *args_p)
{
#if defined(ENABLE_ITTI) && defined(ENABLE_USE_MME)
MessageDef *message_p;
char *mme_address_v4;
char *mme_address_v6 = "2001:660:5502:12:30da:829a:2343:b6cf";
s1ap_register_eNB_t *s1ap_register_eNB;
uint32_t hash;
if (EPC_MODE_ENABLED)
{
char *mme_address_v4;
char *mme_address_v6 = "2001:660:5502:12:30da:829a:2343:b6cf";
s1ap_register_eNB_t *s1ap_register_eNB;
uint32_t hash;
if (EPC_MODE_ENABLED)
{
mme_address_v4 = EPC_MODE_MME_ADDRESS;
}
else
{
mme_address_v4 = "192.168.12.87";
}
/* FIXME: following parameters should be setup by eNB applicative layer ? */
message_p = itti_alloc_new_message(TASK_L2L1, S1AP_REGISTER_ENB);
s1ap_register_eNB = &message_p->ittiMsg.s1ap_register_eNB;
hash = s1ap_generate_eNB_id();
/* Some default/random parameters */
s1ap_register_eNB->eNB_id = eNB_id + (hash & 0xFFFF8);
s1ap_register_eNB->cell_type = CELL_MACRO_ENB;
s1ap_register_eNB->tac = 0;
s1ap_register_eNB->mcc = 208;
s1ap_register_eNB->mnc = 34;
s1ap_register_eNB->default_drx = PAGING_DRX_256;
s1ap_register_eNB->nb_mme = 1;
s1ap_register_eNB->mme_ip_address[0].ipv4 = 1;
s1ap_register_eNB->mme_ip_address[0].ipv6 = 0;
memcpy(s1ap_register_eNB->mme_ip_address[0].ipv4_address, mme_address_v4,
strlen(mme_address_v4));
memcpy(s1ap_register_eNB->mme_ip_address[0].ipv6_address, mme_address_v6,
strlen(mme_address_v6));
itti_send_msg_to_task(TASK_S1AP, eNB_id, message_p);
mme_address_v4 = EPC_MODE_MME_ADDRESS;
}
else
{
mme_address_v4 = "192.168.12.87";
}
# endif
#endif
#if defined(ENABLE_ITTI)
while (1) {
// Checks if a message has been sent to L2L1 task
itti_receive_msg (TASK_L2L1, &message_p);
if (message_p != NULL) {
switch (ITTI_MSG_ID(message_p)) {
case TERMINATE_MESSAGE:
itti_exit_task ();
break;
case MESSAGE_TEST:
LOG_D(EMU, "Received %s\n", ITTI_MSG_NAME(message_p));
break;
default:
LOG_E(EMU, "Received unexpected message %s\n", ITTI_MSG_NAME(message_p));
break;
}
/* FIXME: following parameters should be setup by eNB applicative layer ? */
message_p = itti_alloc_new_message(TASK_ENB_APP, S1AP_REGISTER_ENB);
s1ap_register_eNB = &message_p->ittiMsg.s1ap_register_eNB;
hash = s1ap_generate_eNB_id();
/* Some default/random parameters */
s1ap_register_eNB->eNB_id = eNB_id + (hash & 0xFFFF8);
s1ap_register_eNB->cell_type = CELL_MACRO_ENB;
s1ap_register_eNB->tac = 0;
s1ap_register_eNB->mcc = 208;
s1ap_register_eNB->mnc = 34;
s1ap_register_eNB->default_drx = PAGING_DRX_256;
s1ap_register_eNB->nb_mme = 1;
s1ap_register_eNB->mme_ip_address[0].ipv4 = 1;
s1ap_register_eNB->mme_ip_address[0].ipv6 = 0;
memcpy(s1ap_register_eNB->mme_ip_address[0].ipv4_address, mme_address_v4,
strlen(mme_address_v4));
memcpy(s1ap_register_eNB->mme_ip_address[0].ipv6_address, mme_address_v6,
strlen(mme_address_v6));
itti_send_msg_to_task(TASK_S1AP, eNB_id, message_p);
itti_mark_task_ready (TASK_ENB_APP); // at the end of init for the current task
do {
// Checks if a message has been sent to L2L1 task
itti_receive_msg (TASK_ENB_APP, &message_p);
if (message_p != NULL) {
switch (ITTI_MSG_ID(message_p)) {
case TERMINATE_MESSAGE:
itti_exit_task ();
break;
case MESSAGE_TEST:
LOG_D(EMU, "Received %s\n", ITTI_MSG_NAME(message_p));
break;
default:
LOG_E(EMU, "Received unexpected message %s\n", ITTI_MSG_NAME(message_p));
break;
}
free (message_p);
}
}
free (message_p);
}
} while(1);
#endif
return NULL;
return NULL;
}
int main(int argc, char **argv) {
......@@ -1205,6 +1227,13 @@ int main(int argc, char **argv) {
// initialize the log (see log.h for details)
logInit();
if (ouput_vcd) {
if (UE_flag==1)
vcd_signal_dumper_init("/tmp/openair_dump_UE.vcd");
else
vcd_signal_dumper_init("/tmp/openair_dump_eNB.vcd");
}
#if defined(ENABLE_ITTI)
itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info, messages_definition_xml, itti_dump_file);
......@@ -1219,25 +1248,23 @@ int main(int argc, char **argv) {
LOG_D(EMU, "Initializing S1AP task interface: FAILED\n");
return -1;
}
# endif
if (itti_create_task(TASK_L2L1, l2l1_task, NULL) < 0) {
if (itti_create_task(TASK_ENB_APP, eNB_app_task, NULL) < 0) {
LOG_E(EMU, "Create task failed");
LOG_D(EMU, "Initializing L2L1 task interface: FAILED\n");
LOG_D(EMU, "Initializing eNB APP task interface: FAILED\n");
return -1;
}
# endif
if (itti_create_task(TASK_L2L1, dummy_l2l1_task, NULL) < 0) {
LOG_E(EMU, "Create task failed");
LOG_D(EMU, "Initializing L2L1 task interface: FAILED\n");
return -1;
}
// Handle signals until all tasks are terminated
// itti_wait_tasks_end();
#endif
if (ouput_vcd) {
if (UE_flag==1)
vcd_signal_dumper_init("/tmp/openair_dump_UE.vcd");
else
vcd_signal_dumper_init("/tmp/openair_dump_eNB.vcd");
}
#ifdef NAS_NETLINK
netlink_init();
#endif
......@@ -1419,7 +1446,12 @@ int main(int argc, char **argv) {
g_log->log_component[OTG].flag = LOG_HIGH;
g_log->log_component[RRC].level = LOG_INFO;
g_log->log_component[RRC].flag = LOG_HIGH;
#if defined(ENABLE_ITTI) && defined(ENABLE_USE_MME)
g_log->log_component[S1AP].level = LOG_INFO;
g_log->log_component[S1AP].flag = LOG_HIGH;
g_log->log_component[SCTP].level = LOG_INFO;
g_log->log_component[SCTP].flag = LOG_HIGH;
#endif
PHY_vars_eNB_g = malloc(sizeof(PHY_VARS_eNB*));
PHY_vars_eNB_g[0] = init_lte_eNB(frame_parms,eNB_id,Nid_cell,cooperation_flag,transmission_mode,abstraction_flag);
......
......@@ -485,10 +485,9 @@ void *eNB_app_task(void *args_p) {
} while(1);
itti_terminate_tasks(TASK_ENB_APP);
#endif
return NULL;
#endif
return NULL;
}
void *l2l1_task(void *args_p) {
......
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