Commit 4f7ae5dd authored by Robert Schmidt's avatar Robert Schmidt

No double instance book keeping

parent 57876fc1
......@@ -106,7 +106,7 @@ void prepare_and_send_ue_context_modification_f1(rrc_gNB_ue_context_t *ue_contex
abort();
}
f1ap_cudu_inst_t *getCxt(F1_t isCU, instance_t instanceP)
f1ap_cudu_inst_t *getCxt(instance_t instanceP)
{
abort();
return NULL;
......
......@@ -32,8 +32,7 @@
#include "f1ap_common.h"
static f1ap_cudu_inst_t *f1_du_inst[NUMBER_OF_gNB_MAX]= {0};
static f1ap_cudu_inst_t *f1_cu_inst[NUMBER_OF_gNB_MAX]= {0};
static f1ap_cudu_inst_t *f1_inst[NUMBER_OF_gNB_MAX]= {0};
uint8_t F1AP_get_next_transaction_identifier(instance_t mod_idP, instance_t cu_mod_idP)
{
......@@ -44,32 +43,16 @@ uint8_t F1AP_get_next_transaction_identifier(instance_t mod_idP, instance_t cu_m
return transaction_identifier[mod_idP+cu_mod_idP];
}
f1ap_cudu_inst_t *getCxt(F1_t isCU, instance_t instanceP) {
//Fixme: 4G F1 has race condtions, someone may debug it, using this test
/*
static pid_t t=-1;
pid_t tNew=gettid();
AssertFatal ( t==-1 || t==tNew, "This is not thread safe\n");
t=tNew;
*/
AssertFatal( instanceP < sizeofArray(f1_cu_inst), "");
return isCU == CUtype ? f1_cu_inst[ instanceP]: f1_du_inst[ instanceP];
}
void createF1inst(F1_t isCU, instance_t instanceP, f1ap_setup_req_t *req) {
if (isCU == CUtype) {
AssertFatal(f1_cu_inst[instanceP] == NULL, "Double call to F1 CU init\n");
f1_cu_inst[instanceP]=( f1ap_cudu_inst_t *) calloc(1, sizeof( f1ap_cudu_inst_t));
//memcpy(f1_cu_inst[instanceP]->setupReq, req, sizeof(f1ap_setup_req_t) );
} else {
AssertFatal(f1_du_inst[instanceP] == NULL, "Double call to F1 DU init\n");
f1_du_inst[instanceP]=( f1ap_cudu_inst_t *) calloc(1, sizeof(f1ap_cudu_inst_t));
memcpy(&f1_du_inst[instanceP]->setupReq, req, sizeof(f1ap_setup_req_t) );
}
f1ap_cudu_inst_t *getCxt(instance_t instanceP)
{
DevAssert(instanceP == 0);
return f1_inst[instanceP];
}
int f1ap_assoc_id(F1_t isCu, instance_t instanceP) {
f1ap_setup_req_t *f1_inst=f1ap_req(isCu, instanceP);
return f1_inst->assoc_id;
void createF1inst(instance_t instanceP, f1ap_setup_req_t *req)
{
AssertFatal(f1_inst[instanceP] == NULL, "Double call to F1 DU init\n");
f1_inst[instanceP] = (f1ap_cudu_inst_t *)calloc(1, sizeof(f1ap_cudu_inst_t));
if (req)
memcpy(&f1_inst[instanceP]->setupReq, req, sizeof(f1ap_setup_req_t));
}
......@@ -414,24 +414,13 @@ typedef struct f1ap_cudu_inst_s {
f1ap_cudu_ue_t f1ap_ue[MAX_MOBILES_PER_GNB];
} f1ap_cudu_inst_t;
typedef enum {
DUtype=0,
CUtype
} F1_t;
static const int nrb_lut[29] = {11, 18, 24, 25, 31, 32, 38, 51, 52, 65, 66, 78, 79, 93, 106, 107, 121, 132, 133, 135, 160, 162, 189, 216, 217, 245, 264, 270, 273};
uint8_t F1AP_get_next_transaction_identifier(instance_t mod_idP, instance_t cu_mod_idP);
f1ap_cudu_inst_t *getCxt(F1_t isCU, instance_t instanceP);
void createF1inst(F1_t isCU, instance_t instanceP, f1ap_setup_req_t *req);
int f1ap_assoc_id(F1_t isCu, instance_t instanceP);
f1ap_cudu_inst_t *getCxt(instance_t instanceP);
static inline f1ap_setup_req_t *f1ap_req(F1_t isCu, instance_t instanceP) {
return &getCxt(isCu, instanceP)->setupReq;
}
void createF1inst(instance_t instanceP, f1ap_setup_req_t *req);
//lts: C struct type is not homogeneous, so we need macros instead of functions
#define addnRCGI(nRCGi, servedCelL) \
......
......@@ -353,7 +353,7 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance, f1ap_setup_resp_t *f1ap_setup
}
ASN_STRUCT_RESET(asn_DEF_F1AP_F1AP_PDU, &pdu);
f1ap_itti_send_sctp_data_req(true, instance, buffer, len);
f1ap_itti_send_sctp_data_req(instance, buffer, len);
return 0;
}
......@@ -420,7 +420,7 @@ int CU_send_F1_SETUP_FAILURE(instance_t instance) {
}
ASN_STRUCT_RESET(asn_DEF_F1AP_F1AP_PDU, &pdu);
f1ap_itti_send_sctp_data_req(true,instance, buffer, len);
f1ap_itti_send_sctp_data_req(instance, buffer, len);
return 0;
}
......@@ -536,7 +536,7 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu
LOG_DUMPMSG(F1AP, LOG_DUMP_CHAR, buffer, len, "F1AP gNB-CU CONFIGURATION UPDATE : ");
ASN_STRUCT_RESET(asn_DEF_F1AP_F1AP_PDU, &pdu);
f1ap_itti_send_sctp_data_req(true,instance, buffer, len);
f1ap_itti_send_sctp_data_req(instance, buffer, len);
return 0;
}
......
......@@ -115,6 +115,6 @@ int CU_send_Paging(instance_t instance, f1ap_paging_ind_t *paging) {
return -1;
}
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, &pdu);
f1ap_itti_send_sctp_data_req(true, instance, buffer, len);
f1ap_itti_send_sctp_data_req(instance, buffer, len);
return 0;
}
......@@ -209,7 +209,7 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
return -1;
}
f1ap_itti_send_sctp_data_req(true, instance, buffer, len);
f1ap_itti_send_sctp_data_req(instance, buffer, len);
return 0;
}
......
......@@ -50,20 +50,20 @@ static instance_t cu_task_create_gtpu_instance(eth_params_t *IPaddrs) {
static void cu_task_handle_sctp_association_ind(instance_t instance, sctp_new_association_ind_t *sctp_new_association_ind,
eth_params_t *IPaddrs) {
createF1inst(true, instance, NULL);
createF1inst(instance, NULL);
// save the assoc id
f1ap_setup_req_t *f1ap_cu_data=f1ap_req(true, instance);
f1ap_setup_req_t *f1ap_cu_data = &getCxt(instance)->setupReq;
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_out_streams = sctp_new_association_ind->out_streams;
if (RC.nrrrc[instance]->node_type != ngran_gNB_CUCP) {
getCxt(CUtype, instance)->gtpInst = cu_task_create_gtpu_instance(IPaddrs);
AssertFatal(getCxt(CUtype, instance)->gtpInst > 0, "Failed to create CU F1-U UDP listener");
getCxt(instance)->gtpInst = cu_task_create_gtpu_instance(IPaddrs);
AssertFatal(getCxt(instance)->gtpInst > 0, "Failed to create CU F1-U UDP listener");
} else
LOG_I(F1AP, "In F1AP connection, don't start GTP-U, as we have also E1AP\n");
// Fixme: fully inconsistent instances management
// dirty global var is a bad fix
CUuniqInstance=getCxt(CUtype, instance)->gtpInst;
CUuniqInstance=getCxt(instance)->gtpInst;
}
static void cu_task_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp) {
......
......@@ -509,7 +509,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance,
/*Use a dummy teid for the outgoing GTP-U tunnel (DU) which will be updated once we get the UE context setup response from the DU*/
/* Use a dummy address and teid for the outgoing GTP-U tunnel (DU) which will be updated once we get the UE context setup response from the DU */
transport_layer_addr_t addr = { .length= 32, .buffer= { 0 } };
f1ap_ue_context_setup_req->drbs_to_be_setup[i].up_ul_tnl[j].teid = newGtpuCreateTunnel(getCxt(CUtype, instance)->gtpInst,
f1ap_ue_context_setup_req->drbs_to_be_setup[i].up_ul_tnl[j].teid = newGtpuCreateTunnel(getCxt(instance)->gtpInst,
f1ap_ue_context_setup_req->gNB_CU_ue_id,
f1ap_ue_context_setup_req->drbs_to_be_setup[i].drb_id,
f1ap_ue_context_setup_req->drbs_to_be_setup[i].drb_id,
......@@ -628,7 +628,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance,
// return -1;
// }
LOG_D(F1AP,"F1AP UEContextSetupRequest Encoded %u bits\n", len);
f1ap_itti_send_sctp_data_req(true, instance, buffer, len);
f1ap_itti_send_sctp_data_req(instance, buffer, len);
return 0;
}
......@@ -692,7 +692,7 @@ int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance,
F1AP_GTPTunnel_t *dl_up_tnl0 = dl_up_tnl_info_p->dLUPTNLInformation.choice.gTPTunnel;
BIT_STRING_TO_TRANSPORT_LAYER_ADDRESS_IPv4(&dl_up_tnl0->transportLayerAddress, drb_p->up_dl_tnl[0].tl_address);
OCTET_STRING_TO_UINT32(&dl_up_tnl0->gTP_TEID, drb_p->up_dl_tnl[0].teid);
GtpuUpdateTunnelOutgoingAddressAndTeid(getCxt(CUtype, instance)->gtpInst,
GtpuUpdateTunnelOutgoingAddressAndTeid(getCxt(instance)->gtpInst,
f1ap_ue_context_setup_resp->gNB_DU_ue_id,
(ebi_t)drbs_setup_item_p->dRBID,
drb_p->up_dl_tnl[0].tl_address,
......@@ -916,7 +916,7 @@ int CU_send_UE_CONTEXT_RELEASE_COMMAND(instance_t instance,
return -1;
}
f1ap_itti_send_sctp_data_req(true, instance, buffer, len);
f1ap_itti_send_sctp_data_req(instance, buffer, len);
return 0;
}
int CU_handle_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance,
......@@ -1562,7 +1562,7 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, f1ap_ue_context
LOG_E(F1AP, "Failed to encode F1 UE CONTEXT_MODIFICATION REQUEST\n");
return -1;
}
f1ap_itti_send_sctp_data_req(true, instance, buffer, len);
f1ap_itti_send_sctp_data_req(instance, buffer, len);
return 0;
}
......@@ -1628,7 +1628,7 @@ int CU_handle_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance,
F1AP_GTPTunnel_t *dl_up_tnl0 = dl_up_tnl_info_p->dLUPTNLInformation.choice.gTPTunnel;
BIT_STRING_TO_TRANSPORT_LAYER_ADDRESS_IPv4(&dl_up_tnl0->transportLayerAddress, drb_p->up_dl_tnl[0].tl_address);
OCTET_STRING_TO_UINT32(&dl_up_tnl0->gTP_TEID, drb_p->up_dl_tnl[0].teid);
GtpuUpdateTunnelOutgoingAddressAndTeid(getCxt(CUtype, instance)->gtpInst,
GtpuUpdateTunnelOutgoingAddressAndTeid(getCxt(instance)->gtpInst,
f1ap_ue_context_modification_resp->gNB_CU_ue_id,
(ebi_t)drbs_setupmod_item_p->dRBID,
drb_p->up_dl_tnl[0].tl_address,
......@@ -1892,7 +1892,7 @@ int CU_send_UE_CONTEXT_MODIFICATION_CONFIRM(instance_t instance, f1ap_ue_context
LOG_E(F1AP, "Failed to encode F1 UE Context Modification Confirm\n");
return -1;
}
f1ap_itti_send_sctp_data_req(true, instance, buffer, len);
f1ap_itti_send_sctp_data_req(instance, buffer, len);
return 0;
}
......@@ -1959,6 +1959,6 @@ int CU_send_UE_CONTEXT_MODIFICATION_REFUSE(instance_t instance, f1ap_ue_context_
LOG_E(F1AP, "Failed to encode F1 UE Context Modification Refuse\n");
return -1;
}
f1ap_itti_send_sctp_data_req(true, instance, buffer, len);
f1ap_itti_send_sctp_data_req(instance, buffer, len);
return 0;
}
......@@ -347,7 +347,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance, f1ap_setup_req_t *setup_req)
}
ASN_STRUCT_RESET(asn_DEF_F1AP_F1AP_PDU, &pdu);
f1ap_itti_send_sctp_data_req(false, instance, buffer, len);
f1ap_itti_send_sctp_data_req(instance, buffer, len);
return 0;
}
......@@ -984,7 +984,7 @@ int DU_send_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance,
}
ASN_STRUCT_RESET(asn_DEF_F1AP_F1AP_PDU, &pdu);
f1ap_itti_send_sctp_data_req(false, instance, buffer, len);
f1ap_itti_send_sctp_data_req(instance, buffer, len);
return 0;
}
......
......@@ -85,7 +85,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
/* strange: it is not named OLD_GNB_DU_UE... */
old_gNB_DU_ue_id_stack = ie->value.choice.GNB_DU_UE_F1AP_ID_1;
old_gNB_DU_ue_id = &old_gNB_DU_ue_id_stack;
gtpv1u_update_ue_id(getCxt(false, instance)->gtpInst, old_gNB_DU_ue_id_stack, du_ue_f1ap_id);
gtpv1u_update_ue_id(getCxt(instance)->gtpInst, old_gNB_DU_ue_id_stack, du_ue_f1ap_id);
}
/* mandatory */
......@@ -172,7 +172,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instanceP, const f1ap_ini
ie2->criticality = F1AP_Criticality_reject;
ie2->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_NRCGI;
//Fixme: takes always the first cell
addnRCGI(ie2->value.choice.NRCGI, getCxt(DUtype, instanceP)->setupReq.cell);
addnRCGI(ie2->value.choice.NRCGI, getCxt(instanceP)->setupReq.cell);
/* mandatory */
/* c3. C_RNTI */ // 16
asn1cSequenceAdd(out->protocolIEs.list, F1AP_InitialULRRCMessageTransferIEs_t, ie3);
......@@ -213,7 +213,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instanceP, const f1ap_ini
return -1;
}
f1ap_itti_send_sctp_data_req(false, instanceP, buffer, len);
f1ap_itti_send_sctp_data_req(instanceP, buffer, len);
return 0;
}
......@@ -279,6 +279,6 @@ int DU_send_UL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, const f1ap_ul_rrc_me
return -1;
}
f1ap_itti_send_sctp_data_req(false, instance, buffer, len);
f1ap_itti_send_sctp_data_req(instance, buffer, len);
return 0;
}
......@@ -78,7 +78,7 @@ void du_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat
}
// save the assoc id
f1ap_setup_req_t *f1ap_du_data=f1ap_req(false, instance);
f1ap_setup_req_t *f1ap_du_data = &getCxt(instance)->setupReq;
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_out_streams = sctp_new_association_resp->out_streams;
......@@ -114,7 +114,7 @@ void *F1AP_DU_task(void *arg) {
// 2. store the message in f1ap context, that is also stored in RC
// 2. send a sctp_association req
f1ap_setup_req_t *msgSetup = &F1AP_SETUP_REQ(msg);
createF1inst(false, myInstance, msgSetup);
createF1inst(myInstance, msgSetup);
du_task_send_sctp_association_req(myInstance, msgSetup);
} break;
......
......@@ -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);
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
drb_p->up_ul_tnl[0].port=getCxt(false,instance)->setupReq.CUport;
drb_p->up_ul_tnl[0].port = getCxt(instance)->setupReq.CUport;
switch (drbs_tobesetup_item_p->rLCMode) {
case F1AP_RLCMode_rlc_am:
......@@ -332,8 +332,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup
asn1cCalloc(dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.choice.gTPTunnel,gTPTunnel);
/* transportLayerAddress */
struct sockaddr_in addr= {0};
inet_pton(AF_INET, getCxt(false,instance)->setupReq.DU_f1_ip_address.ipv4_address,
&addr.sin_addr.s_addr);
inet_pton(AF_INET, getCxt(instance)->setupReq.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);
/* gTP_TEID */
......@@ -459,7 +458,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup
F1AP_SCell_FailedtoSetup_Item_t *sCell_FailedtoSetup_item=
&sCell_FailedtoSetup_item_ies->value.choice.SCell_FailedtoSetup_Item;
/* sCell_ID */
addnRCGI(sCell_FailedtoSetup_item->sCell_ID,f1ap_req(false, instance)->cell+i);
addnRCGI(sCell_FailedtoSetup_item->sCell_ID, getCxt(instance)->setupReq.cell+i);
/* cause */
asn1cCalloc(sCell_FailedtoSetup_item->cause, tmp);
// dummy value
......@@ -544,7 +543,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup
return -1;
}
f1ap_itti_send_sctp_data_req(false, instance, buffer, len);
f1ap_itti_send_sctp_data_req(instance, buffer, len);
return 0;
}
......@@ -619,7 +618,7 @@ int DU_send_UE_CONTEXT_RELEASE_REQUEST(instance_t instance,
return -1;
}
f1ap_itti_send_sctp_data_req(false, instance, buffer, len);
f1ap_itti_send_sctp_data_req(instance, buffer, len);
return 0;
}
......@@ -766,7 +765,7 @@ int DU_send_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, f1ap_ue_context_rel
return -1;
}
f1ap_itti_send_sctp_data_req(false, instance, buffer, len);
f1ap_itti_send_sctp_data_req(instance, buffer, len);
return 0;
}
......@@ -849,7 +848,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);
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
drb_p->up_ul_tnl[0].port=getCxt(false,instance)->setupReq.CUport;
drb_p->up_ul_tnl[0].port = getCxt(instance)->setupReq.CUport;
extern instance_t DUuniqInstance;
if (DUuniqInstance == 0) {
......@@ -861,16 +860,15 @@ int DU_handle_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, uint32_t asso
(drb_p->up_ul_tnl[0].tl_address >> 8) & 0xff,
(drb_p->up_ul_tnl[0].tl_address >> 16) & 0xff,
(drb_p->up_ul_tnl[0].tl_address >> 24) & 0xff);
getCxt(DUtype, instance)->gtpInst=du_create_gtpu_instance_to_cu(
gtp_tunnel_ip_address,
getCxt(false,instance)->setupReq.CUport,
getCxt(false,instance)->setupReq.DU_f1_ip_address.ipv4_address,
getCxt(false,instance)->setupReq.DUport);
AssertFatal(getCxt(DUtype, instance)->gtpInst>0,"Failed to create CU F1-U UDP listener");
getCxt(instance)->gtpInst = du_create_gtpu_instance_to_cu(gtp_tunnel_ip_address,
getCxt(instance)->setupReq.CUport,
getCxt(instance)->setupReq.DU_f1_ip_address.ipv4_address,
getCxt(instance)->setupReq.DUport);
AssertFatal(getCxt(instance)->gtpInst > 0, "Failed to create CU F1-U UDP listener");
// Fixme: fully inconsistent instances management
// dirty global var is a bad fix
extern instance_t legacyInstanceMapping;
legacyInstanceMapping = DUuniqInstance = getCxt(DUtype, instance)->gtpInst;
legacyInstanceMapping = DUuniqInstance = getCxt(instance)->gtpInst;
}
switch (drbs_tobesetupmod_item_p->rLCMode) {
......@@ -1026,7 +1024,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance, f1ap_ue_contex
transport_layer_addr_t tl_addr = {0};
memcpy(tl_addr.buffer, &drb->up_ul_tnl[0].tl_address, sizeof(drb->up_ul_tnl[0].tl_address));
tl_addr.length = sizeof(drb->up_ul_tnl[0].tl_address) * 8;
drb->up_dl_tnl[j].teid = newGtpuCreateTunnel(getCxt(false, instance)->gtpInst,
drb->up_dl_tnl[j].teid = newGtpuCreateTunnel(getCxt(instance)->gtpInst,
resp->gNB_DU_ue_id,
drb->drb_id,
drb->drb_id,
......@@ -1045,8 +1043,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance, f1ap_ue_contex
asn1cCalloc(dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.choice.gTPTunnel,gTPTunnel);
/* transportLayerAddress */
struct sockaddr_in addr= {0};
inet_pton(AF_INET, getCxt(false,instance)->setupReq.DU_f1_ip_address.ipv4_address,
&addr.sin_addr.s_addr);
inet_pton(AF_INET, getCxt(instance)->setupReq.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);
/* gTP_TEID */
......@@ -1084,8 +1081,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance, f1ap_ue_contex
asn1cCalloc(dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.choice.gTPTunnel, gTPTunnel);
/* transportLayerAddress */
struct sockaddr_in addr= {0};
inet_pton(AF_INET, getCxt(false,instance)->setupReq.DU_f1_ip_address.ipv4_address,
&addr.sin_addr.s_addr);
inet_pton(AF_INET, getCxt(instance)->setupReq.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);
/* gTP_TEID */
INT32_TO_OCTET_STRING(resp->drbs_to_be_modified[i].up_dl_tnl[j].teid, &gTPTunnel->gTP_TEID);
......@@ -1160,7 +1156,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance, f1ap_ue_contex
/* 8.1 SCell_ToBeSetup_Item */
F1AP_SCell_FailedtoSetupMod_Item_t *scell_failedtoSetupMod_item=&scell_failedtoSetupMod_item_ies->value.choice.SCell_FailedtoSetupMod_Item;
/* - sCell_ID */
addnRCGI(scell_failedtoSetupMod_item->sCell_ID, &f1ap_req(false, instance)->cell[i]);
addnRCGI(scell_failedtoSetupMod_item->sCell_ID, &getCxt(instance)->setupReq.cell[i]);
asn1cCalloc(scell_failedtoSetupMod_item->cause, tmp);
tmp->present = F1AP_Cause_PR_radioNetwork;
tmp->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnb_du_ue_f1ap_id;
......@@ -1269,7 +1265,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance, f1ap_ue_contex
return -1;
}
f1ap_itti_send_sctp_data_req(false, instance, buffer, len);
f1ap_itti_send_sctp_data_req(instance, buffer, len);
return 0;
}
......@@ -1393,7 +1389,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_REQUIRED(instance_t instance, f1ap_ue_contex
return -1;
}
f1ap_itti_send_sctp_data_req(false, instance, buffer, len);
f1ap_itti_send_sctp_data_req(instance, buffer, len);
return 0;
}
......
......@@ -22,13 +22,13 @@
#include "f1ap_common.h"
#include "f1ap_itti_messaging.h"
void f1ap_itti_send_sctp_data_req(bool isCu, instance_t instance, uint8_t *buffer, uint32_t buffer_length)
void f1ap_itti_send_sctp_data_req(instance_t instance, uint8_t *buffer, uint32_t buffer_length)
{
MessageDef *message_p;
sctp_data_req_t *sctp_data_req;
message_p = itti_alloc_new_message(isCu?TASK_CU_F1:TASK_DU_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->assoc_id = f1ap_assoc_id(isCu,instance);
sctp_data_req->assoc_id = getCxt(instance)->setupReq.assoc_id;
sctp_data_req->buffer = buffer;
sctp_data_req->buffer_length = buffer_length;
sctp_data_req->stream = 0;
......@@ -36,12 +36,13 @@ void f1ap_itti_send_sctp_data_req(bool isCu, instance_t instance, uint8_t *buffe
itti_send_msg_to_task(TASK_SCTP, instance, message_p);
}
void f1ap_itti_send_sctp_close_association(bool isCu, instance_t instance) {
void f1ap_itti_send_sctp_close_association(instance_t instance)
{
MessageDef *message_p = NULL;
sctp_close_association_t *sctp_close_association_p = NULL;
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->assoc_id = f1ap_assoc_id(isCu,instance);
sctp_close_association_p->assoc_id = getCxt(instance)->setupReq.assoc_id;
itti_send_msg_to_task(TASK_SCTP, instance, message_p);
}
......@@ -22,6 +22,6 @@
#ifndef F1AP_ITTI_MESSAGING_H_
#define F1AP_ITTI_MESSAGING_H_
void f1ap_itti_send_sctp_data_req(bool isCu,instance_t instance, uint8_t *buffer, uint32_t buffer_length);
void f1ap_itti_send_sctp_data_req(instance_t instance, uint8_t *buffer, uint32_t buffer_length);
#endif /* F1AP_ITTI_MESSAGING_H_ */
......@@ -195,7 +195,7 @@ static void cucp_cuup_bearer_context_setup_direct(e1ap_bearer_setup_req_t *const
} else {
int remote_port = RC.nrrrc[ctxt.module_id]->eth_params_s.remote_portd;
in_addr_t my_addr = inet_addr(RC.nrrrc[ctxt.module_id]->eth_params_s.my_addr);
instance_t gtpInst = getCxt(CUtype, instance)->gtpInst;
instance_t gtpInst = getCxt(instance)->gtpInst;
// GTP tunnel for DL
fill_e1ap_bearer_setup_resp(&resp, req, gtpInst, UE->rrc_ue_id, remote_port, my_addr);
}
......@@ -210,7 +210,7 @@ static void cucp_cuup_bearer_context_mod_direct(e1ap_bearer_setup_req_t *const r
// only update GTP tunnels if it is really a CU
if (!NODE_IS_CU(RC.nrrrc[0]->node_type))
return;
instance_t gtpInst = getCxt(CUtype, instance)->gtpInst;
instance_t gtpInst = getCxt(instance)->gtpInst;
CU_update_UP_DL_tunnel(req, gtpInst, req->gNB_cu_cp_ue_id);
}
......
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