From 0d58ed224fed53ed3a7f96c7c3adfea81d52bece Mon Sep 17 00:00:00 2001 From: Y_Tomita Date: Wed, 17 Oct 2018 09:48:15 +0900 Subject: [PATCH 01/53] Change type for 256UEs test , abnormal exit and add definition of UE's thread ID for multiple UEs simulation. --- openair2/LAYER2/MAC/mac_extern.h | 2 +- openair2/LAYER2/MAC/mac_vars.h | 5 +++-- openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 1 + openair2/LAYER2/PDCP_v10.1.0/pdcp.h | 2 +- openair2/RRC/LTE/rrc_extern.h | 2 +- openair2/RRC/LTE/rrc_vars.h | 2 +- 6 files changed, 8 insertions(+), 6 deletions(-) mode change 100644 => 100755 openair2/LAYER2/MAC/mac_extern.h mode change 100644 => 100755 openair2/LAYER2/MAC/mac_vars.h mode change 100644 => 100755 openair2/LAYER2/PDCP_v10.1.0/pdcp.c mode change 100644 => 100755 openair2/LAYER2/PDCP_v10.1.0/pdcp.h mode change 100644 => 100755 openair2/RRC/LTE/rrc_extern.h mode change 100644 => 100755 openair2/RRC/LTE/rrc_vars.h diff --git a/openair2/LAYER2/MAC/mac_extern.h b/openair2/LAYER2/MAC/mac_extern.h old mode 100644 new mode 100755 index ca72882471..10822465f1 --- a/openair2/LAYER2/MAC/mac_extern.h +++ b/openair2/LAYER2/MAC/mac_extern.h @@ -64,7 +64,7 @@ extern eNB_DLSCH_INFO eNB_dlsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][MAX_MOBILES extern unsigned char NB_INST; #endif extern unsigned char NB_eNB_INST; -extern unsigned char NB_UE_INST; +extern uint16_t NB_UE_INST; extern unsigned char NB_RN_INST; extern unsigned short NODE_ID[1]; diff --git a/openair2/LAYER2/MAC/mac_vars.h b/openair2/LAYER2/MAC/mac_vars.h old mode 100644 new mode 100755 index 76842afd38..071ed7391d --- a/openair2/LAYER2/MAC/mac_vars.h +++ b/openair2/LAYER2/MAC/mac_vars.h @@ -95,7 +95,7 @@ const uint8_t cqi2fmt2x_agg[MAX_SUPPORTED_BW][CQI_VALUE_RANGE] = { uint32_t RRC_CONNECTION_FLAG; -UE_MAC_INST *UE_mac_inst; //[NB_MODULE_MAX]; +UE_MAC_INST *UE_mac_inst = NULL; //[NB_MODULE_MAX]; MAC_RLC_XFACE *Mac_rlc_xface; /// Primary component carrier index of eNB @@ -109,7 +109,8 @@ eNB_DLSCH_INFO eNB_dlsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][MAX_MOBILES_PER_EN #ifdef OPENAIR2 unsigned char NB_eNB_INST = 0; -unsigned char NB_UE_INST = 0; +uint16_t NB_UE_INST = 0; +uint16_t NB_THREAD_INST = 0; unsigned char NB_RN_INST = 0; unsigned char NB_INST = 0; #endif diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c old mode 100644 new mode 100755 index 05ddb4151f..15b970b319 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -67,6 +67,7 @@ extern int otg_enabled; #include "common/ran_context.h" extern RAN_CONTEXT_t RC; +hash_table_t *pdcp_coll_p = NULL; #ifdef MBMS_MULTICAST_OUT # include diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h old mode 100644 new mode 100755 index 054bb5fac4..75754664e9 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h @@ -542,7 +542,7 @@ sdu_size_t pdcp_input_sdu_remaining_size_to_read; (((hash_key_t)(sESSION_ID)) << 37) | \ (((hash_key_t)(0x0000000000000001)) << 63)) -hash_table_t *pdcp_coll_p; +extern hash_table_t *pdcp_coll_p; #endif /*@}*/ diff --git a/openair2/RRC/LTE/rrc_extern.h b/openair2/RRC/LTE/rrc_extern.h old mode 100644 new mode 100755 index 59200fb9cc..67504cb245 --- a/openair2/RRC/LTE/rrc_extern.h +++ b/openair2/RRC/LTE/rrc_extern.h @@ -51,7 +51,7 @@ extern LogicalChannelConfig_t SRB2_logicalChannelConfig_defaultValue; extern unsigned char NB_INST; #endif extern unsigned char NB_eNB_INST; -extern unsigned char NB_UE_INST; +extern uint16_t NB_UE_INST; extern unsigned short NODE_ID[1]; extern void* bigphys_malloc(int); #endif diff --git a/openair2/RRC/LTE/rrc_vars.h b/openair2/RRC/LTE/rrc_vars.h old mode 100644 new mode 100755 index 028a59f7d9..732be74aa1 --- a/openair2/RRC/LTE/rrc_vars.h +++ b/openair2/RRC/LTE/rrc_vars.h @@ -38,7 +38,7 @@ UE_PF_PO_t UE_PF_PO[NFAPI_CC_MAX][MAX_MOBILES_PER_ENB]; pthread_mutex_t ue_pf_po_mutex; -UE_RRC_INST *UE_rrc_inst; +UE_RRC_INST *UE_rrc_inst = NULL; #include "LAYER2/MAC/mac_extern.h" #define MAX_U32 0xFFFFFFFF From 1791574de5b4771f7ea21e21e0546b6fac371390 Mon Sep 17 00:00:00 2001 From: Y_Tomita Date: Wed, 17 Oct 2018 09:52:53 +0900 Subject: [PATCH 02/53] Missing RRC_VERSION and sourceL2Id, destinationL2Id. --- openair2/NETWORK_DRIVER/MESH/local.h | 10 ++++++++++ 1 file changed, 10 insertions(+) mode change 100644 => 100755 openair2/NETWORK_DRIVER/MESH/local.h diff --git a/openair2/NETWORK_DRIVER/MESH/local.h b/openair2/NETWORK_DRIVER/MESH/local.h old mode 100644 new mode 100755 index e23188d357..82dfc0ac88 --- a/openair2/NETWORK_DRIVER/MESH/local.h +++ b/openair2/NETWORK_DRIVER/MESH/local.h @@ -64,6 +64,8 @@ #include "rrc_nas_primitives.h" #include "COMMON/platform_types.h" +#define MAKE_VERSION(a,b,c) ((a)*256+(b)*16+(c)) + struct rb_entity { nasRadioBearerId_t rab_id; nasSapId_t sapi; @@ -160,6 +162,10 @@ typedef struct pdcp_data_req_header_s { sdu_size_t data_size; signed int inst; ip_traffic_type_t traffic_type; +#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + uint32_t sourceL2Id; + uint32_t destinationL2Id; +#endif } pdcp_data_req_header_t; typedef struct pdcp_data_ind_header_s { @@ -167,6 +173,10 @@ typedef struct pdcp_data_ind_header_s { sdu_size_t data_size; signed int inst; ip_traffic_type_t dummy_traffic_type; +#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + uint32_t sourceL2Id; + uint32_t destinationL2Id; +#endif } pdcp_data_ind_header_t; extern struct net_device *nasdev[NB_INSTANCES_MAX]; From 1f4a9f343940aaf025cab1a3b20e5c2be0369263 Mon Sep 17 00:00:00 2001 From: Y_Tomita Date: Wed, 17 Oct 2018 09:54:08 +0900 Subject: [PATCH 03/53] Fix for abnormal exit because L2sim doesn't use pointer of D2D test. --- openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c | 38 ++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 3 deletions(-) mode change 100644 => 100755 openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c old mode 100644 new mode 100755 index 92409d96dc..96a0ad26ce --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c @@ -85,7 +85,7 @@ unsigned char pdcp_read_state_g = 0; #endif extern Packet_OTG_List_t *otg_pdcp_buffer; - +extern uint8_t nfapi_mode; #if defined(LINK_ENB_PDCP_TO_GTPV1U) # include "gtpv1u_eNB_task.h" # include "gtpv1u_eNB_defs.h" @@ -1072,7 +1072,22 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) pdcp_read_header_g.rb_id, rab_id, pdcp_read_header_g.data_size); - + if(nfapi_mode == 3){ + pdcp_data_req( + &ctxt, + SRB_FLAG_NO, + rab_id, + RLC_MUI_UNDEFINED, + RLC_SDU_CONFIRM_NO, + pdcp_read_header_g.data_size, + (unsigned char *)NLMSG_DATA(nas_nlh_rx), + PDCP_TRANSMISSION_MODE_DATA +#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + ,NULL + ,NULL +#endif + ); + }else{ pdcp_data_req( &ctxt, SRB_FLAG_NO, @@ -1087,6 +1102,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) ,&pdcp_read_header_g.destinationL2Id #endif ); + } } else { MSC_LOG_RX_DISCARDED_MESSAGE( (ctxt_pP->enb_flag == ENB_FLAG_YES) ? MSC_PDCP_ENB:MSC_PDCP_UE, @@ -1130,7 +1146,22 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) pdcp_read_header_g.rb_id, DEFAULT_RAB_ID, pdcp_read_header_g.data_size); - + if(nfapi_mode == 3){ + pdcp_data_req ( + &ctxt, + SRB_FLAG_NO, + DEFAULT_RAB_ID, + RLC_MUI_UNDEFINED, + RLC_SDU_CONFIRM_NO, + pdcp_read_header_g.data_size, + (unsigned char *)NLMSG_DATA(nas_nlh_rx), + PDCP_TRANSMISSION_MODE_DATA +#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + ,NULL + ,NULL +#endif + ); + }else{ pdcp_data_req ( &ctxt, SRB_FLAG_NO, @@ -1145,6 +1176,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) ,&pdcp_read_header_g.destinationL2Id #endif ); + } } } From 53d6f992c92ab4760d64042ab670db52189f8d46 Mon Sep 17 00:00:00 2001 From: Y_Tomita Date: Wed, 17 Oct 2018 09:55:27 +0900 Subject: [PATCH 04/53] Fix for problems that eNB keeps waiting for signal of unused thread and eNB_thread_rxtx isn't created. --- targets/RT/USER/lte-enb.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) mode change 100644 => 100755 targets/RT/USER/lte-enb.c diff --git a/targets/RT/USER/lte-enb.c b/targets/RT/USER/lte-enb.c old mode 100644 new mode 100755 index e2415e1156..9ac7da46e7 --- a/targets/RT/USER/lte-enb.c +++ b/targets/RT/USER/lte-enb.c @@ -222,7 +222,7 @@ static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_nam } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER , 1 ); - if(get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT){ + if(get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT && nfapi_mode != 2){ if(wait_on_condition(&proc[1].mutex_rxtx,&proc[1].cond_rxtx,&proc[1].pipe_ready,"wakeup_tx")<0) { LOG_E(PHY,"Frame %d, subframe %d: TX1 not ready\n",proc[1].frame_rx,proc[1].subframe_rx); return(-1); @@ -965,6 +965,10 @@ void init_eNB_proc(int inst) { pthread_create( &proc_rxtx[0].pthread_rxtx, attr0, eNB_thread_rxtx, proc ); pthread_create( &proc_rxtx[1].pthread_rxtx, attr1, tx_thread, proc); } + else if (nfapi_mode == 2) { + pthread_create( &proc_rxtx[0].pthread_rxtx, attr0, eNB_thread_rxtx, &proc_rxtx[0] ); + pthread_create( &proc_rxtx[1].pthread_rxtx, attr1, eNB_thread_rxtx, &proc_rxtx[1] ); + } pthread_create( &proc->pthread_prach, attr_prach, eNB_thread_prach, eNB ); #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) pthread_create( &proc->pthread_prach_br, attr_prach_br, eNB_thread_prach_br, eNB ); From 33e8577f941360e2f3dd29748478be073ce194e2 Mon Sep 17 00:00:00 2001 From: Y_Tomita Date: Wed, 17 Oct 2018 10:01:05 +0900 Subject: [PATCH 05/53] Fix for problems that L2sim finishes in case of multiple UEs and UE L2sim keeps wating for a signal. --- targets/RT/USER/lte-uesoftmodem.c | 35 +++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) mode change 100644 => 100755 targets/RT/USER/lte-uesoftmodem.c diff --git a/targets/RT/USER/lte-uesoftmodem.c b/targets/RT/USER/lte-uesoftmodem.c old mode 100644 new mode 100755 index 69556b19f2..0081e7be8b --- a/targets/RT/USER/lte-uesoftmodem.c +++ b/targets/RT/USER/lte-uesoftmodem.c @@ -852,7 +852,7 @@ printf("~~~~~~~~~~~~~~~~~~~~successfully get the parallel config[%d], worker con printf("Running with %d UE instances\n",NB_UE_INST); - if (NB_UE_INST > 1 && simL1flag != 1) { + if (NB_UE_INST > 1 && simL1flag != 1 && nfapi_mode != 3) { printf("Running with more than 1 UE instance and simL1 is not active, this will result in undefined behaviour for now, exiting.\n"); abort(); } @@ -971,6 +971,8 @@ printf("~~~~~~~~~~~~~~~~~~~~successfully get the parallel config[%d], worker con RCConfig_sim(); } +// source code written in below moved to later to avoid keeping waiting for nfapi_sync_cond in wait_nfapi_init. +/* // start the main UE threads int eMBMS_active = 0; @@ -1001,7 +1003,7 @@ printf("~~~~~~~~~~~~~~~~~~~~successfully get the parallel config[%d], worker con PHY_vars_UE_g[0][CC_id]->rf_map.chain=CC_id+chain_offset; } } - +*/ cpuf=get_cpu_freq_GHz(); @@ -1090,7 +1092,36 @@ printf("~~~~~~~~~~~~~~~~~~~~successfully get the parallel config[%d], worker con } printf("NFAPI MODE:%s\n", nfapi_mode_str); + // start the main UE threads + int eMBMS_active = 0; + if (nfapi_mode==3) // UE-STUB-PNF + { + config_sync_var=0; + wait_nfapi_init("main?"); + //Panos: Temporarily we will be using single set of threads for multiple UEs. + //init_UE_stub(1,eMBMS_active,uecap_xer_in,emul_iface); + init_UE_stub_single_thread(NB_UE_INST,eMBMS_active,uecap_xer_in,emul_iface); + } + else { + init_UE(NB_UE_INST,eMBMS_active,uecap_xer_in,0,phy_test,UE_scan,UE_scan_carrier,mode,(int)rx_gain[0][0],tx_max_power[0], + frame_parms[0]); + } + + + if (phy_test==0) { + printf("Filling UE band info\n"); + fill_ue_band_info(); + dl_phy_sync_success (0, 0, 0, 1); + } + + if (nfapi_mode!=3){ + number_of_cards = 1; + for(CC_id=0; CC_idrf_map.card=0; + PHY_vars_UE_g[0][CC_id]->rf_map.chain=CC_id+chain_offset; + } + } // connect the TX/RX buffers From 4249ebbf8ba61391e896b9e0bcf92a156641423c Mon Sep 17 00:00:00 2001 From: Y_Tomita Date: Wed, 17 Oct 2018 10:05:41 +0900 Subject: [PATCH 06/53] Add function to create pre_scd_thread in case of L2sim. --- targets/RT/USER/lte-enb.c | 32 +++++++++ targets/RT/USER/lte-ru.c | 114 ++++++++++++++++++++++++++++++++ targets/RT/USER/lte-softmodem.c | 7 ++ targets/RT/USER/lte-softmodem.h | 1 + 4 files changed, 154 insertions(+) mode change 100644 => 100755 targets/RT/USER/lte-ru.c mode change 100644 => 100755 targets/RT/USER/lte-softmodem.c mode change 100644 => 100755 targets/RT/USER/lte-softmodem.h diff --git a/targets/RT/USER/lte-enb.c b/targets/RT/USER/lte-enb.c index 9ac7da46e7..a93a52a1a9 100755 --- a/targets/RT/USER/lte-enb.c +++ b/targets/RT/USER/lte-enb.c @@ -165,6 +165,8 @@ static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_nam // ******************************************************************* + RU_t *ru = RC.ru[0]; + if (nfapi_mode == 1) { // I am a PNF and I need to let nFAPI know that we have a (sub)frame tick @@ -230,6 +232,36 @@ static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_nam if (release_thread(&proc[1].mutex_rxtx,&proc[1].pipe_ready,"wakeup_tx")<0) return(-1); } +#if defined(PRE_SCD_THREAD) + if (nfapi_mode == 2){ + new_dlsch_ue_select_tbl_in_use = dlsch_ue_select_tbl_in_use; + dlsch_ue_select_tbl_in_use = !dlsch_ue_select_tbl_in_use; + memcpy(&pre_scd_eNB_UE_stats,&RC.mac[ru->eNB_list[0]->Mod_id]->UE_list.eNB_UE_stats, sizeof(eNB_UE_STATS)*MAX_NUM_CCs*NUMBER_OF_UE_MAX); + memcpy(&pre_scd_activeUE, &RC.mac[ru->eNB_list[0]->Mod_id]->UE_list.active, sizeof(boolean_t)*NUMBER_OF_UE_MAX); + if (pthread_mutex_lock(&ru->proc.mutex_pre_scd)!= 0) { + LOG_E( PHY, "[eNB] error locking proc mutex for eNB pre scd\n"); + exit_fun("error locking mutex_time"); + } + + ru->proc.instance_pre_scd++; + + if (ru->proc.instance_pre_scd == 0) { + if (pthread_cond_signal(&ru->proc.cond_pre_scd) != 0) { + LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB pre scd\n" ); + exit_fun( "ERROR pthread_cond_signal cond_pre_scd" ); + } + }else{ + LOG_E( PHY, "[eNB] frame %d subframe %d rxtx busy instance_pre_scd %d\n", + proc->frame_rx,proc->subframe_rx,ru->proc.instance_pre_scd ); + } + + if (pthread_mutex_unlock(&ru->proc.mutex_pre_scd)!= 0) { + LOG_E( PHY, "[eNB] error unlocking mutex_pre_scd mutex for eNB pre scd\n"); + exit_fun("error unlocking mutex_pre_scd"); + } + } +#endif + pthread_mutex_lock(&eNB->UL_INFO_mutex); eNB->UL_INFO.frame = proc->frame_rx; diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c old mode 100644 new mode 100755 index 7002bc4ebd..750d8239da --- a/targets/RT/USER/lte-ru.c +++ b/targets/RT/USER/lte-ru.c @@ -120,6 +120,7 @@ extern volatile int oai_exit; extern int emulate_rf; extern int numerology; extern clock_source_t clock_source; +extern uint8_t dlsch_ue_select_tbl_in_use; extern PARALLEL_CONF_t get_thread_parallel_conf(void); extern WORKER_CONF_t get_thread_worker_conf(void); @@ -142,6 +143,11 @@ int connect_rau(RU_t *ru); extern uint16_t sf_ahead; +#if defined(PRE_SCD_THREAD) +void init_ru_vnf(void); +#endif + + /*************************************************************/ /* Functions to attach and configure RRU */ @@ -2798,6 +2804,114 @@ void stop_RU(int nb_ru) } } +//Some of the member of ru pointer is used in pre_scd. +//This funtion is for initializing ru pointer for L2 FAPI simulator. +#if defined(PRE_SCD_THREAD) +void init_ru_vnf(void) { + + int ru_id; + RU_t *ru; + RU_proc_t *proc; +// PHY_VARS_eNB *eNB0= (PHY_VARS_eNB *)NULL; + int i; + int CC_id; + + + dlsch_ue_select_tbl_in_use = 1; + + + // create status mask + RC.ru_mask = 0; + pthread_mutex_init(&RC.ru_mutex,NULL); + pthread_cond_init(&RC.ru_cond,NULL); + + // read in configuration file) + printf("configuring RU from file\n"); + RCconfig_RU(); + LOG_I(PHY,"number of L1 instances %d, number of RU %d, number of CPU cores %d\n",RC.nb_L1_inst,RC.nb_RU,get_nprocs()); + + if (RC.nb_CC != 0) + for (i=0;inum_RU=0; + + LOG_D(PHY,"Process RUs RC.nb_RU:%d\n",RC.nb_RU); + for (ru_id=0;ru_idrf_config_file = rf_config_file; + ru->idx = ru_id; + ru->ts_offset = 0; + // use eNB_list[0] as a reference for RU frame parameters + // NOTE: multiple CC_id are not handled here yet! + + if (ru->num_eNB > 0) { +// LOG_D(PHY, "%s() RC.ru[%d].num_eNB:%d ru->eNB_list[0]:%p RC.eNB[0][0]:%p rf_config_file:%s\n", __FUNCTION__, ru_id, ru->num_eNB, ru->eNB_list[0], RC.eNB[0][0], ru->rf_config_file); + + if (ru->eNB_list[0] == 0) + { + LOG_E(PHY,"%s() DJP - ru->eNB_list ru->num_eNB are not initialized - so do it manually\n", __FUNCTION__); + ru->eNB_list[0] = RC.eNB[0][0]; + ru->num_eNB=1; + // + // DJP - feptx_prec() / feptx_ofdm() parses the eNB_list (based on num_eNB) and copies the txdata_F to txdata in RU + // + } + else + { + LOG_E(PHY,"DJP - delete code above this %s:%d\n", __FILE__, __LINE__); + } + } + +// frame_parms is not used in L2 FAPI simulator +/* + eNB0 = ru->eNB_list[0]; + LOG_D(PHY, "RU FUnction:%d ru->if_south:%d\n", ru->function, ru->if_south); + LOG_D(PHY, "eNB0:%p\n", eNB0); + if (eNB0) + { + if ((ru->function != NGFI_RRU_IF5) && (ru->function != NGFI_RRU_IF4p5)) + AssertFatal(eNB0!=NULL,"eNB0 is null!\n"); + + if (eNB0) { + LOG_I(PHY,"Copying frame parms from eNB %d to ru %d\n",eNB0->Mod_id,ru->idx); + memcpy((void*)&ru->frame_parms,(void*)&eNB0->frame_parms,sizeof(LTE_DL_FRAME_PARMS)); + + // attach all RU to all eNBs in its list/ + LOG_D(PHY,"ru->num_eNB:%d eNB0->num_RU:%d\n", ru->num_eNB, eNB0->num_RU); + for (i=0;inum_eNB;i++) { + eNB0 = ru->eNB_list[i]; + eNB0->RU_list[eNB0->num_RU++] = ru; + } + } + } +*/ + LOG_I(PHY,"Initializing RRU descriptor %d : (%s,%s,%d)\n",ru_id,ru_if_types[ru->if_south],eNB_timing[ru->if_timing],ru->function); + +// set_function_spec_param(ru); + LOG_I(PHY,"Starting ru_thread %d\n",ru_id); + +// init_RU_proc(ru); + + proc = &ru->proc; + memset((void*)proc,0,sizeof(RU_proc_t)); + + proc->instance_pre_scd = -1; + pthread_mutex_init( &proc->mutex_pre_scd, NULL); + pthread_cond_init( &proc->cond_pre_scd, NULL); + pthread_create(&proc->pthread_pre_scd, NULL, pre_scd_thread, (void*)ru); + pthread_setname_np(proc->pthread_pre_scd, "pre_scd_thread"); + + } // for ru_id + + + + // sleep(1); + LOG_D(HW,"[lte-softmodem.c] RU threads created\n"); + + +} +#endif + /* --------------------------------------------------------*/ /* from here function to use configuration module */ diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c old mode 100644 new mode 100755 index 03a461454f..101f8fa0a8 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -1063,6 +1063,13 @@ int main( int argc, char **argv ) } } + +#if defined(PRE_SCD_THREAD) + if (nfapi_mode==2) { // ru pointer is necessary for pre_scd. + init_ru_vnf(); + } +#endif + config_sync_var=0; if (nfapi_mode==1) { // PNF diff --git a/targets/RT/USER/lte-softmodem.h b/targets/RT/USER/lte-softmodem.h old mode 100644 new mode 100755 index 96ab799c3d..bd71e0877f --- a/targets/RT/USER/lte-softmodem.h +++ b/targets/RT/USER/lte-softmodem.h @@ -255,6 +255,7 @@ extern void kill_eNB_proc(int inst); // In lte-ru.c extern void init_RU(const char*); extern void stop_ru(RU_t *ru); +extern void init_ru_vnf(void); extern void init_RU_proc(RU_t *ru); extern void stop_RU(int nb_ru); extern void kill_RU_proc(RU_t *ru); From d27a0cbb231638cec8f57e154bf5f5cbb4361e69 Mon Sep 17 00:00:00 2001 From: Y_Tomita Date: Mon, 22 Oct 2018 13:26:51 +0900 Subject: [PATCH 07/53] Move initialization of ru pointer before it's accessed. --- targets/RT/USER/lte-softmodem.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index 101f8fa0a8..d3f1b9736a 100755 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -1034,8 +1034,14 @@ int main( int argc, char **argv ) } printf("NFAPI MODE:%s\n", nfapi_mode_str); - if (nfapi_mode==2) // VNF + +if (nfapi_mode==2) {// VNF +#if defined(PRE_SCD_THREAD) + init_ru_vnf(); // ru pointer is necessary for pre_scd. +#endif wait_nfapi_init("main?"); + } + printf("START MAIN THREADS\n"); @@ -1064,12 +1070,6 @@ int main( int argc, char **argv ) } -#if defined(PRE_SCD_THREAD) - if (nfapi_mode==2) { // ru pointer is necessary for pre_scd. - init_ru_vnf(); - } -#endif - config_sync_var=0; if (nfapi_mode==1) { // PNF From 7a755d8df6e4646231928ac1ee0ba86a5d43eb9e Mon Sep 17 00:00:00 2001 From: Y_Tomita Date: Mon, 22 Oct 2018 13:30:09 +0900 Subject: [PATCH 08/53] Modify not to use initializations of usual test in L2 FAPI simulator. --- targets/RT/USER/lte-softmodem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index d3f1b9736a..87c43fbf55 100755 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -1049,7 +1049,7 @@ if (nfapi_mode==2) {// VNF number_of_cards = 1; printf("RC.nb_L1_inst:%d\n", RC.nb_L1_inst); - if (RC.nb_L1_inst > 0) { + if (RC.nb_L1_inst > 0 && nfapi_mode != 2) { printf("Initializing eNB threads single_thread_flag:%d wait_for_sync:%d\n", single_thread_flag,wait_for_sync); init_eNB(single_thread_flag,wait_for_sync); // for (inst=0;inst0) { + if (RC.nb_RU >0 && nfapi_mode != 2) { printf("Initializing RU threads\n"); init_RU(rf_config_file); for (ru_id=0;ru_id Date: Mon, 22 Oct 2018 13:33:24 +0900 Subject: [PATCH 09/53] Modify to use Mod_id = 0 in L2 FAPI simulator's eNB to avoid Segmentation Fault --- targets/RT/USER/lte-enb.c | 9 +++++++-- targets/RT/USER/lte-ru.c | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/targets/RT/USER/lte-enb.c b/targets/RT/USER/lte-enb.c index a93a52a1a9..17d3cd63d4 100755 --- a/targets/RT/USER/lte-enb.c +++ b/targets/RT/USER/lte-enb.c @@ -236,8 +236,13 @@ static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_nam if (nfapi_mode == 2){ new_dlsch_ue_select_tbl_in_use = dlsch_ue_select_tbl_in_use; dlsch_ue_select_tbl_in_use = !dlsch_ue_select_tbl_in_use; - memcpy(&pre_scd_eNB_UE_stats,&RC.mac[ru->eNB_list[0]->Mod_id]->UE_list.eNB_UE_stats, sizeof(eNB_UE_STATS)*MAX_NUM_CCs*NUMBER_OF_UE_MAX); - memcpy(&pre_scd_activeUE, &RC.mac[ru->eNB_list[0]->Mod_id]->UE_list.active, sizeof(boolean_t)*NUMBER_OF_UE_MAX); + +// L2-emulator can work only one eNB. +// memcpy(&pre_scd_eNB_UE_stats,&RC.mac[ru->eNB_list[0]->Mod_id]->UE_list.eNB_UE_stats, sizeof(eNB_UE_STATS)*MAX_NUM_CCs*NUMBER_OF_UE_MAX); +// memcpy(&pre_scd_activeUE, &RC.mac[ru->eNB_list[0]->Mod_id]->UE_list.active, sizeof(boolean_t)*NUMBER_OF_UE_MAX); + memcpy(&pre_scd_eNB_UE_stats,&RC.mac[0]->UE_list.eNB_UE_stats, sizeof(eNB_UE_STATS)*MAX_NUM_CCs*NUMBER_OF_UE_MAX); + memcpy(&pre_scd_activeUE, &RC.mac[0]->UE_list.active, sizeof(boolean_t)*NUMBER_OF_UE_MAX); + if (pthread_mutex_lock(&ru->proc.mutex_pre_scd)!= 0) { LOG_E( PHY, "[eNB] error locking proc mutex for eNB pre scd\n"); exit_fun("error locking mutex_time"); diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c index 750d8239da..502d406d0e 100755 --- a/targets/RT/USER/lte-ru.c +++ b/targets/RT/USER/lte-ru.c @@ -121,7 +121,7 @@ extern int emulate_rf; extern int numerology; extern clock_source_t clock_source; extern uint8_t dlsch_ue_select_tbl_in_use; - +extern uint8_t nfapi_mode; extern PARALLEL_CONF_t get_thread_parallel_conf(void); extern WORKER_CONF_t get_thread_worker_conf(void); extern void phy_init_RU(RU_t*); @@ -1923,7 +1923,12 @@ void* pre_scd_thread( void* param ){ int CC_id; int Mod_id; RU_t *ru = (RU_t*)param; - Mod_id = ru->eNB_list[0]->Mod_id; + + // L2-emulator can work only one eNB + if( nfapi_mode == 2) + Mod_id = 0; + else + Mod_id = ru->eNB_list[0]->Mod_id; frame = 0; subframe = 4; From 50df0f683f9ed8e2cf45ecb12173567f30659a7d Mon Sep 17 00:00:00 2001 From: Y_Tomita Date: Mon, 22 Oct 2018 13:42:43 +0900 Subject: [PATCH 10/53] Temporary Fix: disabling FAPI log to avoid Segmentation Fault. --- nfapi/open-nFAPI/pnf/src/pnf.c | 2 +- nfapi/open-nFAPI/pnf/src/pnf_p7.c | 2 +- nfapi/open-nFAPI/vnf/src/vnf_p7.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) mode change 100644 => 100755 nfapi/open-nFAPI/pnf/src/pnf.c mode change 100644 => 100755 nfapi/open-nFAPI/pnf/src/pnf_p7.c mode change 100644 => 100755 nfapi/open-nFAPI/vnf/src/vnf_p7.c diff --git a/nfapi/open-nFAPI/pnf/src/pnf.c b/nfapi/open-nFAPI/pnf/src/pnf.c old mode 100644 new mode 100755 index d0a7fa6fd1..362162cd9d --- a/nfapi/open-nFAPI/pnf/src/pnf.c +++ b/nfapi/open-nFAPI/pnf/src/pnf.c @@ -1260,7 +1260,7 @@ int pnf_connect(pnf_t* pnf) address = inet_ntoa(addr->sin_addr); } - NFAPI_TRACE(NFAPI_TRACE_NOTE, "Host address info %d Family:%s Address:%s\n", i++, family, address); +// NFAPI_TRACE(NFAPI_TRACE_NOTE, "Host address info %d Family:%s Address:%s\n", i++, family, address); if (pnf->sctp) { diff --git a/nfapi/open-nFAPI/pnf/src/pnf_p7.c b/nfapi/open-nFAPI/pnf/src/pnf_p7.c old mode 100644 new mode 100755 index 8d94c23476..f7152cc077 --- a/nfapi/open-nFAPI/pnf/src/pnf_p7.c +++ b/nfapi/open-nFAPI/pnf/src/pnf_p7.c @@ -379,7 +379,7 @@ static uint32_t get_sf_time(uint32_t now_hr, uint32_t sf_start_hr) { if(now_hr < sf_start_hr) { - NFAPI_TRACE(NFAPI_TRACE_INFO, "now is earlier than start of subframe now_hr:%u sf_start_hr:%u\n", now_hr, sf_start_hr); +// NFAPI_TRACE(NFAPI_TRACE_INFO, "now is earlier than start of subframe now_hr:%u sf_start_hr:%u\n", now_hr, sf_start_hr); return 0; } else diff --git a/nfapi/open-nFAPI/vnf/src/vnf_p7.c b/nfapi/open-nFAPI/vnf/src/vnf_p7.c old mode 100644 new mode 100755 index cea259c35b..6c17fb2a99 --- a/nfapi/open-nFAPI/vnf/src/vnf_p7.c +++ b/nfapi/open-nFAPI/vnf/src/vnf_p7.c @@ -1203,13 +1203,13 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7) if(phy->in_sync == 0) { - NFAPI_TRACE(NFAPI_TRACE_NOTE, "***** Adjusting VNF phy_id:%d SFN/SF (%s) from %d to %d (%d) mode:%s zeroCount:%u sync:%s\n", +/* NFAPI_TRACE(NFAPI_TRACE_NOTE, "***** Adjusting VNF phy_id:%d SFN/SF (%s) from %d to %d (%d) mode:%s zeroCount:%u sync:%s\n", ind.header.phy_id, (phy->in_sync ? "via sfn" : "now"), NFAPI_SFNSF2DEC(curr_sfn_sf), NFAPI_SFNSF2DEC(new_sfn_sf), phy->adjustment, phy->filtered_adjust ? "FILTERED" : "ABSOLUTE", phy->zero_count, phy->in_sync ? "IN_SYNC" : "OUT_OF_SYNC"); - +*/ phy->sfn_sf = new_sfn_sf; } } From 2151da7b333232ba57f363b3520ae8994e29921f Mon Sep 17 00:00:00 2001 From: Y_Tomita Date: Mon, 22 Oct 2018 13:47:05 +0900 Subject: [PATCH 11/53] Fix to set message_id in VNF. --- nfapi/oai_integration/nfapi_vnf.c | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 nfapi/oai_integration/nfapi_vnf.c diff --git a/nfapi/oai_integration/nfapi_vnf.c b/nfapi/oai_integration/nfapi_vnf.c old mode 100644 new mode 100755 From ac0d6cc1f3c8fb85b6b1f53c3a1238e2889a06c7 Mon Sep 17 00:00:00 2001 From: Y_Tomita Date: Mon, 22 Oct 2018 14:00:47 +0900 Subject: [PATCH 12/53] Add NAS initialization in L2 FAPI simulator. --- targets/RT/USER/lte-ue.c | 7 +++++++ 1 file changed, 7 insertions(+) mode change 100644 => 100755 targets/RT/USER/lte-ue.c diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c old mode 100644 new mode 100755 index c49a54b98a..ada4144a4f --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -1771,6 +1771,13 @@ void init_UE_single_thread_stub(int nb_inst) { AssertFatal(PHY_vars_UE_g!=NULL,"PHY_vars_UE_g is NULL\n"); AssertFatal(PHY_vars_UE_g[i]!=NULL,"PHY_vars_UE_g[inst] is NULL\n"); AssertFatal(PHY_vars_UE_g[i][0]!=NULL,"PHY_vars_UE_g[inst][0] is NULL\n"); + if(nfapi_mode == 3){ +#ifdef NAS_UE + MessageDef *message_p; + message_p = itti_alloc_new_message(TASK_NAS_UE, INITIALIZE_MESSAGE); + itti_send_msg_to_task (TASK_NAS_UE, i + NB_eNB_INST, message_p); +#endif + } } UE = PHY_vars_UE_g[0][0]; From f4aa4ee9187d20fc848761ebb5b8987389bba800 Mon Sep 17 00:00:00 2001 From: Y_Tomita Date: Mon, 22 Oct 2018 14:06:01 +0900 Subject: [PATCH 13/53] Fix for setting of harq_information->harq_information_rel10.tl.tag --- openair2/LAYER2/MAC/eNB_scheduler_primitives.c | 1 + 1 file changed, 1 insertion(+) mode change 100644 => 100755 openair2/LAYER2/MAC/eNB_scheduler_primitives.c diff --git a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c old mode 100644 new mode 100755 index c9d3d9dbac..bb4e7a0f38 --- a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c @@ -1286,6 +1286,7 @@ fill_nfapi_ulsch_harq_information(module_id_t module_ */ #endif harq_information->harq_information_rel10.delta_offset_harq = puschConfigDedicated->betaOffset_ACK_Index; + harq_information->harq_information_rel10.tl.tag = NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL10_TAG; AssertFatal(UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated != NULL, "pucch_ConfigDedicated is null!\n"); if ((UE_list->UE_template[CC_idP][UE_id].physicalConfigDedicated->pucch_ConfigDedicated->tdd_AckNackFeedbackMode != NULL) From d43dd64b94460c6ead834045a87068a17c8323c7 Mon Sep 17 00:00:00 2001 From: Y_Tomita Date: Mon, 22 Oct 2018 14:12:41 +0900 Subject: [PATCH 14/53] Change not to watch timing in MSG2 and MSG4 procedure in L2 FAPI simulator because it's possible to differ timing(frame, subframe) between eNB and UE. --- openair2/LAYER2/MAC/eNB_scheduler_RA.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) mode change 100644 => 100755 openair2/LAYER2/MAC/eNB_scheduler_RA.c diff --git a/openair2/LAYER2/MAC/eNB_scheduler_RA.c b/openair2/LAYER2/MAC/eNB_scheduler_RA.c old mode 100644 new mode 100755 index b637a92a96..98a500a23d --- a/openair2/LAYER2/MAC/eNB_scheduler_RA.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_RA.c @@ -501,7 +501,9 @@ generate_Msg2(module_id_t module_idP, int CC_idP, frame_t frameP, #endif { - if ((ra->Msg2_frame == frameP) && (ra->Msg2_subframe == subframeP)) { + // In case of nFAPI, sometimes timing of eNB and UE become different. + // So if nfapi_mode == 2(VNF) , this function don't check timing to avoid Attach failure. + if (((ra->Msg2_frame == frameP) && (ra->Msg2_subframe == subframeP)) || (nfapi_mode == 2)) { LOG_D(MAC, "[eNB %d] CC_id %d Frame %d, subframeP %d: Generating RAR DCI, state %d\n", module_idP, CC_idP, frameP, subframeP, ra->state); @@ -1010,7 +1012,9 @@ generate_Msg4(module_id_t module_idP, int CC_idP, frame_t frameP, { // This is normal LTE case LOG_D(MAC, "generate_Msg4 1 ra->Msg4_frame SFN/SF: %d.%d, frameP SFN/SF: %d.%d FOR eNB_Mod: %d \n", ra->Msg4_frame, ra->Msg4_subframe, frameP, subframeP, module_idP); - if ((ra->Msg4_frame == frameP) && (ra->Msg4_subframe == subframeP)) { + // In case of nFAPI, sometimes timing of eNB and UE become different. + // So if nfapi_mode == 2(VNF) , this function don't check timing to avoid Attach failure. + if (((ra->Msg4_frame == frameP) && (ra->Msg4_subframe == subframeP))||((nfapi_mode == 2)&&(cc->tdd_Config == NULL))) { // Get RRCConnectionSetup for Piggyback /*rrc_sdu_length = mac_rrc_data_req(module_idP, CC_idP, frameP, CCCH, 1, // 1 transport block @@ -1421,7 +1425,9 @@ schedule_RA(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) if (ra->state == MSG2) generate_Msg2(module_idP, CC_id, frameP, subframeP, ra); - else if (ra->state == MSG4 && ra->Msg4_frame == frameP && ra->Msg4_subframe == subframeP ) + // In case of nFAPI, sometimes timing of eNB and UE become different. + // So if nfapi_mode == 2(VNF) , this function don't check timing to avoid Attach failure. + else if ((ra->state == MSG4 && ra->Msg4_frame == frameP && ra->Msg4_subframe == subframeP ) || (nfapi_mode == 2)) generate_Msg4(module_idP, CC_id, frameP, subframeP, ra); else if (ra->state == WAITMSG4ACK) check_Msg4_retransmission(module_idP, CC_id, frameP, From d9d204a5d3a64ac8a7b8e6356f10858772e23ae1 Mon Sep 17 00:00:00 2001 From: Y_Tomita Date: Mon, 22 Oct 2018 14:20:51 +0900 Subject: [PATCH 15/53] Modify RRC SDU length is not enough when UE received it. --- openair2/LAYER2/MAC/eNB_scheduler_RA.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/LAYER2/MAC/eNB_scheduler_RA.c b/openair2/LAYER2/MAC/eNB_scheduler_RA.c index 98a500a23d..d8c5683f61 100755 --- a/openair2/LAYER2/MAC/eNB_scheduler_RA.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_RA.c @@ -1172,7 +1172,7 @@ generate_Msg4(module_id_t module_idP, int CC_idP, frame_t frameP, mac->TX_req[CC_idP].sfn_sf = fill_nfapi_tx_req(&mac->TX_req[CC_idP].tx_request_body, (frameP * 10) + subframeP, - rrc_sdu_length, + rrc_sdu_length + offset, mac->pdu_index[CC_idP], mac->UE_list. DLSCH_pdu[CC_idP][0][(unsigned char)UE_id].payload[0]); From 564f2cbfd4db81e3ca0286cab92573c08de78d19 Mon Sep 17 00:00:00 2001 From: Y_Tomita Date: Mon, 22 Oct 2018 14:43:22 +0900 Subject: [PATCH 16/53] Modify not to assert a part in L2 FAPI simulator because it's possible to differ timing(frame, subframe) between eNB and UE. --- openair2/LAYER2/MAC/eNB_scheduler_primitives.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c index bb4e7a0f38..599dff678e 100755 --- a/openair2/LAYER2/MAC/eNB_scheduler_primitives.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_primitives.c @@ -61,6 +61,7 @@ extern uint16_t frame_cnt; #include "SCHED/sched_common.h" extern RAN_CONTEXT_t RC; +extern uint8_t nfapi_mode; int choose(int n, int k) { @@ -3631,9 +3632,19 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id, AssertFatal(num_ack_nak == 1, "num_ack_nak %d > 1 for 1 CC and single-layer transmission frame:%d subframe:%d\n", num_ack_nak,frameP,subframeP); - AssertFatal(sched_ctl->round[CC_idP][harq_pid] < 8, - "Got ACK/NAK for inactive harq_pid %d for UE %d/%x\n", - harq_pid, UE_id, rnti); + + // In case of nFAPI, sometimes timing of eNB and UE become different. + // So if nfapi_mode == 2(VNF) , this function don't check assertion to avoid process exit. + if (nfapi_mode != 2){ + AssertFatal(sched_ctl->round[CC_idP][harq_pid] < 8, + "Got ACK/NAK for inactive harq_pid %d for UE %d/%x\n", + harq_pid, UE_id, rnti); + } else { + if(sched_ctl->round[CC_idP][harq_pid] == 8){ + LOG_E(MAC,"Got ACK/NAK for inactive harq_pid %d for UE %d/%x\n",harq_pid, UE_id, rnti); + return; + } + } AssertFatal(pdu[0] == 1 || pdu[0] == 2 || pdu[0] == 4, "Received ACK/NAK %d which is not 1 or 2 for harq_pid %d from UE %d/%x\n", From 0e0a04fbc17ae9e772079d4c574e3bceacf05d8b Mon Sep 17 00:00:00 2001 From: Y_Tomita Date: Mon, 22 Oct 2018 15:35:34 +0900 Subject: [PATCH 17/53] Fix for 256UEs. --- openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 4 ++-- openair2/LAYER2/RLC/rlc.c | 4 ++-- openair3/NAS/UE/nas_ue_task.c | 2 +- targets/RT/USER/lte-softmodem.h | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) mode change 100644 => 100755 openair2/LAYER2/RLC/rlc.c mode change 100644 => 100755 openair3/NAS/UE/nas_ue_task.c diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index 15b970b319..3d6650a96f 100755 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -49,7 +49,7 @@ #include "platform_constants.h" #include "common/utils/LOG/vcd_signal_dumper.h" #include "msc.h" - +#include "targets/COMMON/openairinterface5g_limits.h" #if defined(ENABLE_SECURITY) # include "UTIL/OSA/osa_defs.h" #endif @@ -2015,7 +2015,7 @@ void pdcp_layer_init(void) * Initialize SDU list */ list_init(&pdcp_sdu_list, NULL); - pdcp_coll_p = hashtable_create ((maxDRB + 2) * 16, NULL, pdcp_free); + pdcp_coll_p = hashtable_create ((maxDRB + 2) * NUMBER_OF_UE_MAX, NULL, pdcp_free); AssertFatal(pdcp_coll_p != NULL, "UNRECOVERABLE error, PDCP hashtable_create failed"); for (instance = 0; instance < MAX_MOBILES_PER_ENB; instance++) { diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c old mode 100644 new mode 100755 index 846d406319..1b705c1328 --- a/openair2/LAYER2/RLC/rlc.c +++ b/openair2/LAYER2/RLC/rlc.c @@ -34,7 +34,7 @@ #include "common/utils/LOG/log.h" #include "UTIL/OCG/OCG_vars.h" #include "common/utils/LOG/vcd_signal_dumper.h" - +#include "targets/COMMON/openairinterface5g_limits.h" #include "assertions.h" extern boolean_t pdcp_data_ind( @@ -649,7 +649,7 @@ rlc_module_init (void) rlc_rrc_data_ind = NULL; rlc_rrc_data_conf = NULL; - rlc_coll_p = hashtable_create ((maxDRB + 2) * 16, NULL, rb_free_rlc_union); + rlc_coll_p = hashtable_create ((maxDRB + 2) * NUMBER_OF_UE_MAX, NULL, rb_free_rlc_union); //AssertFatal(rlc_coll_p != NULL, "UNRECOVERABLE error, RLC hashtable_create failed"); if(rlc_coll_p == NULL) { LOG_E(RLC, "UNRECOVERABLE error, RLC hashtable_create failed\n"); diff --git a/openair3/NAS/UE/nas_ue_task.c b/openair3/NAS/UE/nas_ue_task.c old mode 100644 new mode 100755 index 529ac5e602..6df6666638 --- a/openair3/NAS/UE/nas_ue_task.c +++ b/openair3/NAS/UE/nas_ue_task.c @@ -40,7 +40,7 @@ // FIXME review these externs extern unsigned char NB_eNB_INST; -extern unsigned char NB_UE_INST; +extern uint16_t NB_UE_INST; char *make_port_str_from_ueid(const char *base_port_str, int ueid); diff --git a/targets/RT/USER/lte-softmodem.h b/targets/RT/USER/lte-softmodem.h index bd71e0877f..9682bb0a56 100755 --- a/targets/RT/USER/lte-softmodem.h +++ b/targets/RT/USER/lte-softmodem.h @@ -147,7 +147,7 @@ {"ue-max-power", NULL, 0, iptr:&(tx_max_power[0]), defintval:23, TYPE_INT, 0}, \ {"emul-iface", CONFIG_HLP_EMULIFACE, 0, strptr:&emul_iface, defstrval:"lo", TYPE_STRING, 100}, \ {"L2-emul", NULL, 0, u8ptr:&nfapi_mode, defuintval:3, TYPE_UINT8, 0}, \ -{"num-ues", NULL, 0, u8ptr:&(NB_UE_INST), defuintval:1, TYPE_UINT8, 0}, \ +{"num-ues", NULL, 0, u16ptr:&(NB_UE_INST), defuintval:1, TYPE_UINT16, 0}, \ {"r" , CONFIG_HLP_PRB, 0, u8ptr:&(frame_parms[0]->N_RB_DL), defintval:25, TYPE_UINT8, 0}, \ {"dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \ {"usrp-args", CONFIG_HLP_USRP_ARGS, 0, strptr:(char **)&usrp_args, defstrval:"type=b200", TYPE_STRING, 0}, \ From 2b0097a8d4f4709abfe285f4976e84bab9b8b925 Mon Sep 17 00:00:00 2001 From: Y_Tomita Date: Mon, 22 Oct 2018 16:01:15 +0900 Subject: [PATCH 18/53] Add UE's thread ID for L2 FAPI simulator. --- openair1/PHY/defs_UE.h | 1 + targets/RT/USER/lte-softmodem.h | 1 + targets/RT/USER/lte-uesoftmodem.c | 14 ++++++++++++-- 3 files changed, 14 insertions(+), 2 deletions(-) mode change 100644 => 100755 openair1/PHY/defs_UE.h diff --git a/openair1/PHY/defs_UE.h b/openair1/PHY/defs_UE.h old mode 100644 new mode 100755 index 55f8c9639a..0a4bd36731 --- a/openair1/PHY/defs_UE.h +++ b/openair1/PHY/defs_UE.h @@ -889,6 +889,7 @@ typedef struct { struct rx_tx_thread_data { PHY_VARS_UE *UE; UE_rxtx_proc_t *proc; + uint16_t ue_thread_id; }; diff --git a/targets/RT/USER/lte-softmodem.h b/targets/RT/USER/lte-softmodem.h index 9682bb0a56..56598a6c14 100755 --- a/targets/RT/USER/lte-softmodem.h +++ b/targets/RT/USER/lte-softmodem.h @@ -148,6 +148,7 @@ {"emul-iface", CONFIG_HLP_EMULIFACE, 0, strptr:&emul_iface, defstrval:"lo", TYPE_STRING, 100}, \ {"L2-emul", NULL, 0, u8ptr:&nfapi_mode, defuintval:3, TYPE_UINT8, 0}, \ {"num-ues", NULL, 0, u16ptr:&(NB_UE_INST), defuintval:1, TYPE_UINT16, 0}, \ +{"nums_ue_thread" , NULL, 0, u16ptr:&(NB_THREAD_INST), defuintval:1, TYPE_UINT16, 0}, \ {"r" , CONFIG_HLP_PRB, 0, u8ptr:&(frame_parms[0]->N_RB_DL), defintval:25, TYPE_UINT8, 0}, \ {"dlsch-demod-shift", CONFIG_HLP_DLSHIFT, 0, iptr:(int32_t *)&dlsch_demod_shift, defintval:0, TYPE_INT, 0}, \ {"usrp-args", CONFIG_HLP_USRP_ARGS, 0, strptr:(char **)&usrp_args, defstrval:"type=b200", TYPE_STRING, 0}, \ diff --git a/targets/RT/USER/lte-uesoftmodem.c b/targets/RT/USER/lte-uesoftmodem.c index 0081e7be8b..2a2c874a91 100755 --- a/targets/RT/USER/lte-uesoftmodem.c +++ b/targets/RT/USER/lte-uesoftmodem.c @@ -823,7 +823,7 @@ int main( int argc, char **argv ) // Default value for the number of UEs. It will hold, // if not changed from the command line option --num-ues NB_UE_INST=1; - + NB_THREAD_INST=1; #if defined (XFORMS) int ret; #endif @@ -859,6 +859,16 @@ printf("~~~~~~~~~~~~~~~~~~~~successfully get the parallel config[%d], worker con printf("NFAPI_MODE value: %d \n", nfapi_mode); + // Checking option of nums_ue_thread. + if(NB_THREAD_INST < 1){ + printf("Running with 0 UE rxtx thread, exiting.\n"); + abort(); + } + // Checking option's relation between nums_ue_thread and num-ues + if(NB_UE_INST Date: Mon, 22 Oct 2018 16:09:34 +0900 Subject: [PATCH 19/53] Add definition about mutex for multiple UE's L2 FAPI simulator. --- openair1/PHY/defs_UE.h | 6 ++++++ openair2/PHY_INTERFACE/IF_Module.h | 11 +++++++++++ openair2/PHY_INTERFACE/phy_stub_UE.h | 3 +++ 3 files changed, 20 insertions(+) mode change 100644 => 100755 openair2/PHY_INTERFACE/IF_Module.h mode change 100644 => 100755 openair2/PHY_INTERFACE/phy_stub_UE.h diff --git a/openair1/PHY/defs_UE.h b/openair1/PHY/defs_UE.h index 0a4bd36731..d6da512e9a 100755 --- a/openair1/PHY/defs_UE.h +++ b/openair1/PHY/defs_UE.h @@ -204,6 +204,12 @@ typedef struct { /// condition variable for timer_thread; pthread_cond_t cond_ticking; //time_stats_t timer_stats; + + // below 3 members is used for waiting each UE threads(multiple UEs test) in L2 FAPI simulator. + // This used in UE_phy_stub_single_thread_rxn_txnp4 + pthread_mutex_t mutex_single_thread; + pthread_cond_t cond_single_thread; + int num_single_thread[NUMBER_OF_UE_MAX]; } SF_ticking; typedef struct { diff --git a/openair2/PHY_INTERFACE/IF_Module.h b/openair2/PHY_INTERFACE/IF_Module.h old mode 100644 new mode 100755 index 0390a90551..f89fcda568 --- a/openair2/PHY_INTERFACE/IF_Module.h +++ b/openair2/PHY_INTERFACE/IF_Module.h @@ -128,6 +128,17 @@ typedef struct IF_Module_s{ pthread_mutex_t if_mutex; }IF_Module_t; +// These mutex is used for multiple UEs L2 FAPI simulator. +// Each UEs set these value in UL and UL_INFO is shared in all UE's thread. +typedef struct { + pthread_mutex_t rx_mutex; + pthread_mutex_t crc_mutex; + pthread_mutex_t sr_mutex; + pthread_mutex_t harq_mutex; + pthread_mutex_t cqi_mutex; + pthread_mutex_t rach_mutex; +}FILL_UL_INFO_MUTEX_t; + /*Initial */ IF_Module_t *IF_Module_init(int Mod_id); void IF_Module_kill(int Mod_id); diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.h b/openair2/PHY_INTERFACE/phy_stub_UE.h old mode 100644 new mode 100755 index 9060951b26..1afb82add3 --- a/openair2/PHY_INTERFACE/phy_stub_UE.h +++ b/openair2/PHY_INTERFACE/phy_stub_UE.h @@ -17,6 +17,9 @@ //#include "openair1/PHY/defs.h" //#include "openair1/PHY/LTE_TRANSPORT/defs.h" +// this mutex is used to set multiple UE's UL value in L2 FAPI simulator. +FILL_UL_INFO_MUTEX_t fill_ul_mutex; + UL_IND_t *UL_INFO; nfapi_tx_request_pdu_t* tx_request_pdu_list; From da3e4ced9d076a67dee57a5a8cd40be58018e7a8 Mon Sep 17 00:00:00 2001 From: Y_Tomita Date: Mon, 22 Oct 2018 16:15:24 +0900 Subject: [PATCH 20/53] Fix for TDD's ULSCH HARQ in L2 FAPI simulator. --- openair2/PHY_INTERFACE/phy_stub_UE.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) mode change 100644 => 100755 openair2/PHY_INTERFACE/phy_stub_UE.c diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.c b/openair2/PHY_INTERFACE/phy_stub_UE.c old mode 100644 new mode 100755 index 166616c368..bda6f156c5 --- a/openair2/PHY_INTERFACE/phy_stub_UE.c +++ b/openair2/PHY_INTERFACE/phy_stub_UE.c @@ -311,6 +311,7 @@ void fill_uci_harq_indication_UE_MAC(int Mod_id, else if (SNRtimes10 > 635) pdu->ul_cqi_information.ul_cqi=255; else pdu->ul_cqi_information.ul_cqi=(640+SNRtimes10)/5; pdu->ul_cqi_information.channel = 0; + if(harq_information->harq_information_rel9_fdd.tl.tag == NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL9_FDD_TAG){ if ((harq_information->harq_information_rel9_fdd.ack_nack_mode == 0) && (harq_information->harq_information_rel9_fdd.harq_size == 1)) { @@ -332,7 +333,24 @@ void fill_uci_harq_indication_UE_MAC(int Mod_id, pdu->harq_indication_fdd_rel13.harq_tb_n[1] = 1; // Assuming always an ACK (No NACK or DTX) } - else AssertFatal(1==0,"only format 1a/b for now, received \n"); + }else if(harq_information->harq_information_rel10_tdd.tl.tag == NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL10_TDD_TAG ){ + if ((harq_information->harq_information_rel10_tdd.ack_nack_mode == 0) && + (harq_information->harq_information_rel10_tdd.harq_size == 1)) { + pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG; + pdu->harq_indication_tdd_rel13.mode = 0; + pdu->harq_indication_tdd_rel13.number_of_ack_nack = 1; + pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = 1; + + } else if ((harq_information->harq_information_rel10_tdd.ack_nack_mode == 1) && + (harq_information->harq_information_rel10_tdd.harq_size == 2)) { + pdu->harq_indication_tdd_rel13.tl.tag = NFAPI_HARQ_INDICATION_TDD_REL13_TAG; + pdu->harq_indication_tdd_rel13.mode = 0; + pdu->harq_indication_tdd_rel13.number_of_ack_nack = 1; + pdu->harq_indication_tdd_rel13.harq_data[0].bundling.value_0 = 1; + pdu->harq_indication_tdd_rel13.harq_data[1].bundling.value_0 = 1; + + } + } else AssertFatal(1==0,"only format 1a/b for now, received \n"); UL_INFO->harq_ind.harq_indication_body.number_of_harqs++; From 04691fb04ca3110cd3f3beeb4a5cb25618d4280f Mon Sep 17 00:00:00 2001 From: Y_Tomita Date: Mon, 22 Oct 2018 16:39:44 +0900 Subject: [PATCH 21/53] Add checking pdu_index is enough in function of dl_config_req_UE_MAC. --- openair2/PHY_INTERFACE/phy_stub_UE.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.c b/openair2/PHY_INTERFACE/phy_stub_UE.c index bda6f156c5..b1269d92c6 100755 --- a/openair2/PHY_INTERFACE/phy_stub_UE.c +++ b/openair2/PHY_INTERFACE/phy_stub_UE.c @@ -640,7 +640,8 @@ int dl_config_req_UE_MAC(nfapi_dl_config_request_t* req, module_id_t Mod_id) //, //if(tx_request_pdu_list[dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index].segments[0].segment_data!= NULL && tx_request_pdu_list[dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index].segments[0].segment_length >0){ */ - if(dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index <= tx_req_num_elems -1){ + // to avoid unexpected error , add check pdu_index is more than 0. + if((dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index >= 0) &&(dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index <= tx_req_num_elems -1)){ //if(tx_request_pdu_list + dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index!= NULL){ LOG_E(MAC, "dl_config_req_UE_MAC 2 Received data: sfn/sf:%d PDU[%d] size:%d, TX_PDU index: %d, tx_req_num_elems: %d \n", NFAPI_SFNSF2DEC(req->sfn_sf), i, dl_config_pdu_list[i].pdu_size, dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index, tx_req_num_elems); From bf8706d2c0e1698203e4dd1257cc8764e3f1b9f1 Mon Sep 17 00:00:00 2001 From: Y_Tomita Date: Mon, 22 Oct 2018 16:48:31 +0900 Subject: [PATCH 22/53] Modify to keep ulsch_buffer's value. --- openair2/PHY_INTERFACE/phy_stub_UE.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.c b/openair2/PHY_INTERFACE/phy_stub_UE.c index b1269d92c6..6ff14c61e9 100755 --- a/openair2/PHY_INTERFACE/phy_stub_UE.c +++ b/openair2/PHY_INTERFACE/phy_stub_UE.c @@ -65,7 +65,11 @@ void fill_rx_indication_UE_MAC(module_id_t Mod_id,int frame,int subframe, UL_IND //pdu->rx_indication_rel8.length = eNB->ulsch[UE_id]->harq_processes[harq_pid]->TBS>>3; pdu->rx_indication_rel8.length = buflen; pdu->rx_indication_rel8.offset = 1; // DJP - I dont understand - but broken unless 1 ???? 0; // filled in at the end of the UL_INFO formation - pdu->data = ulsch_buffer; + + // ulsch_buffer is necessary to keep its value. + //pdu->data = ulsch_buffer; + pdu->data = malloc(buflen); + memcpy(pdu->data,ulsch_buffer,buflen); // estimate timing advance for MAC //sync_pos = lte_est_timing_advance_pusch(eNB,UE_id); timing_advance_update = 0; // Don't know what to put here From eb0ebc588fda0983482587aa1a5a7c9585031747 Mon Sep 17 00:00:00 2001 From: Y_Tomita Date: Mon, 22 Oct 2018 16:56:51 +0900 Subject: [PATCH 23/53] Add some valuables initialization to avoid unexpected exit. --- openair2/PHY_INTERFACE/phy_stub_UE.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.c b/openair2/PHY_INTERFACE/phy_stub_UE.c index 6ff14c61e9..bf542b00d3 100755 --- a/openair2/PHY_INTERFACE/phy_stub_UE.c +++ b/openair2/PHY_INTERFACE/phy_stub_UE.c @@ -25,7 +25,11 @@ extern int oai_nfapi_rach_ind(nfapi_rach_indication_t *rach_ind); void configure_nfapi_pnf(char *vnf_ip_addr, int vnf_p5_port, char *pnf_ip_addr, int pnf_p7_port, int vnf_p7_port); - +UL_IND_t *UL_INFO = NULL; +nfapi_tx_request_pdu_t* tx_request_pdu_list = NULL; +nfapi_dl_config_request_t* dl_config_req = NULL; +nfapi_ul_config_request_t* ul_config_req = NULL; +nfapi_hi_dci0_request_t* hi_dci0_req = NULL; //extern uint8_t nfapi_pnf; //UL_IND_t *UL_INFO; From 20a2e83c39dd96ee76bd914065b9270ce727cbec Mon Sep 17 00:00:00 2001 From: Y_Tomita Date: Mon, 22 Oct 2018 17:21:30 +0900 Subject: [PATCH 24/53] Add multiple UE's L2 FAPI simulator's function. --- openair2/LAYER2/MAC/mac_extern.h | 1 + openair2/LAYER2/MAC/main_ue.c | 9 +- openair2/LAYER2/MAC/ue_procedures.c | 54 ++++---- openair2/PHY_INTERFACE/phy_stub_UE.c | 69 +++++++--- targets/RT/USER/lte-ue.c | 182 ++++++++++++++++++++------- 5 files changed, 223 insertions(+), 92 deletions(-) mode change 100644 => 100755 openair2/LAYER2/MAC/main_ue.c mode change 100644 => 100755 openair2/LAYER2/MAC/ue_procedures.c diff --git a/openair2/LAYER2/MAC/mac_extern.h b/openair2/LAYER2/MAC/mac_extern.h index 10822465f1..fd9ffb6a87 100755 --- a/openair2/LAYER2/MAC/mac_extern.h +++ b/openair2/LAYER2/MAC/mac_extern.h @@ -65,6 +65,7 @@ extern unsigned char NB_INST; #endif extern unsigned char NB_eNB_INST; extern uint16_t NB_UE_INST; +extern uint16_t NB_THREAD_INST; extern unsigned char NB_RN_INST; extern unsigned short NODE_ID[1]; diff --git a/openair2/LAYER2/MAC/main_ue.c b/openair2/LAYER2/MAC/main_ue.c old mode 100644 new mode 100755 index 95f25c7ff5..dd76df76dd --- a/openair2/LAYER2/MAC/main_ue.c +++ b/openair2/LAYER2/MAC/main_ue.c @@ -43,7 +43,7 @@ #include "common/ran_context.h" - +extern FILL_UL_INFO_MUTEX_t fill_ul_mutex; extern void openair_rrc_top_init_ue( int eMBMS_active, char* uecap_xer, uint8_t cba_group_active, uint8_t HO_active); void dl_phy_sync_success(module_id_t module_idP, frame_t frameP, unsigned char eNB_index, uint8_t first_sync) //init as MR @@ -103,6 +103,13 @@ mac_top_init_ue(int eMBMS_active, char *uecap_xer, UE_mac_inst = NULL; } + // mutex below are used for multiple UE's L2 FAPI simulation. + pthread_mutex_init(&fill_ul_mutex.rx_mutex,NULL); + pthread_mutex_init(&fill_ul_mutex.crc_mutex,NULL); + pthread_mutex_init(&fill_ul_mutex.sr_mutex,NULL); + pthread_mutex_init(&fill_ul_mutex.harq_mutex,NULL); + pthread_mutex_init(&fill_ul_mutex.cqi_mutex,NULL); + pthread_mutex_init(&fill_ul_mutex.rach_mutex,NULL); LOG_I(MAC, "[MAIN] calling RRC\n"); openair_rrc_top_init_ue(eMBMS_active, uecap_xer, cba_group_active, diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c old mode 100644 new mode 100755 index 2c99b79ce8..12fbef7d80 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -70,6 +70,8 @@ extern uint8_t usim_test; extern UL_IND_t *UL_INFO; extern uint8_t nfapi_mode; +extern int next_ra_frame; +extern module_id_t next_Mod_id; /* * @@ -2524,44 +2526,46 @@ ue_scheduler(const module_id_t module_idP, UE_mac_inst[module_idP].crnti, txFrameP, txSubframeP, eNB_indexP); #if defined(ENABLE_ITTI) + if(module_idP == 0){ + do { + // Checks if a message has been sent to MAC sub-task + itti_poll_msg(TASK_MAC_UE, &msg_p); - do { - // Checks if a message has been sent to MAC sub-task - itti_poll_msg(TASK_MAC_UE, &msg_p); + if (msg_p != NULL) { - if (msg_p != NULL) { + switch (ITTI_MSG_ID(msg_p)) { + case RRC_MAC_CCCH_DATA_REQ: + LOG_I(MAC, + "Received %s from %s: instance %d, frameP %d, eNB_index %d\n", + ITTI_MSG_NAME(msg_p), ITTI_MSG_ORIGIN_NAME(msg_p), ITTI_MSG_INSTANCE(msg_p), + RRC_MAC_CCCH_DATA_REQ(msg_p).frame, + RRC_MAC_CCCH_DATA_REQ(msg_p).enb_index); - switch (ITTI_MSG_ID(msg_p)) { - case RRC_MAC_CCCH_DATA_REQ: - LOG_I(MAC, - "Received %s from %s: instance %d, frameP %d, eNB_index %d\n", - ITTI_MSG_NAME(msg_p), ITTI_MSG_ORIGIN_NAME(msg_p), ITTI_MSG_INSTANCE(msg_p), - RRC_MAC_CCCH_DATA_REQ(msg_p).frame, - RRC_MAC_CCCH_DATA_REQ(msg_p).enb_index); - - // TODO process CCCH data req. - break; + // TODO process CCCH data req. + break; - default: - LOG_E(MAC, "Received unexpected message %s\n", ITTI_MSG_NAME(msg_p)); - break; + default: + LOG_E(MAC, "Received unexpected message %s\n", ITTI_MSG_NAME(msg_p)); + break; + } + + result = itti_free(ITTI_MSG_ORIGIN_ID(msg_p), msg_p); + AssertFatal(result == EXIT_SUCCESS, + "Failed to free memory (%d)!\n", result); } - - result = itti_free(ITTI_MSG_ORIGIN_ID(msg_p), msg_p); - AssertFatal(result == EXIT_SUCCESS, - "Failed to free memory (%d)!\n", result); - } - } + } while (msg_p != NULL); - + } #endif //Mac_rlc_xface->frameP=frameP; //Rrc_xface->Frame_index=Mac_rlc_xface->frameP; //if (subframe%5 == 0) //LG#ifdef EXMIMO - pdcp_run(&ctxt); + if(module_idP == 0){ + pdcp_run(&ctxt); + } //#endif UE_mac_inst[module_idP].txFrame = txFrameP; UE_mac_inst[module_idP].txSubframe = txSubframeP; diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.c b/openair2/PHY_INTERFACE/phy_stub_UE.c index bf542b00d3..a1340e5e2e 100755 --- a/openair2/PHY_INTERFACE/phy_stub_UE.c +++ b/openair2/PHY_INTERFACE/phy_stub_UE.c @@ -51,7 +51,9 @@ void fill_rx_indication_UE_MAC(module_id_t Mod_id,int frame,int subframe, UL_IND int timing_advance_update; - pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + // pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + // change for mutiple UE's simulation. + pthread_mutex_lock(&fill_ul_mutex.rx_mutex); UL_INFO->rx_ind.sfn_sf = frame<<4| subframe; @@ -88,7 +90,9 @@ void fill_rx_indication_UE_MAC(module_id_t Mod_id,int frame,int subframe, UL_IND UL_INFO->rx_ind.rx_indication_body.number_of_pdus++; UL_INFO->rx_ind.sfn_sf = frame<<4 | subframe; - pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + // pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + // change for mutiple UE's simulation. + pthread_mutex_unlock(&fill_ul_mutex.rx_mutex); } @@ -96,7 +100,9 @@ void fill_rx_indication_UE_MAC(module_id_t Mod_id,int frame,int subframe, UL_IND void fill_sr_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL_INFO, uint16_t rnti) { - pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + // change for mutiple UE's simulation. + //pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + pthread_mutex_lock(&fill_ul_mutex.sr_mutex); nfapi_sr_indication_t *sr_ind = &UL_INFO->sr_ind; nfapi_sr_indication_body_t *sr_ind_body = &sr_ind->sr_indication_body; @@ -130,13 +136,17 @@ void fill_sr_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL_I //UL_INFO->rx_ind.rx_indication_body.number_of_pdus++; sr_ind_body->number_of_srs++; - pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + // change for mutiple UE's simulation. + // pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + pthread_mutex_unlock(&fill_ul_mutex.sr_mutex); } void fill_crc_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL_INFO, uint8_t crc_flag, int index, uint16_t rnti) { - pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + // change for mutiple UE's simulation. + //pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + pthread_mutex_lock(&fill_ul_mutex.crc_mutex); // REMEMBER HAVE EXCHANGED THE FOLLOWING TWO LINES HERE! nfapi_crc_indication_pdu_t *pdu = &UL_INFO->crc_ind.crc_indication_body.crc_pdu_list[UL_INFO->crc_ind.crc_indication_body.number_of_crcs]; @@ -159,14 +169,21 @@ void fill_crc_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL_ LOG_D(PHY, "%s() rnti:%04x pdus:%d\n", __FUNCTION__, pdu->rx_ue_information.rnti, UL_INFO->crc_ind.crc_indication_body.number_of_crcs); - pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + // change for mutiple UE's simulation. + // pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + pthread_mutex_unlock(&fill_ul_mutex.crc_mutex); } void fill_rach_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL_INFO, uint8_t ra_PreambleIndex, uint16_t ra_RNTI) { LOG_D(MAC, "fill_rach_indication_UE_MAC 1 \n"); - pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex); - UL_INFO = (UL_IND_t*)malloc(sizeof(UL_IND_t)); + + // change for mutiple UE's simulation. + // pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + pthread_mutex_lock(&fill_ul_mutex.rach_mutex); + + // memory allocation and free memory of UL_INFO are done in UE_phy_stub_single_thread_rxn_txnp4. + // UL_INFO = (UL_IND_t*)malloc(sizeof(UL_IND_t)); UL_INFO->rach_ind.rach_indication_body.number_of_preambles = 1; @@ -203,16 +220,22 @@ void fill_rach_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL // with that branch. oai_nfapi_rach_ind(&UL_INFO->rach_ind); free(UL_INFO->rach_ind.rach_indication_body.preamble_list); - free(UL_INFO); + + // memory allocation and free memory of UL_INFO are done in UE_phy_stub_single_thread_rxn_txnp4. + //free(UL_INFO); //} - pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + // change for mutiple UE's simulation. + // pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + pthread_mutex_unlock(&fill_ul_mutex.rach_mutex); } void fill_ulsch_cqi_indication_UE_MAC(int Mod_id, uint16_t frame,uint8_t subframe, UL_IND_t *UL_INFO, uint16_t rnti) { - pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + // change for mutiple UE's simulation. + //pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + pthread_mutex_lock(&fill_ul_mutex.cqi_mutex); nfapi_cqi_indication_pdu_t *pdu = &UL_INFO->cqi_ind.cqi_pdu_list[UL_INFO->cqi_ind.number_of_cqis]; nfapi_cqi_indication_raw_pdu_t *raw_pdu = &UL_INFO->cqi_ind.cqi_raw_pdu_list[UL_INFO->cqi_ind.number_of_cqis]; @@ -241,14 +264,18 @@ void fill_ulsch_cqi_indication_UE_MAC(int Mod_id, uint16_t frame,uint8_t subfram UL_INFO->cqi_ind.number_of_cqis++; - pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex); - + // change for mutiple UE's simulation. + //pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + pthread_mutex_unlock(&fill_ul_mutex.cqi_mutex); } void fill_ulsch_harq_indication_UE_MAC(int Mod_id, int frame,int subframe, UL_IND_t *UL_INFO, nfapi_ul_config_ulsch_harq_information *harq_information, uint16_t rnti) { - pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + // change for mutiple UE's simulation. + //pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + pthread_mutex_lock(&fill_ul_mutex.harq_mutex); + nfapi_harq_indication_pdu_t *pdu = &UL_INFO->harq_ind.harq_indication_body.harq_pdu_list[UL_INFO->harq_ind.harq_indication_body.number_of_harqs]; int i; @@ -279,8 +306,9 @@ void fill_ulsch_harq_indication_UE_MAC(int Mod_id, int frame,int subframe, UL_IN } UL_INFO->harq_ind.harq_indication_body.number_of_harqs++; - pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex); -} + // change for mutiple UE's simulation. + //pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + pthread_mutex_unlock(&fill_ul_mutex.harq_mutex);} void fill_uci_harq_indication_UE_MAC(int Mod_id, @@ -293,7 +321,10 @@ void fill_uci_harq_indication_UE_MAC(int Mod_id, uint16_t tdd_multiplexing_mask*/) { - pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + // change for mutiple UE's simulation. + //pthread_mutex_lock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + pthread_mutex_lock(&fill_ul_mutex.harq_mutex); + nfapi_harq_indication_t *ind = &UL_INFO->harq_ind; nfapi_harq_indication_body_t *body = &ind->harq_indication_body; nfapi_harq_indication_pdu_t *pdu = &body->harq_pdu_list[UL_INFO->harq_ind.harq_indication_body.number_of_harqs]; @@ -363,7 +394,9 @@ void fill_uci_harq_indication_UE_MAC(int Mod_id, UL_INFO->harq_ind.harq_indication_body.number_of_harqs++; LOG_D(PHY,"Incremented eNB->UL_INFO.harq_ind.number_of_harqs:%d\n", UL_INFO->harq_ind.harq_indication_body.number_of_harqs); - pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + // change for mutiple UE's simulation. + //pthread_mutex_unlock(&UE_mac_inst[Mod_id].UL_INFO_mutex); + pthread_mutex_unlock(&fill_ul_mutex.harq_mutex); } diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index ada4144a4f..39e6179d65 100755 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -102,9 +102,11 @@ void ue_stub_rx_handler(unsigned int, char *); int32_t **rxdata; int32_t **txdata; -int timer_subframe; -int timer_frame; -SF_ticking *phy_stub_ticking; +int timer_subframe = 0; +int timer_frame = 0; +SF_ticking *phy_stub_ticking = NULL; +int next_ra_frame = 0; +module_id_t next_Mod_id = 0; #define KHz (1000UL) #define MHz (1000*KHz) @@ -954,31 +956,53 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) { thread_top_init("UE_phy_stub_thread_rxn_txnp4",1,870000L,1000000L,1000000L); - module_id_t Mod_id = 0; + // for multipule UE's L2-emulator + //module_id_t Mod_id = 0; + //int init_ra_UE = -1; // This counter is used to initiate the RA of each UE in different SFrames static __thread int UE_thread_rxtx_retval; struct rx_tx_thread_data *rtd = arg; UE_rxtx_proc_t *proc = rtd->proc; - // Initializations for nfapi-L2-emulator mode - dl_config_req = NULL; - ul_config_req = NULL; - hi_dci0_req = NULL; - tx_request_pdu_list = NULL; - + // settings for nfapi-L2-emulator mode + module_id_t ue_thread_id = rtd->ue_thread_id; + uint16_t ue_index = 0; + uint16_t ue_num = NB_UE_INST/NB_THREAD_INST+((NB_UE_INST%NB_THREAD_INST > ue_thread_id) ? 1 :0); + module_id_t ue_Mod_id; PHY_VARS_UE *UE; //= rtd->UE; int ret; + uint8_t end_flag; + proc = &PHY_vars_UE_g[0][0]->proc.proc_rxtx[0]; + phy_stub_ticking->num_single_thread[ue_thread_id] = -1; + if(ue_thread_id == 0){ + phy_stub_ticking->ticking_var = -1; + proc->subframe_rx=proc->sub_frame_start; + // Initializations for nfapi-L2-emulator mode + dl_config_req = NULL; + ul_config_req = NULL; + hi_dci0_req = NULL; + tx_request_pdu_list = NULL; - phy_stub_ticking->ticking_var = -1; - proc->subframe_rx=proc->sub_frame_start; + // waiting for all UE's threads set phy_stub_ticking->num_single_thread[ue_thread_id] = -1. + do{ + end_flag = 1; + for(uint16_t i = 0;i< NB_THREAD_INST;i++){ + if(phy_stub_ticking->num_single_thread[i] == 0){ + end_flag = 0; + } + } + }while(end_flag == 0); + + sync_var=0; + } //PANOS: CAREFUL HERE! wait_sync("UE_phy_stub_single_thread_rxn_txnp4"); while (!oai_exit) { - + if(ue_thread_id == 0){ if (pthread_mutex_lock(&phy_stub_ticking->mutex_ticking) != 0) { LOG_E( MAC, "[SCHED][UE] error locking mutex for UE RXTX\n" ); exit_fun("nothing to add"); @@ -1026,14 +1050,46 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) { UL_INFO->harq_ind.harq_indication_body.number_of_harqs = 0; UL_INFO->sr_ind.sr_indication_body.sr_pdu_list = (nfapi_sr_indication_pdu_t*)malloc(NB_UE_INST*sizeof(nfapi_sr_indication_pdu_t)); - UL_INFO->sr_ind.sr_indication_body.number_of_srs = 0; + UL_INFO->sr_ind.sr_indication_body.sr_pdu_list = (nfapi_sr_indication_pdu_t*)malloc(NB_UE_INST*sizeof(nfapi_sr_indication_pdu_t)); + UL_INFO->sr_ind.sr_indication_body.number_of_srs = 0; + UL_INFO->cqi_ind.cqi_pdu_list = (nfapi_cqi_indication_pdu_t*)malloc(NB_UE_INST*sizeof(nfapi_cqi_indication_pdu_t)); + UL_INFO->cqi_ind.cqi_raw_pdu_list = (nfapi_cqi_indication_raw_pdu_t*)malloc(NB_UE_INST*sizeof(nfapi_cqi_indication_raw_pdu_t)); + UL_INFO->cqi_ind.number_of_cqis = 0; + if (pthread_mutex_lock(&phy_stub_ticking->mutex_single_thread) != 0) { + LOG_E( MAC, "[SCHED][UE] error locking mutex for ue_thread_id %d (mutex_single_thread)\n",ue_thread_id); + exit_fun("nothing to add"); + } + memset(&phy_stub_ticking->num_single_thread[0],0,sizeof(int)*NB_THREAD_INST); + pthread_cond_broadcast(&phy_stub_ticking->cond_single_thread); + if (pthread_mutex_unlock(&phy_stub_ticking->mutex_single_thread) != 0) { + LOG_E( MAC, "[SCHED][UE] error unlocking mutex for ue_thread_id %d (mutex_single_thread)\n",ue_thread_id); + exit_fun("nothing to add"); + } + }else{ + if (pthread_mutex_lock(&phy_stub_ticking->mutex_single_thread) != 0) { + LOG_E( MAC, "[SCHED][UE] error locking mutex for ue_thread_id %d (mutex_single_thread)\n",ue_thread_id); + exit_fun("nothing to add"); + } + while (phy_stub_ticking->num_single_thread[ue_thread_id] < 0) { + // most of the time, the thread is waiting here + LOG_D(MAC,"Waiting for single_thread (ue_thread_id %d)\n",ue_thread_id); + pthread_cond_wait( &phy_stub_ticking->cond_single_thread, &phy_stub_ticking->mutex_single_thread); + } + if (pthread_mutex_unlock(&phy_stub_ticking->mutex_single_thread) != 0) { + LOG_E( MAC, "[SCHED][UE] error unlocking mutex for ue_thread_id %d (mutex_single_thread)\n",ue_thread_id); + exit_fun("nothing to add"); + } + } - for (Mod_id=0; Mod_idframe_parms, proc->subframe_rx); if ((sf_type == SF_DL) || (UE->frame_parms.frame_type == FDD) || @@ -1059,12 +1115,12 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) { if (dl_config_req!=NULL && tx_request_pdu_list!=NULL){ //if(dl_config_req!= NULL) { - dl_config_req_UE_MAC(dl_config_req, Mod_id); + dl_config_req_UE_MAC(dl_config_req, ue_Mod_id); } if (hi_dci0_req!=NULL && hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list!=NULL){ - hi_dci0_req_UE_MAC(hi_dci0_req, Mod_id); + hi_dci0_req_UE_MAC(hi_dci0_req, ue_Mod_id); } if(nfapi_mode!=3) @@ -1078,7 +1134,7 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) { if (UE->mac_enabled==1) { - ret = ue_scheduler(UE->Mod_id, + ret = ue_scheduler(ue_Mod_id, proc->frame_rx, proc->subframe_rx, proc->frame_tx, @@ -1104,34 +1160,37 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) { // We make the start of RA between consecutive UEs differ by 20 frames //if ((UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id == 0) || (UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id>0 && proc->frame_rx >= UE_mac_inst[Mod_id-1].ra_frame + 20) ) { - if (UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id == next_Mod_id && proc->frame_rx >= next_ra_frame) { - + if (UE_mac_inst[ue_Mod_id].UE_mode[0] == PRACH && ue_Mod_id == next_Mod_id) { + next_ra_frame++; + if(next_ra_frame > 200){ // check if we have PRACH opportunity - if (is_prach_subframe(&UE->frame_parms,proc->frame_tx, proc->subframe_tx) && UE_mac_inst[Mod_id].SI_Decoded == 1) { + if (is_prach_subframe(&UE->frame_parms,proc->frame_tx, proc->subframe_tx) && UE_mac_inst[ue_Mod_id].SI_Decoded == 1) { // The one working strangely... //if (is_prach_subframe(&UE->frame_parms,proc->frame_tx, proc->subframe_tx && Mod_id == (module_id_t) init_ra_UE) ) { - PRACH_RESOURCES_t *prach_resources = ue_get_rach(Mod_id, 0, proc->frame_tx, 0, proc->subframe_tx); + PRACH_RESOURCES_t *prach_resources = ue_get_rach(ue_Mod_id, 0, proc->frame_tx, 0, proc->subframe_tx); if(prach_resources!=NULL ) { - UE_mac_inst[Mod_id].ra_frame = proc->frame_rx; - LOG_D(MAC, "UE_phy_stub_thread_rxn_txnp4 before RACH, Mod_id: %d \n", Mod_id ); - fill_rach_indication_UE_MAC(Mod_id, proc->frame_tx ,proc->subframe_tx, UL_INFO, prach_resources->ra_PreambleIndex, prach_resources->ra_RNTI); - Msg1_transmitted(Mod_id, 0, proc->frame_tx, 0); - UE_mac_inst[Mod_id].UE_mode[0] = RA_RESPONSE; - next_Mod_id = Mod_id + 1; - next_ra_frame = (proc->frame_rx + 20)%1000; + UE_mac_inst[ue_Mod_id].ra_frame = proc->frame_rx; + LOG_D(MAC, "UE_phy_stub_thread_rxn_txnp4 before RACH, Mod_id: %d frame %d subframe %d\n", ue_Mod_id ,proc->frame_tx, proc->subframe_tx); + fill_rach_indication_UE_MAC(ue_Mod_id, proc->frame_tx ,proc->subframe_tx, UL_INFO, prach_resources->ra_PreambleIndex, prach_resources->ra_RNTI); + Msg1_transmitted(ue_Mod_id, 0, proc->frame_tx, 0); + UE_mac_inst[ue_Mod_id].UE_mode[0] = RA_RESPONSE; + next_Mod_id = ue_Mod_id + 1; + //next_ra_frame = (proc->frame_rx + 20)%1000; + next_ra_frame = 0; } //ue_prach_procedures(ue,proc,eNB_id,abstraction_flag,mode); } + } } // mode is PRACH // Substitute call to phy_procedures Tx with call to phy_stub functions in order to trigger // UE Tx procedures directly at the MAC layer, based on the received ul_config requests from the vnf (eNB). // Generate UL_indications which correspond to UL traffic. if(ul_config_req!=NULL){ //&& UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL){ - ul_config_req_UE_MAC(ul_config_req, timer_frame, timer_subframe, Mod_id); + ul_config_req_UE_MAC(ul_config_req, timer_frame, timer_subframe, ue_Mod_id); } } @@ -1140,6 +1199,19 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) { } //for (Mod_id=0; Mod_idnum_single_thread[ue_thread_id] = -1; + + // waiting for all UE's threads set phy_stub_ticking->num_single_thread[ue_thread_id] = -1. + if(ue_thread_id == 0){ + do{ + end_flag = 1; + for(uint16_t i = 0;i< NB_THREAD_INST;i++){ + if(phy_stub_ticking->num_single_thread[i] == 0){ + end_flag = 0; + } + } + }while(end_flag == 0); + if (UL_INFO->crc_ind.crc_indication_body.number_of_crcs>0) { @@ -1154,6 +1226,9 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) { //LOG_D(PHY,"UL_info->rx_ind.number_of_pdus:%d RX_IND:SFN/SF:%d\n", UL_info->rx_ind.rx_indication_body.number_of_pdus, NFAPI_SFNSF2DEC(UL_info->rx_ind.sfn_sf)); //LOG_I(MAC, "ul_config_req_UE_MAC 2.3, SFN/SF of PNF counter:%d.%d, number_of_pdus: %d \n", timer_frame, timer_subframe, UL_INFO->rx_ind.rx_indication_body.number_of_pdus); oai_nfapi_rx_ind(&UL_INFO->rx_ind); + for(uint8_t num_pdu = 0;num_pdu < UL_INFO->rx_ind.rx_indication_body.number_of_pdus;num_pdu++){ + free(UL_INFO->rx_ind.rx_indication_body.rx_pdu_list[num_pdu].data); + } //LOG_I(MAC, "ul_config_req_UE_MAC 2.31 \n"); UL_INFO->rx_ind.rx_indication_body.number_of_pdus = 0; } @@ -1190,14 +1265,19 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) { free(UL_INFO->sr_ind.sr_indication_body.sr_pdu_list); UL_INFO->sr_ind.sr_indication_body.sr_pdu_list = NULL; //} - + free(UL_INFO->cqi_ind.cqi_pdu_list); + UL_INFO->cqi_ind.cqi_pdu_list = NULL; + free(UL_INFO->cqi_ind.cqi_raw_pdu_list); + UL_INFO->cqi_ind.cqi_raw_pdu_list = NULL; free(UL_INFO); UL_INFO = NULL; // De-allocate memory of nfapi requests copies before next subframe round if(dl_config_req!=NULL){ - if(dl_config_req->vendor_extension) - free(dl_config_req->vendor_extension); + if(dl_config_req->vendor_extension!=NULL){ + free(dl_config_req->vendor_extension); + dl_config_req->vendor_extension = NULL; + } if(dl_config_req->dl_config_request_body.dl_config_pdu_list!=NULL){ free(dl_config_req->dl_config_request_body.dl_config_pdu_list); dl_config_req->dl_config_request_body.dl_config_pdu_list = NULL; @@ -1227,7 +1307,7 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) { hi_dci0_req = NULL; } - + } } // thread finished @@ -1792,19 +1872,22 @@ void init_UE_single_thread_stub(int nb_inst) { // In phy_stub_UE mode due to less heavy processing operations we don't need two threads //int nb_threads=RX_NB_TH; int nb_threads=1; - for (int i=0; iUE = UE; - rtd->proc = &UE->proc.proc_rxtx[i]; - - pthread_mutex_init(&UE->proc.proc_rxtx[i].mutex_rxtx,NULL); - pthread_cond_init(&UE->proc.proc_rxtx[i].cond_rxtx,NULL); - UE->proc.proc_rxtx[i].sub_frame_start=i; - UE->proc.proc_rxtx[i].sub_frame_step=nb_threads; - printf("Init_UE_threads rtd %d proc %d nb_threads %d i %d\n",rtd->proc->sub_frame_start, UE->proc.proc_rxtx[i].sub_frame_start,nb_threads, i); - pthread_create(&UE->proc.proc_rxtx[i].pthread_rxtx, NULL, UE_phy_stub_single_thread_rxn_txnp4, rtd); + for(uint16_t ue_thread_id = 0;ue_thread_id < NB_THREAD_INST;ue_thread_id++){ + UE = PHY_vars_UE_g[ue_thread_id][0]; + for (int i=0; iUE = UE; + rtd->proc = &UE->proc.proc_rxtx[i]; + rtd->ue_thread_id = ue_thread_id; + pthread_mutex_init(&UE->proc.proc_rxtx[i].mutex_rxtx,NULL); + pthread_cond_init(&UE->proc.proc_rxtx[i].cond_rxtx,NULL); + UE->proc.proc_rxtx[i].sub_frame_start=i; + UE->proc.proc_rxtx[i].sub_frame_step=nb_threads; + printf("Init_UE_threads rtd %d proc %d nb_threads %d i %d\n",rtd->proc->sub_frame_start, UE->proc.proc_rxtx[i].sub_frame_start,nb_threads, i); + pthread_create(&UE->proc.proc_rxtx[i].pthread_rxtx, NULL, UE_phy_stub_single_thread_rxn_txnp4, rtd); + } } // Remove thread for UE_sync in phy_stub_UE mode. //pthread_create(&UE->proc.pthread_synch,NULL,UE_thread_synch,(void*)UE); @@ -2074,8 +2157,11 @@ int init_timer_thread(void) { pthread_mutex_init(&UE->timer_mutex,NULL); pthread_cond_init(&UE->timer_cond,NULL); UE->instance_cnt_timer = -1; + memset(&phy_stub_ticking->num_single_thread[0],0,sizeof(int)*NB_THREAD_INST); pthread_mutex_init(&phy_stub_ticking->mutex_ticking,NULL); pthread_cond_init(&phy_stub_ticking->cond_ticking,NULL); + pthread_mutex_init(&phy_stub_ticking->mutex_single_thread,NULL); + pthread_cond_init(&phy_stub_ticking->cond_single_thread,NULL); pthread_create(&phy_stub_ticking->pthread_timer, NULL, &timer_thread, NULL); return 0; } From 05fb6c9192ea78a242ab96e75478b6152e1da520 Mon Sep 17 00:00:00 2001 From: Y_Tomita Date: Mon, 22 Oct 2018 17:59:24 +0900 Subject: [PATCH 25/53] bugfix about MSG4 in L2 FAPI simulator. --- openair2/LAYER2/MAC/eNB_scheduler_RA.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/LAYER2/MAC/eNB_scheduler_RA.c b/openair2/LAYER2/MAC/eNB_scheduler_RA.c index d8c5683f61..4010d892e9 100755 --- a/openair2/LAYER2/MAC/eNB_scheduler_RA.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_RA.c @@ -1427,7 +1427,7 @@ schedule_RA(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) generate_Msg2(module_idP, CC_id, frameP, subframeP, ra); // In case of nFAPI, sometimes timing of eNB and UE become different. // So if nfapi_mode == 2(VNF) , this function don't check timing to avoid Attach failure. - else if ((ra->state == MSG4 && ra->Msg4_frame == frameP && ra->Msg4_subframe == subframeP ) || (nfapi_mode == 2)) + else if ((ra->state == MSG4 && ra->Msg4_frame == frameP && ra->Msg4_subframe == subframeP ) || (nfapi_mode == 2 && ra->state == MSG4)) generate_Msg4(module_idP, CC_id, frameP, subframeP, ra); else if (ra->state == WAITMSG4ACK) check_Msg4_retransmission(module_idP, CC_id, frameP, From ff312b1b97533660a21c26b24b8ff176a9ab5e59 Mon Sep 17 00:00:00 2001 From: Y_Tomita Date: Tue, 23 Oct 2018 12:56:56 +0900 Subject: [PATCH 26/53] Fix to set message_id in VNF.(Failed to commit 2151da7b.) --- nfapi/oai_integration/nfapi_vnf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nfapi/oai_integration/nfapi_vnf.c b/nfapi/oai_integration/nfapi_vnf.c index 8022bc53f4..765dc266b9 100755 --- a/nfapi/oai_integration/nfapi_vnf.c +++ b/nfapi/oai_integration/nfapi_vnf.c @@ -1112,7 +1112,7 @@ int oai_nfapi_dl_config_req(nfapi_dl_config_request_t *dl_config_req) nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config; dl_config_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!! - + dl_config_req->header.message_id = NFAPI_DL_CONFIG_REQUEST; int retval = nfapi_vnf_p7_dl_config_req(p7_config, dl_config_req); dl_config_req->dl_config_request_body.number_pdcch_ofdm_symbols = 1; @@ -1131,7 +1131,7 @@ int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req) nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config; tx_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!! - + tx_req->header.message_id = NFAPI_TX_REQUEST; //LOG_D(PHY, "[VNF] %s() TX_REQ sfn_sf:%d number_of_pdus:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(tx_req->sfn_sf), tx_req->tx_request_body.number_of_pdus); int retval = nfapi_vnf_p7_tx_req(p7_config, tx_req); @@ -1149,7 +1149,7 @@ int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req) { nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config; hi_dci0_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!! - + hi_dci0_req->header.message_id = NFAPI_HI_DCI0_REQUEST; //LOG_D(PHY, "[VNF] %s() HI_DCI0_REQ sfn_sf:%d dci:%d hi:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(hi_dci0_req->sfn_sf), hi_dci0_req->hi_dci0_request_body.number_of_dci, hi_dci0_req->hi_dci0_request_body.number_of_hi); int retval = nfapi_vnf_p7_hi_dci0_req(p7_config, hi_dci0_req); @@ -1168,7 +1168,7 @@ int oai_nfapi_ul_config_req(nfapi_ul_config_request_t *ul_config_req) { nfapi_vnf_p7_config_t *p7_config = vnf.p7_vnfs[0].config; ul_config_req->header.phy_id = 1; // DJP HACK TODO FIXME - need to pass this around!!!! - + ul_config_req->header.message_id = NFAPI_UL_CONFIG_REQUEST; //LOG_D(PHY, "[VNF] %s() header message_id:%02x\n", __FUNCTION__, ul_config_req->header.message_id); //LOG_D(PHY, "[VNF] %s() UL_CONFIG sfn_sf:%d PDUs:%d rach_prach_frequency_resources:%d srs_present:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(ul_config_req->sfn_sf), ul_config_req->ul_config_request_body.number_of_pdus, ul_config_req->ul_config_request_body.rach_prach_frequency_resources, ul_config_req->ul_config_request_body.srs_present); From 2ed0722544fd6fe9662187b06bc093a7f995d1fc Mon Sep 17 00:00:00 2001 From: Y_Tomita Date: Tue, 23 Oct 2018 13:15:09 +0900 Subject: [PATCH 27/53] Changed difinition of some valuables to add initialization. --- openair2/PHY_INTERFACE/phy_stub_UE.h | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.h b/openair2/PHY_INTERFACE/phy_stub_UE.h index 1afb82add3..21fb8518fa 100755 --- a/openair2/PHY_INTERFACE/phy_stub_UE.h +++ b/openair2/PHY_INTERFACE/phy_stub_UE.h @@ -19,20 +19,21 @@ // this mutex is used to set multiple UE's UL value in L2 FAPI simulator. FILL_UL_INFO_MUTEX_t fill_ul_mutex; - -UL_IND_t *UL_INFO; - -nfapi_tx_request_pdu_t* tx_request_pdu_list; +//below 2 difinitions move to phy_stub_UE.c to add initialization when difinition. +extern UL_IND_t *UL_INFO; +extern nfapi_tx_request_pdu_t* tx_request_pdu_list; // New /// Pointers to config_request types. Used from nfapi callback functions. -nfapi_dl_config_request_t* dl_config_req; -nfapi_ul_config_request_t* ul_config_req; -nfapi_hi_dci0_request_t* hi_dci0_req; +//below 3 difinitions move to phy_stub_UE.c to add initialization when difinition. +extern nfapi_dl_config_request_t* dl_config_req; +extern nfapi_ul_config_request_t* ul_config_req; +extern nfapi_hi_dci0_request_t* hi_dci0_req; int tx_req_num_elems; -int next_ra_frame; -module_id_t next_Mod_id; +//below 2 difinitions move to lte-ue.c to add initialization when difinition. +//int next_ra_frame; +//module_id_t next_Mod_id; eth_params_t stub_eth_params; From 6404eddfc12d05ee950ce97080447813d72409bd Mon Sep 17 00:00:00 2001 From: Y_Tomita Date: Tue, 23 Oct 2018 13:19:33 +0900 Subject: [PATCH 28/53] Fix easy mistatke. --- targets/RT/USER/lte-ue.c | 1 - 1 file changed, 1 deletion(-) diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index 39e6179d65..4c52b0b792 100755 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -1049,7 +1049,6 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) { UL_INFO->harq_ind.harq_indication_body.harq_pdu_list = (nfapi_harq_indication_pdu_t*)malloc(NB_UE_INST*sizeof(nfapi_harq_indication_pdu_t)); UL_INFO->harq_ind.harq_indication_body.number_of_harqs = 0; - UL_INFO->sr_ind.sr_indication_body.sr_pdu_list = (nfapi_sr_indication_pdu_t*)malloc(NB_UE_INST*sizeof(nfapi_sr_indication_pdu_t)); UL_INFO->sr_ind.sr_indication_body.sr_pdu_list = (nfapi_sr_indication_pdu_t*)malloc(NB_UE_INST*sizeof(nfapi_sr_indication_pdu_t)); UL_INFO->sr_ind.sr_indication_body.number_of_srs = 0; From 31d6783d60dea25f90253e563904d2f9f71db675 Mon Sep 17 00:00:00 2001 From: Y_Tomita Date: Tue, 23 Oct 2018 15:23:11 +0900 Subject: [PATCH 29/53] Modify setting of new_sdu_p->data->inst to avoid unexpected setting in case of UE. --- openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 4 +++- openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index 3d6650a96f..b16b7ad062 100755 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -800,8 +800,10 @@ pdcp_data_ind( #endif } else { ((pdcp_data_ind_header_t*) new_sdu_p->data)->rb_id = rb_id + (ctxt_pP->module_id * maxDRB); + ((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = ctxt_pP->module_id; } - ((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = ctxt_pP->module_id; + // new_sdu_p->data->inst is set again in UE case so move to above. + //((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = ctxt_pP->module_id; #ifdef DEBUG_PDCP_FIFO_FLUSH_SDU static uint32_t pdcp_inst = 0; diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c index 96a0ad26ce..3b0283525e 100755 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c @@ -168,7 +168,11 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const ctxt_pP) ((pdcp_data_ind_header_t*) sdu_p->data)->inst, ((pdcp_data_ind_header_t *) sdu_p->data)->data_size); #else - ((pdcp_data_ind_header_t *)(sdu_p->data))->inst = 0; + // value of sdu_p->data->inst is set in pdcp_data_ind + // it's necessary to set 1 in case of UE with S1. + if (ctxt_pP->enb_flag){ + ((pdcp_data_ind_header_t *)(sdu_p->data))->inst = 0; + } #endif #if defined(LINK_ENB_PDCP_TO_GTPV1U) From 35e81d8a66bf49ddb7fa2d102c455f4c366a19ab Mon Sep 17 00:00:00 2001 From: Y_Tomita Date: Tue, 23 Oct 2018 15:28:04 +0900 Subject: [PATCH 30/53] Add virtual NIC setting for L2 FAPI simulator. --- openair3/NAS/UE/ESM/esm_ebr_context.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) mode change 100644 => 100755 openair3/NAS/UE/ESM/esm_ebr_context.c diff --git a/openair3/NAS/UE/ESM/esm_ebr_context.c b/openair3/NAS/UE/ESM/esm_ebr_context.c old mode 100644 new mode 100755 index e2a327f488..865be3ea8c --- a/openair3/NAS/UE/ESM/esm_ebr_context.c +++ b/openair3/NAS/UE/ESM/esm_ebr_context.c @@ -58,6 +58,7 @@ Description Defines functions used to handle EPS bearer contexts. #include #include +extern uint8_t nfapi_mode; /****************************************************************************/ /**************** E X T E R N A L D E F I N I T I O N S ****************/ @@ -272,7 +273,21 @@ int esm_ebr_context_create( strcpy(broadcast, ipv4_addr); } - res = sprintf(command_line, + if(nfapi_mode ==3){ + // this is for L2 FAPI simulator. + // change for multiple UE's like 256UEs. + // if it's made too many tables , OS may crush so we use one table. + res = sprintf(command_line, + "ifconfig oip%d %s netmask %s broadcast %s up && " + "ip rule add from %s/24 table %d && " + "ip rule add to %s/24 table %d && " + "ip route add default dev oip%d table %d && " + ueid+1, ipv4_addr, netmask, broadcast, + ipv4_addr, 201, + ipv4_addr, 201, + ueid+1, 201, ueid+1); + } else { + res = sprintf(command_line, "ifconfig oip%d %s netmask %s broadcast %s up && " "ip rule add from %s/32 table %d && " "ip rule add to %s/32 table %d && " @@ -281,6 +296,7 @@ int esm_ebr_context_create( ipv4_addr, ueid + 201, ipv4_addr, ueid + 201, ueid + 1, ueid + 201); + } if ( res<0 ) { LOG_TRACE(WARNING, "ESM-PROC - Failed to system command string"); } From 6d97a7358bd6a7784caf017e95f9e6d6ad322915 Mon Sep 17 00:00:00 2001 From: Y_Tomita Date: Tue, 23 Oct 2018 15:31:13 +0900 Subject: [PATCH 31/53] Add sudo to enable init_nas_S1. --- cmake_targets/tools/init_nas_s1 | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cmake_targets/tools/init_nas_s1 b/cmake_targets/tools/init_nas_s1 index cab4ad047b..b78ab34ff9 100755 --- a/cmake_targets/tools/init_nas_s1 +++ b/cmake_targets/tools/init_nas_s1 @@ -52,20 +52,20 @@ load_module ../../targets/bin/ue_ip.ko if [ "$1" = "UE" ]; then echo "bring up $LTEIF interface for UE" - ifconfig $LTEIF up + sudo ifconfig $LTEIF up fi -ip route flush cache +sudo ip route flush cache sleep 1 -sysctl -w net.ipv4.conf.all.log_martians=1 +sudo sysctl -w net.ipv4.conf.all.log_martians=1 echo "Disabling reverse path filtering" -sysctl -w net.ipv4.conf.all.rp_filter=0 -ip route flush cache +sudo sysctl -w net.ipv4.conf.all.rp_filter=0 +sudo ip route flush cache # Check table 200 lte in /etc/iproute2/rt_tables fgrep lte /etc/iproute2/rt_tables > /dev/null if [ $? -ne 0 ]; then echo "200 lte " >> /etc/iproute2/rt_tables fi -ip rule add fwmark 1 table lte -ip route add default dev $LTEIF table lte +sudo ip rule add fwmark 1 table lte +sudo ip route add default dev $LTEIF table lte From f39f321d3bc0e774167838c314028e04e679bf62 Mon Sep 17 00:00:00 2001 From: Y_Tomita Date: Tue, 23 Oct 2018 18:50:46 +0900 Subject: [PATCH 32/53] Compiling error fix. --- openair3/NAS/UE/ESM/esm_ebr_context.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openair3/NAS/UE/ESM/esm_ebr_context.c b/openair3/NAS/UE/ESM/esm_ebr_context.c index 865be3ea8c..25d3bea6ea 100755 --- a/openair3/NAS/UE/ESM/esm_ebr_context.c +++ b/openair3/NAS/UE/ESM/esm_ebr_context.c @@ -281,11 +281,11 @@ int esm_ebr_context_create( "ifconfig oip%d %s netmask %s broadcast %s up && " "ip rule add from %s/24 table %d && " "ip rule add to %s/24 table %d && " - "ip route add default dev oip%d table %d && " + "ip route add default dev oip%d table %d", ueid+1, ipv4_addr, netmask, broadcast, ipv4_addr, 201, ipv4_addr, 201, - ueid+1, 201, ueid+1); + ueid+1, 201); } else { res = sprintf(command_line, "ifconfig oip%d %s netmask %s broadcast %s up && " From f7bf5905a0ce81e1d35576c6d168aa605635295e Mon Sep 17 00:00:00 2001 From: Y_Tomita Date: Wed, 24 Oct 2018 09:48:09 +0900 Subject: [PATCH 33/53] Refactoring for L2 FAPI simulator. --- openair2/LAYER2/MAC/main_ue.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/openair2/LAYER2/MAC/main_ue.c b/openair2/LAYER2/MAC/main_ue.c index dd76df76dd..1168ed265a 100755 --- a/openair2/LAYER2/MAC/main_ue.c +++ b/openair2/LAYER2/MAC/main_ue.c @@ -44,6 +44,7 @@ #include "common/ran_context.h" extern FILL_UL_INFO_MUTEX_t fill_ul_mutex; +extern uint8_t nfapi_mode; extern void openair_rrc_top_init_ue( int eMBMS_active, char* uecap_xer, uint8_t cba_group_active, uint8_t HO_active); void dl_phy_sync_success(module_id_t module_idP, frame_t frameP, unsigned char eNB_index, uint8_t first_sync) //init as MR @@ -103,13 +104,15 @@ mac_top_init_ue(int eMBMS_active, char *uecap_xer, UE_mac_inst = NULL; } - // mutex below are used for multiple UE's L2 FAPI simulation. - pthread_mutex_init(&fill_ul_mutex.rx_mutex,NULL); - pthread_mutex_init(&fill_ul_mutex.crc_mutex,NULL); - pthread_mutex_init(&fill_ul_mutex.sr_mutex,NULL); - pthread_mutex_init(&fill_ul_mutex.harq_mutex,NULL); - pthread_mutex_init(&fill_ul_mutex.cqi_mutex,NULL); - pthread_mutex_init(&fill_ul_mutex.rach_mutex,NULL); + // mutex below are used for multiple UE's L2 FAPI simulation. + if (nfapi_mode == 3){ + pthread_mutex_init(&fill_ul_mutex.rx_mutex,NULL); + pthread_mutex_init(&fill_ul_mutex.crc_mutex,NULL); + pthread_mutex_init(&fill_ul_mutex.sr_mutex,NULL); + pthread_mutex_init(&fill_ul_mutex.harq_mutex,NULL); + pthread_mutex_init(&fill_ul_mutex.cqi_mutex,NULL); + pthread_mutex_init(&fill_ul_mutex.rach_mutex,NULL); + } LOG_I(MAC, "[MAIN] calling RRC\n"); openair_rrc_top_init_ue(eMBMS_active, uecap_xer, cba_group_active, From 58c6520218dfd707e814766e153456044132086a Mon Sep 17 00:00:00 2001 From: Y_Tomita Date: Wed, 24 Oct 2018 10:00:33 +0900 Subject: [PATCH 34/53] Remove a change about MSG2 and MSG4 because this is used not only in L2 FAPI simulator but also in real eNB. --- openair2/LAYER2/MAC/eNB_scheduler_RA.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/openair2/LAYER2/MAC/eNB_scheduler_RA.c b/openair2/LAYER2/MAC/eNB_scheduler_RA.c index 4010d892e9..b6fdaab8a9 100755 --- a/openair2/LAYER2/MAC/eNB_scheduler_RA.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_RA.c @@ -501,9 +501,7 @@ generate_Msg2(module_id_t module_idP, int CC_idP, frame_t frameP, #endif { - // In case of nFAPI, sometimes timing of eNB and UE become different. - // So if nfapi_mode == 2(VNF) , this function don't check timing to avoid Attach failure. - if (((ra->Msg2_frame == frameP) && (ra->Msg2_subframe == subframeP)) || (nfapi_mode == 2)) { + if ((ra->Msg2_frame == frameP) && (ra->Msg2_subframe == subframeP)) { LOG_D(MAC, "[eNB %d] CC_id %d Frame %d, subframeP %d: Generating RAR DCI, state %d\n", module_idP, CC_idP, frameP, subframeP, ra->state); @@ -1012,9 +1010,7 @@ generate_Msg4(module_id_t module_idP, int CC_idP, frame_t frameP, { // This is normal LTE case LOG_D(MAC, "generate_Msg4 1 ra->Msg4_frame SFN/SF: %d.%d, frameP SFN/SF: %d.%d FOR eNB_Mod: %d \n", ra->Msg4_frame, ra->Msg4_subframe, frameP, subframeP, module_idP); - // In case of nFAPI, sometimes timing of eNB and UE become different. - // So if nfapi_mode == 2(VNF) , this function don't check timing to avoid Attach failure. - if (((ra->Msg4_frame == frameP) && (ra->Msg4_subframe == subframeP))||((nfapi_mode == 2)&&(cc->tdd_Config == NULL))) { + if ((ra->Msg4_frame == frameP) && (ra->Msg4_subframe == subframeP)) { // Get RRCConnectionSetup for Piggyback /*rrc_sdu_length = mac_rrc_data_req(module_idP, CC_idP, frameP, CCCH, 1, // 1 transport block @@ -1425,9 +1421,7 @@ schedule_RA(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) if (ra->state == MSG2) generate_Msg2(module_idP, CC_id, frameP, subframeP, ra); - // In case of nFAPI, sometimes timing of eNB and UE become different. - // So if nfapi_mode == 2(VNF) , this function don't check timing to avoid Attach failure. - else if ((ra->state == MSG4 && ra->Msg4_frame == frameP && ra->Msg4_subframe == subframeP ) || (nfapi_mode == 2 && ra->state == MSG4)) + else if (ra->state == MSG4 && ra->Msg4_frame == frameP && ra->Msg4_subframe == subframeP ) generate_Msg4(module_idP, CC_id, frameP, subframeP, ra); else if (ra->state == WAITMSG4ACK) check_Msg4_retransmission(module_idP, CC_id, frameP, From 66dad294a51e7a39528f059c75061a0661f471a8 Mon Sep 17 00:00:00 2001 From: Y_Tomita Date: Wed, 24 Oct 2018 18:26:24 +0900 Subject: [PATCH 35/53] Change define NUMBER_OF_UE_MAX to avoid unexpected access. --- targets/COMMON/openairinterface5g_limits.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) mode change 100644 => 100755 targets/COMMON/openairinterface5g_limits.h diff --git a/targets/COMMON/openairinterface5g_limits.h b/targets/COMMON/openairinterface5g_limits.h old mode 100644 new mode 100755 index 1c27f65585..82a9f7df02 --- a/targets/COMMON/openairinterface5g_limits.h +++ b/targets/COMMON/openairinterface5g_limits.h @@ -15,7 +15,12 @@ # define NUMBER_OF_eNB_MAX 7 # define NUMBER_OF_RU_MAX 32 # ifndef UE_EXPANSION -# define NUMBER_OF_UE_MAX 20 +/* if the value of MAX_MOBILES_PER_ENB and NUMBER_OF_UE_MAX is different, +eNB process will exit because unexpected access happens. +Now some parts are using NUMBER_OF_UE_MAX +and the other are using MAX_MOBILES_PER_ENB in for-loop. +*/ +# define NUMBER_OF_UE_MAX 16 # define NUMBER_OF_CONNECTED_eNB_MAX 3 # else # define NUMBER_OF_UE_MAX 256 From 0b55ecab3769b6c4951d3b0d7ec7564bf67071c4 Mon Sep 17 00:00:00 2001 From: Y_Tomita Date: Wed, 24 Oct 2018 18:44:18 +0900 Subject: [PATCH 36/53] Fix lack of initialize a valuable. --- openair2/LAYER2/MAC/eNB_scheduler_fairRR.c | 1 + 1 file changed, 1 insertion(+) mode change 100644 => 100755 openair2/LAYER2/MAC/eNB_scheduler_fairRR.c diff --git a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c old mode 100644 new mode 100755 index 9ab4306000..da89564b02 --- a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.c @@ -569,6 +569,7 @@ void dlsch_scheduler_pre_processor_fairRR (module_id_t Mod_id, LTE_eNB_UE_stats *eNB_UE_stats2 = NULL; UE_sched_ctrl *ue_sched_ctl1, *ue_sched_ctl2; #endif + memset(rballoc_sub[0],0,(MAX_NUM_CCs)*(N_RBG_MAX)*sizeof(unsigned char)); memset(min_rb_unit,0,sizeof(min_rb_unit)); for (CC_id=0; CC_id Date: Wed, 24 Oct 2018 18:58:05 +0900 Subject: [PATCH 37/53] Add comments. --- openair2/LAYER2/MAC/ue_procedures.c | 4 ++++ targets/RT/USER/lte-enb.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index 12fbef7d80..29579517dd 100755 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -2563,6 +2563,10 @@ ue_scheduler(const module_id_t module_idP, //Rrc_xface->Frame_index=Mac_rlc_xface->frameP; //if (subframe%5 == 0) //LG#ifdef EXMIMO + + // data to/from NETLINK is treated in pdcp_run. + // one socket is used in multiple UE's L2 FAPI simulator and + // only first UE need to do this. if(module_idP == 0){ pdcp_run(&ctxt); } diff --git a/targets/RT/USER/lte-enb.c b/targets/RT/USER/lte-enb.c index 17d3cd63d4..d6aeb99340 100755 --- a/targets/RT/USER/lte-enb.c +++ b/targets/RT/USER/lte-enb.c @@ -1002,7 +1002,7 @@ void init_eNB_proc(int inst) { pthread_create( &proc_rxtx[0].pthread_rxtx, attr0, eNB_thread_rxtx, proc ); pthread_create( &proc_rxtx[1].pthread_rxtx, attr1, tx_thread, proc); } - else if (nfapi_mode == 2) { + else if (nfapi_mode == 2) { // this is neccesary in VNF or L2 FAPI simulator. pthread_create( &proc_rxtx[0].pthread_rxtx, attr0, eNB_thread_rxtx, &proc_rxtx[0] ); pthread_create( &proc_rxtx[1].pthread_rxtx, attr1, eNB_thread_rxtx, &proc_rxtx[1] ); } From fd1054598d9de81643ed3d078d465c27e222c6b7 Mon Sep 17 00:00:00 2001 From: Y_Tomita Date: Wed, 24 Oct 2018 19:14:00 +0900 Subject: [PATCH 38/53] Change the conditional expression about init_eNB and add comment. --- targets/RT/USER/lte-softmodem.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index 87c43fbf55..ea76e7099b 100755 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -1049,7 +1049,7 @@ if (nfapi_mode==2) {// VNF number_of_cards = 1; printf("RC.nb_L1_inst:%d\n", RC.nb_L1_inst); - if (RC.nb_L1_inst > 0 && nfapi_mode != 2) { + if (RC.nb_L1_inst > 0) { printf("Initializing eNB threads single_thread_flag:%d wait_for_sync:%d\n", single_thread_flag,wait_for_sync); init_eNB(single_thread_flag,wait_for_sync); // for (inst=0;inst0 && nfapi_mode != 2) { printf("Initializing RU threads\n"); init_RU(rf_config_file); From cfab3139058cd763fdaf128eda5d32c78c5d3475 Mon Sep 17 00:00:00 2001 From: Y_Tomita Date: Wed, 24 Oct 2018 19:24:16 +0900 Subject: [PATCH 39/53] Remove a change about rrc_sdu_length.(because I don't know this modification is correct or not.) --- openair2/LAYER2/MAC/eNB_scheduler_RA.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/LAYER2/MAC/eNB_scheduler_RA.c b/openair2/LAYER2/MAC/eNB_scheduler_RA.c index b6fdaab8a9..e71dba1a9c 100755 --- a/openair2/LAYER2/MAC/eNB_scheduler_RA.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_RA.c @@ -1168,7 +1168,7 @@ generate_Msg4(module_id_t module_idP, int CC_idP, frame_t frameP, mac->TX_req[CC_idP].sfn_sf = fill_nfapi_tx_req(&mac->TX_req[CC_idP].tx_request_body, (frameP * 10) + subframeP, - rrc_sdu_length + offset, + rrc_sdu_length, mac->pdu_index[CC_idP], mac->UE_list. DLSCH_pdu[CC_idP][0][(unsigned char)UE_id].payload[0]); From b60e861b148e4772362ba1dd0ab765e7c5fca785 Mon Sep 17 00:00:00 2001 From: Y_Tomita Date: Thu, 25 Oct 2018 22:09:33 +0900 Subject: [PATCH 40/53] Add --musim option for L2 FAPI simulator. --- cmake_targets/CMakeLists.txt | 1 + cmake_targets/build_oai | 6 ++++++ openair2/COMMON/platform_constants.h | 11 +++++++++++ targets/COMMON/openairinterface5g_limits.h | 15 +++++++++++++++ 4 files changed, 33 insertions(+) mode change 100644 => 100755 cmake_targets/CMakeLists.txt mode change 100644 => 100755 openair2/COMMON/platform_constants.h diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt old mode 100644 new mode 100755 index 23d96afc54..86303e3e76 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -616,6 +616,7 @@ add_boolean_option(MESSAGE_CHART_GENERATOR_PHY False "trace some PHY exchang add_boolean_option(UE_EXPANSION False "enable UE_EXPANSION with max 256 UE") add_boolean_option(PHY_TX_THREAD False "enable UE_EXPANSION with max 256 UE") add_boolean_option(PRE_SCD_THREAD False "enable UE_EXPANSION with max 256 UE") +add_boolean_option(UESIM_EXPANSION False "enable UESIM_EXPANSION with max 256 UE") ######################## # Include order diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index 3954827c09..9dfe9d3ecc 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -43,6 +43,7 @@ conf_nvram_path=$OPENAIR_DIR/openair3/NAS/TOOLS/ue_eurecom_test_sfr.conf MSC_GEN=0 XFORMS="True" UE_EXPANSION="False" +UESIM_EXPANSION="False" PRINT_STATS="False" VCD_TIMING="False" DEADLINE_SCHEDULER_FLAG_USER="False" @@ -218,6 +219,10 @@ function main() { UE_EXPANSION="True" echo_info "Will compile with UE_EXPANSION" shift;; + --musim) + UESIM_EXPANSION="True" + echo_info "Will compile with UESIM_EXPANSION" + shift;; --UE-conf-nvram) conf_nvram_path=$(readlink -f $2) shift 2;; @@ -539,6 +544,7 @@ function main() { echo "set ( UE_EXPANSION $UE_EXPANSION )" >> $cmake_file # echo "set ( PHY_TX_THREAD $UE_EXPANSION )" >> $cmake_file echo "set ( PRE_SCD_THREAD $UE_EXPANSION )" >> $cmake_file + echo "set ( UESIM_EXPANSION $UESIM_EXPANSION )" >> $cmake_file echo "set ( RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file echo "set ( RF_BOARD \"${HW}\")" >> $cmake_file diff --git a/openair2/COMMON/platform_constants.h b/openair2/COMMON/platform_constants.h old mode 100644 new mode 100755 index 9aa912a01e..2a3dee6b23 --- a/openair2/COMMON/platform_constants.h +++ b/openair2/COMMON/platform_constants.h @@ -68,6 +68,16 @@ # define MAX_MODULES NB_MODULES_MAX #ifndef UE_EXPANSION +// TODO:L2 FAPI simulator. +// UESIM_EXPANSION is used to be same value of MAX_MOBILES_PER_ENB +// in eNB and UE. +// now , if we use --mu option in UE, compiling error will occur. +// This problem will be fixed in the future. +# ifdef UESIM_EXPANSION +# define MAX_MOBILES_PER_ENB 256 +# define MAX_MOBILES_PER_ENB_NB_IoT 256 +# define MAX_eNB 2 +# else # ifdef LARGE_SCALE # define MAX_MOBILES_PER_ENB 128 # define MAX_MOBILES_PER_ENB_NB_IoT 128 @@ -77,6 +87,7 @@ # define MAX_MOBILES_PER_ENB_NB_IoT 16 # define MAX_eNB 2 # endif +#endif #else # define MAX_MOBILES_PER_ENB 256 # define MAX_MOBILES_PER_ENB_NB_IoT 256 diff --git a/targets/COMMON/openairinterface5g_limits.h b/targets/COMMON/openairinterface5g_limits.h index 82a9f7df02..644952ca79 100755 --- a/targets/COMMON/openairinterface5g_limits.h +++ b/targets/COMMON/openairinterface5g_limits.h @@ -5,8 +5,18 @@ # define NUMBER_OF_eNB_MAX 1 # define NUMBER_OF_RU_MAX 2 # ifndef UE_EXPANSION +// TODO:L2 FAPI simulator. +// UESIM_EXPANSION is used to be same value of NUMBER_OF_UE_MAX +// in eNB and UE. +// now , if we use --mu option in UE, compiling error will occur. +// This problem will be fixed in the future. +# ifndef UESIM_EXPANSION # define NUMBER_OF_UE_MAX 16 # define NUMBER_OF_CONNECTED_eNB_MAX 3 +# else +# define NUMBER_OF_UE_MAX 256 +# define NUMBER_OF_CONNECTED_eNB_MAX 1 +# endif # else # define NUMBER_OF_UE_MAX 256 # define NUMBER_OF_CONNECTED_eNB_MAX 1 @@ -20,8 +30,13 @@ eNB process will exit because unexpected access happens. Now some parts are using NUMBER_OF_UE_MAX and the other are using MAX_MOBILES_PER_ENB in for-loop. */ +# ifndef UESIM_EXPANSION # define NUMBER_OF_UE_MAX 16 # define NUMBER_OF_CONNECTED_eNB_MAX 3 +# else +# define NUMBER_OF_UE_MAX 256 +# define NUMBER_OF_CONNECTED_eNB_MAX 1 +# endif # else # define NUMBER_OF_UE_MAX 256 # define NUMBER_OF_CONNECTED_eNB_MAX 1 From dcfe6b32e248718402980eba28a075697c67dde7 Mon Sep 17 00:00:00 2001 From: Y_Tomita Date: Thu, 25 Oct 2018 22:10:57 +0900 Subject: [PATCH 41/53] Fix for TDD L2 FAPI simulator. --- targets/RT/USER/lte-ue.c | 12 +++++++----- targets/RT/USER/lte-uesoftmodem.c | 10 ++++++---- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index 4c52b0b792..2cdbfcc27a 100755 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -94,7 +94,7 @@ extern int oai_nfapi_rx_ind(nfapi_rx_indication_t *ind); extern int multicast_link_write_sock(int groupP, char *dataP, uint32_t sizeP); extern int simL1flag; - +extern uint16_t sf_ahead; //extern int tx_req_UE_MAC1(); void ue_stub_rx_handler(unsigned int, char *); @@ -379,7 +379,7 @@ void init_UE_stub_single_thread(int nb_inst,int eMBMS_active, int uecap_xer_in, for (inst=0;instsubframe_rx=timer_subframe; proc->frame_rx = timer_frame; - proc->subframe_tx=(timer_subframe+4)%10; - proc->frame_tx = proc->frame_rx + (proc->subframe_rx>5?1:0); + + // FDD and TDD tx timing settings. + proc->subframe_tx=(timer_subframe+sf_ahead)%10; + proc->frame_tx = proc->frame_rx + (proc->subframe_rx>(9-sf_ahead)?1:0); //oai_subframe_ind(proc->frame_rx, proc->subframe_rx); - oai_subframe_ind(timer_frame, timer_subframe); + oai_subframe_ind(proc->frame_tx,proc->subframe_tx); //Guessing that the next 4 lines are not needed for the phy_stub mode. /*initRefTimes(t2); diff --git a/targets/RT/USER/lte-uesoftmodem.c b/targets/RT/USER/lte-uesoftmodem.c index 2a2c874a91..be8a30c1bd 100755 --- a/targets/RT/USER/lte-uesoftmodem.c +++ b/targets/RT/USER/lte-uesoftmodem.c @@ -117,7 +117,7 @@ int nfapi_sync_var=-1; //!< protected by mutex \ref nfapi_sync_mutex uint8_t nfapi_mode = 0; uint16_t sf_ahead=2; - +int tddflag; char *emul_iface; @@ -498,7 +498,7 @@ extern int16_t dlsch_demod_shift; static void get_options(unsigned int *start_msc) { int CC_id; - int tddflag, nonbiotflag; + int nonbiotflag; char *loopfile=NULL; int dumpframe; uint32_t online_log_messages; @@ -565,8 +565,10 @@ static void get_options(unsigned int *start_msc) { UE_scan=0; if (tddflag > 0) { - for (CC_id=0; CC_idframe_type = TDD; + for (CC_id=0; CC_idframe_type = TDD; + frame_parms[CC_id]->tdd_config = tddflag; + } } if (frame_parms[0]->N_RB_DL !=0) { From bb7d63e97e6706e8493f30f358fa0014c5573a9d Mon Sep 17 00:00:00 2001 From: Y_Tomita Date: Fri, 26 Oct 2018 18:07:03 +0900 Subject: [PATCH 42/53] Fix timing setting in L2 FAPI simulator. --- targets/RT/USER/lte-ue.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index 2cdbfcc27a..bc393b7371 100755 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -1028,7 +1028,11 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) { //oai_subframe_ind(proc->frame_rx, proc->subframe_rx); + if(UE->frame_parms.frame_type == FDD){ + oai_subframe_ind(proc->frame_rx, proc->subframe_rx); + }else{ oai_subframe_ind(proc->frame_tx,proc->subframe_tx); + } //Guessing that the next 4 lines are not needed for the phy_stub mode. /*initRefTimes(t2); From e13c962d24c0f66a6ae5d39db6d7b3bec206bff0 Mon Sep 17 00:00:00 2001 From: "yoshio.inoue" Date: Fri, 2 Nov 2018 16:54:19 +0900 Subject: [PATCH 43/53] Fixed bug that u-plane is not transferred with multiple UEs --- openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 14 ++++++++++-- openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c | 15 +++++++++++-- openair2/NETWORK_DRIVER/UE_IP/common.c | 11 +++++++++- openair2/NETWORK_DRIVER/UE_IP/device.c | 10 ++++----- openair3/NAS/UE/ESM/esm_ebr_context.c | 28 +++++++++++++++++++++--- targets/RT/USER/lte-uesoftmodem.c | 12 ++++++++-- 6 files changed, 75 insertions(+), 15 deletions(-) diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index b16b7ad062..0112fe10ef 100755 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -64,7 +64,9 @@ #endif extern int otg_enabled; - +#if defined(ENABLE_USE_MME) +extern uint8_t nfapi_mode; +#endif #include "common/ran_context.h" extern RAN_CONTEXT_t RC; hash_table_t *pdcp_coll_p = NULL; @@ -796,7 +798,15 @@ pdcp_data_ind( * for the UE compiled in noS1 mode, we need 0 * TODO: be sure of this */ - ((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = 1; + if (nfapi_mode == 3) { +#ifdef UESIM_EXPANSION + ((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = 1; +#else + ((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = ctxt_pP->module_id + 1; +#endif + } else { + ((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = 1; + } #endif } else { ((pdcp_data_ind_header_t*) new_sdu_p->data)->rb_id = rb_id + (ctxt_pP->module_id * maxDRB); diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c index 3b0283525e..0a49c7d94c 100755 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c @@ -82,10 +82,13 @@ extern struct msghdr nas_msg_tx; extern struct msghdr nas_msg_rx; unsigned char pdcp_read_state_g = 0; +extern uint8_t nfapi_mode; +#ifdef UESIM_EXPANSION +extern uint16_t inst_pdcp_list[NUMBER_OF_UE_MAX]; +#endif #endif extern Packet_OTG_List_t *otg_pdcp_buffer; -extern uint8_t nfapi_mode; #if defined(LINK_ENB_PDCP_TO_GTPV1U) # include "gtpv1u_eNB_task.h" # include "gtpv1u_eNB_defs.h" @@ -931,7 +934,15 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) rab_id = pdcp_read_header_g.rb_id % maxDRB; ctxt.rnti = pdcp_eNB_UE_instance_to_rnti[pdcp_read_header_g.rb_id / maxDRB]; } else { - ctxt.module_id = 0; + if (nfapi_mode == 3) { +#ifdef UESIM_EXPANSION + ctxt.module_id = inst_pdcp_list[pdcp_read_header_g.inst]; +#else + ctxt.module_id = pdcp_read_header_g.inst - 1; +#endif + } else { + ctxt.module_id = 0; + } rab_id = pdcp_read_header_g.rb_id % maxDRB; ctxt.rnti = pdcp_UE_UE_module_id_to_rnti[ctxt.module_id]; } diff --git a/openair2/NETWORK_DRIVER/UE_IP/common.c b/openair2/NETWORK_DRIVER/UE_IP/common.c index b21ca5f2dc..1b15ea8aed 100644 --- a/openair2/NETWORK_DRIVER/UE_IP/common.c +++ b/openair2/NETWORK_DRIVER/UE_IP/common.c @@ -304,7 +304,16 @@ ue_ip_common_ip2wireless( if (dst_addr) { printk("[UE_IP_DRV][%s] Dest %d.%d.%d.%d\n",__FUNCTION__, dst_addr[0],dst_addr[1],dst_addr[2],dst_addr[3]); } - + // modify inst by IP address for the U-Plane of multiple UEs while L2 fapi simulator start +#ifdef UESIM_EXPANSION + if ((src_addr[3] - 1)> instP) { + pdcph.inst = src_addr[3] - 1; + printk("[UE_IP_DRV] change INST from %d to %d\n",instP, pdcph.inst); + instP = src_addr[3] - 1; + priv_p=netdev_priv(ue_ip_dev[instP]); + } +#endif + // modify inst by IP address for the U-Plane of multiple UEs while L2 fapi simulator end //get Ipv4 address and pass to PCDP header printk("[UE_IP_DRV] source Id: 0x%08x\n",pdcph.sourceL2Id ); printk("[UE_IP_DRV] destinationL2Id Id: 0x%08x\n",pdcph.destinationL2Id ); diff --git a/openair2/NETWORK_DRIVER/UE_IP/device.c b/openair2/NETWORK_DRIVER/UE_IP/device.c index 47c820fe77..e67f67d6e3 100644 --- a/openair2/NETWORK_DRIVER/UE_IP/device.c +++ b/openair2/NETWORK_DRIVER/UE_IP/device.c @@ -61,7 +61,7 @@ int ue_ip_find_inst(struct net_device *dev_pP) //--------------------------------------------------------------------------- int i; - for (i=0; i=UE_IP_NB_INSTANCES_MAX)) { + if ((inst<=0) || (inst>UE_IP_NB_INSTANCES_MAX)) { printk("[UE_IP_DRV][%s] ERROR, couldn't find instance\n", __FUNCTION__); return; } @@ -243,7 +243,7 @@ int ue_ip_hard_start_xmit(struct sk_buff *skb_pP, struct net_device *dev_pP) return -1; } - if ((inst>=0) && (inst0) && (inst<=UE_IP_NB_INSTANCES_MAX)) { #ifdef OAI_DRV_OAI_DRV_DEBUG_DEVICE printk("[UE_IP_DRV][%s] inst %d, begin\n", __FUNCTION__,inst); #endif @@ -392,7 +392,7 @@ int init_module (void) // Initialize parameters shared with RRC printk("[UE_IP_DRV][%s] Starting OAI IP driver", __FUNCTION__); - for (inst=0; inst #include #include - +#ifdef PDCP_USE_NETLINK +#ifdef UESIM_EXPANSION + #include "openairinterface5g_limits.h" + extern uint16_t inst_pdcp_list[NUMBER_OF_UE_MAX]; +#endif +#endif extern uint8_t nfapi_mode; /****************************************************************************/ @@ -277,15 +282,32 @@ int esm_ebr_context_create( // this is for L2 FAPI simulator. // change for multiple UE's like 256UEs. // if it's made too many tables , OS may crush so we use one table. +#ifdef PDCP_USE_NETLINK +#ifdef UESIM_EXPANSION + uint16_t inst_nic = (pdn->ip_addr[3] & 0x000000FF) - 1; res = sprintf(command_line, "ifconfig oip%d %s netmask %s broadcast %s up && " "ip rule add from %s/24 table %d && " "ip rule add to %s/24 table %d && " "ip route add default dev oip%d table %d", - ueid+1, ipv4_addr, netmask, broadcast, + inst_nic, ipv4_addr, netmask, broadcast, ipv4_addr, 201, ipv4_addr, 201, - ueid+1, 201); + inst_nic, 201); + + inst_pdcp_list[inst_nic] = ueid; +#else + res = sprintf(command_line, + "ifconfig oip%d %s netmask %s broadcast %s up && " + "ip rule add from %s/32 table %d && " + "ip rule add to %s/32 table %d && " + "ip route add default dev oip%d table %d", + ueid + 1, ipv4_addr, netmask, broadcast, + ipv4_addr, ueid + 201, + ipv4_addr, ueid + 201, + ueid + 1, ueid + 201); +#endif +#endif } else { res = sprintf(command_line, "ifconfig oip%d %s netmask %s broadcast %s up && " diff --git a/targets/RT/USER/lte-uesoftmodem.c b/targets/RT/USER/lte-uesoftmodem.c index be8a30c1bd..9ae1ead95e 100755 --- a/targets/RT/USER/lte-uesoftmodem.c +++ b/targets/RT/USER/lte-uesoftmodem.c @@ -115,7 +115,11 @@ pthread_mutex_t nfapi_sync_mutex; int nfapi_sync_var=-1; //!< protected by mutex \ref nfapi_sync_mutex uint8_t nfapi_mode = 0; - +#ifdef PDCP_USE_NETLINK +#ifdef UESIM_EXPANSION +uint16_t inst_pdcp_list[NUMBER_OF_UE_MAX]; +#endif +#endif uint16_t sf_ahead=2; int tddflag; char *emul_iface; @@ -821,7 +825,11 @@ int main( int argc, char **argv ) int CC_id; uint8_t abstraction_flag=0; unsigned int start_msc=0; - +#ifdef PDCP_USE_NETLINK +#ifdef UESIM_EXPANSION + memset(inst_pdcp_list, 0, sizeof(inst_pdcp_list)); +#endif +#endif // Default value for the number of UEs. It will hold, // if not changed from the command line option --num-ues NB_UE_INST=1; From 3ec3a1af3478eed544b7aec064f2ae6c206e3f56 Mon Sep 17 00:00:00 2001 From: "yoshio.inoue" Date: Fri, 2 Nov 2018 16:55:13 +0900 Subject: [PATCH 44/53] Add comment --- targets/RT/USER/lte-ue.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index bc393b7371..18a47409e5 100755 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -1023,11 +1023,12 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) { proc->frame_rx = timer_frame; // FDD and TDD tx timing settings. + // XXX:It is the result of timing adjustment in debug. + // It is necessary to investigate why this will work in the future. proc->subframe_tx=(timer_subframe+sf_ahead)%10; proc->frame_tx = proc->frame_rx + (proc->subframe_rx>(9-sf_ahead)?1:0); //oai_subframe_ind(proc->frame_rx, proc->subframe_rx); - if(UE->frame_parms.frame_type == FDD){ oai_subframe_ind(proc->frame_rx, proc->subframe_rx); }else{ From 64b395c64a3346bfa1cebf7f62442034d44cb6e7 Mon Sep 17 00:00:00 2001 From: "yoshio.inoue" Date: Fri, 2 Nov 2018 19:28:15 +0900 Subject: [PATCH 45/53] Fixed overflow related to oip generation --- openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 4 ++-- openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c | 2 +- openair2/NETWORK_DRIVER/UE_IP/common.c | 6 +++--- openair2/NETWORK_DRIVER/UE_IP/device.c | 12 ++++++------ openair3/NAS/UE/ESM/esm_ebr_context.c | 6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index 0112fe10ef..7bbbbef4f8 100755 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -800,9 +800,9 @@ pdcp_data_ind( */ if (nfapi_mode == 3) { #ifdef UESIM_EXPANSION - ((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = 1; + ((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = 0; #else - ((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = ctxt_pP->module_id + 1; + ((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = ctxt_pP->module_id; #endif } else { ((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = 1; diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c index 0a49c7d94c..9d0ed19a59 100755 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c @@ -938,7 +938,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP) #ifdef UESIM_EXPANSION ctxt.module_id = inst_pdcp_list[pdcp_read_header_g.inst]; #else - ctxt.module_id = pdcp_read_header_g.inst - 1; + ctxt.module_id = pdcp_read_header_g.inst; #endif } else { ctxt.module_id = 0; diff --git a/openair2/NETWORK_DRIVER/UE_IP/common.c b/openair2/NETWORK_DRIVER/UE_IP/common.c index 1b15ea8aed..d23132d96a 100644 --- a/openair2/NETWORK_DRIVER/UE_IP/common.c +++ b/openair2/NETWORK_DRIVER/UE_IP/common.c @@ -306,10 +306,10 @@ ue_ip_common_ip2wireless( } // modify inst by IP address for the U-Plane of multiple UEs while L2 fapi simulator start #ifdef UESIM_EXPANSION - if ((src_addr[3] - 1)> instP) { - pdcph.inst = src_addr[3] - 1; + if ((src_addr[3] - 2)> instP) { + pdcph.inst = src_addr[3] - 2; printk("[UE_IP_DRV] change INST from %d to %d\n",instP, pdcph.inst); - instP = src_addr[3] - 1; + instP = src_addr[3] - 2; priv_p=netdev_priv(ue_ip_dev[instP]); } #endif diff --git a/openair2/NETWORK_DRIVER/UE_IP/device.c b/openair2/NETWORK_DRIVER/UE_IP/device.c index e67f67d6e3..4f295543dc 100644 --- a/openair2/NETWORK_DRIVER/UE_IP/device.c +++ b/openair2/NETWORK_DRIVER/UE_IP/device.c @@ -61,7 +61,7 @@ int ue_ip_find_inst(struct net_device *dev_pP) //--------------------------------------------------------------------------- int i; - for (i=1; i<=UE_IP_NB_INSTANCES_MAX; i++) + for (i=0; iUE_IP_NB_INSTANCES_MAX)) { + if ((inst<0) || (inst>=UE_IP_NB_INSTANCES_MAX)) { printk("[UE_IP_DRV][%s] ERROR, couldn't find instance\n", __FUNCTION__); return; } @@ -243,7 +243,7 @@ int ue_ip_hard_start_xmit(struct sk_buff *skb_pP, struct net_device *dev_pP) return -1; } - if ((inst>0) && (inst<=UE_IP_NB_INSTANCES_MAX)) { + if ((inst>=0) && (instip_addr[3] & 0x000000FF) - 1; + uint16_t inst_nic = (pdn->ip_addr[3] & 0x000000FF) - 2; res = sprintf(command_line, "ifconfig oip%d %s netmask %s broadcast %s up && " "ip rule add from %s/24 table %d && " "ip rule add to %s/24 table %d && " "ip route add default dev oip%d table %d", - inst_nic, ipv4_addr, netmask, broadcast, + inst_nic + 1, ipv4_addr, netmask, broadcast, ipv4_addr, 201, ipv4_addr, 201, - inst_nic, 201); + inst_nic + 1, 201); inst_pdcp_list[inst_nic] = ueid; #else From 11df1684b7c1c2f04b881d17da623f4aa5f6cbb0 Mon Sep 17 00:00:00 2001 From: "yoshio.inoue" Date: Wed, 7 Nov 2018 21:04:12 +0900 Subject: [PATCH 46/53] cleanup warnings --- nfapi/open-nFAPI/pnf/src/pnf.c | 2 +- nfapi/open-nFAPI/pnf/src/pnf_p7.c | 2 +- nfapi/open-nFAPI/vnf/src/vnf_p7.c | 4 ++-- openair3/NAS/UE/ESM/esm_ebr_context.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/nfapi/open-nFAPI/pnf/src/pnf.c b/nfapi/open-nFAPI/pnf/src/pnf.c index 362162cd9d..d0a7fa6fd1 100755 --- a/nfapi/open-nFAPI/pnf/src/pnf.c +++ b/nfapi/open-nFAPI/pnf/src/pnf.c @@ -1260,7 +1260,7 @@ int pnf_connect(pnf_t* pnf) address = inet_ntoa(addr->sin_addr); } -// NFAPI_TRACE(NFAPI_TRACE_NOTE, "Host address info %d Family:%s Address:%s\n", i++, family, address); + NFAPI_TRACE(NFAPI_TRACE_NOTE, "Host address info %d Family:%s Address:%s\n", i++, family, address); if (pnf->sctp) { diff --git a/nfapi/open-nFAPI/pnf/src/pnf_p7.c b/nfapi/open-nFAPI/pnf/src/pnf_p7.c index f7152cc077..8d94c23476 100755 --- a/nfapi/open-nFAPI/pnf/src/pnf_p7.c +++ b/nfapi/open-nFAPI/pnf/src/pnf_p7.c @@ -379,7 +379,7 @@ static uint32_t get_sf_time(uint32_t now_hr, uint32_t sf_start_hr) { if(now_hr < sf_start_hr) { -// NFAPI_TRACE(NFAPI_TRACE_INFO, "now is earlier than start of subframe now_hr:%u sf_start_hr:%u\n", now_hr, sf_start_hr); + NFAPI_TRACE(NFAPI_TRACE_INFO, "now is earlier than start of subframe now_hr:%u sf_start_hr:%u\n", now_hr, sf_start_hr); return 0; } else diff --git a/nfapi/open-nFAPI/vnf/src/vnf_p7.c b/nfapi/open-nFAPI/vnf/src/vnf_p7.c index 6c17fb2a99..cea259c35b 100755 --- a/nfapi/open-nFAPI/vnf/src/vnf_p7.c +++ b/nfapi/open-nFAPI/vnf/src/vnf_p7.c @@ -1203,13 +1203,13 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7) if(phy->in_sync == 0) { -/* NFAPI_TRACE(NFAPI_TRACE_NOTE, "***** Adjusting VNF phy_id:%d SFN/SF (%s) from %d to %d (%d) mode:%s zeroCount:%u sync:%s\n", + NFAPI_TRACE(NFAPI_TRACE_NOTE, "***** Adjusting VNF phy_id:%d SFN/SF (%s) from %d to %d (%d) mode:%s zeroCount:%u sync:%s\n", ind.header.phy_id, (phy->in_sync ? "via sfn" : "now"), NFAPI_SFNSF2DEC(curr_sfn_sf), NFAPI_SFNSF2DEC(new_sfn_sf), phy->adjustment, phy->filtered_adjust ? "FILTERED" : "ABSOLUTE", phy->zero_count, phy->in_sync ? "IN_SYNC" : "OUT_OF_SYNC"); -*/ + phy->sfn_sf = new_sfn_sf; } } diff --git a/openair3/NAS/UE/ESM/esm_ebr_context.c b/openair3/NAS/UE/ESM/esm_ebr_context.c index 7cf1d8abbd..7404cd8b8a 100755 --- a/openair3/NAS/UE/ESM/esm_ebr_context.c +++ b/openair3/NAS/UE/ESM/esm_ebr_context.c @@ -214,7 +214,7 @@ int esm_ebr_context_create( char broadcast[INET_ADDRSTRLEN]; struct in_addr in_addr; char command_line[500]; - int res; + int res = -1; switch (pdn->type) { case NET_PDN_TYPE_IPV4V6: From 0fb80c0cff7fc30fea0169997c0bffffb789fbf0 Mon Sep 17 00:00:00 2001 From: "yoshio.inoue" Date: Wed, 21 Nov 2018 11:44:18 +0900 Subject: [PATCH 47/53] Fixed problem that u-plane does not transferr with noS1 in L2 nFAPI Simulator --- openair2/NETWORK_DRIVER/MESH/local.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openair2/NETWORK_DRIVER/MESH/local.h b/openair2/NETWORK_DRIVER/MESH/local.h index 82dfc0ac88..f3f30f9224 100755 --- a/openair2/NETWORK_DRIVER/MESH/local.h +++ b/openair2/NETWORK_DRIVER/MESH/local.h @@ -162,7 +162,7 @@ typedef struct pdcp_data_req_header_s { sdu_size_t data_size; signed int inst; ip_traffic_type_t traffic_type; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) uint32_t sourceL2Id; uint32_t destinationL2Id; #endif @@ -173,7 +173,7 @@ typedef struct pdcp_data_ind_header_s { sdu_size_t data_size; signed int inst; ip_traffic_type_t dummy_traffic_type; -#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) uint32_t sourceL2Id; uint32_t destinationL2Id; #endif From 6bb767487717a3dd3ccce81ed449e92e7b8769f7 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Wed, 16 Jan 2019 14:25:38 +0100 Subject: [PATCH 48/53] Fixing usage of old structure/field names --> temporary as old code is kept in comment Signed-off-by: Raphael Defosseux --- targets/RT/USER/lte-enb.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/targets/RT/USER/lte-enb.c b/targets/RT/USER/lte-enb.c index 55043bba31..d1296a8bdb 100755 --- a/targets/RT/USER/lte-enb.c +++ b/targets/RT/USER/lte-enb.c @@ -164,7 +164,9 @@ static inline int rxtx(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc, char *thread_name // ******************************************************************* +#if defined(PRE_SCD_THREAD) RU_t *ru = RC.ru[0]; +#endif if (nfapi_mode == 1) { // I am a PNF and I need to let nFAPI know that we have a (sub)frame tick @@ -218,6 +220,8 @@ static inline int rxtx(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc, char *thread_name phy_procedures_eNB_uespec_RX(eNB, proc); } +#if 0 + // Original Code from Fujitsu w/ old structure/field name if(get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT && nfapi_mode != 2){ if(wait_on_condition(&proc[1].mutex_rxtx,&proc[1].cond_rxtx,&proc[1].pipe_ready,"wakeup_tx")<0) { LOG_E(PHY,"Frame %d, subframe %d: TX1 not ready\n",proc[1].frame_rx,proc[1].subframe_rx); @@ -225,6 +229,14 @@ static inline int rxtx(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc, char *thread_name } if (release_thread(&proc[1].mutex_rxtx,&proc[1].pipe_ready,"wakeup_tx")<0) return(-1); } +#endif + if(get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT && nfapi_mode != 2){ + if (wait_on_condition(&proc->mutex,&proc->cond,&proc->instance_cnt, "wakeup_tx")<0) { + LOG_E(PHY,"Frame %d, subframe %d: TX1 not ready\n",proc->frame_rx,proc->subframe_rx); + return(-1); + } + if (release_thread(&proc->mutex,&proc->instance_cnt,"wakeup_tx")<0) return(-1); + } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER, 1 ); @@ -951,8 +963,11 @@ void init_eNB_proc(int inst) { pthread_create( &L1_proc->pthread, attr0, L1_thread, proc ); pthread_create( &L1_proc_tx->pthread, attr1, L1_thread_tx, proc); } else if (nfapi_mode == 2) { // this is neccesary in VNF or L2 FAPI simulator. - pthread_create( &proc_rxtx[0].pthread_rxtx, attr0, eNB_thread_rxtx, &proc_rxtx[0] ); - pthread_create( &proc_rxtx[1].pthread_rxtx, attr1, eNB_thread_rxtx, &proc_rxtx[1] ); + // Original Code from Fujitsu w/ old structure/field name + //pthread_create( &proc_rxtx[0].pthread_rxtx, attr0, eNB_thread_rxtx, &proc_rxtx[0] ); + //pthread_create( &proc_rxtx[1].pthread_rxtx, attr1, eNB_thread_rxtx, &proc_rxtx[1] ); + pthread_create( &L1_proc->pthread, attr0, L1_thread, proc ); + pthread_create( &L1_proc_tx->pthread, attr1, L1_thread, proc); } pthread_create( &proc->pthread_prach, attr_prach, eNB_thread_prach, eNB ); From c12dfe19db2336527de2d871ec9b48e08bc6a043 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Wed, 16 Jan 2019 15:54:39 +0100 Subject: [PATCH 49/53] Fix in the UE side Signed-off-by: Raphael Defosseux --- targets/RT/USER/lte-uesoftmodem.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/targets/RT/USER/lte-uesoftmodem.c b/targets/RT/USER/lte-uesoftmodem.c index e2cdb88ae9..07b411e262 100755 --- a/targets/RT/USER/lte-uesoftmodem.c +++ b/targets/RT/USER/lte-uesoftmodem.c @@ -728,7 +728,6 @@ int main( int argc, char **argv ) { #endif int CC_id; uint8_t abstraction_flag=0; - unsigned int start_msc=0; #ifdef PDCP_USE_NETLINK #ifdef UESIM_EXPANSION memset(inst_pdcp_list, 0, sizeof(inst_pdcp_list)); @@ -1001,12 +1000,12 @@ int main( int argc, char **argv ) { init_UE_stub_single_thread(NB_UE_INST,eMBMS_active,uecap_xer_in,emul_iface); } else { - init_UE(NB_UE_INST,eMBMS_active,uecap_xer_in,0,phy_test,UE_scan,UE_scan_carrier,mode,(int)rx_gain[0][0],tx_max_power[0], + init_UE(NB_UE_INST,eMBMS_active,uecap_xer_in,0,get_softmodem_params()->phy_test,UE_scan,UE_scan_carrier,mode,(int)rx_gain[0][0],tx_max_power[0], frame_parms[0]); } - if (phy_test==0) { + if (get_softmodem_params()->phy_test==0) { printf("Filling UE band info\n"); fill_ue_band_info(); dl_phy_sync_success (0, 0, 0, 1); @@ -1016,7 +1015,7 @@ int main( int argc, char **argv ) { number_of_cards = 1; for(CC_id=0; CC_idrf_map.card=0; - PHY_vars_UE_g[0][CC_id]->rf_map.chain=CC_id+chain_offset; + PHY_vars_UE_g[0][CC_id]->rf_map.chain=CC_id+(get_softmodem_params()->chain_offset); } } // connect the TX/RX buffers From d62f8f93495e7cc00dfa645bc76e5b787cd26cde Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Thu, 17 Jan 2019 13:07:07 +0100 Subject: [PATCH 50/53] Fix merge: removed very old code Signed-off-by: Raphael Defosseux --- targets/RT/USER/lte-enb.c | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/targets/RT/USER/lte-enb.c b/targets/RT/USER/lte-enb.c index d1296a8bdb..0268ff0747 100755 --- a/targets/RT/USER/lte-enb.c +++ b/targets/RT/USER/lte-enb.c @@ -220,24 +220,6 @@ static inline int rxtx(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc, char *thread_name phy_procedures_eNB_uespec_RX(eNB, proc); } -#if 0 - // Original Code from Fujitsu w/ old structure/field name - if(get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT && nfapi_mode != 2){ - if(wait_on_condition(&proc[1].mutex_rxtx,&proc[1].cond_rxtx,&proc[1].pipe_ready,"wakeup_tx")<0) { - LOG_E(PHY,"Frame %d, subframe %d: TX1 not ready\n",proc[1].frame_rx,proc[1].subframe_rx); - return(-1); - } - if (release_thread(&proc[1].mutex_rxtx,&proc[1].pipe_ready,"wakeup_tx")<0) return(-1); - } -#endif - if(get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT && nfapi_mode != 2){ - if (wait_on_condition(&proc->mutex,&proc->cond,&proc->instance_cnt, "wakeup_tx")<0) { - LOG_E(PHY,"Frame %d, subframe %d: TX1 not ready\n",proc->frame_rx,proc->subframe_rx); - return(-1); - } - if (release_thread(&proc->mutex,&proc->instance_cnt,"wakeup_tx")<0) return(-1); - } - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER, 1 ); #if defined(PRE_SCD_THREAD) From eb92fa917b13782507a17fa7ff4d5b061ef0e28e Mon Sep 17 00:00:00 2001 From: matzakos Date: Thu, 17 Jan 2019 15:29:15 +0100 Subject: [PATCH 51/53] Fixed eNB threading issues creating problems for nfapi emulator. --- nfapi/open-nFAPI/pnf/src/pnf.c | 2 +- nfapi/open-nFAPI/pnf/src/pnf_p7.c | 2 +- nfapi/open-nFAPI/vnf/src/vnf_p7.c | 4 +-- .../CONF/rcc.band7.tm1.50PRB.nfapi.conf | 26 +++++++++++++------ targets/RT/USER/lte-enb.c | 4 +-- 5 files changed, 24 insertions(+), 14 deletions(-) diff --git a/nfapi/open-nFAPI/pnf/src/pnf.c b/nfapi/open-nFAPI/pnf/src/pnf.c index d0a7fa6fd1..0cacf8c66f 100755 --- a/nfapi/open-nFAPI/pnf/src/pnf.c +++ b/nfapi/open-nFAPI/pnf/src/pnf.c @@ -1260,7 +1260,7 @@ int pnf_connect(pnf_t* pnf) address = inet_ntoa(addr->sin_addr); } - NFAPI_TRACE(NFAPI_TRACE_NOTE, "Host address info %d Family:%s Address:%s\n", i++, family, address); + //NFAPI_TRACE(NFAPI_TRACE_NOTE, "Host address info %d Family:%s Address:%s\n", i++, family, address); if (pnf->sctp) { diff --git a/nfapi/open-nFAPI/pnf/src/pnf_p7.c b/nfapi/open-nFAPI/pnf/src/pnf_p7.c index 8d94c23476..81abed81a9 100755 --- a/nfapi/open-nFAPI/pnf/src/pnf_p7.c +++ b/nfapi/open-nFAPI/pnf/src/pnf_p7.c @@ -379,7 +379,7 @@ static uint32_t get_sf_time(uint32_t now_hr, uint32_t sf_start_hr) { if(now_hr < sf_start_hr) { - NFAPI_TRACE(NFAPI_TRACE_INFO, "now is earlier than start of subframe now_hr:%u sf_start_hr:%u\n", now_hr, sf_start_hr); + //NFAPI_TRACE(NFAPI_TRACE_INFO, "now is earlier than start of subframe now_hr:%u sf_start_hr:%u\n", now_hr, sf_start_hr); return 0; } else diff --git a/nfapi/open-nFAPI/vnf/src/vnf_p7.c b/nfapi/open-nFAPI/vnf/src/vnf_p7.c index cea259c35b..4b7acabec3 100755 --- a/nfapi/open-nFAPI/vnf/src/vnf_p7.c +++ b/nfapi/open-nFAPI/vnf/src/vnf_p7.c @@ -1203,12 +1203,12 @@ void vnf_handle_ul_node_sync(void *pRecvMsg, int recvMsgLen, vnf_p7_t* vnf_p7) if(phy->in_sync == 0) { - NFAPI_TRACE(NFAPI_TRACE_NOTE, "***** Adjusting VNF phy_id:%d SFN/SF (%s) from %d to %d (%d) mode:%s zeroCount:%u sync:%s\n", + /*NFAPI_TRACE(NFAPI_TRACE_NOTE, "***** Adjusting VNF phy_id:%d SFN/SF (%s) from %d to %d (%d) mode:%s zeroCount:%u sync:%s\n", ind.header.phy_id, (phy->in_sync ? "via sfn" : "now"), NFAPI_SFNSF2DEC(curr_sfn_sf), NFAPI_SFNSF2DEC(new_sfn_sf), phy->adjustment, phy->filtered_adjust ? "FILTERED" : "ABSOLUTE", phy->zero_count, - phy->in_sync ? "IN_SYNC" : "OUT_OF_SYNC"); + phy->in_sync ? "IN_SYNC" : "OUT_OF_SYNC");*/ phy->sfn_sf = new_sfn_sf; } diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.50PRB.nfapi.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.50PRB.nfapi.conf index ced031163d..472d84c7e2 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.50PRB.nfapi.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/rcc.band7.tm1.50PRB.nfapi.conf @@ -172,7 +172,7 @@ eNBs = ////////// MME parameters: - mme_ip_address = ( { ipv4 = "127.0.0.3"; + mme_ip_address = ( { ipv4 = "192.168.12.26"; ipv6 = "192:168:30::17"; active = "yes"; preference = "ipv4"; @@ -181,14 +181,24 @@ eNBs = NETWORK_INTERFACES : { - ENB_INTERFACE_NAME_FOR_S1_MME = "lo"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "127.0.0.2/24"; - ENB_INTERFACE_NAME_FOR_S1U = "lo"; - ENB_IPV4_ADDRESS_FOR_S1U = "127.0.0.5/24"; - ENB_PORT_FOR_S1U = 2152; # Spec 2152 + #ENB_INTERFACE_NAME_FOR_S1_MME = "lo"; + #ENB_IPV4_ADDRESS_FOR_S1_MME = "127.0.0.2/24"; + #ENB_INTERFACE_NAME_FOR_S1U = "lo"; + #ENB_IPV4_ADDRESS_FOR_S1U = "127.0.0.5/24"; + #ENB_PORT_FOR_S1U = 2152; # Spec 2152 - ENB_IPV4_ADDRESS_FOR_X2C = "127.0.0.2/24"; + #ENB_IPV4_ADDRESS_FOR_X2C = "127.0.0.2/24"; + #ENB_PORT_FOR_X2C = 36422; # Spec 36422 + + ENB_INTERFACE_NAME_FOR_S1_MME = "enp0s31f6"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.188/24"; + ENB_INTERFACE_NAME_FOR_S1U = "enp0s31f6"; + ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.188/24"; + ENB_PORT_FOR_S1U = 2152; # Spec 2152 + + ENB_IPV4_ADDRESS_FOR_X2C = "192.168.12.188/24"; ENB_PORT_FOR_X2C = 36422; # Spec 36422 + }; } ); @@ -196,7 +206,7 @@ eNBs = MACRLCs = ( { num_cc = 1; - local_s_if_name = "lo"; + local_s_if_name = "lo:"; remote_s_address = "127.0.0.1"; local_s_address = "127.0.0.2"; local_s_portc = 50001; diff --git a/targets/RT/USER/lte-enb.c b/targets/RT/USER/lte-enb.c index 0268ff0747..9db1684bd2 100755 --- a/targets/RT/USER/lte-enb.c +++ b/targets/RT/USER/lte-enb.c @@ -948,8 +948,8 @@ void init_eNB_proc(int inst) { // Original Code from Fujitsu w/ old structure/field name //pthread_create( &proc_rxtx[0].pthread_rxtx, attr0, eNB_thread_rxtx, &proc_rxtx[0] ); //pthread_create( &proc_rxtx[1].pthread_rxtx, attr1, eNB_thread_rxtx, &proc_rxtx[1] ); - pthread_create( &L1_proc->pthread, attr0, L1_thread, proc ); - pthread_create( &L1_proc_tx->pthread, attr1, L1_thread, proc); + pthread_create( &L1_proc->pthread, attr0, L1_thread, L1_proc ); + pthread_create( &L1_proc_tx->pthread, attr1, L1_thread, L1_proc_tx); } pthread_create( &proc->pthread_prach, attr_prach, eNB_thread_prach, eNB ); From d0190899d27b79e5daa79a037b70ce7155285c60 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Thu, 17 Jan 2019 23:09:10 +0100 Subject: [PATCH 52/53] Try out to comment added lines Signed-off-by: Raphael Defosseux --- openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c index 7cae1129a3..906fbaba5a 100755 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c @@ -174,9 +174,9 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const ctxt_pP) // Raphael: was suppressed by Raymond --> should be suppressed? // value of sdu_p->data->inst is set in pdcp_data_ind // it's necessary to set 1 in case of UE with S1. - if (ctxt_pP->enb_flag){ - ((pdcp_data_ind_header_t *)(sdu_p->data))->inst = 0; - } + //if (ctxt_pP->enb_flag){ + // ((pdcp_data_ind_header_t *)(sdu_p->data))->inst = 0; + //} #endif #if defined(LINK_ENB_PDCP_TO_GTPV1U) From f43bbe670b6a3a5bbe1ce67efdd74bb8d270648d Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Mon, 21 Jan 2019 17:34:46 +0100 Subject: [PATCH 53/53] CI: adding support for L2 NFAPI simulation Signed-off-by: Raphael Defosseux --- ci-scripts/Jenkinsfile-gitlab | 30 +- .../conf_files/rcc.band7.tm1.nfapi.conf | 236 +++++++++ ci-scripts/conf_files/ue.nfapi.conf | 44 ++ ci-scripts/oai-ci-vm-tool | 25 + ci-scripts/runTestOnVM.sh | 498 ++++++++++++------ 5 files changed, 673 insertions(+), 160 deletions(-) create mode 100644 ci-scripts/conf_files/rcc.band7.tm1.nfapi.conf create mode 100644 ci-scripts/conf_files/ue.nfapi.conf diff --git a/ci-scripts/Jenkinsfile-gitlab b/ci-scripts/Jenkinsfile-gitlab index 0d9f37ed24..b050eff60e 100644 --- a/ci-scripts/Jenkinsfile-gitlab +++ b/ci-scripts/Jenkinsfile-gitlab @@ -166,6 +166,14 @@ pipeline { } } + stage ("Start VM -- L2-Sim") { + steps { + timeout (time: 5, unit: 'MINUTES') { + sh "./ci-scripts/oai-ci-vm-tool build --workspace $WORKSPACE --variant l2-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon" + } + } + } + stage ("Start VM -- phy-sim") { steps { timeout (time: 5, unit: 'MINUTES') { @@ -215,7 +223,7 @@ pipeline { steps { gitlabCommitStatus(name: "Build eNb-ethernet") { timeout (time: 20, unit: 'MINUTES') { - sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" + sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID}" } } } @@ -224,11 +232,20 @@ pipeline { steps { gitlabCommitStatus(name: "Build UE-ethernet") { timeout (time: 20, unit: 'MINUTES') { - sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" + sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID}" } } } } + stage ("Build L2-Simulator-eNB") { + steps { + //gitlabCommitStatus(name: "Build UE-ethernet") { + timeout (time: 20, unit: 'MINUTES') { + sh "./ci-scripts/oai-ci-vm-tool wait --workspace $WORKSPACE --variant l2-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" + } + //} + } + } stage ("Build physical simulators") { steps { gitlabCommitStatus(name: "Build phy-sim") { @@ -313,6 +330,15 @@ pipeline { } } } + stage ("Test L2 simulator") { + steps { + //gitlabCommitStatus(name: "Test basic-sim") { + timeout (time: 30, unit: 'MINUTES') { + sh "./ci-scripts/oai-ci-vm-tool test --workspace $WORKSPACE --variant l2-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID}" + } + //} + } + } stage ("Build Flexran Controller") { when { expression {doFlexranCtrlTest} diff --git a/ci-scripts/conf_files/rcc.band7.tm1.nfapi.conf b/ci-scripts/conf_files/rcc.band7.tm1.nfapi.conf new file mode 100644 index 0000000000..c2a86f079e --- /dev/null +++ b/ci-scripts/conf_files/rcc.band7.tm1.nfapi.conf @@ -0,0 +1,236 @@ +Active_eNBs = ( "eNB-Eurecom-LTEBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +eNBs = +( + { + ////////// Identification parameters: + eNB_ID = 0xe00; + + cell_type = "CELL_MACRO_ENB"; + + eNB_name = "eNB-Eurecom-LTEBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + + plmn_list = ( { mcc = 208; mnc = 93; mnc_length = 2; } ); + + tr_s_preference = "local_mac" + + ////////// Physical parameters: + + component_carriers = ( + { + node_function = "3GPP_eNODEB"; + node_timing = "synch_to_ext_device"; + node_synch_ref = 0; + frame_type = "FDD"; + tdd_config = 3; + tdd_config_s = 0; + prefix_type = "NORMAL"; + eutra_band = 7; + downlink_frequency = 2685000000L; + uplink_frequency_offset = -120000000; + Nid_cell = 0; + N_RB_DL = 50; + Nid_cell_mbsfn = 0; + nb_antenna_ports = 1; + nb_antennas_tx = 1; + nb_antennas_rx = 1; + tx_gain = 90; + rx_gain = 125; + pbch_repetition = "FALSE"; + prach_root = 0; + prach_config_index = 0; + prach_high_speed = "DISABLE"; + prach_zero_correlation = 1; + prach_freq_offset = 2; + pucch_delta_shift = 1; + pucch_nRB_CQI = 0; + pucch_nCS_AN = 0; + pucch_n1_AN = 0; + pdsch_referenceSignalPower = -27; + pdsch_p_b = 0; + pusch_n_SB = 1; + pusch_enable64QAM = "DISABLE"; + pusch_hoppingMode = "interSubFrame"; + pusch_hoppingOffset = 0; + pusch_groupHoppingEnabled = "ENABLE"; + pusch_groupAssignment = 0; + pusch_sequenceHoppingEnabled = "DISABLE"; + pusch_nDMRS1 = 1; + phich_duration = "NORMAL"; + phich_resource = "ONESIXTH"; + srs_enable = "DISABLE"; + /* srs_BandwidthConfig =; + srs_SubframeConfig =; + srs_ackNackST =; + srs_MaxUpPts =;*/ + + pusch_p0_Nominal = -96; + pusch_alpha = "AL1"; + pucch_p0_Nominal = -104; + msg3_delta_Preamble = 6; + pucch_deltaF_Format1 = "deltaF2"; + pucch_deltaF_Format1b = "deltaF3"; + pucch_deltaF_Format2 = "deltaF0"; + pucch_deltaF_Format2a = "deltaF0"; + pucch_deltaF_Format2b = "deltaF0"; + + rach_numberOfRA_Preambles = 64; + rach_preamblesGroupAConfig = "DISABLE"; + /* + rach_sizeOfRA_PreamblesGroupA = ; + rach_messageSizeGroupA = ; + rach_messagePowerOffsetGroupB = ; + */ + rach_powerRampingStep = 4; + rach_preambleInitialReceivedTargetPower = -108; + rach_preambleTransMax = 10; + rach_raResponseWindowSize = 10; + rach_macContentionResolutionTimer = 48; + rach_maxHARQ_Msg3Tx = 4; + + pcch_default_PagingCycle = 128; + pcch_nB = "oneT"; + bcch_modificationPeriodCoeff = 2; + ue_TimersAndConstants_t300 = 1000; + ue_TimersAndConstants_t301 = 1000; + ue_TimersAndConstants_t310 = 1000; + ue_TimersAndConstants_t311 = 10000; + ue_TimersAndConstants_n310 = 20; + ue_TimersAndConstants_n311 = 1; + ue_TransmissionMode = 1; + + //Parameters for SIB18 + rxPool_sc_CP_Len = "normal"; + rxPool_sc_Period = "sf40"; + rxPool_data_CP_Len = "normal"; + rxPool_ResourceConfig_prb_Num = 20; + rxPool_ResourceConfig_prb_Start = 5; + rxPool_ResourceConfig_prb_End = 44; + rxPool_ResourceConfig_offsetIndicator_present = "prSmall"; + rxPool_ResourceConfig_offsetIndicator_choice = 0; + rxPool_ResourceConfig_subframeBitmap_present = "prBs40"; + rxPool_ResourceConfig_subframeBitmap_choice_bs_buf = "00000000000000000000"; + rxPool_ResourceConfig_subframeBitmap_choice_bs_size = 5; + rxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused = 0; +/* rxPool_dataHoppingConfig_hoppingParameter = 0; + rxPool_dataHoppingConfig_numSubbands = "ns1"; + rxPool_dataHoppingConfig_rbOffset = 0; + rxPool_commTxResourceUC-ReqAllowed = "TRUE"; +*/ + // Parameters for SIB19 + discRxPool_cp_Len = "normal" + discRxPool_discPeriod = "rf32" + discRxPool_numRetx = 1; + discRxPool_numRepetition = 2; + discRxPool_ResourceConfig_prb_Num = 5; + discRxPool_ResourceConfig_prb_Start = 3; + discRxPool_ResourceConfig_prb_End = 21; + discRxPool_ResourceConfig_offsetIndicator_present = "prSmall"; + discRxPool_ResourceConfig_offsetIndicator_choice = 0; + discRxPool_ResourceConfig_subframeBitmap_present = "prBs40"; + discRxPool_ResourceConfig_subframeBitmap_choice_bs_buf = "f0ffffffff"; + discRxPool_ResourceConfig_subframeBitmap_choice_bs_size = 5; + discRxPool_ResourceConfig_subframeBitmap_choice_bs_bits_unused = 0; + + } + ); + + + srb1_parameters : + { + # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500] + timer_poll_retransmit = 80; + + # timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200] + timer_reordering = 35; + + # timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500] + timer_status_prohibit = 0; + + # poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)] + poll_pdu = 4; + + # poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)] + poll_byte = 99999; + + # max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32] + max_retx_threshold = 4; + } + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "CI_MME_IP_ADDR"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + ENB_INTERFACE_NAME_FOR_S1_MME = "ens3"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "CI_ENB_IP_ADDR"; + ENB_INTERFACE_NAME_FOR_S1U = "ens3"; + ENB_IPV4_ADDRESS_FOR_S1U = "CI_ENB_IP_ADDR"; + ENB_PORT_FOR_S1U = 2152; # Spec 2152 + ENB_IPV4_ADDRESS_FOR_X2C = "CI_ENB_IP_ADDR"; + ENB_PORT_FOR_X2C = 36422; # Spec 36422 + + }; + } +); + +MACRLCs = ( + { + num_cc = 1; + local_s_if_name = "lo:"; + remote_s_address = "127.0.0.1"; + local_s_address = "127.0.0.2"; + local_s_portc = 50001; + remote_s_portc = 50000; + local_s_portd = 50011; + remote_s_portd = 50010; + tr_s_preference = "nfapi"; + tr_n_preference = "local_RRC"; + } +); + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_ENABLE"; + } +); + +log_config = + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + }; diff --git a/ci-scripts/conf_files/ue.nfapi.conf b/ci-scripts/conf_files/ue.nfapi.conf new file mode 100644 index 0000000000..ea0236cab4 --- /dev/null +++ b/ci-scripts/conf_files/ue.nfapi.conf @@ -0,0 +1,44 @@ +log_config = { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="medium"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="full"; +}; + + +L1s = ( + { + num_cc = 1; + tr_n_preference = "nfapi"; + local_n_if_name = "lo"; + remote_n_address = "127.0.0.2"; + local_n_address = "127.0.0.1"; + local_n_portc = 50000; + remote_n_portc = 50001; + local_n_portd = 50010; + remote_n_portd = 50011; + } +); + +RUs = ( + { + local_rf = "yes" + nb_tx = 1 + nb_rx = 1 + att_tx = 90 + att_rx = 0; + bands = [7,38,42,43]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 125; + } +); diff --git a/ci-scripts/oai-ci-vm-tool b/ci-scripts/oai-ci-vm-tool index 8bf7853d0c..b787129302 100755 --- a/ci-scripts/oai-ci-vm-tool +++ b/ci-scripts/oai-ci-vm-tool @@ -40,6 +40,7 @@ function variant_usage { echo " --variant cppcheck OR -v4" echo " --variant enb-ethernet OR -v7" echo " --variant ue-ethernet OR -v8" + echo " --variant l2-sim OR -v9" echo " --variant flexran-rtc OR -v10" } @@ -285,6 +286,18 @@ case $key in NBARGS=$[$NBARGS+256] shift ;; + -v9) + VM_NAME=ci-l2-sim + VM_MEMORY=8192 + VM_CPU=8 + ARCHIVES_LOC=l2_sim + LOG_PATTERN=.Rel14.txt + NB_PATTERN_FILES=4 + BUILD_OPTIONS="--eNB -t ETHERNET" + RUN_OPTIONS="complex" + NBARGS=$[$NBARGS+256] + shift + ;; -v10) VM_NAME=ci-flexran-rtc ARCHIVES_LOC=flexran @@ -350,6 +363,18 @@ case $key in BUILD_OPTIONS="--UE -t ETHERNET --noS1" NBARGS=$[$NBARGS+256] ;; + l2-sim) + VM_NAME=ci-l2-sim + VM_MEMORY=8192 + VM_CPU=8 + ARCHIVES_LOC=l2_sim + LOG_PATTERN=.Rel14.txt + NB_PATTERN_FILES=4 + BUILD_OPTIONS="--eNB -t ETHERNET" + RUN_OPTIONS="complex" + NBARGS=$[$NBARGS+256] + shift + ;; flexran-rtc) VM_NAME=ci-flexran-rtc ARCHIVES_LOC=flexran diff --git a/ci-scripts/runTestOnVM.sh b/ci-scripts/runTestOnVM.sh index bed46f0ace..4d87ba5791 100755 --- a/ci-scripts/runTestOnVM.sh +++ b/ci-scripts/runTestOnVM.sh @@ -280,17 +280,171 @@ function recover_core_dump { fi } -function terminate_ltebox_epc { - echo "echo \"cd /opt/ltebox/tools\"" > $1 - echo "cd /opt/ltebox/tools" >> $1 - echo "echo \"sudo ./stop_ltebox\"" >> $1 - echo "sudo ./stop_ltebox" >> $1 - echo "echo \"sudo daemon --name=simulated_hss --stop\"" >> $1 - echo "sudo daemon --name=simulated_hss --stop" >> $1 - echo "echo \"sudo killall --signal SIGKILL hss_sim\"" >> $1 - echo "sudo killall --signal SIGKILL hss_sim" >> $1 - ssh -o StrictHostKeyChecking=no ubuntu@$2 < $1 - rm $1 +function install_epc_on_vm { + local LOC_EPC_VM_NAME=$1 + local LOC_EPC_VM_CMDS=$2 + + if [ -d /opt/ltebox-archives/ ] + then + # Checking if all ltebox archives are available to run ltebx epc on a brand new VM + if [ -f /opt/ltebox-archives/ltebox_2.2.70_16_04_amd64.deb ] && [ -f /opt/ltebox-archives/etc-conf.zip ] && [ -f /opt/ltebox-archives/hss-sim.zip ] + then + echo "############################################################" + echo "Test EPC on VM ($EPC_VM_NAME) will be using ltebox" + echo "############################################################" + LTEBOX=1 + fi + fi + # Here we could have other types of EPC detection + + # Do we need to start the EPC VM + echo "EPC_VM_CMD_FILE = $LOC_EPC_VM_CMDS" + IS_EPC_VM_ALIVE=`uvt-kvm list | grep -c $LOC_EPC_VM_NAME` + if [ $IS_EPC_VM_ALIVE -eq 0 ] + then + echo "############################################################" + echo "Creating test EPC VM ($LOC_EPC_VM_NAME) on Ubuntu Cloud Image base" + echo "############################################################" + uvt-kvm create $LOC_EPC_VM_NAME release=xenial --unsafe-caching + fi + + uvt-kvm wait $LOC_EPC_VM_NAME --insecure + local LOC_EPC_VM_IP_ADDR=`uvt-kvm ip $LOC_EPC_VM_NAME` + echo "$LOC_EPC_VM_NAME has for IP addr = $LOC_EPC_VM_IP_ADDR" + scp -o StrictHostKeyChecking=no /etc/apt/apt.conf.d/01proxy ubuntu@$LOC_EPC_VM_IP_ADDR:/home/ubuntu + + # ltebox specific actions (install and start) + LTE_BOX_TO_INSTALL=1 + if [ $LTEBOX -eq 1 ] + then + echo "ls -ls /opt/ltebox/tools/start_ltebox" > $LOC_EPC_VM_CMDS + RESPONSE=`ssh -o StrictHostKeyChecking=no ubuntu@$LOC_EPC_VM_IP_ADDR < $LOC_EPC_VM_CMDS` + NB_EXES=`echo $RESPONSE | grep -c ltebox` + if [ $NB_EXES -eq 1 ]; then LTE_BOX_TO_INSTALL=0; fi + fi + + if [ $LTEBOX -eq 1 ] && [ $LTE_BOX_TO_INSTALL -eq 1 ] + then + echo "############################################################" + echo "Copying ltebox archives into EPC VM ($LOC_EPC_VM_NAME)" + echo "############################################################" + scp -o StrictHostKeyChecking=no /opt/ltebox-archives/ltebox_2.2.70_16_04_amd64.deb ubuntu@$LOC_EPC_VM_IP_ADDR:/home/ubuntu + scp -o StrictHostKeyChecking=no /opt/ltebox-archives/etc-conf.zip ubuntu@$LOC_EPC_VM_IP_ADDR:/home/ubuntu + scp -o StrictHostKeyChecking=no /opt/ltebox-archives/hss-sim.zip ubuntu@$LOC_EPC_VM_IP_ADDR:/home/ubuntu + + echo "############################################################" + echo "Install EPC on EPC VM ($LOC_EPC_VM_NAME)" + echo "############################################################" + echo "sudo cp 01proxy /etc/apt/apt.conf.d/" > $LOC_EPC_VM_CMDS + echo "touch /home/ubuntu/.hushlogin" >> $LOC_EPC_VM_CMDS + echo "echo \"sudo apt-get --yes --quiet install zip openjdk-8-jre libconfuse-dev libreadline-dev liblog4c-dev libgcrypt-dev libsctp-dev python2.7 python2.7-dev daemon iperf\"" >> $LOC_EPC_VM_CMDS + echo "sudo apt-get update > zip-install.txt 2>&1" >> $LOC_EPC_VM_CMDS + echo "sudo apt-get --yes install zip openjdk-8-jre libconfuse-dev libreadline-dev liblog4c-dev libgcrypt-dev libsctp-dev python2.7 python2.7-dev daemon iperf >> zip-install.txt 2>&1" >> $LOC_EPC_VM_CMDS + + # Installing HSS + echo "echo \"cd /opt\"" >> $LOC_EPC_VM_CMDS + echo "cd /opt" >> $LOC_EPC_VM_CMDS + echo "echo \"sudo unzip -qq /home/ubuntu/hss-sim.zip\"" >> $LOC_EPC_VM_CMDS + echo "sudo unzip -qq /home/ubuntu/hss-sim.zip" >> $LOC_EPC_VM_CMDS + echo "echo \"cd /opt/hss_sim0609\"" >> $LOC_EPC_VM_CMDS + echo "cd /opt/hss_sim0609" >> $LOC_EPC_VM_CMDS + + # Installing ltebox + echo "echo \"cd /home/ubuntu\"" >> $LOC_EPC_VM_CMDS + echo "cd /home/ubuntu" >> $LOC_EPC_VM_CMDS + echo "echo \"sudo dpkg -i ltebox_2.2.70_16_04_amd64.deb \"" >> $LOC_EPC_VM_CMDS + echo "sudo dpkg -i ltebox_2.2.70_16_04_amd64.deb >> zip-install.txt 2>&1" >> $LOC_EPC_VM_CMDS + + echo "echo \"cd /opt/ltebox/etc/\"" >> $LOC_EPC_VM_CMDS + echo "cd /opt/ltebox/etc/" >> $LOC_EPC_VM_CMDS + echo "echo \"sudo unzip -qq -o /home/ubuntu/etc-conf.zip\"" >> $LOC_EPC_VM_CMDS + echo "sudo unzip -qq -o /home/ubuntu/etc-conf.zip" >> $LOC_EPC_VM_CMDS + echo "sudo sed -i -e 's#EPC_VM_IP_ADDRESS#$LOC_EPC_VM_IP_ADDR#' gw.conf" >> $LOC_EPC_VM_CMDS + echo "sudo sed -i -e 's#EPC_VM_IP_ADDRESS#$LOC_EPC_VM_IP_ADDR#' mme.conf" >> $LOC_EPC_VM_CMDS + + ssh -o StrictHostKeyChecking=no ubuntu@$LOC_EPC_VM_IP_ADDR < $LOC_EPC_VM_CMDS + rm -f $LOC_EPC_VM_CMDS + fi +} + +function start_epc { + local LOC_EPC_VM_NAME=$1 + local LOC_EPC_VM_CMDS=$2 + local LOC_EPC_VM_IP_ADDR=$3 + + if [ $LTEBOX -eq 1 ] + then + echo "############################################################" + echo "Start EPC on EPC VM ($LOC_EPC_VM_NAME)" + echo "############################################################" + echo "echo \"cd /opt/hss_sim0609\"" > $LOC_EPC_VM_CMDS + echo "cd /opt/hss_sim0609" >> $LOC_EPC_VM_CMDS + echo "echo \"sudo daemon --unsafe --name=simulated_hss --chdir=/opt/hss_sim0609 ./starthss_real\"" >> $LOC_EPC_VM_CMDS + echo "sudo daemon --unsafe --name=simulated_hss --chdir=/opt/hss_sim0609 ./starthss_real" >> $LOC_EPC_VM_CMDS + + echo "echo \"cd /opt/ltebox/tools/\"" >> $LOC_EPC_VM_CMDS + echo "cd /opt/ltebox/tools/" >> $LOC_EPC_VM_CMDS + echo "echo \"sudo ./start_ltebox\"" >> $LOC_EPC_VM_CMDS + echo "nohup sudo ./start_ltebox > /home/ubuntu/ltebox.txt" >> $LOC_EPC_VM_CMDS + + ssh -o StrictHostKeyChecking=no ubuntu@$LOC_EPC_VM_IP_ADDR < $LOC_EPC_VM_CMDS + rm -f $LOC_EPC_VM_CMDS + + i="0" + echo "ifconfig tun5 | egrep -c \"inet addr\"" > $LOC_EPC_VM_CMDS + while [ $i -lt 10 ] + do + sleep 2 + CONNECTED=`ssh -o StrictHostKeyChecking=no ubuntu@$LOC_EPC_VM_IP_ADDR < $LOC_EPC_VM_CMDS` + if [ $CONNECTED -eq 1 ] + then + i="100" + else + i=$[$i+1] + fi + done + rm $LOC_EPC_VM_CMDS + if [ $i -lt 50 ] + then + echo "Problem w/ starting ltebox EPC" + echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log + exit -1 + fi + fi + + # HERE ADD ANY INSTALL ACTIONS FOR ANOTHER EPC + +} + +function retrieve_real_epc_ip_addr { + local LOC_EPC_VM_NAME=$1 + local LOC_EPC_VM_CMDS=$2 + local LOC_EPC_VM_IP_ADDR=$3 + + if [ $LTEBOX -eq 1 ] + then + # in our configuration file, we are using pool 5 + echo "ifconfig tun5 | egrep \"inet addr\" | sed -e 's#^.*inet addr:##' -e 's# P-t-P:.*\$##'" > $LOC_EPC_VM_CMDS + REAL_EPC_IP_ADDR=`ssh -o StrictHostKeyChecking=no ubuntu@$LOC_EPC_VM_IP_ADDR < $LOC_EPC_VM_CMDS` + echo "EPC IP Address is : $REAL_EPC_IP_ADDR" + rm $LOC_EPC_VM_CMDS + fi +} + +function terminate_epc { + if [ $LTEBOX -eq 1 ] + then + echo "echo \"cd /opt/ltebox/tools\"" > $1 + echo "cd /opt/ltebox/tools" >> $1 + echo "echo \"sudo ./stop_ltebox\"" >> $1 + echo "sudo ./stop_ltebox" >> $1 + echo "echo \"sudo daemon --name=simulated_hss --stop\"" >> $1 + echo "sudo daemon --name=simulated_hss --stop" >> $1 + echo "echo \"sudo killall --signal SIGKILL hss_sim\"" >> $1 + echo "sudo killall --signal SIGKILL hss_sim" >> $1 + ssh -o StrictHostKeyChecking=no ubuntu@$2 < $1 + rm $1 + fi } function start_flexran_ctrl { @@ -322,6 +476,85 @@ function query_flexran_ctrl_status { rm $1 } +function build_ue_on_separate_folder { + echo "mkdir tmp-ue" > $1 + echo "cd tmp-ue" >> $1 + echo "echo \"unzip -qq -DD ../localZip.zip\"" >> $1 + echo "unzip -qq -DD ../localZip.zip" >> $1 + + # We may have some adaptation to do + if [ -f /opt/ltebox-archives/adapt_ue_l2_sim.txt ] + then + echo "############################################################" + echo "Doing some adaptation on UE side" + echo "############################################################" + cat /opt/ltebox-archives/adapt_ue_l2_sim.txt >> $1 + fi + + echo "echo \"source oaienv\"" >> $1 + echo "source oaienv" >> $1 + echo "cd cmake_targets/" >> $1 + echo "mkdir log" >> $1 + echo "chmod 777 log" >> $1 + echo "echo \"./build_oai --UE -t ETHERNET \"" >> $1 + echo "./build_oai --UE -t ETHERNET > log/ue-build.txt 2>&1" >> $1 + echo "cd tools" >> $1 + echo "sudo ifconfig lo: 127.0.0.2 netmask 255.0.0.0 up" >> $1 + echo "sudo chmod 666 /etc/iproute2/rt_tables" >> $1 + echo "source init_nas_s1 UE" >> $1 + echo "ifconfig" >> $1 + ssh -o StrictHostKeyChecking=no ubuntu@$2 < $1 + rm -f $1 +} + +function start_l2_sim_enb { + local LOC_VM_IP_ADDR=$2 + local LOC_EPC_IP_ADDR=$3 + local LOC_LOG_FILE=$4 + local LOC_NB_RBS=$5 + local LOC_CONF_FILE=$6 + echo "cd /home/ubuntu/tmp" > $1 + echo "echo \"sudo apt-get --yes --quiet install daemon \"" >> $1 + echo "sudo apt-get --yes install daemon >> /home/ubuntu/tmp/cmake_targets/log/daemon-install.txt 2>&1" >> $1 + echo "echo \"source oaienv\"" >> $1 + echo "source oaienv" >> $1 + echo "cd ci-scripts/conf_files/" >> $1 + echo "cp $LOC_CONF_FILE ci-$LOC_CONF_FILE" >> $1 + echo "sed -i -e 's#N_RB_DL.*=.*;#N_RB_DL = $LOC_NB_RBS;#' -e 's#CI_MME_IP_ADDR#$LOC_EPC_IP_ADDR#' -e 's#CI_ENB_IP_ADDR#$LOC_VM_IP_ADDR#' ci-$LOC_CONF_FILE" >> $1 + echo "echo \"grep N_RB_DL ci-$LOC_CONF_FILE\"" >> $1 + echo "grep N_RB_DL ci-$LOC_CONF_FILE | sed -e 's#N_RB_DL.*=#N_RB_DL =#'" >> $1 + echo "echo \"cd /home/ubuntu/tmp/cmake_targets/lte_build_oai/build/\"" >> $1 + echo "sudo chmod 777 /home/ubuntu/tmp/cmake_targets/lte_build_oai/build/" >> $1 + echo "cd /home/ubuntu/tmp/cmake_targets/lte_build_oai/build/" >> $1 + echo "echo \"ulimit -c unlimited && ./lte-softmodem -O /home/ubuntu/tmp/ci-scripts/conf_files/ci-$LOC_CONF_FILE\" > ./my-lte-softmodem-run.sh " >> $1 + echo "chmod 775 ./my-lte-softmodem-run.sh" >> $1 + echo "cat ./my-lte-softmodem-run.sh" >> $1 + echo "if [ -e /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE ]; then sudo sudo rm -f /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE; fi" >> $1 + echo "sudo -E daemon --inherit --unsafe --name=enb_daemon --chdir=/home/ubuntu/tmp/cmake_targets/lte_build_oai/build/ -o /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE ./my-lte-softmodem-run.sh" >> $1 + + ssh -o StrictHostKeyChecking=no ubuntu@$LOC_VM_IP_ADDR < $1 + sleep 10 + rm $1 +} + +function start_l2_sim_ue { + local LOC_VM_IP_ADDR=$2 + local LOC_LOG_FILE=$3 + local LOC_CONF_FILE=$4 + echo "echo \"cd /home/ubuntu/tmp-ue/cmake_targets/lte_build_oai/build/\"" >> $1 + echo "sudo chmod 777 /home/ubuntu/tmp-ue/cmake_targets/lte_build_oai/build/" >> $1 + echo "cd /home/ubuntu/tmp-ue/cmake_targets/lte_build_oai/build/" >> $1 + echo "echo \"ulimit -c unlimited && ./lte-uesoftmodem -O /home/ubuntu/tmp-ue/ci-scripts/conf_files/$LOC_CONF_FILE --L2-emul 3 --num-ues 1\" > ./my-lte-softmodem-run.sh " >> $1 + echo "chmod 775 ./my-lte-softmodem-run.sh" >> $1 + echo "cat ./my-lte-softmodem-run.sh" >> $1 + echo "if [ -e /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE ]; then sudo sudo rm -f /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE; fi" >> $1 + echo "sudo -E daemon --inherit --unsafe --name=ue_daemon --chdir=/home/ubuntu/tmp-ue/cmake_targets/lte_build_oai/build/ -o /home/ubuntu/tmp/cmake_targets/log/$LOC_LOG_FILE ./my-lte-softmodem-run.sh" >> $1 + + ssh -o StrictHostKeyChecking=no ubuntu@$LOC_VM_IP_ADDR < $1 + sleep 10 + rm $1 +} + function run_test_on_vm { echo "############################################################" echo "OAI CI VM script" @@ -459,148 +692,26 @@ function run_test_on_vm { fi mkdir --parents $ARCHIVES_LOC + # Creating a VM for EPC and installing SW EPC_VM_NAME=`echo $VM_NAME | sed -e "s#basic-sim#epc#"` + EPC_VM_CMDS=${EPC_VM_NAME}_cmds.txt LTEBOX=0 - if [ -d /opt/ltebox-archives/ ] - then - # Checking if all ltebox archives are available to run ltebx epc on a brand new VM - if [ -f /opt/ltebox-archives/ltebox_2.2.70_16_04_amd64.deb ] && [ -f /opt/ltebox-archives/etc-conf.zip ] && [ -f /opt/ltebox-archives/hss-sim.zip ] - then - echo "############################################################" - echo "Test EPC on VM ($EPC_VM_NAME) will be using ltebox" - echo "############################################################" - LTEBOX=1 - fi - fi - # Here we could have other types of EPC detection - - # Do we need to start the EPC VM - EPC_VM_CMDS=`echo $VM_CMDS | sed -e "s#cmds#epc-cmds#"` - echo "EPC_VM_CMD_FILE = $EPC_VM_CMDS" - IS_EPC_VM_ALIVE=`uvt-kvm list | grep -c $EPC_VM_NAME` - if [ $IS_EPC_VM_ALIVE -eq 0 ] - then - echo "############################################################" - echo "Creating test EPC VM ($EPC_VM_NAME) on Ubuntu Cloud Image base" - echo "############################################################" - uvt-kvm create $EPC_VM_NAME release=xenial --unsafe-caching - fi - - uvt-kvm wait $EPC_VM_NAME --insecure + install_epc_on_vm $EPC_VM_NAME $EPC_VM_CMDS EPC_VM_IP_ADDR=`uvt-kvm ip $EPC_VM_NAME` - echo "$EPC_VM_NAME has for IP addr = $EPC_VM_IP_ADDR" - scp -o StrictHostKeyChecking=no /etc/apt/apt.conf.d/01proxy ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu - - # ltebox specific actions (install and start) - LTE_BOX_TO_INSTALL=1 - if [ $LTEBOX -eq 1 ] - then - echo "ls -ls /opt/ltebox/tools/start_ltebox" > $EPC_VM_CMDS - RESPONSE=`ssh -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR < $EPC_VM_CMDS` - NB_EXES=`echo $RESPONSE | grep -c ltebox` - if [ $NB_EXES -eq 1 ]; then LTE_BOX_TO_INSTALL=0; fi - fi - - if [ $LTEBOX -eq 1 ] && [ $LTE_BOX_TO_INSTALL -eq 1 ] - then - echo "############################################################" - echo "Copying ltebox archives into EPC VM ($EPC_VM_NAME)" - echo "############################################################" - scp -o StrictHostKeyChecking=no /opt/ltebox-archives/ltebox_2.2.70_16_04_amd64.deb ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu - scp -o StrictHostKeyChecking=no /opt/ltebox-archives/etc-conf.zip ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu - scp -o StrictHostKeyChecking=no /opt/ltebox-archives/hss-sim.zip ubuntu@$EPC_VM_IP_ADDR:/home/ubuntu - - echo "############################################################" - echo "Install EPC on EPC VM ($EPC_VM_NAME)" - echo "############################################################" - echo "sudo cp 01proxy /etc/apt/apt.conf.d/" > $EPC_VM_CMDS - echo "touch /home/ubuntu/.hushlogin" >> $EPC_VM_CMDS - echo "echo \"sudo apt-get --yes --quiet install zip openjdk-8-jre libconfuse-dev libreadline-dev liblog4c-dev libgcrypt-dev libsctp-dev python2.7 python2.7-dev daemon iperf\"" >> $EPC_VM_CMDS - echo "sudo apt-get update > zip-install.txt 2>&1" >> $EPC_VM_CMDS - echo "sudo apt-get --yes install zip openjdk-8-jre libconfuse-dev libreadline-dev liblog4c-dev libgcrypt-dev libsctp-dev python2.7 python2.7-dev daemon iperf >> zip-install.txt 2>&1" >> $EPC_VM_CMDS - - # Installing HSS - echo "echo \"cd /opt\"" >> $EPC_VM_CMDS - echo "cd /opt" >> $EPC_VM_CMDS - echo "echo \"sudo unzip -qq /home/ubuntu/hss-sim.zip\"" >> $EPC_VM_CMDS - echo "sudo unzip -qq /home/ubuntu/hss-sim.zip" >> $EPC_VM_CMDS - echo "echo \"cd /opt/hss_sim0609\"" >> $EPC_VM_CMDS - echo "cd /opt/hss_sim0609" >> $EPC_VM_CMDS - - # Installing ltebox - echo "echo \"cd /home/ubuntu\"" >> $EPC_VM_CMDS - echo "cd /home/ubuntu" >> $EPC_VM_CMDS - echo "echo \"sudo dpkg -i ltebox_2.2.70_16_04_amd64.deb \"" >> $EPC_VM_CMDS - echo "sudo dpkg -i ltebox_2.2.70_16_04_amd64.deb >> zip-install.txt 2>&1" >> $EPC_VM_CMDS - - echo "echo \"cd /opt/ltebox/etc/\"" >> $EPC_VM_CMDS - echo "cd /opt/ltebox/etc/" >> $EPC_VM_CMDS - echo "echo \"sudo unzip -qq -o /home/ubuntu/etc-conf.zip\"" >> $EPC_VM_CMDS - echo "sudo unzip -qq -o /home/ubuntu/etc-conf.zip" >> $EPC_VM_CMDS - echo "sudo sed -i -e 's#EPC_VM_IP_ADDRESS#$EPC_VM_IP_ADDR#' gw.conf" >> $EPC_VM_CMDS - echo "sudo sed -i -e 's#EPC_VM_IP_ADDRESS#$EPC_VM_IP_ADDR#' mme.conf" >> $EPC_VM_CMDS - fi # Starting EPC - if [ $LTEBOX -eq 1 ] - then - echo "############################################################" - echo "Start EPC on EPC VM ($EPC_VM_NAME)" - echo "############################################################" - echo "echo \"cd /opt/hss_sim0609\"" >> $EPC_VM_CMDS - echo "cd /opt/hss_sim0609" >> $EPC_VM_CMDS - echo "echo \"sudo daemon --unsafe --name=simulated_hss --chdir=/opt/hss_sim0609 ./starthss_real\"" >> $EPC_VM_CMDS - echo "sudo daemon --unsafe --name=simulated_hss --chdir=/opt/hss_sim0609 ./starthss_real" >> $EPC_VM_CMDS - - echo "echo \"cd /opt/ltebox/tools/\"" >> $EPC_VM_CMDS - echo "cd /opt/ltebox/tools/" >> $EPC_VM_CMDS - echo "echo \"sudo ./start_ltebox\"" >> $EPC_VM_CMDS - echo "nohup sudo ./start_ltebox > /home/ubuntu/ltebox.txt" >> $EPC_VM_CMDS - - ssh -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR < $EPC_VM_CMDS - rm -f $EPC_VM_CMDS - - # We may have some adaptation to do - if [ -f /opt/ltebox-archives/adapt_ue_sim.txt ] - then - echo "############################################################" - echo "Doing some adaptation on UE side" - echo "############################################################" - ssh -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR < /opt/ltebox-archives/adapt_ue_sim.txt - fi - - i="0" - echo "ifconfig tun5 | egrep -c \"inet addr\"" > $EPC_VM_CMDS - while [ $i -lt 10 ] - do - sleep 2 - CONNECTED=`ssh -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR < $EPC_VM_CMDS` - if [ $CONNECTED -eq 1 ] - then - i="100" - else - i=$[$i+1] - fi - done - rm $EPC_VM_CMDS - if [ $i -lt 50 ] - then - echo "Problem w/ starting ltebox EPC" - echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log - exit -1 - fi - fi - - # HERE ADD ANY INSTALL ACTIONS FOR ANOTHER EPC + start_epc $EPC_VM_NAME $EPC_VM_CMDS $EPC_VM_IP_ADDR # Retrieve EPC real IP address - if [ $LTEBOX -eq 1 ] + retrieve_real_epc_ip_addr $EPC_VM_NAME $EPC_VM_CMDS $EPC_VM_IP_ADDR + + # We may have some adaptation to do + if [ -f /opt/ltebox-archives/adapt_ue_sim.txt ] then - # in our configuration file, we are using pool 5 - echo "ifconfig tun5 | egrep \"inet addr\" | sed -e 's#^.*inet addr:##' -e 's# P-t-P:.*\$##'" > $EPC_VM_CMDS - REAL_EPC_IP_ADDR=`ssh -o StrictHostKeyChecking=no ubuntu@$EPC_VM_IP_ADDR < $EPC_VM_CMDS` - echo "EPC IP Address is : $REAL_EPC_IP_ADDR" - rm $EPC_VM_CMDS + echo "############################################################" + echo "Doing some adaptation on UE side" + echo "############################################################" + ssh -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR < /opt/ltebox-archives/adapt_ue_sim.txt fi echo "############################################################" @@ -621,7 +732,7 @@ function run_test_on_vm { scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC - terminate_ltebox_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR + terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log exit -1 fi @@ -680,7 +791,7 @@ function run_test_on_vm { scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC - terminate_ltebox_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR + terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log exit -1 fi @@ -739,7 +850,7 @@ function run_test_on_vm { scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC - terminate_ltebox_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR + terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log exit -1 fi @@ -791,7 +902,7 @@ function run_test_on_vm { if [ $j -lt 50 ] then echo "ERROR: compiling flexran controller on vm went wrong" - terminate_ltebox_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR + terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log exit -1 fi @@ -801,7 +912,7 @@ function run_test_on_vm { if [ $IS_FLEXRAN_VM_ALIVE -eq 0 ] then echo "ERROR: Flexran Ctl VM is not alive" - terminate_ltebox_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR + terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log exit -1 fi @@ -835,7 +946,7 @@ function run_test_on_vm { scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC - terminate_ltebox_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR + terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR stop_flexran_ctrl $FLEXRAN_CTL_VM_CMDS $FLEXRAN_CTL_VM_IP_ADDR echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log exit -1 @@ -878,7 +989,7 @@ function run_test_on_vm { scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC - terminate_ltebox_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR + terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log exit -1 fi @@ -929,7 +1040,7 @@ function run_test_on_vm { scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC - terminate_ltebox_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR + terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log exit -1 fi @@ -980,7 +1091,7 @@ function run_test_on_vm { # scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC # scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC # recover_core_dump $VM_CMDS $VM_IP_ADDR $ARCHIVES_LOC/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC -# terminate_ltebox_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR +# terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR # echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log # exit -1 # fi @@ -1016,10 +1127,7 @@ function run_test_on_vm { echo "Terminate EPC" echo "############################################################" - if [ $LTEBOX -eq 1 ] - then - terminate_ltebox_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR - fi + terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR if [ $KEEP_VM_ALIVE -eq 0 ] then @@ -1051,4 +1159,78 @@ function run_test_on_vm { echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log fi fi + + if [[ "$RUN_OPTIONS" == "complex" ]] && [[ $VM_NAME =~ .*-l2-sim.* ]] + then + PING_STATUS=0 + IPERF_STATUS=0 + if [ -d $ARCHIVES_LOC ] + then + rm -Rf $ARCHIVES_LOC + fi + mkdir --parents $ARCHIVES_LOC + + # Building UE elsewhere in VM + build_ue_on_separate_folder $VM_CMDS $VM_IP_ADDR + + # Creating a VM for EPC and installing SW + EPC_VM_NAME=`echo $VM_NAME | sed -e "s#l2-sim#l2-epc#"` + EPC_VM_CMDS=${EPC_VM_NAME}_cmds.txt + LTEBOX=0 + install_epc_on_vm $EPC_VM_NAME $EPC_VM_CMDS + EPC_VM_IP_ADDR=`uvt-kvm ip $EPC_VM_NAME` + + # Starting EPC + start_epc $EPC_VM_NAME $EPC_VM_CMDS $EPC_VM_IP_ADDR + + # Retrieve EPC real IP address + retrieve_real_epc_ip_addr $EPC_VM_NAME $EPC_VM_CMDS $EPC_VM_IP_ADDR + + echo "############################################################" + echo "Starting the eNB in FDD-5MHz mode" + echo "############################################################" + CURRENT_ENB_LOG_FILE=fdd_05MHz_enb.log + start_l2_sim_enb $VM_CMDS $VM_IP_ADDR $EPC_VM_IP_ADDR $CURRENT_ENB_LOG_FILE 25 rcc.band7.tm1.nfapi.conf + + echo "############################################################" + echo "Starting the UEs" + echo "############################################################" + CURRENT_UE_LOG_FILE=fdd_05MHz_ue.log + start_l2_sim_ue $VM_CMDS $VM_IP_ADDR $CURRENT_UE_LOG_FILE ue.nfapi.conf + + sleep 30 + echo "ping -I oip1 -c 20 $REAL_EPC_IP_ADDR" > $VM_CMDS + ssh -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR < $VM_CMDS + + echo "############################################################" + echo "Terminate enb/ue simulators" + echo "############################################################" + terminate_enb_ue_basic_sim $VM_CMDS $VM_IP_ADDR + scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_ENB_LOG_FILE $ARCHIVES_LOC + scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/$CURRENT_UE_LOG_FILE $ARCHIVES_LOC + + echo "############################################################" + echo "Terminate EPC" + echo "############################################################" + + terminate_epc $EPC_VM_CMDS $EPC_VM_IP_ADDR + + if [ $KEEP_VM_ALIVE -eq 0 ] + then + echo "############################################################" + echo "Destroying VMs" + echo "############################################################" + uvt-kvm destroy $VM_NAME + ssh-keygen -R $VM_IP_ADDR + uvt-kvm destroy $EPC_VM_NAME + ssh-keygen -R $EPC_VM_IP_ADDR + fi + + if [ $STATUS -eq 0 ] + then + echo "TEST_OK" > $ARCHIVES_LOC/test_final_status.log + else + echo "TEST_KO" > $ARCHIVES_LOC/test_final_status.log + fi + fi }