From 66ab8e12a58726b122bc8e9589c47a94724de348 Mon Sep 17 00:00:00 2001
From: Raymond Knopp <raymond.knopp@eurecom.fr>
Date: Tue, 15 Jun 2021 16:36:54 +0200
Subject: [PATCH] Avoid double call of gtpu task and call it only for the NSA
 and SA scenarios

---
 executables/nr-softmodem.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c
index 632e2d8d30d..4727d09b043 100644
--- a/executables/nr-softmodem.c
+++ b/executables/nr-softmodem.c
@@ -370,10 +370,10 @@ int create_gNB_tasks(uint32_t gnb_nb) {
         }
       }
 
-      if (itti_create_task (TASK_GTPV1_U, &nr_gtpv1u_gNB_task, NULL) < 0) {
+      /*if (itti_create_task (TASK_GTPV1_U, &nr_gtpv1u_gNB_task, NULL) < 0) {
         LOG_E(GTPU, "Create task for GTPV1U failed\n");
         return -1;
-      }
+      }*/
     }
   }
 
@@ -388,9 +388,12 @@ int create_gNB_tasks(uint32_t gnb_nb) {
       LOG_E(NR_RRC, "Create task for NR RRC gNB failed\n");
       return -1;
     }
-    if (itti_create_task (TASK_GTPV1_U, &nr_gtpv1u_gNB_task, NULL) < 0) {
-      LOG_E(GTPU, "Create task for GTPV1U failed\n");
-      return -1;
+    //Use check on x2ap to consider the NSA scenario and check on AMF_MODE_ENABLED for the SA scenario 
+    if(is_x2ap_enabled() || AMF_MODE_ENABLED){
+      if (itti_create_task (TASK_GTPV1_U, &nr_gtpv1u_gNB_task, NULL) < 0) {
+        LOG_E(GTPU, "Create task for GTPV1U failed\n");
+        return -1;
+      }
     }
   }
 
-- 
GitLab