Commit afcbf7b6 authored by Laurent THOMAS's avatar Laurent THOMAS

remove most of globale variables, remain data model inconsistency and race conditions

parent 6ce958f7
......@@ -85,7 +85,6 @@ char * split73_config;
int split73;
AGENT_RRC_xface *agent_rrc_xface[NUM_MAX_ENB]= {0};
AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB]= {0};
uint8_t proto_agent_flag = 0;
void flexran_agent_slice_update(mid_t module_idP) {
}
int proto_agent_start(mod_id_t mod_id, const cudu_params_t *p){
......
......@@ -303,7 +303,7 @@ typedef struct f1ap_initial_ul_rrc_message_s {
uint16_t crnti;
uint8_t *rrc_container;
int rrc_container_length;
int8_t *du2cu_rrc_container;
char *du2cu_rrc_container;
int du2cu_rrc_container_length;
} f1ap_initial_ul_rrc_message_t;
......
......@@ -1910,6 +1910,7 @@ int RCconfig_DU_F1(MessageDef *msg_p, uint32_t i) {
AssertFatal(ENBParamList.paramarray[i][ENB_ENB_ID_IDX].uptr != NULL,
"eNB id %u is not defined in configuration file\n",i);
F1AP_SETUP_REQ (msg_p).num_cells_available = 0;
F1AP_SETUP_REQ (msg_p).cell_type = CELL_MACRO_ENB;
for (k=0; k <num_enbs ; k++) {
if (strcmp(ENBSParams[ENB_ACTIVE_ENBS_IDX].strlistptr[k], *(ENBParamList.paramarray[i][ENB_ENB_NAME_IDX].strptr) )== 0) {
......
......@@ -32,6 +32,9 @@
#include "f1ap_common.h"
static f1ap_cudu_inst_t *f1_du_inst[NUMBER_OF_eNB_MAX]= {0};
static f1ap_cudu_inst_t *f1_cu_inst[NUMBER_OF_eNB_MAX]= {0};
#if defined(EMIT_ASN_DEBUG_EXTERN)
int asn_debug = 0;
int asn1_xer_print = 0;
......@@ -61,11 +64,30 @@ uint8_t F1AP_get_next_transaction_identifier(module_id_t enb_mod_idP, module_id_
return transaction_identifier[enb_mod_idP+cu_mod_idP];
}
int f1ap_add_ue(f1ap_cudu_inst_t *f1_inst,
f1ap_cudu_inst_t *getCxt(bool isCU, module_id_t module_idP) {
AssertFatal( module_idP < sizeofArray(f1_cu_inst), "");
return isCU? f1_cu_inst[ module_idP]: f1_du_inst[ module_idP];
}
void createF1inst(bool isCU, module_id_t module_idP, f1ap_setup_req_t *req) {
if (isCU) {
AssertFatal(f1_cu_inst[module_idP] == NULL, "Double call to F1 CU init\n");
f1_cu_inst[module_idP]=( f1ap_cudu_inst_t *) calloc(1, sizeof( f1ap_cudu_inst_t));
//memcpy(f1_cu_inst[module_idP]->setupReq, req, sizeof(f1ap_setup_req_t) );
} else {
AssertFatal(f1_du_inst[module_idP] == NULL, "Double call to F1 DU init\n");
f1_du_inst[module_idP]=( f1ap_cudu_inst_t *) calloc(1, sizeof(f1ap_cudu_inst_t));
memcpy(&f1_du_inst[module_idP]->setupReq, req, sizeof(f1ap_setup_req_t) );
}
}
int f1ap_add_ue(bool isCu,
module_id_t module_idP,
int CC_idP,
int UE_id,
rnti_t rntiP) {
f1ap_cudu_inst_t *f1_inst=getCxt(isCu, module_idP);
for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) {
if (f1_inst->f1ap_ue[i].rnti == rntiP) {
f1_inst->f1ap_ue[i].f1ap_uid = i;
......@@ -92,8 +114,10 @@ int f1ap_add_ue(f1ap_cudu_inst_t *f1_inst,
}
int f1ap_remove_ue(f1ap_cudu_inst_t *f1_inst,
int f1ap_remove_ue(bool isCu, module_id_t module_idP,
rnti_t rntiP) {
f1ap_cudu_inst_t *f1_inst=getCxt(isCu, module_idP);
for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) {
if (f1_inst->f1ap_ue[i].rnti == rntiP) {
f1_inst->f1ap_ue[i].rnti = 0;
......@@ -105,8 +129,10 @@ int f1ap_remove_ue(f1ap_cudu_inst_t *f1_inst,
return 0;
}
int f1ap_get_du_ue_f1ap_id(f1ap_cudu_inst_t *f1_inst,
int f1ap_get_du_ue_f1ap_id(bool isCu, module_id_t module_idP,
rnti_t rntiP) {
f1ap_cudu_inst_t *f1_inst=getCxt(isCu, module_idP);
for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) {
if (f1_inst->f1ap_ue[i].rnti == rntiP) {
return f1_inst->f1ap_ue[i].du_ue_f1ap_id;
......@@ -116,8 +142,10 @@ int f1ap_get_du_ue_f1ap_id(f1ap_cudu_inst_t *f1_inst,
return -1;
}
int f1ap_get_cu_ue_f1ap_id(f1ap_cudu_inst_t *f1_inst,
int f1ap_get_cu_ue_f1ap_id(bool isCu, module_id_t module_idP,
rnti_t rntiP) {
f1ap_cudu_inst_t *f1_inst=getCxt(isCu, module_idP);
for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) {
if (f1_inst->f1ap_ue[i].rnti == rntiP) {
return f1_inst->f1ap_ue[i].cu_ue_f1ap_id;
......@@ -127,8 +155,10 @@ int f1ap_get_cu_ue_f1ap_id(f1ap_cudu_inst_t *f1_inst,
return -1;
}
int f1ap_get_rnti_by_du_id(f1ap_cudu_inst_t *f1_inst,
int f1ap_get_rnti_by_du_id(bool isCu, module_id_t module_idP,
module_id_t du_ue_f1ap_id ) {
f1ap_cudu_inst_t *f1_inst=getCxt(isCu, module_idP);
for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) {
if (f1_inst->f1ap_ue[i].du_ue_f1ap_id == du_ue_f1ap_id) {
return f1_inst->f1ap_ue[i].rnti;
......@@ -138,8 +168,10 @@ int f1ap_get_rnti_by_du_id(f1ap_cudu_inst_t *f1_inst,
return -1;
}
int f1ap_get_rnti_by_cu_id(f1ap_cudu_inst_t *f1_inst,
int f1ap_get_rnti_by_cu_id(bool isCu, module_id_t module_idP,
module_id_t cu_ue_f1ap_id ) {
f1ap_cudu_inst_t *f1_inst=getCxt(isCu, module_idP);
for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) {
if (f1_inst->f1ap_ue[i].cu_ue_f1ap_id == cu_ue_f1ap_id) {
return f1_inst->f1ap_ue[i].rnti;
......@@ -149,8 +181,10 @@ int f1ap_get_rnti_by_cu_id(f1ap_cudu_inst_t *f1_inst,
return -1;
}
int f1ap_get_du_uid(f1ap_cudu_inst_t *f1_inst,
int f1ap_get_du_uid(bool isCu, module_id_t module_idP,
module_id_t du_ue_f1ap_id ) {
f1ap_cudu_inst_t *f1_inst=getCxt(isCu, module_idP);
for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) {
if (f1_inst->f1ap_ue[i].du_ue_f1ap_id == du_ue_f1ap_id) {
return i;
......@@ -160,8 +194,10 @@ int f1ap_get_du_uid(f1ap_cudu_inst_t *f1_inst,
return -1;
}
int f1ap_get_cu_uid(f1ap_cudu_inst_t *f1_inst,
int f1ap_get_cu_uid(bool isCu, module_id_t module_idP,
module_id_t cu_ue_f1ap_id ) {
f1ap_cudu_inst_t *f1_inst=getCxt(isCu, module_idP);
for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) {
if (f1_inst->f1ap_ue[i].cu_ue_f1ap_id == cu_ue_f1ap_id) {
return i;
......@@ -171,8 +207,10 @@ int f1ap_get_cu_uid(f1ap_cudu_inst_t *f1_inst,
return -1;
}
int f1ap_get_uid_by_rnti(f1ap_cudu_inst_t *f1_inst,
int f1ap_get_uid_by_rnti(bool isCu, module_id_t module_idP,
rnti_t rntiP ) {
f1ap_cudu_inst_t *f1_inst=getCxt(isCu, module_idP);
for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) {
if (f1_inst->f1ap_ue[i].rnti == rntiP) {
return i;
......@@ -182,10 +220,11 @@ int f1ap_get_uid_by_rnti(f1ap_cudu_inst_t *f1_inst,
return -1;
}
int f1ap_du_add_cu_ue_id(f1ap_cudu_inst_t *f1_inst,
int f1ap_du_add_cu_ue_id(bool isCu, module_id_t module_idP,
module_id_t du_ue_f1ap_id,
module_id_t cu_ue_f1ap_id) {
module_id_t f1ap_uid = f1ap_get_du_uid(f1_inst,du_ue_f1ap_id);
f1ap_cudu_inst_t *f1_inst=getCxt(isCu, module_idP);
module_id_t f1ap_uid = f1ap_get_du_uid(isCu, module_idP,du_ue_f1ap_id);
if (f1ap_uid < 0 || f1ap_uid >= MAX_MOBILES_PER_ENB)
return -1;
......@@ -195,10 +234,11 @@ int f1ap_du_add_cu_ue_id(f1ap_cudu_inst_t *f1_inst,
return 0;
}
int f1ap_cu_add_du_ue_id(f1ap_cudu_inst_t *f1_inst,
int f1ap_cu_add_du_ue_id(bool isCu, module_id_t module_idP,
module_id_t cu_ue_f1ap_id,
module_id_t du_ue_f1ap_id) {
module_id_t f1ap_uid = f1ap_get_cu_uid(f1_inst,cu_ue_f1ap_id);
f1ap_cudu_inst_t *f1_inst=getCxt(isCu, module_idP);
module_id_t f1ap_uid = f1ap_get_cu_uid(isCu,module_idP,cu_ue_f1ap_id);
if (f1ap_uid < 0 || f1ap_uid >= MAX_MOBILES_PER_ENB)
return -1;
......@@ -207,3 +247,8 @@ int f1ap_cu_add_du_ue_id(f1ap_cudu_inst_t *f1_inst,
LOG_I(F1AP, "Adding du_ue_f1ap_id %d for UE with RNTI %x\n", du_ue_f1ap_id, f1_inst->f1ap_ue[f1ap_uid].rnti);
return 0;
}
int f1ap_assoc_id(bool isCu, module_id_t module_idP) {
f1ap_setup_req_t *f1_inst=f1ap_req(isCu, module_idP);
return f1_inst->assoc_id;
}
......@@ -426,6 +426,12 @@ typedef struct f1ap_cudu_ue_inst_s {
} f1ap_cudu_ue_t;
typedef struct f1ap_cudu_inst_s {
f1ap_setup_req_t setupReq;
instance_t du_ue_f1ap_id;
uint16_t sctp_in_streams;
uint16_t sctp_out_streams;
uint16_t default_sctp_stream_id;
uint64_t gNB_DU_id;
uint16_t num_ues;
f1ap_cudu_ue_t f1ap_ue[MAX_MOBILES_PER_ENB];
} f1ap_cudu_inst_t;
......@@ -434,59 +440,67 @@ typedef struct f1ap_cudu_inst_s {
uint8_t F1AP_get_next_transaction_identifier(module_id_t enb_mod_idP, module_id_t cu_mod_idP);
f1ap_cudu_inst_t *getCxt(bool isCU, module_id_t module_idP);
int f1ap_add_ue(f1ap_cudu_inst_t *f1_inst,
void createF1inst(bool isCU, module_id_t module_idP, f1ap_setup_req_t *req);
int f1ap_add_ue(bool isCu,
module_id_t module_idP,
int CC_idP,
int UE_id,
rnti_t rntiP);
int f1ap_remove_ue(f1ap_cudu_inst_t *f1_inst,
int f1ap_remove_ue(bool isCu, module_id_t module_idP,
rnti_t rntiP);
int f1ap_get_du_ue_f1ap_id (f1ap_cudu_inst_t *f1_inst,
int f1ap_get_du_ue_f1ap_id (bool isCu, module_id_t module_idP,
rnti_t rntiP);
int f1ap_get_cu_ue_f1ap_id (f1ap_cudu_inst_t *f1_inst,
int f1ap_get_cu_ue_f1ap_id (bool isCu, module_id_t module_idP,
rnti_t rntiP);
int f1ap_get_rnti_by_du_id(f1ap_cudu_inst_t *f1_inst,
int f1ap_get_rnti_by_du_id(bool isCu, module_id_t module_idP,
module_id_t du_ue_f1ap_id );
int f1ap_get_rnti_by_cu_id(f1ap_cudu_inst_t *f1_inst,
int f1ap_get_rnti_by_cu_id(bool isCu, module_id_t module_idP,
module_id_t cu_ue_f1ap_id );
int f1ap_get_du_uid(f1ap_cudu_inst_t *f1_inst,
int f1ap_get_du_uid(bool isCu, module_id_t module_idP,
module_id_t du_ue_f1ap_id );
int f1ap_get_cu_uid(f1ap_cudu_inst_t *f1_inst,
int f1ap_get_cu_uid(bool isCu, module_id_t module_idP,
module_id_t cu_ue_f1ap_id );
int f1ap_get_uid_by_rnti(f1ap_cudu_inst_t *f1_inst,
int f1ap_get_uid_by_rnti(bool isCu, module_id_t module_idP,
rnti_t rntiP );
int f1ap_du_add_cu_ue_id(f1ap_cudu_inst_t *f1_inst,
int f1ap_du_add_cu_ue_id(bool isCu, module_id_t module_idP,
module_id_t du_ue_f1ap_id,
module_id_t cu_ue_f1ap_id);
int f1ap_cu_add_du_ue_id(f1ap_cudu_inst_t *f1_inst,
int f1ap_cu_add_du_ue_id(bool isCu, module_id_t module_idP,
module_id_t cu_ue_f1ap_id,
module_id_t du_ue_f1ap_id);
int f1ap_assoc_id(bool isCu, module_id_t module_idP);
static inline f1ap_setup_req_t *f1ap_req(bool isCu, module_id_t module_idP) {
return &getCxt(isCu, module_idP)->setupReq;
}
#define asn1cCalloc(VaR, TyPe, lOcPtr) TyPe *lOcPtr=VaR=(TyPe*) calloc(1,sizeof(TyPe));
#define asn1cCallocOne(VaR, TyPe, VaLue) VaR=(TyPe*) calloc(1,sizeof(TyPe)); *VaR=VaLue;
#define asn1cSequenceAdd(VaR, TyPe, lOcPtr) TyPe *lOcPtr=(TyPe*) calloc(1,sizeof(TyPe)); ASN_SEQUENCE_ADD(&VaR,lOcPtr);
#define TASK_F1APP f1ap_req(false, instance)->cell_type==CELL_MACRO_GNB?TASK_GNB_APP:TASK_ENB_APP
//lts: C struct type is not homogeneous, so we need macros instead of functions
#define addnRCGI(nRCGi, servedCelL) \
MCC_MNC_TO_PLMNID((servedCelL)->mcc,(servedCelL)-> mnc,(servedCelL)->mnc_digit_length, \
&((nRCGi).pLMN_Identity)); \
NR_CELL_ID_TO_BIT_STRING((servedCelL)->nr_cellid, &((nRCGi).nRCellIdentity));
extern f1ap_setup_req_t *f1ap_du_data_from_du;
extern RAN_CONTEXT_t RC;
#endif /* F1AP_COMMON_H_ */
......@@ -133,8 +133,11 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance,
}
/* - nRCGI */
addnRCGI(served_cells_item_p->served_Cell_Information.nRCGI, req->cell+i);
TBCD_TO_MCC_MNC(&(served_cells_item_p->served_Cell_Information.nRCGI.pLMN_Identity), req->cell[i].mcc,
req->cell[i].mnc,req->cell[i].mnc_digit_length);
// NR cellID
BIT_STRING_TO_NR_CELL_IDENTITY(&served_cells_item_p->served_Cell_Information.nRCGI.nRCellIdentity,
req->cell[i].nr_cellid);
LOG_D(F1AP, "[SCTP %d] Received nRCGI: MCC %d, MNC %d, CELL_ID %llu\n", assoc_id,
req->cell[i].mcc,
req->cell[i].mnc,
......@@ -147,6 +150,12 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance,
served_cells_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[4]);
/* - nRPCI */
req->cell[i].nr_pci = served_cells_item_p->served_Cell_Information.nRPCI;
// LTS: FIXME data model failure: we don't KNOW if we receive a 4G or a 5G cell
// Furthermore, cell_type is not a attribute of a cell in the data structure !!!!!!!!!!
if (RC.nrrrc[GNB_INSTANCE_TO_MODULE_ID(instance)]->node_type == ngran_gNB_CU)
f1ap_req(true, instance)->cell_type=CELL_MACRO_GNB;
LOG_D(F1AP, "req->nr_pci[%d] %d \n",
i, req->cell[i].nr_pci);
// System Information
......@@ -170,7 +179,6 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance,
i, req->sib1[i], req->sib1_length[i]);
}
*f1ap_du_data_from_du = F1AP_SETUP_REQ(message_p);
// char *measurement_timing_information[F1AP_MAX_NB_CELLS];
// uint8_t ranac[F1AP_MAX_NB_CELLS];
// int fdd_flag = f1ap_setup_req->fdd_flag;
......@@ -222,13 +230,7 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance,
}
} else {
CU_send_F1_SETUP_FAILURE(instance);
if (RC.nrrrc[0]->node_type == ngran_gNB_CU) {
itti_free(TASK_RRC_GNB,message_p);
} else {
itti_free(TASK_RRC_ENB,message_p);
}
return -1;
}
......@@ -340,7 +342,7 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance,
}
ASN_STRUCT_RESET(asn_DEF_F1AP_F1AP_PDU, &pdu);
cu_f1ap_itti_send_sctp_data_req(instance, f1ap_du_data_from_du->assoc_id, buffer, len, 0);
f1ap_itti_send_sctp_data_req(true, instance, buffer, len, 0);
return 0;
}
......@@ -410,7 +412,7 @@ int CU_send_F1_SETUP_FAILURE(instance_t instance) {
}
ASN_STRUCT_RESET(asn_DEF_F1AP_F1AP_PDU, &pdu);
cu_f1ap_itti_send_sctp_data_req(instance, f1ap_du_data_from_du->assoc_id, buffer, len, 0);
f1ap_itti_send_sctp_data_req(true,instance, buffer, len, 0);
return 0;
}
......@@ -811,7 +813,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);
cu_f1ap_itti_send_sctp_data_req(instance, f1ap_du_data_from_du->assoc_id, buffer, len, 0);
f1ap_itti_send_sctp_data_req(true,instance, buffer, len, 0);
return 0;
}
......
......@@ -38,20 +38,10 @@
#include "common/ran_context.h"
#include "openair3/UTILS/conversions.h"
// Bing Kai: create CU and DU context, and put all the information there.
uint64_t du_ue_f1ap_id = 0;
uint32_t f1ap_assoc_id = 0;
uint32_t f1ap_stream = 0;
extern f1ap_cudu_inst_t f1ap_cu_inst[MAX_eNB];
/*
Initial UL RRC Message Transfer
*/
extern RAN_CONTEXT_t RC;
int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
uint32_t assoc_id,
uint32_t stream,
......@@ -74,15 +64,11 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
return -1;
}
// TODO: use context
f1ap_stream = stream;
f1ap_assoc_id = assoc_id;
container = &pdu->choice.initiatingMessage->value.choice.InitialULRRCMessageTransfer;
/* GNB_DU_UE_F1AP_ID */
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true);
du_ue_f1ap_id = ie->value.choice.GNB_DU_UE_F1AP_ID;
LOG_D(F1AP, "du_ue_f1ap_id %lu \n", du_ue_f1ap_id);
getCxt(true, instance)->du_ue_f1ap_id = ie->value.choice.GNB_DU_UE_F1AP_ID;
/* NRCGI
* TODO: process NRCGI
*/
......@@ -100,7 +86,7 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
AssertFatal(ie!=NULL,"RRCContainer is missing\n");
// create an ITTI message and copy SDU
if (RC.nrrrc[GNB_INSTANCE_TO_MODULE_ID(instance)]->node_type == ngran_gNB_CU) {
if (f1ap_req(true, instance)->cell_type==CELL_MACRO_GNB) {
message_p = itti_alloc_new_message (TASK_CU_F1, 0, NR_RRC_MAC_CCCH_DATA_IND);
memset (NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE);
ccch_sdu_len = ie->value.choice.RRCContainer.size;
......@@ -137,7 +123,7 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
// Find instance from nr_cellid
int rrc_inst = -1;
if (RC.nrrrc[GNB_INSTANCE_TO_MODULE_ID(instance)]->node_type == ngran_gNB_CU) {
if (f1ap_req(true, instance)->cell_type==CELL_MACRO_GNB) {
for (int i=0; i<RC.nb_nr_inst; i++) {
// first get RRC instance (note, no the ITTI instance)
gNB_RRC_INST *rrc = RC.nrrrc[i];
......@@ -160,7 +146,7 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
}
AssertFatal(rrc_inst>=0,"couldn't find an RRC instance for nr_cell %llu\n",(unsigned long long int)nr_cellid);
int f1ap_uid = f1ap_add_ue(&f1ap_cu_inst[rrc_inst], rrc_inst, CC_id, 0, rnti);
int f1ap_uid = f1ap_add_ue(true, rrc_inst, CC_id, 0, rnti);
if (f1ap_uid < 0 ) {
LOG_E(F1AP, "Failed to add UE \n");
......@@ -168,26 +154,14 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
return -1;
}
f1ap_cu_inst[rrc_inst].f1ap_ue[f1ap_uid].du_ue_f1ap_id = du_ue_f1ap_id;
if (RC.nrrrc[GNB_INSTANCE_TO_MODULE_ID(instance)]->node_type == ngran_gNB_CU) {
//getCxt(true,ITTI_MSG_DESTINATION_ID(message_p))->f1ap_ue[f1ap_uid].du_ue_f1ap_id = du_ue_f1ap_id;
NR_RRC_MAC_CCCH_DATA_IND (message_p).frame = 0;
NR_RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = 0;
NR_RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = ccch_sdu_len;
NR_RRC_MAC_CCCH_DATA_IND (message_p).gnb_index = rrc_inst; // CU instance
NR_RRC_MAC_CCCH_DATA_IND (message_p).rnti = rnti;
NR_RRC_MAC_CCCH_DATA_IND (message_p).CC_id = CC_id;
itti_send_msg_to_task (TASK_RRC_GNB, instance, message_p);
} else {
RRC_MAC_CCCH_DATA_IND (message_p).frame = 0;
RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = 0;
RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = ccch_sdu_len;
RRC_MAC_CCCH_DATA_IND (message_p).enb_index = rrc_inst; // CU instance
RRC_MAC_CCCH_DATA_IND (message_p).rnti = rnti;
RRC_MAC_CCCH_DATA_IND (message_p).CC_id = CC_id;
itti_send_msg_to_task (TASK_RRC_ENB, instance, message_p);
}
itti_send_msg_to_task (f1ap_req(true,ITTI_MSG_DESTINATION_ID(message_p))->cell_type==CELL_MACRO_GNB?TASK_RRC_GNB:TASK_RRC_ENB, instance, message_p);
return 0;
}
......@@ -218,7 +192,7 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
ie1->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
ie1->criticality = F1AP_Criticality_reject;
ie1->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_GNB_CU_UE_F1AP_ID;
ie1->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(&f1ap_cu_inst[instance], f1ap_dl_rrc->rnti);
ie1->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(true, instance, f1ap_dl_rrc->rnti);
LOG_I(F1AP, "Setting GNB_CU_UE_F1AP_ID %llu associated with UE RNTI %x (instance %ld)\n",
(unsigned long long int)ie1->value.choice.GNB_CU_UE_F1AP_ID, f1ap_dl_rrc->rnti, instance);
/* mandatory */
......@@ -227,7 +201,7 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
ie2->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
ie2->criticality = F1AP_Criticality_reject;
ie2->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID;
ie2->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(&f1ap_cu_inst[instance], f1ap_dl_rrc->rnti);
ie2->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(true, instance, f1ap_dl_rrc->rnti);
LOG_I(F1AP, "GNB_DU_UE_F1AP_ID %llu associated with UE RNTI %x \n", (unsigned long long int)ie2->value.choice.GNB_DU_UE_F1AP_ID, f1ap_dl_rrc->rnti);
/* optional */
/* c3. oldgNB_DU_UE_F1AP_ID */
......@@ -294,7 +268,7 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
return -1;
}
cu_f1ap_itti_send_sctp_data_req(instance, f1ap_assoc_id /* BK: fix me*/, buffer, len, 0 /* BK: fix me*/);
f1ap_itti_send_sctp_data_req(true, instance, buffer, len, 0 /* BK: fix me*/);
return 0;
}
......@@ -326,13 +300,13 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true);
cu_ue_f1ap_id = ie->value.choice.GNB_CU_UE_F1AP_ID;
LOG_D(F1AP, "cu_ue_f1ap_id %lu associated with RNTI %x\n",
cu_ue_f1ap_id, f1ap_get_rnti_by_cu_id(&f1ap_cu_inst[instance], cu_ue_f1ap_id));
cu_ue_f1ap_id, f1ap_get_rnti_by_cu_id(true, instance, cu_ue_f1ap_id));
/* GNB_DU_UE_F1AP_ID */
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_ULRRCMessageTransferIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true);
du_ue_f1ap_id = ie->value.choice.GNB_DU_UE_F1AP_ID;
LOG_D(F1AP, "du_ue_f1ap_id %lu associated with RNTI %x\n",
du_ue_f1ap_id, f1ap_get_rnti_by_cu_id(&f1ap_cu_inst[instance], du_ue_f1ap_id));
du_ue_f1ap_id, f1ap_get_rnti_by_cu_id(true, instance, du_ue_f1ap_id));
/* mandatory */
/* SRBID */
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_ULRRCMessageTransferIEs_t, ie, container,
......@@ -362,7 +336,7 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
ie->value.choice.RRCContainer.size);
RRC_DCCH_DATA_IND (message_p).dcch_index = srb_id;
RRC_DCCH_DATA_IND (message_p).rnti = f1ap_get_rnti_by_cu_id(&f1ap_cu_inst[instance], cu_ue_f1ap_id);
RRC_DCCH_DATA_IND (message_p).rnti = f1ap_get_rnti_by_cu_id(true, instance, cu_ue_f1ap_id);
RRC_DCCH_DATA_IND (message_p).module_id = instance;
RRC_DCCH_DATA_IND (message_p).eNB_index = instance; // not needed for CU
......@@ -371,7 +345,7 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
protocol_ctxt_t ctxt;
ctxt.module_id = instance;
ctxt.instance = instance;
ctxt.rnti = f1ap_get_rnti_by_cu_id(&f1ap_cu_inst[instance], cu_ue_f1ap_id);
ctxt.rnti = f1ap_get_rnti_by_cu_id(true, instance, cu_ue_f1ap_id);
ctxt.enb_flag = 1;
ctxt.eNB_index = 0;
ctxt.configured = 1;
......
......@@ -38,13 +38,14 @@
#include "f1ap_cu_task.h"
#include "proto_agent.h"
extern RAN_CONTEXT_t RC;
extern uint8_t proto_agent_flag;
f1ap_setup_req_t *f1ap_du_data_from_du;
f1ap_cudu_inst_t f1ap_cu_inst[MAX_eNB];
void cu_task_handle_sctp_association_ind(instance_t instance, sctp_new_association_ind_t *sctp_new_association_ind) {
createF1inst(true, instance, NULL);
// save the assoc id
f1ap_setup_req_t *f1ap_du_data=f1ap_req(true, instance);
f1ap_du_data->assoc_id = sctp_new_association_ind->assoc_id;
f1ap_du_data->sctp_in_streams = sctp_new_association_ind->in_streams;
f1ap_du_data->sctp_out_streams = sctp_new_association_ind->out_streams;
f1ap_du_data->default_sctp_stream_id = 0;
// Nothing
}
......@@ -56,20 +57,12 @@ void cu_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat
sctp_new_association_resp->sctp_state,
instance,
sctp_new_association_resp->ulp_cnx_id);
if (sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN)
proto_agent_stop(instance);
//if (sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN)
//proto_agent_stop(instance);
//f1ap_handle_setup_message(instance, sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN);
return; // exit -1 for debugging
}
// go to an init func
f1ap_du_data_from_du = (f1ap_setup_req_t *)calloc(1, sizeof(f1ap_setup_req_t));
// save the assoc id
f1ap_du_data_from_du->assoc_id = sctp_new_association_resp->assoc_id;
f1ap_du_data_from_du->sctp_in_streams = sctp_new_association_resp->in_streams;
f1ap_du_data_from_du->sctp_out_streams = sctp_new_association_resp->out_streams;
/* setup parameters for F1U and start the server */
const cudu_params_t params = {
.local_ipv4_address = RC.nrrrc[instance]->eth_params_s.my_addr,
......@@ -77,9 +70,8 @@ void cu_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat
.remote_ipv4_address = RC.nrrrc[instance]->eth_params_s.remote_addr,
.remote_port = RC.nrrrc[instance]->eth_params_s.remote_portd
};
AssertFatal(proto_agent_start(instance, &params) == 0,
"could not start PROTO_AGENT for F1U on instance %ld!\n", instance);
proto_agent_flag = 1;
//AssertFatal(proto_agent_start(instance, &params) == 0,
// "could not start PROTO_AGENT for F1U on instance %ld!\n", instance);
}
void cu_task_handle_sctp_data_ind(instance_t instance, sctp_data_ind_t *sctp_data_ind) {
......@@ -120,7 +112,10 @@ void cu_task_send_sctp_init_req(instance_t enb_id) {
}
void *F1AP_CU_task(void *arg) {
void *
F1AP_CU_task(void *arg) {
MessageDef *received_msg = NULL;
int result;
LOG_I(F1AP, "Starting F1AP at CU\n");
......@@ -136,7 +131,7 @@ void *F1AP_CU_task(void *arg) {
case SCTP_NEW_ASSOCIATION_IND:
LOG_I(F1AP, "CU Task Received SCTP_NEW_ASSOCIATION_IND for instance %ld\n",
ITTI_MSG_DESTINATION_INSTANCE(received_msg));
cu_task_handle_sctp_association_ind(ITTI_MSG_DESTINATION_INSTANCE(received_msg),
cu_task_handle_sctp_association_ind(ITTI_MSG_ORIGIN_INSTANCE(received_msg),
&received_msg->ittiMsg.sctp_new_association_ind);
break;
......
......@@ -44,26 +44,24 @@
#include "rrc_eNB_GTPV1U.h"
#include "openair2/RRC/NR/rrc_gNB_NGAP.h"
extern f1ap_setup_req_t *f1ap_du_data_from_du;
extern f1ap_cudu_inst_t f1ap_cu_inst[MAX_eNB];
extern RAN_CONTEXT_t RC;
extern uint32_t f1ap_assoc_id;
static void setQos(F1AP_NonDynamic5QIDescriptor_t *toFill) {
asn1cCalloc(toFill,F1AP_NonDynamic5QIDescriptor_t, tmp);
/* fiveQI */
tmp->fiveQI = 1L;
/* OPTIONAL */
/* qoSPriorityLevel */
if (0) {
asn1cCallocOne(toFill->qoSPriorityLevel, long, 1L);
}
/* OPTIONAL */
/* averagingWindow */
if (0) {
asn1cCallocOne(toFill->averagingWindow,
F1AP_AveragingWindow_t, 1L);
}
/* OPTIONAL */
/* maxDataBurstVolume */
if (0) {
......@@ -110,8 +108,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance,
ie3->criticality = F1AP_Criticality_reject;
ie3->value.present = F1AP_UEContextSetupRequestIEs__value_PR_NRCGI;
/* - nRCGI */
addnRCGI(ie3->value.choice.NRCGI, f1ap_du_data_from_du->cell);
addnRCGI(ie3->value.choice.NRCGI, f1ap_ue_context_setup_req);
/* mandatory */
/* c4. ServCellIndex */
asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupRequestIEs_t, ie4);
......@@ -624,7 +621,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance,
// return -1;
// }
LOG_D(F1AP,"F1AP UEContextSetupRequest Encoded %u bits\n", len);
cu_f1ap_itti_send_sctp_data_req(instance, f1ap_assoc_id /* BK: fix me*/, buffer, len, 0 /* BK: fix me*/);
f1ap_itti_send_sctp_data_req(true, instance, buffer, len, 0 /* BK: fix me*/);
return 0;
}
......@@ -679,12 +676,12 @@ int CU_handle_UE_CONTEXT_RELEASE_REQUEST(instance_t instance,
/* GNB_CU_UE_F1AP_ID */
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseRequestIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true);
const rnti_t rnti = f1ap_get_rnti_by_cu_id(&f1ap_cu_inst[instance],
const rnti_t rnti = f1ap_get_rnti_by_cu_id(true, instance,
ie->value.choice.GNB_CU_UE_F1AP_ID);
/* GNB_DU_UE_F1AP_ID */
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseRequestIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true);
const rnti_t rnti2 = f1ap_get_rnti_by_du_id(&f1ap_cu_inst[instance],
const rnti_t rnti2 = f1ap_get_rnti_by_du_id(true, instance,
ie->value.choice.GNB_DU_UE_F1AP_ID);
AssertFatal(rnti == rnti2, "RNTI obtained through DU ID (%x) is different from CU ID (%x)\n",
rnti2, rnti);
......@@ -713,6 +710,10 @@ int CU_handle_UE_CONTEXT_RELEASE_REQUEST(instance_t instance,
}
*/
LOG_I(F1AP, "Received UE CONTEXT RELEASE REQUEST: Trigger RRC for RNTI %x\n", rnti);
if (f1ap_req(true, instance)->cell_type==CELL_MACRO_GNB) {
AssertFatal(false,"must be devlopped\n");
} else {
struct rrc_eNB_ue_context_s *ue_context_pP;
ue_context_pP = rrc_eNB_get_ue_context(RC.rrc[instance], rnti);
rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_REQ(
......@@ -720,6 +721,8 @@ int CU_handle_UE_CONTEXT_RELEASE_REQUEST(instance_t instance,
ue_context_pP,
S1AP_CAUSE_RADIO_NETWORK,
21); // send cause 21: connection with ue lost
}
return 0;
}
......@@ -744,14 +747,14 @@ int CU_send_UE_CONTEXT_RELEASE_COMMAND(instance_t instance,
ie1->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
ie1->criticality = F1AP_Criticality_reject;
ie1->value.present = F1AP_UEContextReleaseCommandIEs__value_PR_GNB_CU_UE_F1AP_ID;
ie1->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(&f1ap_cu_inst[instance], cmd->rnti);
ie1->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(true, instance, cmd->rnti);
/* mandatory */
/* c2. GNB_DU_UE_F1AP_ID */
asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextReleaseCommandIEs_t, ie2);
ie2->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
ie2->criticality = F1AP_Criticality_reject;
ie2->value.present = F1AP_UEContextReleaseCommandIEs__value_PR_GNB_DU_UE_F1AP_ID;
ie2->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(&f1ap_cu_inst[instance], cmd->rnti);
ie2->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(true, instance, cmd->rnti);
/* mandatory */
/* c3. Cause */
asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextReleaseCommandIEs_t, ie3);
......@@ -801,7 +804,7 @@ int CU_send_UE_CONTEXT_RELEASE_COMMAND(instance_t instance,
return -1;
}
cu_f1ap_itti_send_sctp_data_req(instance, f1ap_du_data_from_du->assoc_id, buffer, len, 0);
f1ap_itti_send_sctp_data_req(true, instance, buffer, len, 0);
return 0;
}
......@@ -816,12 +819,12 @@ int CU_handle_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance,
/* GNB_CU_UE_F1AP_ID */
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseCompleteIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true);
const rnti_t rnti = f1ap_get_rnti_by_cu_id(&f1ap_cu_inst[instance],
const rnti_t rnti = f1ap_get_rnti_by_cu_id(true, instance,
ie->value.choice.GNB_CU_UE_F1AP_ID);
/* GNB_DU_UE_F1AP_ID */
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseCompleteIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true);
const rnti_t rnti2 = f1ap_get_rnti_by_du_id(&f1ap_cu_inst[instance],
const rnti_t rnti2 = f1ap_get_rnti_by_du_id(true, instance,
ie->value.choice.GNB_DU_UE_F1AP_ID);
AssertFatal(rnti == rnti2, "RNTI obtained through DU ID (%x) is different from CU ID (%x)\n",
rnti2, rnti);
......@@ -841,7 +844,7 @@ int CU_handle_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance,
protocol_ctxt_t ctxt;
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, instance, ENB_FLAG_YES, rnti, 0, 0, instance);
if (RC.nrrrc[instance]->node_type == ngran_gNB_CU) {
if (f1ap_req(true, instance)->cell_type==CELL_MACRO_GNB) {
struct rrc_gNB_ue_context_s *ue_context_p =
rrc_gNB_get_ue_context(RC.nrrrc[instance], rnti);
......@@ -897,7 +900,7 @@ int CU_handle_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance,
instance, rnti, PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED);
LOG_I(F1AP, "Received UE CONTEXT RELEASE COMPLETE: Removing CU UE entry for RNTI %x\n", rnti);
f1ap_remove_ue(&f1ap_cu_inst[instance], rnti);
f1ap_remove_ue(true, instance, rnti);
return 0;
}
......@@ -909,7 +912,7 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance) {
uint8_t *buffer=NULL;
uint32_t len=0;
// for test
cellIDs_t hardCoded={ .mcc=208, .mnc=93, .mnc_digit_length=2};
cellIDs_t hardCoded= { .mcc=208, .mnc=93, .mnc_digit_length=2};
/* Create */
/* 0. Message Type */
pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage;
......
......@@ -38,11 +38,6 @@
#include "f1ap_du_task.h"
#include "proto_agent.h"
extern RAN_CONTEXT_t RC;
f1ap_setup_req_t *f1ap_du_data;
f1ap_cudu_inst_t f1ap_du_inst[MAX_eNB];
void du_task_send_sctp_association_req(instance_t instance, f1ap_setup_req_t *f1ap_setup_req) {
DevAssert(f1ap_setup_req != NULL);
MessageDef *message_p = NULL;
......@@ -62,9 +57,6 @@ void du_task_send_sctp_association_req(instance_t instance, f1ap_setup_req_t *f1
memcpy(&sctp_new_association_req_p->local_address,
&f1ap_setup_req->DU_f1_ip_address,
sizeof(f1ap_setup_req->DU_f1_ip_address));
// store data
f1ap_du_data = (f1ap_setup_req_t *)calloc(1, sizeof(f1ap_setup_req_t));
*f1ap_du_data = *f1ap_setup_req;
//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
......@@ -84,6 +76,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_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;
......@@ -131,13 +124,14 @@ void *F1AP_DU_task(void *arg) {
// 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. send a sctp_association req
createF1inst(false, ITTI_MSG_DESTINATION_INSTANCE(received_msg), &F1AP_SETUP_REQ(received_msg));
LOG_I(F1AP, "DU Task Received F1AP_SETUP_REQ\n");
du_task_send_sctp_association_req(ITTI_MSG_DESTINATION_INSTANCE(received_msg),
&F1AP_SETUP_REQ(received_msg));
break;
case F1AP_GNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE:
DU_send_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(ITTI_MSG_DESTINATION_INSTANCE(received_msg),
DU_send_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(ITTI_MSG_ORIGIN_INSTANCE(received_msg),
&F1AP_GNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(received_msg));
break;
......
......@@ -41,10 +41,6 @@
#include "openair2/RRC/NR/rrc_gNB_UE_context.h"
#include "openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h"
extern f1ap_setup_req_t *f1ap_du_data;
extern f1ap_cudu_inst_t f1ap_du_inst[MAX_eNB];
extern RAN_CONTEXT_t RC;
int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance,
uint32_t assoc_id,
uint32_t stream,
......@@ -183,7 +179,7 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance,
//void DU_send_UE_CONTEXT_SETUP_RESPONSE(F1AP_UEContextSetupResponse_t *UEContextSetupResponse) {
int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance) {
F1AP_F1AP_PDU_t pdu={0};
F1AP_F1AP_PDU_t pdu= {0};
F1AP_UEContextSetupResponse_t *out;
uint8_t *buffer=NULL;
uint32_t len=0;
......@@ -234,7 +230,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance) {
if (0) {
asn1cCalloc(ie3->value.choice.DUtoCURRCInformation.requestedP_MaxFR1,
OCTET_STRING_t, tmp);
OCTET_STRING_fromBuf(tmp , "asdsa", strlen("asdsa"));
OCTET_STRING_fromBuf(tmp, "asdsa", strlen("asdsa"));
}
}
......@@ -310,7 +306,6 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance) {
OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "1204",
strlen("1204"));
} // for j
} // for i
/* mandatory */
......@@ -333,7 +328,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance) {
/* sRBID */
srbs_failedToBeSetup_item->sRBID = 13L;
/* cause */
asn1cCalloc(srbs_failedToBeSetup_item->cause, F1AP_Cause_t ,tmp);
asn1cCalloc(srbs_failedToBeSetup_item->cause, F1AP_Cause_t,tmp);
// dummy value
tmp->present = F1AP_Cause_PR_radioNetwork;
......@@ -358,7 +353,6 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance) {
default:
break;
} // switch
} // for i
/* */
......@@ -406,7 +400,6 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance) {
default:
break;
} // switch
} // for i
// /* */
......@@ -423,10 +416,10 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance) {
sCell_FailedtoSetup_item_ies->criticality = F1AP_Criticality_ignore;
sCell_FailedtoSetup_item_ies->value.present = F1AP_SCell_FailedtoSetup_ItemIEs__value_PR_SCell_FailedtoSetup_Item;
/* 10.1 DRBs_Setup_Item */
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_ID */
addnRCGI(sCell_FailedtoSetup_item->sCell_ID,f1ap_du_data->cell+i);
addnRCGI(sCell_FailedtoSetup_item->sCell_ID,f1ap_req(false, instance)->cell+i);
/* cause */
asn1cCalloc(sCell_FailedtoSetup_item->cause, F1AP_Cause_t, tmp);
// dummy value
......@@ -453,10 +446,8 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance) {
default:
break;
} // switch
} // for i
/* Optional */
/* c11. InactivityMonitoringResponse */
if (0) {
......@@ -518,15 +509,14 @@ int DU_send_UE_CONTEXT_RELEASE_REQUEST(instance_t instance,
ie1->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
ie1->criticality = F1AP_Criticality_reject;
ie1->value.present = F1AP_UEContextReleaseRequestIEs__value_PR_GNB_CU_UE_F1AP_ID;
ie1->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(&f1ap_du_inst[instance], req->rnti);
ie1->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(false, instance, req->rnti);
/* mandatory */
/* c2. GNB_DU_UE_F1AP_ID */
asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextReleaseRequestIEs_t, ie2);
ie2->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
ie2->criticality = F1AP_Criticality_reject;
ie2->value.present = F1AP_UEContextReleaseRequestIEs__value_PR_GNB_DU_UE_F1AP_ID;
ie2->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(&f1ap_du_inst[instance], req->rnti);
ie2->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(false, instance, req->rnti);
/* mandatory */
/* c3. Cause */
asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextReleaseRequestIEs_t, ie3);
......@@ -567,11 +557,10 @@ int DU_send_UE_CONTEXT_RELEASE_REQUEST(instance_t instance,
return -1;
}
du_f1ap_itti_send_sctp_data_req(instance,
f1ap_du_data->assoc_id,
f1ap_itti_send_sctp_data_req(false, instance,
buffer,
len,
f1ap_du_data->default_sctp_stream_id);
getCxt(false, instance)->default_sctp_stream_id);
return 0;
}
......@@ -588,14 +577,14 @@ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance,
/* GNB_CU_UE_F1AP_ID */
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseCommandIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true);
ctxt.rnti = f1ap_get_rnti_by_cu_id(&f1ap_du_inst[instance], ie->value.choice.GNB_CU_UE_F1AP_ID);
ctxt.rnti = f1ap_get_rnti_by_cu_id(false, instance, ie->value.choice.GNB_CU_UE_F1AP_ID);
ctxt.module_id = instance;
ctxt.instance = instance;
ctxt.enb_flag = 1;
/* GNB_DU_UE_F1AP_ID */
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseCommandIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true);
const rnti_t rnti = f1ap_get_rnti_by_du_id(&f1ap_du_inst[instance],
const rnti_t rnti = f1ap_get_rnti_by_du_id(false, instance,
ie->value.choice.GNB_DU_UE_F1AP_ID);
AssertFatal(ctxt.rnti == rnti,
"RNTI obtained through DU ID (%x) is different from CU ID (%x)\n",
......@@ -720,7 +709,7 @@ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance,
int DU_send_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance,
f1ap_ue_context_release_cplt_t *cplt) {
F1AP_F1AP_PDU_t pdu={0};
F1AP_F1AP_PDU_t pdu= {0};
F1AP_UEContextReleaseComplete_t *out;
/* Create */
/* 0. Message Type */
......@@ -736,14 +725,14 @@ int DU_send_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance,
ie1->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
ie1->criticality = F1AP_Criticality_reject;
ie1->value.present = F1AP_UEContextReleaseCompleteIEs__value_PR_GNB_CU_UE_F1AP_ID;
ie1->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(&f1ap_du_inst[instance], cplt->rnti);
ie1->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(false, instance, cplt->rnti);
/* mandatory */
/* c2. GNB_DU_UE_F1AP_ID */
asn1cSequenceAdd(out->protocolIEs.list,F1AP_UEContextReleaseCompleteIEs_t, ie2);
ie2->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
ie2->criticality = F1AP_Criticality_reject;
ie2->value.present = F1AP_UEContextReleaseCompleteIEs__value_PR_GNB_DU_UE_F1AP_ID;
ie2->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(&f1ap_du_inst[instance], cplt->rnti);
ie2->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(false, instance, cplt->rnti);
/* optional -> currently not used */
/* c3. CriticalityDiagnostics */
//if (0) {
......@@ -801,12 +790,11 @@ int DU_send_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance,
return -1;
}
du_f1ap_itti_send_sctp_data_req(instance,
f1ap_du_data->assoc_id,
f1ap_itti_send_sctp_data_req(false, instance,
buffer,
len,
f1ap_du_data->default_sctp_stream_id);
f1ap_remove_ue(&f1ap_du_inst[instance], cplt->rnti);
getCxt(false, instance)->default_sctp_stream_id);
f1ap_remove_ue(false, instance, cplt->rnti);
return 0;
}
......@@ -1011,7 +999,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance) {
/* 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_du_data->cell[i]);
addnRCGI(scell_failedtoSetupMod_item->sCell_ID, &f1ap_req(false, instance)->cell[i]);
asn1cCalloc(scell_failedtoSetupMod_item->cause, F1AP_Cause_t, tmp);
tmp->present = F1AP_Cause_PR_radioNetwork;
tmp->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnb_du_ue_f1ap_id;
......@@ -1096,7 +1084,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance) {
return -1;
}
//du_f1ap_itti_send_sctp_data_req(instance, f1ap_setup_req->assoc_id, buffer, len, 0);
//f1ap_itti_send_sctp_data_req(false, instance, buffer, len, 0);
return 0;
}
......
......@@ -40,8 +40,6 @@
#include "f1ap_cu_ue_context_management.h"
#include "f1ap_du_ue_context_management.h"
extern f1ap_setup_req_t *f1ap_du_data_from_du;
/* Handlers matrix. Only f1 related procedure present here */
f1ap_message_decoded_callback f1ap_messages_callback[][3] = {
......
......@@ -22,26 +22,13 @@
#include "f1ap_common.h"
#include "f1ap_itti_messaging.h"
void cu_f1ap_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer,
void f1ap_itti_send_sctp_data_req(bool isCu, instance_t instance, uint8_t *buffer,
uint32_t buffer_length, uint16_t stream) {
MessageDef *message_p;
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(isCu?TASK_CU_F1:TASK_DU_F1, 0, SCTP_DATA_REQ);
sctp_data_req = &message_p->ittiMsg.sctp_data_req;
sctp_data_req->assoc_id = assoc_id;
sctp_data_req->buffer = buffer;
sctp_data_req->buffer_length = buffer_length;
sctp_data_req->stream = stream;
itti_send_msg_to_task(TASK_SCTP, instance, message_p);
}
void du_f1ap_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer,
uint32_t buffer_length, uint16_t stream) {
MessageDef *message_p;
sctp_data_req_t *sctp_data_req;
message_p = itti_alloc_new_message(TASK_DU_F1, 0, SCTP_DATA_REQ);
sctp_data_req = &message_p->ittiMsg.sctp_data_req;
sctp_data_req->assoc_id = assoc_id;
sctp_data_req->assoc_id = f1ap_assoc_id(isCu,instance);
sctp_data_req->buffer = buffer;
sctp_data_req->buffer_length = buffer_length;
sctp_data_req->stream = stream;
......@@ -49,12 +36,12 @@ void du_f1ap_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint
itti_send_msg_to_task(TASK_SCTP, instance, message_p);
}
void f1ap_itti_send_sctp_close_association(instance_t instance, int32_t assoc_id) {
void f1ap_itti_send_sctp_close_association(bool isCu, 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 = assoc_id;
sctp_close_association_p->assoc_id = f1ap_assoc_id(isCu,instance);
itti_send_msg_to_task(TASK_SCTP, instance, message_p);
}
......@@ -22,14 +22,10 @@
#ifndef F1AP_ITTI_MESSAGING_H_
#define F1AP_ITTI_MESSAGING_H_
void cu_f1ap_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer,
void f1ap_itti_send_sctp_data_req(bool isCu,instance_t instance, uint8_t *buffer,
uint32_t buffer_length, uint16_t stream);
void du_f1ap_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer,
uint32_t buffer_length, uint16_t stream);
void f1ap_eNB_itti_send_sctp_close_association(instance_t instance,
int32_t assoc_id);
void f1ap_eNB_itti_send_sctp_close_association(bool isCu,instance_t instance);
#endif /* F1AP_ITTI_MESSAGING_H_ */
......@@ -1646,6 +1646,7 @@ int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) {
AssertFatal(GNBParamList.paramarray[i][GNB_GNB_ID_IDX].uptr != NULL,
"gNB id %u is not defined in configuration file\n",i);
F1AP_SETUP_REQ (msg_p).num_cells_available = 0;
F1AP_SETUP_REQ (msg_p).cell_type=CELL_MACRO_GNB;
for (k=0; k <num_gnbs ; k++) {
if (strcmp(GNBSParams[GNB_ACTIVE_GNBS_IDX].strlistptr[k], *(GNBParamList.paramarray[i][GNB_GNB_NAME_IDX].strptr)) == 0) {
......
......@@ -55,7 +55,6 @@ static uint64_t pdcp_optmask;
ngran_node_t node_type = ngran_gNB;
uint8_t first_dcch = 0;
uint8_t proto_agent_flag = 0;
/****************************************************************************/
/* rlc_data_req queue - begin */
......
......@@ -183,7 +183,6 @@ eth_params_t *eth_params;
double cpuf;
int oaisim_flag=0;
uint8_t proto_agent_flag = 0;
/* forward declarations */
......
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