From e7f0701aa7640ac717e48d3573506a0dc4a8204c Mon Sep 17 00:00:00 2001
From: Wang Tsu-Han <wangts@eurecom.fr>
Date: Thu, 29 Nov 2018 16:03:07 +0100
Subject: [PATCH] fixes for getting config by command line

---
 openair2/ENB_APP/enb_config.c          | 32 +++++++++++++++-----------
 targets/RT/USER/lte-softmodem-common.c |  4 ++--
 2 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c
index 9cbfb8741e..71adb2b811 100644
--- a/openair2/ENB_APP/enb_config.c
+++ b/openair2/ENB_APP/enb_config.c
@@ -67,6 +67,8 @@ extern PARALLEL_CONF_t get_thread_parallel_conf(void);
 extern WORKER_CONF_t   get_thread_worker_conf(void);
 extern uint32_t to_earfcn_DL(int eutra_bandP, uint32_t dl_CarrierFreq, uint32_t bw);
 extern uint32_t to_earfcn_UL(int eutra_bandP, uint32_t ul_CarrierFreq, uint32_t bw);
+extern char *parallel_config;
+extern char *worker_config;
 
 void RCconfig_flexran() {
   uint16_t i;
@@ -2494,29 +2496,33 @@ int RCconfig_X2(MessageDef *msg_p, uint32_t i) {
 int RCconfig_parallel(void) {
   char *parallel_conf = NULL;
   char *worker_conf   = NULL;
+  
 
   paramdef_t ThreadParams[]  = THREAD_CONF_DESC;
   paramlist_def_t THREADParamList = {THREAD_CONFIG_STRING_THREAD_STRUCT,NULL,0};
   config_getlist( &THREADParamList,NULL,0,NULL);
 
-  if(THREADParamList.numelt>0) {
-    config_getlist( &THREADParamList,ThreadParams,sizeof(ThreadParams)/sizeof(paramdef_t),NULL);
-    parallel_conf = strdup(*(THREADParamList.paramarray[0][THREAD_PARALLEL_IDX].strptr));
-  } else {
-    parallel_conf = strdup("PARALLEL_RU_L1_TRX_SPLIT");
+  if(parallel_config == NULL){
+    if(THREADParamList.numelt>0) {
+      config_getlist( &THREADParamList,ThreadParams,sizeof(ThreadParams)/sizeof(paramdef_t),NULL);
+      parallel_conf = strdup(*(THREADParamList.paramarray[0][THREAD_PARALLEL_IDX].strptr));
+    } else {
+      parallel_conf = strdup("PARALLEL_RU_L1_TRX_SPLIT");
+    }
+    set_parallel_conf(parallel_conf);
   }
 
-  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(worker_config == NULL){
+    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");
+    }
+    set_worker_conf(worker_conf);
   }
 
 
-  set_parallel_conf(parallel_conf);
-  set_worker_conf(worker_conf);
-
 
   return 0;
 }
diff --git a/targets/RT/USER/lte-softmodem-common.c b/targets/RT/USER/lte-softmodem-common.c
index 94a5dd0a6b..7e1235b310 100644
--- a/targets/RT/USER/lte-softmodem-common.c
+++ b/targets/RT/USER/lte-softmodem-common.c
@@ -35,6 +35,8 @@
 #include "common/config/config_userapi.h"
 #include "common/utils/load_module_shlib.h"
 static softmodem_params_t softmodem_params;
+char *parallel_config=NULL;
+char *worker_config=NULL;
 
 uint64_t get_softmodem_optmask(void) {
      return softmodem_params.optmask;
@@ -51,8 +53,6 @@ softmodem_params_t* get_softmodem_params(void) {
 
 void get_common_options(void)
 {
-char *parallel_config=NULL;
-char *worker_config=NULL;
 
 
 uint32_t online_log_messages;
-- 
GitLab