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 */
{
/* Need to first activate lower layers */
MessageDef *message_p;
UE_rrc_inst[Mod_id].RrcState = RRC_STATE_IDLE;
break;
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 */
......@@ -2540,18 +2553,19 @@ void *rrc_ue_task(void *args_p) {
case NAS_UPLINK_DATA_REQ:
{
uint32_t length;
uint8_t *buffer;
uint32_t length;
uint8_t *buffer;
LOG_I(RRC, "[UE %d] Received %s: UEid %d\n", Mod_id, msg_name, NAS_UPLINK_DATA_REQ (msg_p).UEid);
LOG_I(RRC, "[UE %d] Received %s: UEid %d\n", Mod_id, msg_name, NAS_UPLINK_DATA_REQ (msg_p).UEid);
/* Create message for PDCP (ULInformationTransfer_t) */
length = do_ULInformationTransfer(&buffer, NAS_UPLINK_DATA_REQ (msg_p).nasMsg.length, NAS_UPLINK_DATA_REQ (msg_p).nasMsg.data);
/* Create message for PDCP (ULInformationTransfer_t) */
length = do_ULInformationTransfer(&buffer, NAS_UPLINK_DATA_REQ (msg_p).nasMsg.length, NAS_UPLINK_DATA_REQ (msg_p).nasMsg.data);
/* Transfer data to PDCP */
pdcp_rrc_data_req (instance, 0 /* TODO put frame number ! */, 0, DCCH, rrc_mui++, 0, length, buffer, 1);
break;
/* Transfer data to PDCP */
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,67 +676,69 @@ 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++) {
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);
(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
#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) {
PHY_vars_UE_g[UE_id]->frame = frame;
if (PHY_vars_UE_g[UE_id]->UE_mode[0] != NOT_SYNCHED) {
if (frame > 0) {
PHY_vars_UE_g[UE_id]->frame = frame;
#ifdef OPENAIR2
//Application
update_otg_UE (UE_id, oai_emulation.info.time_ms);
//Application
update_otg_UE (UE_id, oai_emulation.info.time_ms);
//Access layer
pdcp_run (frame, 0, UE_id, 0);
//Access layer
pdcp_run (frame, 0, UE_id, 0);
#endif
phy_procedures_UE_lte (last_slot, next_slot, PHY_vars_UE_g[UE_id], 0, abstraction_flag, normal_txrx,
no_relay, NULL);
ue_data[UE_id]->tx_power_dBm = PHY_vars_UE_g[UE_id]->tx_power_dBm;
phy_procedures_UE_lte (last_slot, next_slot, PHY_vars_UE_g[UE_id], 0, abstraction_flag, normal_txrx,
no_relay, NULL);
ue_data[UE_id]->tx_power_dBm = PHY_vars_UE_g[UE_id]->tx_power_dBm;
}
}
}
else {
if (abstraction_flag == 1) {
LOG_E(
EMU,
"sync not supported in abstraction mode (UE%d,mode%d)\n", UE_id, PHY_vars_UE_g[UE_id]->UE_mode[0]);
exit (-1);
}
if ((frame > 0) && (last_slot == (LTE_SLOTS_PER_FRAME - 2))) {
initial_sync (PHY_vars_UE_g[UE_id], normal_txrx);
/*
write_output("dlchan00.m","dlch00",&(PHY_vars_UE_g[0]->lte_ue_common_vars.dl_ch_estimates[0][0][0]),(6*(PHY_vars_UE_g[0]->lte_frame_parms.ofdm_symbol_size)),1,1);
if (PHY_vars_UE_g[0]->lte_frame_parms.nb_antennas_rx>1)
write_output("dlchan01.m","dlch01",&(PHY_vars_UE_g[0]->lte_ue_common_vars.dl_ch_estimates[0][1][0]),(6*(PHY_vars_UE_g[0]->lte_frame_parms.ofdm_symbol_size)),1,1);
write_output("dlchan10.m","dlch10",&(PHY_vars_UE_g[0]->lte_ue_common_vars.dl_ch_estimates[0][2][0]),(6*(PHY_vars_UE_g[0]->lte_frame_parms.ofdm_symbol_size)),1,1);
if (PHY_vars_UE_g[0]->lte_frame_parms.nb_antennas_rx>1)
write_output("dlchan11.m","dlch11",&(PHY_vars_UE_g[0]->lte_ue_common_vars.dl_ch_estimates[0][3][0]),(6*(PHY_vars_UE_g[0]->lte_frame_parms.ofdm_symbol_size)),1,1);
write_output("rxsig.m","rxs",PHY_vars_UE_g[0]->lte_ue_common_vars.rxdata[0],PHY_vars_UE_g[0]->lte_frame_parms.samples_per_tti*10,1,1);
write_output("rxsigF.m","rxsF",PHY_vars_UE_g[0]->lte_ue_common_vars.rxdataF[0],2*PHY_vars_UE_g[0]->lte_frame_parms.symbols_per_tti*PHY_vars_UE_g[0]->lte_frame_parms.ofdm_symbol_size,2,1);
write_output("pbch_rxF_ext0.m","pbch_ext0",PHY_vars_UE_g[0]->lte_ue_pbch_vars[0]->rxdataF_ext[0],6*12*4,1,1);
write_output("pbch_rxF_comp0.m","pbch_comp0",PHY_vars_UE_g[0]->lte_ue_pbch_vars[0]->rxdataF_comp[0],6*12*4,1,1);
write_output("pbch_rxF_llr.m","pbch_llr",PHY_vars_UE_g[0]->lte_ue_pbch_vars[0]->llr,(frame_parms->Ncp==0) ? 1920 : 1728,1,4);
*/
else {
if (abstraction_flag == 1) {
LOG_E(
EMU,
"sync not supported in abstraction mode (UE%d,mode%d)\n", UE_id, PHY_vars_UE_g[UE_id]->UE_mode[0]);
exit (-1);
}
if ((frame > 0) && (last_slot == (LTE_SLOTS_PER_FRAME - 2))) {
initial_sync (PHY_vars_UE_g[UE_id], normal_txrx);
/*
write_output("dlchan00.m","dlch00",&(PHY_vars_UE_g[0]->lte_ue_common_vars.dl_ch_estimates[0][0][0]),(6*(PHY_vars_UE_g[0]->lte_frame_parms.ofdm_symbol_size)),1,1);
if (PHY_vars_UE_g[0]->lte_frame_parms.nb_antennas_rx>1)
write_output("dlchan01.m","dlch01",&(PHY_vars_UE_g[0]->lte_ue_common_vars.dl_ch_estimates[0][1][0]),(6*(PHY_vars_UE_g[0]->lte_frame_parms.ofdm_symbol_size)),1,1);
write_output("dlchan10.m","dlch10",&(PHY_vars_UE_g[0]->lte_ue_common_vars.dl_ch_estimates[0][2][0]),(6*(PHY_vars_UE_g[0]->lte_frame_parms.ofdm_symbol_size)),1,1);
if (PHY_vars_UE_g[0]->lte_frame_parms.nb_antennas_rx>1)
write_output("dlchan11.m","dlch11",&(PHY_vars_UE_g[0]->lte_ue_common_vars.dl_ch_estimates[0][3][0]),(6*(PHY_vars_UE_g[0]->lte_frame_parms.ofdm_symbol_size)),1,1);
write_output("rxsig.m","rxs",PHY_vars_UE_g[0]->lte_ue_common_vars.rxdata[0],PHY_vars_UE_g[0]->lte_frame_parms.samples_per_tti*10,1,1);
write_output("rxsigF.m","rxsF",PHY_vars_UE_g[0]->lte_ue_common_vars.rxdataF[0],2*PHY_vars_UE_g[0]->lte_frame_parms.symbols_per_tti*PHY_vars_UE_g[0]->lte_frame_parms.ofdm_symbol_size,2,1);
write_output("pbch_rxF_ext0.m","pbch_ext0",PHY_vars_UE_g[0]->lte_ue_pbch_vars[0]->rxdataF_ext[0],6*12*4,1,1);
write_output("pbch_rxF_comp0.m","pbch_comp0",PHY_vars_UE_g[0]->lte_ue_pbch_vars[0]->rxdataF_comp[0],6*12*4,1,1);
write_output("pbch_rxF_llr.m","pbch_llr",PHY_vars_UE_g[0]->lte_ue_pbch_vars[0]->llr,(frame_parms->Ncp==0) ? 1920 : 1728,1,4);
*/
}
}
}
#ifdef PRINT_STATS
if(last_slot==2 && frame%10==0)
if (UE_stats_th[UE_id])
fprintf(UE_stats_th[UE_id],"%d %d\n",frame, PHY_vars_UE_g[UE_id]->bitrate[0]/1000);
if (UE_stats[UE_id]) {
len = dump_ue_stats (PHY_vars_UE_g[UE_id], stats_buffer, 0, normal_txrx, 0);
rewind (UE_stats[UE_id]);
fwrite (stats_buffer, 1, len, UE_stats[UE_id]);
fflush(UE_stats[UE_id]);
}
if(last_slot==2 && frame%10==0)
if (UE_stats_th[UE_id])
fprintf(UE_stats_th[UE_id],"%d %d\n",frame, PHY_vars_UE_g[UE_id]->bitrate[0]/1000);
if (UE_stats[UE_id]) {
len = dump_ue_stats (PHY_vars_UE_g[UE_id], stats_buffer, 0, normal_txrx, 0);
rewind (UE_stats[UE_id]);
fwrite (stats_buffer, 1, len, UE_stats[UE_id]);
fflush(UE_stats[UE_id]);
}
#endif
}
}
}
#ifdef Rel10
......
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