From c4370d9df0c43542582c724326eb9f9fb8628d1d Mon Sep 17 00:00:00 2001
From: Robert Schmidt <robert.schmidt@eurecom.fr>
Date: Fri, 7 Sep 2018 12:15:28 +0200
Subject: [PATCH] Start CU/DU tasks in create_remaining_tasks() of ENB_APP

---
 openair2/ENB_APP/enb_app.c   | 19 ++++++++++++++-----
 openair2/F1AP/CU_F1AP.c      |  1 +
 openair2/F1AP/DU_F1AP.c      |  1 +
 openair2/F1AP/cu_f1ap_task.h | 27 +++++++++++++++++++++++++++
 openair2/F1AP/du_f1ap_task.h | 27 +++++++++++++++++++++++++++
 5 files changed, 70 insertions(+), 5 deletions(-)
 create mode 100644 openair2/F1AP/cu_f1ap_task.h
 create mode 100644 openair2/F1AP/du_f1ap_task.h

diff --git a/openair2/ENB_APP/enb_app.c b/openair2/ENB_APP/enb_app.c
index 385b7fae5a..de1e655d32 100644
--- a/openair2/ENB_APP/enb_app.c
+++ b/openair2/ENB_APP/enb_app.c
@@ -49,6 +49,9 @@
 #   include "udp_eNB_task.h"
 # endif
 
+extern void *F1AP_CU_task(void *);
+extern void *F1AP_DU_task(void *);
+
 #if defined(FLEXRAN_AGENT_SB_IF)
 #   include "flexran_agent.h"
 #endif
@@ -70,12 +73,15 @@ static void create_remaining_tasks(module_id_t enb_id)
   int rc;
   itti_wait_ready(1);
   switch (type) {
-  case ngran_eNB:
-  case ngran_ng_eNB:
-  case ngran_gNB:
   case ngran_eNB_CU:
   case ngran_ng_eNB_CU:
   case ngran_gNB_CU:
+    rc = itti_create_task(TASK_CU_F1, F1AP_CU_task, NULL);
+    AssertFatal(rc >= 0, "Create task for CU F1AP failed\n");
+    /* fall through */
+  case ngran_eNB:
+  case ngran_ng_eNB:
+  case ngran_gNB:
     rc = itti_create_task(TASK_SCTP, sctp_eNB_task, NULL);
     AssertFatal(rc >= 0, "Create task for SCTP failed\n");
     rc = itti_create_task(TASK_S1AP, s1ap_eNB_task, NULL);
@@ -92,11 +98,14 @@ static void create_remaining_tasks(module_id_t enb_id)
     break;
   }
   switch (type) {
+  case ngran_eNB_DU:
+  case ngran_gNB_DU:
+    rc = itti_create_task(TASK_DU_F1, F1AP_DU_task, NULL);
+    AssertFatal(rc >= 0, "Create task for DU F1AP failed\n");
+    /* fall through */
   case ngran_eNB:
   case ngran_ng_eNB:
   case ngran_gNB:
-  case ngran_eNB_DU:
-  case ngran_gNB_DU:
     rc = itti_create_task (TASK_L2L1, l2l1_task, NULL);
     AssertFatal(rc >= 0, "Create task for L2L1 failed\n");
     break;
diff --git a/openair2/F1AP/CU_F1AP.c b/openair2/F1AP/CU_F1AP.c
index 0684c866b2..726eeba0f7 100644
--- a/openair2/F1AP/CU_F1AP.c
+++ b/openair2/F1AP/CU_F1AP.c
@@ -35,6 +35,7 @@
 #include "cu_f1ap_defs.h"
 #include "f1ap_encoder.h"
 #include "f1ap_decoder.h"
+#include "cu_f1ap_task.h"
 #include "sctp_cu.h"
 #include "platform_types.h"
 #include "common/utils/LOG/log.h"
diff --git a/openair2/F1AP/DU_F1AP.c b/openair2/F1AP/DU_F1AP.c
index 70420fd74f..599616a546 100644
--- a/openair2/F1AP/DU_F1AP.c
+++ b/openair2/F1AP/DU_F1AP.c
@@ -35,6 +35,7 @@
 #include "du_f1ap_defs.h"
 #include "f1ap_encoder.h"
 #include "f1ap_decoder.h"
+#include "du_f1ap_task.h"
 #include "platform_types.h"
 #include "common/utils/LOG/log.h"
 #include "sctp_du.h"
diff --git a/openair2/F1AP/cu_f1ap_task.h b/openair2/F1AP/cu_f1ap_task.h
new file mode 100644
index 0000000000..6904672f58
--- /dev/null
+++ b/openair2/F1AP/cu_f1ap_task.h
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+#ifndef CU_F1AP_TASK_H_
+#define CU_F1AP_TASK_H_
+
+void *F1AP_CU_task(void *arg);
+
+#endif /* CU_F1AP_TASK_H_ */
diff --git a/openair2/F1AP/du_f1ap_task.h b/openair2/F1AP/du_f1ap_task.h
new file mode 100644
index 0000000000..579c2a9761
--- /dev/null
+++ b/openair2/F1AP/du_f1ap_task.h
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The OpenAirInterface Software Alliance licenses this file to You under
+ * the OAI Public License, Version 1.1  (the "License"); you may not use this file
+ * except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.openairinterface.org/?page_id=698
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *-------------------------------------------------------------------------------
+ * For more information about the OpenAirInterface (OAI) Software Alliance:
+ *      contact@openairinterface.org
+ */
+
+#ifndef DU_F1AP_TASK_H_
+#define DU_F1AP_TASK_H_
+
+void *F1AP_DU_task(void *arg);
+
+#endif /* DU_F1AP_TASK_H_ */
-- 
GitLab