Commit 0511ff45 authored by Wang Tsu-Han's avatar Wang Tsu-Han

adding both configurable at config file and commandline

parent 5b1260a7
...@@ -63,6 +63,8 @@ ...@@ -63,6 +63,8 @@
extern uint16_t sf_ahead; extern uint16_t sf_ahead;
extern void set_parallel_conf(int parallel_conf); extern void set_parallel_conf(int parallel_conf);
extern void set_parallel_worker_conf(int worker_conf); extern void set_parallel_worker_conf(int worker_conf);
extern PARALLEL_CONF_t get_thread_parallel_conf(void);
extern WORKER_CONF_t get_thread_worker_conf(void);
void RCconfig_flexran() void RCconfig_flexran()
{ {
...@@ -2488,8 +2490,10 @@ return 0; ...@@ -2488,8 +2490,10 @@ return 0;
int RCconfig_parallel(void) int RCconfig_parallel(void)
{ {
char *parallel_conf; char *parallel_conf = NULL;
char *worker_conf; char *worker_conf = NULL;
extern char *parallel_config;
extern char *worker_config;
paramdef_t ThreadParams[] = THREAD_CONF_DESC; paramdef_t ThreadParams[] = THREAD_CONF_DESC;
paramlist_def_t THREADParamList = {THREAD_CONFIG_STRING_THREAD_STRUCT,NULL,0}; paramlist_def_t THREADParamList = {THREAD_CONFIG_STRING_THREAD_STRUCT,NULL,0};
...@@ -2500,19 +2504,25 @@ int RCconfig_parallel(void) ...@@ -2500,19 +2504,25 @@ int RCconfig_parallel(void)
{ {
config_getlist( &THREADParamList,ThreadParams,sizeof(ThreadParams)/sizeof(paramdef_t),NULL); config_getlist( &THREADParamList,ThreadParams,sizeof(ThreadParams)/sizeof(paramdef_t),NULL);
parallel_conf = strdup(*(THREADParamList.paramarray[0][THREAD_PARALLEL_IDX].strptr)); parallel_conf = strdup(*(THREADParamList.paramarray[0][THREAD_PARALLEL_IDX].strptr));
worker_conf = strdup(*(THREADParamList.paramarray[0][THREAD_PARALLEL_IDX].strptr));
} }
else else
{ {
parallel_conf = "PARALLEL_RU_L1_TRX_SPLIT"; parallel_conf = strdup("PARALLEL_RU_L1_TRX_SPLIT");
worker_conf = "WORKER_ENABLE";
} }
if(THREADParamList.numelt>0)
{
config_getlist( &THREADParamList,ThreadParams,sizeof(ThreadParams)/sizeof(paramdef_t),NULL);
worker_conf = strdup(*(THREADParamList.paramarray[0][THREAD_WORKER_IDX].strptr));
}
else
{
worker_conf = strdup("WORKER_ENABLE");
}
if(parallel_config == NULL) set_parallel_conf(parallel_conf);
if(worker_config == NULL) set_worker_conf(worker_conf);
if(strcmp(parallel_conf,"PARALLEL_SINGLE_THREAD")==0) set_parallel_conf(0);
else if(strcmp(parallel_conf,"PARALLEL_RU_L1_SPLIT")==0) set_parallel_conf(1);
else if(strcmp(parallel_conf,"PARALLEL_RU_L1_TRX_SPLIT")==0) set_parallel_conf(2);
if(strcmp(worker_conf,"WORKER_DISABLE")==0) set_parallel_worker_conf(0);
else if(strcmp(worker_conf,"WORKER_ENABLE")==0) set_parallel_worker_conf(1);
return 0; return 0;
} }
......
...@@ -219,15 +219,22 @@ extern void init_eNB_afterRU(void); ...@@ -219,15 +219,22 @@ extern void init_eNB_afterRU(void);
int transmission_mode=1; int transmission_mode=1;
int emulate_rf = 0; int emulate_rf = 0;
int numerology = 0; int numerology = 0;
char *parallel_config = NULL;
char *worker_config = NULL;
static THREAD_STRUCT thread_struct; static THREAD_STRUCT thread_struct;
void set_parallel_conf(int parallel_conf) void set_parallel_conf(char *parallel_conf)
{ {
thread_struct.parallel_conf = (PARALLEL_CONF_t)parallel_conf; if(strcmp(parallel_conf,"PARALLEL_SINGLE_THREAD")==0) thread_struct.parallel_conf = PARALLEL_SINGLE_THREAD;
else if(strcmp(parallel_conf,"PARALLEL_RU_L1_SPLIT")==0) thread_struct.parallel_conf = PARALLEL_RU_L1_SPLIT;
else if(strcmp(parallel_conf,"PARALLEL_RU_L1_TRX_SPLIT")==0) thread_struct.parallel_conf = PARALLEL_RU_L1_TRX_SPLIT;
printf("[CONFIG] parallel conf is set to %d\n",thread_struct.parallel_conf);
} }
void set_parallel_worker_conf(int worker_conf) void set_worker_conf(char *worker_conf)
{ {
thread_struct.worker_conf = (WORKER_CONF_t)worker_conf; if(strcmp(worker_conf,"WORKER_DISABLE")==0) thread_struct.worker_conf = WORKER_DISABLE;
else if(strcmp(worker_conf,"WORKER_ENABLE")==0) thread_struct.worker_conf = WORKER_ENABLE;
printf("[CONFIG] worker conf is set to %d\n",thread_struct.worker_conf);
} }
PARALLEL_CONF_t get_thread_parallel_conf(void) PARALLEL_CONF_t get_thread_parallel_conf(void)
{ {
...@@ -562,6 +569,8 @@ static void get_options(unsigned int *start_msc) { ...@@ -562,6 +569,8 @@ static void get_options(unsigned int *start_msc) {
RC.nb_nb_iot_rrc_inst=RC.nb_nb_iot_L1_inst=RC.nb_nb_iot_macrlc_inst=0; RC.nb_nb_iot_rrc_inst=RC.nb_nb_iot_L1_inst=RC.nb_nb_iot_macrlc_inst=0;
} }
} }
if(parallel_config != NULL) set_parallel_conf(parallel_config);
if(worker_config != NULL) set_worker_conf(worker_config);
} }
......
...@@ -93,6 +93,8 @@ ...@@ -93,6 +93,8 @@
#define CONFIG_HLP_NUMEROLOGY "adding numerology for 5G\n" #define CONFIG_HLP_NUMEROLOGY "adding numerology for 5G\n"
#define CONFIG_HLP_EMULATE_RF "Emulated RF enabled(disable by defult)\n" #define CONFIG_HLP_EMULATE_RF "Emulated RF enabled(disable by defult)\n"
#define CONFIG_HLP_PARALLEL_CMD "three config for level of parallelism 'PARALLEL_SINGLE_THREAD', 'PARALLEL_RU_L1_SPLIT', or 'PARALLEL_RU_L1_TRX_SPLIT'\n"
#define CONFIG_HLP_WORKER_CMD "two option for worker 'WORKER_DISABLE' or 'WORKER_ENABLE'\n"
#define CONFIG_HLP_DISABLNBIOT "disable nb-iot, even if defined in config\n" #define CONFIG_HLP_DISABLNBIOT "disable nb-iot, even if defined in config\n"
...@@ -184,7 +186,9 @@ ...@@ -184,7 +186,9 @@
{"s" , CONFIG_HLP_SNR, 0, iptr:&snr_dB, defintval:25, TYPE_INT, 0}, \ {"s" , CONFIG_HLP_SNR, 0, iptr:&snr_dB, defintval:25, TYPE_INT, 0}, \
{"numerology" , CONFIG_HLP_NUMEROLOGY, PARAMFLAG_BOOL, iptr:&numerology, defintval:0, TYPE_INT, 0}, \ {"numerology" , CONFIG_HLP_NUMEROLOGY, PARAMFLAG_BOOL, iptr:&numerology, defintval:0, TYPE_INT, 0}, \
{"emulate-rf" , CONFIG_HLP_EMULATE_RF, PARAMFLAG_BOOL, iptr:&emulate_rf, defintval:0, TYPE_INT, 0}, \ {"emulate-rf" , CONFIG_HLP_EMULATE_RF, PARAMFLAG_BOOL, iptr:&emulate_rf, defintval:0, TYPE_INT, 0}, \
{"nbiot-disable", CONFIG_HLP_DISABLNBIOT, PARAMFLAG_BOOL, iptr:&nonbiotflag, defintval:0, TYPE_INT, 0} \ {"parallel-config", CONFIG_HLP_PARALLEL_CMD,0, strptr:(char **)&parallel_config, defstrval:NULL, TYPE_STRING, 0}, \
{"worker-config", CONFIG_HLP_WORKER_CMD, 0, strptr:(char **)&worker_config, defstrval:NULL, TYPE_STRING, 0}, \
{"nbiot-disable", CONFIG_HLP_DISABLNBIOT, PARAMFLAG_BOOL, iptr:&nonbiotflag, defintval:0, TYPE_INT, 0} \
} }
#define CONFIG_HLP_FLOG "Enable online log \n" #define CONFIG_HLP_FLOG "Enable online log \n"
...@@ -275,11 +279,10 @@ PHY_VARS_UE* init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms, ...@@ -275,11 +279,10 @@ PHY_VARS_UE* init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t UE_id, uint8_t UE_id,
uint8_t abstraction_flag); uint8_t abstraction_flag);
void init_eNB_afterRU(void); void init_eNB_afterRU(void);
void thread_structure_init(void);
PARALLEL_CONF_t get_thread_parallel_conf(void); PARALLEL_CONF_t get_thread_parallel_conf(void);
WORKER_CONF_t get_thread_worker_conf(void); WORKER_CONF_t get_thread_worker_conf(void);
void set_parallel_conf(int parallel_conf); void set_parallel_conf(char *parallel_conf);
void set_parallel_worker_conf(int worker_conf); void set_worker_conf(char *worker_conf);
extern int stop_L1L2(module_id_t enb_id); extern int stop_L1L2(module_id_t enb_id);
extern int restart_L1L2(module_id_t enb_id); extern int restart_L1L2(module_id_t enb_id);
......
...@@ -220,15 +220,22 @@ int transmission_mode=1; ...@@ -220,15 +220,22 @@ int transmission_mode=1;
int emulate_rf = 0; int emulate_rf = 0;
int numerology = 0; int numerology = 0;
char *parallel_config = NULL;
char *worker_config = NULL;
static THREAD_STRUCT thread_struct; static THREAD_STRUCT thread_struct;
void set_parallel_conf(int parallel_conf) void set_parallel_conf(char *parallel_conf)
{ {
thread_struct.parallel_conf = (PARALLEL_CONF_t)parallel_conf; if(strcmp(parallel_conf,"PARALLEL_SINGLE_THREAD")==0) thread_struct.parallel_conf = PARALLEL_SINGLE_THREAD;
else if(strcmp(parallel_conf,"PARALLEL_RU_L1_SPLIT")==0) thread_struct.parallel_conf = PARALLEL_RU_L1_SPLIT;
else if(strcmp(parallel_conf,"PARALLEL_RU_L1_TRX_SPLIT")==0) thread_struct.parallel_conf = PARALLEL_RU_L1_TRX_SPLIT;
printf("[CONFIG] parallel conf is set to %d\n",thread_struct.parallel_conf);
} }
void set_parallel_worker_conf(int worker_conf) void set_worker_conf(char *worker_conf)
{ {
thread_struct.worker_conf = (WORKER_CONF_t)worker_conf; if(strcmp(worker_conf,"WORKER_DISABLE")==0) thread_struct.worker_conf = WORKER_DISABLE;
else if(strcmp(worker_conf,"WORKER_ENABLE")==0) thread_struct.worker_conf = WORKER_ENABLE;
printf("[CONFIG] worker conf is set to %d\n",thread_struct.worker_conf);
} }
PARALLEL_CONF_t get_thread_parallel_conf(void) PARALLEL_CONF_t get_thread_parallel_conf(void)
{ {
...@@ -237,7 +244,7 @@ PARALLEL_CONF_t get_thread_parallel_conf(void) ...@@ -237,7 +244,7 @@ PARALLEL_CONF_t get_thread_parallel_conf(void)
WORKER_CONF_t get_thread_worker_conf(void) WORKER_CONF_t get_thread_worker_conf(void)
{ {
return thread_struct.worker_conf; return thread_struct.worker_conf;
} }
/* struct for ethernet specific parameters given in eNB conf file */ /* struct for ethernet specific parameters given in eNB conf file */
eth_params_t *eth_params; eth_params_t *eth_params;
...@@ -599,6 +606,8 @@ static void get_options(unsigned int *start_msc) { ...@@ -599,6 +606,8 @@ static void get_options(unsigned int *start_msc) {
if(nfapi_mode!=3) if(nfapi_mode!=3)
uecap_xer_in=1; uecap_xer_in=1;
} *//* UE with config file */ } *//* UE with config file */
if(parallel_config != NULL) set_parallel_conf(parallel_config);
if(worker_config != NULL) set_worker_conf(worker_config);
} }
...@@ -816,6 +825,8 @@ int main( int argc, char **argv ) ...@@ -816,6 +825,8 @@ int main( int argc, char **argv )
for (int i=0;i<MAX_NUM_CCs;i++) tx_max_power[i]=23; for (int i=0;i<MAX_NUM_CCs;i++) tx_max_power[i]=23;
get_options (&start_msc); get_options (&start_msc);
printf("~~~~~~~~~~~~~~~~~~~~successfully get the parallel config[%d], worker config [%d] \n", get_thread_parallel_conf(), get_thread_worker_conf());
printf("Running with %d UE instances\n",NB_UE_INST); printf("Running with %d UE instances\n",NB_UE_INST);
if (NB_UE_INST > 1 && simL1flag != 1) { if (NB_UE_INST > 1 && simL1flag != 1) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment