create_tasks.c 3.5 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
/*
 * 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
 */

# include "intertask_interface.h"
# include "create_tasks.h"
24
# include "common/utils/LOG/log.h"
25
# include "targets/RT/USER/lte-softmodem.h"
26
# include "common/ran_context.h"
27

28
#ifdef OPENAIR2
29 30 31 32 33
  #include "sctp_eNB_task.h"
  #include "x2ap_eNB.h"
  #include "s1ap_eNB.h"
  #include "udp_eNB_task.h"
  #include "gtpv1u_eNB_task.h"
34 35 36 37 38 39
  #if ENABLE_RAL
    #include "lteRALue.h"
    #include "lteRALenb.h"
  #endif
  #include "RRC/LTE/rrc_defs.h"
#endif
40 41
# include "f1ap_cu_task.h"
# include "f1ap_du_task.h"
42
# include "enb_app.h"
43
# include "openair2/LAYER2/MAC/mac_proto.h"
laurent's avatar
laurent committed
44
#include <executables/split_headers.h> 
45

46
extern RAN_CONTEXT_t RC;
47

48
int create_tasks(uint32_t enb_nb) {
49
  LOG_D(ENB_APP, "%s(enb_nb:%d\n", __FUNCTION__, enb_nb);
50 51
  ngran_node_t type = RC.rrc[0]->node_type;
  int rc;
52

53
  if (enb_nb == 0) return 0;
54

55 56 57
  LOG_I(ENB_APP, "Creating ENB_APP eNB Task\n");
  rc = itti_create_task (TASK_ENB_APP, eNB_app_task, NULL);
  AssertFatal(rc >= 0, "Create task for eNB APP failed\n");
58

59 60 61
  LOG_I(RRC,"Creating RRC eNB Task\n");
  rc = itti_create_task (TASK_RRC_ENB, rrc_enb_task, NULL);
  AssertFatal(rc >= 0, "Create task for RRC eNB failed\n");
62

laurent's avatar
laurent committed
63
  if (EPC_MODE_ENABLED && ! ( split73==SPLIT73_DU ) ) {
64 65
    rc = itti_create_task(TASK_SCTP, sctp_eNB_task, NULL);
    AssertFatal(rc >= 0, "Create task for SCTP failed\n");
66
  }
67

laurent's avatar
laurent committed
68
  if (EPC_MODE_ENABLED && !NODE_IS_DU(type) && ! ( split73==SPLIT73_DU ) ) {
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
    rc = itti_create_task(TASK_S1AP, s1ap_eNB_task, NULL);
    AssertFatal(rc >= 0, "Create task for S1AP failed\n");
    if (!(get_softmodem_params()->emulate_rf)){
      rc = itti_create_task(TASK_UDP, udp_eNB_task, NULL);
      AssertFatal(rc >= 0, "Create task for UDP failed\n");
    }
    rc = itti_create_task(TASK_GTPV1_U, gtpv1u_eNB_task, NULL);
    AssertFatal(rc >= 0, "Create task for GTPV1U failed\n");
    if (is_x2ap_enabled()) {
      rc = itti_create_task(TASK_X2AP, x2ap_task, NULL);
      AssertFatal(rc >= 0, "Create task for X2AP failed\n");
    } else {
      LOG_I(X2AP, "X2AP is disabled.\n");
    }
  }

  if (NODE_IS_CU(type)) {
86 87
    rc = itti_create_task(TASK_CU_F1, F1AP_CU_task, NULL);
    AssertFatal(rc >= 0, "Create task for CU F1AP failed\n");
88
  }
89

90
  if (NODE_IS_DU(type)) {
91 92
    rc = itti_create_task(TASK_DU_F1, F1AP_DU_task, NULL);
    AssertFatal(rc >= 0, "Create task for DU F1AP failed\n");
93
  }
94

95 96 97 98 99
  if (!NODE_IS_CU(type)) {
    LOG_I(MAC,"Creating MAC eNB Task\n");
    rc = itti_create_task(TASK_MAC_ENB, mac_enb_task, NULL);
    AssertFatal(rc >= 0, "Create task for MAC eNB failed\n");
  }
100

101 102
  return 0;
}