From bc53a9afee60b0c6187d133fb7194f1d875a8c17 Mon Sep 17 00:00:00 2001
From: laurent <laurent.thomas@open-cells.com>
Date: Tue, 9 Apr 2019 10:17:12 +0200
Subject: [PATCH] fix number of parallel slots processing limit

---
 cmake_targets/build_oai |  5 -----
 executables/nr-ue.c     | 17 +++++++++--------
 2 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai
index 596ff978f17..ba7fdc6cb0e 100755
--- a/cmake_targets/build_oai
+++ b/cmake_targets/build_oai
@@ -422,11 +422,6 @@ function main() {
   
   CMAKE_CMD="$CMAKE_CMD .."
   echo_info "CMAKE_CMD=$CMAKE_CMD"
-  if [ "$eNB" = "1" -o "$gNB" = "1" ] && [ "$UE" = "1" -o "$nrUE" = "1" ]; then
-    echo_error "Cannot build UE/nrUE and eNB/gNB on one build_oai execution"
-    echo_error "use 2 build_oai invocations"
-    exit
-  fi
 
   #########################################################
   # check validity of HW and TP parameters for eNB / gNB
diff --git a/executables/nr-ue.c b/executables/nr-ue.c
index 19b462d7703..03249d7dccf 100644
--- a/executables/nr-ue.c
+++ b/executables/nr-ue.c
@@ -697,13 +697,14 @@ void *UE_thread(void *arg) {
         decoded_frame_rx=tmp->proc.decoded_frame_rx;
     }
 
-    while (nbSlotProcessing >= RX_NB_TH && (res=tryPullTpool(&nf, Tpool)) != NULL ) {
-      nbSlotProcessing--;
-      processingData_t *tmp=(processingData_t *)res->msgData;
-
-      if (tmp->proc.decoded_frame_rx != -1)
-        decoded_frame_rx=tmp->proc.decoded_frame_rx;
-
+    while (nbSlotProcessing >= RX_NB_TH ) {
+      if ( (res=tryPullTpool(&nf, Tpool)) != NULL ) {
+	nbSlotProcessing--;
+	processingData_t *tmp=(processingData_t *)res->msgData;
+	
+	if (tmp->proc.decoded_frame_rx != -1)
+	  decoded_frame_rx=tmp->proc.decoded_frame_rx;
+      }
       usleep(200);
     }
 
@@ -711,7 +712,7 @@ void *UE_thread(void *arg) {
           ((decoded_frame_rx+1) % MAX_FRAME_NUMBER) != proc->frame_rx )
       LOG_D(PHY,"Decoded frame index (%d) is not compatible with current context (%d), UE should go back to synch mode\n",
             decoded_frame_rx,  proc->frame_rx);
-
+    nbSlotProcessing++;
     pushTpool(Tpool, processingMsg[thread_idx]);
   } // while !oai_exit
 
-- 
GitLab