Commit f19fa8ad authored by Bing-Kai Hong's avatar Bing-Kai Hong

Create ITTI procedure for F1

parent 9e5f9bdb
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
//-------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------//
// Defines to access message fields. // Defines to access message fields.
#define F1AP_CU_SCTP_REQ(mSGpTR) (mSGpTR)->ittiMsg.f1ap_cu_sctp_req
#define F1AP_SETUP_REQ(mSGpTR) (mSGpTR)->ittiMsg.f1ap_setup_req #define F1AP_SETUP_REQ(mSGpTR) (mSGpTR)->ittiMsg.f1ap_setup_req
#define F1AP_SETUP_RESP(mSGpTR) (mSGpTR)->ittiMsg.f1ap_setup_resp #define F1AP_SETUP_RESP(mSGpTR) (mSGpTR)->ittiMsg.f1ap_setup_resp
#define F1AP_SETUP_FAILURE(mSGpTR) (mSGpTR)->ittiMsg.f1ap_setup_failure #define F1AP_SETUP_FAILURE(mSGpTR) (mSGpTR)->ittiMsg.f1ap_setup_failure
......
...@@ -53,6 +53,8 @@ TASK_DEF(TASK_UDP, TASK_PRIORITY_MED, 1000) ...@@ -53,6 +53,8 @@ TASK_DEF(TASK_UDP, TASK_PRIORITY_MED, 1000)
// GTP_V1U task // GTP_V1U task
TASK_DEF(TASK_GTPV1_U, TASK_PRIORITY_MED, 1000) TASK_DEF(TASK_GTPV1_U, TASK_PRIORITY_MED, 1000)
TASK_DEF(TASK_S1AP, TASK_PRIORITY_MED, 200) TASK_DEF(TASK_S1AP, TASK_PRIORITY_MED, 200)
TASK_DEF(TASK_CU_F1, TASK_PRIORITY_MED, 200)
TASK_DEF(TASK_DU_F1, TASK_PRIORITY_MED, 200)
/// X2ap task, acts as both source and target /// X2ap task, acts as both source and target
TASK_DEF(TASK_X2AP, TASK_PRIORITY_MED, 200) TASK_DEF(TASK_X2AP, TASK_PRIORITY_MED, 200)
/// Sctp task (Used by both S1AP and X2AP) /// Sctp task (Used by both S1AP and X2AP)
......
...@@ -130,7 +130,7 @@ static uint32_t eNB_app_register(ngran_node_t node_type,uint32_t enb_id_start, u ...@@ -130,7 +130,7 @@ static uint32_t eNB_app_register(ngran_node_t node_type,uint32_t enb_id_start, u
LOG_I(ENB_APP,"[eNB %d] eNB_app_register via F1AP for instance %d\n", enb_id, ENB_MODULE_ID_TO_INSTANCE(enb_id)); LOG_I(ENB_APP,"[eNB %d] eNB_app_register via F1AP for instance %d\n", enb_id, ENB_MODULE_ID_TO_INSTANCE(enb_id));
AssertFatal(1==0,"No ITTI ask for F1AP yet\n"); AssertFatal(1==0,"No ITTI ask for F1AP yet\n");
// itti_send_msg_to_task (TASK_F1AP, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p); itti_send_msg_to_task (TASK_DU_F1, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p);
// configure GTPu here for F1U // configure GTPu here for F1U
} }
else { // S1AP registration else { // S1AP registration
......
...@@ -32,12 +32,12 @@ ...@@ -32,12 +32,12 @@
#include "conversions.h" #include "conversions.h"
#include "f1ap_common.h" #include "f1ap_common.h"
#include "f1ap_messages_types.h"
#include "f1ap_encoder.h" #include "f1ap_encoder.h"
#include "f1ap_decoder.h" #include "f1ap_decoder.h"
#include "sctp_cu.h" #include "sctp_cu.h"
#include "platform_types.h" #include "platform_types.h"
#include "log.h" #include "common/utils/LOG/log.h"
#include "intertask_interface.h"
#define MAX_F1AP_BUFFER_SIZE 4096 #define MAX_F1AP_BUFFER_SIZE 4096
...@@ -86,46 +86,60 @@ uint8_t F1AP_get_next_transaction_identifier(module_id_t enb_mod_idP, module_id_ ...@@ -86,46 +86,60 @@ uint8_t F1AP_get_next_transaction_identifier(module_id_t enb_mod_idP, module_id_
} }
// ============================================================================== // ==============================================================================
static
void CU_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind)
{
int result;
DevAssert(sctp_data_ind != NULL);
void F1AP_CU_task(void) { f1ap_handle_message(sctp_data_ind->assoc_id, sctp_data_ind->stream,
sctp_data_ind->buffer, sctp_data_ind->buffer_length);
result = itti_free(TASK_UNKNOWN, sctp_data_ind->buffer);
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
}
void *F1AP_CU_task(void *arg) {
printf("Start F1AP CU task!\n"); printf("Start F1AP CU task!\n");
sctp_cu_init(); //sctp_cu_init();
// MessageDef *received_msg = NULL; MessageDef *received_msg = NULL;
// int result; int result;
// F1AP_DEBUG("Starting F1AP layer\n"); //F1AP_DEBUG("Starting F1AP at DU\n");
// f1ap_eNB_prepare_internal_data(); //f1ap_eNB_prepare_internal_data();
// itti_mark_task_ready(TASK_F1AP); itti_mark_task_ready(TASK_CU_F1);
// while (1) { while (1) {
// switch (ITTI_MSG_ID(received_msg)) { switch (ITTI_MSG_ID(received_msg)) {
// case F1AP_SETUP_RESP:
// CU_send_F1_SETUP_RESPONSE(); //case F1AP_CU_SCTP_REQ: // this is not a true F1 message, but rather an ITTI message sent by enb_app
// break; // 1. save the itti msg so that you can use it to sen f1ap_setup_req
// case F1AP_INITIAL_UL_RRC_MESSAGE: // 2. send a sctp_init req
// CU_handle_UL_INITIAL_RRC_MESSAGE_TRANSFER(); // CU_send_sctp_init_req(ITTI_MESSAGE_GET_INSTANCE(received_msg),
// break; // &F1AP_SETUP_REQ(received_msg));
// case F1AP_DL_RRC_MESSAGE:
// CU_send_DL_RRC_MESSAGE_TRANSFER(); // SRBID and RRCContainer get issue when decode.
// break;
// //CU_send_UE_CONTEXT_SETUP_REQUEST();
// case F1AP_UE_CONTEXT_MODIFICATION_REQ:
// CU_send_UE_CONTEXT_MODIFICATION_REQUEST();
// break;
// //CU_send_gNB_CU_CONFIGURATION_UPDATE((module_id_t)1, (module_id_t)2); // some problem found
// break; // break;
// default: case SCTP_DATA_IND:
CU_handle_sctp_data_ind(&received_msg->ittiMsg.sctp_data_ind);
break;
// } // switch default:
// F1AP_ERROR("CU Received unhandled message: %d:%s\n",
// ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg));
break;
} // switch
result = itti_free (ITTI_MSG_ORIGIN_ID(received_msg), received_msg);
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
// } // while received_msg = NULL;
} // while
return; return NULL;
} }
......
...@@ -32,10 +32,10 @@ ...@@ -32,10 +32,10 @@
#include "conversions.h" #include "conversions.h"
#include "f1ap_common.h" #include "f1ap_common.h"
#include "f1ap_messages_types.h"
#include "platform_types.h" #include "platform_types.h"
#include "common/utils/LOG/log.h" #include "common/utils/LOG/log.h"
#include "sctp_du.h" #include "sctp_du.h"
#include "intertask_interface.h"
/* This structure describes association of a DU to a CU */ /* This structure describes association of a DU to a CU */
...@@ -76,6 +76,9 @@ typedef struct f1ap_info { ...@@ -76,6 +76,9 @@ typedef struct f1ap_info {
#define F1AP_UE_IDENTIFIER_NUMBER 3 #define F1AP_UE_IDENTIFIER_NUMBER 3
#define NUMBER_OF_eNB_MAX 3 #define NUMBER_OF_eNB_MAX 3
void DU_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp);
uint8_t F1AP_get_next_transaction_identifier(module_id_t enb_mod_idP, module_id_t du_mod_idP) { uint8_t F1AP_get_next_transaction_identifier(module_id_t enb_mod_idP, module_id_t du_mod_idP) {
static uint8_t transaction_identifier[NUMBER_OF_eNB_MAX]; static uint8_t transaction_identifier[NUMBER_OF_eNB_MAX];
transaction_identifier[enb_mod_idP+du_mod_idP] = (transaction_identifier[enb_mod_idP+du_mod_idP] + 1) % F1AP_TRANSACTION_IDENTIFIER_NUMBER; transaction_identifier[enb_mod_idP+du_mod_idP] = (transaction_identifier[enb_mod_idP+du_mod_idP] + 1) % F1AP_TRANSACTION_IDENTIFIER_NUMBER;
...@@ -91,36 +94,87 @@ uint8_t F1AP_get_UE_identifier(module_id_t enb_mod_idP, int CC_idP, int UE_id) { ...@@ -91,36 +94,87 @@ uint8_t F1AP_get_UE_identifier(module_id_t enb_mod_idP, int CC_idP, int UE_id) {
} }
// ============================================================================== // ==============================================================================
static
void DU_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind)
{
int result;
DevAssert(sctp_data_ind != NULL);
f1ap_handle_message(sctp_data_ind->assoc_id, sctp_data_ind->stream,
sctp_data_ind->buffer, sctp_data_ind->buffer_length);
result = itti_free(TASK_UNKNOWN, sctp_data_ind->buffer);
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
}
void F1AP_DU_task(void) { void *F1AP_DU_task(void *arg) {
printf("Start F1AP DU task!\n"); printf("Start F1AP DU task!\n");
sctp_du_init(); //sctp_cu_init();
// while (1) { MessageDef *received_msg = NULL;
int result;
// switch () { //F1AP_DEBUG("Starting F1AP at DU\n");
// case F1AP_ProcedureCode_id_F1Setup: //f1ap_eNB_prepare_internal_data();
DU_send_F1_SETUP_REQUEST((module_id_t)1, (module_id_t)2);
itti_mark_task_ready(TASK_DU_F1);
while (1) {
switch (ITTI_MSG_ID(received_msg)) {
// case TERMINATE_MESSAGE:
// //F1AP_WARN(" *** Exiting F1AP DU thread\n");
// itti_exit_task();
// break; // break;
//DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER();
//DU_send_UL_RRC_MESSAGE_TRANSFER(); // OK
//DU_send_UE_CONTEXT_SETUP_RESPONSE(); // OK
//DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(); // OK
//DU_send_gNB_DU_CONFIGURATION_UPDATE((module_id_t)1, (module_id_t)2);
// default:
// } // switch //case F1AP_SETUP_REQ: // this is not a true F1 message, but rather an ITTI message sent by enb_app
// 1. save the itti msg so that you can use it to sen f1ap_setup_req
// 2. send a sctp_association req
// DU_send_sctp_association_req(ITTI_MESSAGE_GET_INSTANCE(received_msg),
// &F1AP_SETUP_REQ(received_msg));
// break;
// } // while case SCTP_NEW_ASSOCIATION_RESP:
// 1. store the respon
// 2. send the f1setup_req
DU_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg),
&received_msg->ittiMsg.sctp_new_association_resp);
break;
return; case SCTP_DATA_IND:
DU_handle_sctp_data_ind(&received_msg->ittiMsg.sctp_data_ind);
break;
default:
// F1AP_ERROR("DU Received unhandled message: %d:%s\n",
// ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg));
break;
} // switch
result = itti_free (ITTI_MSG_ORIGIN_ID(received_msg), received_msg);
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
received_msg = NULL;
} // while
return NULL;
} }
// ============================================================================== // ==============================================================================
void DU_send_sctp_association_req(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp)
{
//
AssertFatal(0,"Not implemented yet\n");
}
void DU_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp)
{
//
AssertFatal(0,"Not implemented yet\n");
}
// ============================================================================== // ==============================================================================
......
...@@ -6084,6 +6084,8 @@ openair_rrc_eNB_init( ...@@ -6084,6 +6084,8 @@ openair_rrc_eNB_init(
openair_rrc_on(&ctxt); openair_rrc_on(&ctxt);
if (RC.rrc[ctxt.module_id]->node_type == ngran_eNB_CU || RC.rrc[ctxt.module_id]->node_type == ngran_ng_eNB_CU) if (RC.rrc[ctxt.module_id]->node_type == ngran_eNB_CU || RC.rrc[ctxt.module_id]->node_type == ngran_ng_eNB_CU)
// msg_p = itti_alloc_new_message (TASK_ENB_APP, F1AP_SCTP_REQ);
// RCconfig_CU_F1(msg_p, enb_id);
setup_ngran_CU(RC.rrc[ctxt.module_id]); setup_ngran_CU(RC.rrc[ctxt.module_id]);
return 0; return 0;
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "ip_forward_messages_types.h" #include "ip_forward_messages_types.h"
#include "s11_messages_types.h" #include "s11_messages_types.h"
#include "s1ap_messages_types.h" #include "s1ap_messages_types.h"
#include "f1ap_messages_types.h"
#include "nas_messages_types.h" #include "nas_messages_types.h"
#include "s6a_messages_types.h" #include "s6a_messages_types.h"
#include "sctp_messages_types.h" #include "sctp_messages_types.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment