merge nfapi_cleanup
This commit is contained in:
+12
-12
@@ -48,7 +48,7 @@
|
||||
#include "PHY/defs_eNB.h"
|
||||
#include "SCHED/sched_eNB.h"
|
||||
#include "PHY/LTE_TRANSPORT/transport_proto.h"
|
||||
|
||||
#include "nfapi/oai_integration/vendor_ext.h"
|
||||
#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all
|
||||
//#undef FRAME_LENGTH_COMPLEX_SAMPLES //there are two conflicting definitions, so we better make sure we don't use it at all
|
||||
|
||||
@@ -139,7 +139,7 @@ void wakeup_prach_eNB(PHY_VARS_eNB *eNB,RU_t *ru,int frame,int subframe);
|
||||
void wakeup_prach_eNB_br(PHY_VARS_eNB *eNB,RU_t *ru,int frame,int subframe);
|
||||
#endif
|
||||
|
||||
extern uint8_t nfapi_mode;
|
||||
|
||||
extern void oai_subframe_ind(uint16_t sfn, uint16_t sf);
|
||||
extern void add_subframe(uint16_t *frameP, uint16_t *subframeP, int offset);
|
||||
|
||||
@@ -160,7 +160,7 @@ static inline int rxtx(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc, char *thread_name
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (nfapi_mode == 1) {
|
||||
if (NFAPI_MODE==NFAPI_MODE_PNF) {
|
||||
// I am a PNF and I need to let nFAPI know that we have a (sub)frame tick
|
||||
uint16_t frame = proc->frame_rx;
|
||||
uint16_t subframe = proc->subframe_rx;
|
||||
@@ -188,7 +188,7 @@ static inline int rxtx(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc, char *thread_name
|
||||
}
|
||||
}
|
||||
|
||||
if (nfapi_mode == 1 && eNB->pdcch_vars[proc->subframe_tx&1].num_pdcch_symbols == 0) {
|
||||
if (NFAPI_MODE==NFAPI_MODE_PNF && eNB->pdcch_vars[proc->subframe_tx&1].num_pdcch_symbols == 0) {
|
||||
LOG_E(PHY, "eNB->pdcch_vars[proc->subframe_tx&1].num_pdcch_symbols == 0");
|
||||
return 0;
|
||||
}
|
||||
@@ -208,14 +208,14 @@ static inline int rxtx(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc, char *thread_name
|
||||
release_UE_in_freeList(eNB->Mod_id);
|
||||
|
||||
// UE-specific RX processing for subframe n
|
||||
if (nfapi_mode == 0 || nfapi_mode == 1) {
|
||||
if (NFAPI_MODE==NFAPI_MONOLITHIC || NFAPI_MODE==NFAPI_MODE_PNF) {
|
||||
phy_procedures_eNB_uespec_RX(eNB, proc);
|
||||
}
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER, 1 );
|
||||
#if defined(PRE_SCD_THREAD)
|
||||
|
||||
if (nfapi_mode == 2) {
|
||||
if (NFAPI_MODE==NFAPI_MODE_VNF) {
|
||||
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;
|
||||
// L2-emulator can work only one eNB.
|
||||
@@ -365,7 +365,7 @@ static void *L1_thread( void *param ) {
|
||||
L1_rxtx_proc_t *proc;
|
||||
|
||||
// Working
|
||||
if(nfapi_mode ==2) {
|
||||
if(NFAPI_MODE==NFAPI_MODE_VNF) {
|
||||
proc = (L1_rxtx_proc_t *)param;
|
||||
} else {
|
||||
L1_proc_t *eNB_proc = (L1_proc_t *)param;
|
||||
@@ -406,7 +406,7 @@ static void *L1_thread( void *param ) {
|
||||
|
||||
if (release_thread(&proc->mutex,&proc->instance_cnt,thread_name)<0) break;
|
||||
|
||||
if (nfapi_mode!=2) {
|
||||
if (NFAPI_MODE!=NFAPI_MODE_VNF) {
|
||||
if(get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT) wakeup_tx(eNB);
|
||||
else if(get_thread_parallel_conf() == PARALLEL_RU_L1_SPLIT) wakeup_txfh(proc,eNB);
|
||||
}
|
||||
@@ -908,10 +908,10 @@ void init_eNB_proc(int inst) {
|
||||
|
||||
LOG_I(PHY,"eNB->single_thread_flag:%d\n", eNB->single_thread_flag);
|
||||
|
||||
if ((get_thread_parallel_conf() == PARALLEL_RU_L1_SPLIT || get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT) && nfapi_mode!=2) {
|
||||
if ((get_thread_parallel_conf() == PARALLEL_RU_L1_SPLIT || get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT) && NFAPI_MODE!=NFAPI_MODE_VNF) {
|
||||
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.
|
||||
} else if (NFAPI_MODE==NFAPI_MODE_VNF) { // this is neccesary in VNF or L2 FAPI simulator.
|
||||
// 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] );
|
||||
@@ -974,7 +974,7 @@ void kill_eNB_proc(int inst) {
|
||||
|
||||
LOG_I(PHY, "Killing TX CC_id %d inst %d\n", CC_id, inst );
|
||||
|
||||
if ((get_thread_parallel_conf() == PARALLEL_RU_L1_SPLIT || get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT) && nfapi_mode!=2) {
|
||||
if ((get_thread_parallel_conf() == PARALLEL_RU_L1_SPLIT || get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT) && NFAPI_MODE!=NFAPI_MODE_VNF) {
|
||||
pthread_mutex_lock(&L1_proc->mutex);
|
||||
L1_proc->instance_cnt = 0;
|
||||
pthread_cond_signal(&L1_proc->cond);
|
||||
@@ -1006,7 +1006,7 @@ void kill_eNB_proc(int inst) {
|
||||
LOG_I(PHY, "Destroying UL_INFO mutex\n");
|
||||
pthread_mutex_destroy(&eNB->UL_INFO_mutex);
|
||||
|
||||
if ((get_thread_parallel_conf() == PARALLEL_RU_L1_SPLIT || get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT) && nfapi_mode!=2) {
|
||||
if ((get_thread_parallel_conf() == PARALLEL_RU_L1_SPLIT || get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT) && NFAPI_MODE!=NFAPI_MODE_VNF) {
|
||||
LOG_I(PHY, "Joining L1_proc mutex/cond\n");
|
||||
pthread_join( L1_proc->pthread, (void **)&status );
|
||||
LOG_I(PHY, "Joining L1_proc_tx mutex/cond\n");
|
||||
|
||||
@@ -75,6 +75,7 @@
|
||||
#include "PHY_INTERFACE/phy_interface.h"
|
||||
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "nfapi/oai_integration/vendor_ext.h"
|
||||
#include "UTIL/OTG/otg_tx.h"
|
||||
#include "UTIL/OTG/otg_externs.h"
|
||||
#include "UTIL/MATH/oml.h"
|
||||
@@ -109,7 +110,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);
|
||||
@@ -1869,7 +1870,7 @@ void *pre_scd_thread( void *param ) {
|
||||
RU_t *ru = (RU_t *)param;
|
||||
|
||||
// L2-emulator can work only one eNB
|
||||
if( nfapi_mode == 2)
|
||||
if( NFAPI_MODE==NFAPI_MODE_VNF)
|
||||
Mod_id = 0;
|
||||
else
|
||||
Mod_id = ru->eNB_list[0]->Mod_id;
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
#include "LAYER2/MAC/mac_proto.h"
|
||||
#include "RRC/LTE/rrc_vars.h"
|
||||
#include "PHY_INTERFACE/phy_interface_vars.h"
|
||||
|
||||
#include "nfapi/oai_integration/vendor_ext.h"
|
||||
#ifdef SMBV
|
||||
#include "PHY/TOOLS/smbv.h"
|
||||
unsigned short config_frames[4] = {2,9,11,13};
|
||||
@@ -112,7 +112,6 @@ pthread_cond_t nfapi_sync_cond;
|
||||
pthread_mutex_t nfapi_sync_mutex;
|
||||
int nfapi_sync_var=-1; //!< protected by mutex \ref nfapi_sync_mutex
|
||||
|
||||
uint8_t nfapi_mode = 0; // Default to monolithic mode
|
||||
|
||||
uint16_t sf_ahead=4;
|
||||
|
||||
@@ -133,7 +132,7 @@ int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
|
||||
int UE_scan = 1;
|
||||
int UE_scan_carrier = 0;
|
||||
runmode_t mode = normal_txrx;
|
||||
int simL1flag;
|
||||
|
||||
FILE *input_fd=NULL;
|
||||
|
||||
|
||||
@@ -657,21 +656,22 @@ int main( int argc, char **argv ) {
|
||||
/* Read configuration */
|
||||
if (RC.nb_inst > 0)
|
||||
read_config_and_init();
|
||||
|
||||
|
||||
/* Start the agent. If it is turned off in the configuration, it won't start */
|
||||
RCconfig_flexran();
|
||||
|
||||
for (i = 0; i < RC.nb_inst; i++) {
|
||||
flexran_agent_start(i);
|
||||
}
|
||||
|
||||
uint32_t pdcp_initmask = ( IS_SOFTMODEM_NOS1 )? ( PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT) : LINK_ENB_PDCP_TO_GTPV1U_BIT;
|
||||
|
||||
if ( IS_SOFTMODEM_NOS1)
|
||||
pdcp_initmask = pdcp_initmask | ENB_NAS_USE_TUN_BIT | SOFTMODEM_NOKRNMOD_BIT ;
|
||||
|
||||
pdcp_module_init(pdcp_initmask);
|
||||
|
||||
if (RC.nb_inst > 0) {
|
||||
|
||||
if (create_tasks(1) < 0) {
|
||||
printf("cannot create ITTI tasks\n");
|
||||
exit(-1);
|
||||
@@ -682,8 +682,7 @@ int main( int argc, char **argv ) {
|
||||
RRC_CONFIGURATION_REQ(msg_p) = RC.rrc[enb_id]->configuration;
|
||||
itti_send_msg_to_task (TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
printf("No ITTI, Initializing L1\n");
|
||||
RCconfig_L1();
|
||||
}
|
||||
@@ -705,7 +704,6 @@ int main( int argc, char **argv ) {
|
||||
mlockall(MCL_CURRENT | MCL_FUTURE);
|
||||
pthread_cond_init(&sync_cond,NULL);
|
||||
pthread_mutex_init(&sync_mutex, NULL);
|
||||
|
||||
#ifdef XFORMS
|
||||
int UE_id;
|
||||
printf("XFORMS\n");
|
||||
@@ -740,46 +738,24 @@ int main( int argc, char **argv ) {
|
||||
|
||||
printf("Scope thread created, ret=%d\n",ret);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
rt_sleep_ns(10*100000000ULL);
|
||||
|
||||
if (nfapi_mode) {
|
||||
LOG_I(ENB_APP,"NFAPI*** - mutex and cond created - will block shortly for completion of PNF connection\n");
|
||||
if (NFAPI_MODE!=NFAPI_MONOLITHIC) {
|
||||
LOG_I(ENB_APP,"NFAPI*** - mutex and cond created - will block shortly for completion of PNF connection\n");
|
||||
pthread_cond_init(&sync_cond,NULL);
|
||||
pthread_mutex_init(&sync_mutex, NULL);
|
||||
}
|
||||
|
||||
const char *nfapi_mode_str = "<UNKNOWN>";
|
||||
|
||||
switch(nfapi_mode) {
|
||||
case 0:
|
||||
nfapi_mode_str = "MONOLITHIC";
|
||||
break;
|
||||
|
||||
case 1:
|
||||
nfapi_mode_str = "PNF";
|
||||
break;
|
||||
|
||||
case 2:
|
||||
nfapi_mode_str = "VNF";
|
||||
break;
|
||||
|
||||
default:
|
||||
nfapi_mode_str = "<UNKNOWN NFAPI MODE>";
|
||||
break;
|
||||
}
|
||||
|
||||
LOG_I(ENB_APP,"NFAPI MODE:%s\n", nfapi_mode_str);
|
||||
|
||||
if (nfapi_mode==2) {// VNF
|
||||
if (NFAPI_MODE==NFAPI_MODE_VNF) {// VNF
|
||||
#if defined(PRE_SCD_THREAD)
|
||||
init_ru_vnf(); // ru pointer is necessary for pre_scd.
|
||||
#endif
|
||||
wait_nfapi_init("main?");
|
||||
}
|
||||
|
||||
LOG_I(ENB_APP,"START MAIN THREADS\n");
|
||||
LOG_I(ENB_APP,"START MAIN THREADS\n");
|
||||
// start the main threads
|
||||
number_of_cards = 1;
|
||||
printf("RC.nb_L1_inst:%d\n", RC.nb_L1_inst);
|
||||
@@ -798,11 +774,11 @@ int main( int argc, char **argv ) {
|
||||
// RU thread and some L1 procedure aren't necessary in VNF or L2 FAPI simulator.
|
||||
// but RU thread deals with pre_scd and this is necessary in VNF and simulator.
|
||||
// some initialization is necessary and init_ru_vnf do this.
|
||||
if (RC.nb_RU >0 && nfapi_mode != 2) {
|
||||
if (RC.nb_RU >0 && NFAPI_MODE!=NFAPI_MODE_VNF) {
|
||||
printf("Initializing RU threads\n");
|
||||
init_RU(get_softmodem_params()->rf_config_file);
|
||||
|
||||
for (ru_id=0; ru_id<RC.nb_RU; ru_id++) {
|
||||
for (ru_id=0; ru_id<RC.nb_RU; ru_id++) {
|
||||
RC.ru[ru_id]->rf_map.card=0;
|
||||
RC.ru[ru_id]->rf_map.chain=CC_id+(get_softmodem_params()->chain_offset);
|
||||
}
|
||||
@@ -810,7 +786,7 @@ int main( int argc, char **argv ) {
|
||||
|
||||
config_sync_var=0;
|
||||
|
||||
if (nfapi_mode==1) { // PNF
|
||||
if (NFAPI_MODE==NFAPI_MODE_PNF) { // PNF
|
||||
wait_nfapi_init("main?");
|
||||
}
|
||||
|
||||
@@ -818,21 +794,21 @@ int main( int argc, char **argv ) {
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
wait_RUs();
|
||||
LOG_I(ENB_APP,"RC.nb_RU:%d\n", RC.nb_RU);
|
||||
LOG_I(ENB_APP,"RC.nb_RU:%d\n", RC.nb_RU);
|
||||
// once all RUs are ready intiailize the rest of the eNBs ((dependence on final RU parameters after configuration)
|
||||
printf("ALL RUs ready - init eNBs\n");
|
||||
|
||||
if (nfapi_mode != 1 && nfapi_mode != 2) {
|
||||
LOG_I(ENB_APP,"Not NFAPI mode - call init_eNB_afterRU()\n");
|
||||
if (NFAPI_MODE!=NFAPI_MODE_PNF && NFAPI_MODE!=NFAPI_MODE_VNF) {
|
||||
LOG_I(ENB_APP,"Not NFAPI mode - call init_eNB_afterRU()\n");
|
||||
init_eNB_afterRU();
|
||||
} else {
|
||||
LOG_I(ENB_APP,"NFAPI mode - DO NOT call init_eNB_afterRU()\n");
|
||||
LOG_I(ENB_APP,"NFAPI mode - DO NOT call init_eNB_afterRU()\n");
|
||||
}
|
||||
|
||||
LOG_UI(ENB_APP,"ALL RUs ready - ALL eNBs ready\n");
|
||||
LOG_UI(ENB_APP,"ALL RUs ready - ALL eNBs ready\n");
|
||||
// connect the TX/RX buffers
|
||||
sleep(1); /* wait for thread activation */
|
||||
LOG_I(ENB_APP,"Sending sync to all threads\n");
|
||||
LOG_I(ENB_APP,"Sending sync to all threads\n");
|
||||
pthread_mutex_lock(&sync_mutex);
|
||||
sync_var=0;
|
||||
pthread_cond_broadcast(&sync_cond);
|
||||
@@ -848,7 +824,6 @@ int main( int argc, char **argv ) {
|
||||
LOG_I(ENB_APP,"oai_exit=%d\n",oai_exit);
|
||||
// stop threads
|
||||
|
||||
|
||||
if (RC.nb_inst == 0 || !NODE_IS_CU(RC.rrc[0]->node_type)) {
|
||||
int UE_id;
|
||||
#ifdef XFORMS
|
||||
@@ -868,11 +843,12 @@ int main( int argc, char **argv ) {
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
LOG_I(ENB_APP,"stopping MODEM threads\n");
|
||||
stop_eNB(NB_eNB_INST);
|
||||
stop_RU(RC.nb_RU);
|
||||
|
||||
/* release memory used by the RU/eNB threads (incomplete), after all
|
||||
* threads have been stopped (they partially use the same memory) */
|
||||
for (int inst = 0; inst < NB_eNB_INST; inst++) {
|
||||
@@ -881,9 +857,11 @@ int main( int argc, char **argv ) {
|
||||
phy_free_lte_eNB(RC.eNB[inst][cc_id]);
|
||||
}
|
||||
}
|
||||
|
||||
for (int inst = 0; inst < RC.nb_RU; inst++) {
|
||||
phy_free_RU(RC.ru[inst]);
|
||||
}
|
||||
|
||||
free_lte_top();
|
||||
end_configmodule();
|
||||
pthread_cond_destroy(&sync_cond);
|
||||
@@ -891,12 +869,13 @@ int main( int argc, char **argv ) {
|
||||
pthread_cond_destroy(&nfapi_sync_cond);
|
||||
pthread_mutex_destroy(&nfapi_sync_mutex);
|
||||
pthread_mutex_destroy(&ue_pf_po_mutex);
|
||||
|
||||
|
||||
for(ru_id=0; ru_id<RC.nb_RU; ru_id++) {
|
||||
if (RC.ru[ru_id]->rfdevice.trx_end_func) {
|
||||
RC.ru[ru_id]->rfdevice.trx_end_func(&RC.ru[ru_id]->rfdevice);
|
||||
RC.ru[ru_id]->rfdevice.trx_end_func = NULL;
|
||||
}
|
||||
|
||||
if (RC.ru[ru_id]->ifdevice.trx_end_func) {
|
||||
RC.ru[ru_id]->ifdevice.trx_end_func(&RC.ru[ru_id]->ifdevice);
|
||||
RC.ru[ru_id]->ifdevice.trx_end_func = NULL;
|
||||
|
||||
@@ -243,6 +243,7 @@
|
||||
#define SOFTMODEM_NONBIOT_BIT (1<<2)
|
||||
#define SOFTMODEM_RFSIM_BIT (1<<10)
|
||||
#define SOFTMODEM_BASICSIM_BIT (1<<11)
|
||||
#define SOFTMODEM_SIML1_BIT (1<<12)
|
||||
typedef struct {
|
||||
uint64_t optmask;
|
||||
THREAD_STRUCT thread_struct;
|
||||
@@ -265,6 +266,7 @@ typedef struct {
|
||||
#define IS_SOFTMODEM_NONBIOT ( get_softmodem_optmask() & SOFTMODEM_NONBIOT_BIT)
|
||||
#define IS_SOFTMODEM_RFSIM ( get_softmodem_optmask() & SOFTMODEM_RFSIM_BIT)
|
||||
#define IS_SOFTMODEM_BASICSIM ( get_softmodem_optmask() & SOFTMODEM_BASICSIM_BIT)
|
||||
#define IS_SOFTMODEM_SIML1 ( get_softmodem_optmask() & SOFTMODEM_SIML1_BIT)
|
||||
extern uint64_t get_softmodem_optmask(void);
|
||||
extern uint64_t set_softmodem_optmask(uint64_t bitmask);
|
||||
extern void get_common_options(void);
|
||||
|
||||
+14
-13
@@ -53,6 +53,7 @@
|
||||
#include <inttypes.h>
|
||||
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "nfapi/oai_integration/vendor_ext.h"
|
||||
#include "UTIL/OTG/otg_tx.h"
|
||||
#include "UTIL/OTG/otg_externs.h"
|
||||
#include "UTIL/MATH/oml.h"
|
||||
@@ -63,7 +64,7 @@
|
||||
#include "T.h"
|
||||
|
||||
extern double cpuf;
|
||||
extern uint8_t nfapi_mode;
|
||||
|
||||
|
||||
#define FRAME_PERIOD 100000000ULL
|
||||
#define DAQ_PERIOD 66667ULL
|
||||
@@ -93,7 +94,7 @@ extern int oai_nfapi_sr_indication(nfapi_sr_indication_t *ind);
|
||||
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();
|
||||
|
||||
@@ -192,7 +193,7 @@ PHY_VARS_UE *init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms,
|
||||
ue->mac_enabled = 1;
|
||||
|
||||
// In phy_stub_UE (MAC-to-MAC) mode these init functions don't need to get called. Is this correct?
|
||||
if (nfapi_mode!=3) {
|
||||
if (NFAPI_MODE!=NFAPI_UE_STUB_PNF) {
|
||||
// initialize all signal buffers
|
||||
init_lte_ue_signal(ue,1,abstraction_flag);
|
||||
// intialize transport
|
||||
@@ -266,7 +267,7 @@ void init_UE(int nb_inst,int eMBMS_active, int uecap_xer_in, int timing_correcti
|
||||
|
||||
LOG_I(PHY,"Allocating UE context %d\n",inst);
|
||||
|
||||
if (simL1flag == 0) PHY_vars_UE_g[inst][0] = init_ue_vars(fp0,inst,0);
|
||||
if ( !IS_SOFTMODEM_SIML1 ) PHY_vars_UE_g[inst][0] = init_ue_vars(fp0,inst,0);
|
||||
else {
|
||||
// needed for memcopy below. these are not used in the RU, but needed for UE
|
||||
RC.ru[0]->frame_parms.nb_antennas_rx = fp0->nb_antennas_rx;
|
||||
@@ -354,12 +355,12 @@ void init_UE(int nb_inst,int eMBMS_active, int uecap_xer_in, int timing_correcti
|
||||
*/
|
||||
UE->N_TA_offset = 0;
|
||||
|
||||
if (simL1flag == 1) init_ue_devices(UE);
|
||||
if (IS_SOFTMODEM_SIML1 ) init_ue_devices(UE);
|
||||
|
||||
LOG_I(PHY,"Intializing UE Threads for instance %d (%p,%p)...\n",inst,PHY_vars_UE_g[inst],PHY_vars_UE_g[inst][0]);
|
||||
init_UE_threads(inst);
|
||||
|
||||
if (simL1flag == 0) {
|
||||
if (!IS_SOFTMODEM_SIML1 ) {
|
||||
ret = openair0_device_load(&(UE->rfdevice), &openair0_cfg[0]);
|
||||
|
||||
if (ret !=0) {
|
||||
@@ -397,7 +398,7 @@ void init_UE_stub_single_thread(int nb_inst,int eMBMS_active, int uecap_xer_in,
|
||||
printf("UE threads created \n");
|
||||
LOG_I(PHY,"Starting multicast link on %s\n",emul_iface);
|
||||
|
||||
if(nfapi_mode!=3)
|
||||
if(NFAPI_MODE!=NFAPI_UE_STUB_PNF)
|
||||
multicast_link_start(ue_stub_rx_handler,0,emul_iface);
|
||||
}
|
||||
|
||||
@@ -427,7 +428,7 @@ void init_UE_stub(int nb_inst,int eMBMS_active, int uecap_xer_in, char *emul_ifa
|
||||
printf("UE threads created \n");
|
||||
LOG_I(PHY,"Starting multicast link on %s\n",emul_iface);
|
||||
|
||||
if(nfapi_mode !=3)
|
||||
if(NFAPI_MODE!=NFAPI_UE_STUB_PNF)
|
||||
multicast_link_start(ue_stub_rx_handler,0,emul_iface);
|
||||
}
|
||||
|
||||
@@ -1123,7 +1124,7 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
|
||||
hi_dci0_req_UE_MAC(hi_dci0_req, ue_Mod_id);
|
||||
}
|
||||
|
||||
if(nfapi_mode!=3)
|
||||
if(NFAPI_MODE!=NFAPI_UE_STUB_PNF)
|
||||
phy_procedures_UE_SL_TX(UE,proc);
|
||||
}
|
||||
|
||||
@@ -1405,7 +1406,7 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) {
|
||||
hi_dci0_req = NULL;
|
||||
}
|
||||
|
||||
if (nfapi_mode != 3)
|
||||
if (NFAPI_MODE!=NFAPI_UE_STUB_PNF)
|
||||
phy_procedures_UE_SL_TX(UE,proc);
|
||||
}
|
||||
|
||||
@@ -1858,7 +1859,7 @@ void init_UE_single_thread_stub(int nb_inst) {
|
||||
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) {
|
||||
if(NFAPI_MODE==NFAPI_UE_STUB_PNF) {
|
||||
#ifdef NAS_UE
|
||||
MessageDef *message_p;
|
||||
message_p = itti_alloc_new_message(TASK_NAS_UE, INITIALIZE_MESSAGE);
|
||||
@@ -2040,7 +2041,7 @@ static void *timer_thread( void *param ) {
|
||||
opp_enabled = 1;
|
||||
|
||||
// first check if we are receiving timing indications
|
||||
if(nfapi_mode==4) {
|
||||
if(NFAPI_MODE==NFAPI_UE_STUB_OFFNET) {
|
||||
usleep(10000);
|
||||
|
||||
if (UE->instance_cnt_timer > 0) {
|
||||
@@ -2128,7 +2129,7 @@ static void *timer_thread( void *param ) {
|
||||
pdu.header.packet_type = TTI_SYNC;
|
||||
pdu.header.absSF = (timer_frame*10)+timer_subframe;
|
||||
|
||||
if (nfapi_mode!=3) {
|
||||
if (NFAPI_MODE != NFAPI_UE_STUB_PNF) {
|
||||
multicast_link_write_sock(0,
|
||||
(char *)&pdu,
|
||||
sizeof(UE_tport_header_t));
|
||||
|
||||
@@ -68,6 +68,7 @@
|
||||
#include "PHY_INTERFACE/phy_interface_vars.h"
|
||||
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "nfapi/oai_integration/vendor_ext.h"
|
||||
#include "UTIL/OTG/otg_tx.h"
|
||||
#include "UTIL/OTG/otg_externs.h"
|
||||
#include "UTIL/MATH/oml.h"
|
||||
@@ -109,7 +110,7 @@ pthread_cond_t nfapi_sync_cond;
|
||||
pthread_mutex_t nfapi_sync_mutex;
|
||||
int nfapi_sync_var=-1; //!< protected by mutex \ref nfapi_sync_mutex
|
||||
|
||||
uint8_t nfapi_mode = 0;
|
||||
|
||||
#ifdef UESIM_EXPANSION
|
||||
uint16_t inst_pdcp_list[NUMBER_OF_UE_MAX];
|
||||
#endif
|
||||
@@ -141,7 +142,7 @@ int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
|
||||
|
||||
int UE_scan = 1;
|
||||
int UE_scan_carrier = 0;
|
||||
int simL1flag = 0;
|
||||
|
||||
int snr_dB=25;
|
||||
|
||||
runmode_t mode = normal_txrx;
|
||||
@@ -321,12 +322,10 @@ void exit_function(const char *file, const char *function, const int line, const
|
||||
}
|
||||
|
||||
sleep(1); //allow lte-softmodem threads to exit first
|
||||
#if defined(ENABLE_ITTI)
|
||||
|
||||
if(PHY_vars_UE_g != NULL )
|
||||
itti_terminate_tasks (TASK_UNKNOWN);
|
||||
|
||||
#endif
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@@ -403,6 +402,8 @@ static void get_options(void) {
|
||||
char *loopfile=NULL;
|
||||
int dumpframe;
|
||||
int timingadv;
|
||||
uint8_t nfapi_mode;
|
||||
int simL1flag ;
|
||||
set_default_frame_parms(frame_parms);
|
||||
CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP);
|
||||
/* unknown parameters on command line will be checked in main
|
||||
@@ -413,6 +414,10 @@ static void get_options(void) {
|
||||
paramdef_t cmdline_ueparams[] =CMDLINE_UEPARAMS_DESC;
|
||||
config_process_cmdline( cmdline_uemodeparams,sizeof(cmdline_uemodeparams)/sizeof(paramdef_t),NULL);
|
||||
config_process_cmdline( cmdline_ueparams,sizeof(cmdline_ueparams)/sizeof(paramdef_t),NULL);
|
||||
nfapi_setmode(nfapi_mode);
|
||||
|
||||
if (simL1flag)
|
||||
set_softmodem_optmask(SOFTMODEM_SIML1_BIT);
|
||||
|
||||
if (loopfile != NULL) {
|
||||
printf("Input file for hardware emulation: %s",loopfile);
|
||||
@@ -445,7 +450,7 @@ static void get_options(void) {
|
||||
}
|
||||
|
||||
UE_scan=0;
|
||||
|
||||
|
||||
if (tddflag > 0) {
|
||||
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
||||
frame_parms[CC_id]->frame_type = TDD;
|
||||
@@ -487,16 +492,6 @@ static void get_options(void) {
|
||||
rx_gain[0][CC_id] = rx_gain[0][0];
|
||||
tx_gain[0][CC_id] = tx_gain[0][0];
|
||||
}
|
||||
|
||||
/*
|
||||
if ( !(CONFIG_ISFLAGSET(CONFIG_ABORT)) && (!(CONFIG_ISFLAGSET(CONFIG_NOOOPT))) ) {
|
||||
// Here the configuration file is the XER encoded UE capabilities
|
||||
// Read it in and store in asn1c data structures
|
||||
sprintf(uecap_xer,"%stargets/PROJECTS/GENERIC-LTE-EPC/CONF/UE_config.xml",getenv("OPENAIR_HOME"));
|
||||
printf("%s\n",uecap_xer);
|
||||
if(nfapi_mode!=3)
|
||||
uecap_xer_in=1;
|
||||
} *//* UE with config file */
|
||||
}
|
||||
|
||||
|
||||
@@ -634,10 +629,7 @@ void init_openair0(LTE_DL_FRAME_PARMS *frame_parms,int rxgain) {
|
||||
|
||||
|
||||
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
/*
|
||||
* helper function to terminate a certain ITTI task
|
||||
/* helper function to terminate a certain ITTI task
|
||||
*/
|
||||
void terminate_task(task_id_t task_id, module_id_t mod_id) {
|
||||
LOG_I(ENB_APP, "sending TERMINATE_MESSAGE to task %s (%d)\n", itti_get_task_name(task_id), task_id);
|
||||
@@ -647,11 +639,6 @@ void terminate_task(task_id_t task_id, module_id_t mod_id) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
static inline void wait_nfapi_init(char *thread_name) {
|
||||
printf( "waiting for NFAPI PNF connection and population of global structure (%s)\n",thread_name);
|
||||
pthread_mutex_lock( &nfapi_sync_mutex );
|
||||
@@ -712,13 +699,11 @@ int main( int argc, char **argv ) {
|
||||
EPC_MODE_ENABLED = !IS_SOFTMODEM_NOS1;
|
||||
printf("Running with %d UE instances\n",NB_UE_INST);
|
||||
|
||||
if (NB_UE_INST > 1 && simL1flag != 1 && nfapi_mode != 3) {
|
||||
if (NB_UE_INST > 1 && (!IS_SOFTMODEM_SIML1) && NFAPI_MODE!=NFAPI_UE_STUB_PNF) {
|
||||
printf("Running with more than 1 UE instance and simL1 is not active, this will result in undefined behaviour for now, exiting.\n");
|
||||
abort();
|
||||
}
|
||||
|
||||
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");
|
||||
@@ -731,17 +716,6 @@ int main( int argc, char **argv ) {
|
||||
abort();
|
||||
}
|
||||
|
||||
// Not sure if the following is needed here
|
||||
/*if (CONFIG_ISFLAGSET(CONFIG_ABORT)) {
|
||||
if (UE_flag == 0) {
|
||||
fprintf(stderr,"Getting configuration failed\n");
|
||||
exit(-1);
|
||||
}
|
||||
else {
|
||||
printf("Setting nfapi mode to UE_STUB_OFFNET\n");
|
||||
nfapi_mode = 4;
|
||||
}
|
||||
}*/
|
||||
#if T_TRACER
|
||||
T_Config_Init();
|
||||
#endif
|
||||
@@ -762,7 +736,7 @@ int main( int argc, char **argv ) {
|
||||
init_opt();
|
||||
uint32_t pdcp_initmask = (!IS_SOFTMODEM_NOS1 )? LINK_ENB_PDCP_TO_GTPV1U_BIT : (LINK_ENB_PDCP_TO_GTPV1U_BIT | PDCP_USE_NETLINK_BIT | LINK_ENB_PDCP_TO_IP_DRIVER_BIT);
|
||||
|
||||
if ( IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM || (nfapi_mode == 3) ) {
|
||||
if ( IS_SOFTMODEM_BASICSIM || IS_SOFTMODEM_RFSIM || (nfapi_getmode()==NFAPI_UE_STUB_PNF) ) {
|
||||
pdcp_initmask = pdcp_initmask | UE_NAS_USE_TUN_BIT;
|
||||
}
|
||||
|
||||
@@ -795,7 +769,7 @@ int main( int argc, char **argv ) {
|
||||
|
||||
NB_INST=1;
|
||||
|
||||
if(nfapi_mode == 3) {
|
||||
if(NFAPI_MODE==NFAPI_UE_STUB_PNF) {
|
||||
PHY_vars_UE_g = malloc(sizeof(PHY_VARS_UE **)*NB_UE_INST);
|
||||
|
||||
for (int i=0; i<NB_UE_INST; i++) {
|
||||
@@ -811,7 +785,7 @@ int main( int argc, char **argv ) {
|
||||
}
|
||||
} else init_openair0(frame_parms[0],(int)rx_gain[0][0]);
|
||||
|
||||
if (simL1flag==1) {
|
||||
if (IS_SOFTMODEM_SIML1 ) {
|
||||
RCConfig_sim();
|
||||
}
|
||||
|
||||
@@ -858,62 +832,30 @@ int main( int argc, char **argv ) {
|
||||
|
||||
LOG_I(HW, "CPU Affinity of main() function is... %s\n", cpu_affinity);
|
||||
#endif
|
||||
#if defined(ENABLE_ITTI)
|
||||
|
||||
if (create_tasks_ue(NB_UE_INST) < 0) {
|
||||
printf("cannot create ITTI tasks\n");
|
||||
exit(-1); // need a softer mode
|
||||
}
|
||||
|
||||
if(nfapi_mode==3) { // Here we should add another nfapi_mode for the case of Supervised LTE-D2D
|
||||
if (NFAPI_MODE==NFAPI_UE_STUB_PNF) { // UE-STUB-PNF
|
||||
UE_config_stub_pnf();
|
||||
}
|
||||
|
||||
printf("ITTI tasks created\n");
|
||||
#endif
|
||||
mlockall(MCL_CURRENT | MCL_FUTURE);
|
||||
rt_sleep_ns(10*100000000ULL);
|
||||
const char *nfapi_mode_str = "<UNKNOWN>";
|
||||
// start the main UE threads
|
||||
int eMBMS_active = 0;
|
||||
|
||||
switch(nfapi_mode) {
|
||||
case 0:
|
||||
nfapi_mode_str = "MONOLITHIC";
|
||||
break;
|
||||
|
||||
case 1:
|
||||
nfapi_mode_str = "PNF";
|
||||
break;
|
||||
|
||||
case 2:
|
||||
nfapi_mode_str = "VNF";
|
||||
break;
|
||||
|
||||
case 3:
|
||||
nfapi_mode_str = "UE_STUB_PNF";
|
||||
break;
|
||||
|
||||
case 4:
|
||||
nfapi_mode_str = "UE_STUB_OFFNET";
|
||||
break;
|
||||
|
||||
default:
|
||||
nfapi_mode_str = "<UNKNOWN NFAPI MODE>";
|
||||
break;
|
||||
}
|
||||
|
||||
printf("NFAPI MODE:%s\n", nfapi_mode_str);
|
||||
|
||||
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);
|
||||
if (NFAPI_MODE==NFAPI_UE_STUB_PNF) { // 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,get_softmodem_params()->phy_test,UE_scan,UE_scan_carrier,mode,(int)rx_gain[0][0],tx_max_power[0],
|
||||
frame_parms[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 (get_softmodem_params()->phy_test==0) {
|
||||
@@ -922,25 +864,14 @@ int main( int argc, char **argv ) {
|
||||
dl_phy_sync_success (0, 0, 0, 1);
|
||||
}
|
||||
|
||||
if (nfapi_mode!=3) {
|
||||
number_of_cards = 1;
|
||||
if (NFAPI_MODE != NFAPI_UE_STUB_PNF) {
|
||||
number_of_cards = 1;
|
||||
|
||||
for(CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
||||
PHY_vars_UE_g[0][CC_id]->rf_map.card=0;
|
||||
PHY_vars_UE_g[0][CC_id]->rf_map.chain=CC_id+(get_softmodem_params()->chain_offset);
|
||||
}
|
||||
}
|
||||
|
||||
// connect the TX/RX buffers
|
||||
|
||||
/*
|
||||
if(nfapi_mode!=3) {
|
||||
if (setup_ue_buffers(PHY_vars_UE_g[0],&openair0_cfg[0])!=0) {
|
||||
printf("Error setting up eNB buffer\n");
|
||||
exit(-1);
|
||||
for(CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
||||
PHY_vars_UE_g[0][CC_id]->rf_map.card=0;
|
||||
PHY_vars_UE_g[0][CC_id]->rf_map.chain=CC_id+(get_softmodem_params()->chain_offset);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
if (input_fd) {
|
||||
printf("Reading in from file to antenna buffer %d\n",0);
|
||||
@@ -954,7 +885,7 @@ int main( int argc, char **argv ) {
|
||||
|
||||
//p_exmimo_config->framing.tdd_config = TXRXSWITCH_TESTRX;
|
||||
|
||||
if (simL1flag==1) {
|
||||
if (IS_SOFTMODEM_SIML1 ) {
|
||||
init_ocm((double)snr_dB,0);
|
||||
PHY_vars_UE_g[0][0]->no_timing_correction = 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user