Commit 8f897e06 authored by winckel's avatar winckel

Added on UE side NAS controlled L2L1 start.

Saved parameters of NAS_CELL_SELECTION_REQ.

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4691 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 90410a00
......@@ -40,15 +40,16 @@
# define NAS_UE_AUTOSTART 1
extern unsigned char NB_eNB_INST;
extern unsigned char NB_UE_INST;
static int user_fd;
static int nas_ue_process_events(struct epoll_event *events, int nb_events, unsigned int Mod_id)
static int nas_ue_process_events(struct epoll_event *events, int nb_events)
{
int event;
int exit_loop = FALSE;
LOG_I(NAS, "[UE %d] Received %d events\n", Mod_id, nb_events);
LOG_I(NAS, "[UE] Received %d events\n", nb_events);
for (event = 0; event < nb_events; event++) {
if (events[event].events != 0)
......@@ -57,7 +58,7 @@ static int nas_ue_process_events(struct epoll_event *events, int nb_events, unsi
if (events[event].data.fd == user_fd) {
exit_loop = nas_user_receive_and_process(&user_fd);
} else {
LOG_E(NAS, "[UE %d] Received an event from an unknown fd %d!\n", Mod_id, events[event].data.fd);
LOG_E(NAS, "[UE] Received an event from an unknown fd %d!\n", events[event].data.fd);
}
}
}
......@@ -92,6 +93,19 @@ void *nas_ue_task(void *args_p) {
nas_user_initialize (&user_api_emm_callback, &user_api_esm_callback, FIRMWARE_VERSION);
}
/* Set UE activation state */
for (instance = NB_eNB_INST; instance < (NB_eNB_INST + NB_UE_INST); instance++)
{
MessageDef *message_p;
#if (NAS_UE_AUTOSTART == 0)
message_p = itti_alloc_new_message(TASK_NAS_UE, DEACTIVATE_MESSAGE);
#else
message_p = itti_alloc_new_message(TASK_NAS_UE, ACTIVATE_MESSAGE);
#endif
itti_send_msg_to_task(TASK_L2L1, instance, message_p);
}
while(1) {
// Wait for a message or an event
itti_receive_msg (TASK_NAS_UE, &msg_p);
......@@ -104,8 +118,8 @@ void *nas_ue_task(void *args_p) {
switch (ITTI_MSG_ID(msg_p)) {
case INITIALIZE_MESSAGE:
LOG_I(NAS, "[UE %d] Received %s\n", Mod_id, msg_name);
#if defined(NAS_UE_AUTOSTART)
#endif
#if (NAS_UE_AUTOSTART != 0)
#endif
break;
case TERMINATE_MESSAGE:
......@@ -132,8 +146,8 @@ void *nas_ue_task(void *args_p) {
nb_events = itti_get_events(TASK_NAS_UE, &events);
if ((nb_events > 0) && (events != NULL)) {
if (nas_ue_process_events(events, nb_events, Mod_id) == TRUE) {
LOG_E(NAS, "[UE %d] Received exit loop\n", Mod_id);
if (nas_ue_process_events(events, nb_events) == TRUE) {
LOG_E(NAS, "[UE] Received exit loop\n");
}
}
}
......
......@@ -86,6 +86,10 @@
# include "intertask_interface.h"
#endif
#if defined(ENABLE_USE_MME)
# include "commonDef.h"
#endif
/** @defgroup _rrc_impl_ RRC Layer Reference Implementation
* @ingroup _ref_implementation_
* @{
......@@ -347,6 +351,10 @@ typedef struct OAI_UECapability_s {
typedef struct UE_RRC_INST_s {
RRC_STATE_t RrcState;
# if defined(ENABLE_USE_MME)
plmn_t plmnID;
Byte_t rat;
# endif
uint8_t *UECapability;
uint8_t UECapability_size;
UE_RRC_INFO Info[NB_SIG_CNX_UE];
......
......@@ -2508,12 +2508,25 @@ void *rrc_ue_task(void *args_p) {
LOG_I(RRC, "[UE %d] Received %s: state %d, plmnID %d, rat %x\n", Mod_id, msg_name, UE_rrc_inst[Mod_id].RrcState,
NAS_CELL_SELECTION_REQ (msg_p).plmnID, NAS_CELL_SELECTION_REQ (msg_p).rat);
/* Save cell selection criterion */
{
UE_rrc_inst[Mod_id].plmnID = NAS_CELL_SELECTION_REQ (msg_p).plmnID;
UE_rrc_inst[Mod_id].rat = NAS_CELL_SELECTION_REQ (msg_p).rat;
}
switch (UE_rrc_inst[Mod_id].RrcState) {
case RRC_STATE_INACTIVE:
{
/* Need to first activate lower layers */
MessageDef *message_p;
message_p = itti_alloc_new_message(TASK_RRC_UE, ACTIVATE_MESSAGE);
itti_send_msg_to_task(TASK_L2L1, NB_eNB_INST + Mod_id, message_p);
UE_rrc_inst[Mod_id].RrcState = RRC_STATE_IDLE;
break;
}
case RRC_STATE_IDLE:
/* Ask to layer 1 to find a cell matching the criterion */
......@@ -2552,6 +2565,7 @@ void *rrc_ue_task(void *args_p) {
pdcp_rrc_data_req (instance, 0 /* TODO put frame number ! */, 0, DCCH, rrc_mui++, 0, length, buffer, 1);
break;
}
# endif
case RRC_RAL_SCAN_REQ:
{
......@@ -2573,7 +2587,6 @@ void *rrc_ue_task(void *args_p) {
{
LOG_I(RRC, "[UE %d] Received %s\n", Mod_id, msg_name);
}
# endif
default:
LOG_E(RRC, "[UE %d] Received unexpected message %s\n", Mod_id, msg_name);
......
......@@ -285,6 +285,16 @@ int log_thread_finalize() {
return err;
}
#if defined(ENABLE_ITTI)
static void set_cli_start(uint8_t instance, uint8_t start) {
if (instance < NB_eNB_INST) {
oai_emulation.info.cli_start_enb[instance] = start;
} else {
oai_emulation.info.cli_start_ue[instance - NB_eNB_INST] = start;
}
}
#endif
#ifdef OPENAIR2
int omv_write(int pfd, Node_list enb_node_list, Node_list ue_node_list, Data_Flow_Unit omv_data) {
int i, j;
......@@ -478,6 +488,14 @@ void *l2l1_task(void *args_p) {
case INITIALIZE_MESSAGE:
break;
case ACTIVATE_MESSAGE:
set_cli_start(ITTI_MSG_INSTANCE (message_p), 1);
break;
case DEACTIVATE_MESSAGE:
set_cli_start(ITTI_MSG_INSTANCE (message_p), 0);
break;
case TERMINATE_MESSAGE:
itti_exit_task ();
break;
......@@ -500,6 +518,14 @@ void *l2l1_task(void *args_p) {
if (message_p != NULL) {
switch (ITTI_MSG_ID(message_p)) {
case ACTIVATE_MESSAGE:
set_cli_start(ITTI_MSG_INSTANCE (message_p), 1);
break;
case DEACTIVATE_MESSAGE:
set_cli_start(ITTI_MSG_INSTANCE (message_p), 0);
break;
case TERMINATE_MESSAGE:
itti_exit_task ();
break;
......@@ -650,13 +676,14 @@ void *l2l1_task(void *args_p) {
clear_UE_transport_info (oai_emulation.info.nb_ue_local);
for (UE_id = oai_emulation.info.first_ue_local;
(UE_id < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local))
&& (oai_emulation.info.cli_start_ue[UE_id] == 1); UE_id++) {
(UE_id < (oai_emulation.info.first_ue_local + oai_emulation.info.nb_ue_local)); UE_id++) {
if (oai_emulation.info.cli_start_ue[UE_id] != 0) {
#if defined(ENABLE_ITTI) && defined(ENABLE_USE_MME)
{
#else
if (frame >= (UE_id * 20)) { // activate UE only after 20*UE_id frames so that different UEs turn on separately
LOG_D(
EMU,
"PHY procedures UE %d for frame %d, slot %d (subframe TX %d, RX %d)\n", UE_id, frame, slot, next_slot >> 1, last_slot>>1);
#endif
LOG_D(EMU, "PHY procedures UE %d for frame %d, slot %d (subframe TX %d, RX %d)\n", UE_id, frame, slot, next_slot >> 1, last_slot>>1);
if (PHY_vars_UE_g[UE_id]->UE_mode[0] != NOT_SYNCHED) {
if (frame > 0) {
......@@ -713,6 +740,7 @@ void *l2l1_task(void *args_p) {
#endif
}
}
}
#ifdef Rel10
for (RN_id=oai_emulation.info.first_rn_local;
RN_id<oai_emulation.info.first_rn_local+oai_emulation.info.nb_rn_local;
......
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