From 2dc3dfa373fbcf3973fd99e270ec16d60c5fbc38 Mon Sep 17 00:00:00 2001
From: Wang Tsu-Han <wangts@eurecom.fr>
Date: Thu, 20 Sep 2018 15:17:32 +0200
Subject: [PATCH] adding parallel config in dlsim and ulsim

---
 openair1/SIMULATION/LTE_PHY/dlsim.c | 18 ++++++++++++++----
 openair1/SIMULATION/LTE_PHY/ulsim.c | 17 +++++++++++++----
 openair2/ENB_APP/enb_config.c       |  4 ++--
 3 files changed, 29 insertions(+), 10 deletions(-)

diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c
index fd649ec0e4d..6d85b47a10f 100644
--- a/openair1/SIMULATION/LTE_PHY/dlsim.c
+++ b/openair1/SIMULATION/LTE_PHY/dlsim.c
@@ -82,14 +82,21 @@ double t_rx_min = 1000000000; /*!< \brief initial min process time for rx */
 int n_tx_dropped = 0; /*!< \brief initial max process time for tx */
 int n_rx_dropped = 0; /*!< \brief initial max process time for rx */
 
+char *parallel_config = NULL;
+char *worker_config = NULL;
 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)
 {
@@ -1057,6 +1064,9 @@ int main(int argc, char **argv)
       break;
     }
   }
+  if()
+  set_parallel_conf("PARALLEL_RU_L1_TRX_SPLIT");
+  set_worker_conf("WORKER_ENABLE");
 
   if (transmission_mode>1) pa=dBm3;
   printf("dlsim: tmode %d, pa %d\n",transmission_mode,pa);
diff --git a/openair1/SIMULATION/LTE_PHY/ulsim.c b/openair1/SIMULATION/LTE_PHY/ulsim.c
index 826f185d2ab..89c0d09b1da 100644
--- a/openair1/SIMULATION/LTE_PHY/ulsim.c
+++ b/openair1/SIMULATION/LTE_PHY/ulsim.c
@@ -97,14 +97,21 @@ nfapi_tx_request_pdu_t tx_pdu_list[MAX_NUM_TX_REQUEST_PDU];
 nfapi_tx_request_t TX_req;
 Sched_Rsp_t sched_resp;
 
+char *parallel_config = NULL;
+char *worker_config = NULL;
 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)
 {
@@ -741,6 +748,8 @@ int main(int argc, char **argv)
       break;
     }
   }
+  set_parallel_conf("PARALLEL_RU_L1_TRX_SPLIT");
+  set_worker_conf("WORKER_ENABLE");
   RC.nb_L1_inst = 1;
   RC.nb_RU = 1;
 
diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c
index 2d6ebc966e2..73a7cfb9ca3 100644
--- a/openair2/ENB_APP/enb_config.c
+++ b/openair2/ENB_APP/enb_config.c
@@ -61,8 +61,8 @@
 #include "enb_paramdef.h"
 
 extern uint16_t sf_ahead;
-extern void set_parallel_conf(int parallel_conf);
-extern void set_parallel_worker_conf(int worker_conf);
+extern void set_parallel_conf(char* parallel_conf);
+extern void set_worker_conf(char* worker_conf);
 extern PARALLEL_CONF_t get_thread_parallel_conf(void);
 extern WORKER_CONF_t   get_thread_worker_conf(void);
 
-- 
GitLab