Commit 632ca157 authored by Robert Schmidt's avatar Robert Schmidt

Separate F1 Setup Request and network configuration

This branch series implements the usage of the F1 Setup Request
internally at the gNB, even if CU and DU run in the same process. Until
now, the F1 Setup Request contained struct fields to pass IP
configuration to the F1AP module; this information is not necessary in
monolithic, nor should it be relevant when passing the information in
F1 Setup Request.

Therefore, this commit moves all IP connection-related information out
of the F1 Setup Request and into a separate structure instead.  In order
to give the F1AP module the necessary connection information, the
DU_REGISTER_REQ message is introduced that combines the F1 Setup Request
and IP configuration, such that the F1AP module can setup the SCTP
connection and then send the F1 Setup Request message.

In a later commit, there will be a callback for F1 Setup Request at MAC
to simply register the DU at the CU. The monolithic callback will simply
forward the F1 Setup Request The F1AP callback will look up the IP
configuration and create DU_REGISTER_REQ message containing IP
configuration and F1 Setup Request, which is then handled by the F1AP
module. To this end, a separate function in gnb_config.c allows to read
IP information from configuration.
parent 4f7ae5dd
...@@ -19,6 +19,9 @@ ...@@ -19,6 +19,9 @@
* contact@openairinterface.org * contact@openairinterface.org
*/ */
/* To setup F1 at DU */
MESSAGE_DEF(F1AP_DU_REGISTER_REQ, MESSAGE_PRIORITY_MED, f1ap_du_register_req_t, f1ap_du_register_req)
/* eNB_DU application layer -> F1AP messages or CU F1AP -> RRC*/ /* eNB_DU application layer -> F1AP messages or CU F1AP -> RRC*/
MESSAGE_DEF(F1AP_SETUP_REQ , MESSAGE_PRIORITY_MED, f1ap_setup_req_t , f1ap_setup_req) MESSAGE_DEF(F1AP_SETUP_REQ , MESSAGE_PRIORITY_MED, f1ap_setup_req_t , f1ap_setup_req)
MESSAGE_DEF(F1AP_GNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE , MESSAGE_PRIORITY_MED, f1ap_gnb_cu_configuration_update_acknowledge_t , f1ap_gnb_cu_configuration_update_acknowledge) MESSAGE_DEF(F1AP_GNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE , MESSAGE_PRIORITY_MED, f1ap_gnb_cu_configuration_update_acknowledge_t , f1ap_gnb_cu_configuration_update_acknowledge)
......
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
#define F1AP_CU_SCTP_REQ(mSGpTR) (mSGpTR)->ittiMsg.f1ap_cu_sctp_req #define F1AP_CU_SCTP_REQ(mSGpTR) (mSGpTR)->ittiMsg.f1ap_cu_sctp_req
#define F1AP_DU_REGISTER_REQ(mSGpTR) (mSGpTR)->ittiMsg.f1ap_du_register_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_GNB_CU_CONFIGURATION_UPDATE(mSGpTR) (mSGpTR)->ittiMsg.f1ap_gnb_cu_configuration_update #define F1AP_GNB_CU_CONFIGURATION_UPDATE(mSGpTR) (mSGpTR)->ittiMsg.f1ap_gnb_cu_configuration_update
...@@ -75,6 +77,13 @@ typedef struct f1ap_net_ip_address_s { ...@@ -75,6 +77,13 @@ typedef struct f1ap_net_ip_address_s {
char ipv6_address[46]; char ipv6_address[46];
} f1ap_net_ip_address_t; } f1ap_net_ip_address_t;
typedef struct f1ap_net_config_t {
f1ap_net_ip_address_t CU_f1_ip_address;
f1ap_net_ip_address_t DU_f1_ip_address;
uint16_t CUport;
uint16_t DUport;
} f1ap_net_config_t;
typedef struct cellIDs_s { typedef struct cellIDs_s {
// Served Cell Information // Served Cell Information
...@@ -100,24 +109,6 @@ typedef struct cellIDs_s { ...@@ -100,24 +109,6 @@ typedef struct cellIDs_s {
typedef struct f1ap_setup_req_s { typedef struct f1ap_setup_req_s {
// Midhaul networking parameters
/* Connexion id used between SCTP/F1AP */
uint16_t cnx_id;
/* SCTP association id */
int32_t assoc_id;
/* The eNB IP address to bind */
f1ap_net_ip_address_t CU_f1_ip_address;
f1ap_net_ip_address_t DU_f1_ip_address;
uint16_t CUport;
uint16_t DUport;
/* Number of SCTP streams used for a mme association */
uint16_t sctp_in_streams;
uint16_t sctp_out_streams;
// F1_Setup_Req payload // F1_Setup_Req payload
uint64_t gNB_DU_id; uint64_t gNB_DU_id;
char *gNB_DU_name; char *gNB_DU_name;
...@@ -184,6 +175,11 @@ typedef struct f1ap_setup_req_s { ...@@ -184,6 +175,11 @@ typedef struct f1ap_setup_req_s {
} f1ap_setup_req_t; } f1ap_setup_req_t;
typedef struct f1ap_du_register_req_t {
f1ap_setup_req_t setup_req;
f1ap_net_config_t net_config;
} f1ap_du_register_req_t;
typedef struct served_cells_to_activate_s { typedef struct served_cells_to_activate_s {
/// mcc of DU cells /// mcc of DU cells
uint16_t mcc; uint16_t mcc;
......
...@@ -49,10 +49,13 @@ f1ap_cudu_inst_t *getCxt(instance_t instanceP) ...@@ -49,10 +49,13 @@ f1ap_cudu_inst_t *getCxt(instance_t instanceP)
return f1_inst[instanceP]; return f1_inst[instanceP];
} }
void createF1inst(instance_t instanceP, f1ap_setup_req_t *req) void createF1inst(instance_t instanceP, f1ap_setup_req_t *req, f1ap_net_config_t *nc)
{ {
AssertFatal(f1_inst[instanceP] == NULL, "Double call to F1 DU init\n"); DevAssert(instanceP == 0);
f1_inst[instanceP] = (f1ap_cudu_inst_t *)calloc(1, sizeof(f1ap_cudu_inst_t)); DevAssert(req != NULL);
if (req) AssertFatal(f1_inst[0] == NULL, "Double call to F1 DU init\n");
memcpy(&f1_inst[instanceP]->setupReq, req, sizeof(f1ap_setup_req_t)); f1_inst[0] = calloc(1, sizeof(f1ap_cudu_inst_t));
AssertFatal(f1_inst[0] != NULL, "out of memory\n");
f1_inst[0]->setupReq = *req;
f1_inst[0]->net_config = *nc;
} }
...@@ -406,8 +406,16 @@ typedef struct f1ap_cudu_ue_inst_s { ...@@ -406,8 +406,16 @@ typedef struct f1ap_cudu_ue_inst_s {
typedef struct f1ap_cudu_inst_s { typedef struct f1ap_cudu_inst_s {
f1ap_setup_req_t setupReq; f1ap_setup_req_t setupReq;
/* The eNB IP address to bind */
f1ap_net_config_t net_config;
/* SCTP information */
int32_t assoc_id;
uint16_t sctp_in_streams; uint16_t sctp_in_streams;
uint16_t sctp_out_streams; uint16_t sctp_out_streams;
/* GTP instance used by F1 */
instance_t gtpInst; instance_t gtpInst;
uint64_t gNB_DU_id; uint64_t gNB_DU_id;
uint16_t num_ues; uint16_t num_ues;
...@@ -420,7 +428,7 @@ uint8_t F1AP_get_next_transaction_identifier(instance_t mod_idP, instance_t cu_m ...@@ -420,7 +428,7 @@ uint8_t F1AP_get_next_transaction_identifier(instance_t mod_idP, instance_t cu_m
f1ap_cudu_inst_t *getCxt(instance_t instanceP); f1ap_cudu_inst_t *getCxt(instance_t instanceP);
void createF1inst(instance_t instanceP, f1ap_setup_req_t *req); void createF1inst(instance_t instanceP, f1ap_setup_req_t *req, f1ap_net_config_t *nc);
//lts: C struct type is not homogeneous, so we need macros instead of functions //lts: C struct type is not homogeneous, so we need macros instead of functions
#define addnRCGI(nRCGi, servedCelL) \ #define addnRCGI(nRCGi, servedCelL) \
......
...@@ -48,11 +48,12 @@ static instance_t cu_task_create_gtpu_instance(eth_params_t *IPaddrs) { ...@@ -48,11 +48,12 @@ static instance_t cu_task_create_gtpu_instance(eth_params_t *IPaddrs) {
return gtpv1Init(tmp); return gtpv1Init(tmp);
} }
static void cu_task_handle_sctp_association_ind(instance_t instance, sctp_new_association_ind_t *sctp_new_association_ind, static void cu_task_handle_sctp_association_ind(instance_t instance,
eth_params_t *IPaddrs) { sctp_new_association_ind_t *sctp_new_association_ind,
createF1inst(instance, NULL); eth_params_t *IPaddrs)
{
// save the assoc id // save the assoc id
f1ap_setup_req_t *f1ap_cu_data = &getCxt(instance)->setupReq; f1ap_cudu_inst_t *f1ap_cu_data = getCxt(instance);
f1ap_cu_data->assoc_id = sctp_new_association_ind->assoc_id; f1ap_cu_data->assoc_id = sctp_new_association_ind->assoc_id;
f1ap_cu_data->sctp_in_streams = sctp_new_association_ind->in_streams; f1ap_cu_data->sctp_in_streams = sctp_new_association_ind->in_streams;
f1ap_cu_data->sctp_out_streams = sctp_new_association_ind->out_streams; f1ap_cu_data->sctp_out_streams = sctp_new_association_ind->out_streams;
......
...@@ -40,8 +40,9 @@ ...@@ -40,8 +40,9 @@
//Fixme: Uniq dirty DU instance, by global var, datamodel need better management //Fixme: Uniq dirty DU instance, by global var, datamodel need better management
instance_t DUuniqInstance=0; instance_t DUuniqInstance=0;
void du_task_send_sctp_association_req(instance_t instance, f1ap_setup_req_t *f1ap_setup_req) { void du_task_send_sctp_association_req(instance_t instance, f1ap_net_config_t *nc)
DevAssert(f1ap_setup_req != NULL); {
DevAssert(nc != NULL);
MessageDef *message_p = NULL; MessageDef *message_p = NULL;
sctp_new_association_req_t *sctp_new_association_req_p = NULL; sctp_new_association_req_t *sctp_new_association_req_p = NULL;
message_p = itti_alloc_new_message(TASK_DU_F1, 0, SCTP_NEW_ASSOCIATION_REQ); message_p = itti_alloc_new_message(TASK_DU_F1, 0, SCTP_NEW_ASSOCIATION_REQ);
...@@ -49,19 +50,13 @@ void du_task_send_sctp_association_req(instance_t instance, f1ap_setup_req_t *f1 ...@@ -49,19 +50,13 @@ void du_task_send_sctp_association_req(instance_t instance, f1ap_setup_req_t *f1
sctp_new_association_req_p->ulp_cnx_id = instance; sctp_new_association_req_p->ulp_cnx_id = instance;
sctp_new_association_req_p->port = F1AP_PORT_NUMBER; sctp_new_association_req_p->port = F1AP_PORT_NUMBER;
sctp_new_association_req_p->ppid = F1AP_SCTP_PPID; sctp_new_association_req_p->ppid = F1AP_SCTP_PPID;
sctp_new_association_req_p->in_streams = f1ap_setup_req->sctp_in_streams; sctp_new_association_req_p->in_streams = 2; //du_inst->sctp_in_streams;
sctp_new_association_req_p->out_streams = f1ap_setup_req->sctp_out_streams; sctp_new_association_req_p->out_streams = 2; //du_inst->sctp_out_streams;
// remote // remote
memcpy(&sctp_new_association_req_p->remote_address, memcpy(&sctp_new_association_req_p->remote_address, &nc->CU_f1_ip_address, sizeof(nc->CU_f1_ip_address));
&f1ap_setup_req->CU_f1_ip_address,
sizeof(f1ap_setup_req->CU_f1_ip_address));
// local // local
memcpy(&sctp_new_association_req_p->local_address, memcpy(&sctp_new_association_req_p->local_address, &nc->DU_f1_ip_address, sizeof(nc->DU_f1_ip_address));
&f1ap_setup_req->DU_f1_ip_address, // du_f1ap_register_to_sctp
sizeof(f1ap_setup_req->DU_f1_ip_address));
//printf("sib itti message %s\n", f1ap_setup_req_t->sib1[0]);
//printf("nr_cellid : %llx (%lld)",f1ap_setup_req->nr_cellid[0],f1ap_setup_req->nr_cellid[0]);
//du_f1ap_register_to_sctp
itti_send_msg_to_task(TASK_SCTP, instance, message_p); itti_send_msg_to_task(TASK_SCTP, instance, message_p);
} }
...@@ -78,12 +73,12 @@ void du_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat ...@@ -78,12 +73,12 @@ void du_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat
} }
// save the assoc id // save the assoc id
f1ap_setup_req_t *f1ap_du_data = &getCxt(instance)->setupReq; f1ap_cudu_inst_t *f1ap_du_data = getCxt(instance);
f1ap_du_data->assoc_id = sctp_new_association_resp->assoc_id; f1ap_du_data->assoc_id = sctp_new_association_resp->assoc_id;
f1ap_du_data->sctp_in_streams = sctp_new_association_resp->in_streams; f1ap_du_data->sctp_in_streams = sctp_new_association_resp->in_streams;
f1ap_du_data->sctp_out_streams = sctp_new_association_resp->out_streams; f1ap_du_data->sctp_out_streams = sctp_new_association_resp->out_streams;
/* setup parameters for F1U and start the server */ /* setup parameters for F1U and start the server */
DU_send_F1_SETUP_REQUEST(instance, f1ap_du_data); DU_send_F1_SETUP_REQUEST(instance, &f1ap_du_data->setupReq);
} }
void du_task_handle_sctp_data_ind(instance_t instance, sctp_data_ind_t *sctp_data_ind) { void du_task_handle_sctp_data_ind(instance_t instance, sctp_data_ind_t *sctp_data_ind) {
...@@ -108,14 +103,19 @@ void *F1AP_DU_task(void *arg) { ...@@ -108,14 +103,19 @@ void *F1AP_DU_task(void *arg) {
LOG_D(F1AP, "DU Task Received %s for instance %ld\n", LOG_D(F1AP, "DU Task Received %s for instance %ld\n",
ITTI_MSG_NAME(msg),myInstance); ITTI_MSG_NAME(msg),myInstance);
switch (ITTI_MSG_ID(msg)) { switch (ITTI_MSG_ID(msg)) {
case F1AP_SETUP_REQ: { case F1AP_SETUP_REQ:
AssertFatal(false, "the F1AP_SETUP_REQ should not be received; use the F1AP_DU_REGISTER_REQ instead\n");
break;
case F1AP_DU_REGISTER_REQ: {
// this is not a true F1 message, but rather an ITTI message sent by gnb_app // this is not a true F1 message, but rather an ITTI message sent by gnb_app
// 1. save the itti msg so that you can use it to sen f1ap_setup_req, fill the f1ap_setup_req message, // 1. save the itti msg so that you can use it to sen f1ap_setup_req, fill the f1ap_setup_req message,
// 2. store the message in f1ap context, that is also stored in RC // 2. store the message in f1ap context, that is also stored in RC
// 2. send a sctp_association req // 2. send a sctp_association req
f1ap_setup_req_t *msgSetup = &F1AP_SETUP_REQ(msg); f1ap_setup_req_t *msgSetup = &F1AP_DU_REGISTER_REQ(msg).setup_req;
createF1inst(myInstance, msgSetup); f1ap_net_config_t *nc = &F1AP_DU_REGISTER_REQ(msg).net_config;
du_task_send_sctp_association_req(myInstance, msgSetup); createF1inst(myInstance, msgSetup, nc);
du_task_send_sctp_association_req(myInstance, nc);
} break; } break;
case F1AP_GNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE: case F1AP_GNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE:
......
...@@ -22,7 +22,8 @@ ...@@ -22,7 +22,8 @@
#ifndef F1AP_DU_TASK_H_ #ifndef F1AP_DU_TASK_H_
#define F1AP_DU_TASK_H_ #define F1AP_DU_TASK_H_
void du_task_send_sctp_association_req(instance_t instance, f1ap_setup_req_t *f1ap_setup_req); struct f1ap_net_config_t;
void du_task_send_sctp_association_req(instance_t instance, struct f1ap_net_config_t *du_inst);
void du_task_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp); void du_task_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp);
void du_task_handle_sctp_data_ind(instance_t instance, sctp_data_ind_t *sctp_data_ind); void du_task_handle_sctp_data_ind(instance_t instance, sctp_data_ind_t *sctp_data_ind);
void *F1AP_DU_task(void *arg); void *F1AP_DU_task(void *arg);
......
...@@ -150,7 +150,7 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, ...@@ -150,7 +150,7 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance,
BIT_STRING_TO_TRANSPORT_LAYER_ADDRESS_IPv4(&ul_up_tnl0->transportLayerAddress, drb_p->up_ul_tnl[0].tl_address); BIT_STRING_TO_TRANSPORT_LAYER_ADDRESS_IPv4(&ul_up_tnl0->transportLayerAddress, drb_p->up_ul_tnl[0].tl_address);
OCTET_STRING_TO_UINT32(&ul_up_tnl0->gTP_TEID, drb_p->up_ul_tnl[0].teid); OCTET_STRING_TO_UINT32(&ul_up_tnl0->gTP_TEID, drb_p->up_ul_tnl[0].teid);
// 3GPP assumes GTP-U is on port 2152, but OAI is configurable // 3GPP assumes GTP-U is on port 2152, but OAI is configurable
drb_p->up_ul_tnl[0].port = getCxt(instance)->setupReq.CUport; drb_p->up_ul_tnl[0].port = getCxt(instance)->net_config.CUport;
switch (drbs_tobesetup_item_p->rLCMode) { switch (drbs_tobesetup_item_p->rLCMode) {
case F1AP_RLCMode_rlc_am: case F1AP_RLCMode_rlc_am:
...@@ -332,7 +332,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup ...@@ -332,7 +332,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup
asn1cCalloc(dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.choice.gTPTunnel,gTPTunnel); asn1cCalloc(dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.choice.gTPTunnel,gTPTunnel);
/* transportLayerAddress */ /* transportLayerAddress */
struct sockaddr_in addr= {0}; struct sockaddr_in addr= {0};
inet_pton(AF_INET, getCxt(instance)->setupReq.DU_f1_ip_address.ipv4_address, &addr.sin_addr.s_addr); inet_pton(AF_INET, getCxt(instance)->net_config.DU_f1_ip_address.ipv4_address, &addr.sin_addr.s_addr);
TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(addr.sin_addr.s_addr, TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(addr.sin_addr.s_addr,
&gTPTunnel->transportLayerAddress); &gTPTunnel->transportLayerAddress);
/* gTP_TEID */ /* gTP_TEID */
...@@ -458,7 +458,9 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup ...@@ -458,7 +458,9 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup
F1AP_SCell_FailedtoSetup_Item_t *sCell_FailedtoSetup_item= F1AP_SCell_FailedtoSetup_Item_t *sCell_FailedtoSetup_item=
&sCell_FailedtoSetup_item_ies->value.choice.SCell_FailedtoSetup_Item; &sCell_FailedtoSetup_item_ies->value.choice.SCell_FailedtoSetup_Item;
/* sCell_ID */ /* sCell_ID */
addnRCGI(sCell_FailedtoSetup_item->sCell_ID, getCxt(instance)->setupReq.cell+i); AssertFatal(false, "handle correct CellID\n");
cellIDs_t cellID = {0};
addnRCGI(sCell_FailedtoSetup_item->sCell_ID, &cellID);
/* cause */ /* cause */
asn1cCalloc(sCell_FailedtoSetup_item->cause, tmp); asn1cCalloc(sCell_FailedtoSetup_item->cause, tmp);
// dummy value // dummy value
...@@ -848,7 +850,7 @@ int DU_handle_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, uint32_t asso ...@@ -848,7 +850,7 @@ int DU_handle_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, uint32_t asso
BIT_STRING_TO_TRANSPORT_LAYER_ADDRESS_IPv4(&ul_up_tnl0->transportLayerAddress, drb_p->up_ul_tnl[0].tl_address); BIT_STRING_TO_TRANSPORT_LAYER_ADDRESS_IPv4(&ul_up_tnl0->transportLayerAddress, drb_p->up_ul_tnl[0].tl_address);
OCTET_STRING_TO_UINT32(&ul_up_tnl0->gTP_TEID, drb_p->up_ul_tnl[0].teid); OCTET_STRING_TO_UINT32(&ul_up_tnl0->gTP_TEID, drb_p->up_ul_tnl[0].teid);
// 3GPP assumes GTP-U is on port 2152, but OAI is configurable // 3GPP assumes GTP-U is on port 2152, but OAI is configurable
drb_p->up_ul_tnl[0].port = getCxt(instance)->setupReq.CUport; drb_p->up_ul_tnl[0].port = getCxt(instance)->net_config.CUport;
extern instance_t DUuniqInstance; extern instance_t DUuniqInstance;
if (DUuniqInstance == 0) { if (DUuniqInstance == 0) {
...@@ -861,9 +863,9 @@ int DU_handle_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, uint32_t asso ...@@ -861,9 +863,9 @@ int DU_handle_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, uint32_t asso
(drb_p->up_ul_tnl[0].tl_address >> 16) & 0xff, (drb_p->up_ul_tnl[0].tl_address >> 16) & 0xff,
(drb_p->up_ul_tnl[0].tl_address >> 24) & 0xff); (drb_p->up_ul_tnl[0].tl_address >> 24) & 0xff);
getCxt(instance)->gtpInst = du_create_gtpu_instance_to_cu(gtp_tunnel_ip_address, getCxt(instance)->gtpInst = du_create_gtpu_instance_to_cu(gtp_tunnel_ip_address,
getCxt(instance)->setupReq.CUport, getCxt(instance)->net_config.CUport,
getCxt(instance)->setupReq.DU_f1_ip_address.ipv4_address, getCxt(instance)->net_config.DU_f1_ip_address.ipv4_address,
getCxt(instance)->setupReq.DUport); getCxt(instance)->net_config.DUport);
AssertFatal(getCxt(instance)->gtpInst > 0, "Failed to create CU F1-U UDP listener"); AssertFatal(getCxt(instance)->gtpInst > 0, "Failed to create CU F1-U UDP listener");
// Fixme: fully inconsistent instances management // Fixme: fully inconsistent instances management
// dirty global var is a bad fix // dirty global var is a bad fix
...@@ -1043,7 +1045,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance, f1ap_ue_contex ...@@ -1043,7 +1045,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance, f1ap_ue_contex
asn1cCalloc(dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.choice.gTPTunnel,gTPTunnel); asn1cCalloc(dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.choice.gTPTunnel,gTPTunnel);
/* transportLayerAddress */ /* transportLayerAddress */
struct sockaddr_in addr= {0}; struct sockaddr_in addr= {0};
inet_pton(AF_INET, getCxt(instance)->setupReq.DU_f1_ip_address.ipv4_address, &addr.sin_addr.s_addr); inet_pton(AF_INET, getCxt(instance)->net_config.DU_f1_ip_address.ipv4_address, &addr.sin_addr.s_addr);
TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(addr.sin_addr.s_addr, TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(addr.sin_addr.s_addr,
&gTPTunnel->transportLayerAddress); &gTPTunnel->transportLayerAddress);
/* gTP_TEID */ /* gTP_TEID */
...@@ -1081,7 +1083,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance, f1ap_ue_contex ...@@ -1081,7 +1083,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance, f1ap_ue_contex
asn1cCalloc(dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.choice.gTPTunnel, gTPTunnel); asn1cCalloc(dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.choice.gTPTunnel, gTPTunnel);
/* transportLayerAddress */ /* transportLayerAddress */
struct sockaddr_in addr= {0}; struct sockaddr_in addr= {0};
inet_pton(AF_INET, getCxt(instance)->setupReq.DU_f1_ip_address.ipv4_address, &addr.sin_addr.s_addr); inet_pton(AF_INET, getCxt(instance)->net_config.DU_f1_ip_address.ipv4_address, &addr.sin_addr.s_addr);
TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(addr.sin_addr.s_addr, &gTPTunnel->transportLayerAddress); TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(addr.sin_addr.s_addr, &gTPTunnel->transportLayerAddress);
/* gTP_TEID */ /* gTP_TEID */
INT32_TO_OCTET_STRING(resp->drbs_to_be_modified[i].up_dl_tnl[j].teid, &gTPTunnel->gTP_TEID); INT32_TO_OCTET_STRING(resp->drbs_to_be_modified[i].up_dl_tnl[j].teid, &gTPTunnel->gTP_TEID);
......
...@@ -28,7 +28,7 @@ void f1ap_itti_send_sctp_data_req(instance_t instance, uint8_t *buffer, uint32_t ...@@ -28,7 +28,7 @@ void f1ap_itti_send_sctp_data_req(instance_t instance, uint8_t *buffer, uint32_t
sctp_data_req_t *sctp_data_req; sctp_data_req_t *sctp_data_req;
message_p = itti_alloc_new_message(TASK_CU_F1, 0, SCTP_DATA_REQ); message_p = itti_alloc_new_message(TASK_CU_F1, 0, SCTP_DATA_REQ);
sctp_data_req = &message_p->ittiMsg.sctp_data_req; sctp_data_req = &message_p->ittiMsg.sctp_data_req;
sctp_data_req->assoc_id = getCxt(instance)->setupReq.assoc_id; sctp_data_req->assoc_id = getCxt(instance)->assoc_id;
sctp_data_req->buffer = buffer; sctp_data_req->buffer = buffer;
sctp_data_req->buffer_length = buffer_length; sctp_data_req->buffer_length = buffer_length;
sctp_data_req->stream = 0; sctp_data_req->stream = 0;
...@@ -42,7 +42,7 @@ void f1ap_itti_send_sctp_close_association(instance_t instance) ...@@ -42,7 +42,7 @@ void f1ap_itti_send_sctp_close_association(instance_t instance)
sctp_close_association_t *sctp_close_association_p = NULL; sctp_close_association_t *sctp_close_association_p = NULL;
message_p = itti_alloc_new_message(TASK_S1AP, 0, SCTP_CLOSE_ASSOCIATION); message_p = itti_alloc_new_message(TASK_S1AP, 0, SCTP_CLOSE_ASSOCIATION);
sctp_close_association_p = &message_p->ittiMsg.sctp_close_association; sctp_close_association_p = &message_p->ittiMsg.sctp_close_association;
sctp_close_association_p->assoc_id = getCxt(instance)->setupReq.assoc_id; sctp_close_association_p->assoc_id = getCxt(instance)->assoc_id;
itti_send_msg_to_task(TASK_SCTP, instance, message_p); itti_send_msg_to_task(TASK_SCTP, instance, message_p);
} }
...@@ -181,7 +181,7 @@ void *gNB_app_task(void *args_p) ...@@ -181,7 +181,7 @@ void *gNB_app_task(void *args_p)
} }
// configure F1AP here for F1C // configure F1AP here for F1C
LOG_I(GNB_APP,"ngran_gNB_DU: Allocating ITTI message for F1AP_SETUP_REQ\n"); LOG_I(GNB_APP,"ngran_gNB_DU: Allocating ITTI message for F1AP_SETUP_REQ\n");
msg_p = itti_alloc_new_message (TASK_GNB_APP, 0, F1AP_SETUP_REQ); msg_p = itti_alloc_new_message (TASK_GNB_APP, 0, F1AP_DU_REGISTER_REQ);
RCconfig_NR_DU_F1(msg_p, 0); RCconfig_NR_DU_F1(msg_p, 0);
itti_send_msg_to_task (TASK_DU_F1, GNB_MODULE_ID_TO_INSTANCE(0), msg_p); itti_send_msg_to_task (TASK_DU_F1, GNB_MODULE_ID_TO_INSTANCE(0), msg_p);
......
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
#include "sctp_eNB_task.h" #include "sctp_eNB_task.h"
#include "sctp_default_values.h" #include "sctp_default_values.h"
#include "F1AP_CauseRadioNetwork.h" #include "F1AP_CauseRadioNetwork.h"
#include "f1ap_common.h"
// #include "SystemInformationBlockType2.h" // #include "SystemInformationBlockType2.h"
// #include "LAYER2/MAC/extern.h" // #include "LAYER2/MAC/extern.h"
// #include "LAYER2/MAC/proto.h" // #include "LAYER2/MAC/proto.h"
...@@ -1881,6 +1882,32 @@ int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i) { ...@@ -1881,6 +1882,32 @@ int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i) {
return 0; return 0;
} }
static f1ap_net_config_t read_DU_IP_config(const eth_params_t* f1_params)
{
f1ap_net_config_t nc = {0};
nc.CU_f1_ip_address.ipv6 = 0;
nc.CU_f1_ip_address.ipv4 = 1;
strcpy(nc.CU_f1_ip_address.ipv4_address, f1_params->remote_addr);
nc.CUport = f1_params->remote_portd;
LOG_I(GNB_APP,
"FIAP: CU_ip4_address in DU %p, strlen %d\n",
nc.CU_f1_ip_address.ipv4_address,
(int)strlen(f1_params->remote_addr));
nc.DU_f1_ip_address.ipv6 = 0;
nc.DU_f1_ip_address.ipv4 = 1;
strcpy(nc.DU_f1_ip_address.ipv4_address, f1_params->my_addr);
nc.DUport = f1_params->my_portd;
LOG_I(GNB_APP,
"FIAP: DU_ip4_address in DU %p, strlen %ld\n",
nc.DU_f1_ip_address.ipv4_address,
strlen(f1_params->my_addr));
// sctp_in_streams/sctp_out_streams are given by SCTP layer
return nc;
}
int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) { int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) {
int k; int k;
paramdef_t GNBSParams[] = GNBSPARAMS_DESC; paramdef_t GNBSParams[] = GNBSPARAMS_DESC;
...@@ -1896,7 +1923,7 @@ int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) { ...@@ -1896,7 +1923,7 @@ int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) {
config_getlist( &GNBParamList,GNBParams,sizeof(GNBParams)/sizeof(paramdef_t),NULL); config_getlist( &GNBParamList,GNBParams,sizeof(GNBParams)/sizeof(paramdef_t),NULL);
AssertFatal(GNBParamList.paramarray[i][GNB_GNB_ID_IDX].uptr != NULL, AssertFatal(GNBParamList.paramarray[i][GNB_GNB_ID_IDX].uptr != NULL,
"gNB id %u is not defined in configuration file\n",i); "gNB id %u is not defined in configuration file\n",i);
f1ap_setup_req_t * f1Setup=&F1AP_SETUP_REQ(msg_p); f1ap_setup_req_t *f1Setup = &F1AP_DU_REGISTER_REQ(msg_p).setup_req;
f1Setup->num_cells_available = 0; f1Setup->num_cells_available = 0;
for (k=0; k <num_gnbs ; k++) { for (k=0; k <num_gnbs ; k++) {
...@@ -1912,7 +1939,6 @@ int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) { ...@@ -1912,7 +1939,6 @@ int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) {
PLMNParams[I].chkPptr = &(config_check_PLMNParams[I]); PLMNParams[I].chkPptr = &(config_check_PLMNParams[I]);
config_getlist(&PLMNParamList, PLMNParams, sizeof(PLMNParams)/sizeof(paramdef_t), aprefix); config_getlist(&PLMNParamList, PLMNParams, sizeof(PLMNParams)/sizeof(paramdef_t), aprefix);
paramdef_t SCTPParams[] = SCTPPARAMS_DESC;
f1Setup->num_cells_available++; f1Setup->num_cells_available++;
f1Setup->gNB_DU_id = *(GNBParamList.paramarray[0][GNB_GNB_ID_IDX].uptr); f1Setup->gNB_DU_id = *(GNBParamList.paramarray[0][GNB_GNB_ID_IDX].uptr);
LOG_I(GNB_APP,"F1AP: gNB_DU_id[%d] %ld\n",k,f1Setup->gNB_DU_id); LOG_I(GNB_APP,"F1AP: gNB_DU_id[%d] %ld\n",k,f1Setup->gNB_DU_id);
...@@ -1933,26 +1959,9 @@ int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) { ...@@ -1933,26 +1959,9 @@ int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) {
f1Setup->cell[k].nr_cellid = (uint64_t)*(GNBParamList.paramarray[i][GNB_NRCELLID_IDX].u64ptr); f1Setup->cell[k].nr_cellid = (uint64_t)*(GNBParamList.paramarray[i][GNB_NRCELLID_IDX].u64ptr);
LOG_I(GNB_APP,"F1AP: nr_cellid[%d] %ld\n",k,f1Setup->cell[k].nr_cellid); LOG_I(GNB_APP,"F1AP: nr_cellid[%d] %ld\n",k,f1Setup->cell[k].nr_cellid);
LOG_I(GNB_APP,"F1AP: CU_ip4_address in DU %s\n",RC.nrmac[k]->eth_params_n.remote_addr); LOG_I(GNB_APP,"F1AP: CU_ip4_address in DU %s\n",RC.nrmac[k]->eth_params_n.remote_addr);
LOG_I(GNB_APP,"FIAP: CU_ip4_address in DU %p, strlen %d\n",f1Setup->CU_f1_ip_address.ipv4_address,(int)strlen(RC.nrmac[k]->eth_params_n.remote_addr));
f1Setup->CU_f1_ip_address.ipv6 = 0; F1AP_DU_REGISTER_REQ(msg_p).net_config = read_DU_IP_config(&RC.nrmac[k]->eth_params_n);
f1Setup->CU_f1_ip_address.ipv4 = 1;
//strcpy(f1Setup->CU_f1_ip_address.ipv6_address, "");
strcpy(f1Setup->CU_f1_ip_address.ipv4_address, RC.nrmac[k]->eth_params_n.remote_addr);
LOG_I(GNB_APP,"F1AP: DU_ip4_address in DU %s\n",RC.nrmac[k]->eth_params_n.my_addr);
LOG_I(GNB_APP,"FIAP: DU_ip4_address in DU %p, strlen %ld\n",
f1Setup->DU_f1_ip_address.ipv4_address,
strlen(RC.nrmac[k]->eth_params_n.my_addr));
f1Setup->DU_f1_ip_address.ipv6 = 0;
f1Setup->DU_f1_ip_address.ipv4 = 1;
//strcpy(f1Setup->DU_f1_ip_address.ipv6_address, "");
strcpy(f1Setup->DU_f1_ip_address.ipv4_address, RC.nrmac[k]->eth_params_n.my_addr);
f1Setup->DUport= RC.nrmac[k]->eth_params_n.my_portd;
f1Setup->CUport= RC.nrmac[k]->eth_params_n.remote_portd;
//strcpy(f1Setup->CU_ip_address[l].ipv6_address,*(F1ParamList.paramarray[l][ENB_CU_IPV6_ADDRESS_IDX].strptr));
sprintf(aprefix,"%s.[%i].%s",GNB_CONFIG_STRING_GNB_LIST,k,GNB_CONFIG_STRING_SCTP_CONFIG);
config_get(SCTPParams,sizeof(SCTPParams)/sizeof(paramdef_t),aprefix);
f1Setup->sctp_in_streams = (uint16_t)*(SCTPParams[GNB_SCTP_INSTREAMS_IDX].uptr);
f1Setup->sctp_out_streams = (uint16_t)*(SCTPParams[GNB_SCTP_OUTSTREAMS_IDX].uptr);
gNB_RRC_INST *rrc = RC.nrrrc[k]; gNB_RRC_INST *rrc = RC.nrrrc[k];
// wait until RRC cell information is configured // wait until RRC cell information is configured
int cell_info_configured = 0; int cell_info_configured = 0;
......
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