From 32c682a7d0c03f915f319ab6cb34e105f2d80fb2 Mon Sep 17 00:00:00 2001 From: Raymond Knopp Date: Tue, 22 Jun 2021 15:36:18 +0200 Subject: [PATCH 001/110] Preliminary work for integration of F1AP UE Context Setup Request/Response - Encoding of UE Context Setup Request is failing. Problem seems to be with SST encoding --- openair2/COMMON/f1ap_messages_types.h | 2 +- openair2/F1AP/f1ap_cu_ue_context_management.c | 43 +++++++++++-------- openair2/RRC/NR/rrc_gNB.c | 27 +++++++++++- 3 files changed, 53 insertions(+), 19 deletions(-) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index ecfde8d38b..42914e61ab 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -316,7 +316,7 @@ typedef struct f1ap_up_tnl_s { } f1ap_up_tnl_t; typedef struct f1ap_drb_to_be_setup_s { - uint8_t drb_id; + long drb_id; f1ap_up_tnl_t up_ul_tnl[2]; uint8_t up_ul_tnl_length; rlc_mode_t rlc_mode; diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 54c61ad5bf..1f77c6a06c 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -98,11 +98,11 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* - nRCGI */ F1AP_NRCGI_t nRCGI; memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t)); - MCC_MNC_TO_PLMNID(f1ap_ue_context_setup_req->mcc, - f1ap_ue_context_setup_req->mnc, - f1ap_ue_context_setup_req->mnc_digit_length, + MCC_MNC_TO_PLMNID(f1ap_du_data_from_du->mcc[0],//f1ap_ue_context_setup_req->mcc, + f1ap_du_data_from_du->mnc[0],//f1ap_ue_context_setup_req->mnc, + f1ap_du_data_from_du->mnc_digit_length[0],//f1ap_ue_context_setup_req->mnc_digit_length, &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(f1ap_ue_context_setup_req->nr_cellid, &nRCGI.nRCellIdentity); + NR_CELL_ID_TO_BIT_STRING(f1ap_du_data_from_du->nr_cellid[0], &nRCGI.nRCellIdentity); ie->value.choice.NRCGI = nRCGI; @@ -134,7 +134,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, ie->id = F1AP_ProtocolIE_ID_id_CUtoDURRCInformation; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_CUtoDURRCInformation; - + /* optional */ /* 6.1 cG_ConfigInfo */ ie->value.choice.CUtoDURRCInformation.cG_ConfigInfo = (F1AP_CG_ConfigInfo_t *)calloc(1, sizeof(F1AP_CG_ConfigInfo_t)); @@ -153,9 +153,10 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); -if (0) { +//if (0) { /* mandatory */ /* c7. Candidate_SpCell_List */ + if (0) { ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); ie->id = F1AP_ProtocolIE_ID_id_Candidate_SpCell_List; //90 ie->criticality = F1AP_Criticality_ignore; @@ -192,6 +193,7 @@ if (0) { candidate_spCell_item_ies); } ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } /* optional */ /* c8. DRXCycle */ @@ -240,6 +242,7 @@ if (0) { /* mandatory */ /* c10. SCell_ToBeSetup_List */ + if(0){ ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); ie->id = F1AP_ProtocolIE_ID_id_SCell_ToBeSetup_List; ie->criticality = F1AP_Criticality_ignore; @@ -286,6 +289,7 @@ if (0) { scell_toBeSetup_item_ies); } ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } /* mandatory */ @@ -296,7 +300,7 @@ if (0) { ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_SRBs_ToBeSetup_List; for (i=0; - i<0; + i<1; i++) { // F1AP_SRBs_ToBeSetup_ItemIEs_t *srbs_toBeSetup_item_ies; @@ -314,10 +318,11 @@ if (0) { /* OPTIONAL */ /* 11.1.2 duplicationIndication */ - if (0) { + + //if (0) { srbs_toBeSetup_item.duplicationIndication = (F1AP_DuplicationIndication_t *)calloc(1, sizeof(F1AP_DuplicationIndication_t)); srbs_toBeSetup_item.duplicationIndication = F1AP_DuplicationIndication_true; // enum - } + //} /* ADD */ srbs_toBeSetup_item_ies->value.choice.SRBs_ToBeSetup_Item = srbs_toBeSetup_item; @@ -333,6 +338,7 @@ if (0) { ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_DRBs_ToBeSetup_List; + LOG_I(F1AP, "Length of drbs_to_be_setup: %d \n", f1ap_ue_context_setup_req->drbs_to_be_setup_length); for (i = 0; i < f1ap_ue_context_setup_req->drbs_to_be_setup_length; i++) { // F1AP_DRBs_ToBeSetup_ItemIEs_t *drbs_toBeSetup_item_ies; @@ -349,7 +355,7 @@ if (0) { drbs_toBeSetup_item.dRBID = f1ap_ue_context_setup_req->drbs_to_be_setup[i].drb_id; // 9 /* 12.1.2 qoSInformation */ - int some_decide_qos = 1; // BK: Need Check + int some_decide_qos = 0; // BK: Need Check if (some_decide_qos) { drbs_toBeSetup_item.qoSInformation.present = F1AP_QoSInformation_PR_eUTRANQoS; @@ -710,7 +716,7 @@ if (0) { } ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); -} +//} /* OPTIONAL */ /* InactivityMonitoringRequest */ if (0) { @@ -743,13 +749,15 @@ if (0) { /* OPTIONAL */ /* RRCContainer */ - ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_RRCContainer; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_RRCContainer; - OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, (const char*)f1ap_ue_context_setup_req->rrc_container, + if(f1ap_ue_context_setup_req->rrc_container_length > 0){ + ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); + ie->id = F1AP_ProtocolIE_ID_id_RRCContainer; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_RRCContainer; + OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, (const char*)f1ap_ue_context_setup_req->rrc_container, f1ap_ue_context_setup_req->rrc_container_length); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } /* OPTIONAL */ /* MaskedIMEISV */ @@ -762,6 +770,7 @@ if (0) { ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } + //xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, &pdu); //(void *)pdu /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { LOG_E(F1AP, "Failed to encode F1 UE CONTEXT SETUP REQUEST\n"); diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 4cd79cb134..5fa96409ad 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -1280,7 +1280,7 @@ rrc_gNB_process_RRCReconfigurationComplete( NR_SRB_ToAddModList_t *SRB_configList = ue_context_pP->ue_context.SRB_configList2[xid]; NR_DRB_ToReleaseList_t *DRB_Release_configList2 = ue_context_pP->ue_context.DRB_Release_configList2[xid]; NR_DRB_Identity_t *drb_id_p = NULL; -// uint8_t nr_DRB2LCHAN[8]; + // uint8_t nr_DRB2LCHAN[8]; gNB_RRC_INST *rrc = RC.nrrrc[ctxt_pP->module_id]; ue_context_pP->ue_context.ue_reestablishment_timer = 0; @@ -1340,6 +1340,31 @@ rrc_gNB_process_RRCReconfigurationComplete( ue_context_pP->ue_context.masterCellGroup->rlc_BearerToAddModList, NULL); } + else { + /*gtpv1u_gnb_create_tunnel_req_t create_tunnel_req; + gtpv1u_gnb_create_tunnel_resp_t create_tunnel_resp; + memset(&create_tunnel_req, 0, sizeof(gtpv1u_gnb_create_tunnel_req_t)); + create_tunnel_req.upf_NGu_teid[0] = 1;*/ + if(DRB_configList!=NULL){ + MessageDef *message_p; + message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_UE_CONTEXT_SETUP_REQ); + F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup = malloc(DRB_configList->list.count*sizeof(f1ap_drb_to_be_setup_t)); + F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup_length = DRB_configList->list.count; + LOG_I(RRC, "Length of DRB list:%d, %d \n", DRB_configList->list.count, F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup_length); + for (int i = 0; i < DRB_configList->list.count; i++){ + F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].drb_id = DRB_configList->list.array[i]->drb_Identity; + F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].rlc_mode = RLC_MODE_AM; + F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].up_ul_tnl[0].gtp_teid = 1; + memcpy(&F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].up_ul_tnl[0].tl_address,rrc->eth_params_s.my_addr,4); + F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].up_ul_tnl_length = 1; + } + F1AP_UE_CONTEXT_SETUP_REQ (message_p).gNB_CU_ue_id = 0; + F1AP_UE_CONTEXT_SETUP_REQ (message_p).gNB_DU_ue_id = 0; + F1AP_UE_CONTEXT_SETUP_REQ (message_p).rnti = ue_context_pP->ue_context.rnti; + itti_send_msg_to_task (TASK_CU_F1, ctxt_pP->module_id, message_p); + LOG_I(RRC, "Send F1AP_UE_CONTEXT_SETUP_REQ with ITTI\n"); + } + } #endif /* Set the SRB active in UE context */ From 42ea1f8261b293a1db352c29bfb73b076d234c6b Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Sun, 27 Jun 2021 21:51:04 +0200 Subject: [PATCH 002/110] fix F1 setup messages memory error --- openair2/F1AP/f1ap_cu_interface_management.c | 443 +++--- openair2/F1AP/f1ap_du_interface_management.c | 1375 ++++++++---------- openair3/SCTP/sctp_eNB_task.c | 21 +- 3 files changed, 786 insertions(+), 1053 deletions(-) diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index 88d0a8ec59..51986ac0f5 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -39,21 +39,24 @@ extern f1ap_setup_req_t *f1ap_du_data_from_du; extern RAN_CONTEXT_t RC; +#define asn1cCalloc(VaR, TyPe, lOcPtr) TyPe *lOcPtr=VaR=(TyPe*) calloc(1,sizeof(TyPe)); +#define asn1cSequenceAdd(VaR, TyPe, lOcPtr) TyPe *lOcPtr=(TyPe*) calloc(1,sizeof(TyPe)); ASN_SEQUENCE_ADD(&VaR,lOcPtr); + int CU_send_RESET(instance_t instance, F1AP_Reset_t *Reset) { AssertFatal(1==0,"Not implemented yet\n"); } int CU_handle_RESET_ACKKNOWLEDGE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { AssertFatal(1==0,"Not implemented yet\n"); } int CU_handle_RESET(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { AssertFatal(1==0,"Not implemented yet\n"); } @@ -66,9 +69,9 @@ int CU_send_RESET_ACKNOWLEDGE(instance_t instance, F1AP_ResetAcknowledge_t *Rese Error Indication */ int CU_handle_ERROR_INDICATION(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { AssertFatal(1==0,"Not implemented yet\n"); } @@ -83,77 +86,65 @@ int CU_send_ERROR_INDICATION(instance_t instance, F1AP_ErrorIndication_t *ErrorI int CU_handle_F1_SETUP_REQUEST(instance_t instance, uint32_t assoc_id, uint32_t stream, - F1AP_F1AP_PDU_t *pdu) -{ + F1AP_F1AP_PDU_t *pdu) { LOG_D(F1AP, "CU_handle_F1_SETUP_REQUEST\n"); - MessageDef *message_p; F1AP_F1SetupRequest_t *container; F1AP_F1SetupRequestIEs_t *ie; int i = 0; - - DevAssert(pdu != NULL); - container = &pdu->choice.initiatingMessage->value.choice.F1SetupRequest; /* F1 Setup Request == Non UE-related procedure -> stream 0 */ if (stream != 0) { LOG_W(F1AP, "[SCTP %d] Received f1 setup request on stream != 0 (%d)\n", - assoc_id, stream); + assoc_id, stream); } message_p = itti_alloc_new_message(TASK_CU_F1, 0, F1AP_SETUP_REQ); - /* assoc_id */ F1AP_SETUP_REQ(message_p).assoc_id = assoc_id; - /* gNB_DU_id */ // this function exits if the ie is mandatory F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupRequestIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_DU_ID, true); asn_INTEGER2ulong(&ie->value.choice.GNB_DU_ID, &F1AP_SETUP_REQ(message_p).gNB_DU_id); LOG_D(F1AP, "F1AP_SETUP_REQ(message_p).gNB_DU_id %lu \n", F1AP_SETUP_REQ(message_p).gNB_DU_id); - /* gNB_DU_name */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupRequestIEs_t, ie, container, - F1AP_ProtocolIE_ID_id_gNB_DU_Name, true); + F1AP_ProtocolIE_ID_id_gNB_DU_Name, true); F1AP_SETUP_REQ(message_p).gNB_DU_name = calloc(ie->value.choice.GNB_DU_Name.size + 1, sizeof(char)); memcpy(F1AP_SETUP_REQ(message_p).gNB_DU_name, ie->value.choice.GNB_DU_Name.buf, ie->value.choice.GNB_DU_Name.size); /* Convert the mme name to a printable string */ F1AP_SETUP_REQ(message_p).gNB_DU_name[ie->value.choice.GNB_DU_Name.size] = '\0'; LOG_D(F1AP, "F1AP_SETUP_REQ(message_p).gNB_DU_name %s \n", F1AP_SETUP_REQ(message_p).gNB_DU_name); - /* GNB_DU_Served_Cells_List */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupRequestIEs_t, ie, container, - F1AP_ProtocolIE_ID_id_gNB_DU_Served_Cells_List, true); + F1AP_ProtocolIE_ID_id_gNB_DU_Served_Cells_List, true); F1AP_SETUP_REQ(message_p).num_cells_available = ie->value.choice.GNB_DU_Served_Cells_List.list.count; LOG_D(F1AP, "F1AP_SETUP_REQ(message_p).num_cells_available %d \n", F1AP_SETUP_REQ(message_p).num_cells_available); - int num_cells_available = F1AP_SETUP_REQ(message_p).num_cells_available; for (i=0; ivalue.choice.GNB_DU_Served_Cells_List.list.array[i])->value.choice.GNB_DU_Served_Cells_Item); - + /* tac */ if (served_cells_item_p->served_Cell_Information.fiveGS_TAC) { OCTET_STRING_TO_INT16(served_cells_item_p->served_Cell_Information.fiveGS_TAC, F1AP_SETUP_REQ(message_p).tac[i]); LOG_D(F1AP, "F1AP_SETUP_REQ(message_p).tac[%d] %d \n", i, F1AP_SETUP_REQ(message_p).tac[i]); } + /* - nRCGI */ TBCD_TO_MCC_MNC(&(served_cells_item_p->served_Cell_Information.nRCGI.pLMN_Identity), F1AP_SETUP_REQ(message_p).mcc[i], F1AP_SETUP_REQ(message_p).mnc[i], F1AP_SETUP_REQ(message_p).mnc_digit_length[i]); - - // NR cellID BIT_STRING_TO_NR_CELL_IDENTITY(&served_cells_item_p->served_Cell_Information.nRCGI.nRCellIdentity, - F1AP_SETUP_REQ(message_p).nr_cellid[i]); + F1AP_SETUP_REQ(message_p).nr_cellid[i]); LOG_D(F1AP, "[SCTP %d] Received nRCGI: MCC %d, MNC %d, CELL_ID %llu\n", assoc_id, F1AP_SETUP_REQ(message_p).mcc[i], F1AP_SETUP_REQ(message_p).mnc[i], @@ -168,7 +159,6 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, F1AP_SETUP_REQ(message_p).nr_pci[i] = served_cells_item_p->served_Cell_Information.nRPCI; LOG_D(F1AP, "F1AP_SETUP_REQ(message_p).nr_pci[%d] %d \n", i, F1AP_SETUP_REQ(message_p).nr_pci[i]); - // System Information /* mib */ F1AP_SETUP_REQ(message_p).mib[i] = calloc(served_cells_item_p->gNB_DU_System_Information->mIB_message.size + 1, sizeof(char)); @@ -179,7 +169,6 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, F1AP_SETUP_REQ(message_p).mib_length[i] = served_cells_item_p->gNB_DU_System_Information->mIB_message.size; LOG_D(F1AP, "F1AP_SETUP_REQ(message_p).mib[%d] %s , len = %d \n", i, F1AP_SETUP_REQ(message_p).mib[i], F1AP_SETUP_REQ(message_p).mib_length[i]); - /* sib1 */ F1AP_SETUP_REQ(message_p).sib1[i] = calloc(served_cells_item_p->gNB_DU_System_Information->sIB1_message.size + 1, sizeof(char)); memcpy(F1AP_SETUP_REQ(message_p).sib1[i], served_cells_item_p->gNB_DU_System_Information->sIB1_message.buf, @@ -191,59 +180,48 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, i, F1AP_SETUP_REQ(message_p).sib1[i], F1AP_SETUP_REQ(message_p).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; - // union { // struct { // uint32_t ul_nr_arfcn; // uint8_t ul_scs; // uint8_t ul_nrb; - // uint32_t dl_nr_arfcn; // uint8_t dl_scs; // uint8_t dl_nrb; - // uint32_t sul_active; // uint32_t sul_nr_arfcn; // uint8_t sul_scs; // uint8_t sul_nrb; - // uint8_t num_frequency_bands; // uint16_t nr_band[32]; // uint8_t num_sul_frequency_bands; // uint16_t nr_sul_band[32]; // } fdd; // struct { - // uint32_t nr_arfcn; // uint8_t scs; // uint8_t nrb; - // uint32_t sul_active; // uint32_t sul_nr_arfcn; // uint8_t sul_scs; // uint8_t sul_nrb; - // uint8_t num_frequency_bands; // uint16_t nr_band[32]; // uint8_t num_sul_frequency_bands; // uint16_t nr_sul_band[32]; - // } tdd; // } nr_mode_info[F1AP_MAX_NB_CELLS]; - MSC_LOG_TX_MESSAGE( - MSC_F1AP_CU, - MSC_RRC_ENB, - 0, - 0, - MSC_AS_TIME_FMT" CU_handle_F1_SETUP_REQUEST", - 0,0//MSC_AS_TIME_ARGS(ctxt_pP), + MSC_F1AP_CU, + MSC_RRC_ENB, + 0, + 0, + MSC_AS_TIME_FMT" CU_handle_F1_SETUP_REQUEST", + 0,0//MSC_AS_TIME_ARGS(ctxt_pP), ); if (num_cells_available > 0) { @@ -254,34 +232,32 @@ 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; } + return 0; } int CU_send_F1_SETUP_RESPONSE(instance_t instance, - f1ap_setup_resp_t *f1ap_setup_resp) { - + f1ap_setup_resp_t *f1ap_setup_resp) { module_id_t enb_mod_idP; module_id_t cu_mod_idP; - // This should be fixed enb_mod_idP = (module_id_t)0; cu_mod_idP = (module_id_t)0; - F1AP_F1AP_PDU_t pdu; F1AP_F1SetupResponse_t *out; F1AP_F1SetupResponseIEs_t *ie; - uint8_t *buffer; uint32_t len; int i = 0; - /* Create */ /* 0. Message Type */ memset(&pdu, 0, sizeof(pdu)); @@ -291,7 +267,6 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance, pdu.choice.successfulOutcome->criticality = F1AP_Criticality_reject; pdu.choice.successfulOutcome->value.present = F1AP_SuccessfulOutcome__value_PR_F1SetupResponse; out = &pdu.choice.successfulOutcome->value.choice.F1SetupResponse; - /* mandatory */ /* c1. Transaction ID (integer value)*/ ie = (F1AP_F1SetupResponseIEs_t *)calloc(1, sizeof(F1AP_F1SetupResponseIEs_t)); @@ -300,7 +275,7 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance, ie->value.present = F1AP_F1SetupResponseIEs__value_PR_TransactionID; ie->value.choice.TransactionID = F1AP_get_next_transaction_identifier(enb_mod_idP, cu_mod_idP); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - + /* optional */ /* c2. GNB_CU_Name */ if (f1ap_setup_resp->gNB_CU_name != NULL) { @@ -317,91 +292,85 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance, /* c3. cells to be Activated list */ int num_cells_to_activate = f1ap_setup_resp->num_cells_to_activate; LOG_D(F1AP, "num_cells_to_activate = %d \n", num_cells_to_activate); + if (num_cells_to_activate >0) { ie = (F1AP_F1SetupResponseIEs_t *)calloc(1, sizeof(F1AP_F1SetupResponseIEs_t)); ie->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_F1SetupResponseIEs__value_PR_Cells_to_be_Activated_List; - - + for (i=0; - iid = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item; cells_to_be_activated_list_item_ies->criticality = F1AP_Criticality_reject; cells_to_be_activated_list_item_ies->value.present = F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item; - /* 3.1 cells to be Activated list item */ F1AP_Cells_to_be_Activated_List_Item_t cells_to_be_activated_list_item; memset((void *)&cells_to_be_activated_list_item, 0, sizeof(F1AP_Cells_to_be_Activated_List_Item_t)); - /* - nRCGI */ F1AP_NRCGI_t nRCGI; memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t)); MCC_MNC_TO_PLMNID(f1ap_setup_resp->cells_to_activate[i].mcc, f1ap_setup_resp->cells_to_activate[i].mnc, f1ap_setup_resp->cells_to_activate[i].mnc_digit_length, - &nRCGI.pLMN_Identity); + &nRCGI.pLMN_Identity); NR_CELL_ID_TO_BIT_STRING(f1ap_setup_resp->cells_to_activate[i].nr_cellid, &nRCGI.nRCellIdentity); cells_to_be_activated_list_item.nRCGI = nRCGI; - + /* optional */ /* - nRPCI */ if (1) { - cells_to_be_activated_list_item.nRPCI = (F1AP_NRPCI_t *)calloc(1, sizeof(F1AP_NRPCI_t)); - *cells_to_be_activated_list_item.nRPCI = f1ap_setup_resp->cells_to_activate[i].nrpci; // int 0..1007 + cells_to_be_activated_list_item.nRPCI = (F1AP_NRPCI_t *)calloc(1, sizeof(F1AP_NRPCI_t)); + *cells_to_be_activated_list_item.nRPCI = f1ap_setup_resp->cells_to_activate[i].nrpci; // int 0..1007 } - + /* optional */ /* - gNB-CU System Information */ if (1) { - /* 3.1.2 gNB-CUSystem Information */ - F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *cells_to_be_activated_list_itemExtIEs; - cells_to_be_activated_list_itemExtIEs = (F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *)calloc(1, sizeof(F1AP_Cells_to_be_Activated_List_ItemExtIEs_t)); - cells_to_be_activated_list_itemExtIEs->id = F1AP_ProtocolIE_ID_id_gNB_CUSystemInformation; - cells_to_be_activated_list_itemExtIEs->criticality = F1AP_Criticality_reject; - cells_to_be_activated_list_itemExtIEs->extensionValue.present = F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_GNB_CUSystemInformation; - - F1AP_GNB_CUSystemInformation_t *gNB_CUSystemInformation = (F1AP_GNB_CUSystemInformation_t *)calloc(1, sizeof(F1AP_GNB_CUSystemInformation_t)); - //LOG_I(F1AP, "%s() SI %d size %d: ", __func__, i, f1ap_setup_resp->SI_container_length[i][0]); - //for (int n = 0; n < f1ap_setup_resp->SI_container_length[i][0]; n++) - // printf("%02x ", f1ap_setup_resp->SI_container[i][0][n]); - //printf("\n"); - - // for (int sIBtype=2;sIBtype<33;sIBtype++) { //21 ? 33 ? - for (int sIBtype=2;sIBtype<21;sIBtype++) { - if (f1ap_setup_resp->cells_to_activate[i].SI_container[sIBtype]!=NULL) { - AssertFatal(sIBtype < 6 || sIBtype == 9, "Illegal SI type %d\n",sIBtype); - F1AP_SibtypetobeupdatedListItem_t *sib_item = calloc(1,sizeof(*sib_item)); - memset((void*)sib_item,0,sizeof(*sib_item)); - sib_item->sIBtype = sIBtype; - OCTET_STRING_fromBuf(&sib_item->sIBmessage, - (const char*)f1ap_setup_resp->cells_to_activate[i].SI_container[sIBtype], - f1ap_setup_resp->cells_to_activate[i].SI_container_length[sIBtype]); - - LOG_D(F1AP, "f1ap_setup_resp->SI_container_length[%d][%d] = %d \n", i,sIBtype,f1ap_setup_resp->cells_to_activate[i].SI_container_length[sIBtype]); - ASN_SEQUENCE_ADD(&gNB_CUSystemInformation->sibtypetobeupdatedlist.list,sib_item); - } - } - cells_to_be_activated_list_itemExtIEs->extensionValue.choice.GNB_CUSystemInformation = *gNB_CUSystemInformation; - - - F1AP_ProtocolExtensionContainer_154P112_t p_154P112_t; - memset((void *)&p_154P112_t, 0, sizeof(F1AP_ProtocolExtensionContainer_154P112_t)); - - ASN_SEQUENCE_ADD(&p_154P112_t.list, - cells_to_be_activated_list_itemExtIEs); - cells_to_be_activated_list_item.iE_Extensions = (struct F1AP_ProtocolExtensionContainer*)&p_154P112_t; - - free(gNB_CUSystemInformation); - gNB_CUSystemInformation = NULL; + /* 3.1.2 gNB-CUSystem Information */ + F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *cells_to_be_activated_list_itemExtIEs; + cells_to_be_activated_list_itemExtIEs = (F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *)calloc(1, sizeof(F1AP_Cells_to_be_Activated_List_ItemExtIEs_t)); + cells_to_be_activated_list_itemExtIEs->id = F1AP_ProtocolIE_ID_id_gNB_CUSystemInformation; + cells_to_be_activated_list_itemExtIEs->criticality = F1AP_Criticality_reject; + cells_to_be_activated_list_itemExtIEs->extensionValue.present = F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_GNB_CUSystemInformation; + F1AP_GNB_CUSystemInformation_t *gNB_CUSystemInformation = (F1AP_GNB_CUSystemInformation_t *)calloc(1, sizeof(F1AP_GNB_CUSystemInformation_t)); + //LOG_I(F1AP, "%s() SI %d size %d: ", __func__, i, f1ap_setup_resp->SI_container_length[i][0]); + //for (int n = 0; n < f1ap_setup_resp->SI_container_length[i][0]; n++) + // printf("%02x ", f1ap_setup_resp->SI_container[i][0][n]); + //printf("\n"); + + // for (int sIBtype=2;sIBtype<33;sIBtype++) { //21 ? 33 ? + for (int sIBtype=2; sIBtype<21; sIBtype++) { + if (f1ap_setup_resp->cells_to_activate[i].SI_container[sIBtype]!=NULL) { + AssertFatal(sIBtype < 6 || sIBtype == 9, "Illegal SI type %d\n",sIBtype); + F1AP_SibtypetobeupdatedListItem_t *sib_item = calloc(1,sizeof(*sib_item)); + memset((void *)sib_item,0,sizeof(*sib_item)); + sib_item->sIBtype = sIBtype; + OCTET_STRING_fromBuf(&sib_item->sIBmessage, + (const char *)f1ap_setup_resp->cells_to_activate[i].SI_container[sIBtype], + f1ap_setup_resp->cells_to_activate[i].SI_container_length[sIBtype]); + LOG_D(F1AP, "f1ap_setup_resp->SI_container_length[%d][%d] = %d \n", i,sIBtype,f1ap_setup_resp->cells_to_activate[i].SI_container_length[sIBtype]); + ASN_SEQUENCE_ADD(&gNB_CUSystemInformation->sibtypetobeupdatedlist.list,sib_item); + } + } + + cells_to_be_activated_list_itemExtIEs->extensionValue.choice.GNB_CUSystemInformation = *gNB_CUSystemInformation; + F1AP_ProtocolExtensionContainer_154P112_t p_154P112_t; + memset((void *)&p_154P112_t, 0, sizeof(F1AP_ProtocolExtensionContainer_154P112_t)); + ASN_SEQUENCE_ADD(&p_154P112_t.list, + cells_to_be_activated_list_itemExtIEs); + cells_to_be_activated_list_item.iE_Extensions = (struct F1AP_ProtocolExtensionContainer *)&p_154P112_t; + free(gNB_CUSystemInformation); + gNB_CUSystemInformation = NULL; } + /* ADD */ cells_to_be_activated_list_item_ies->value.choice.Cells_to_be_Activated_List_Item = cells_to_be_activated_list_item; - ASN_SEQUENCE_ADD(&ie->value.choice.Cells_to_be_Activated_List.list, - cells_to_be_activated_list_item_ies); + ASN_SEQUENCE_ADD(&ie->value.choice.Cells_to_be_Activated_List.list, + cells_to_be_activated_list_item_ies); } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } @@ -412,27 +381,21 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance, } cu_f1ap_itti_send_sctp_data_req(instance, f1ap_du_data_from_du->assoc_id, buffer, len, 0); - return 0; } int CU_send_F1_SETUP_FAILURE(instance_t instance) { LOG_D(F1AP, "CU_send_F1_SETUP_FAILURE\n"); - module_id_t enb_mod_idP; module_id_t cu_mod_idP; - // This should be fixed enb_mod_idP = (module_id_t)0; cu_mod_idP = (module_id_t)0; - F1AP_F1AP_PDU_t pdu; F1AP_F1SetupFailure_t *out; F1AP_F1SetupFailureIEs_t *ie; - uint8_t *buffer; uint32_t len; - /* Create */ /* 0. Message Type */ memset(&pdu, 0, sizeof(pdu)); @@ -442,7 +405,6 @@ int CU_send_F1_SETUP_FAILURE(instance_t instance) { pdu.choice.unsuccessfulOutcome->criticality = F1AP_Criticality_reject; pdu.choice.unsuccessfulOutcome->value.present = F1AP_UnsuccessfulOutcome__value_PR_F1SetupFailure; out = &pdu.choice.unsuccessfulOutcome->value.choice.F1SetupFailure; - /* mandatory */ /* c1. Transaction ID (integer value)*/ ie = (F1AP_F1SetupFailureIEs_t *)calloc(1, sizeof(F1AP_F1SetupFailureIEs_t)); @@ -451,7 +413,6 @@ int CU_send_F1_SETUP_FAILURE(instance_t instance) { ie->value.present = F1AP_F1SetupFailureIEs__value_PR_TransactionID; ie->value.choice.TransactionID = F1AP_get_next_transaction_identifier(enb_mod_idP, cu_mod_idP); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - /* mandatory */ /* c2. Cause */ ie = (F1AP_F1SetupFailureIEs_t *)calloc(1, sizeof(F1AP_F1SetupFailureIEs_t)); @@ -498,7 +459,6 @@ int CU_send_F1_SETUP_FAILURE(instance_t instance) { } cu_f1ap_itti_send_sctp_data_req(instance, f1ap_du_data_from_du->assoc_id, buffer, len, 0); - return 0; } @@ -509,19 +469,19 @@ int CU_send_F1_SETUP_FAILURE(instance_t instance) { */ int CU_handle_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { AssertFatal(1==0,"Not implemented yet\n"); } int CU_send_gNB_DU_CONFIGURATION_FAILURE(instance_t instance, - F1AP_GNBDUConfigurationUpdateFailure_t *GNBDUConfigurationUpdateFailure) { + F1AP_GNBDUConfigurationUpdateFailure_t *GNBDUConfigurationUpdateFailure) { AssertFatal(1==0,"Not implemented yet\n"); } int CU_send_gNB_DU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, - F1AP_GNBDUConfigurationUpdateAcknowledge_t *GNBDUConfigurationUpdateAcknowledge) { + F1AP_GNBDUConfigurationUpdateAcknowledge_t *GNBDUConfigurationUpdateAcknowledge) { AssertFatal(1==0,"Not implemented yet\n"); } @@ -533,130 +493,90 @@ int CU_send_gNB_DU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, //void CU_send_gNB_CU_CONFIGURATION_UPDATE(F1AP_GNBCUConfigurationUpdate_t *GNBCUConfigurationUpdate) { int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configuration_update_t *f1ap_gnb_cu_configuration_update) { - F1AP_F1AP_PDU_t pdu; - F1AP_GNBCUConfigurationUpdate_t *out; - F1AP_GNBCUConfigurationUpdateIEs_t *ie; - + F1AP_F1AP_PDU_t pdu= {0}; uint8_t *buffer; uint32_t len; - int i = 0; - - /* Create */ /* 0. Message Type */ - memset(&pdu, 0, sizeof(pdu)); pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; - pdu.choice.initiatingMessage = (F1AP_InitiatingMessage_t *)calloc(1, sizeof(F1AP_InitiatingMessage_t)); - pdu.choice.initiatingMessage->procedureCode = F1AP_ProcedureCode_id_gNBCUConfigurationUpdate; - pdu.choice.initiatingMessage->criticality = F1AP_Criticality_reject; - pdu.choice.initiatingMessage->value.present = F1AP_InitiatingMessage__value_PR_GNBCUConfigurationUpdate; - out = &pdu.choice.initiatingMessage->value.choice.GNBCUConfigurationUpdate; - + asn1cCalloc(pdu.choice.initiatingMessage, F1AP_InitiatingMessage_t, initMsg); + initMsg->procedureCode = F1AP_ProcedureCode_id_gNBCUConfigurationUpdate; + initMsg->criticality = F1AP_Criticality_reject; + initMsg->value.present = F1AP_InitiatingMessage__value_PR_GNBCUConfigurationUpdate; + F1AP_GNBCUConfigurationUpdate_t *cfgUpdate = &pdu.choice.initiatingMessage->value.choice.GNBCUConfigurationUpdate; /* mandatory */ /* c1. Transaction ID (integer value) */ - ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_TransactionID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_TransactionID; - ie->value.choice.TransactionID = F1AP_get_next_transaction_identifier(instance, 0); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + asn1cSequenceAdd(cfgUpdate->protocolIEs.list, F1AP_GNBCUConfigurationUpdateIEs_t, ieC1); + ieC1->id = F1AP_ProtocolIE_ID_id_TransactionID; + ieC1->criticality = F1AP_Criticality_reject; + ieC1->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_TransactionID; + ieC1->value.choice.TransactionID = F1AP_get_next_transaction_identifier(instance, 0); - - // mandatory - // c2. Cells_to_be_Activated_List + // c2. Cells_to_be_Activated_List if (f1ap_gnb_cu_configuration_update->num_cells_to_activate > 0) { - ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_Cells_to_be_Activated_List; - - for (i=0; - inum_cells_to_activate; - i++) { - - F1AP_Cells_to_be_Activated_List_ItemIEs_t *cells_to_be_activated_list_item_ies; - cells_to_be_activated_list_item_ies = (F1AP_Cells_to_be_Activated_List_ItemIEs_t *)calloc(1, sizeof(F1AP_Cells_to_be_Activated_List_ItemIEs_t)); + asn1cSequenceAdd(cfgUpdate->protocolIEs.list, F1AP_GNBCUConfigurationUpdateIEs_t, ieC3); + ieC3->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List; + ieC3->criticality = F1AP_Criticality_reject; + ieC3->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_Cells_to_be_Activated_List; + + for (int i=0; inum_cells_to_activate; i++) { + asn1cSequenceAdd(ieC3->value.choice.Cells_to_be_Activated_List.list,F1AP_Cells_to_be_Activated_List_ItemIEs_t, + cells_to_be_activated_list_item_ies); cells_to_be_activated_list_item_ies->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item; cells_to_be_activated_list_item_ies->criticality = F1AP_Criticality_reject; cells_to_be_activated_list_item_ies->value.present = F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item; - // 2.1 cells to be Activated list item - F1AP_Cells_to_be_Activated_List_Item_t cells_to_be_activated_list_item; - memset((void *)&cells_to_be_activated_list_item, 0, sizeof(F1AP_Cells_to_be_Activated_List_Item_t)); - - // - nRCGI - F1AP_NRCGI_t nRCGI; - memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t)); - MCC_MNC_TO_PLMNID(f1ap_gnb_cu_configuration_update->cells_to_activate[i].mcc, - f1ap_gnb_cu_configuration_update->cells_to_activate[i].mnc, - f1ap_gnb_cu_configuration_update->cells_to_activate[i].mnc_digit_length, - &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(f1ap_gnb_cu_configuration_update->cells_to_activate[i].nr_cellid, - &nRCGI.nRCellIdentity); - cells_to_be_activated_list_item.nRCGI = nRCGI; - + F1AP_Cells_to_be_Activated_List_Item_t *cells_to_be_activated_list_item=&cells_to_be_activated_list_item_ies->value.choice.Cells_to_be_Activated_List_Item; + // - nRCGI + F1AP_NRCGI_t *nRCGI=&cells_to_be_activated_list_item->nRCGI; + MCC_MNC_TO_PLMNID(f1ap_gnb_cu_configuration_update->cells_to_activate[i].mcc, + f1ap_gnb_cu_configuration_update->cells_to_activate[i].mnc, + f1ap_gnb_cu_configuration_update->cells_to_activate[i].mnc_digit_length, + &nRCGI->pLMN_Identity); + NR_CELL_ID_TO_BIT_STRING(f1ap_gnb_cu_configuration_update->cells_to_activate[i].nr_cellid, + &nRCGI->nRCellIdentity); // optional // -nRPCI - cells_to_be_activated_list_item.nRPCI = (F1AP_NRPCI_t *)calloc(1, sizeof(F1AP_NRPCI_t)); - *cells_to_be_activated_list_item.nRPCI = f1ap_gnb_cu_configuration_update->cells_to_activate[i].nrpci; // int 0..1007 - - // optional + asn1cCalloc(cells_to_be_activated_list_item->nRPCI, F1AP_NRPCI_t, tmp); + *tmp = f1ap_gnb_cu_configuration_update->cells_to_activate[i].nrpci; // int 0..1007 + // optional // 3.1.2 gNB-CUSystem Information - F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *cells_to_be_activated_list_itemExtIEs; - cells_to_be_activated_list_itemExtIEs = (F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *)calloc(1, sizeof(F1AP_Cells_to_be_Activated_List_ItemExtIEs_t)); + F1AP_ProtocolExtensionContainer_154P112_t *p_154P112=(F1AP_ProtocolExtensionContainer_154P112_t *) calloc(1,sizeof(*p_154P112)); + cells_to_be_activated_list_item->iE_Extensions = (struct F1AP_ProtocolExtensionContainer *)p_154P112; + //F1AP_ProtocolExtensionContainer_154P112_t + asn1cSequenceAdd(p_154P112->list,F1AP_Cells_to_be_Activated_List_ItemExtIEs_t, cells_to_be_activated_list_itemExtIEs); cells_to_be_activated_list_itemExtIEs->id = F1AP_ProtocolIE_ID_id_gNB_CUSystemInformation; cells_to_be_activated_list_itemExtIEs->criticality = F1AP_Criticality_reject; cells_to_be_activated_list_itemExtIEs->extensionValue.present = F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_GNB_CUSystemInformation; if (f1ap_gnb_cu_configuration_update->cells_to_activate[i].num_SI > 0) { - F1AP_GNB_CUSystemInformation_t *gNB_CUSystemInformation = (F1AP_GNB_CUSystemInformation_t *)calloc(1, sizeof(F1AP_GNB_CUSystemInformation_t)); - //LOG_I(F1AP, "%s() SI %d size %d: ", __func__, i, f1ap_setup_resp->SI_container_length[i][0]); - //for (int n = 0; n < f1ap_setup_resp->SI_container_length[i][0]; n++) - // printf("%02x ", f1ap_setup_resp->SI_container[i][0][n]); - //printf("\n"); - - // for (int sIBtype=2;sIBtype<33;sIBtype++) { //21 ? 33 ? - for (int sIBtype=2;sIBtype<21;sIBtype++) { - if (f1ap_gnb_cu_configuration_update->cells_to_activate[i].SI_container[sIBtype]!=NULL) { - AssertFatal(sIBtype < 6 || sIBtype == 9, "Illegal SI type %d\n",sIBtype); - F1AP_SibtypetobeupdatedListItem_t *sib_item = calloc(1,sizeof(*sib_item)); - memset((void*)sib_item,0,sizeof(*sib_item)); - sib_item->sIBtype = sIBtype; - OCTET_STRING_fromBuf(&sib_item->sIBmessage, - (const char*)f1ap_gnb_cu_configuration_update->cells_to_activate[i].SI_container[sIBtype], - f1ap_gnb_cu_configuration_update->cells_to_activate[i].SI_container_length[sIBtype]); - - LOG_D(F1AP, "f1ap_setup_resp->SI_container_length[%d][%d] = %d \n", i,sIBtype,f1ap_gnb_cu_configuration_update->cells_to_activate[i].SI_container_length[sIBtype]); - ASN_SEQUENCE_ADD(&gNB_CUSystemInformation->sibtypetobeupdatedlist.list,sib_item); - } - } - cells_to_be_activated_list_itemExtIEs->extensionValue.choice.GNB_CUSystemInformation = *gNB_CUSystemInformation; - - - F1AP_ProtocolExtensionContainer_154P112_t p_154P112_t; - memset((void *)&p_154P112_t, 0, sizeof(F1AP_ProtocolExtensionContainer_154P112_t)); - - ASN_SEQUENCE_ADD(&p_154P112_t.list, - cells_to_be_activated_list_itemExtIEs); - cells_to_be_activated_list_item.iE_Extensions = (struct F1AP_ProtocolExtensionContainer*)&p_154P112_t; - - free(gNB_CUSystemInformation); - gNB_CUSystemInformation = NULL; - } + F1AP_GNB_CUSystemInformation_t *gNB_CUSystemInformation = &cells_to_be_activated_list_itemExtIEs->extensionValue.choice.GNB_CUSystemInformation; + //LOG_I(F1AP, "%s() SI %d size %d: ", __func__, i, f1ap_setup_resp->SI_container_length[i][0]); + //for (int n = 0; n < f1ap_setup_resp->SI_container_length[i][0]; n++) + // printf("%02x ", f1ap_setup_resp->SI_container[i][0][n]); + //printf("\n"); - // ADD - cells_to_be_activated_list_item_ies->value.choice.Cells_to_be_Activated_List_Item = cells_to_be_activated_list_item; - ASN_SEQUENCE_ADD(&ie->value.choice.Cells_to_be_Activated_List.list, - cells_to_be_activated_list_item_ies); - } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - + // for (int sIBtype=2;sIBtype<33;sIBtype++) { //21 ? 33 ? + for (int sIBtype=2; sIBtype<21; sIBtype++) { + if (f1ap_gnb_cu_configuration_update->cells_to_activate[i].SI_container[sIBtype]!=NULL) { + AssertFatal(sIBtype < 6 || sIBtype == 9, "Illegal SI type %d\n",sIBtype); + asn1cSequenceAdd(gNB_CUSystemInformation->sibtypetobeupdatedlist.list, F1AP_SibtypetobeupdatedListItem_t, sib_item); + sib_item->sIBtype = sIBtype; + OCTET_STRING_fromBuf(&sib_item->sIBmessage, + (const char *)f1ap_gnb_cu_configuration_update->cells_to_activate[i].SI_container[sIBtype], + f1ap_gnb_cu_configuration_update->cells_to_activate[i].SI_container_length[sIBtype]); + LOG_D(F1AP, "f1ap_setup_resp->SI_container_length[%d][%d] = %d \n", i,sIBtype, + f1ap_gnb_cu_configuration_update->cells_to_activate[i].SI_container_length[sIBtype]); + } + } + } + } } - + /* - // c3. Cells_to_be_Deactivated_List + // c3. Cells_to_be_Deactivated_List // ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t)); ie->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Deactivated_List; @@ -673,7 +593,7 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu cells_to_be_deactivated_list_item_ies->criticality = F1AP_Criticality_reject; cells_to_be_deactivated_list_item_ies->value.present = F1AP_Cells_to_be_Deactivated_List_ItemIEs__value_PR_Cells_to_be_Deactivated_List_Item; - // 3.1 cells to be Deactivated list item + // 3.1 cells to be Deactivated list item F1AP_Cells_to_be_Deactivated_List_Item_t cells_to_be_deactivated_list_item; memset((void *)&cells_to_be_deactivated_list_item, 0, sizeof(F1AP_Cells_to_be_Deactivated_List_Item_t)); @@ -688,14 +608,13 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu cells_to_be_deactivated_list_item_ies->value.choice.Cells_to_be_Deactivated_List_Item = cells_to_be_deactivated_list_item; ASN_SEQUENCE_ADD(&ie->value.choice.Cells_to_be_Deactivated_List.list, cells_to_be_deactivated_list_item_ies); - } + } ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); -*/ - + */ /* // c4. GNB_CU_TNL_Association_To_Add_List - + ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t)); ie->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Add_List; ie->criticality = F1AP_Criticality_reject; @@ -711,7 +630,7 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu gnb_cu_tnl_association_to_add_item_ies->criticality = F1AP_Criticality_reject; gnb_cu_tnl_association_to_add_item_ies->value.present = F1AP_GNB_CU_TNL_Association_To_Add_ItemIEs__value_PR_GNB_CU_TNL_Association_To_Add_Item; - // 4.1 GNB_CU_TNL_Association_To_Add_Item + // 4.1 GNB_CU_TNL_Association_To_Add_Item F1AP_GNB_CU_TNL_Association_To_Add_Item_t gnb_cu_tnl_association_to_add_item; memset((void *)&gnb_cu_tnl_association_to_add_item, 0, sizeof(F1AP_GNB_CU_TNL_Association_To_Add_Item_t)); @@ -721,7 +640,7 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t)); transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address; TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address); - + // memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t)); // transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address_and_port; // transportLayerAddress.choice.endpoint_IP_address_and_port = (F1AP_Endpoint_IP_address_and_port_t *)calloc(1, sizeof(F1AP_Endpoint_IP_address_and_port_t)); @@ -731,19 +650,19 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu // 4.1.2 tNLAssociationUsage gnb_cu_tnl_association_to_add_item.tNLAssociationUsage = F1AP_TNLAssociationUsage_non_ue; - - + + gnb_cu_tnl_association_to_add_item_ies->value.choice.GNB_CU_TNL_Association_To_Add_Item = gnb_cu_tnl_association_to_add_item; ASN_SEQUENCE_ADD(&ie->value.choice.GNB_CU_TNL_Association_To_Add_List.list, gnb_cu_tnl_association_to_add_item_ies); - } + } ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); */ - /* - + /* + // c5. GNB_CU_TNL_Association_To_Remove_List ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t)); ie->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Remove_List; @@ -764,29 +683,29 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu memset((void *)&gnb_cu_tnl_association_to_remove_item, 0, sizeof(F1AP_GNB_CU_TNL_Association_To_Remove_Item_t)); - // 4.1.1 tNLAssociationTransportLayerAddress + // 4.1.1 tNLAssociationTransportLayerAddress F1AP_CP_TransportLayerAddress_t transportLayerAddress; memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t)); transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address; TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address); - + // memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t)); // transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address_and_port; // transportLayerAddress.choice.endpoint_IP_address_and_port = (F1AP_Endpoint_IP_address_and_port_t *)calloc(1, sizeof(F1AP_Endpoint_IP_address_and_port_t)); // TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address_and_port.endpoint_IP_address); gnb_cu_tnl_association_to_remove_item.tNLAssociationTransportLayerAddress = transportLayerAddress; - + gnb_cu_tnl_association_to_remove_item_ies->value.choice.GNB_CU_TNL_Association_To_Remove_Item = gnb_cu_tnl_association_to_remove_item; ASN_SEQUENCE_ADD(&ie->value.choice.GNB_CU_TNL_Association_To_Remove_List.list, gnb_cu_tnl_association_to_remove_item_ies); - } + } ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); */ - /* + /* //c6. GNB_CU_TNL_Association_To_Update_List ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t)); ie->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Update_List; @@ -802,7 +721,7 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu gnb_cu_tnl_association_to_update_item_ies->criticality = F1AP_Criticality_reject; gnb_cu_tnl_association_to_update_item_ies->value.present = F1AP_GNB_CU_TNL_Association_To_Update_ItemIEs__value_PR_GNB_CU_TNL_Association_To_Update_Item; - // 4.1 GNB_CU_TNL_Association_To_Update_Item + // 4.1 GNB_CU_TNL_Association_To_Update_Item F1AP_GNB_CU_TNL_Association_To_Update_Item_t gnb_cu_tnl_association_to_update_item; memset((void *)&gnb_cu_tnl_association_to_update_item, 0, sizeof(F1AP_GNB_CU_TNL_Association_To_Update_Item_t)); @@ -812,32 +731,32 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t)); transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address; TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address); - + // memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t)); // transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address_and_port; // transportLayerAddress.choice.endpoint_IP_address_and_port = (F1AP_Endpoint_IP_address_and_port_t *)calloc(1, sizeof(F1AP_Endpoint_IP_address_and_port_t)); // TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address_and_port.endpoint_IP_address); gnb_cu_tnl_association_to_update_item.tNLAssociationTransportLayerAddress = transportLayerAddress; - - // 4.1.2 tNLAssociationUsage + + // 4.1.2 tNLAssociationUsage if (1) { gnb_cu_tnl_association_to_update_item.tNLAssociationUsage = (F1AP_TNLAssociationUsage_t *)calloc(1, sizeof(F1AP_TNLAssociationUsage_t)); *gnb_cu_tnl_association_to_update_item.tNLAssociationUsage = F1AP_TNLAssociationUsage_non_ue; } - + gnb_cu_tnl_association_to_update_item_ies->value.choice.GNB_CU_TNL_Association_To_Update_Item = gnb_cu_tnl_association_to_update_item; ASN_SEQUENCE_ADD(&ie->value.choice.GNB_CU_TNL_Association_To_Update_List.list, gnb_cu_tnl_association_to_update_item_ies); - } + } ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); */ - /* + /* // c7. Cells_to_be_Barred_List ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t)); ie->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Barred_List; @@ -857,14 +776,14 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu F1AP_Cells_to_be_Barred_Item_t cells_to_be_barred_item; memset((void *)&cells_to_be_barred_item, 0, sizeof(F1AP_Cells_to_be_Barred_Item_t)); - // - nRCGI + // - nRCGI F1AP_NRCGI_t nRCGI; memset(&nRCGI,0,sizeof(F1AP_NRCGI_t)); MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length, &nRCGI.pLMN_Identity); NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); cells_to_be_barred_item.nRCGI = nRCGI; - + // 7.2 cellBarred cells_to_be_barred_item.cellBarred = F1AP_CellBarred_not_barred; @@ -897,7 +816,7 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu protected_eutra_resources_item_ies->value.present = F1AP_Protected_EUTRA_Resources_ItemIEs__value_PR_Protected_EUTRA_Resources_Item; ((F1AP_Protected_EUTRA_Resources_Item_t*)&protected_eutra_resources_item_ies->value.choice.Protected_EUTRA_Resources_Item)->spectrumSharingGroupID = 123L; memset(&protected_eutra_resources_item_ies->value.choice.Protected_EUTRA_Resources_Item,0, - sizeof(F1AP_Protected_EUTRA_Resources_Item_t)); + sizeof(F1AP_Protected_EUTRA_Resources_Item_t)); ASN_SEQUENCE_ADD(&ie->value.choice.Protected_EUTRA_Resources_List.list, protected_eutra_resources_item_ies); @@ -936,44 +855,48 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); */ - /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { LOG_E(F1AP, "Failed to encode F1 gNB-CU CONFIGURATION UPDATE\n"); return -1; } + printf("F1AP gNB-CU CONFIGURATION UPDATE : "); - for (int i=0;iassoc_id, buffer, len, 0); return 0; } int CU_handle_gNB_CU_CONFIGURATION_UPDATE_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { AssertFatal(1==0,"Not implemented yet\n"); } int CU_handle_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { LOG_I(F1AP,"Cell Configuration ok (assoc_id %d)\n",assoc_id); return(0); } int CU_handle_gNB_DU_RESOURCE_COORDINATION_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { AssertFatal(0, "Not implemented yet\n"); } int CU_send_gNB_DU_RESOURCE_COORDINATION_RESPONSE(instance_t instance, - F1AP_GNBDUResourceCoordinationResponse_t *GNBDUResourceCoordinationResponse) { + F1AP_GNBDUResourceCoordinationResponse_t *GNBDUResourceCoordinationResponse) { AssertFatal(0, "Not implemented yet\n"); } diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index 6f43240e66..26d6ae0b71 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -43,14 +43,17 @@ extern RAN_CONTEXT_t RC; 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}; int to_NRNRB(int nrb) { - for (int i=0;i<29;i++) if (nrb_lut[i] == nrb) return i; + for (int i=0; i<29; i++) + if (nrb_lut[i] == nrb) + return i; + AssertFatal(1==0,"nrb %d is not in the list of possible NRNRB\n",nrb); } int DU_handle_RESET(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { AssertFatal(1==0,"Not implemented yet\n"); } @@ -79,9 +82,9 @@ int DU_send_ERROR_INDICATION(instance_t instance, F1AP_F1AP_PDU_t *pdu_p) { } int DU_handle_ERROR_INDICATION(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { AssertFatal(1==0,"Not implemented yet\n"); } @@ -90,329 +93,240 @@ int DU_handle_ERROR_INDICATION(instance_t instance, F1 Setup */ +#define asn1cCalloc(VaR, TyPe, lOcPtr) TyPe *lOcPtr=VaR=(TyPe*) calloc(1,sizeof(TyPe)); +#define asn1cSequenceAdd(VaR, TyPe, lOcPtr) TyPe *lOcPtr=(TyPe*) calloc(1,sizeof(TyPe)); ASN_SEQUENCE_ADD(&VaR,lOcPtr); + // SETUP REQUEST int DU_send_F1_SETUP_REQUEST(instance_t instance) { module_id_t enb_mod_idP=0; module_id_t du_mod_idP=0; - - F1AP_F1AP_PDU_t pdu; - F1AP_F1SetupRequest_t *out; - F1AP_F1SetupRequestIEs_t *ie; - + F1AP_F1AP_PDU_t pdu= {0}; uint8_t *buffer; uint32_t len; - int i = 0; - /* Create */ /* 0. pdu Type */ - memset(&pdu, 0, sizeof(pdu)); pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; - pdu.choice.initiatingMessage = (F1AP_InitiatingMessage_t *)calloc(1, sizeof(F1AP_InitiatingMessage_t)); - pdu.choice.initiatingMessage->procedureCode = F1AP_ProcedureCode_id_F1Setup; - pdu.choice.initiatingMessage->criticality = F1AP_Criticality_reject; - pdu.choice.initiatingMessage->value.present = F1AP_InitiatingMessage__value_PR_F1SetupRequest; - out = &pdu.choice.initiatingMessage->value.choice.F1SetupRequest; - + asn1cCalloc(pdu.choice.initiatingMessage, F1AP_InitiatingMessage_t, initMsg); + initMsg->procedureCode = F1AP_ProcedureCode_id_F1Setup; + initMsg->criticality = F1AP_Criticality_reject; + initMsg->value.present = F1AP_InitiatingMessage__value_PR_F1SetupRequest; + F1AP_F1SetupRequest_t *f1Setup = &initMsg->value.choice.F1SetupRequest; /* mandatory */ /* c1. Transaction ID (integer value) */ - ie = (F1AP_F1SetupRequestIEs_t *)calloc(1, sizeof(F1AP_F1SetupRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_TransactionID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_F1SetupRequestIEs__value_PR_TransactionID; - ie->value.choice.TransactionID = F1AP_get_next_transaction_identifier(enb_mod_idP, du_mod_idP); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - + asn1cSequenceAdd(f1Setup->protocolIEs.list, F1AP_F1SetupRequestIEs_t, ieC1); + ieC1->id = F1AP_ProtocolIE_ID_id_TransactionID; + ieC1->criticality = F1AP_Criticality_reject; + ieC1->value.present = F1AP_F1SetupRequestIEs__value_PR_TransactionID; + ieC1->value.choice.TransactionID = F1AP_get_next_transaction_identifier(enb_mod_idP, du_mod_idP); /* mandatory */ /* c2. GNB_DU_ID (integer value) */ - ie = (F1AP_F1SetupRequestIEs_t *)calloc(1, sizeof(F1AP_F1SetupRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_ID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_F1SetupRequestIEs__value_PR_GNB_DU_ID; - asn_int642INTEGER(&ie->value.choice.GNB_DU_ID, f1ap_du_data->gNB_DU_id); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + asn1cSequenceAdd(f1Setup->protocolIEs.list, F1AP_F1SetupRequestIEs_t, ieC2); + ieC2->id = F1AP_ProtocolIE_ID_id_gNB_DU_ID; + ieC2->criticality = F1AP_Criticality_reject; + ieC2->value.present = F1AP_F1SetupRequestIEs__value_PR_GNB_DU_ID; + asn_int642INTEGER(&ieC2->value.choice.GNB_DU_ID, f1ap_du_data->gNB_DU_id); /* optional */ /* c3. GNB_DU_Name */ if (f1ap_du_data->gNB_DU_name != NULL) { - ie = (F1AP_F1SetupRequestIEs_t *)calloc(1, sizeof(F1AP_F1SetupRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_Name; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_F1SetupRequestIEs__value_PR_GNB_DU_Name; - OCTET_STRING_fromBuf(&ie->value.choice.GNB_DU_Name, f1ap_du_data->gNB_DU_name, + asn1cSequenceAdd(f1Setup->protocolIEs.list, F1AP_F1SetupRequestIEs_t, ieC3); + ieC3->id = F1AP_ProtocolIE_ID_id_gNB_DU_Name; + ieC3->criticality = F1AP_Criticality_ignore; + ieC3->value.present = F1AP_F1SetupRequestIEs__value_PR_GNB_DU_Name; + OCTET_STRING_fromBuf(&ieC3->value.choice.GNB_DU_Name, f1ap_du_data->gNB_DU_name, strlen(f1ap_du_data->gNB_DU_name)); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } /* mandatory */ /* c4. served cells list */ - ie = (F1AP_F1SetupRequestIEs_t *)calloc(1, sizeof(F1AP_F1SetupRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_Served_Cells_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_F1SetupRequestIEs__value_PR_GNB_DU_Served_Cells_List; - + asn1cSequenceAdd(f1Setup->protocolIEs.list, F1AP_F1SetupRequestIEs_t, ieCells); + ieCells->id = F1AP_ProtocolIE_ID_id_gNB_DU_Served_Cells_List; + ieCells->criticality = F1AP_Criticality_reject; + ieCells->value.present = F1AP_F1SetupRequestIEs__value_PR_GNB_DU_Served_Cells_List; int num_cells_available = f1ap_du_data->num_cells_available; LOG_D(F1AP, "num_cells_available = %d \n", num_cells_available); - for (i=0; - iid = F1AP_ProtocolIE_ID_id_GNB_DU_Served_Cells_Item; - gnb_du_served_cell_list_item_ies->criticality = F1AP_Criticality_reject; - gnb_du_served_cell_list_item_ies->value.present = F1AP_GNB_DU_Served_Cells_ItemIEs__value_PR_GNB_DU_Served_Cells_Item; - + for (int i=0; ivalue.choice.GNB_DU_Served_Cells_List.list, + F1AP_GNB_DU_Served_Cells_ItemIEs_t, duServedCell); + duServedCell->id = F1AP_ProtocolIE_ID_id_GNB_DU_Served_Cells_Item; + duServedCell->criticality = F1AP_Criticality_reject; + duServedCell->value.present = F1AP_GNB_DU_Served_Cells_ItemIEs__value_PR_GNB_DU_Served_Cells_Item; + F1AP_GNB_DU_Served_Cells_Item_t *gnb_du_served_cells_item=&duServedCell->value.choice.GNB_DU_Served_Cells_Item; - F1AP_GNB_DU_Served_Cells_Item_t gnb_du_served_cells_item; - memset((void *)&gnb_du_served_cells_item, 0, sizeof(F1AP_GNB_DU_Served_Cells_Item_t)); + /* 4.1.1 served cell Information */ + F1AP_Served_Cell_Information_t *served_cell_information= &gnb_du_served_cells_item->served_Cell_Information; + F1AP_NRCGI_t *nRCGI= &served_cell_information->nRCGI; + /* - nRCGI */ + MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &nRCGI->pLMN_Identity); + LOG_D(F1AP, "plmn: (%d,%d)\n",f1ap_du_data->mcc[i],f1ap_du_data->mnc[i]); + NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[i], &nRCGI->nRCellIdentity); + LOG_D(F1AP, "nRCellIdentity (%llx): %x.%x.%x.%x.%x\n", + (long long unsigned int)f1ap_du_data->nr_cellid[i], + nRCGI->nRCellIdentity.buf[0], + nRCGI->nRCellIdentity.buf[1], + nRCGI->nRCellIdentity.buf[2], + nRCGI->nRCellIdentity.buf[3], + nRCGI->nRCellIdentity.buf[4]); + /* - nRPCI */ + served_cell_information->nRPCI = f1ap_du_data->nr_pci[i]; // int 0..1007 + /* - fiveGS_TAC */ + uint32_t tac=htonl(f1ap_du_data->tac[i]); + asn1cCalloc(served_cell_information->fiveGS_TAC, F1AP_FiveGS_TAC_t, netOrder); + OCTET_STRING_fromBuf(netOrder, ((char *)&tac)+1, 3); - /* 4.1.1 served cell Information */ - F1AP_Served_Cell_Information_t served_cell_information; + /* - Configured_EPS_TAC */ + if(0) { + served_cell_information->configured_EPS_TAC = (F1AP_Configured_EPS_TAC_t *)calloc(1, sizeof(F1AP_Configured_EPS_TAC_t)); + OCTET_STRING_fromBuf(served_cell_information->configured_EPS_TAC, "2", 2); + } - memset((void *)&served_cell_information, 0, sizeof(F1AP_Served_Cell_Information_t)); + /* servedPLMN information */ + asn1cSequenceAdd(served_cell_information->servedPLMNs.list, F1AP_ServedPLMNs_Item_t,servedPLMN_item); + MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], + f1ap_du_data->mnc_digit_length[i], &servedPLMN_item->pLMN_Identity); + // // /* - CHOICE NR-MODE-Info */ + F1AP_NR_Mode_Info_t *nR_Mode_Info= &served_cell_information->nR_Mode_Info; - /* - nRCGI */ - F1AP_NRCGI_t nRCGI; - memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t)); - MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &nRCGI.pLMN_Identity); - LOG_D(F1AP, "plmn: (%d,%d)\n",f1ap_du_data->mcc[i],f1ap_du_data->mnc[i]); - //MCC_MNC_TO_PLMNID(208, 95, 2, &nRCGI.pLMN_Identity); + //f1ap_du_data->fdd_flag = 1; + if (f1ap_du_data->fdd_flag) { // FDD + nR_Mode_Info->present = F1AP_NR_Mode_Info_PR_fDD; + asn1cCalloc(nR_Mode_Info->choice.fDD, F1AP_FDD_Info_t, fDD_Info); + /* FDD.1 UL NRFreqInfo */ + /* FDD.1.1 UL NRFreqInfo ARFCN */ + fDD_Info->uL_NRFreqInfo.nRARFCN = f1ap_du_data->nr_mode_info[i].fdd.ul_nr_arfcn; // Integer - NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[i], &nRCGI.nRCellIdentity); - LOG_D(F1AP, "nRCellIdentity (%llx): %x.%x.%x.%x.%x\n", - (long long unsigned int)f1ap_du_data->nr_cellid[i], - nRCGI.nRCellIdentity.buf[0], - nRCGI.nRCellIdentity.buf[1], - nRCGI.nRCellIdentity.buf[2], - nRCGI.nRCellIdentity.buf[3], - nRCGI.nRCellIdentity.buf[4]); + /* FDD.1.2 F1AP_SUL_Information */ + if(0) { // Optional + asn1cCalloc(fDD_Info->uL_NRFreqInfo.sul_Information, F1AP_SUL_Information_t, fdd_sul_info); + fdd_sul_info->sUL_NRARFCN = 0; + fdd_sul_info->sUL_transmission_Bandwidth.nRSCS = 0; + fdd_sul_info->sUL_transmission_Bandwidth.nRNRB = 0; + } - served_cell_information.nRCGI = nRCGI; + /* FDD.1.3 freqBandListNr */ + int fdd_ul_num_available_freq_Bands = f1ap_du_data->nr_mode_info[i].fdd.ul_num_frequency_bands; + LOG_D(F1AP, "fdd_ul_num_available_freq_Bands = %d \n", fdd_ul_num_available_freq_Bands); - /* - nRPCI */ - served_cell_information.nRPCI = f1ap_du_data->nr_pci[i]; // int 0..1007 + for (int fdd_ul_j=0; fdd_ul_juL_NRFreqInfo.freqBandListNr.list, F1AP_FreqBandNrItem_t, nr_freqBandNrItem); + /* FDD.1.3.1 freqBandIndicatorNr*/ + nr_freqBandNrItem->freqBandIndicatorNr = f1ap_du_data->nr_mode_info[i].fdd.ul_nr_band[fdd_ul_j]; // + /* FDD.1.3.2 supportedSULBandList*/ + int num_available_supported_SULBands = f1ap_du_data->nr_mode_info[i].fdd.ul_num_sul_frequency_bands; + LOG_D(F1AP, "num_available_supported_SULBands = %d \n", num_available_supported_SULBands); - /* - fiveGS_TAC */ - uint8_t fiveGS_TAC[3]; - served_cell_information.fiveGS_TAC=calloc(1,sizeof(*served_cell_information.fiveGS_TAC)); - fiveGS_TAC[0] = ((uint8_t*)&f1ap_du_data->tac[i])[2]; - fiveGS_TAC[1] = ((uint8_t*)&f1ap_du_data->tac[i])[1]; - fiveGS_TAC[2] = ((uint8_t*)&f1ap_du_data->tac[i])[0]; - OCTET_STRING_fromBuf(served_cell_information.fiveGS_TAC, - (const char *)fiveGS_TAC, - 3); + for (int fdd_ul_k=0; fdd_ul_ksupportedSULBandList.list, F1AP_SupportedSULFreqBandItem_t, nr_supportedSULFreqBandItem); + /* FDD.1.3.2.1 freqBandIndicatorNr */ + nr_supportedSULFreqBandItem->freqBandIndicatorNr = f1ap_du_data->nr_mode_info[i].fdd.ul_nr_sul_band[fdd_ul_k]; // + } // for FDD : UL supported_SULBands + } // for FDD : UL freq_Bands - /* - Configured_EPS_TAC */ - if(0){ - served_cell_information.configured_EPS_TAC = (F1AP_Configured_EPS_TAC_t *)calloc(1, sizeof(F1AP_Configured_EPS_TAC_t)); - OCTET_STRING_fromBuf(served_cell_information.configured_EPS_TAC, - "2", - 2); - } + /* FDD.2 DL NRFreqInfo */ + /* FDD.2.1 DL NRFreqInfo ARFCN */ + fDD_Info->dL_NRFreqInfo.nRARFCN = f1ap_du_data->nr_mode_info[i].fdd.dl_nr_arfcn; // Integer - /* servedPLMN information */ - F1AP_ServedPLMNs_Item_t *servedPLMN_item = calloc(1,sizeof(*servedPLMN_item)); - memset(servedPLMN_item,0,sizeof(*servedPLMN_item)); - MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &servedPLMN_item->pLMN_Identity); - ASN_SEQUENCE_ADD(&served_cell_information.servedPLMNs.list, servedPLMN_item); + /* FDD.2.2 F1AP_SUL_Information */ + if(0) { // Optional + F1AP_SUL_Information_t *fdd_sul_info=fDD_Info->dL_NRFreqInfo.sul_Information; + fdd_sul_info->sUL_NRARFCN = 0; + fdd_sul_info->sUL_transmission_Bandwidth.nRSCS = 0; + fdd_sul_info->sUL_transmission_Bandwidth.nRNRB = 0; + } - // // /* - CHOICE NR-MODE-Info */ - F1AP_NR_Mode_Info_t nR_Mode_Info; - //f1ap_du_data->fdd_flag = 1; - if (f1ap_du_data->fdd_flag) { // FDD - nR_Mode_Info.present = F1AP_NR_Mode_Info_PR_fDD; - F1AP_FDD_Info_t *fDD_Info = (F1AP_FDD_Info_t *)calloc(1, sizeof(F1AP_FDD_Info_t)); + /* FDD.2.3 freqBandListNr */ + int fdd_dl_num_available_freq_Bands = f1ap_du_data->nr_mode_info[i].fdd.dl_num_frequency_bands; + LOG_D(F1AP, "fdd_dl_num_available_freq_Bands = %d \n", fdd_dl_num_available_freq_Bands); - /* FDD.1 UL NRFreqInfo */ - /* FDD.1.1 UL NRFreqInfo ARFCN */ - fDD_Info->uL_NRFreqInfo.nRARFCN = f1ap_du_data->nr_mode_info[i].fdd.ul_nr_arfcn; // Integer + for (int fdd_dl_j=0; fdd_dl_jdL_NRFreqInfo.freqBandListNr.list, F1AP_FreqBandNrItem_t, nr_freqBandNrItem); + /* FDD.2.3.1 freqBandIndicatorNr*/ + nr_freqBandNrItem->freqBandIndicatorNr = f1ap_du_data->nr_mode_info[i].fdd.dl_nr_band[fdd_dl_j]; // + /* FDD.2.3.2 supportedSULBandList*/ + int num_available_supported_SULBands = f1ap_du_data->nr_mode_info[i].fdd.dl_num_sul_frequency_bands; + LOG_D(F1AP, "num_available_supported_SULBands = %d \n", num_available_supported_SULBands); - /* FDD.1.2 F1AP_SUL_Information */ - if(0) { // Optional - F1AP_SUL_Information_t *fdd_sul_info = (F1AP_SUL_Information_t *)calloc(1, sizeof(F1AP_SUL_Information_t)); - fdd_sul_info->sUL_NRARFCN = 0; - fdd_sul_info->sUL_transmission_Bandwidth.nRSCS = 0; - fdd_sul_info->sUL_transmission_Bandwidth.nRNRB = 0; - fDD_Info->uL_NRFreqInfo.sul_Information = fdd_sul_info; - } + for (int fdd_dl_k=0; fdd_dl_ksupportedSULBandList.list, F1AP_SupportedSULFreqBandItem_t, nr_supportedSULFreqBandItem); + /* FDD.2.3.2.1 freqBandIndicatorNr */ + nr_supportedSULFreqBandItem->freqBandIndicatorNr = f1ap_du_data->nr_mode_info[i].fdd.dl_nr_sul_band[fdd_dl_k]; // + } // for FDD : DL supported_SULBands + } // for FDD : DL freq_Bands - /* FDD.1.3 freqBandListNr */ - int fdd_ul_num_available_freq_Bands = f1ap_du_data->nr_mode_info[i].fdd.ul_num_frequency_bands; - LOG_D(F1AP, "fdd_ul_num_available_freq_Bands = %d \n", fdd_ul_num_available_freq_Bands); - int fdd_ul_j; - for (fdd_ul_j=0; - fdd_ul_juL_Transmission_Bandwidth.nRSCS = f1ap_du_data->nr_mode_info[i].fdd.ul_scs; + fDD_Info->uL_Transmission_Bandwidth.nRNRB = to_NRNRB(f1ap_du_data->nr_mode_info[i].fdd.ul_nrb); + /* FDD.4 DL Transmission Bandwidth */ + fDD_Info->dL_Transmission_Bandwidth.nRSCS = f1ap_du_data->nr_mode_info[i].fdd.dl_scs; + fDD_Info->dL_Transmission_Bandwidth.nRNRB = to_NRNRB(f1ap_du_data->nr_mode_info[i].fdd.dl_nrb); + } else { // TDD + nR_Mode_Info->present = F1AP_NR_Mode_Info_PR_tDD; + asn1cCalloc(nR_Mode_Info->choice.tDD, F1AP_TDD_Info_t, tDD_Info); + /* TDD.1 nRFreqInfo */ + /* TDD.1.1 nRFreqInfo ARFCN */ + tDD_Info->nRFreqInfo.nRARFCN = f1ap_du_data->nr_mode_info[i].tdd.nr_arfcn; // Integer - F1AP_FreqBandNrItem_t nr_freqBandNrItem; - memset((void *)&nr_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); - /* FDD.1.3.1 freqBandIndicatorNr*/ - nr_freqBandNrItem.freqBandIndicatorNr = f1ap_du_data->nr_mode_info[i].fdd.ul_nr_band[fdd_ul_j]; // + /* TDD.1.2 F1AP_SUL_Information */ + if(0) { // Optional + F1AP_SUL_Information_t *tdd_sul_info= tDD_Info->nRFreqInfo.sul_Information; + tdd_sul_info->sUL_NRARFCN = 0; + tdd_sul_info->sUL_transmission_Bandwidth.nRSCS = 0; + tdd_sul_info->sUL_transmission_Bandwidth.nRNRB = 0; + } - /* FDD.1.3.2 supportedSULBandList*/ - int num_available_supported_SULBands = f1ap_du_data->nr_mode_info[i].fdd.ul_num_sul_frequency_bands; - LOG_D(F1AP, "num_available_supported_SULBands = %d \n", num_available_supported_SULBands); - int fdd_ul_k; - for (fdd_ul_k=0; - fdd_ul_knr_mode_info[i].fdd.ul_nr_sul_band[fdd_ul_k]; // - ASN_SEQUENCE_ADD(&nr_freqBandNrItem.supportedSULBandList.list, &nr_supportedSULFreqBandItem); - } // for FDD : UL supported_SULBands - ASN_SEQUENCE_ADD(&fDD_Info->uL_NRFreqInfo.freqBandListNr.list, &nr_freqBandNrItem); - } // for FDD : UL freq_Bands - - /* FDD.2 DL NRFreqInfo */ - /* FDD.2.1 DL NRFreqInfo ARFCN */ - fDD_Info->dL_NRFreqInfo.nRARFCN = f1ap_du_data->nr_mode_info[i].fdd.dl_nr_arfcn; // Integer + /* TDD.1.3 freqBandListNr */ + int tdd_num_available_freq_Bands = f1ap_du_data->nr_mode_info[i].tdd.num_frequency_bands; + LOG_D(F1AP, "tdd_num_available_freq_Bands = %d \n", tdd_num_available_freq_Bands); - /* FDD.2.2 F1AP_SUL_Information */ - if(0) { // Optional - F1AP_SUL_Information_t *fdd_sul_info = (F1AP_SUL_Information_t *)calloc(1, sizeof(F1AP_SUL_Information_t)); - fdd_sul_info->sUL_NRARFCN = 0; - fdd_sul_info->sUL_transmission_Bandwidth.nRSCS = 0; - fdd_sul_info->sUL_transmission_Bandwidth.nRNRB = 0; - fDD_Info->dL_NRFreqInfo.sul_Information = fdd_sul_info; - } + for (int j=0; jnRFreqInfo.freqBandListNr.list, F1AP_FreqBandNrItem_t, nr_freqBandNrItem); + /* TDD.1.3.1 freqBandIndicatorNr*/ + nr_freqBandNrItem->freqBandIndicatorNr = *f1ap_du_data->nr_mode_info[i].tdd.nr_band; // + /* TDD.1.3.2 supportedSULBandList*/ + int num_available_supported_SULBands = f1ap_du_data->nr_mode_info[i].tdd.num_sul_frequency_bands; + LOG_D(F1AP, "num_available_supported_SULBands = %d \n", num_available_supported_SULBands); - /* FDD.2.3 freqBandListNr */ - int fdd_dl_num_available_freq_Bands = f1ap_du_data->nr_mode_info[i].fdd.dl_num_frequency_bands; - LOG_D(F1AP, "fdd_dl_num_available_freq_Bands = %d \n", fdd_dl_num_available_freq_Bands); - int fdd_dl_j; - for (fdd_dl_j=0; - fdd_dl_jsupportedSULBandList.list,F1AP_SupportedSULFreqBandItem_t, nr_supportedSULFreqBandItem); + /* TDD.1.3.2.1 freqBandIndicatorNr */ + nr_supportedSULFreqBandItem->freqBandIndicatorNr = *f1ap_du_data->nr_mode_info[i].tdd.nr_sul_band; // + } // for TDD : supported_SULBands + } // for TDD : freq_Bands - F1AP_FreqBandNrItem_t nr_freqBandNrItem; - memset((void *)&nr_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); - /* FDD.2.3.1 freqBandIndicatorNr*/ - nr_freqBandNrItem.freqBandIndicatorNr = f1ap_du_data->nr_mode_info[i].fdd.dl_nr_band[fdd_dl_j]; // + /* TDD.2 transmission_Bandwidth */ + tDD_Info->transmission_Bandwidth.nRSCS = f1ap_du_data->nr_mode_info[i].tdd.scs; + tDD_Info->transmission_Bandwidth.nRNRB = to_NRNRB(f1ap_du_data->nr_mode_info[i].tdd.nrb); + } // if nR_Mode_Info - /* FDD.2.3.2 supportedSULBandList*/ - int num_available_supported_SULBands = f1ap_du_data->nr_mode_info[i].fdd.dl_num_sul_frequency_bands; - LOG_D(F1AP, "num_available_supported_SULBands = %d \n", num_available_supported_SULBands); - int fdd_dl_k; - for (fdd_dl_k=0; - fdd_dl_knr_mode_info[i].fdd.dl_nr_sul_band[fdd_dl_k]; // - ASN_SEQUENCE_ADD(&nr_freqBandNrItem.supportedSULBandList.list, &nr_supportedSULFreqBandItem); - } // for FDD : DL supported_SULBands - ASN_SEQUENCE_ADD(&fDD_Info->dL_NRFreqInfo.freqBandListNr.list, &nr_freqBandNrItem); - } // for FDD : DL freq_Bands - - /* FDD.3 UL Transmission Bandwidth */ - fDD_Info->uL_Transmission_Bandwidth.nRSCS = f1ap_du_data->nr_mode_info[i].fdd.ul_scs; - fDD_Info->uL_Transmission_Bandwidth.nRNRB = to_NRNRB(f1ap_du_data->nr_mode_info[i].fdd.ul_nrb); - /* FDD.4 DL Transmission Bandwidth */ - fDD_Info->dL_Transmission_Bandwidth.nRSCS = f1ap_du_data->nr_mode_info[i].fdd.dl_scs; - fDD_Info->dL_Transmission_Bandwidth.nRNRB = to_NRNRB(f1ap_du_data->nr_mode_info[i].fdd.dl_nrb); - - nR_Mode_Info.choice.fDD = fDD_Info; - } else { // TDD - nR_Mode_Info.present = F1AP_NR_Mode_Info_PR_tDD; - F1AP_TDD_Info_t *tDD_Info = (F1AP_TDD_Info_t *)calloc(1, sizeof(F1AP_TDD_Info_t)); - - /* TDD.1 nRFreqInfo */ - /* TDD.1.1 nRFreqInfo ARFCN */ - tDD_Info->nRFreqInfo.nRARFCN = f1ap_du_data->nr_mode_info[i].tdd.nr_arfcn; // Integer - - /* TDD.1.2 F1AP_SUL_Information */ - if(0) { // Optional - F1AP_SUL_Information_t *tdd_sul_info = (F1AP_SUL_Information_t *)calloc(1, sizeof(F1AP_SUL_Information_t)); - tdd_sul_info->sUL_NRARFCN = 0; - tdd_sul_info->sUL_transmission_Bandwidth.nRSCS = 0; - tdd_sul_info->sUL_transmission_Bandwidth.nRNRB = 0; - tDD_Info->nRFreqInfo.sul_Information = tdd_sul_info; - } - - /* TDD.1.3 freqBandListNr */ - int tdd_num_available_freq_Bands = f1ap_du_data->nr_mode_info[i].tdd.num_frequency_bands; - LOG_D(F1AP, "tdd_num_available_freq_Bands = %d \n", tdd_num_available_freq_Bands); - int j; - for (j=0; - jnr_mode_info[i].tdd.nr_band; // - - /* TDD.1.3.2 supportedSULBandList*/ - int num_available_supported_SULBands = f1ap_du_data->nr_mode_info[i].tdd.num_sul_frequency_bands; - LOG_D(F1AP, "num_available_supported_SULBands = %d \n", num_available_supported_SULBands); - int k; - for (k=0; - knr_mode_info[i].tdd.nr_sul_band; // - ASN_SEQUENCE_ADD(&nr_freqBandNrItem.supportedSULBandList.list, &nr_supportedSULFreqBandItem); - } // for TDD : supported_SULBands - ASN_SEQUENCE_ADD(&tDD_Info->nRFreqInfo.freqBandListNr.list, &nr_freqBandNrItem); - } // for TDD : freq_Bands - - /* TDD.2 transmission_Bandwidth */ - tDD_Info->transmission_Bandwidth.nRSCS = f1ap_du_data->nr_mode_info[i].tdd.scs; - tDD_Info->transmission_Bandwidth.nRNRB = to_NRNRB(f1ap_du_data->nr_mode_info[i].tdd.nrb); - - nR_Mode_Info.choice.tDD = tDD_Info; - } // if nR_Mode_Info - - served_cell_information.nR_Mode_Info = nR_Mode_Info; - - /* - measurementTimingConfiguration */ - char *measurementTimingConfiguration = f1ap_du_data->measurement_timing_information[i]; // sept. 2018 - - OCTET_STRING_fromBuf(&served_cell_information.measurementTimingConfiguration, - measurementTimingConfiguration, - strlen(measurementTimingConfiguration)); - gnb_du_served_cells_item.served_Cell_Information = served_cell_information; // - - /* 4.1.2 gNB-DU System Information */ - F1AP_GNB_DU_System_Information_t *gNB_DU_System_Information = (F1AP_GNB_DU_System_Information_t *)calloc(1, sizeof(F1AP_GNB_DU_System_Information_t)); - - OCTET_STRING_fromBuf(&gNB_DU_System_Information->mIB_message, // sept. 2018 - (const char*)f1ap_du_data->mib[i],//f1ap_du_data->mib, - f1ap_du_data->mib_length[i]); - - OCTET_STRING_fromBuf(&gNB_DU_System_Information->sIB1_message, // sept. 2018 - (const char*)f1ap_du_data->sib1[i], - f1ap_du_data->sib1_length[i]); - - gnb_du_served_cells_item.gNB_DU_System_Information = gNB_DU_System_Information; // - - /* ADD */ - gnb_du_served_cell_list_item_ies->value.choice.GNB_DU_Served_Cells_Item = gnb_du_served_cells_item; - - ASN_SEQUENCE_ADD(&ie->value.choice.GNB_DU_Served_Cells_List.list, - gnb_du_served_cell_list_item_ies); + /* - measurementTimingConfiguration */ + char *measurementTimingConfiguration = f1ap_du_data->measurement_timing_information[i]; // sept. 2018 + OCTET_STRING_fromBuf(&served_cell_information->measurementTimingConfiguration, + measurementTimingConfiguration, + strlen(measurementTimingConfiguration)); + asn1cCalloc(gnb_du_served_cells_item->gNB_DU_System_Information, F1AP_GNB_DU_System_Information_t, gNB_DU_System_Information); + /* 4.1.2 gNB-DU System Information */ + OCTET_STRING_fromBuf(&gNB_DU_System_Information->mIB_message, // sept. 2018 + (const char *)f1ap_du_data->mib[i], //f1ap_du_data->mib, + f1ap_du_data->mib_length[i]); + OCTET_STRING_fromBuf(&gNB_DU_System_Information->sIB1_message, // sept. 2018 + (const char *)f1ap_du_data->sib1[i], + f1ap_du_data->sib1_length[i]); } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ /* c5. RRC VERSION */ - ie = (F1AP_F1SetupRequestIEs_t *)calloc(1, sizeof(F1AP_F1SetupRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_GNB_DU_RRC_Version; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_F1SetupRequestIEs__value_PR_RRC_Version; - ie->value.choice.RRC_Version.latest_RRC_Version.buf=calloc(1,sizeof(char)); - ie->value.choice.RRC_Version.latest_RRC_Version.buf[0] = 0xe0; - ie->value.choice.RRC_Version.latest_RRC_Version.size = 1; - ie->value.choice.RRC_Version.latest_RRC_Version.bits_unused = 5; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + asn1cSequenceAdd(f1Setup->protocolIEs.list, F1AP_F1SetupRequestIEs_t, ie2); + ie2->id = F1AP_ProtocolIE_ID_id_GNB_DU_RRC_Version; + ie2->criticality = F1AP_Criticality_reject; + ie2->value.present = F1AP_F1SetupRequestIEs__value_PR_RRC_Version; + ie2->value.choice.RRC_Version.latest_RRC_Version.buf=calloc(1,sizeof(char)); + ie2->value.choice.RRC_Version.latest_RRC_Version.buf[0] = 0xe0; + ie2->value.choice.RRC_Version.latest_RRC_Version.size = 1; + ie2->value.choice.RRC_Version.latest_RRC_Version.bits_unused = 5; /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { @@ -420,98 +334,82 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { return -1; } - MSC_LOG_TX_MESSAGE( - MSC_F1AP_DU, - MSC_F1AP_CU, - (const char *)buffer, - len, - MSC_AS_TIME_FMT" F1_SETUP_REQUEST initiatingMessage gNB_DU_name %s", - 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - f1ap_du_data->gNB_DU_name); - + ASN_STRUCT_RESET(asn_DEF_F1AP_F1AP_PDU, &pdu); du_f1ap_itti_send_sctp_data_req(instance, f1ap_du_data->assoc_id, buffer, len, 0); - return 0; } int DU_handle_F1_SETUP_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) -{ - + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { LOG_D(F1AP, "DU_handle_F1_SETUP_RESPONSE\n"); - AssertFatal(pdu->present == F1AP_F1AP_PDU_PR_successfulOutcome, - "pdu->present != F1AP_F1AP_PDU_PR_successfulOutcome\n"); + "pdu->present != F1AP_F1AP_PDU_PR_successfulOutcome\n"); AssertFatal(pdu->choice.successfulOutcome->procedureCode == F1AP_ProcedureCode_id_F1Setup, - "pdu->choice.successfulOutcome->procedureCode != F1AP_ProcedureCode_id_F1Setup\n"); + "pdu->choice.successfulOutcome->procedureCode != F1AP_ProcedureCode_id_F1Setup\n"); AssertFatal(pdu->choice.successfulOutcome->criticality == F1AP_Criticality_reject, - "pdu->choice.successfulOutcome->criticality != F1AP_Criticality_reject\n"); + "pdu->choice.successfulOutcome->criticality != F1AP_Criticality_reject\n"); AssertFatal(pdu->choice.successfulOutcome->value.present == F1AP_SuccessfulOutcome__value_PR_F1SetupResponse, - "pdu->choice.successfulOutcome->value.present != F1AP_SuccessfulOutcome__value_PR_F1SetupResponse\n"); - + "pdu->choice.successfulOutcome->value.present != F1AP_SuccessfulOutcome__value_PR_F1SetupResponse\n"); F1AP_F1SetupResponse_t *in = &pdu->choice.successfulOutcome->value.choice.F1SetupResponse; - - F1AP_F1SetupResponseIEs_t *ie; int TransactionId = -1; int num_cells_to_activate = 0; F1AP_Cells_to_be_Activated_List_Item_t *cell; - MessageDef *msg_p = itti_alloc_new_message (TASK_DU_F1, 0, F1AP_SETUP_RESP); - LOG_D(F1AP, "F1AP: F1Setup-Resp: protocolIEs.list.count %d\n", in->protocolIEs.list.count); - for (int i=0;i < in->protocolIEs.list.count; i++) { + + for (int i=0; i < in->protocolIEs.list.count; i++) { ie = in->protocolIEs.list.array[i]; + switch (ie->id) { case F1AP_ProtocolIE_ID_id_TransactionID: AssertFatal(ie->criticality == F1AP_Criticality_reject, - "ie->criticality != F1AP_Criticality_reject\n"); + "ie->criticality != F1AP_Criticality_reject\n"); AssertFatal(ie->value.present == F1AP_F1SetupResponseIEs__value_PR_TransactionID, - "ie->value.present != F1AP_F1SetupResponseIEs__value_PR_TransactionID\n"); + "ie->value.present != F1AP_F1SetupResponseIEs__value_PR_TransactionID\n"); TransactionId=ie->value.choice.TransactionID; LOG_D(F1AP, "F1AP: F1Setup-Resp: TransactionId %d\n", TransactionId); break; + case F1AP_ProtocolIE_ID_id_gNB_CU_Name: AssertFatal(ie->criticality == F1AP_Criticality_ignore, - "ie->criticality != F1AP_Criticality_ignore\n"); + "ie->criticality != F1AP_Criticality_ignore\n"); AssertFatal(ie->value.present == F1AP_F1SetupResponseIEs__value_PR_GNB_CU_Name, - "ie->value.present != F1AP_F1SetupResponseIEs__value_PR_TransactionID\n"); + "ie->value.present != F1AP_F1SetupResponseIEs__value_PR_TransactionID\n"); F1AP_SETUP_RESP (msg_p).gNB_CU_name = malloc(ie->value.choice.GNB_CU_Name.size+1); memcpy(F1AP_SETUP_RESP (msg_p).gNB_CU_name,ie->value.choice.GNB_CU_Name.buf,ie->value.choice.GNB_CU_Name.size); F1AP_SETUP_RESP (msg_p).gNB_CU_name[ie->value.choice.GNB_CU_Name.size]='\0'; LOG_D(F1AP, "F1AP: F1Setup-Resp: gNB_CU_name %s\n", F1AP_SETUP_RESP (msg_p).gNB_CU_name); break; + case F1AP_ProtocolIE_ID_id_GNB_CU_RRC_Version: LOG_D(F1AP, "F1AP: Received GNB-CU-RRC-Version, ignoring\n"); break; - case F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List: - { + + case F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List: { AssertFatal(ie->criticality == F1AP_Criticality_reject, - "ie->criticality != F1AP_Criticality_reject\n"); + "ie->criticality != F1AP_Criticality_reject\n"); AssertFatal(ie->value.present == F1AP_F1SetupResponseIEs__value_PR_Cells_to_be_Activated_List, - "ie->value.present != F1AP_F1SetupResponseIEs__value_PR_Cells_to_be_Activated_List\n"); + "ie->value.present != F1AP_F1SetupResponseIEs__value_PR_Cells_to_be_Activated_List\n"); num_cells_to_activate = ie->value.choice.Cells_to_be_Activated_List.list.count; LOG_D(F1AP, "F1AP: Activating %d cells\n",num_cells_to_activate); - for (int i=0;ivalue.choice.Cells_to_be_Activated_List.list.array[i]; - AssertFatal(cells_to_be_activated_list_item_ies->id == F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item, - "cells_to_be_activated_list_item_ies->id != F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item"); + "cells_to_be_activated_list_item_ies->id != F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item"); AssertFatal(cells_to_be_activated_list_item_ies->criticality == F1AP_Criticality_reject, - "cells_to_be_activated_list_item_ies->criticality == F1AP_Criticality_reject"); + "cells_to_be_activated_list_item_ies->criticality == F1AP_Criticality_reject"); AssertFatal(cells_to_be_activated_list_item_ies->value.present == F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item, - "cells_to_be_activated_list_item_ies->value.present == F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item"); - + "cells_to_be_activated_list_item_ies->value.present == F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item"); cell = &cells_to_be_activated_list_item_ies->value.choice.Cells_to_be_Activated_List_Item; - - TBCD_TO_MCC_MNC(&cell->nRCGI.pLMN_Identity, F1AP_SETUP_RESP (msg_p).cells_to_activate[i].mcc, F1AP_SETUP_RESP (msg_p).cells_to_activate[i].mnc, F1AP_SETUP_RESP (msg_p).cells_to_activate[i].mnc_digit_length); - + TBCD_TO_MCC_MNC(&cell->nRCGI.pLMN_Identity, F1AP_SETUP_RESP (msg_p).cells_to_activate[i].mcc, F1AP_SETUP_RESP (msg_p).cells_to_activate[i].mnc, + F1AP_SETUP_RESP (msg_p).cells_to_activate[i].mnc_digit_length); LOG_D(F1AP, "nr_cellId : %x %x %x %x %x\n", cell->nRCGI.nRCellIdentity.buf[0], cell->nRCGI.nRCellIdentity.buf[1], @@ -519,60 +417,70 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, cell->nRCGI.nRCellIdentity.buf[3], cell->nRCGI.nRCellIdentity.buf[4]); BIT_STRING_TO_NR_CELL_IDENTITY(&cell->nRCGI.nRCellIdentity, - F1AP_SETUP_RESP (msg_p).cells_to_activate[i].nr_cellid); - F1AP_ProtocolExtensionContainer_154P112_t *ext = (F1AP_ProtocolExtensionContainer_154P112_t *)cell->iE_Extensions; - if (ext==NULL) continue; + F1AP_SETUP_RESP (msg_p).cells_to_activate[i].nr_cellid); + F1AP_ProtocolExtensionContainer_154P112_t *ext = (F1AP_ProtocolExtensionContainer_154P112_t *)cell->iE_Extensions; - for (int cnt=0;cntlist.count;cnt++) { + if (ext==NULL) + continue; + + for (int cnt=0; cntlist.count; cnt++) { F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *cells_to_be_activated_list_itemExtIEs=(F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *)ext->list.array[cnt]; + switch (cells_to_be_activated_list_itemExtIEs->id) { - /* - case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_NOTHING: - case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_GNB_CUSystemInformation, - case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_AvailablePLMNList, - case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_ExtendedAvailablePLMN_List, - case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_IAB_Info_IAB_donor_CU, - case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_AvailableSNPN_ID_List - */ - case F1AP_ProtocolIE_ID_id_gNB_CUSystemInformation: - { + /* + case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_NOTHING: + case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_GNB_CUSystemInformation, + case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_AvailablePLMNList, + case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_ExtendedAvailablePLMN_List, + case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_IAB_Info_IAB_donor_CU, + case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_AvailableSNPN_ID_List + */ + case F1AP_ProtocolIE_ID_id_gNB_CUSystemInformation: { F1AP_SETUP_RESP (msg_p).cells_to_activate[i].nrpci = (cell->nRPCI != NULL) ? *cell->nRPCI : 0; - F1AP_GNB_CUSystemInformation_t *gNB_CUSystemInformation = (F1AP_GNB_CUSystemInformation_t*)&cells_to_be_activated_list_itemExtIEs->extensionValue.choice.GNB_CUSystemInformation; + F1AP_GNB_CUSystemInformation_t *gNB_CUSystemInformation = (F1AP_GNB_CUSystemInformation_t *)&cells_to_be_activated_list_itemExtIEs->extensionValue.choice.GNB_CUSystemInformation; F1AP_SETUP_RESP (msg_p).cells_to_activate[i].num_SI = gNB_CUSystemInformation->sibtypetobeupdatedlist.list.count; AssertFatal(ext->list.count==1,"At least one SI message should be there, and only 1 for now!\n"); LOG_D(F1AP, "F1AP: Cell %d MCC %d MNC %d NRCellid %lx num_si %d\n", i, F1AP_SETUP_RESP (msg_p).cells_to_activate[i].mcc, F1AP_SETUP_RESP (msg_p).cells_to_activate[i].mnc, F1AP_SETUP_RESP (msg_p).cells_to_activate[i].nr_cellid, F1AP_SETUP_RESP (msg_p).cells_to_activate[i].num_SI); - for (int si = 0;si < gNB_CUSystemInformation->sibtypetobeupdatedlist.list.count;si++) { + + for (int si = 0; si < gNB_CUSystemInformation->sibtypetobeupdatedlist.list.count; si++) { F1AP_SibtypetobeupdatedListItem_t *sib_item = gNB_CUSystemInformation->sibtypetobeupdatedlist.list.array[si]; size_t size = sib_item->sIBmessage.size; F1AP_SETUP_RESP (msg_p).cells_to_activate[i].SI_container_length[si] = size; LOG_D(F1AP, "F1AP: SI_container_length[%d][%d] %ld bytes\n", i, (int)sib_item->sIBtype, size); F1AP_SETUP_RESP (msg_p).cells_to_activate[i].SI_container[si] = malloc(F1AP_SETUP_RESP (msg_p).cells_to_activate[i].SI_container_length[si]); - memcpy((void*)F1AP_SETUP_RESP (msg_p).cells_to_activate[i].SI_container[si], - (void*)sib_item->sIBmessage.buf, - size); + memcpy((void *)F1AP_SETUP_RESP (msg_p).cells_to_activate[i].SI_container[si], + (void *)sib_item->sIBmessage.buf, + size); } + break; } + case F1AP_ProtocolIE_ID_id_AvailablePLMNList: AssertFatal(1==0,"F1AP_ProtocolIE_ID_id_AvailablePLMNList not supported yet\n"); break; + case F1AP_ProtocolIE_ID_id_ExtendedAvailablePLMN_List: AssertFatal(1==0,"F1AP_ProtocolIE_ID_id_AvailablePLMNList not supported yet\n"); break; + case F1AP_ProtocolIE_ID_id_IAB_Info_IAB_donor_CU: AssertFatal(1==0,"F1AP_ProtocolIE_ID_id_AvailablePLMNList not supported yet\n"); break; + case F1AP_ProtocolIE_ID_id_AvailableSNPN_ID_List: AssertFatal(1==0,"F1AP_ProtocolIE_ID_id_AvailablePLMNList not supported yet\n"); break; + default: AssertFatal(1==0,"F1AP_ProtocolIE_ID_id %d unknown\n",(int)cells_to_be_activated_list_itemExtIEs->id); break; } } // for (cnt=... } // for (cells_to_activate... + break; } // case F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List @@ -581,30 +489,32 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, break; } // switch ie } // for IE + AssertFatal(TransactionId!=-1,"TransactionId was not sent\n"); LOG_D(F1AP,"F1AP: num_cells_to_activate %d\n",num_cells_to_activate); F1AP_SETUP_RESP (msg_p).num_cells_to_activate = num_cells_to_activate; + // tmp // F1AP_SETUP_RESP (msg_p).num_SI[0] = 1; - for (int i=0;i 0, "System Information %d is missing",i); MSC_LOG_RX_MESSAGE( - MSC_F1AP_DU, - MSC_F1AP_CU, - 0, - 0, - MSC_AS_TIME_FMT" DU_handle_F1_SETUP_RESPONSE successfulOutcome assoc_id %d", - 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - assoc_id); + MSC_F1AP_DU, + MSC_F1AP_CU, + 0, + 0, + MSC_AS_TIME_FMT" DU_handle_F1_SETUP_RESPONSE successfulOutcome assoc_id %d", + 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), + assoc_id); if (RC.nrrrc[0]->node_type == ngran_gNB_DU) { LOG_D(F1AP, "Sending F1AP_SETUP_RESP ITTI message to GNB_APP with assoc_id (%d->%d)\n", - assoc_id,ENB_MODULE_ID_TO_INSTANCE(assoc_id)); + assoc_id,ENB_MODULE_ID_TO_INSTANCE(assoc_id)); itti_send_msg_to_task(TASK_GNB_APP, GNB_MODULE_ID_TO_INSTANCE(assoc_id), msg_p); } else { LOG_D(F1AP, "Sending F1AP_SETUP_RESP ITTI message to ENB_APP with assoc_id (%d->%d)\n", - assoc_id,ENB_MODULE_ID_TO_INSTANCE(assoc_id)); + assoc_id,ENB_MODULE_ID_TO_INSTANCE(assoc_id)); itti_send_msg_to_task(TASK_ENB_APP, ENB_MODULE_ID_TO_INSTANCE(assoc_id), msg_p); } @@ -617,24 +527,20 @@ int DU_handle_F1_SETUP_FAILURE(instance_t instance, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { LOG_E(F1AP, "DU_handle_F1_SETUP_FAILURE\n"); - F1AP_F1SetupFailure_t *out; F1AP_F1SetupFailureIEs_t *ie; - out = &pdu->choice.unsuccessfulOutcome->value.choice.F1SetupFailure; - /* Transaction ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupFailureIEs_t, ie, out, - F1AP_ProtocolIE_ID_id_TransactionID, true); - + F1AP_ProtocolIE_ID_id_TransactionID, true); /* Cause */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupFailureIEs_t, ie, out, - F1AP_ProtocolIE_ID_id_Cause, true); + F1AP_ProtocolIE_ID_id_Cause, true); if(0) { /* TimeToWait */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupFailureIEs_t, ie, out, - F1AP_ProtocolIE_ID_id_TimeToWait, true); + F1AP_ProtocolIE_ID_id_TimeToWait, true); } return 0; @@ -647,17 +553,15 @@ int DU_handle_F1_SETUP_FAILURE(instance_t instance, //void DU_send_gNB_DU_CONFIGURATION_UPDATE(F1AP_GNBDUConfigurationUpdate_t *GNBDUConfigurationUpdate) { int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, - instance_t du_mod_idP, - f1ap_setup_req_t *f1ap_setup_req) { + instance_t du_mod_idP, + f1ap_setup_req_t *f1ap_setup_req) { F1AP_F1AP_PDU_t pdu; F1AP_GNBDUConfigurationUpdate_t *out; F1AP_GNBDUConfigurationUpdateIEs_t *ie; - uint8_t *buffer; uint32_t len; int i = 0; int j = 0; - /* Create */ /* 0. Message Type */ memset(&pdu, 0, sizeof(pdu)); @@ -667,7 +571,6 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, pdu.choice.initiatingMessage->criticality = F1AP_Criticality_reject; pdu.choice.initiatingMessage->value.present = F1AP_InitiatingMessage__value_PR_GNBDUConfigurationUpdate; out = &pdu.choice.initiatingMessage->value.choice.GNBDUConfigurationUpdate; - /* mandatory */ /* c1. Transaction ID (integer value) */ ie = (F1AP_GNBDUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBDUConfigurationUpdateIEs_t)); @@ -676,8 +579,6 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, ie->value.present = F1AP_GNBDUConfigurationUpdateIEs__value_PR_TransactionID; ie->value.choice.TransactionID = F1AP_get_next_transaction_identifier(instance, du_mod_idP); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - /* mandatory */ /* c2. Served_Cells_To_Add */ ie = (F1AP_GNBDUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBDUConfigurationUpdateIEs_t)); @@ -688,158 +589,124 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, for (j=0; j<1; j++) { - // - F1AP_Served_Cells_To_Add_ItemIEs_t *served_cells_to_add_item_ies; - served_cells_to_add_item_ies = (F1AP_Served_Cells_To_Add_ItemIEs_t *)calloc(1, sizeof(F1AP_Served_Cells_To_Add_ItemIEs_t)); - served_cells_to_add_item_ies->id = F1AP_ProtocolIE_ID_id_Served_Cells_To_Add_Item; - served_cells_to_add_item_ies->criticality = F1AP_Criticality_reject; - served_cells_to_add_item_ies->value.present = F1AP_Served_Cells_To_Add_ItemIEs__value_PR_Served_Cells_To_Add_Item; - - F1AP_Served_Cells_To_Add_Item_t served_cells_to_add_item; - memset((void *)&served_cells_to_add_item, 0, sizeof(F1AP_Served_Cells_To_Add_Item_t)); + // + F1AP_Served_Cells_To_Add_ItemIEs_t *served_cells_to_add_item_ies; + served_cells_to_add_item_ies = (F1AP_Served_Cells_To_Add_ItemIEs_t *)calloc(1, sizeof(F1AP_Served_Cells_To_Add_ItemIEs_t)); + served_cells_to_add_item_ies->id = F1AP_ProtocolIE_ID_id_Served_Cells_To_Add_Item; + served_cells_to_add_item_ies->criticality = F1AP_Criticality_reject; + served_cells_to_add_item_ies->value.present = F1AP_Served_Cells_To_Add_ItemIEs__value_PR_Served_Cells_To_Add_Item; + F1AP_Served_Cells_To_Add_Item_t served_cells_to_add_item; + memset((void *)&served_cells_to_add_item, 0, sizeof(F1AP_Served_Cells_To_Add_Item_t)); + /* 2.1.1 serverd cell Information */ + F1AP_Served_Cell_Information_t served_cell_information; + memset((void *)&served_cell_information, 0, sizeof(F1AP_Served_Cell_Information_t)); + /* - nRCGI */ + F1AP_NRCGI_t nRCGI; + memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t)); + MCC_MNC_TO_PLMNID(f1ap_setup_req->mcc[i], f1ap_setup_req->mnc[i], f1ap_setup_req->mnc_digit_length[i], &nRCGI.pLMN_Identity); + LOG_D(F1AP, "nr_cellId : %x %x %x %x %x\n", + nRCGI.nRCellIdentity.buf[0], + nRCGI.nRCellIdentity.buf[1], + nRCGI.nRCellIdentity.buf[2], + nRCGI.nRCellIdentity.buf[3], + nRCGI.nRCellIdentity.buf[4]); + NR_CELL_ID_TO_BIT_STRING(f1ap_setup_req->nr_cellid[i], &nRCGI.nRCellIdentity); + served_cell_information.nRCGI = nRCGI; + /* - nRPCI */ + served_cell_information.nRPCI = f1ap_setup_req->nr_pci[i]; // int 0..1007 + /* - fiveGS_TAC */ + uint32_t tac=htonl(f1ap_du_data->tac[i]); + served_cell_information.fiveGS_TAC=(F1AP_FiveGS_TAC_t *) calloc(1,sizeof(F1AP_FiveGS_TAC_t *)); + OCTET_STRING_fromBuf(served_cell_information.fiveGS_TAC, ((char *)&tac)+1, 3); - /* 2.1.1 serverd cell Information */ - F1AP_Served_Cell_Information_t served_cell_information; + /* - Configured_EPS_TAC */ + if(1) { + served_cell_information.configured_EPS_TAC = (F1AP_Configured_EPS_TAC_t *)calloc(1, sizeof(F1AP_Configured_EPS_TAC_t)); + OCTET_STRING_fromBuf(served_cell_information.configured_EPS_TAC, + "2", + 2); + } - memset((void *)&served_cell_information, 0, sizeof(F1AP_Served_Cell_Information_t)); - /* - nRCGI */ - F1AP_NRCGI_t nRCGI; - memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t)); - MCC_MNC_TO_PLMNID(f1ap_setup_req->mcc[i], f1ap_setup_req->mnc[i], f1ap_setup_req->mnc_digit_length[i], &nRCGI.pLMN_Identity); - LOG_D(F1AP, "nr_cellId : %x %x %x %x %x\n", - nRCGI.nRCellIdentity.buf[0], - nRCGI.nRCellIdentity.buf[1], - nRCGI.nRCellIdentity.buf[2], - nRCGI.nRCellIdentity.buf[3], - nRCGI.nRCellIdentity.buf[4]); - NR_CELL_ID_TO_BIT_STRING(f1ap_setup_req->nr_cellid[i], &nRCGI.nRCellIdentity); - served_cell_information.nRCGI = nRCGI; + F1AP_ServedPLMNs_Item_t *servedPLMN_item = calloc(1,sizeof(*servedPLMN_item)); + memset(servedPLMN_item,0,sizeof(*servedPLMN_item)); + MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &servedPLMN_item->pLMN_Identity); + ASN_SEQUENCE_ADD(&served_cell_information.servedPLMNs.list, servedPLMN_item); + // // /* - CHOICE NR-MODE-Info */ + F1AP_NR_Mode_Info_t nR_Mode_Info; - /* - nRPCI */ - served_cell_information.nRPCI = f1ap_setup_req->nr_pci[i]; // int 0..1007 - - /* - fiveGS_TAC */ - uint8_t fiveGS_TAC[3]; - fiveGS_TAC[0] = ((uint8_t*)&f1ap_setup_req->tac[i])[2]; - fiveGS_TAC[1] = ((uint8_t*)&f1ap_setup_req->tac[i])[1]; - fiveGS_TAC[2] = ((uint8_t*)&f1ap_setup_req->tac[i])[0]; - OCTET_STRING_fromBuf(served_cell_information.fiveGS_TAC, - (const char *)fiveGS_TAC, - 3); - - /* - Configured_EPS_TAC */ - if(1){ - served_cell_information.configured_EPS_TAC = (F1AP_Configured_EPS_TAC_t *)calloc(1, sizeof(F1AP_Configured_EPS_TAC_t)); - OCTET_STRING_fromBuf(served_cell_information.configured_EPS_TAC, - "2", - 2); - } - - F1AP_ServedPLMNs_Item_t *servedPLMN_item = calloc(1,sizeof(*servedPLMN_item)); - memset(servedPLMN_item,0,sizeof(*servedPLMN_item)); - MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &servedPLMN_item->pLMN_Identity); - ASN_SEQUENCE_ADD(&served_cell_information.servedPLMNs.list, servedPLMN_item); - - - // // /* - CHOICE NR-MODE-Info */ - F1AP_NR_Mode_Info_t nR_Mode_Info; - - if (f1ap_setup_req->fdd_flag) { - nR_Mode_Info.present = F1AP_NR_Mode_Info_PR_fDD; - /* > FDD >> FDD Info */ - F1AP_FDD_Info_t *fDD_Info = (F1AP_FDD_Info_t *)calloc(1, sizeof(F1AP_FDD_Info_t)); - /* >>> UL NRFreqInfo */ - fDD_Info->uL_NRFreqInfo.nRARFCN = 999L; - - F1AP_FreqBandNrItem_t ul_freqBandNrItem; - memset((void *)&ul_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); - ul_freqBandNrItem.freqBandIndicatorNr = 888L; - - F1AP_SupportedSULFreqBandItem_t ul_supportedSULFreqBandItem; - memset((void *)&ul_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); - ul_supportedSULFreqBandItem.freqBandIndicatorNr = 777L; - ASN_SEQUENCE_ADD(&ul_freqBandNrItem.supportedSULBandList.list, &ul_supportedSULFreqBandItem); - - ASN_SEQUENCE_ADD(&fDD_Info->uL_NRFreqInfo.freqBandListNr.list, &ul_freqBandNrItem); - - /* >>> DL NRFreqInfo */ - fDD_Info->dL_NRFreqInfo.nRARFCN = 666L; - - F1AP_FreqBandNrItem_t dl_freqBandNrItem; - memset((void *)&dl_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); - dl_freqBandNrItem.freqBandIndicatorNr = 555L; - - F1AP_SupportedSULFreqBandItem_t dl_supportedSULFreqBandItem; - memset((void *)&dl_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); - dl_supportedSULFreqBandItem.freqBandIndicatorNr = 444L; - ASN_SEQUENCE_ADD(&dl_freqBandNrItem.supportedSULBandList.list, &dl_supportedSULFreqBandItem); - - ASN_SEQUENCE_ADD(&fDD_Info->dL_NRFreqInfo.freqBandListNr.list, &dl_freqBandNrItem); - - /* >>> UL Transmission Bandwidth */ - fDD_Info->uL_Transmission_Bandwidth.nRSCS = F1AP_NRSCS_scs15; - fDD_Info->uL_Transmission_Bandwidth.nRNRB = F1AP_NRNRB_nrb11; - /* >>> DL Transmission Bandwidth */ - fDD_Info->dL_Transmission_Bandwidth.nRSCS = F1AP_NRSCS_scs15; - fDD_Info->dL_Transmission_Bandwidth.nRNRB = F1AP_NRNRB_nrb11; - - nR_Mode_Info.choice.fDD = fDD_Info; - } else { // TDD - nR_Mode_Info.present = F1AP_NR_Mode_Info_PR_tDD; - - /* > TDD >> TDD Info */ - F1AP_TDD_Info_t *tDD_Info = (F1AP_TDD_Info_t *)calloc(1, sizeof(F1AP_TDD_Info_t)); - /* >>> ARFCN */ - tDD_Info->nRFreqInfo.nRARFCN = 999L; // Integer - F1AP_FreqBandNrItem_t nr_freqBandNrItem; - memset((void *)&nr_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); - nr_freqBandNrItem.freqBandIndicatorNr = 555L; - - F1AP_SupportedSULFreqBandItem_t nr_supportedSULFreqBandItem; - memset((void *)&nr_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); - nr_supportedSULFreqBandItem.freqBandIndicatorNr = 444L; - ASN_SEQUENCE_ADD(&nr_freqBandNrItem.supportedSULBandList.list, &nr_supportedSULFreqBandItem); - - ASN_SEQUENCE_ADD(&tDD_Info->nRFreqInfo.freqBandListNr.list, &nr_freqBandNrItem); - - tDD_Info->transmission_Bandwidth.nRSCS= F1AP_NRSCS_scs15; - tDD_Info->transmission_Bandwidth.nRNRB= F1AP_NRNRB_nrb11; - - nR_Mode_Info.choice.tDD = tDD_Info; - } - - served_cell_information.nR_Mode_Info = nR_Mode_Info; - - /* - measurementTimingConfiguration */ - char *measurementTimingConfiguration = "0"; // sept. 2018 - - OCTET_STRING_fromBuf(&served_cell_information.measurementTimingConfiguration, - measurementTimingConfiguration, - strlen(measurementTimingConfiguration)); - served_cells_to_add_item.served_Cell_Information = served_cell_information; // - - /* 2.1.2 gNB-DU System Information */ - F1AP_GNB_DU_System_Information_t *gNB_DU_System_Information = (F1AP_GNB_DU_System_Information_t *)calloc(1, sizeof(F1AP_GNB_DU_System_Information_t)); - - OCTET_STRING_fromBuf(&gNB_DU_System_Information->mIB_message, // sept. 2018 - "1", - sizeof("1")); - - OCTET_STRING_fromBuf(&gNB_DU_System_Information->sIB1_message, // sept. 2018 - "1", - sizeof("1")); - served_cells_to_add_item.gNB_DU_System_Information = gNB_DU_System_Information; // - - /* ADD */ - served_cells_to_add_item_ies->value.choice.Served_Cells_To_Add_Item = served_cells_to_add_item; - - ASN_SEQUENCE_ADD(&ie->value.choice.Served_Cells_To_Add_List.list, - served_cells_to_add_item_ies); + if (f1ap_setup_req->fdd_flag) { + nR_Mode_Info.present = F1AP_NR_Mode_Info_PR_fDD; + /* > FDD >> FDD Info */ + F1AP_FDD_Info_t *fDD_Info = (F1AP_FDD_Info_t *)calloc(1, sizeof(F1AP_FDD_Info_t)); + /* >>> UL NRFreqInfo */ + fDD_Info->uL_NRFreqInfo.nRARFCN = 999L; + F1AP_FreqBandNrItem_t ul_freqBandNrItem; + memset((void *)&ul_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); + ul_freqBandNrItem.freqBandIndicatorNr = 888L; + F1AP_SupportedSULFreqBandItem_t ul_supportedSULFreqBandItem; + memset((void *)&ul_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); + ul_supportedSULFreqBandItem.freqBandIndicatorNr = 777L; + ASN_SEQUENCE_ADD(&ul_freqBandNrItem.supportedSULBandList.list, &ul_supportedSULFreqBandItem); + ASN_SEQUENCE_ADD(&fDD_Info->uL_NRFreqInfo.freqBandListNr.list, &ul_freqBandNrItem); + /* >>> DL NRFreqInfo */ + fDD_Info->dL_NRFreqInfo.nRARFCN = 666L; + F1AP_FreqBandNrItem_t dl_freqBandNrItem; + memset((void *)&dl_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); + dl_freqBandNrItem.freqBandIndicatorNr = 555L; + F1AP_SupportedSULFreqBandItem_t dl_supportedSULFreqBandItem; + memset((void *)&dl_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); + dl_supportedSULFreqBandItem.freqBandIndicatorNr = 444L; + ASN_SEQUENCE_ADD(&dl_freqBandNrItem.supportedSULBandList.list, &dl_supportedSULFreqBandItem); + ASN_SEQUENCE_ADD(&fDD_Info->dL_NRFreqInfo.freqBandListNr.list, &dl_freqBandNrItem); + /* >>> UL Transmission Bandwidth */ + fDD_Info->uL_Transmission_Bandwidth.nRSCS = F1AP_NRSCS_scs15; + fDD_Info->uL_Transmission_Bandwidth.nRNRB = F1AP_NRNRB_nrb11; + /* >>> DL Transmission Bandwidth */ + fDD_Info->dL_Transmission_Bandwidth.nRSCS = F1AP_NRSCS_scs15; + fDD_Info->dL_Transmission_Bandwidth.nRNRB = F1AP_NRNRB_nrb11; + nR_Mode_Info.choice.fDD = fDD_Info; + } else { // TDD + nR_Mode_Info.present = F1AP_NR_Mode_Info_PR_tDD; + /* > TDD >> TDD Info */ + F1AP_TDD_Info_t *tDD_Info = (F1AP_TDD_Info_t *)calloc(1, sizeof(F1AP_TDD_Info_t)); + /* >>> ARFCN */ + tDD_Info->nRFreqInfo.nRARFCN = 999L; // Integer + F1AP_FreqBandNrItem_t nr_freqBandNrItem; + memset((void *)&nr_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); + nr_freqBandNrItem.freqBandIndicatorNr = 555L; + F1AP_SupportedSULFreqBandItem_t nr_supportedSULFreqBandItem; + memset((void *)&nr_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); + nr_supportedSULFreqBandItem.freqBandIndicatorNr = 444L; + ASN_SEQUENCE_ADD(&nr_freqBandNrItem.supportedSULBandList.list, &nr_supportedSULFreqBandItem); + ASN_SEQUENCE_ADD(&tDD_Info->nRFreqInfo.freqBandListNr.list, &nr_freqBandNrItem); + tDD_Info->transmission_Bandwidth.nRSCS= F1AP_NRSCS_scs15; + tDD_Info->transmission_Bandwidth.nRNRB= F1AP_NRNRB_nrb11; + nR_Mode_Info.choice.tDD = tDD_Info; + } + served_cell_information.nR_Mode_Info = nR_Mode_Info; + /* - measurementTimingConfiguration */ + char *measurementTimingConfiguration = "0"; // sept. 2018 + OCTET_STRING_fromBuf(&served_cell_information.measurementTimingConfiguration, + measurementTimingConfiguration, + strlen(measurementTimingConfiguration)); + served_cells_to_add_item.served_Cell_Information = served_cell_information; // + /* 2.1.2 gNB-DU System Information */ + F1AP_GNB_DU_System_Information_t *gNB_DU_System_Information = (F1AP_GNB_DU_System_Information_t *)calloc(1, sizeof(F1AP_GNB_DU_System_Information_t)); + OCTET_STRING_fromBuf(&gNB_DU_System_Information->mIB_message, // sept. 2018 + "1", + sizeof("1")); + OCTET_STRING_fromBuf(&gNB_DU_System_Information->sIB1_message, // sept. 2018 + "1", + sizeof("1")); + served_cells_to_add_item.gNB_DU_System_Information = gNB_DU_System_Information; // + /* ADD */ + served_cells_to_add_item_ies->value.choice.Served_Cells_To_Add_Item = served_cells_to_add_item; + ASN_SEQUENCE_ADD(&ie->value.choice.Served_Cells_To_Add_List.list, + served_cells_to_add_item_ies); } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - /* mandatory */ /* c3. Served_Cells_To_Modify */ ie = (F1AP_GNBDUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBDUConfigurationUpdateIEs_t)); @@ -850,160 +717,127 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, for (i=0; i<1; i++) { - // - F1AP_Served_Cells_To_Modify_ItemIEs_t *served_cells_to_modify_item_ies; - served_cells_to_modify_item_ies = (F1AP_Served_Cells_To_Modify_ItemIEs_t *)calloc(1, sizeof(F1AP_Served_Cells_To_Modify_ItemIEs_t)); - served_cells_to_modify_item_ies->id = F1AP_ProtocolIE_ID_id_Served_Cells_To_Modify_Item; - served_cells_to_modify_item_ies->criticality = F1AP_Criticality_reject; - served_cells_to_modify_item_ies->value.present = F1AP_Served_Cells_To_Modify_ItemIEs__value_PR_Served_Cells_To_Modify_Item; - - F1AP_Served_Cells_To_Modify_Item_t served_cells_to_modify_item; - memset((void *)&served_cells_to_modify_item, 0, sizeof(F1AP_Served_Cells_To_Modify_Item_t)); + // + F1AP_Served_Cells_To_Modify_ItemIEs_t *served_cells_to_modify_item_ies; + served_cells_to_modify_item_ies = (F1AP_Served_Cells_To_Modify_ItemIEs_t *)calloc(1, sizeof(F1AP_Served_Cells_To_Modify_ItemIEs_t)); + served_cells_to_modify_item_ies->id = F1AP_ProtocolIE_ID_id_Served_Cells_To_Modify_Item; + served_cells_to_modify_item_ies->criticality = F1AP_Criticality_reject; + served_cells_to_modify_item_ies->value.present = F1AP_Served_Cells_To_Modify_ItemIEs__value_PR_Served_Cells_To_Modify_Item; + F1AP_Served_Cells_To_Modify_Item_t served_cells_to_modify_item; + memset((void *)&served_cells_to_modify_item, 0, sizeof(F1AP_Served_Cells_To_Modify_Item_t)); + /* 3.1 oldNRCGI */ + F1AP_NRCGI_t oldNRCGI; + memset(&oldNRCGI, 0, sizeof(F1AP_NRCGI_t)); + MCC_MNC_TO_PLMNID(f1ap_setup_req->mcc[i], f1ap_setup_req->mnc[i], f1ap_setup_req->mnc_digit_length[i], + &oldNRCGI.pLMN_Identity); + NR_CELL_ID_TO_BIT_STRING(f1ap_setup_req->nr_cellid[i], &oldNRCGI.nRCellIdentity); + served_cells_to_modify_item.oldNRCGI = oldNRCGI; + /* 3.2.1 serverd cell Information */ + F1AP_Served_Cell_Information_t served_cell_information; + memset((void *)&served_cell_information, 0, sizeof(F1AP_Served_Cell_Information_t)); + /* - nRCGI */ + F1AP_NRCGI_t nRCGI; + memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t)); + MCC_MNC_TO_PLMNID(f1ap_setup_req->mcc[i], f1ap_setup_req->mnc[i], f1ap_setup_req->mnc_digit_length[i], + &nRCGI.pLMN_Identity); + NR_CELL_ID_TO_BIT_STRING(f1ap_setup_req->nr_cellid[i], &nRCGI.nRCellIdentity); + served_cell_information.nRCGI = nRCGI; + /* - nRPCI */ + served_cell_information.nRPCI = f1ap_setup_req->nr_pci[i]; // int 0..1007 + /* - fiveGS_TAC */ + served_cell_information.fiveGS_TAC=calloc(1,sizeof(*served_cell_information.fiveGS_TAC)); + OCTET_STRING_fromBuf(served_cell_information.fiveGS_TAC, + (const char *) &f1ap_setup_req->tac[i], + 3); - /* 3.1 oldNRCGI */ - F1AP_NRCGI_t oldNRCGI; - memset(&oldNRCGI, 0, sizeof(F1AP_NRCGI_t)); - MCC_MNC_TO_PLMNID(f1ap_setup_req->mcc[i], f1ap_setup_req->mnc[i], f1ap_setup_req->mnc_digit_length[i], - &oldNRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(f1ap_setup_req->nr_cellid[i], &oldNRCGI.nRCellIdentity); - served_cells_to_modify_item.oldNRCGI = oldNRCGI; + /* - Configured_EPS_TAC */ + if(1) { + served_cell_information.configured_EPS_TAC = (F1AP_Configured_EPS_TAC_t *)calloc(1, sizeof(F1AP_Configured_EPS_TAC_t)); + OCTET_STRING_fromBuf(served_cell_information.configured_EPS_TAC, + "2", + 2); + } + F1AP_ServedPLMNs_Item_t *servedPLMN_item = calloc(1,sizeof(*servedPLMN_item)); + memset(servedPLMN_item,0,sizeof(*servedPLMN_item)); + MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &servedPLMN_item->pLMN_Identity); + ASN_SEQUENCE_ADD(&served_cell_information.servedPLMNs.list, servedPLMN_item); + // // /* - CHOICE NR-MODE-Info */ + F1AP_NR_Mode_Info_t nR_Mode_Info; - /* 3.2.1 serverd cell Information */ - F1AP_Served_Cell_Information_t served_cell_information; - memset((void *)&served_cell_information, 0, sizeof(F1AP_Served_Cell_Information_t)); - - /* - nRCGI */ - F1AP_NRCGI_t nRCGI; - memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t)); - MCC_MNC_TO_PLMNID(f1ap_setup_req->mcc[i], f1ap_setup_req->mnc[i], f1ap_setup_req->mnc_digit_length[i], - &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(f1ap_setup_req->nr_cellid[i], &nRCGI.nRCellIdentity); - served_cell_information.nRCGI = nRCGI; - - /* - nRPCI */ - served_cell_information.nRPCI = f1ap_setup_req->nr_pci[i]; // int 0..1007 - - /* - fiveGS_TAC */ - served_cell_information.fiveGS_TAC=calloc(1,sizeof(*served_cell_information.fiveGS_TAC)); - OCTET_STRING_fromBuf(served_cell_information.fiveGS_TAC, - (const char *) &f1ap_setup_req->tac[i], - 3); - - /* - Configured_EPS_TAC */ - if(1){ - served_cell_information.configured_EPS_TAC = (F1AP_Configured_EPS_TAC_t *)calloc(1, sizeof(F1AP_Configured_EPS_TAC_t)); - OCTET_STRING_fromBuf(served_cell_information.configured_EPS_TAC, - "2", - 2); - } - - F1AP_ServedPLMNs_Item_t *servedPLMN_item = calloc(1,sizeof(*servedPLMN_item)); - memset(servedPLMN_item,0,sizeof(*servedPLMN_item)); - MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &servedPLMN_item->pLMN_Identity); - ASN_SEQUENCE_ADD(&served_cell_information.servedPLMNs.list, servedPLMN_item); - - - - // // /* - CHOICE NR-MODE-Info */ - F1AP_NR_Mode_Info_t nR_Mode_Info; - - if (f1ap_setup_req->fdd_flag) { - nR_Mode_Info.present = F1AP_NR_Mode_Info_PR_fDD; - /* > FDD >> FDD Info */ - F1AP_FDD_Info_t *fDD_Info = (F1AP_FDD_Info_t *)calloc(1, sizeof(F1AP_FDD_Info_t)); - /* >>> UL NRFreqInfo */ - fDD_Info->uL_NRFreqInfo.nRARFCN = 999L; - - F1AP_FreqBandNrItem_t ul_freqBandNrItem; - memset((void *)&ul_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); - ul_freqBandNrItem.freqBandIndicatorNr = 888L; - - F1AP_SupportedSULFreqBandItem_t ul_supportedSULFreqBandItem; - memset((void *)&ul_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); - ul_supportedSULFreqBandItem.freqBandIndicatorNr = 777L; - ASN_SEQUENCE_ADD(&ul_freqBandNrItem.supportedSULBandList.list, &ul_supportedSULFreqBandItem); - - ASN_SEQUENCE_ADD(&fDD_Info->uL_NRFreqInfo.freqBandListNr.list, &ul_freqBandNrItem); - - /* >>> DL NRFreqInfo */ - fDD_Info->dL_NRFreqInfo.nRARFCN = 666L; - - F1AP_FreqBandNrItem_t dl_freqBandNrItem; - memset((void *)&dl_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); - dl_freqBandNrItem.freqBandIndicatorNr = 555L; - - F1AP_SupportedSULFreqBandItem_t dl_supportedSULFreqBandItem; - memset((void *)&dl_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); - dl_supportedSULFreqBandItem.freqBandIndicatorNr = 444L; - ASN_SEQUENCE_ADD(&dl_freqBandNrItem.supportedSULBandList.list, &dl_supportedSULFreqBandItem); - - ASN_SEQUENCE_ADD(&fDD_Info->dL_NRFreqInfo.freqBandListNr.list, &dl_freqBandNrItem); - - /* >>> UL Transmission Bandwidth */ - fDD_Info->uL_Transmission_Bandwidth.nRSCS = F1AP_NRSCS_scs15; - fDD_Info->uL_Transmission_Bandwidth.nRNRB = F1AP_NRNRB_nrb11; - /* >>> DL Transmission Bandwidth */ - fDD_Info->dL_Transmission_Bandwidth.nRSCS = F1AP_NRSCS_scs15; - fDD_Info->dL_Transmission_Bandwidth.nRNRB = F1AP_NRNRB_nrb11; - - nR_Mode_Info.choice.fDD = fDD_Info; - } else { // TDD - nR_Mode_Info.present = F1AP_NR_Mode_Info_PR_tDD; - - /* > TDD >> TDD Info */ - F1AP_TDD_Info_t *tDD_Info = (F1AP_TDD_Info_t *)calloc(1, sizeof(F1AP_TDD_Info_t)); - /* >>> ARFCN */ - tDD_Info->nRFreqInfo.nRARFCN = 999L; // Integer - F1AP_FreqBandNrItem_t nr_freqBandNrItem; - memset((void *)&nr_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); - nr_freqBandNrItem.freqBandIndicatorNr = 555L; - - F1AP_SupportedSULFreqBandItem_t nr_supportedSULFreqBandItem; - memset((void *)&nr_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); - nr_supportedSULFreqBandItem.freqBandIndicatorNr = 444L; - ASN_SEQUENCE_ADD(&nr_freqBandNrItem.supportedSULBandList.list, &nr_supportedSULFreqBandItem); - - ASN_SEQUENCE_ADD(&tDD_Info->nRFreqInfo.freqBandListNr.list, &nr_freqBandNrItem); - - tDD_Info->transmission_Bandwidth.nRSCS= F1AP_NRSCS_scs15; - tDD_Info->transmission_Bandwidth.nRNRB= F1AP_NRNRB_nrb11; - - nR_Mode_Info.choice.tDD = tDD_Info; - } - - served_cell_information.nR_Mode_Info = nR_Mode_Info; - - /* - measurementTimingConfiguration */ - char *measurementTimingConfiguration = "0"; // sept. 2018 - - OCTET_STRING_fromBuf(&served_cell_information.measurementTimingConfiguration, - measurementTimingConfiguration, - strlen(measurementTimingConfiguration)); - served_cells_to_modify_item.served_Cell_Information = served_cell_information; // - - /* 3.2.2 gNB-DU System Information */ - F1AP_GNB_DU_System_Information_t *gNB_DU_System_Information = (F1AP_GNB_DU_System_Information_t *)calloc(1, sizeof(F1AP_GNB_DU_System_Information_t)); - - OCTET_STRING_fromBuf(&gNB_DU_System_Information->mIB_message, // sept. 2018 - "1", - sizeof("1")); - - OCTET_STRING_fromBuf(&gNB_DU_System_Information->sIB1_message, // sept. 2018 - "1", - sizeof("1")); - served_cells_to_modify_item.gNB_DU_System_Information = gNB_DU_System_Information; // - - /* ADD */ - served_cells_to_modify_item_ies->value.choice.Served_Cells_To_Modify_Item = served_cells_to_modify_item; - - ASN_SEQUENCE_ADD(&ie->value.choice.Served_Cells_To_Modify_List.list, - served_cells_to_modify_item_ies); + if (f1ap_setup_req->fdd_flag) { + nR_Mode_Info.present = F1AP_NR_Mode_Info_PR_fDD; + /* > FDD >> FDD Info */ + F1AP_FDD_Info_t *fDD_Info = (F1AP_FDD_Info_t *)calloc(1, sizeof(F1AP_FDD_Info_t)); + /* >>> UL NRFreqInfo */ + fDD_Info->uL_NRFreqInfo.nRARFCN = 999L; + F1AP_FreqBandNrItem_t ul_freqBandNrItem; + memset((void *)&ul_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); + ul_freqBandNrItem.freqBandIndicatorNr = 888L; + F1AP_SupportedSULFreqBandItem_t ul_supportedSULFreqBandItem; + memset((void *)&ul_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); + ul_supportedSULFreqBandItem.freqBandIndicatorNr = 777L; + ASN_SEQUENCE_ADD(&ul_freqBandNrItem.supportedSULBandList.list, &ul_supportedSULFreqBandItem); + ASN_SEQUENCE_ADD(&fDD_Info->uL_NRFreqInfo.freqBandListNr.list, &ul_freqBandNrItem); + /* >>> DL NRFreqInfo */ + fDD_Info->dL_NRFreqInfo.nRARFCN = 666L; + F1AP_FreqBandNrItem_t dl_freqBandNrItem; + memset((void *)&dl_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); + dl_freqBandNrItem.freqBandIndicatorNr = 555L; + F1AP_SupportedSULFreqBandItem_t dl_supportedSULFreqBandItem; + memset((void *)&dl_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); + dl_supportedSULFreqBandItem.freqBandIndicatorNr = 444L; + ASN_SEQUENCE_ADD(&dl_freqBandNrItem.supportedSULBandList.list, &dl_supportedSULFreqBandItem); + ASN_SEQUENCE_ADD(&fDD_Info->dL_NRFreqInfo.freqBandListNr.list, &dl_freqBandNrItem); + /* >>> UL Transmission Bandwidth */ + fDD_Info->uL_Transmission_Bandwidth.nRSCS = F1AP_NRSCS_scs15; + fDD_Info->uL_Transmission_Bandwidth.nRNRB = F1AP_NRNRB_nrb11; + /* >>> DL Transmission Bandwidth */ + fDD_Info->dL_Transmission_Bandwidth.nRSCS = F1AP_NRSCS_scs15; + fDD_Info->dL_Transmission_Bandwidth.nRNRB = F1AP_NRNRB_nrb11; + nR_Mode_Info.choice.fDD = fDD_Info; + } else { // TDD + nR_Mode_Info.present = F1AP_NR_Mode_Info_PR_tDD; + /* > TDD >> TDD Info */ + F1AP_TDD_Info_t *tDD_Info = (F1AP_TDD_Info_t *)calloc(1, sizeof(F1AP_TDD_Info_t)); + /* >>> ARFCN */ + tDD_Info->nRFreqInfo.nRARFCN = 999L; // Integer + F1AP_FreqBandNrItem_t nr_freqBandNrItem; + memset((void *)&nr_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); + nr_freqBandNrItem.freqBandIndicatorNr = 555L; + F1AP_SupportedSULFreqBandItem_t nr_supportedSULFreqBandItem; + memset((void *)&nr_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); + nr_supportedSULFreqBandItem.freqBandIndicatorNr = 444L; + ASN_SEQUENCE_ADD(&nr_freqBandNrItem.supportedSULBandList.list, &nr_supportedSULFreqBandItem); + ASN_SEQUENCE_ADD(&tDD_Info->nRFreqInfo.freqBandListNr.list, &nr_freqBandNrItem); + tDD_Info->transmission_Bandwidth.nRSCS= F1AP_NRSCS_scs15; + tDD_Info->transmission_Bandwidth.nRNRB= F1AP_NRNRB_nrb11; + nR_Mode_Info.choice.tDD = tDD_Info; + } + served_cell_information.nR_Mode_Info = nR_Mode_Info; + /* - measurementTimingConfiguration */ + char *measurementTimingConfiguration = "0"; // sept. 2018 + OCTET_STRING_fromBuf(&served_cell_information.measurementTimingConfiguration, + measurementTimingConfiguration, + strlen(measurementTimingConfiguration)); + served_cells_to_modify_item.served_Cell_Information = served_cell_information; // + /* 3.2.2 gNB-DU System Information */ + F1AP_GNB_DU_System_Information_t *gNB_DU_System_Information = (F1AP_GNB_DU_System_Information_t *)calloc(1, sizeof(F1AP_GNB_DU_System_Information_t)); + OCTET_STRING_fromBuf(&gNB_DU_System_Information->mIB_message, // sept. 2018 + "1", + sizeof("1")); + OCTET_STRING_fromBuf(&gNB_DU_System_Information->sIB1_message, // sept. 2018 + "1", + sizeof("1")); + served_cells_to_modify_item.gNB_DU_System_Information = gNB_DU_System_Information; // + /* ADD */ + served_cells_to_modify_item_ies->value.choice.Served_Cells_To_Modify_Item = served_cells_to_modify_item; + ASN_SEQUENCE_ADD(&ie->value.choice.Served_Cells_To_Modify_List.list, + served_cells_to_modify_item_ies); } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - /* mandatory */ /* c4. Served_Cells_To_Delete */ ie = (F1AP_GNBDUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBDUConfigurationUpdateIEs_t)); @@ -1014,34 +848,29 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, for (i=0; i<1; i++) { - // - F1AP_Served_Cells_To_Delete_ItemIEs_t *served_cells_to_delete_item_ies; - served_cells_to_delete_item_ies = (F1AP_Served_Cells_To_Delete_ItemIEs_t *)calloc(1, sizeof(F1AP_Served_Cells_To_Delete_ItemIEs_t)); - served_cells_to_delete_item_ies->id = F1AP_ProtocolIE_ID_id_Served_Cells_To_Delete_Item; - served_cells_to_delete_item_ies->criticality = F1AP_Criticality_reject; - served_cells_to_delete_item_ies->value.present = F1AP_Served_Cells_To_Delete_ItemIEs__value_PR_Served_Cells_To_Delete_Item; - - F1AP_Served_Cells_To_Delete_Item_t served_cells_to_delete_item; - memset((void *)&served_cells_to_delete_item, 0, sizeof(F1AP_Served_Cells_To_Delete_Item_t)); - - /* 3.1 oldNRCGI */ - F1AP_NRCGI_t oldNRCGI; - memset(&oldNRCGI, 0, sizeof(F1AP_NRCGI_t)); - MCC_MNC_TO_PLMNID(f1ap_setup_req->mcc[i], f1ap_setup_req->mnc[i], f1ap_setup_req->mnc_digit_length[i], - &oldNRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(f1ap_setup_req->nr_cellid[i], &oldNRCGI.nRCellIdentity); - served_cells_to_delete_item.oldNRCGI = oldNRCGI; - - /* ADD */ - served_cells_to_delete_item_ies->value.choice.Served_Cells_To_Delete_Item = served_cells_to_delete_item; - - ASN_SEQUENCE_ADD(&ie->value.choice.Served_Cells_To_Delete_List.list, - served_cells_to_delete_item_ies); + // + F1AP_Served_Cells_To_Delete_ItemIEs_t *served_cells_to_delete_item_ies; + served_cells_to_delete_item_ies = (F1AP_Served_Cells_To_Delete_ItemIEs_t *)calloc(1, sizeof(F1AP_Served_Cells_To_Delete_ItemIEs_t)); + served_cells_to_delete_item_ies->id = F1AP_ProtocolIE_ID_id_Served_Cells_To_Delete_Item; + served_cells_to_delete_item_ies->criticality = F1AP_Criticality_reject; + served_cells_to_delete_item_ies->value.present = F1AP_Served_Cells_To_Delete_ItemIEs__value_PR_Served_Cells_To_Delete_Item; + F1AP_Served_Cells_To_Delete_Item_t served_cells_to_delete_item; + memset((void *)&served_cells_to_delete_item, 0, sizeof(F1AP_Served_Cells_To_Delete_Item_t)); + /* 3.1 oldNRCGI */ + F1AP_NRCGI_t oldNRCGI; + memset(&oldNRCGI, 0, sizeof(F1AP_NRCGI_t)); + MCC_MNC_TO_PLMNID(f1ap_setup_req->mcc[i], f1ap_setup_req->mnc[i], f1ap_setup_req->mnc_digit_length[i], + &oldNRCGI.pLMN_Identity); + NR_CELL_ID_TO_BIT_STRING(f1ap_setup_req->nr_cellid[i], &oldNRCGI.nRCellIdentity); + served_cells_to_delete_item.oldNRCGI = oldNRCGI; + /* ADD */ + served_cells_to_delete_item_ies->value.choice.Served_Cells_To_Delete_Item = served_cells_to_delete_item; + ASN_SEQUENCE_ADD(&ie->value.choice.Served_Cells_To_Delete_List.list, + served_cells_to_delete_item_ies); } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { LOG_E(F1AP, "Failed to encode F1 gNB-DU CONFIGURATION UPDATE\n"); return -1; @@ -1050,86 +879,76 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, return 0; } - - int DU_handle_gNB_DU_CONFIGURATION_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { AssertFatal(1==0,"Not implemented yet\n"); } int DU_handle_gNB_DU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { AssertFatal(1==0,"Not implemented yet\n"); } int DU_handle_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { - + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { LOG_D(F1AP, "DU_handle_gNB_CU_CONFIGURATION_UPDATE\n"); - AssertFatal(pdu->present == F1AP_F1AP_PDU_PR_initiatingMessage, - "pdu->present != F1AP_F1AP_PDU_PR_initiatingMessage\n"); + "pdu->present != F1AP_F1AP_PDU_PR_initiatingMessage\n"); AssertFatal(pdu->choice.initiatingMessage->procedureCode == F1AP_ProcedureCode_id_gNBCUConfigurationUpdate, - "pdu->choice.initiatingMessage->procedureCode != F1AP_ProcedureCode_id_gNBCUConfigurationUpdate\n"); + "pdu->choice.initiatingMessage->procedureCode != F1AP_ProcedureCode_id_gNBCUConfigurationUpdate\n"); AssertFatal(pdu->choice.initiatingMessage->criticality == F1AP_Criticality_reject, - "pdu->choice.initiatingMessage->criticality != F1AP_Criticality_reject\n"); + "pdu->choice.initiatingMessage->criticality != F1AP_Criticality_reject\n"); AssertFatal(pdu->choice.initiatingMessage->value.present == F1AP_InitiatingMessage__value_PR_GNBCUConfigurationUpdate, - "pdu->choice.initiatingMessage->value.present != F1AP_InitiatingMessage__value_PR_GNBCUConfigurationUpdate\n"); - + "pdu->choice.initiatingMessage->value.present != F1AP_InitiatingMessage__value_PR_GNBCUConfigurationUpdate\n"); F1AP_GNBCUConfigurationUpdate_t *in = &pdu->choice.initiatingMessage->value.choice.GNBCUConfigurationUpdate; - - F1AP_GNBCUConfigurationUpdateIEs_t *ie; int TransactionId = -1; int num_cells_to_activate = 0; F1AP_Cells_to_be_Activated_List_Item_t *cell; - MessageDef *msg_p = itti_alloc_new_message (TASK_DU_F1, 0, F1AP_GNB_CU_CONFIGURATION_UPDATE); - LOG_D(F1AP, "F1AP: gNB_CU_Configuration_Update: protocolIEs.list.count %d\n", in->protocolIEs.list.count); - for (int i=0;i < in->protocolIEs.list.count; i++) { + + for (int i=0; i < in->protocolIEs.list.count; i++) { ie = in->protocolIEs.list.array[i]; + switch (ie->id) { case F1AP_ProtocolIE_ID_id_TransactionID: AssertFatal(ie->criticality == F1AP_Criticality_reject, - "ie->criticality != F1AP_Criticality_reject\n"); + "ie->criticality != F1AP_Criticality_reject\n"); AssertFatal(ie->value.present == F1AP_GNBCUConfigurationUpdateIEs__value_PR_TransactionID, - "ie->value.present != F1AP_GNBCUConfigurationUpdateIEs__value_PR_TransactionID\n"); + "ie->value.present != F1AP_GNBCUConfigurationUpdateIEs__value_PR_TransactionID\n"); TransactionId=ie->value.choice.TransactionID; LOG_D(F1AP, "F1AP: GNB-CU-ConfigurationUpdate: TransactionId %d\n", TransactionId); break; - case F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List: - { + + case F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List: { AssertFatal(ie->criticality == F1AP_Criticality_reject, - "ie->criticality != F1AP_Criticality_reject\n"); + "ie->criticality != F1AP_Criticality_reject\n"); AssertFatal(ie->value.present == F1AP_GNBCUConfigurationUpdateIEs__value_PR_Cells_to_be_Activated_List, - "ie->value.present != F1AP_GNBCUConfigurationUpdateIEs__value_PR_Cells_to_be_Activated_List\n"); + "ie->value.present != F1AP_GNBCUConfigurationUpdateIEs__value_PR_Cells_to_be_Activated_List\n"); num_cells_to_activate = ie->value.choice.Cells_to_be_Activated_List.list.count; LOG_D(F1AP, "F1AP: Activating %d cells\n",num_cells_to_activate); - for (int i=0;ivalue.choice.Cells_to_be_Activated_List.list.array[i]; - AssertFatal(cells_to_be_activated_list_item_ies->id == F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item, - "cells_to_be_activated_list_item_ies->id != F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item"); + "cells_to_be_activated_list_item_ies->id != F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item"); AssertFatal(cells_to_be_activated_list_item_ies->criticality == F1AP_Criticality_reject, - "cells_to_be_activated_list_item_ies->criticality == F1AP_Criticality_reject"); + "cells_to_be_activated_list_item_ies->criticality == F1AP_Criticality_reject"); AssertFatal(cells_to_be_activated_list_item_ies->value.present == F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item, - "cells_to_be_activated_list_item_ies->value.present == F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item"); - + "cells_to_be_activated_list_item_ies->value.present == F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item"); cell = &cells_to_be_activated_list_item_ies->value.choice.Cells_to_be_Activated_List_Item; - - TBCD_TO_MCC_MNC(&cell->nRCGI.pLMN_Identity, F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].mcc, F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].mnc, F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].mnc_digit_length); - + TBCD_TO_MCC_MNC(&cell->nRCGI.pLMN_Identity, F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].mcc, F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].mnc, + F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].mnc_digit_length); LOG_D(F1AP, "nr_cellId : %x %x %x %x %x\n", cell->nRCGI.nRCellIdentity.buf[0], cell->nRCGI.nRCellIdentity.buf[1], @@ -1137,61 +956,70 @@ int DU_handle_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, cell->nRCGI.nRCellIdentity.buf[3], cell->nRCGI.nRCellIdentity.buf[4]); BIT_STRING_TO_NR_CELL_IDENTITY(&cell->nRCGI.nRCellIdentity, - F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].nr_cellid); - F1AP_ProtocolExtensionContainer_154P112_t *ext = (F1AP_ProtocolExtensionContainer_154P112_t *)cell->iE_Extensions; + F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].nr_cellid); + F1AP_ProtocolExtensionContainer_154P112_t *ext = (F1AP_ProtocolExtensionContainer_154P112_t *)cell->iE_Extensions; - if (ext==NULL) continue; - - for (int cnt=0;cntlist.count;cnt++) { + if (ext==NULL) + continue; + + for (int cnt=0; cntlist.count; cnt++) { F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *cells_to_be_activated_list_itemExtIEs=(F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *)ext->list.array[cnt]; + switch (cells_to_be_activated_list_itemExtIEs->id) { - /* - case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_NOTHING: - case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_GNB_CUSystemInformation, - case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_AvailablePLMNList, - case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_ExtendedAvailablePLMN_List, - case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_IAB_Info_IAB_donor_CU, - case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_AvailableSNPN_ID_List - */ - case F1AP_ProtocolIE_ID_id_gNB_CUSystemInformation: - { + /* + case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_NOTHING: + case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_GNB_CUSystemInformation, + case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_AvailablePLMNList, + case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_ExtendedAvailablePLMN_List, + case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_IAB_Info_IAB_donor_CU, + case F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_AvailableSNPN_ID_List + */ + case F1AP_ProtocolIE_ID_id_gNB_CUSystemInformation: { F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].nrpci = (cell->nRPCI != NULL) ? *cell->nRPCI : 0; - F1AP_GNB_CUSystemInformation_t *gNB_CUSystemInformation = (F1AP_GNB_CUSystemInformation_t*)&cells_to_be_activated_list_itemExtIEs->extensionValue.choice.GNB_CUSystemInformation; + F1AP_GNB_CUSystemInformation_t *gNB_CUSystemInformation = (F1AP_GNB_CUSystemInformation_t *)&cells_to_be_activated_list_itemExtIEs->extensionValue.choice.GNB_CUSystemInformation; F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].num_SI = gNB_CUSystemInformation->sibtypetobeupdatedlist.list.count; AssertFatal(ext->list.count==1,"At least one SI message should be there, and only 1 for now!\n"); LOG_D(F1AP, "F1AP: Cell %d MCC %d MNC %d NRCellid %lx num_si %d\n", i, F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].mcc, F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].mnc, F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].nr_cellid, F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].num_SI); - for (int si = 0;si < gNB_CUSystemInformation->sibtypetobeupdatedlist.list.count;si++) { + + for (int si = 0; si < gNB_CUSystemInformation->sibtypetobeupdatedlist.list.count; si++) { F1AP_SibtypetobeupdatedListItem_t *sib_item = gNB_CUSystemInformation->sibtypetobeupdatedlist.list.array[si]; size_t size = sib_item->sIBmessage.size; F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].SI_container_length[si] = size; LOG_D(F1AP, "F1AP: SI_container_length[%d][%d] %ld bytes\n", i, (int)sib_item->sIBtype, size); F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].SI_container[si] = malloc(F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].SI_container_length[si]); - memcpy((void*)F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].SI_container[si], - (void*)sib_item->sIBmessage.buf, - size); + memcpy((void *)F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].SI_container[si], + (void *)sib_item->sIBmessage.buf, + size); } + break; } + case F1AP_ProtocolIE_ID_id_AvailablePLMNList: AssertFatal(1==0,"F1AP_ProtocolIE_ID_id_AvailablePLMNList not supported yet\n"); break; + case F1AP_ProtocolIE_ID_id_ExtendedAvailablePLMN_List: AssertFatal(1==0,"F1AP_ProtocolIE_ID_id_AvailablePLMNList not supported yet\n"); break; + case F1AP_ProtocolIE_ID_id_IAB_Info_IAB_donor_CU: AssertFatal(1==0,"F1AP_ProtocolIE_ID_id_AvailablePLMNList not supported yet\n"); break; + case F1AP_ProtocolIE_ID_id_AvailableSNPN_ID_List: AssertFatal(1==0,"F1AP_ProtocolIE_ID_id_AvailablePLMNList not supported yet\n"); break; + default: AssertFatal(1==0,"F1AP_ProtocolIE_ID_id %d unknown\n",(int)cells_to_be_activated_list_itemExtIEs->id); break; } } // for (cnt=... } // for (cells_to_activate... + break; } // case F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List @@ -1200,26 +1028,26 @@ int DU_handle_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, break; } // switch ie } // for IE + AssertFatal(TransactionId!=-1,"TransactionId was not sent\n"); LOG_D(F1AP,"F1AP: num_cells_to_activate %d\n",num_cells_to_activate); F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).num_cells_to_activate = num_cells_to_activate; - MSC_LOG_RX_MESSAGE( - MSC_F1AP_DU, - MSC_F1AP_CU, - 0, - 0, - MSC_AS_TIME_FMT" DU_handle_GNB_CU_CONFIGURATION_UPDATE initiatingMessage assoc_id %d", - 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - assoc_id); + MSC_F1AP_DU, + MSC_F1AP_CU, + 0, + 0, + MSC_AS_TIME_FMT" DU_handle_GNB_CU_CONFIGURATION_UPDATE initiatingMessage assoc_id %d", + 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), + assoc_id); if (RC.nrrrc[0]->node_type == ngran_gNB_DU) { LOG_D(F1AP, "Sending F1AP_GNB_CU_CONFIGURATION_UPDATE ITTI message to GNB_APP with assoc_id (%d->%d)\n", - assoc_id,ENB_MODULE_ID_TO_INSTANCE(assoc_id)); + assoc_id,ENB_MODULE_ID_TO_INSTANCE(assoc_id)); itti_send_msg_to_task(TASK_GNB_APP, GNB_MODULE_ID_TO_INSTANCE(assoc_id), msg_p); } else { LOG_D(F1AP, "Sending F1AP_GNB_CU_CONFIGURATION_UPDATE ITTI message to ENB_APP with assoc_id (%d->%d)\n", - assoc_id,ENB_MODULE_ID_TO_INSTANCE(assoc_id)); + assoc_id,ENB_MODULE_ID_TO_INSTANCE(assoc_id)); itti_send_msg_to_task(TASK_ENB_APP, ENB_MODULE_ID_TO_INSTANCE(assoc_id), msg_p); } @@ -1227,35 +1055,28 @@ int DU_handle_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, } int DU_send_gNB_CU_CONFIGURATION_UPDATE_FAILURE(instance_t instance, - f1ap_gnb_cu_configuration_update_failure_t *GNBCUConfigurationUpdateFailure) { + f1ap_gnb_cu_configuration_update_failure_t *GNBCUConfigurationUpdateFailure) { AssertFatal(1==0,"received gNB CU CONFIGURATION UPDATE FAILURE with cause %d\n", - GNBCUConfigurationUpdateFailure->cause); + GNBCUConfigurationUpdateFailure->cause); } int DU_send_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, - f1ap_gnb_cu_configuration_update_acknowledge_t *GNBCUConfigurationUpdateAcknowledge) { - + f1ap_gnb_cu_configuration_update_acknowledge_t *GNBCUConfigurationUpdateAcknowledge) { AssertFatal(GNBCUConfigurationUpdateAcknowledge->num_cells_failed_to_be_activated == 0, - "%d cells failed to activate\n", - GNBCUConfigurationUpdateAcknowledge->num_cells_failed_to_be_activated); - + "%d cells failed to activate\n", + GNBCUConfigurationUpdateAcknowledge->num_cells_failed_to_be_activated); AssertFatal(GNBCUConfigurationUpdateAcknowledge->noofTNLAssociations_to_setup == 0, - "%d TNLAssociations to setup, handle this ...\n", - GNBCUConfigurationUpdateAcknowledge->noofTNLAssociations_to_setup); - - + "%d TNLAssociations to setup, handle this ...\n", + GNBCUConfigurationUpdateAcknowledge->noofTNLAssociations_to_setup); AssertFatal(GNBCUConfigurationUpdateAcknowledge->noofTNLAssociations_failed == 0, - "%d TNLAssociations failed\n", - GNBCUConfigurationUpdateAcknowledge->noofTNLAssociations_failed); - + "%d TNLAssociations failed\n", + GNBCUConfigurationUpdateAcknowledge->noofTNLAssociations_failed); AssertFatal(GNBCUConfigurationUpdateAcknowledge->noofDedicatedSIDeliveryNeededUEs == 0, - "%d DedicatedSIDeliveryNeededUEs\n", - GNBCUConfigurationUpdateAcknowledge->noofDedicatedSIDeliveryNeededUEs); - + "%d DedicatedSIDeliveryNeededUEs\n", + GNBCUConfigurationUpdateAcknowledge->noofDedicatedSIDeliveryNeededUEs); F1AP_F1AP_PDU_t pdu; uint8_t *buffer; uint32_t len; - /* Create */ /* 0. pdu Type */ memset(&pdu, 0, sizeof(pdu)); @@ -1265,7 +1086,6 @@ int DU_send_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, pdu.choice.successfulOutcome->criticality = F1AP_Criticality_reject; pdu.choice.successfulOutcome->value.present = F1AP_SuccessfulOutcome__value_PR_GNBCUConfigurationUpdateAcknowledge; F1AP_GNBCUConfigurationUpdateAcknowledge_t *out = &pdu.choice.successfulOutcome->value.choice.GNBCUConfigurationUpdateAcknowledge; - /* mandatory */ /* c1. Transaction ID (integer value)*/ F1AP_GNBCUConfigurationUpdateAcknowledgeIEs_t *ie = (F1AP_GNBCUConfigurationUpdateAcknowledgeIEs_t *)calloc(1, sizeof(F1AP_F1SetupResponseIEs_t)); @@ -1282,21 +1102,18 @@ int DU_send_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, } du_f1ap_itti_send_sctp_data_req(instance, f1ap_du_data->assoc_id, buffer, len, 0); - - - return 0; } int DU_send_gNB_DU_RESOURCE_COORDINATION_REQUEST(instance_t instance, - F1AP_GNBDUResourceCoordinationRequest_t *GNBDUResourceCoordinationRequest) { + F1AP_GNBDUResourceCoordinationRequest_t *GNBDUResourceCoordinationRequest) { AssertFatal(0, "Not implemented yet\n"); } int DU_handle_gNB_DU_RESOURCE_COORDINATION_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { AssertFatal(0, "Not implemented yet\n"); } diff --git a/openair3/SCTP/sctp_eNB_task.c b/openair3/SCTP/sctp_eNB_task.c index 045c4e2c16..a6073cce0d 100644 --- a/openair3/SCTP/sctp_eNB_task.c +++ b/openair3/SCTP/sctp_eNB_task.c @@ -925,21 +925,14 @@ void sctp_eNB_read_from_socket( struct sctp_cnx_list_elm_s *sctp_cnx) { - int flags = 0, n; - socklen_t from_len; - struct sctp_sndrcvinfo sinfo; - - struct sockaddr_in addr; - uint8_t buffer[SCTP_RECV_BUFFER_SIZE]; - DevAssert(sctp_cnx != NULL); - memset((void *)&addr, 0, sizeof(struct sockaddr_in)); - from_len = (socklen_t)sizeof(struct sockaddr_in); - memset((void *)&sinfo, 0, sizeof(struct sctp_sndrcvinfo)); + int flags = 0; + struct sctp_sndrcvinfo sinfo={0}; + uint8_t buffer[SCTP_RECV_BUFFER_SIZE]; - n = sctp_recvmsg(sctp_cnx->sd, (void *)buffer, SCTP_RECV_BUFFER_SIZE, - (struct sockaddr *)&addr, &from_len, + int n = sctp_recvmsg(sctp_cnx->sd, (void *)buffer, SCTP_RECV_BUFFER_SIZE, + NULL, NULL, &sinfo, &flags); if (n < 0) { @@ -1049,8 +1042,8 @@ sctp_eNB_read_from_socket( sctp_cnx->ppid); } - SCTP_DEBUG("[%d][%d] Msg of length %d received from port %u, on stream %d, PPID %d\n", - sinfo.sinfo_assoc_id, sctp_cnx->sd, n, ntohs(addr.sin_port), + SCTP_DEBUG("[%d][%d] Msg of length %d received, on stream %d, PPID %d\n", + sinfo.sinfo_assoc_id, sctp_cnx->sd, n, sinfo.sinfo_stream, ntohl(sinfo.sinfo_ppid)); sctp_itti_send_new_message_ind(sctp_cnx->task_id, From 9f07b3704b997220b8accb4219190fa4fb7653fc Mon Sep 17 00:00:00 2001 From: Laurent Thomas Date: Tue, 29 Jun 2021 13:13:20 +0200 Subject: [PATCH 003/110] sctp source port allocation to Linux automatic, heap corruption fix --- openair2/RRC/NR_UE/rrc_UE.c | 12 +++++++----- openair3/SCTP/sctp_eNB_task.c | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 1ac21c3584..09c6deb58f 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -407,8 +407,7 @@ void process_nsa_message(NR_UE_RRC_INST_t *rrc, nsa_message_t nsa_message_type, NR_UE_RRC_INST_t* openair_rrc_top_init_ue_nr(char* rrc_config_path){ int nr_ue; if(NB_NR_UE_INST > 0){ - NR_UE_rrc_inst = (NR_UE_RRC_INST_t *)malloc(NB_NR_UE_INST * sizeof(NR_UE_RRC_INST_t)); - memset(NR_UE_rrc_inst, 0, NB_NR_UE_INST * sizeof(NR_UE_RRC_INST_t)); + NR_UE_rrc_inst = (NR_UE_RRC_INST_t *)calloc(NB_NR_UE_INST , sizeof(NR_UE_RRC_INST_t)); for(nr_ue=0;nr_uemodule_id].cell_group_config == NULL){ - NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config = malloc(sizeof(NR_CellGroupConfig_t)); + NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config = calloc(1,sizeof(NR_CellGroupConfig_t)); } @@ -1275,7 +1274,8 @@ nr_rrc_ue_process_masterCellGroup( if( cellGroupConfig->rlc_BearerToAddModList != NULL){ //TODO (perform the RLC bearer addition/modification as specified in 5.3.5.5.4) if(NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToAddModList != NULL){ - free(NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToAddModList); + // Laurent: there are cases where the not NULL value is also not coming from a previous malloc + // so it is better to let the potential memory leak than corrupting the heap //free(NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToAddModList); } NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToAddModList = calloc(1, sizeof(struct NR_CellGroupConfig__rlc_BearerToAddModList)); memcpy(NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->rlc_BearerToAddModList,cellGroupConfig->rlc_BearerToAddModList, @@ -1287,7 +1287,9 @@ nr_rrc_ue_process_masterCellGroup( LOG_I(RRC, "Received mac_CellGroupConfig from gNB\n"); if(NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->mac_CellGroupConfig != NULL){ LOG_E(RRC, "UE RRC instance already contains mac CellGroupConfig which will be overwritten\n"); - free(NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->mac_CellGroupConfig); + // Laurent: there are cases where the not NULL value is also not coming from a previous malloc + // so it is better to let the potential memory leak than corrupting the heap + //free(NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->mac_CellGroupConfig); } NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->mac_CellGroupConfig = malloc(sizeof(struct NR_MAC_CellGroupConfig)); memcpy(NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->mac_CellGroupConfig,cellGroupConfig->mac_CellGroupConfig, diff --git a/openair3/SCTP/sctp_eNB_task.c b/openair3/SCTP/sctp_eNB_task.c index a6073cce0d..34a44aacc7 100644 --- a/openair3/SCTP/sctp_eNB_task.c +++ b/openair3/SCTP/sctp_eNB_task.c @@ -453,7 +453,7 @@ sctp_handle_new_association_req( if (((struct sockaddr_in*)ifa->ifa_addr)->sin_addr.s_addr == in.s_addr) { struct sockaddr_in locaddr; locaddr.sin_family = AF_INET; - locaddr.sin_port = htons(sctp_new_association_req_p->port); + locaddr.sin_port = 0; locaddr.sin_addr.s_addr = in.s_addr; if (sctp_bindx(sd, (struct sockaddr*)&locaddr, 1, SCTP_BINDX_ADD_ADDR) < 0) { From 305a268173c0c57991e22d54d33eb72c04b892c6 Mon Sep 17 00:00:00 2001 From: Laurent Thomas Date: Wed, 30 Jun 2021 16:49:33 +0200 Subject: [PATCH 004/110] bug fix in F1 --- openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c | 4 +- openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c | 4 +- openair2/RRC/NR/rrc_gNB.c | 4 + openair3/NAS/NR_UE/nr_nas_msg_sim.c | 97 ++++++++++++++--------- openair3/NAS/NR_UE/nr_nas_msg_sim.h | 31 ++++++++ 5 files changed, 100 insertions(+), 40 deletions(-) diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index c9d7cf7696..e5ecf3b65c 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -627,7 +627,9 @@ srb_found: } else { MessageDef *message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_DL_RRC_MESSAGE); - F1AP_DL_RRC_MESSAGE (message_p).rrc_container = (uint8_t*)buf; + uint8_t *message_buffer = itti_malloc (TASK_RRC_GNB, TASK_CU_F1, size); + memcpy (message_buffer, buf, size); + F1AP_DL_RRC_MESSAGE (message_p).rrc_container = message_buffer; F1AP_DL_RRC_MESSAGE (message_p).rrc_container_length = size; F1AP_DL_RRC_MESSAGE (message_p).gNB_CU_ue_id = 0; F1AP_DL_RRC_MESSAGE (message_p).gNB_DU_ue_id = 0; diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index b2d29a88c6..acbb6b4f45 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -491,9 +491,11 @@ rb_found: if (NODE_IS_DU(type) && is_srb == 1) { MessageDef *msg; msg = itti_alloc_new_message(TASK_RLC_ENB, 0, F1AP_UL_RRC_MESSAGE); + uint8_t *message_buffer = itti_malloc (TASK_RLC_ENB, TASK_DU_F1, size); + memcpy (message_buffer, buf, size); F1AP_UL_RRC_MESSAGE(msg).rnti = ue->rnti; F1AP_UL_RRC_MESSAGE(msg).srb_id = rb_id; - F1AP_UL_RRC_MESSAGE(msg).rrc_container = (unsigned char *)buf; + F1AP_UL_RRC_MESSAGE(msg).rrc_container = message_buffer; F1AP_UL_RRC_MESSAGE(msg).rrc_container_length = size; itti_send_msg_to_task(TASK_DU_F1, ENB_MODULE_ID_TO_INSTANCE(0 /*ctxt_pP->module_id*/), msg); return; diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index bcdf0967ae..1bef151704 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -1361,6 +1361,10 @@ rrc_gNB_process_RRCReconfigurationComplete( F1AP_UE_CONTEXT_SETUP_REQ (message_p).gNB_CU_ue_id = 0; F1AP_UE_CONTEXT_SETUP_REQ (message_p).gNB_DU_ue_id = 0; F1AP_UE_CONTEXT_SETUP_REQ (message_p).rnti = ue_context_pP->ue_context.rnti; + F1AP_UE_CONTEXT_SETUP_REQ (message_p).mcc = RC.nrrrc[0]->configuration.mcc[0]; + F1AP_UE_CONTEXT_SETUP_REQ (message_p).mnc = RC.nrrrc[0]->configuration.mnc[0]; + F1AP_UE_CONTEXT_SETUP_REQ (message_p).mnc_digit_length = RC.nrrrc[0]->configuration.mnc_digit_length[0]; + F1AP_UE_CONTEXT_SETUP_REQ (message_p).nr_cellid = RC.nrrrc[0]->nr_cellid; itti_send_msg_to_task (TASK_CU_F1, ctxt_pP->module_id, message_p); LOG_I(RRC, "Send F1AP_UE_CONTEXT_SETUP_REQ with ITTI\n"); } diff --git a/openair3/NAS/NR_UE/nr_nas_msg_sim.c b/openair3/NAS/NR_UE/nr_nas_msg_sim.c index f69231cc18..ca7df4cac7 100644 --- a/openair3/NAS/NR_UE/nr_nas_msg_sim.c +++ b/openair3/NAS/NR_UE/nr_nas_msg_sim.c @@ -713,6 +713,31 @@ void generatePduSessionEstablishRequest(as_nas_info_t *initialNasMsg){ } +uint8_t get_msg_type(uint8_t *pdu_buffer, uint32_t length) { + uint8_t msg_type = 0; + uint8_t offset = 0; + nas_msg_header_t nas_msg_header; + + if ((pdu_buffer != NULL) && (length > 0)) { + if (((nas_msg_header_t *)(pdu_buffer))->choice.security_protected_nas_msg_header_t.security_header_type > 0) { + offset += SECURITY_PROTECTED_5GS_NAS_MESSAGE_HEADER_LENGTH; + if (offset < length) { + msg_type = ((mm_msg_header_t *)(pdu_buffer + offset))->message_type; + + if (msg_type == FGS_DOWNLINK_NAS_TRANSPORT) { + msg_type = ((dl_nas_transport_t *)(pdu_buffer+ offset))->sm_nas_msg_header.message_type; + } + } + } else { // plain 5GS NAS message + msg_type = ((nas_msg_header_t *)(pdu_buffer))->choice.plain_nas_msg_header.message_type; + } + } else { + LOG_I(NAS, "[UE] Received invalid downlink message\n"); + } + + return msg_type; +} + void *nas_nrue_task(void *args_p) { MessageDef *msg_p; @@ -784,23 +809,8 @@ void *nas_nrue_task(void *args_p) NAS_CONN_ESTABLI_CNF (msg_p).errCode, NAS_CONN_ESTABLI_CNF (msg_p).nasMsg.length); pdu_buffer = NAS_CONN_ESTABLI_CNF (msg_p).nasMsg.data; - if((pdu_buffer + 1) != NULL){ - if (*(pdu_buffer + 1) > 0 ) { - if((pdu_buffer + 9) != NULL){ - msg_type = *(pdu_buffer + 9); - } else { - LOG_W(NAS, "[UE] Received invalid downlink message\n"); - break; - } - } else { - if((pdu_buffer + 2) != NULL){ - msg_type = *(pdu_buffer + 2); - } else { - LOG_W(NAS, "[UE] Received invalid downlink message\n"); - break; - } - } - } + msg_type = get_msg_type(pdu_buffer, NAS_CONN_ESTABLI_CNF (msg_p).nasMsg.length); + if(msg_type == REGISTRATION_ACCEPT){ LOG_I(NAS, "[UE] Received REGISTRATION ACCEPT message\n"); @@ -829,17 +839,38 @@ void *nas_nrue_task(void *args_p) itti_send_msg_to_task(TASK_RRC_NRUE, instance, message_p); LOG_I(NAS, "Send NAS_UPLINK_DATA_REQ message(PduSessionEstablishRequest)\n"); } - } - else if((pdu_buffer + 16) != NULL){ - msg_type = *(pdu_buffer + 16); - if(msg_type == FGS_PDU_SESSION_ESTABLISHMENT_ACC){ - sprintf(baseNetAddress, "%d.%d", *(pdu_buffer + 39),*(pdu_buffer + 40)); - int third_octet = *(pdu_buffer + 41); - int fourth_octet = *(pdu_buffer + 42); - LOG_I(NAS, "Received PDU Session Establishment Accept\n"); - nas_config(1,third_octet,fourth_octet,"ue"); + } else if(msg_type == FGS_PDU_SESSION_ESTABLISHMENT_ACC){ + uint8_t offset = 0; + uint8_t *payload_container = NULL; + offset += SECURITY_PROTECTED_5GS_NAS_MESSAGE_HEADER_LENGTH; + uint16_t payload_container_length = htons(((dl_nas_transport_t *)(pdu_buffer + offset))->payload_container_length); + if ((payload_container_length >= PAYLOAD_CONTAINER_LENGTH_MIN) && (payload_container_length <= PAYLOAD_CONTAINER_LENGTH_MAX)) { + offset += (PLAIN_5GS_NAS_MESSAGE_HEADER_LENGTH + 3); + } + + if (offset < NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.length) { + payload_container = pdu_buffer + offset; + } + offset = 0; + + while(offset < payload_container_length) { + if (*(payload_container + offset) == 0x29) { // PDU address IEI + if ((*(payload_container+offset+1) == 0x05) && (*(payload_container +offset+2) == 0x01)) { // IPV4 + nas_getparams(); + netlink_init_tun("ue", 1); + sprintf(baseNetAddress, "%d.%d", *(payload_container+offset+3), *(payload_container+offset+4)); + int third_octet = *(payload_container+offset+5); + int fourth_octet = *(payload_container+offset+6); + LOG_I(NAS, "Received PDU Session Establishment Accept, UE IP: %d.%d.%d.%d\n", + *(payload_container+offset+3), *(payload_container+offset+4), + *(payload_container+offset+5), *(payload_container+offset+6)); + nas_config(1,third_octet,fourth_octet,"oaitun_ue"); + break; + } + } + offset++; + } } - } break; } @@ -866,17 +897,7 @@ void *nas_nrue_task(void *args_p) as_nas_info_t initialNasMsg={0}; pdu_buffer = NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.data; - if((pdu_buffer + 1) != NULL){ - if (*(pdu_buffer + 1) > 0 ) { - msg_type = *(pdu_buffer + 9); - } else { - msg_type = *(pdu_buffer + 2); - } - } - if((pdu_buffer + 2) == NULL){ - LOG_W(NAS, "[UE] Received invalid downlink message\n"); - return 0; - } + msg_type = get_msg_type(pdu_buffer, NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.length); switch(msg_type){ case FGS_IDENTITY_REQUEST: diff --git a/openair3/NAS/NR_UE/nr_nas_msg_sim.h b/openair3/NAS/NR_UE/nr_nas_msg_sim.h index 348c27ecc8..3ec827117a 100644 --- a/openair3/NAS/NR_UE/nr_nas_msg_sim.h +++ b/openair3/NAS/NR_UE/nr_nas_msg_sim.h @@ -64,6 +64,10 @@ #define INITIAL_REGISTRATION 0b001 +#define PLAIN_5GS_NAS_MESSAGE_HEADER_LENGTH 3 +#define SECURITY_PROTECTED_5GS_NAS_MESSAGE_HEADER_LENGTH 7 +#define PAYLOAD_CONTAINER_LENGTH_MIN 3 +#define PAYLOAD_CONTAINER_LENGTH_MAX 65537 typedef enum fgs_protocol_discriminator_e { /* Protocol discriminator identifier for 5GS Mobility Management */ @@ -116,6 +120,33 @@ typedef union { fgs_nas_message_plain_t plain; } fgs_nas_message_t; +typedef struct { + union { + mm_msg_header_t plain_nas_msg_header; + struct security_protected_nas_msg_header_s { + uint8_t ex_protocol_discriminator; + uint8_t security_header_type; + uint16_t message_authentication_code1; + uint16_t message_authentication_code2; + uint8_t sequence_number; + } security_protected_nas_msg_header_t; + } choice; +} nas_msg_header_t; + +typedef struct { + uint8_t ex_protocol_discriminator; + uint8_t pdu_session_id; + uint8_t PTI; + uint8_t message_type; +} fgs_sm_nas_msg_header_t; + +typedef struct { + mm_msg_header_t plain_nas_msg_header; + uint8_t payload_container_type; + uint16_t payload_container_length; + fgs_sm_nas_msg_header_t sm_nas_msg_header; +} dl_nas_transport_t; + void generateRegistrationRequest(as_nas_info_t *initialNasMsg, int Mod_id); void generateSecurityModeComplete(as_nas_info_t *initialNasMsg); void generateRegistrationComplete(as_nas_info_t *initialNasMsg, SORTransparentContainer *sortransparentcontainer); From 6ce958f7ede654002078661df48cb7bc71ed1d2c Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Sat, 3 Jul 2021 16:32:20 +0200 Subject: [PATCH 005/110] Coarse grain cleanup: a lot of errors fixed --- .../PHY/NR_ESTIMATION/nr_measurements_gNB.c | 4 - openair2/COMMON/f1ap_messages_types.h | 44 +- openair2/ENB_APP/enb_config.c | 38 +- openair2/F1AP/f1ap_common.c | 35 +- openair2/F1AP/f1ap_common.h | 49 +- openair2/F1AP/f1ap_cu_interface_management.c | 318 ++-- openair2/F1AP/f1ap_cu_interface_management.h | 30 +- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 256 ++- openair2/F1AP/f1ap_cu_rrc_message_transfer.h | 6 +- openair2/F1AP/f1ap_cu_task.c | 64 +- openair2/F1AP/f1ap_cu_ue_context_management.c | 1408 +++++++---------- openair2/F1AP/f1ap_cu_ue_context_management.h | 32 +- openair2/F1AP/f1ap_decoder.c | 31 +- openair2/F1AP/f1ap_du_interface_management.c | 338 ++-- openair2/F1AP/f1ap_du_interface_management.h | 34 +- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 1207 +++++++------- openair2/F1AP/f1ap_du_rrc_message_transfer.h | 14 +- openair2/F1AP/f1ap_du_task.c | 79 +- openair2/F1AP/f1ap_du_ue_context_management.c | 756 ++++----- openair2/F1AP/f1ap_du_ue_context_management.h | 18 +- openair2/F1AP/f1ap_encoder.c | 4 +- openair2/F1AP/f1ap_handlers.c | 30 +- openair2/F1AP/f1ap_handlers.h | 2 +- openair2/F1AP/f1ap_itti_messaging.c | 19 +- openair2/F1AP/f1ap_itti_messaging.h | 4 +- openair2/F1AP/f1ap_messaging.c | 66 - openair2/F1AP/f1ap_messaging.h | 4 +- openair2/GNB_APP/gnb_config.c | 38 +- openair2/LAYER2/PDCP_v10.1.0/pdcp.h | 1 + openair2/RRC/LTE/rrc_eNB.c | 12 +- openair2/RRC/NR/rrc_gNB.c | 20 +- openair2/RRC/NR/rrc_gNB_NGAP.c | 3 - 32 files changed, 2057 insertions(+), 2907 deletions(-) delete mode 100644 openair2/F1AP/f1ap_messaging.c diff --git a/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c b/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c index 116a943880..91b6a59248 100644 --- a/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c +++ b/openair1/PHY/NR_ESTIMATION/nr_measurements_gNB.c @@ -102,12 +102,8 @@ void gNB_I0_measurements(PHY_VARS_gNB *gNB,int first_symb,int num_symb) { NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms; NR_gNB_COMMON *common_vars = &gNB->common_vars; PHY_MEASUREMENTS_gNB *measurements = &gNB->measurements; - NR_DL_FRAME_PARMS *fp = &gNB->frame_parms; - double rx_gain = openair0_cfg[0].rx_gain[0]; - double rx_gain_offset = openair0_cfg[0].rx_gain_offset[0]; uint32_t *rb_mask = gNB->rb_mask_ul; int rb, offset, offset0, nb_rb, len; - uint32_t n0_subband_power_temp = 0; int32_t *ul_ch; int32_t n0_power_tot; int64_t n0_power_tot2; diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index d3c4f2ce2f..9ecf8c1b19 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -71,6 +71,29 @@ typedef struct f1ap_cu_setup_req_s { // } f1ap_cu_setup_req_t; +typedef struct cellIDs_s { + + // Served Cell Information + /* Tracking area code */ + uint32_t tac; + + /* Mobile Country Codes + * Mobile Network Codes + */ + uint16_t mcc; + uint16_t mnc; + uint8_t mnc_digit_length; + + // NR Global Cell Id + uint64_t nr_cellid; + // NR Physical Cell Ids + uint16_t nr_pci; + // Number of slide support items (max 16, could be increased to as much as 1024) + uint16_t num_ssi; + uint8_t sst; + uint8_t sd; +} cellIDs_t; + typedef struct f1ap_setup_req_s { // Midhaul networking parameters @@ -100,26 +123,7 @@ typedef struct f1ap_setup_req_s { /// number of DU cells available uint16_t num_cells_available; //0< num_cells_available <= 512; - - // Served Cell Information - /* Tracking area code */ - uint32_t tac[F1AP_MAX_NB_CELLS]; - - /* Mobile Country Codes - * Mobile Network Codes - */ - uint16_t mcc[F1AP_MAX_NB_CELLS];//[6]; - uint16_t mnc[F1AP_MAX_NB_CELLS];//[6]; - uint8_t mnc_digit_length[F1AP_MAX_NB_CELLS];//[6]; - - // NR Global Cell Id - uint64_t nr_cellid[F1AP_MAX_NB_CELLS]; - // NR Physical Cell Ids - uint16_t nr_pci[F1AP_MAX_NB_CELLS]; - // Number of slide support items (max 16, could be increased to as much as 1024) - uint16_t num_ssi[F1AP_MAX_NB_CELLS];//[6]; - uint8_t sst[F1AP_MAX_NB_CELLS];//[16][6]; - uint8_t sd[F1AP_MAX_NB_CELLS];//[16][6]; + cellIDs_t cell[F1AP_MAX_NB_CELLS]; // fdd_flag = 1 means FDD, 0 means TDD int fdd_flag; diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index ee7b26ff1a..accb467738 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -1930,20 +1930,20 @@ int RCconfig_DU_F1(MessageDef *msg_p, uint32_t i) { LOG_I(ENB_APP,"F1AP: gNB_DU_id[%d] %ld\n",k,F1AP_SETUP_REQ (msg_p).gNB_DU_id); F1AP_SETUP_REQ (msg_p).gNB_DU_name = strdup(*(ENBParamList.paramarray[0][ENB_ENB_NAME_IDX].strptr)); LOG_I(ENB_APP,"F1AP: gNB_DU_name[%d] %s\n",k,F1AP_SETUP_REQ (msg_p).gNB_DU_name); - F1AP_SETUP_REQ (msg_p).tac[k] = *ENBParamList.paramarray[i][ENB_TRACKING_AREA_CODE_IDX].uptr; - LOG_I(ENB_APP,"F1AP: tac[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).tac[k]); - F1AP_SETUP_REQ (msg_p).mcc[k] = *PLMNParamList.paramarray[0][ENB_MOBILE_COUNTRY_CODE_IDX].uptr; - LOG_I(ENB_APP,"F1AP: mcc[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).mcc[k]); - F1AP_SETUP_REQ (msg_p).mnc[k] = *PLMNParamList.paramarray[0][ENB_MOBILE_NETWORK_CODE_IDX].uptr; - LOG_I(ENB_APP,"F1AP: mnc[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).mnc[k]); - F1AP_SETUP_REQ (msg_p).mnc_digit_length[k] = *PLMNParamList.paramarray[0][ENB_MNC_DIGIT_LENGTH].u8ptr; - LOG_I(ENB_APP,"F1AP: mnc_digit_length[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).mnc_digit_length[k]); - AssertFatal((F1AP_SETUP_REQ (msg_p).mnc_digit_length[k] == 2) || - (F1AP_SETUP_REQ (msg_p).mnc_digit_length[k] == 3), + F1AP_SETUP_REQ (msg_p).cell[k].tac = *ENBParamList.paramarray[i][ENB_TRACKING_AREA_CODE_IDX].uptr; + LOG_I(ENB_APP,"F1AP: tac[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).cell[k].tac); + F1AP_SETUP_REQ (msg_p).cell[k].mcc = *PLMNParamList.paramarray[0][ENB_MOBILE_COUNTRY_CODE_IDX].uptr; + LOG_I(ENB_APP,"F1AP: mcc[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).cell[k].mcc); + F1AP_SETUP_REQ (msg_p).cell[k].mnc = *PLMNParamList.paramarray[0][ENB_MOBILE_NETWORK_CODE_IDX].uptr; + LOG_I(ENB_APP,"F1AP: mnc[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).cell[k].mnc); + F1AP_SETUP_REQ (msg_p).cell[k].mnc_digit_length = *PLMNParamList.paramarray[0][ENB_MNC_DIGIT_LENGTH].u8ptr; + LOG_I(ENB_APP,"F1AP: mnc_digit_length[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).cell[k].mnc_digit_length); + AssertFatal((F1AP_SETUP_REQ (msg_p).cell[k].mnc_digit_length == 2) || + (F1AP_SETUP_REQ (msg_p).cell[k].mnc_digit_length == 3), "BAD MNC DIGIT LENGTH %d", - F1AP_SETUP_REQ (msg_p).mnc_digit_length[k]); - F1AP_SETUP_REQ (msg_p).nr_cellid[k] = (uint64_t)*(ENBParamList.paramarray[i][ENB_NRCELLID_IDX].u64ptr); - LOG_I(ENB_APP,"F1AP: nr_cellid[%d] %ld\n",k,F1AP_SETUP_REQ (msg_p).nr_cellid[k]); + F1AP_SETUP_REQ (msg_p).cell[k].mnc_digit_length); + F1AP_SETUP_REQ (msg_p).cell[k].nr_cellid = (uint64_t)*(ENBParamList.paramarray[i][ENB_NRCELLID_IDX].u64ptr); + LOG_I(ENB_APP,"F1AP: nr_cellid[%d] %ld\n",k,F1AP_SETUP_REQ (msg_p).cell[k].nr_cellid); LOG_I(ENB_APP,"F1AP: CU_ip4_address in DU %s\n",RC.mac[k]->eth_params_n.remote_addr); LOG_I(ENB_APP,"FIAP: CU_ip4_address in DU %p, strlen %d\n",F1AP_SETUP_REQ (msg_p).CU_f1_ip_address.ipv4_address,(int)strlen(RC.mac[k]->eth_params_n.remote_addr)); F1AP_SETUP_REQ (msg_p).CU_f1_ip_address.ipv6 = 0; @@ -1974,12 +1974,12 @@ int RCconfig_DU_F1(MessageDef *msg_p, uint32_t i) { pthread_mutex_unlock(&rrc->cell_info_mutex); } while (cell_info_configured ==0); - rrc->configuration.mcc[0] = F1AP_SETUP_REQ (msg_p).mcc[k]; - rrc->configuration.mnc[0] = F1AP_SETUP_REQ (msg_p).mnc[k]; - rrc->configuration.tac = F1AP_SETUP_REQ (msg_p).tac[k]; - rrc->nr_cellid = F1AP_SETUP_REQ (msg_p).nr_cellid[k]; - F1AP_SETUP_REQ (msg_p).nr_pci[k] = rrc->carrier[0].physCellId; - F1AP_SETUP_REQ (msg_p).num_ssi[k] = 0; + rrc->configuration.mcc[0] = F1AP_SETUP_REQ (msg_p).cell[k].mcc; + rrc->configuration.mnc[0] = F1AP_SETUP_REQ (msg_p).cell[k].mnc; + rrc->configuration.tac = F1AP_SETUP_REQ (msg_p).cell[k].tac; + rrc->nr_cellid = F1AP_SETUP_REQ (msg_p).cell[k].nr_cellid; + F1AP_SETUP_REQ (msg_p).cell[k].nr_pci = rrc->carrier[0].physCellId; + F1AP_SETUP_REQ (msg_p).cell[k].num_ssi = 0; if (rrc->carrier[0].sib1->tdd_Config) { LOG_I(ENB_APP,"ngran_DU: Configuring Cell %d for TDD\n",k); diff --git a/openair2/F1AP/f1ap_common.c b/openair2/F1AP/f1ap_common.c index 267626dd5c..906c4cf91c 100644 --- a/openair2/F1AP/f1ap_common.c +++ b/openair2/F1AP/f1ap_common.c @@ -36,15 +36,15 @@ int asn_debug = 0; int asn1_xer_print = 0; -inline void ASN_DEBUG(const char *fmt, ...) -{ +inline void ASN_DEBUG(const char *fmt, ...) { if (asn_debug) { int adi = asn_debug_indent; va_list ap; va_start(ap, fmt); fprintf(stderr, "[ASN1]"); - while(adi--) fprintf(stderr, " "); + while(adi--) + fprintf(stderr, " "); vfprintf(stderr, fmt, ap); fprintf(stderr, "\n"); @@ -53,11 +53,10 @@ inline void ASN_DEBUG(const char *fmt, ...) } #endif -uint8_t F1AP_get_next_transaction_identifier(module_id_t enb_mod_idP, module_id_t cu_mod_idP) -{ +uint8_t F1AP_get_next_transaction_identifier(module_id_t enb_mod_idP, module_id_t cu_mod_idP) { static uint8_t transaction_identifier[NUMBER_OF_eNB_MAX]; transaction_identifier[enb_mod_idP+cu_mod_idP] = - (transaction_identifier[enb_mod_idP+cu_mod_idP] + 1) % F1AP_TRANSACTION_IDENTIFIER_NUMBER; + (transaction_identifier[enb_mod_idP+cu_mod_idP] + 1) % F1AP_TRANSACTION_IDENTIFIER_NUMBER; //LOG_T(F1AP,"generated xid is %d\n",transaction_identifier[enb_mod_idP+cu_mod_idP]); return transaction_identifier[enb_mod_idP+cu_mod_idP]; } @@ -75,6 +74,7 @@ int f1ap_add_ue(f1ap_cudu_inst_t *f1_inst, return i; } } + for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) { if (f1_inst->f1ap_ue[i].rnti == 0 ) { f1_inst->f1ap_ue[i].rnti = rntiP; @@ -87,6 +87,7 @@ int f1ap_add_ue(f1ap_cudu_inst_t *f1_inst, return i; } } + return -1; } @@ -99,27 +100,30 @@ int f1ap_remove_ue(f1ap_cudu_inst_t *f1_inst, break; } } + f1_inst->num_ues--; return 0; } int f1ap_get_du_ue_f1ap_id(f1ap_cudu_inst_t *f1_inst, - rnti_t rntiP) { + rnti_t rntiP) { 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; } } + return -1; } int f1ap_get_cu_ue_f1ap_id(f1ap_cudu_inst_t *f1_inst, - rnti_t rntiP) { + rnti_t rntiP) { 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; } } + return -1; } @@ -130,6 +134,7 @@ int f1ap_get_rnti_by_du_id(f1ap_cudu_inst_t *f1_inst, return f1_inst->f1ap_ue[i].rnti; } } + return -1; } @@ -140,6 +145,7 @@ int f1ap_get_rnti_by_cu_id(f1ap_cudu_inst_t *f1_inst, return f1_inst->f1ap_ue[i].rnti; } } + return -1; } @@ -150,6 +156,7 @@ int f1ap_get_du_uid(f1ap_cudu_inst_t *f1_inst, return i; } } + return -1; } @@ -160,6 +167,7 @@ int f1ap_get_cu_uid(f1ap_cudu_inst_t *f1_inst, return i; } } + return -1; } @@ -170,6 +178,7 @@ int f1ap_get_uid_by_rnti(f1ap_cudu_inst_t *f1_inst, return i; } } + return -1; } @@ -177,7 +186,10 @@ int f1ap_du_add_cu_ue_id(f1ap_cudu_inst_t *f1_inst, 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); - if (f1ap_uid < 0 || f1ap_uid >= MAX_MOBILES_PER_ENB) return -1; + + if (f1ap_uid < 0 || f1ap_uid >= MAX_MOBILES_PER_ENB) + return -1; + f1_inst->f1ap_ue[f1ap_uid].cu_ue_f1ap_id = cu_ue_f1ap_id; LOG_I(F1AP, "Adding cu_ue_f1ap_id %d for UE with RNTI %x\n", cu_ue_f1ap_id, f1_inst->f1ap_ue[f1ap_uid].rnti); return 0; @@ -187,7 +199,10 @@ int f1ap_cu_add_du_ue_id(f1ap_cudu_inst_t *f1_inst, 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); - if (f1ap_uid < 0 || f1ap_uid >= MAX_MOBILES_PER_ENB) return -1; + + if (f1ap_uid < 0 || f1ap_uid >= MAX_MOBILES_PER_ENB) + return -1; + f1_inst->f1ap_ue[f1ap_uid].du_ue_f1ap_id = du_ue_f1ap_id; 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; diff --git a/openair2/F1AP/f1ap_common.h b/openair2/F1AP/f1ap_common.h index 7781a78412..bb3b525518 100644 --- a/openair2/F1AP/f1ap_common.h +++ b/openair2/F1AP/f1ap_common.h @@ -31,7 +31,7 @@ */ #if HAVE_CONFIG_H_ -# include "config.h" + #include "config.h" #endif #ifndef F1AP_COMMON_H_ @@ -43,7 +43,7 @@ #define F1AP_TRANSACTION_IDENTIFIER_NUMBER 3 #if defined(EMIT_ASN_DEBUG_EXTERN) -inline void ASN_DEBUG(const char *fmt, ...); + inline void ASN_DEBUG(const char *fmt, ...); #endif #include "F1AP_RAT-FrequencyPriorityInformation.h" @@ -360,14 +360,14 @@ inline void ASN_DEBUG(const char *fmt, ...); /* Checking version of ASN1C compiler */ #if (ASN1C_ENVIRONMENT_VERSION < ASN1C_MINIMUM_VERSION) -# error "You are compiling f1ap with the wrong version of ASN1C" + # error "You are compiling f1ap with the wrong version of ASN1C" #endif #ifndef FALSE -# define FALSE (0) + #define FALSE (0) #endif #ifndef TRUE -# define TRUE (!FALSE) + #define TRUE (!FALSE) #endif #define F1AP_UE_ID_FMT "0x%06"PRIX32 @@ -375,20 +375,20 @@ inline void ASN_DEBUG(const char *fmt, ...); #include "assertions.h" #if defined(ENB_MODE) -# include "common/utils/LOG/log.h" -# include "f1ap_default_values.h" -# define F1AP_ERROR(x, args...) LOG_E(F1AP, x, ##args) -# define F1AP_WARN(x, args...) LOG_W(F1AP, x, ##args) -# define F1AP_TRAF(x, args...) LOG_I(F1AP, x, ##args) -# define F1AP_INFO(x, args...) LOG_I(F1AP, x, ##args) -# define F1AP_DEBUG(x, args...) LOG_I(F1AP, x, ##args) + #include "common/utils/LOG/log.h" + #include "f1ap_default_values.h" + #define F1AP_ERROR(x, args...) LOG_E(F1AP, x, ##args) + #define F1AP_WARN(x, args...) LOG_W(F1AP, x, ##args) + #define F1AP_TRAF(x, args...) LOG_I(F1AP, x, ##args) + #define F1AP_INFO(x, args...) LOG_I(F1AP, x, ##args) + #define F1AP_DEBUG(x, args...) LOG_I(F1AP, x, ##args) #else -//# include "mme_default_values.h" -# define F1AP_ERROR(x, args...) do { fprintf(stdout, "[F1AP][E]"x, ##args); } while(0) -# define F1AP_WARN(x, args...) do { fprintf(stdout, "[F1AP][W]"x, ##args); } while(0) -# define F1AP_TRAF(x, args...) do { fprintf(stdout, "[F1AP][T]"x, ##args); } while(0) -# define F1AP_INFO(x, args...) do { fprintf(stdout, "[F1AP][I]"x, ##args); } while(0) -# define F1AP_DEBUG(x, args...) do { fprintf(stdout, "[F1AP][D]"x, ##args); } while(0) + //# include "mme_default_values.h" + #define F1AP_ERROR(x, args...) do { fprintf(stdout, "[F1AP][E]"x, ##args); } while(0) + #define F1AP_WARN(x, args...) do { fprintf(stdout, "[F1AP][W]"x, ##args); } while(0) + #define F1AP_TRAF(x, args...) do { fprintf(stdout, "[F1AP][T]"x, ##args); } while(0) + #define F1AP_INFO(x, args...) do { fprintf(stdout, "[F1AP][I]"x, ##args); } while(0) + #define F1AP_DEBUG(x, args...) do { fprintf(stdout, "[F1AP][D]"x, ##args); } while(0) #endif //Forward declaration @@ -476,4 +476,17 @@ int f1ap_cu_add_du_ue_id(f1ap_cudu_inst_t *f1_inst, module_id_t cu_ue_f1ap_id, module_id_t du_ue_f1ap_id); +#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); + +//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_ */ diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index 51986ac0f5..490b0bf67a 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -36,12 +36,6 @@ #include "f1ap_itti_messaging.h" #include "f1ap_cu_interface_management.h" -extern f1ap_setup_req_t *f1ap_du_data_from_du; -extern RAN_CONTEXT_t RC; - -#define asn1cCalloc(VaR, TyPe, lOcPtr) TyPe *lOcPtr=VaR=(TyPe*) calloc(1,sizeof(TyPe)); -#define asn1cSequenceAdd(VaR, TyPe, lOcPtr) TyPe *lOcPtr=(TyPe*) calloc(1,sizeof(TyPe)); ASN_SEQUENCE_ADD(&VaR,lOcPtr); - int CU_send_RESET(instance_t instance, F1AP_Reset_t *Reset) { AssertFatal(1==0,"Not implemented yet\n"); } @@ -103,29 +97,30 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, message_p = itti_alloc_new_message(TASK_CU_F1, 0, F1AP_SETUP_REQ); /* assoc_id */ - F1AP_SETUP_REQ(message_p).assoc_id = assoc_id; + f1ap_setup_req_t *req=&F1AP_SETUP_REQ(message_p); + req->assoc_id = assoc_id; /* gNB_DU_id */ // this function exits if the ie is mandatory F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupRequestIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_DU_ID, true); - asn_INTEGER2ulong(&ie->value.choice.GNB_DU_ID, &F1AP_SETUP_REQ(message_p).gNB_DU_id); - LOG_D(F1AP, "F1AP_SETUP_REQ(message_p).gNB_DU_id %lu \n", F1AP_SETUP_REQ(message_p).gNB_DU_id); + asn_INTEGER2ulong(&ie->value.choice.GNB_DU_ID, &req->gNB_DU_id); + LOG_D(F1AP, "req->gNB_DU_id %lu \n", req->gNB_DU_id); /* gNB_DU_name */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupRequestIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_DU_Name, true); - F1AP_SETUP_REQ(message_p).gNB_DU_name = calloc(ie->value.choice.GNB_DU_Name.size + 1, sizeof(char)); - memcpy(F1AP_SETUP_REQ(message_p).gNB_DU_name, ie->value.choice.GNB_DU_Name.buf, + req->gNB_DU_name = calloc(ie->value.choice.GNB_DU_Name.size + 1, sizeof(char)); + memcpy(req->gNB_DU_name, ie->value.choice.GNB_DU_Name.buf, ie->value.choice.GNB_DU_Name.size); /* Convert the mme name to a printable string */ - F1AP_SETUP_REQ(message_p).gNB_DU_name[ie->value.choice.GNB_DU_Name.size] = '\0'; - LOG_D(F1AP, "F1AP_SETUP_REQ(message_p).gNB_DU_name %s \n", F1AP_SETUP_REQ(message_p).gNB_DU_name); + req->gNB_DU_name[ie->value.choice.GNB_DU_Name.size] = '\0'; + LOG_D(F1AP, "req->gNB_DU_name %s \n", req->gNB_DU_name); /* GNB_DU_Served_Cells_List */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupRequestIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_DU_Served_Cells_List, true); - F1AP_SETUP_REQ(message_p).num_cells_available = ie->value.choice.GNB_DU_Served_Cells_List.list.count; - LOG_D(F1AP, "F1AP_SETUP_REQ(message_p).num_cells_available %d \n", - F1AP_SETUP_REQ(message_p).num_cells_available); - int num_cells_available = F1AP_SETUP_REQ(message_p).num_cells_available; + req->num_cells_available = ie->value.choice.GNB_DU_Served_Cells_List.list.count; + LOG_D(F1AP, "req->num_cells_available %d \n", + req->num_cells_available); + int num_cells_available = req->num_cells_available; for (i=0; iserved_Cell_Information.fiveGS_TAC) { - OCTET_STRING_TO_INT16(served_cells_item_p->served_Cell_Information.fiveGS_TAC, F1AP_SETUP_REQ(message_p).tac[i]); - LOG_D(F1AP, "F1AP_SETUP_REQ(message_p).tac[%d] %d \n", - i, F1AP_SETUP_REQ(message_p).tac[i]); + OCTET_STRING_TO_INT16(served_cells_item_p->served_Cell_Information.fiveGS_TAC, req->cell[i].tac); + LOG_D(F1AP, "req->tac[%d] %d \n", i, req->cell[i].tac); } /* - nRCGI */ - TBCD_TO_MCC_MNC(&(served_cells_item_p->served_Cell_Information.nRCGI.pLMN_Identity), F1AP_SETUP_REQ(message_p).mcc[i], - F1AP_SETUP_REQ(message_p).mnc[i], - F1AP_SETUP_REQ(message_p).mnc_digit_length[i]); - // NR cellID - BIT_STRING_TO_NR_CELL_IDENTITY(&served_cells_item_p->served_Cell_Information.nRCGI.nRCellIdentity, - F1AP_SETUP_REQ(message_p).nr_cellid[i]); + addnRCGI(served_cells_item_p->served_Cell_Information.nRCGI, req->cell+i); + LOG_D(F1AP, "[SCTP %d] Received nRCGI: MCC %d, MNC %d, CELL_ID %llu\n", assoc_id, - F1AP_SETUP_REQ(message_p).mcc[i], - F1AP_SETUP_REQ(message_p).mnc[i], - (long long unsigned int)F1AP_SETUP_REQ(message_p).nr_cellid[i]); + req->cell[i].mcc, + req->cell[i].mnc, + (long long unsigned int)req->cell[i].nr_cellid); LOG_D(F1AP, "nr_cellId : %x %x %x %x %x\n", served_cells_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[0], served_cells_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[1], @@ -156,28 +146,28 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, served_cells_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[3], served_cells_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[4]); /* - nRPCI */ - F1AP_SETUP_REQ(message_p).nr_pci[i] = served_cells_item_p->served_Cell_Information.nRPCI; - LOG_D(F1AP, "F1AP_SETUP_REQ(message_p).nr_pci[%d] %d \n", - i, F1AP_SETUP_REQ(message_p).nr_pci[i]); + req->cell[i].nr_pci = served_cells_item_p->served_Cell_Information.nRPCI; + LOG_D(F1AP, "req->nr_pci[%d] %d \n", + i, req->cell[i].nr_pci); // System Information /* mib */ - F1AP_SETUP_REQ(message_p).mib[i] = calloc(served_cells_item_p->gNB_DU_System_Information->mIB_message.size + 1, sizeof(char)); - memcpy(F1AP_SETUP_REQ(message_p).mib[i], served_cells_item_p->gNB_DU_System_Information->mIB_message.buf, + req->mib[i] = calloc(served_cells_item_p->gNB_DU_System_Information->mIB_message.size + 1, sizeof(char)); + memcpy(req->mib[i], served_cells_item_p->gNB_DU_System_Information->mIB_message.buf, served_cells_item_p->gNB_DU_System_Information->mIB_message.size); /* Convert the mme name to a printable string */ - F1AP_SETUP_REQ(message_p).mib[i][served_cells_item_p->gNB_DU_System_Information->mIB_message.size] = '\0'; - F1AP_SETUP_REQ(message_p).mib_length[i] = served_cells_item_p->gNB_DU_System_Information->mIB_message.size; - LOG_D(F1AP, "F1AP_SETUP_REQ(message_p).mib[%d] %s , len = %d \n", - i, F1AP_SETUP_REQ(message_p).mib[i], F1AP_SETUP_REQ(message_p).mib_length[i]); + req->mib[i][served_cells_item_p->gNB_DU_System_Information->mIB_message.size] = '\0'; + req->mib_length[i] = served_cells_item_p->gNB_DU_System_Information->mIB_message.size; + LOG_D(F1AP, "req->mib[%d] %s , len = %d \n", + i, req->mib[i], req->mib_length[i]); /* sib1 */ - F1AP_SETUP_REQ(message_p).sib1[i] = calloc(served_cells_item_p->gNB_DU_System_Information->sIB1_message.size + 1, sizeof(char)); - memcpy(F1AP_SETUP_REQ(message_p).sib1[i], served_cells_item_p->gNB_DU_System_Information->sIB1_message.buf, + req->sib1[i] = calloc(served_cells_item_p->gNB_DU_System_Information->sIB1_message.size + 1, sizeof(char)); + memcpy(req->sib1[i], served_cells_item_p->gNB_DU_System_Information->sIB1_message.buf, served_cells_item_p->gNB_DU_System_Information->sIB1_message.size); /* Convert the mme name to a printable string */ - F1AP_SETUP_REQ(message_p).sib1[i][served_cells_item_p->gNB_DU_System_Information->sIB1_message.size] = '\0'; - F1AP_SETUP_REQ(message_p).sib1_length[i] = served_cells_item_p->gNB_DU_System_Information->sIB1_message.size; - LOG_D(F1AP, "F1AP_SETUP_REQ(message_p).sib1[%d] %s , len = %d \n", - i, F1AP_SETUP_REQ(message_p).sib1[i], F1AP_SETUP_REQ(message_p).sib1_length[i]); + req->sib1[i][served_cells_item_p->gNB_DU_System_Information->sIB1_message.size] = '\0'; + req->sib1_length[i] = served_cells_item_p->gNB_DU_System_Information->sIB1_message.size; + LOG_D(F1AP, "req->sib1[%d] %s , len = %d \n", + i, req->sib1[i], req->sib1_length[i]); } *f1ap_du_data_from_du = F1AP_SETUP_REQ(message_p); @@ -252,40 +242,34 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance, // This should be fixed enb_mod_idP = (module_id_t)0; cu_mod_idP = (module_id_t)0; - F1AP_F1AP_PDU_t pdu; - F1AP_F1SetupResponse_t *out; - F1AP_F1SetupResponseIEs_t *ie; - uint8_t *buffer; - uint32_t len; - int i = 0; + F1AP_F1AP_PDU_t pdu= {0}; + uint8_t *buffer=NULL; + uint32_t len=0; /* Create */ /* 0. Message Type */ - memset(&pdu, 0, sizeof(pdu)); pdu.present = F1AP_F1AP_PDU_PR_successfulOutcome; - pdu.choice.successfulOutcome = (F1AP_SuccessfulOutcome_t *)calloc(1, sizeof(F1AP_SuccessfulOutcome_t)); - pdu.choice.successfulOutcome->procedureCode = F1AP_ProcedureCode_id_F1Setup; - pdu.choice.successfulOutcome->criticality = F1AP_Criticality_reject; - pdu.choice.successfulOutcome->value.present = F1AP_SuccessfulOutcome__value_PR_F1SetupResponse; - out = &pdu.choice.successfulOutcome->value.choice.F1SetupResponse; + asn1cCalloc(pdu.choice.successfulOutcome, F1AP_SuccessfulOutcome_t, tmp); + tmp->procedureCode = F1AP_ProcedureCode_id_F1Setup; + tmp->criticality = F1AP_Criticality_reject; + tmp->value.present = F1AP_SuccessfulOutcome__value_PR_F1SetupResponse; + F1AP_F1SetupResponse_t *out = &pdu.choice.successfulOutcome->value.choice.F1SetupResponse; /* mandatory */ /* c1. Transaction ID (integer value)*/ - ie = (F1AP_F1SetupResponseIEs_t *)calloc(1, sizeof(F1AP_F1SetupResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_TransactionID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_F1SetupResponseIEs__value_PR_TransactionID; - ie->value.choice.TransactionID = F1AP_get_next_transaction_identifier(enb_mod_idP, cu_mod_idP); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + asn1cSequenceAdd(out->protocolIEs.list, F1AP_F1SetupResponseIEs_t, ie1); + ie1->id = F1AP_ProtocolIE_ID_id_TransactionID; + ie1->criticality = F1AP_Criticality_reject; + ie1->value.present = F1AP_F1SetupResponseIEs__value_PR_TransactionID; + ie1->value.choice.TransactionID = F1AP_get_next_transaction_identifier(enb_mod_idP, cu_mod_idP); /* optional */ /* c2. GNB_CU_Name */ if (f1ap_setup_resp->gNB_CU_name != NULL) { - ie = (F1AP_F1SetupResponseIEs_t *)calloc(1, sizeof(F1AP_F1SetupResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_Name; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_F1SetupResponseIEs__value_PR_GNB_CU_Name; - OCTET_STRING_fromBuf(&ie->value.choice.GNB_CU_Name, f1ap_setup_resp->gNB_CU_name, + asn1cSequenceAdd(out->protocolIEs.list, F1AP_F1SetupResponseIEs_t, ie2); + ie2->id = F1AP_ProtocolIE_ID_id_gNB_CU_Name; + ie2->criticality = F1AP_Criticality_ignore; + ie2->value.present = F1AP_F1SetupResponseIEs__value_PR_GNB_CU_Name; + OCTET_STRING_fromBuf(&ie2->value.choice.GNB_CU_Name, f1ap_setup_resp->gNB_CU_name, strlen(f1ap_setup_resp->gNB_CU_name)); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } /* mandatory */ @@ -294,84 +278,59 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance, LOG_D(F1AP, "num_cells_to_activate = %d \n", num_cells_to_activate); if (num_cells_to_activate >0) { - ie = (F1AP_F1SetupResponseIEs_t *)calloc(1, sizeof(F1AP_F1SetupResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_F1SetupResponseIEs__value_PR_Cells_to_be_Activated_List; + asn1cSequenceAdd(out->protocolIEs.list, F1AP_F1SetupResponseIEs_t, ie3); + ie3->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List; + ie3->criticality = F1AP_Criticality_reject; + ie3->value.present = F1AP_F1SetupResponseIEs__value_PR_Cells_to_be_Activated_List; - for (i=0; + for (int i=0; iid = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item; - cells_to_be_activated_list_item_ies->criticality = F1AP_Criticality_reject; - cells_to_be_activated_list_item_ies->value.present = F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item; + asn1cSequenceAdd(ie3->value.choice.Cells_to_be_Activated_List.list, + F1AP_Cells_to_be_Activated_List_ItemIEs_t, cells_to_be_activated_ies); + cells_to_be_activated_ies->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item; + cells_to_be_activated_ies->criticality = F1AP_Criticality_reject; + cells_to_be_activated_ies->value.present = F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item; /* 3.1 cells to be Activated list item */ - F1AP_Cells_to_be_Activated_List_Item_t cells_to_be_activated_list_item; - memset((void *)&cells_to_be_activated_list_item, 0, sizeof(F1AP_Cells_to_be_Activated_List_Item_t)); + F1AP_Cells_to_be_Activated_List_Item_t *cells_to_be_activated_item= + &cells_to_be_activated_ies->value.choice.Cells_to_be_Activated_List_Item; /* - nRCGI */ - F1AP_NRCGI_t nRCGI; - memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t)); - MCC_MNC_TO_PLMNID(f1ap_setup_resp->cells_to_activate[i].mcc, f1ap_setup_resp->cells_to_activate[i].mnc, f1ap_setup_resp->cells_to_activate[i].mnc_digit_length, - &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(f1ap_setup_resp->cells_to_activate[i].nr_cellid, &nRCGI.nRCellIdentity); - cells_to_be_activated_list_item.nRCGI = nRCGI; + addnRCGI(cells_to_be_activated_item->nRCGI, f1ap_setup_resp->cells_to_activate+i); /* optional */ /* - nRPCI */ if (1) { - cells_to_be_activated_list_item.nRPCI = (F1AP_NRPCI_t *)calloc(1, sizeof(F1AP_NRPCI_t)); - *cells_to_be_activated_list_item.nRPCI = f1ap_setup_resp->cells_to_activate[i].nrpci; // int 0..1007 + cells_to_be_activated_item->nRPCI = (F1AP_NRPCI_t *)calloc(1, sizeof(F1AP_NRPCI_t)); + *cells_to_be_activated_item->nRPCI = f1ap_setup_resp->cells_to_activate[i].nrpci; // int 0..1007 } /* optional */ /* - gNB-CU System Information */ if (1) { /* 3.1.2 gNB-CUSystem Information */ - F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *cells_to_be_activated_list_itemExtIEs; - cells_to_be_activated_list_itemExtIEs = (F1AP_Cells_to_be_Activated_List_ItemExtIEs_t *)calloc(1, sizeof(F1AP_Cells_to_be_Activated_List_ItemExtIEs_t)); - cells_to_be_activated_list_itemExtIEs->id = F1AP_ProtocolIE_ID_id_gNB_CUSystemInformation; - cells_to_be_activated_list_itemExtIEs->criticality = F1AP_Criticality_reject; - cells_to_be_activated_list_itemExtIEs->extensionValue.present = F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_GNB_CUSystemInformation; - F1AP_GNB_CUSystemInformation_t *gNB_CUSystemInformation = (F1AP_GNB_CUSystemInformation_t *)calloc(1, sizeof(F1AP_GNB_CUSystemInformation_t)); - //LOG_I(F1AP, "%s() SI %d size %d: ", __func__, i, f1ap_setup_resp->SI_container_length[i][0]); - //for (int n = 0; n < f1ap_setup_resp->SI_container_length[i][0]; n++) - // printf("%02x ", f1ap_setup_resp->SI_container[i][0][n]); - //printf("\n"); + F1AP_ProtocolExtensionContainer_154P112_t *p_154P112=calloc(1, sizeof(* p_154P112)); + cells_to_be_activated_item->iE_Extensions = (struct F1AP_ProtocolExtensionContainer *)p_154P112; + asn1cSequenceAdd(p_154P112->list, F1AP_Cells_to_be_Activated_List_ItemExtIEs_t, cells_to_be_activated_itemExtIEs); + cells_to_be_activated_itemExtIEs->id = F1AP_ProtocolIE_ID_id_gNB_CUSystemInformation; + cells_to_be_activated_itemExtIEs->criticality = F1AP_Criticality_reject; + cells_to_be_activated_itemExtIEs->extensionValue.present = F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_GNB_CUSystemInformation; + F1AP_GNB_CUSystemInformation_t *gNB_CUSystemInformation = + &cells_to_be_activated_itemExtIEs->extensionValue.choice.GNB_CUSystemInformation; // for (int sIBtype=2;sIBtype<33;sIBtype++) { //21 ? 33 ? for (int sIBtype=2; sIBtype<21; sIBtype++) { if (f1ap_setup_resp->cells_to_activate[i].SI_container[sIBtype]!=NULL) { AssertFatal(sIBtype < 6 || sIBtype == 9, "Illegal SI type %d\n",sIBtype); - F1AP_SibtypetobeupdatedListItem_t *sib_item = calloc(1,sizeof(*sib_item)); - memset((void *)sib_item,0,sizeof(*sib_item)); + asn1cSequenceAdd(gNB_CUSystemInformation->sibtypetobeupdatedlist.list, F1AP_SibtypetobeupdatedListItem_t, sib_item); sib_item->sIBtype = sIBtype; OCTET_STRING_fromBuf(&sib_item->sIBmessage, (const char *)f1ap_setup_resp->cells_to_activate[i].SI_container[sIBtype], f1ap_setup_resp->cells_to_activate[i].SI_container_length[sIBtype]); LOG_D(F1AP, "f1ap_setup_resp->SI_container_length[%d][%d] = %d \n", i,sIBtype,f1ap_setup_resp->cells_to_activate[i].SI_container_length[sIBtype]); - ASN_SEQUENCE_ADD(&gNB_CUSystemInformation->sibtypetobeupdatedlist.list,sib_item); } } - - cells_to_be_activated_list_itemExtIEs->extensionValue.choice.GNB_CUSystemInformation = *gNB_CUSystemInformation; - F1AP_ProtocolExtensionContainer_154P112_t p_154P112_t; - memset((void *)&p_154P112_t, 0, sizeof(F1AP_ProtocolExtensionContainer_154P112_t)); - ASN_SEQUENCE_ADD(&p_154P112_t.list, - cells_to_be_activated_list_itemExtIEs); - cells_to_be_activated_list_item.iE_Extensions = (struct F1AP_ProtocolExtensionContainer *)&p_154P112_t; - free(gNB_CUSystemInformation); - gNB_CUSystemInformation = NULL; } - - /* ADD */ - cells_to_be_activated_list_item_ies->value.choice.Cells_to_be_Activated_List_Item = cells_to_be_activated_list_item; - ASN_SEQUENCE_ADD(&ie->value.choice.Cells_to_be_Activated_List.list, - cells_to_be_activated_list_item_ies); } - - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } /* encode */ @@ -380,76 +339,68 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance, return -1; } + 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); return 0; } int CU_send_F1_SETUP_FAILURE(instance_t instance) { LOG_D(F1AP, "CU_send_F1_SETUP_FAILURE\n"); - module_id_t enb_mod_idP; - module_id_t cu_mod_idP; + module_id_t enb_mod_idP=0; + module_id_t cu_mod_idP=0; // This should be fixed - enb_mod_idP = (module_id_t)0; - cu_mod_idP = (module_id_t)0; - F1AP_F1AP_PDU_t pdu; - F1AP_F1SetupFailure_t *out; - F1AP_F1SetupFailureIEs_t *ie; - uint8_t *buffer; - uint32_t len; + F1AP_F1AP_PDU_t pdu= {0}; + uint8_t *buffer=NULL; + uint32_t len=0; /* Create */ /* 0. Message Type */ - memset(&pdu, 0, sizeof(pdu)); + asn1cCalloc(pdu.choice.unsuccessfulOutcome, F1AP_UnsuccessfulOutcome_t, UnsuccessfulOutcome); pdu.present = F1AP_F1AP_PDU_PR_unsuccessfulOutcome; - pdu.choice.unsuccessfulOutcome = (F1AP_UnsuccessfulOutcome_t *)calloc(1, sizeof(F1AP_UnsuccessfulOutcome_t)); - pdu.choice.unsuccessfulOutcome->procedureCode = F1AP_ProcedureCode_id_F1Setup; - pdu.choice.unsuccessfulOutcome->criticality = F1AP_Criticality_reject; - pdu.choice.unsuccessfulOutcome->value.present = F1AP_UnsuccessfulOutcome__value_PR_F1SetupFailure; - out = &pdu.choice.unsuccessfulOutcome->value.choice.F1SetupFailure; + UnsuccessfulOutcome->procedureCode = F1AP_ProcedureCode_id_F1Setup; + UnsuccessfulOutcome->criticality = F1AP_Criticality_reject; + UnsuccessfulOutcome->value.present = F1AP_UnsuccessfulOutcome__value_PR_F1SetupFailure; + F1AP_F1SetupFailure_t *out = &pdu.choice.unsuccessfulOutcome->value.choice.F1SetupFailure; /* mandatory */ /* c1. Transaction ID (integer value)*/ - ie = (F1AP_F1SetupFailureIEs_t *)calloc(1, sizeof(F1AP_F1SetupFailureIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_TransactionID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_F1SetupFailureIEs__value_PR_TransactionID; - ie->value.choice.TransactionID = F1AP_get_next_transaction_identifier(enb_mod_idP, cu_mod_idP); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + asn1cSequenceAdd(out->protocolIEs.list, F1AP_F1SetupFailureIEs_t, ie1); + ie1->id = F1AP_ProtocolIE_ID_id_TransactionID; + ie1->criticality = F1AP_Criticality_reject; + ie1->value.present = F1AP_F1SetupFailureIEs__value_PR_TransactionID; + ie1->value.choice.TransactionID = F1AP_get_next_transaction_identifier(enb_mod_idP, cu_mod_idP); /* mandatory */ /* c2. Cause */ - ie = (F1AP_F1SetupFailureIEs_t *)calloc(1, sizeof(F1AP_F1SetupFailureIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_Cause; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_F1SetupFailureIEs__value_PR_Cause; - ie->value.choice.Cause.present = F1AP_Cause_PR_radioNetwork; - ie->value.choice.Cause.choice.radioNetwork = F1AP_CauseRadioNetwork_unspecified; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + asn1cSequenceAdd(out->protocolIEs.list, F1AP_F1SetupFailureIEs_t, ie2); + ie2->id = F1AP_ProtocolIE_ID_id_Cause; + ie2->criticality = F1AP_Criticality_ignore; + ie2->value.present = F1AP_F1SetupFailureIEs__value_PR_Cause; + ie2->value.choice.Cause.present = F1AP_Cause_PR_radioNetwork; + ie2->value.choice.Cause.choice.radioNetwork = F1AP_CauseRadioNetwork_unspecified; /* optional */ /* c3. TimeToWait */ if (0) { - ie = (F1AP_F1SetupFailureIEs_t *)calloc(1, sizeof(F1AP_F1SetupFailureIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_TimeToWait; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_F1SetupFailureIEs__value_PR_TimeToWait; - ie->value.choice.TimeToWait = F1AP_TimeToWait_v10s; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + asn1cSequenceAdd(out->protocolIEs.list, F1AP_F1SetupFailureIEs_t, ie3); + ie3->id = F1AP_ProtocolIE_ID_id_TimeToWait; + ie3->criticality = F1AP_Criticality_ignore; + ie3->value.present = F1AP_F1SetupFailureIEs__value_PR_TimeToWait; + ie3->value.choice.TimeToWait = F1AP_TimeToWait_v10s; } /* optional */ /* c4. CriticalityDiagnostics*/ if (0) { - ie = (F1AP_F1SetupFailureIEs_t *)calloc(1, sizeof(F1AP_F1SetupFailureIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_CriticalityDiagnostics; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_F1SetupFailureIEs__value_PR_CriticalityDiagnostics; - ie->value.choice.CriticalityDiagnostics.procedureCode = (F1AP_ProcedureCode_t *)calloc(1, sizeof(F1AP_ProcedureCode_t)); - *ie->value.choice.CriticalityDiagnostics.procedureCode = F1AP_ProcedureCode_id_UEContextSetup; - ie->value.choice.CriticalityDiagnostics.triggeringMessage = (F1AP_TriggeringMessage_t *)calloc(1, sizeof(F1AP_TriggeringMessage_t)); - *ie->value.choice.CriticalityDiagnostics.triggeringMessage = F1AP_TriggeringMessage_initiating_message; - ie->value.choice.CriticalityDiagnostics.procedureCriticality = (F1AP_Criticality_t *)calloc(1, sizeof(F1AP_Criticality_t)); - *ie->value.choice.CriticalityDiagnostics.procedureCriticality = F1AP_Criticality_reject; - ie->value.choice.CriticalityDiagnostics.transactionID = (F1AP_TransactionID_t *)calloc(1, sizeof(F1AP_TransactionID_t)); - *ie->value.choice.CriticalityDiagnostics.transactionID = 0; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + asn1cSequenceAdd(out->protocolIEs.list, F1AP_F1SetupFailureIEs_t, ie4); + ie4->id = F1AP_ProtocolIE_ID_id_CriticalityDiagnostics; + ie4->criticality = F1AP_Criticality_ignore; + ie4->value.present = F1AP_F1SetupFailureIEs__value_PR_CriticalityDiagnostics; + asn1cCallocOne(ie4->value.choice.CriticalityDiagnostics.procedureCode, + F1AP_ProcedureCode_t, F1AP_ProcedureCode_id_UEContextSetup); + asn1cCallocOne(ie4->value.choice.CriticalityDiagnostics.triggeringMessage, + F1AP_TriggeringMessage_t, F1AP_TriggeringMessage_initiating_message); + asn1cCallocOne(ie4->value.choice.CriticalityDiagnostics.procedureCriticality, + F1AP_Criticality_t, F1AP_Criticality_reject); + asn1cCallocOne(ie4->value.choice.CriticalityDiagnostics.transactionID, + F1AP_TransactionID_t, 0); } /* encode */ @@ -458,6 +409,7 @@ int CU_send_F1_SETUP_FAILURE(instance_t instance) { return -1; } + 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); return 0; } @@ -522,20 +474,15 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu for (int i=0; inum_cells_to_activate; i++) { asn1cSequenceAdd(ieC3->value.choice.Cells_to_be_Activated_List.list,F1AP_Cells_to_be_Activated_List_ItemIEs_t, - cells_to_be_activated_list_item_ies); - cells_to_be_activated_list_item_ies->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item; - cells_to_be_activated_list_item_ies->criticality = F1AP_Criticality_reject; - cells_to_be_activated_list_item_ies->value.present = F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item; + cells_to_be_activated_ies); + cells_to_be_activated_ies->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item; + cells_to_be_activated_ies->criticality = F1AP_Criticality_reject; + cells_to_be_activated_ies->value.present = F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item; // 2.1 cells to be Activated list item - F1AP_Cells_to_be_Activated_List_Item_t *cells_to_be_activated_list_item=&cells_to_be_activated_list_item_ies->value.choice.Cells_to_be_Activated_List_Item; + F1AP_Cells_to_be_Activated_List_Item_t *cells_to_be_activated_list_item= + &cells_to_be_activated_ies->value.choice.Cells_to_be_Activated_List_Item; // - nRCGI - F1AP_NRCGI_t *nRCGI=&cells_to_be_activated_list_item->nRCGI; - MCC_MNC_TO_PLMNID(f1ap_gnb_cu_configuration_update->cells_to_activate[i].mcc, - f1ap_gnb_cu_configuration_update->cells_to_activate[i].mnc, - f1ap_gnb_cu_configuration_update->cells_to_activate[i].mnc_digit_length, - &nRCGI->pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(f1ap_gnb_cu_configuration_update->cells_to_activate[i].nr_cellid, - &nRCGI->nRCellIdentity); + addnRCGI(cells_to_be_activated_list_item->nRCGI, f1ap_gnb_cu_configuration_update->cells_to_activate+i); // optional // -nRPCI asn1cCalloc(cells_to_be_activated_list_item->nRPCI, F1AP_NRPCI_t, tmp); @@ -545,13 +492,14 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu F1AP_ProtocolExtensionContainer_154P112_t *p_154P112=(F1AP_ProtocolExtensionContainer_154P112_t *) calloc(1,sizeof(*p_154P112)); cells_to_be_activated_list_item->iE_Extensions = (struct F1AP_ProtocolExtensionContainer *)p_154P112; //F1AP_ProtocolExtensionContainer_154P112_t - asn1cSequenceAdd(p_154P112->list,F1AP_Cells_to_be_Activated_List_ItemExtIEs_t, cells_to_be_activated_list_itemExtIEs); - cells_to_be_activated_list_itemExtIEs->id = F1AP_ProtocolIE_ID_id_gNB_CUSystemInformation; - cells_to_be_activated_list_itemExtIEs->criticality = F1AP_Criticality_reject; - cells_to_be_activated_list_itemExtIEs->extensionValue.present = F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_GNB_CUSystemInformation; + asn1cSequenceAdd(p_154P112->list,F1AP_Cells_to_be_Activated_List_ItemExtIEs_t, cells_to_be_activated_itemExtIEs); + cells_to_be_activated_itemExtIEs->id = F1AP_ProtocolIE_ID_id_gNB_CUSystemInformation; + cells_to_be_activated_itemExtIEs->criticality = F1AP_Criticality_reject; + cells_to_be_activated_itemExtIEs->extensionValue.present = F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_GNB_CUSystemInformation; if (f1ap_gnb_cu_configuration_update->cells_to_activate[i].num_SI > 0) { - F1AP_GNB_CUSystemInformation_t *gNB_CUSystemInformation = &cells_to_be_activated_list_itemExtIEs->extensionValue.choice.GNB_CUSystemInformation; + F1AP_GNB_CUSystemInformation_t *gNB_CUSystemInformation = + &cells_to_be_activated_itemExtIEs->extensionValue.choice.GNB_CUSystemInformation; //LOG_I(F1AP, "%s() SI %d size %d: ", __func__, i, f1ap_setup_resp->SI_container_length[i][0]); //for (int n = 0; n < f1ap_setup_resp->SI_container_length[i][0]; n++) // printf("%02x ", f1ap_setup_resp->SI_container[i][0][n]); @@ -861,14 +809,8 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu return -1; } - - printf("F1AP gNB-CU CONFIGURATION UPDATE : "); - - for (int i=0; iassoc_id, buffer, len, 0); return 0; } diff --git a/openair2/F1AP/f1ap_cu_interface_management.h b/openair2/F1AP/f1ap_cu_interface_management.h index de7dcfe99b..83da037925 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.h +++ b/openair2/F1AP/f1ap_cu_interface_management.h @@ -72,39 +72,39 @@ int CU_send_F1_SETUP_FAILURE(instance_t instance); * gNB-DU Configuration Update */ int CU_handle_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); int CU_send_gNB_DU_CONFIGURATION_FAILURE(instance_t instance, - F1AP_GNBDUConfigurationUpdateFailure_t *GNBDUConfigurationUpdateFailure); + F1AP_GNBDUConfigurationUpdateFailure_t *GNBDUConfigurationUpdateFailure); int CU_send_gNB_DU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, - F1AP_GNBDUConfigurationUpdateAcknowledge_t *GNBDUConfigurationUpdateAcknowledge); + F1AP_GNBDUConfigurationUpdateAcknowledge_t *GNBDUConfigurationUpdateAcknowledge); /* * gNB-CU Configuration Update */ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configuration_update_t *f1ap_gnb_cu_configuration_update); int CU_handle_gNB_CU_CONFIGURATION_UPDATE_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); int CU_handle_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); /* * gNB-DU Resource Coordination */ int CU_handle_gNB_DU_RESOURCE_COORDINATION_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); int CU_send_gNB_DU_RESOURCE_COORDINATION_RESPONSE(instance_t instance, - F1AP_GNBDUResourceCoordinationResponse_t *GNBDUResourceCoordinationResponse); + F1AP_GNBDUResourceCoordinationResponse_t *GNBDUResourceCoordinationResponse); #endif /* F1AP_CU_INTERFACE_MANAGEMENT_H_ */ diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index 1129d67643..40bf156806 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -53,61 +53,52 @@ extern f1ap_cudu_inst_t f1ap_cu_inst[MAX_eNB]; extern RAN_CONTEXT_t RC; int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { - + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { LOG_D(F1AP, "CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER\n"); // decode the F1 message - // get the rrc message from the contauiner + // get the rrc message from the contauiner // call func rrc_eNB_decode_ccch: <-- needs some update here MessageDef *message_p; F1AP_InitialULRRCMessageTransfer_t *container; F1AP_InitialULRRCMessageTransferIEs_t *ie; - rnti_t rnti; sdu_size_t ccch_sdu_len; int CC_id =0; - - DevAssert(pdu != NULL); - + if (stream != 0) { LOG_E(F1AP, "[SCTP %d] Received F1 on stream != 0 (%d)\n", assoc_id, stream); return -1; } - // TODO: use context + + // 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); - - /* NRCGI + /* NRCGI * TODO: process NRCGI */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_NRCGI, true); - - uint64_t nr_cellid; BIT_STRING_TO_NR_CELL_IDENTITY(&ie->value.choice.NRCGI.nRCellIdentity,nr_cellid); - /* RNTI */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_C_RNTI, true); rnti = ie->value.choice.C_RNTI; - /* RRC Container */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_RRCContainer, true); 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) { message_p = itti_alloc_new_message (TASK_CU_F1, 0, NR_RRC_MAC_CCCH_DATA_IND); @@ -125,69 +116,75 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, LOG_I(F1AP, "%s() RRCContainer (CCCH) size %ld: ", __func__, ie->value.choice.RRCContainer.size); + for (int i = 0; i < ie->value.choice.RRCContainer.size; i++) printf("%02x ", RRC_MAC_CCCH_DATA_IND (message_p).sdu[i]); - printf("\n"); + printf("\n"); /* DUtoCURRCContainer */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_DUtoCURRCContainer, true); + if (ie) { NR_RRC_MAC_CCCH_DATA_IND (message_p).du_to_cu_rrc_container = malloc(sizeof(OCTET_STRING_t)); NR_RRC_MAC_CCCH_DATA_IND (message_p).du_to_cu_rrc_container->size = ie->value.choice.DUtoCURRCContainer.size; NR_RRC_MAC_CCCH_DATA_IND (message_p).du_to_cu_rrc_container->buf = malloc(ie->value.choice.DUtoCURRCContainer.size); memcpy(NR_RRC_MAC_CCCH_DATA_IND (message_p).du_to_cu_rrc_container->buf, - ie->value.choice.DUtoCURRCContainer.buf, - ie->value.choice.DUtoCURRCContainer.size); - + ie->value.choice.DUtoCURRCContainer.buf, + ie->value.choice.DUtoCURRCContainer.size); } + // Find instance from nr_cellid int rrc_inst = -1; + if (RC.nrrrc[GNB_INSTANCE_TO_MODULE_ID(instance)]->node_type == ngran_gNB_CU) { - for (int i=0;inr_cellid == nr_cellid) { - rrc_inst = i; + rrc_inst = i; break; } } } else { - for (int i=0;inr_cellid == nr_cellid) { - rrc_inst = i; + rrc_inst = i; break; } } } 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); + if (f1ap_uid < 0 ) { LOG_E(F1AP, "Failed to add UE \n"); itti_free(ITTI_MSG_ORIGIN_ID(message_p), message_p); 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) { - NR_RRC_MAC_CCCH_DATA_IND (message_p).frame = 0; + 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).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; + 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).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).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; + RRC_MAC_CCCH_DATA_IND (message_p).CC_id = CC_id; itti_send_msg_to_task (TASK_RRC_ENB, instance, message_p); } @@ -201,116 +198,94 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, //void CU_send_DL_RRC_MESSAGE_TRANSFER(F1AP_DLRRCMessageTransfer_t *DLRRCMessageTransfer) { int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance, - f1ap_dl_rrc_message_t *f1ap_dl_rrc) - { - + f1ap_dl_rrc_message_t *f1ap_dl_rrc) { LOG_D(F1AP, "CU send DL_RRC_MESSAGE_TRANSFER \n"); - F1AP_F1AP_PDU_t pdu; + F1AP_F1AP_PDU_t pdu= {0}; F1AP_DLRRCMessageTransfer_t *out; - F1AP_DLRRCMessageTransferIEs_t *ie; - - uint8_t *buffer; - uint32_t len; - + uint8_t *buffer=NULL; + uint32_t len=0; /* Create */ - /* 0. Message Type */ - memset(&pdu, 0, sizeof(pdu)); + /* 0. Message Type */ pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; - pdu.choice.initiatingMessage = (F1AP_InitiatingMessage_t *)calloc(1, sizeof(F1AP_InitiatingMessage_t)); - pdu.choice.initiatingMessage->procedureCode = F1AP_ProcedureCode_id_DLRRCMessageTransfer; - pdu.choice.initiatingMessage->criticality = F1AP_Criticality_ignore; - pdu.choice.initiatingMessage->value.present = F1AP_InitiatingMessage__value_PR_DLRRCMessageTransfer; - out = &pdu.choice.initiatingMessage->value.choice.DLRRCMessageTransfer; - + asn1cCalloc(pdu.choice.initiatingMessage, F1AP_InitiatingMessage_t, tmp); + tmp->procedureCode = F1AP_ProcedureCode_id_DLRRCMessageTransfer; + tmp->criticality = F1AP_Criticality_ignore; + tmp->value.present = F1AP_InitiatingMessage__value_PR_DLRRCMessageTransfer; + out = &tmp->value.choice.DLRRCMessageTransfer; /* mandatory */ /* c1. GNB_CU_UE_F1AP_ID */ - - ie = (F1AP_DLRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_DLRRCMessageTransferIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_GNB_CU_UE_F1AP_ID; - ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(&f1ap_cu_inst[instance], f1ap_dl_rrc->rnti); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + asn1cSequenceAdd(out->protocolIEs.list, F1AP_DLRRCMessageTransferIEs_t, ie1); + 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); LOG_I(F1AP, "Setting GNB_CU_UE_F1AP_ID %llu associated with UE RNTI %x (instance %ld)\n", - (unsigned long long int)ie->value.choice.GNB_CU_UE_F1AP_ID, f1ap_dl_rrc->rnti, instance); - - + (unsigned long long int)ie1->value.choice.GNB_CU_UE_F1AP_ID, f1ap_dl_rrc->rnti, instance); /* mandatory */ /* c2. GNB_DU_UE_F1AP_ID */ - ie = (F1AP_DLRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_DLRRCMessageTransferIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(&f1ap_cu_inst[instance], f1ap_dl_rrc->rnti); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - LOG_I(F1AP, "GNB_DU_UE_F1AP_ID %llu associated with UE RNTI %x \n", (unsigned long long int)ie->value.choice.GNB_DU_UE_F1AP_ID, f1ap_dl_rrc->rnti); - + asn1cSequenceAdd(out->protocolIEs.list, F1AP_DLRRCMessageTransferIEs_t, ie2); + 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); + 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 */ - /* if (f1ap_dl_rrc->old_gNB_DU_ue_id != 0xFFFFFFFF) { - ie = (F1AP_DLRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_DLRRCMessageTransferIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_oldgNB_DU_UE_F1AP_ID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_NOTHING; - ie->value.choice.oldgNB_DU_UE_F1AP_ID = f1ap_dl_rrc->old_gNB_DU_ue_id; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - }*/ - + /* if (f1ap_dl_rrc->old_gNB_DU_ue_id != 0xFFFFFFFF) { + asn1cSequenceAdd(out->protocolIEs.list, F1AP_DLRRCMessageTransferIEs_t, ie3); + ie3->id = F1AP_ProtocolIE_ID_id_oldgNB_DU_UE_F1AP_ID; + ie3->criticality = F1AP_Criticality_reject; + ie3->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_NOTHING; + ie3->value.choice.oldgNB_DU_UE_F1AP_ID = f1ap_dl_rrc->old_gNB_DU_ue_id; + }*/ /* mandatory */ /* c4. SRBID */ - ie = (F1AP_DLRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_DLRRCMessageTransferIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_SRBID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_SRBID; - ie->value.choice.SRBID = f1ap_dl_rrc->srb_id; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + asn1cSequenceAdd(out->protocolIEs.list, F1AP_DLRRCMessageTransferIEs_t, ie4); + ie4->id = F1AP_ProtocolIE_ID_id_SRBID; + ie4->criticality = F1AP_Criticality_reject; + ie4->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_SRBID; + ie4->value.choice.SRBID = f1ap_dl_rrc->srb_id; /* optional */ /* c5. ExecuteDuplication */ if (f1ap_dl_rrc->execute_duplication) { - ie = (F1AP_DLRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_DLRRCMessageTransferIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_ExecuteDuplication; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_ExecuteDuplication; - ie->value.choice.ExecuteDuplication = F1AP_ExecuteDuplication_true; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + asn1cSequenceAdd(out->protocolIEs.list, F1AP_DLRRCMessageTransferIEs_t, ie5); + ie5->id = F1AP_ProtocolIE_ID_id_ExecuteDuplication; + ie5->criticality = F1AP_Criticality_ignore; + ie5->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_ExecuteDuplication; + ie5->value.choice.ExecuteDuplication = F1AP_ExecuteDuplication_true; } // issue in here /* mandatory */ /* c6. RRCContainer */ - ie = (F1AP_DLRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_DLRRCMessageTransferIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_RRCContainer; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_RRCContainer; - OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, (const char*)f1ap_dl_rrc->rrc_container, f1ap_dl_rrc->rrc_container_length); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - - LOG_I(F1AP, "%s() RRCContainer size %d: ", __func__, f1ap_dl_rrc->rrc_container_length); - for (int i = 0; i < ie->value.choice.RRCContainer.size; i++) - printf("%02x ", f1ap_dl_rrc->rrc_container[i]); - printf("\n"); + asn1cSequenceAdd(out->protocolIEs.list, F1AP_DLRRCMessageTransferIEs_t, ie6); + ie6->id = F1AP_ProtocolIE_ID_id_RRCContainer; + ie6->criticality = F1AP_Criticality_reject; + ie6->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_RRCContainer; + OCTET_STRING_fromBuf(&ie6->value.choice.RRCContainer, + (const char *)f1ap_dl_rrc->rrc_container, f1ap_dl_rrc->rrc_container_length); /* optional */ /* c7. RAT_FrequencyPriorityInformation */ - /* TODO */ + /* TODO */ if (0) { int endc=1; - ie = (F1AP_DLRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_DLRRCMessageTransferIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_RAT_FrequencyPriorityInformation; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_RAT_FrequencyPriorityInformation; + asn1cSequenceAdd(out->protocolIEs.list, F1AP_DLRRCMessageTransferIEs_t, ie7); + ie7->id = F1AP_ProtocolIE_ID_id_RAT_FrequencyPriorityInformation; + ie7->criticality = F1AP_Criticality_reject; + ie7->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_RAT_FrequencyPriorityInformation; + if (endc==1) { - ie->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_eNDC; - ie->value.choice.RAT_FrequencyPriorityInformation.choice.eNDC = 123L; + ie7->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_eNDC; + ie7->value.choice.RAT_FrequencyPriorityInformation.choice.eNDC = 123L; + } else { + ie7->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_nGRAN; + ie7->value.choice.RAT_FrequencyPriorityInformation.choice.nGRAN = 11L; } - else { - ie->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_nGRAN; - ie->value.choice.RAT_FrequencyPriorityInformation.choice.nGRAN = 11L; - } - //ie->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_rAT_FrequencySelectionPriority; - //ie->value.choice.RAT_FrequencyPriorityInformation.choice.rAT_FrequencySelectionPriority = 123L; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + //ie->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_rAT_FrequencySelectionPriority; + //ie->value.choice.RAT_FrequencyPriorityInformation.choice.rAT_FrequencySelectionPriority = 123L; } /* encode */ @@ -319,8 +294,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*/); - + cu_f1ap_itti_send_sctp_data_req(instance, f1ap_assoc_id /* BK: fix me*/, buffer, len, 0 /* BK: fix me*/); return 0; } @@ -332,63 +306,53 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { - LOG_D(F1AP, "CU_handle_UL_RRC_MESSAGE_TRANSFER \n"); - F1AP_ULRRCMessageTransfer_t *container; F1AP_ULRRCMessageTransferIEs_t *ie; - uint64_t cu_ue_f1ap_id; uint64_t du_ue_f1ap_id; uint64_t srb_id; - DevAssert(pdu != NULL); - + if (stream != 0) { LOG_E(F1AP, "[SCTP %d] Received F1 on stream != 0 (%d)\n", - assoc_id, stream); + assoc_id, stream); return -1; } container = &pdu->choice.initiatingMessage->value.choice.ULRRCMessageTransfer; - - /* GNB_CU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_ULRRCMessageTransferIEs_t, ie, container, 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)); - - + 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)); /* 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)); - - + 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)); /* mandatory */ /* SRBID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_ULRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_SRBID, true); srb_id = ie->value.choice.SRBID; - if (srb_id < 1 ) - LOG_E(F1AP, "Unexpected UL RRC MESSAGE for srb_id %lu \n", srb_id); - else - LOG_D(F1AP, "UL RRC MESSAGE for srb_id %lu in DCCH \n", srb_id); + if (srb_id < 1 ) + LOG_E(F1AP, "Unexpected UL RRC MESSAGE for srb_id %lu \n", srb_id); + else + LOG_D(F1AP, "UL RRC MESSAGE for srb_id %lu in DCCH \n", srb_id); // issue in here /* mandatory */ /* RRC Container */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_ULRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_RRCContainer, true); - // print message in debug mode - + // print message in debug mode // create an ITTI message and copy SDU - /* - + message_p = itti_alloc_new_message (TASK_CU_F1, 0, RRC_DCCH_DATA_IND); RRC_DCCH_DATA_IND (message_p).sdu_p = malloc(ie->value.choice.RRCContainer.size); @@ -412,19 +376,17 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, ctxt.eNB_index = 0; ctxt.configured = 1; mem_block_t *mb = get_free_mem_block(ie->value.choice.RRCContainer.size,__func__); - memcpy((void*)mb->data,(void*)ie->value.choice.RRCContainer.buf,ie->value.choice.RRCContainer.size); + memcpy((void *)mb->data,(void *)ie->value.choice.RRCContainer.buf,ie->value.choice.RRCContainer.size); LOG_I(F1AP, "Calling pdcp_data_ind for UE RNTI %x srb_id %lu with size %ld (DCCH) \n", ctxt.rnti, srb_id, ie->value.choice.RRCContainer.size); - //LOG_I(F1AP, "%s() RRCContainer size %lu: ", __func__, ie->value.choice.RRCContainer.size); //for (int i = 0; i < ie->value.choice.RRCContainer.size; i++) // printf("%02x ", mb->data[i]); //printf("\n"); - pdcp_data_ind (&ctxt, - 1, // srb_flag - 0, // embms_flag - srb_id, - ie->value.choice.RRCContainer.size, - mb); + 1, // srb_flag + 0, // embms_flag + srb_id, + ie->value.choice.RRCContainer.size, + mb); return 0; } diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.h b/openair2/F1AP/f1ap_cu_rrc_message_transfer.h index 68ebbfe41e..c8c9d3a6f9 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.h +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.h @@ -34,9 +34,9 @@ #define F1AP_CU_RRC_MESSAGE_TRANSFER_H_ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance, f1ap_dl_rrc_message_t *f1ap_dl_rrc); diff --git a/openair2/F1AP/f1ap_cu_task.c b/openair2/F1AP/f1ap_cu_task.c index 24aec70b57..4432879715 100644 --- a/openair2/F1AP/f1ap_cu_task.c +++ b/openair2/F1AP/f1ap_cu_task.c @@ -49,28 +49,27 @@ void cu_task_handle_sctp_association_ind(instance_t instance, sctp_new_associati } void cu_task_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp) { - DevAssert(sctp_new_association_resp != NULL); if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) { LOG_W(F1AP, "Received unsuccessful result for SCTP association (%u), instance %ld, cnx_id %u\n", - sctp_new_association_resp->sctp_state, - instance, - sctp_new_association_resp->ulp_cnx_id); + 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); - //f1ap_handle_setup_message(instance, sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN); - return; // exit -1 for debugging + + //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 + // 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, @@ -85,12 +84,9 @@ void cu_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat void cu_task_handle_sctp_data_ind(instance_t instance, sctp_data_ind_t *sctp_data_ind) { int result; - DevAssert(sctp_data_ind != NULL); - f1ap_handle_message(instance, sctp_data_ind->assoc_id, sctp_data_ind->stream, - sctp_data_ind->buffer, sctp_data_ind->buffer_length); - + sctp_data_ind->buffer, sctp_data_ind->buffer_length); result = itti_free(TASK_UNKNOWN, sctp_data_ind->buffer); AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); } @@ -99,69 +95,63 @@ void cu_task_send_sctp_init_req(instance_t enb_id) { // 1. get the itti msg, and retrive the enb_id from the message // 2. use RC.rrc[enb_id] to fill the sctp_init_t with the ip, port // 3. creat an itti message to init - LOG_I(F1AP, "F1AP_CU_SCTP_REQ(create socket)\n"); MessageDef *message_p = NULL; - message_p = itti_alloc_new_message (TASK_CU_F1, 0, SCTP_INIT_MSG); message_p->ittiMsg.sctp_init.port = F1AP_PORT_NUMBER; message_p->ittiMsg.sctp_init.ppid = F1AP_SCTP_PPID; message_p->ittiMsg.sctp_init.ipv4 = 1; message_p->ittiMsg.sctp_init.ipv6 = 0; message_p->ittiMsg.sctp_init.nb_ipv4_addr = 1; + if (RC.nrrrc[0]->node_type == ngran_gNB_CU) { message_p->ittiMsg.sctp_init.ipv4_address[0] = inet_addr(RC.nrrrc[enb_id]->eth_params_s.my_addr); - } else{ + } else { message_p->ittiMsg.sctp_init.ipv4_address[0] = inet_addr(RC.rrc[enb_id]->eth_params_s.my_addr); } + /* * SR WARNING: ipv6 multi-homing fails sometimes for localhost. * * * * Disable it for now. */ message_p->ittiMsg.sctp_init.nb_ipv6_addr = 0; message_p->ittiMsg.sctp_init.ipv6_address[0] = "0:0:0:0:0:0:0:1"; - itti_send_msg_to_task(TASK_SCTP, enb_id, message_p); } void *F1AP_CU_task(void *arg) { - MessageDef *received_msg = NULL; int result; - LOG_I(F1AP, "Starting F1AP at CU\n"); - // no RLC in CU, initialize mem pool for PDCP pool_buffer_init(); - itti_mark_task_ready(TASK_CU_F1); - cu_task_send_sctp_init_req(0); while (1) { itti_receive_msg(TASK_CU_F1, &received_msg); - switch (ITTI_MSG_ID(received_msg)) { + switch (ITTI_MSG_ID(received_msg)) { 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), - &received_msg->ittiMsg.sctp_new_association_ind); + &received_msg->ittiMsg.sctp_new_association_ind); break; case SCTP_NEW_ASSOCIATION_RESP: LOG_I(F1AP, "CU Task Received SCTP_NEW_ASSOCIATION_RESP for instance %ld\n", ITTI_MSG_DESTINATION_INSTANCE(received_msg)); cu_task_handle_sctp_association_resp(ITTI_MSG_DESTINATION_INSTANCE(received_msg), - &received_msg->ittiMsg.sctp_new_association_resp); + &received_msg->ittiMsg.sctp_new_association_resp); break; case SCTP_DATA_IND: LOG_I(F1AP, "CU Task Received SCTP_DATA_IND for Instance %ld\n", ITTI_MSG_DESTINATION_INSTANCE(received_msg)); cu_task_handle_sctp_data_ind(ITTI_MSG_DESTINATION_INSTANCE(received_msg), - &received_msg->ittiMsg.sctp_data_ind); + &received_msg->ittiMsg.sctp_data_ind); break; case F1AP_SETUP_RESP: // from rrc @@ -169,7 +159,7 @@ void *F1AP_CU_task(void *arg) { // CU_send_f1setup_resp(ITTI_MSG_DESTINATION_INSTANCE(received_msg), // &F1AP_SETUP_RESP(received_msg)); CU_send_F1_SETUP_RESPONSE(ITTI_MSG_DESTINATION_INSTANCE(received_msg), - &F1AP_SETUP_RESP(received_msg)); + &F1AP_SETUP_RESP(received_msg)); break; case F1AP_GNB_CU_CONFIGURATION_UPDATE: // from rrc @@ -177,19 +167,19 @@ void *F1AP_CU_task(void *arg) { // CU_send_f1setup_resp(ITTI_MSG_DESTINATION_INSTANCE(received_msg), // &F1AP_SETUP_RESP(received_msg)); CU_send_gNB_CU_CONFIGURATION_UPDATE(ITTI_MSG_DESTINATION_INSTANCE(received_msg), - &F1AP_GNB_CU_CONFIGURATION_UPDATE(received_msg)); + &F1AP_GNB_CU_CONFIGURATION_UPDATE(received_msg)); break; case F1AP_DL_RRC_MESSAGE: // from rrc LOG_I(F1AP, "CU Task Received F1AP_DL_RRC_MESSAGE\n"); CU_send_DL_RRC_MESSAGE_TRANSFER(ITTI_MSG_DESTINATION_INSTANCE(received_msg), - &F1AP_DL_RRC_MESSAGE(received_msg)); + &F1AP_DL_RRC_MESSAGE(received_msg)); break; case F1AP_UE_CONTEXT_SETUP_REQ: // from rrc LOG_I(F1AP, "CU Task Received F1AP_UE_CONTEXT_SETUP_REQ\n"); CU_send_UE_CONTEXT_SETUP_REQUEST(ITTI_MSG_DESTINATION_INSTANCE(received_msg), - &F1AP_UE_CONTEXT_SETUP_REQ(received_msg)); + &F1AP_UE_CONTEXT_SETUP_REQ(received_msg)); break; case F1AP_UE_CONTEXT_RELEASE_CMD: // from rrc @@ -198,13 +188,13 @@ void *F1AP_CU_task(void *arg) { &F1AP_UE_CONTEXT_RELEASE_CMD(received_msg)); break; -// case F1AP_SETUP_RESPONSE: // This is from RRC -// CU_send_F1_SETUP_RESPONSE(instance, *f1ap_setup_ind, &(F1AP_SETUP_RESP) f1ap_setup_resp) -// break; - -// case F1AP_SETUP_FAILURE: // This is from RRC -// CU_send_F1_SETUP_FAILURE(instance, *f1ap_setup_ind, &(F1AP_SETUP_FAILURE) f1ap_setup_failure) -// break; + // case F1AP_SETUP_RESPONSE: // This is from RRC + // CU_send_F1_SETUP_RESPONSE(instance, *f1ap_setup_ind, &(F1AP_SETUP_RESP) f1ap_setup_resp) + // break; + + // case F1AP_SETUP_FAILURE: // This is from RRC + // CU_send_F1_SETUP_FAILURE(instance, *f1ap_setup_ind, &(F1AP_SETUP_FAILURE) f1ap_setup_failure) + // break; case TERMINATE_MESSAGE: LOG_W(F1AP, " *** Exiting F1AP thread\n"); @@ -216,9 +206,9 @@ void *F1AP_CU_task(void *arg) { ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg)); break; } // switch + result = itti_free (ITTI_MSG_ORIGIN_ID(received_msg), received_msg); AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); - received_msg = NULL; } // while diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 1f77c6a06c..70cd8b5ce0 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -49,725 +49,562 @@ 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) { + asn1cCallocOne(toFill->maxDataBurstVolume, + F1AP_MaxDataBurstVolume_t, 1L); + } +} + int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_req) { - F1AP_F1AP_PDU_t pdu; - F1AP_UEContextSetupRequest_t *out; - F1AP_UEContextSetupRequestIEs_t *ie; - - uint8_t *buffer; - uint32_t len; - int i = 0, j = 0; - + F1AP_F1AP_PDU_t pdu= {0}; + uint8_t *buffer=NULL; + uint32_t len=0; /* Create */ /* 0. Message Type */ - memset(&pdu, 0, sizeof(pdu)); pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; - pdu.choice.initiatingMessage = (F1AP_InitiatingMessage_t *)calloc(1, sizeof(F1AP_InitiatingMessage_t)); - pdu.choice.initiatingMessage->procedureCode = F1AP_ProcedureCode_id_UEContextSetup; - pdu.choice.initiatingMessage->criticality = F1AP_Criticality_reject; - pdu.choice.initiatingMessage->value.present = F1AP_InitiatingMessage__value_PR_UEContextSetupRequest; - out = &pdu.choice.initiatingMessage->value.choice.UEContextSetupRequest; - + asn1cCalloc(pdu.choice.initiatingMessage, F1AP_InitiatingMessage_t, tmp); + tmp->procedureCode = F1AP_ProcedureCode_id_UEContextSetup; + tmp->criticality = F1AP_Criticality_reject; + tmp->value.present = F1AP_InitiatingMessage__value_PR_UEContextSetupRequest; + F1AP_UEContextSetupRequest_t *out = &pdu.choice.initiatingMessage->value.choice.UEContextSetupRequest; /* mandatory */ /* c1. GNB_CU_UE_F1AP_ID */ - ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_GNB_CU_UE_F1AP_ID; - ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_ue_context_setup_req->gNB_CU_ue_id; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupRequestIEs_t, ie1); + ie1->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; + ie1->criticality = F1AP_Criticality_reject; + ie1->value.present = F1AP_UEContextSetupRequestIEs__value_PR_GNB_CU_UE_F1AP_ID; + ie1->value.choice.GNB_CU_UE_F1AP_ID = f1ap_ue_context_setup_req->gNB_CU_ue_id; /* optional */ /* c2. GNB_DU_UE_F1AP_ID */ if (f1ap_ue_context_setup_req->gNB_DU_ue_id) { - ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie->value.choice.GNB_DU_UE_F1AP_ID = *f1ap_ue_context_setup_req->gNB_DU_ue_id; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupRequestIEs_t, ie2); + ie2->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; + ie2->criticality = F1AP_Criticality_ignore; + ie2->value.present = F1AP_UEContextSetupRequestIEs__value_PR_GNB_DU_UE_F1AP_ID; + ie2->value.choice.GNB_DU_UE_F1AP_ID = *f1ap_ue_context_setup_req->gNB_DU_ue_id; } /* mandatory */ /* c3. SpCell_ID */ - ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_SpCell_ID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_NRCGI; + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupRequestIEs_t, ie3); + ie3->id = F1AP_ProtocolIE_ID_id_SpCell_ID; + ie3->criticality = F1AP_Criticality_reject; + ie3->value.present = F1AP_UEContextSetupRequestIEs__value_PR_NRCGI; /* - nRCGI */ - F1AP_NRCGI_t nRCGI; - memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t)); - MCC_MNC_TO_PLMNID(f1ap_du_data_from_du->mcc[0],//f1ap_ue_context_setup_req->mcc, - f1ap_du_data_from_du->mnc[0],//f1ap_ue_context_setup_req->mnc, - f1ap_du_data_from_du->mnc_digit_length[0],//f1ap_ue_context_setup_req->mnc_digit_length, - &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(f1ap_du_data_from_du->nr_cellid[0], &nRCGI.nRCellIdentity); - - ie->value.choice.NRCGI = nRCGI; - - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + addnRCGI(ie3->value.choice.NRCGI, f1ap_du_data_from_du->cell); /* mandatory */ /* c4. ServCellIndex */ - ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_ServCellIndex; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_ServCellIndex; - ie->value.choice.ServCellIndex = 2; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupRequestIEs_t, ie4); + ie4->id = F1AP_ProtocolIE_ID_id_ServCellIndex; + ie4->criticality = F1AP_Criticality_reject; + ie4->value.present = F1AP_UEContextSetupRequestIEs__value_PR_ServCellIndex; + ie4->value.choice.ServCellIndex = 2; /* optional */ /* c5. CellULConfigured */ if (0) { - ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_SpCellULConfigured; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_CellULConfigured; - ie->value.choice.CellULConfigured = F1AP_CellULConfigured_ul; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupRequestIEs_t, ie5); + ie5->id = F1AP_ProtocolIE_ID_id_SpCellULConfigured; + ie5->criticality = F1AP_Criticality_ignore; + ie5->value.present = F1AP_UEContextSetupRequestIEs__value_PR_CellULConfigured; + ie5->value.choice.CellULConfigured = F1AP_CellULConfigured_ul; } /* mandatory */ /* c6. CUtoDURRCInformation */ - ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_CUtoDURRCInformation; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_CUtoDURRCInformation; - + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupRequestIEs_t, ie6); + ie6->id = F1AP_ProtocolIE_ID_id_CUtoDURRCInformation; + ie6->criticality = F1AP_Criticality_reject; + ie6->value.present = F1AP_UEContextSetupRequestIEs__value_PR_CUtoDURRCInformation; /* optional */ /* 6.1 cG_ConfigInfo */ - ie->value.choice.CUtoDURRCInformation.cG_ConfigInfo = (F1AP_CG_ConfigInfo_t *)calloc(1, sizeof(F1AP_CG_ConfigInfo_t)); - OCTET_STRING_fromBuf(ie->value.choice.CUtoDURRCInformation.cG_ConfigInfo, "asdsa1d32sa1d31asd31as", - strlen("asdsa1d32sa1d31asd31as")); + const char cG_ConfigInfoStr[]="asdsa1d32sa1d31asd31as"; + asn1cCalloc(ie6->value.choice.CUtoDURRCInformation.cG_ConfigInfo, F1AP_CG_ConfigInfo_t, cG_ConfigInfo); + OCTET_STRING_fromBuf(cG_ConfigInfo, cG_ConfigInfoStr, strlen( cG_ConfigInfoStr )) ; /* optional */ /* 6.2 uE_CapabilityRAT_ContainerList */ - ie->value.choice.CUtoDURRCInformation.uE_CapabilityRAT_ContainerList = (F1AP_UE_CapabilityRAT_ContainerList_t *)calloc(1, sizeof(F1AP_UE_CapabilityRAT_ContainerList_t)); - OCTET_STRING_fromBuf(ie->value.choice.CUtoDURRCInformation.uE_CapabilityRAT_ContainerList, "asdsa1d32sa1d31asd31as", - strlen("asdsa1d32sa1d31asd31as")); + asn1cCalloc(ie6->value.choice.CUtoDURRCInformation.uE_CapabilityRAT_ContainerList, F1AP_UE_CapabilityRAT_ContainerList_t, uE_CapabilityRAT_ContainerList ); + OCTET_STRING_fromBuf(uE_CapabilityRAT_ContainerList, cG_ConfigInfoStr, strlen( cG_ConfigInfoStr )) ; /* optional */ /* 6.3 measConfig */ - ie->value.choice.CUtoDURRCInformation.measConfig = (F1AP_MeasConfig_t *)calloc(1, sizeof(F1AP_MeasConfig_t)); - OCTET_STRING_fromBuf(ie->value.choice.CUtoDURRCInformation.measConfig, "asdsa1d32sa1d31asd31as", - strlen("asdsa1d32sa1d31asd31as")); + asn1cCalloc(ie6->value.choice.CUtoDURRCInformation.measConfig, F1AP_MeasConfig_t, measConfig); + OCTET_STRING_fromBuf(measConfig, cG_ConfigInfoStr, strlen( cG_ConfigInfoStr )) ; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - -//if (0) { /* mandatory */ /* c7. Candidate_SpCell_List */ if (0) { - ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_Candidate_SpCell_List; //90 - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_Candidate_SpCell_List; - - for (i=0; - i<0; - i++) { - - F1AP_Candidate_SpCell_ItemIEs_t *candidate_spCell_item_ies; - candidate_spCell_item_ies = (F1AP_Candidate_SpCell_ItemIEs_t *)calloc(1, sizeof(F1AP_Candidate_SpCell_ItemIEs_t)); - candidate_spCell_item_ies->id = F1AP_ProtocolIE_ID_id_Candidate_SpCell_Item; // 91 - candidate_spCell_item_ies->criticality = F1AP_Criticality_reject; - candidate_spCell_item_ies->value.present = F1AP_Candidate_SpCell_ItemIEs__value_PR_Candidate_SpCell_Item; - - /* 7.1 Candidate_SpCell_Item */ - F1AP_Candidate_SpCell_Item_t candidate_spCell_item; - memset((void *)&candidate_spCell_item, 0, sizeof(F1AP_Candidate_SpCell_Item_t)); - - /* - candidate_SpCell_ID */ - F1AP_NRCGI_t nRCGI; - /* TODO add correct mcc/mnc */ - MCC_MNC_TO_PLMNID(f1ap_ue_context_setup_req->mcc, - f1ap_ue_context_setup_req->mnc, - f1ap_ue_context_setup_req->mnc_digit_length, - &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(f1ap_ue_context_setup_req->nr_cellid, &nRCGI.nRCellIdentity); - - candidate_spCell_item.candidate_SpCell_ID = nRCGI; - - /* ADD */ - candidate_spCell_item_ies->value.choice.Candidate_SpCell_Item = candidate_spCell_item; - ASN_SEQUENCE_ADD(&ie->value.choice.Candidate_SpCell_List.list, - candidate_spCell_item_ies); + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupRequestIEs_t, ie7); + ie7->id = F1AP_ProtocolIE_ID_id_Candidate_SpCell_List; //90 + ie7->criticality = F1AP_Criticality_ignore; + ie7->value.present = F1AP_UEContextSetupRequestIEs__value_PR_Candidate_SpCell_List; + + for (int i=0; i<0; i++) { + asn1cSequenceAdd(ie7->value.choice.Candidate_SpCell_List.list,F1AP_Candidate_SpCell_ItemIEs_t, candidate_spCell_item_ies); + candidate_spCell_item_ies->id = F1AP_ProtocolIE_ID_id_Candidate_SpCell_Item; // 91 + candidate_spCell_item_ies->criticality = F1AP_Criticality_reject; + candidate_spCell_item_ies->value.present = F1AP_Candidate_SpCell_ItemIEs__value_PR_Candidate_SpCell_Item; + /* 7.1 Candidate_SpCell_Item */ + F1AP_Candidate_SpCell_Item_t *candidate_spCell_item= + &candidate_spCell_item_ies->value.choice.Candidate_SpCell_Item; + /* - candidate_SpCell_ID */ + //FixMe: first cell ??? + addnRCGI(candidate_spCell_item->candidate_SpCell_ID,f1ap_ue_context_setup_req); + /* TODO add correct mcc/mnc */ + } } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - } - + /* optional */ /* c8. DRXCycle */ if (0) { - ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_DRXCycle; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_DRXCycle; + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupRequestIEs_t, ie8); + ie8->id = F1AP_ProtocolIE_ID_id_DRXCycle; + ie8->criticality = F1AP_Criticality_ignore; + ie8->value.present = F1AP_UEContextSetupRequestIEs__value_PR_DRXCycle; /* 8.1 longDRXCycleLength */ - ie->value.choice.DRXCycle.longDRXCycleLength = F1AP_LongDRXCycleLength_ms10; // enum - + ie8->value.choice.DRXCycle.longDRXCycleLength = F1AP_LongDRXCycleLength_ms10; // enum + /* optional */ /* 8.2 shortDRXCycleLength */ if (0) { - ie->value.choice.DRXCycle.shortDRXCycleLength = (F1AP_ShortDRXCycleLength_t *)calloc(1, sizeof(F1AP_ShortDRXCycleLength_t)); - *ie->value.choice.DRXCycle.shortDRXCycleLength = F1AP_ShortDRXCycleLength_ms2; // enum + asn1cCallocOne(ie6->value.choice.DRXCycle.shortDRXCycleLength, + F1AP_ShortDRXCycleLength_t, F1AP_ShortDRXCycleLength_ms2); // enum } - + /* optional */ /* 8.3 shortDRXCycleTimer */ if (0) { - ie->value.choice.DRXCycle.shortDRXCycleTimer = (F1AP_ShortDRXCycleTimer_t *)calloc(1, sizeof(F1AP_ShortDRXCycleTimer_t)); - *ie->value.choice.DRXCycle.shortDRXCycleTimer = 123L; + asn1cCallocOne(ie8->value.choice.DRXCycle.shortDRXCycleTimer, + F1AP_ShortDRXCycleTimer_t, 123L); } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } /* optional */ /* c9. ResourceCoordinationTransferContainer */ if (0) { - ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_ResourceCoordinationTransferContainer; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_ResourceCoordinationTransferContainer; - - ie->value.choice.ResourceCoordinationTransferContainer.buf = malloc(4); - ie->value.choice.ResourceCoordinationTransferContainer.size = 4; - strncpy((char *)ie->value.choice.ResourceCoordinationTransferContainer.buf, "123", 4); - - - OCTET_STRING_fromBuf(&ie->value.choice.ResourceCoordinationTransferContainer, "asdsa1d32sa1d31asd31as", + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupRequestIEs_t, ie9); + ie9->id = F1AP_ProtocolIE_ID_id_ResourceCoordinationTransferContainer; + ie9->criticality = F1AP_Criticality_ignore; + ie9->value.present = F1AP_UEContextSetupRequestIEs__value_PR_ResourceCoordinationTransferContainer; + ie9->value.choice.ResourceCoordinationTransferContainer.buf = malloc(4); + ie9->value.choice.ResourceCoordinationTransferContainer.size = 4; + strncpy((char *)ie9->value.choice.ResourceCoordinationTransferContainer.buf, "123", 4); + OCTET_STRING_fromBuf(&ie9->value.choice.ResourceCoordinationTransferContainer, "asdsa1d32sa1d31asd31as", strlen("asdsa1d32sa1d31asd31as")); - - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } /* mandatory */ /* c10. SCell_ToBeSetup_List */ - if(0){ - ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_SCell_ToBeSetup_List; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_SCell_ToBeSetup_List; + if(0) { + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupRequestIEs_t, ie10); + ie10->id = F1AP_ProtocolIE_ID_id_SCell_ToBeSetup_List; + ie10->criticality = F1AP_Criticality_ignore; + ie10->value.present = F1AP_UEContextSetupRequestIEs__value_PR_SCell_ToBeSetup_List; - for (i=0; - i<0; - i++) { - // - F1AP_SCell_ToBeSetup_ItemIEs_t *scell_toBeSetup_item_ies; - scell_toBeSetup_item_ies = (F1AP_SCell_ToBeSetup_ItemIEs_t *)calloc(1, sizeof(F1AP_SCell_ToBeSetup_ItemIEs_t)); - scell_toBeSetup_item_ies->id = F1AP_ProtocolIE_ID_id_SCell_ToBeSetup_Item; //53 - scell_toBeSetup_item_ies->criticality = F1AP_Criticality_ignore; - scell_toBeSetup_item_ies->value.present = F1AP_SCell_ToBeSetup_ItemIEs__value_PR_SCell_ToBeSetup_Item; + for (int i=0; i<0; i++) { + // + asn1cSequenceAdd(ie10->value.choice.SCell_ToBeSetup_List.list, F1AP_SCell_ToBeSetup_ItemIEs_t, scell_toBeSetup_item_ies); + scell_toBeSetup_item_ies->id = F1AP_ProtocolIE_ID_id_SCell_ToBeSetup_Item; //53 + scell_toBeSetup_item_ies->criticality = F1AP_Criticality_ignore; + scell_toBeSetup_item_ies->value.present = F1AP_SCell_ToBeSetup_ItemIEs__value_PR_SCell_ToBeSetup_Item; + /* 10.1 SCell_ToBeSetup_Item */ + F1AP_SCell_ToBeSetup_Item_t *scell_toBeSetup_item=&scell_toBeSetup_item_ies->value.choice.SCell_ToBeSetup_Item; + /* 10.1.1 sCell_ID */ + addnRCGI(scell_toBeSetup_item->sCell_ID, f1ap_ue_context_setup_req); + /* TODO correct MCC/MNC */ + /* 10.1.2 sCellIndex */ + scell_toBeSetup_item->sCellIndex = 3; // issue here - /* 10.1 SCell_ToBeSetup_Item */ - F1AP_SCell_ToBeSetup_Item_t scell_toBeSetup_item; - memset((void *)&scell_toBeSetup_item, 0, sizeof(F1AP_SCell_ToBeSetup_Item_t)); - - /* 10.1.1 sCell_ID */ - F1AP_NRCGI_t nRCGI; - /* TODO correct MCC/MNC */ - MCC_MNC_TO_PLMNID(f1ap_ue_context_setup_req->mcc, - f1ap_ue_context_setup_req->mnc, - f1ap_ue_context_setup_req->mnc_digit_length, - &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); - scell_toBeSetup_item.sCell_ID = nRCGI; - - /* 10.1.2 sCellIndex */ - scell_toBeSetup_item.sCellIndex = 3; // issue here - - /* OPTIONAL */ - /* 10.1.3 sCellULConfigured*/ - if (0) { - scell_toBeSetup_item.sCellULConfigured = (F1AP_CellULConfigured_t *)calloc(1, sizeof(F1AP_CellULConfigured_t)); - *scell_toBeSetup_item.sCellULConfigured = F1AP_CellULConfigured_ul_and_sul; // enum - } - - /* ADD */ - scell_toBeSetup_item_ies->value.choice.SCell_ToBeSetup_Item = scell_toBeSetup_item; - - ASN_SEQUENCE_ADD(&ie->value.choice.SCell_ToBeSetup_List.list, - scell_toBeSetup_item_ies); + /* OPTIONAL */ + /* 10.1.3 sCellULConfigured*/ + if (0) { + asn1cCallocOne(scell_toBeSetup_item->sCellULConfigured, + F1AP_CellULConfigured_t, F1AP_CellULConfigured_ul_and_sul); // enum + } + } } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - } - /* mandatory */ /* c11. SRBs_ToBeSetup_List */ - ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_SRBs_ToBeSetup_List; - ie->criticality = F1AP_Criticality_reject; // ? - ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_SRBs_ToBeSetup_List; + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupRequestIEs_t, ie11); + ie11->id = F1AP_ProtocolIE_ID_id_SRBs_ToBeSetup_List; + ie11->criticality = F1AP_Criticality_reject; // ? + ie11->value.present = F1AP_UEContextSetupRequestIEs__value_PR_SRBs_ToBeSetup_List; - for (i=0; - i<1; - i++) { + for (int i=0; i<1; i++) { // - F1AP_SRBs_ToBeSetup_ItemIEs_t *srbs_toBeSetup_item_ies; - srbs_toBeSetup_item_ies = (F1AP_SRBs_ToBeSetup_ItemIEs_t *)calloc(1, sizeof(F1AP_SRBs_ToBeSetup_ItemIEs_t)); + asn1cSequenceAdd(ie11->value.choice.SRBs_ToBeSetup_List.list, F1AP_SRBs_ToBeSetup_ItemIEs_t, srbs_toBeSetup_item_ies); srbs_toBeSetup_item_ies->id = F1AP_ProtocolIE_ID_id_SRBs_ToBeSetup_Item; // 73 srbs_toBeSetup_item_ies->criticality = F1AP_Criticality_ignore; srbs_toBeSetup_item_ies->value.present = F1AP_SRBs_ToBeSetup_ItemIEs__value_PR_SRBs_ToBeSetup_Item; - /* 11.1 SRBs_ToBeSetup_Item */ - F1AP_SRBs_ToBeSetup_Item_t srbs_toBeSetup_item; - memset((void *)&srbs_toBeSetup_item, 0, sizeof(F1AP_SRBs_ToBeSetup_Item_t)); - + F1AP_SRBs_ToBeSetup_Item_t *srbs_toBeSetup_item=&srbs_toBeSetup_item_ies->value.choice.SRBs_ToBeSetup_Item; /* 11.1.1 sRBID */ - srbs_toBeSetup_item.sRBID = 2L; - + srbs_toBeSetup_item->sRBID = 2L; /* OPTIONAL */ /* 11.1.2 duplicationIndication */ - //if (0) { - srbs_toBeSetup_item.duplicationIndication = (F1AP_DuplicationIndication_t *)calloc(1, sizeof(F1AP_DuplicationIndication_t)); - srbs_toBeSetup_item.duplicationIndication = F1AP_DuplicationIndication_true; // enum + asn1cCallocOne(srbs_toBeSetup_item->duplicationIndication, + F1AP_DuplicationIndication_t, F1AP_DuplicationIndication_true); // enum //} - - /* ADD */ - srbs_toBeSetup_item_ies->value.choice.SRBs_ToBeSetup_Item = srbs_toBeSetup_item; - ASN_SEQUENCE_ADD(&ie->value.choice.SRBs_ToBeSetup_List.list, - srbs_toBeSetup_item_ies); } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ /* c12. DRBs_ToBeSetup_List */ - ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_DRBs_ToBeSetup_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_DRBs_ToBeSetup_List; - + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupRequestIEs_t, ie12); + ie12->id = F1AP_ProtocolIE_ID_id_DRBs_ToBeSetup_List; + ie12->criticality = F1AP_Criticality_reject; + ie12->value.present = F1AP_UEContextSetupRequestIEs__value_PR_DRBs_ToBeSetup_List; LOG_I(F1AP, "Length of drbs_to_be_setup: %d \n", f1ap_ue_context_setup_req->drbs_to_be_setup_length); - for (i = 0; i < f1ap_ue_context_setup_req->drbs_to_be_setup_length; i++) { + + for (int i = 0; i < f1ap_ue_context_setup_req->drbs_to_be_setup_length; i++) { // - F1AP_DRBs_ToBeSetup_ItemIEs_t *drbs_toBeSetup_item_ies; - drbs_toBeSetup_item_ies = (F1AP_DRBs_ToBeSetup_ItemIEs_t *)calloc(1, sizeof(F1AP_DRBs_ToBeSetup_ItemIEs_t)); + asn1cSequenceAdd(ie12->value.choice.DRBs_ToBeSetup_List.list, F1AP_DRBs_ToBeSetup_ItemIEs_t, drbs_toBeSetup_item_ies); drbs_toBeSetup_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_ToBeSetup_Item; drbs_toBeSetup_item_ies->criticality = F1AP_Criticality_reject; drbs_toBeSetup_item_ies->value.present = F1AP_DRBs_ToBeSetup_ItemIEs__value_PR_DRBs_ToBeSetup_Item; - /* 12.1 DRBs_ToBeSetup_Item */ - F1AP_DRBs_ToBeSetup_Item_t drbs_toBeSetup_item; - memset((void *)&drbs_toBeSetup_item, 0, sizeof(F1AP_DRBs_ToBeSetup_Item_t)); - + F1AP_DRBs_ToBeSetup_Item_t *drbs_toBeSetup_item=&drbs_toBeSetup_item_ies->value.choice.DRBs_ToBeSetup_Item; /* 12.1.1 dRBID */ - drbs_toBeSetup_item.dRBID = f1ap_ue_context_setup_req->drbs_to_be_setup[i].drb_id; // 9 - + drbs_toBeSetup_item->dRBID = f1ap_ue_context_setup_req->drbs_to_be_setup[i].drb_id; // 9 /* 12.1.2 qoSInformation */ int some_decide_qos = 0; // BK: Need Check + if (some_decide_qos) { - drbs_toBeSetup_item.qoSInformation.present = F1AP_QoSInformation_PR_eUTRANQoS; - + drbs_toBeSetup_item->qoSInformation.present = F1AP_QoSInformation_PR_eUTRANQoS; /* 12.1.2.1 eUTRANQoS */ - drbs_toBeSetup_item.qoSInformation.choice.eUTRANQoS = (F1AP_EUTRANQoS_t *)calloc(1, sizeof(F1AP_EUTRANQoS_t)); - + asn1cCalloc(drbs_toBeSetup_item->qoSInformation.choice.eUTRANQoS, F1AP_EUTRANQoS_t, eUTRANQoS); /* 12.1.2.1.1 qCI */ - drbs_toBeSetup_item.qoSInformation.choice.eUTRANQoS->qCI = 254L; - + eUTRANQoS->qCI = 254L; /* 12.1.2.1.2 allocationAndRetentionPriority */ { /* 12.1.2.1.2.1 priorityLevel */ - drbs_toBeSetup_item.qoSInformation.choice.eUTRANQoS->allocationAndRetentionPriority.priorityLevel = F1AP_PriorityLevel_highest; // enum - + eUTRANQoS->allocationAndRetentionPriority.priorityLevel = F1AP_PriorityLevel_highest; // enum /* 12.1.2.1.2.2 pre_emptionCapability */ - drbs_toBeSetup_item.qoSInformation.choice.eUTRANQoS->allocationAndRetentionPriority.pre_emptionCapability = F1AP_Pre_emptionCapability_may_trigger_pre_emption; // enum - + eUTRANQoS->allocationAndRetentionPriority.pre_emptionCapability = F1AP_Pre_emptionCapability_may_trigger_pre_emption; // enum /* 12.1.2.1.2.2 pre_emptionVulnerability */ - drbs_toBeSetup_item.qoSInformation.choice.eUTRANQoS->allocationAndRetentionPriority.pre_emptionVulnerability = F1AP_Pre_emptionVulnerability_not_pre_emptable; // enum + eUTRANQoS->allocationAndRetentionPriority.pre_emptionVulnerability = F1AP_Pre_emptionVulnerability_not_pre_emptable; // enum } /* OPTIONAL */ /* 12.1.2.1.3 gbrQosInformation */ if (0) { - drbs_toBeSetup_item.qoSInformation.choice.eUTRANQoS->gbrQosInformation = (F1AP_GBR_QosInformation_t *)calloc(1, sizeof(F1AP_GBR_QosInformation_t)); - asn_long2INTEGER(&drbs_toBeSetup_item.qoSInformation.choice.eUTRANQoS->gbrQosInformation->e_RAB_MaximumBitrateDL, 1L); - asn_long2INTEGER(&drbs_toBeSetup_item.qoSInformation.choice.eUTRANQoS->gbrQosInformation->e_RAB_MaximumBitrateUL, 1L); - asn_long2INTEGER(&drbs_toBeSetup_item.qoSInformation.choice.eUTRANQoS->gbrQosInformation->e_RAB_GuaranteedBitrateDL, 1L); - asn_long2INTEGER(&drbs_toBeSetup_item.qoSInformation.choice.eUTRANQoS->gbrQosInformation->e_RAB_GuaranteedBitrateUL, 1L); + eUTRANQoS->gbrQosInformation = (F1AP_GBR_QosInformation_t *)calloc(1, sizeof(F1AP_GBR_QosInformation_t)); + asn_long2INTEGER(&eUTRANQoS->gbrQosInformation->e_RAB_MaximumBitrateDL, 1L); + asn_long2INTEGER(&eUTRANQoS->gbrQosInformation->e_RAB_MaximumBitrateUL, 1L); + asn_long2INTEGER(&eUTRANQoS->gbrQosInformation->e_RAB_GuaranteedBitrateDL, 1L); + asn_long2INTEGER(&eUTRANQoS->gbrQosInformation->e_RAB_GuaranteedBitrateUL, 1L); } - - } else { + } else { /* 12.1.2 DRB_Information */ - drbs_toBeSetup_item.qoSInformation.present = F1AP_QoSInformation_PR_choice_extension; - - F1AP_QoSInformation_ExtIEs_t *ie; - ie = (F1AP_QoSInformation_ExtIEs_t *)calloc(1, sizeof(F1AP_QoS_Characteristics_ExtIEs_t)); + drbs_toBeSetup_item->qoSInformation.present = F1AP_QoSInformation_PR_choice_extension; + F1AP_QoSInformation_ExtIEs_t *ie = (F1AP_QoSInformation_ExtIEs_t *)calloc(1, sizeof(*ie)); ie->id = F1AP_ProtocolIE_ID_id_DRB_Information; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_QoSInformation_ExtIEs__value_PR_DRB_Information; F1AP_DRB_Information_t *DRB_Information = &ie->value.choice.DRB_Information; - - drbs_toBeSetup_item.qoSInformation.choice.choice_extension = (struct F1AP_ProtocolIE_SingleContainer*)ie; - - + drbs_toBeSetup_item->qoSInformation.choice.choice_extension = (struct F1AP_ProtocolIE_SingleContainer *)ie; /* 12.1.2.1 dRB_QoS */ { /* qoS_Characteristics */ { int some_decide_qoS_characteristics = 1; // BK: Need Check + if (some_decide_qoS_characteristics) { DRB_Information->dRB_QoS.qoS_Characteristics.present = F1AP_QoS_Characteristics_PR_non_Dynamic_5QI; - DRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI = (F1AP_NonDynamic5QIDescriptor_t *)calloc(1, sizeof(F1AP_NonDynamic5QIDescriptor_t)); - - /* fiveQI */ - DRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->fiveQI = 1L; - - /* OPTIONAL */ - /* qoSPriorityLevel */ - if (0) { - DRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel = (long *)calloc(1, sizeof(long)); - *DRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel = 1L; - } - - /* OPTIONAL */ - /* averagingWindow */ - if (0) { - DRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow = (F1AP_AveragingWindow_t *)calloc(1, sizeof(F1AP_AveragingWindow_t)); - *DRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow = 1L; - } - - /* OPTIONAL */ - /* maxDataBurstVolume */ - if (0) { - DRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume = (F1AP_MaxDataBurstVolume_t *)calloc(1, sizeof(F1AP_MaxDataBurstVolume_t)); - *DRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume = 1L; - } - + setQos(DRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI); } else { DRB_Information->dRB_QoS.qoS_Characteristics.present = F1AP_QoS_Characteristics_PR_dynamic_5QI; - DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI = (F1AP_Dynamic5QIDescriptor_t *)calloc(1, sizeof(F1AP_Dynamic5QIDescriptor_t)); - + asn1cCalloc(DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI, F1AP_Dynamic5QIDescriptor_t, tmp); /* qoSPriorityLevel */ - DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->qoSPriorityLevel = 1L; - + tmp->qoSPriorityLevel = 1L; /* packetDelayBudget */ - DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->packetDelayBudget = 1L; - + tmp->packetDelayBudget = 1L; /* packetErrorRate */ - DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->packetErrorRate.pER_Scalar = 1L; - DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->packetErrorRate.pER_Exponent = 6L; - + tmp->packetErrorRate.pER_Scalar = 1L; + tmp->packetErrorRate.pER_Exponent = 6L; /* OPTIONAL */ /* delayCritical */ if (0) { - DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->delayCritical = (long *)calloc(1, sizeof(long)); - *DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->delayCritical = 1L; + asn1cCallocOne(DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->delayCritical, + long, 1L); } /* OPTIONAL */ /* averagingWindow */ if (0) { - DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->averagingWindow = (F1AP_AveragingWindow_t *)calloc(1, sizeof(F1AP_AveragingWindow_t)); - *DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->averagingWindow = 1L; + asn1cCallocOne(DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->averagingWindow, + F1AP_AveragingWindow_t, 1L); } /* OPTIONAL */ /* maxDataBurstVolume */ if (0) { - DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->maxDataBurstVolume = (F1AP_MaxDataBurstVolume_t *)calloc(1, sizeof(F1AP_MaxDataBurstVolume_t)); - *DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->maxDataBurstVolume = 1L; + asn1cCallocOne(DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->maxDataBurstVolume, + F1AP_MaxDataBurstVolume_t, 1L); } - } // if some_decide_qoS_characteristics - } // qoS_Characteristics - /* nGRANallocationRetentionPriority */ { - DRB_Information->dRB_QoS.nGRANallocationRetentionPriority.priorityLevel = F1AP_PriorityLevel_highest; // enum - DRB_Information->dRB_QoS.nGRANallocationRetentionPriority.pre_emptionCapability = F1AP_Pre_emptionCapability_shall_not_trigger_pre_emption; // enum - DRB_Information->dRB_QoS.nGRANallocationRetentionPriority.pre_emptionVulnerability = F1AP_Pre_emptionVulnerability_not_pre_emptable; // enum + DRB_Information->dRB_QoS.nGRANallocationRetentionPriority.priorityLevel = F1AP_PriorityLevel_highest; // enum + DRB_Information->dRB_QoS.nGRANallocationRetentionPriority.pre_emptionCapability = F1AP_Pre_emptionCapability_shall_not_trigger_pre_emption; // enum + DRB_Information->dRB_QoS.nGRANallocationRetentionPriority.pre_emptionVulnerability = F1AP_Pre_emptionVulnerability_not_pre_emptable; // enum } // nGRANallocationRetentionPriority /* OPTIONAL */ /* gBR_QoS_Flow_Information */ if (0) { - DRB_Information->dRB_QoS.gBR_QoS_Flow_Information = (F1AP_GBR_QoSFlowInformation_t *)calloc(1, sizeof(F1AP_GBR_QoSFlowInformation_t)); - asn_long2INTEGER(&DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxFlowBitRateDownlink, 1L); - asn_long2INTEGER(&DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxFlowBitRateUplink, 1L); - asn_long2INTEGER(&DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->guaranteedFlowBitRateDownlink, 1L); - asn_long2INTEGER(&DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->guaranteedFlowBitRateUplink, 1L); + asn1cCalloc(DRB_Information->dRB_QoS.gBR_QoS_Flow_Information, F1AP_GBR_QoSFlowInformation_t, tmp); + asn_long2INTEGER(&tmp->maxFlowBitRateDownlink, 1L); + asn_long2INTEGER(&tmp->maxFlowBitRateUplink, 1L); + asn_long2INTEGER(&tmp->guaranteedFlowBitRateDownlink, 1L); + asn_long2INTEGER(&tmp->guaranteedFlowBitRateUplink, 1L); /* OPTIONAL */ /* maxPacketLossRateDownlink */ if (0) { - DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateDownlink = (F1AP_MaxPacketLossRate_t *)calloc(1, sizeof(F1AP_MaxPacketLossRate_t)); - *DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateDownlink = 1L; + asn1cCallocOne(DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateDownlink, + F1AP_MaxPacketLossRate_t, 1L); } /* OPTIONAL */ /* maxPacketLossRateUplink */ if (0) { - DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateUplink = (F1AP_MaxPacketLossRate_t *)calloc(1, sizeof(F1AP_MaxPacketLossRate_t)); - *DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateUplink = 1L; + asn1cCallocOne(DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateUplink, + F1AP_MaxPacketLossRate_t, 1L); } - } /* OPTIONAL */ /* reflective_QoS_Attribute */ if (0) { - DRB_Information->dRB_QoS.reflective_QoS_Attribute = (long *)calloc(1, sizeof(long)); - *DRB_Information->dRB_QoS.reflective_QoS_Attribute = 1L; + asn1cCallocOne(DRB_Information->dRB_QoS.reflective_QoS_Attribute, + long, 1L); } - } // dRB_QoS - /* 12.1.2.2 sNSSAI */ { /* sST */ OCTET_STRING_fromBuf(&DRB_Information->sNSSAI.sST, "asdsa1d32sa1d31asd31as", - strlen("asdsa1d32sa1d31asd31as")); + strlen("asdsa1d32sa1d31asd31as")); + /* OPTIONAL */ /* sD */ if (0) { - DRB_Information->sNSSAI.sD = (OCTET_STRING_t *)calloc(1, sizeof(OCTET_STRING_t)); - OCTET_STRING_fromBuf(DRB_Information->sNSSAI.sD, "asdsa1d32sa1d31asd31as", - strlen("asdsa1d32sa1d31asd31as")); + asn1cCalloc(DRB_Information->sNSSAI.sD, OCTET_STRING_t, tmp); + OCTET_STRING_fromBuf(tmp, "asdsa1d32sa1d31asd31as", + strlen("asdsa1d32sa1d31asd31as")); } } + /* OPTIONAL */ /* 12.1.2.3 notificationControl */ if (0) { - DRB_Information->notificationControl = (F1AP_NotificationControl_t *)calloc(1, sizeof(F1AP_NotificationControl_t)); - *DRB_Information->notificationControl = F1AP_NotificationControl_active; // enum + asn1cCallocOne(DRB_Information->notificationControl, + F1AP_NotificationControl_t, F1AP_NotificationControl_active); // enum } /* 12.1.2.4 flows_Mapped_To_DRB_List */ // BK: need verifiy - int k; - for (k = 0; k < 1; k ++) { - - F1AP_Flows_Mapped_To_DRB_Item_t flows_mapped_to_drb_item; - memset((void *)&flows_mapped_to_drb_item, 0, sizeof(F1AP_Flows_Mapped_To_DRB_Item_t)); - - /* qoSFlowIndicator */ - flows_mapped_to_drb_item.qoSFlowIdentifier = 1L; + for (int k = 0; k < 1; k ++) { + asn1cSequenceAdd(DRB_Information->flows_Mapped_To_DRB_List.list, + F1AP_Flows_Mapped_To_DRB_Item_t, flows_mapped_to_drb_item); + /* qoSFlowIndicator */ + flows_mapped_to_drb_item->qoSFlowIdentifier = 1L; /* qoSFlowLevelQoSParameters */ - { + { /* qoS_Characteristics */ { int some_decide_qoS_characteristics = 1; // BK: Need Check + F1AP_QoS_Characteristics_t *QosParams=&flows_mapped_to_drb_item->qoSFlowLevelQoSParameters.qoS_Characteristics; + if (some_decide_qoS_characteristics) { - flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.present = F1AP_QoS_Characteristics_PR_non_Dynamic_5QI; - flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.non_Dynamic_5QI = (F1AP_NonDynamic5QIDescriptor_t *)calloc(1, sizeof(F1AP_NonDynamic5QIDescriptor_t)); - - /* fiveQI */ - flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.non_Dynamic_5QI->fiveQI = 1L; - - /* OPTIONAL */ + QosParams->present = F1AP_QoS_Characteristics_PR_non_Dynamic_5QI; + setQos(QosParams->choice.non_Dynamic_5QI); + } else { + QosParams->present = F1AP_QoS_Characteristics_PR_dynamic_5QI; + asn1cCalloc(QosParams->choice.dynamic_5QI, F1AP_Dynamic5QIDescriptor_t, tmp); /* qoSPriorityLevel */ - if (0) { - flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel = (long *)calloc(1, sizeof(long)); - *flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.non_Dynamic_5QI->qoSPriorityLevel = 1L; - } - - /* OPTIONAL */ - /* averagingWindow */ - if (0) { - flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow = (F1AP_AveragingWindow_t *)calloc(1, sizeof(F1AP_AveragingWindow_t)); - *flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.non_Dynamic_5QI->averagingWindow = 1L; - } - - /* OPTIONAL */ - /* maxDataBurstVolume */ - if (0) { - flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume = (F1AP_MaxDataBurstVolume_t *)calloc(1, sizeof(F1AP_MaxDataBurstVolume_t)); - *flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.non_Dynamic_5QI->maxDataBurstVolume = 1L; - } - - } else { - flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.present = F1AP_QoS_Characteristics_PR_dynamic_5QI; - flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI = (F1AP_Dynamic5QIDescriptor_t *)calloc(1, sizeof(F1AP_Dynamic5QIDescriptor_t)); - - /* qoSPriorityLevel */ - flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->qoSPriorityLevel = 1L; - + tmp->qoSPriorityLevel = 1L; /* packetDelayBudget */ - flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->packetDelayBudget = 1L; - + tmp->packetDelayBudget = 1L; /* packetErrorRate */ - flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->packetErrorRate.pER_Scalar = 1L; - flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->packetErrorRate.pER_Exponent = 6L; + tmp->packetErrorRate.pER_Scalar = 1L; + tmp->packetErrorRate.pER_Exponent = 6L; + /* OPTIONAL */ /* delayCritical */ if (0) { - flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->delayCritical = (long *)calloc(1, sizeof(long)); - *flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->delayCritical = 1L; + asn1cCalloc(QosParams->choice.dynamic_5QI->delayCritical, long, tmp); + *tmp = 1L; } /* OPTIONAL */ /* averagingWindow */ if (0) { - flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->averagingWindow = (F1AP_AveragingWindow_t *)calloc(1, sizeof(F1AP_AveragingWindow_t)); - *flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->averagingWindow = 1L; + asn1cCalloc(QosParams->choice.dynamic_5QI->averagingWindow, F1AP_AveragingWindow_t, tmp); + *tmp = 1L; } /* OPTIONAL */ /* maxDataBurstVolume */ if (0) { - flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->maxDataBurstVolume = (F1AP_MaxDataBurstVolume_t *)calloc(1, sizeof(F1AP_MaxDataBurstVolume_t)); - *flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.qoS_Characteristics.choice.dynamic_5QI->maxDataBurstVolume = 1L; + asn1cCalloc(QosParams->choice.dynamic_5QI->maxDataBurstVolume, F1AP_MaxDataBurstVolume_t, tmp); + *tmp= 1L; } - } // if some_decide_qoS_characteristics - } // qoS_Characteristics - /* nGRANallocationRetentionPriority */ { - flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.nGRANallocationRetentionPriority.priorityLevel = F1AP_PriorityLevel_highest; // enum - flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.nGRANallocationRetentionPriority.pre_emptionCapability = F1AP_Pre_emptionCapability_shall_not_trigger_pre_emption; // enum - flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.nGRANallocationRetentionPriority.pre_emptionVulnerability = F1AP_Pre_emptionVulnerability_not_pre_emptable; // enum + flows_mapped_to_drb_item->qoSFlowLevelQoSParameters.nGRANallocationRetentionPriority.priorityLevel = F1AP_PriorityLevel_highest; // enum + flows_mapped_to_drb_item->qoSFlowLevelQoSParameters.nGRANallocationRetentionPriority.pre_emptionCapability = F1AP_Pre_emptionCapability_shall_not_trigger_pre_emption; // enum + flows_mapped_to_drb_item->qoSFlowLevelQoSParameters.nGRANallocationRetentionPriority.pre_emptionVulnerability = F1AP_Pre_emptionVulnerability_not_pre_emptable; // enum } // nGRANallocationRetentionPriority /* OPTIONAL */ /* gBR_QoS_Flow_Information */ if (0) { - flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.gBR_QoS_Flow_Information = (F1AP_GBR_QoSFlowInformation_t *)calloc(1, sizeof(F1AP_GBR_QoSFlowInformation_t)); - asn_long2INTEGER(&flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.gBR_QoS_Flow_Information->maxFlowBitRateDownlink, 1L); - asn_long2INTEGER(&flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.gBR_QoS_Flow_Information->maxFlowBitRateUplink, 1L); - asn_long2INTEGER(&flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.gBR_QoS_Flow_Information->guaranteedFlowBitRateDownlink, 1L); - asn_long2INTEGER(&flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.gBR_QoS_Flow_Information->guaranteedFlowBitRateUplink, 1L); + asn1cCalloc(flows_mapped_to_drb_item->qoSFlowLevelQoSParameters.gBR_QoS_Flow_Information, F1AP_GBR_QoSFlowInformation_t, tmp); + asn_long2INTEGER(&tmp->maxFlowBitRateDownlink, 1L); + asn_long2INTEGER(&tmp->maxFlowBitRateUplink, 1L); + asn_long2INTEGER(&tmp->guaranteedFlowBitRateDownlink, 1L); + asn_long2INTEGER(&tmp->guaranteedFlowBitRateUplink, 1L); /* OPTIONAL */ /* maxPacketLossRateDownlink */ if (0) { - flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.gBR_QoS_Flow_Information->maxPacketLossRateDownlink = (F1AP_MaxPacketLossRate_t *)calloc(1, sizeof(F1AP_MaxPacketLossRate_t)); - *flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.gBR_QoS_Flow_Information->maxPacketLossRateDownlink = 1L; + asn1cCalloc(flows_mapped_to_drb_item->qoSFlowLevelQoSParameters.gBR_QoS_Flow_Information->maxPacketLossRateDownlink, F1AP_MaxPacketLossRate_t, tmp); + *tmp = 1L; } /* OPTIONAL */ /* maxPacketLossRateUplink */ if (0) { - flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.gBR_QoS_Flow_Information->maxPacketLossRateUplink = (F1AP_MaxPacketLossRate_t *)calloc(1, sizeof(F1AP_MaxPacketLossRate_t)); - *flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.gBR_QoS_Flow_Information->maxPacketLossRateUplink = 1L; + asn1cCalloc(flows_mapped_to_drb_item->qoSFlowLevelQoSParameters.gBR_QoS_Flow_Information->maxPacketLossRateUplink, F1AP_MaxPacketLossRate_t, tmp); + *tmp = 1L; } - } /* OPTIONAL */ /* reflective_QoS_Attribute */ if (0) { - flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.reflective_QoS_Attribute = (long *)calloc(1, sizeof(long)); - *flows_mapped_to_drb_item.qoSFlowLevelQoSParameters.reflective_QoS_Attribute = 1L; + asn1cCalloc(flows_mapped_to_drb_item->qoSFlowLevelQoSParameters.reflective_QoS_Attribute, long, tmp); + *tmp = 1L; } - } // qoSFlowLevelQoSParameters - // BK: need check - ASN_SEQUENCE_ADD(&DRB_Information->flows_Mapped_To_DRB_List.list, &flows_mapped_to_drb_item); } - } // if some_decide_qos /* 12.1.3 uLUPTNLInformation_ToBeSetup_List */ - for (j = 0; j < f1ap_ue_context_setup_req->drbs_to_be_setup[i].up_ul_tnl_length; j++) { + for (int j = 0; j < f1ap_ue_context_setup_req->drbs_to_be_setup[i].up_ul_tnl_length; j++) { f1ap_up_tnl_t *up_tnl = &f1ap_ue_context_setup_req->drbs_to_be_setup[i].up_ul_tnl[j]; - /* 12.3.1 ULTunnels_ToBeSetup_Item */ - F1AP_ULUPTNLInformation_ToBeSetup_Item_t *uLUPTNLInformation_ToBeSetup_Item; - - /* 12.3.1.1 gTPTunnel */ - uLUPTNLInformation_ToBeSetup_Item = calloc(1, sizeof(F1AP_ULUPTNLInformation_ToBeSetup_Item_t)); + asn1cSequenceAdd(drbs_toBeSetup_item->uLUPTNLInformation_ToBeSetup_List.list, + F1AP_ULUPTNLInformation_ToBeSetup_Item_t, uLUPTNLInformation_ToBeSetup_Item); uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; - F1AP_GTPTunnel_t *gTPTunnel = (F1AP_GTPTunnel_t *)calloc(1, sizeof(F1AP_GTPTunnel_t)); - + asn1cCalloc( uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.choice.gTPTunnel, + F1AP_GTPTunnel_t, gTPTunnel); /* 12.3.1.1.1 transportLayerAddress */ TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(up_tnl->tl_address, &gTPTunnel->transportLayerAddress); - /* 12.3.1.1.2 gTP_TEID */ INT32_TO_OCTET_STRING(up_tnl->gtp_teid, &gTPTunnel->gTP_TEID); - - // Add - uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.choice.gTPTunnel = gTPTunnel; - ASN_SEQUENCE_ADD(&drbs_toBeSetup_item.uLUPTNLInformation_ToBeSetup_List.list, uLUPTNLInformation_ToBeSetup_Item); } /* 12.1.4 rLCMode */ /* TODO use rlc_mode from f1ap_drb_to_be_setup */ switch (f1ap_ue_context_setup_req->drbs_to_be_setup[i].rlc_mode) { case RLC_MODE_AM: - drbs_toBeSetup_item.rLCMode = F1AP_RLCMode_rlc_am; + drbs_toBeSetup_item->rLCMode = F1AP_RLCMode_rlc_am; break; + default: - drbs_toBeSetup_item.rLCMode = F1AP_RLCMode_rlc_um_bidirectional; + drbs_toBeSetup_item->rLCMode = F1AP_RLCMode_rlc_um_bidirectional; } /* OPTIONAL */ /* 12.1.5 ULConfiguration */ if (0) { - drbs_toBeSetup_item.uLConfiguration = (F1AP_ULConfiguration_t *)calloc(1, sizeof(F1AP_ULConfiguration_t)); - drbs_toBeSetup_item.uLConfiguration->uLUEConfiguration = F1AP_ULUEConfiguration_no_data; + asn1cCalloc(drbs_toBeSetup_item->uLConfiguration, F1AP_ULConfiguration_t, tmp); + tmp->uLUEConfiguration = F1AP_ULUEConfiguration_no_data; } /* OPTIONAL */ /* 12.1.6 duplicationActivation */ if (0) { - drbs_toBeSetup_item.duplicationActivation = (F1AP_DuplicationActivation_t *)calloc(1, sizeof(F1AP_DuplicationActivation_t)); - drbs_toBeSetup_item.duplicationActivation = F1AP_DuplicationActivation_active; // enum + asn1cCalloc(drbs_toBeSetup_item->duplicationActivation, F1AP_DuplicationActivation_t, tmp); + *tmp = F1AP_DuplicationActivation_active; // enum } - - /* ADD */ - drbs_toBeSetup_item_ies->value.choice.DRBs_ToBeSetup_Item = drbs_toBeSetup_item; - ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_ToBeSetup_List.list, - drbs_toBeSetup_item_ies); - } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); -//} + + //} /* OPTIONAL */ /* InactivityMonitoringRequest */ if (0) { - ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_InactivityMonitoringRequest; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_InactivityMonitoringRequest; - ie->value.choice.InactivityMonitoringRequest = F1AP_InactivityMonitoringRequest_true; // 0 - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupRequestIEs_t, ie12); + ie12->id = F1AP_ProtocolIE_ID_id_InactivityMonitoringRequest; + ie12->criticality = F1AP_Criticality_reject; + ie12->value.present = F1AP_UEContextSetupRequestIEs__value_PR_InactivityMonitoringRequest; + ie12->value.choice.InactivityMonitoringRequest = F1AP_InactivityMonitoringRequest_true; // 0 } /* OPTIONAL */ /* RAT_FrequencyPriorityInformation */ if (0) { - ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_RAT_FrequencyPriorityInformation; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_RAT_FrequencyPriorityInformation; + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupRequestIEs_t, ie13); + ie13->id = F1AP_ProtocolIE_ID_id_RAT_FrequencyPriorityInformation; + ie13->criticality = F1AP_Criticality_reject; + ie13->value.present = F1AP_UEContextSetupRequestIEs__value_PR_RAT_FrequencyPriorityInformation; + int endc = 1; // RK: Get this from somewhere ... - int endc = 1; // RK: Get this from somewhere ... if (endc) { - ie->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_eNDC; - ie->value.choice.RAT_FrequencyPriorityInformation.choice.eNDC = 11L; + ie13->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_eNDC; + ie13->value.choice.RAT_FrequencyPriorityInformation.choice.eNDC = 11L; } else { - ie->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_nGRAN; - ie->value.choice.RAT_FrequencyPriorityInformation.choice.nGRAN = 11L; + ie13->value.choice.RAT_FrequencyPriorityInformation.present = F1AP_RAT_FrequencyPriorityInformation_PR_nGRAN; + ie13->value.choice.RAT_FrequencyPriorityInformation.choice.nGRAN = 11L; } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } /* OPTIONAL */ /* RRCContainer */ - if(f1ap_ue_context_setup_req->rrc_container_length > 0){ - ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_RRCContainer; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_RRCContainer; - OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, (const char*)f1ap_ue_context_setup_req->rrc_container, - f1ap_ue_context_setup_req->rrc_container_length); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + if(f1ap_ue_context_setup_req->rrc_container_length > 0) { + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupRequestIEs_t, ie14); + ie14->id = F1AP_ProtocolIE_ID_id_RRCContainer; + ie14->criticality = F1AP_Criticality_reject; + ie14->value.present = F1AP_UEContextSetupRequestIEs__value_PR_RRCContainer; + OCTET_STRING_fromBuf(&ie14->value.choice.RRCContainer, (const char *)f1ap_ue_context_setup_req->rrc_container, + f1ap_ue_context_setup_req->rrc_container_length); } /* OPTIONAL */ /* MaskedIMEISV */ if (0) { - ie = (F1AP_UEContextSetupRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_MaskedIMEISV; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextSetupRequestIEs__value_PR_MaskedIMEISV; - MaskedIMEISV_TO_BIT_STRING(12340000l, &ie->value.choice.MaskedIMEISV); // size (64) - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupRequestIEs_t, ie15); + ie15->id = F1AP_ProtocolIE_ID_id_MaskedIMEISV; + ie15->criticality = F1AP_Criticality_reject; + ie15->value.present = F1AP_UEContextSetupRequestIEs__value_PR_MaskedIMEISV; + MaskedIMEISV_TO_BIT_STRING(12340000l, &ie15->value.choice.MaskedIMEISV); // size (64) } //xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, &pdu); //(void *)pdu @@ -778,21 +615,16 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, } // xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, (void *)pdu); - // asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} }; // res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); // buffer = res.buffer; // len = res.result.encoded; - // if (res.result.encoded <= 0) { // LOG_E(F1AP, "ASN1 message encoding failed (%s, %lu)!\n", res.result.failed_type->name, res.result.encoded); // 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*/); - + cu_f1ap_itti_send_sctp_data_req(instance, f1ap_assoc_id /* BK: fix me*/, buffer, len, 0 /* BK: fix me*/); return 0; } @@ -802,39 +634,29 @@ int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, F1AP_F1AP_PDU_t *pdu) { F1AP_UEContextSetupResponse_t *container; F1AP_UEContextSetupResponseIEs_t *ie; - DevAssert(pdu); - container = &pdu->choice.successfulOutcome->value.choice.UEContextSetupResponse; - /* GNB_CU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true); - /* GNB_DU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true); - /* DUtoCURRCInformation */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, F1AP_ProtocolIE_ID_id_DUtoCURRCInformation, true); - /* DRBs_Setup_List */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, F1AP_ProtocolIE_ID_id_DRBs_Setup_List, true); - /* SRBs_FailedToBeSetup_List */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, F1AP_ProtocolIE_ID_id_SRBs_FailedToBeSetup_List, true); - /* DRBs_FailedToBeSetup_List */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, F1AP_ProtocolIE_ID_id_DRBs_FailedToBeSetup_List, true); - /* SCell_FailedtoSetup_List */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, F1AP_ProtocolIE_ID_id_SCell_FailedtoSetup_List, true); - return 0; } @@ -847,29 +669,25 @@ int CU_handle_UE_CONTEXT_SETUP_FAILURE(instance_t instance, int CU_handle_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { F1AP_UEContextReleaseRequest_t *container; F1AP_UEContextReleaseRequestIEs_t *ie; - DevAssert(pdu); - container = &pdu->choice.initiatingMessage->value.choice.UEContextReleaseRequest; /* 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], - ie->value.choice.GNB_CU_UE_F1AP_ID); - + 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], - ie->value.choice.GNB_DU_UE_F1AP_ID); + 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); - /* Cause */ /* We don't care for the moment F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseRequestIEs_t, ie, container, @@ -894,98 +712,88 @@ int CU_handle_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, break; } */ - LOG_I(F1AP, "Received UE CONTEXT RELEASE REQUEST: Trigger RRC for RNTI %x\n", rnti); 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( - instance, - ue_context_pP, - S1AP_CAUSE_RADIO_NETWORK, - 21); // send cause 21: connection with ue lost - + instance, + ue_context_pP, + S1AP_CAUSE_RADIO_NETWORK, + 21); // send cause 21: connection with ue lost return 0; } int CU_send_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, f1ap_ue_context_release_cmd_t *cmd) { - F1AP_F1AP_PDU_t pdu; + F1AP_F1AP_PDU_t pdu= {0}; F1AP_UEContextReleaseCommand_t *out; - F1AP_UEContextReleaseCommandIEs_t *ie; - - uint8_t *buffer; - uint32_t len; - + uint8_t *buffer=NULL; + uint32_t len=0; /* Create */ /* 0. Message Type */ - memset(&pdu, 0, sizeof(pdu)); pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; - pdu.choice.initiatingMessage = (F1AP_InitiatingMessage_t *)calloc(1, sizeof(F1AP_InitiatingMessage_t)); - pdu.choice.initiatingMessage->procedureCode = F1AP_ProcedureCode_id_UEContextRelease; - pdu.choice.initiatingMessage->criticality = F1AP_Criticality_reject; - pdu.choice.initiatingMessage->value.present = F1AP_InitiatingMessage__value_PR_UEContextReleaseCommand; - out = &pdu.choice.initiatingMessage->value.choice.UEContextReleaseCommand; - + asn1cCalloc(pdu.choice.initiatingMessage, F1AP_InitiatingMessage_t, tmp); + tmp->procedureCode = F1AP_ProcedureCode_id_UEContextRelease; + tmp->criticality = F1AP_Criticality_reject; + tmp->value.present = F1AP_InitiatingMessage__value_PR_UEContextReleaseCommand; + out = &tmp->value.choice.UEContextReleaseCommand; /* mandatory */ /* c1. GNB_CU_UE_F1AP_ID */ - ie = (F1AP_UEContextReleaseCommandIEs_t *)calloc(1, sizeof(F1AP_UEContextReleaseCommandIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextReleaseCommandIEs__value_PR_GNB_CU_UE_F1AP_ID; - ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(&f1ap_cu_inst[instance], cmd->rnti); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextReleaseCommandIEs_t, ie1); + 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); /* mandatory */ /* c2. GNB_DU_UE_F1AP_ID */ - ie = (F1AP_UEContextReleaseCommandIEs_t *)calloc(1, sizeof(F1AP_UEContextReleaseCommandIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextReleaseCommandIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(&f1ap_cu_inst[instance], cmd->rnti); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - + 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); /* mandatory */ /* c3. Cause */ - ie = (F1AP_UEContextReleaseCommandIEs_t *)calloc(1, sizeof(F1AP_UEContextReleaseCommandIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_Cause; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextReleaseCommandIEs__value_PR_Cause; + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextReleaseCommandIEs_t, ie3); + ie3->id = F1AP_ProtocolIE_ID_id_Cause; + ie3->criticality = F1AP_Criticality_ignore; + ie3->value.present = F1AP_UEContextReleaseCommandIEs__value_PR_Cause; switch (cmd->cause) { case F1AP_CAUSE_RADIO_NETWORK: - ie->value.choice.Cause.present = F1AP_Cause_PR_radioNetwork; - ie->value.choice.Cause.choice.radioNetwork = cmd->cause_value; + ie3->value.choice.Cause.present = F1AP_Cause_PR_radioNetwork; + ie3->value.choice.Cause.choice.radioNetwork = cmd->cause_value; break; + case F1AP_CAUSE_TRANSPORT: - ie->value.choice.Cause.present = F1AP_Cause_PR_transport; - ie->value.choice.Cause.choice.transport = cmd->cause_value; + ie3->value.choice.Cause.present = F1AP_Cause_PR_transport; + ie3->value.choice.Cause.choice.transport = cmd->cause_value; break; + case F1AP_CAUSE_PROTOCOL: - ie->value.choice.Cause.present = F1AP_Cause_PR_protocol; - ie->value.choice.Cause.choice.protocol = cmd->cause_value; + ie3->value.choice.Cause.present = F1AP_Cause_PR_protocol; + ie3->value.choice.Cause.choice.protocol = cmd->cause_value; break; + case F1AP_CAUSE_MISC: - ie->value.choice.Cause.present = F1AP_Cause_PR_misc; - ie->value.choice.Cause.choice.misc = cmd->cause_value; + ie3->value.choice.Cause.present = F1AP_Cause_PR_misc; + ie3->value.choice.Cause.choice.misc = cmd->cause_value; break; + case F1AP_CAUSE_NOTHING: default: - ie->value.choice.Cause.present = F1AP_Cause_PR_NOTHING; + ie3->value.choice.Cause.present = F1AP_Cause_PR_NOTHING; break; } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* optional */ /* c4. RRCContainer */ - ie = (F1AP_UEContextReleaseCommandIEs_t *)calloc(1, sizeof(F1AP_UEContextReleaseCommandIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_RRCContainer; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextReleaseCommandIEs__value_PR_RRCContainer; - - OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, (const char *)cmd->rrc_container, + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextReleaseCommandIEs_t, ie4); + ie4->id = F1AP_ProtocolIE_ID_id_RRCContainer; + ie4->criticality = F1AP_Criticality_ignore; + ie4->value.present = F1AP_UEContextReleaseCommandIEs__value_PR_RRCContainer; + OCTET_STRING_fromBuf(&ie4->value.choice.RRCContainer, (const char *)cmd->rrc_container, cmd->rrc_container_length); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { @@ -994,44 +802,39 @@ int CU_send_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, } cu_f1ap_itti_send_sctp_data_req(instance, f1ap_du_data_from_du->assoc_id, buffer, len, 0); - return 0; } int CU_handle_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { F1AP_UEContextReleaseComplete_t *container; F1AP_UEContextReleaseCompleteIEs_t *ie; - DevAssert(pdu); - container = &pdu->choice.successfulOutcome->value.choice.UEContextReleaseComplete; /* 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], - ie->value.choice.GNB_CU_UE_F1AP_ID); - + 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], - ie->value.choice.GNB_DU_UE_F1AP_ID); + 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); - /* Optional*/ /* CriticalityDiagnostics */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseCompleteIEs_t, ie, container, F1AP_ProtocolIE_ID_id_CriticalityDiagnostics, false); + if (ie) { // ie->value.choice.CriticalityDiagnostics.procedureCode // ie->value.choice.CriticalityDiagnostics.triggeringMessage // ie->value.choice.CriticalityDiagnostics.procedureCriticality // ie->value.choice.CriticalityDiagnostics.transactionID - // F1AP_CriticalityDiagnostics_IE_List } @@ -1040,44 +843,44 @@ int CU_handle_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, if (RC.nrrrc[instance]->node_type == ngran_gNB_CU) { struct rrc_gNB_ue_context_s *ue_context_p = - rrc_gNB_get_ue_context(RC.nrrrc[instance], rnti); + rrc_gNB_get_ue_context(RC.nrrrc[instance], rnti); if (ue_context_p) { MessageDef *msg = itti_alloc_new_message(TASK_CU_F1, 0, NGAP_UE_CONTEXT_RELEASE_COMPLETE); NGAP_UE_CONTEXT_RELEASE_COMPLETE(msg).gNB_ue_ngap_id = ue_context_p->ue_context.gNB_ue_ngap_id; itti_send_msg_to_task(TASK_NGAP, instance, msg); - rrc_gNB_remove_ue_context(&ctxt, RC.nrrrc[instance], ue_context_p); } else { LOG_E(F1AP, "could not find ue_context of UE RNTI %x\n", rnti); } + #ifdef ITTI_SIM return 0; #endif - } else { struct rrc_eNB_ue_context_s *ue_context_p = - rrc_eNB_get_ue_context(RC.rrc[instance], rnti); + rrc_eNB_get_ue_context(RC.rrc[instance], rnti); if (ue_context_p) { /* The following is normally done in the function rrc_rx_tx() */ rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_CPLT(instance, ue_context_p->ue_context.eNB_ue_s1ap_id); - rrc_eNB_send_GTPV1U_ENB_DELETE_TUNNEL_REQ(instance, ue_context_p); + // erase data of GTP tunnels in UE context for (int e_rab = 0; e_rab < ue_context_p->ue_context.nb_of_e_rabs; e_rab++) { ue_context_p->ue_context.enb_gtp_teid[e_rab] = 0; memset(&ue_context_p->ue_context.enb_gtp_addrs[e_rab], - 0, sizeof(ue_context_p->ue_context.enb_gtp_addrs[e_rab])); + 0, sizeof(ue_context_p->ue_context.enb_gtp_addrs[e_rab])); ue_context_p->ue_context.enb_gtp_ebi[e_rab] = 0; } struct rrc_ue_s1ap_ids_s *rrc_ue_s1ap_ids = - rrc_eNB_S1AP_get_ue_ids(RC.rrc[instance], 0, - ue_context_p->ue_context.eNB_ue_s1ap_id); + rrc_eNB_S1AP_get_ue_ids(RC.rrc[instance], 0, + ue_context_p->ue_context.eNB_ue_s1ap_id); + if (rrc_ue_s1ap_ids) - rrc_eNB_S1AP_remove_ue_ids(RC.rrc[instance], rrc_ue_s1ap_ids); + rrc_eNB_S1AP_remove_ue_ids(RC.rrc[instance], rrc_ue_s1ap_ids); /* trigger UE release in RRC */ rrc_eNB_remove_ue_context(&ctxt, RC.rrc[instance], ue_context_p); @@ -1091,7 +894,7 @@ int CU_handle_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, /* notify the agent */ if (flexran_agent_get_rrc_xface(instance)) flexran_agent_get_rrc_xface(instance)->flexran_agent_notify_ue_state_change( - instance, rnti, PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED); + 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); @@ -1101,467 +904,338 @@ int CU_handle_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, //void CU_send_UE_CONTEXT_MODIFICATION_REQUEST(F1AP_UEContextModificationRequest_t *UEContextModificationRequest) { int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance) { - F1AP_F1AP_PDU_t pdu; + F1AP_F1AP_PDU_t pdu= {0}; F1AP_UEContextModificationRequest_t *out; - F1AP_UEContextModificationRequestIEs_t *ie; - - uint8_t *buffer; - uint32_t len; - int i = 0; - + uint8_t *buffer=NULL; + uint32_t len=0; // for test - int mcc = 208; - int mnc = 93; - int mnc_digit_length = 8; - + cellIDs_t hardCoded={ .mcc=208, .mnc=93, .mnc_digit_length=2}; /* Create */ /* 0. Message Type */ - memset(&pdu, 0, sizeof(pdu)); pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; - pdu.choice.initiatingMessage = (F1AP_InitiatingMessage_t *)calloc(1, sizeof(F1AP_InitiatingMessage_t)); - pdu.choice.initiatingMessage->procedureCode = F1AP_ProcedureCode_id_UEContextModification; - pdu.choice.initiatingMessage->criticality = F1AP_Criticality_reject; - pdu.choice.initiatingMessage->value.present = F1AP_InitiatingMessage__value_PR_UEContextModificationRequest; - out = &pdu.choice.initiatingMessage->value.choice.UEContextModificationRequest; - + asn1cCalloc(pdu.choice.initiatingMessage, F1AP_InitiatingMessage_t, tmp); + tmp->procedureCode = F1AP_ProcedureCode_id_UEContextModification; + tmp->criticality = F1AP_Criticality_reject; + tmp->value.present = F1AP_InitiatingMessage__value_PR_UEContextModificationRequest; + out = &tmp->value.choice.UEContextModificationRequest; /* mandatory */ /* c1. GNB_CU_UE_F1AP_ID */ - ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_GNB_CU_UE_F1AP_ID; - ie->value.choice.GNB_CU_UE_F1AP_ID = 126L; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextModificationRequestIEs_t, ie1); + ie1->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; + ie1->criticality = F1AP_Criticality_reject; + ie1->value.present = F1AP_UEContextModificationRequestIEs__value_PR_GNB_CU_UE_F1AP_ID; + ie1->value.choice.GNB_CU_UE_F1AP_ID = 126L; /* mandatory */ /* c2. GNB_DU_UE_F1AP_ID */ - ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie->value.choice.GNB_DU_UE_F1AP_ID = 651L; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextModificationRequestIEs_t, ie2); + ie2->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; + ie2->criticality = F1AP_Criticality_reject; + ie2->value.present = F1AP_UEContextModificationRequestIEs__value_PR_GNB_DU_UE_F1AP_ID; + ie2->value.choice.GNB_DU_UE_F1AP_ID = 651L; /* optional */ /* c3. NRCGI */ if (0) { - ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_SpCell_ID; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_NRCGI; + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextModificationRequestIEs_t, ie3); + ie3->id = F1AP_ProtocolIE_ID_id_SpCell_ID; + ie3->criticality = F1AP_Criticality_ignore; + ie3->value.present = F1AP_UEContextModificationRequestIEs__value_PR_NRCGI; /* - nRCGI */ - F1AP_NRCGI_t nRCGI; - MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length, - &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); - ie->value.choice.NRCGI = nRCGI; - - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + addnRCGI(ie3->value.choice.NRCGI, &hardCoded); } /* mandatory */ /* c4. ServCellIndex */ - ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_ServCellIndex; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_ServCellIndex; - ie->value.choice.ServCellIndex = 5L; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextModificationRequestIEs_t, ie4); + ie4->id = F1AP_ProtocolIE_ID_id_ServCellIndex; + ie4->criticality = F1AP_Criticality_reject; + ie4->value.present = F1AP_UEContextModificationRequestIEs__value_PR_ServCellIndex; + ie4->value.choice.ServCellIndex = 5L; /* optional */ /* c5. DRXCycle */ if (0) { - ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_DRXCycle; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_DRXCycle; - ie->value.choice.DRXCycle.longDRXCycleLength = F1AP_LongDRXCycleLength_ms10; // enum + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextModificationRequestIEs_t, ie5); + ie5->id = F1AP_ProtocolIE_ID_id_DRXCycle; + ie5->criticality = F1AP_Criticality_ignore; + ie5->value.present = F1AP_UEContextModificationRequestIEs__value_PR_DRXCycle; + ie5->value.choice.DRXCycle.longDRXCycleLength = F1AP_LongDRXCycleLength_ms10; // enum + if (0) { - ie->value.choice.DRXCycle.shortDRXCycleLength = (F1AP_ShortDRXCycleLength_t *)calloc(1, sizeof(F1AP_ShortDRXCycleLength_t)); - *ie->value.choice.DRXCycle.shortDRXCycleLength = F1AP_ShortDRXCycleLength_ms2; // enum + asn1cCalloc(ie5->value.choice.DRXCycle.shortDRXCycleLength, F1AP_ShortDRXCycleLength_t,tmp); + *tmp = F1AP_ShortDRXCycleLength_ms2; // enum } + if (0) { - ie->value.choice.DRXCycle.shortDRXCycleTimer = (F1AP_ShortDRXCycleTimer_t *)calloc(1, sizeof(F1AP_ShortDRXCycleTimer_t)); - *ie->value.choice.DRXCycle.shortDRXCycleTimer = 123L; + asn1cCalloc(ie5->value.choice.DRXCycle.shortDRXCycleTimer, F1AP_ShortDRXCycleTimer_t, tmp); + *tmp = 123L; } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } /* optional */ /* c5. CUtoDURRCInformation */ if (1) { - ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_CUtoDURRCInformation; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_CUtoDURRCInformation; - ie->value.choice.CUtoDURRCInformation.cG_ConfigInfo = (F1AP_CG_ConfigInfo_t *)calloc(1, sizeof(F1AP_CG_ConfigInfo_t)); + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextModificationRequestIEs_t, ie5); + ie5->id = F1AP_ProtocolIE_ID_id_CUtoDURRCInformation; + ie5->criticality = F1AP_Criticality_reject; + ie5->value.present = F1AP_UEContextModificationRequestIEs__value_PR_CUtoDURRCInformation; + asn1cCalloc(ie5->value.choice.CUtoDURRCInformation.cG_ConfigInfo, F1AP_CG_ConfigInfo_t, tmp); /* optional */ - OCTET_STRING_fromBuf(ie->value.choice.CUtoDURRCInformation.cG_ConfigInfo, "asdsa1d32sa1d31asd31as", + OCTET_STRING_fromBuf(tmp, "asdsa1d32sa1d31asd31as", strlen("asdsa1d32sa1d31asd31as")); - ie->value.choice.CUtoDURRCInformation.uE_CapabilityRAT_ContainerList = (F1AP_UE_CapabilityRAT_ContainerList_t *)calloc(1, sizeof(F1AP_UE_CapabilityRAT_ContainerList_t)); + asn1cCalloc(ie5->value.choice.CUtoDURRCInformation.uE_CapabilityRAT_ContainerList, + F1AP_UE_CapabilityRAT_ContainerList_t,tmp2); /* optional */ - OCTET_STRING_fromBuf(ie->value.choice.CUtoDURRCInformation.uE_CapabilityRAT_ContainerList, "asdsa1d32sa1d31asd31as", + OCTET_STRING_fromBuf(tmp2, "asdsa1d32sa1d31asd31as", strlen("asdsa1d32sa1d31asd31as")); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } /* optional */ /* c6. TransmissionActionIndicator */ if (1) { - ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_TransmissionActionIndicator; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_TransmissionActionIndicator; - ie->value.choice.TransmissionActionIndicator = F1AP_TransmissionActionIndicator_stop; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextModificationRequestIEs_t, ie6); + ie6->id = F1AP_ProtocolIE_ID_id_TransmissionActionIndicator; + ie6->criticality = F1AP_Criticality_ignore; + ie6->value.present = F1AP_UEContextModificationRequestIEs__value_PR_TransmissionActionIndicator; + ie6->value.choice.TransmissionActionIndicator = F1AP_TransmissionActionIndicator_stop; } /* optional */ /* c7. ResourceCoordinationTransferContainer */ if (0) { - ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_ResourceCoordinationTransferContainer; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_ResourceCoordinationTransferContainer; - OCTET_STRING_fromBuf(&ie->value.choice.ResourceCoordinationTransferContainer, "asdsa1d32sa1d31asd31as", + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextModificationRequestIEs_t, ie7); + ie7->id = F1AP_ProtocolIE_ID_id_ResourceCoordinationTransferContainer; + ie7->criticality = F1AP_Criticality_ignore; + ie7->value.present = F1AP_UEContextModificationRequestIEs__value_PR_ResourceCoordinationTransferContainer; + OCTET_STRING_fromBuf(&ie7->value.choice.ResourceCoordinationTransferContainer, "asdsa1d32sa1d31asd31as", strlen("asdsa1d32sa1d31asd31as")); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } /* optional */ /* c7. RRCRconfigurationCompleteIndicator */ if (1) { - ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_RRCReconfigurationCompleteIndicator; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_RRCReconfigurationCompleteIndicator; - ie->value.choice.RRCReconfigurationCompleteIndicator = F1AP_RRCReconfigurationCompleteIndicator_true; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextModificationRequestIEs_t, ie71); + ie71->id = F1AP_ProtocolIE_ID_id_RRCReconfigurationCompleteIndicator; + ie71->criticality = F1AP_Criticality_ignore; + ie71->value.present = F1AP_UEContextModificationRequestIEs__value_PR_RRCReconfigurationCompleteIndicator; + ie71->value.choice.RRCReconfigurationCompleteIndicator = F1AP_RRCReconfigurationCompleteIndicator_true; } /* optional */ /* c8. RRCContainer */ if (1) { - ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_RRCContainer; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_RRCContainer; - OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, "asdsa1d32sa1d31asd31as", + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextModificationRequestIEs_t, ie8); + ie8->id = F1AP_ProtocolIE_ID_id_RRCContainer; + ie8->criticality = F1AP_Criticality_ignore; + ie8->value.present = F1AP_UEContextModificationRequestIEs__value_PR_RRCContainer; + OCTET_STRING_fromBuf(&ie8->value.choice.RRCContainer, "asdsa1d32sa1d31asd31as", strlen("asdsa1d32sa1d31asd31as")); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } /* mandatory */ /* c9. SCell_ToBeSetupMod_List */ - ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_SCell_ToBeSetupMod_List; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_SCell_ToBeSetupMod_List; + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextModificationRequestIEs_t, ie9); + ie9->id = F1AP_ProtocolIE_ID_id_SCell_ToBeSetupMod_List; + ie9->criticality = F1AP_Criticality_ignore; + ie9->value.present = F1AP_UEContextModificationRequestIEs__value_PR_SCell_ToBeSetupMod_List; - for (i=0; - i<1; - i++) { - // - F1AP_SCell_ToBeSetupMod_ItemIEs_t *scell_toBeSetupMod_item_ies; - scell_toBeSetupMod_item_ies = (F1AP_SCell_ToBeSetupMod_ItemIEs_t *)calloc(1, sizeof(F1AP_SCell_ToBeSetupMod_ItemIEs_t)); - //memset((void *)&scell_toBeSetupMod_item_ies, 0, sizeof(F1AP_SCell_ToBeSetupMod_ItemIEs_t)); - scell_toBeSetupMod_item_ies->id = F1AP_ProtocolIE_ID_id_SCell_ToBeSetupMod_Item; - scell_toBeSetupMod_item_ies->criticality = F1AP_Criticality_ignore; - scell_toBeSetupMod_item_ies->value.present = F1AP_SCell_ToBeSetupMod_ItemIEs__value_PR_SCell_ToBeSetupMod_Item; - - /* 8.1 SCell_ToBeSetup_Item */ - F1AP_SCell_ToBeSetupMod_Item_t scell_toBeSetupMod_item; - memset((void *)&scell_toBeSetupMod_item, 0, sizeof(F1AP_SCell_ToBeSetupMod_Item_t)); - - // /* - sCell_ID */ - F1AP_NRCGI_t nRCGI; - memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t)); - MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length, - &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); - scell_toBeSetupMod_item.sCell_ID = nRCGI; - - /* sCellIndex */ - scell_toBeSetupMod_item.sCellIndex = 6; // issue here - - // /* ADD */ - scell_toBeSetupMod_item_ies->value.choice.SCell_ToBeSetupMod_Item = scell_toBeSetupMod_item; - ASN_SEQUENCE_ADD(&ie->value.choice.SCell_ToBeSetupMod_List.list, - scell_toBeSetupMod_item_ies); + for (int i=0; i<1; i++) { + // + asn1cSequenceAdd(ie9->value.choice.SCell_ToBeSetupMod_List.list, + F1AP_SCell_ToBeSetupMod_ItemIEs_t, scell_toBeSetupMod_item_ies); + scell_toBeSetupMod_item_ies->id = F1AP_ProtocolIE_ID_id_SCell_ToBeSetupMod_Item; + scell_toBeSetupMod_item_ies->criticality = F1AP_Criticality_ignore; + scell_toBeSetupMod_item_ies->value.present = F1AP_SCell_ToBeSetupMod_ItemIEs__value_PR_SCell_ToBeSetupMod_Item; + /* 8.1 SCell_ToBeSetup_Item */ + F1AP_SCell_ToBeSetupMod_Item_t *scell_toBeSetupMod_item= + &scell_toBeSetupMod_item_ies->value.choice.SCell_ToBeSetupMod_Item; + // /* - sCell_ID */ + addnRCGI(scell_toBeSetupMod_item->sCell_ID, &hardCoded); + /* sCellIndex */ + scell_toBeSetupMod_item->sCellIndex = 6; // issue here } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ /* c10. SCell_ToBeRemoved_List */ - ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_SCell_ToBeRemoved_List; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_SCell_ToBeRemoved_List; + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextModificationRequestIEs_t, ie10); + ie10->id = F1AP_ProtocolIE_ID_id_SCell_ToBeRemoved_List; + ie10->criticality = F1AP_Criticality_ignore; + ie10->value.present = F1AP_UEContextModificationRequestIEs__value_PR_SCell_ToBeRemoved_List; - for (i=0; - i<1; - i++) { - // - F1AP_SCell_ToBeRemoved_ItemIEs_t *scell_toBeRemoved_item_ies; - scell_toBeRemoved_item_ies = (F1AP_SCell_ToBeRemoved_ItemIEs_t *)calloc(1, sizeof(F1AP_SCell_ToBeRemoved_ItemIEs_t)); - //memset((void *)&scell_toBeRemoved_item_ies, 0, sizeof(F1AP_SCell_ToBeRemoved_ItemIEs_t)); - scell_toBeRemoved_item_ies->id = F1AP_ProtocolIE_ID_id_SCell_ToBeRemoved_Item; - scell_toBeRemoved_item_ies->criticality = F1AP_Criticality_ignore; - scell_toBeRemoved_item_ies->value.present = F1AP_SCell_ToBeRemoved_ItemIEs__value_PR_SCell_ToBeRemoved_Item; - - /* 10.1 SCell_ToBeRemoved_Item */ - F1AP_SCell_ToBeRemoved_Item_t scell_toBeRemoved_item; - memset((void *)&scell_toBeRemoved_item, 0, sizeof(F1AP_SCell_ToBeRemoved_Item_t)); - - /* - sCell_ID */ - F1AP_NRCGI_t nRCGI; - memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t)); - MCC_MNC_TO_PLMNID(mcc, mnc, mnc_digit_length, - &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(123456, &nRCGI.nRCellIdentity); - scell_toBeRemoved_item.sCell_ID = nRCGI; - - /* ADD */ - scell_toBeRemoved_item_ies->value.choice.SCell_ToBeRemoved_Item = scell_toBeRemoved_item; - ASN_SEQUENCE_ADD(&ie->value.choice.SCell_ToBeRemoved_List.list, - scell_toBeRemoved_item_ies); + for (int i=0; i<1; i++) { + // + asn1cSequenceAdd(ie10->value.choice.SCell_ToBeRemoved_List.list, + F1AP_SCell_ToBeRemoved_ItemIEs_t, scell_toBeRemoved_item_ies); + scell_toBeRemoved_item_ies = (F1AP_SCell_ToBeRemoved_ItemIEs_t *)calloc(1, sizeof(F1AP_SCell_ToBeRemoved_ItemIEs_t)); + //memset((void *)&scell_toBeRemoved_item_ies, 0, sizeof(F1AP_SCell_ToBeRemoved_ItemIEs_t)); + scell_toBeRemoved_item_ies->id = F1AP_ProtocolIE_ID_id_SCell_ToBeRemoved_Item; + scell_toBeRemoved_item_ies->criticality = F1AP_Criticality_ignore; + scell_toBeRemoved_item_ies->value.present = F1AP_SCell_ToBeRemoved_ItemIEs__value_PR_SCell_ToBeRemoved_Item; + /* 10.1 SCell_ToBeRemoved_Item */ + F1AP_SCell_ToBeRemoved_Item_t *scell_toBeRemoved_item= + &scell_toBeRemoved_item_ies->value.choice.SCell_ToBeRemoved_Item; + /* - sCell_ID */ + addnRCGI(scell_toBeRemoved_item->sCell_ID, &hardCoded); } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ /* c11. SRBs_ToBeSetupMod_List */ - ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_SRBs_ToBeSetupMod_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_SRBs_ToBeSetupMod_List; + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextModificationRequestIEs_t, ie11); + ie11->id = F1AP_ProtocolIE_ID_id_SRBs_ToBeSetupMod_List; + ie11->criticality = F1AP_Criticality_reject; + ie11->value.present = F1AP_UEContextModificationRequestIEs__value_PR_SRBs_ToBeSetupMod_List; - for (i=0; - i<1; - i++) { + for (int i=0; i<1; i++) { // - F1AP_SRBs_ToBeSetupMod_ItemIEs_t *srbs_toBeSetupMod_item_ies; - srbs_toBeSetupMod_item_ies = (F1AP_SRBs_ToBeSetupMod_ItemIEs_t *)calloc(1, sizeof(F1AP_SRBs_ToBeSetupMod_ItemIEs_t)); - //memset((void *)&srbs_toBeSetupMod_item_ies, 0, sizeof(F1AP_SRBs_ToBeSetupMod_ItemIEs_t)); + asn1cSequenceAdd(ie11->value.choice.SRBs_ToBeSetupMod_List.list, + F1AP_SRBs_ToBeSetupMod_ItemIEs_t, srbs_toBeSetupMod_item_ies); srbs_toBeSetupMod_item_ies->id = F1AP_ProtocolIE_ID_id_SRBs_ToBeSetupMod_Item; srbs_toBeSetupMod_item_ies->criticality = F1AP_Criticality_ignore; srbs_toBeSetupMod_item_ies->value.present = F1AP_SRBs_ToBeSetupMod_ItemIEs__value_PR_SRBs_ToBeSetupMod_Item; - /* 9.1 SRBs_ToBeSetupMod_Item */ - F1AP_SRBs_ToBeSetupMod_Item_t srbs_toBeSetupMod_item; - memset((void *)&srbs_toBeSetupMod_item, 0, sizeof(F1AP_SRBs_ToBeSetupMod_Item_t)); - + F1AP_SRBs_ToBeSetupMod_Item_t *srbs_toBeSetupMod_item= + &srbs_toBeSetupMod_item_ies->value.choice.SRBs_ToBeSetupMod_Item; /* - sRBID */ - srbs_toBeSetupMod_item.sRBID = 3L; - - /* ADD */ - srbs_toBeSetupMod_item_ies->value.choice.SRBs_ToBeSetupMod_Item = srbs_toBeSetupMod_item; - - ASN_SEQUENCE_ADD(&ie->value.choice.SRBs_ToBeSetupMod_List.list, - srbs_toBeSetupMod_item_ies); + srbs_toBeSetupMod_item->sRBID = 3L; } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - /* mandatory */ /* c12. DRBs_ToBeSetupMod_List */ - ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_DRBs_ToBeSetupMod_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_DRBs_ToBeSetupMod_List; + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextModificationRequestIEs_t, ie12); + ie12->id = F1AP_ProtocolIE_ID_id_DRBs_ToBeSetupMod_List; + ie12->criticality = F1AP_Criticality_reject; + ie12->value.present = F1AP_UEContextModificationRequestIEs__value_PR_DRBs_ToBeSetupMod_List; - for (i=0; - i<1; - i++) { + for (int i=0; i<1; i++) { // - F1AP_DRBs_ToBeSetupMod_ItemIEs_t *drbs_toBeSetupMod_item_ies; - drbs_toBeSetupMod_item_ies = (F1AP_DRBs_ToBeSetupMod_ItemIEs_t *)calloc(1, sizeof(F1AP_DRBs_ToBeSetupMod_ItemIEs_t)); + asn1cSequenceAdd(ie12->value.choice.DRBs_ToBeSetupMod_List.list, + F1AP_DRBs_ToBeSetupMod_ItemIEs_t, drbs_toBeSetupMod_item_ies); drbs_toBeSetupMod_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_ToBeSetupMod_Item; drbs_toBeSetupMod_item_ies->criticality = F1AP_Criticality_reject; drbs_toBeSetupMod_item_ies->value.present = F1AP_DRBs_ToBeSetupMod_ItemIEs__value_PR_DRBs_ToBeSetupMod_Item; - /* 12.1 DRBs_ToBeSetupMod_Item */ - F1AP_DRBs_ToBeSetupMod_Item_t drbs_toBeSetupMod_item; - memset((void *)&drbs_toBeSetupMod_item, 0, sizeof(F1AP_DRBs_ToBeSetupMod_Item_t)); - + F1AP_DRBs_ToBeSetupMod_Item_t *drbs_toBeSetupMod_item= + &drbs_toBeSetupMod_item_ies->value.choice.DRBs_ToBeSetupMod_Item; /* dRBID */ - drbs_toBeSetupMod_item.dRBID = 30L; - + drbs_toBeSetupMod_item->dRBID = 30L; /* qoSInformation */ - drbs_toBeSetupMod_item.qoSInformation.present = F1AP_QoSInformation_PR_eUTRANQoS; - drbs_toBeSetupMod_item.qoSInformation.choice.eUTRANQoS = (F1AP_EUTRANQoS_t *)calloc(1, sizeof(F1AP_EUTRANQoS_t)); - drbs_toBeSetupMod_item.qoSInformation.choice.eUTRANQoS->qCI = 253L; - + drbs_toBeSetupMod_item->qoSInformation.present = F1AP_QoSInformation_PR_eUTRANQoS; + drbs_toBeSetupMod_item->qoSInformation.choice.eUTRANQoS = (F1AP_EUTRANQoS_t *)calloc(1, sizeof(F1AP_EUTRANQoS_t)); + drbs_toBeSetupMod_item->qoSInformation.choice.eUTRANQoS->qCI = 253L; /* uLUPTNLInformation_ToBeSetup_List */ - int j = 0; int maxnoofULTunnels = 1; // 2; - for (j=0; - juLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; - F1AP_GTPTunnel_t *gTPTunnel = (F1AP_GTPTunnel_t *)calloc(1, sizeof(F1AP_GTPTunnel_t)); - - /* transportLayerAddress */ - TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); - - /* gTP_TEID */ - OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "4567", - strlen("4567")); - - // Add - uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.choice.gTPTunnel = gTPTunnel; - ASN_SEQUENCE_ADD(&drbs_toBeSetupMod_item.uLUPTNLInformation_ToBeSetup_List.list, uLUPTNLInformation_ToBeSetup_Item); + for (int j=0; juLUPTNLInformation_ToBeSetup_List.list, + F1AP_ULUPTNLInformation_ToBeSetup_Item_t, uLUPTNLInformation_ToBeSetup_Item); + uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; + asn1cCalloc(uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.choice.gTPTunnel, + F1AP_GTPTunnel_t, gTPTunnel) + /* transportLayerAddress */ + TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); + /* gTP_TEID */ + OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "4567", + strlen("4567")); } /* rLCMode */ - drbs_toBeSetupMod_item.rLCMode = F1AP_RLCMode_rlc_um_bidirectional; // enum + drbs_toBeSetupMod_item->rLCMode = F1AP_RLCMode_rlc_um_bidirectional; // enum /* OPTIONAL */ /* ULConfiguration */ if (0) { - drbs_toBeSetupMod_item.uLConfiguration = (F1AP_ULConfiguration_t *)calloc(1, sizeof(F1AP_ULConfiguration_t)); + drbs_toBeSetupMod_item->uLConfiguration = (F1AP_ULConfiguration_t *)calloc(1, sizeof(F1AP_ULConfiguration_t)); } - - /* ADD */ - drbs_toBeSetupMod_item_ies->value.choice.DRBs_ToBeSetupMod_Item = drbs_toBeSetupMod_item; - ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_ToBeSetupMod_List.list, - drbs_toBeSetupMod_item_ies); - } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ /* c13. DRBs_ToBeModified_List */ - ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_DRBs_ToBeModified_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_DRBs_ToBeModified_List; + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextModificationRequestIEs_t, ie13); + ie13->id = F1AP_ProtocolIE_ID_id_DRBs_ToBeModified_List; + ie13->criticality = F1AP_Criticality_reject; + ie13->value.present = F1AP_UEContextModificationRequestIEs__value_PR_DRBs_ToBeModified_List; - for (i=0; - i<1; - i++) { + for (int i=0; i<1; i++) { // - F1AP_DRBs_ToBeModified_ItemIEs_t *drbs_toBeModified_item_ies; - drbs_toBeModified_item_ies = (F1AP_DRBs_ToBeModified_ItemIEs_t *)calloc(1, sizeof(F1AP_DRBs_ToBeModified_ItemIEs_t)); + asn1cSequenceAdd( ie13->value.choice.DRBs_ToBeModified_List.list, + F1AP_DRBs_ToBeModified_ItemIEs_t, drbs_toBeModified_item_ies); drbs_toBeModified_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_ToBeModified_Item; drbs_toBeModified_item_ies->criticality = F1AP_Criticality_reject; drbs_toBeModified_item_ies->value.present = F1AP_DRBs_ToBeModified_ItemIEs__value_PR_DRBs_ToBeModified_Item; - /* 13.1 SRBs_ToBeModified_Item */ - F1AP_DRBs_ToBeModified_Item_t drbs_toBeModified_item; - memset((void *)&drbs_toBeModified_item, 0, sizeof(F1AP_DRBs_ToBeModified_Item_t)); - + F1AP_DRBs_ToBeModified_Item_t *drbs_toBeModified_item= + &drbs_toBeModified_item_ies->value.choice.DRBs_ToBeModified_Item; /* dRBID */ - drbs_toBeModified_item.dRBID = 30L; - + drbs_toBeModified_item->dRBID = 30L; /* qoSInformation */ - drbs_toBeModified_item.qoSInformation =calloc(1,sizeof(*drbs_toBeModified_item.qoSInformation)); - drbs_toBeModified_item.qoSInformation->present = F1AP_QoSInformation_PR_eUTRANQoS; - drbs_toBeModified_item.qoSInformation->choice.eUTRANQoS = (F1AP_EUTRANQoS_t *)calloc(1, sizeof(F1AP_EUTRANQoS_t)); - drbs_toBeModified_item.qoSInformation->choice.eUTRANQoS->qCI = 254L; - + asn1cCalloc(drbs_toBeModified_item->qoSInformation, F1AP_QoSInformation_t, tmp); + tmp->present = F1AP_QoSInformation_PR_eUTRANQoS; + tmp->choice.eUTRANQoS = (F1AP_EUTRANQoS_t *)calloc(1, sizeof(F1AP_EUTRANQoS_t)); + tmp->choice.eUTRANQoS->qCI = 254L; /* ULTunnels_ToBeModified_List */ - int j = 0; int maxnoofULTunnels = 1; // 2; - for (j=0; - juLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; - F1AP_GTPTunnel_t *gTPTunnel = (F1AP_GTPTunnel_t *)calloc(1, sizeof(F1AP_GTPTunnel_t)); - TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); - - OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "1204", - strlen("1204")); - - uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.choice.gTPTunnel = gTPTunnel; - - ASN_SEQUENCE_ADD(&drbs_toBeModified_item.uLUPTNLInformation_ToBeSetup_List.list, uLUPTNLInformation_ToBeSetup_Item); + for (int j=0; juLUPTNLInformation_ToBeSetup_List.list, + F1AP_ULUPTNLInformation_ToBeSetup_Item_t, uLUPTNLInformation_ToBeSetup_Item); + uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; + asn1cCalloc(uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.choice.gTPTunnel, + F1AP_GTPTunnel_t, gTPTunnel); + TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); + OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "1204", + strlen("1204")); } /* OPTIONAL */ /* ULConfiguration */ if (0) { - drbs_toBeModified_item.uLConfiguration = (F1AP_ULConfiguration_t *)calloc(1, sizeof(F1AP_ULConfiguration_t)); + drbs_toBeModified_item->uLConfiguration = (F1AP_ULConfiguration_t *)calloc(1, sizeof(F1AP_ULConfiguration_t)); } - - /* ADD */ - drbs_toBeModified_item_ies->value.choice.DRBs_ToBeModified_Item = drbs_toBeModified_item; - ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_ToBeModified_List.list, - drbs_toBeModified_item_ies); - } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ /* c14. SRBs_ToBeReleased_List */ - ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_SRBs_ToBeReleased_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_SRBs_ToBeReleased_List; + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextModificationRequestIEs_t, ie14); + ie14->id = F1AP_ProtocolIE_ID_id_SRBs_ToBeReleased_List; + ie14->criticality = F1AP_Criticality_reject; + ie14->value.present = F1AP_UEContextModificationRequestIEs__value_PR_SRBs_ToBeReleased_List; - for (i=0; - i<1; - i++) { + for (int i=0; i<1; i++) { // - F1AP_SRBs_ToBeReleased_ItemIEs_t *srbs_toBeReleased_item_ies; - srbs_toBeReleased_item_ies = (F1AP_SRBs_ToBeReleased_ItemIEs_t *)calloc(1, sizeof(F1AP_SRBs_ToBeReleased_ItemIEs_t)); - //memset((void *)&srbs_toBeReleased_item_ies, 0, sizeof(F1AP_SRBs_ToBeReleased_ItemIEs_t)); + asn1cSequenceAdd(ie14->value.choice.SRBs_ToBeReleased_List.list, + F1AP_SRBs_ToBeReleased_ItemIEs_t, srbs_toBeReleased_item_ies); srbs_toBeReleased_item_ies->id = F1AP_ProtocolIE_ID_id_SRBs_ToBeReleased_Item; srbs_toBeReleased_item_ies->criticality = F1AP_Criticality_ignore; srbs_toBeReleased_item_ies->value.present = F1AP_SRBs_ToBeReleased_ItemIEs__value_PR_SRBs_ToBeReleased_Item; - /* 9.1 SRBs_ToBeReleased_Item */ - F1AP_SRBs_ToBeReleased_Item_t srbs_toBeReleased_item; - memset((void *)&srbs_toBeReleased_item, 0, sizeof(F1AP_SRBs_ToBeReleased_Item_t)); - + F1AP_SRBs_ToBeReleased_Item_t *srbs_toBeReleased_item= + &srbs_toBeReleased_item_ies->value.choice.SRBs_ToBeReleased_Item; /* - sRBID */ - srbs_toBeReleased_item.sRBID = 2L; - - /* ADD */ - srbs_toBeReleased_item_ies->value.choice.SRBs_ToBeReleased_Item = srbs_toBeReleased_item; - ASN_SEQUENCE_ADD(&ie->value.choice.SRBs_ToBeReleased_List.list, - srbs_toBeReleased_item_ies); + srbs_toBeReleased_item->sRBID = 2L; } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ /* c15. DRBs_ToBeReleased_List */ - ie = (F1AP_UEContextModificationRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_DRBs_ToBeReleased_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextModificationRequestIEs__value_PR_DRBs_ToBeReleased_List; + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextModificationRequestIEs_t, ie15); + ie15->id = F1AP_ProtocolIE_ID_id_DRBs_ToBeReleased_List; + ie15->criticality = F1AP_Criticality_reject; + ie15->value.present = F1AP_UEContextModificationRequestIEs__value_PR_DRBs_ToBeReleased_List; - for (i=0; - i<1; - i++) { + for (int i=0; i<1; i++) { // - F1AP_DRBs_ToBeReleased_ItemIEs_t *drbs_toBeReleased_item_ies; - drbs_toBeReleased_item_ies = (F1AP_DRBs_ToBeReleased_ItemIEs_t *)calloc(1, sizeof(F1AP_DRBs_ToBeReleased_ItemIEs_t)); + asn1cSequenceAdd(ie15->value.choice.DRBs_ToBeReleased_List.list, + F1AP_DRBs_ToBeReleased_ItemIEs_t, drbs_toBeReleased_item_ies); drbs_toBeReleased_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_ToBeReleased_Item; drbs_toBeReleased_item_ies->criticality = F1AP_Criticality_reject; drbs_toBeReleased_item_ies->value.present = F1AP_DRBs_ToBeReleased_ItemIEs__value_PR_DRBs_ToBeReleased_Item; - /* 14.1 SRBs_ToBeReleased_Item */ - F1AP_DRBs_ToBeReleased_Item_t drbs_toBeReleased_item; - memset((void *)&drbs_toBeReleased_item, 0, sizeof(F1AP_DRBs_ToBeReleased_Item_t)); - + F1AP_DRBs_ToBeReleased_Item_t *drbs_toBeReleased_item= + &drbs_toBeReleased_item_ies->value.choice.DRBs_ToBeReleased_Item; /* dRBID */ - drbs_toBeReleased_item.dRBID = 30L; - - /* ADD */ - drbs_toBeReleased_item_ies->value.choice.DRBs_ToBeReleased_Item = drbs_toBeReleased_item; - ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_ToBeReleased_List.list, - drbs_toBeReleased_item_ies); - + drbs_toBeReleased_item->dRBID = 30L; } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { @@ -1573,27 +1247,27 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance) { } int CU_handle_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { AssertFatal(1==0,"Not implemented yet\n"); } int CU_handle_UE_CONTEXT_MODIFICATION_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { AssertFatal(1==0,"Not implemented yet\n"); } int CU_handle_UE_CONTEXT_MODIFICATION_REQUIRED(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { AssertFatal(1==0,"Not implemented yet\n"); } int CU_send_UE_CONTEXT_MODIFICATION_CONFIRM(instance_t instance, - F1AP_UEContextModificationConfirm_t UEContextModificationConfirm_t) { + F1AP_UEContextModificationConfirm_t UEContextModificationConfirm_t) { AssertFatal(1==0,"Not implemented yet\n"); } diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.h b/openair2/F1AP/f1ap_cu_ue_context_management.h index cc4ca3e35f..a0df3a53d9 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.h +++ b/openair2/F1AP/f1ap_cu_ue_context_management.h @@ -54,9 +54,9 @@ int CU_handle_UE_CONTEXT_SETUP_FAILURE(instance_t instance, * UE Context Release Request (gNB-DU initiated) */ int CU_handle_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); /* * UE Context Release (gNB-CU initiated) @@ -65,32 +65,32 @@ int CU_send_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, f1ap_ue_context_release_cmd_t *cmd); int CU_handle_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); /* * UE Context Modification (gNB-CU initiated) */ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance); int CU_handle_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); int CU_handle_UE_CONTEXT_MODIFICATION_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); /* * UE Context Modification Required (gNB-DU initiated) */ int CU_handle_UE_CONTEXT_MODIFICATION_REQUIRED(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); int CU_send_UE_CONTEXT_MODIFICATION_CONFIRM(instance_t instance, - F1AP_UEContextModificationConfirm_t UEContextModificationConfirm_t); + F1AP_UEContextModificationConfirm_t UEContextModificationConfirm_t); /* * UE Inactivity Notification diff --git a/openair2/F1AP/f1ap_decoder.c b/openair2/F1AP/f1ap_decoder.c index 1b35ca6ccf..94797d3f28 100644 --- a/openair2/F1AP/f1ap_decoder.c +++ b/openair2/F1AP/f1ap_decoder.c @@ -35,15 +35,13 @@ int asn1_decoder_xer_print = 0; -static int f1ap_decode_initiating_message(F1AP_F1AP_PDU_t *pdu) -{ +static int f1ap_decode_initiating_message(F1AP_F1AP_PDU_t *pdu) { //MessageDef *message_p; //MessagesIds message_id; //asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} }; DevAssert(pdu != NULL); switch(pdu->choice.initiatingMessage->procedureCode) { - case F1AP_ProcedureCode_id_F1Setup: //res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); LOG_I(F1AP, "%s(): F1AP_ProcedureCode_id_F1Setup\n", __func__); @@ -68,15 +66,19 @@ static int f1ap_decode_initiating_message(F1AP_F1AP_PDU_t *pdu) //res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); LOG_I(F1AP, "%s(): F1AP_ProcedureCode_id_ULRRCMessageTransfer\n", __func__); break; + case F1AP_ProcedureCode_id_UEContextRelease: LOG_I(F1AP, "%s(): F1AP_ProcedureCode_id_UEContextRelease\n", __func__); break; + case F1AP_ProcedureCode_id_UEContextReleaseRequest: LOG_I(F1AP, "%s(): F1AP_ProcedureCode_id_UEContextReleaseRequest\n", __func__); break; + case F1AP_ProcedureCode_id_UEContextSetup: LOG_I(F1AP, "%s(): F1AP_ProcedureCode_id_UEContextSetup\n", __func__); break; + // case F1AP_ProcedureCode_id_InitialContextSetup: // res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); // message_id = F1AP_INITIAL_CONTEXT_SETUP_LOG; @@ -92,7 +94,7 @@ static int f1ap_decode_initiating_message(F1AP_F1AP_PDU_t *pdu) // F1AP_ERROR("Unknown procedure ID (%d) for initiating message\n", // (int)pdu->choice.initiatingMessage->procedureCode); LOG_E(F1AP, "Unknown procedure ID (%d) for initiating message\n", - (int)pdu->choice.initiatingMessage->procedureCode); + (int)pdu->choice.initiatingMessage->procedureCode); AssertFatal( 0, "Unknown procedure ID (%d) for initiating message\n", (int)pdu->choice.initiatingMessage->procedureCode); return -1; @@ -101,8 +103,7 @@ static int f1ap_decode_initiating_message(F1AP_F1AP_PDU_t *pdu) return 0; } -static int f1ap_decode_successful_outcome(F1AP_F1AP_PDU_t *pdu) -{ +static int f1ap_decode_successful_outcome(F1AP_F1AP_PDU_t *pdu) { DevAssert(pdu != NULL); switch(pdu->choice.successfulOutcome->procedureCode) { @@ -120,39 +121,35 @@ static int f1ap_decode_successful_outcome(F1AP_F1AP_PDU_t *pdu) default: LOG_E(F1AP,"Unknown procedure ID (%d) for successfull outcome message\n", - (int)pdu->choice.successfulOutcome->procedureCode); + (int)pdu->choice.successfulOutcome->procedureCode); return -1; } return 0; } -static int f1ap_decode_unsuccessful_outcome(F1AP_F1AP_PDU_t *pdu) -{ +static int f1ap_decode_unsuccessful_outcome(F1AP_F1AP_PDU_t *pdu) { DevAssert(pdu != NULL); switch(pdu->choice.unsuccessfulOutcome->procedureCode) { case F1AP_ProcedureCode_id_F1Setup: - LOG_I(F1AP, "%s(): F1AP_ProcedureCode_id_F1Setup\n", __func__); - break; + LOG_I(F1AP, "%s(): F1AP_ProcedureCode_id_F1Setup\n", __func__); + break; default: // F1AP_ERROR("Unknown procedure ID (%d) for unsuccessfull outcome message\n", // (int)pdu->choice.unsuccessfulOutcome->procedureCode); LOG_E(F1AP, "Unknown procedure ID (%d) for unsuccessfull outcome message\n", - (int)pdu->choice.unsuccessfulOutcome->procedureCode); + (int)pdu->choice.unsuccessfulOutcome->procedureCode); return -1; } return 0; } -int f1ap_decode_pdu(F1AP_F1AP_PDU_t *pdu, const uint8_t *const buffer, uint32_t length) -{ +int f1ap_decode_pdu(F1AP_F1AP_PDU_t *pdu, const uint8_t *const buffer, uint32_t length) { asn_dec_rval_t dec_ret; - DevAssert(buffer != NULL); - dec_ret = aper_decode(NULL, &asn_DEF_F1AP_F1AP_PDU, (void **)&pdu, @@ -166,6 +163,7 @@ int f1ap_decode_pdu(F1AP_F1AP_PDU_t *pdu, const uint8_t *const buffer, uint32_t xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu); LOG_E(F1AP, "----------------- ASN1 DECODER PRINT END ----------------- \n"); } + //LOG_I(F1AP, "f1ap_decode_pdu.dec_ret.code = %d\n", dec_ret.code); if (dec_ret.code != RC_OK) { @@ -188,6 +186,5 @@ int f1ap_decode_pdu(F1AP_F1AP_PDU_t *pdu, const uint8_t *const buffer, uint32_t break; } - return -1; } diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index 26d6ae0b71..54d88666f2 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -43,7 +43,7 @@ extern RAN_CONTEXT_t RC; 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}; int to_NRNRB(int nrb) { - for (int i=0; i<29; i++) + for (int i=0; icriticality = F1AP_Criticality_reject; duServedCell->value.present = F1AP_GNB_DU_Served_Cells_ItemIEs__value_PR_GNB_DU_Served_Cells_Item; F1AP_GNB_DU_Served_Cells_Item_t *gnb_du_served_cells_item=&duServedCell->value.choice.GNB_DU_Served_Cells_Item; - /* 4.1.1 served cell Information */ F1AP_Served_Cell_Information_t *served_cell_information= &gnb_du_served_cells_item->served_Cell_Information; - F1AP_NRCGI_t *nRCGI= &served_cell_information->nRCGI; - /* - nRCGI */ - MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &nRCGI->pLMN_Identity); - LOG_D(F1AP, "plmn: (%d,%d)\n",f1ap_du_data->mcc[i],f1ap_du_data->mnc[i]); - NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[i], &nRCGI->nRCellIdentity); - LOG_D(F1AP, "nRCellIdentity (%llx): %x.%x.%x.%x.%x\n", - (long long unsigned int)f1ap_du_data->nr_cellid[i], - nRCGI->nRCellIdentity.buf[0], - nRCGI->nRCellIdentity.buf[1], - nRCGI->nRCellIdentity.buf[2], - nRCGI->nRCellIdentity.buf[3], - nRCGI->nRCellIdentity.buf[4]); + //addnRCGI(served_cell_information->nRCGI,f1ap_du_data->cell+i); /* - nRPCI */ - served_cell_information->nRPCI = f1ap_du_data->nr_pci[i]; // int 0..1007 + served_cell_information->nRPCI = f1ap_du_data->cell[i].nr_pci; // int 0..1007 /* - fiveGS_TAC */ - uint32_t tac=htonl(f1ap_du_data->tac[i]); + uint32_t tac=htonl(f1ap_du_data->cell[i].tac); asn1cCalloc(served_cell_information->fiveGS_TAC, F1AP_FiveGS_TAC_t, netOrder); OCTET_STRING_fromBuf(netOrder, ((char *)&tac)+1, 3); @@ -185,8 +170,8 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { /* servedPLMN information */ asn1cSequenceAdd(served_cell_information->servedPLMNs.list, F1AP_ServedPLMNs_Item_t,servedPLMN_item); - MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], - f1ap_du_data->mnc_digit_length[i], &servedPLMN_item->pLMN_Identity); + MCC_MNC_TO_PLMNID(f1ap_du_data->cell[i].mcc, f1ap_du_data->cell[i].mnc, + f1ap_du_data->cell[i].mnc_digit_length, &servedPLMN_item->pLMN_Identity); // // /* - CHOICE NR-MODE-Info */ F1AP_NR_Mode_Info_t *nR_Mode_Info= &served_cell_information->nR_Mode_Info; @@ -306,8 +291,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { OCTET_STRING_fromBuf(&served_cell_information->measurementTimingConfiguration, measurementTimingConfiguration, strlen(measurementTimingConfiguration)); - - asn1cCalloc(gnb_du_served_cells_item->gNB_DU_System_Information, F1AP_GNB_DU_System_Information_t, gNB_DU_System_Information); + asn1cCalloc(gnb_du_served_cells_item->gNB_DU_System_Information, F1AP_GNB_DU_System_Information_t, gNB_DU_System_Information); /* 4.1.2 gNB-DU System Information */ OCTET_STRING_fromBuf(&gNB_DU_System_Information->mIB_message, // sept. 2018 (const char *)f1ap_du_data->mib[i], //f1ap_du_data->mib, @@ -555,327 +539,228 @@ int DU_handle_F1_SETUP_FAILURE(instance_t instance, int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, instance_t du_mod_idP, f1ap_setup_req_t *f1ap_setup_req) { - F1AP_F1AP_PDU_t pdu; - F1AP_GNBDUConfigurationUpdate_t *out; - F1AP_GNBDUConfigurationUpdateIEs_t *ie; - uint8_t *buffer; - uint32_t len; - int i = 0; - int j = 0; + F1AP_F1AP_PDU_t pdu= {0}; + uint8_t *buffer=NULL; + uint32_t len=0; /* Create */ /* 0. Message Type */ - memset(&pdu, 0, sizeof(pdu)); pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; - pdu.choice.initiatingMessage = (F1AP_InitiatingMessage_t *)calloc(1, sizeof(F1AP_InitiatingMessage_t)); - pdu.choice.initiatingMessage->procedureCode = F1AP_ProcedureCode_id_gNBDUConfigurationUpdate; - pdu.choice.initiatingMessage->criticality = F1AP_Criticality_reject; - pdu.choice.initiatingMessage->value.present = F1AP_InitiatingMessage__value_PR_GNBDUConfigurationUpdate; - out = &pdu.choice.initiatingMessage->value.choice.GNBDUConfigurationUpdate; + asn1cCalloc(pdu.choice.initiatingMessage,F1AP_InitiatingMessage_t, initMsg); + initMsg->procedureCode = F1AP_ProcedureCode_id_gNBDUConfigurationUpdate; + initMsg->criticality = F1AP_Criticality_reject; + initMsg->value.present = F1AP_InitiatingMessage__value_PR_GNBDUConfigurationUpdate; + F1AP_GNBDUConfigurationUpdate_t *out = &pdu.choice.initiatingMessage->value.choice.GNBDUConfigurationUpdate; /* mandatory */ /* c1. Transaction ID (integer value) */ - ie = (F1AP_GNBDUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBDUConfigurationUpdateIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_TransactionID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_GNBDUConfigurationUpdateIEs__value_PR_TransactionID; - ie->value.choice.TransactionID = F1AP_get_next_transaction_identifier(instance, du_mod_idP); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + asn1cSequenceAdd(out, F1AP_GNBDUConfigurationUpdateIEs_t, ie1); + ie1->id = F1AP_ProtocolIE_ID_id_TransactionID; + ie1->criticality = F1AP_Criticality_reject; + ie1->value.present = F1AP_GNBDUConfigurationUpdateIEs__value_PR_TransactionID; + ie1->value.choice.TransactionID = F1AP_get_next_transaction_identifier(instance, du_mod_idP); /* mandatory */ /* c2. Served_Cells_To_Add */ - ie = (F1AP_GNBDUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBDUConfigurationUpdateIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_Served_Cells_To_Add_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_GNBDUConfigurationUpdateIEs__value_PR_Served_Cells_To_Add_List; + asn1cSequenceAdd(out, F1AP_GNBDUConfigurationUpdateIEs_t, ie2); + ie2->id = F1AP_ProtocolIE_ID_id_Served_Cells_To_Add_List; + ie2->criticality = F1AP_Criticality_reject; + ie2->value.present = F1AP_GNBDUConfigurationUpdateIEs__value_PR_Served_Cells_To_Add_List; - for (j=0; - j<1; - j++) { + for (int j=0; j<1; j++) { // - F1AP_Served_Cells_To_Add_ItemIEs_t *served_cells_to_add_item_ies; - served_cells_to_add_item_ies = (F1AP_Served_Cells_To_Add_ItemIEs_t *)calloc(1, sizeof(F1AP_Served_Cells_To_Add_ItemIEs_t)); + asn1cSequenceAdd(ie2->value.choice.Served_Cells_To_Add_List.list, F1AP_Served_Cells_To_Add_ItemIEs_t, served_cells_to_add_item_ies); served_cells_to_add_item_ies->id = F1AP_ProtocolIE_ID_id_Served_Cells_To_Add_Item; served_cells_to_add_item_ies->criticality = F1AP_Criticality_reject; served_cells_to_add_item_ies->value.present = F1AP_Served_Cells_To_Add_ItemIEs__value_PR_Served_Cells_To_Add_Item; - F1AP_Served_Cells_To_Add_Item_t served_cells_to_add_item; - memset((void *)&served_cells_to_add_item, 0, sizeof(F1AP_Served_Cells_To_Add_Item_t)); - /* 2.1.1 serverd cell Information */ - F1AP_Served_Cell_Information_t served_cell_information; - memset((void *)&served_cell_information, 0, sizeof(F1AP_Served_Cell_Information_t)); + F1AP_Served_Cells_To_Add_Item_t *served_cells_to_add_item= &served_cells_to_add_item_ies->value.choice.Served_Cells_To_Add_Item; + F1AP_Served_Cell_Information_t *served_cell_information=&served_cells_to_add_item->served_Cell_Information; /* - nRCGI */ - F1AP_NRCGI_t nRCGI; - memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t)); - MCC_MNC_TO_PLMNID(f1ap_setup_req->mcc[i], f1ap_setup_req->mnc[i], f1ap_setup_req->mnc_digit_length[i], &nRCGI.pLMN_Identity); - LOG_D(F1AP, "nr_cellId : %x %x %x %x %x\n", - nRCGI.nRCellIdentity.buf[0], - nRCGI.nRCellIdentity.buf[1], - nRCGI.nRCellIdentity.buf[2], - nRCGI.nRCellIdentity.buf[3], - nRCGI.nRCellIdentity.buf[4]); - NR_CELL_ID_TO_BIT_STRING(f1ap_setup_req->nr_cellid[i], &nRCGI.nRCellIdentity); - served_cell_information.nRCGI = nRCGI; + //addnRCGI(served_cell_information->nRCGI, f1ap_setup_req->cell[j]); /* - nRPCI */ - served_cell_information.nRPCI = f1ap_setup_req->nr_pci[i]; // int 0..1007 + /* 2.1.1 serverd cell Information */ + served_cell_information->nRPCI = f1ap_setup_req->cell[j].nr_pci; // int 0..1007 /* - fiveGS_TAC */ - uint32_t tac=htonl(f1ap_du_data->tac[i]); - served_cell_information.fiveGS_TAC=(F1AP_FiveGS_TAC_t *) calloc(1,sizeof(F1AP_FiveGS_TAC_t *)); - OCTET_STRING_fromBuf(served_cell_information.fiveGS_TAC, ((char *)&tac)+1, 3); + uint32_t tac=htonl(f1ap_du_data->cell[j].tac); + served_cell_information->fiveGS_TAC=(F1AP_FiveGS_TAC_t *) calloc(1,sizeof(F1AP_FiveGS_TAC_t *)); + OCTET_STRING_fromBuf(served_cell_information->fiveGS_TAC, ((char *)&tac)+1, 3); /* - Configured_EPS_TAC */ if(1) { - served_cell_information.configured_EPS_TAC = (F1AP_Configured_EPS_TAC_t *)calloc(1, sizeof(F1AP_Configured_EPS_TAC_t)); - OCTET_STRING_fromBuf(served_cell_information.configured_EPS_TAC, - "2", - 2); + served_cell_information->configured_EPS_TAC = (F1AP_Configured_EPS_TAC_t *)calloc(1, sizeof(F1AP_Configured_EPS_TAC_t)); + OCTET_STRING_fromBuf(served_cell_information->configured_EPS_TAC,"2", 2); } - F1AP_ServedPLMNs_Item_t *servedPLMN_item = calloc(1,sizeof(*servedPLMN_item)); - memset(servedPLMN_item,0,sizeof(*servedPLMN_item)); - MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &servedPLMN_item->pLMN_Identity); - ASN_SEQUENCE_ADD(&served_cell_information.servedPLMNs.list, servedPLMN_item); + asn1cSequenceAdd(served_cell_information->servedPLMNs.list, F1AP_ServedPLMNs_Item_t, servedPLMN_item); + MCC_MNC_TO_PLMNID(f1ap_du_data->cell[j].mcc, f1ap_du_data->cell[j].mnc, f1ap_du_data->cell[j].mnc_digit_length, &servedPLMN_item->pLMN_Identity); // // /* - CHOICE NR-MODE-Info */ - F1AP_NR_Mode_Info_t nR_Mode_Info; + F1AP_NR_Mode_Info_t *nR_Mode_Info=&served_cell_information->nR_Mode_Info; if (f1ap_setup_req->fdd_flag) { - nR_Mode_Info.present = F1AP_NR_Mode_Info_PR_fDD; + nR_Mode_Info->present = F1AP_NR_Mode_Info_PR_fDD; /* > FDD >> FDD Info */ - F1AP_FDD_Info_t *fDD_Info = (F1AP_FDD_Info_t *)calloc(1, sizeof(F1AP_FDD_Info_t)); + asn1cCalloc(nR_Mode_Info->choice.fDD, F1AP_FDD_Info_t, fDD_Info); /* >>> UL NRFreqInfo */ fDD_Info->uL_NRFreqInfo.nRARFCN = 999L; - F1AP_FreqBandNrItem_t ul_freqBandNrItem; - memset((void *)&ul_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); - ul_freqBandNrItem.freqBandIndicatorNr = 888L; - F1AP_SupportedSULFreqBandItem_t ul_supportedSULFreqBandItem; - memset((void *)&ul_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); - ul_supportedSULFreqBandItem.freqBandIndicatorNr = 777L; - ASN_SEQUENCE_ADD(&ul_freqBandNrItem.supportedSULBandList.list, &ul_supportedSULFreqBandItem); - ASN_SEQUENCE_ADD(&fDD_Info->uL_NRFreqInfo.freqBandListNr.list, &ul_freqBandNrItem); + asn1cSequenceAdd(fDD_Info->uL_NRFreqInfo.freqBandListNr.list, F1AP_FreqBandNrItem_t, ul_freqBandNrItem); + ul_freqBandNrItem->freqBandIndicatorNr = 888L; + asn1cSequenceAdd(ul_freqBandNrItem->supportedSULBandList.list, F1AP_SupportedSULFreqBandItem_t, ul_supportedSULFreqBandItem); + ul_supportedSULFreqBandItem->freqBandIndicatorNr = 777L; /* >>> DL NRFreqInfo */ fDD_Info->dL_NRFreqInfo.nRARFCN = 666L; - F1AP_FreqBandNrItem_t dl_freqBandNrItem; - memset((void *)&dl_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); - dl_freqBandNrItem.freqBandIndicatorNr = 555L; - F1AP_SupportedSULFreqBandItem_t dl_supportedSULFreqBandItem; - memset((void *)&dl_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); - dl_supportedSULFreqBandItem.freqBandIndicatorNr = 444L; - ASN_SEQUENCE_ADD(&dl_freqBandNrItem.supportedSULBandList.list, &dl_supportedSULFreqBandItem); - ASN_SEQUENCE_ADD(&fDD_Info->dL_NRFreqInfo.freqBandListNr.list, &dl_freqBandNrItem); + asn1cSequenceAdd(fDD_Info->dL_NRFreqInfo.freqBandListNr.list, F1AP_FreqBandNrItem_t, dl_freqBandNrItem); + dl_freqBandNrItem->freqBandIndicatorNr = 555L; + asn1cSequenceAdd(dl_freqBandNrItem->supportedSULBandList.list, F1AP_SupportedSULFreqBandItem_t, dl_supportedSULFreqBandItem); + dl_supportedSULFreqBandItem->freqBandIndicatorNr = 444L; /* >>> UL Transmission Bandwidth */ fDD_Info->uL_Transmission_Bandwidth.nRSCS = F1AP_NRSCS_scs15; fDD_Info->uL_Transmission_Bandwidth.nRNRB = F1AP_NRNRB_nrb11; /* >>> DL Transmission Bandwidth */ fDD_Info->dL_Transmission_Bandwidth.nRSCS = F1AP_NRSCS_scs15; fDD_Info->dL_Transmission_Bandwidth.nRNRB = F1AP_NRNRB_nrb11; - nR_Mode_Info.choice.fDD = fDD_Info; } else { // TDD - nR_Mode_Info.present = F1AP_NR_Mode_Info_PR_tDD; + nR_Mode_Info->present = F1AP_NR_Mode_Info_PR_tDD; /* > TDD >> TDD Info */ - F1AP_TDD_Info_t *tDD_Info = (F1AP_TDD_Info_t *)calloc(1, sizeof(F1AP_TDD_Info_t)); + asn1cCalloc(nR_Mode_Info->choice.tDD, F1AP_TDD_Info_t, tDD_Info); /* >>> ARFCN */ tDD_Info->nRFreqInfo.nRARFCN = 999L; // Integer - F1AP_FreqBandNrItem_t nr_freqBandNrItem; - memset((void *)&nr_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); - nr_freqBandNrItem.freqBandIndicatorNr = 555L; - F1AP_SupportedSULFreqBandItem_t nr_supportedSULFreqBandItem; - memset((void *)&nr_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); - nr_supportedSULFreqBandItem.freqBandIndicatorNr = 444L; - ASN_SEQUENCE_ADD(&nr_freqBandNrItem.supportedSULBandList.list, &nr_supportedSULFreqBandItem); - ASN_SEQUENCE_ADD(&tDD_Info->nRFreqInfo.freqBandListNr.list, &nr_freqBandNrItem); + asn1cSequenceAdd(tDD_Info->nRFreqInfo.freqBandListNr.list, F1AP_FreqBandNrItem_t, nr_freqBandNrItem); + nr_freqBandNrItem->freqBandIndicatorNr = 555L; + asn1cSequenceAdd(nr_freqBandNrItem->supportedSULBandList.list, F1AP_SupportedSULFreqBandItem_t, nr_supportedSULFreqBandItem); + nr_supportedSULFreqBandItem->freqBandIndicatorNr = 444L; tDD_Info->transmission_Bandwidth.nRSCS= F1AP_NRSCS_scs15; tDD_Info->transmission_Bandwidth.nRNRB= F1AP_NRNRB_nrb11; - nR_Mode_Info.choice.tDD = tDD_Info; } - served_cell_information.nR_Mode_Info = nR_Mode_Info; /* - measurementTimingConfiguration */ char *measurementTimingConfiguration = "0"; // sept. 2018 - OCTET_STRING_fromBuf(&served_cell_information.measurementTimingConfiguration, + OCTET_STRING_fromBuf(&served_cell_information->measurementTimingConfiguration, measurementTimingConfiguration, strlen(measurementTimingConfiguration)); - served_cells_to_add_item.served_Cell_Information = served_cell_information; // /* 2.1.2 gNB-DU System Information */ - F1AP_GNB_DU_System_Information_t *gNB_DU_System_Information = (F1AP_GNB_DU_System_Information_t *)calloc(1, sizeof(F1AP_GNB_DU_System_Information_t)); + asn1cCalloc(served_cells_to_add_item->gNB_DU_System_Information, F1AP_GNB_DU_System_Information_t, gNB_DU_System_Information); OCTET_STRING_fromBuf(&gNB_DU_System_Information->mIB_message, // sept. 2018 "1", sizeof("1")); OCTET_STRING_fromBuf(&gNB_DU_System_Information->sIB1_message, // sept. 2018 "1", sizeof("1")); - served_cells_to_add_item.gNB_DU_System_Information = gNB_DU_System_Information; // - /* ADD */ - served_cells_to_add_item_ies->value.choice.Served_Cells_To_Add_Item = served_cells_to_add_item; - ASN_SEQUENCE_ADD(&ie->value.choice.Served_Cells_To_Add_List.list, - served_cells_to_add_item_ies); } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ /* c3. Served_Cells_To_Modify */ - ie = (F1AP_GNBDUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBDUConfigurationUpdateIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_Served_Cells_To_Modify_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_GNBDUConfigurationUpdateIEs__value_PR_Served_Cells_To_Modify_List; + asn1cSequenceAdd(out, F1AP_GNBDUConfigurationUpdateIEs_t, ie3); + ie3->id = F1AP_ProtocolIE_ID_id_Served_Cells_To_Modify_List; + ie3->criticality = F1AP_Criticality_reject; + ie3->value.present = F1AP_GNBDUConfigurationUpdateIEs__value_PR_Served_Cells_To_Modify_List; - for (i=0; - i<1; - i++) { + for (int i=0; i<1; i++) { // - F1AP_Served_Cells_To_Modify_ItemIEs_t *served_cells_to_modify_item_ies; - served_cells_to_modify_item_ies = (F1AP_Served_Cells_To_Modify_ItemIEs_t *)calloc(1, sizeof(F1AP_Served_Cells_To_Modify_ItemIEs_t)); + asn1cSequenceAdd(ie3->value.choice.Served_Cells_To_Modify_List.list, F1AP_Served_Cells_To_Modify_ItemIEs_t, served_cells_to_modify_item_ies); served_cells_to_modify_item_ies->id = F1AP_ProtocolIE_ID_id_Served_Cells_To_Modify_Item; served_cells_to_modify_item_ies->criticality = F1AP_Criticality_reject; served_cells_to_modify_item_ies->value.present = F1AP_Served_Cells_To_Modify_ItemIEs__value_PR_Served_Cells_To_Modify_Item; - F1AP_Served_Cells_To_Modify_Item_t served_cells_to_modify_item; - memset((void *)&served_cells_to_modify_item, 0, sizeof(F1AP_Served_Cells_To_Modify_Item_t)); + F1AP_Served_Cells_To_Modify_Item_t *served_cells_to_modify_item=&served_cells_to_modify_item_ies->value.choice.Served_Cells_To_Modify_Item; /* 3.1 oldNRCGI */ - F1AP_NRCGI_t oldNRCGI; - memset(&oldNRCGI, 0, sizeof(F1AP_NRCGI_t)); - MCC_MNC_TO_PLMNID(f1ap_setup_req->mcc[i], f1ap_setup_req->mnc[i], f1ap_setup_req->mnc_digit_length[i], - &oldNRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(f1ap_setup_req->nr_cellid[i], &oldNRCGI.nRCellIdentity); - served_cells_to_modify_item.oldNRCGI = oldNRCGI; + //addnRGCI(served_cells_to_modify_item->oldNRCGI, f1ap_setup_req->cell[i]); /* 3.2.1 serverd cell Information */ - F1AP_Served_Cell_Information_t served_cell_information; - memset((void *)&served_cell_information, 0, sizeof(F1AP_Served_Cell_Information_t)); + F1AP_Served_Cell_Information_t *served_cell_information= &served_cells_to_modify_item->served_Cell_Information; /* - nRCGI */ - F1AP_NRCGI_t nRCGI; - memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t)); - MCC_MNC_TO_PLMNID(f1ap_setup_req->mcc[i], f1ap_setup_req->mnc[i], f1ap_setup_req->mnc_digit_length[i], - &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(f1ap_setup_req->nr_cellid[i], &nRCGI.nRCellIdentity); - served_cell_information.nRCGI = nRCGI; + //addnRGCI(served_cell_information->nRCGI,f1ap_setup_req->cell[i]); /* - nRPCI */ - served_cell_information.nRPCI = f1ap_setup_req->nr_pci[i]; // int 0..1007 + served_cell_information->nRPCI = f1ap_setup_req->cell[i].nr_pci; // int 0..1007 /* - fiveGS_TAC */ - served_cell_information.fiveGS_TAC=calloc(1,sizeof(*served_cell_information.fiveGS_TAC)); - OCTET_STRING_fromBuf(served_cell_information.fiveGS_TAC, - (const char *) &f1ap_setup_req->tac[i], + asn1cCalloc(served_cell_information->fiveGS_TAC,F1AP_FiveGS_TAC_t, tac ); + OCTET_STRING_fromBuf(tac, + (const char *) &f1ap_setup_req->cell[i].tac, 3); /* - Configured_EPS_TAC */ if(1) { - served_cell_information.configured_EPS_TAC = (F1AP_Configured_EPS_TAC_t *)calloc(1, sizeof(F1AP_Configured_EPS_TAC_t)); - OCTET_STRING_fromBuf(served_cell_information.configured_EPS_TAC, + asn1cCalloc(served_cell_information->configured_EPS_TAC, F1AP_Configured_EPS_TAC_t, tmp2); + OCTET_STRING_fromBuf(tmp2, "2", 2); } - F1AP_ServedPLMNs_Item_t *servedPLMN_item = calloc(1,sizeof(*servedPLMN_item)); - memset(servedPLMN_item,0,sizeof(*servedPLMN_item)); - MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &servedPLMN_item->pLMN_Identity); - ASN_SEQUENCE_ADD(&served_cell_information.servedPLMNs.list, servedPLMN_item); + asn1cSequenceAdd(served_cell_information->servedPLMNs.list, F1AP_ServedPLMNs_Item_t, servedPLMN_item); + MCC_MNC_TO_PLMNID(f1ap_du_data->cell[i].mcc, f1ap_du_data->cell[i].mnc, f1ap_du_data->cell[i].mnc_digit_length, &servedPLMN_item->pLMN_Identity); // // /* - CHOICE NR-MODE-Info */ - F1AP_NR_Mode_Info_t nR_Mode_Info; + F1AP_NR_Mode_Info_t *nR_Mode_Info= &served_cell_information->nR_Mode_Info; if (f1ap_setup_req->fdd_flag) { - nR_Mode_Info.present = F1AP_NR_Mode_Info_PR_fDD; + nR_Mode_Info->present = F1AP_NR_Mode_Info_PR_fDD; /* > FDD >> FDD Info */ - F1AP_FDD_Info_t *fDD_Info = (F1AP_FDD_Info_t *)calloc(1, sizeof(F1AP_FDD_Info_t)); + asn1cCalloc(nR_Mode_Info->choice.fDD, F1AP_FDD_Info_t, fDD_Info); /* >>> UL NRFreqInfo */ fDD_Info->uL_NRFreqInfo.nRARFCN = 999L; - F1AP_FreqBandNrItem_t ul_freqBandNrItem; - memset((void *)&ul_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); - ul_freqBandNrItem.freqBandIndicatorNr = 888L; - F1AP_SupportedSULFreqBandItem_t ul_supportedSULFreqBandItem; - memset((void *)&ul_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); - ul_supportedSULFreqBandItem.freqBandIndicatorNr = 777L; - ASN_SEQUENCE_ADD(&ul_freqBandNrItem.supportedSULBandList.list, &ul_supportedSULFreqBandItem); - ASN_SEQUENCE_ADD(&fDD_Info->uL_NRFreqInfo.freqBandListNr.list, &ul_freqBandNrItem); + asn1cSequenceAdd(fDD_Info->uL_NRFreqInfo.freqBandListNr.list, F1AP_FreqBandNrItem_t, ul_freqBandNrItem); + ul_freqBandNrItem->freqBandIndicatorNr = 888L; + asn1cSequenceAdd(ul_freqBandNrItem->supportedSULBandList.list, F1AP_SupportedSULFreqBandItem_t, ul_supportedSULFreqBandItem); + ul_supportedSULFreqBandItem->freqBandIndicatorNr = 777L; /* >>> DL NRFreqInfo */ fDD_Info->dL_NRFreqInfo.nRARFCN = 666L; - F1AP_FreqBandNrItem_t dl_freqBandNrItem; - memset((void *)&dl_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); - dl_freqBandNrItem.freqBandIndicatorNr = 555L; + asn1cSequenceAdd(dl_freqBandNrItem->supportedSULBandList.list, F1AP_FreqBandNrItem_t, dl_freqBandNrItem); + dl_freqBandNrItem->freqBandIndicatorNr = 555L; F1AP_SupportedSULFreqBandItem_t dl_supportedSULFreqBandItem; memset((void *)&dl_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); dl_supportedSULFreqBandItem.freqBandIndicatorNr = 444L; - ASN_SEQUENCE_ADD(&dl_freqBandNrItem.supportedSULBandList.list, &dl_supportedSULFreqBandItem); - ASN_SEQUENCE_ADD(&fDD_Info->dL_NRFreqInfo.freqBandListNr.list, &dl_freqBandNrItem); /* >>> UL Transmission Bandwidth */ fDD_Info->uL_Transmission_Bandwidth.nRSCS = F1AP_NRSCS_scs15; fDD_Info->uL_Transmission_Bandwidth.nRNRB = F1AP_NRNRB_nrb11; /* >>> DL Transmission Bandwidth */ fDD_Info->dL_Transmission_Bandwidth.nRSCS = F1AP_NRSCS_scs15; fDD_Info->dL_Transmission_Bandwidth.nRNRB = F1AP_NRNRB_nrb11; - nR_Mode_Info.choice.fDD = fDD_Info; } else { // TDD - nR_Mode_Info.present = F1AP_NR_Mode_Info_PR_tDD; + nR_Mode_Info->present = F1AP_NR_Mode_Info_PR_tDD; /* > TDD >> TDD Info */ - F1AP_TDD_Info_t *tDD_Info = (F1AP_TDD_Info_t *)calloc(1, sizeof(F1AP_TDD_Info_t)); + asn1cCalloc(nR_Mode_Info->choice.tDD, F1AP_TDD_Info_t, tDD_Info); /* >>> ARFCN */ tDD_Info->nRFreqInfo.nRARFCN = 999L; // Integer - F1AP_FreqBandNrItem_t nr_freqBandNrItem; - memset((void *)&nr_freqBandNrItem, 0, sizeof(F1AP_FreqBandNrItem_t)); - nr_freqBandNrItem.freqBandIndicatorNr = 555L; - F1AP_SupportedSULFreqBandItem_t nr_supportedSULFreqBandItem; - memset((void *)&nr_supportedSULFreqBandItem, 0, sizeof(F1AP_SupportedSULFreqBandItem_t)); - nr_supportedSULFreqBandItem.freqBandIndicatorNr = 444L; - ASN_SEQUENCE_ADD(&nr_freqBandNrItem.supportedSULBandList.list, &nr_supportedSULFreqBandItem); - ASN_SEQUENCE_ADD(&tDD_Info->nRFreqInfo.freqBandListNr.list, &nr_freqBandNrItem); + asn1cSequenceAdd(tDD_Info->nRFreqInfo.freqBandListNr.list, F1AP_FreqBandNrItem_t, nr_freqBandNrItem); + nr_freqBandNrItem->freqBandIndicatorNr = 555L; + asn1cSequenceAdd(nr_freqBandNrItem->supportedSULBandList.list, F1AP_SupportedSULFreqBandItem_t, nr_supportedSULFreqBandItem); + nr_supportedSULFreqBandItem->freqBandIndicatorNr = 444L; tDD_Info->transmission_Bandwidth.nRSCS= F1AP_NRSCS_scs15; tDD_Info->transmission_Bandwidth.nRNRB= F1AP_NRNRB_nrb11; - nR_Mode_Info.choice.tDD = tDD_Info; } - served_cell_information.nR_Mode_Info = nR_Mode_Info; /* - measurementTimingConfiguration */ char *measurementTimingConfiguration = "0"; // sept. 2018 - OCTET_STRING_fromBuf(&served_cell_information.measurementTimingConfiguration, + OCTET_STRING_fromBuf(&served_cell_information->measurementTimingConfiguration, measurementTimingConfiguration, strlen(measurementTimingConfiguration)); - served_cells_to_modify_item.served_Cell_Information = served_cell_information; // /* 3.2.2 gNB-DU System Information */ - F1AP_GNB_DU_System_Information_t *gNB_DU_System_Information = (F1AP_GNB_DU_System_Information_t *)calloc(1, sizeof(F1AP_GNB_DU_System_Information_t)); + asn1cCalloc( served_cells_to_modify_item->gNB_DU_System_Information, F1AP_GNB_DU_System_Information_t, gNB_DU_System_Information); OCTET_STRING_fromBuf(&gNB_DU_System_Information->mIB_message, // sept. 2018 "1", sizeof("1")); OCTET_STRING_fromBuf(&gNB_DU_System_Information->sIB1_message, // sept. 2018 "1", sizeof("1")); - served_cells_to_modify_item.gNB_DU_System_Information = gNB_DU_System_Information; // - /* ADD */ - served_cells_to_modify_item_ies->value.choice.Served_Cells_To_Modify_Item = served_cells_to_modify_item; - ASN_SEQUENCE_ADD(&ie->value.choice.Served_Cells_To_Modify_List.list, - served_cells_to_modify_item_ies); } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ /* c4. Served_Cells_To_Delete */ - ie = (F1AP_GNBDUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBDUConfigurationUpdateIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_Served_Cells_To_Delete_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_GNBDUConfigurationUpdateIEs__value_PR_Served_Cells_To_Delete_List; + asn1cSequenceAdd(out, F1AP_GNBDUConfigurationUpdateIEs_t, ie4); + ie4->id = F1AP_ProtocolIE_ID_id_Served_Cells_To_Delete_List; + ie4->criticality = F1AP_Criticality_reject; + ie4->value.present = F1AP_GNBDUConfigurationUpdateIEs__value_PR_Served_Cells_To_Delete_List; - for (i=0; - i<1; - i++) { + for (int i=0; i<1; i++) { // - F1AP_Served_Cells_To_Delete_ItemIEs_t *served_cells_to_delete_item_ies; - served_cells_to_delete_item_ies = (F1AP_Served_Cells_To_Delete_ItemIEs_t *)calloc(1, sizeof(F1AP_Served_Cells_To_Delete_ItemIEs_t)); + asn1cSequenceAdd(ie4->value.choice.Served_Cells_To_Delete_List.list, F1AP_Served_Cells_To_Delete_ItemIEs_t, served_cells_to_delete_item_ies); served_cells_to_delete_item_ies->id = F1AP_ProtocolIE_ID_id_Served_Cells_To_Delete_Item; served_cells_to_delete_item_ies->criticality = F1AP_Criticality_reject; served_cells_to_delete_item_ies->value.present = F1AP_Served_Cells_To_Delete_ItemIEs__value_PR_Served_Cells_To_Delete_Item; - F1AP_Served_Cells_To_Delete_Item_t served_cells_to_delete_item; - memset((void *)&served_cells_to_delete_item, 0, sizeof(F1AP_Served_Cells_To_Delete_Item_t)); + F1AP_Served_Cells_To_Delete_Item_t *served_cells_to_delete_item=&served_cells_to_delete_item_ies->value.choice.Served_Cells_To_Delete_Item; /* 3.1 oldNRCGI */ - F1AP_NRCGI_t oldNRCGI; - memset(&oldNRCGI, 0, sizeof(F1AP_NRCGI_t)); - MCC_MNC_TO_PLMNID(f1ap_setup_req->mcc[i], f1ap_setup_req->mnc[i], f1ap_setup_req->mnc_digit_length[i], - &oldNRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(f1ap_setup_req->nr_cellid[i], &oldNRCGI.nRCellIdentity); - served_cells_to_delete_item.oldNRCGI = oldNRCGI; - /* ADD */ - served_cells_to_delete_item_ies->value.choice.Served_Cells_To_Delete_Item = served_cells_to_delete_item; - ASN_SEQUENCE_ADD(&ie->value.choice.Served_Cells_To_Delete_List.list, - served_cells_to_delete_item_ies); + //addnRGCI(served_cells_to_delete_item->oldNRCGI, f1ap_setup_req->cell[i]); } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { LOG_E(F1AP, "Failed to encode F1 gNB-DU CONFIGURATION UPDATE\n"); return -1; } + ASN_STRUCT_RESET(asn_DEF_F1AP_F1AP_PDU, &pdu); return 0; } @@ -1074,26 +959,24 @@ int DU_send_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, AssertFatal(GNBCUConfigurationUpdateAcknowledge->noofDedicatedSIDeliveryNeededUEs == 0, "%d DedicatedSIDeliveryNeededUEs\n", GNBCUConfigurationUpdateAcknowledge->noofDedicatedSIDeliveryNeededUEs); - F1AP_F1AP_PDU_t pdu; - uint8_t *buffer; - uint32_t len; + F1AP_F1AP_PDU_t pdu= {0}; + uint8_t *buffer=NULL; + uint32_t len=0; /* Create */ /* 0. pdu Type */ - memset(&pdu, 0, sizeof(pdu)); pdu.present = F1AP_F1AP_PDU_PR_successfulOutcome; - pdu.choice.successfulOutcome = (F1AP_SuccessfulOutcome_t *)calloc(1, sizeof(F1AP_SuccessfulOutcome_t)); - pdu.choice.successfulOutcome->procedureCode = F1AP_ProcedureCode_id_gNBCUConfigurationUpdate; - pdu.choice.successfulOutcome->criticality = F1AP_Criticality_reject; - pdu.choice.successfulOutcome->value.present = F1AP_SuccessfulOutcome__value_PR_GNBCUConfigurationUpdateAcknowledge; - F1AP_GNBCUConfigurationUpdateAcknowledge_t *out = &pdu.choice.successfulOutcome->value.choice.GNBCUConfigurationUpdateAcknowledge; + asn1cCalloc(pdu.choice.successfulOutcome, F1AP_SuccessfulOutcome_t, tmp); + tmp->procedureCode = F1AP_ProcedureCode_id_gNBCUConfigurationUpdate; + tmp->criticality = F1AP_Criticality_reject; + tmp->value.present = F1AP_SuccessfulOutcome__value_PR_GNBCUConfigurationUpdateAcknowledge; + F1AP_GNBCUConfigurationUpdateAcknowledge_t *out = &tmp->value.choice.GNBCUConfigurationUpdateAcknowledge; /* mandatory */ /* c1. Transaction ID (integer value)*/ - F1AP_GNBCUConfigurationUpdateAcknowledgeIEs_t *ie = (F1AP_GNBCUConfigurationUpdateAcknowledgeIEs_t *)calloc(1, sizeof(F1AP_F1SetupResponseIEs_t)); + asn1cSequenceAdd(out->protocolIEs.list, F1AP_GNBCUConfigurationUpdateAcknowledgeIEs_t, ie); ie->id = F1AP_ProtocolIE_ID_id_TransactionID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_GNBCUConfigurationUpdateAcknowledgeIEs__value_PR_TransactionID; ie->value.choice.TransactionID = F1AP_get_next_transaction_identifier(0, 0); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { @@ -1101,6 +984,7 @@ int DU_send_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, return -1; } + ASN_STRUCT_RESET(asn_DEF_F1AP_F1AP_PDU, &pdu); du_f1ap_itti_send_sctp_data_req(instance, f1ap_du_data->assoc_id, buffer, len, 0); return 0; } diff --git a/openair2/F1AP/f1ap_du_interface_management.h b/openair2/F1AP/f1ap_du_interface_management.h index f15decb6f5..27e839147d 100644 --- a/openair2/F1AP/f1ap_du_interface_management.h +++ b/openair2/F1AP/f1ap_du_interface_management.h @@ -76,43 +76,43 @@ int DU_handle_F1_SETUP_FAILURE(instance_t instance, * gNB-DU Configuration Update */ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, - instance_t du_mod_idP, - f1ap_setup_req_t *f1ap_du_data); + instance_t du_mod_idP, + f1ap_setup_req_t *f1ap_du_data); int DU_handle_gNB_DU_CONFIGURATION_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); int DU_handle_gNB_DU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); /* * gNB-CU Configuration Update */ int DU_handle_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); int DU_send_gNB_CU_CONFIGURATION_UPDATE_FAILURE(instance_t instance, - f1ap_gnb_cu_configuration_update_failure_t *GNBCUConfigurationUpdateFailure); + f1ap_gnb_cu_configuration_update_failure_t *GNBCUConfigurationUpdateFailure); int DU_send_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, - f1ap_gnb_cu_configuration_update_acknowledge_t *GNBCUConfigurationUpdateAcknowledge); + f1ap_gnb_cu_configuration_update_acknowledge_t *GNBCUConfigurationUpdateAcknowledge); /* * gNB-DU Resource Coordination */ int DU_send_gNB_DU_RESOURCE_COORDINATION_REQUEST(instance_t instance, - F1AP_GNBDUResourceCoordinationRequest_t *GNBDUResourceCoordinationRequest); + F1AP_GNBDUResourceCoordinationRequest_t *GNBDUResourceCoordinationRequest); int DU_handle_gNB_DU_RESOURCE_COORDINATION_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); #endif /* F1AP_DU_INTERFACE_MANAGEMENT_H_ */ diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index 770a321347..0084f0fe51 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -63,16 +63,15 @@ extern f1ap_cudu_inst_t f1ap_du_inst[MAX_eNB]; uint8_t du_ccch_flag = 1; int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); /* DL RRC Message Transfer */ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { - if (RC.nrrrc[instance]->node_type == ngran_gNB_DU) { LOG_I(F1AP, "node is gNB DU, call DU_handle_DL_NR_RRC_MESSAGE_TRANSFER \n"); DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance, assoc_id, stream, pdu); @@ -80,10 +79,8 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, } LOG_D(F1AP, "DU_handle_DL_RRC_MESSAGE_TRANSFER \n"); - F1AP_DLRRCMessageTransfer_t *container; F1AP_DLRRCMessageTransferIEs_t *ie; - uint64_t cu_ue_f1ap_id; uint64_t du_ue_f1ap_id; uint64_t srb_id; @@ -91,25 +88,20 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, sdu_size_t rrc_dl_sdu_len; //uint64_t subscriberProfileIDforRFP; //uint64_t rAT_FrequencySelectionPriority; - DevAssert(pdu != NULL); if (stream != 0) { LOG_E(F1AP, "[SCTP %d] Received F1 on stream != 0 (%d)\n", - assoc_id, stream); + assoc_id, stream); return -1; } container = &pdu->choice.initiatingMessage->value.choice.DLRRCMessageTransfer; - - /* GNB_CU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container, 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 \n", cu_ue_f1ap_id); - - /* GNB_DU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true); @@ -127,7 +119,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, /* oldgNB_DU_UE_F1AP_ID */ if (0) { F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container, - F1AP_ProtocolIE_ID_id_oldgNB_DU_UE_F1AP_ID, true); + F1AP_ProtocolIE_ID_id_oldgNB_DU_UE_F1AP_ID, true); } /* mandatory */ @@ -141,7 +133,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, /* ExecuteDuplication */ if (0) { F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container, - F1AP_ProtocolIE_ID_id_ExecuteDuplication, true); + F1AP_ProtocolIE_ID_id_ExecuteDuplication, true); executeDuplication = ie->value.choice.ExecuteDuplication; LOG_D(F1AP, "ExecuteDuplication %d \n", executeDuplication); } @@ -153,7 +145,6 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, F1AP_ProtocolIE_ID_id_RRCContainer, true); // BK: need check // create an ITTI message and copy SDU - // message_p = itti_alloc_new_message (TASK_CU_F1, 0, RRC_MAC_CCCH_DATA_IND); // memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE); rrc_dl_sdu_len = ie->value.choice.RRCContainer.size; @@ -169,15 +160,17 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, /* RAT_FrequencyPriorityInformation */ if (0) { F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container, - F1AP_ProtocolIE_ID_id_RAT_FrequencyPriorityInformation, true); + F1AP_ProtocolIE_ID_id_RAT_FrequencyPriorityInformation, true); switch(ie->value.choice.RAT_FrequencyPriorityInformation.present) { case F1AP_RAT_FrequencyPriorityInformation_PR_eNDC: //subscriberProfileIDforRFP = ie->value.choice.RAT_FrequencyPriorityInformation.choice.subscriberProfileIDforRFP; break; + case F1AP_RAT_FrequencyPriorityInformation_PR_nGRAN: //rAT_FrequencySelectionPriority = ie->value.choice.RAT_FrequencyPriorityInformation.choice.rAT_FrequencySelectionPriority; break; + default: LOG_W(F1AP, "unhandled IE RAT_FrequencyPriorityInformation.present\n"); break; @@ -186,28 +179,26 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, // decode RRC Container and act on the message type AssertFatal(srb_id<3,"illegal srb_id\n"); - protocol_ctxt_t ctxt; ctxt.rnti = f1ap_get_rnti_by_du_id(&f1ap_du_inst[instance], du_ue_f1ap_id); ctxt.module_id = instance; ctxt.instance = instance; ctxt.enb_flag = 1; - - struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context( - RC.rrc[ctxt.module_id], - ctxt.rnti); + struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context( + RC.rrc[ctxt.module_id], + ctxt.rnti); if (srb_id == 0) { - LTE_DL_CCCH_Message_t* dl_ccch_msg=NULL; + LTE_DL_CCCH_Message_t *dl_ccch_msg=NULL; asn_dec_rval_t dec_rval; dec_rval = uper_decode(NULL, - &asn_DEF_LTE_DL_CCCH_Message, - (void**)&dl_ccch_msg, - ie->value.choice.RRCContainer.buf, - rrc_dl_sdu_len,0,0); + &asn_DEF_LTE_DL_CCCH_Message, + (void **)&dl_ccch_msg, + ie->value.choice.RRCContainer.buf, + rrc_dl_sdu_len,0,0); AssertFatal(dec_rval.code == RC_OK, "could not decode F1AP message\n"); - switch (dl_ccch_msg->message.choice.c1.present) { + switch (dl_ccch_msg->message.choice.c1.present) { case LTE_DL_CCCH_MessageType__c1_PR_NOTHING: LOG_I(F1AP, "Received PR_NOTHING on DL-CCCH-Message\n"); break; @@ -227,32 +218,29 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, "Logical Channel DL-CCCH (SRB0), Received RRCConnectionReject \n"); break; - case LTE_DL_CCCH_MessageType__c1_PR_rrcConnectionSetup: - { + case LTE_DL_CCCH_MessageType__c1_PR_rrcConnectionSetup: { LOG_I(F1AP, "Logical Channel DL-CCCH (SRB0), Received RRCConnectionSetup DU_ID %lx/RNTI %x\n", du_ue_f1ap_id, f1ap_get_rnti_by_du_id(&f1ap_du_inst[instance], du_ue_f1ap_id)); - // Get configuration - - LTE_RRCConnectionSetup_t* rrcConnectionSetup = &dl_ccch_msg->message.choice.c1.choice.rrcConnectionSetup; + // Get configuration + LTE_RRCConnectionSetup_t *rrcConnectionSetup = &dl_ccch_msg->message.choice.c1.choice.rrcConnectionSetup; AssertFatal(rrcConnectionSetup!=NULL,"rrcConnectionSetup is null\n"); - LTE_RadioResourceConfigDedicated_t* radioResourceConfigDedicated = &rrcConnectionSetup->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated; - + LTE_RadioResourceConfigDedicated_t *radioResourceConfigDedicated = &rrcConnectionSetup->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated; // get SRB logical channel information LTE_SRB_ToAddModList_t *SRB_configList; LTE_SRB_ToAddMod_t *SRB1_config; LTE_LogicalChannelConfig_t *SRB1_logicalChannelConfig = NULL; SRB_configList = radioResourceConfigDedicated->srb_ToAddModList; - AssertFatal(SRB_configList!=NULL,"SRB_configList is null\n"); + for (int cnt = 0; cnt < (SRB_configList)->list.count; cnt++) { if ((SRB_configList)->list.array[cnt]->srb_Identity == 1) { SRB1_config = (SRB_configList)->list.array[cnt]; if (SRB1_config->logicalChannelConfig) { if (SRB1_config->logicalChannelConfig->present == - LTE_SRB_ToAddMod__logicalChannelConfig_PR_explicitValue) { + LTE_SRB_ToAddMod__logicalChannelConfig_PR_explicitValue) { SRB1_logicalChannelConfig = &SRB1_config->logicalChannelConfig->choice.explicitValue; } else { SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue; @@ -262,34 +250,32 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, } } } // for + rrc_rlc_config_asn1_req(&ctxt, - SRB_configList, - (LTE_DRB_ToAddModList_t*) NULL, - (LTE_DRB_ToReleaseList_t*) NULL - , (LTE_PMCH_InfoList_r9_t *) NULL, - 0,0 - ); + SRB_configList, + (LTE_DRB_ToAddModList_t *) NULL, + (LTE_DRB_ToReleaseList_t *) NULL + , (LTE_PMCH_InfoList_r9_t *) NULL, + 0,0 + ); + // This should be somewhere in the f1ap_cudu_ue_inst_t + /*int macrlc_instance = 0; - // This should be somewhere in the f1ap_cudu_ue_inst_t - /*int macrlc_instance = 0; + rnti_t rnti = f1ap_get_rnti_by_du_id(&f1ap_du_inst[0], du_ue_f1ap_id); + struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[macrlc_instance],rnti); + */ + eNB_RRC_UE_t *ue_p = &ue_context_p->ue_context; + AssertFatal(ue_p->Srb0.Active == 1,"SRB0 is not active\n"); + memcpy((void *)ue_p->Srb0.Tx_buffer.Payload, + (void *)ie->value.choice.RRCContainer.buf, + rrc_dl_sdu_len); // ie->value.choice.RRCContainer.size + ue_p->Srb0.Tx_buffer.payload_size = rrc_dl_sdu_len; + LTE_MAC_MainConfig_t *mac_MainConfig = NULL; - rnti_t rnti = f1ap_get_rnti_by_du_id(&f1ap_du_inst[0], du_ue_f1ap_id); - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[macrlc_instance],rnti); - */ - eNB_RRC_UE_t *ue_p = &ue_context_p->ue_context; - AssertFatal(ue_p->Srb0.Active == 1,"SRB0 is not active\n"); + if (radioResourceConfigDedicated->mac_MainConfig) + mac_MainConfig = &radioResourceConfigDedicated->mac_MainConfig->choice.explicitValue; - memcpy((void*)ue_p->Srb0.Tx_buffer.Payload, - (void*)ie->value.choice.RRCContainer.buf, - rrc_dl_sdu_len); // ie->value.choice.RRCContainer.size - - ue_p->Srb0.Tx_buffer.payload_size = rrc_dl_sdu_len; - - LTE_MAC_MainConfig_t *mac_MainConfig = NULL; - if (radioResourceConfigDedicated->mac_MainConfig) - mac_MainConfig = &radioResourceConfigDedicated->mac_MainConfig->choice.explicitValue; - - rrc_mac_config_req_eNB( + rrc_mac_config_req_eNB( ctxt.module_id, 0, //primaryCC_id, 0,0,0,0,0,0, @@ -311,234 +297,239 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, 0, NULL, NULL, (LTE_MBSFN_SubframeConfigList_t *) NULL , 0, (LTE_MBSFN_AreaInfoList_r9_t *) NULL, (LTE_PMCH_InfoList_r9_t *) NULL, (LTE_SystemInformationBlockType1_v1310_IEs_t *)NULL - , - 0, - (LTE_BCCH_DL_SCH_Message_MBMS_t *) NULL, - (LTE_SchedulingInfo_MBMS_r14_t *) NULL, - (struct LTE_NonMBSFN_SubframeConfig_r14 *) NULL, - (LTE_SystemInformationBlockType1_MBMS_r14_t *) NULL, - (LTE_MBSFN_AreaInfoList_r9_t *) NULL, - (LTE_MBSFNAreaConfiguration_r9_t*) NULL - ); - break; + , + 0, + (LTE_BCCH_DL_SCH_Message_MBMS_t *) NULL, + (LTE_SchedulingInfo_MBMS_r14_t *) NULL, + (struct LTE_NonMBSFN_SubframeConfig_r14 *) NULL, + (LTE_SystemInformationBlockType1_MBMS_r14_t *) NULL, + (LTE_MBSFN_AreaInfoList_r9_t *) NULL, + (LTE_MBSFNAreaConfiguration_r9_t *) NULL + ); + break; } // case default: AssertFatal(1==0, - "Unknown message\n"); + "Unknown message\n"); break; }// switch case - return(0); - } else if (srb_id == 1) { - LTE_DL_DCCH_Message_t* dl_dcch_msg=NULL; + return(0); + } else if (srb_id == 1) { + LTE_DL_DCCH_Message_t *dl_dcch_msg=NULL; asn_dec_rval_t dec_rval; dec_rval = uper_decode(NULL, - &asn_DEF_LTE_DL_DCCH_Message, - (void**)&dl_dcch_msg, - &ie->value.choice.RRCContainer.buf[1], // buf[0] includes the pdcp header - rrc_dl_sdu_len,0,0); - - if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) + &asn_DEF_LTE_DL_DCCH_Message, + (void **)&dl_dcch_msg, + &ie->value.choice.RRCContainer.buf[1], // buf[0] includes the pdcp header + rrc_dl_sdu_len,0,0); + + if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) LOG_E(F1AP," Failed to decode DL-DCCH (%zu bytes)\n",dec_rval.consumed); else LOG_D(F1AP, "Received message: present %d and c1 present %d\n", dl_dcch_msg->message.present, dl_dcch_msg->message.choice.c1.present); if (dl_dcch_msg->message.present == LTE_DL_DCCH_MessageType_PR_c1) { - switch (dl_dcch_msg->message.choice.c1.present) { - - case LTE_DL_DCCH_MessageType__c1_PR_NOTHING: - LOG_I(F1AP, "Received PR_NOTHING on DL-DCCH-Message\n"); - return 0; - case LTE_DL_DCCH_MessageType__c1_PR_dlInformationTransfer: - LOG_I(F1AP,"Received NAS DL Information Transfer\n"); - break; - case LTE_DL_DCCH_MessageType__c1_PR_csfbParametersResponseCDMA2000: - LOG_I(F1AP,"Received NAS sfbParametersResponseCDMA2000\n"); - break; - case LTE_DL_DCCH_MessageType__c1_PR_handoverFromEUTRAPreparationRequest: - LOG_I(F1AP,"Received NAS andoverFromEUTRAPreparationRequest\n"); - break; - case LTE_DL_DCCH_MessageType__c1_PR_mobilityFromEUTRACommand: - LOG_I(F1AP,"Received NAS mobilityFromEUTRACommand\n"); - break; - case LTE_DL_DCCH_MessageType__c1_PR_rrcConnectionReconfiguration: - // handle RRCConnectionReconfiguration - LOG_I(F1AP, - "Logical Channel DL-DCCH (SRB1), Received RRCConnectionReconfiguration DU_ID %lx/RNTI %x\n", - du_ue_f1ap_id, - f1ap_get_rnti_by_du_id(&f1ap_du_inst[instance], du_ue_f1ap_id)); - - LTE_RRCConnectionReconfiguration_t* rrcConnectionReconfiguration = &dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration; + case LTE_DL_DCCH_MessageType__c1_PR_NOTHING: + LOG_I(F1AP, "Received PR_NOTHING on DL-DCCH-Message\n"); + return 0; - if (rrcConnectionReconfiguration->criticalExtensions.present == LTE_RRCConnectionReconfiguration__criticalExtensions_PR_c1) { - if (rrcConnectionReconfiguration->criticalExtensions.choice.c1.present == - LTE_RRCConnectionReconfiguration__criticalExtensions__c1_PR_rrcConnectionReconfiguration_r8) { - LTE_RRCConnectionReconfiguration_r8_IEs_t* rrcConnectionReconfiguration_r8 = - &rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8; - - if (rrcConnectionReconfiguration_r8->mobilityControlInfo) { - LOG_I(F1AP, "Mobility Control Information is present\n"); - AssertFatal(1==0,"Can't handle this yet in DU\n"); - } - if (rrcConnectionReconfiguration_r8->measConfig != NULL) { - LOG_I(F1AP, "Measurement Configuration is present\n"); - } - - if (rrcConnectionReconfiguration_r8->radioResourceConfigDedicated) { - LOG_I(F1AP, "Radio Resource Configuration is present\n"); - uint8_t DRB2LCHAN[8]; - long drb_id; - int i; - LTE_DRB_ToAddModList_t *DRB_configList = rrcConnectionReconfiguration_r8->radioResourceConfigDedicated->drb_ToAddModList; - LTE_SRB_ToAddModList_t *SRB_configList = rrcConnectionReconfiguration_r8->radioResourceConfigDedicated->srb_ToAddModList; - LTE_DRB_ToReleaseList_t *DRB_ReleaseList = rrcConnectionReconfiguration_r8->radioResourceConfigDedicated->drb_ToReleaseList; - LTE_MAC_MainConfig_t *mac_MainConfig = NULL; - - for (i = 0; i< 8; i++){ - DRB2LCHAN[i] = 0; + case LTE_DL_DCCH_MessageType__c1_PR_dlInformationTransfer: + LOG_I(F1AP,"Received NAS DL Information Transfer\n"); + break; + + case LTE_DL_DCCH_MessageType__c1_PR_csfbParametersResponseCDMA2000: + LOG_I(F1AP,"Received NAS sfbParametersResponseCDMA2000\n"); + break; + + case LTE_DL_DCCH_MessageType__c1_PR_handoverFromEUTRAPreparationRequest: + LOG_I(F1AP,"Received NAS andoverFromEUTRAPreparationRequest\n"); + break; + + case LTE_DL_DCCH_MessageType__c1_PR_mobilityFromEUTRACommand: + LOG_I(F1AP,"Received NAS mobilityFromEUTRACommand\n"); + break; + + case LTE_DL_DCCH_MessageType__c1_PR_rrcConnectionReconfiguration: + // handle RRCConnectionReconfiguration + LOG_I(F1AP, + "Logical Channel DL-DCCH (SRB1), Received RRCConnectionReconfiguration DU_ID %lx/RNTI %x\n", + du_ue_f1ap_id, + f1ap_get_rnti_by_du_id(&f1ap_du_inst[instance], du_ue_f1ap_id)); + LTE_RRCConnectionReconfiguration_t *rrcConnectionReconfiguration = &dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration; + + if (rrcConnectionReconfiguration->criticalExtensions.present == LTE_RRCConnectionReconfiguration__criticalExtensions_PR_c1) { + if (rrcConnectionReconfiguration->criticalExtensions.choice.c1.present == + LTE_RRCConnectionReconfiguration__criticalExtensions__c1_PR_rrcConnectionReconfiguration_r8) { + LTE_RRCConnectionReconfiguration_r8_IEs_t *rrcConnectionReconfiguration_r8 = + &rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8; + + if (rrcConnectionReconfiguration_r8->mobilityControlInfo) { + LOG_I(F1AP, "Mobility Control Information is present\n"); + AssertFatal(1==0,"Can't handle this yet in DU\n"); } - if (rrcConnectionReconfiguration_r8->radioResourceConfigDedicated->mac_MainConfig) { - LOG_D(F1AP, "MAC Main Configuration is present\n"); + if (rrcConnectionReconfiguration_r8->measConfig != NULL) { + LOG_I(F1AP, "Measurement Configuration is present\n"); + } - mac_MainConfig = &rrcConnectionReconfiguration_r8->radioResourceConfigDedicated->mac_MainConfig->choice.explicitValue; + if (rrcConnectionReconfiguration_r8->radioResourceConfigDedicated) { + LOG_I(F1AP, "Radio Resource Configuration is present\n"); + uint8_t DRB2LCHAN[8]; + long drb_id; + int i; + LTE_DRB_ToAddModList_t *DRB_configList = rrcConnectionReconfiguration_r8->radioResourceConfigDedicated->drb_ToAddModList; + LTE_SRB_ToAddModList_t *SRB_configList = rrcConnectionReconfiguration_r8->radioResourceConfigDedicated->srb_ToAddModList; + LTE_DRB_ToReleaseList_t *DRB_ReleaseList = rrcConnectionReconfiguration_r8->radioResourceConfigDedicated->drb_ToReleaseList; + LTE_MAC_MainConfig_t *mac_MainConfig = NULL; - /* CDRX Configuration */ - if (mac_MainConfig->drx_Config == NULL) { - LOG_W(F1AP, "drx_Configuration parameter is NULL, cannot configure local UE parameters or CDRX is deactivated\n"); - } else { - MessageDef *message_p = NULL; - - /* Send DRX configuration to MAC task to configure timers of local UE context */ - message_p = itti_alloc_new_message(TASK_DU_F1, 0, RRC_MAC_DRX_CONFIG_REQ); - RRC_MAC_DRX_CONFIG_REQ(message_p).rnti = ctxt.rnti; - RRC_MAC_DRX_CONFIG_REQ(message_p).drx_Configuration = mac_MainConfig->drx_Config; - itti_send_msg_to_task(TASK_MAC_ENB, ctxt.module_id, message_p); - LOG_D(F1AP, "DRX configured in MAC Main Configuration for RRC Connection Reconfiguration\n"); + for (i = 0; i< 8; i++) { + DRB2LCHAN[i] = 0; } - /* End of CDRX configuration */ - } - LTE_MeasGapConfig_t *measGapConfig = NULL; - struct LTE_PhysicalConfigDedicated* physicalConfigDedicated = rrcConnectionReconfiguration_r8->radioResourceConfigDedicated->physicalConfigDedicated; - rrc_rlc_config_asn1_req( - &ctxt, - SRB_configList, // NULL, //LG-RK 14/05/2014 SRB_configList, - DRB_configList, - DRB_ReleaseList, (LTE_PMCH_InfoList_r9_t *) NULL, 0, 0 + if (rrcConnectionReconfiguration_r8->radioResourceConfigDedicated->mac_MainConfig) { + LOG_D(F1AP, "MAC Main Configuration is present\n"); + mac_MainConfig = &rrcConnectionReconfiguration_r8->radioResourceConfigDedicated->mac_MainConfig->choice.explicitValue; + + /* CDRX Configuration */ + if (mac_MainConfig->drx_Config == NULL) { + LOG_W(F1AP, "drx_Configuration parameter is NULL, cannot configure local UE parameters or CDRX is deactivated\n"); + } else { + MessageDef *message_p = NULL; + /* Send DRX configuration to MAC task to configure timers of local UE context */ + message_p = itti_alloc_new_message(TASK_DU_F1, 0, RRC_MAC_DRX_CONFIG_REQ); + RRC_MAC_DRX_CONFIG_REQ(message_p).rnti = ctxt.rnti; + RRC_MAC_DRX_CONFIG_REQ(message_p).drx_Configuration = mac_MainConfig->drx_Config; + itti_send_msg_to_task(TASK_MAC_ENB, ctxt.module_id, message_p); + LOG_D(F1AP, "DRX configured in MAC Main Configuration for RRC Connection Reconfiguration\n"); + } + + /* End of CDRX configuration */ + } + + LTE_MeasGapConfig_t *measGapConfig = NULL; + struct LTE_PhysicalConfigDedicated *physicalConfigDedicated = rrcConnectionReconfiguration_r8->radioResourceConfigDedicated->physicalConfigDedicated; + rrc_rlc_config_asn1_req( + &ctxt, + SRB_configList, // NULL, //LG-RK 14/05/2014 SRB_configList, + DRB_configList, + DRB_ReleaseList, (LTE_PMCH_InfoList_r9_t *) NULL, 0, 0 ); - if (SRB_configList != NULL) { - for (i = 0; (i < SRB_configList->list.count) && (i < 3); i++) { - if (SRB_configList->list.array[i]->srb_Identity == 1 ){ - ue_context_p->ue_context.Srb1.Active=1; + if (SRB_configList != NULL) { + for (i = 0; (i < SRB_configList->list.count) && (i < 3); i++) { + if (SRB_configList->list.array[i]->srb_Identity == 1 ) { + ue_context_p->ue_context.Srb1.Active=1; + } else if (SRB_configList->list.array[i]->srb_Identity == 2 ) { + ue_context_p->ue_context.Srb2.Active=1; + ue_context_p->ue_context.Srb2.Srb_info.Srb_id=2; + LOG_I(F1AP, "[DU %d] SRB2 is now active\n",ctxt.module_id); + } else { + LOG_W(F1AP, "[DU %d] invalide SRB identity %ld\n",ctxt.module_id, + SRB_configList->list.array[i]->srb_Identity); + } } - else if (SRB_configList->list.array[i]->srb_Identity == 2 ) { - ue_context_p->ue_context.Srb2.Active=1; - ue_context_p->ue_context.Srb2.Srb_info.Srb_id=2; - LOG_I(F1AP, "[DU %d] SRB2 is now active\n",ctxt.module_id); - } else { - LOG_W(F1AP, "[DU %d] invalide SRB identity %ld\n",ctxt.module_id, - SRB_configList->list.array[i]->srb_Identity); + } + + if (DRB_configList != NULL) { + for (i = 0; i < DRB_configList->list.count; i++) { // num max DRB (11-3-8) + if (DRB_configList->list.array[i]) { + drb_id = (int)DRB_configList->list.array[i]->drb_Identity; + LOG_I(F1AP, + "[DU %d] Logical Channel UL-DCCH, Received RRCConnectionReconfiguration for UE rnti %x, reconfiguring DRB %d/LCID %d\n", + ctxt.module_id, + ctxt.rnti, + (int)DRB_configList->list.array[i]->drb_Identity, + (int)*DRB_configList->list.array[i]->logicalChannelIdentity); + + if (ue_context_p->ue_context.DRB_active[drb_id] == 0) { + ue_context_p->ue_context.DRB_active[drb_id] = 1; + + if (DRB_configList->list.array[i]->logicalChannelIdentity) { + DRB2LCHAN[i] = (uint8_t) * DRB_configList->list.array[i]->logicalChannelIdentity; + } + + rrc_mac_config_req_eNB( + ctxt.module_id, + 0,0,0,0,0,0, + 0, + ue_context_p->ue_context.rnti, + (LTE_BCCH_BCH_Message_t *) NULL, + (LTE_RadioResourceConfigCommonSIB_t *) NULL, + (LTE_RadioResourceConfigCommonSIB_t *) NULL, + physicalConfigDedicated, + (LTE_SCellToAddMod_r10_t *)NULL, + //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, + (LTE_MeasObjectToAddMod_t **) NULL, + mac_MainConfig, + DRB2LCHAN[i], + DRB_configList->list.array[i]->logicalChannelConfig, + measGapConfig, + (LTE_TDD_Config_t *) NULL, + NULL, + (LTE_SchedulingInfoList_t *) NULL, + 0, NULL, NULL, (LTE_MBSFN_SubframeConfigList_t *) NULL + , 0, (LTE_MBSFN_AreaInfoList_r9_t *) NULL, (LTE_PMCH_InfoList_r9_t *) NULL, + (LTE_SystemInformationBlockType1_v1310_IEs_t *)NULL, + 0, + (LTE_BCCH_DL_SCH_Message_MBMS_t *) NULL, + (LTE_SchedulingInfo_MBMS_r14_t *) NULL, + (struct LTE_NonMBSFN_SubframeConfig_r14 *) NULL, + (LTE_SystemInformationBlockType1_MBMS_r14_t *) NULL, + (LTE_MBSFN_AreaInfoList_r9_t *) NULL, + (LTE_MBSFNAreaConfiguration_r9_t *) NULL + ); + } + } else { // remove LCHAN from MAC/PHY + AssertFatal(1==0,"Can't handle this yet in DU\n"); + } } } } + } + } - if (DRB_configList != NULL) { - for (i = 0; i < DRB_configList->list.count; i++) { // num max DRB (11-3-8) - if (DRB_configList->list.array[i]) { - drb_id = (int)DRB_configList->list.array[i]->drb_Identity; - LOG_I(F1AP, - "[DU %d] Logical Channel UL-DCCH, Received RRCConnectionReconfiguration for UE rnti %x, reconfiguring DRB %d/LCID %d\n", - ctxt.module_id, - ctxt.rnti, - (int)DRB_configList->list.array[i]->drb_Identity, - (int)*DRB_configList->list.array[i]->logicalChannelIdentity); - - if (ue_context_p->ue_context.DRB_active[drb_id] == 0) { - ue_context_p->ue_context.DRB_active[drb_id] = 1; - - if (DRB_configList->list.array[i]->logicalChannelIdentity) { - DRB2LCHAN[i] = (uint8_t) * DRB_configList->list.array[i]->logicalChannelIdentity; - } - - rrc_mac_config_req_eNB( - ctxt.module_id, - 0,0,0,0,0,0, - 0, - ue_context_p->ue_context.rnti, - (LTE_BCCH_BCH_Message_t *) NULL, - (LTE_RadioResourceConfigCommonSIB_t *) NULL, - (LTE_RadioResourceConfigCommonSIB_t *) NULL, - physicalConfigDedicated, - (LTE_SCellToAddMod_r10_t *)NULL, - //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, - (LTE_MeasObjectToAddMod_t **) NULL, - mac_MainConfig, - DRB2LCHAN[i], - DRB_configList->list.array[i]->logicalChannelConfig, - measGapConfig, - (LTE_TDD_Config_t *) NULL, - NULL, - (LTE_SchedulingInfoList_t *) NULL, - 0, NULL, NULL, (LTE_MBSFN_SubframeConfigList_t *) NULL - , 0, (LTE_MBSFN_AreaInfoList_r9_t *) NULL, (LTE_PMCH_InfoList_r9_t *) NULL, - (LTE_SystemInformationBlockType1_v1310_IEs_t *)NULL, - 0, - (LTE_BCCH_DL_SCH_Message_MBMS_t *) NULL, - (LTE_SchedulingInfo_MBMS_r14_t *) NULL, - (struct LTE_NonMBSFN_SubframeConfig_r14 *) NULL, - (LTE_SystemInformationBlockType1_MBMS_r14_t *) NULL, - (LTE_MBSFN_AreaInfoList_r9_t *) NULL, - (LTE_MBSFNAreaConfiguration_r9_t*) NULL - ); - } - - } else { // remove LCHAN from MAC/PHY - AssertFatal(1==0,"Can't handle this yet in DU\n"); - } - } - } - } - } - } - break; - case LTE_DL_DCCH_MessageType__c1_PR_rrcConnectionRelease: - // handle RRCConnectionRelease - LOG_I(F1AP, "Received RRCConnectionRelease\n"); - break; - case LTE_DL_DCCH_MessageType__c1_PR_securityModeCommand: - LOG_I(F1AP, "Received securityModeCommand\n"); - break; - case LTE_DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry: - LOG_I(F1AP, "Received ueCapabilityEnquiry\n"); break; - case LTE_DL_DCCH_MessageType__c1_PR_counterCheck: - case LTE_DL_DCCH_MessageType__c1_PR_loggedMeasurementConfiguration_r10: - case LTE_DL_DCCH_MessageType__c1_PR_rnReconfiguration_r10: - case LTE_DL_DCCH_MessageType__c1_PR_spare1: - case LTE_DL_DCCH_MessageType__c1_PR_spare2: - case LTE_DL_DCCH_MessageType__c1_PR_spare3: - break; - case LTE_DL_DCCH_MessageType__c1_PR_ueInformationRequest_r9: - LOG_I(F1AP, "Received ueInformationRequest_r9\n"); - break; - case LTE_DL_DCCH_MessageType__c1_PR_rrcConnectionResume_r13: - LOG_I(F1AP, "Received rrcConnectionResume_r13\n"); - } - } - } - else if (srb_id == 2) { - + + case LTE_DL_DCCH_MessageType__c1_PR_rrcConnectionRelease: + // handle RRCConnectionRelease + LOG_I(F1AP, "Received RRCConnectionRelease\n"); + break; + + case LTE_DL_DCCH_MessageType__c1_PR_securityModeCommand: + LOG_I(F1AP, "Received securityModeCommand\n"); + break; + + case LTE_DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry: + LOG_I(F1AP, "Received ueCapabilityEnquiry\n"); + break; + + case LTE_DL_DCCH_MessageType__c1_PR_counterCheck: + case LTE_DL_DCCH_MessageType__c1_PR_loggedMeasurementConfiguration_r10: + case LTE_DL_DCCH_MessageType__c1_PR_rnReconfiguration_r10: + case LTE_DL_DCCH_MessageType__c1_PR_spare1: + case LTE_DL_DCCH_MessageType__c1_PR_spare2: + case LTE_DL_DCCH_MessageType__c1_PR_spare3: + break; + + case LTE_DL_DCCH_MessageType__c1_PR_ueInformationRequest_r9: + LOG_I(F1AP, "Received ueInformationRequest_r9\n"); + break; + + case LTE_DL_DCCH_MessageType__c1_PR_rrcConnectionResume_r13: + LOG_I(F1AP, "Received rrcConnectionResume_r13\n"); + } + } + } else if (srb_id == 2) { } LOG_I(F1AP, "Received DL RRC Transfer on srb_id %ld\n", srb_id); rlc_op_status_t rlc_status; boolean_t ret = TRUE; - mem_block_t *pdcp_pdu_p = NULL; + mem_block_t *pdcp_pdu_p = NULL; pdcp_pdu_p = get_free_mem_block(rrc_dl_sdu_len, __func__); //LOG_I(F1AP, "PRRCContainer size %lu:", ie->value.choice.RRCContainer.size); @@ -549,75 +540,68 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, //for (int i=0;idata[i]); //printf("\n"); - if (pdcp_pdu_p != NULL) { memset(pdcp_pdu_p->data, 0, rrc_dl_sdu_len); memcpy(&pdcp_pdu_p->data[0], ie->value.choice.RRCContainer.buf, rrc_dl_sdu_len); + rlc_status = rlc_data_req(&ctxt + , 1 + , MBMS_FLAG_NO + , srb_id + , 0 + , 0 + , rrc_dl_sdu_len + , pdcp_pdu_p + ,NULL + ,NULL + ); - rlc_status = rlc_data_req(&ctxt - , 1 - , MBMS_FLAG_NO - , srb_id - , 0 - , 0 - , rrc_dl_sdu_len - , pdcp_pdu_p - ,NULL - ,NULL - ); - switch (rlc_status) { - case RLC_OP_STATUS_OK: - //LOG_I(F1AP, "Data sending request over RLC succeeded!\n"); - ret=TRUE; - break; + switch (rlc_status) { + case RLC_OP_STATUS_OK: + //LOG_I(F1AP, "Data sending request over RLC succeeded!\n"); + ret=TRUE; + break; - case RLC_OP_STATUS_BAD_PARAMETER: - LOG_W(F1AP, "Data sending request over RLC failed with 'Bad Parameter' reason!\n"); - ret= FALSE; - break; + case RLC_OP_STATUS_BAD_PARAMETER: + LOG_W(F1AP, "Data sending request over RLC failed with 'Bad Parameter' reason!\n"); + ret= FALSE; + break; - case RLC_OP_STATUS_INTERNAL_ERROR: - LOG_W(F1AP, "Data sending request over RLC failed with 'Internal Error' reason!\n"); - ret= FALSE; - break; + case RLC_OP_STATUS_INTERNAL_ERROR: + LOG_W(F1AP, "Data sending request over RLC failed with 'Internal Error' reason!\n"); + ret= FALSE; + break; - case RLC_OP_STATUS_OUT_OF_RESSOURCES: - LOG_W(F1AP, "Data sending request over RLC failed with 'Out of Resources' reason!\n"); - ret= FALSE; - break; + case RLC_OP_STATUS_OUT_OF_RESSOURCES: + LOG_W(F1AP, "Data sending request over RLC failed with 'Out of Resources' reason!\n"); + ret= FALSE; + break; + + default: + LOG_W(F1AP, "RLC returned an unknown status code after PDCP placed the order to send some data (Status Code:%d)\n", rlc_status); + ret= FALSE; + break; + } // switch case + + return ret; + } // if pdcp_pdu_p - default: - LOG_W(F1AP, "RLC returned an unknown status code after PDCP placed the order to send some data (Status Code:%d)\n", rlc_status); - ret= FALSE; - break; - } // switch case - return ret; - } // if pdcp_pdu_p - return 0; - } -int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance, +int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance, const f1ap_ul_rrc_message_t *msg) { const rnti_t rnti = msg->rnti; - F1AP_F1AP_PDU_t pdu; F1AP_ULRRCMessageTransfer_t *out; F1AP_ULRRCMessageTransferIEs_t *ie; - uint8_t *buffer = NULL; uint32_t len; - - LOG_I(F1AP, "[DU %ld] %s: size %d UE RNTI %x in SRB %d\n", instance, __func__, msg->rrc_container_length, rnti, msg->srb_id); - //LOG_I(F1AP, "%s() RRCContainer size %d: ", __func__, msg->rrc_container_length); //for (int i = 0;i < msg->rrc_container_length; i++) // printf("%02x ", msg->rrc_container[i]); //printf("\n"); - /* Create */ /* 0. Message Type */ memset(&pdu, 0, sizeof(pdu)); @@ -627,18 +611,14 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance, pdu.choice.initiatingMessage->criticality = F1AP_Criticality_ignore; pdu.choice.initiatingMessage->value.present = F1AP_InitiatingMessage__value_PR_ULRRCMessageTransfer; out = &pdu.choice.initiatingMessage->value.choice.ULRRCMessageTransfer; - /* mandatory */ /* c1. GNB_CU_UE_F1AP_ID */ ie = (F1AP_ULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_ULRRCMessageTransferIEs_t)); ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_GNB_CU_UE_F1AP_ID; - ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(&f1ap_du_inst[instance], rnti); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - /* mandatory */ /* c2. GNB_DU_UE_F1AP_ID */ ie = (F1AP_ULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_ULRRCMessageTransferIEs_t)); @@ -647,7 +627,6 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance, ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID; ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(&f1ap_du_inst[instance], rnti); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - /* mandatory */ /* c3. SRBID */ ie = (F1AP_ULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_ULRRCMessageTransferIEs_t)); @@ -656,7 +635,6 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance, ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_SRBID; ie->value.choice.SRBID = msg->srb_id; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - // issue in here /* mandatory */ /* c4. RRCContainer */ @@ -670,111 +648,108 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance, ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); if (msg->srb_id == 1 || msg->srb_id == 2) { - struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(RC.rrc[instance], rnti); - - - LTE_UL_DCCH_Message_t* ul_dcch_msg=NULL; + struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[instance], rnti); + LTE_UL_DCCH_Message_t *ul_dcch_msg=NULL; asn_dec_rval_t dec_rval; dec_rval = uper_decode(NULL, - &asn_DEF_LTE_UL_DCCH_Message, - (void**)&ul_dcch_msg, - &ie->value.choice.RRCContainer.buf[1], // buf[0] includes the pdcp header - msg->rrc_container_length, 0, 0); - - if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) + &asn_DEF_LTE_UL_DCCH_Message, + (void **)&ul_dcch_msg, + &ie->value.choice.RRCContainer.buf[1], // buf[0] includes the pdcp header + msg->rrc_container_length, 0, 0); + + if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) LOG_E(F1AP, " Failed to decode UL-DCCH (%zu bytes)\n",dec_rval.consumed); else LOG_I(F1AP, "Received message: present %d and c1 present %d\n", ul_dcch_msg->message.present, ul_dcch_msg->message.choice.c1.present); if (ul_dcch_msg->message.present == LTE_UL_DCCH_MessageType_PR_c1) { - switch (ul_dcch_msg->message.choice.c1.present) { - case LTE_UL_DCCH_MessageType__c1_PR_NOTHING: /* No components present */ - break; - - case LTE_UL_DCCH_MessageType__c1_PR_csfbParametersRequestCDMA2000: - break; - - case LTE_UL_DCCH_MessageType__c1_PR_measurementReport: - break; - - case LTE_UL_DCCH_MessageType__c1_PR_rrcConnectionReconfigurationComplete: - LOG_I(F1AP, "[MSG] RRC UL rrcConnectionReconfigurationComplete\n"); - - /* CDRX: activated when RRC Connection Reconfiguration Complete is received */ - int UE_id_mac = find_UE_id(instance, rnti); - - if (UE_id_mac == -1) { - LOG_E(F1AP, "Can't find UE_id(MAC) of UE rnti %x\n", rnti); + case LTE_UL_DCCH_MessageType__c1_PR_NOTHING: /* No components present */ break; - } - - UE_sched_ctrl_t *UE_scheduling_control = &(RC.mac[instance]->UE_info.UE_sched_ctrl[UE_id_mac]); - - if (UE_scheduling_control->cdrx_waiting_ack == TRUE) { - UE_scheduling_control->cdrx_waiting_ack = FALSE; - UE_scheduling_control->cdrx_configured = TRUE; // Set to TRUE when RRC Connection Reconfiguration Complete is received - LOG_I(F1AP, "CDRX configuration activated after RRC Connection Reconfiguration Complete reception\n"); - } - /* End of CDRX processing */ - - break; - case LTE_UL_DCCH_MessageType__c1_PR_rrcConnectionReestablishmentComplete: - break; + case LTE_UL_DCCH_MessageType__c1_PR_csfbParametersRequestCDMA2000: + break; - case LTE_UL_DCCH_MessageType__c1_PR_rrcConnectionSetupComplete: - LOG_I(F1AP, "[MSG] RRC UL rrcConnectionSetupComplete \n"); - - if(!ue_context_p){ - LOG_E(F1AP, "Did not find the UE context associated with UE RNTOI %x, ue_context_p is NULL\n", rnti); + case LTE_UL_DCCH_MessageType__c1_PR_measurementReport: + break; - } else { - LOG_I(F1AP, "Processing RRCConnectionSetupComplete UE %x\n", rnti); - ue_context_p->ue_context.Status = RRC_CONNECTED; - } - break; + case LTE_UL_DCCH_MessageType__c1_PR_rrcConnectionReconfigurationComplete: + LOG_I(F1AP, "[MSG] RRC UL rrcConnectionReconfigurationComplete\n"); + /* CDRX: activated when RRC Connection Reconfiguration Complete is received */ + int UE_id_mac = find_UE_id(instance, rnti); - case LTE_UL_DCCH_MessageType__c1_PR_securityModeComplete: - LOG_I(F1AP, "[MSG] RRC securityModeComplete \n"); - break; + if (UE_id_mac == -1) { + LOG_E(F1AP, "Can't find UE_id(MAC) of UE rnti %x\n", rnti); + break; + } - case LTE_UL_DCCH_MessageType__c1_PR_securityModeFailure: - break; + UE_sched_ctrl_t *UE_scheduling_control = &(RC.mac[instance]->UE_info.UE_sched_ctrl[UE_id_mac]); - case LTE_UL_DCCH_MessageType__c1_PR_ueCapabilityInformation: - LOG_I(F1AP, "[MSG] RRC ueCapabilityInformation \n"); - break; + if (UE_scheduling_control->cdrx_waiting_ack == TRUE) { + UE_scheduling_control->cdrx_waiting_ack = FALSE; + UE_scheduling_control->cdrx_configured = TRUE; // Set to TRUE when RRC Connection Reconfiguration Complete is received + LOG_I(F1AP, "CDRX configuration activated after RRC Connection Reconfiguration Complete reception\n"); + } - case LTE_UL_DCCH_MessageType__c1_PR_ulHandoverPreparationTransfer: - break; + /* End of CDRX processing */ + break; - case LTE_UL_DCCH_MessageType__c1_PR_ulInformationTransfer: - LOG_I(F1AP,"[MSG] RRC UL Information Transfer \n"); - break; + case LTE_UL_DCCH_MessageType__c1_PR_rrcConnectionReestablishmentComplete: + break; - case LTE_UL_DCCH_MessageType__c1_PR_counterCheckResponse: - break; + case LTE_UL_DCCH_MessageType__c1_PR_rrcConnectionSetupComplete: + LOG_I(F1AP, "[MSG] RRC UL rrcConnectionSetupComplete \n"); - case LTE_UL_DCCH_MessageType__c1_PR_ueInformationResponse_r9: - break; + if(!ue_context_p) { + LOG_E(F1AP, "Did not find the UE context associated with UE RNTOI %x, ue_context_p is NULL\n", rnti); + } else { + LOG_I(F1AP, "Processing RRCConnectionSetupComplete UE %x\n", rnti); + ue_context_p->ue_context.Status = RRC_CONNECTED; + } - case LTE_UL_DCCH_MessageType__c1_PR_proximityIndication_r9: - break; + break; - case LTE_UL_DCCH_MessageType__c1_PR_rnReconfigurationComplete_r10: - break; + case LTE_UL_DCCH_MessageType__c1_PR_securityModeComplete: + LOG_I(F1AP, "[MSG] RRC securityModeComplete \n"); + break; - case LTE_UL_DCCH_MessageType__c1_PR_mbmsCountingResponse_r10: - break; + case LTE_UL_DCCH_MessageType__c1_PR_securityModeFailure: + break; - case LTE_UL_DCCH_MessageType__c1_PR_interFreqRSTDMeasurementIndication_r10: - break; + case LTE_UL_DCCH_MessageType__c1_PR_ueCapabilityInformation: + LOG_I(F1AP, "[MSG] RRC ueCapabilityInformation \n"); + break; + + case LTE_UL_DCCH_MessageType__c1_PR_ulHandoverPreparationTransfer: + break; + + case LTE_UL_DCCH_MessageType__c1_PR_ulInformationTransfer: + LOG_I(F1AP,"[MSG] RRC UL Information Transfer \n"); + break; + + case LTE_UL_DCCH_MessageType__c1_PR_counterCheckResponse: + break; + + case LTE_UL_DCCH_MessageType__c1_PR_ueInformationResponse_r9: + break; + + case LTE_UL_DCCH_MessageType__c1_PR_proximityIndication_r9: + break; + + case LTE_UL_DCCH_MessageType__c1_PR_rnReconfigurationComplete_r10: + break; + + case LTE_UL_DCCH_MessageType__c1_PR_mbmsCountingResponse_r10: + break; + + case LTE_UL_DCCH_MessageType__c1_PR_interFreqRSTDMeasurementIndication_r10: + break; } } } - /* encode */ + + /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { LOG_E(F1AP, "Failed to encode F1 UL RRC MESSAGE TRANSFER\n"); return -1; @@ -787,19 +762,17 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance, /* UL RRC Message Transfer */ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, - int CC_idP, - int UE_id, - rnti_t rntiP, - const uint8_t *sduP, - sdu_size_t sdu_lenP, - const int8_t *sdu2P, - sdu_size_t sdu2_lenP) { - F1AP_F1AP_PDU_t pdu; + int CC_idP, + int UE_id, + rnti_t rntiP, + const uint8_t *sduP, + sdu_size_t sdu_lenP, + const char *sdu2P, + sdu_size_t sdu2_lenP) { + F1AP_F1AP_PDU_t pdu= {0}; F1AP_InitialULRRCMessageTransfer_t *out; - F1AP_InitialULRRCMessageTransferIEs_t *ie; - - uint8_t *buffer; - uint32_t len; + uint8_t *buffer=NULL; + uint32_t len=0; int f1ap_uid = f1ap_add_ue (&f1ap_du_inst[module_idP], module_idP, CC_idP,UE_id, rntiP); if (f1ap_uid < 0 ) { @@ -809,176 +782,138 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, /* Create */ /* 0. Message Type */ - memset(&pdu, 0, sizeof(pdu)); pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; - pdu.choice.initiatingMessage = (F1AP_InitiatingMessage_t *)calloc(1, sizeof(F1AP_InitiatingMessage_t)); - pdu.choice.initiatingMessage->procedureCode = F1AP_ProcedureCode_id_InitialULRRCMessageTransfer; - pdu.choice.initiatingMessage->criticality = F1AP_Criticality_ignore; - pdu.choice.initiatingMessage->value.present = F1AP_InitiatingMessage__value_PR_InitialULRRCMessageTransfer; - out = &pdu.choice.initiatingMessage->value.choice.InitialULRRCMessageTransfer; - - + asn1cCalloc(pdu.choice.initiatingMessage, F1AP_InitiatingMessage_t, tmp); + tmp->procedureCode = F1AP_ProcedureCode_id_InitialULRRCMessageTransfer; + tmp->criticality = F1AP_Criticality_ignore; + tmp->value.present = F1AP_InitiatingMessage__value_PR_InitialULRRCMessageTransfer; + out = &tmp->value.choice.InitialULRRCMessageTransfer; /* mandatory */ /* c1. GNB_DU_UE_F1AP_ID */ - ie = (F1AP_InitialULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_InitialULRRCMessageTransferIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_du_inst[module_idP].f1ap_ue[f1ap_uid].du_ue_f1ap_id; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - + asn1cSequenceAdd(out->protocolIEs.list, F1AP_InitialULRRCMessageTransferIEs_t, ie1); + ie1->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; + ie1->criticality = F1AP_Criticality_reject; + ie1->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID; + ie1->value.choice.GNB_DU_UE_F1AP_ID = f1ap_du_inst[module_idP].f1ap_ue[f1ap_uid].du_ue_f1ap_id; /* mandatory */ /* c2. NRCGI */ - ie = (F1AP_InitialULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_InitialULRRCMessageTransferIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_NRCGI; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_NRCGI; - - F1AP_NRCGI_t nRCGI; - memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t)); - MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[0], f1ap_du_data->mnc[0], f1ap_du_data->mnc_digit_length[0], - &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[0], &nRCGI.nRCellIdentity); - ie->value.choice.NRCGI = nRCGI; - - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - + asn1cSequenceAdd(out->protocolIEs.list, F1AP_InitialULRRCMessageTransferIEs_t, ie2); + ie2->id = F1AP_ProtocolIE_ID_id_NRCGI; + ie2->criticality = F1AP_Criticality_reject; + ie2->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_NRCGI; + //addnRCGI(ie2->value.choice.NRCGI, f1ap_du_data->cell[0]); /* mandatory */ /* c3. C_RNTI */ // 16 - ie = (F1AP_InitialULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_InitialULRRCMessageTransferIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_C_RNTI; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_C_RNTI; - ie->value.choice.C_RNTI=rntiP; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - + asn1cSequenceAdd(out->protocolIEs.list, F1AP_InitialULRRCMessageTransferIEs_t, ie3); + ie3->id = F1AP_ProtocolIE_ID_id_C_RNTI; + ie3->criticality = F1AP_Criticality_reject; + ie3->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_C_RNTI; + ie3->value.choice.C_RNTI=rntiP; /* mandatory */ /* c4. RRCContainer */ - ie = (F1AP_InitialULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_InitialULRRCMessageTransferIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_RRCContainer; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_RRCContainer; - OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, (const char *)sduP, sdu_lenP); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + asn1cSequenceAdd(out->protocolIEs.list, F1AP_InitialULRRCMessageTransferIEs_t, ie4); + ie4->id = F1AP_ProtocolIE_ID_id_RRCContainer; + ie4->criticality = F1AP_Criticality_reject; + ie4->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_RRCContainer; + OCTET_STRING_fromBuf(&ie4->value.choice.RRCContainer, (const char *)sduP, sdu_lenP); /* optional */ /* c5. DUtoCURRCContainer */ if (sdu2P) { - ie = (F1AP_InitialULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_InitialULRRCMessageTransferIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_DUtoCURRCContainer; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_DUtoCURRCContainer; - OCTET_STRING_fromBuf(&ie->value.choice.DUtoCURRCContainer, - sdu2P, - sdu2_lenP); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - } + asn1cSequenceAdd(out->protocolIEs.list, F1AP_InitialULRRCMessageTransferIEs_t, ie5); + ie5->id = F1AP_ProtocolIE_ID_id_DUtoCURRCContainer; + ie5->criticality = F1AP_Criticality_reject; + ie5->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_DUtoCURRCContainer; + OCTET_STRING_fromBuf(&ie5->value.choice.DUtoCURRCContainer, + sdu2P, + sdu2_lenP); + } - - /* encode */ + /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { LOG_E(F1AP, "Failed to encode F1 INITIAL UL RRC MESSAGE TRANSFER\n"); return -1; } if (RC.nrrrc[module_idP]->node_type == ngran_gNB_DU) { - struct rrc_gNB_ue_context_s* ue_context_p = rrc_gNB_allocate_new_UE_context(RC.nrrrc[module_idP]); - ue_context_p->ue_id_rnti = rntiP; + struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_allocate_new_UE_context(RC.nrrrc[module_idP]); + ue_context_p->ue_id_rnti = rntiP; ue_context_p->ue_context.rnti = rntiP; ue_context_p->ue_context.random_ue_identity = rntiP; ue_context_p->ue_context.Srb0.Active = 1; RB_INSERT(rrc_nr_ue_tree_s, &RC.nrrrc[module_idP]->rrc_ue_head, ue_context_p); } else { - struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_allocate_new_UE_context(RC.rrc[module_idP]); - ue_context_p->ue_id_rnti = rntiP; + struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_allocate_new_UE_context(RC.rrc[module_idP]); + ue_context_p->ue_id_rnti = rntiP; ue_context_p->ue_context.rnti = rntiP; ue_context_p->ue_context.random_ue_identity = rntiP; ue_context_p->ue_context.Srb0.Active = 1; RB_INSERT(rrc_ue_tree_s, &RC.rrc[module_idP]->rrc_ue_head, ue_context_p); } - du_f1ap_itti_send_sctp_data_req(module_idP, f1ap_du_data->assoc_id, buffer, len, f1ap_du_data->default_sctp_stream_id); + du_f1ap_itti_send_sctp_data_req(module_idP, f1ap_du_data->assoc_id, buffer, len, f1ap_du_data->default_sctp_stream_id); return 0; } - + void init_f1ap_du_ue_inst (void) { - - memset(f1ap_du_inst, 0, sizeof(f1ap_du_inst)); + memset(f1ap_du_inst, 0, sizeof(f1ap_du_inst)); } -int DU_send_UL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, - const f1ap_ul_rrc_message_t *msg) { +int DU_send_UL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, + const f1ap_ul_rrc_message_t *msg) { const rnti_t rnti = msg->rnti; - - F1AP_F1AP_PDU_t pdu; + F1AP_F1AP_PDU_t pdu= {0}; F1AP_ULRRCMessageTransfer_t *out; - F1AP_ULRRCMessageTransferIEs_t *ie; - uint8_t *buffer = NULL; uint32_t len; - - LOG_I(F1AP, "[DU %ld] %s: size %d UE RNTI %x in SRB %d\n", instance, __func__, msg->rrc_container_length, rnti, msg->srb_id); - //LOG_I(F1AP, "%s() RRCContainer size %d: ", __func__, msg->rrc_container_length); //for (int i = 0;i < msg->rrc_container_length; i++) // printf("%02x ", msg->rrc_container[i]); //printf("\n"); - /* Create */ /* 0. Message Type */ - memset(&pdu, 0, sizeof(pdu)); pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; - pdu.choice.initiatingMessage = (F1AP_InitiatingMessage_t *)calloc(1, sizeof(F1AP_InitiatingMessage_t)); - pdu.choice.initiatingMessage->procedureCode = F1AP_ProcedureCode_id_ULRRCMessageTransfer; - pdu.choice.initiatingMessage->criticality = F1AP_Criticality_ignore; - pdu.choice.initiatingMessage->value.present = F1AP_InitiatingMessage__value_PR_ULRRCMessageTransfer; - out = &pdu.choice.initiatingMessage->value.choice.ULRRCMessageTransfer; - + asn1cCalloc(pdu.choice.initiatingMessage, F1AP_InitiatingMessage_t, tmp); + tmp->procedureCode = F1AP_ProcedureCode_id_ULRRCMessageTransfer; + tmp->criticality = F1AP_Criticality_ignore; + tmp->value.present = F1AP_InitiatingMessage__value_PR_ULRRCMessageTransfer; + out = &tmp->value.choice.ULRRCMessageTransfer; /* mandatory */ /* c1. GNB_CU_UE_F1AP_ID */ - ie = (F1AP_ULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_ULRRCMessageTransferIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_GNB_CU_UE_F1AP_ID; - - ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(&f1ap_du_inst[instance], rnti); - - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - + asn1cSequenceAdd(out->protocolIEs.list, F1AP_ULRRCMessageTransferIEs_t, ie1); + ie1->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; + ie1->criticality = F1AP_Criticality_reject; + ie1->value.present = F1AP_ULRRCMessageTransferIEs__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], rnti); /* mandatory */ /* c2. GNB_DU_UE_F1AP_ID */ - ie = (F1AP_ULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_ULRRCMessageTransferIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(&f1ap_du_inst[instance], rnti); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - + asn1cSequenceAdd(out->protocolIEs.list, F1AP_ULRRCMessageTransferIEs_t, ie2); + ie2->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; + ie2->criticality = F1AP_Criticality_reject; + ie2->value.present = F1AP_ULRRCMessageTransferIEs__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], rnti); /* mandatory */ /* c3. SRBID */ - ie = (F1AP_ULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_ULRRCMessageTransferIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_SRBID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_SRBID; - ie->value.choice.SRBID = msg->srb_id; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - + asn1cSequenceAdd(out->protocolIEs.list, F1AP_ULRRCMessageTransferIEs_t, ie3); + ie3->id = F1AP_ProtocolIE_ID_id_SRBID; + ie3->criticality = F1AP_Criticality_reject; + ie3->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_SRBID; + ie3->value.choice.SRBID = msg->srb_id; // issue in here /* mandatory */ /* c4. RRCContainer */ - ie = (F1AP_ULRRCMessageTransferIEs_t *)calloc(1, sizeof(F1AP_ULRRCMessageTransferIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_RRCContainer; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_RRCContainer; - OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, + asn1cSequenceAdd(out->protocolIEs.list, F1AP_ULRRCMessageTransferIEs_t, ie4); + ie4->id = F1AP_ProtocolIE_ID_id_RRCContainer; + ie4->criticality = F1AP_Criticality_reject; + ie4->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_RRCContainer; + OCTET_STRING_fromBuf(&ie4->value.choice.RRCContainer, (const char *) msg->rrc_container, msg->rrc_container_length); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - /* encode */ + /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { LOG_E(F1AP, "Failed to encode F1 UL RRC MESSAGE TRANSFER \n"); return -1; @@ -990,14 +925,12 @@ int DU_send_UL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, /* DL NR RRC Message Transfer */ int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) { LOG_D(F1AP, "DU_handle_DL_NR_RRC_MESSAGE_TRANSFER \n"); - F1AP_DLRRCMessageTransfer_t *container; F1AP_DLRRCMessageTransferIEs_t *ie; - uint64_t cu_ue_f1ap_id; uint64_t du_ue_f1ap_id; uint64_t srb_id; @@ -1005,25 +938,20 @@ int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, sdu_size_t rrc_dl_sdu_len; //uint64_t subscriberProfileIDforRFP; //uint64_t rAT_FrequencySelectionPriority; - DevAssert(pdu != NULL); if (stream != 0) { LOG_E(F1AP, "[SCTP %d] Received F1 on stream != 0 (%d)\n", - assoc_id, stream); + assoc_id, stream); return -1; } container = &pdu->choice.initiatingMessage->value.choice.DLRRCMessageTransfer; - - /* GNB_CU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container, 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 \n", cu_ue_f1ap_id); - - /* GNB_DU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true); @@ -1041,7 +969,7 @@ int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, /* oldgNB_DU_UE_F1AP_ID */ if (0) { F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container, - F1AP_ProtocolIE_ID_id_oldgNB_DU_UE_F1AP_ID, true); + F1AP_ProtocolIE_ID_id_oldgNB_DU_UE_F1AP_ID, true); } /* mandatory */ @@ -1055,7 +983,7 @@ int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, /* ExecuteDuplication */ if (0) { F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container, - F1AP_ProtocolIE_ID_id_ExecuteDuplication, true); + F1AP_ProtocolIE_ID_id_ExecuteDuplication, true); executeDuplication = ie->value.choice.ExecuteDuplication; LOG_D(F1AP, "ExecuteDuplication %d \n", executeDuplication); } @@ -1067,7 +995,6 @@ int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, F1AP_ProtocolIE_ID_id_RRCContainer, true); // BK: need check // create an ITTI message and copy SDU - // message_p = itti_alloc_new_message (TASK_CU_F1, RRC_MAC_CCCH_DATA_IND); // memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE); rrc_dl_sdu_len = ie->value.choice.RRCContainer.size; @@ -1083,15 +1010,17 @@ int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, /* RAT_FrequencyPriorityInformation */ if (0) { F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container, - F1AP_ProtocolIE_ID_id_RAT_FrequencyPriorityInformation, true); + F1AP_ProtocolIE_ID_id_RAT_FrequencyPriorityInformation, true); switch(ie->value.choice.RAT_FrequencyPriorityInformation.present) { case F1AP_RAT_FrequencyPriorityInformation_PR_eNDC: //subscriberProfileIDforRFP = ie->value.choice.RAT_FrequencyPriorityInformation.choice.subscriberProfileIDforRFP; break; + case F1AP_RAT_FrequencyPriorityInformation_PR_nGRAN: //rAT_FrequencySelectionPriority = ie->value.choice.RAT_FrequencyPriorityInformation.choice.rAT_FrequencySelectionPriority; break; + default: LOG_W(F1AP, "unhandled IE RAT_FrequencyPriorityInformation.present\n"); break; @@ -1100,31 +1029,28 @@ int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, // decode RRC Container and act on the message type AssertFatal(srb_id<3,"illegal srb_id\n"); - protocol_ctxt_t ctxt; ctxt.rnti = f1ap_get_rnti_by_du_id(&f1ap_du_inst[instance], du_ue_f1ap_id); ctxt.module_id = instance; ctxt.instance = instance; ctxt.enb_flag = 1; - - struct rrc_gNB_ue_context_s* ue_context_p = rrc_gNB_get_ue_context( - RC.nrrrc[ctxt.module_id], - ctxt.rnti); - + struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_get_ue_context( + RC.nrrrc[ctxt.module_id], + ctxt.rnti); gNB_RRC_INST *rrc = RC.nrrrc[ctxt.module_id]; + if (srb_id == 0) { - NR_DL_CCCH_Message_t* dl_ccch_msg=NULL; + NR_DL_CCCH_Message_t *dl_ccch_msg=NULL; asn_dec_rval_t dec_rval; dec_rval = uper_decode(NULL, &asn_DEF_NR_DL_CCCH_Message, - (void**)&dl_ccch_msg, - ie->value.choice.RRCContainer.buf, - rrc_dl_sdu_len,0,0); + (void **)&dl_ccch_msg, + ie->value.choice.RRCContainer.buf, + rrc_dl_sdu_len,0,0); AssertFatal(dec_rval.code == RC_OK, "could not decode F1AP message\n"); + switch (dl_ccch_msg->message.choice.c1->present) { - case NR_DL_CCCH_MessageType__c1_PR_NOTHING: - LOG_I(F1AP, "Received PR_NOTHING on DL-CCCH-Message\n"); break; @@ -1133,40 +1059,32 @@ int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, "Logical Channel DL-CCCH (SRB0), Received RRCReject\n"); break; - case NR_DL_CCCH_MessageType__c1_PR_rrcSetup: - { + case NR_DL_CCCH_MessageType__c1_PR_rrcSetup: { LOG_I(F1AP, "Logical Channel DL-CCCH (SRB0), Received RRCSetup DU_ID %lx/RNTI %x\n", du_ue_f1ap_id, f1ap_get_rnti_by_du_id(&f1ap_du_inst[instance], du_ue_f1ap_id)); - // Get configuration - - NR_RRCSetup_t* rrcSetup = dl_ccch_msg->message.choice.c1->choice.rrcSetup; + // Get configuration + NR_RRCSetup_t *rrcSetup = dl_ccch_msg->message.choice.c1->choice.rrcSetup; AssertFatal(rrcSetup!=NULL, "rrcSetup is null\n"); NR_RRCSetup_IEs_t *rrcSetup_ies = rrcSetup->criticalExtensions.choice.rrcSetup; - - ue_context_p->ue_context.SRB_configList = rrcSetup_ies->radioBearerConfig.srb_ToAddModList; + ue_context_p->ue_context.SRB_configList = rrcSetup_ies->radioBearerConfig.srb_ToAddModList; AssertFatal(rrcSetup_ies->masterCellGroup.buf!=NULL,"masterCellGroup is null\n"); - asn_dec_rval_t dec_rval; - dec_rval = uper_decode(NULL, - &asn_DEF_NR_CellGroupConfig, - (void**)&ue_context_p->ue_context.masterCellGroup, - rrcSetup_ies->masterCellGroup.buf, - rrcSetup_ies->masterCellGroup.size,0,0); - AssertFatal(dec_rval.code == RC_OK, "could not decode masterCellGroup\n"); - + asn_dec_rval_t dec_rval; + dec_rval = uper_decode(NULL, + &asn_DEF_NR_CellGroupConfig, + (void **)&ue_context_p->ue_context.masterCellGroup, + rrcSetup_ies->masterCellGroup.buf, + rrcSetup_ies->masterCellGroup.size,0,0); + AssertFatal(dec_rval.code == RC_OK, "could not decode masterCellGroup\n"); apply_macrlc_config(rrc,ue_context_p,&ctxt); - - gNB_RRC_UE_t *ue_p = &ue_context_p->ue_context; + gNB_RRC_UE_t *ue_p = &ue_context_p->ue_context; AssertFatal(ue_p->Srb0.Active == 1,"SRB0 is not active\n"); - - memcpy((void*)ue_p->Srb0.Tx_buffer.Payload, - (void*)ie->value.choice.RRCContainer.buf, + memcpy((void *)ue_p->Srb0.Tx_buffer.Payload, + (void *)ie->value.choice.RRCContainer.buf, rrc_dl_sdu_len); // ie->value.choice.RRCContainer.size - ue_p->Srb0.Tx_buffer.payload_size = rrc_dl_sdu_len; - - break; + break; } // case case NR_DL_CCCH_MessageType__c1_PR_spare2: @@ -1181,21 +1099,21 @@ int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, default: AssertFatal(1==0, - "Unknown message\n"); + "Unknown message\n"); break; }// switch case - return(0); - } else if (srb_id == 1) { - NR_DL_DCCH_Message_t* dl_dcch_msg=NULL; + return(0); + } else if (srb_id == 1) { + NR_DL_DCCH_Message_t *dl_dcch_msg=NULL; asn_dec_rval_t dec_rval; dec_rval = uper_decode(NULL, - &asn_DEF_NR_DL_DCCH_Message, - (void**)&dl_dcch_msg, - &ie->value.choice.RRCContainer.buf[2], // buf[0] includes the pdcp header - rrc_dl_sdu_len-6,0,0); + &asn_DEF_NR_DL_DCCH_Message, + (void **)&dl_dcch_msg, + &ie->value.choice.RRCContainer.buf[2], // buf[0] includes the pdcp header + rrc_dl_sdu_len-6,0,0); - if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) + if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) LOG_E(F1AP," Failed to decode DL-DCCH (%zu bytes)\n",dec_rval.consumed); else LOG_D(F1AP, "Received message: present %d and c1 present %d\n", @@ -1208,117 +1126,121 @@ int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, return 0; case NR_DL_DCCH_MessageType__c1_PR_rrcReconfiguration: - // handle RRCReconfiguration + // handle RRCReconfiguration LOG_I(F1AP, "Logical Channel DL-DCCH (SRB1), Received RRCReconfiguration DU_ID %lx/RNTI %x\n", du_ue_f1ap_id, f1ap_get_rnti_by_du_id(&f1ap_du_inst[instance], du_ue_f1ap_id)); - - NR_RRCReconfiguration_t* rrcReconfiguration = dl_dcch_msg->message.choice.c1->choice.rrcReconfiguration; + NR_RRCReconfiguration_t *rrcReconfiguration = dl_dcch_msg->message.choice.c1->choice.rrcReconfiguration; if (rrcReconfiguration->criticalExtensions.present == NR_RRCReconfiguration__criticalExtensions_PR_rrcReconfiguration) { - NR_RRCReconfiguration_IEs_t* rrcReconfiguration_ies = + NR_RRCReconfiguration_IEs_t *rrcReconfiguration_ies = rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration; if (rrcReconfiguration_ies->measConfig != NULL) { LOG_I(F1AP, "Measurement Configuration is present\n"); } - if (rrcReconfiguration_ies->radioBearerConfig) { - LOG_I(F1AP, "Radio Resource Configuration is present\n"); - long drb_id; - int i; - NR_DRB_ToAddModList_t *DRB_configList = rrcReconfiguration_ies->radioBearerConfig->drb_ToAddModList; - NR_SRB_ToAddModList_t *SRB_configList = rrcReconfiguration_ies->radioBearerConfig->srb_ToAddModList; - // NR_DRB_ToReleaseList_t *DRB_ReleaseList = rrcReconfiguration_ies->radioBearerConfig->drb_ToReleaseList; + if (rrcReconfiguration_ies->radioBearerConfig) { + LOG_I(F1AP, "Radio Resource Configuration is present\n"); + long drb_id; + int i; + NR_DRB_ToAddModList_t *DRB_configList = rrcReconfiguration_ies->radioBearerConfig->drb_ToAddModList; + NR_SRB_ToAddModList_t *SRB_configList = rrcReconfiguration_ies->radioBearerConfig->srb_ToAddModList; - // rrc_rlc_config_asn1_req + // NR_DRB_ToReleaseList_t *DRB_ReleaseList = rrcReconfiguration_ies->radioBearerConfig->drb_ToReleaseList; - if (SRB_configList != NULL) { - for (i = 0; (i < SRB_configList->list.count) && (i < 3); i++) { - if (SRB_configList->list.array[i]->srb_Identity == 1 ){ - ue_context_p->ue_context.Srb1.Active=1; - } - else if (SRB_configList->list.array[i]->srb_Identity == 2 ) { - ue_context_p->ue_context.Srb2.Active=1; - ue_context_p->ue_context.Srb2.Srb_info.Srb_id=2; - LOG_I(F1AP, "[DU %d] SRB2 is now active\n",ctxt.module_id); - } else { - LOG_W(F1AP, "[DU %d] invalide SRB identity %ld\n",ctxt.module_id, - SRB_configList->list.array[i]->srb_Identity); - } + // rrc_rlc_config_asn1_req + + if (SRB_configList != NULL) { + for (i = 0; (i < SRB_configList->list.count) && (i < 3); i++) { + if (SRB_configList->list.array[i]->srb_Identity == 1 ) { + ue_context_p->ue_context.Srb1.Active=1; + } else if (SRB_configList->list.array[i]->srb_Identity == 2 ) { + ue_context_p->ue_context.Srb2.Active=1; + ue_context_p->ue_context.Srb2.Srb_info.Srb_id=2; + LOG_I(F1AP, "[DU %d] SRB2 is now active\n",ctxt.module_id); + } else { + LOG_W(F1AP, "[DU %d] invalide SRB identity %ld\n",ctxt.module_id, + SRB_configList->list.array[i]->srb_Identity); } } + } - if (DRB_configList != NULL) { - for (i = 0; i < DRB_configList->list.count; i++) { // num max DRB (11-3-8) - if (DRB_configList->list.array[i]) { - drb_id = (int)DRB_configList->list.array[i]->drb_Identity; - LOG_I(F1AP, - "[DU %d] Logical Channel UL-DCCH, Received RRCConnectionReconfiguration for UE rnti %x, reconfiguring DRB %d\n", - ctxt.module_id, - ctxt.rnti, - (int)DRB_configList->list.array[i]->drb_Identity); - // (int)*DRB_configList->list.array[i]->logicalChannelIdentity); + if (DRB_configList != NULL) { + for (i = 0; i < DRB_configList->list.count; i++) { // num max DRB (11-3-8) + if (DRB_configList->list.array[i]) { + drb_id = (int)DRB_configList->list.array[i]->drb_Identity; + LOG_I(F1AP, + "[DU %d] Logical Channel UL-DCCH, Received RRCConnectionReconfiguration for UE rnti %x, reconfiguring DRB %d\n", + ctxt.module_id, + ctxt.rnti, + (int)DRB_configList->list.array[i]->drb_Identity); + + // (int)*DRB_configList->list.array[i]->logicalChannelIdentity); if (ue_context_p->ue_context.DRB_active[drb_id] == 0) { ue_context_p->ue_context.DRB_active[drb_id] = 1; - // logicalChannelIdentity // rrc_mac_config_req_eNB } - } else { // remove LCHAN from MAC/PHY - AssertFatal(1==0,"Can't handle this yet in DU\n"); - } + AssertFatal(1==0,"Can't handle this yet in DU\n"); + } } } } - } - break; - case NR_DL_DCCH_MessageType__c1_PR_rrcResume: - LOG_I(F1AP,"Received rrcResume\n"); - break; - case NR_DL_DCCH_MessageType__c1_PR_rrcRelease: - LOG_I(F1AP,"Received rrcRelease\n"); - break; - case NR_DL_DCCH_MessageType__c1_PR_rrcReestablishment: - LOG_I(F1AP,"Received rrcReestablishment\n"); - break; - case NR_DL_DCCH_MessageType__c1_PR_securityModeCommand: - LOG_I(F1AP,"Received securityModeCommand\n"); - break; - case NR_DL_DCCH_MessageType__c1_PR_dlInformationTransfer: - LOG_I(F1AP, "Received dlInformationTransfer\n"); - break; - case NR_DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry: - LOG_I(F1AP, "Received ueCapabilityEnquiry\n"); - break; - case NR_DL_DCCH_MessageType__c1_PR_counterCheck: - LOG_I(F1AP, "Received counterCheck\n"); + } + break; - case NR_DL_DCCH_MessageType__c1_PR_mobilityFromNRCommand: - case NR_DL_DCCH_MessageType__c1_PR_dlDedicatedMessageSegment_r16: - case NR_DL_DCCH_MessageType__c1_PR_ueInformationRequest_r16: - case NR_DL_DCCH_MessageType__c1_PR_dlInformationTransferMRDC_r16: - case NR_DL_DCCH_MessageType__c1_PR_loggedMeasurementConfiguration_r16: - case NR_DL_DCCH_MessageType__c1_PR_spare3: - case NR_DL_DCCH_MessageType__c1_PR_spare2: - case NR_DL_DCCH_MessageType__c1_PR_spare1: - break; + + case NR_DL_DCCH_MessageType__c1_PR_rrcResume: + LOG_I(F1AP,"Received rrcResume\n"); + break; + + case NR_DL_DCCH_MessageType__c1_PR_rrcRelease: + LOG_I(F1AP,"Received rrcRelease\n"); + break; + + case NR_DL_DCCH_MessageType__c1_PR_rrcReestablishment: + LOG_I(F1AP,"Received rrcReestablishment\n"); + break; + + case NR_DL_DCCH_MessageType__c1_PR_securityModeCommand: + LOG_I(F1AP,"Received securityModeCommand\n"); + break; + + case NR_DL_DCCH_MessageType__c1_PR_dlInformationTransfer: + LOG_I(F1AP, "Received dlInformationTransfer\n"); + break; + + case NR_DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry: + LOG_I(F1AP, "Received ueCapabilityEnquiry\n"); + break; + + case NR_DL_DCCH_MessageType__c1_PR_counterCheck: + LOG_I(F1AP, "Received counterCheck\n"); + break; + + case NR_DL_DCCH_MessageType__c1_PR_mobilityFromNRCommand: + case NR_DL_DCCH_MessageType__c1_PR_dlDedicatedMessageSegment_r16: + case NR_DL_DCCH_MessageType__c1_PR_ueInformationRequest_r16: + case NR_DL_DCCH_MessageType__c1_PR_dlInformationTransferMRDC_r16: + case NR_DL_DCCH_MessageType__c1_PR_loggedMeasurementConfiguration_r16: + case NR_DL_DCCH_MessageType__c1_PR_spare3: + case NR_DL_DCCH_MessageType__c1_PR_spare2: + case NR_DL_DCCH_MessageType__c1_PR_spare1: + break; + } } - } - } - else if (srb_id == 2) { + } else if (srb_id == 2) { // TODO } LOG_I(F1AP, "Received DL RRC Transfer on srb_id %ld\n", srb_id); - - -// rlc_op_status_t rlc_status; -// boolean_t ret = TRUE; - mem_block_t *pdcp_pdu_p = NULL; + // rlc_op_status_t rlc_status; + // boolean_t ret = TRUE; + mem_block_t *pdcp_pdu_p = NULL; pdcp_pdu_p = get_free_mem_block(rrc_dl_sdu_len, __func__); //LOG_I(F1AP, "PRRCContainer size %lu:", ie->value.choice.RRCContainer.size); @@ -1332,7 +1254,6 @@ int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, if (pdcp_pdu_p != NULL) { memset(pdcp_pdu_p->data, 0, rrc_dl_sdu_len); memcpy(&pdcp_pdu_p->data[0], ie->value.choice.RRCContainer.buf, rrc_dl_sdu_len); - /* for rfsim */ du_rlc_data_req(&ctxt, 1, 0x00, 1, 1, 0, rrc_dl_sdu_len, pdcp_pdu_p); // rlc_status = rlc_data_req(&ctxt @@ -1351,29 +1272,25 @@ int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, // //LOG_I(F1AP, "Data sending request over RLC succeeded!\n"); // ret=TRUE; // break; - // case RLC_OP_STATUS_BAD_PARAMETER: // LOG_W(F1AP, "Data sending request over RLC failed with 'Bad Parameter' reason!\n"); // ret= FALSE; // break; - // case RLC_OP_STATUS_INTERNAL_ERROR: // LOG_W(F1AP, "Data sending request over RLC failed with 'Internal Error' reason!\n"); // ret= FALSE; // break; - // case RLC_OP_STATUS_OUT_OF_RESSOURCES: // LOG_W(F1AP, "Data sending request over RLC failed with 'Out of Resources' reason!\n"); // ret= FALSE; // break; - // default: // LOG_W(F1AP, "RLC returned an unknown status code after PDCP placed the order to send some data (Status Code:%d)\n", rlc_status); // ret= FALSE; // break; // } // switch case - // return ret; - } // if pdcp_pdu_p + // return ret; + } // if pdcp_pdu_p return 0; } diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.h b/openair2/F1AP/f1ap_du_rrc_message_transfer.h index bb2bf020b8..563898224c 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.h +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.h @@ -45,12 +45,12 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance, const f1ap_ul_rrc_messa int DU_send_UL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, const f1ap_ul_rrc_message_t *msg); int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, - int CC_idP, - int UE_id, - rnti_t rntiP, - const uint8_t *sduP, - sdu_size_t sdu_lenP, - const int8_t *sdu2P, - sdu_size_t sdu2_lenP); + int CC_idP, + int UE_id, + rnti_t rntiP, + const uint8_t *sduP, + sdu_size_t sdu_lenP, + const char *sdu2P, + sdu_size_t sdu2_lenP); #endif /* F1AP_DU_RRC_MESSAGE_TRANSFER_H_ */ diff --git a/openair2/F1AP/f1ap_du_task.c b/openair2/F1AP/f1ap_du_task.c index 676aba54a2..e844788fc2 100644 --- a/openair2/F1AP/f1ap_du_task.c +++ b/openair2/F1AP/f1ap_du_task.c @@ -44,63 +44,50 @@ 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; 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); - sctp_new_association_req_p = &message_p->ittiMsg.sctp_new_association_req; sctp_new_association_req_p->ulp_cnx_id = instance; sctp_new_association_req_p->port = F1AP_PORT_NUMBER; 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->out_streams = f1ap_setup_req->sctp_out_streams; - // remote memcpy(&sctp_new_association_req_p->remote_address, &f1ap_setup_req->CU_f1_ip_address, sizeof(f1ap_setup_req->CU_f1_ip_address)); - // local 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 itti_send_msg_to_task(TASK_SCTP, instance, message_p); } void du_task_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp) { - DevAssert(sctp_new_association_resp != NULL); if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) { LOG_W(F1AP, "Received unsuccessful result for SCTP association (%u), instance %ld, cnx_id %u\n", - sctp_new_association_resp->sctp_state, - instance, - sctp_new_association_resp->ulp_cnx_id); + sctp_new_association_resp->sctp_state, + instance, + sctp_new_association_resp->ulp_cnx_id); + //f1ap_handle_setup_message(instance, sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN); + return; // exit -1 for debugging + } - //f1ap_handle_setup_message(instance, sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN); - return; // exit -1 for debugging - } - - // save the assoc id + // save the 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_out_streams = sctp_new_association_resp->out_streams; f1ap_du_data->default_sctp_stream_id = 0; - /* setup parameters for F1U and start the server */ const cudu_params_t params = { .local_ipv4_address = RC.nrmac[instance]->eth_params_n.my_addr, @@ -110,34 +97,25 @@ void du_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat }; AssertFatal(proto_agent_start(instance, ¶ms) == 0, "could not start PROTO_AGENT for F1U on instance %ld!\n", instance); - DU_send_F1_SETUP_REQUEST(instance); } -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) { int result; - DevAssert(sctp_data_ind != NULL); - f1ap_handle_message(instance, sctp_data_ind->assoc_id, sctp_data_ind->stream, - sctp_data_ind->buffer, sctp_data_ind->buffer_length); - + sctp_data_ind->buffer, sctp_data_ind->buffer_length); result = itti_free(TASK_UNKNOWN, sctp_data_ind->buffer); AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); } void *F1AP_DU_task(void *arg) { - //sctp_cu_init(); MessageDef *received_msg = NULL; int result; - LOG_I(F1AP, "Starting F1AP at DU\n"); - //f1ap_eNB_prepare_internal_data(); - itti_mark_task_ready(TASK_DU_F1); // SCTP @@ -145,58 +123,58 @@ void *F1AP_DU_task(void *arg) { itti_receive_msg(TASK_DU_F1, &received_msg); switch (ITTI_MSG_ID(received_msg)) { - // case TERMINATE_MESSAGE: // //F1AP_WARN(" *** Exiting F1AP DU thread\n"); // itti_exit_task(); // break; - case F1AP_SETUP_REQ: // this is not a true F1 message, but rather an ITTI message sent by enb_app - // 1. save the itti msg so that you can use it to sen f1ap_setup_req, 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. send a sctp_association req 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)); + &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), - &F1AP_GNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(received_msg)); - break; + DU_send_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(ITTI_MSG_DESTINATION_INSTANCE(received_msg), + &F1AP_GNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(received_msg)); + break; + case F1AP_GNB_CU_CONFIGURATION_UPDATE_FAILURE: - DU_send_gNB_CU_CONFIGURATION_UPDATE_FAILURE(ITTI_MSG_DESTINATION_INSTANCE(received_msg), - &F1AP_GNB_CU_CONFIGURATION_UPDATE_FAILURE(received_msg)); - break; + DU_send_gNB_CU_CONFIGURATION_UPDATE_FAILURE(ITTI_MSG_DESTINATION_INSTANCE(received_msg), + &F1AP_GNB_CU_CONFIGURATION_UPDATE_FAILURE(received_msg)); + break; case SCTP_NEW_ASSOCIATION_RESP: // 1. store the respon // 2. send the f1setup_req LOG_I(F1AP, "DU Task Received SCTP_NEW_ASSOCIATION_RESP\n"); du_task_handle_sctp_association_resp(ITTI_MSG_DESTINATION_INSTANCE(received_msg), - &received_msg->ittiMsg.sctp_new_association_resp); + &received_msg->ittiMsg.sctp_new_association_resp); break; - case SCTP_DATA_IND: + case SCTP_DATA_IND: // ex: any F1 incoming message for DU ends here LOG_I(F1AP, "DU Task Received SCTP_DATA_IND\n"); du_task_handle_sctp_data_ind(ITTI_MSG_DESTINATION_INSTANCE(received_msg), - &received_msg->ittiMsg.sctp_data_ind); + &received_msg->ittiMsg.sctp_data_ind); break; case F1AP_INITIAL_UL_RRC_MESSAGE: // to rrc LOG_I(F1AP, "DU Task Received F1AP_INITIAL_UL_RRC_MESSAGE\n"); - f1ap_initial_ul_rrc_message_t *msg = &F1AP_INITIAL_UL_RRC_MESSAGE(received_msg); DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(0,0,0,msg->crnti, msg->rrc_container, msg->rrc_container_length, - (char*)msg->du2cu_rrc_container, - msg->du2cu_rrc_container_length - ); + msg->du2cu_rrc_container, + msg->du2cu_rrc_container_length + ); break; - case F1AP_UL_RRC_MESSAGE: // to rrc + case F1AP_UL_RRC_MESSAGE: // to rrc LOG_I(F1AP, "DU Task Received F1AP_UL_RRC_MESSAGE\n"); + if (RC.nrrrc[0]->node_type == ngran_gNB_DU) { DU_send_UL_NR_RRC_MESSAGE_TRANSFER(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &F1AP_UL_RRC_MESSAGE(received_msg)); @@ -204,6 +182,7 @@ void *F1AP_DU_task(void *arg) { DU_send_UL_RRC_MESSAGE_TRANSFER(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &F1AP_UL_RRC_MESSAGE(received_msg)); } + break; case F1AP_UE_CONTEXT_RELEASE_REQ: // from MAC @@ -222,9 +201,9 @@ void *F1AP_DU_task(void *arg) { ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg)); break; } // switch + result = itti_free (ITTI_MSG_ORIGIN_ID(received_msg), received_msg); AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); - received_msg = NULL; } // while diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 81fdd0c35f..7ff403fb66 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -115,7 +115,7 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* Decode DRBs_ToBeSetup_List */ if(0) { F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container, - F1AP_ProtocolIE_ID_id_DRBs_ToBeSetup_List, true); + F1AP_ProtocolIE_ID_id_DRBs_ToBeSetup_List, true); f1ap_ue_context_setup_req->drbs_to_be_setup_length = ie->value.choice.DRBs_ToBeSetup_List.list.count; f1ap_ue_context_setup_req->drbs_to_be_setup = calloc(f1ap_ue_context_setup_req->drbs_to_be_setup_length, sizeof(f1ap_drb_to_be_setup_t)); @@ -148,9 +148,11 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, } } } + /* RRCContainer */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container, F1AP_ProtocolIE_ID_id_RRCContainer, false); + if (ie) { /* correct here */ f1ap_ue_context_setup_req->rrc_container = malloc(ie->value.choice.RRCContainer.size); @@ -160,221 +162,196 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, } // AssertFatal(0, "check configuration, send to appropriate handler\n"); - protocol_ctxt_t ctxt; // ctxt.rnti = f1ap_get_rnti_by_du_id(&f1ap_du_inst[instance], ie->value.choice.GNB_DU_UE_F1AP_ID); ctxt.rnti = 0x1234; ctxt.module_id = instance; ctxt.instance = instance; ctxt.enb_flag = 1; - - mem_block_t *pdcp_pdu_p = NULL; + mem_block_t *pdcp_pdu_p = NULL; pdcp_pdu_p = get_free_mem_block(ie->value.choice.RRCContainer.size, __func__); + if (pdcp_pdu_p != NULL) { memset(pdcp_pdu_p->data, 0, ie->value.choice.RRCContainer.size); memcpy(&pdcp_pdu_p->data[0], ie->value.choice.RRCContainer.buf, ie->value.choice.RRCContainer.size); - /* for rfsim */ du_rlc_data_req(&ctxt, 1, 0x00, 1, 1, 0, ie->value.choice.RRCContainer.size, pdcp_pdu_p); } + return 0; } //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; + F1AP_F1AP_PDU_t pdu={0}; F1AP_UEContextSetupResponse_t *out; - F1AP_UEContextSetupResponseIEs_t *ie; - uint8_t *buffer; - uint32_t len; - int i = 0, j = 0; + uint8_t *buffer=NULL; + uint32_t len=0; rnti_t rntiP; // note: need get value /* Create */ /* 0. Message Type */ - memset(&pdu, 0, sizeof(pdu)); pdu.present = F1AP_F1AP_PDU_PR_successfulOutcome; - pdu.choice.successfulOutcome = (F1AP_SuccessfulOutcome_t *)calloc(1, sizeof(F1AP_SuccessfulOutcome_t)); - pdu.choice.successfulOutcome->procedureCode = F1AP_ProcedureCode_id_UEContextSetup; - pdu.choice.successfulOutcome->criticality = F1AP_Criticality_reject; - pdu.choice.successfulOutcome->value.present = F1AP_SuccessfulOutcome__value_PR_UEContextSetupResponse; - out = &pdu.choice.successfulOutcome->value.choice.UEContextSetupResponse; + asn1cCalloc(pdu.choice.successfulOutcome, F1AP_SuccessfulOutcome_t,tmp); + tmp->procedureCode = F1AP_ProcedureCode_id_UEContextSetup; + tmp->criticality = F1AP_Criticality_reject; + tmp->value.present = F1AP_SuccessfulOutcome__value_PR_UEContextSetupResponse; + out = &tmp->value.choice.UEContextSetupResponse; /* mandatory */ /* c1. GNB_CU_UE_F1AP_ID */ - ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextSetupResponseIEs__value_PR_GNB_CU_UE_F1AP_ID; - ie->value.choice.GNB_CU_UE_F1AP_ID = 126L; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie1); + ie1->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; + ie1->criticality = F1AP_Criticality_reject; + ie1->value.present = F1AP_UEContextSetupResponseIEs__value_PR_GNB_CU_UE_F1AP_ID; + ie1->value.choice.GNB_CU_UE_F1AP_ID = 126L; /* mandatory */ /* c2. GNB_DU_UE_F1AP_ID */ - ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextSetupResponseIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie->value.choice.GNB_DU_UE_F1AP_ID = 651L; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie2); + ie2->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; + ie2->criticality = F1AP_Criticality_reject; + ie2->value.present = F1AP_UEContextSetupResponseIEs__value_PR_GNB_DU_UE_F1AP_ID; + ie2->value.choice.GNB_DU_UE_F1AP_ID = 651L; /* mandatory */ /* c3. DUtoCURRCInformation */ - ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_DUtoCURRCInformation; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextSetupResponseIEs__value_PR_DUtoCURRCInformation; + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie3); + ie3->id = F1AP_ProtocolIE_ID_id_DUtoCURRCInformation; + ie3->criticality = F1AP_Criticality_reject; + ie3->value.present = F1AP_UEContextSetupResponseIEs__value_PR_DUtoCURRCInformation; { /* cellGroupConfig */ - OCTET_STRING_fromBuf(&ie->value.choice.DUtoCURRCInformation.cellGroupConfig, "asdsa", + OCTET_STRING_fromBuf(&ie3->value.choice.DUtoCURRCInformation.cellGroupConfig, "asdsa", strlen("asdsa")); /* OPTIONAL */ /* measGapConfig */ if (0) { - ie->value.choice.DUtoCURRCInformation.measGapConfig = (F1AP_MeasGapConfig_t *)calloc(1, sizeof(F1AP_MeasGapConfig_t)); - OCTET_STRING_fromBuf( ie->value.choice.DUtoCURRCInformation.measGapConfig, "asdsa", - strlen("asdsa")); + asn1cCalloc(ie3->value.choice.DUtoCURRCInformation.measGapConfig, + F1AP_MeasGapConfig_t, tmp); + OCTET_STRING_fromBuf(tmp, "asdsa", strlen("asdsa")); } /* OPTIONAL */ /* requestedP_MaxFR1 */ if (0) { - ie->value.choice.DUtoCURRCInformation.requestedP_MaxFR1 = (OCTET_STRING_t *)calloc(1, sizeof(OCTET_STRING_t)); - OCTET_STRING_fromBuf( ie->value.choice.DUtoCURRCInformation.requestedP_MaxFR1, "asdsa", - strlen("asdsa")); + asn1cCalloc(ie3->value.choice.DUtoCURRCInformation.requestedP_MaxFR1, + OCTET_STRING_t, tmp); + OCTET_STRING_fromBuf(tmp , "asdsa", strlen("asdsa")); } - - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } /* optional */ /* c4. C_RNTI */ if (0) { - ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_C_RNTI; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextSetupResponseIEs__value_PR_C_RNTI; + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie4); + ie4->id = F1AP_ProtocolIE_ID_id_C_RNTI; + ie4->criticality = F1AP_Criticality_ignore; + ie4->value.present = F1AP_UEContextSetupResponseIEs__value_PR_C_RNTI; //C_RNTI_TO_BIT_STRING(rntiP, &ie->value.choice.C_RNTI); - ie->value.choice.C_RNTI=rntiP; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + ie4->value.choice.C_RNTI=rntiP; + LOG_E(F1AP,"RNTI to code!\n"); } /* optional */ /* c5. ResourceCoordinationTransferContainer */ if (0) { - ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_ResourceCoordinationTransferContainer; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextSetupResponseIEs__value_PR_ResourceCoordinationTransferContainer; - OCTET_STRING_fromBuf(&ie->value.choice.ResourceCoordinationTransferContainer, "asdsa", + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie5); + ie5->id = F1AP_ProtocolIE_ID_id_ResourceCoordinationTransferContainer; + ie5->criticality = F1AP_Criticality_ignore; + ie5->value.present = F1AP_UEContextSetupResponseIEs__value_PR_ResourceCoordinationTransferContainer; + OCTET_STRING_fromBuf(&ie5->value.choice.ResourceCoordinationTransferContainer, "asdsa", strlen("asdsa")); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } /* optional */ /* c6. FullConfiguration */ if (0) { - ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_FullConfiguration; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextSetupResponseIEs__value_PR_FullConfiguration; - ie->value.choice.FullConfiguration = F1AP_FullConfiguration_full; //enum - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie6); + ie6->id = F1AP_ProtocolIE_ID_id_FullConfiguration; + ie6->criticality = F1AP_Criticality_ignore; + ie6->value.present = F1AP_UEContextSetupResponseIEs__value_PR_FullConfiguration; + ie6->value.choice.FullConfiguration = F1AP_FullConfiguration_full; //enum } /* mandatory */ /* c7. DRBs_Setup_List */ - ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_DRBs_Setup_List; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextSetupResponseIEs__value_PR_DRBs_Setup_List; + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie7); + ie7->id = F1AP_ProtocolIE_ID_id_DRBs_Setup_List; + ie7->criticality = F1AP_Criticality_ignore; + ie7->value.present = F1AP_UEContextSetupResponseIEs__value_PR_DRBs_Setup_List; - for (i=0; - i<1; - i++) { + for (int i=0; i<1; i++) { // - F1AP_DRBs_Setup_ItemIEs_t *drbs_setup_item_ies; - drbs_setup_item_ies = (F1AP_DRBs_Setup_ItemIEs_t *)calloc(1, sizeof(F1AP_DRBs_Setup_ItemIEs_t)); + asn1cSequenceAdd(ie7->value.choice.DRBs_Setup_List.list, + F1AP_DRBs_Setup_ItemIEs_t, drbs_setup_item_ies); drbs_setup_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_Setup_Item; drbs_setup_item_ies->criticality = F1AP_Criticality_ignore; drbs_setup_item_ies->value.present = F1AP_SRBs_FailedToBeSetup_ItemIEs__value_PR_SRBs_FailedToBeSetup_Item; /* 7.1 DRBs_Setup_Item */ - F1AP_DRBs_Setup_Item_t drbs_setup_item; - memset((void *)&drbs_setup_item, 0, sizeof(F1AP_DRBs_Setup_Item_t)); + /* ADD */ + F1AP_DRBs_Setup_Item_t *drbs_setup_item=&drbs_setup_item_ies->value.choice.DRBs_Setup_Item; /* dRBID */ - drbs_setup_item.dRBID = 12; + drbs_setup_item->dRBID = 12; /* OPTIONAL */ /* lCID */ //drbs_setup_item.lCID = (F1AP_LCID_t *)calloc(1, sizeof(F1AP_LCID_t)); //drbs_setup_item.lCID = 1L; - for (j=0; - j<1; - j++) { - F1AP_DLUPTNLInformation_ToBeSetup_Item_t *dLUPTNLInformation_ToBeSetup_Item; - dLUPTNLInformation_ToBeSetup_Item = (F1AP_DLUPTNLInformation_ToBeSetup_Item_t *)calloc(1, sizeof(F1AP_DLUPTNLInformation_ToBeSetup_Item_t)); + for (int j=0; j<1; j++) { + /* ADD */ + asn1cSequenceAdd(drbs_setup_item->dLUPTNLInformation_ToBeSetup_List.list, + F1AP_DLUPTNLInformation_ToBeSetup_Item_t, dLUPTNLInformation_ToBeSetup_Item); dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; /* gTPTunnel */ - F1AP_GTPTunnel_t *gTPTunnel = (F1AP_GTPTunnel_t *)calloc(1, sizeof(F1AP_GTPTunnel_t)); - { + asn1cCalloc(dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.choice.gTPTunnel, + F1AP_GTPTunnel_t, gTPTunnel); /* transportLayerAddress */ TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); /* gTP_TEID */ OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "1204", strlen("1204")); - dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.choice.gTPTunnel = gTPTunnel; - } - /* ADD */ - ASN_SEQUENCE_ADD(&drbs_setup_item.dLUPTNLInformation_ToBeSetup_List.list, - dLUPTNLInformation_ToBeSetup_Item); } // for j - /* ADD */ - drbs_setup_item_ies->value.choice.DRBs_Setup_Item = drbs_setup_item; - ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_Setup_List.list, - drbs_setup_item_ies); } // for i - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ /* c8. SRBs_FailedToBeSetup_List */ - ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_SRBs_FailedToBeSetup_List; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextSetupResponseIEs__value_PR_SRBs_FailedToBeSetup_List; + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie8); + ie8->id = F1AP_ProtocolIE_ID_id_SRBs_FailedToBeSetup_List; + ie8->criticality = F1AP_Criticality_ignore; + ie8->value.present = F1AP_UEContextSetupResponseIEs__value_PR_SRBs_FailedToBeSetup_List; - for (i=0; - i<1; - i++) { + for (int i=0; i<1; i++) { // - F1AP_SRBs_FailedToBeSetup_ItemIEs_t *srbs_failedToBeSetup_item_ies; - srbs_failedToBeSetup_item_ies = (F1AP_SRBs_FailedToBeSetup_ItemIEs_t *)calloc(1, sizeof(F1AP_SRBs_FailedToBeSetup_ItemIEs_t)); + asn1cSequenceAdd(ie8->value.choice.SRBs_FailedToBeSetup_List.list, + F1AP_SRBs_FailedToBeSetup_ItemIEs_t, srbs_failedToBeSetup_item_ies); srbs_failedToBeSetup_item_ies->id = F1AP_ProtocolIE_ID_id_SRBs_FailedToBeSetup_Item; srbs_failedToBeSetup_item_ies->criticality = F1AP_Criticality_ignore; srbs_failedToBeSetup_item_ies->value.present = F1AP_SRBs_FailedToBeSetup_ItemIEs__value_PR_SRBs_FailedToBeSetup_Item; /* 8.1 SRBs_Setup_Item */ - F1AP_SRBs_FailedToBeSetup_Item_t srbs_failedToBeSetup_item; - memset((void *)&srbs_failedToBeSetup_item, 0, sizeof(F1AP_SRBs_FailedToBeSetup_Item_t)); + F1AP_SRBs_FailedToBeSetup_Item_t *srbs_failedToBeSetup_item= + &srbs_failedToBeSetup_item_ies->value.choice.SRBs_FailedToBeSetup_Item; /* sRBID */ - srbs_failedToBeSetup_item.sRBID = 13L; + srbs_failedToBeSetup_item->sRBID = 13L; /* cause */ - srbs_failedToBeSetup_item.cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t)); + asn1cCalloc(srbs_failedToBeSetup_item->cause, F1AP_Cause_t ,tmp); // dummy value - srbs_failedToBeSetup_item.cause->present = F1AP_Cause_PR_radioNetwork; + tmp->present = F1AP_Cause_PR_radioNetwork; - switch(srbs_failedToBeSetup_item.cause->present) { + switch(tmp->present) { case F1AP_Cause_PR_radioNetwork: - srbs_failedToBeSetup_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unspecified; + tmp->choice.radioNetwork = F1AP_CauseRadioNetwork_unspecified; break; case F1AP_Cause_PR_transport: - srbs_failedToBeSetup_item.cause->choice.transport = F1AP_CauseTransport_unspecified; + tmp->choice.transport = F1AP_CauseTransport_unspecified; break; case F1AP_Cause_PR_protocol: - srbs_failedToBeSetup_item.cause->choice.protocol = F1AP_CauseProtocol_unspecified; + tmp->choice.protocol = F1AP_CauseProtocol_unspecified; break; case F1AP_Cause_PR_misc: - srbs_failedToBeSetup_item.cause->choice.misc = F1AP_CauseMisc_unspecified; + tmp->choice.misc = F1AP_CauseMisc_unspecified; break; case F1AP_Cause_PR_NOTHING: @@ -382,54 +359,47 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance) { break; } // switch - /* ADD */ - srbs_failedToBeSetup_item_ies->value.choice.SRBs_FailedToBeSetup_Item = srbs_failedToBeSetup_item; - ASN_SEQUENCE_ADD(&ie->value.choice.SRBs_FailedToBeSetup_List.list, - srbs_failedToBeSetup_item_ies); } // for i - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* */ /* c9. DRBs_FailedToBeSetup_List */ - ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_DRBs_FailedToBeSetup_List; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextSetupResponseIEs__value_PR_DRBs_FailedToBeSetup_List; + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie9); + ie9->id = F1AP_ProtocolIE_ID_id_DRBs_FailedToBeSetup_List; + ie9->criticality = F1AP_Criticality_ignore; + ie9->value.present = F1AP_UEContextSetupResponseIEs__value_PR_DRBs_FailedToBeSetup_List; - for (i=0; - i<1; - i++) { - // - F1AP_DRBs_FailedToBeSetup_ItemIEs_t *drbs_failedToBeSetup_item_ies; - drbs_failedToBeSetup_item_ies = (F1AP_DRBs_FailedToBeSetup_ItemIEs_t *)calloc(1, sizeof(F1AP_DRBs_FailedToBeSetup_ItemIEs_t)); + for (int i=0; i<1; i++) { + asn1cSequenceAdd(ie9->value.choice.DRBs_FailedToBeSetup_List.list, + F1AP_DRBs_FailedToBeSetup_ItemIEs_t, drbs_failedToBeSetup_item_ies); drbs_failedToBeSetup_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_FailedToBeSetup_Item; drbs_failedToBeSetup_item_ies->criticality = F1AP_Criticality_ignore; drbs_failedToBeSetup_item_ies->value.present = F1AP_DRBs_FailedToBeSetup_ItemIEs__value_PR_DRBs_FailedToBeSetup_Item; /* 9.1 DRBs_Setup_Item */ - F1AP_DRBs_FailedToBeSetup_Item_t drbs_failedToBeSetup_item; - memset((void *)&drbs_failedToBeSetup_item, 0, sizeof(F1AP_DRBs_FailedToBeSetup_Item_t)); + /* ADD */ + F1AP_DRBs_FailedToBeSetup_Item_t *drbs_failedToBeSetup_item= + &drbs_failedToBeSetup_item_ies->value.choice.DRBs_FailedToBeSetup_Item; /* dRBID */ - drbs_failedToBeSetup_item.dRBID = 14; + drbs_failedToBeSetup_item->dRBID = 14; /* cause */ - drbs_failedToBeSetup_item.cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t)); + asn1cCalloc(drbs_failedToBeSetup_item->cause, F1AP_Cause_t,tmp); // dummy value - drbs_failedToBeSetup_item.cause->present = F1AP_Cause_PR_radioNetwork; + tmp->present = F1AP_Cause_PR_radioNetwork; - switch(drbs_failedToBeSetup_item.cause->present) { + switch(tmp->present) { case F1AP_Cause_PR_radioNetwork: - drbs_failedToBeSetup_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unspecified; + tmp->choice.radioNetwork = F1AP_CauseRadioNetwork_unspecified; break; case F1AP_Cause_PR_transport: - drbs_failedToBeSetup_item.cause->choice.transport = F1AP_CauseTransport_unspecified; + tmp->choice.transport = F1AP_CauseTransport_unspecified; break; case F1AP_Cause_PR_protocol: - drbs_failedToBeSetup_item.cause->choice.protocol = F1AP_CauseProtocol_unspecified; + tmp->choice.protocol = F1AP_CauseProtocol_unspecified; break; case F1AP_Cause_PR_misc: - drbs_failedToBeSetup_item.cause->choice.misc = F1AP_CauseMisc_unspecified; + tmp->choice.misc = F1AP_CauseMisc_unspecified; break; case F1AP_Cause_PR_NOTHING: @@ -437,58 +407,46 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance) { break; } // switch - /* ADD */ - drbs_failedToBeSetup_item_ies->value.choice.DRBs_FailedToBeSetup_Item = drbs_failedToBeSetup_item; - ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_FailedToBeSetup_List.list, - drbs_failedToBeSetup_item_ies); } // for i - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); // /* */ /* c10. SCell_FailedtoSetup_List */ - ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_SCell_FailedtoSetup_List; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextSetupResponseIEs__value_PR_SCell_FailedtoSetup_List; + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie10); + ie10->id = F1AP_ProtocolIE_ID_id_SCell_FailedtoSetup_List; + ie10->criticality = F1AP_Criticality_ignore; + ie10->value.present = F1AP_UEContextSetupResponseIEs__value_PR_SCell_FailedtoSetup_List; - for (i=0; - i<1; - i++) { - // - F1AP_SCell_FailedtoSetup_ItemIEs_t *sCell_FailedtoSetup_item_ies; - sCell_FailedtoSetup_item_ies = (F1AP_SCell_FailedtoSetup_ItemIEs_t *)calloc(1, sizeof(F1AP_SCell_FailedtoSetup_ItemIEs_t)); + for (int i=0; i<1; i++) { + asn1cSequenceAdd(ie10->value.choice.SCell_FailedtoSetup_List.list, + F1AP_SCell_FailedtoSetup_ItemIEs_t, sCell_FailedtoSetup_item_ies); sCell_FailedtoSetup_item_ies->id = F1AP_ProtocolIE_ID_id_SCell_FailedtoSetup_Item; 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; - memset((void *)&sCell_FailedtoSetup_item, 0, sizeof(F1AP_SCell_FailedtoSetup_Item_t)); + F1AP_SCell_FailedtoSetup_Item_t*sCell_FailedtoSetup_item= + &sCell_FailedtoSetup_item_ies->value.choice.SCell_FailedtoSetup_Item; /* sCell_ID */ - F1AP_NRCGI_t nRCGI; // issue here - memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t)); - MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[0], &nRCGI.nRCellIdentity); - sCell_FailedtoSetup_item.sCell_ID = nRCGI; + addnRCGI(sCell_FailedtoSetup_item->sCell_ID,f1ap_du_data->cell+i); /* cause */ - sCell_FailedtoSetup_item.cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t)); + asn1cCalloc(sCell_FailedtoSetup_item->cause, F1AP_Cause_t, tmp); // dummy value - sCell_FailedtoSetup_item.cause->present = F1AP_Cause_PR_radioNetwork; + tmp->present = F1AP_Cause_PR_radioNetwork; - switch(sCell_FailedtoSetup_item.cause->present) { + switch(tmp->present) { case F1AP_Cause_PR_radioNetwork: - sCell_FailedtoSetup_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unspecified; + tmp->choice.radioNetwork = F1AP_CauseRadioNetwork_unspecified; break; case F1AP_Cause_PR_transport: - sCell_FailedtoSetup_item.cause->choice.transport = F1AP_CauseTransport_unspecified; + tmp->choice.transport = F1AP_CauseTransport_unspecified; break; case F1AP_Cause_PR_protocol: - sCell_FailedtoSetup_item.cause->choice.protocol = F1AP_CauseProtocol_unspecified; + tmp->choice.protocol = F1AP_CauseProtocol_unspecified; break; case F1AP_Cause_PR_misc: - sCell_FailedtoSetup_item.cause->choice.misc = F1AP_CauseMisc_unspecified; + tmp->choice.misc = F1AP_CauseMisc_unspecified; break; case F1AP_Cause_PR_NOTHING: @@ -496,41 +454,34 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance) { break; } // switch - /* ADD */ - sCell_FailedtoSetup_item_ies->value.choice.SCell_FailedtoSetup_Item = sCell_FailedtoSetup_item; - ASN_SEQUENCE_ADD(&ie->value.choice.SCell_FailedtoSetup_List.list, - sCell_FailedtoSetup_item_ies); } // for i - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* Optional */ /* c11. InactivityMonitoringResponse */ if (0) { - ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_InactivityMonitoringResponse; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextSetupResponseIEs__value_PR_InactivityMonitoringResponse; - ie->value.choice.InactivityMonitoringResponse = F1AP_InactivityMonitoringResponse_not_supported; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie11); + ie11->id = F1AP_ProtocolIE_ID_id_InactivityMonitoringResponse; + ie11->criticality = F1AP_Criticality_ignore; + ie11->value.present = F1AP_UEContextSetupResponseIEs__value_PR_InactivityMonitoringResponse; + ie11->value.choice.InactivityMonitoringResponse = F1AP_InactivityMonitoringResponse_not_supported; } /* Optional */ /* c12. CriticalityDiagnostics */ if (0) { - ie = (F1AP_UEContextSetupResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextSetupResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_CriticalityDiagnostics; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextSetupResponseIEs__value_PR_CriticalityDiagnostics; - ie->value.choice.CriticalityDiagnostics.procedureCode = (F1AP_ProcedureCode_t *)calloc(1, sizeof(F1AP_ProcedureCode_t)); - *ie->value.choice.CriticalityDiagnostics.procedureCode = F1AP_ProcedureCode_id_UEContextSetup; - ie->value.choice.CriticalityDiagnostics.triggeringMessage = (F1AP_TriggeringMessage_t *)calloc(1, sizeof(F1AP_TriggeringMessage_t)); - *ie->value.choice.CriticalityDiagnostics.triggeringMessage = F1AP_TriggeringMessage_initiating_message; - ie->value.choice.CriticalityDiagnostics.procedureCriticality = (F1AP_Criticality_t *)calloc(1, sizeof(F1AP_Criticality_t)); - *ie->value.choice.CriticalityDiagnostics.procedureCriticality = F1AP_Criticality_reject; - ie->value.choice.CriticalityDiagnostics.transactionID = (F1AP_TransactionID_t *)calloc(1, sizeof(F1AP_TransactionID_t)); - *ie->value.choice.CriticalityDiagnostics.transactionID = 0; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie12); + ie12->id = F1AP_ProtocolIE_ID_id_CriticalityDiagnostics; + ie12->criticality = F1AP_Criticality_ignore; + ie12->value.present = F1AP_UEContextSetupResponseIEs__value_PR_CriticalityDiagnostics; + asn1cCallocOne(ie12->value.choice.CriticalityDiagnostics.procedureCode, + F1AP_ProcedureCode_t, F1AP_ProcedureCode_id_UEContextSetup); + asn1cCallocOne(ie12->value.choice.CriticalityDiagnostics.triggeringMessage, + F1AP_TriggeringMessage_t, F1AP_TriggeringMessage_initiating_message); + asn1cCallocOne(ie12->value.choice.CriticalityDiagnostics.procedureCriticality, + F1AP_Criticality_t, F1AP_Criticality_reject); + asn1cCallocOne(ie12->value.choice.CriticalityDiagnostics.transactionID, + F1AP_TransactionID_t, 0); } /* encode */ @@ -538,7 +489,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance) { LOG_E(F1AP, "Failed to encode F1 UE CONTEXT SETUP RESPONSE\n"); return -1; } - + return 0; } @@ -551,71 +502,65 @@ int DU_send_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, f1ap_ue_context_release_req_t *req) { F1AP_F1AP_PDU_t pdu; F1AP_UEContextReleaseRequest_t *out; - F1AP_UEContextReleaseRequestIEs_t *ie; - uint8_t *buffer; - uint32_t len; - //int i = 0, j = 0; + uint8_t *buffer=NULL; + uint32_t len=0; /* Create */ /* 0. Message Type */ - memset(&pdu, 0, sizeof(pdu)); pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; - pdu.choice.initiatingMessage = (F1AP_InitiatingMessage_t *)calloc(1, sizeof(F1AP_InitiatingMessage_t)); - pdu.choice.initiatingMessage->procedureCode = F1AP_ProcedureCode_id_UEContextReleaseRequest; - pdu.choice.initiatingMessage->criticality = F1AP_Criticality_reject; - pdu.choice.initiatingMessage->value.present = F1AP_InitiatingMessage__value_PR_UEContextReleaseRequest; - out = &pdu.choice.initiatingMessage->value.choice.UEContextReleaseRequest; + asn1cCalloc(pdu.choice.initiatingMessage, F1AP_InitiatingMessage_t, tmp); + tmp->procedureCode = F1AP_ProcedureCode_id_UEContextReleaseRequest; + tmp->criticality = F1AP_Criticality_reject; + tmp->value.present = F1AP_InitiatingMessage__value_PR_UEContextReleaseRequest; + out = &tmp->value.choice.UEContextReleaseRequest; /* mandatory */ /* c1. GNB_CU_UE_F1AP_ID */ - ie = (F1AP_UEContextReleaseRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextReleaseRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextReleaseRequestIEs__value_PR_GNB_CU_UE_F1AP_ID; - ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(&f1ap_du_inst[instance], req->rnti); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextReleaseRequestIEs_t, ie1); + 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); + /* mandatory */ /* c2. GNB_DU_UE_F1AP_ID */ - ie = (F1AP_UEContextReleaseRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextReleaseRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextReleaseRequestIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(&f1ap_du_inst[instance], req->rnti); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + 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); /* mandatory */ /* c3. Cause */ - ie = (F1AP_UEContextReleaseRequestIEs_t *)calloc(1, sizeof(F1AP_UEContextReleaseRequestIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_Cause; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextReleaseRequestIEs__value_PR_Cause; + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextReleaseRequestIEs_t, ie3); + ie3->id = F1AP_ProtocolIE_ID_id_Cause; + ie3->criticality = F1AP_Criticality_ignore; + ie3->value.present = F1AP_UEContextReleaseRequestIEs__value_PR_Cause; switch (req->cause) { case F1AP_CAUSE_RADIO_NETWORK: - ie->value.choice.Cause.present = F1AP_Cause_PR_radioNetwork; - ie->value.choice.Cause.choice.radioNetwork = req->cause_value; + ie3->value.choice.Cause.present = F1AP_Cause_PR_radioNetwork; + ie3->value.choice.Cause.choice.radioNetwork = req->cause_value; break; case F1AP_CAUSE_TRANSPORT: - ie->value.choice.Cause.present = F1AP_Cause_PR_transport; - ie->value.choice.Cause.choice.transport = req->cause_value; + ie3->value.choice.Cause.present = F1AP_Cause_PR_transport; + ie3->value.choice.Cause.choice.transport = req->cause_value; break; case F1AP_CAUSE_PROTOCOL: - ie->value.choice.Cause.present = F1AP_Cause_PR_protocol; - ie->value.choice.Cause.choice.protocol = req->cause_value; + ie3->value.choice.Cause.present = F1AP_Cause_PR_protocol; + ie3->value.choice.Cause.choice.protocol = req->cause_value; break; case F1AP_CAUSE_MISC: - ie->value.choice.Cause.present = F1AP_Cause_PR_misc; - ie->value.choice.Cause.choice.misc = req->cause_value; + ie3->value.choice.Cause.present = F1AP_Cause_PR_misc; + ie3->value.choice.Cause.choice.misc = req->cause_value; break; case F1AP_CAUSE_NOTHING: default: - ie->value.choice.Cause.present = F1AP_Cause_PR_NOTHING; + ie3->value.choice.Cause.present = F1AP_Cause_PR_NOTHING; break; } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { LOG_E(F1AP, "Failed to encode F1 context release request\n"); @@ -723,7 +668,6 @@ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, if (RC.nrrrc[instance]->node_type == ngran_gNB_DU) { // struct rrc_gNB_ue_context_s *ue_context_p; - f1ap_ue_context_release_cplt_t cplt; cplt.rnti = ctxt.rnti; DU_send_UE_CONTEXT_RELEASE_COMPLETE(instance, &cplt); @@ -776,34 +720,30 @@ 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; + F1AP_F1AP_PDU_t pdu={0}; F1AP_UEContextReleaseComplete_t *out; - F1AP_UEContextReleaseCompleteIEs_t *ie; /* Create */ /* 0. Message Type */ - memset(&pdu, 0, sizeof(pdu)); pdu.present = F1AP_F1AP_PDU_PR_successfulOutcome; - pdu.choice.successfulOutcome = (F1AP_SuccessfulOutcome_t *)calloc(1, sizeof(F1AP_SuccessfulOutcome_t)); - pdu.choice.successfulOutcome->procedureCode = F1AP_ProcedureCode_id_UEContextRelease; - pdu.choice.successfulOutcome->criticality = F1AP_Criticality_reject; - pdu.choice.successfulOutcome->value.present = F1AP_SuccessfulOutcome__value_PR_UEContextReleaseComplete; - out = &pdu.choice.successfulOutcome->value.choice.UEContextReleaseComplete; + asn1cCalloc(pdu.choice.successfulOutcome, F1AP_SuccessfulOutcome_t, tmp); + tmp->procedureCode = F1AP_ProcedureCode_id_UEContextRelease; + tmp->criticality = F1AP_Criticality_reject; + tmp->value.present = F1AP_SuccessfulOutcome__value_PR_UEContextReleaseComplete; + out = &tmp->value.choice.UEContextReleaseComplete; /* mandatory */ /* c1. GNB_CU_UE_F1AP_ID */ - ie = (F1AP_UEContextReleaseCompleteIEs_t *)calloc(1, sizeof(F1AP_UEContextReleaseCompleteIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextReleaseCompleteIEs__value_PR_GNB_CU_UE_F1AP_ID; - ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(&f1ap_du_inst[instance], cplt->rnti); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextReleaseCompleteIEs_t, ie1); + 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); /* mandatory */ /* c2. GNB_DU_UE_F1AP_ID */ - ie = (F1AP_UEContextReleaseCompleteIEs_t *)calloc(1, sizeof(F1AP_UEContextReleaseCompleteIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextReleaseCompleteIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(&f1ap_du_inst[instance], cplt->rnti); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + 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); /* optional -> currently not used */ /* c3. CriticalityDiagnostics */ //if (0) { @@ -880,346 +820,274 @@ int DU_handle_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, //void DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(F1AP_UEContextModificationResponse_t *UEContextModificationResponse) { int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance) { - F1AP_F1AP_PDU_t pdu; + F1AP_F1AP_PDU_t pdu= {0}; F1AP_UEContextModificationResponse_t *out; - F1AP_UEContextModificationResponseIEs_t *ie; - uint8_t *buffer; - uint32_t len; - int i = 0; + uint8_t *buffer=NULL; + uint32_t len=0; /* Create */ /* 0. Message Type */ - memset(&pdu, 0, sizeof(pdu)); pdu.present = F1AP_F1AP_PDU_PR_successfulOutcome; - pdu.choice.successfulOutcome = (F1AP_SuccessfulOutcome_t *)calloc(1, sizeof(F1AP_SuccessfulOutcome_t)); - pdu.choice.successfulOutcome->procedureCode = F1AP_ProcedureCode_id_UEContextModification; - pdu.choice.successfulOutcome->criticality = F1AP_Criticality_reject; - pdu.choice.successfulOutcome->value.present = F1AP_SuccessfulOutcome__value_PR_UEContextModificationResponse; - out = &pdu.choice.successfulOutcome->value.choice.UEContextModificationResponse; + asn1cCalloc(pdu.choice.successfulOutcome,F1AP_SuccessfulOutcome_t, tmp); + tmp->procedureCode = F1AP_ProcedureCode_id_UEContextModification; + tmp->criticality = F1AP_Criticality_reject; + tmp->value.present = F1AP_SuccessfulOutcome__value_PR_UEContextModificationResponse; + out = &tmp->value.choice.UEContextModificationResponse; /* mandatory */ /* c1. GNB_CU_UE_F1AP_ID */ - ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_GNB_CU_UE_F1AP_ID; - ie->value.choice.GNB_CU_UE_F1AP_ID = 126L; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextModificationResponseIEs_t, ie1); + ie1->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; + ie1->criticality = F1AP_Criticality_reject; + ie1->value.present = F1AP_UEContextModificationResponseIEs__value_PR_GNB_CU_UE_F1AP_ID; + ie1->value.choice.GNB_CU_UE_F1AP_ID = 126L; /* mandatory */ /* c2. GNB_DU_UE_F1AP_ID */ - ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie->value.choice.GNB_DU_UE_F1AP_ID = 651L; - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextModificationResponseIEs_t, ie2); + ie2->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; + ie2->criticality = F1AP_Criticality_reject; + ie2->value.present = F1AP_UEContextModificationResponseIEs__value_PR_GNB_DU_UE_F1AP_ID; + ie2->value.choice.GNB_DU_UE_F1AP_ID = 651L; /* optional */ /* c3. ResourceCoordinationTransferContainer */ if (0) { - ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_ResourceCoordinationTransferContainer; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_ResourceCoordinationTransferContainer; - OCTET_STRING_fromBuf(&ie->value.choice.ResourceCoordinationTransferContainer, "asdsa1d32sa1d31asd31as", + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextModificationResponseIEs_t, ie3); + ie3->id = F1AP_ProtocolIE_ID_id_ResourceCoordinationTransferContainer; + ie3->criticality = F1AP_Criticality_ignore; + ie3->value.present = F1AP_UEContextModificationResponseIEs__value_PR_ResourceCoordinationTransferContainer; + OCTET_STRING_fromBuf(&ie3->value.choice.ResourceCoordinationTransferContainer, "asdsa1d32sa1d31asd31as", strlen("asdsa1d32sa1d31asd31as")); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } /* optional */ /* c4. DUtoCURRCInformation */ if (0) { - ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_DUtoCURRCInformation; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_DUtoCURRCInformation; - OCTET_STRING_fromBuf(&ie->value.choice.DUtoCURRCInformation.cellGroupConfig, "asdsa1d32sa1d31asd31as", + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextModificationResponseIEs_t, ie4); + ie4->id = F1AP_ProtocolIE_ID_id_DUtoCURRCInformation; + ie4->criticality = F1AP_Criticality_reject; + ie4->value.present = F1AP_UEContextModificationResponseIEs__value_PR_DUtoCURRCInformation; + OCTET_STRING_fromBuf(&ie4->value.choice.DUtoCURRCInformation.cellGroupConfig, "asdsa1d32sa1d31asd31as", strlen("asdsa1d32sa1d31asd31as")); /* OPTIONAL */ if (1) { - ie->value.choice.DUtoCURRCInformation.measGapConfig = (F1AP_MeasGapConfig_t *)calloc(1, sizeof(F1AP_MeasGapConfig_t)); - OCTET_STRING_fromBuf( ie->value.choice.DUtoCURRCInformation.measGapConfig, "asdsa1d32sa1d31asd31as", + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextModificationResponseIEs_t, ie41); + ie41->value.choice.DUtoCURRCInformation.measGapConfig = (F1AP_MeasGapConfig_t *)calloc(1, sizeof(F1AP_MeasGapConfig_t)); + OCTET_STRING_fromBuf( ie41->value.choice.DUtoCURRCInformation.measGapConfig, "asdsa1d32sa1d31asd31as", strlen("asdsa1d32sa1d31asd31as")); - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } } /* mandatory */ /* c5. DRBs_SetupMod_List */ - ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_DRBs_SetupMod_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_DRBs_SetupMod_List; + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextModificationResponseIEs_t, ie5); + ie5->id = F1AP_ProtocolIE_ID_id_DRBs_SetupMod_List; + ie5->criticality = F1AP_Criticality_reject; + ie5->value.present = F1AP_UEContextModificationResponseIEs__value_PR_DRBs_SetupMod_List; - for (i=0; - i<1; - i++) { + for (int i=0; i<1; i++) { // - F1AP_DRBs_SetupMod_ItemIEs_t *drbs_setupMod_item_ies; - drbs_setupMod_item_ies = (F1AP_DRBs_SetupMod_ItemIEs_t *)calloc(1, sizeof(F1AP_DRBs_SetupMod_ItemIEs_t)); + asn1cSequenceAdd(ie5->value.choice.DRBs_SetupMod_List.list, + F1AP_DRBs_SetupMod_ItemIEs_t, drbs_setupMod_item_ies); drbs_setupMod_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_SetupMod_Item; drbs_setupMod_item_ies->criticality = F1AP_Criticality_reject; drbs_setupMod_item_ies->value.present = F1AP_DRBs_SetupMod_ItemIEs__value_PR_DRBs_SetupMod_Item; /* 10.1 DRBs_SetupMod_Item */ - F1AP_DRBs_SetupMod_Item_t drbs_setupMod_item; - memset((void *)&drbs_setupMod_item, 0, sizeof(F1AP_DRBs_SetupMod_Item_t)); + F1AP_DRBs_SetupMod_Item_t *drbs_setupMod_item=&drbs_setupMod_item_ies->value.choice.DRBs_SetupMod_Item; /* dRBID */ - drbs_setupMod_item.dRBID = 30L; + drbs_setupMod_item->dRBID = 30L; /* DLTunnels_SetupMod_List */ - int j = 0; int maxnoofDLUPTNLInformation = 1; // 2; - for (j=0; - jvalue.choice.DRBs_SetupMod_List.list, + F1AP_DLUPTNLInformation_ToBeSetup_Item_t, dLUPTNLInformation_ToBeSetup_Item); dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; - F1AP_GTPTunnel_t *gTPTunnel = (F1AP_GTPTunnel_t *)calloc(1, sizeof(F1AP_GTPTunnel_t)); + asn1cCalloc(dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.choice.gTPTunnel, + F1AP_GTPTunnel_t, gTPTunnel); TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "1204", strlen("1204")); - dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.choice.gTPTunnel = gTPTunnel; - ASN_SEQUENCE_ADD(&drbs_setupMod_item.dLUPTNLInformation_ToBeSetup_List.list, dLUPTNLInformation_ToBeSetup_Item); } - - /* ADD */ - drbs_setupMod_item_ies->value.choice.DRBs_SetupMod_Item = drbs_setupMod_item; - ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_SetupMod_List.list, - drbs_setupMod_item_ies); } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ /* c6. DRBs_Modified_List */ - ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_DRBs_Modified_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_DRBs_Modified_List; + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextModificationResponseIEs_t, ie6); + ie6->id = F1AP_ProtocolIE_ID_id_DRBs_Modified_List; + ie6->criticality = F1AP_Criticality_reject; + ie6->value.present = F1AP_UEContextModificationResponseIEs__value_PR_DRBs_Modified_List; - for (i=0; - i<1; - i++) { + for (int i=0; i<1; i++) { // - F1AP_DRBs_Modified_ItemIEs_t *drbs_modified_item_ies; - drbs_modified_item_ies = (F1AP_DRBs_Modified_ItemIEs_t *)calloc(1, sizeof(F1AP_DRBs_Modified_ItemIEs_t)); + asn1cSequenceAdd(ie6->value.choice.DRBs_Modified_List.list, + F1AP_DRBs_Modified_ItemIEs_t, drbs_modified_item_ies); drbs_modified_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_Modified_Item; drbs_modified_item_ies->criticality = F1AP_Criticality_reject; drbs_modified_item_ies->value.present = F1AP_DRBs_Modified_ItemIEs__value_PR_DRBs_Modified_Item; /* 13.1 SRBs_modified_Item */ - F1AP_DRBs_Modified_Item_t drbs_modified_item; - memset((void *)&drbs_modified_item, 0, sizeof(F1AP_DRBs_Modified_Item_t)); + F1AP_DRBs_Modified_Item_t *drbs_modified_item= + &drbs_modified_item_ies->value.choice.DRBs_Modified_Item; /* dRBID */ - drbs_modified_item.dRBID = 25L; + drbs_modified_item->dRBID = 25L; /* ULTunnels_Modified_List */ int maxnoofULTunnels = 1; // 2; - int j = 0; - for (j=0; - jdLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; - F1AP_GTPTunnel_t *gTPTunnel = (F1AP_GTPTunnel_t *)calloc(1, sizeof(F1AP_GTPTunnel_t)); + asn1cSequenceAdd(drbs_modified_item->dLUPTNLInformation_ToBeSetup_List.list, + F1AP_DLUPTNLInformation_ToBeSetup_Item_t, dLUPTNLInformation_ToBeSetup_Item); + asn1cCalloc(dLUPTNLInformation_ToBeSetup_Item, F1AP_DLUPTNLInformation_ToBeSetup_Item_t, tmp); + tmp->dLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; + asn1cCalloc(dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.choice.gTPTunnel, + F1AP_GTPTunnel_t, gTPTunnel); TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); - OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "1204", - strlen("1204")); - dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.choice.gTPTunnel = gTPTunnel; - ASN_SEQUENCE_ADD(&drbs_modified_item.dLUPTNLInformation_ToBeSetup_List.list, dLUPTNLInformation_ToBeSetup_Item); + OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "1204", strlen("1204")); } - - /* ADD */ - drbs_modified_item_ies->value.choice.DRBs_Modified_Item = drbs_modified_item; - ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_Modified_List.list, - drbs_modified_item_ies); } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ /* c7. SRBs_FailedToBeSetupMod_List */ - ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_SRBs_FailedToBeSetupMod_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_SRBs_FailedToBeSetupMod_List; + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextModificationResponseIEs_t, ie7); + ie7->id = F1AP_ProtocolIE_ID_id_SRBs_FailedToBeSetupMod_List; + ie7->criticality = F1AP_Criticality_reject; + ie7->value.present = F1AP_UEContextModificationResponseIEs__value_PR_SRBs_FailedToBeSetupMod_List; - for (i=0; - i<1; - i++) { + for (int i=0; i<1; i++) { // - F1AP_SRBs_FailedToBeSetupMod_ItemIEs_t *srbs_failedToBeSetupMod_item_ies; - srbs_failedToBeSetupMod_item_ies = (F1AP_SRBs_FailedToBeSetupMod_ItemIEs_t *)calloc(1, sizeof(F1AP_SRBs_FailedToBeSetupMod_ItemIEs_t)); + asn1cSequenceAdd(ie7->value.choice.SRBs_FailedToBeSetupMod_List.list, + F1AP_SRBs_FailedToBeSetupMod_ItemIEs_t, srbs_failedToBeSetupMod_item_ies); srbs_failedToBeSetupMod_item_ies->id = F1AP_ProtocolIE_ID_id_SRBs_FailedToBeSetupMod_Item; srbs_failedToBeSetupMod_item_ies->criticality = F1AP_Criticality_ignore; srbs_failedToBeSetupMod_item_ies->value.present = F1AP_SRBs_FailedToBeSetupMod_ItemIEs__value_PR_SRBs_FailedToBeSetupMod_Item; /* 9.1 SRBs_FailedToBeSetupMod_Item */ - F1AP_SRBs_FailedToBeSetupMod_Item_t srbs_failedToBeSetupMod_item; - memset((void *)&srbs_failedToBeSetupMod_item, 0, sizeof(F1AP_SRBs_FailedToBeSetupMod_Item_t)); + F1AP_SRBs_FailedToBeSetupMod_Item_t *srbs_failedToBeSetupMod_item= + &srbs_failedToBeSetupMod_item_ies->value.choice.SRBs_FailedToBeSetupMod_Item; /* - sRBID */ - srbs_failedToBeSetupMod_item.sRBID = 50L; - srbs_failedToBeSetupMod_item.cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t)); - srbs_failedToBeSetupMod_item.cause->present = F1AP_Cause_PR_radioNetwork; - srbs_failedToBeSetupMod_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnb_du_ue_f1ap_id; - /* ADD */ - srbs_failedToBeSetupMod_item_ies->value.choice.SRBs_FailedToBeSetupMod_Item = srbs_failedToBeSetupMod_item; - ASN_SEQUENCE_ADD(&ie->value.choice.SRBs_FailedToBeSetupMod_List.list, - srbs_failedToBeSetupMod_item_ies); + srbs_failedToBeSetupMod_item->sRBID = 50L; + asn1cCalloc(srbs_failedToBeSetupMod_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; } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ /* c8. DRBs_FailedToBeSetupMod_List */ - ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_DRBs_FailedToBeSetupMod_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_DRBs_FailedToBeSetupMod_List; + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextModificationResponseIEs_t, ie8); + ie8->id = F1AP_ProtocolIE_ID_id_DRBs_FailedToBeSetupMod_List; + ie8->criticality = F1AP_Criticality_reject; + ie8->value.present = F1AP_UEContextModificationResponseIEs__value_PR_DRBs_FailedToBeSetupMod_List; - for (i=0; - i<1; - i++) { + for (int i=0; i<1; i++) { // - F1AP_DRBs_FailedToBeSetupMod_ItemIEs_t *drbs_failedToBeSetupMod_item_ies; - drbs_failedToBeSetupMod_item_ies = (F1AP_DRBs_FailedToBeSetupMod_ItemIEs_t *)calloc(1, sizeof(F1AP_DRBs_FailedToBeSetupMod_ItemIEs_t)); + asn1cSequenceAdd(ie8->value.choice.DRBs_FailedToBeSetupMod_List.list, + F1AP_DRBs_FailedToBeSetupMod_ItemIEs_t, drbs_failedToBeSetupMod_item_ies); drbs_failedToBeSetupMod_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_FailedToBeSetupMod_Item; drbs_failedToBeSetupMod_item_ies->criticality = F1AP_Criticality_reject; drbs_failedToBeSetupMod_item_ies->value.present = F1AP_DRBs_FailedToBeSetupMod_ItemIEs__value_PR_DRBs_FailedToBeSetupMod_Item; /* 10.1 DRBs_ToBeSetupMod_Item */ - F1AP_DRBs_FailedToBeSetupMod_Item_t drbs_failedToBeSetupMod_item; - memset((void *)&drbs_failedToBeSetupMod_item, 0, sizeof(F1AP_DRBs_FailedToBeSetupMod_Item_t)); + F1AP_DRBs_FailedToBeSetupMod_Item_t *drbs_failedToBeSetupMod_item= + &drbs_failedToBeSetupMod_item_ies->value.choice.DRBs_FailedToBeSetupMod_Item; /* dRBID */ - drbs_failedToBeSetupMod_item.dRBID = 30L; - drbs_failedToBeSetupMod_item.cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t)); - drbs_failedToBeSetupMod_item.cause->present = F1AP_Cause_PR_radioNetwork; - drbs_failedToBeSetupMod_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnb_du_ue_f1ap_id; - /* ADD */ - drbs_failedToBeSetupMod_item_ies->value.choice.DRBs_FailedToBeSetupMod_Item = drbs_failedToBeSetupMod_item; - ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_FailedToBeSetupMod_List.list, - drbs_failedToBeSetupMod_item_ies); + drbs_failedToBeSetupMod_item->dRBID = 30L; + drbs_failedToBeSetupMod_item->cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t)); + drbs_failedToBeSetupMod_item->cause->present = F1AP_Cause_PR_radioNetwork; + drbs_failedToBeSetupMod_item->cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnb_du_ue_f1ap_id; } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ /* c9. SCell_FailedtoSetupMod_List */ - ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_SCell_FailedtoSetupMod_List; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_SCell_FailedtoSetupMod_List; + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextModificationResponseIEs_t, ie9); + ie9->id = F1AP_ProtocolIE_ID_id_SCell_FailedtoSetupMod_List; + ie9->criticality = F1AP_Criticality_ignore; + ie9->value.present = F1AP_UEContextModificationResponseIEs__value_PR_SCell_FailedtoSetupMod_List; - for (i=0; - i<1; - i++) { + for (int i=0; i<1; i++) { // - F1AP_SCell_FailedtoSetupMod_ItemIEs_t *scell_failedtoSetupMod_item_ies; - scell_failedtoSetupMod_item_ies = (F1AP_SCell_FailedtoSetupMod_ItemIEs_t *)calloc(1, sizeof(F1AP_SCell_FailedtoSetupMod_ItemIEs_t)); + asn1cSequenceAdd(ie9->value.choice.SCell_FailedtoSetupMod_List.list, + F1AP_SCell_FailedtoSetupMod_ItemIEs_t, scell_failedtoSetupMod_item_ies); scell_failedtoSetupMod_item_ies->id = F1AP_ProtocolIE_ID_id_SCell_FailedtoSetupMod_Item; scell_failedtoSetupMod_item_ies->criticality = F1AP_Criticality_ignore; scell_failedtoSetupMod_item_ies->value.present = F1AP_SCell_FailedtoSetupMod_ItemIEs__value_PR_SCell_FailedtoSetupMod_Item; /* 8.1 SCell_ToBeSetup_Item */ - F1AP_SCell_FailedtoSetupMod_Item_t scell_failedtoSetupMod_item; - memset((void *)&scell_failedtoSetupMod_item, 0, sizeof(F1AP_SCell_FailedtoSetupMod_Item_t)); + F1AP_SCell_FailedtoSetupMod_Item_t *scell_failedtoSetupMod_item=&scell_failedtoSetupMod_item_ies->value.choice.SCell_FailedtoSetupMod_Item; /* - sCell_ID */ - F1AP_NRCGI_t nRCGI; - memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t)); - MCC_MNC_TO_PLMNID(f1ap_du_data->mcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], - &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[0], &nRCGI.nRCellIdentity); - scell_failedtoSetupMod_item.sCell_ID = nRCGI; - scell_failedtoSetupMod_item.cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t)); - scell_failedtoSetupMod_item.cause->present = F1AP_Cause_PR_radioNetwork; - scell_failedtoSetupMod_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnb_du_ue_f1ap_id; - /* ADD */ - scell_failedtoSetupMod_item_ies->value.choice.SCell_FailedtoSetupMod_Item = scell_failedtoSetupMod_item; - ASN_SEQUENCE_ADD(&ie->value.choice.SCell_FailedtoSetupMod_List.list, - scell_failedtoSetupMod_item_ies); + addnRCGI(scell_failedtoSetupMod_item->sCell_ID, &f1ap_du_data->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; } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ /* c10. DRBs_FailedToBeModified_List */ - ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_DRBs_FailedToBeModified_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_DRBs_FailedToBeModified_List; + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextModificationResponseIEs_t, ie10); + ie10->id = F1AP_ProtocolIE_ID_id_DRBs_FailedToBeModified_List; + ie10->criticality = F1AP_Criticality_reject; + ie10->value.present = F1AP_UEContextModificationResponseIEs__value_PR_DRBs_FailedToBeModified_List; - for (i=0; - i<1; - i++) { + for (int i=0; i<1; i++) { // - F1AP_DRBs_FailedToBeModified_ItemIEs_t *drbs_failedToBeModified_item_ies; - drbs_failedToBeModified_item_ies = (F1AP_DRBs_FailedToBeModified_ItemIEs_t *)calloc(1, sizeof(F1AP_DRBs_FailedToBeModified_ItemIEs_t)); + asn1cSequenceAdd(ie10->value.choice.DRBs_FailedToBeModified_List.list, + F1AP_DRBs_FailedToBeModified_ItemIEs_t, drbs_failedToBeModified_item_ies); drbs_failedToBeModified_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_FailedToBeModified_Item; drbs_failedToBeModified_item_ies->criticality = F1AP_Criticality_reject; drbs_failedToBeModified_item_ies->value.present = F1AP_DRBs_FailedToBeModified_ItemIEs__value_PR_DRBs_FailedToBeModified_Item; /* 13.1 DRBs_FailedToBeModified_Item */ - F1AP_DRBs_FailedToBeModified_Item_t drbs_failedToBeModified_item; - memset((void *)&drbs_failedToBeModified_item, 0, sizeof(F1AP_DRBs_FailedToBeModified_Item_t)); + F1AP_DRBs_FailedToBeModified_Item_t *drbs_failedToBeModified_item= + &drbs_failedToBeModified_item_ies->value.choice.DRBs_FailedToBeModified_Item ; /* dRBID */ - drbs_failedToBeModified_item.dRBID = 30L; - drbs_failedToBeModified_item.cause = (F1AP_Cause_t *)calloc(1, sizeof(F1AP_Cause_t)); - drbs_failedToBeModified_item.cause->present = F1AP_Cause_PR_radioNetwork; - drbs_failedToBeModified_item.cause->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnb_du_ue_f1ap_id; - /* ADD */ - drbs_failedToBeModified_item_ies->value.choice.DRBs_FailedToBeModified_Item = drbs_failedToBeModified_item; - ASN_SEQUENCE_ADD(&ie->value.choice.DRBs_FailedToBeModified_List.list, - drbs_failedToBeModified_item_ies); + drbs_failedToBeModified_item->dRBID = 30L; + asn1cCalloc(drbs_failedToBeModified_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; } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - // /* */ /* c11. CriticalityDiagnostics */ if (0) { - ie = (F1AP_UEContextModificationResponseIEs_t *)calloc(1, sizeof(F1AP_UEContextModificationResponseIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_CriticalityDiagnostics; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_UEContextModificationResponseIEs__value_PR_CriticalityDiagnostics; + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextModificationResponseIEs_t, ie11); + ie11->id = F1AP_ProtocolIE_ID_id_CriticalityDiagnostics; + ie11->criticality = F1AP_Criticality_ignore; + ie11->value.present = F1AP_UEContextModificationResponseIEs__value_PR_CriticalityDiagnostics; // dummy value /* optional */ /* procedureCode */ if (0) { - ie->value.choice.CriticalityDiagnostics.procedureCode = (F1AP_ProcedureCode_t *)calloc(1, sizeof(F1AP_ProcedureCode_t)); - ie->value.choice.CriticalityDiagnostics.procedureCode = 0L; + ie11->value.choice.CriticalityDiagnostics.procedureCode = (F1AP_ProcedureCode_t *)calloc(1, sizeof(F1AP_ProcedureCode_t)); + ie11->value.choice.CriticalityDiagnostics.procedureCode = 0L; } /* optional */ /* triggeringMessage */ if (0) { - ie->value.choice.CriticalityDiagnostics.triggeringMessage = (F1AP_TriggeringMessage_t *)calloc(1, sizeof(F1AP_TriggeringMessage_t)); - ie->value.choice.CriticalityDiagnostics.triggeringMessage = (F1AP_TriggeringMessage_t *)F1AP_TriggeringMessage_successful_outcome; + ie11->value.choice.CriticalityDiagnostics.triggeringMessage = (F1AP_TriggeringMessage_t *)calloc(1, sizeof(F1AP_TriggeringMessage_t)); + *ie11->value.choice.CriticalityDiagnostics.triggeringMessage = F1AP_TriggeringMessage_successful_outcome; } /* optional */ /* procedureCriticality */ if (0) { - ie->value.choice.CriticalityDiagnostics.procedureCriticality = (F1AP_Criticality_t *)calloc(1, sizeof(F1AP_Criticality_t)); - ie->value.choice.CriticalityDiagnostics.procedureCriticality = F1AP_Criticality_reject; + ie11->value.choice.CriticalityDiagnostics.procedureCriticality = (F1AP_Criticality_t *)calloc(1, sizeof(F1AP_Criticality_t)); + ie11->value.choice.CriticalityDiagnostics.procedureCriticality = F1AP_Criticality_reject; } /* optional */ /* transactionID */ if (0) { - ie->value.choice.CriticalityDiagnostics.transactionID = (F1AP_TransactionID_t *)calloc(1, sizeof(F1AP_TransactionID_t)); - ie->value.choice.CriticalityDiagnostics.transactionID = 0L; + ie11->value.choice.CriticalityDiagnostics.transactionID = (F1AP_TransactionID_t *)calloc(1, sizeof(F1AP_TransactionID_t)); + ie11->value.choice.CriticalityDiagnostics.transactionID = 0L; } /* optional */ /* F1AP_CriticalityDiagnostics_IE_List */ if (0) { - for (i=0; - i<0; - i++) { - F1AP_CriticalityDiagnostics_IE_Item_t *criticalityDiagnostics_ie_item = (F1AP_CriticalityDiagnostics_IE_Item_t *)calloc(1, sizeof(F1AP_CriticalityDiagnostics_IE_Item_t));; + for (int i=0; i<0; i++) { + asn1cSequenceAdd(ie11->value.choice.CriticalityDiagnostics.iEsCriticalityDiagnostics->list, F1AP_CriticalityDiagnostics_IE_Item_t, criticalityDiagnostics_ie_item); criticalityDiagnostics_ie_item->iECriticality = F1AP_Criticality_reject; criticalityDiagnostics_ie_item->iE_ID = 0L; criticalityDiagnostics_ie_item->typeOfError = F1AP_TypeOfError_not_understood; - ASN_SEQUENCE_ADD(&ie->value.choice.CriticalityDiagnostics.iEsCriticalityDiagnostics->list, - criticalityDiagnostics_ie_item); } } - - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } /* encode */ diff --git a/openair2/F1AP/f1ap_du_ue_context_management.h b/openair2/F1AP/f1ap_du_ue_context_management.h index 2bb3ca95b9..fa2044ba22 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.h +++ b/openair2/F1AP/f1ap_du_ue_context_management.h @@ -55,9 +55,9 @@ int DU_send_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, * UE Context Release Command (gNB-CU initiated) */ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); /* * UE Context Release Complete (gNB-DU initiated) @@ -70,9 +70,9 @@ int DU_send_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, * UE Context Modification (gNB-CU initiated) */ int DU_handle_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance); int DU_send_UE_CONTEXT_MODIFICATION_FAILURE(instance_t instance); @@ -82,9 +82,9 @@ int DU_send_UE_CONTEXT_MODIFICATION_FAILURE(instance_t instance); */ int DU_send_UE_CONTEXT_MODIFICATION_REQUIRED(instance_t instance); int DU_handle_UE_CONTEXT_MODIFICATION_CONFIRM(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); + uint32_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); /* * UE Inactivity Notification diff --git a/openair2/F1AP/f1ap_encoder.c b/openair2/F1AP/f1ap_encoder.c index 1dbfd707c0..ce1311ff3a 100644 --- a/openair2/F1AP/f1ap_encoder.c +++ b/openair2/F1AP/f1ap_encoder.c @@ -71,8 +71,7 @@ int f1ap_encode_ue_context_release_request( uint32_t *length); */ -int f1ap_encode_pdu(F1AP_F1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *length) -{ +int f1ap_encode_pdu(F1AP_F1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *length) { ssize_t encoded; DevAssert(pdu != NULL); DevAssert(buffer != NULL); @@ -92,7 +91,6 @@ int f1ap_encode_pdu(F1AP_F1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *length) } *length = encoded; - return encoded; } diff --git a/openair2/F1AP/f1ap_handlers.c b/openair2/F1AP/f1ap_handlers.c index 5aca059ae4..fd8ec0e2e6 100644 --- a/openair2/F1AP/f1ap_handlers.c +++ b/openair2/F1AP/f1ap_handlers.c @@ -44,7 +44,7 @@ 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] = { - + { 0, 0, 0 }, /* Reset */ { CU_handle_F1_SETUP_REQUEST, DU_handle_F1_SETUP_RESPONSE, DU_handle_F1_SETUP_FAILURE }, /* F1Setup */ @@ -73,25 +73,21 @@ f1ap_message_decoded_callback f1ap_messages_callback[][3] = { }; const char *f1ap_direction2String(int f1ap_dir) { -static const char *f1ap_direction_String[] = { - "", /* Nothing */ - "Initiating message", /* initiating message */ - "Successfull outcome", /* successfull outcome */ - "UnSuccessfull outcome", /* successfull outcome */ -}; -return(f1ap_direction_String[f1ap_dir]); + static const char *f1ap_direction_String[] = { + "", /* Nothing */ + "Initiating message", /* initiating message */ + "Successfull outcome", /* successfull outcome */ + "UnSuccessfull outcome", /* successfull outcome */ + }; + return(f1ap_direction_String[f1ap_dir]); } int f1ap_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, - const uint8_t * const data, const uint32_t data_length) -{ - F1AP_F1AP_PDU_t pdu; + const uint8_t *const data, const uint32_t data_length) { + F1AP_F1AP_PDU_t pdu= {0}; int ret; - DevAssert(data != NULL); - memset(&pdu, 0, sizeof(pdu)); - if (f1ap_decode_pdu(&pdu, data, data_length) < 0) { LOG_E(F1AP, "Failed to decode PDU\n"); return -1; @@ -102,7 +98,7 @@ int f1ap_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, f1ap_message_decoded_callback)) || (pdu.present > F1AP_F1AP_PDU_PR_unsuccessfulOutcome)) { LOG_E(F1AP, "[SCTP %d] Either procedureCode %ld or direction %d exceed expected\n", - assoc_id, pdu.choice.initiatingMessage->procedureCode, pdu.present); + assoc_id, pdu.choice.initiatingMessage->procedureCode, pdu.present); ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, &pdu); return -1; } @@ -112,8 +108,8 @@ int f1ap_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, */ if (f1ap_messages_callback[pdu.choice.initiatingMessage->procedureCode][pdu.present - 1] == NULL) { LOG_E(F1AP, "[SCTP %d] No handler for procedureCode %ld in %s\n", - assoc_id, pdu.choice.initiatingMessage->procedureCode, - f1ap_direction2String(pdu.present - 1)); + assoc_id, pdu.choice.initiatingMessage->procedureCode, + f1ap_direction2String(pdu.present - 1)); ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, &pdu); return -1; } diff --git a/openair2/F1AP/f1ap_handlers.h b/openair2/F1AP/f1ap_handlers.h index 631249a324..7a0b891f62 100644 --- a/openair2/F1AP/f1ap_handlers.h +++ b/openair2/F1AP/f1ap_handlers.h @@ -34,6 +34,6 @@ #define F1AP_HANDLERS_H_ int f1ap_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, - const uint8_t * const data, const uint32_t data_length); + const uint8_t *const data, const uint32_t data_length); #endif /* F1AP_HANDLERS_H_ */ diff --git a/openair2/F1AP/f1ap_itti_messaging.c b/openair2/F1AP/f1ap_itti_messaging.c index 443357a45e..94f844f367 100644 --- a/openair2/F1AP/f1ap_itti_messaging.c +++ b/openair2/F1AP/f1ap_itti_messaging.c @@ -23,51 +23,38 @@ #include "f1ap_itti_messaging.h" void cu_f1ap_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer, - uint32_t buffer_length, uint16_t stream) -{ + 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); - 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) -{ + 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->buffer = buffer; sctp_data_req->buffer_length = buffer_length; sctp_data_req->stream = stream; - LOG_I(F1AP, "Sending ITTI message to SCTP Task\n"); 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(instance_t instance, int32_t assoc_id) { 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; - itti_send_msg_to_task(TASK_SCTP, instance, message_p); } diff --git a/openair2/F1AP/f1ap_itti_messaging.h b/openair2/F1AP/f1ap_itti_messaging.h index 66c59a72e7..b32785035d 100644 --- a/openair2/F1AP/f1ap_itti_messaging.h +++ b/openair2/F1AP/f1ap_itti_messaging.h @@ -23,10 +23,10 @@ #define F1AP_ITTI_MESSAGING_H_ void cu_f1ap_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer, - uint32_t buffer_length, uint16_t stream); + 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); + uint32_t buffer_length, uint16_t stream); void f1ap_eNB_itti_send_sctp_close_association(instance_t instance, int32_t assoc_id); diff --git a/openair2/F1AP/f1ap_messaging.c b/openair2/F1AP/f1ap_messaging.c deleted file mode 100644 index fb189eaed3..0000000000 --- a/openair2/F1AP/f1ap_messaging.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file f1ap_messaging.c - * \brief f1ap procedures - * \author EURECOM/NTUST - * \date 2018 - * \version 0.1 - * \company Eurecom - * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr - * \note - * \warning - */ - - -#include "f1ap_common.h" -#include "f1ap_messaging.h" - -// void f1ap_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_F1AP, 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 f1ap_send_sctp_close_association(instance_t instance, int32_t assoc_id) -// { -// MessageDef *message_p = NULL; -// sctp_close_association_t *sctp_close_association_p = NULL; - -// message_p = itti_alloc_new_message(TASK_F1AP, SCTP_CLOSE_ASSOCIATION); -// sctp_close_association_p = &message_p->ittiMsg.sctp_close_association; -// sctp_close_association_p->assoc_id = assoc_id; - -// itti_send_msg_to_task(TASK_SCTP, instance, message_p); -// } - diff --git a/openair2/F1AP/f1ap_messaging.h b/openair2/F1AP/f1ap_messaging.h index 9ad0388d01..eb3b4224e9 100644 --- a/openair2/F1AP/f1ap_messaging.h +++ b/openair2/F1AP/f1ap_messaging.h @@ -35,10 +35,10 @@ #define F1AP_MESSAGING_H_ void f1ap_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer, - uint32_t buffer_length, uint16_t stream); + uint32_t buffer_length, uint16_t stream); void f1ap_send_sctp_close_association(instance_t instance, - int32_t assoc_id); + int32_t assoc_id); #endif /* F1AP_MESSAGING_H_ */ diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 643dd0096c..1313ca9594 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -1666,20 +1666,20 @@ int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) { LOG_I(GNB_APP,"F1AP: gNB_DU_id[%d] %ld\n",k,F1AP_SETUP_REQ (msg_p).gNB_DU_id); F1AP_SETUP_REQ (msg_p).gNB_DU_name = strdup(*(GNBParamList.paramarray[0][GNB_GNB_NAME_IDX].strptr)); LOG_I(GNB_APP,"F1AP: gNB_DU_name[%d] %s\n",k,F1AP_SETUP_REQ (msg_p).gNB_DU_name); - F1AP_SETUP_REQ (msg_p).tac[k] = *GNBParamList.paramarray[i][GNB_TRACKING_AREA_CODE_IDX].uptr; - LOG_I(GNB_APP,"F1AP: tac[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).tac[k]); - F1AP_SETUP_REQ (msg_p).mcc[k] = *PLMNParamList.paramarray[0][GNB_MOBILE_COUNTRY_CODE_IDX].uptr; - LOG_I(GNB_APP,"F1AP: mcc[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).mcc[k]); - F1AP_SETUP_REQ (msg_p).mnc[k] = *PLMNParamList.paramarray[0][GNB_MOBILE_NETWORK_CODE_IDX].uptr; - LOG_I(GNB_APP,"F1AP: mnc[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).mnc[k]); - F1AP_SETUP_REQ (msg_p).mnc_digit_length[k] = *PLMNParamList.paramarray[0][GNB_MNC_DIGIT_LENGTH].u8ptr; - LOG_I(GNB_APP,"F1AP: mnc_digit_length[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).mnc_digit_length[k]); - AssertFatal((F1AP_SETUP_REQ (msg_p).mnc_digit_length[k] == 2) || - (F1AP_SETUP_REQ (msg_p).mnc_digit_length[k] == 3), + F1AP_SETUP_REQ (msg_p).cell[k].tac = *GNBParamList.paramarray[i][GNB_TRACKING_AREA_CODE_IDX].uptr; + LOG_I(GNB_APP,"F1AP: tac[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).cell[k].tac); + F1AP_SETUP_REQ (msg_p).cell[k].mcc = *PLMNParamList.paramarray[0][GNB_MOBILE_COUNTRY_CODE_IDX].uptr; + LOG_I(GNB_APP,"F1AP: mcc[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).cell[k].mcc); + F1AP_SETUP_REQ (msg_p).cell[k].mnc = *PLMNParamList.paramarray[0][GNB_MOBILE_NETWORK_CODE_IDX].uptr; + LOG_I(GNB_APP,"F1AP: mnc[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).cell[k].mnc); + F1AP_SETUP_REQ (msg_p).cell[k].mnc_digit_length = *PLMNParamList.paramarray[0][GNB_MNC_DIGIT_LENGTH].u8ptr; + LOG_I(GNB_APP,"F1AP: mnc_digit_length[%d] %d\n",k,F1AP_SETUP_REQ (msg_p).cell[k].mnc_digit_length); + AssertFatal((F1AP_SETUP_REQ (msg_p).cell[k].mnc_digit_length == 2) || + (F1AP_SETUP_REQ (msg_p).cell[k].mnc_digit_length == 3), "BAD MNC DIGIT LENGTH %d", - F1AP_SETUP_REQ (msg_p).mnc_digit_length[k]); - F1AP_SETUP_REQ (msg_p).nr_cellid[k] = (uint64_t)*(GNBParamList.paramarray[i][GNB_NRCELLID_IDX].u64ptr); - LOG_I(GNB_APP,"F1AP: nr_cellid[%d] %ld\n",k,F1AP_SETUP_REQ (msg_p).nr_cellid[k]); + F1AP_SETUP_REQ (msg_p).cell[k].mnc_digit_length); + F1AP_SETUP_REQ (msg_p).cell[k].nr_cellid = (uint64_t)*(GNBParamList.paramarray[i][GNB_NRCELLID_IDX].u64ptr); + LOG_I(GNB_APP,"F1AP: nr_cellid[%d] %ld\n",k,F1AP_SETUP_REQ (msg_p).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,"FIAP: CU_ip4_address in DU %p, strlen %d\n",F1AP_SETUP_REQ (msg_p).CU_f1_ip_address.ipv4_address,(int)strlen(RC.nrmac[k]->eth_params_n.remote_addr)); F1AP_SETUP_REQ (msg_p).CU_f1_ip_address.ipv6 = 0; @@ -1709,12 +1709,12 @@ int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) { pthread_mutex_unlock(&rrc->cell_info_mutex); } while (cell_info_configured == 0); - rrc->configuration.mcc[0] = F1AP_SETUP_REQ (msg_p).mcc[k]; - rrc->configuration.mnc[0] = F1AP_SETUP_REQ (msg_p).mnc[k]; - rrc->configuration.tac = F1AP_SETUP_REQ (msg_p).tac[k]; - rrc->nr_cellid = F1AP_SETUP_REQ (msg_p).nr_cellid[k]; - F1AP_SETUP_REQ (msg_p).nr_pci[k] = *rrc->configuration.scc->physCellId; - F1AP_SETUP_REQ (msg_p).num_ssi[k] = 0; + rrc->configuration.mcc[0] = F1AP_SETUP_REQ (msg_p).cell[k].mcc; + rrc->configuration.mnc[0] = F1AP_SETUP_REQ (msg_p).cell[k].mnc; + rrc->configuration.tac = F1AP_SETUP_REQ (msg_p).cell[k].tac; + rrc->nr_cellid = F1AP_SETUP_REQ (msg_p).cell[k].nr_cellid; + F1AP_SETUP_REQ (msg_p).cell[k].nr_pci = *rrc->configuration.scc->physCellId; + F1AP_SETUP_REQ (msg_p).cell[k].num_ssi = 0; if (rrc->configuration.scc->tdd_UL_DL_ConfigurationCommon) { LOG_I(GNB_APP,"ngran_DU: Configuring Cell %d for TDD\n",k); diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h index 0c3dd2f04f..e19acd335c 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h @@ -544,6 +544,7 @@ extern notifiedFIFO_t pdcp_sdu_list; (((hash_key_t)(0x0000000000000001)) << 63)) extern hash_table_t *pdcp_coll_p; +void init_pdcp(void); #endif /*@}*/ diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 881e5b8ad1..dcf575392c 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -8518,9 +8518,9 @@ void handle_f1_setup_req(f1ap_setup_req_t *f1_setup_req) { for (int j=0; jconfiguration.mcc[0] == f1_setup_req->mcc[i] && - rrc->configuration.mnc[0] == f1_setup_req->mnc[i] && - rrc->nr_cellid == f1_setup_req->nr_cellid[i]) { + if (rrc->configuration.mcc[0] == f1_setup_req->cell[i].mcc && + rrc->configuration.mnc[0] == f1_setup_req->cell[i].mnc && + rrc->nr_cellid == f1_setup_req->cell[i].nr_cellid) { // check that CU rrc instance corresponds to mcc/mnc/cgi (normally cgi should be enough, but just in case) rrc->carrier[0].MIB = malloc(f1_setup_req->mib_length[i]); rrc->carrier[0].sizeof_MIB = f1_setup_req->mib_length[i]; @@ -8560,7 +8560,7 @@ void handle_f1_setup_req(f1ap_setup_req_t *f1_setup_req) { AssertFatal(bcch_message->message.choice.c1.present == LTE_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1, "bcch_message->message.choice.c1.present != LTE_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1\n"); rrc->carrier[0].sib1 = &bcch_message->message.choice.c1.choice.systemInformationBlockType1; - rrc->carrier[0].physCellId = f1_setup_req->nr_pci[i]; + rrc->carrier[0].physCellId = f1_setup_req->cell[i].nr_pci; // prepare F1_SETUP_RESPONSE if (msg_p == NULL) { @@ -8572,7 +8572,7 @@ void handle_f1_setup_req(f1ap_setup_req_t *f1_setup_req) { F1AP_SETUP_RESP (msg_p).cells_to_activate[cu_cell_ind].mnc = rrc->configuration.mnc[0]; F1AP_SETUP_RESP (msg_p).cells_to_activate[cu_cell_ind].mnc_digit_length = rrc->configuration.mnc_digit_length[0]; F1AP_SETUP_RESP (msg_p).cells_to_activate[cu_cell_ind].nr_cellid = rrc->nr_cellid; - F1AP_SETUP_RESP (msg_p).cells_to_activate[cu_cell_ind].nrpci = f1_setup_req->nr_pci[i]; + F1AP_SETUP_RESP (msg_p).cells_to_activate[cu_cell_ind].nrpci = f1_setup_req->cell[i].nr_pci; int num_SI= 0; if (rrc->carrier[0].SIB23) { @@ -8594,7 +8594,7 @@ void handle_f1_setup_req(f1ap_setup_req_t *f1_setup_req) { break; } else {// setup_req mcc/mnc match rrc internal list element LOG_W(RRC,"[Inst %d] No matching MCC/MNC: rrc->mcc/f1_setup_req->mcc %d/%d rrc->mnc/f1_setup_req->mnc %d/%d \n", - j, rrc->configuration.mcc[0], f1_setup_req->mcc[i],rrc->configuration.mnc[0], f1_setup_req->mnc[i]); + j, rrc->configuration.mcc[0], f1_setup_req->cell[i].mcc,rrc->configuration.mnc[0], f1_setup_req->cell[i].mnc); } }// for (int j=0;jmodule_id]; NR_ServingCellConfigCommon_t *scc=rrc_instance_p->carrier.servingcellconfigcommon; @@ -559,7 +557,6 @@ rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest( ue_context_pP = rrc_gNB_get_next_free_ue_context(ctxt_pP, rrc_instance_p, 0); gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context; - SRB_configList = &ue_p->SRB_configList; ue_p->Srb0.Tx_buffer.payload_size = do_RRCSetup(ue_context_pP, (uint8_t *) ue_p->Srb0.Tx_buffer.Payload, rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id), @@ -2744,9 +2741,9 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) { for (int j=0; jconfiguration.mcc[0] == f1_setup_req->mcc[i] && - rrc->configuration.mnc[0] == f1_setup_req->mnc[i] && - rrc->nr_cellid == f1_setup_req->nr_cellid[i]) { + if (rrc->configuration.mcc[0] == f1_setup_req->cell[i].mcc && + rrc->configuration.mnc[0] == f1_setup_req->cell[i].mnc && + rrc->nr_cellid == f1_setup_req->cell[i].nr_cellid) { // check that CU rrc instance corresponds to mcc/mnc/cgi (normally cgi should be enough, but just in case) rrc->carrier.MIB = malloc(f1_setup_req->mib_length[i]); rrc->carrier.sizeof_MIB = f1_setup_req->mib_length[i]; @@ -2789,7 +2786,7 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) { AssertFatal(bcch_message->message.choice.c1->present == NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1, "bcch_message->message.choice.c1->present != NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1\n"); rrc->carrier.sib1 = bcch_message->message.choice.c1->choice.systemInformationBlockType1; - rrc->carrier.physCellId = f1_setup_req->nr_pci[i]; + rrc->carrier.physCellId = f1_setup_req->cell[i].nr_pci; if (cu_cell_ind == 0) { // prepare F1_SETUP_RESPONSE + GNB_CU_CONFIGURATION_UPDATE if (msg_p == NULL) { @@ -2809,7 +2806,7 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) { F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].mnc = rrc->configuration.mnc[0]; F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].mnc_digit_length = rrc->configuration.mnc_digit_length[0]; F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].nr_cellid = rrc->nr_cellid; - F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].nrpci = f1_setup_req->nr_pci[i]; + F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].nrpci = f1_setup_req->cell[i].nr_pci; int num_SI= 0; if (rrc->carrier.SIB23) { @@ -2826,9 +2823,9 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) { break; } else {// setup_req mcc/mnc match rrc internal list element LOG_W(NR_RRC,"[Inst %d] No matching MCC/MNC: rrc->mcc/f1_setup_req->mcc %d/%d rrc->mnc/f1_setup_req->mnc %d/%d rrc->nr_cellid/f1_setup_req->nr_cellid %ld/%ld \n", - j, rrc->configuration.mcc[0], f1_setup_req->mcc[i], - rrc->configuration.mnc[0], f1_setup_req->mnc[i], - rrc->nr_cellid, f1_setup_req->nr_cellid[i]); + j, rrc->configuration.mcc[0], f1_setup_req->cell[i].mcc, + rrc->configuration.mnc[0], f1_setup_req->cell[i].mnc, + rrc->nr_cellid, f1_setup_req->cell[i].nr_cellid); } }// for (int j=0;jmodule_id]->rrc_ue_head)) { diff --git a/openair2/RRC/NR/rrc_gNB_NGAP.c b/openair2/RRC/NR/rrc_gNB_NGAP.c index 3f37061484..1c236ce99c 100644 --- a/openair2/RRC/NR/rrc_gNB_NGAP.c +++ b/openair2/RRC/NR/rrc_gNB_NGAP.c @@ -307,10 +307,7 @@ nr_rrc_pdcp_config_security( uint8_t *kRRCint = NULL; uint8_t *kUPenc = NULL; uint8_t *k_kdf = NULL; - pdcp_t *pdcp_p = NULL; static int print_keys= 1; - hashtable_rc_t h_rc; - hash_key_t key; #ifndef PHYSIM /* Derive the keys from kgnb */ From afcbf7b6cc83d802205f7bbedb3f7b9bd5008ba3 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Tue, 6 Jul 2021 09:49:47 +0200 Subject: [PATCH 006/110] remove most of globale variables, remain data model inconsistency and race conditions --- executables/main-ocp.c | 1 - openair2/COMMON/f1ap_messages_types.h | 2 +- openair2/ENB_APP/enb_config.c | 1 + openair2/F1AP/f1ap_common.c | 71 ++++++++-- openair2/F1AP/f1ap_common.h | 42 ++++-- openair2/F1AP/f1ap_cu_interface_management.c | 42 +++--- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 66 +++------ openair2/F1AP/f1ap_cu_task.c | 37 +++--- openair2/F1AP/f1ap_cu_ue_context_management.c | 95 ++++++------- openair2/F1AP/f1ap_du_interface_management.c | 125 ++++++++---------- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 54 ++++---- openair2/F1AP/f1ap_du_task.c | 12 +- openair2/F1AP/f1ap_du_ue_context_management.c | 92 ++++++------- openair2/F1AP/f1ap_handlers.c | 2 - openair2/F1AP/f1ap_itti_messaging.c | 25 +--- openair2/F1AP/f1ap_itti_messaging.h | 10 +- openair2/GNB_APP/gnb_config.c | 1 + openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c | 1 - targets/RT/USER/lte-softmodem.c | 1 - 19 files changed, 324 insertions(+), 356 deletions(-) diff --git a/executables/main-ocp.c b/executables/main-ocp.c index 0712dfbf57..8ceab3d61c 100644 --- a/executables/main-ocp.c +++ b/executables/main-ocp.c @@ -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){ diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index 9ecf8c1b19..4327382be8 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -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; diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index accb467738..8f96c669da 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -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 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; +} diff --git a/openair2/F1AP/f1ap_common.h b/openair2/F1AP/f1ap_common.h index bb3b525518..22fd8ec8cb 100644 --- a/openair2/F1AP/f1ap_common.h +++ b/openair2/F1AP/f1ap_common.h @@ -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)); \ + &((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_ */ diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index 490b0bf67a..a3c31de07a 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -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); - } - + itti_free(TASK_RRC_GNB,message_p); return -1; } @@ -287,7 +289,7 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance, ivalue.choice.Cells_to_be_Activated_List.list, - F1AP_Cells_to_be_Activated_List_ItemIEs_t, cells_to_be_activated_ies); + F1AP_Cells_to_be_Activated_List_ItemIEs_t, cells_to_be_activated_ies); cells_to_be_activated_ies->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item; cells_to_be_activated_ies->criticality = F1AP_Criticality_reject; cells_to_be_activated_ies->value.present = F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item; @@ -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; } @@ -394,13 +396,13 @@ int CU_send_F1_SETUP_FAILURE(instance_t instance) { ie4->criticality = F1AP_Criticality_ignore; ie4->value.present = F1AP_F1SetupFailureIEs__value_PR_CriticalityDiagnostics; asn1cCallocOne(ie4->value.choice.CriticalityDiagnostics.procedureCode, - F1AP_ProcedureCode_t, F1AP_ProcedureCode_id_UEContextSetup); + F1AP_ProcedureCode_t, F1AP_ProcedureCode_id_UEContextSetup); asn1cCallocOne(ie4->value.choice.CriticalityDiagnostics.triggeringMessage, - F1AP_TriggeringMessage_t, F1AP_TriggeringMessage_initiating_message); + F1AP_TriggeringMessage_t, F1AP_TriggeringMessage_initiating_message); asn1cCallocOne(ie4->value.choice.CriticalityDiagnostics.procedureCriticality, - F1AP_Criticality_t, F1AP_Criticality_reject); + F1AP_Criticality_t, F1AP_Criticality_reject); asn1cCallocOne(ie4->value.choice.CriticalityDiagnostics.transactionID, - F1AP_TransactionID_t, 0); + F1AP_TransactionID_t, 0); } /* encode */ @@ -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; } @@ -480,7 +482,7 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu cells_to_be_activated_ies->value.present = F1AP_Cells_to_be_Activated_List_ItemIEs__value_PR_Cells_to_be_Activated_List_Item; // 2.1 cells to be Activated list item F1AP_Cells_to_be_Activated_List_Item_t *cells_to_be_activated_list_item= - &cells_to_be_activated_ies->value.choice.Cells_to_be_Activated_List_Item; + &cells_to_be_activated_ies->value.choice.Cells_to_be_Activated_List_Item; // - nRCGI addnRCGI(cells_to_be_activated_list_item->nRCGI, f1ap_gnb_cu_configuration_update->cells_to_activate+i); // optional @@ -499,7 +501,7 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu if (f1ap_gnb_cu_configuration_update->cells_to_activate[i].num_SI > 0) { F1AP_GNB_CUSystemInformation_t *gNB_CUSystemInformation = - &cells_to_be_activated_itemExtIEs->extensionValue.choice.GNB_CUSystemInformation; + &cells_to_be_activated_itemExtIEs->extensionValue.choice.GNB_CUSystemInformation; //LOG_I(F1AP, "%s() SI %d size %d: ", __func__, i, f1ap_setup_resp->SI_container_length[i][0]); //for (int n = 0; n < f1ap_setup_resp->SI_container_length[i][0]; n++) // printf("%02x ", f1ap_setup_resp->SI_container[i][0][n]); @@ -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; } diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index 40bf156806..9a145c00be 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -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=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) { - 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); - } - + //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 (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 */ @@ -264,7 +238,7 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance, ie6->criticality = F1AP_Criticality_reject; ie6->value.present = F1AP_DLRRCMessageTransferIEs__value_PR_RRCContainer; OCTET_STRING_fromBuf(&ie6->value.choice.RRCContainer, - (const char *)f1ap_dl_rrc->rrc_container, f1ap_dl_rrc->rrc_container_length); + (const char *)f1ap_dl_rrc->rrc_container, f1ap_dl_rrc->rrc_container_length); /* optional */ /* c7. RAT_FrequencyPriorityInformation */ @@ -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; diff --git a/openair2/F1AP/f1ap_cu_task.c b/openair2/F1AP/f1ap_cu_task.c index 4432879715..a4b9b82dac 100644 --- a/openair2/F1AP/f1ap_cu_task.c +++ b/openair2/F1AP/f1ap_cu_task.c @@ -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, ¶ms) == 0, - "could not start PROTO_AGENT for F1U on instance %ld!\n", instance); - proto_agent_flag = 1; + //AssertFatal(proto_agent_start(instance, ¶ms) == 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; diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 70cd8b5ce0..68d71065e5 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -44,31 +44,29 @@ #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); + F1AP_AveragingWindow_t, 1L); } + /* OPTIONAL */ /* maxDataBurstVolume */ if (0) { asn1cCallocOne(toFill->maxDataBurstVolume, - F1AP_MaxDataBurstVolume_t, 1L); + F1AP_MaxDataBurstVolume_t, 1L); } } @@ -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); @@ -157,7 +154,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, ie7->id = F1AP_ProtocolIE_ID_id_Candidate_SpCell_List; //90 ie7->criticality = F1AP_Criticality_ignore; ie7->value.present = F1AP_UEContextSetupRequestIEs__value_PR_Candidate_SpCell_List; - + for (int i=0; i<0; i++) { asn1cSequenceAdd(ie7->value.choice.Candidate_SpCell_List.list,F1AP_Candidate_SpCell_ItemIEs_t, candidate_spCell_item_ies); candidate_spCell_item_ies->id = F1AP_ProtocolIE_ID_id_Candidate_SpCell_Item; // 91 @@ -165,14 +162,14 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, candidate_spCell_item_ies->value.present = F1AP_Candidate_SpCell_ItemIEs__value_PR_Candidate_SpCell_Item; /* 7.1 Candidate_SpCell_Item */ F1AP_Candidate_SpCell_Item_t *candidate_spCell_item= - &candidate_spCell_item_ies->value.choice.Candidate_SpCell_Item; + &candidate_spCell_item_ies->value.choice.Candidate_SpCell_Item; /* - candidate_SpCell_ID */ //FixMe: first cell ??? addnRCGI(candidate_spCell_item->candidate_SpCell_ID,f1ap_ue_context_setup_req); /* TODO add correct mcc/mnc */ } } - + /* optional */ /* c8. DRXCycle */ if (0) { @@ -182,19 +179,19 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, ie8->value.present = F1AP_UEContextSetupRequestIEs__value_PR_DRXCycle; /* 8.1 longDRXCycleLength */ ie8->value.choice.DRXCycle.longDRXCycleLength = F1AP_LongDRXCycleLength_ms10; // enum - + /* optional */ /* 8.2 shortDRXCycleLength */ if (0) { asn1cCallocOne(ie6->value.choice.DRXCycle.shortDRXCycleLength, - F1AP_ShortDRXCycleLength_t, F1AP_ShortDRXCycleLength_ms2); // enum + F1AP_ShortDRXCycleLength_t, F1AP_ShortDRXCycleLength_ms2); // enum } - + /* optional */ /* 8.3 shortDRXCycleTimer */ if (0) { asn1cCallocOne(ie8->value.choice.DRXCycle.shortDRXCycleTimer, - F1AP_ShortDRXCycleTimer_t, 123L); + F1AP_ShortDRXCycleTimer_t, 123L); } } @@ -238,7 +235,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* 10.1.3 sCellULConfigured*/ if (0) { asn1cCallocOne(scell_toBeSetup_item->sCellULConfigured, - F1AP_CellULConfigured_t, F1AP_CellULConfigured_ul_and_sul); // enum + F1AP_CellULConfigured_t, F1AP_CellULConfigured_ul_and_sul); // enum } } } @@ -264,7 +261,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* 11.1.2 duplicationIndication */ //if (0) { asn1cCallocOne(srbs_toBeSetup_item->duplicationIndication, - F1AP_DuplicationIndication_t, F1AP_DuplicationIndication_true); // enum + F1AP_DuplicationIndication_t, F1AP_DuplicationIndication_true); // enum //} } @@ -331,7 +328,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, if (some_decide_qoS_characteristics) { DRB_Information->dRB_QoS.qoS_Characteristics.present = F1AP_QoS_Characteristics_PR_non_Dynamic_5QI; - setQos(DRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI); + setQos(DRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI); } else { DRB_Information->dRB_QoS.qoS_Characteristics.present = F1AP_QoS_Characteristics_PR_dynamic_5QI; asn1cCalloc(DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI, F1AP_Dynamic5QIDescriptor_t, tmp); @@ -347,21 +344,21 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* delayCritical */ if (0) { asn1cCallocOne(DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->delayCritical, - long, 1L); + long, 1L); } /* OPTIONAL */ /* averagingWindow */ if (0) { asn1cCallocOne(DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->averagingWindow, - F1AP_AveragingWindow_t, 1L); + F1AP_AveragingWindow_t, 1L); } /* OPTIONAL */ /* maxDataBurstVolume */ if (0) { asn1cCallocOne(DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->maxDataBurstVolume, - F1AP_MaxDataBurstVolume_t, 1L); + F1AP_MaxDataBurstVolume_t, 1L); } } // if some_decide_qoS_characteristics } // qoS_Characteristics @@ -385,14 +382,14 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* maxPacketLossRateDownlink */ if (0) { asn1cCallocOne(DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateDownlink, - F1AP_MaxPacketLossRate_t, 1L); + F1AP_MaxPacketLossRate_t, 1L); } /* OPTIONAL */ /* maxPacketLossRateUplink */ if (0) { asn1cCallocOne(DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateUplink, - F1AP_MaxPacketLossRate_t, 1L); + F1AP_MaxPacketLossRate_t, 1L); } } @@ -400,7 +397,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* reflective_QoS_Attribute */ if (0) { asn1cCallocOne(DRB_Information->dRB_QoS.reflective_QoS_Attribute, - long, 1L); + long, 1L); } } // dRB_QoS /* 12.1.2.2 sNSSAI */ @@ -422,7 +419,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* 12.1.2.3 notificationControl */ if (0) { asn1cCallocOne(DRB_Information->notificationControl, - F1AP_NotificationControl_t, F1AP_NotificationControl_active); // enum + F1AP_NotificationControl_t, F1AP_NotificationControl_active); // enum } /* 12.1.2.4 flows_Mapped_To_DRB_List */ // BK: need verifiy @@ -441,8 +438,8 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, if (some_decide_qoS_characteristics) { QosParams->present = F1AP_QoS_Characteristics_PR_non_Dynamic_5QI; - setQos(QosParams->choice.non_Dynamic_5QI); - } else { + setQos(QosParams->choice.non_Dynamic_5QI); + } else { QosParams->present = F1AP_QoS_Characteristics_PR_dynamic_5QI; asn1cCalloc(QosParams->choice.dynamic_5QI, F1AP_Dynamic5QIDescriptor_t, tmp); /* qoSPriorityLevel */ @@ -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,13 +710,19 @@ 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); - 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( - instance, - ue_context_pP, - S1AP_CAUSE_RADIO_NETWORK, - 21); // send cause 21: connection with ue lost + + 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( + 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; diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index 54d88666f2..a646ef1107 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -37,10 +37,8 @@ #include "f1ap_du_interface_management.h" #include "assertions.h" -extern f1ap_setup_req_t *f1ap_du_data; -extern RAN_CONTEXT_t RC; -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}; +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}; int to_NRNRB(int nrb) { for (int i=0; iid = F1AP_ProtocolIE_ID_id_gNB_DU_ID; ieC2->criticality = F1AP_Criticality_reject; ieC2->value.present = F1AP_F1SetupRequestIEs__value_PR_GNB_DU_ID; - asn_int642INTEGER(&ieC2->value.choice.GNB_DU_ID, f1ap_du_data->gNB_DU_id); + asn_int642INTEGER(&ieC2->value.choice.GNB_DU_ID, f1ap_req(false, instance)->gNB_DU_id); /* optional */ /* c3. GNB_DU_Name */ - if (f1ap_du_data->gNB_DU_name != NULL) { + if (f1ap_req(false,instance)->gNB_DU_name != NULL) { asn1cSequenceAdd(f1Setup->protocolIEs.list, F1AP_F1SetupRequestIEs_t, ieC3); ieC3->id = F1AP_ProtocolIE_ID_id_gNB_DU_Name; ieC3->criticality = F1AP_Criticality_ignore; ieC3->value.present = F1AP_F1SetupRequestIEs__value_PR_GNB_DU_Name; - OCTET_STRING_fromBuf(&ieC3->value.choice.GNB_DU_Name, f1ap_du_data->gNB_DU_name, - strlen(f1ap_du_data->gNB_DU_name)); + char *gNB_DU_name=f1ap_req(false, instance)->gNB_DU_name; + OCTET_STRING_fromBuf(&ieC3->value.choice.GNB_DU_Name, gNB_DU_name, strlen(gNB_DU_name)); } /* mandatory */ @@ -140,12 +138,13 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { ieCells->id = F1AP_ProtocolIE_ID_id_gNB_DU_Served_Cells_List; ieCells->criticality = F1AP_Criticality_reject; ieCells->value.present = F1AP_F1SetupRequestIEs__value_PR_GNB_DU_Served_Cells_List; - int num_cells_available = f1ap_du_data->num_cells_available; + int num_cells_available = f1ap_req(false, instance)->num_cells_available; LOG_D(F1AP, "num_cells_available = %d \n", num_cells_available); for (int i=0; icell[i]; asn1cSequenceAdd(ieCells->value.choice.GNB_DU_Served_Cells_List.list, F1AP_GNB_DU_Served_Cells_ItemIEs_t, duServedCell); duServedCell->id = F1AP_ProtocolIE_ID_id_GNB_DU_Served_Cells_Item; @@ -154,11 +153,11 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { F1AP_GNB_DU_Served_Cells_Item_t *gnb_du_served_cells_item=&duServedCell->value.choice.GNB_DU_Served_Cells_Item; /* 4.1.1 served cell Information */ F1AP_Served_Cell_Information_t *served_cell_information= &gnb_du_served_cells_item->served_Cell_Information; - //addnRCGI(served_cell_information->nRCGI,f1ap_du_data->cell+i); + addnRCGI(served_cell_information->nRCGI,cell); /* - nRPCI */ - served_cell_information->nRPCI = f1ap_du_data->cell[i].nr_pci; // int 0..1007 + served_cell_information->nRPCI = cell->nr_pci; // int 0..1007 /* - fiveGS_TAC */ - uint32_t tac=htonl(f1ap_du_data->cell[i].tac); + uint32_t tac=htonl(cell->tac); asn1cCalloc(served_cell_information->fiveGS_TAC, F1AP_FiveGS_TAC_t, netOrder); OCTET_STRING_fromBuf(netOrder, ((char *)&tac)+1, 3); @@ -170,18 +169,16 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { /* servedPLMN information */ asn1cSequenceAdd(served_cell_information->servedPLMNs.list, F1AP_ServedPLMNs_Item_t,servedPLMN_item); - MCC_MNC_TO_PLMNID(f1ap_du_data->cell[i].mcc, f1ap_du_data->cell[i].mnc, - f1ap_du_data->cell[i].mnc_digit_length, &servedPLMN_item->pLMN_Identity); + MCC_MNC_TO_PLMNID(cell->mcc, cell->mnc, cell->mnc_digit_length, &servedPLMN_item->pLMN_Identity); // // /* - CHOICE NR-MODE-Info */ F1AP_NR_Mode_Info_t *nR_Mode_Info= &served_cell_information->nR_Mode_Info; - //f1ap_du_data->fdd_flag = 1; - if (f1ap_du_data->fdd_flag) { // FDD + if (f1ap_req(false, instance)->fdd_flag) { // FDD nR_Mode_Info->present = F1AP_NR_Mode_Info_PR_fDD; asn1cCalloc(nR_Mode_Info->choice.fDD, F1AP_FDD_Info_t, fDD_Info); /* FDD.1 UL NRFreqInfo */ /* FDD.1.1 UL NRFreqInfo ARFCN */ - fDD_Info->uL_NRFreqInfo.nRARFCN = f1ap_du_data->nr_mode_info[i].fdd.ul_nr_arfcn; // Integer + fDD_Info->uL_NRFreqInfo.nRARFCN = f1ap_req(false,instance)->nr_mode_info[i].fdd.ul_nr_arfcn; // Integer /* FDD.1.2 F1AP_SUL_Information */ if(0) { // Optional @@ -192,27 +189,27 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { } /* FDD.1.3 freqBandListNr */ - int fdd_ul_num_available_freq_Bands = f1ap_du_data->nr_mode_info[i].fdd.ul_num_frequency_bands; + int fdd_ul_num_available_freq_Bands = f1ap_req(false,instance)->nr_mode_info[i].fdd.ul_num_frequency_bands; LOG_D(F1AP, "fdd_ul_num_available_freq_Bands = %d \n", fdd_ul_num_available_freq_Bands); for (int fdd_ul_j=0; fdd_ul_juL_NRFreqInfo.freqBandListNr.list, F1AP_FreqBandNrItem_t, nr_freqBandNrItem); /* FDD.1.3.1 freqBandIndicatorNr*/ - nr_freqBandNrItem->freqBandIndicatorNr = f1ap_du_data->nr_mode_info[i].fdd.ul_nr_band[fdd_ul_j]; // + nr_freqBandNrItem->freqBandIndicatorNr = f1ap_req(false,instance)->nr_mode_info[i].fdd.ul_nr_band[fdd_ul_j]; // /* FDD.1.3.2 supportedSULBandList*/ - int num_available_supported_SULBands = f1ap_du_data->nr_mode_info[i].fdd.ul_num_sul_frequency_bands; + int num_available_supported_SULBands = f1ap_req(false,instance)->nr_mode_info[i].fdd.ul_num_sul_frequency_bands; LOG_D(F1AP, "num_available_supported_SULBands = %d \n", num_available_supported_SULBands); for (int fdd_ul_k=0; fdd_ul_ksupportedSULBandList.list, F1AP_SupportedSULFreqBandItem_t, nr_supportedSULFreqBandItem); /* FDD.1.3.2.1 freqBandIndicatorNr */ - nr_supportedSULFreqBandItem->freqBandIndicatorNr = f1ap_du_data->nr_mode_info[i].fdd.ul_nr_sul_band[fdd_ul_k]; // + nr_supportedSULFreqBandItem->freqBandIndicatorNr = f1ap_req(false,instance)->nr_mode_info[i].fdd.ul_nr_sul_band[fdd_ul_k]; // } // for FDD : UL supported_SULBands } // for FDD : UL freq_Bands /* FDD.2 DL NRFreqInfo */ /* FDD.2.1 DL NRFreqInfo ARFCN */ - fDD_Info->dL_NRFreqInfo.nRARFCN = f1ap_du_data->nr_mode_info[i].fdd.dl_nr_arfcn; // Integer + fDD_Info->dL_NRFreqInfo.nRARFCN = f1ap_req(false,instance)->nr_mode_info[i].fdd.dl_nr_arfcn; // Integer /* FDD.2.2 F1AP_SUL_Information */ if(0) { // Optional @@ -223,36 +220,36 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { } /* FDD.2.3 freqBandListNr */ - int fdd_dl_num_available_freq_Bands = f1ap_du_data->nr_mode_info[i].fdd.dl_num_frequency_bands; + int fdd_dl_num_available_freq_Bands = f1ap_req(false,instance)->nr_mode_info[i].fdd.dl_num_frequency_bands; LOG_D(F1AP, "fdd_dl_num_available_freq_Bands = %d \n", fdd_dl_num_available_freq_Bands); for (int fdd_dl_j=0; fdd_dl_jdL_NRFreqInfo.freqBandListNr.list, F1AP_FreqBandNrItem_t, nr_freqBandNrItem); /* FDD.2.3.1 freqBandIndicatorNr*/ - nr_freqBandNrItem->freqBandIndicatorNr = f1ap_du_data->nr_mode_info[i].fdd.dl_nr_band[fdd_dl_j]; // + nr_freqBandNrItem->freqBandIndicatorNr = f1ap_req(false,instance)->nr_mode_info[i].fdd.dl_nr_band[fdd_dl_j]; // /* FDD.2.3.2 supportedSULBandList*/ - int num_available_supported_SULBands = f1ap_du_data->nr_mode_info[i].fdd.dl_num_sul_frequency_bands; + int num_available_supported_SULBands = f1ap_req(false,instance)->nr_mode_info[i].fdd.dl_num_sul_frequency_bands; LOG_D(F1AP, "num_available_supported_SULBands = %d \n", num_available_supported_SULBands); for (int fdd_dl_k=0; fdd_dl_ksupportedSULBandList.list, F1AP_SupportedSULFreqBandItem_t, nr_supportedSULFreqBandItem); /* FDD.2.3.2.1 freqBandIndicatorNr */ - nr_supportedSULFreqBandItem->freqBandIndicatorNr = f1ap_du_data->nr_mode_info[i].fdd.dl_nr_sul_band[fdd_dl_k]; // + nr_supportedSULFreqBandItem->freqBandIndicatorNr = f1ap_req(false,instance)->nr_mode_info[i].fdd.dl_nr_sul_band[fdd_dl_k]; // } // for FDD : DL supported_SULBands } // for FDD : DL freq_Bands /* FDD.3 UL Transmission Bandwidth */ - fDD_Info->uL_Transmission_Bandwidth.nRSCS = f1ap_du_data->nr_mode_info[i].fdd.ul_scs; - fDD_Info->uL_Transmission_Bandwidth.nRNRB = to_NRNRB(f1ap_du_data->nr_mode_info[i].fdd.ul_nrb); + fDD_Info->uL_Transmission_Bandwidth.nRSCS = f1ap_req(false,instance)->nr_mode_info[i].fdd.ul_scs; + fDD_Info->uL_Transmission_Bandwidth.nRNRB = to_NRNRB(f1ap_req(false,instance)->nr_mode_info[i].fdd.ul_nrb); /* FDD.4 DL Transmission Bandwidth */ - fDD_Info->dL_Transmission_Bandwidth.nRSCS = f1ap_du_data->nr_mode_info[i].fdd.dl_scs; - fDD_Info->dL_Transmission_Bandwidth.nRNRB = to_NRNRB(f1ap_du_data->nr_mode_info[i].fdd.dl_nrb); + fDD_Info->dL_Transmission_Bandwidth.nRSCS = f1ap_req(false,instance)->nr_mode_info[i].fdd.dl_scs; + fDD_Info->dL_Transmission_Bandwidth.nRNRB = to_NRNRB(f1ap_req(false,instance)->nr_mode_info[i].fdd.dl_nrb); } else { // TDD nR_Mode_Info->present = F1AP_NR_Mode_Info_PR_tDD; asn1cCalloc(nR_Mode_Info->choice.tDD, F1AP_TDD_Info_t, tDD_Info); /* TDD.1 nRFreqInfo */ /* TDD.1.1 nRFreqInfo ARFCN */ - tDD_Info->nRFreqInfo.nRARFCN = f1ap_du_data->nr_mode_info[i].tdd.nr_arfcn; // Integer + tDD_Info->nRFreqInfo.nRARFCN = f1ap_req(false,instance)->nr_mode_info[i].tdd.nr_arfcn; // Integer /* TDD.1.2 F1AP_SUL_Information */ if(0) { // Optional @@ -263,42 +260,42 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { } /* TDD.1.3 freqBandListNr */ - int tdd_num_available_freq_Bands = f1ap_du_data->nr_mode_info[i].tdd.num_frequency_bands; + int tdd_num_available_freq_Bands = f1ap_req(false,instance)->nr_mode_info[i].tdd.num_frequency_bands; LOG_D(F1AP, "tdd_num_available_freq_Bands = %d \n", tdd_num_available_freq_Bands); for (int j=0; jnRFreqInfo.freqBandListNr.list, F1AP_FreqBandNrItem_t, nr_freqBandNrItem); /* TDD.1.3.1 freqBandIndicatorNr*/ - nr_freqBandNrItem->freqBandIndicatorNr = *f1ap_du_data->nr_mode_info[i].tdd.nr_band; // + nr_freqBandNrItem->freqBandIndicatorNr = *f1ap_req(false,instance)->nr_mode_info[i].tdd.nr_band; // /* TDD.1.3.2 supportedSULBandList*/ - int num_available_supported_SULBands = f1ap_du_data->nr_mode_info[i].tdd.num_sul_frequency_bands; + int num_available_supported_SULBands = f1ap_req(false,instance)->nr_mode_info[i].tdd.num_sul_frequency_bands; LOG_D(F1AP, "num_available_supported_SULBands = %d \n", num_available_supported_SULBands); for (int k=0; ksupportedSULBandList.list,F1AP_SupportedSULFreqBandItem_t, nr_supportedSULFreqBandItem); /* TDD.1.3.2.1 freqBandIndicatorNr */ - nr_supportedSULFreqBandItem->freqBandIndicatorNr = *f1ap_du_data->nr_mode_info[i].tdd.nr_sul_band; // + nr_supportedSULFreqBandItem->freqBandIndicatorNr = *f1ap_req(false,instance)->nr_mode_info[i].tdd.nr_sul_band; // } // for TDD : supported_SULBands } // for TDD : freq_Bands /* TDD.2 transmission_Bandwidth */ - tDD_Info->transmission_Bandwidth.nRSCS = f1ap_du_data->nr_mode_info[i].tdd.scs; - tDD_Info->transmission_Bandwidth.nRNRB = to_NRNRB(f1ap_du_data->nr_mode_info[i].tdd.nrb); + tDD_Info->transmission_Bandwidth.nRSCS = f1ap_req(false,instance)->nr_mode_info[i].tdd.scs; + tDD_Info->transmission_Bandwidth.nRNRB = to_NRNRB(f1ap_req(false,instance)->nr_mode_info[i].tdd.nrb); } // if nR_Mode_Info /* - measurementTimingConfiguration */ - char *measurementTimingConfiguration = f1ap_du_data->measurement_timing_information[i]; // sept. 2018 + char *measurementTimingConfiguration = f1ap_req(false,instance)->measurement_timing_information[i]; // sept. 2018 OCTET_STRING_fromBuf(&served_cell_information->measurementTimingConfiguration, measurementTimingConfiguration, strlen(measurementTimingConfiguration)); asn1cCalloc(gnb_du_served_cells_item->gNB_DU_System_Information, F1AP_GNB_DU_System_Information_t, gNB_DU_System_Information); /* 4.1.2 gNB-DU System Information */ OCTET_STRING_fromBuf(&gNB_DU_System_Information->mIB_message, // sept. 2018 - (const char *)f1ap_du_data->mib[i], //f1ap_du_data->mib, - f1ap_du_data->mib_length[i]); + (const char *)f1ap_req(false,instance)->mib[i], //f1ap_du_data->mib, + f1ap_req(false,instance)->mib_length[i]); OCTET_STRING_fromBuf(&gNB_DU_System_Information->sIB1_message, // sept. 2018 - (const char *)f1ap_du_data->sib1[i], - f1ap_du_data->sib1_length[i]); + (const char *)f1ap_req(false,instance)->sib1[i], + f1ap_req(false,instance)->sib1_length[i]); } /* mandatory */ @@ -319,7 +316,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { } ASN_STRUCT_RESET(asn_DEF_F1AP_F1AP_PDU, &pdu); - du_f1ap_itti_send_sctp_data_req(instance, f1ap_du_data->assoc_id, buffer, len, 0); + f1ap_itti_send_sctp_data_req(false, instance, buffer, len, 0); return 0; } @@ -491,17 +488,8 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, MSC_AS_TIME_FMT" DU_handle_F1_SETUP_RESPONSE successfulOutcome assoc_id %d", 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), assoc_id); - - if (RC.nrrrc[0]->node_type == ngran_gNB_DU) { - LOG_D(F1AP, "Sending F1AP_SETUP_RESP ITTI message to GNB_APP with assoc_id (%d->%d)\n", - assoc_id,ENB_MODULE_ID_TO_INSTANCE(assoc_id)); - itti_send_msg_to_task(TASK_GNB_APP, GNB_MODULE_ID_TO_INSTANCE(assoc_id), msg_p); - } else { - LOG_D(F1AP, "Sending F1AP_SETUP_RESP ITTI message to ENB_APP with assoc_id (%d->%d)\n", - assoc_id,ENB_MODULE_ID_TO_INSTANCE(assoc_id)); - itti_send_msg_to_task(TASK_ENB_APP, ENB_MODULE_ID_TO_INSTANCE(assoc_id), msg_p); - } - + LOG_D(F1AP, "Sending F1AP_SETUP_RESP ITTI message\n"); + itti_send_msg_to_task(TASK_F1APP, GNB_MODULE_ID_TO_INSTANCE(assoc_id), msg_p); return 0; } @@ -573,12 +561,13 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, F1AP_Served_Cells_To_Add_Item_t *served_cells_to_add_item= &served_cells_to_add_item_ies->value.choice.Served_Cells_To_Add_Item; F1AP_Served_Cell_Information_t *served_cell_information=&served_cells_to_add_item->served_Cell_Information; /* - nRCGI */ - //addnRCGI(served_cell_information->nRCGI, f1ap_setup_req->cell[j]); + addnRCGI(served_cell_information->nRCGI, &f1ap_setup_req->cell[j]); /* - nRPCI */ /* 2.1.1 serverd cell Information */ - served_cell_information->nRPCI = f1ap_setup_req->cell[j].nr_pci; // int 0..1007 + cellIDs_t *cell=&f1ap_req(false, instance)->cell[j]; + served_cell_information->nRPCI = cell->nr_pci; // int 0..1007 /* - fiveGS_TAC */ - uint32_t tac=htonl(f1ap_du_data->cell[j].tac); + uint32_t tac=htonl(cell->tac); served_cell_information->fiveGS_TAC=(F1AP_FiveGS_TAC_t *) calloc(1,sizeof(F1AP_FiveGS_TAC_t *)); OCTET_STRING_fromBuf(served_cell_information->fiveGS_TAC, ((char *)&tac)+1, 3); @@ -589,7 +578,7 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, } asn1cSequenceAdd(served_cell_information->servedPLMNs.list, F1AP_ServedPLMNs_Item_t, servedPLMN_item); - MCC_MNC_TO_PLMNID(f1ap_du_data->cell[j].mcc, f1ap_du_data->cell[j].mnc, f1ap_du_data->cell[j].mnc_digit_length, &servedPLMN_item->pLMN_Identity); + MCC_MNC_TO_PLMNID(cell->mcc, cell->mnc, cell->mnc_digit_length, &servedPLMN_item->pLMN_Identity); // // /* - CHOICE NR-MODE-Info */ F1AP_NR_Mode_Info_t *nR_Mode_Info=&served_cell_information->nR_Mode_Info; @@ -653,6 +642,7 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, for (int i=0; i<1; i++) { // + cellIDs_t *cell=&f1ap_req(false, instance)->cell[i]; asn1cSequenceAdd(ie3->value.choice.Served_Cells_To_Modify_List.list, F1AP_Served_Cells_To_Modify_ItemIEs_t, served_cells_to_modify_item_ies); served_cells_to_modify_item_ies->id = F1AP_ProtocolIE_ID_id_Served_Cells_To_Modify_Item; served_cells_to_modify_item_ies->criticality = F1AP_Criticality_reject; @@ -663,7 +653,7 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, /* 3.2.1 serverd cell Information */ F1AP_Served_Cell_Information_t *served_cell_information= &served_cells_to_modify_item->served_Cell_Information; /* - nRCGI */ - //addnRGCI(served_cell_information->nRCGI,f1ap_setup_req->cell[i]); + //addnRGCI(served_cell_information->nRCGI,f1ap_setup_req->cell[i]); /* - nRPCI */ served_cell_information->nRPCI = f1ap_setup_req->cell[i].nr_pci; // int 0..1007 /* - fiveGS_TAC */ @@ -681,7 +671,7 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, } asn1cSequenceAdd(served_cell_information->servedPLMNs.list, F1AP_ServedPLMNs_Item_t, servedPLMN_item); - MCC_MNC_TO_PLMNID(f1ap_du_data->cell[i].mcc, f1ap_du_data->cell[i].mnc, f1ap_du_data->cell[i].mnc_digit_length, &servedPLMN_item->pLMN_Identity); + MCC_MNC_TO_PLMNID(cell->mcc, cell->mnc, cell->mnc_digit_length, &servedPLMN_item->pLMN_Identity); // // /* - CHOICE NR-MODE-Info */ F1AP_NR_Mode_Info_t *nR_Mode_Info= &served_cell_information->nR_Mode_Info; @@ -752,7 +742,7 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, served_cells_to_delete_item_ies->value.present = F1AP_Served_Cells_To_Delete_ItemIEs__value_PR_Served_Cells_To_Delete_Item; F1AP_Served_Cells_To_Delete_Item_t *served_cells_to_delete_item=&served_cells_to_delete_item_ies->value.choice.Served_Cells_To_Delete_Item; /* 3.1 oldNRCGI */ - //addnRGCI(served_cells_to_delete_item->oldNRCGI, f1ap_setup_req->cell[i]); + addnRCGI(served_cells_to_delete_item->oldNRCGI, &f1ap_setup_req->cell[i]); } if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { @@ -925,17 +915,8 @@ int DU_handle_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, MSC_AS_TIME_FMT" DU_handle_GNB_CU_CONFIGURATION_UPDATE initiatingMessage assoc_id %d", 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), assoc_id); - - if (RC.nrrrc[0]->node_type == ngran_gNB_DU) { - LOG_D(F1AP, "Sending F1AP_GNB_CU_CONFIGURATION_UPDATE ITTI message to GNB_APP with assoc_id (%d->%d)\n", - assoc_id,ENB_MODULE_ID_TO_INSTANCE(assoc_id)); - itti_send_msg_to_task(TASK_GNB_APP, GNB_MODULE_ID_TO_INSTANCE(assoc_id), msg_p); - } else { - LOG_D(F1AP, "Sending F1AP_GNB_CU_CONFIGURATION_UPDATE ITTI message to ENB_APP with assoc_id (%d->%d)\n", - assoc_id,ENB_MODULE_ID_TO_INSTANCE(assoc_id)); - itti_send_msg_to_task(TASK_ENB_APP, ENB_MODULE_ID_TO_INSTANCE(assoc_id), msg_p); - } - + LOG_D(F1AP, "Sending F1AP_GNB_CU_CONFIGURATION_UPDATE ITTI message \n"); + itti_send_msg_to_task(TASK_F1APP, GNB_MODULE_ID_TO_INSTANCE(assoc_id), msg_p); return 0; } @@ -985,7 +966,7 @@ int DU_send_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, } ASN_STRUCT_RESET(asn_DEF_F1AP_F1AP_PDU, &pdu); - du_f1ap_itti_send_sctp_data_req(instance, f1ap_du_data->assoc_id, buffer, len, 0); + f1ap_itti_send_sctp_data_req(false, instance, buffer, len, 0); return 0; } diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index 0084f0fe51..c89f042967 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -56,12 +56,6 @@ #include "intertask_interface.h" #include "LAYER2/NR_MAC_gNB/mac_proto.h" -extern f1ap_setup_req_t *f1ap_du_data; -extern RAN_CONTEXT_t RC; -extern f1ap_cudu_inst_t f1ap_du_inst[MAX_eNB]; - -uint8_t du_ccch_flag = 1; - int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, uint32_t assoc_id, uint32_t stream, @@ -108,9 +102,9 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, du_ue_f1ap_id = ie->value.choice.GNB_DU_UE_F1AP_ID; LOG_D(F1AP, "du_ue_f1ap_id %lu associated with UE RNTI %x \n", du_ue_f1ap_id, - f1ap_get_rnti_by_du_id(&f1ap_du_inst[instance], du_ue_f1ap_id)); // this should be the one transmitted via initial ul rrc message transfer + f1ap_get_rnti_by_du_id(false, instance, du_ue_f1ap_id)); // this should be the one transmitted via initial ul rrc message transfer - if (f1ap_du_add_cu_ue_id(&f1ap_du_inst[instance],du_ue_f1ap_id, cu_ue_f1ap_id) < 0 ) { + if (f1ap_du_add_cu_ue_id(false, instance,du_ue_f1ap_id, cu_ue_f1ap_id) < 0 ) { LOG_E(F1AP, "Failed to find the F1AP UID \n"); //return -1; } @@ -180,7 +174,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, // decode RRC Container and act on the message type AssertFatal(srb_id<3,"illegal srb_id\n"); protocol_ctxt_t ctxt; - ctxt.rnti = f1ap_get_rnti_by_du_id(&f1ap_du_inst[instance], du_ue_f1ap_id); + ctxt.rnti = f1ap_get_rnti_by_du_id(false, instance, du_ue_f1ap_id); ctxt.module_id = instance; ctxt.instance = instance; ctxt.enb_flag = 1; @@ -222,7 +216,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, LOG_I(F1AP, "Logical Channel DL-CCCH (SRB0), Received RRCConnectionSetup DU_ID %lx/RNTI %x\n", du_ue_f1ap_id, - f1ap_get_rnti_by_du_id(&f1ap_du_inst[instance], du_ue_f1ap_id)); + f1ap_get_rnti_by_du_id(false, instance, du_ue_f1ap_id)); // Get configuration LTE_RRCConnectionSetup_t *rrcConnectionSetup = &dl_ccch_msg->message.choice.c1.choice.rrcConnectionSetup; AssertFatal(rrcConnectionSetup!=NULL,"rrcConnectionSetup is null\n"); @@ -261,7 +255,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, // This should be somewhere in the f1ap_cudu_ue_inst_t /*int macrlc_instance = 0; - rnti_t rnti = f1ap_get_rnti_by_du_id(&f1ap_du_inst[0], du_ue_f1ap_id); + rnti_t rnti = f1ap_get_rnti_by_du_id(false, instance, du_ue_f1ap_id); struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[macrlc_instance],rnti); */ eNB_RRC_UE_t *ue_p = &ue_context_p->ue_context; @@ -358,7 +352,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, LOG_I(F1AP, "Logical Channel DL-DCCH (SRB1), Received RRCConnectionReconfiguration DU_ID %lx/RNTI %x\n", du_ue_f1ap_id, - f1ap_get_rnti_by_du_id(&f1ap_du_inst[instance], du_ue_f1ap_id)); + f1ap_get_rnti_by_du_id(false, instance, du_ue_f1ap_id)); LTE_RRCConnectionReconfiguration_t *rrcConnectionReconfiguration = &dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration; if (rrcConnectionReconfiguration->criticalExtensions.present == LTE_RRCConnectionReconfiguration__criticalExtensions_PR_c1) { @@ -617,7 +611,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance, ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_GNB_CU_UE_F1AP_ID; - ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(&f1ap_du_inst[instance], rnti); + ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(false, instance, rnti); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ /* c2. GNB_DU_UE_F1AP_ID */ @@ -625,7 +619,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance, ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(&f1ap_du_inst[instance], rnti); + ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(false, instance, rnti); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ /* c3. SRBID */ @@ -755,7 +749,8 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance, return -1; } - du_f1ap_itti_send_sctp_data_req(instance, f1ap_du_data->assoc_id, buffer, len, f1ap_du_data->default_sctp_stream_id); + ASN_STRUCT_RESET(asn_DEF_F1AP_F1AP_PDU, &pdu); + f1ap_itti_send_sctp_data_req(false, instance, buffer, len, getCxt(false, instance)->default_sctp_stream_id); return 0; } @@ -773,7 +768,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, F1AP_InitialULRRCMessageTransfer_t *out; uint8_t *buffer=NULL; uint32_t len=0; - int f1ap_uid = f1ap_add_ue (&f1ap_du_inst[module_idP], module_idP, CC_idP,UE_id, rntiP); + int f1ap_uid = f1ap_add_ue (false, module_idP, CC_idP,UE_id, rntiP); if (f1ap_uid < 0 ) { LOG_E(F1AP, "Failed to add UE \n"); @@ -794,14 +789,15 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, ie1->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; ie1->criticality = F1AP_Criticality_reject; ie1->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie1->value.choice.GNB_DU_UE_F1AP_ID = f1ap_du_inst[module_idP].f1ap_ue[f1ap_uid].du_ue_f1ap_id; + ie1->value.choice.GNB_DU_UE_F1AP_ID = getCxt(false, module_idP)->f1ap_ue[f1ap_uid].du_ue_f1ap_id; /* mandatory */ /* c2. NRCGI */ asn1cSequenceAdd(out->protocolIEs.list, F1AP_InitialULRRCMessageTransferIEs_t, ie2); ie2->id = F1AP_ProtocolIE_ID_id_NRCGI; ie2->criticality = F1AP_Criticality_reject; ie2->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_NRCGI; - //addnRCGI(ie2->value.choice.NRCGI, f1ap_du_data->cell[0]); + //Fixme: takes always the first cell + addnRCGI(ie2->value.choice.NRCGI, getCxt(false, module_idP)->setupReq.cell); /* mandatory */ /* c3. C_RNTI */ // 16 asn1cSequenceAdd(out->protocolIEs.list, F1AP_InitialULRRCMessageTransferIEs_t, ie3); @@ -851,15 +847,11 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, RB_INSERT(rrc_ue_tree_s, &RC.rrc[module_idP]->rrc_ue_head, ue_context_p); } - du_f1ap_itti_send_sctp_data_req(module_idP, f1ap_du_data->assoc_id, buffer, len, f1ap_du_data->default_sctp_stream_id); + f1ap_itti_send_sctp_data_req(false, module_idP, buffer, len, getCxt(false, module_idP)->default_sctp_stream_id); return 0; } -void init_f1ap_du_ue_inst (void) { - memset(f1ap_du_inst, 0, sizeof(f1ap_du_inst)); -} - int DU_send_UL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, const f1ap_ul_rrc_message_t *msg) { const rnti_t rnti = msg->rnti; @@ -887,14 +879,14 @@ int DU_send_UL_NR_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_ULRRCMessageTransferIEs__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], rnti); + ie1->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(false, instance, rnti); /* mandatory */ /* c2. GNB_DU_UE_F1AP_ID */ asn1cSequenceAdd(out->protocolIEs.list, F1AP_ULRRCMessageTransferIEs_t, ie2); ie2->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; ie2->criticality = F1AP_Criticality_reject; ie2->value.present = F1AP_ULRRCMessageTransferIEs__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], rnti); + ie2->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(false, instance, rnti); /* mandatory */ /* c3. SRBID */ asn1cSequenceAdd(out->protocolIEs.list, F1AP_ULRRCMessageTransferIEs_t, ie3); @@ -919,7 +911,7 @@ int DU_send_UL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, return -1; } - du_f1ap_itti_send_sctp_data_req(instance, f1ap_du_data->assoc_id, buffer, len, f1ap_du_data->default_sctp_stream_id); + f1ap_itti_send_sctp_data_req(false, instance, buffer, len, getCxt(false, instance)->default_sctp_stream_id); return 0; } @@ -958,9 +950,9 @@ int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, du_ue_f1ap_id = ie->value.choice.GNB_DU_UE_F1AP_ID; LOG_D(F1AP, "du_ue_f1ap_id %lu associated with UE RNTI %x \n", du_ue_f1ap_id, - f1ap_get_rnti_by_du_id(&f1ap_du_inst[instance], du_ue_f1ap_id)); // this should be the one transmitted via initial ul rrc message transfer + f1ap_get_rnti_by_du_id(false, instance, du_ue_f1ap_id)); // this should be the one transmitted via initial ul rrc message transfer - if (f1ap_du_add_cu_ue_id(&f1ap_du_inst[instance],du_ue_f1ap_id, cu_ue_f1ap_id) < 0 ) { + if (f1ap_du_add_cu_ue_id(false, instance,du_ue_f1ap_id, cu_ue_f1ap_id) < 0 ) { LOG_E(F1AP, "Failed to find the F1AP UID \n"); //return -1; } @@ -1030,7 +1022,7 @@ int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, // decode RRC Container and act on the message type AssertFatal(srb_id<3,"illegal srb_id\n"); protocol_ctxt_t ctxt; - ctxt.rnti = f1ap_get_rnti_by_du_id(&f1ap_du_inst[instance], du_ue_f1ap_id); + ctxt.rnti = f1ap_get_rnti_by_du_id(false, instance, du_ue_f1ap_id); ctxt.module_id = instance; ctxt.instance = instance; ctxt.enb_flag = 1; @@ -1063,7 +1055,7 @@ int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, LOG_I(F1AP, "Logical Channel DL-CCCH (SRB0), Received RRCSetup DU_ID %lx/RNTI %x\n", du_ue_f1ap_id, - f1ap_get_rnti_by_du_id(&f1ap_du_inst[instance], du_ue_f1ap_id)); + f1ap_get_rnti_by_du_id(false, instance, du_ue_f1ap_id)); // Get configuration NR_RRCSetup_t *rrcSetup = dl_ccch_msg->message.choice.c1->choice.rrcSetup; AssertFatal(rrcSetup!=NULL, "rrcSetup is null\n"); @@ -1130,7 +1122,7 @@ int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, LOG_I(F1AP, "Logical Channel DL-DCCH (SRB1), Received RRCReconfiguration DU_ID %lx/RNTI %x\n", du_ue_f1ap_id, - f1ap_get_rnti_by_du_id(&f1ap_du_inst[instance], du_ue_f1ap_id)); + f1ap_get_rnti_by_du_id(false, instance, du_ue_f1ap_id)); NR_RRCReconfiguration_t *rrcReconfiguration = dl_dcch_msg->message.choice.c1->choice.rrcReconfiguration; if (rrcReconfiguration->criticalExtensions.present == NR_RRCReconfiguration__criticalExtensions_PR_rrcReconfiguration) { diff --git a/openair2/F1AP/f1ap_du_task.c b/openair2/F1AP/f1ap_du_task.c index e844788fc2..ffa14e0a35 100644 --- a/openair2/F1AP/f1ap_du_task.c +++ b/openair2/F1AP/f1ap_du_task.c @@ -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; diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 7ff403fb66..cd28542094 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -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; @@ -225,7 +221,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance) { /* measGapConfig */ if (0) { asn1cCalloc(ie3->value.choice.DUtoCURRCInformation.measGapConfig, - F1AP_MeasGapConfig_t, tmp); + F1AP_MeasGapConfig_t, tmp); OCTET_STRING_fromBuf(tmp, "asdsa", strlen("asdsa")); } @@ -233,8 +229,8 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance) { /* requestedP_MaxFR1 */ if (0) { asn1cCalloc(ie3->value.choice.DUtoCURRCInformation.requestedP_MaxFR1, - OCTET_STRING_t, tmp); - OCTET_STRING_fromBuf(tmp , "asdsa", strlen("asdsa")); + OCTET_STRING_t, tmp); + OCTET_STRING_fromBuf(tmp, "asdsa", strlen("asdsa")); } } @@ -281,7 +277,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance) { for (int i=0; i<1; i++) { // asn1cSequenceAdd(ie7->value.choice.DRBs_Setup_List.list, - F1AP_DRBs_Setup_ItemIEs_t, drbs_setup_item_ies); + F1AP_DRBs_Setup_ItemIEs_t, drbs_setup_item_ies); drbs_setup_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_Setup_Item; drbs_setup_item_ies->criticality = F1AP_Criticality_ignore; drbs_setup_item_ies->value.present = F1AP_SRBs_FailedToBeSetup_ItemIEs__value_PR_SRBs_FailedToBeSetup_Item; @@ -297,20 +293,19 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance) { //drbs_setup_item.lCID = 1L; for (int j=0; j<1; j++) { - /* ADD */ + /* ADD */ asn1cSequenceAdd(drbs_setup_item->dLUPTNLInformation_ToBeSetup_List.list, - F1AP_DLUPTNLInformation_ToBeSetup_Item_t, dLUPTNLInformation_ToBeSetup_Item); + F1AP_DLUPTNLInformation_ToBeSetup_Item_t, dLUPTNLInformation_ToBeSetup_Item); dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; /* gTPTunnel */ asn1cCalloc(dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.choice.gTPTunnel, - F1AP_GTPTunnel_t, gTPTunnel); - /* transportLayerAddress */ - TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); - /* gTP_TEID */ - OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "1204", - strlen("1204")); + F1AP_GTPTunnel_t, gTPTunnel); + /* transportLayerAddress */ + TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); + /* gTP_TEID */ + 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 // /* */ @@ -418,15 +411,15 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance) { for (int i=0; i<1; i++) { asn1cSequenceAdd(ie10->value.choice.SCell_FailedtoSetup_List.list, - F1AP_SCell_FailedtoSetup_ItemIEs_t, sCell_FailedtoSetup_item_ies); + F1AP_SCell_FailedtoSetup_ItemIEs_t, sCell_FailedtoSetup_item_ies); sCell_FailedtoSetup_item_ies->id = F1AP_ProtocolIE_ID_id_SCell_FailedtoSetup_Item; 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) { @@ -475,13 +466,13 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance) { ie12->criticality = F1AP_Criticality_ignore; ie12->value.present = F1AP_UEContextSetupResponseIEs__value_PR_CriticalityDiagnostics; asn1cCallocOne(ie12->value.choice.CriticalityDiagnostics.procedureCode, - F1AP_ProcedureCode_t, F1AP_ProcedureCode_id_UEContextSetup); + F1AP_ProcedureCode_t, F1AP_ProcedureCode_id_UEContextSetup); asn1cCallocOne(ie12->value.choice.CriticalityDiagnostics.triggeringMessage, - F1AP_TriggeringMessage_t, F1AP_TriggeringMessage_initiating_message); + F1AP_TriggeringMessage_t, F1AP_TriggeringMessage_initiating_message); asn1cCallocOne(ie12->value.choice.CriticalityDiagnostics.procedureCriticality, - F1AP_Criticality_t, F1AP_Criticality_reject); + F1AP_Criticality_t, F1AP_Criticality_reject); asn1cCallocOne(ie12->value.choice.CriticalityDiagnostics.transactionID, - F1AP_TransactionID_t, 0); + F1AP_TransactionID_t, 0); } /* encode */ @@ -489,7 +480,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance) { LOG_E(F1AP, "Failed to encode F1 UE CONTEXT SETUP RESPONSE\n"); return -1; } - + return 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, - buffer, - len, - f1ap_du_data->default_sctp_stream_id); + f1ap_itti_send_sctp_data_req(false, instance, + buffer, + len, + 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, - buffer, - len, - f1ap_du_data->default_sctp_stream_id); - f1ap_remove_ue(&f1ap_du_inst[instance], cplt->rnti); + f1ap_itti_send_sctp_data_req(false, instance, + buffer, + len, + 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; } diff --git a/openair2/F1AP/f1ap_handlers.c b/openair2/F1AP/f1ap_handlers.c index fd8ec0e2e6..5eff06c010 100644 --- a/openair2/F1AP/f1ap_handlers.c +++ b/openair2/F1AP/f1ap_handlers.c @@ -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] = { diff --git a/openair2/F1AP/f1ap_itti_messaging.c b/openair2/F1AP/f1ap_itti_messaging.c index 94f844f367..21096a6518 100644 --- a/openair2/F1AP/f1ap_itti_messaging.c +++ b/openair2/F1AP/f1ap_itti_messaging.c @@ -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, - uint32_t buffer_length, uint16_t stream) { +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); } diff --git a/openair2/F1AP/f1ap_itti_messaging.h b/openair2/F1AP/f1ap_itti_messaging.h index b32785035d..a5560e6c81 100644 --- a/openair2/F1AP/f1ap_itti_messaging.h +++ b/openair2/F1AP/f1ap_itti_messaging.h @@ -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, - uint32_t buffer_length, uint16_t stream); +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_ */ diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 1313ca9594..e6002bce26 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -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 Date: Mon, 12 Jul 2021 14:40:40 +0200 Subject: [PATCH 007/110] add processing of pduSessionEstablishmentAccept --- openair3/NAS/NR_UE/nr_nas_msg_sim.c | 75 +++++++++++++++++++++-------- 1 file changed, 54 insertions(+), 21 deletions(-) diff --git a/openair3/NAS/NR_UE/nr_nas_msg_sim.c b/openair3/NAS/NR_UE/nr_nas_msg_sim.c index ca7df4cac7..7520dfb251 100644 --- a/openair3/NAS/NR_UE/nr_nas_msg_sim.c +++ b/openair3/NAS/NR_UE/nr_nas_msg_sim.c @@ -43,6 +43,7 @@ #include #include #include +#include uint8_t *registration_request_buf; uint32_t registration_request_len; @@ -854,9 +855,12 @@ void *nas_nrue_task(void *args_p) offset = 0; while(offset < payload_container_length) { + // Fixme: this is not good 'type' 0x29 searching in TLV like structure + // AND fix dirsty code copy hereafter of the same!!! if (*(payload_container + offset) == 0x29) { // PDU address IEI if ((*(payload_container+offset+1) == 0x05) && (*(payload_container +offset+2) == 0x01)) { // IPV4 nas_getparams(); + // FixME: seems wrong: pdcp_module_init has already created the interface netlink_init_tun("ue", 1); sprintf(baseNetAddress, "%d.%d", *(payload_container+offset+3), *(payload_container+offset+4)); int third_octet = *(payload_container+offset+5); @@ -900,36 +904,65 @@ void *nas_nrue_task(void *args_p) msg_type = get_msg_type(pdu_buffer, NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.length); switch(msg_type){ - case FGS_IDENTITY_REQUEST: - generateIdentityResponse(&initialNasMsg,*(pdu_buffer+3), uicc); - break; - case FGS_AUTHENTICATION_REQUEST: - generateAuthenticationResp(&initialNasMsg, pdu_buffer, uicc); - break; - case FGS_SECURITY_MODE_COMMAND: - generateSecurityModeComplete(&initialNasMsg); - break; + case FGS_IDENTITY_REQUEST: + generateIdentityResponse(&initialNasMsg,*(pdu_buffer+3), uicc); + break; + case FGS_AUTHENTICATION_REQUEST: + generateAuthenticationResp(&initialNasMsg, pdu_buffer, uicc); + break; + case FGS_SECURITY_MODE_COMMAND: + generateSecurityModeComplete(&initialNasMsg); + break; case FGS_DOWNLINK_NAS_TRANSPORT: decodeDownlinkNASTransport(&initialNasMsg, pdu_buffer); break; + case FGS_PDU_SESSION_ESTABLISHMENT_ACC: + { + uint8_t offset = 0; + uint8_t *payload_container = pdu_buffer; + offset += SECURITY_PROTECTED_5GS_NAS_MESSAGE_HEADER_LENGTH; + uint16_t payload_container_length = htons(((dl_nas_transport_t *)(pdu_buffer + offset))->payload_container_length); + if ((payload_container_length >= PAYLOAD_CONTAINER_LENGTH_MIN) && + (payload_container_length <= PAYLOAD_CONTAINER_LENGTH_MAX)) + offset += (PLAIN_5GS_NAS_MESSAGE_HEADER_LENGTH + 3); + if (offset < NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.length) + payload_container = pdu_buffer + offset; - default: - LOG_W(NR_RRC,"unknow message type %d\n",msg_type); - break; - } - - if(initialNasMsg.length > 0){ - MessageDef *message_p; - message_p = itti_alloc_new_message(TASK_NAS_NRUE, 0, NAS_UPLINK_DATA_REQ); - NAS_UPLINK_DATA_REQ(message_p).UEid = Mod_id; - NAS_UPLINK_DATA_REQ(message_p).nasMsg.data = (uint8_t *)initialNasMsg.data; + while(offset < payload_container_length) { + if (*(payload_container + offset) == 0x29) { // PDU address IEI + if ((*(payload_container+offset+1) == 0x05) && (*(payload_container +offset+2) == 0x01)) { // IPV4 + nas_getparams(); + sprintf(baseNetAddress, "%d.%d", *(payload_container+offset+3), *(payload_container+offset+4)); + int third_octet = *(payload_container+offset+5); + int fourth_octet = *(payload_container+offset+6); + LOG_I(NAS, "Received PDU Session Establishment Accept, UE IP: %d.%d.%d.%d\n", + *(payload_container+offset+3), *(payload_container+offset+4), + *(payload_container+offset+5), *(payload_container+offset+6)); + nas_config(1,third_octet,fourth_octet,"oaitun_ue"); + break; + } + } + offset++; + } + } + break; + + default: + LOG_W(NR_RRC,"unknow message type %d\n",msg_type); + break; + } + + if(initialNasMsg.length > 0){ + MessageDef *message_p; + message_p = itti_alloc_new_message(TASK_NAS_NRUE, 0, NAS_UPLINK_DATA_REQ); + NAS_UPLINK_DATA_REQ(message_p).UEid = Mod_id; + NAS_UPLINK_DATA_REQ(message_p).nasMsg.data = (uint8_t *)initialNasMsg.data; NAS_UPLINK_DATA_REQ(message_p).nasMsg.length = initialNasMsg.length; itti_send_msg_to_task(TASK_RRC_NRUE, instance, message_p); LOG_I(NAS, "Send NAS_UPLINK_DATA_REQ message\n"); } - - break; } + break; default: LOG_E(NAS, "[UE %d] Received unexpected message %s\n", Mod_id, ITTI_MSG_NAME (msg_p)); From bb6ded4258ed50f92bec78e49c8fd551029bb498 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Tue, 13 Jul 2021 13:40:28 +0200 Subject: [PATCH 008/110] Remove big race condition, remove name "callback" on what is not a callback --- openair2/COMMON/f1ap_messages_types.h | 2 +- openair2/F1AP/f1ap_common.h | 6 +- openair2/F1AP/f1ap_cu_task.c | 1 - openair2/F1AP/f1ap_cu_ue_context_management.c | 4 +- openair2/F1AP/f1ap_du_task.c | 1 - openair2/F1AP/f1ap_handlers.c | 27 +- openair2/F1AP/f1ap_handlers.h | 39 -- openair2/RRC/LTE/rrc_UE_ral.c | 238 --------- openair2/RRC/LTE/rrc_eNB_ral.c | 236 --------- openair2/RRC/NR/L2_nr_interface.c | 24 +- openair3/GTPV1-U/gtpv1u_task.c | 485 ------------------ 11 files changed, 29 insertions(+), 1034 deletions(-) delete mode 100644 openair2/F1AP/f1ap_handlers.h delete mode 100644 openair2/RRC/LTE/rrc_UE_ral.c delete mode 100644 openair2/RRC/LTE/rrc_eNB_ral.c delete mode 100644 openair3/GTPV1-U/gtpv1u_task.c diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index 4327382be8..f16f4842cb 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -303,7 +303,7 @@ typedef struct f1ap_initial_ul_rrc_message_s { uint16_t crnti; uint8_t *rrc_container; int rrc_container_length; - char *du2cu_rrc_container; + char du2cu_rrc_container[100]; int du2cu_rrc_container_length; } f1ap_initial_ul_rrc_message_t; diff --git a/openair2/F1AP/f1ap_common.h b/openair2/F1AP/f1ap_common.h index 22fd8ec8cb..7bceeab68a 100644 --- a/openair2/F1AP/f1ap_common.h +++ b/openair2/F1AP/f1ap_common.h @@ -407,14 +407,16 @@ if (mandatory) DevAssert(ie != NULL); \ } while(0) -/** \brief Function callback prototype. +/** \brief Function array prototype. **/ -typedef int (*f1ap_message_decoded_callback)( +typedef int (*f1ap_message_processing_t)( instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *message_p ); +int f1ap_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, + const uint8_t *const data, const uint32_t data_length); typedef struct f1ap_cudu_ue_inst_s { // used for eNB stats generation diff --git a/openair2/F1AP/f1ap_cu_task.c b/openair2/F1AP/f1ap_cu_task.c index a4b9b82dac..f1c952fd6c 100644 --- a/openair2/F1AP/f1ap_cu_task.c +++ b/openair2/F1AP/f1ap_cu_task.c @@ -31,7 +31,6 @@ */ #include "f1ap_common.h" -#include "f1ap_handlers.h" #include "f1ap_cu_interface_management.h" #include "f1ap_cu_rrc_message_transfer.h" #include "f1ap_cu_ue_context_management.h" diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 68d71065e5..f3a8295ba0 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -324,7 +324,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, { /* qoS_Characteristics */ { - int some_decide_qoS_characteristics = 1; // BK: Need Check + int some_decide_qoS_characteristics = 0; // BK: Need Check if (some_decide_qoS_characteristics) { DRB_Information->dRB_QoS.qoS_Characteristics.present = F1AP_QoS_Characteristics_PR_non_Dynamic_5QI; @@ -433,7 +433,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, { /* qoS_Characteristics */ { - int some_decide_qoS_characteristics = 1; // BK: Need Check + int some_decide_qoS_characteristics = 0; // BK: Need Check F1AP_QoS_Characteristics_t *QosParams=&flows_mapped_to_drb_item->qoSFlowLevelQoSParameters.qoS_Characteristics; if (some_decide_qoS_characteristics) { diff --git a/openair2/F1AP/f1ap_du_task.c b/openair2/F1AP/f1ap_du_task.c index ffa14e0a35..1745f0cce7 100644 --- a/openair2/F1AP/f1ap_du_task.c +++ b/openair2/F1AP/f1ap_du_task.c @@ -31,7 +31,6 @@ */ #include "f1ap_common.h" -#include "f1ap_handlers.h" #include "f1ap_du_interface_management.h" #include "f1ap_du_ue_context_management.h" #include "f1ap_du_rrc_message_transfer.h" diff --git a/openair2/F1AP/f1ap_handlers.c b/openair2/F1AP/f1ap_handlers.c index 5eff06c010..e8c0f4de43 100644 --- a/openair2/F1AP/f1ap_handlers.c +++ b/openair2/F1AP/f1ap_handlers.c @@ -31,7 +31,6 @@ */ #include "f1ap_common.h" -#include "f1ap_handlers.h" #include "f1ap_decoder.h" #include "f1ap_cu_interface_management.h" #include "f1ap_du_interface_management.h" @@ -41,7 +40,7 @@ #include "f1ap_du_ue_context_management.h" /* Handlers matrix. Only f1 related procedure present here */ -f1ap_message_decoded_callback f1ap_messages_callback[][3] = { +f1ap_message_processing_t f1ap_messages_processing[][3] = { { 0, 0, 0 }, /* Reset */ @@ -92,8 +91,8 @@ int f1ap_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, } /* Checking procedure Code and direction of message */ - if (pdu.choice.initiatingMessage->procedureCode >= sizeof(f1ap_messages_callback) / (3 * sizeof( - f1ap_message_decoded_callback)) + if (pdu.choice.initiatingMessage->procedureCode >= sizeof(f1ap_message_processing_t) / (3 * sizeof( + f1ap_message_processing_t)) || (pdu.present > F1AP_F1AP_PDU_PR_unsuccessfulOutcome)) { LOG_E(F1AP, "[SCTP %d] Either procedureCode %ld or direction %d exceed expected\n", assoc_id, pdu.choice.initiatingMessage->procedureCode, pdu.present); @@ -101,21 +100,19 @@ int f1ap_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, return -1; } - /* No handler present. - * This can mean not implemented or no procedure for eNB (wrong direction). - */ - if (f1ap_messages_callback[pdu.choice.initiatingMessage->procedureCode][pdu.present - 1] == NULL) { + + if (f1ap_messages_processing[pdu.choice.initiatingMessage->procedureCode][pdu.present - 1] == NULL) { + // No handler present. This can mean not implemented or no procedure for eNB (wrong direction). LOG_E(F1AP, "[SCTP %d] No handler for procedureCode %ld in %s\n", assoc_id, pdu.choice.initiatingMessage->procedureCode, f1ap_direction2String(pdu.present - 1)); - ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, &pdu); - return -1; + ret=-1; + } else { + /* Calling the right handler */ + LOG_I(F1AP, "Calling handler with instance %ld\n",instance); + ret = (*f1ap_messages_processing[pdu.choice.initiatingMessage->procedureCode][pdu.present - 1]) + (instance, assoc_id, stream, &pdu); } - - /* Calling the right handler */ - LOG_I(F1AP, "Calling handler with instance %ld\n",instance); - ret = (*f1ap_messages_callback[pdu.choice.initiatingMessage->procedureCode][pdu.present - 1]) - (instance, assoc_id, stream, &pdu); ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, &pdu); return ret; } diff --git a/openair2/F1AP/f1ap_handlers.h b/openair2/F1AP/f1ap_handlers.h deleted file mode 100644 index 7a0b891f62..0000000000 --- a/openair2/F1AP/f1ap_handlers.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file f1ap_handlers.h - * \brief f1ap messages handlers - * \author EURECOM/NTUST - * \date 2018 - * \version 0.1 - * \company Eurecom - * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr - * \note - * \warning - */ - -#ifndef F1AP_HANDLERS_H_ -#define F1AP_HANDLERS_H_ - -int f1ap_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, - const uint8_t *const data, const uint32_t data_length); - -#endif /* F1AP_HANDLERS_H_ */ diff --git a/openair2/RRC/LTE/rrc_UE_ral.c b/openair2/RRC/LTE/rrc_UE_ral.c deleted file mode 100644 index 1ebba43d8b..0000000000 --- a/openair2/RRC/LTE/rrc_UE_ral.c +++ /dev/null @@ -1,238 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file rrc_UE_ral.c - * \brief rrc procedures for handling RAL messages - * \author Lionel GAUTHIER - * \date 2013 - * \version 1.0 - * \company Eurecom - * \email: lionel.gauthier@eurecom.fr - */ -#define RRC_UE -#define RRC_UE_RAL_C -//----------------------------------------------------------------------------- -#include "rrc_UE_ral.h" -#include "assertions.h" -#include "collection/hashtable/obj_hashtable.h" -#include "RRC/LTE/defs.h" -#include "RRC/LTE/extern.h" - - -//----------------------------------------------------------------------------- -int rrc_ue_ral_delete_all_thresholds_type(unsigned int mod_idP, ral_link_param_type_t *param_type_pP) -//----------------------------------------------------------------------------- -{ - hashtable_rc_t rc; - rrc_ral_threshold_key_t *key; - rrc_ral_threshold_key_t *keys = NULL; - unsigned int num_keys = 0; - int return_code = 0; - rc = obj_hashtable_get_keys(UE_rrc_inst[mod_idP].ral_meas_thresholds, (void *)&keys, &num_keys); - - if (rc == HASH_TABLE_OK) { - key = keys; - - while (num_keys > 0) { - if (memcmp(&key->link_param_type, param_type_pP, sizeof(ral_link_param_type_t)) == 0) { - rc = obj_hashtable_remove (UE_rrc_inst[mod_idP].ral_meas_thresholds, key, sizeof(rrc_ral_threshold_key_t)); - - if (rc != HASH_TABLE_OK) { - return_code = -1; - } - } - - key = &key[1]; - num_keys--; - } - } else { - return_code = -1; - } - - if (keys != NULL) { - free(keys); - } - - return return_code; -} - - -//----------------------------------------------------------------------------- -int rrc_ue_ral_delete_threshold(unsigned int mod_idP, ral_link_param_type_t *param_type_pP, ral_threshold_t *threshold_pP) -//----------------------------------------------------------------------------- -{ - hashtable_rc_t rc; - rrc_ral_threshold_key_t ref_key; - memcpy(&ref_key.link_param_type, param_type_pP, sizeof(ral_link_param_type_t)); - memcpy(&ref_key.threshold, threshold_pP, sizeof(ral_threshold_t)); - rc = obj_hashtable_remove (UE_rrc_inst[mod_idP].ral_meas_thresholds, (void *)&ref_key, sizeof(rrc_ral_threshold_key_t)); - - if (rc == HASH_TABLE_OK) { - return 0; - } else { - return -1; - } -} - - -//----------------------------------------------------------------------------- -int rrc_ue_ral_handle_configure_threshold_request(unsigned int mod_idP, MessageDef *msg_pP) -//----------------------------------------------------------------------------- -{ - ral_transaction_id_t transaction_id = 0; - rrc_ral_configure_threshold_req_t *configure_threshold_req_p = NULL; - ral_link_cfg_param_t *link_cfg_param_p = NULL; - ral_threshold_t *threshold_p = NULL; - MessageDef *message_p = NULL; - unsigned int ix_param = 0; - unsigned int ix_thresholds = 0; - DevAssert(msg_pP != NULL); - LOG_I(RRC, "[UE %d] Received %s\n", mod_idP, ITTI_MSG_NAME (msg_pP)); - configure_threshold_req_p = &RRC_RAL_CONFIGURE_THRESHOLD_REQ(msg_pP); - transaction_id = configure_threshold_req_p->transaction_id; - - for (ix_param = 0; ix_param < configure_threshold_req_p->num_link_cfg_params; ix_param++) { - link_cfg_param_p = &configure_threshold_req_p->link_cfg_params[ix_param]; - - switch (link_cfg_param_p->th_action) { - case RAL_TH_ACTION_SET_NORMAL_THRESHOLD: - case RAL_TH_ACTION_SET_ONE_SHOT_THRESHOLD: - switch (link_cfg_param_p->link_param_type.choice) { - case RAL_LINK_PARAM_TYPE_CHOICE_GEN: - switch (link_cfg_param_p->link_param_type._union.link_param_gen) { - case RAL_LINK_PARAM_GEN_DATA_RATE: - case RAL_LINK_PARAM_GEN_SIGNAL_STRENGTH: - case RAL_LINK_PARAM_GEN_SINR: - case RAL_LINK_PARAM_GEN_THROUGHPUT: - case RAL_LINK_PARAM_GEN_PACKET_ERROR_RATE: - message_p = itti_alloc_new_message (TASK_RRC_UE, PHY_MEAS_THRESHOLD_REQ); - PHY_MEAS_THRESHOLD_REQ(message_p).transaction_id = transaction_id; - memcpy (&PHY_MEAS_THRESHOLD_REQ(message_p).cfg_param, (void *) link_cfg_param_p, sizeof(ral_link_cfg_param_t)); - itti_send_msg_to_task (TASK_PHY_UE, ITTI_MSG_DESTINATION_INSTANCE(msg_pP), message_p); - break; - - default: - LOG_E(RRC, "Message RRC_RAL_CONFIGURE_THRESHOLD_REQ malformed, unknown link_param_gen %d\n", link_cfg_param_p->link_param_type._union.link_param_gen); - return -1; - } - - break; - - case RAL_LINK_PARAM_TYPE_CHOICE_QOS: - switch (link_cfg_param_p->link_param_type._union.link_param_qos) { - case RAL_LINK_PARAM_QOS_MAX_NUM_DIF_COS_SUPPORTED: - case RAL_LINK_PARAM_QOS_MIN_PACKET_TRANSFER_DELAY_ALL_COS: - case RAL_LINK_PARAM_QOS_AVG_PACKET_TRANSFER_DELAY_ALL_COS: - case RAL_LINK_PARAM_QOS_MAX_PACKET_TRANSFER_DELAY_ALL_COS: - case RAL_LINK_PARAM_QOS_STD_DEVIATION_PACKET_TRANSFER_DELAY: - case RAL_LINK_PARAM_QOS_PACKET_LOSS_RATE_ALL_COS_FRAME_RATIO: - message_p = itti_alloc_new_message (TASK_RRC_UE, PHY_MEAS_THRESHOLD_REQ); - PHY_MEAS_THRESHOLD_REQ(message_p).transaction_id = transaction_id; - memcpy (&PHY_MEAS_THRESHOLD_REQ(message_p).cfg_param, (void *) link_cfg_param_p, sizeof(ral_link_cfg_param_t)); - itti_send_msg_to_task (TASK_MAC_UE, ITTI_MSG_DESTINATION_INSTANCE(msg_pP), message_p); - break; - - default: - LOG_E(RRC, "Message RRC_RAL_CONFIGURE_THRESHOLD_REQ malformed, unknown link_param_qos %d\n", link_cfg_param_p->link_param_type._union.link_param_qos); - return -1; - } - - break; - - case RAL_LINK_PARAM_TYPE_CHOICE_LTE: - switch (link_cfg_param_p->link_param_type._union.link_param_lte) { - // group by dest task id - case RAL_LINK_PARAM_LTE_UE_RSRP: - case RAL_LINK_PARAM_LTE_UE_RSRQ: - case RAL_LINK_PARAM_LTE_UE_CQI: - message_p = itti_alloc_new_message (TASK_RRC_UE, PHY_MEAS_THRESHOLD_REQ); - PHY_MEAS_THRESHOLD_REQ(message_p).transaction_id = transaction_id; - memcpy (&PHY_MEAS_THRESHOLD_REQ(message_p).cfg_param, (void *) link_cfg_param_p, sizeof(ral_link_cfg_param_t)); - itti_send_msg_to_task (TASK_PHY_UE, ITTI_MSG_DESTINATION_INSTANCE(msg_pP), message_p); - break; - - case RAL_LINK_PARAM_LTE_AVAILABLE_BW: - case RAL_LINK_PARAM_LTE_PACKET_LOSS_RATE: - case RAL_LINK_PARAM_LTE_L2_BUFFER_STATUS: - case RAL_LINK_PARAM_LTE_PACKET_DELAY: - message_p = itti_alloc_new_message (TASK_RRC_UE, PHY_MEAS_THRESHOLD_REQ); - PHY_MEAS_THRESHOLD_REQ(message_p).transaction_id = transaction_id; - memcpy (&PHY_MEAS_THRESHOLD_REQ(message_p).cfg_param, (void *) link_cfg_param_p, sizeof(ral_link_cfg_param_t)); - itti_send_msg_to_task (TASK_MAC_UE, ITTI_MSG_DESTINATION_INSTANCE(msg_pP), message_p); - break; - - case RAL_LINK_PARAM_LTE_MOBILE_NODE_CAPABILITIES: - case RAL_LINK_PARAM_LTE_EMBMS_CAPABILITY: - case RAL_LINK_PARAM_LTE_JUMBO_FEASIBILITY: - case RAL_LINK_PARAM_LTE_JUMBO_SETUP_STATUS: - case RAL_LINK_PARAM_LTE_NUM_ACTIVE_EMBMS_RECEIVERS_PER_FLOW: -#warning "TO DO MIH LTE LINK PARAMS IN RRC UE" - break; - - default: - LOG_E(RRC, "Message RRC_RAL_CONFIGURE_THRESHOLD_REQ malformed, unknown link_param_lte %d\n", link_cfg_param_p->link_param_type._union.link_param_lte); - return -1; - } - - break; - - default: - LOG_E(RRC, "Message RRC_RAL_CONFIGURE_THRESHOLD_REQ malformed, unknown link_param_type choice %d\n", link_cfg_param_p->link_param_type.choice); - return -1; - } - - for (ix_thresholds=0; ix_thresholds < link_cfg_param_p->num_thresholds; ix_thresholds++) { - threshold_p = &link_cfg_param_p->thresholds[ix_thresholds]; - } - - break; - - case RAL_TH_ACTION_CANCEL_THRESHOLD: - - // IEEE Std 802.21-2008, Table F4, Data type name=LINK_CFG_PARAM (page 228): - // When “Cancel threshold” is selected and no thresholds are specified, then all - // currently configured thresholds for the given LINK_PARAM_TYPE are cancelled. - if (link_cfg_param_p->num_thresholds == 0) { - rrc_ue_ral_delete_all_thresholds_type(mod_idP, &link_cfg_param_p->link_param_type); - } else { - // - // When “Cancel threshold” is selected and thresholds are specified only those - // configured thresholds for the given LINK_PARAM_TYPE and whose threshold value match what was - // specified are cancelled. - for (ix_thresholds=0; ix_thresholds < link_cfg_param_p->num_thresholds; ix_thresholds++) { - threshold_p = &link_cfg_param_p->thresholds[ix_thresholds]; - rrc_ue_ral_delete_threshold(mod_idP, &link_cfg_param_p->link_param_type, threshold_p); - } - } - - LOG_E(RRC, "Message RRC_RAL_CONFIGURE_THRESHOLD_REQ with RAL_TH_ACTION_CANCEL_THRESHOLD\n"); - break; - - default: - LOG_E(RRC, "Message RRC_RAL_CONFIGURE_THRESHOLD_REQ malformed, unknown th_action %d\n", link_cfg_param_p->th_action); - return -1; - } - } - - return 0; -} - - diff --git a/openair2/RRC/LTE/rrc_eNB_ral.c b/openair2/RRC/LTE/rrc_eNB_ral.c deleted file mode 100644 index 9e1486f6d8..0000000000 --- a/openair2/RRC/LTE/rrc_eNB_ral.c +++ /dev/null @@ -1,236 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file rrc_eNB_ral.c - * \brief rrc procedures for handling RAL messages - * \author Lionel GAUTHIER - * \date 2013 - * \version 1.0 - * \company Eurecom - * \email: lionel.gauthier@eurecom.fr - */ -#define RRC_ENB -#define RRC_ENB_RAL_C -//----------------------------------------------------------------------------- -#include "rrc_eNB_ral.h" -#include "assertions.h" -#include "collection/hashtable/obj_hashtable.h" -#include "RRC/LTE/defs.h" -#include "RRC/LTE/extern.h" - - -//----------------------------------------------------------------------------- -int rrc_enb_ral_delete_all_thresholds_type(unsigned int mod_idP, ral_link_param_type_t *param_type_pP) -//----------------------------------------------------------------------------- -{ - hashtable_rc_t rc; - rrc_ral_threshold_key_t *key; - rrc_ral_threshold_key_t *keys = NULL; - unsigned int num_keys = 0; - int return_code = 0; - rc = obj_hashtable_get_keys(eNB_rrc_inst[mod_idP].ral_meas_thresholds, (void *)&keys, &num_keys); - - if (rc == HASH_TABLE_OK) { - key = keys; - - while (num_keys > 0) { - if (memcmp(&key->link_param_type, param_type_pP, sizeof(ral_link_param_type_t)) == 0) { - rc = obj_hashtable_remove (eNB_rrc_inst[mod_idP].ral_meas_thresholds, key, sizeof(rrc_ral_threshold_key_t)); - - if (rc != HASH_TABLE_OK) { - return_code = -1; - } - } - - key = &key[1]; - num_keys--; - } - } else { - return_code = -1; - } - - if (keys != NULL) { - free(keys); - } - - return return_code; -} - - -//----------------------------------------------------------------------------- -int rrc_enb_ral_delete_threshold(unsigned int mod_idP, ral_link_param_type_t *param_type_pP, ral_threshold_t *threshold_pP) -//----------------------------------------------------------------------------- -{ - hashtable_rc_t rc; - rrc_ral_threshold_key_t ref_key; - memcpy(&ref_key.link_param_type, param_type_pP, sizeof(ral_link_param_type_t)); - memcpy(&ref_key.threshold, threshold_pP, sizeof(ral_threshold_t)); - rc = obj_hashtable_remove (eNB_rrc_inst[mod_idP].ral_meas_thresholds, (void *)&ref_key, sizeof(rrc_ral_threshold_key_t)); - - if (rc == HASH_TABLE_OK) { - return 0; - } else { - return -1; - } -} - - -//----------------------------------------------------------------------------- -int rrc_enb_ral_handle_configure_threshold_request(unsigned int mod_idP, MessageDef *msg_pP) -//----------------------------------------------------------------------------- -{ - ral_transaction_id_t transaction_id = 0; - rrc_ral_configure_threshold_req_t *configure_threshold_req_p = NULL; - ral_link_cfg_param_t *link_cfg_param_p = NULL; - ral_threshold_t *threshold_p = NULL; - MessageDef *message_p = NULL; - unsigned int ix_param = 0; - unsigned int ix_thresholds = 0; - DevAssert(msg_pP != NULL); - LOG_I(RRC, "[eNB %d] Received %s\n", mod_idP, ITTI_MSG_NAME (msg_pP)); - configure_threshold_req_p = &RRC_RAL_CONFIGURE_THRESHOLD_REQ(msg_pP); - transaction_id = configure_threshold_req_p->transaction_id; - - for (ix_param = 0; ix_param < configure_threshold_req_p->num_link_cfg_params; ix_param++) { - link_cfg_param_p = &configure_threshold_req_p->link_cfg_params[ix_param]; - - switch (link_cfg_param_p->th_action) { - case RAL_TH_ACTION_SET_NORMAL_THRESHOLD: - case RAL_TH_ACTION_SET_ONE_SHOT_THRESHOLD: - switch (link_cfg_param_p->link_param_type.choice) { - case RAL_LINK_PARAM_TYPE_CHOICE_GEN: - switch (link_cfg_param_p->link_param_type._union.link_param_gen) { - case RAL_LINK_PARAM_GEN_DATA_RATE: - case RAL_LINK_PARAM_GEN_SIGNAL_STRENGTH: - case RAL_LINK_PARAM_GEN_SINR: - case RAL_LINK_PARAM_GEN_THROUGHPUT: - case RAL_LINK_PARAM_GEN_PACKET_ERROR_RATE: - message_p = itti_alloc_new_message (TASK_RRC_ENB, PHY_MEAS_THRESHOLD_REQ); - PHY_MEAS_THRESHOLD_REQ(message_p).transaction_id = transaction_id; - memcpy (&PHY_MEAS_THRESHOLD_REQ(message_p).cfg_param, (void *) link_cfg_param_p, sizeof(ral_link_cfg_param_t)); - itti_send_msg_to_task (TASK_PHY_ENB, ITTI_MSG_DESTINATION_INSTANCE(msg_pP), message_p); - break; - - default: - LOG_E(RRC, "Message RRC_RAL_CONFIGURE_THRESHOLD_REQ malformed, unknown link_param_gen %d\n", link_cfg_param_p->link_param_type._union.link_param_gen); - return -1; - } - - break; - - case RAL_LINK_PARAM_TYPE_CHOICE_QOS: - switch (link_cfg_param_p->link_param_type._union.link_param_qos) { - case RAL_LINK_PARAM_QOS_MAX_NUM_DIF_COS_SUPPORTED: - case RAL_LINK_PARAM_QOS_MIN_PACKET_TRANSFER_DELAY_ALL_COS: - case RAL_LINK_PARAM_QOS_AVG_PACKET_TRANSFER_DELAY_ALL_COS: - case RAL_LINK_PARAM_QOS_MAX_PACKET_TRANSFER_DELAY_ALL_COS: - case RAL_LINK_PARAM_QOS_STD_DEVIATION_PACKET_TRANSFER_DELAY: - case RAL_LINK_PARAM_QOS_PACKET_LOSS_RATE_ALL_COS_FRAME_RATIO: - message_p = itti_alloc_new_message (TASK_RRC_ENB, PHY_MEAS_THRESHOLD_REQ); - PHY_MEAS_THRESHOLD_REQ(message_p).transaction_id = transaction_id; - memcpy (&PHY_MEAS_THRESHOLD_REQ(message_p).cfg_param, (void *) link_cfg_param_p, sizeof(ral_link_cfg_param_t)); - itti_send_msg_to_task (TASK_MAC_ENB, ITTI_MSG_DESTINATION_INSTANCE(msg_pP), message_p); - break; - - default: - LOG_E(RRC, "Message RRC_RAL_CONFIGURE_THRESHOLD_REQ malformed, unknown link_param_qos %d\n", link_cfg_param_p->link_param_type._union.link_param_qos); - return -1; - } - - break; - - case RAL_LINK_PARAM_TYPE_CHOICE_LTE: - switch (link_cfg_param_p->link_param_type._union.link_param_lte) { - // group by dest task id - case RAL_LINK_PARAM_LTE_UE_RSRP: - case RAL_LINK_PARAM_LTE_UE_RSRQ: - case RAL_LINK_PARAM_LTE_UE_CQI: - message_p = itti_alloc_new_message (TASK_RRC_ENB, PHY_MEAS_THRESHOLD_REQ); - PHY_MEAS_THRESHOLD_REQ(message_p).transaction_id = transaction_id; - memcpy (&PHY_MEAS_THRESHOLD_REQ(message_p).cfg_param, (void *) link_cfg_param_p, sizeof(ral_link_cfg_param_t)); - itti_send_msg_to_task (TASK_PHY_ENB, ITTI_MSG_DESTINATION_INSTANCE(msg_pP), message_p); - break; - - case RAL_LINK_PARAM_LTE_AVAILABLE_BW: - case RAL_LINK_PARAM_LTE_PACKET_LOSS_RATE: - case RAL_LINK_PARAM_LTE_L2_BUFFER_STATUS: - case RAL_LINK_PARAM_LTE_PACKET_DELAY: - message_p = itti_alloc_new_message (TASK_RRC_ENB, PHY_MEAS_THRESHOLD_REQ); - PHY_MEAS_THRESHOLD_REQ(message_p).transaction_id = transaction_id; - memcpy (&PHY_MEAS_THRESHOLD_REQ(message_p).cfg_param, (void *) link_cfg_param_p, sizeof(ral_link_cfg_param_t)); - itti_send_msg_to_task (TASK_MAC_ENB, ITTI_MSG_DESTINATION_INSTANCE(msg_pP), message_p); - break; - - case RAL_LINK_PARAM_LTE_MOBILE_NODE_CAPABILITIES: - case RAL_LINK_PARAM_LTE_EMBMS_CAPABILITY: - case RAL_LINK_PARAM_LTE_JUMBO_FEASIBILITY: - case RAL_LINK_PARAM_LTE_JUMBO_SETUP_STATUS: - case RAL_LINK_PARAM_LTE_NUM_ACTIVE_EMBMS_RECEIVERS_PER_FLOW: -#warning "TO DO MIH LTE LINK PARAMS IN RRC ENB" - break; - - default: - LOG_E(RRC, "Message RRC_RAL_CONFIGURE_THRESHOLD_REQ malformed, unknown link_param_lte %d\n", link_cfg_param_p->link_param_type._union.link_param_lte); - return -1; - } - - break; - - default: - LOG_E(RRC, "Message RRC_RAL_CONFIGURE_THRESHOLD_REQ malformed, unknown link_param_type choice %d\n", link_cfg_param_p->link_param_type.choice); - return -1; - } - - for (ix_thresholds=0; ix_thresholds < link_cfg_param_p->num_thresholds; ix_thresholds++) { - threshold_p = &link_cfg_param_p->thresholds[ix_thresholds]; - } - - break; - - case RAL_TH_ACTION_CANCEL_THRESHOLD: - - // IEEE Std 802.21-2008, Table F4, Data type name=LINK_CFG_PARAM (page 228): - // When “Cancel threshold” is selected and no thresholds are specified, then all - // currently configured thresholds for the given LINK_PARAM_TYPE are cancelled. - if (link_cfg_param_p->num_thresholds == 0) { - rrc_enb_ral_delete_all_thresholds_type(mod_idP, &link_cfg_param_p->link_param_type); - } else { - // - // When “Cancel threshold” is selected and thresholds are specified only those - // configured thresholds for the given LINK_PARAM_TYPE and whose threshold value match what was - // specified are cancelled. - for (ix_thresholds=0; ix_thresholds < link_cfg_param_p->num_thresholds; ix_thresholds++) { - threshold_p = &link_cfg_param_p->thresholds[ix_thresholds]; - rrc_enb_ral_delete_threshold(mod_idP, &link_cfg_param_p->link_param_type, threshold_p); - } - } - - break; - - default: - LOG_E(RRC, "Message RRC_RAL_CONFIGURE_THRESHOLD_REQ malformed, unknown th_action %d\n", link_cfg_param_p->th_action); - return -1; - } - } - - return 0; -} - diff --git a/openair2/RRC/NR/L2_nr_interface.c b/openair2/RRC/NR/L2_nr_interface.c index 1b5c35f0f8..063ba32fb6 100644 --- a/openair2/RRC/NR/L2_nr_interface.c +++ b/openair2/RRC/NR/L2_nr_interface.c @@ -322,31 +322,27 @@ int8_t nr_mac_rrc_data_ind(const module_id_t module_idP, // call do_RRCSetup like full procedure and extract masterCellGroup NR_CellGroupConfig_t cellGroupConfig; NR_ServingCellConfigCommon_t *scc=RC.nrrrc[module_idP]->carrier.servingcellconfigcommon; - uint8_t sdu2[100]; memset(&cellGroupConfig,0,sizeof(cellGroupConfig)); fill_initial_cellGroupConfig(rntiP,&cellGroupConfig,scc); + MessageDef* tmp=itti_alloc_new_message_sized(TASK_RRC_GNB, 0, F1AP_INITIAL_UL_RRC_MESSAGE, sizeof(f1ap_initial_ul_rrc_message_t) + sdu_lenP); + f1ap_initial_ul_rrc_message_t *msg = &F1AP_INITIAL_UL_RRC_MESSAGE(tmp); asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig, NULL, (void *)&cellGroupConfig, - sdu2, - 100); + msg->du2cu_rrc_container, + sizeof(msg->du2cu_rrc_container)); - int sdu2_len = (enc_rval.encoded+7)/8; if (enc_rval.encoded == -1) { LOG_I(F1AP,"Could not encoded cellGroupConfig, failed element %s\n",enc_rval.failed_type->name); exit(-1); } /* do ITTI message */ - DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER( - module_idP, - CC_id, - UE_id, - rntiP, - sduP, - sdu_lenP, - sdu2, - sdu2_len - ); + msg->du2cu_rrc_container_length = (enc_rval.encoded+7)/8; + msg->crnti=rntiP; + msg->rrc_container=(uint8_t*) (msg+1); // Made extra room after the struct with itti_alloc_msg_sized() + memcpy(msg->rrc_container, sduP, sdu_lenP); + msg->rrc_container_length=sdu_lenP; + itti_send_msg(TASK_DU_F1, 0, tmp); return(0); } diff --git a/openair3/GTPV1-U/gtpv1u_task.c b/openair3/GTPV1-U/gtpv1u_task.c deleted file mode 100644 index 1339839cf9..0000000000 --- a/openair3/GTPV1-U/gtpv1u_task.c +++ /dev/null @@ -1,485 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file gtpv1u_task.c -* \brief -* \author Sebastien ROUX, Lionel Gauthier -* \company Eurecom -* \email: lionel.gauthier@eurecom.fr -*/ -#include -#include -#include -#include -#include - -#include "mme_config.h" - -#include "assertions.h" -#include "intertask_interface.h" - -#include "gtpv1u.h" -#include "NwGtpv1u.h" -#include "NwGtpv1uMsg.h" -#include "NwLog.h" -#include "gtpv1u_sgw_defs.h" -#include "NwGtpv1uPrivate.h" -#include "msc.h" - -//static NwGtpv1uStackHandleT gtpv1u_stack = 0; -static gtpv1u_data_t gtpv1u_sgw_data; - - -static int gtpv1u_create_s1u_tunnel(Gtpv1uCreateTunnelReq *create_tunnel_reqP); -static int gtpv1u_delete_s1u_tunnel(Teid_t context_teidP, Teid_t S1U_teidP); -static int gtpv1u_update_s1u_tunnel(Gtpv1uUpdateTunnelReq *reqP); -static void *gtpv1u_thread(void *args); - -NwGtpv1uRcT gtpv1u_send_udp_msg( - NwGtpv1uUdpHandleT udpHandle, - uint8_t *buffer, - uint32_t buffer_len, - uint32_t buffer_offset, - uint32_t peerIpAddr, - uint32_t peerPort); - -NwGtpv1uRcT gtpv1u_log_request( - NwGtpv1uLogMgrHandleT hLogMgr, - uint32_t logLevel, - NwCharT *file, - uint32_t line, - NwCharT *logStr); - -NwGtpv1uRcT gtpv1u_process_stack_req( - NwGtpv1uUlpHandleT hUlp, - NwGtpv1uUlpApiT *pUlpApi); - - -//----------------------------------------------------------------------------- -void gtpu_print_hex_octets(unsigned char* dataP, unsigned long sizeP) -//----------------------------------------------------------------------------- -{ - unsigned long octet_index = 0; - unsigned long buffer_marker = 0; - unsigned char aindex; -#define GTPU_2_PRINT_BUFFER_LEN 8000 - char gtpu_2_print_buffer[GTPU_2_PRINT_BUFFER_LEN]; - struct timeval tv; - struct timezone tz; - char timeofday[64]; - unsigned int h,m,s; - - if (dataP == NULL) { - return; - } - - gettimeofday(&tv, &tz); - h = tv.tv_sec/3600/24; - m = (tv.tv_sec / 60) % 60; - s = tv.tv_sec % 60; - snprintf(timeofday, 64, "%02u:%02u:%02u.%06d", h,m,s,tv.tv_usec); - - GTPU_DEBUG("%s------+-------------------------------------------------|\n",timeofday); - GTPU_DEBUG("%s | 0 1 2 3 4 5 6 7 8 9 a b c d e f |\n",timeofday); - GTPU_DEBUG("%s------+-------------------------------------------------|\n",timeofday); - - for (octet_index = 0; octet_index < sizeP; octet_index++) { - if (GTPU_2_PRINT_BUFFER_LEN < (buffer_marker + 32)) { - buffer_marker+=snprintf(>pu_2_print_buffer[buffer_marker], GTPU_2_PRINT_BUFFER_LEN - buffer_marker, - "... (print buffer overflow)"); - GTPU_DEBUG("%s%s",timeofday,gtpu_2_print_buffer); - return; - } - - if ((octet_index % 16) == 0) { - if (octet_index != 0) { - buffer_marker+=snprintf(>pu_2_print_buffer[buffer_marker], GTPU_2_PRINT_BUFFER_LEN - buffer_marker, " |\n"); - GTPU_DEBUG("%s%s",timeofday, gtpu_2_print_buffer); - buffer_marker = 0; - } - - buffer_marker+=snprintf(>pu_2_print_buffer[buffer_marker], GTPU_2_PRINT_BUFFER_LEN - buffer_marker, " %04lu |", octet_index); - } - - /* - * Print every single octet in hexadecimal form - */ - buffer_marker+=snprintf(>pu_2_print_buffer[buffer_marker], GTPU_2_PRINT_BUFFER_LEN - buffer_marker, " %02x", dataP[octet_index]); - /* - * Align newline and pipes according to the octets in groups of 2 - */ - } - - /* - * Append enough spaces and put final pipe - */ - for (aindex = octet_index; aindex < 16; ++aindex) - buffer_marker+=snprintf(>pu_2_print_buffer[buffer_marker], GTPU_2_PRINT_BUFFER_LEN - buffer_marker, " "); - - //GTPU_DEBUG(" "); - buffer_marker+=snprintf(>pu_2_print_buffer[buffer_marker], GTPU_2_PRINT_BUFFER_LEN - buffer_marker, " |\n"); - GTPU_DEBUG("%s%s",timeofday,gtpu_2_print_buffer); -} - - -NwGtpv1uRcT gtpv1u_log_request(NwGtpv1uLogMgrHandleT hLogMgr, - uint32_t logLevel, - NwCharT *file, - uint32_t line, - NwCharT *logStr) -{ - GTPU_DEBUG("%s\n", logStr); - return NW_GTPV1U_OK; -} - -NwGtpv1uRcT gtpv1u_send_udp_msg( - NwGtpv1uUdpHandleT udpHandle, - uint8_t *buffer, - uint32_t buffer_len, - uint32_t buffer_offset, - uint32_t peerIpAddr, - uint32_t peerPort) -{ - // Create and alloc new message - MessageDef *message_p; - udp_data_req_t *udp_data_req_p; - - message_p = itti_alloc_new_message(TASK_GTPV1_U, UDP_DATA_REQ); - - udp_data_req_p = &message_p->ittiMsg.udp_data_req; - - udp_data_req_p->peer_address = peerIpAddr; - udp_data_req_p->peer_port = peerPort; - udp_data_req_p->buffer = buffer; - udp_data_req_p->buffer_length = buffer_len; - udp_data_req_p->buffer_offset = buffer_offset; - - return itti_send_msg_to_task(TASK_UDP, INSTANCE_DEFAULT, message_p); -} - -/* Callback called when a gtpv1u message arrived on UDP interface */ -NwGtpv1uRcT gtpv1u_process_stack_req( - NwGtpv1uUlpHandleT hUlp, - NwGtpv1uUlpApiT *pUlpApi) -{ - switch(pUlpApi->apiType) { - /* Here there are two type of messages handled: - * - T-PDU - * - END-MARKER - */ - case NW_GTPV1U_ULP_API_RECV_TPDU: { - //uint8_t buffer[4096]; - //uint32_t buffer_len; - MessageDef *message_p = NULL; - Gtpv1uTunnelDataInd *data_ind_p = NULL; - - /* Nw-gptv1u stack has processed a PDU. we can forward it to IPV4 - * task for transmission. - */ - /*if (NW_GTPV1U_OK != nwGtpv1uMsgGetTpdu(pUlpApi->apiInfo.recvMsgInfo.hMsg, - buffer, (uint32_t *)&buffer_len)) { - GTPU_ERROR("Error while retrieving T-PDU\n"); - }*/ - GTPU_DEBUG("Received TPDU from gtpv1u stack %u with size %d\n", - pUlpApi->apiInfo.recvMsgInfo.teid, - ((NwGtpv1uMsgT*)pUlpApi->apiInfo.recvMsgInfo.hMsg)->msgBufLen); - - message_p = itti_alloc_new_message(TASK_GTPV1_U, GTPV1U_TUNNEL_DATA_IND); - - if (message_p == NULL) { - return -1; - } - - data_ind_p = &message_p->ittiMsg.gtpv1uTunnelDataInd; - data_ind_p->buffer = ((NwGtpv1uMsgT*)pUlpApi->apiInfo.recvMsgInfo.hMsg)->msgBuf; - data_ind_p->length = ((NwGtpv1uMsgT*)pUlpApi->apiInfo.recvMsgInfo.hMsg)->msgBufLen; - data_ind_p->offset = ((NwGtpv1uMsgT*)pUlpApi->apiInfo.recvMsgInfo.hMsg)->msgBufOffset; - data_ind_p->local_S1u_teid = pUlpApi->apiInfo.recvMsgInfo.teid; - - if (data_ind_p->buffer == NULL) { - GTPU_ERROR("Failed to allocate new buffer\n"); - itti_free(ITTI_MSG_ORIGIN_ID(message_p), message_p); - message_p = NULL; - } else { - //memcpy(data_ind_p->buffer, buffer, buffer_len); - //data_ind_p->length = buffer_len; - if (itti_send_msg_to_task(TASK_FW_IP, INSTANCE_DEFAULT, message_p) < 0) { - GTPU_ERROR("Failed to send message to task\n"); - itti_free(ITTI_MSG_ORIGIN_ID(message_p), message_p); - message_p = NULL; - } - } - } - break; - - case NW_GTPV1U_ULP_API_CREATE_TUNNEL_ENDPOINT: { - } - break; - - default: { - GTPU_ERROR("Received undefined UlpApi (%02x) from gtpv1u stack!\n", - pUlpApi->apiType); - } - } - - return NW_GTPV1U_OK; -} - -static int gtpv1u_create_s1u_tunnel(Gtpv1uCreateTunnelReq *create_tunnel_reqP) -{ - /* Create a new nw-gtpv1-u stack req using API */ - NwGtpv1uUlpApiT stack_req; - NwGtpv1uRcT rc; - /* Local tunnel end-point identifier */ - uint32_t s1u_teid = 0; - gtpv1u_teid2enb_info_t *gtpv1u_teid2enb_info = NULL; - MessageDef *message_p = NULL; - hashtable_rc_t hash_rc; - - GTPU_DEBUG("Rx GTPV1U_CREATE_TUNNEL_REQ Context %d\n", create_tunnel_reqP->context_teid); - memset(&stack_req, 0, sizeof(NwGtpv1uUlpApiT)); - - stack_req.apiType = NW_GTPV1U_ULP_API_CREATE_TUNNEL_ENDPOINT; - - do { - s1u_teid = gtpv1u_new_teid(); - GTPU_DEBUG("gtpv1u_create_s1u_tunnel() %u\n", s1u_teid); - stack_req.apiInfo.createTunnelEndPointInfo.teid = s1u_teid; - stack_req.apiInfo.createTunnelEndPointInfo.hUlpSession = 0; - stack_req.apiInfo.createTunnelEndPointInfo.hStackSession = 0; - - rc = nwGtpv1uProcessUlpReq(gtpv1u_sgw_data.gtpv1u_stack, &stack_req); - GTPU_DEBUG(".\n"); - } while (rc != NW_GTPV1U_OK); - - gtpv1u_teid2enb_info = malloc (sizeof(gtpv1u_teid2enb_info_t)); - memset(gtpv1u_teid2enb_info, 0, sizeof(gtpv1u_teid2enb_info_t)); - gtpv1u_teid2enb_info->state = BEARER_IN_CONFIG; - - //#warning !!! hack because missing modify session request, so force enb address - // gtpv1u_teid2enb_info->enb_ip_addr.pdn_type = IPv4; - // gtpv1u_teid2enb_info->enb_ip_addr.address.ipv4_address[0] = 192; - // gtpv1u_teid2enb_info->enb_ip_addr.address.ipv4_address[1] = 168; - // gtpv1u_teid2enb_info->enb_ip_addr.address.ipv4_address[2] = 1; - // gtpv1u_teid2enb_info->enb_ip_addr.address.ipv4_address[3] = 2; - - - message_p = itti_alloc_new_message(TASK_GTPV1_U, GTPV1U_CREATE_TUNNEL_RESP); - message_p->ittiMsg.gtpv1uCreateTunnelResp.S1u_teid = s1u_teid; - message_p->ittiMsg.gtpv1uCreateTunnelResp.context_teid = create_tunnel_reqP->context_teid; - message_p->ittiMsg.gtpv1uCreateTunnelResp.eps_bearer_id = create_tunnel_reqP->eps_bearer_id; - - hash_rc = hashtable_is_key_exists(gtpv1u_sgw_data.S1U_mapping, s1u_teid); - - if (hash_rc == HASH_TABLE_KEY_NOT_EXISTS) { - hash_rc = hashtable_insert(gtpv1u_sgw_data.S1U_mapping, s1u_teid, gtpv1u_teid2enb_info); - message_p->ittiMsg.gtpv1uCreateTunnelResp.status = 0; - } else { - message_p->ittiMsg.gtpv1uCreateTunnelResp.status = 0xFF; - } - - GTPU_DEBUG("Tx GTPV1U_CREATE_TUNNEL_RESP Context %u teid %u eps bearer id %u status %d\n", - message_p->ittiMsg.gtpv1uCreateTunnelResp.context_teid, - message_p->ittiMsg.gtpv1uCreateTunnelResp.S1u_teid, - message_p->ittiMsg.gtpv1uCreateTunnelResp.eps_bearer_id, - message_p->ittiMsg.gtpv1uCreateTunnelResp.status); - return itti_send_msg_to_task(TASK_SPGW_APP, INSTANCE_DEFAULT, message_p); -} - - - -static int gtpv1u_delete_s1u_tunnel(Teid_t context_teidP, Teid_t S1U_teidP) -{ - /* Local tunnel end-point identifier */ - MessageDef *message_p; - - GTPU_DEBUG("Rx GTPV1U_DELETE_TUNNEL Context %u S1U teid %u\n", context_teidP, S1U_teidP); - message_p = itti_alloc_new_message(TASK_GTPV1_U, GTPV1U_DELETE_TUNNEL_RESP); - - message_p->ittiMsg.gtpv1uDeleteTunnelResp.S1u_teid = S1U_teidP; - message_p->ittiMsg.gtpv1uDeleteTunnelResp.context_teid = context_teidP; - - if (hashtable_remove(gtpv1u_sgw_data.S1U_mapping, S1U_teidP) == HASH_TABLE_OK ) { - message_p->ittiMsg.gtpv1uDeleteTunnelResp.status = 0; - } else { - message_p->ittiMsg.gtpv1uDeleteTunnelResp.status = -1; - } - - GTPU_DEBUG("Tx SGW_S1U_ENDPOINT_CREATED Context %u teid %u status %d\n", context_teidP, S1U_teidP, message_p->ittiMsg.gtpv1uDeleteTunnelResp.status); - return itti_send_msg_to_task(TASK_SPGW_APP, INSTANCE_DEFAULT, message_p); -} - - -static int gtpv1u_update_s1u_tunnel(Gtpv1uUpdateTunnelReq *reqP) -{ - hashtable_rc_t hash_rc; - gtpv1u_teid2enb_info_t *gtpv1u_teid2enb_info; - MessageDef *message_p; - - GTPU_DEBUG("Rx GTPV1U_UPDATE_TUNNEL_REQ Context %u, S-GW S1U teid %u, eNB S1U teid %u\n", - reqP->context_teid, - reqP->sgw_S1u_teid, - reqP->enb_S1u_teid); - message_p = itti_alloc_new_message(TASK_GTPV1_U, GTPV1U_UPDATE_TUNNEL_RESP); - - hash_rc = hashtable_get(gtpv1u_sgw_data.S1U_mapping, reqP->sgw_S1u_teid, (void**)>pv1u_teid2enb_info); - - if (hash_rc == HASH_TABLE_OK) { - gtpv1u_teid2enb_info->teid_enb = reqP->enb_S1u_teid; - gtpv1u_teid2enb_info->enb_ip_addr = reqP->enb_ip_address_for_S1u; - gtpv1u_teid2enb_info->state = BEARER_UP; - gtpv1u_teid2enb_info->port = GTPV1U_UDP_PORT; - message_p->ittiMsg.gtpv1uUpdateTunnelResp.status = 0; ///< Status (Failed = 0xFF or Success = 0x0) - } else { - GTPU_ERROR("Mapping not found\n"); - message_p->ittiMsg.gtpv1uUpdateTunnelResp.status = 0xFF; ///< Status (Failed = 0xFF or Success = 0x0) - } - - message_p->ittiMsg.gtpv1uUpdateTunnelResp.context_teid = reqP->context_teid; - message_p->ittiMsg.gtpv1uUpdateTunnelResp.sgw_S1u_teid = reqP->sgw_S1u_teid; - message_p->ittiMsg.gtpv1uUpdateTunnelResp.enb_S1u_teid = reqP->enb_S1u_teid; - message_p->ittiMsg.gtpv1uUpdateTunnelResp.eps_bearer_id = reqP->eps_bearer_id; - return itti_send_msg_to_task(TASK_SPGW_APP, INSTANCE_DEFAULT, message_p); -} - - -static NwGtpv1uRcT gtpv1u_start_timer_wrapper( - NwGtpv1uTimerMgrHandleT tmrMgrHandle, - uint32_t timeoutSec, - uint32_t timeoutUsec, - uint32_t tmrType, - void *timeoutArg, - NwGtpv1uTimerHandleT *hTmr) -{ - - NwGtpv1uRcT rc = NW_GTPV1U_OK; - long timer_id; - - if (tmrType == NW_GTPV1U_TMR_TYPE_ONE_SHOT) { - timer_setup(timeoutSec, - timeoutUsec, - TASK_GTPV1_U, - INSTANCE_DEFAULT, - TIMER_ONE_SHOT, - timeoutArg, - &timer_id); - } else { - timer_setup(timeoutSec, - timeoutUsec, - TASK_GTPV1_U, - INSTANCE_DEFAULT, - TIMER_PERIODIC, - timeoutArg, - &timer_id); - } - - return rc; -} - -static NwGtpv1uRcT gtpv1u_stop_timer_wrapper( - NwGtpv1uTimerMgrHandleT tmrMgrHandle, - NwGtpv1uTimerHandleT hTmr) -{ - - NwGtpv1uRcT rc = NW_GTPV1U_OK; - - return rc; -} - -static void *gtpv1u_thread(void *args) -{ - itti_mark_task_ready(TASK_GTPV1_U); - MSC_START_USE(); - - while(1) { - /* Trying to fetch a message from the message queue. - * If the queue is empty, this function will block till a - * message is sent to the task. - */ - MessageDef *received_message_p = NULL; - itti_receive_msg(TASK_GTPV1_U, &received_message_p); - DevAssert(received_message_p != NULL); - - - switch (ITTI_MSG_ID(received_message_p)) { - - case TERMINATE_MESSAGE: { - GTPU_WARN(" *** Exiting GTPU thread\n"); - itti_exit_task(); - } - break; - - // DATA COMING FROM UDP - case UDP_DATA_IND: { - udp_data_ind_t *udp_data_ind_p; - udp_data_ind_p = &received_message_p->ittiMsg.udp_data_ind; - nwGtpv1uProcessUdpReq(gtpv1u_sgw_data.gtpv1u_stack, - udp_data_ind_p->buffer, - udp_data_ind_p->buffer_length, - udp_data_ind_p->peer_port, - udp_data_ind_p->peer_address); - //itti_free(ITTI_MSG_ORIGIN_ID(received_message_p), udp_data_ind_p->buffer); - } - break; - - case TIMER_HAS_EXPIRED: - nwGtpv1uProcessTimeout(&received_message_p->ittiMsg.timer_has_expired.arg); - break; - - default: { - GTPU_ERROR("Unkwnon message ID %d:%s\n", - ITTI_MSG_ID(received_message_p), - ITTI_MSG_NAME(received_message_p)); - } - break; - } - - itti_free(ITTI_MSG_ORIGIN_ID(received_message_p), received_message_p); - received_message_p = NULL; - } - - return NULL; -} - -int gtpv1u_init(const mme_config_t *mme_config_p) -{ - int ret = 0; - NwGtpv1uRcT rc = 0; - NwGtpv1uUlpEntityT ulp; - NwGtpv1uUdpEntityT udp; - NwGtpv1uLogMgrEntityT log; - NwGtpv1uTimerMgrEntityT tmr; - - GTPU_DEBUG("Initializing GTPV1U interface\n"); - - memset(>pv1u_sgw_data, 0, sizeof(gtpv1u_sgw_data)); - - gtpv1u_sgw_data.sgw_ip_address_for_S1u_S12_S4_up = mme_config_p->ipv4.sgw_ip_address_for_S1u_S12_S4_up; - - if (itti_create_task(TASK_GTPV1_U, >pv1u_thread, NULL) < 0) { - GTPU_ERROR("gtpv1u phtread_create: %s", strerror(errno)); - return -1; - } - - GTPU_DEBUG("Initializing GTPV1U interface: DONE\n"); - - return ret; -} From 7ac44159b05acf56808f1eca183adbba3afb0496 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Tue, 13 Jul 2021 15:40:11 +0200 Subject: [PATCH 009/110] first draft of code design documentation --- doc/F1-design.md | 168 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 168 insertions(+) create mode 100644 doc/F1-design.md diff --git a/doc/F1-design.md b/doc/F1-design.md new file mode 100644 index 0000000000..c1d0d1f798 --- /dev/null +++ b/doc/F1-design.md @@ -0,0 +1,168 @@ + + + + + +
+ + + + + + F1 split design +
+# 1. Introduction + +We use OpenAirInterface source code, and it's regular deployment scheme. + +F1 specification is in 3GPP documents: TS 38.470 header document and all documents listed in chapter 2 References of TS 38.470. + +This document explains how the source code works. + +Offered features and deployment instructions are described in: +https://gitlab.eurecom.fr/oai/openairinterface5g/-/wikis/f1-interface + +# 2. Common multi-threading architecture # + +The CU and DU interfaces are based on ITTI threads (see oai/common/utils/ocp_itti/itti.md when it will be written, draft available: https://docbox.etsi.org/Workshop/2018/201812_ETSI_OAI/TRAINING/OPENCELLS_THOMAS.pdf) + +All OAI upper layers use the ITTI framework to run isolated threads dedicated to one feature. +The lower layers adopt case by case specific software architecture. + +```mermaid +graph TD +Linux[configuration file] --> APP[gNB_app_task] +Socks[Linux UDP] --> GTP[nr_gtpv1u_gNB_task] +APP --> CU +APP --> DU +A[Linux SCTP] -->|sockets| SCTP(OAI itti thread TASK_SCTP) +SCTP-->|TASK_NGAP| NG[ngap_gNB_task] +NG-->|TASK_SCTP| SCTP +SCTP-->|TASK_DU_F1| DU[F1AP_DU_task] +SCTP-->|TASK_CU_F1| CU[F1AP_CU_task] +CU-->|TASK_RRC_GNB| RRC +RRC -->|non ITTI| PHY[OAI L1+L2] +RRC -->|API calls to create tunnels| GTP +PHY --> |user plane| GTP +CU --> |TASK_GTPV1_U| GTP +DU --> |TASK_GTPV1_U| GTP +``` +A "task" is a Linux thread running infinite waiting loop on one ITTI queue + +app task manages the initial configuration + +sctp task mamanges the SCTP Linux sockets + +CU code runs in the task F1AP_CU_task. It stores it's private data context in a static variable. No mutex is used, as the single interface to CU ITTI tast in incoming ITTI messages. CU task is a single ITTI queue, but multiple CU could exist in one Linux process, using the "instance id" (called "module id" also) to create separate contextual information for each CU instance. + +DU code runs in the task F1AP_DU_task. The design is similar to CU task + +All GTP-U tunnels are managed in a Linux Thread, that have partially ITTI design: + +1. tunnel creation/deletion is by C API functions direct calls (a mutex protects it) +2. outgoing packets are pushed in a ITTI queue to the gtp thread +3. incoming packets are sent to the tunnel creator using a C callback (the callback function is given in tunnel creation order). The callback should not block + + + +# 3. CU F1AP messages # + +## startup + +CU thread starts when the CU starts. It opens listening socket on F1AP_PORT_NUMBER by sending the appropriate message to TASK_SCTP. + +It will accept the first incoming connection on this port + +## F1 SETUP + +DU has connected, and sent this message. + +The CU receives, decode it and send relevant information to RRC thread by message F1AP_SETUP_REQ + +## F1 SETUP response + +RRC sends two messages to CU F1 task: the information to encode the F1 setup response and a second message to encode F1AP_GNB_CU_CONFIGURATION_UPDATE + +Upon reception of these two messages the CU task encodes and sends the messages to the DU + +## UE entry + +When CCH channel decoding finds a new UE identity, it call rrc_gNB_generate_RRCSetup() that will send F1AP_DL_RRC_MESSAGE to the CU task. + +The CU encodes and sends to DU DLRRCMessageTransfer + +## UE attach/detach + +When rrc_gNB_process_RRCReconfigurationComplete() occurs, the RRC sends to CU task the message F1AP_UE_CONTEXT_SETUP_REQ. The CU task encodes the F1 message UEContextSetup and send it to the DU over F1AP. + +This function rrc_gNB_process_RRCReconfigurationComplete() also creates the GTP-U user plane bearers. + +## F1AP incoming messages + +SCTP tasks sends a ITTI message SCTP_DATA_IND to the CU task. + +A array of functions pointers and the F1AP standard identifier "procedureCode", the CU calls the appropriate function + +Hereafter the most significant messages processing + +### CU_handle_F1_SETUP_REQUEST + +Transcodes information to the same message toward RRC (F1AP_SETUP_REQ) + +### CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER + +Transcodes information to the same message toward RRC (NR_RRC_MAC_CCCH_DATA_IND) + +### CU_handle_UL_RRC_MESSAGE_TRANSFER + +Encode and send data to PDCP (calling pdcp_data_ind ()) for processing UL data. + +# DU F1 Messages + +## Startup + +The task "gNB app" after rzading the configuration file, sends a first message F1AP_SETUP_REQ to DU task + +Using this message, the uniq DU task (Linux Thread) creates a DU instance context memory space, calls SCTP task to create a socket to the CU. + +When it receives from the SCTP task the socket creation success, the DU task encodes+sends the F1 setup message to the CU. + +## F1AP_INITIAL_UL_RRC_MESSAGE + +When MAC layer push UL data to DU task, the DU sends to CU the message InitialULRRCMessageTransfer + +## F1AP_UL_RRC_MESSAGE + +In case of SRB bearer, the RLC layer use this message to push rlc bearer payload to DU task, that forward to CU + +## pdcp_data_ind + +This function call in RLC, when it is a DRB will be replaced by F1-U transport to CU + +## F1AP incoming messages + +SCTP tasks sends a ITTI message SCTP_DATA_IND to the DU task. + +A array of functions pointers and the F1AP standard identifier "procedureCode", the DU calls the appropriate function + +Hereafter the most significant messages processing + +### DU_send_F1_SETUP_RESPONSE + +Decode the CU message, then encode a message to TASK_GNB_APP. The thread "APP" extracts the system information block and reconfigure the DU with: du_extract_and_decode_SI(), configure_gnb_du_mac() + +### DU_handle_gNB_CU_CONFIGURATION_UPDATE + +No developped + +### DU_handle_UE_CONTEXT_SETUP_REQUEST + +Push data to RLC layer for transmisstion in DL (to the UE) by calling enqueue_rlc_data_req() + +### DU_handle_DL_RRC_MESSAGE_TRANSFER + +Depending on the content, adds UE context in DU low layers and/or send data to the UE with rlc_data_req() + +# F1-U messages + +To be completed From 02fcc2ad7f8918d0019f9fec7e6e843496b7e52a Mon Sep 17 00:00:00 2001 From: Laurent OpenCells Date: Wed, 14 Jul 2021 22:27:43 +0200 Subject: [PATCH 010/110] small fix, documentation enhancement --- common/utils/ocp_itti/itti.md | 91 +++++++++++++++++++++++++++++++ doc/F1-design.md | 2 +- openair2/RRC/NR/L2_nr_interface.c | 2 +- 3 files changed, 93 insertions(+), 2 deletions(-) create mode 100644 common/utils/ocp_itti/itti.md diff --git a/common/utils/ocp_itti/itti.md b/common/utils/ocp_itti/itti.md new file mode 100644 index 0000000000..89bc3ee29f --- /dev/null +++ b/common/utils/ocp_itti/itti.md @@ -0,0 +1,91 @@ +# interthread interface (ITTI) + +A Middleware called “itti” (interthread interface) provides classical send/receive message queues between threads. + +A simpler thread safe message queue is available in the thread-pool, as it is a required lower level feature. + +ITTI is providing more feature, to be used as the thread event main loop. + +It is also made for strong type definition is source code. + +It is able to add in the managed events: external sockets, timers + +All queues are created in .h files, as static permanent queues, nevertheless the possibility to add queues during runtime is available. + +The queues are called tasks because it is often read in a single thread that have the same name. + +# API definition + +## itti_send_msg_to_task, itti_receive_msg, itti_poll_msg + +Standard messages queues, thread safe +The reader is responsible of freeing the message + +## itti_subscribe_event_fd, itti_get_events + +Add external sockets to itti based main loop + +## timer_setup timer_remove + +When a timer expire, it adds a message in a itti queue + +## itti_terminate_tasks + +Calling this function push a “terminate” message on each itti queue + +# Example code of a thread using ITTI + +``` +Thread_aLayer_main(void * context) { + // initialize the layer data + // and register in itti the external sockets (like S1AP, GTP) + aLayer_init(); + while (1) { + MessageDef * msg + itti_receive_msg(TASK_aLayer, &msg); + // itti receive released, so we have incoming data + // Can be a itti message + if ( msg != NULL) { + switch(ITTI_MSG_ID(msg)) { + case …: + processThisMsgType1(msg); + break; + case …: + processThisMsgType2(msg); + break; + } + Itti_free(msg); + } + // or data/event on external entries (sockets) + Struct eppol_events* events; + int nbEvents=itti_get_events(TASK_aLayer, &events); + if ( nbEvents > 0) + processLayerEvents(events, nbEvents); + } +} + + +``` + +# Current usage in OpenAir + +## UDP, SCTP + +Simple threads that interface itti internal messages to Linux + +## GTPV1-U, S1AP + +Threads to implement S1AP and GTP protocols + +## PDCP + +4G Pdcp is not following itti design pattern, but it uses itti internally , 5G PDCP uses ad hoc design + +## RRC + +Implements 3GPP Rrc features +Interfaces the layer 1 and the above itti tasks + +## X2, ENP_APP (configuration), L1L2 + +Are declared itti queues with a dedicated thread, but they are almost empty \ No newline at end of file diff --git a/doc/F1-design.md b/doc/F1-design.md index c1d0d1f798..343dd63464 100644 --- a/doc/F1-design.md +++ b/doc/F1-design.md @@ -24,7 +24,7 @@ https://gitlab.eurecom.fr/oai/openairinterface5g/-/wikis/f1-interface # 2. Common multi-threading architecture # -The CU and DU interfaces are based on ITTI threads (see oai/common/utils/ocp_itti/itti.md when it will be written, draft available: https://docbox.etsi.org/Workshop/2018/201812_ETSI_OAI/TRAINING/OPENCELLS_THOMAS.pdf) +The CU and DU interfaces are based on ITTI threads (see oai/common/utils/ocp_itti/itti.md) All OAI upper layers use the ITTI framework to run isolated threads dedicated to one feature. The lower layers adopt case by case specific software architecture. diff --git a/openair2/RRC/NR/L2_nr_interface.c b/openair2/RRC/NR/L2_nr_interface.c index 063ba32fb6..1b1ed3ced9 100644 --- a/openair2/RRC/NR/L2_nr_interface.c +++ b/openair2/RRC/NR/L2_nr_interface.c @@ -342,7 +342,7 @@ int8_t nr_mac_rrc_data_ind(const module_id_t module_idP, msg->rrc_container=(uint8_t*) (msg+1); // Made extra room after the struct with itti_alloc_msg_sized() memcpy(msg->rrc_container, sduP, sdu_lenP); msg->rrc_container_length=sdu_lenP; - itti_send_msg(TASK_DU_F1, 0, tmp); + itti_send_msg_to_task(TASK_DU_F1, 0, tmp); return(0); } From ec9a5cfd99d61e12db9bbbb6ec804bee54112cff Mon Sep 17 00:00:00 2001 From: Thomas Laurent Date: Mon, 19 Jul 2021 11:42:35 +0000 Subject: [PATCH 011/110] Update F1-design.md --- doc/F1-design.md | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/doc/F1-design.md b/doc/F1-design.md index 343dd63464..e97d3c32f1 100644 --- a/doc/F1-design.md +++ b/doc/F1-design.md @@ -165,4 +165,37 @@ Depending on the content, adds UE context in DU low layers and/or send data to t # F1-U messages -To be completed +The data path by itself doesn't make any difficulty: +1. for UL, rlc calls pdcp_data_ind (DRB) or sends a message to RRC (SRB). So, we can replace pdcp_data_ind() by du_pdcp_data_ind() that will push the message in the GTP tunnel. In CU, assuming the tunnel is in place, the right call back decapsulate the transport (cu_ul_recv()), then calls pdcp_data_ind() in CU +The SRB are sent in DU RRC tasks via itti F1AP_UL_RRC_MESSAGE (see above the processing) +2. For DL, pdcp (in CU for DRBs) calls rlc_data_req (by a decoupling queue and thread rlc_data_req_thread, so function du_rlc_data_req() or enqueue_rlc_data_req()). in DU, assuming the gtp-u tunnel exists, a reception call back (du_dl_recv()) decapsulate the gtp-u packet and calls du_rlc_data_req() + +Hereafter the processing design, that doesn't require to setup a new context storage, as we can use the GTP-U internal tables: rnti+rb=>teid for outgoing gtp-u packets and teid=>rnti+rb for incoming gtp-u packets + +## tunnels setup +In GTP-U, TS 29.281 specifies a option header (NR RAN Container This extension header may be transmitted in a G-PDU over the X2-U, Xn-U and F1-U user plane interfaces), but it is not mandatory optional header (as is the N3 one). + +So, we can use this header a something reliable with other vendors implementation. + +In DL, we need to associate the packet with: rnti, rb (radio bearer) and "mui" (a OAI internal id that is optional and may be removed soon) to call rlc_data_req() + +In UL, we need also the RNTI, the rb + +So, we need to create a gtp-u tunnel for each rb over F1, then manage in CU and DU the association between a uniq TEid and the pair(rnti, rb). This is already what we have in existing OAI GTP-U layer interface. + +In F1AP, for each "DRB to Be Setup Item IEs", we have a field TNL (transport network layer) to set a specific GTP tunnel (@IP, TEid, udp port is always 2152). This is the same for each message related to DRBs. (F1AP carries the SRB payload inside F1AP). + +So, For each F1AP containing DRB setup/modification/deletion, the related GTP-U tunnels will be modified one to one. +The exception is the intialisation of new tunnel: in the call to tunnel creation, we need to send the remote TEID, but we don't know yet if we are the initial source. In this case, we issue a dummy (0xFFFF) remote teid; when we receive the remote answer, we get the source teid, that we can inform GTP-U with (using update tunnel). + +## processing on GTP-U incoming message + +Du_dl_recv() or cu_ul_recv() are called because we have set this callbacks in creat/update tunnel calls to gtp-u. As gtp-u maintains a pair(rnti,rbid) associated to each tunnel, the functions can be very simple stateless callback that calls pdcp_data_ind() or rlc_data_req() to get back in normal processing path + +## CU/DU outgoing + +DU rlc north output goes to du_pdcp_data_ind() that push a outgoing packet request to gtp-u, using the rnti+rb as ids. GTP-U must have the tunnel existing, then it simply implement the same as in N3 for exemple. + +CU pdcp south output calls cu_rlc_data_ind() that do the same symetric processing. + + From 39e637b60e1dcd263620ed800b70f4ea7620cd5b Mon Sep 17 00:00:00 2001 From: Laurent OpenCells Date: Fri, 23 Jul 2021 15:03:51 +0200 Subject: [PATCH 012/110] add race codnition test --- openair2/F1AP/f1ap_common.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/openair2/F1AP/f1ap_common.c b/openair2/F1AP/f1ap_common.c index aeda45455f..082554e054 100644 --- a/openair2/F1AP/f1ap_common.c +++ b/openair2/F1AP/f1ap_common.c @@ -65,6 +65,10 @@ uint8_t F1AP_get_next_transaction_identifier(module_id_t enb_mod_idP, module_id_ } f1ap_cudu_inst_t *getCxt(bool isCU, module_id_t module_idP) { + static pid_t t=-1; + pid_t tNew=gettind(); + AssertFatal ( t==-1 || t==tNew, ""This is not thread safe\n"); + t=tNew; AssertFatal( module_idP < sizeofArray(f1_cu_inst), ""); return isCU? f1_cu_inst[ module_idP]: f1_du_inst[ module_idP]; } From b0af61dd204cae93533878f58b685b30e1398cbb Mon Sep 17 00:00:00 2001 From: Laurent OpenCells Date: Sat, 31 Jul 2021 09:51:55 +0200 Subject: [PATCH 013/110] F1AP improvement --- cmake_targets/CMakeLists.txt | 1 - .../nfapi/public_inc/nfapi_interface.h | 2 +- openair2/F1AP/f1ap_cu_interface_management.c | 289 +++++++----------- openair2/F1AP/f1ap_encoder.c | 36 --- openair2/LAYER2/MAC/eNB_scheduler_fairRR.h | 15 - openair2/RRC/NR/MESSAGES/asn1_msg.c | 1 + 6 files changed, 104 insertions(+), 240 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index e7c2cbc6cd..e791afdbfe 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -463,7 +463,6 @@ add_custom_target ( DEPENDS ${RRC_GRAMMAR} ) -set_source_files_properties(${rrc_source} PROPERTIES COMPILE_FLAGS -w) # suppress warnings from generated code add_library(RRC_LIB ${rrc_source} ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1_msg.c ${OPENAIR2_DIR}/RRC/LTE/MESSAGES/asn1_msg_NB_IoT.c) diff --git a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_interface.h b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_interface.h index 0eb77a9d26..ea459138e1 100644 --- a/nfapi/open-nFAPI/nfapi/public_inc/nfapi_interface.h +++ b/nfapi/open-nFAPI/nfapi/public_inc/nfapi_interface.h @@ -2727,7 +2727,7 @@ typedef struct { } nfapi_cqi_indication_rel8_t; #define NFAPI_CQI_INDICATION_REL8_TAG 0x202f -#define NFAPI_CC_MAX 4 +#define NFAPI_CC_MAX MAX_NUM_CCs typedef struct { nfapi_tl_t tl; uint16_t length; diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index d8a9bad9f8..5c412e5280 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -111,8 +111,6 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, req->gNB_DU_name = calloc(ie->value.choice.GNB_DU_Name.size + 1, sizeof(char)); memcpy(req->gNB_DU_name, ie->value.choice.GNB_DU_Name.buf, ie->value.choice.GNB_DU_Name.size); - /* Convert the mme name to a printable string */ - req->gNB_DU_name[ie->value.choice.GNB_DU_Name.size] = '\0'; LOG_D(F1AP, "req->gNB_DU_name %s \n", req->gNB_DU_name); /* GNB_DU_Served_Cells_List */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupRequestIEs_t, ie, container, @@ -124,7 +122,9 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, for (i=0; ivalue.choice.GNB_DU_Served_Cells_List.list.array[i])->value.choice.GNB_DU_Served_Cells_Item); + served_cells_item_p = &(((F1AP_GNB_DU_Served_Cells_ItemIEs_t *) + ie->value.choice.GNB_DU_Served_Cells_List.list.array[i])-> + value.choice.GNB_DU_Served_Cells_Item); /* tac */ if (served_cells_item_p->served_Cell_Information.fiveGS_TAC) { @@ -142,22 +142,15 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, req->cell[i].mcc, req->cell[i].mnc, (long long unsigned int)req->cell[i].nr_cellid); - LOG_D(F1AP, "nr_cellId : %x %x %x %x %x\n", - served_cells_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[0], - served_cells_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[1], - served_cells_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[2], - served_cells_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[3], - 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; + LOG_D(F1AP, "req->nr_pci[%d] %d \n", i, req->cell[i].nr_pci); // 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) + if (RC.nrrrc && 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); + LOG_I(F1AP, "Received Cell in %d context\n", f1ap_req(true, instance)->cell_type=CELL_MACRO_GNB); // System Information /* mib */ req->mib[i] = calloc(served_cells_item_p->gNB_DU_System_Information->mIB_message.size + 1, sizeof(char)); @@ -213,14 +206,6 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, // uint16_t nr_sul_band[32]; // } tdd; // } nr_mode_info[F1AP_MAX_NB_CELLS]; - MSC_LOG_TX_MESSAGE( - MSC_F1AP_CU, - MSC_RRC_ENB, - 0, - 0, - MSC_AS_TIME_FMT" CU_handle_F1_SETUP_REQUEST", - 0,0//MSC_AS_TIME_ARGS(ctxt_pP), - ); if (num_cells_available > 0) { if (RC.nrrrc && RC.nrrrc[0]->node_type == ngran_gNB_CU) { @@ -414,8 +399,6 @@ int CU_send_F1_SETUP_FAILURE(instance_t instance) { return 0; } - - /* gNB-DU Configuration Update */ @@ -437,8 +420,6 @@ int CU_send_gNB_DU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, AssertFatal(1==0,"Not implemented yet\n"); } - - /* gNB-CU Configuration Update */ @@ -522,241 +503,181 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu } } - /* - // c3. Cells_to_be_Deactivated_List // + /* if(!RC.nrrrc) { // mandatory // c3. Cells_to_be_Deactivated_List - ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Deactivated_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_Cells_to_be_Deactivated_List; + asn1cSequenceAdd(cfgUpdate->protocolIEs.list, F1AP_GNBCUConfigurationUpdateIEs_t, ieC3); + ieC3->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Deactivated_List; + ieC3->criticality = F1AP_Criticality_reject; + ieC3->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_Cells_to_be_Deactivated_List; for (int i=0; i<1; i++) { - F1AP_Cells_to_be_Deactivated_List_ItemIEs_t *cells_to_be_deactivated_list_item_ies; - cells_to_be_deactivated_list_item_ies = (F1AP_Cells_to_be_Deactivated_List_ItemIEs_t *)calloc(1, sizeof(F1AP_Cells_to_be_Deactivated_List_ItemIEs_t)); - cells_to_be_deactivated_list_item_ies->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item; - cells_to_be_deactivated_list_item_ies->criticality = F1AP_Criticality_reject; - cells_to_be_deactivated_list_item_ies->value.present = F1AP_Cells_to_be_Deactivated_List_ItemIEs__value_PR_Cells_to_be_Deactivated_List_Item; + asn1cSequenceAdd(ieC3->value.choice.Cells_to_be_Deactivated_List.list, + F1AP_Cells_to_be_Deactivated_List_ItemIEs_t, cells_to_be_deactivated); + cells_to_be_deactivated->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item; + cells_to_be_deactivated->criticality = F1AP_Criticality_reject; + cells_to_be_deactivated->value.present = F1AP_Cells_to_be_Deactivated_List_ItemIEs__value_PR_Cells_to_be_Deactivated_List_Item; // 3.1 cells to be Deactivated list item - F1AP_Cells_to_be_Deactivated_List_Item_t cells_to_be_deactivated_list_item; - memset((void *)&cells_to_be_deactivated_list_item, 0, sizeof(F1AP_Cells_to_be_Deactivated_List_Item_t)); - F1AP_NRCGI_t nRCGI; - memset(&nRCGI, 0, sizeof(F1AP_NRCGI_t)); - MCC_MNC_TO_PLMNID(f1ap_gnb_cu_configuration_update->cells_to_activate[i].mcc, - f1ap_gnb_cu_configuration_update->cells_to_activate[i].mnc, - f1ap_gnb_cu_configuration_update->cells_to_activate[i].mnc_digit_length, - &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(f1ap_gnb_cu_configuration_update->cells_to_activate[i].nr_cellid, &nRCGI.nRCellIdentity); - cells_to_be_deactivated_list_item.nRCGI = nRCGI; - cells_to_be_deactivated_list_item_ies->value.choice.Cells_to_be_Deactivated_List_Item = cells_to_be_deactivated_list_item; - ASN_SEQUENCE_ADD(&ie->value.choice.Cells_to_be_Deactivated_List.list, - cells_to_be_deactivated_list_item_ies); - } - - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + F1AP_Cells_to_be_Deactivated_List_Item_t *cells_to_be_deactivated_list= + cells_to_be_deactivated->value.choice.Cells_to_be_Deactivated_List_Item; + addnRCGI(cells_to_be_deactivated_item->nRCGI, f1ap_setup_resp->cells_to_deactivate+i); + } + } */ - /* // c4. GNB_CU_TNL_Association_To_Add_List + /* + asn1cSequenceAdd(cfgUpdate->protocolIEs.list, F1AP_GNBCUConfigurationUpdateIEs_t, ieC4); + ieC4->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Add_List; + ieC4->criticality = F1AP_Criticality_reject; + ieC4->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_GNB_CU_TNL_Association_To_Add_List; - ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Add_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_GNB_CU_TNL_Association_To_Add_List; - - for (i=0; - i<1; - i++) { - - F1AP_GNB_CU_TNL_Association_To_Add_ItemIEs_t *gnb_cu_tnl_association_to_add_item_ies; - gnb_cu_tnl_association_to_add_item_ies = (F1AP_GNB_CU_TNL_Association_To_Add_ItemIEs_t *)calloc(1, sizeof(F1AP_GNB_CU_TNL_Association_To_Add_ItemIEs_t)); - gnb_cu_tnl_association_to_add_item_ies->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Add_Item; - gnb_cu_tnl_association_to_add_item_ies->criticality = F1AP_Criticality_reject; - gnb_cu_tnl_association_to_add_item_ies->value.present = F1AP_GNB_CU_TNL_Association_To_Add_ItemIEs__value_PR_GNB_CU_TNL_Association_To_Add_Item; + for (int i=0; i<1; i++) { + asn1cSequenceAdd(ieC4->value.choice.GNB_CU_TNL_Association_To_Add_List.list, + F1AP_GNB_CU_TNL_Association_To_Add_ItemIEs_t, gnb_cu_tnl_association_to_add; + gnb_cu_tnl_association_to_add->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Add_Item; + gnb_cu_tnl_association_to_add->criticality = F1AP_Criticality_reject; + gnb_cu_tnl_association_to_add->value.present = F1AP_GNB_CU_TNL_Association_To_Add_ItemIEs__value_PR_GNB_CU_TNL_Association_To_Add_Item; // 4.1 GNB_CU_TNL_Association_To_Add_Item - F1AP_GNB_CU_TNL_Association_To_Add_Item_t gnb_cu_tnl_association_to_add_item; - memset((void *)&gnb_cu_tnl_association_to_add_item, 0, sizeof(F1AP_GNB_CU_TNL_Association_To_Add_Item_t)); - + F1AP_GNB_CU_TNL_Association_To_Add_Item_t *gnb_cu_tnl_association_to_add_item= + &gnb_cu_tnl_association_to_add_item_ies->value.choice.GNB_CU_TNL_Association_To_Add_Item; // 4.1.1 tNLAssociationTransportLayerAddress - F1AP_CP_TransportLayerAddress_t transportLayerAddress; - memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t)); - transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address; - TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address); + F1AP_CP_TransportLayerAddress_t *transportLayerAddress=; + gnb_cu_tnl_association_to_add->value.choice.GNB_CU_TNL_Association_To_Add_Item; + + transportLayerAddress->present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address; + TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &transportLayerAddress->choice.endpoint_IP_address); // memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t)); // transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address_and_port; // transportLayerAddress.choice.endpoint_IP_address_and_port = (F1AP_Endpoint_IP_address_and_port_t *)calloc(1, sizeof(F1AP_Endpoint_IP_address_and_port_t)); // TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address_and_port.endpoint_IP_address); - gnb_cu_tnl_association_to_add_item.tNLAssociationTransportLayerAddress = transportLayerAddress; - // 4.1.2 tNLAssociationUsage - gnb_cu_tnl_association_to_add_item.tNLAssociationUsage = F1AP_TNLAssociationUsage_non_ue; - - - - gnb_cu_tnl_association_to_add_item_ies->value.choice.GNB_CU_TNL_Association_To_Add_Item = gnb_cu_tnl_association_to_add_item; - ASN_SEQUENCE_ADD(&ie->value.choice.GNB_CU_TNL_Association_To_Add_List.list, - gnb_cu_tnl_association_to_add_item_ies); + gnb_cu_tnl_association_to_add_item->tNLAssociationUsage = F1AP_TNLAssociationUsage_non_ue; } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - */ /* - // c5. GNB_CU_TNL_Association_To_Remove_List - ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Remove_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_GNB_CU_TNL_Association_To_Remove_List; - for (i=0; - i<1; - i++) { - - F1AP_GNB_CU_TNL_Association_To_Remove_ItemIEs_t *gnb_cu_tnl_association_to_remove_item_ies; - gnb_cu_tnl_association_to_remove_item_ies = (F1AP_GNB_CU_TNL_Association_To_Remove_ItemIEs_t *)calloc(1, sizeof(F1AP_GNB_CU_TNL_Association_To_Remove_ItemIEs_t)); - gnb_cu_tnl_association_to_remove_item_ies->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Remove_Item; - gnb_cu_tnl_association_to_remove_item_ies->criticality = F1AP_Criticality_reject; - gnb_cu_tnl_association_to_remove_item_ies->value.present = F1AP_GNB_CU_TNL_Association_To_Remove_ItemIEs__value_PR_GNB_CU_TNL_Association_To_Remove_Item; + asn1cSequenceAdd(cfgUpdate->protocolIEs.list, F1AP_GNBCUConfigurationUpdateIEs_t, ieC5); + ieC5->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Remove_List; + ieC5->criticality = F1AP_Criticality_reject; + ieC5->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_GNB_CU_TNL_Association_To_Remove_List; + for (int i=0; i<1; i++) { + asn1cSequenceAdd(ieC5->value.choice.GNB_CU_TNL_Association_To_Remove_List.list, + F1AP_GNB_CU_TNL_Association_To_Remove_ItemIEs_t, gnb_cu_tnl_association_to_remove); + gnb_cu_tnl_association_to_remove->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Remove_Item; + gnb_cu_tnl_association_to_remove->criticality = F1AP_Criticality_reject; + gnb_cu_tnl_association_to_remove->value.present = F1AP_GNB_CU_TNL_Association_To_Remove_ItemIEs__value_PR_GNB_CU_TNL_Association_To_Remove_Item; // 4.1 GNB_CU_TNL_Association_To_Remove_Item - F1AP_GNB_CU_TNL_Association_To_Remove_Item_t gnb_cu_tnl_association_to_remove_item; - memset((void *)&gnb_cu_tnl_association_to_remove_item, 0, sizeof(F1AP_GNB_CU_TNL_Association_To_Remove_Item_t)); - + F1AP_GNB_CU_TNL_Association_To_Remove_Item_t *gnb_cu_tnl_association_to_remove_item= + &gnb_cu_tnl_association_to_remove->value.choice.GNB_CU_TNL_Association_To_Remove_Item; // 4.1.1 tNLAssociationTransportLayerAddress - F1AP_CP_TransportLayerAddress_t transportLayerAddress; - memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t)); - transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address; - TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address); + F1AP_CP_TransportLayerAddress_t *transportLayerAddress= + &gnb_cu_tnl_association_to_remove_item->tNLAssociationTransportLayerAddress; + transportLayerAddress->present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address; + TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &transportLayerAddress->choice.endpoint_IP_address); // memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t)); // transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address_and_port; // transportLayerAddress.choice.endpoint_IP_address_and_port = (F1AP_Endpoint_IP_address_and_port_t *)calloc(1, sizeof(F1AP_Endpoint_IP_address_and_port_t)); // TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address_and_port.endpoint_IP_address); - - gnb_cu_tnl_association_to_remove_item.tNLAssociationTransportLayerAddress = transportLayerAddress; - - - - gnb_cu_tnl_association_to_remove_item_ies->value.choice.GNB_CU_TNL_Association_To_Remove_Item = gnb_cu_tnl_association_to_remove_item; - ASN_SEQUENCE_ADD(&ie->value.choice.GNB_CU_TNL_Association_To_Remove_List.list, - gnb_cu_tnl_association_to_remove_item_ies); } - ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); */ /* //mandatory // c6. GNB_CU_TNL_Association_To_Update_List - ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Update_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_GNB_CU_TNL_Association_To_Update_List; + asn1cSequenceAdd(cfgUpdate->protocolIEs.list, F1AP_GNBCUConfigurationUpdateIEs_t, ieC6); + ieC6->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Update_List; + ieC6->criticality = F1AP_Criticality_reject; + ieC6->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_GNB_CU_TNL_Association_To_Update_List; for (int i=0; i<1; i++) { - F1AP_GNB_CU_TNL_Association_To_Update_ItemIEs_t *gnb_cu_tnl_association_to_update_item_ies; - gnb_cu_tnl_association_to_update_item_ies = (F1AP_GNB_CU_TNL_Association_To_Update_ItemIEs_t *)calloc(1, sizeof(F1AP_GNB_CU_TNL_Association_To_Update_ItemIEs_t)); - gnb_cu_tnl_association_to_update_item_ies->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Update_Item; - gnb_cu_tnl_association_to_update_item_ies->criticality = F1AP_Criticality_reject; - gnb_cu_tnl_association_to_update_item_ies->value.present = F1AP_GNB_CU_TNL_Association_To_Update_ItemIEs__value_PR_GNB_CU_TNL_Association_To_Update_Item; + asn1cSequenceAdd(ieC3->value.choice.GNB_CU_TNL_Association_To_Update_List.list, + F1AP_GNB_CU_TNL_Association_To_Update_ItemIEs_t, gnb_cu_tnl_association_to_update); + gnb_cu_tnl_association_to_update->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Update_Item; + gnb_cu_tnl_association_to_update->criticality = F1AP_Criticality_reject; + gnb_cu_tnl_association_to_update->value.present = F1AP_GNB_CU_TNL_Association_To_Update_ItemIEs__value_PR_GNB_CU_TNL_Association_To_Update_Item; // 4.1 GNB_CU_TNL_Association_To_Update_Item - F1AP_GNB_CU_TNL_Association_To_Update_Item_t gnb_cu_tnl_association_to_update_item; - memset((void *)&gnb_cu_tnl_association_to_update_item, 0, sizeof(F1AP_GNB_CU_TNL_Association_To_Update_Item_t)); + F1AP_GNB_CU_TNL_Association_To_Update_Item_t *gnb_cu_tnl_association_to_update_item= + &gnb_cu_tnl_association_to_update->value.choice.GNB_CU_TNL_Association_To_Update_Item; // 4.1.1 tNLAssociationTransportLayerAddress - F1AP_CP_TransportLayerAddress_t transportLayerAddress; - memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t)); - transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address; - TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address); + F1AP_CP_TransportLayerAddress_t *transportLayerAddress= + &gnb_cu_tnl_association_to_update_item.tNLAssociationTransportLayerAddress; + transportLayerAddress->present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address; + TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &transportLayerAddress->choice.endpoint_IP_address); // memset((void *)&transportLayerAddress, 0, sizeof(F1AP_CP_TransportLayerAddress_t)); // transportLayerAddress.present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address_and_port; // transportLayerAddress.choice.endpoint_IP_address_and_port = (F1AP_Endpoint_IP_address_and_port_t *)calloc(1, sizeof(F1AP_Endpoint_IP_address_and_port_t)); // TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &transportLayerAddress.choice.endpoint_IP_address_and_port.endpoint_IP_address); - gnb_cu_tnl_association_to_update_item.tNLAssociationTransportLayerAddress = transportLayerAddress; - // 4.1.2 tNLAssociationUsage if (1) { gnb_cu_tnl_association_to_update_item.tNLAssociationUsage = (F1AP_TNLAssociationUsage_t *)calloc(1, sizeof(F1AP_TNLAssociationUsage_t)); *gnb_cu_tnl_association_to_update_item.tNLAssociationUsage = F1AP_TNLAssociationUsage_non_ue; } - - gnb_cu_tnl_association_to_update_item_ies->value.choice.GNB_CU_TNL_Association_To_Update_Item = gnb_cu_tnl_association_to_update_item; - ASN_SEQUENCE_ADD(&ie->value.choice.GNB_CU_TNL_Association_To_Update_List.list, - gnb_cu_tnl_association_to_update_item_ies); } */ /* // c7. Cells_to_be_Barred_List - ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Barred_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_Cells_to_be_Barred_List; + asn1cSequenceAdd(cfgUpdate->protocolIEs.list, F1AP_GNBCUConfigurationUpdateIEs_t, ieC7); + ieC7->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Barred_List; + ieC7->criticality = F1AP_Criticality_reject; + ieC7->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_Cells_to_be_Barred_List; for (int i=0; i<1; i++) { - F1AP_Cells_to_be_Barred_ItemIEs_t *cells_to_be_barred_item_ies; - cells_to_be_barred_item_ies = (F1AP_Cells_to_be_Barred_ItemIEs_t *)calloc(1, sizeof(F1AP_Cells_to_be_Barred_ItemIEs_t)); - cells_to_be_barred_item_ies->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item; - cells_to_be_barred_item_ies->criticality = F1AP_Criticality_reject; - cells_to_be_barred_item_ies->value.present = F1AP_Cells_to_be_Barred_ItemIEs__value_PR_Cells_to_be_Barred_Item; + asn1cSequenceAdd(ieC7->value.choice.Cells_to_be_Barred_List.list, + F1AP_Cells_to_be_Barred_ItemIEs_t,cells_to_be_barred); + cells_to_be_barred->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item; + cells_to_be_barred->criticality = F1AP_Criticality_reject; + cells_to_be_barred->value.present = F1AP_Cells_to_be_Barred_ItemIEs__value_PR_Cells_to_be_Barred_Item; // 7.1 cells to be Deactivated list item - F1AP_Cells_to_be_Barred_Item_t cells_to_be_barred_item; - memset((void *)&cells_to_be_barred_item, 0, sizeof(F1AP_Cells_to_be_Barred_Item_t)); + F1AP_Cells_to_be_Barred_Item_t *cells_to_be_barred_item= + &cells_to_be_barred_item_ies->value.choice.Cells_to_be_Barred_Item; // - nRCGI - F1AP_NRCGI_t nRCGI; - memset(&nRCGI,0,sizeof(F1AP_NRCGI_t)); - MCC_MNC_TO_PLMNID(f1ap_gnb_cu_configuration_update->cells_to_activate[i].mcc, - f1ap_gnb_cu_configuration_update->cells_to_activate[i].mnc, - f1ap_gnb_cu_configuration_update->cells_to_activate[i].mnc_digit_length, - &nRCGI.pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(f1ap_gnb_cu_configuration_update->cells_to_activate[i].nr_cellid, &nRCGI.nRCellIdentity); - cells_to_be_barred_item.nRCGI = nRCGI; + addnRCGI(cells_to_be_barred_item->nRCGI, f1ap_gnb_cu_configuration_update->cells_to_activate+i); // 7.2 cellBarred - cells_to_be_barred_item.cellBarred = F1AP_CellBarred_not_barred; - cells_to_be_barred_item_ies->value.choice.Cells_to_be_Barred_Item = cells_to_be_barred_item; - ASN_SEQUENCE_ADD(&ie->value.choice.Cells_to_be_Barred_List.list, - cells_to_be_barred_item_ies); + cells_to_be_barred_item->cellBarred = F1AP_CellBarred_not_barred; } */ /* // c8. Protected_EUTRA_Resources_List - ie = (F1AP_GNBCUConfigurationUpdateIEs_t *)calloc(1, sizeof(F1AP_GNBCUConfigurationUpdateIEs_t)); - ie->id = F1AP_ProtocolIE_ID_id_Protected_EUTRA_Resources_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_Protected_EUTRA_Resources_List; + asn1cSequenceAdd(cfgUpdate->protocolIEs.list, F1AP_GNBCUConfigurationUpdateIEs_t, ieC8); + ieC8->id = F1AP_ProtocolIE_ID_id_Protected_EUTRA_Resources_List; + ieC8->criticality = F1AP_Criticality_reject; + ieC8->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_Protected_EUTRA_Resources_List; - for (i=0; - i<1; - i++) { - F1AP_Protected_EUTRA_Resources_ItemIEs_t *protected_eutra_resources_item_ies; + for (int i=0; i<1; i++) { + asn1cSequenceAdd(ieC8->value.choice.Protected_EUTRA_Resources_List.list, + F1AP_Protected_EUTRA_Resources_ItemIEs_t, protected_eutra_resources); // 8.1 SpectrumSharingGroupID - protected_eutra_resources_item_ies = (F1AP_Protected_EUTRA_Resources_ItemIEs_t *)calloc(1, sizeof(F1AP_Protected_EUTRA_Resources_ItemIEs_t)); - protected_eutra_resources_item_ies->id = F1AP_ProtocolIE_ID_id_Protected_EUTRA_Resources_List; - protected_eutra_resources_item_ies->criticality = F1AP_Criticality_reject; - protected_eutra_resources_item_ies->value.present = F1AP_Protected_EUTRA_Resources_ItemIEs__value_PR_Protected_EUTRA_Resources_Item; - ((F1AP_Protected_EUTRA_Resources_Item_t *)&protected_eutra_resources_item_ies->value.choice.Protected_EUTRA_Resources_Item)->spectrumSharingGroupID = 123L; - memset(&protected_eutra_resources_item_ies->value.choice.Protected_EUTRA_Resources_Item,0, + protected_eutra_resources->id = F1AP_ProtocolIE_ID_id_Protected_EUTRA_Resources_List; + protected_eutra_resources->criticality = F1AP_Criticality_reject; + protected_eutra_resources->value.present = F1AP_Protected_EUTRA_Resources_ItemIEs__value_PR_Protected_EUTRA_Resources_Item; + ((F1AP_Protected_EUTRA_Resources_Item_t *)&protected_eutra_resources->value.choice.Protected_EUTRA_Resources_Item)->spectrumSharingGroupID = 123L; + memset(&protected_eutra_resources->value.choice.Protected_EUTRA_Resources_Item,0, sizeof(F1AP_Protected_EUTRA_Resources_Item_t)); - ASN_SEQUENCE_ADD(&ie->value.choice.Protected_EUTRA_Resources_List.list, protected_eutra_resources_item_ies); - - F1AP_Served_EUTRA_Cells_Information_t served_eutra_cells_information; + asn1cSequenceAdd(protected_eutra_resources->value.choice.ListofEUTRACellsinGNBDUCoordination.list, + F1AP_Served_EUTRA_Cells_Information_t, served_eutra_cells_information); memset((void *)&served_eutra_cells_information, 0, sizeof(F1AP_Served_EUTRA_Cells_Information_t)); - F1AP_EUTRA_Mode_Info_t eUTRA_Mode_Info; - memset((void *)&eUTRA_Mode_Info, 0, sizeof(F1AP_EUTRA_Mode_Info_t)); + F1AP_EUTRA_Mode_Info_t *eUTRA_Mode_Info= + &served_eutra_cells_information.eUTRA_Mode_Info; // eUTRAFDD - eUTRA_Mode_Info.present = F1AP_EUTRA_Mode_Info_PR_eUTRAFDD; - F1AP_EUTRA_FDD_Info_t *eutra_fdd_info; - eutra_fdd_info = (F1AP_EUTRA_FDD_Info_t *)calloc(1, sizeof(F1AP_EUTRA_FDD_Info_t)); + eUTRA_Mode_Info->present = F1AP_EUTRA_Mode_Info_PR_eUTRAFDD; + F1AP_EUTRA_FDD_Info_t *eutra_fdd_info = (F1AP_EUTRA_FDD_Info_t *)calloc(1, sizeof(F1AP_EUTRA_FDD_Info_t)); eutra_fdd_info->uL_offsetToPointA = 123L; eutra_fdd_info->dL_offsetToPointA = 456L; eUTRA_Mode_Info.choice.eUTRAFDD = eutra_fdd_info; @@ -769,14 +690,8 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu // eutra_tdd_info->dL_offsetToPointA = 456L; // eUTRA_Mode_Info.choice.eUTRATDD = eutra_tdd_info; - served_eutra_cells_information.eUTRA_Mode_Info = eUTRA_Mode_Info; - OCTET_STRING_fromBuf(&served_eutra_cells_information.protectedEUTRAResourceIndication, "asdsa1d32sa1d31asd31as", strlen("asdsa1d32sa1d31asd31as")); - - ASN_SEQUENCE_ADD(&protected_eutra_resources_item_ies->value.choice.ListofEUTRACellsinGNBDUCoordination.list, &served_eutra_cells_information); - - ASN_SEQUENCE_ADD(&ie->value.choice.Protected_EUTRA_Resources_List.list, protected_eutra_resources_item_ies); } */ diff --git a/openair2/F1AP/f1ap_encoder.c b/openair2/F1AP/f1ap_encoder.c index ce1311ff3a..22bbe5e140 100644 --- a/openair2/F1AP/f1ap_encoder.c +++ b/openair2/F1AP/f1ap_encoder.c @@ -35,42 +35,6 @@ int asn1_encoder_xer_print = 1; -/* -static inline int f1ap_encode_initiating(f1ap_message *message, - uint8_t **buffer, - uint32_t *len); - -static inline int f1ap_encode_successfull_outcome(f1ap_message *message, - uint8_t **buffer, uint32_t *len); - -static inline int f1ap_encode_unsuccessfull_outcome(f1ap_message *message, - uint8_t **buffer, uint32_t *len); - -static inline int f1ap_encode_f1_setup_request( - F1ap_F1SetupRequestIEs_t *f1SetupRequestIEs, uint8_t **buffer, uint32_t *length); - -static inline int f1ap_encode_trace_failure(F1ap_TraceFailureIndicationIEs_t - *trace_failure_ies_p, uint8_t **buffer, - uint32_t *length); - -static inline int f1ap_encode_initial_context_setup_response( - F1ap_InitialContextSetupResponseIEs_t *initialContextSetupResponseIEs, - uint8_t **buffer, - uint32_t *length); - -static inline -int f1ap_encode_ue_context_release_complete( - F1ap_UEContextReleaseCompleteIEs_t *f1ap_UEContextReleaseCompleteIEs, - uint8_t **buffer, - uint32_t *length); - -static inline -int f1ap_encode_ue_context_release_request( - F1ap_UEContextReleaseRequestIEs_t *f1ap_UEContextReleaseRequestIEs, - uint8_t **buffer, - uint32_t *length); - */ - int f1ap_encode_pdu(F1AP_F1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *length) { ssize_t encoded; DevAssert(pdu != NULL); diff --git a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.h b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.h index 880e60ec19..9c4421abd2 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_fairRR.h +++ b/openair2/LAYER2/MAC/eNB_scheduler_fairRR.h @@ -85,21 +85,6 @@ void dlsch_scheduler_pre_ue_select_fairRR( uint16_t nb_rbs_required[MAX_NUM_CCs][MAX_MOBILES_PER_ENB], DLSCH_UE_SELECT dlsch_ue_select[MAX_NUM_CCs]); -void dlsch_scheduler_pre_processor_reset_fairRR( - module_id_t module_idP, - frame_t frameP, - sub_frame_t subframeP, - int min_rb_unit[NFAPI_CC_MAX], - uint16_t nb_rbs_required[NFAPI_CC_MAX][MAX_MOBILES_PER_ENB], - uint8_t rballoc_sub[NFAPI_CC_MAX][N_RBG_MAX], - uint8_t MIMO_mode_indicator[NFAPI_CC_MAX][N_RBG_MAX]); - -void assign_rbs_required_fairRR( - module_id_t Mod_id, - frame_t frameP, - sub_frame_t subframe, - uint16_t nb_rbs_required[NFAPI_CC_MAX][MAX_MOBILES_PER_ENB]); - void dlsch_scheduler_pre_processor_allocate_fairRR( module_id_t Mod_id, int UE_id, diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index e36644afb0..1728f011f4 100755 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -655,6 +655,7 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, if (enc_rval.encoded==-1) { return(-1); } + sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->commonControlResourceSet=coreset0; return((enc_rval.encoded+7)/8); } From 5d2fa9265d3bc7137d51ee94709b280bc4dc4e5a Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Mon, 2 Aug 2021 18:27:01 +0200 Subject: [PATCH 014/110] fix a test line i missed to remove before commit right changes --- openair2/RRC/NR/MESSAGES/asn1_msg.c | 1 - 1 file changed, 1 deletion(-) diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 1728f011f4..e36644afb0 100755 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -655,7 +655,6 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, if (enc_rval.encoded==-1) { return(-1); } - sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->commonControlResourceSet=coreset0; return((enc_rval.encoded+7)/8); } From 6a2b312a866138f9a49e72ea9f54ad9e49fce6c4 Mon Sep 17 00:00:00 2001 From: Thomas Laurent Date: Tue, 3 Aug 2021 07:55:07 +0000 Subject: [PATCH 015/110] Update SW_archi.md --- doc/SW_archi.md | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/doc/SW_archi.md b/doc/SW_archi.md index e5856d63bc..1f7993950d 100644 --- a/doc/SW_archi.md +++ b/doc/SW_archi.md @@ -312,17 +312,20 @@ Current status of new implementation: not tested, X2 not developped, 5G new GTP ocp_gtpv1uTask(): this creates only the thread, doesn't configure anything gtpv1Init(): creates a listening socket to Linux for a given reception and select a local IP address -newGtpuCreateTunnel() this function will replace the xxx_create_tunnel_xxx() for various cases -This creates a outgoing context for a teid (in input), it computes and return the incoming teid that will be used for incoming packets -These teids and in a "instance", so in a Linux socket: same teid can co-exist for different sockets - Remain here a lack to fill: the information given in the legacy funtions is not enough to fullfil the data needed by the callback -stuff like enb_flag, but also mui and more important data are not given explicitly by any legacy function (gtpv1u_create_s1u_tunnel), but the legacy and the new interface to lower layer (like pdcp) require this data. -The datamodel is still not fully understood, so this data source remain unknown -A new parameter is the callback function: will be pdpcp_data_req() and gtpv_data_req() (x2 case) for existing implementation and later other call backs like the F1-U implementation. +newGtpuCreateTunnel() +this function will replace the xxx_create_tunnel_xxx() for various cases +The parameters are: +1. outgoing TEid, associated with outpoing pair(rnti, id) +2. incoming packets callback, incoming pair(rnti,id) and a callback function for incoming data -incoming packets -the gtp layer retrieves the data, the teid, find out the related data: rnti, bearer and quite a lot of other parameters (not clear why, because it looks like all is statefull, so the lower layer should have the context) -if lower layers can be stateless, it is a good idea to keep the context in the gtp layer and pass it to the callback, but the design remain obfuscated. +This function creates a outgoing context for a teid (given as function input), a pair(rnti,outgoing id). Each outgoing packet received on GTP-U ITTI queue must match one pair(rnti,id), so the gtp-u thread can lookup the related TEid and use it to encode the outpoing GTP-U tunneled packet. + +It also computes and return the incoming teid that will be used for incoming packets. +When a incoming packet arrives on this incoming teid, the GTP-U thread calls the defined callback, with the associated pair(rnti, incoming id). +stuff like enb_flag, mui and more important data are not given explicitly by any legacy function (gtpv1u_create_s1u_tunnel), but the legacy and the new interface to lower layer (like pdcp) require this data. We hardcode it in first version. + +These teids and "instance", so in a Linux socket: same teid can co-exist for different sockets + Remain here a lack to fill: the information given in the legacy funtions is not enough to fullfil the data needed by the callback # NGAP NGAP would be a itti thread as is S1AP (+twin thread SCTP that is almost void processing)? From 609ea60774271e6db4eb8c5f304a0969fb913a1f Mon Sep 17 00:00:00 2001 From: Thomas Laurent Date: Tue, 3 Aug 2021 07:59:42 +0000 Subject: [PATCH 016/110] Update SW_archi.md --- doc/SW_archi.md | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/doc/SW_archi.md b/doc/SW_archi.md index 1f7993950d..0593863102 100644 --- a/doc/SW_archi.md +++ b/doc/SW_archi.md @@ -304,28 +304,36 @@ gtpv1u_create_s1u_tunnel(), delete tunnel, ... functions are called inside the o # New GTP ## initialization -Coexistance until full merge with legacy GTP -cmake new option: NEW_GTPU to use the new implementation (it changes for the entire executable) -It is possible to use both old and new GTP in same executable because the itti task and all functions names are different -Current status of new implementation: not tested, X2 not developped, 5G new GTP option not developped, remain issues on data coming from void: muid, enb_flag, ... ocp_gtpv1uTask(): this creates only the thread, doesn't configure anything gtpv1Init(): creates a listening socket to Linux for a given reception and select a local IP address -newGtpuCreateTunnel() +## newGtpuCreateTunnel() this function will replace the xxx_create_tunnel_xxx() for various cases The parameters are: 1. outgoing TEid, associated with outpoing pair(rnti, id) 2. incoming packets callback, incoming pair(rnti,id) and a callback function for incoming data -This function creates a outgoing context for a teid (given as function input), a pair(rnti,outgoing id). Each outgoing packet received on GTP-U ITTI queue must match one pair(rnti,id), so the gtp-u thread can lookup the related TEid and use it to encode the outpoing GTP-U tunneled packet. +## outgoing packets + +Each call to newGtpuCreateTunnel() creates a outgoing context for a teid (given as function input), a pair(rnti,outgoing id). + Each outgoing packet received on GTP-U ITTI queue must match one pair(rnti,id), so the gtp-u thread can lookup the related TEid and use it to encode the outpoing GTP-U tunneled packet. + +## incoming packets + +newGtpuCreateTunnel() computes and return the incoming teid that will be used for incoming packets. +When a incoming packet arrives on this incoming teid, the GTP-U thread calls the defined callback, with the associated pair(rnti, incoming id). -It also computes and return the incoming teid that will be used for incoming packets. -When a incoming packet arrives on this incoming teid, the GTP-U thread calls the defined callback, with the associated pair(rnti, incoming id). stuff like enb_flag, mui and more important data are not given explicitly by any legacy function (gtpv1u_create_s1u_tunnel), but the legacy and the new interface to lower layer (like pdcp) require this data. We hardcode it in first version. +## remaining work These teids and "instance", so in a Linux socket: same teid can co-exist for different sockets - Remain here a lack to fill: the information given in the legacy funtions is not enough to fullfil the data needed by the callback + Remain here a lack to fill: the information given in the legacy funtions is not enough to fullfil the data needed by the callback + +Coexistance until full merge with legacy GTP +cmake new option: NEW_GTPU to use the new implementation (it changes for the entire executable) +It is possible to use both old and new GTP in same executable because the itti task and all functions names are different +Current status of new implementation: not tested, X2 not developped, 5G new GTP option not developped, remain issues on data coming from void: muid, enb_flag, ... # NGAP NGAP would be a itti thread as is S1AP (+twin thread SCTP that is almost void processing)? From e4ec620e6b7ff951a3b646c3005cef2b71b2531b Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Mon, 9 Aug 2021 22:01:30 +0200 Subject: [PATCH 017/110] fix a regression I made --- cmake_targets/CMakeLists.txt | 8 ++-- openair2/F1AP/f1ap_du_interface_management.c | 47 +++++++++++++++----- openair2/F1AP/f1ap_handlers.c | 5 ++- openair3/S1AP/s1ap_common.h | 1 - 4 files changed, 43 insertions(+), 18 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index e791afdbfe..5fa8752c6a 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -345,13 +345,13 @@ endif () add_definitions("-DASN_DISABLE_OER_SUPPORT") ######################### -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath -Wl,${CMAKE_CURRENT_BINARY_DIR}") +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -ggdb3 -Wl,-rpath -Wl,${CMAKE_CURRENT_BINARY_DIR}") ######################### # set a flag for changes in the source code # these changes are related to hardcoded path to include .h files -set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g3 -Og -DMALLOC_CHECK_=3") -set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -g3 -DMALLOC_CHECK_=3 -O2 -fno-delete-null-pointer-checks") -set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -O3") +set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -ggdb3 -Og -DMALLOC_CHECK_=3") +set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -ggdb3 -DMALLOC_CHECK_=3 -O2 -fno-delete-null-pointer-checks") +set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -O3") set(GIT_BRANCH "UNKNOWN") set(GIT_COMMIT_HASH "UNKNOWN") diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index 7faa24cb5b..a646ef1107 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -300,16 +300,14 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { /* mandatory */ /* c5. RRC VERSION */ - if(RC.nrrrc) { - asn1cSequenceAdd(f1Setup->protocolIEs.list, F1AP_F1SetupRequestIEs_t, ie2); - ie2->id = F1AP_ProtocolIE_ID_id_GNB_DU_RRC_Version; - ie2->criticality = F1AP_Criticality_reject; - ie2->value.present = F1AP_F1SetupRequestIEs__value_PR_RRC_Version; - ie2->value.choice.RRC_Version.latest_RRC_Version.buf=calloc(1,sizeof(char)); - ie2->value.choice.RRC_Version.latest_RRC_Version.buf[0] = 0xe0; - ie2->value.choice.RRC_Version.latest_RRC_Version.size = 1; - ie2->value.choice.RRC_Version.latest_RRC_Version.bits_unused = 5; - } + asn1cSequenceAdd(f1Setup->protocolIEs.list, F1AP_F1SetupRequestIEs_t, ie2); + ie2->id = F1AP_ProtocolIE_ID_id_GNB_DU_RRC_Version; + ie2->criticality = F1AP_Criticality_reject; + ie2->value.present = F1AP_F1SetupRequestIEs__value_PR_RRC_Version; + ie2->value.choice.RRC_Version.latest_RRC_Version.buf=calloc(1,sizeof(char)); + ie2->value.choice.RRC_Version.latest_RRC_Version.buf[0] = 0xe0; + ie2->value.choice.RRC_Version.latest_RRC_Version.size = 1; + ie2->value.choice.RRC_Version.latest_RRC_Version.bits_unused = 5; /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { @@ -474,6 +472,7 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, } // for IE AssertFatal(TransactionId!=-1,"TransactionId was not sent\n"); + LOG_D(F1AP,"F1AP: num_cells_to_activate %d\n",num_cells_to_activate); F1AP_SETUP_RESP (msg_p).num_cells_to_activate = num_cells_to_activate; // tmp @@ -481,10 +480,19 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, for (int i=0; i 0, "System Information %d is missing",i); + MSC_LOG_RX_MESSAGE( + MSC_F1AP_DU, + MSC_F1AP_CU, + 0, + 0, + MSC_AS_TIME_FMT" DU_handle_F1_SETUP_RESPONSE successfulOutcome assoc_id %d", + 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), + assoc_id); LOG_D(F1AP, "Sending F1AP_SETUP_RESP ITTI message\n"); itti_send_msg_to_task(TASK_F1APP, GNB_MODULE_ID_TO_INSTANCE(assoc_id), msg_p); return 0; } + // SETUP FAILURE int DU_handle_F1_SETUP_FAILURE(instance_t instance, uint32_t assoc_id, @@ -509,9 +517,12 @@ int DU_handle_F1_SETUP_FAILURE(instance_t instance, return 0; } + + /* gNB-DU Configuration Update */ + //void DU_send_gNB_DU_CONFIGURATION_UPDATE(F1AP_GNBDUConfigurationUpdate_t *GNBDUConfigurationUpdate) { int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, instance_t du_mod_idP, @@ -749,14 +760,16 @@ int DU_handle_gNB_DU_CONFIGURATION_FAILURE(instance_t instance, F1AP_F1AP_PDU_t *pdu) { AssertFatal(1==0,"Not implemented yet\n"); } + int DU_handle_gNB_DU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { AssertFatal(1==0,"Not implemented yet\n"); } -int DU_handle_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, + +int DU_handle_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { @@ -894,6 +907,14 @@ int DU_handle_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, AssertFatal(TransactionId!=-1,"TransactionId was not sent\n"); LOG_D(F1AP,"F1AP: num_cells_to_activate %d\n",num_cells_to_activate); F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).num_cells_to_activate = num_cells_to_activate; + MSC_LOG_RX_MESSAGE( + MSC_F1AP_DU, + MSC_F1AP_CU, + 0, + 0, + MSC_AS_TIME_FMT" DU_handle_GNB_CU_CONFIGURATION_UPDATE initiatingMessage assoc_id %d", + 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), + assoc_id); LOG_D(F1AP, "Sending F1AP_GNB_CU_CONFIGURATION_UPDATE ITTI message \n"); itti_send_msg_to_task(TASK_F1APP, GNB_MODULE_ID_TO_INSTANCE(assoc_id), msg_p); return 0; @@ -904,6 +925,7 @@ int DU_send_gNB_CU_CONFIGURATION_UPDATE_FAILURE(instance_t instance, AssertFatal(1==0,"received gNB CU CONFIGURATION UPDATE FAILURE with cause %d\n", GNBCUConfigurationUpdateFailure->cause); } + int DU_send_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, f1ap_gnb_cu_configuration_update_acknowledge_t *GNBCUConfigurationUpdateAcknowledge) { AssertFatal(GNBCUConfigurationUpdateAcknowledge->num_cells_failed_to_be_activated == 0, @@ -947,10 +969,13 @@ int DU_send_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, f1ap_itti_send_sctp_data_req(false, instance, buffer, len, 0); return 0; } + + int DU_send_gNB_DU_RESOURCE_COORDINATION_REQUEST(instance_t instance, F1AP_GNBDUResourceCoordinationRequest_t *GNBDUResourceCoordinationRequest) { AssertFatal(0, "Not implemented yet\n"); } + int DU_handle_gNB_DU_RESOURCE_COORDINATION_RESPONSE(instance_t instance, uint32_t assoc_id, uint32_t stream, diff --git a/openair2/F1AP/f1ap_handlers.c b/openair2/F1AP/f1ap_handlers.c index 95133b9698..fec03bb0b9 100644 --- a/openair2/F1AP/f1ap_handlers.c +++ b/openair2/F1AP/f1ap_handlers.c @@ -91,8 +91,9 @@ int f1ap_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, } /* Checking procedure Code and direction of message */ - if (pdu.choice.initiatingMessage->procedureCode >= sizeof(f1ap_message_processing_t) / (3 * sizeof( - f1ap_message_processing_t)) + if (pdu.choice.initiatingMessage->procedureCode >= + sizeof(f1ap_messages_processing) / + (3 * sizeof(f1ap_message_processing_t)) || (pdu.present > F1AP_F1AP_PDU_PR_unsuccessfulOutcome)) { LOG_E(F1AP, "[SCTP %d] Either procedureCode %ld or direction %d exceed expected\n", assoc_id, pdu.choice.initiatingMessage->procedureCode, pdu.present); diff --git a/openair3/S1AP/s1ap_common.h b/openair3/S1AP/s1ap_common.h index efac0201a3..3c07f92a7f 100644 --- a/openair3/S1AP/s1ap_common.h +++ b/openair3/S1AP/s1ap_common.h @@ -82,7 +82,6 @@ extern int asn1_xer_print; # define S1AP_INFO(x, args...) LOG_I(S1AP, x, ##args) # define S1AP_DEBUG(x, args...) LOG_I(S1AP, x, ##args) #else -# include "mme_default_values.h" # define S1AP_ERROR(x, args...) do { fprintf(stdout, "[S1AP][E]"x, ##args); } while(0) # define S1AP_WARN(x, args...) do { fprintf(stdout, "[S1AP][W]"x, ##args); } while(0) # define S1AP_TRAF(x, args...) do { fprintf(stdout, "[S1AP][T]"x, ##args); } while(0) From 457dc5816b90165b038894a890538e304c6c1bd2 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Thu, 12 Aug 2021 09:31:36 +0200 Subject: [PATCH 018/110] fixes commit before merge develop --- cmake_targets/CMakeLists.txt | 6 +- .../SIMULATION/ETH_TRANSPORT/netlink_init.c | 63 ++----------------- openair2/F1AP/f1ap_cu_task.c | 2 - openair2/GNB_APP/gnb_config.c | 8 +-- 4 files changed, 11 insertions(+), 68 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 5fa8752c6a..f92c472ee8 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -345,12 +345,12 @@ endif () add_definitions("-DASN_DISABLE_OER_SUPPORT") ######################### -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -ggdb3 -Wl,-rpath -Wl,${CMAKE_CURRENT_BINARY_DIR}") +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -ggdb2 -Wl,-rpath -Wl,${CMAKE_CURRENT_BINARY_DIR}") ######################### # set a flag for changes in the source code # these changes are related to hardcoded path to include .h files -set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -ggdb3 -Og -DMALLOC_CHECK_=3") -set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -ggdb3 -DMALLOC_CHECK_=3 -O2 -fno-delete-null-pointer-checks") +set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -ggdb2 -Og -DMALLOC_CHECK_=3") +set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -ggdb2 -DMALLOC_CHECK_=3 -O2 -fno-delete-null-pointer-checks") set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -O3") set(GIT_BRANCH "UNKNOWN") diff --git a/openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c b/openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c index 9b4aba46c3..d0a7865146 100644 --- a/openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c +++ b/openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c @@ -70,7 +70,7 @@ static int tun_alloc(char *dev) { int fd, err; if( (fd = open("/dev/net/tun", O_RDWR)) < 0 ) { - printf("[TUN] failed to open /dev/net/tun\n"); + LOG_E(PDCP, "[TUN] failed to open /dev/net/tun\n"); return -1; } @@ -123,31 +123,6 @@ int netlink_init_mbms_tun(char *ifprefix) { nas_src_addr.nl_pid = 1;//getpid(); /* self pid */ nas_src_addr.nl_groups = 0; /* not in mcast groups */ ret = bind(nas_sock_mbms_fd, (struct sockaddr *)&nas_src_addr, sizeof(nas_src_addr)); - memset(&nas_dest_addr, 0, sizeof(nas_dest_addr)); - nas_dest_addr.nl_family = AF_NETLINK; - nas_dest_addr.nl_pid = 0; /* For Linux Kernel */ - nas_dest_addr.nl_groups = 0; /* unicast */ - // TX PART - nas_nlh_tx=(struct nlmsghdr *)malloc(NLMSG_SPACE(NL_MAX_PAYLOAD)); - memset(nas_nlh_tx, 0, NLMSG_SPACE(NL_MAX_PAYLOAD)); - /* Fill the netlink message header */ - nas_nlh_tx->nlmsg_len = NLMSG_SPACE(NL_MAX_PAYLOAD); - nas_nlh_tx->nlmsg_pid = 1;//getpid(); /* self pid */ - nas_nlh_tx->nlmsg_flags = 0; - nas_iov_tx.iov_base = (void *)nas_nlh_tx; - nas_iov_tx.iov_len = nas_nlh_tx->nlmsg_len; - memset(&nas_msg_tx,0,sizeof(nas_msg_tx)); - nas_msg_tx.msg_name = (void *)&nas_dest_addr; - nas_msg_tx.msg_namelen = sizeof(nas_dest_addr); - nas_msg_tx.msg_iov = &nas_iov_tx; - nas_msg_tx.msg_iovlen = 1; - // RX PART - memset(&nas_msg_rx,0,sizeof(nas_msg_rx)); - nas_msg_rx.msg_name = (void *)&nas_src_addr; - nas_msg_rx.msg_namelen = sizeof(nas_src_addr); - nas_msg_rx.msg_iov = &nas_iov_rx; - nas_msg_rx.msg_iovlen = 1; - return 1; } @@ -160,51 +135,21 @@ int netlink_init_tun(char *ifprefix, int num_if) { nas_sock_fd[i] = tun_alloc(ifname); if (nas_sock_fd[i] == -1) { - printf("[NETLINK] Error opening socket %s (%d:%s)\n",ifname,errno, strerror(errno)); + LOG_E(PDCP, "TUN: Error opening socket %s (%d:%s)\n",ifname,errno, strerror(errno)); exit(1); } - printf("[NETLINK]Opened socket %s with fd nas_sock_fd[%d]=%d\n", + LOG_I(PDCP, "TUN: Opened socket %s with fd nas_sock_fd[%d]=%d\n", ifname, i, nas_sock_fd[i]); ret = fcntl(nas_sock_fd[i],F_SETFL,O_NONBLOCK); if (ret == -1) { - printf("[NETLINK] Error fcntl (%d:%s)\n",errno, strerror(errno)); + LOG_E(PDCP, "TUN: Error fcntl (%d:%s)\n",errno, strerror(errno)); if (LINK_ENB_PDCP_TO_IP_DRIVER) { exit(1); } } - - memset(&nas_src_addr, 0, sizeof(nas_src_addr)); - nas_src_addr.nl_family = AF_NETLINK; - nas_src_addr.nl_pid = 1;//getpid(); /* self pid */ - nas_src_addr.nl_groups = 0; /* not in mcast groups */ - ret = bind(nas_sock_fd[i], (struct sockaddr *)&nas_src_addr, sizeof(nas_src_addr)); - memset(&nas_dest_addr, 0, sizeof(nas_dest_addr)); - nas_dest_addr.nl_family = AF_NETLINK; - nas_dest_addr.nl_pid = 0; /* For Linux Kernel */ - nas_dest_addr.nl_groups = 0; /* unicast */ - // TX PART - nas_nlh_tx=(struct nlmsghdr *)malloc(NLMSG_SPACE(NL_MAX_PAYLOAD)); - memset(nas_nlh_tx, 0, NLMSG_SPACE(NL_MAX_PAYLOAD)); - /* Fill the netlink message header */ - nas_nlh_tx->nlmsg_len = NLMSG_SPACE(NL_MAX_PAYLOAD); - nas_nlh_tx->nlmsg_pid = 1;//getpid(); /* self pid */ - nas_nlh_tx->nlmsg_flags = 0; - nas_iov_tx.iov_base = (void *)nas_nlh_tx; - nas_iov_tx.iov_len = nas_nlh_tx->nlmsg_len; - memset(&nas_msg_tx,0,sizeof(nas_msg_tx)); - nas_msg_tx.msg_name = (void *)&nas_dest_addr; - nas_msg_tx.msg_namelen = sizeof(nas_dest_addr); - nas_msg_tx.msg_iov = &nas_iov_tx; - nas_msg_tx.msg_iovlen = 1; - // RX PART - memset(&nas_msg_rx,0,sizeof(nas_msg_rx)); - nas_msg_rx.msg_name = (void *)&nas_src_addr; - nas_msg_rx.msg_namelen = sizeof(nas_src_addr); - nas_msg_rx.msg_iov = &nas_iov_rx; - nas_msg_rx.msg_iovlen = 1; } /* for */ return 1; diff --git a/openair2/F1AP/f1ap_cu_task.c b/openair2/F1AP/f1ap_cu_task.c index 92a93254d4..28d415328a 100644 --- a/openair2/F1AP/f1ap_cu_task.c +++ b/openair2/F1AP/f1ap_cu_task.c @@ -147,8 +147,6 @@ F1AP_CU_task(void *arg) { case F1AP_SETUP_RESP: // from rrc LOG_I(F1AP, "CU Task Received F1AP_SETUP_RESP\n"); - // CU_send_f1setup_resp(ITTI_MSG_DESTINATION_INSTANCE(received_msg), - // &F1AP_SETUP_RESP(received_msg)); CU_send_F1_SETUP_RESPONSE(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &F1AP_SETUP_RESP(received_msg)); break; diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index afe7ee2ed0..c669041e4d 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -1953,8 +1953,8 @@ int gNB_app_handle_f1ap_setup_resp(f1ap_setup_resp_t *resp) { du_extract_and_decode_SI(i, si_ind, - resp->cells_to_activate[j].SI_container[2+si_ind], - resp->cells_to_activate[j].SI_container_length[2+si_ind]); + resp->cells_to_activate[j].SI_container[si_ind], + resp->cells_to_activate[j].SI_container_length[si_ind]); } // perform MAC/L1 common configuration @@ -1988,8 +1988,8 @@ int gNB_app_handle_f1ap_gnb_cu_configuration_update(f1ap_gnb_cu_configuration_up du_extract_and_decode_SI(i, si_ind, - gnb_cu_cfg_update->cells_to_activate[j].SI_container[2+si_ind], - gnb_cu_cfg_update->cells_to_activate[j].SI_container_length[2+si_ind]); + gnb_cu_cfg_update->cells_to_activate[j].SI_container[si_ind], + gnb_cu_cfg_update->cells_to_activate[j].SI_container_length[si_ind]); } // perform MAC/L1 common configuration From 19af86b16340870c6022ea4c85ea7c6dae945e45 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Thu, 12 Aug 2021 21:53:56 +0200 Subject: [PATCH 019/110] little fixes --- cmake_targets/CMakeLists.txt | 3 +- openair2/F1AP/f1ap_cu_ue_context_management.c | 44 +++++++++---------- openair2/F1AP/f1ap_encoder.c | 7 +++ openair2/GNB_APP/gnb_app.c | 2 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 4 +- 5 files changed, 33 insertions(+), 27 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index b7578d5bc4..91b7283847 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -814,9 +814,8 @@ set(F1AP_ASN_FILES if (${RU} STREQUAL 0) set(F1AP_ASN_GENERATED_C_DIR ${asn1_generated_dir}/F1AP_${ASN1RELDIR}) - message("calling ASN1C_PREFIX=F1AP_ asn1c -gen-PER -no-gen-OER -fcompound-names -no-gen-example -findirect-choice -fno-include-deps -D ${F1AP_ASN_GENERATED_C_DIR} ${F1AP_ASN_FILES}") execute_process( - COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "F1AP_" "-findirect-choice -fno-include-deps" ${F1AP_ASN_GENERATED_C_DIR} ${F1AP_ASN_FILES} + COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "F1AP_" "-findirect-choice -fno-include-deps -Wdebug-compiler -Wdebug-parser" ${F1AP_ASN_GENERATED_C_DIR} ${F1AP_ASN_FILES} RESULT_VARIABLE ret ) diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 0e39d23576..d200f1b636 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -73,8 +73,6 @@ static void setQos(F1AP_NonDynamic5QIDescriptor_t *toFill) { int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_req) { F1AP_F1AP_PDU_t pdu= {0}; - uint8_t *buffer=NULL; - uint32_t len=0; /* Create */ /* 0. Message Type */ pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; @@ -115,7 +113,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, ie4->id = F1AP_ProtocolIE_ID_id_ServCellIndex; ie4->criticality = F1AP_Criticality_reject; ie4->value.present = F1AP_UEContextSetupRequestIEs__value_PR_ServCellIndex; - ie4->value.choice.ServCellIndex = 2; + ie4->value.choice.ServCellIndex = 0; /* optional */ /* c5. CellULConfigured */ @@ -149,25 +147,23 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* mandatory */ /* c7. Candidate_SpCell_List */ - if (0) { - asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupRequestIEs_t, ie7); - ie7->id = F1AP_ProtocolIE_ID_id_Candidate_SpCell_List; //90 - ie7->criticality = F1AP_Criticality_ignore; - ie7->value.present = F1AP_UEContextSetupRequestIEs__value_PR_Candidate_SpCell_List; - - for (int i=0; i<0; i++) { - asn1cSequenceAdd(ie7->value.choice.Candidate_SpCell_List.list,F1AP_Candidate_SpCell_ItemIEs_t, candidate_spCell_item_ies); - candidate_spCell_item_ies->id = F1AP_ProtocolIE_ID_id_Candidate_SpCell_Item; // 91 - candidate_spCell_item_ies->criticality = F1AP_Criticality_reject; - candidate_spCell_item_ies->value.present = F1AP_Candidate_SpCell_ItemIEs__value_PR_Candidate_SpCell_Item; - /* 7.1 Candidate_SpCell_Item */ - F1AP_Candidate_SpCell_Item_t *candidate_spCell_item= - &candidate_spCell_item_ies->value.choice.Candidate_SpCell_Item; - /* - candidate_SpCell_ID */ - //FixMe: first cell ??? - addnRCGI(candidate_spCell_item->candidate_SpCell_ID,f1ap_ue_context_setup_req); - /* TODO add correct mcc/mnc */ - } + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupRequestIEs_t, ie7); + ie7->id = F1AP_ProtocolIE_ID_id_Candidate_SpCell_List; //90 + ie7->criticality = F1AP_Criticality_ignore; + ie7->value.present = F1AP_UEContextSetupRequestIEs__value_PR_Candidate_SpCell_List; + + for (int i=0; i<1; i++) { + asn1cSequenceAdd(ie7->value.choice.Candidate_SpCell_List.list,F1AP_Candidate_SpCell_ItemIEs_t, candidate_spCell_item_ies); + candidate_spCell_item_ies->id = F1AP_ProtocolIE_ID_id_Candidate_SpCell_Item; // 91 + candidate_spCell_item_ies->criticality = F1AP_Criticality_reject; + candidate_spCell_item_ies->value.present = F1AP_Candidate_SpCell_ItemIEs__value_PR_Candidate_SpCell_Item; + /* 7.1 Candidate_SpCell_Item */ + F1AP_Candidate_SpCell_Item_t *candidate_spCell_item= + &candidate_spCell_item_ies->value.choice.Candidate_SpCell_Item; + /* - candidate_SpCell_ID */ + //FixMe: first cell ??? + addnRCGI(candidate_spCell_item->candidate_SpCell_ID,f1ap_ue_context_setup_req); + /* TODO add correct mcc/mnc */ } /* optional */ @@ -601,8 +597,10 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, MaskedIMEISV_TO_BIT_STRING(12340000l, &ie15->value.choice.MaskedIMEISV); // size (64) } - //xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, &pdu); //(void *)pdu /* encode */ + uint8_t *buffer=NULL; + uint32_t len=0; + if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { LOG_E(F1AP, "Failed to encode F1 UE CONTEXT SETUP REQUEST\n"); return -1; diff --git a/openair2/F1AP/f1ap_encoder.c b/openair2/F1AP/f1ap_encoder.c index 22bbe5e140..f1208565bb 100644 --- a/openair2/F1AP/f1ap_encoder.c +++ b/openair2/F1AP/f1ap_encoder.c @@ -47,6 +47,13 @@ int f1ap_encode_pdu(F1AP_F1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *length) { LOG_E(F1AP, "----------------- ASN1 ENCODER PRINT END----------------- \n"); } + char errbuf[128]; /* Buffer for error message */ + size_t errlen = sizeof(errbuf); /* Size of the buffer */ + int ret = asn_check_constraints(&asn_DEF_F1AP_F1AP_PDU, pdu, errbuf, &errlen); + /* assert(errlen < sizeof(errbuf)); // Guaranteed: you may rely on that */ + if(ret) { + fprintf(stderr, "Constraint validation failed: %s\n", errbuf); + } encoded = aper_encode_to_new_buffer(&asn_DEF_F1AP_F1AP_PDU, 0, pdu, (void **)buffer); if (encoded < 0) { diff --git a/openair2/GNB_APP/gnb_app.c b/openair2/GNB_APP/gnb_app.c index b1dc59f2e2..0efd229343 100644 --- a/openair2/GNB_APP/gnb_app.c +++ b/openair2/GNB_APP/gnb_app.c @@ -214,7 +214,7 @@ void *gNB_app_task(void *args_p) /* For the CU case the gNB registration with the AMF might have to take place after the F1 setup, as the PLMN info * can originate from the DU. Add check on whether x2ap is enabled to account for ENDC NSA scenario.*/ - if ((AMF_MODE_ENABLED || is_x2ap_enabled()) && !NODE_IS_DU(RC.nrrrc[0]->node_type) && !NODE_IS_CU(RC.nrrrc[0]->node_type)) { + if ((AMF_MODE_ENABLED || is_x2ap_enabled()) && !NODE_IS_DU(RC.nrrrc[0]->node_type) ) { //&& !NODE_IS_CU(RC.nrrrc[0]->node_type)) { /* Try to register each gNB */ //registered_gnb = 0; __attribute__((unused)) uint32_t register_gnb_pending = gNB_app_register (gnb_id_start, gnb_id_end); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index a284ad96e8..9606b4eb6d 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -1351,6 +1351,8 @@ int nr_acknack_scheduling(int mod_id, /* verify that at that slot and symbol, resources are free. We only do this * for initialCyclicShift 0 (we assume it always has that one), so other * initialCyclicShifts can overlap with ICS 0!*/ + if (pucch_Config==NULL) + return; const NR_PUCCH_Resource_t *resource = pucch_Config->resourceToAddModList->list.array[pucch->resource_indicator]; DevAssert(resource->format.present == NR_PUCCH_Resource__format_PR_format0); if (resource->format.choice.format0->initialCyclicShift == 0) { @@ -1387,7 +1389,7 @@ void nr_sr_reporting(int Mod_idP, frame_t SFN, sub_frame_t slot) RC.nrmac[Mod_idP]->UE_info.CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup) { pucch_Config = RC.nrmac[Mod_idP]->UE_info.CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup; } - + if (pucch_Config == NULL ) continue; AssertFatal(pucch_Config->schedulingRequestResourceToAddModList->list.count>0,"NO SR configuration available"); for (int SR_resource_id =0; SR_resource_id < pucch_Config->schedulingRequestResourceToAddModList->list.count;SR_resource_id++) { From 90999e5a1542336e918c429794f7c669ba0679a2 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Mon, 16 Aug 2021 14:14:52 +0200 Subject: [PATCH 020/110] Fix F1 bugs --- cmake_targets/CMakeLists.txt | 15 +++---- openair2/F1AP/f1ap_cu_ue_context_management.c | 13 +++--- openair2/F1AP/f1ap_du_ue_context_management.c | 44 ++++++++++--------- 3 files changed, 36 insertions(+), 36 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 91b7283847..0d5565165a 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -337,7 +337,7 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -ggdb2 -Wl,-rpath -Wl,${C # set a flag for changes in the source code # these changes are related to hardcoded path to include .h files set(debugOpt "-ggdb2 -DMALLOC_CHECK_=3 -fno-delete-null-pointer-checks") -set(CMAKE_C_FLAGS_DEBUG "${debugOpt} -Og") +set(CMAKE_C_FLAGS_DEBUG "${debugOpt} -O0") set(CMAKE_C_FLAGS_RELWITHDEBINFO "${debugOpt} -O2") set(CMAKE_C_FLAGS_RELEASE "-O3") @@ -378,14 +378,13 @@ set (FIRMWARE_VERSION "No svn information") add_definitions("-DFIRMWARE_VERSION=\"${FIRMWARE_VERSION}\"") add_definitions("-DPACKAGE_VERSION=\"Branch: ${GIT_BRANCH} Abrev. Hash: ${GIT_COMMIT_HASH} Date: ${GIT_COMMIT_DATE}\"") add_definitions("-DPACKAGE_BUGREPORT=\"openair4g-devel@lists.eurecom.fr\"") -#add_definitions("-DEMIT_ASN_DEBUG=1") # Debug related options ######################################### -add_boolean_option(ASN_DEBUG False "ASN1 coder/decoder Debug") -add_boolean_option(EMIT_ASN_DEBUG False "ASN1 coder/decoder Debug") -add_boolean_option(MSG_PRINT False "print debug messages") +add_boolean_option(ASN_EMIT_DEBUG False "ASN1 coder/decoder Debug") +add_boolean_option(ASN_THREAD_SAFE True "ASN1 coder/decoder Debug") +add_boolean_option(MSG_PRINT True "print debug messages") add_boolean_option(DISABLE_XER_PRINT False "print XER Format") add_boolean_option(XER_PRINT False "print XER Format") add_boolean_option(RRC_MSG_PRINT False "print RRC messages") @@ -624,7 +623,7 @@ set(M2AP_C_DIR ${asn1_generated_dir}/M2AP_${M2AP_RELEASE}) # Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make if (${RU} STREQUAL 0) execute_process( - COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "M2AP_" "-fno-include-deps -DEMIT_ASN_DEBUG=1" "${M2AP_C_DIR}" "${M2AP_ASN_DIR}/${M2AP_ASN_FILES}" + COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "M2AP_" "-fno-include-deps " "${M2AP_C_DIR}" "${M2AP_ASN_DIR}/${M2AP_ASN_FILES}" RESULT_VARIABLE ret) if (NOT ${ret} STREQUAL 0) message(FATAL_ERROR "${ret}: error") @@ -635,7 +634,7 @@ file(GLOB M2AP_source ${M2AP_C_DIR}/*.c) add_custom_target ( m2_flag ALL - COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "M2AP_" "-fno-include-deps -DEMIT_ASN_DEBUG=1" "${M2AP_C_DIR}" "${M2AP_ASN_DIR}/${M2AP_ASN_FILES}" + COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "M2AP_" "-fno-include-deps " "${M2AP_C_DIR}" "${M2AP_ASN_DIR}/${M2AP_ASN_FILES}" DEPENDS ${M2AP_ASN_DIR}/${M2AP_ASN_FILES} ) @@ -815,7 +814,7 @@ set(F1AP_ASN_FILES if (${RU} STREQUAL 0) set(F1AP_ASN_GENERATED_C_DIR ${asn1_generated_dir}/F1AP_${ASN1RELDIR}) execute_process( - COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "F1AP_" "-findirect-choice -fno-include-deps -Wdebug-compiler -Wdebug-parser" ${F1AP_ASN_GENERATED_C_DIR} ${F1AP_ASN_FILES} + COMMAND ${OPENAIR_CMAKE}/tools/make_asn1c_includes.sh "F1AP_" "-findirect-choice -fno-include-deps" ${F1AP_ASN_GENERATED_C_DIR} ${F1AP_ASN_FILES} RESULT_VARIABLE ret ) diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index d200f1b636..8dbda7ab49 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -114,7 +114,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, ie4->criticality = F1AP_Criticality_reject; ie4->value.present = F1AP_UEContextSetupRequestIEs__value_PR_ServCellIndex; ie4->value.choice.ServCellIndex = 0; - + /* optional */ /* c5. CellULConfigured */ if (0) { @@ -204,15 +204,14 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, OCTET_STRING_fromBuf(&ie9->value.choice.ResourceCoordinationTransferContainer, "asdsa1d32sa1d31asd31as", strlen("asdsa1d32sa1d31asd31as")); } - - /* mandatory */ + /* mandatory */ /* c10. SCell_ToBeSetup_List */ asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupRequestIEs_t, ie10); ie10->id = F1AP_ProtocolIE_ID_id_SCell_ToBeSetup_List; ie10->criticality = F1AP_Criticality_ignore; ie10->value.present = F1AP_UEContextSetupRequestIEs__value_PR_SCell_ToBeSetup_List; - - for (int i=0; i<0; i++) { + + for (int i=0; i<1; i++) { // asn1cSequenceAdd(ie10->value.choice.SCell_ToBeSetup_List.list, F1AP_SCell_ToBeSetup_ItemIEs_t, scell_toBeSetup_item_ies); scell_toBeSetup_item_ies->id = F1AP_ProtocolIE_ID_id_SCell_ToBeSetup_Item; //53 @@ -397,8 +396,8 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* 12.1.2.2 sNSSAI */ { /* sST */ - OCTET_STRING_fromBuf(&DRB_Information->sNSSAI.sST, "asdsa1d32sa1d31asd31as", - strlen("asdsa1d32sa1d31asd31as")); + + OCTET_STRING_fromBuf(&DRB_Information->sNSSAI.sST, "1", 1); /* OPTIONAL */ /* sD */ diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 9d811f3958..cb5c412ece 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -50,9 +50,9 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, F1AP_UEContextSetupRequestIEs_t *ie; int i; DevAssert(pdu); - msg_p = itti_alloc_new_message(TASK_DU_F1, 0, F1AP_UE_CONTEXT_SETUP_REQ); - f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_req; - f1ap_ue_context_setup_req = &F1AP_UE_CONTEXT_SETUP_REQ(msg_p); + LOG_E(F1AP, "DU_handle_UE_CONTEXT_SETUP_REQUEST() fills a ITTI message F1AP_UE_CONTEXT_SETUP_REQ but it never sends it\n"); + msg_p = itti_alloc_new_message(TASK_DU_F1, 0, F1AP_UE_CONTEXT_SETUP_REQ); + f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_req = &F1AP_UE_CONTEXT_SETUP_REQ(msg_p); container = &pdu->choice.initiatingMessage->value.choice.UEContextSetupRequest; /* GNB_CU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container, @@ -144,27 +144,29 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* correct here */ f1ap_ue_context_setup_req->rrc_container = malloc(ie->value.choice.RRCContainer.size); memcpy(f1ap_ue_context_setup_req->rrc_container, ie->value.choice.RRCContainer.buf, ie->value.choice.RRCContainer.size); + + + // AssertFatal(0, "check configuration, send to appropriate handler\n"); + protocol_ctxt_t ctxt; + // ctxt.rnti = f1ap_get_rnti_by_du_id(&f1ap_du_inst[instance], ie->value.choice.GNB_DU_UE_F1AP_ID); + ctxt.rnti = 0x1234; + ctxt.module_id = instance; + ctxt.instance = instance; + ctxt.enb_flag = 1; + + if ( ie->value.choice.RRCContainer.size ) { + mem_block_t *pdcp_pdu_p = NULL; + pdcp_pdu_p = get_free_mem_block(ie->value.choice.RRCContainer.size, __func__); + memset(pdcp_pdu_p->data, 0, ie->value.choice.RRCContainer.size); + memcpy(&pdcp_pdu_p->data[0], ie->value.choice.RRCContainer.buf, ie->value.choice.RRCContainer.size); + /* for rfsim */ + du_rlc_data_req(&ctxt, 1, 0x00, 1, 1, 0, ie->value.choice.RRCContainer.size, pdcp_pdu_p); + } else { + LOG_E(F1AP, " RRCContainer in UEContextSetupRequestIEs size id 0\n"); + } } else { LOG_E(F1AP, "can't find RRCContainer in UEContextSetupRequestIEs by id %ld \n", F1AP_ProtocolIE_ID_id_RRCContainer); } - - // AssertFatal(0, "check configuration, send to appropriate handler\n"); - protocol_ctxt_t ctxt; - // ctxt.rnti = f1ap_get_rnti_by_du_id(&f1ap_du_inst[instance], ie->value.choice.GNB_DU_UE_F1AP_ID); - ctxt.rnti = 0x1234; - ctxt.module_id = instance; - ctxt.instance = instance; - ctxt.enb_flag = 1; - mem_block_t *pdcp_pdu_p = NULL; - pdcp_pdu_p = get_free_mem_block(ie->value.choice.RRCContainer.size, __func__); - - if (pdcp_pdu_p != NULL) { - memset(pdcp_pdu_p->data, 0, ie->value.choice.RRCContainer.size); - memcpy(&pdcp_pdu_p->data[0], ie->value.choice.RRCContainer.buf, ie->value.choice.RRCContainer.size); - /* for rfsim */ - du_rlc_data_req(&ctxt, 1, 0x00, 1, 1, 0, ie->value.choice.RRCContainer.size, pdcp_pdu_p); - } - return 0; } From 058b040c56e4bc340595af97bf888f8e2bec5a27 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Tue, 17 Aug 2021 09:04:28 +0200 Subject: [PATCH 021/110] ue context setup first fix, the feature is not well implemented --- openair2/F1AP/f1ap_cu_ue_context_management.c | 24 ++++++++++--------- openair2/F1AP/f1ap_du_ue_context_management.c | 22 ++++++++++------- openair2/F1AP/f1ap_du_ue_context_management.h | 1 - 3 files changed, 26 insertions(+), 21 deletions(-) diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 8dbda7ab49..8b379735b4 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -133,17 +133,19 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, ie6->value.present = F1AP_UEContextSetupRequestIEs__value_PR_CUtoDURRCInformation; /* optional */ /* 6.1 cG_ConfigInfo */ - const char cG_ConfigInfoStr[]="asdsa1d32sa1d31asd31as"; - asn1cCalloc(ie6->value.choice.CUtoDURRCInformation.cG_ConfigInfo, F1AP_CG_ConfigInfo_t, cG_ConfigInfo); - OCTET_STRING_fromBuf(cG_ConfigInfo, cG_ConfigInfoStr, strlen( cG_ConfigInfoStr )) ; - /* optional */ - /* 6.2 uE_CapabilityRAT_ContainerList */ - asn1cCalloc(ie6->value.choice.CUtoDURRCInformation.uE_CapabilityRAT_ContainerList, F1AP_UE_CapabilityRAT_ContainerList_t, uE_CapabilityRAT_ContainerList ); - OCTET_STRING_fromBuf(uE_CapabilityRAT_ContainerList, cG_ConfigInfoStr, strlen( cG_ConfigInfoStr )) ; - /* optional */ - /* 6.3 measConfig */ - asn1cCalloc(ie6->value.choice.CUtoDURRCInformation.measConfig, F1AP_MeasConfig_t, measConfig); - OCTET_STRING_fromBuf(measConfig, cG_ConfigInfoStr, strlen( cG_ConfigInfoStr )) ; + if (0) { + const char cG_ConfigInfoStr[]="asdsa1d32sa1d31asd31as"; + asn1cCalloc(ie6->value.choice.CUtoDURRCInformation.cG_ConfigInfo, F1AP_CG_ConfigInfo_t, cG_ConfigInfo); + OCTET_STRING_fromBuf(cG_ConfigInfo, cG_ConfigInfoStr, strlen( cG_ConfigInfoStr )) ; + /* optional */ + /* 6.2 uE_CapabilityRAT_ContainerList */ + asn1cCalloc(ie6->value.choice.CUtoDURRCInformation.uE_CapabilityRAT_ContainerList, F1AP_UE_CapabilityRAT_ContainerList_t, uE_CapabilityRAT_ContainerList ); + OCTET_STRING_fromBuf(uE_CapabilityRAT_ContainerList, cG_ConfigInfoStr, strlen( cG_ConfigInfoStr )) ; + /* optional */ + /* 6.3 measConfig */ + asn1cCalloc(ie6->value.choice.CUtoDURRCInformation.measConfig, F1AP_MeasConfig_t, measConfig); + OCTET_STRING_fromBuf(measConfig, cG_ConfigInfoStr, strlen( cG_ConfigInfoStr )) ; + } /* mandatory */ /* c7. Candidate_SpCell_List */ diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index cb5c412ece..ed1830789a 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -148,12 +148,11 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, // AssertFatal(0, "check configuration, send to appropriate handler\n"); protocol_ctxt_t ctxt; - // ctxt.rnti = f1ap_get_rnti_by_du_id(&f1ap_du_inst[instance], ie->value.choice.GNB_DU_UE_F1AP_ID); - ctxt.rnti = 0x1234; + // decode RRC Container and act on the message type + rnti_t rnti = f1ap_get_rnti_by_du_id(false, instance, du_ue_f1ap_id); ctxt.module_id = instance; ctxt.instance = instance; - ctxt.enb_flag = 1; - + ctxt.enb_flag = 1; if ( ie->value.choice.RRCContainer.size ) { mem_block_t *pdcp_pdu_p = NULL; pdcp_pdu_p = get_free_mem_block(ie->value.choice.RRCContainer.size, __func__); @@ -161,22 +160,23 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, memcpy(&pdcp_pdu_p->data[0], ie->value.choice.RRCContainer.buf, ie->value.choice.RRCContainer.size); /* for rfsim */ du_rlc_data_req(&ctxt, 1, 0x00, 1, 1, 0, ie->value.choice.RRCContainer.size, pdcp_pdu_p); + + DU_send_UE_CONTEXT_SETUP_RESPONSE(instance, ctxt.rnti); } else { LOG_E(F1AP, " RRCContainer in UEContextSetupRequestIEs size id 0\n"); } } else { LOG_E(F1AP, "can't find RRCContainer in UEContextSetupRequestIEs by id %ld \n", F1AP_ProtocolIE_ID_id_RRCContainer); } - return 0; + return 0; } //void DU_send_UE_CONTEXT_SETUP_RESPONSE(F1AP_UEContextSetupResponse_t *UEContextSetupResponse) { -int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance) { +int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, rnti_t rntiP) { F1AP_F1AP_PDU_t pdu= {0}; F1AP_UEContextSetupResponse_t *out; uint8_t *buffer=NULL; uint32_t len=0; - rnti_t rntiP; // note: need get value /* Create */ /* 0. Message Type */ pdu.present = F1AP_F1AP_PDU_PR_successfulOutcome; @@ -208,8 +208,8 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance) { { /* cellGroupConfig */ OCTET_STRING_fromBuf(&ie3->value.choice.DUtoCURRCInformation.cellGroupConfig, "asdsa", - strlen("asdsa")); - + strlen("asdsa")); + /* OPTIONAL */ /* measGapConfig */ if (0) { @@ -474,6 +474,10 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance) { return -1; } + f1ap_itti_send_sctp_data_req(false, instance, + buffer, + len, + getCxt(false, instance)->default_sctp_stream_id); return 0; } diff --git a/openair2/F1AP/f1ap_du_ue_context_management.h b/openair2/F1AP/f1ap_du_ue_context_management.h index fa2044ba22..320061672a 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.h +++ b/openair2/F1AP/f1ap_du_ue_context_management.h @@ -40,7 +40,6 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); -int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance); int DU_send_UE_CONTEXT_SETUP_FAILURE(instance_t instance); From 18fce2b1735d5fc06c6cc4cf6df1834179153402 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Tue, 17 Aug 2021 14:55:44 +0200 Subject: [PATCH 022/110] fix several bugs, remain critical design mistakes --- openair2/COMMON/mac_messages_types.h | 1 + openair2/F1AP/f1ap_common.c | 6 +- openair2/F1AP/f1ap_common.h | 4 - openair2/F1AP/f1ap_cu_interface_management.c | 16 ++-- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 34 +------ openair2/F1AP/f1ap_cu_task.c | 10 +- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 20 +--- openair2/F1AP/f1ap_du_task.c | 2 +- openair2/F1AP/f1ap_du_ue_context_management.c | 4 +- openair2/RRC/LTE/L2_interface.c | 6 ++ openair2/RRC/NR/L2_nr_interface.c | 8 ++ openair2/RRC/NR/rrc_gNB.c | 94 +++++++++---------- 12 files changed, 87 insertions(+), 118 deletions(-) diff --git a/openair2/COMMON/mac_messages_types.h b/openair2/COMMON/mac_messages_types.h index a9336a58a9..cad7b9f172 100644 --- a/openair2/COMMON/mac_messages_types.h +++ b/openair2/COMMON/mac_messages_types.h @@ -147,6 +147,7 @@ typedef struct NRRrcMacCcchDataInd_s { OCTET_STRING_t *du_to_cu_rrc_container; uint8_t gnb_index; int CC_id; + uint64_t nr_cellid; } NRRrcMacCcchDataInd; typedef struct RrcMacMcchDataReq_s { diff --git a/openair2/F1AP/f1ap_common.c b/openair2/F1AP/f1ap_common.c index 1042cb4e54..85f1286557 100644 --- a/openair2/F1AP/f1ap_common.c +++ b/openair2/F1AP/f1ap_common.c @@ -87,25 +87,21 @@ 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) { 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; - f1_inst->f1ap_ue[i].mac_uid = UE_id; LOG_I(F1AP, "Updating the index of UE with RNTI %x and du_ue_f1ap_id %d\n", f1_inst->f1ap_ue[i].rnti, f1_inst->f1ap_ue[i].du_ue_f1ap_id); return i; } } - + // We didn't find the rnti for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) { if (f1_inst->f1ap_ue[i].rnti == 0 ) { f1_inst->f1ap_ue[i].rnti = rntiP; f1_inst->f1ap_ue[i].f1ap_uid = i; - f1_inst->f1ap_ue[i].mac_uid = UE_id; f1_inst->f1ap_ue[i].du_ue_f1ap_id = rntiP; f1_inst->f1ap_ue[i].cu_ue_f1ap_id = rntiP; f1_inst->num_ues++; diff --git a/openair2/F1AP/f1ap_common.h b/openair2/F1AP/f1ap_common.h index 7bceeab68a..2c357cd199 100644 --- a/openair2/F1AP/f1ap_common.h +++ b/openair2/F1AP/f1ap_common.h @@ -422,14 +422,12 @@ typedef struct f1ap_cudu_ue_inst_s { // used for eNB stats generation rnti_t rnti; module_id_t f1ap_uid; - module_id_t mac_uid; module_id_t du_ue_f1ap_id; module_id_t cu_ue_f1ap_id; } 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; @@ -447,8 +445,6 @@ f1ap_cudu_inst_t *getCxt(bool isCU, module_id_t module_idP); 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(bool isCu, module_id_t module_idP, diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index 5c412e5280..b3668cd783 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -95,9 +95,10 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, assoc_id, stream); } - message_p = itti_alloc_new_message(TASK_CU_F1, 0, F1AP_SETUP_REQ); /* assoc_id */ - f1ap_setup_req_t *req=&F1AP_SETUP_REQ(message_p); + f1ap_setup_req_t *req=&getCxt(true, instance)->setupReq; + + req->assoc_id = assoc_id; /* gNB_DU_id */ // this function exits if the ie is mandatory @@ -159,8 +160,8 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, /* Convert the mme name to a printable string */ req->mib[i][served_cells_item_p->gNB_DU_System_Information->mIB_message.size] = '\0'; req->mib_length[i] = served_cells_item_p->gNB_DU_System_Information->mIB_message.size; - LOG_D(F1AP, "req->mib[%d] %s , len = %d \n", - i, req->mib[i], req->mib_length[i]); + LOG_D(F1AP, "req->mib[%d] len = %d \n", + i, req->mib_length[i]); /* sib1 */ req->sib1[i] = calloc(served_cells_item_p->gNB_DU_System_Information->sIB1_message.size + 1, sizeof(char)); memcpy(req->sib1[i], served_cells_item_p->gNB_DU_System_Information->sIB1_message.buf, @@ -168,8 +169,8 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, /* Convert the mme name to a printable string */ req->sib1[i][served_cells_item_p->gNB_DU_System_Information->sIB1_message.size] = '\0'; req->sib1_length[i] = served_cells_item_p->gNB_DU_System_Information->sIB1_message.size; - LOG_D(F1AP, "req->sib1[%d] %s , len = %d \n", - i, req->sib1[i], req->sib1_length[i]); + LOG_D(F1AP, "req->sib1[%d] len = %d \n", + i, req->sib1_length[i]); } // char *measurement_timing_information[F1AP_MAX_NB_CELLS]; @@ -207,6 +208,9 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, // } tdd; // } nr_mode_info[F1AP_MAX_NB_CELLS]; + // We copy and store in F1 task data, RRC will free "req" as it frees all itti received messages + message_p = itti_alloc_new_message(TASK_CU_F1, 0, F1AP_SETUP_REQ); + memcpy(&F1AP_SETUP_REQ(message_p), req, sizeof(f1ap_setup_req_t) ); if (num_cells_available > 0) { if (RC.nrrrc && RC.nrrrc[0]->node_type == ngran_gNB_CU) { itti_send_msg_to_task(TASK_RRC_GNB, GNB_MODULE_ID_TO_INSTANCE(instance), message_p); diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index e130ea0c98..e005b999fd 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -68,9 +68,9 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, /* 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); - getCxt(true, instance)->du_ue_f1ap_id = ie->value.choice.GNB_DU_UE_F1AP_ID; + module_id_t du_ue_f1ap_id = ie->value.choice.GNB_DU_UE_F1AP_ID; /* NRCGI - * TODO: process NRCGI + * Fixme: process NRCGI */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_NRCGI, true); @@ -120,33 +120,7 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, ie->value.choice.DUtoCURRCContainer.size); } - // Find instance from nr_cellid - int rrc_inst = -1; - - if (f1ap_req(true, instance)->cell_type==CELL_MACRO_GNB) { - for (int i=0; inr_cellid == nr_cellid) { - rrc_inst = i; - break; - } - } - } else { - for (int i=0; inr_cellid == nr_cellid) { - rrc_inst = i; - break; - } - } - } - - 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(true, rrc_inst, CC_id, 0, rnti); + int f1ap_uid = f1ap_add_ue(true, instance, rnti); if (f1ap_uid < 0 ) { LOG_E(F1AP, "Failed to add UE \n"); @@ -158,7 +132,7 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, 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).nr_cellid = nr_cellid; // 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 (f1ap_req(true,ITTI_MSG_DESTINATION_ID(message_p))->cell_type==CELL_MACRO_GNB?TASK_RRC_GNB:TASK_RRC_ENB, instance, message_p); diff --git a/openair2/F1AP/f1ap_cu_task.c b/openair2/F1AP/f1ap_cu_task.c index 28d415328a..4e6fc7d712 100644 --- a/openair2/F1AP/f1ap_cu_task.c +++ b/openair2/F1AP/f1ap_cu_task.c @@ -40,11 +40,11 @@ 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; + f1ap_setup_req_t *f1ap_cu_data=f1ap_req(true, instance); + 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; + f1ap_cu_data->default_sctp_stream_id = 0; // Nothing } diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index 3d7dbce3e3..692f8b6e92 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -762,13 +762,13 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, rnti_t rntiP, const uint8_t *sduP, sdu_size_t sdu_lenP, - const char *sdu2P, + const char *sdu2P, sdu_size_t sdu2_lenP) { F1AP_F1AP_PDU_t pdu= {0}; F1AP_InitialULRRCMessageTransfer_t *out; uint8_t *buffer=NULL; uint32_t len=0; - int f1ap_uid = f1ap_add_ue (false, module_idP, CC_idP,UE_id, rntiP); + int f1ap_uid = f1ap_add_ue (false, module_idP, rntiP); if (f1ap_uid < 0 ) { LOG_E(F1AP, "Failed to add UE \n"); @@ -831,22 +831,6 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, return -1; } - if (RC.nrrrc && RC.nrrrc[module_idP]->node_type == ngran_gNB_DU) { - struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_allocate_new_UE_context(RC.nrrrc[module_idP]); - ue_context_p->ue_id_rnti = rntiP; - ue_context_p->ue_context.rnti = rntiP; - ue_context_p->ue_context.random_ue_identity = rntiP; - ue_context_p->ue_context.Srb0.Active = 1; - RB_INSERT(rrc_nr_ue_tree_s, &RC.nrrrc[module_idP]->rrc_ue_head, ue_context_p); - } else { - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_allocate_new_UE_context(RC.rrc[module_idP]); - ue_context_p->ue_id_rnti = rntiP; - ue_context_p->ue_context.rnti = rntiP; - ue_context_p->ue_context.random_ue_identity = rntiP; - ue_context_p->ue_context.Srb0.Active = 1; - RB_INSERT(rrc_ue_tree_s, &RC.rrc[module_idP]->rrc_ue_head, ue_context_p); - } - f1ap_itti_send_sctp_data_req(false, module_idP, buffer, len, getCxt(false, module_idP)->default_sctp_stream_id); return 0; } diff --git a/openair2/F1AP/f1ap_du_task.c b/openair2/F1AP/f1ap_du_task.c index a9701e005d..ba14bf90da 100644 --- a/openair2/F1AP/f1ap_du_task.c +++ b/openair2/F1AP/f1ap_du_task.c @@ -154,7 +154,7 @@ void *F1AP_DU_task(void *arg) { &received_msg->ittiMsg.sctp_data_ind); break; - case F1AP_INITIAL_UL_RRC_MESSAGE: // to rrc + case F1AP_INITIAL_UL_RRC_MESSAGE: // from rrc LOG_I(F1AP, "DU Task Received F1AP_INITIAL_UL_RRC_MESSAGE\n"); f1ap_initial_ul_rrc_message_t *msg = &F1AP_INITIAL_UL_RRC_MESSAGE(received_msg); DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(0,0,0,msg->crnti, diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index ed1830789a..6c0f5fa9ab 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -41,6 +41,7 @@ #include "openair2/RRC/NR/rrc_gNB_UE_context.h" #include "openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h" +int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, rnti_t rntiP); int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, uint32_t assoc_id, uint32_t stream, @@ -149,7 +150,8 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, // AssertFatal(0, "check configuration, send to appropriate handler\n"); protocol_ctxt_t ctxt; // decode RRC Container and act on the message type - rnti_t rnti = f1ap_get_rnti_by_du_id(false, instance, du_ue_f1ap_id); + //FIXME + //rnti_t rnti = f1ap_get_rnti_by_du_id(false, instance, du_ue_f1ap_id); ctxt.module_id = instance; ctxt.instance = instance; ctxt.enb_flag = 1; diff --git a/openair2/RRC/LTE/L2_interface.c b/openair2/RRC/LTE/L2_interface.c index 0b767b8ad6..3759519228 100644 --- a/openair2/RRC/LTE/L2_interface.c +++ b/openair2/RRC/LTE/L2_interface.c @@ -317,6 +317,12 @@ mac_rrc_data_ind( sdu_lenP, NULL, 0); + struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_allocate_new_UE_context(RC.rrc[module_idP]); + ue_context_p->ue_id_rnti = rntiP; + ue_context_p->ue_context.rnti = rntiP; + ue_context_p->ue_context.random_ue_identity = rntiP; + ue_context_p->ue_context.Srb0.Active = 1; + RB_INSERT(rrc_ue_tree_s, &RC.rrc[module_idP]->rrc_ue_head, ue_context_p); return(0); } diff --git a/openair2/RRC/NR/L2_nr_interface.c b/openair2/RRC/NR/L2_nr_interface.c index ddd5533c6c..445aa832cb 100644 --- a/openair2/RRC/NR/L2_nr_interface.c +++ b/openair2/RRC/NR/L2_nr_interface.c @@ -344,6 +344,14 @@ int8_t nr_mac_rrc_data_ind(const module_id_t module_idP, memcpy(msg->rrc_container, sduP, sdu_lenP); msg->rrc_container_length=sdu_lenP; itti_send_msg_to_task(TASK_DU_F1, 0, tmp); + + struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_allocate_new_UE_context(RC.nrrrc[module_idP]); + ue_context_p->ue_id_rnti = rntiP; + ue_context_p->ue_context.rnti = rntiP; + ue_context_p->ue_context.random_ue_identity = rntiP; + ue_context_p->ue_context.Srb0.Active = 1; + RB_INSERT(rrc_nr_ue_tree_s, &RC.nrrrc[module_idP]->rrc_ue_head, ue_context_p); + return(0); } diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index b7ddd40d55..73fac87f64 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -2736,16 +2736,19 @@ rrc_gNB_decode_dcch( void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) { LOG_I(NR_RRC,"Received F1 Setup Request from gNB_DU %llu (%s)\n",(unsigned long long int)f1_setup_req->gNB_DU_id,f1_setup_req->gNB_DU_name); int cu_cell_ind = 0; - MessageDef *msg_p = NULL,*msg_p2=NULL; + MessageDef *msg_p =itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_SETUP_RESP); + F1AP_SETUP_RESP (msg_p).num_cells_to_activate = 0; + MessageDef *msg_p2=itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_GNB_CU_CONFIGURATION_UPDATE); for (int i = 0; i < f1_setup_req->num_cells_available; i++) { - int found_cell=0; for (int j=0; jconfiguration.mcc[0] == f1_setup_req->cell[i].mcc && rrc->configuration.mnc[0] == f1_setup_req->cell[i].mnc && rrc->nr_cellid == f1_setup_req->cell[i].nr_cellid) { + //fixme: multi instance is not consistent here + F1AP_SETUP_RESP (msg_p).gNB_CU_name = rrc->node_name; // check that CU rrc instance corresponds to mcc/mnc/cgi (normally cgi should be enough, but just in case) rrc->carrier.MIB = malloc(f1_setup_req->mib_length[i]); rrc->carrier.sizeof_MIB = f1_setup_req->mib_length[i]; @@ -2789,19 +2792,6 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) { "bcch_message->message.choice.c1->present != NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1\n"); rrc->carrier.sib1 = bcch_message->message.choice.c1->choice.systemInformationBlockType1; rrc->carrier.physCellId = f1_setup_req->cell[i].nr_pci; - if (cu_cell_ind == 0) { - // prepare F1_SETUP_RESPONSE + GNB_CU_CONFIGURATION_UPDATE - if (msg_p == NULL) { - msg_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_SETUP_RESP); - } - if (msg_p2 == NULL) { - msg_p2 = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_GNB_CU_CONFIGURATION_UPDATE); - } - - F1AP_SETUP_RESP (msg_p).gNB_CU_name = rrc->node_name; - F1AP_SETUP_RESP (msg_p).num_cells_to_activate = 0; - - } F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).gNB_CU_name = rrc->node_name; F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].mcc = rrc->configuration.mcc[0]; @@ -2819,7 +2809,6 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) { F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].num_SI = num_SI; cu_cell_ind++; - found_cell=1; F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).num_cells_to_activate = cu_cell_ind; // send break; @@ -2831,10 +2820,9 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) { } }// for (int j=0;jittiMsgHeader.lte_time.frame, - msg_p->ittiMsgHeader.lte_time.slot); - LOG_I(NR_RRC,"Decoding CCCH : ue %d, inst %ld, CC_id %d, ctxt %p, sib_info_p->Rx_buffer.payload_size %d\n", - ctxt.rnti, - instance, - NR_RRC_MAC_CCCH_DATA_IND(msg_p).CC_id, - &ctxt, - NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size); - - if (NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size >= CCCH_SDU_SIZE) { - LOG_I(NR_RRC, "CCCH message has size %d > %d\n", - NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size,CCCH_SDU_SIZE); - break; - } - - nr_rrc_gNB_decode_ccch(&ctxt, - (uint8_t *)NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu, - NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size, - NR_RRC_MAC_CCCH_DATA_IND(msg_p).du_to_cu_rrc_container, - NR_RRC_MAC_CCCH_DATA_IND(msg_p).CC_id); - - if (NR_RRC_MAC_CCCH_DATA_IND(msg_p).du_to_cu_rrc_container) { - free(NR_RRC_MAC_CCCH_DATA_IND(msg_p).du_to_cu_rrc_container->buf); - free(NR_RRC_MAC_CCCH_DATA_IND(msg_p).du_to_cu_rrc_container); - } + { + instance_t i; + for (i=0; inr_cellid == NR_RRC_MAC_CCCH_DATA_IND(msg_p).nr_cellid) + break; + } + AssertFatal(i!=RC.nb_nr_inst, "Cell_id not found\n"); + PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, + i, + GNB_FLAG_YES, + NR_RRC_MAC_CCCH_DATA_IND(msg_p).rnti, + msg_p->ittiMsgHeader.lte_time.frame, + msg_p->ittiMsgHeader.lte_time.slot); + LOG_I(NR_RRC,"Decoding CCCH : ue %d, inst %ld, CC_id %d, ctxt %p, sib_info_p->Rx_buffer.payload_size %d\n", + ctxt.rnti, + i, + NR_RRC_MAC_CCCH_DATA_IND(msg_p).CC_id, + &ctxt, + NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size); + + if (NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size >= CCCH_SDU_SIZE) { + LOG_I(NR_RRC, "CCCH message has size %d > %d\n", + NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size,CCCH_SDU_SIZE); + break; + } + nr_rrc_gNB_decode_ccch(&ctxt, + (uint8_t *)NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu, + NR_RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size, + NR_RRC_MAC_CCCH_DATA_IND(msg_p).du_to_cu_rrc_container, + NR_RRC_MAC_CCCH_DATA_IND(msg_p).CC_id); + + if (NR_RRC_MAC_CCCH_DATA_IND(msg_p).du_to_cu_rrc_container) { + free(NR_RRC_MAC_CCCH_DATA_IND(msg_p).du_to_cu_rrc_container->buf); + free(NR_RRC_MAC_CCCH_DATA_IND(msg_p).du_to_cu_rrc_container); + } + } break; /* Messages from PDCP */ From 1a43c21b124a30dd009163dc8955a1e77b470190 Mon Sep 17 00:00:00 2001 From: Laurent Thomas Date: Thu, 19 Aug 2021 12:09:06 +0200 Subject: [PATCH 023/110] remove a race F1AP->NR RRC --- openair2/COMMON/rrc_messages_def.h | 2 + openair2/COMMON/rrc_messages_types.h | 6 + openair2/F1AP/f1ap_du_rrc_message_transfer.c | 304 +------------------ openair2/RRC/NR/rrc_gNB.c | 267 +++++++++++++++- 4 files changed, 289 insertions(+), 290 deletions(-) diff --git a/openair2/COMMON/rrc_messages_def.h b/openair2/COMMON/rrc_messages_def.h index cde2497880..fa946f362f 100644 --- a/openair2/COMMON/rrc_messages_def.h +++ b/openair2/COMMON/rrc_messages_def.h @@ -79,3 +79,5 @@ MESSAGE_DEF(RRC_SUBFRAME_PROCESS, MESSAGE_PRIORITY_MED, RrcSubframeP // eNB: RLC -> RRC messages MESSAGE_DEF(RLC_SDU_INDICATION, MESSAGE_PRIORITY_MED, RlcSduIndication, rlc_sdu_indication) + +MESSAGE_DEF(NR_DU_RRC_DL_INDICATION, MESSAGE_PRIORITY_MED, NRDuDlReq_t, nr_du_dl_req) diff --git a/openair2/COMMON/rrc_messages_types.h b/openair2/COMMON/rrc_messages_types.h index ca4011231a..f24f974125 100644 --- a/openair2/COMMON/rrc_messages_types.h +++ b/openair2/COMMON/rrc_messages_types.h @@ -89,6 +89,7 @@ #define RRC_SUBFRAME_PROCESS(mSGpTR) (mSGpTR)->ittiMsg.rrc_subframe_process #define RLC_SDU_INDICATION(mSGpTR) (mSGpTR)->ittiMsg.rlc_sdu_indication +#define NRDuDlReq(mSGpTR) (mSGpTR)->ittiMsg.nr_du_dl_req //-------------------------------------------------------------------------------------------// typedef struct RrcStateInd_s { @@ -416,6 +417,11 @@ typedef struct NRRrcConfigurationReq_s { int pucch_TargetSNRx10; } gNB_RrcConfigurationReq; +typedef struct NRDuDlReq_s { + rnti_t rnti; + mem_block_t * buf; + uint64_t srb_id; +} NRDuDlReq_t; // UE: NAS -> RRC messages typedef kenb_refresh_req_t NasKenbRefreshReq; diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index 692f8b6e92..dbb10cd4a0 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -72,12 +72,11 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, return DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance, assoc_id, stream, pdu); } - LOG_D(F1AP, "DU_handle_DL_RRC_MESSAGE_TRANSFER \n"); + LOG_W(F1AP, "DU_handle_DL_RRC_MESSAGE_TRANSFER is a big race condition with rrc \n"); F1AP_DLRRCMessageTransfer_t *container; F1AP_DLRRCMessageTransferIEs_t *ie; uint64_t cu_ue_f1ap_id; uint64_t du_ue_f1ap_id; - uint64_t srb_id; int executeDuplication; sdu_size_t rrc_dl_sdu_len; //uint64_t subscriberProfileIDforRFP; @@ -102,7 +101,8 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, du_ue_f1ap_id = ie->value.choice.GNB_DU_UE_F1AP_ID; LOG_D(F1AP, "du_ue_f1ap_id %lu associated with UE RNTI %x \n", du_ue_f1ap_id, - f1ap_get_rnti_by_du_id(false, instance, du_ue_f1ap_id)); // this should be the one transmitted via initial ul rrc message transfer + f1ap_get_rnti_by_du_id(false, instance, du_ue_f1ap_id)); + // this should be the one transmitted via initial ul rrc message transfer if (f1ap_du_add_cu_ue_id(false, instance,du_ue_f1ap_id, cu_ue_f1ap_id) < 0 ) { LOG_E(F1AP, "Failed to find the F1AP UID \n"); @@ -120,7 +120,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, /* SRBID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_SRBID, true); - srb_id = ie->value.choice.SRBID; + uint64_t srb_id = ie->value.choice.SRBID; LOG_D(F1AP, "srb_id %lu \n", srb_id); /* optional */ @@ -137,18 +137,8 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, /* RRC Container */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_RRCContainer, true); - // BK: need check - // create an ITTI message and copy SDU - // message_p = itti_alloc_new_message (TASK_CU_F1, 0, RRC_MAC_CCCH_DATA_IND); - // memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE); - rrc_dl_sdu_len = ie->value.choice.RRCContainer.size; - // memcpy(RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf, - // ccch_sdu_len); - //LOG_I(F1AP, "%s() RRCContainer size %lu: ", __func__, ie->value.choice.RRCContainer.size); - //for (int i = 0;i < ie->value.choice.RRCContainer.size; i++) - // printf("%02x ", ie->value.choice.RRCContainer.buf[i]); - //printf("\n"); + rrc_dl_sdu_len = ie->value.choice.RRCContainer.size; /* optional */ /* RAT_FrequencyPriorityInformation */ @@ -909,19 +899,10 @@ int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, F1AP_DLRRCMessageTransferIEs_t *ie; uint64_t cu_ue_f1ap_id; uint64_t du_ue_f1ap_id; - uint64_t srb_id; int executeDuplication; - sdu_size_t rrc_dl_sdu_len; //uint64_t subscriberProfileIDforRFP; //uint64_t rAT_FrequencySelectionPriority; DevAssert(pdu != NULL); - - if (stream != 0) { - LOG_E(F1AP, "[SCTP %d] Received F1 on stream != 0 (%d)\n", - assoc_id, stream); - return -1; - } - container = &pdu->choice.initiatingMessage->value.choice.DLRRCMessageTransfer; /* GNB_CU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container, @@ -940,7 +921,7 @@ int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, LOG_E(F1AP, "Failed to find the F1AP UID \n"); //return -1; } - + /* optional */ /* oldgNB_DU_UE_F1AP_ID */ if (0) { @@ -952,7 +933,8 @@ int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, /* SRBID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_SRBID, true); - srb_id = ie->value.choice.SRBID; + + uint64_t srb_id = ie->value.choice.SRBID; LOG_D(F1AP, "srb_id %lu \n", srb_id); /* optional */ @@ -973,7 +955,6 @@ int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, // create an ITTI message and copy SDU // message_p = itti_alloc_new_message (TASK_CU_F1, RRC_MAC_CCCH_DATA_IND); // memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE); - rrc_dl_sdu_len = ie->value.choice.RRCContainer.size; // memcpy(RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf, // ccch_sdu_len); @@ -1005,268 +986,13 @@ int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, // decode RRC Container and act on the message type AssertFatal(srb_id<3,"illegal srb_id\n"); - protocol_ctxt_t ctxt; - ctxt.rnti = f1ap_get_rnti_by_du_id(false, instance, du_ue_f1ap_id); - ctxt.module_id = instance; - ctxt.instance = instance; - ctxt.enb_flag = 1; - struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_get_ue_context( - RC.nrrrc[ctxt.module_id], - ctxt.rnti); - gNB_RRC_INST *rrc = RC.nrrrc[ctxt.module_id]; - - if (srb_id == 0) { - NR_DL_CCCH_Message_t *dl_ccch_msg=NULL; - asn_dec_rval_t dec_rval; - dec_rval = uper_decode(NULL, - &asn_DEF_NR_DL_CCCH_Message, - (void **)&dl_ccch_msg, - ie->value.choice.RRCContainer.buf, - rrc_dl_sdu_len,0,0); - AssertFatal(dec_rval.code == RC_OK, "could not decode F1AP message\n"); - - switch (dl_ccch_msg->message.choice.c1->present) { - case NR_DL_CCCH_MessageType__c1_PR_NOTHING: - LOG_I(F1AP, "Received PR_NOTHING on DL-CCCH-Message\n"); - break; - - case NR_DL_CCCH_MessageType__c1_PR_rrcReject: - LOG_I(F1AP, - "Logical Channel DL-CCCH (SRB0), Received RRCReject\n"); - break; - - case NR_DL_CCCH_MessageType__c1_PR_rrcSetup: { - LOG_I(F1AP, - "Logical Channel DL-CCCH (SRB0), Received RRCSetup DU_ID %lx/RNTI %x\n", - du_ue_f1ap_id, - f1ap_get_rnti_by_du_id(false, instance, du_ue_f1ap_id)); - // Get configuration - NR_RRCSetup_t *rrcSetup = dl_ccch_msg->message.choice.c1->choice.rrcSetup; - AssertFatal(rrcSetup!=NULL, "rrcSetup is null\n"); - NR_RRCSetup_IEs_t *rrcSetup_ies = rrcSetup->criticalExtensions.choice.rrcSetup; - ue_context_p->ue_context.SRB_configList = rrcSetup_ies->radioBearerConfig.srb_ToAddModList; - AssertFatal(rrcSetup_ies->masterCellGroup.buf!=NULL,"masterCellGroup is null\n"); - asn_dec_rval_t dec_rval; - dec_rval = uper_decode(NULL, - &asn_DEF_NR_CellGroupConfig, - (void **)&ue_context_p->ue_context.masterCellGroup, - rrcSetup_ies->masterCellGroup.buf, - rrcSetup_ies->masterCellGroup.size,0,0); - AssertFatal(dec_rval.code == RC_OK, "could not decode masterCellGroup\n"); - apply_macrlc_config(rrc,ue_context_p,&ctxt); - gNB_RRC_UE_t *ue_p = &ue_context_p->ue_context; - AssertFatal(ue_p->Srb0.Active == 1,"SRB0 is not active\n"); - memcpy((void *)ue_p->Srb0.Tx_buffer.Payload, - (void *)ie->value.choice.RRCContainer.buf, - rrc_dl_sdu_len); // ie->value.choice.RRCContainer.size - ue_p->Srb0.Tx_buffer.payload_size = rrc_dl_sdu_len; - break; - } // case - - case NR_DL_CCCH_MessageType__c1_PR_spare2: - LOG_I(F1AP, - "Logical Channel DL-CCCH (SRB0), Received spare2\n"); - break; - - case NR_DL_CCCH_MessageType__c1_PR_spare1: - LOG_I(F1AP, - "Logical Channel DL-CCCH (SRB0), Received spare1\n"); - break; - - default: - AssertFatal(1==0, - "Unknown message\n"); - break; - }// switch case - - return(0); - } else if (srb_id == 1) { - NR_DL_DCCH_Message_t *dl_dcch_msg=NULL; - asn_dec_rval_t dec_rval; - dec_rval = uper_decode(NULL, - &asn_DEF_NR_DL_DCCH_Message, - (void **)&dl_dcch_msg, - &ie->value.choice.RRCContainer.buf[2], // buf[0] includes the pdcp header - rrc_dl_sdu_len-6,0,0); - - if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) - LOG_E(F1AP," Failed to decode DL-DCCH (%zu bytes)\n",dec_rval.consumed); - else - LOG_D(F1AP, "Received message: present %d and c1 present %d\n", - dl_dcch_msg->message.present, dl_dcch_msg->message.choice.c1->present); - - if (dl_dcch_msg->message.present == NR_DL_DCCH_MessageType_PR_c1) { - switch (dl_dcch_msg->message.choice.c1->present) { - case NR_DL_DCCH_MessageType__c1_PR_NOTHING: - LOG_I(F1AP, "Received PR_NOTHING on DL-DCCH-Message\n"); - return 0; - - case NR_DL_DCCH_MessageType__c1_PR_rrcReconfiguration: - // handle RRCReconfiguration - LOG_I(F1AP, - "Logical Channel DL-DCCH (SRB1), Received RRCReconfiguration DU_ID %lx/RNTI %x\n", - du_ue_f1ap_id, - f1ap_get_rnti_by_du_id(false, instance, du_ue_f1ap_id)); - NR_RRCReconfiguration_t *rrcReconfiguration = dl_dcch_msg->message.choice.c1->choice.rrcReconfiguration; - - if (rrcReconfiguration->criticalExtensions.present == NR_RRCReconfiguration__criticalExtensions_PR_rrcReconfiguration) { - NR_RRCReconfiguration_IEs_t *rrcReconfiguration_ies = - rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration; - - if (rrcReconfiguration_ies->measConfig != NULL) { - LOG_I(F1AP, "Measurement Configuration is present\n"); - } - - if (rrcReconfiguration_ies->radioBearerConfig) { - LOG_I(F1AP, "Radio Resource Configuration is present\n"); - long drb_id; - int i; - NR_DRB_ToAddModList_t *DRB_configList = rrcReconfiguration_ies->radioBearerConfig->drb_ToAddModList; - NR_SRB_ToAddModList_t *SRB_configList = rrcReconfiguration_ies->radioBearerConfig->srb_ToAddModList; - - // NR_DRB_ToReleaseList_t *DRB_ReleaseList = rrcReconfiguration_ies->radioBearerConfig->drb_ToReleaseList; - - // rrc_rlc_config_asn1_req - - if (SRB_configList != NULL) { - for (i = 0; (i < SRB_configList->list.count) && (i < 3); i++) { - if (SRB_configList->list.array[i]->srb_Identity == 1 ) { - ue_context_p->ue_context.Srb1.Active=1; - } else if (SRB_configList->list.array[i]->srb_Identity == 2 ) { - ue_context_p->ue_context.Srb2.Active=1; - ue_context_p->ue_context.Srb2.Srb_info.Srb_id=2; - LOG_I(F1AP, "[DU %d] SRB2 is now active\n",ctxt.module_id); - } else { - LOG_W(F1AP, "[DU %d] invalide SRB identity %ld\n",ctxt.module_id, - SRB_configList->list.array[i]->srb_Identity); - } - } - } - - if (DRB_configList != NULL) { - for (i = 0; i < DRB_configList->list.count; i++) { // num max DRB (11-3-8) - if (DRB_configList->list.array[i]) { - drb_id = (int)DRB_configList->list.array[i]->drb_Identity; - LOG_I(F1AP, - "[DU %d] Logical Channel UL-DCCH, Received RRCConnectionReconfiguration for UE rnti %x, reconfiguring DRB %d\n", - ctxt.module_id, - ctxt.rnti, - (int)DRB_configList->list.array[i]->drb_Identity); - - // (int)*DRB_configList->list.array[i]->logicalChannelIdentity); - - if (ue_context_p->ue_context.DRB_active[drb_id] == 0) { - ue_context_p->ue_context.DRB_active[drb_id] = 1; - // logicalChannelIdentity - // rrc_mac_config_req_eNB - } - } else { // remove LCHAN from MAC/PHY - AssertFatal(1==0,"Can't handle this yet in DU\n"); - } - } - } - } - } - - break; - - case NR_DL_DCCH_MessageType__c1_PR_rrcResume: - LOG_I(F1AP,"Received rrcResume\n"); - break; - - case NR_DL_DCCH_MessageType__c1_PR_rrcRelease: - LOG_I(F1AP,"Received rrcRelease\n"); - break; - - case NR_DL_DCCH_MessageType__c1_PR_rrcReestablishment: - LOG_I(F1AP,"Received rrcReestablishment\n"); - break; - - case NR_DL_DCCH_MessageType__c1_PR_securityModeCommand: - LOG_I(F1AP,"Received securityModeCommand\n"); - break; - - case NR_DL_DCCH_MessageType__c1_PR_dlInformationTransfer: - LOG_I(F1AP, "Received dlInformationTransfer\n"); - break; - - case NR_DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry: - LOG_I(F1AP, "Received ueCapabilityEnquiry\n"); - break; - - case NR_DL_DCCH_MessageType__c1_PR_counterCheck: - LOG_I(F1AP, "Received counterCheck\n"); - break; - - case NR_DL_DCCH_MessageType__c1_PR_mobilityFromNRCommand: - case NR_DL_DCCH_MessageType__c1_PR_dlDedicatedMessageSegment_r16: - case NR_DL_DCCH_MessageType__c1_PR_ueInformationRequest_r16: - case NR_DL_DCCH_MessageType__c1_PR_dlInformationTransferMRDC_r16: - case NR_DL_DCCH_MessageType__c1_PR_loggedMeasurementConfiguration_r16: - case NR_DL_DCCH_MessageType__c1_PR_spare3: - case NR_DL_DCCH_MessageType__c1_PR_spare2: - case NR_DL_DCCH_MessageType__c1_PR_spare1: - break; - } - } - } else if (srb_id == 2) { - // TODO - } - - LOG_I(F1AP, "Received DL RRC Transfer on srb_id %ld\n", srb_id); - // rlc_op_status_t rlc_status; - // boolean_t ret = TRUE; - mem_block_t *pdcp_pdu_p = NULL; - pdcp_pdu_p = get_free_mem_block(rrc_dl_sdu_len, __func__); - - //LOG_I(F1AP, "PRRCContainer size %lu:", ie->value.choice.RRCContainer.size); - //for (int i = 0; i < ie->value.choice.RRCContainer.size; i++) - // printf("%02x ", ie->value.choice.RRCContainer.buf[i]); - - //printf (", PDCP PDU size %d:", rrc_dl_sdu_len); - //for (int i=0;idata[i]); - //printf("\n"); - - if (pdcp_pdu_p != NULL) { - memset(pdcp_pdu_p->data, 0, rrc_dl_sdu_len); - memcpy(&pdcp_pdu_p->data[0], ie->value.choice.RRCContainer.buf, rrc_dl_sdu_len); - /* for rfsim */ - du_rlc_data_req(&ctxt, 1, 0x00, 1, 1, 0, rrc_dl_sdu_len, pdcp_pdu_p); - // rlc_status = rlc_data_req(&ctxt - // , 1 - // , MBMS_FLAG_NO - // , srb_id - // , 0 - // , 0 - // , rrc_dl_sdu_len - // , pdcp_pdu_p - // ,NULL - // ,NULL - // ); - // switch (rlc_status) { - // case RLC_OP_STATUS_OK: - // //LOG_I(F1AP, "Data sending request over RLC succeeded!\n"); - // ret=TRUE; - // break; - // case RLC_OP_STATUS_BAD_PARAMETER: - // LOG_W(F1AP, "Data sending request over RLC failed with 'Bad Parameter' reason!\n"); - // ret= FALSE; - // break; - // case RLC_OP_STATUS_INTERNAL_ERROR: - // LOG_W(F1AP, "Data sending request over RLC failed with 'Internal Error' reason!\n"); - // ret= FALSE; - // break; - // case RLC_OP_STATUS_OUT_OF_RESSOURCES: - // LOG_W(F1AP, "Data sending request over RLC failed with 'Out of Resources' reason!\n"); - // ret= FALSE; - // break; - // default: - // LOG_W(F1AP, "RLC returned an unknown status code after PDCP placed the order to send some data (Status Code:%d)\n", rlc_status); - // ret= FALSE; - // break; - // } // switch case - // return ret; - } // if pdcp_pdu_p + MessageDef * msg = itti_alloc_new_message(TASK_DU_F1, 0, NR_DU_RRC_DL_INDICATION); + NRDuDlReq_t * req=&NRDuDlReq(msg); + req->rnti=f1ap_get_rnti_by_du_id(false, instance, du_ue_f1ap_id); + req->srb_id=srb_id; + req->buf= get_free_mem_block( ie->value.choice.RRCContainer.size, __func__); + memcpy(req->buf->data, ie->value.choice.RRCContainer.buf, ie->value.choice.RRCContainer.size); + itti_send_msg_to_task(TASK_RRC_GNB, instance, msg); return 0; } diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 73fac87f64..d0bddd9a4d 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -47,6 +47,12 @@ #include "NR_BCCH-BCH-Message.h" #include "NR_UL-DCCH-Message.h" #include "NR_DL-DCCH-Message.h" +#include "NR_DL-CCCH-Message.h" +#include "NR_UL-CCCH-Message.h" +#include "NR_RRCReject.h" +#include "NR_RejectWaitTime.h" +#include "NR_RRCSetup.h" + #include "NR_CellGroupConfig.h" #include "NR_MeasResults.h" #include "LTE_UECapabilityInformation.h" @@ -2846,6 +2852,261 @@ void rrc_gNB_process_dc_overall_timeout(const module_id_t gnb_mod_idP, x2ap_ENDC rrc_remove_nsa_user(rrc, m->rnti); } +static int rrc_process_DU_DL(MessageDef *msg_p, const char *msg_name, instance_t instance) { + NRDuDlReq_t * req=&NRDuDlReq(msg_p); + protocol_ctxt_t ctxt; + ctxt.rnti = req->rnti; + ctxt.module_id = instance; + ctxt.instance = instance; + ctxt.enb_flag = 1; + gNB_RRC_INST *rrc = RC.nrrrc[ctxt.module_id]; + struct rrc_gNB_ue_context_s *ue_context_p = + rrc_gNB_get_ue_context(rrc, ctxt.rnti); + + if (req->srb_id == 0) { + NR_DL_CCCH_Message_t *dl_ccch_msg=NULL; + asn_dec_rval_t dec_rval; + dec_rval = uper_decode(NULL, + &asn_DEF_NR_DL_CCCH_Message, + (void **)&dl_ccch_msg, + req->buf->data, + req->buf->size,0,0); + AssertFatal(dec_rval.code == RC_OK, "could not decode F1AP message\n"); + + switch (dl_ccch_msg->message.choice.c1->present) { + case NR_DL_CCCH_MessageType__c1_PR_NOTHING: + LOG_I(F1AP,"Received PR_NOTHING on DL-CCCH-Message\n"); + break; + + case NR_DL_CCCH_MessageType__c1_PR_rrcReject: + LOG_I(F1AP,"Logical Channel DL-CCCH (SRB0), Received RRCReject\n"); + break; + + case NR_DL_CCCH_MessageType__c1_PR_rrcSetup: { + LOG_I(F1AP, "Logical Channel DL-CCCH (SRB0), Received RRCSetup RNTI %x\n", + req->rnti); + // Get configuration + NR_RRCSetup_t *rrcSetup = dl_ccch_msg->message.choice.c1->choice.rrcSetup; + AssertFatal(rrcSetup!=NULL, "rrcSetup is null\n"); + NR_RRCSetup_IEs_t *rrcSetup_ies = rrcSetup->criticalExtensions.choice.rrcSetup; + ue_context_p->ue_context.SRB_configList = rrcSetup_ies->radioBearerConfig.srb_ToAddModList; + AssertFatal(rrcSetup_ies->masterCellGroup.buf!=NULL,"masterCellGroup is null\n"); + asn_dec_rval_t dec_rval; + dec_rval = uper_decode(NULL, + &asn_DEF_NR_CellGroupConfig, + (void **)&ue_context_p->ue_context.masterCellGroup, + rrcSetup_ies->masterCellGroup.buf, + rrcSetup_ies->masterCellGroup.size,0,0); + AssertFatal(dec_rval.code == RC_OK, "could not decode masterCellGroup\n"); + apply_macrlc_config(rrc,ue_context_p,&ctxt); + gNB_RRC_UE_t *ue_p = &ue_context_p->ue_context; + AssertFatal(ue_p->Srb0.Active == 1,"SRB0 is not active\n"); + memcpy((void *)ue_p->Srb0.Tx_buffer.Payload, + (void *)req->buf->data, + req->buf->size); // ie->value.choice.RRCContainer.size + ue_p->Srb0.Tx_buffer.payload_size = req->buf->size; + break; + } // case + + case NR_DL_CCCH_MessageType__c1_PR_spare2: + LOG_I(F1AP, + "Logical Channel DL-CCCH (SRB0), Received spare2\n"); + break; + + case NR_DL_CCCH_MessageType__c1_PR_spare1: + LOG_I(F1AP, + "Logical Channel DL-CCCH (SRB0), Received spare1\n"); + break; + + default: + AssertFatal(1==0, + "Unknown message\n"); + break; + }// switch case + + return(0); + } else if (req->srb_id == 1) { + NR_DL_DCCH_Message_t *dl_dcch_msg=NULL; + asn_dec_rval_t dec_rval; + dec_rval = uper_decode(NULL, + &asn_DEF_NR_DL_DCCH_Message, + (void **)&dl_dcch_msg, + &req->buf->data[2], // buf[0] includes the pdcp header + req->buf->size-6,0,0); + + if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) + LOG_E(F1AP," Failed to decode DL-DCCH (%zu bytes)\n",dec_rval.consumed); + else + LOG_D(F1AP, "Received message: present %d and c1 present %d\n", + dl_dcch_msg->message.present, dl_dcch_msg->message.choice.c1->present); + + if (dl_dcch_msg->message.present == NR_DL_DCCH_MessageType_PR_c1) { + switch (dl_dcch_msg->message.choice.c1->present) { + case NR_DL_DCCH_MessageType__c1_PR_NOTHING: + LOG_I(F1AP, "Received PR_NOTHING on DL-DCCH-Message\n"); + return 0; + + case NR_DL_DCCH_MessageType__c1_PR_rrcReconfiguration: + // handle RRCReconfiguration + LOG_I(F1AP, "Logical Channel DL-DCCH (SRB1), Received RRCReconfiguration RNTI %x\n", + req->rnti); + NR_RRCReconfiguration_t *rrcReconfiguration = dl_dcch_msg->message.choice.c1->choice.rrcReconfiguration; + + if (rrcReconfiguration->criticalExtensions.present == NR_RRCReconfiguration__criticalExtensions_PR_rrcReconfiguration) { + NR_RRCReconfiguration_IEs_t *rrcReconfiguration_ies = + rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration; + + if (rrcReconfiguration_ies->measConfig != NULL) { + LOG_I(F1AP, "Measurement Configuration is present\n"); + } + + if (rrcReconfiguration_ies->radioBearerConfig) { + LOG_I(F1AP, "Radio Resource Configuration is present\n"); + long drb_id; + int i; + NR_DRB_ToAddModList_t *DRB_configList = rrcReconfiguration_ies->radioBearerConfig->drb_ToAddModList; + NR_SRB_ToAddModList_t *SRB_configList = rrcReconfiguration_ies->radioBearerConfig->srb_ToAddModList; + + // NR_DRB_ToReleaseList_t *DRB_ReleaseList = rrcReconfiguration_ies->radioBearerConfig->drb_ToReleaseList; + + // rrc_rlc_config_asn1_req + + if (SRB_configList != NULL) { + for (i = 0; (i < SRB_configList->list.count) && (i < 3); i++) { + if (SRB_configList->list.array[i]->srb_Identity == 1 ) { + ue_context_p->ue_context.Srb1.Active=1; + } else if (SRB_configList->list.array[i]->srb_Identity == 2 ) { + ue_context_p->ue_context.Srb2.Active=1; + ue_context_p->ue_context.Srb2.Srb_info.Srb_id=2; + LOG_I(F1AP, "[DU %d] SRB2 is now active\n",ctxt.module_id); + } else { + LOG_W(F1AP, "[DU %d] invalide SRB identity %ld\n",ctxt.module_id, + SRB_configList->list.array[i]->srb_Identity); + } + } + } + + if (DRB_configList != NULL) { + for (i = 0; i < DRB_configList->list.count; i++) { // num max DRB (11-3-8) + if (DRB_configList->list.array[i]) { + drb_id = (int)DRB_configList->list.array[i]->drb_Identity; + LOG_I(F1AP, + "[DU %d] Logical Channel UL-DCCH, Received RRCConnectionReconfiguration for UE rnti %x, reconfiguring DRB %d\n", + ctxt.module_id, + ctxt.rnti, + (int)DRB_configList->list.array[i]->drb_Identity); + + // (int)*DRB_configList->list.array[i]->logicalChannelIdentity); + + if (ue_context_p->ue_context.DRB_active[drb_id] == 0) { + ue_context_p->ue_context.DRB_active[drb_id] = 1; + // logicalChannelIdentity + // rrc_mac_config_req_eNB + } + } else { // remove LCHAN from MAC/PHY + AssertFatal(1==0,"Can't handle this yet in DU\n"); + } + } + } + } + } + + break; + + case NR_DL_DCCH_MessageType__c1_PR_rrcResume: + LOG_I(F1AP,"Received rrcResume\n"); + break; + + case NR_DL_DCCH_MessageType__c1_PR_rrcRelease: + LOG_I(F1AP,"Received rrcRelease\n"); + break; + + case NR_DL_DCCH_MessageType__c1_PR_rrcReestablishment: + LOG_I(F1AP,"Received rrcReestablishment\n"); + break; + + case NR_DL_DCCH_MessageType__c1_PR_securityModeCommand: + LOG_I(F1AP,"Received securityModeCommand\n"); + break; + + case NR_DL_DCCH_MessageType__c1_PR_dlInformationTransfer: + LOG_I(F1AP, "Received dlInformationTransfer\n"); + break; + + case NR_DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry: + LOG_I(F1AP, "Received ueCapabilityEnquiry\n"); + break; + + case NR_DL_DCCH_MessageType__c1_PR_counterCheck: + LOG_I(F1AP, "Received counterCheck\n"); + break; + + case NR_DL_DCCH_MessageType__c1_PR_mobilityFromNRCommand: + case NR_DL_DCCH_MessageType__c1_PR_dlDedicatedMessageSegment_r16: + case NR_DL_DCCH_MessageType__c1_PR_ueInformationRequest_r16: + case NR_DL_DCCH_MessageType__c1_PR_dlInformationTransferMRDC_r16: + case NR_DL_DCCH_MessageType__c1_PR_loggedMeasurementConfiguration_r16: + case NR_DL_DCCH_MessageType__c1_PR_spare3: + case NR_DL_DCCH_MessageType__c1_PR_spare2: + case NR_DL_DCCH_MessageType__c1_PR_spare1: + break; + } + } + } else if (req->srb_id == 2) { + // TODO + abort(); + } + + LOG_I(F1AP, "Received DL RRC Transfer on srb_id %ld\n", req->srb_id); + // rlc_op_status_t rlc_status; + // boolean_t ret = TRUE; + + //LOG_I(F1AP, "PRRCContainer size %lu:", ie->value.choice.RRCContainer.size); + //for (int i = 0; i < ie->value.choice.RRCContainer.size; i++) + // printf("%02x ", ie->value.choice.RRCContainer.buf[i]); + + //printf (", PDCP PDU size %d:", rrc_dl_sdu_len); + //for (int i=0;idata[i]); + //printf("\n"); + + du_rlc_data_req(&ctxt, 1, 0x00, 1, 1, 0, req->buf->size, req->buf); + // rlc_status = rlc_data_req(&ctxt + // , 1 + // , MBMS_FLAG_NO + // , srb_id + // , 0 + // , 0 + // , rrc_dl_sdu_len + // , pdcp_pdu_p + // ,NULL + // ,NULL + // ); + // switch (rlc_status) { + // case RLC_OP_STATUS_OK: + // //LOG_I(F1AP, "Data sending request over RLC succeeded!\n"); + // ret=TRUE; + // break; + // case RLC_OP_STATUS_BAD_PARAMETER: + // LOG_W(F1AP, "Data sending request over RLC failed with 'Bad Parameter' reason!\n"); + // ret= FALSE; + // break; + // case RLC_OP_STATUS_INTERNAL_ERROR: + // LOG_W(F1AP, "Data sending request over RLC failed with 'Internal Error' reason!\n"); + // ret= FALSE; + // break; + // case RLC_OP_STATUS_OUT_OF_RESSOURCES: + // LOG_W(F1AP, "Data sending request over RLC failed with 'Out of Resources' reason!\n"); + // ret= FALSE; + // break; + // default: + // LOG_W(F1AP, "RLC returned an unknown status code after PDCP placed the order to send some data (Status Code:%d)\n", rlc_status); + // ret= FALSE; + // break; + // } // switch case + // return ret; +return 0; +} + unsigned int mask_flip(unsigned int x) { return((((x>>8) + (x<<8))&0xffff)>>6); } @@ -3336,7 +3597,11 @@ void *rrc_gnb_task(void *args_p) { LOG_I(NR_RRC,"[gNB %ld] Received %s : %p\n", instance, msg_name_p, &F1AP_SETUP_REQ(msg_p)); rrc_gNB_process_f1_setup_req(&F1AP_SETUP_REQ(msg_p)); break; - + + case NR_DU_RRC_DL_INDICATION: + rrc_process_DU_DL(msg_p, msg_name_p, instance); + break; + /* Messages from X2AP */ case X2AP_ENDC_SGNB_ADDITION_REQ: LOG_I(NR_RRC, "Received ENDC sgNB addition request from X2AP \n"); From d7ed6d6270faead1a69681c03bff80f413980f5f Mon Sep 17 00:00:00 2001 From: Laurent Thomas Date: Fri, 20 Aug 2021 09:59:32 +0200 Subject: [PATCH 024/110] small fix --- openair2/F1AP/f1ap_cu_interface_management.c | 2 +- openair2/F1AP/f1ap_cu_task.c | 10 ---------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index b3668cd783..d65a58e27d 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -212,7 +212,7 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, message_p = itti_alloc_new_message(TASK_CU_F1, 0, F1AP_SETUP_REQ); memcpy(&F1AP_SETUP_REQ(message_p), req, sizeof(f1ap_setup_req_t) ); if (num_cells_available > 0) { - if (RC.nrrrc && RC.nrrrc[0]->node_type == ngran_gNB_CU) { + if (f1ap_req(true, instance)->cell_type == CELL_MACRO_GNB) { itti_send_msg_to_task(TASK_RRC_GNB, GNB_MODULE_ID_TO_INSTANCE(instance), message_p); } else { itti_send_msg_to_task(TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(instance), message_p); diff --git a/openair2/F1AP/f1ap_cu_task.c b/openair2/F1AP/f1ap_cu_task.c index 4e6fc7d712..9ffa3ab800 100644 --- a/openair2/F1AP/f1ap_cu_task.c +++ b/openair2/F1AP/f1ap_cu_task.c @@ -61,16 +61,6 @@ void cu_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat //f1ap_handle_setup_message(instance, sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN); return; // exit -1 for debugging } - - /* setup parameters for F1U and start the server */ - const cudu_params_t params = { - .local_ipv4_address = RC.nrrrc[instance]->eth_params_s.my_addr, - .local_port = RC.nrrrc[instance]->eth_params_s.my_portd, - .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, ¶ms) == 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) { From 2c5a5f9f57d181c0392812fa5c176579bfbc2084 Mon Sep 17 00:00:00 2001 From: matzakos Date: Fri, 20 Aug 2021 16:42:22 +0200 Subject: [PATCH 025/110] Remove redundant second call for initialization of oai ue tun interface --- openair3/NAS/NR_UE/nr_nas_msg_sim.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/openair3/NAS/NR_UE/nr_nas_msg_sim.c b/openair3/NAS/NR_UE/nr_nas_msg_sim.c index cfe8935f10..d47d015a8e 100644 --- a/openair3/NAS/NR_UE/nr_nas_msg_sim.c +++ b/openair3/NAS/NR_UE/nr_nas_msg_sim.c @@ -867,8 +867,6 @@ void *nas_nrue_task(void *args_p) if (*(payload_container + offset) == 0x29) { // PDU address IEI if ((*(payload_container+offset+1) == 0x05) && (*(payload_container +offset+2) == 0x01)) { // IPV4 nas_getparams(); - // FixME: seems wrong: pdcp_module_init has already created the interface - netlink_init_tun("ue", 1); sprintf(baseNetAddress, "%d.%d", *(payload_container+offset+3), *(payload_container+offset+4)); int third_octet = *(payload_container+offset+5); int fourth_octet = *(payload_container+offset+6); From e0cb79d2d8a6a9b4cc09301f35110e008b0c6c8b Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Tue, 24 Aug 2021 11:21:53 +0200 Subject: [PATCH 026/110] make SIB1 encoding readable and ARM compatible --- openair2/GNB_APP/gnb_app.c | 3 +- openair2/RRC/NR/MESSAGES/asn1_msg.c | 222 ++++++++++++++-------------- 2 files changed, 109 insertions(+), 116 deletions(-) diff --git a/openair2/GNB_APP/gnb_app.c b/openair2/GNB_APP/gnb_app.c index 0efd229343..f42d496780 100644 --- a/openair2/GNB_APP/gnb_app.c +++ b/openair2/GNB_APP/gnb_app.c @@ -197,9 +197,8 @@ void *gNB_app_task(void *args_p) LOG_I(PHY, "%s() RC.nb_nr_inst:%d RC.nrrrc:%p\n", __FUNCTION__, RC.nb_nr_inst, RC.nrrrc); for (gnb_id = gnb_id_start; (gnb_id < gnb_id_end) ; gnb_id++) { - RC.nrrrc[gnb_id] = (gNB_RRC_INST*)malloc(sizeof(gNB_RRC_INST)); + RC.nrrrc[gnb_id] = (gNB_RRC_INST*)calloc(1,sizeof(gNB_RRC_INST)); LOG_I(PHY, "%s() Creating RRC instance RC.nrrrc[%d]:%p (%d of %d)\n", __FUNCTION__, gnb_id, RC.nrrrc[gnb_id], gnb_id+1, gnb_id_end); - memset((void *)RC.nrrrc[gnb_id],0,sizeof(gNB_RRC_INST)); configure_nr_rrc(gnb_id); } diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index e36644afb0..097e51ade9 100755 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -301,21 +301,15 @@ uint8_t do_MIB_NR(gNB_RRC_INST *rrc,uint32_t frame) { return((enc_rval.encoded+7)/8); } +#define asn1cCalloc(VaR, TyPe, lOcPtr) TyPe *lOcPtr=VaR=(TyPe*) calloc(1,sizeof(TyPe)); +#define asn1cCallocOne(VaR, VaLue) VaR=calloc(1,sizeof(*VaR)); *VaR=VaLue; +#define asn1cSequenceAdd(VaR, TyPe, lOcPtr) TyPe *lOcPtr=(TyPe*) calloc(1,sizeof(TyPe)); ASN_SEQUENCE_ADD(&VaR,lOcPtr); uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, gNB_RrcConfigurationReq *configuration ) { asn_enc_rval_t enc_rval; - // TODO : Add support for more than one PLMN - int num_plmn = 1; // int num_plmn = configuration->num_plmn; - struct NR_PLMN_Identity *nr_plmn = CALLOC(1, sizeof(struct NR_PLMN_Identity) * num_plmn); - NR_MCC_MNC_Digit_t (*nr_mcc_digit)[3] = (NR_MCC_MNC_Digit_t(*)[3])CALLOC(1, sizeof(NR_MCC_MNC_Digit_t)*num_plmn*3); - NR_MCC_MNC_Digit_t (*nr_mnc_digit)[3] = (NR_MCC_MNC_Digit_t(*)[3])CALLOC(1, sizeof(NR_MCC_MNC_Digit_t)*num_plmn*3);; - memset(nr_plmn,0,sizeof(struct NR_PLMN_Identity) * num_plmn); - memset(nr_mcc_digit,0,sizeof(NR_MCC_MNC_Digit_t)*num_plmn*3); - memset(nr_mnc_digit,0,sizeof(NR_MCC_MNC_Digit_t)*num_plmn*3); - NR_BCCH_DL_SCH_Message_t *sib1_message = CALLOC(1,sizeof(NR_BCCH_DL_SCH_Message_t)); carrier->siblock1 = sib1_message; sib1_message->message.present = NR_BCCH_DL_SCH_MessageType_PR_c1; @@ -327,51 +321,52 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, // cellSelectionInfo sib1->cellSelectionInfo = CALLOC(1,sizeof(struct NR_SIB1__cellSelectionInfo)); + // Fixme: should be in config file + //The IE Q-RxLevMin is used to indicate for cell selection/ re-selection the required minimum received RSRP level in the (NR) cell. + //Corresponds to parameter Qrxlevmin in TS38.304. + //Actual value Qrxlevmin = field value * 2 [dBm]. sib1->cellSelectionInfo->q_RxLevMin = -65; // cellAccessRelatedInfo - struct NR_PLMN_IdentityInfo *nr_plmn_info=CALLOC(1,sizeof(struct NR_PLMN_IdentityInfo)); - asn_set_empty(&nr_plmn_info->plmn_IdentityList.list); + // TODO : Add support for more than one PLMN + int num_plmn = 1; // int num_plmn = configuration->num_plmn; + asn1cSequenceAdd(sib1->cellAccessRelatedInfo.plmn_IdentityList.list, struct NR_PLMN_IdentityInfo, nr_plmn_info); for (int i = 0; i < num_plmn; ++i) { - nr_mcc_digit[i][0] = (configuration->mcc[i]/100)%10; - nr_mcc_digit[i][1] = (configuration->mcc[i]/10)%10; - nr_mcc_digit[i][2] = (configuration->mcc[i])%10; - nr_plmn[i].mcc = CALLOC(1,sizeof(struct NR_MCC)); - asn_set_empty(&nr_plmn[i].mcc->list); - ASN_SEQUENCE_ADD(&nr_plmn[i].mcc->list, &nr_mcc_digit[i][0]); - ASN_SEQUENCE_ADD(&nr_plmn[i].mcc->list, &nr_mcc_digit[i][1]); - ASN_SEQUENCE_ADD(&nr_plmn[i].mcc->list, &nr_mcc_digit[i][2]); - if(configuration->mnc_digit_length[i] == 3) nr_mnc_digit[i][0] = (configuration->mnc[i]/100)%10; - nr_mnc_digit[i][1] = (configuration->mnc[i]/10)%10; - nr_mnc_digit[i][2] = (configuration->mnc[i])%10; - nr_plmn[i].mnc.list.size=0; - nr_plmn[i].mnc.list.count=0; - if(configuration->mnc_digit_length[i] == 3) ASN_SEQUENCE_ADD(&nr_plmn[i].mnc.list, &nr_mnc_digit[i][0]); - ASN_SEQUENCE_ADD(&nr_plmn[i].mnc.list, &nr_mnc_digit[i][1]); - ASN_SEQUENCE_ADD(&nr_plmn[i].mnc.list, &nr_mnc_digit[i][2]); - ASN_SEQUENCE_ADD(&nr_plmn_info->plmn_IdentityList.list, &nr_plmn[i]); + asn1cSequenceAdd(nr_plmn_info->plmn_IdentityList.list, struct NR_PLMN_Identity, nr_plmn); + asn1cCalloc(nr_plmn->mcc, struct NR_MCC, mcc); + int confMcc=configuration->mcc[i]; + asn1cSequenceAdd(mcc->list, NR_MCC_MNC_Digit_t, mcc0); + *mcc0=(confMcc/100)%10; + asn1cSequenceAdd(mcc->list, NR_MCC_MNC_Digit_t, mcc1); + *mcc1=(confMcc/10)%10; + asn1cSequenceAdd(mcc->list, NR_MCC_MNC_Digit_t, mcc2); + *mcc2=confMcc%10; + int mnc=configuration->mnc[i]; + if(configuration->mnc_digit_length[i] == 3) { + asn1cSequenceAdd(nr_plmn->mnc.list, NR_MCC_MNC_Digit_t, mnc0); + *mnc0=(configuration->mnc[i]/100)%10; + mnc/=10; + } + asn1cSequenceAdd(nr_plmn->mnc.list, NR_MCC_MNC_Digit_t, mnc1); + *mnc1=(mnc/10)%10; + asn1cSequenceAdd(nr_plmn->mnc.list, NR_MCC_MNC_Digit_t, mnc2); + *mnc2=(mnc)%10; }//end plmn loop nr_plmn_info->cellIdentity.buf = CALLOC(1,5); - nr_plmn_info->cellIdentity.buf[0]= (configuration->cell_identity >> 28) & 0xff; - nr_plmn_info->cellIdentity.buf[1]= (configuration->cell_identity >> 20) & 0xff; - nr_plmn_info->cellIdentity.buf[2]= (configuration->cell_identity >> 12) & 0xff; - nr_plmn_info->cellIdentity.buf[3]= (configuration->cell_identity >> 4) & 0xff; - nr_plmn_info->cellIdentity.buf[4]= (configuration->cell_identity << 4) & 0xff; nr_plmn_info->cellIdentity.size= 5; nr_plmn_info->cellIdentity.bits_unused= 4; + uint64_t tmp=htobe64(configuration->cell_identity)<<4; + memcpy(nr_plmn_info->cellIdentity.buf, ((char*)&tmp)+3, 5); nr_plmn_info->cellReservedForOperatorUse = NR_PLMN_IdentityInfo__cellReservedForOperatorUse_notReserved; nr_plmn_info->trackingAreaCode = CALLOC(1,sizeof(NR_TrackingAreaCode_t)); + uint32_t tmp2=htobe32(configuration->tac); nr_plmn_info->trackingAreaCode->buf = CALLOC(1,3); - nr_plmn_info->trackingAreaCode->buf[0] = ( ((uint32_t)configuration->tac) >> 16) & 0xff; - nr_plmn_info->trackingAreaCode->buf[1] = ( ((uint32_t)configuration->tac) >> 8) & 0xff; - nr_plmn_info->trackingAreaCode->buf[2] = ( ((uint32_t)configuration->tac) >> 0) & 0xff; + memcpy(nr_plmn_info->trackingAreaCode->buf, ((char*) &tmp2)+1, 3); nr_plmn_info->trackingAreaCode->size = 3; nr_plmn_info->trackingAreaCode->bits_unused = 0; - ASN_SEQUENCE_ADD(&sib1->cellAccessRelatedInfo.plmn_IdentityList.list, nr_plmn_info); - // connEstFailureControl // TODO: add connEstFailureControl @@ -407,32 +402,34 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, ASN_SEQUENCE_ADD(&sib1->si_SchedulingInfo->schedulingInfoList.list,schedulingInfo);*/ // servingCellConfigCommon - sib1->servingCellConfigCommon = CALLOC(1,sizeof(struct NR_ServingCellConfigCommonSIB)); + asn1cCalloc(sib1->servingCellConfigCommon, + struct NR_ServingCellConfigCommonSIB, ServCellCom); + NR_BWP_DownlinkCommon_t *initialDownlinkBWP=&ServCellCom->downlinkConfigCommon.initialDownlinkBWP; + initialDownlinkBWP->genericParameters= + configuration->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters; + - asn_set_empty(&sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.frequencyBandList.list); - asn_set_empty(&sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list); - sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.genericParameters.locationAndBandwidth = configuration->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth; - sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.genericParameters.subcarrierSpacing = configuration->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.subcarrierSpacing; - sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.genericParameters.cyclicPrefix = configuration->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.cyclicPrefix; for(int i = 0; i< configuration->scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.count; i++) { - struct NR_NR_MultiBandInfo *nrMultiBandInfo = CALLOC(1,sizeof(struct NR_NR_MultiBandInfo)); + asn1cSequenceAdd(ServCellCom->downlinkConfigCommon.frequencyInfoDL.frequencyBandList.list, + struct NR_NR_MultiBandInfo, nrMultiBandInfo); nrMultiBandInfo->freqBandIndicatorNR = configuration->scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[i]; - ASN_SEQUENCE_ADD(&sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.frequencyBandList.list,nrMultiBandInfo); } - //sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.offsetToPointA = configuration->scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier; - sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.offsetToPointA = 86; + + //sib1->ServCellCom->downlinkConfigCommon.frequencyInfoDL.offsetToPointA = configuration->scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier; + ServCellCom->downlinkConfigCommon.frequencyInfoDL.offsetToPointA = 86; + for(int i = 0; i< configuration->scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.count; i++) { - ASN_SEQUENCE_ADD(&sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list,configuration->scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[i]); + ASN_SEQUENCE_ADD(&ServCellCom->downlinkConfigCommon.frequencyInfoDL.scs_SpecificCarrierList.list, + configuration->scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[i]); } - sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon = configuration->scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon; - sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->commonSearchSpaceList = CALLOC(1,sizeof(struct NR_PDCCH_ConfigCommon__commonSearchSpaceList)); - asn_set_empty(&sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list); + initialDownlinkBWP->pdcch_ConfigCommon = + configuration->scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon; - NR_SearchSpace_t *ss1 = calloc(1,sizeof(*ss1)); + asn1cSequenceAdd(initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list, + NR_SearchSpace_t, ss1); ss1->searchSpaceId = 1; - ss1->controlResourceSetId=calloc(1,sizeof(*ss1->controlResourceSetId)); - *ss1->controlResourceSetId=0; + asn1cCallocOne(ss1->controlResourceSetId, 0); ss1->monitoringSlotPeriodicityAndOffset = calloc(1,sizeof(*ss1->monitoringSlotPeriodicityAndOffset)); ss1->monitoringSlotPeriodicityAndOffset->present = NR_SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1; ss1->monitoringSymbolsWithinSlot = calloc(1,sizeof(*ss1->monitoringSymbolsWithinSlot)); @@ -452,9 +449,9 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, ss1->searchSpaceType->present = NR_SearchSpace__searchSpaceType_PR_common; ss1->searchSpaceType->choice.common=calloc(1,sizeof(*ss1->searchSpaceType->choice.common)); ss1->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 = calloc(1,sizeof(*ss1->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0)); - ASN_SEQUENCE_ADD(&sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list,ss1); - NR_SearchSpace_t *ss5 = calloc(1,sizeof(*ss5)); + asn1cSequenceAdd(initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list, + NR_SearchSpace_t, ss5); ss5->searchSpaceId = 5; ss5->controlResourceSetId=calloc(1,sizeof(*ss5->controlResourceSetId)); *ss5->controlResourceSetId=0; @@ -480,9 +477,9 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, ss5->searchSpaceType->present = NR_SearchSpace__searchSpaceType_PR_common; ss5->searchSpaceType->choice.common=calloc(1,sizeof(*ss5->searchSpaceType->choice.common)); ss5->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 = calloc(1,sizeof(*ss5->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0)); - ASN_SEQUENCE_ADD(&sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list,ss5); - NR_SearchSpace_t *ss7 = calloc(1,sizeof(*ss7)); + asn1cSequenceAdd(initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list, + NR_SearchSpace_t, ss7); ss7->searchSpaceId = 7; ss7->controlResourceSetId=calloc(1,sizeof(*ss7->controlResourceSetId)); *ss7->controlResourceSetId=0; @@ -505,63 +502,61 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, ss7->searchSpaceType->present = NR_SearchSpace__searchSpaceType_PR_common; ss7->searchSpaceType->choice.common=calloc(1,sizeof(*ss7->searchSpaceType->choice.common)); ss7->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0 = calloc(1,sizeof(*ss7->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0)); - ASN_SEQUENCE_ADD(&sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list,ss7); - sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->searchSpaceSIB1 = calloc(1,sizeof(NR_SearchSpaceId_t)); - *sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->searchSpaceSIB1 = 0; - sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation = calloc(1,sizeof(NR_SearchSpaceId_t)); - *sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation = 7; - sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->pagingSearchSpace = calloc(1,sizeof(NR_SearchSpaceId_t)); - *sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->pagingSearchSpace = 5; - sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->ra_SearchSpace = calloc(1,sizeof(NR_SearchSpaceId_t)); - *sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdcch_ConfigCommon->choice.setup->ra_SearchSpace = 1; + + asn1cCallocOne(initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->searchSpaceSIB1, 0); + asn1cCallocOne(initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation, 7); + asn1cCallocOne(initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->pagingSearchSpace, 5); + asn1cCallocOne( initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->ra_SearchSpace, 1); - sib1->servingCellConfigCommon->downlinkConfigCommon.initialDownlinkBWP.pdsch_ConfigCommon = configuration->scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon; - sib1->servingCellConfigCommon->downlinkConfigCommon.bcch_Config.modificationPeriodCoeff = NR_BCCH_Config__modificationPeriodCoeff_n2; - sib1->servingCellConfigCommon->downlinkConfigCommon.pcch_Config.defaultPagingCycle = NR_PagingCycle_rf256; - sib1->servingCellConfigCommon->downlinkConfigCommon.pcch_Config.nAndPagingFrameOffset.present = NR_PCCH_Config__nAndPagingFrameOffset_PR_quarterT; - sib1->servingCellConfigCommon->downlinkConfigCommon.pcch_Config.nAndPagingFrameOffset.choice.quarterT = 1; - sib1->servingCellConfigCommon->downlinkConfigCommon.pcch_Config.ns = NR_PCCH_Config__ns_one; + initialDownlinkBWP->pdsch_ConfigCommon = configuration->scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon; + ServCellCom->downlinkConfigCommon.bcch_Config.modificationPeriodCoeff = NR_BCCH_Config__modificationPeriodCoeff_n2; + ServCellCom->downlinkConfigCommon.pcch_Config.defaultPagingCycle = NR_PagingCycle_rf256; + ServCellCom->downlinkConfigCommon.pcch_Config.nAndPagingFrameOffset.present = NR_PCCH_Config__nAndPagingFrameOffset_PR_quarterT; + ServCellCom->downlinkConfigCommon.pcch_Config.nAndPagingFrameOffset.choice.quarterT = 1; + ServCellCom->downlinkConfigCommon.pcch_Config.ns = NR_PCCH_Config__ns_one; - sib1->servingCellConfigCommon->downlinkConfigCommon.pcch_Config.firstPDCCH_MonitoringOccasionOfPO = calloc(1,sizeof(struct NR_PCCH_Config__firstPDCCH_MonitoringOccasionOfPO)); - sib1->servingCellConfigCommon->downlinkConfigCommon.pcch_Config.firstPDCCH_MonitoringOccasionOfPO->present = NR_PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT; + asn1cCalloc(ServCellCom->downlinkConfigCommon.pcch_Config.firstPDCCH_MonitoringOccasionOfPO, + struct NR_PCCH_Config__firstPDCCH_MonitoringOccasionOfPO, + P0); + P0->present = NR_PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT; - sib1->servingCellConfigCommon->downlinkConfigCommon.pcch_Config.firstPDCCH_MonitoringOccasionOfPO->choice.sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT = CALLOC(1,sizeof(struct NR_PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT)); - asn_set_empty(&sib1->servingCellConfigCommon->downlinkConfigCommon.pcch_Config.firstPDCCH_MonitoringOccasionOfPO->choice.sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT->list); + asn1cCalloc(P0->choice.sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT, + struct NR_PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT, + Z8); + asn1cSequenceAdd(Z8->list, + long, + ZoneEight); + asn1cCallocOne(ZoneEight, 0); - long *sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT = calloc(1,sizeof(long)); - *sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT = 0; - ASN_SEQUENCE_ADD(&sib1->servingCellConfigCommon->downlinkConfigCommon.pcch_Config.firstPDCCH_MonitoringOccasionOfPO->choice.sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT->list,sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT); - - sib1->servingCellConfigCommon->uplinkConfigCommon = CALLOC(1,sizeof(struct NR_UplinkConfigCommonSIB)); - asn_set_empty(&sib1->servingCellConfigCommon->uplinkConfigCommon->frequencyInfoUL.scs_SpecificCarrierList.list); + asn1cCalloc(ServCellCom->uplinkConfigCommon, struct NR_UplinkConfigCommonSIB, UL) + asn_set_empty(&UL->frequencyInfoUL.scs_SpecificCarrierList.list); for(int i = 0; i< configuration->scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.count; i++) { - ASN_SEQUENCE_ADD(&sib1->servingCellConfigCommon->uplinkConfigCommon->frequencyInfoUL.scs_SpecificCarrierList.list,configuration->scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[i]); + ASN_SEQUENCE_ADD(&UL->frequencyInfoUL.scs_SpecificCarrierList.list, + configuration->scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[i]); } - sib1->servingCellConfigCommon->uplinkConfigCommon->frequencyInfoUL.p_Max = CALLOC(1,sizeof(NR_P_Max_t)); - *sib1->servingCellConfigCommon->uplinkConfigCommon->frequencyInfoUL.p_Max = 23; + asn1cCallocOne(UL->frequencyInfoUL.p_Max, 23); - sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.genericParameters = configuration->scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; - sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon = configuration->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon; + UL->initialUplinkBWP.genericParameters = configuration->scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; + UL->initialUplinkBWP.rach_ConfigCommon = configuration->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon; + UL->initialUplinkBWP.pusch_ConfigCommon = configuration->scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon; + UL->initialUplinkBWP.pusch_ConfigCommon->choice.setup->groupHoppingEnabledTransformPrecoding = null; - sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.pusch_ConfigCommon = configuration->scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon; - sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.pusch_ConfigCommon->choice.setup->groupHoppingEnabledTransformPrecoding = null; + UL->initialUplinkBWP.pucch_ConfigCommon = configuration->scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon; - sib1->servingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP.pucch_ConfigCommon = configuration->scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon; + UL->timeAlignmentTimerCommon = NR_TimeAlignmentTimer_infinity; - sib1->servingCellConfigCommon->uplinkConfigCommon->timeAlignmentTimerCommon = NR_TimeAlignmentTimer_infinity; + ServCellCom->n_TimingAdvanceOffset = configuration->scc->n_TimingAdvanceOffset; - sib1->servingCellConfigCommon->n_TimingAdvanceOffset = configuration->scc->n_TimingAdvanceOffset; - - sib1->servingCellConfigCommon->ssb_PositionsInBurst.inOneGroup.buf = calloc(1, sizeof(uint8_t)); + ServCellCom->ssb_PositionsInBurst.inOneGroup.buf = calloc(1, sizeof(uint8_t)); uint8_t bitmap8,temp_bitmap=0; switch (configuration->scc->ssb_PositionsInBurst->present) { case NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_shortBitmap: - sib1->servingCellConfigCommon->ssb_PositionsInBurst.inOneGroup = configuration->scc->ssb_PositionsInBurst->choice.shortBitmap; + ServCellCom->ssb_PositionsInBurst.inOneGroup = configuration->scc->ssb_PositionsInBurst->choice.shortBitmap; break; case NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_mediumBitmap: - sib1->servingCellConfigCommon->ssb_PositionsInBurst.inOneGroup = configuration->scc->ssb_PositionsInBurst->choice.mediumBitmap; + ServCellCom->ssb_PositionsInBurst.inOneGroup = configuration->scc->ssb_PositionsInBurst->choice.mediumBitmap; break; /* groupPresence: This field is present when maximum number of SS/PBCH blocks per half frame equals to 64 as defined in TS 38.213 [13], clause 4.1. @@ -572,14 +567,13 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, (i.e., to SSB index 1, 9, and so on), and so on. Value 0 in the bitmap indicates that the corresponding SS/PBCH block is not transmitted while value 1 indicates that the corresponding SS/PBCH block is transmitted. */ case NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_longBitmap: - sib1->servingCellConfigCommon->ssb_PositionsInBurst.inOneGroup.size = 1; - sib1->servingCellConfigCommon->ssb_PositionsInBurst.inOneGroup.bits_unused = 0; - sib1->servingCellConfigCommon->ssb_PositionsInBurst.groupPresence = calloc(1, sizeof(BIT_STRING_t)); - memset(sib1->servingCellConfigCommon->ssb_PositionsInBurst.groupPresence, 0, sizeof(BIT_STRING_t)); - sib1->servingCellConfigCommon->ssb_PositionsInBurst.groupPresence->size = 1; - sib1->servingCellConfigCommon->ssb_PositionsInBurst.groupPresence->bits_unused = 0; - sib1->servingCellConfigCommon->ssb_PositionsInBurst.groupPresence->buf = calloc(1, sizeof(uint8_t)); - sib1->servingCellConfigCommon->ssb_PositionsInBurst.groupPresence->buf[0] = 0; + ServCellCom->ssb_PositionsInBurst.inOneGroup.size = 1; + ServCellCom->ssb_PositionsInBurst.inOneGroup.bits_unused = 0; + ServCellCom->ssb_PositionsInBurst.groupPresence = calloc(1, sizeof(BIT_STRING_t)); + ServCellCom->ssb_PositionsInBurst.groupPresence->size = 1; + ServCellCom->ssb_PositionsInBurst.groupPresence->bits_unused = 0; + ServCellCom->ssb_PositionsInBurst.groupPresence->buf = calloc(1, sizeof(uint8_t)); + ServCellCom->ssb_PositionsInBurst.groupPresence->buf[0] = 0; for (int i=0; i<8; i++){ bitmap8 = configuration->scc->ssb_PositionsInBurst->choice.longBitmap.buf[i]; if (bitmap8!=0){ @@ -588,8 +582,8 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, else AssertFatal(temp_bitmap==bitmap8,"For longBitmap the groups of 8 SSBs containing at least 1 transmitted SSB should be all the same\n"); - sib1->servingCellConfigCommon->ssb_PositionsInBurst.inOneGroup.buf[0] = bitmap8; - sib1->servingCellConfigCommon->ssb_PositionsInBurst.groupPresence->buf[0] |= 1<<(7-i); + ServCellCom->ssb_PositionsInBurst.inOneGroup.buf[0] = bitmap8; + ServCellCom->ssb_PositionsInBurst.groupPresence->buf[0] |= 1<<(7-i); } } break; @@ -598,12 +592,12 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, break; } - sib1->servingCellConfigCommon->ssb_PeriodicityServingCell = *configuration->scc->ssb_periodicityServingCell; - sib1->servingCellConfigCommon->tdd_UL_DL_ConfigurationCommon = CALLOC(1,sizeof(struct NR_TDD_UL_DL_ConfigCommon)); - sib1->servingCellConfigCommon->tdd_UL_DL_ConfigurationCommon->referenceSubcarrierSpacing = configuration->scc->tdd_UL_DL_ConfigurationCommon->referenceSubcarrierSpacing; - sib1->servingCellConfigCommon->tdd_UL_DL_ConfigurationCommon->pattern1 = configuration->scc->tdd_UL_DL_ConfigurationCommon->pattern1; - sib1->servingCellConfigCommon->tdd_UL_DL_ConfigurationCommon->pattern2 = configuration->scc->tdd_UL_DL_ConfigurationCommon->pattern2; - sib1->servingCellConfigCommon->ss_PBCH_BlockPower = configuration->scc->ss_PBCH_BlockPower; + ServCellCom->ssb_PeriodicityServingCell = *configuration->scc->ssb_periodicityServingCell; + ServCellCom->tdd_UL_DL_ConfigurationCommon = CALLOC(1,sizeof(struct NR_TDD_UL_DL_ConfigCommon)); + ServCellCom->tdd_UL_DL_ConfigurationCommon->referenceSubcarrierSpacing = configuration->scc->tdd_UL_DL_ConfigurationCommon->referenceSubcarrierSpacing; + ServCellCom->tdd_UL_DL_ConfigurationCommon->pattern1 = configuration->scc->tdd_UL_DL_ConfigurationCommon->pattern1; + ServCellCom->tdd_UL_DL_ConfigurationCommon->pattern2 = configuration->scc->tdd_UL_DL_ConfigurationCommon->pattern2; + ServCellCom->ss_PBCH_BlockPower = configuration->scc->ss_PBCH_BlockPower; // ims-EmergencySupport // TODO: add ims-EmergencySupport From 22b072d85ac211fddbbf027f35f18cccb1ae97f3 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Wed, 25 Aug 2021 13:24:31 +0200 Subject: [PATCH 027/110] fix my regression --- openair2/RRC/NR/MESSAGES/asn1_msg.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 097e51ade9..4ec1ab4950 100755 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -423,8 +423,10 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, configuration->scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[i]); } - initialDownlinkBWP->pdcch_ConfigCommon = - configuration->scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon; + initialDownlinkBWP->pdcch_ConfigCommon = + configuration->scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon; + initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList = + CALLOC(1,sizeof(struct NR_PDCCH_ConfigCommon__commonSearchSpaceList)); asn1cSequenceAdd(initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList->list, NR_SearchSpace_t, ss1); @@ -508,7 +510,7 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, asn1cCallocOne(initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation, 7); asn1cCallocOne(initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->pagingSearchSpace, 5); asn1cCallocOne( initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->ra_SearchSpace, 1); - + initialDownlinkBWP->pdsch_ConfigCommon = configuration->scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon; ServCellCom->downlinkConfigCommon.bcch_Config.modificationPeriodCoeff = NR_BCCH_Config__modificationPeriodCoeff_n2; ServCellCom->downlinkConfigCommon.pcch_Config.defaultPagingCycle = NR_PagingCycle_rf256; From bdef3296c4f0249316702640abde50c736dcdb68 Mon Sep 17 00:00:00 2001 From: matzakos Date: Wed, 25 Aug 2021 16:58:29 +0200 Subject: [PATCH 028/110] Add handling of F1 Ue context setup request message at the DU side - Trigger SRB2 and DRB configuration and RRC->MAC configuration - Remaining: gtp-u tunnel creation at the DU side, triggering and handling of UE context setup response --- openair2/COMMON/f1ap_messages_types.h | 7 +++ openair2/COMMON/rrc_messages_def.h | 2 +- openair2/F1AP/f1ap_cu_ue_context_management.c | 4 +- openair2/F1AP/f1ap_du_ue_context_management.c | 37 ++++++++++++- openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c | 8 ++- openair2/RRC/NR/rrc_gNB.c | 52 ++++++++++++++++++- 6 files changed, 102 insertions(+), 8 deletions(-) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index f16f4842cb..3b57619d88 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -326,6 +326,11 @@ typedef struct f1ap_drb_to_be_setup_s { rlc_mode_t rlc_mode; } f1ap_drb_to_be_setup_t; +typedef struct f1ap_srb_to_be_setup_s { + long srb_id; + rlc_mode_t rlc_mode; +} f1ap_srb_to_be_setup_t; + typedef struct f1ap_ue_context_setup_req_s { uint32_t gNB_CU_ue_id; // BK: need to replace by use from rnti uint32_t *gNB_DU_ue_id; @@ -342,6 +347,8 @@ typedef struct f1ap_ue_context_setup_req_s { uint8_t cu_to_du_rrc_information_length; f1ap_drb_to_be_setup_t *drbs_to_be_setup; // BK: need to replace by s1ap_initial_context_setup_req uint8_t drbs_to_be_setup_length; // BK: need to replace by s1ap_initial_context_setup_req + f1ap_srb_to_be_setup_t *srbs_to_be_setup; + uint8_t srbs_to_be_setup_length; s1ap_initial_context_setup_req_t *s1ap_initial_context_setup_req; // coniatner for the rrc_eNB_generate_SecurityModeCommand message uint8_t *rrc_container; diff --git a/openair2/COMMON/rrc_messages_def.h b/openair2/COMMON/rrc_messages_def.h index fa946f362f..81df5fdcbf 100644 --- a/openair2/COMMON/rrc_messages_def.h +++ b/openair2/COMMON/rrc_messages_def.h @@ -80,4 +80,4 @@ MESSAGE_DEF(RRC_SUBFRAME_PROCESS, MESSAGE_PRIORITY_MED, RrcSubframeP // eNB: RLC -> RRC messages MESSAGE_DEF(RLC_SDU_INDICATION, MESSAGE_PRIORITY_MED, RlcSduIndication, rlc_sdu_indication) -MESSAGE_DEF(NR_DU_RRC_DL_INDICATION, MESSAGE_PRIORITY_MED, NRDuDlReq_t, nr_du_dl_req) +MESSAGE_DEF(NR_DU_RRC_DL_INDICATION, MESSAGE_PRIORITY_MED, NRDuDlReq_t, nr_du_dl_req) diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 8b379735b4..2eaa4a1edd 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -87,7 +87,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, ie1->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; ie1->criticality = F1AP_Criticality_reject; ie1->value.present = F1AP_UEContextSetupRequestIEs__value_PR_GNB_CU_UE_F1AP_ID; - ie1->value.choice.GNB_CU_UE_F1AP_ID = f1ap_ue_context_setup_req->gNB_CU_ue_id; + ie1->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(true, instance, f1ap_ue_context_setup_req->rnti); //f1ap_ue_context_setup_req->gNB_CU_ue_id; /* optional */ /* c2. GNB_DU_UE_F1AP_ID */ @@ -96,7 +96,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, ie2->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; ie2->criticality = F1AP_Criticality_ignore; ie2->value.present = F1AP_UEContextSetupRequestIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie2->value.choice.GNB_DU_UE_F1AP_ID = *f1ap_ue_context_setup_req->gNB_DU_ue_id; + ie2->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(true, instance, f1ap_ue_context_setup_req->rnti); //*f1ap_ue_context_setup_req->gNB_DU_ue_id; } /* mandatory */ diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 6c0f5fa9ab..e51a14a448 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -100,6 +100,8 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, f1ap_ue_context_setup_req->cellULConfigured = NULL; } + f1ap_drb_to_be_setup_t *drb_p; + f1ap_srb_to_be_setup_t *srb_p; if (RC.nrrrc) { /* RRCContainer */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container, @@ -111,7 +113,7 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, "could not allocate memory for f1ap_ue_context_setup_req->drbs_to_be_setup\n"); for (i = 0; i < f1ap_ue_context_setup_req->drbs_to_be_setup_length; ++i) { - f1ap_drb_to_be_setup_t *drb_p = &f1ap_ue_context_setup_req->drbs_to_be_setup[i]; + drb_p = &f1ap_ue_context_setup_req->drbs_to_be_setup[i]; F1AP_DRBs_ToBeSetup_Item_t *drbs_tobesetup_item_p; drbs_tobesetup_item_p = &((F1AP_DRBs_ToBeSetup_ItemIEs_t *)ie->value.choice.DRBs_ToBeSetup_List.list.array[i])->value.choice.DRBs_ToBeSetup_Item; drb_p->drb_id = drbs_tobesetup_item_p->dRBID; @@ -135,12 +137,40 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, break; } } + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_SRBs_ToBeSetup_List, true); + f1ap_ue_context_setup_req->srbs_to_be_setup_length = ie->value.choice.SRBs_ToBeSetup_List.list.count; + f1ap_ue_context_setup_req->srbs_to_be_setup = calloc(f1ap_ue_context_setup_req->srbs_to_be_setup_length, + sizeof(f1ap_srb_to_be_setup_t)); + AssertFatal(f1ap_ue_context_setup_req->srbs_to_be_setup, + "could not allocate memory for f1ap_ue_context_setup_req->srbs_to_be_setup\n"); + + for (i = 0; i < f1ap_ue_context_setup_req->srbs_to_be_setup_length; ++i) { + srb_p = &f1ap_ue_context_setup_req->srbs_to_be_setup[i]; + F1AP_SRBs_ToBeSetup_Item_t *srbs_tobesetup_item_p; + srbs_tobesetup_item_p = &((F1AP_SRBs_ToBeSetup_ItemIEs_t *)ie->value.choice.SRBs_ToBeSetup_List.list.array[i])->value.choice.SRBs_ToBeSetup_Item; + srb_p->srb_id = srbs_tobesetup_item_p->sRBID; + } } /* RRCContainer */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container, F1AP_ProtocolIE_ID_id_RRCContainer, false); + if(f1ap_ue_context_setup_req->gNB_DU_ue_id!=NULL){ + f1ap_ue_context_setup_req->rnti = f1ap_get_rnti_by_du_id(false, instance, *f1ap_ue_context_setup_req->gNB_DU_ue_id); + } + else{ + f1ap_ue_context_setup_req->rnti = f1ap_get_rnti_by_cu_id(false, instance, f1ap_ue_context_setup_req->gNB_CU_ue_id); + } + + if(f1ap_ue_context_setup_req->rnti<0){ + LOG_E(F1AP, "Could not retrieve UE rnti based on the CU/DU UE id \n"); + } + else{ + LOG_I(F1AP, "Retrieved rnti is: %d \n", f1ap_ue_context_setup_req->rnti); + } + if (ie) { /* correct here */ f1ap_ue_context_setup_req->rrc_container = malloc(ie->value.choice.RRCContainer.size); @@ -170,7 +200,10 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, } else { LOG_E(F1AP, "can't find RRCContainer in UEContextSetupRequestIEs by id %ld \n", F1AP_ProtocolIE_ID_id_RRCContainer); } - return 0; + + itti_send_msg_to_task(TASK_RRC_GNB, instance, msg_p); + + return 0; } //void DU_send_UE_CONTEXT_SETUP_RESPONSE(F1AP_UEContextSetupResponse_t *UEContextSetupResponse) { diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index 7fc8256759..542c2f6fad 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -506,6 +506,10 @@ rb_found: itti_send_msg_to_task(TASK_DU_F1, ENB_MODULE_ID_TO_INSTANCE(0 /*ctxt_pP->module_id*/), msg); return; } + else if(NODE_IS_DU(type) && is_srb == 0) { + LOG_W(RLC, "Received uplink user-plane traffic at RLC-DU to be sent to the CU, but F1-U implementation is not in place yet \n"); + return; + } } if (!pdcp_data_ind(&ctx, is_srb, 0, rb_id, size, memblock)) { @@ -715,7 +719,7 @@ static void add_rlc_srb(int rnti, struct NR_SRB_ToAddMod *s, NR_RLC_BearerConfig sn_field_length); nr_rlc_ue_add_srb_rlc_entity(ue, srb_id, nr_rlc_am); - LOG_D(RLC, "%s:%d:%s: added srb %d to UE with RNTI 0x%x\n", __FILE__, __LINE__, __FUNCTION__, srb_id, rnti); + LOG_I(RLC, "%s:%d:%s: added srb %d to UE with RNTI 0x%x\n", __FILE__, __LINE__, __FUNCTION__, srb_id, rnti); } nr_rlc_manager_unlock(nr_rlc_ue_manager); } @@ -797,7 +801,7 @@ static void add_drb_am(int rnti, struct NR_DRB_ToAddMod *s, NR_RLC_BearerConfig_ sn_field_length); nr_rlc_ue_add_drb_rlc_entity(ue, drb_id, nr_rlc_am); - LOG_D(RLC, "%s:%d:%s: added drb %d to UE with RNTI 0x%x\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rnti); + LOG_I(RLC, "%s:%d:%s: added drb %d to UE with RNTI 0x%x\n", __FILE__, __LINE__, __FUNCTION__, drb_id, rnti); } nr_rlc_manager_unlock(nr_rlc_ue_manager); } diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index d0bddd9a4d..0bd772850b 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -400,7 +400,7 @@ void apply_macrlc_config(gNB_RRC_INST *rrc, nr_rrc_rlc_config_asn1_req(ctxt_pP, ue_context_pP->ue_context.SRB_configList, - NULL, + ue_context_pP->ue_context.DRB_configList, NULL, NULL, get_softmodem_params()->sa ? ue_context_pP->ue_context.masterCellGroup->rlc_BearerToAddModList : NULL); @@ -3107,6 +3107,52 @@ static int rrc_process_DU_DL(MessageDef *msg_p, const char *msg_name, instance_ return 0; } +static void rrc_DU_process_ue_context_setup_request(MessageDef *msg_p, const char *msg_name, instance_t instance){ + + f1ap_ue_context_setup_req_t * req=&F1AP_UE_CONTEXT_SETUP_REQ(msg_p); + protocol_ctxt_t ctxt; + ctxt.rnti = req->rnti; + ctxt.module_id = instance; + ctxt.instance = instance; + ctxt.enb_flag = 1; + gNB_RRC_INST *rrc = RC.nrrrc[ctxt.module_id]; + struct rrc_gNB_ue_context_s *ue_context_p = + rrc_gNB_get_ue_context(rrc, ctxt.rnti); + + + NR_CellGroupConfig_t *cellGroupConfig; + cellGroupConfig = calloc(1, sizeof(NR_CellGroupConfig_t)); + fill_mastercellGroupConfig(cellGroupConfig, ue_context_p->ue_context.masterCellGroup); + + /* Configure SRB2 */ + NR_SRB_ToAddMod_t *SRB2_config = NULL; + NR_SRB_ToAddModList_t *SRB_configList = ue_context_p->ue_context.SRB_configList; + if(SRB_configList != NULL){ + for (int i=0; isrbs_to_be_setup_length; i++){ + SRB2_config = CALLOC(1, sizeof(*SRB2_config)); + SRB2_config->srb_Identity = req->srbs_to_be_setup[i].srb_id; + ASN_SEQUENCE_ADD(&SRB_configList->list, SRB2_config); + } + } + else{ + LOG_E(NR_RRC, "The SRB list of the UE context is empty before the addition of SRB2 \n"); + return; + } + /* Configure DRB */ + NR_DRB_ToAddMod_t *DRB_config = NULL; + if(ue_context_p->ue_context.DRB_configList == NULL){ + ue_context_p->ue_context.DRB_configList = CALLOC(1, sizeof(*ue_context_p->ue_context.DRB_configList)); + } + NR_DRB_ToAddModList_t *DRB_configList = ue_context_p->ue_context.DRB_configList; + + for (int i=0; idrbs_to_be_setup_length; i++){ + DRB_config = CALLOC(1, sizeof(*DRB_config)); + DRB_config->drb_Identity = req->drbs_to_be_setup[i].drb_id; + ASN_SEQUENCE_ADD(&DRB_configList->list, DRB_config); + } + apply_macrlc_config(rrc, ue_context_p, &ctxt); +} + unsigned int mask_flip(unsigned int x) { return((((x>>8) + (x<<8))&0xffff)>>6); } @@ -3602,6 +3648,10 @@ void *rrc_gnb_task(void *args_p) { rrc_process_DU_DL(msg_p, msg_name_p, instance); break; + case F1AP_UE_CONTEXT_SETUP_REQ: + rrc_DU_process_ue_context_setup_request(msg_p, msg_name_p, instance); + break; + /* Messages from X2AP */ case X2AP_ENDC_SGNB_ADDITION_REQ: LOG_I(NR_RRC, "Received ENDC sgNB addition request from X2AP \n"); From ad27ec9811897c14687bfc20df3476dae2c1bf4c Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Fri, 27 Aug 2021 09:36:17 +0200 Subject: [PATCH 029/110] add UE wireshark trace --- openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c | 2 +- .../PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c | 1 - openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c | 6 +++++- openair1/SCHED_NR_UE/defs.h | 3 ++- openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 19 +++++++++++++++---- .../SIMULATION/NR_PHY/nr_dummy_functions.c | 3 ++- openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c | 14 +++++++------- openair2/LAYER2/nr_rlc/nr_rlc_entity_um.c | 8 ++++---- openair2/RRC/NR/rrc_gNB.c | 2 +- 9 files changed, 37 insertions(+), 21 deletions(-) diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c b/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c index 4d9e2dce35..16933df870 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_pbch.c @@ -607,7 +607,7 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue, uint16_t number_pdus = 1; nr_fill_dl_indication(&dl_indication, NULL, &rx_ind, proc, ue, gNB_id); - nr_fill_rx_indication(&rx_ind, FAPI_NR_RX_PDU_TYPE_SSB, gNB_id, ue, NULL, NULL, number_pdus); + nr_fill_rx_indication(&rx_ind, FAPI_NR_RX_PDU_TYPE_SSB, gNB_id, ue, NULL, NULL, number_pdus, proc); if (ue->if_inst && ue->if_inst->dl_indication) ue->if_inst->dl_indication(&dl_indication, NULL); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c index 5733ef6eb3..e044217249 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_coding.c @@ -257,7 +257,6 @@ int nr_ulsch_encoding(NR_UE_ULSCH_t *ulsch, Ilbrm = 0; Tbslbrm = 950984; //max tbs Coderate = 0.0; - trace_NRpdu(DIRECTION_UPLINK, harq_process->a, harq_process->pusch_pdu.pusch_data.tb_size, 0, WS_C_RNTI, 0, 0, 0,0, 0); /////////// ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c index 4ada19ba33..e521ce9ba3 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c @@ -47,6 +47,7 @@ #include "LAYER2/NR_MAC_UE/mac_proto.h" #include "PHY/NR_REFSIG/ul_ref_seq_nr.h" +#include //#define DEBUG_PUSCH_MAPPING //#define DEBUG_MAC_PDU @@ -158,7 +159,10 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, unsigned int G = nr_get_G(nb_rb, number_of_symbols, nb_dmrs_re_per_rb, number_dmrs_symbols, mod_order, Nl); - + trace_NRpdu(DIRECTION_UPLINK, + ulsch_ue->harq_processes[harq_pid]->a, + ulsch_ue->harq_processes[harq_pid]->pusch_pdu.pusch_data.tb_size, + 0, WS_C_RNTI, rnti, frame, slot, 0, 0); nr_ulsch_encoding(ulsch_ue, frame_parms, harq_pid, G); /////////// diff --git a/openair1/SCHED_NR_UE/defs.h b/openair1/SCHED_NR_UE/defs.h index c4a3de1d5a..348bb24bc8 100644 --- a/openair1/SCHED_NR_UE/defs.h +++ b/openair1/SCHED_NR_UE/defs.h @@ -418,7 +418,8 @@ void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind, PHY_VARS_NR_UE *ue, NR_UE_DLSCH_t *dlsch0, NR_UE_DLSCH_t *dlsch1, - uint16_t n_pdus); + uint16_t n_pdus, + UE_nr_rxtx_proc_t *proc); #endif diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index 6ca02050b7..66cff7eb6d 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -123,7 +123,8 @@ void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind, PHY_VARS_NR_UE *ue, NR_UE_DLSCH_t *dlsch0, NR_UE_DLSCH_t *dlsch1, - uint16_t n_pdus){ + uint16_t n_pdus, + UE_nr_rxtx_proc_t *proc ){ NR_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; @@ -132,6 +133,16 @@ void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind, LOG_E(PHY, "In %s: multiple number of DL PDUs not supported yet...\n", __FUNCTION__); } + if (pdu_type != FAPI_NR_RX_PDU_TYPE_SSB) + trace_NRpdu(DIRECTION_DOWNLINK, + dlsch0->harq_processes[dlsch0->current_harq_pid]->b, + dlsch0->harq_processes[dlsch0->current_harq_pid]->TBS / 8, + pdu_type, + WS_C_RNTI, + dlsch0->rnti, + proc->frame_rx, + proc->nr_slot_rx, + 0,0); switch (pdu_type){ case FAPI_NR_RX_PDU_TYPE_SIB: rx_ind->rx_indication_body[n_pdus - 1].pdsch_pdu.harq_pid = dlsch0->current_harq_pid; @@ -1035,16 +1046,16 @@ void nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue, switch (pdsch) { case RA_PDSCH: nr_fill_dl_indication(&dl_indication, NULL, &rx_ind, proc, ue, gNB_id); - nr_fill_rx_indication(&rx_ind, FAPI_NR_RX_PDU_TYPE_RAR, gNB_id, ue, dlsch0, NULL, number_pdus); + nr_fill_rx_indication(&rx_ind, FAPI_NR_RX_PDU_TYPE_RAR, gNB_id, ue, dlsch0, NULL, number_pdus, proc); ue->UE_mode[gNB_id] = RA_RESPONSE; break; case PDSCH: nr_fill_dl_indication(&dl_indication, NULL, &rx_ind, proc, ue, gNB_id); - nr_fill_rx_indication(&rx_ind, FAPI_NR_RX_PDU_TYPE_DLSCH, gNB_id, ue, dlsch0, NULL, number_pdus); + nr_fill_rx_indication(&rx_ind, FAPI_NR_RX_PDU_TYPE_DLSCH, gNB_id, ue, dlsch0, NULL, number_pdus, proc); break; case SI_PDSCH: nr_fill_dl_indication(&dl_indication, NULL, &rx_ind, proc, ue, gNB_id); - nr_fill_rx_indication(&rx_ind, FAPI_NR_RX_PDU_TYPE_SIB, gNB_id, ue, dlsch0, NULL, number_pdus); + nr_fill_rx_indication(&rx_ind, FAPI_NR_RX_PDU_TYPE_SIB, gNB_id, ue, dlsch0, NULL, number_pdus, proc); break; default: break; diff --git a/openair1/SIMULATION/NR_PHY/nr_dummy_functions.c b/openair1/SIMULATION/NR_PHY/nr_dummy_functions.c index 70d65a3dc2..c452e0f463 100644 --- a/openair1/SIMULATION/NR_PHY/nr_dummy_functions.c +++ b/openair1/SIMULATION/NR_PHY/nr_dummy_functions.c @@ -28,4 +28,5 @@ void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind, PHY_VARS_NR_UE *ue, NR_UE_DLSCH_t *dlsch0, NR_UE_DLSCH_t *dlsch1, - uint16_t n_pdus) {} + uint16_t n_pdus, + UE_nr_rxtx_proc_t *proc) {} diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c b/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c index 08f5b11c23..b078a89c2b 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_entity_am.c @@ -576,20 +576,20 @@ void nr_rlc_entity_am_recv_pdu(nr_rlc_entity_t *_entity, /* dicard PDU if no data */ if (data_size <= 0) { - LOG_D(RLC, "%s:%d:%s: warning: discard PDU, no data\n", + LOG_W(RLC, "%s:%d:%s: warning: discard PDU, no data\n", __FILE__, __LINE__, __FUNCTION__); goto discard; } /* dicard PDU if rx buffer is full */ if (entity->rx_size + data_size > entity->rx_maxsize) { - LOG_D(RLC, "%s:%d:%s: warning: discard PDU, RX buffer full\n", + LOG_W(RLC, "%s:%d:%s: warning: discard PDU, RX buffer full\n", __FILE__, __LINE__, __FUNCTION__); goto discard; } if (!sn_in_recv_window(entity, sn)) { - LOG_D(RLC, "%s:%d:%s: warning: discard PDU, sn out of window (sn %d rx_next %d)\n", + LOG_W(RLC, "%s:%d:%s: warning: discard PDU, sn out of window (sn %d rx_next %d)\n", __FILE__, __LINE__, __FUNCTION__, sn, entity->rx_next); goto discard; @@ -597,7 +597,7 @@ void nr_rlc_entity_am_recv_pdu(nr_rlc_entity_t *_entity, /* discard segment if all the bytes of the segment are already there */ if (segment_already_received(entity, sn, so, data_size)) { - LOG_D(RLC, "%s:%d:%s: warning: discard PDU, already received\n", + LOG_W(RLC, "%s:%d:%s: warning: discard PDU, already received\n", __FILE__, __LINE__, __FUNCTION__); goto discard; } @@ -623,7 +623,7 @@ void nr_rlc_entity_am_recv_pdu(nr_rlc_entity_t *_entity, entity->status_triggered = 1; if (!(sn_compare_rx(entity, sn, entity->rx_highest_status) < 0 || sn_compare_rx(entity, sn, v) >= 0)) { - LOG_D(RLC, "%s:%d:%s: warning: STATUS trigger should be delayed, according to specs\n", + LOG_W(RLC, "%s:%d:%s: warning: STATUS trigger should be delayed, according to specs\n", __FILE__, __LINE__, __FUNCTION__); } } @@ -633,7 +633,7 @@ void nr_rlc_entity_am_recv_pdu(nr_rlc_entity_t *_entity, control: cpt = nr_rlc_pdu_decoder_get_bits(&decoder, 3); R(decoder); if (cpt != 0) { - LOG_D(RLC, "%s:%d:%s: warning: discard PDU, CPT not 0 (%d)\n", + LOG_W(RLC, "%s:%d:%s: warning: discard PDU, CPT not 0 (%d)\n", __FILE__, __LINE__, __FUNCTION__, cpt); goto discard; } @@ -1644,7 +1644,7 @@ static void check_t_poll_retransmit(nr_rlc_entity_am_t *entity) */ entity->force_poll = 1; - LOG_D(RLC, "%s:%d:%s: warning: t_poll_retransmit expired\n", + LOG_W(RLC, "%s:%d:%s: warning: t_poll_retransmit expired\n", __FILE__, __LINE__, __FUNCTION__); /* do we meet conditions of 38.322 5.3.3.4? */ diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_entity_um.c b/openair2/LAYER2/nr_rlc/nr_rlc_entity_um.c index f967c3c543..4b4af8ba95 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_entity_um.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_entity_um.c @@ -299,21 +299,21 @@ void nr_rlc_entity_um_recv_pdu(nr_rlc_entity_t *_entity, /* dicard PDU if no data */ if (data_size <= 0) { - LOG_D(RLC, "%s:%d:%s: warning: discard PDU, no data\n", + LOG_W(RLC, "%s:%d:%s: warning: discard PDU, no data\n", __FILE__, __LINE__, __FUNCTION__); goto discard; } /* dicard PDU if rx buffer is full */ if (entity->rx_size + data_size > entity->rx_maxsize) { - LOG_D(RLC, "%s:%d:%s: warning: discard PDU, RX buffer full\n", + LOG_W(RLC, "%s:%d:%s: warning: discard PDU, RX buffer full\n", __FILE__, __LINE__, __FUNCTION__); goto discard; } /* discard PDU if sn < rx_next_reassembly */ if (sn_compare_rx(entity, sn, entity->rx_next_reassembly) < 0) { - LOG_D(RLC, "%s:%d:%s: warning: discard PDU, SN (%d) < rx_next_reassembly (%d)\n", + LOG_W(RLC, "%s:%d:%s: warning: discard PDU, SN (%d) < rx_next_reassembly (%d)\n", __FILE__, __LINE__, __FUNCTION__, sn, entity->rx_next_reassembly); goto discard; @@ -545,7 +545,7 @@ void nr_rlc_entity_um_recv_sdu(nr_rlc_entity_t *_entity, } if (entity->tx_size + size > entity->tx_maxsize) { - LOG_D(RLC, "%s:%d:%s: warning: SDU rejected, SDU buffer full\n", + LOG_W(RLC, "%s:%d:%s: warning: SDU rejected, SDU buffer full\n", __FILE__, __LINE__, __FUNCTION__); return; } diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 0bd772850b..10967aaa3c 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -3054,7 +3054,7 @@ static int rrc_process_DU_DL(MessageDef *msg_p, const char *msg_name, instance_ } } else if (req->srb_id == 2) { // TODO - abort(); + //abort(); } LOG_I(F1AP, "Received DL RRC Transfer on srb_id %ld\n", req->srb_id); From 229ccd6b143b49b3cb69bdb9db6642a286f0f9c8 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Tue, 31 Aug 2021 08:35:55 +0200 Subject: [PATCH 030/110] fix F1AP error on srb id --- openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c | 2 +- openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c | 2 +- openair2/RRC/NR/rrc_gNB.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c index 0b5d0ad486..fff1db6da6 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity.c @@ -107,7 +107,7 @@ static void nr_pdcp_entity_recv_pdu(nr_pdcp_entity_t *entity, if (rcvd_count < entity->rx_deliv || nr_pdcp_sdu_in_list(entity->rx_list, rcvd_count)) { - LOG_D(PDCP, "discard NR PDU rcvd_count=%d\n", rcvd_count); + LOG_W(PDCP, "discard NR PDU rcvd_count=%d\n", rcvd_count); return; } diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index cc403f6025..2f485894c6 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -453,7 +453,7 @@ static void deliver_sdu(void *_ue, nr_rlc_entity_t *entity, char *buf, int size) exit(1); rb_found: - LOG_D(RLC, "%s:%d:%s: delivering SDU (rnti %d is_srb %d rb_id %d) size %d", + LOG_D(RLC, "%s:%d:%s: delivering SDU (rnti %d is_srb %d rb_id %d) size %d\n", __FILE__, __LINE__, __FUNCTION__, ue->rnti, is_srb, rb_id, size); memblock = get_free_mem_block(size, __func__); diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 10967aaa3c..3793e59dbe 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -3069,7 +3069,7 @@ static int rrc_process_DU_DL(MessageDef *msg_p, const char *msg_name, instance_ //for (int i=0;idata[i]); //printf("\n"); - du_rlc_data_req(&ctxt, 1, 0x00, 1, 1, 0, req->buf->size, req->buf); + du_rlc_data_req(&ctxt, 1, 0, req->srb_id , 1, 0, req->buf->size, req->buf); // rlc_status = rlc_data_req(&ctxt // , 1 // , MBMS_FLAG_NO From 69c87b23440c320433b5aa40c970ed06c2bd9dee Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Tue, 31 Aug 2021 10:37:27 +0200 Subject: [PATCH 031/110] add F1-U DU Uplink --- openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c | 25 +++++++++++++---------- openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c | 24 ++++++++++++++-------- openair3/ocp-gtpu/gtp_itf.cpp | 3 +-- 3 files changed, 31 insertions(+), 21 deletions(-) diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index 5427af19bc..e62d79e23b 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -470,18 +470,21 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity, int offset=0; if (entity->has_sdap == 1 && entity->has_sdapULheader == 1) offset = 1; // this is the offset of the SDAP header in bytes - gtpu_buffer_p = itti_malloc(TASK_PDCP_ENB, TASK_GTPV1_U, - size + GTPU_HEADER_OVERHEAD_MAX - offset); - AssertFatal(gtpu_buffer_p != NULL, "OUT OF MEMORY"); - memcpy(>pu_buffer_p[GTPU_HEADER_OVERHEAD_MAX], buf+offset, size-offset); - message_p = itti_alloc_new_message(TASK_PDCP_ENB, 0, GTPV1U_GNB_TUNNEL_DATA_REQ); + message_p = itti_alloc_new_message_sized(TASK_PDCP_ENB, 0, + GTPV1U_GNB_TUNNEL_DATA_REQ, + sizeof(gtpv1u_gnb_tunnel_data_req_t) + size + + GTPU_HEADER_OVERHEAD_MAX - offset); AssertFatal(message_p != NULL, "OUT OF MEMORY"); - GTPV1U_GNB_TUNNEL_DATA_REQ(message_p).buffer = gtpu_buffer_p; - GTPV1U_GNB_TUNNEL_DATA_REQ(message_p).length = size-offset; - GTPV1U_GNB_TUNNEL_DATA_REQ(message_p).offset = GTPU_HEADER_OVERHEAD_MAX; - GTPV1U_GNB_TUNNEL_DATA_REQ(message_p).rnti = ue->rnti; - GTPV1U_GNB_TUNNEL_DATA_REQ(message_p).pdusession_id = entity->pdusession_id; - if (offset==1) LOG_I(PDCP, "%s() (drb %d) SDAP header %2x\n",__func__, rb_id, buf[0]); + gtpv1u_gnb_tunnel_data_req_t *req=>PV1U_GNB_TUNNEL_DATA_REQ(message_p); + gtpu_buffer_p = (uint8_t*)(req+1); + memcpy(gtpu_buffer_p+GTPU_HEADER_OVERHEAD_MAX, buf+offset, size-offset); + req->buffer = gtpu_buffer_p; + req->length = size-offset; + req->offset = GTPU_HEADER_OVERHEAD_MAX; + req->rnti = ue->rnti; + req->pdusession_id = entity->pdusession_id; + if (offset==1) + LOG_I(PDCP, "%s() (drb %d) SDAP header %2x\n",__func__, rb_id, buf[0]); LOG_D(PDCP, "%s() (drb %d) sending message to gtp size %d\n", __func__, rb_id, size-offset); itti_send_msg_to_task(TASK_VARIABLE, INSTANCE_DEFAULT, message_p); } diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index 2f485894c6..8c8067e7de 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -456,13 +456,6 @@ rb_found: LOG_D(RLC, "%s:%d:%s: delivering SDU (rnti %d is_srb %d rb_id %d) size %d\n", __FILE__, __LINE__, __FUNCTION__, ue->rnti, is_srb, rb_id, size); - memblock = get_free_mem_block(size, __func__); - if (memblock == NULL) { - LOG_E(RLC, "%s:%d:%s: ERROR: get_free_mem_block failed\n", __FILE__, __LINE__, __FUNCTION__); - exit(1); - } - memcpy(memblock->data, buf, size); - /* unused fields? */ ctx.instance = 0; ctx.frame = 0; @@ -506,11 +499,26 @@ rb_found: return; } else if(NODE_IS_DU(type) && is_srb == 0) { - LOG_W(RLC, "Received uplink user-plane traffic at RLC-DU to be sent to the CU, but F1-U implementation is not in place yet \n"); + MessageDef *msg = itti_alloc_new_message_sized(TASK_RLC_ENB, 0, GTPV1U_GNB_TUNNEL_DATA_REQ, sizeof(gtpv1u_gnb_tunnel_data_req_t) + size); + gtpv1u_gnb_tunnel_data_req_t *req=>PV1U_GNB_TUNNEL_DATA_REQ(msg); + req->buffer=(uint8_t*)(req+1); + memcpy(req->buffer,buf,size); + req->length=size; + req->offset=0; + req->rnti=ue->rnti; + req->pdusession_id=rb_id; + LOG_D(RLC, "Received uplink user-plane traffic at RLC-DU to be sent to the CU, size %d \n", size); + itti_send_msg_to_task(OCP_GTPV1_U, 0, msg); return; } } + memblock = get_free_mem_block(size, __func__); + if (memblock == NULL) { + LOG_E(RLC, "%s:%d:%s: ERROR: get_free_mem_block failed\n", __FILE__, __LINE__, __FUNCTION__); + exit(1); + } + memcpy(memblock->data, buf, size); if (!pdcp_data_ind(&ctx, is_srb, 0, rb_id, size, memblock)) { LOG_E(RLC, "%s:%d:%s: ERROR: pdcp_data_ind failed\n", __FILE__, __LINE__, __FUNCTION__); /* what to do in case of failure? for the moment: nothing */ diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index c367374436..25d3d7489d 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -841,8 +841,7 @@ void *ocp_gtpv1uTask(void *args) { case GTPV1U_GNB_TUNNEL_DATA_REQ: { gtpv1uSend2(compatInst(ITTI_MSG_DESTINATION_INSTANCE(message_p)), >PV1U_GNB_TUNNEL_DATA_REQ(message_p), false, false); - itti_free(OCP_GTPV1_U, GTPV1U_GNB_TUNNEL_DATA_REQ(message_p).buffer); - } + } break; case TERMINATE_MESSAGE: From 4e667929b766f871eaedbd2d6c62ed625c81b331 Mon Sep 17 00:00:00 2001 From: matzakos Date: Tue, 31 Aug 2021 11:18:30 +0200 Subject: [PATCH 032/110] Add gtp-u tunnel creation at the CU side - Change some elements names inside create_tunnel structure so that they are more generic to capture both N3 and F1-U use cases --- openair2/COMMON/gtpv1_u_messages_types.h | 7 +++-- openair2/LAYER2/PDCP_v10.1.0/pdcp.h | 15 +++++++++++ openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c | 19 +++++++++++++ openair2/RRC/NR/nr_rrc_defs.h | 2 ++ openair2/RRC/NR/rrc_gNB.c | 33 +++++++++++++++++++---- openair2/RRC/NR/rrc_gNB_NGAP.c | 16 +++++------ openair3/GTPV1-U/gtpv1u_gNB.c | 24 ++++++++--------- openair3/ocp-gtpu/gtp_itf.cpp | 7 ++--- 8 files changed, 93 insertions(+), 30 deletions(-) diff --git a/openair2/COMMON/gtpv1_u_messages_types.h b/openair2/COMMON/gtpv1_u_messages_types.h index 3c82076510..1dff6b89cb 100644 --- a/openair2/COMMON/gtpv1_u_messages_types.h +++ b/openair2/COMMON/gtpv1_u_messages_types.h @@ -189,10 +189,13 @@ typedef struct { typedef struct gtpv1u_gnb_create_tunnel_req_s { rnti_t rnti; int num_tunnels; - teid_t upf_NGu_teid[NR_GTPV1U_MAX_BEARERS_PER_UE]; ///< Tunnel Endpoint Identifier + //teid_t upf_NGu_teid[NR_GTPV1U_MAX_BEARERS_PER_UE]; ///< Tunnel Endpoint Identifier + teid_t outgoing_teid[NR_GTPV1U_MAX_BEARERS_PER_UE]; pdusessionid_t pdusession_id[NR_GTPV1U_MAX_BEARERS_PER_UE]; ebi_t incoming_rb_id[NR_GTPV1U_MAX_BEARERS_PER_UE]; - transport_layer_addr_t upf_addr[NR_GTPV1U_MAX_BEARERS_PER_UE]; + //ebi_t outgoing_rb_id[NR_GTPV1U_MAX_BEARERS_PER_UE]; + //transport_layer_addr_t upf_addr[NR_GTPV1U_MAX_BEARERS_PER_UE]; + transport_layer_addr_t dst_addr[NR_GTPV1U_MAX_BEARERS_PER_UE]; } gtpv1u_gnb_create_tunnel_req_t; typedef struct gtpv1u_gnb_create_tunnel_resp_s { diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h index 0c3dd2f04f..94d19e9c01 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h @@ -256,6 +256,21 @@ boolean_t pdcp_data_req( const uint32_t * destinationL2Id ); +boolean_t cu_f1u_data_req( + protocol_ctxt_t *ctxt_pP, + const srb_flag_t srb_flagP, + const rb_id_t rb_id, + const mui_t muiP, + const confirm_t confirmP, + const sdu_size_t sdu_buffer_size, + unsigned char *const sdu_buffer, + const pdcp_transmission_mode_t mode +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + ,const uint32_t *const sourceL2Id + ,const uint32_t *const destinationL2Id +#endif + ); + /*! \fn boolean_t pdcp_data_ind(const protocol_ctxt_t* const, srb_flag_t, MBMS_flag_t, rb_id_t, sdu_size_t, mem_block_t*, boolean_t) * \brief This functions handles data transfer indications coming from RLC * \param[in] ctxt_pP Running context. diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index e62d79e23b..9f3f3370d4 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -1212,6 +1212,25 @@ static boolean_t pdcp_data_req_drb( return 1; } +boolean_t cu_f1u_data_req( + protocol_ctxt_t *ctxt_pP, + const srb_flag_t srb_flagP, + const rb_id_t rb_id, + const mui_t muiP, + const confirm_t confirmP, + const sdu_size_t sdu_buffer_size, + unsigned char *const sdu_buffer, + const pdcp_transmission_mode_t mode +#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) + ,const uint32_t *const sourceL2Id + ,const uint32_t *const destinationL2Id +#endif + ) +{ + LOG_E(PDCP, "Implementation is pending"); + return true; +} + boolean_t pdcp_data_req( protocol_ctxt_t *ctxt_pP, const srb_flag_t srb_flagP, diff --git a/openair2/RRC/NR/nr_rrc_defs.h b/openair2/RRC/NR/nr_rrc_defs.h index b92b5defe6..4f1f5783c7 100644 --- a/openair2/RRC/NR/nr_rrc_defs.h +++ b/openair2/RRC/NR/nr_rrc_defs.h @@ -367,6 +367,8 @@ typedef struct gNB_RRC_UE_s { transport_layer_addr_t gnb_gtp_addrs[S1AP_MAX_E_RAB]; rb_id_t gnb_gtp_ebi[S1AP_MAX_E_RAB]; rb_id_t gnb_gtp_psi[S1AP_MAX_E_RAB]; + //GTPV1 F1-U TUNNELS + uint32_t incoming_teid[S1AP_MAX_E_RAB]; uint32_t ul_failure_timer; uint32_t ue_release_timer; diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 3793e59dbe..88ff49de3b 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -1346,17 +1346,40 @@ rrc_gNB_process_RRCReconfigurationComplete( /*gtpv1u_gnb_create_tunnel_req_t create_tunnel_req; gtpv1u_gnb_create_tunnel_resp_t create_tunnel_resp; memset(&create_tunnel_req, 0, sizeof(gtpv1u_gnb_create_tunnel_req_t)); - create_tunnel_req.upf_NGu_teid[0] = 1;*/ + create_tunnel_req.outgoing_teid[0] = 1;*/ if(DRB_configList!=NULL){ + + gtpv1u_gnb_create_tunnel_req_t create_tunnel_req; + teid_t incoming_teid; MessageDef *message_p; message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_UE_CONTEXT_SETUP_REQ); F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup = malloc(DRB_configList->list.count*sizeof(f1ap_drb_to_be_setup_t)); F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup_length = DRB_configList->list.count; LOG_I(RRC, "Length of DRB list:%d, %d \n", DRB_configList->list.count, F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup_length); for (int i = 0; i < DRB_configList->list.count; i++){ + memset(&create_tunnel_req, 0, sizeof(gtpv1u_gnb_create_tunnel_req_t)); + //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 + //create_tunnel_req.outgoing_teid[i] = 0xFFFF; + create_tunnel_req.outgoing_teid[i] = 0xFFFF; + create_tunnel_req.rnti = ue_context_pP->ue_context.rnti; + memcpy(create_tunnel_req.dst_addr[i].buffer,rrc->eth_params_s.remote_addr,4); + //create_tunnel_req.dst_addr[i].length = 32; + create_tunnel_req.dst_addr[i].length = 32; + create_tunnel_req.incoming_rb_id[i] = DRB_configList->list.array[i]->drb_Identity; + //create_tunnel_req.outgoing_rb_id[i] = DRB_configList->list.array[i]->drb_Identity; + + /* Here the callback function used as input is not the right one. Need to create a new one probably for F1-U, not sure + * if the kind of input parameters to the callback function are convenient though for gtp-u over F1-U.*/ + incoming_teid=newGtpuCreateTunnel(0, create_tunnel_req.rnti, + create_tunnel_req.incoming_rb_id[i], + create_tunnel_req.incoming_rb_id[i], + create_tunnel_req.outgoing_teid[i], + create_tunnel_req.dst_addr[i], 2152, + cu_f1u_data_req); + F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].drb_id = DRB_configList->list.array[i]->drb_Identity; F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].rlc_mode = RLC_MODE_AM; - F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].up_ul_tnl[0].gtp_teid = 1; + F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].up_ul_tnl[0].gtp_teid = incoming_teid; memcpy(&F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].up_ul_tnl[0].tl_address,rrc->eth_params_s.my_addr,4); F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].up_ul_tnl_length = 1; } @@ -1680,11 +1703,11 @@ rrc_gNB_process_RRCConnectionReestablishmentComplete( if (ue_context_pP->ue_context.pduSession[i].status == PDU_SESSION_STATUS_ESTABLISHED || ue_context_pP->ue_context.pduSession[i].status == PDU_SESSION_STATUS_DONE) { create_tunnel_req.pdusession_id[j] = ue_context_pP->ue_context.pduSession[i].param.pdusession_id; create_tunnel_req.incoming_rb_id[j] = i+1; - create_tunnel_req.upf_NGu_teid[j] = ue_context_pP->ue_context.pduSession[i].param.gtp_teid; - memcpy(create_tunnel_req.upf_addr[j].buffer, + create_tunnel_req.outgoing_teid[j] = ue_context_pP->ue_context.pduSession[i].param.gtp_teid; + memcpy(create_tunnel_req.dst_addr[j].buffer, ue_context_pP->ue_context.pduSession[i].param.upf_addr.buffer, sizeof(uint8_t)*20); - create_tunnel_req.upf_addr[j].length = ue_context_pP->ue_context.pduSession[i].param.upf_addr.length; + create_tunnel_req.dst_addr[j].length = ue_context_pP->ue_context.pduSession[i].param.upf_addr.length; j++; } } diff --git a/openair2/RRC/NR/rrc_gNB_NGAP.c b/openair2/RRC/NR/rrc_gNB_NGAP.c index 49145515a1..e8e5055cfe 100644 --- a/openair2/RRC/NR/rrc_gNB_NGAP.c +++ b/openair2/RRC/NR/rrc_gNB_NGAP.c @@ -541,14 +541,14 @@ rrc_gNB_process_NGAP_INITIAL_CONTEXT_SETUP_REQ( ue_context_p->ue_context.pduSession[i].param = NGAP_INITIAL_CONTEXT_SETUP_REQ (msg_p).pdusession_param[pdu_sessions_done]; create_tunnel_req.pdusession_id[pdu_sessions_done] = NGAP_INITIAL_CONTEXT_SETUP_REQ (msg_p).pdusession_param[pdu_sessions_done].pdusession_id; create_tunnel_req.incoming_rb_id[pdu_sessions_done] = i+1; - create_tunnel_req.upf_NGu_teid[pdu_sessions_done] = NGAP_INITIAL_CONTEXT_SETUP_REQ (msg_p).pdusession_param[pdu_sessions_done].gtp_teid; - create_tunnel_req.upf_addr[pdu_sessions_done].length = NGAP_INITIAL_CONTEXT_SETUP_REQ (msg_p).pdusession_param[pdu_sessions_done].upf_addr.length; - memcpy(create_tunnel_req.upf_addr[pdu_sessions_done].buffer, + create_tunnel_req.outgoing_teid[pdu_sessions_done] = NGAP_INITIAL_CONTEXT_SETUP_REQ (msg_p).pdusession_param[pdu_sessions_done].gtp_teid; + create_tunnel_req.dst_addr[pdu_sessions_done].length = NGAP_INITIAL_CONTEXT_SETUP_REQ (msg_p).pdusession_param[pdu_sessions_done].upf_addr.length; + memcpy(create_tunnel_req.dst_addr[pdu_sessions_done].buffer, NGAP_INITIAL_CONTEXT_SETUP_REQ (msg_p).pdusession_param[pdu_sessions_done].upf_addr.buffer, sizeof(uint8_t)*20); LOG_I(NR_RRC, "PDUSESSION SETUP: local index %d teid %u, pdusession id %d \n", i, - create_tunnel_req.upf_NGu_teid[pdu_sessions_done], + create_tunnel_req.outgoing_teid[pdu_sessions_done], create_tunnel_req.pdusession_id[pdu_sessions_done]); inde_list[pdu_sessions_done] = i; pdu_sessions_done++; @@ -1064,14 +1064,14 @@ rrc_gNB_process_NGAP_PDUSESSION_SETUP_REQ( ue_context_p->ue_context.pduSession[i].param = NGAP_PDUSESSION_SETUP_REQ(msg_p).pdusession_setup_params[pdu_sessions_done]; create_tunnel_req.pdusession_id[pdu_sessions_done] = NGAP_PDUSESSION_SETUP_REQ(msg_p).pdusession_setup_params[pdu_sessions_done].pdusession_id; create_tunnel_req.incoming_rb_id[pdu_sessions_done]= i+1; - create_tunnel_req.upf_NGu_teid[pdu_sessions_done] = NGAP_PDUSESSION_SETUP_REQ(msg_p).pdusession_setup_params[pdu_sessions_done].gtp_teid; - memcpy(create_tunnel_req.upf_addr[pdu_sessions_done].buffer, + create_tunnel_req.outgoing_teid[pdu_sessions_done] = NGAP_PDUSESSION_SETUP_REQ(msg_p).pdusession_setup_params[pdu_sessions_done].gtp_teid; + memcpy(create_tunnel_req.dst_addr[pdu_sessions_done].buffer, NGAP_PDUSESSION_SETUP_REQ(msg_p).pdusession_setup_params[pdu_sessions_done].upf_addr.buffer, sizeof(uint8_t)*20); - create_tunnel_req.upf_addr[pdu_sessions_done].length = NGAP_PDUSESSION_SETUP_REQ(msg_p).pdusession_setup_params[pdu_sessions_done].upf_addr.length; + create_tunnel_req.dst_addr[pdu_sessions_done].length = NGAP_PDUSESSION_SETUP_REQ(msg_p).pdusession_setup_params[pdu_sessions_done].upf_addr.length; LOG_I(NR_RRC,"NGAP PDUSESSION SETUP REQ: local index %d teid %u, pdusession id %d \n", i, - create_tunnel_req.upf_NGu_teid[pdu_sessions_done], + create_tunnel_req.outgoing_teid[pdu_sessions_done], create_tunnel_req.pdusession_id[pdu_sessions_done]); inde_list[pdu_sessions_done] = i; pdu_sessions_done++; diff --git a/openair3/GTPV1-U/gtpv1u_gNB.c b/openair3/GTPV1-U/gtpv1u_gNB.c index d3f26aeff1..ea6902f5be 100644 --- a/openair3/GTPV1-U/gtpv1u_gNB.c +++ b/openair3/GTPV1-U/gtpv1u_gNB.c @@ -528,7 +528,7 @@ gtpv1u_create_ngu_tunnel( MSC_AS_TIME_FMT" CREATE_TUNNEL_REQ RNTI %"PRIx16" inst %u ntuns %u psid %u upf-ngu teid %u", 0,0,create_tunnel_req_pP->rnti, instanceP, create_tunnel_req_pP->num_tunnels, create_tunnel_req_pP->pdusession_id[0], - create_tunnel_req_pP->upf_NGu_teid[0]); + create_tunnel_req_pP->outgoing_teid[0]); create_tunnel_resp_pP->rnti = create_tunnel_req_pP->rnti; create_tunnel_resp_pP->status = 0; create_tunnel_resp_pP->num_tunnels = 0; @@ -579,16 +579,16 @@ gtpv1u_create_ngu_tunnel( LOG_I(GTPU,"Configured GTPu address : %x\n",RC.nr_gtpv1u_data_g->gnb_ip_address_for_NGu_up); create_tunnel_resp_pP->gnb_addr.length = sizeof (in_addr_t); - addrs_length_in_bytes = create_tunnel_req_pP->upf_addr[i].length / 8; + addrs_length_in_bytes = create_tunnel_req_pP->dst_addr[i].length / 8; AssertFatal((addrs_length_in_bytes == 4) || (addrs_length_in_bytes == 16) || (addrs_length_in_bytes == 20), "Bad transport layer address length %d (bits) %d (bytes)", - create_tunnel_req_pP->upf_addr[i].length, addrs_length_in_bytes); + create_tunnel_req_pP->dst_addr[i].length, addrs_length_in_bytes); if ((addrs_length_in_bytes == 4) || (addrs_length_in_bytes == 20)) { - in_addr = *((in_addr_t *)create_tunnel_req_pP->upf_addr[i].buffer); + in_addr = *((in_addr_t *)create_tunnel_req_pP->dst_addr[i].buffer); ip_offset = 4; gtpv1u_ue_data_p->bearers[pdusession_id - GTPV1U_BEARER_OFFSET].upf_ip_addr = in_addr; } @@ -596,7 +596,7 @@ gtpv1u_create_ngu_tunnel( if ((addrs_length_in_bytes == 16) || (addrs_length_in_bytes == 20)) { memcpy(gtpv1u_ue_data_p->bearers[pdusession_id - GTPV1U_BEARER_OFFSET].upf_ip6_addr.s6_addr, - &create_tunnel_req_pP->upf_addr[i].buffer[ip_offset], + &create_tunnel_req_pP->dst_addr[i].buffer[ip_offset], 16); } @@ -861,7 +861,7 @@ static int gtpv1u_gnb_tunnel_data_req(gtpv1u_gnb_tunnel_data_req_t *gnb_tunnel_d hashtable_rc_t hash_rc = HASH_TABLE_KEY_NOT_EXISTS; nr_gtpv1u_ue_data_t *gtpv1u_ue_data_p = NULL; teid_t gnb_ngu_teid = 0; - teid_t upf_ngu_teid = 0; + teid_t outgoing_teid = 0; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_GTPV1U_PROCESS_TUNNEL_DATA_REQ, VCD_FUNCTION_IN); data_req_p = gnb_tunnel_data_req; @@ -873,13 +873,13 @@ static int gtpv1u_gnb_tunnel_data_req(gtpv1u_gnb_tunnel_data_req_t *gnb_tunnel_d } else { if ((data_req_p->pdusession_id >= GTPV1U_BEARER_OFFSET) && (data_req_p->pdusession_id < max_val_NR_DRB_Identity)) { gnb_ngu_teid = gtpv1u_ue_data_p->bearers[data_req_p->pdusession_id - GTPV1U_BEARER_OFFSET].teid_gNB; - upf_ngu_teid = gtpv1u_ue_data_p->bearers[data_req_p->pdusession_id - GTPV1U_BEARER_OFFSET].teid_upf; + outgoing_teid = gtpv1u_ue_data_p->bearers[data_req_p->pdusession_id - GTPV1U_BEARER_OFFSET].teid_upf; stack_req.apiType = NW_GTPV1U_ULP_API_SEND_TPDU; - stack_req.apiInfo.sendtoInfo.teid = upf_ngu_teid; + stack_req.apiInfo.sendtoInfo.teid = outgoing_teid; stack_req.apiInfo.sendtoInfo.ipAddr = gtpv1u_ue_data_p->bearers[data_req_p->pdusession_id - GTPV1U_BEARER_OFFSET].upf_ip_addr; rc = nwGtpv1uGpduMsgNew( RC.nr_gtpv1u_data_g->gtpv1u_stack, - upf_ngu_teid, + outgoing_teid, NW_FALSE, RC.nr_gtpv1u_data_g->seq_num++, data_req_p->buffer, @@ -890,7 +890,7 @@ static int gtpv1u_gnb_tunnel_data_req(gtpv1u_gnb_tunnel_data_req_t *gnb_tunnel_d if (rc != NW_GTPV1U_OK) { LOG_E(GTPU, "nwGtpv1uGpduMsgNew failed: 0x%x\n", rc); MSC_LOG_EVENT(MSC_GTPU_GNB,"0 Failed send G-PDU ltid %u rtid %u size %u", - gnb_ngu_teid,upf_ngu_teid,data_req_p->length); + gnb_ngu_teid,outgoing_teid,data_req_p->length); (void)gnb_ngu_teid; /* avoid gcc warning "set but not used" */ } else { rc = nwGtpv1uProcessUlpReq(RC.nr_gtpv1u_data_g->gtpv1u_stack, &stack_req); @@ -898,7 +898,7 @@ static int gtpv1u_gnb_tunnel_data_req(gtpv1u_gnb_tunnel_data_req_t *gnb_tunnel_d if (rc != NW_GTPV1U_OK) { LOG_E(GTPU, "nwGtpv1uProcessUlpReq failed: 0x%x\n", rc); MSC_LOG_EVENT(MSC_GTPU_GNB,"0 Failed send G-PDU ltid %u rtid %u size %u", - gnb_ngu_teid,upf_ngu_teid,data_req_p->length); + gnb_ngu_teid,outgoing_teid,data_req_p->length); } else { MSC_LOG_TX_MESSAGE( MSC_GTPU_GNB, @@ -908,7 +908,7 @@ static int gtpv1u_gnb_tunnel_data_req(gtpv1u_gnb_tunnel_data_req_t *gnb_tunnel_d MSC_AS_TIME_FMT" G-PDU ltid %u rtid %u size %u", 0,0, gnb_ngu_teid, - upf_ngu_teid, + outgoing_teid, data_req_p->length); } diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index 25d3d7489d..7d039e15a9 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -404,6 +404,7 @@ teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int incoming_bearer LOG_W(GTPU, "generated a random Teid that exists, re-generating (%x)\n",incoming_teid); incoming_teid=gtpv1uNewTeid(); }; + LOG_I (GTPU, "Allocated incoming teid: %d \n", incoming_teid); inst->te2ue_mapping[incoming_teid].rnti=rnti; @@ -524,14 +525,14 @@ int gtpv1u_create_ngu_tunnel( const instance_t instance, LOG_D(GTPU, "Start create tunnels for RNTI %x, num_tunnels %d, sgw_S1u_teid %x\n", create_tunnel_req->rnti, create_tunnel_req->num_tunnels, - create_tunnel_req->upf_NGu_teid[0]); + create_tunnel_req->outgoing_teid[0]); for (int i = 0; i < create_tunnel_req->num_tunnels; i++) { teid_t teid=newGtpuCreateTunnel(compatInst(instance), create_tunnel_req->rnti, create_tunnel_req->incoming_rb_id[i], create_tunnel_req->pdusession_id[i], - create_tunnel_req->upf_NGu_teid[i], - create_tunnel_req->upf_addr[i], 2152, + create_tunnel_req->outgoing_teid[i], + create_tunnel_req->dst_addr[i], 2152, pdcp_data_req); create_tunnel_resp->status=0; create_tunnel_resp->rnti=create_tunnel_req->rnti; From 0976f3e98820d4c6e6128968f177b99df85a60b2 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Tue, 31 Aug 2021 13:26:29 +0200 Subject: [PATCH 033/110] bug fix --- openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c | 4 ++-- openair2/F1AP/f1ap_du_ue_context_management.c | 6 ++---- openair2/RRC/NR/rrc_gNB.c | 1 + openair3/SCTP/sctp_eNB_task.c | 4 ++-- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c b/openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c index d0a7865146..481f5ee0dd 100644 --- a/openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c +++ b/openair1/SIMULATION/ETH_TRANSPORT/netlink_init.c @@ -103,7 +103,7 @@ int netlink_init_mbms_tun(char *ifprefix) { nas_sock_mbms_fd = tun_alloc(ifname); if (nas_sock_mbms_fd == -1) { - printf("[NETLINK] Error opening socket %s (%d:%s)\n",ifname,errno, strerror(errno)); + printf("[NETLINK] Error opening mbms socket %s (%d:%s)\n",ifname,errno, strerror(errno)); exit(1); } @@ -161,7 +161,7 @@ int netlink_init(void) { nas_sock_fd[0] = socket(PF_NETLINK, SOCK_RAW,GRAAL_NETLINK_ID); if (nas_sock_fd[0] == -1) { - printf("[NETLINK] Error opening socket %d (%d:%s)\n",nas_sock_fd[0],errno, strerror(errno)); + printf("[NETLINK] Error opening GRAAL_NETLINK_ID socket %d (%d:%s)\n",nas_sock_fd[0],errno, strerror(errno)); if (LINK_ENB_PDCP_TO_IP_DRIVER) { exit(1); diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index e51a14a448..4cff72c8b5 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -100,8 +100,6 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, f1ap_ue_context_setup_req->cellULConfigured = NULL; } - f1ap_drb_to_be_setup_t *drb_p; - f1ap_srb_to_be_setup_t *srb_p; if (RC.nrrrc) { /* RRCContainer */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container, @@ -113,7 +111,7 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, "could not allocate memory for f1ap_ue_context_setup_req->drbs_to_be_setup\n"); for (i = 0; i < f1ap_ue_context_setup_req->drbs_to_be_setup_length; ++i) { - drb_p = &f1ap_ue_context_setup_req->drbs_to_be_setup[i]; + f1ap_drb_to_be_setup_t *drb_p = &f1ap_ue_context_setup_req->drbs_to_be_setup[i]; F1AP_DRBs_ToBeSetup_Item_t *drbs_tobesetup_item_p; drbs_tobesetup_item_p = &((F1AP_DRBs_ToBeSetup_ItemIEs_t *)ie->value.choice.DRBs_ToBeSetup_List.list.array[i])->value.choice.DRBs_ToBeSetup_Item; drb_p->drb_id = drbs_tobesetup_item_p->dRBID; @@ -146,7 +144,7 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, "could not allocate memory for f1ap_ue_context_setup_req->srbs_to_be_setup\n"); for (i = 0; i < f1ap_ue_context_setup_req->srbs_to_be_setup_length; ++i) { - srb_p = &f1ap_ue_context_setup_req->srbs_to_be_setup[i]; + f1ap_srb_to_be_setup_t *srb_p = &f1ap_ue_context_setup_req->srbs_to_be_setup[i]; F1AP_SRBs_ToBeSetup_Item_t *srbs_tobesetup_item_p; srbs_tobesetup_item_p = &((F1AP_SRBs_ToBeSetup_ItemIEs_t *)ie->value.choice.SRBs_ToBeSetup_List.list.array[i])->value.choice.SRBs_ToBeSetup_Item; srb_p->srb_id = srbs_tobesetup_item_p->sRBID; diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 3793e59dbe..7e1d6ed874 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -3151,6 +3151,7 @@ static void rrc_DU_process_ue_context_setup_request(MessageDef *msg_p, const cha ASN_SEQUENCE_ADD(&DRB_configList->list, DRB_config); } apply_macrlc_config(rrc, ue_context_p, &ctxt); + } unsigned int mask_flip(unsigned int x) { diff --git a/openair3/SCTP/sctp_eNB_task.c b/openair3/SCTP/sctp_eNB_task.c index e53a13f5fe..8d0166f805 100644 --- a/openair3/SCTP/sctp_eNB_task.c +++ b/openair3/SCTP/sctp_eNB_task.c @@ -451,7 +451,7 @@ sctp_handle_new_association_req( if (s > 0 ) { if (((struct sockaddr_in*)ifa->ifa_addr)->sin_addr.s_addr == in.s_addr) { - struct sockaddr_in locaddr; + struct sockaddr_in locaddr={0}; locaddr.sin_family = AF_INET; locaddr.sin_port = 0; locaddr.sin_addr.s_addr = in.s_addr; @@ -693,7 +693,7 @@ static int sctp_create_new_listener( sctp_init_t *init_p, int server_type) { - struct sctp_event_subscribe event; + struct sctp_event_subscribe event={0}; struct sockaddr *addr = NULL; struct sctp_cnx_list_elm_s *sctp_cnx = NULL; uint16_t i = 0, j = 0; From 7ca1f045d08828bf202c7cfd7d7dec18c8c01997 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Tue, 31 Aug 2021 14:36:56 +0200 Subject: [PATCH 034/110] typo remaining --- openair3/GTPV1-U/gtpv1u_gNB.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair3/GTPV1-U/gtpv1u_gNB.c b/openair3/GTPV1-U/gtpv1u_gNB.c index ea6902f5be..1535396803 100644 --- a/openair3/GTPV1-U/gtpv1u_gNB.c +++ b/openair3/GTPV1-U/gtpv1u_gNB.c @@ -603,7 +603,7 @@ gtpv1u_create_ngu_tunnel( gtpv1u_ue_data_p->bearers[pdusession_id - GTPV1U_BEARER_OFFSET].state = BEARER_IN_CONFIG; gtpv1u_ue_data_p->bearers[pdusession_id - GTPV1U_BEARER_OFFSET].teid_gNB = ngu_teid; gtpv1u_ue_data_p->bearers[pdusession_id - GTPV1U_BEARER_OFFSET].teid_gNB_stack_session = stack_req.apiInfo.createTunnelEndPointInfo.hStackSession; - gtpv1u_ue_data_p->bearers[pdusession_id - GTPV1U_BEARER_OFFSET].teid_upf = create_tunnel_req_pP->upf_NGu_teid[i]; + gtpv1u_ue_data_p->bearers[pdusession_id - GTPV1U_BEARER_OFFSET].teid_upf = create_tunnel_req_pP->outgoing_teid[i]; gtpv1u_ue_data_p->num_bearers++; create_tunnel_resp_pP->gnb_NGu_teid[i] = ngu_teid; From 7a2f88040fecccfb455445e9f0ebff285d445315 Mon Sep 17 00:00:00 2001 From: matzakos Date: Tue, 31 Aug 2021 15:39:51 +0200 Subject: [PATCH 035/110] Correction to parse the IP address for F1-U tunnels creation however the address in the NGAP message is still wrong --- openair2/RRC/NR/rrc_gNB.c | 11 +++++------ openair3/ocp-gtpu/gtp_itf.cpp | 3 +-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index f9613f1573..a3707aa352 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -1350,7 +1350,6 @@ rrc_gNB_process_RRCReconfigurationComplete( if(DRB_configList!=NULL){ gtpv1u_gnb_create_tunnel_req_t create_tunnel_req; - teid_t incoming_teid; MessageDef *message_p; message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_UE_CONTEXT_SETUP_REQ); F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup = malloc(DRB_configList->list.count*sizeof(f1ap_drb_to_be_setup_t)); @@ -1362,15 +1361,15 @@ rrc_gNB_process_RRCReconfigurationComplete( //create_tunnel_req.outgoing_teid[i] = 0xFFFF; create_tunnel_req.outgoing_teid[i] = 0xFFFF; create_tunnel_req.rnti = ue_context_pP->ue_context.rnti; - memcpy(create_tunnel_req.dst_addr[i].buffer,rrc->eth_params_s.remote_addr,4); + LOG_I(NR_RRC,"The DU remote IP address is: %s \n", rrc->eth_params_s.remote_addr); + create_tunnel_req.dst_addr[i].buffer[0] = inet_addr(rrc->eth_params_s.remote_addr); //create_tunnel_req.dst_addr[i].length = 32; create_tunnel_req.dst_addr[i].length = 32; create_tunnel_req.incoming_rb_id[i] = DRB_configList->list.array[i]->drb_Identity; - //create_tunnel_req.outgoing_rb_id[i] = DRB_configList->list.array[i]->drb_Identity; /* Here the callback function used as input is not the right one. Need to create a new one probably for F1-U, not sure * if the kind of input parameters to the callback function are convenient though for gtp-u over F1-U.*/ - incoming_teid=newGtpuCreateTunnel(0, create_tunnel_req.rnti, + ue_context_pP->ue_context.incoming_teid[i] = newGtpuCreateTunnel(0, create_tunnel_req.rnti, create_tunnel_req.incoming_rb_id[i], create_tunnel_req.incoming_rb_id[i], create_tunnel_req.outgoing_teid[i], @@ -1379,8 +1378,8 @@ rrc_gNB_process_RRCReconfigurationComplete( F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].drb_id = DRB_configList->list.array[i]->drb_Identity; F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].rlc_mode = RLC_MODE_AM; - F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].up_ul_tnl[0].gtp_teid = incoming_teid; - memcpy(&F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].up_ul_tnl[0].tl_address,rrc->eth_params_s.my_addr,4); + F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].up_ul_tnl[0].gtp_teid = ue_context_pP->ue_context.incoming_teid[i]; + F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].up_ul_tnl[0].tl_address = inet_addr(rrc->eth_params_s.my_addr); F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].up_ul_tnl_length = 1; } F1AP_UE_CONTEXT_SETUP_REQ (message_p).gNB_CU_ue_id = 0; diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index 7d039e15a9..e3dbfe0f25 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -404,7 +404,6 @@ teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int incoming_bearer LOG_W(GTPU, "generated a random Teid that exists, re-generating (%x)\n",incoming_teid); incoming_teid=gtpv1uNewTeid(); }; - LOG_I (GTPU, "Allocated incoming teid: %d \n", incoming_teid); inst->te2ue_mapping[incoming_teid].rnti=rnti; @@ -443,7 +442,7 @@ teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int incoming_bearer char ip4[INET_ADDRSTRLEN]; char ip6[INET6_ADDRSTRLEN]; - LOG_I(GTPU, "Created tunnel for RNTI %x, teid for DL: %d, teid for UL %d to remote IPv4: %s, IPv6 %s\n", + LOG_I(GTPU, "Created tunnel for RNTI %x, teid for DL: %u, teid for UL %u to remote IPv4: %s, IPv6 %s\n", rnti, tmp->teid_incoming, tmp->teid_outgoing, From 2616ef6bdf9df565ce752916ece9f203d789ecb7 Mon Sep 17 00:00:00 2001 From: matzakos Date: Tue, 31 Aug 2021 17:04:48 +0200 Subject: [PATCH 036/110] Correct the placement of memory initialization for F1-U create_tunnel_req --- openair2/RRC/NR/rrc_gNB.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index a3707aa352..957c3b7a66 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -1343,20 +1343,15 @@ rrc_gNB_process_RRCReconfigurationComplete( get_softmodem_params()->sa ? ue_context_pP->ue_context.masterCellGroup->rlc_BearerToAddModList : NULL); } else { - /*gtpv1u_gnb_create_tunnel_req_t create_tunnel_req; - gtpv1u_gnb_create_tunnel_resp_t create_tunnel_resp; - memset(&create_tunnel_req, 0, sizeof(gtpv1u_gnb_create_tunnel_req_t)); - create_tunnel_req.outgoing_teid[0] = 1;*/ if(DRB_configList!=NULL){ - gtpv1u_gnb_create_tunnel_req_t create_tunnel_req; + memset(&create_tunnel_req, 0, sizeof(gtpv1u_gnb_create_tunnel_req_t)); MessageDef *message_p; message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_UE_CONTEXT_SETUP_REQ); F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup = malloc(DRB_configList->list.count*sizeof(f1ap_drb_to_be_setup_t)); F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup_length = DRB_configList->list.count; LOG_I(RRC, "Length of DRB list:%d, %d \n", DRB_configList->list.count, F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup_length); for (int i = 0; i < DRB_configList->list.count; i++){ - memset(&create_tunnel_req, 0, sizeof(gtpv1u_gnb_create_tunnel_req_t)); //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 //create_tunnel_req.outgoing_teid[i] = 0xFFFF; create_tunnel_req.outgoing_teid[i] = 0xFFFF; From 49c4fceb768961868c216bee7f5628344526bc7b Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Tue, 31 Aug 2021 20:51:11 +0200 Subject: [PATCH 037/110] fix memory error: too early paramters read, then free (before end of usage --- common/utils/system.c | 50 +++++++++++++---------------------- executables/nr-softmodem.c | 2 +- openair2/GNB_APP/gnb_config.c | 3 +-- 3 files changed, 21 insertions(+), 34 deletions(-) diff --git a/common/utils/system.c b/common/utils/system.c index d8b66c51d3..4ba1eae993 100644 --- a/common/utils/system.c +++ b/common/utils/system.c @@ -96,39 +96,24 @@ static void read_pipe(int p, char *b, int size) { } } -static int baseRunTimeCommand(char* cmd, size_t cmdSize) { - FILE *fp; - size_t retSize = 0; - - fp = popen(cmd, "r"); - if(fp) { - memset(cmd, 0, cmdSize); - retSize = fread(cmd, 1, cmdSize, fp); - fclose(fp); - } else { - LOG_D(HW,"%s:%d:%s: Cannot open %s\n", __FILE__, __LINE__, __FUNCTION__, cmd); - } - - if (retSize == 0) { - return 0; - } - return atoi(cmd); +static int baseRunTimeCommand(char* cmd) { + return system(cmd); } int checkIfFedoraDistribution(void) { char cmd[200]; memset(cmd, 0, 200); - sprintf(cmd, "cat /etc/os-release | grep ID_LIKE | grep -ic fedora || true"); - return baseRunTimeCommand(cmd, 200); + sprintf(cmd, "cat /etc/os-release | grep ID_LIKE | grep -ic fedora"); + return baseRunTimeCommand(cmd); } int checkIfGenericKernelOnFedora(void) { char cmd[200]; memset(cmd, 0, 200); - sprintf(cmd, "uname -a | grep -c rt || true"); - return (1 - baseRunTimeCommand(cmd, 200)); + sprintf(cmd, "uname -a | grep -c rt"); + return (1 - baseRunTimeCommand(cmd)); } int checkIfInsideContainer(void) { @@ -136,8 +121,8 @@ int checkIfInsideContainer(void) { int res = 0; memset(cmd, 0, 200); - sprintf(cmd, "cat /proc/self/cgroup | egrep -c 'libpod|podman|kubepods' || true"); - res = baseRunTimeCommand(cmd, 200); + sprintf(cmd, "cat /proc/self/cgroup | egrep -c 'libpod|podman|kubepods'"); + res = baseRunTimeCommand(cmd); if (res > 0) return 1; else @@ -255,19 +240,21 @@ void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name, AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno); ret=pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno); + /* if (checkIfFedoraDistribution()) if (checkIfGenericKernelOnFedora()) if (checkIfInsideContainer()) - settingPriority = 0; - + */ + settingPriority = 0; + if (settingPriority) { ret=pthread_attr_setschedpolicy(&attr, SCHED_OAI); AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno); - if(prioritysched_get_priority_max(SCHED_FIFO)) { + if(prioritysched_get_priority_max(SCHED_OAI)) { LOG_E(TMR,"Prio not possible: %d, min is %d, max: %d, forced in the range\n", - priority, - sched_get_priority_min(SCHED_OAI), - sched_get_priority_max(SCHED_OAI)); + priority, + sched_get_priority_min(SCHED_OAI), + sched_get_priority_max(SCHED_OAI)); if(prioritysched_get_priority_max(SCHED_OAI)) @@ -279,12 +266,13 @@ void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name, ret=pthread_attr_setschedparam(&attr, &sparam); AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno); } - + ret=pthread_create(t, &attr, func, param); AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno); - + pthread_setname_np(*t, name); if (affinity != -1 ) { + abort(); cpu_set_t cpuset; CPU_ZERO(&cpuset); CPU_SET(affinity, &cpuset); diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index b855418d64..6347b75941 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -823,7 +823,7 @@ int main( int argc, char **argv ) { } printf("About to call end_configmodule() from %s() %s:%d\n", __FUNCTION__, __FILE__, __LINE__); - end_configmodule(); + //end_configmodule(); printf("Called end_configmodule() from %s() %s:%d\n", __FUNCTION__, __FILE__, __LINE__); // wait for end of program printf("TYPE TO TERMINATE\n"); diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 96e1406630..e65566a752 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -812,9 +812,8 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { paramdef_t GNBParams[] = GNBPARAMS_DESC; paramlist_def_t GNBParamList = {GNB_CONFIG_STRING_GNB_LIST,NULL,0}; - NR_ServingCellConfigCommon_t *scc = calloc(1,sizeof(NR_ServingCellConfigCommon_t)); + NR_ServingCellConfigCommon_t *scc = calloc(1,sizeof(*scc)); uint64_t ssb_bitmap=0xff; - memset((void*)scc,0,sizeof(NR_ServingCellConfigCommon_t)); prepare_scc(scc); paramdef_t SCCsParams[] = SCCPARAMS_DESC(scc); paramlist_def_t SCCsParamList = {GNB_CONFIG_STRING_SERVINGCELLCONFIGCOMMON, NULL, 0}; From 5c3abe6fc8e145fc3ecfe1b281f70903e18ec0ac Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Tue, 31 Aug 2021 21:03:22 +0200 Subject: [PATCH 038/110] add F1-U DU Uplink --- common/config/config_load_configmodule.c | 4 ++-- common/config/libconfig/config_libconfig.c | 4 ++-- common/utils/system.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/common/config/config_load_configmodule.c b/common/config/config_load_configmodule.c index 740c6e240b..c9e8ea0532 100644 --- a/common/config/config_load_configmodule.c +++ b/common/config/config_load_configmodule.c @@ -182,8 +182,8 @@ int config_cmdlineonly_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) } configmodule_interface_t *load_configmodule(int argc, - char **argv, - uint32_t initflags) + char **argv, + uint32_t initflags) { char *cfgparam=NULL; char *modeparams=NULL; diff --git a/common/config/libconfig/config_libconfig.c b/common/config/libconfig/config_libconfig.c index 17266246f0..ec57b420dd 100644 --- a/common/config/libconfig/config_libconfig.c +++ b/common/config/libconfig/config_libconfig.c @@ -91,7 +91,7 @@ int read_intarray(paramdef_t *cfgoptions,config_setting_t *setting, char *cfgpat -int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) { +static int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) { config_setting_t *setting; char *str; int i,u; @@ -122,7 +122,7 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) { switch(cfgoptions[i].type) { case TYPE_STRING: - if ( config_lookup_string(&(libconfig_privdata.cfg),cfgpath, (const char **)&str)) { + if ( config_lookup_string(&(libconfig_privdata.cfg), cfgpath, &str)) { if ( cfgoptions[i].numelt > 0 && str != NULL && strlen(str) >= cfgoptions[i].numelt ) { fprintf(stderr,"[LIBCONFIG] %s: %s exceeds maximum length of %i bytes, value truncated\n", cfgpath,str,cfgoptions[i].numelt); diff --git a/common/utils/system.c b/common/utils/system.c index 4ba1eae993..f7b826e0a7 100644 --- a/common/utils/system.c +++ b/common/utils/system.c @@ -240,11 +240,11 @@ void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name, AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno); ret=pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno); - /* + if (checkIfFedoraDistribution()) if (checkIfGenericKernelOnFedora()) if (checkIfInsideContainer()) - */ + settingPriority = 0; if (settingPriority) { From 9ee167c82928c99afde9a414b1a7dddeefca502f Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Tue, 31 Aug 2021 21:31:24 +0200 Subject: [PATCH 039/110] draft F1-C for DU --- openair2/F1AP/f1ap_du_ue_context_management.c | 32 +++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 4cff72c8b5..fbf6445e17 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -40,6 +40,20 @@ #include "rrc_eNB_UE_context.h" #include "openair2/RRC/NR/rrc_gNB_UE_context.h" #include "openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h" +#include + +boolean_t DURecvCb( protocol_ctxt_t *ctxt_pP, + const srb_flag_t srb_flagP, + const rb_id_t rb_idP, + const mui_t muiP, + const confirm_t confirmP, + const sdu_size_t sdu_buffer_sizeP, + unsigned char *const sdu_buffer_pP, + const pdcp_transmission_mode_t modeP, + const uint32_t *sourceL2Id, + const uint32_t *destinationL2Id) { + return true; +} int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, rnti_t rntiP); int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, @@ -134,6 +148,18 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, drb_p->rlc_mode = RLC_MODE_TM; break; } + transport_layer_addr_t addr; + memcpy(addr.buffer, &drb_p->up_ul_tnl[0].tl_address, sizeof(drb_p->up_ul_tnl[0].tl_address)); + addr.length=sizeof(drb_p->up_ul_tnl[0].tl_address)*8; + teid_t t=newGtpuCreateTunnel(instance, + f1ap_get_rnti_by_du_id(false, instance, ie->value.choice.GNB_DU_UE_F1AP_ID), + drb_p->drb_id , + drb_p->drb_id, + drb_p->up_ul_tnl[0].gtp_teid, + addr, + 2152, + DURecvCb); + } F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container, F1AP_ProtocolIE_ID_id_SRBs_ToBeSetup_List, true); @@ -146,8 +172,8 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, for (i = 0; i < f1ap_ue_context_setup_req->srbs_to_be_setup_length; ++i) { f1ap_srb_to_be_setup_t *srb_p = &f1ap_ue_context_setup_req->srbs_to_be_setup[i]; F1AP_SRBs_ToBeSetup_Item_t *srbs_tobesetup_item_p; - srbs_tobesetup_item_p = &((F1AP_SRBs_ToBeSetup_ItemIEs_t *)ie->value.choice.SRBs_ToBeSetup_List.list.array[i])->value.choice.SRBs_ToBeSetup_Item; - srb_p->srb_id = srbs_tobesetup_item_p->sRBID; + srbs_tobesetup_item_p = &((F1AP_SRBs_ToBeSetup_ItemIEs_t *)ie->value.choice.SRBs_ToBeSetup_List.list.array[i])->value.choice.SRBs_ToBeSetup_Item; + srb_p->srb_id = srbs_tobesetup_item_p->sRBID; } } @@ -199,6 +225,8 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, LOG_E(F1AP, "can't find RRCContainer in UEContextSetupRequestIEs by id %ld \n", F1AP_ProtocolIE_ID_id_RRCContainer); } + + itti_send_msg_to_task(TASK_RRC_GNB, instance, msg_p); return 0; From 01504dcab1f72f70f1555f18d355f0e5f638f117 Mon Sep 17 00:00:00 2001 From: matzakos Date: Wed, 1 Sep 2021 13:32:43 +0200 Subject: [PATCH 040/110] Small correction to obtain the rnti from the CU or DU UE id --- openair2/F1AP/f1ap_du_ue_context_management.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index fbf6445e17..f1a10156a4 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -65,7 +65,6 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, F1AP_UEContextSetupRequestIEs_t *ie; int i; DevAssert(pdu); - LOG_E(F1AP, "DU_handle_UE_CONTEXT_SETUP_REQUEST() fills a ITTI message F1AP_UE_CONTEXT_SETUP_REQ but it never sends it\n"); msg_p = itti_alloc_new_message(TASK_DU_F1, 0, F1AP_UE_CONTEXT_SETUP_REQ); f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_req = &F1AP_UE_CONTEXT_SETUP_REQ(msg_p); container = &pdu->choice.initiatingMessage->value.choice.UEContextSetupRequest; @@ -151,8 +150,11 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, transport_layer_addr_t addr; memcpy(addr.buffer, &drb_p->up_ul_tnl[0].tl_address, sizeof(drb_p->up_ul_tnl[0].tl_address)); addr.length=sizeof(drb_p->up_ul_tnl[0].tl_address)*8; + rnti_t ue_rnti = (f1ap_ue_context_setup_req->gNB_DU_ue_id!=NULL) ? + f1ap_get_rnti_by_du_id(false, instance, *f1ap_ue_context_setup_req->gNB_DU_ue_id): + f1ap_get_rnti_by_cu_id(false, instance, f1ap_ue_context_setup_req->gNB_CU_ue_id); teid_t t=newGtpuCreateTunnel(instance, - f1ap_get_rnti_by_du_id(false, instance, ie->value.choice.GNB_DU_UE_F1AP_ID), + ue_rnti, drb_p->drb_id , drb_p->drb_id, drb_p->up_ul_tnl[0].gtp_teid, From e1e5b56a7794eaa56bd241bfa70d383e3234c21f Mon Sep 17 00:00:00 2001 From: matzakos Date: Wed, 1 Sep 2021 15:46:11 +0200 Subject: [PATCH 041/110] Fix IP address parsing for CU/DU tunnel information info --- openair2/RRC/NR/rrc_gNB.c | 9 +++++---- openair3/UTILS/conversions.h | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 957c3b7a66..992855f9d7 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -94,6 +94,7 @@ #include "executables/softmodem-common.h" #include #include +#include #include "BIT_STRING.h" #include "assertions.h" @@ -1356,10 +1357,10 @@ rrc_gNB_process_RRCReconfigurationComplete( //create_tunnel_req.outgoing_teid[i] = 0xFFFF; create_tunnel_req.outgoing_teid[i] = 0xFFFF; create_tunnel_req.rnti = ue_context_pP->ue_context.rnti; - LOG_I(NR_RRC,"The DU remote IP address is: %s \n", rrc->eth_params_s.remote_addr); - create_tunnel_req.dst_addr[i].buffer[0] = inet_addr(rrc->eth_params_s.remote_addr); - //create_tunnel_req.dst_addr[i].length = 32; - create_tunnel_req.dst_addr[i].length = 32; + in_addr_t tmp_addr = inet_addr(rrc->eth_params_s.remote_addr); + memcpy(create_tunnel_req.dst_addr[i].buffer, &tmp_addr, sizeof(tmp_addr)); + LOG_D(NR_RRC, "The remote tunnel IP address of the DU is: %u.%u.%u.%u \n", create_tunnel_req.dst_addr[i].buffer[0], create_tunnel_req.dst_addr[i].buffer[1],create_tunnel_req.dst_addr[i].buffer[2], create_tunnel_req.dst_addr[i].buffer[3]); + create_tunnel_req.dst_addr[i].length = sizeof(tmp_addr)*8; create_tunnel_req.incoming_rb_id[i] = DRB_configList->list.array[i]->drb_Identity; /* Here the callback function used as input is not the right one. Need to create a new one probably for F1-U, not sure diff --git a/openair3/UTILS/conversions.h b/openair3/UTILS/conversions.h index cfb2c8cdfc..cce89eca1c 100644 --- a/openair3/UTILS/conversions.h +++ b/openair3/UTILS/conversions.h @@ -403,7 +403,7 @@ do { \ (bITsTRING)->buf[0] = (mACRO) >> 24 & 0xFF; \ (bITsTRING)->buf[1] = (mACRO) >> 16 & 0xFF; \ (bITsTRING)->buf[2] = (mACRO) >> 8 & 0xFF; \ - (bITsTRING)->buf[3] = (mACRO) >> 4 & 0xFF; \ + (bITsTRING)->buf[3] = (mACRO) & 0xFF; \ (bITsTRING)->size = 4; \ (bITsTRING)->bits_unused = 0; \ } while(0) From 1f346f1bdfd8713717dade5d7ee16c09fdfc1711 Mon Sep 17 00:00:00 2001 From: matzakos Date: Wed, 1 Sep 2021 19:09:53 +0200 Subject: [PATCH 042/110] Add structure for ue_context_setup_response to be used for ITTI msgs between RRC<->F1 --- openair2/COMMON/f1ap_messages_def.h | 3 ++- openair2/COMMON/f1ap_messages_types.h | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/openair2/COMMON/f1ap_messages_def.h b/openair2/COMMON/f1ap_messages_def.h index 6b1c6d9495..aa4dcd581f 100644 --- a/openair2/COMMON/f1ap_messages_def.h +++ b/openair2/COMMON/f1ap_messages_def.h @@ -44,7 +44,8 @@ MESSAGE_DEF(F1AP_UE_CONTEXT_RELEASE_CMD, MESSAGE_PRIORITY_MED, f1ap_ue_context_r /* RRC -> F1AP messages */ MESSAGE_DEF(F1AP_DL_RRC_MESSAGE , MESSAGE_PRIORITY_MED, f1ap_dl_rrc_message_t , f1ap_dl_rrc_message ) //MESSAGE_DEF(F1AP_INITIAL_CONTEXT_SETUP_REQ , MESSAGE_PRIORITY_MED, f1ap_initial_context_setup_req_t , f1ap_initial_context_setup_req ) -MESSAGE_DEF(F1AP_UE_CONTEXT_SETUP_REQ, MESSAGE_PRIORITY_MED, f1ap_ue_context_setup_req_t, f1ap_ue_context_setup_req) +MESSAGE_DEF(F1AP_UE_CONTEXT_SETUP_REQ, MESSAGE_PRIORITY_MED, f1ap_ue_context_setup_req_t, f1ap_ue_context_setup_req) +MESSAGE_DEF(F1AP_UE_CONTEXT_SETUP_RESP, MESSAGE_PRIORITY_MED, f1ap_ue_context_setup_resp_t, f1ap_ue_context_setup_resp) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index 3b57619d88..865de1cb77 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -39,6 +39,7 @@ #define F1AP_INITIAL_UL_RRC_MESSAGE(mSGpTR) (mSGpTR)->ittiMsg.f1ap_initial_ul_rrc_message #define F1AP_UL_RRC_MESSAGE(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ul_rrc_message #define F1AP_UE_CONTEXT_SETUP_REQ(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ue_context_setup_req +#define F1AP_UE_CONTEXT_SETUP_RESP(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ue_context_setup_resp #define F1AP_UE_CONTEXT_RELEASE_RESP(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ue_context_release_resp #define F1AP_UE_CONTEXT_MODIFICATION_RESP(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ue_context_modification_resp #define F1AP_UE_CONTEXT_MODIFICATION_FAIL(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ue_context_modification_fail @@ -355,6 +356,18 @@ typedef struct f1ap_ue_context_setup_req_s { int rrc_container_length; } f1ap_ue_context_setup_req_t; +typedef struct f1ap_ue_context_setup_resp_s { + uint32_t gNB_CU_ue_id; // BK: need to replace by use from rnti + uint32_t gNB_DU_ue_id; + uint16_t rnti; + uint8_t du_to_cu_rrc_information[1024 /*Arbitrarily big enough*/]; + uint32_t du_to_cu_rrc_information_length; + f1ap_drb_to_be_setup_t *drbs_setup; // BK: need to replace by s1ap_initial_context_setup_req + uint8_t drbs_setup_length; // BK: need to replace by s1ap_initial_context_setup_req + f1ap_srb_to_be_setup_t *srbs_setup; + uint8_t srbs_setup_length; +} f1ap_ue_context_setup_resp_t; + typedef enum F1ap_Cause_e { F1AP_CAUSE_NOTHING, /* No components present */ F1AP_CAUSE_RADIO_NETWORK, From 7cde9f7a884af62a4a127397018c6efd21218ed6 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Thu, 2 Sep 2021 15:10:11 +0200 Subject: [PATCH 043/110] DU sends packet in UL over F1-U --- common/config/libconfig/config_libconfig.c | 4 ++-- openair2/F1AP/f1ap_du_ue_context_management.c | 2 +- openair2/GNB_APP/gnb_app.c | 2 ++ openair3/ocp-gtpu/gtp_itf.cpp | 12 +++++++----- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/common/config/libconfig/config_libconfig.c b/common/config/libconfig/config_libconfig.c index ec57b420dd..48893fb5be 100644 --- a/common/config/libconfig/config_libconfig.c +++ b/common/config/libconfig/config_libconfig.c @@ -91,7 +91,7 @@ int read_intarray(paramdef_t *cfgoptions,config_setting_t *setting, char *cfgpat -static int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) { +int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) { config_setting_t *setting; char *str; int i,u; @@ -122,7 +122,7 @@ static int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *pre switch(cfgoptions[i].type) { case TYPE_STRING: - if ( config_lookup_string(&(libconfig_privdata.cfg), cfgpath, &str)) { + if ( config_lookup_string(&(libconfig_privdata.cfg), cfgpath, (const char**)&str)) { if ( cfgoptions[i].numelt > 0 && str != NULL && strlen(str) >= cfgoptions[i].numelt ) { fprintf(stderr,"[LIBCONFIG] %s: %s exceeds maximum length of %i bytes, value truncated\n", cfgpath,str,cfgoptions[i].numelt); diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index f1a10156a4..0986b1fd90 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -153,7 +153,7 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, rnti_t ue_rnti = (f1ap_ue_context_setup_req->gNB_DU_ue_id!=NULL) ? f1ap_get_rnti_by_du_id(false, instance, *f1ap_ue_context_setup_req->gNB_DU_ue_id): f1ap_get_rnti_by_cu_id(false, instance, f1ap_ue_context_setup_req->gNB_CU_ue_id); - teid_t t=newGtpuCreateTunnel(instance, + teid_t t=newGtpuCreateTunnel(INSTANCE_DEFAULT, ue_rnti, drb_p->drb_id , drb_p->drb_id, diff --git a/openair2/GNB_APP/gnb_app.c b/openair2/GNB_APP/gnb_app.c index cd041aabe4..94b0820d08 100644 --- a/openair2/GNB_APP/gnb_app.c +++ b/openair2/GNB_APP/gnb_app.c @@ -240,6 +240,8 @@ void *gNB_app_task(void *args_p) RCconfig_NR_DU_F1(msg_p, 0); itti_send_msg_to_task (TASK_DU_F1, GNB_MODULE_ID_TO_INSTANCE(0), msg_p); + //start F1-U + RCconfig_nr_gtpu(); } } do { diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index e3dbfe0f25..f53e5d8cd6 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -139,10 +139,11 @@ static int gtpv1uCreateAndSendMsg(int h, uint32_t peerIp, uint16_t peerPort, te to.sin_addr.s_addr = peerIp ; LOG_D(GTPU,"sending packet size: %d to %s\n",fullSize, inet_ntoa(to.sin_addr) ); - if (sendto(h, (void *)buffer, (size_t)fullSize, 0,(struct sockaddr *)&to, sizeof(to) ) != fullSize ) { + int ret; + if ((ret=sendto(h, (void *)buffer, (size_t)fullSize, 0,(struct sockaddr *)&to, sizeof(to) )) != fullSize ) { LOG_E(GTPU, - "[SD %d] Failed to send data to " IPV4_ADDR " on port %d, buffer size %u\n", - h, IPV4_ADDR_FORMAT(peerIp), peerPort, fullSize); + "[SD %d] Failed to send data to " IPV4_ADDR " on port %d, buffer size %u, ret: %d, errno: %d\n", + h, IPV4_ADDR_FORMAT(peerIp), peerPort, fullSize, ret, errno); free(buffer); return GTPNOK; } @@ -390,6 +391,7 @@ instance_t ocp_gtpv1Init(openAddr_t context) { teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int incoming_bearer_id, int outgoing_bearer_id, teid_t outgoing_teid, transport_layer_addr_t remoteAddr, int port, gtpCallback callBack) { pthread_mutex_lock(&globGtp.gtp_lock); + instance=compatInst(instance); auto inst=&globGtp.instances[instance]; auto it=inst->ue2te_mapping.find(rnti); @@ -465,7 +467,7 @@ int ocp_gtpv1u_create_s1u_tunnel(instance_t instance, "From legacy code not clear, seems impossible (bearer=%d)\n", create_tunnel_req->eps_bearer_id[i]); int incoming_rb_id=create_tunnel_req->eps_bearer_id[i]-4; - teid_t teid=newGtpuCreateTunnel(compatInst(instance), create_tunnel_req->rnti, + teid_t teid=newGtpuCreateTunnel(instance, create_tunnel_req->rnti, incoming_rb_id, create_tunnel_req->eps_bearer_id[i], create_tunnel_req->sgw_S1u_teid[i], @@ -527,7 +529,7 @@ int gtpv1u_create_ngu_tunnel( const instance_t instance, create_tunnel_req->outgoing_teid[0]); for (int i = 0; i < create_tunnel_req->num_tunnels; i++) { - teid_t teid=newGtpuCreateTunnel(compatInst(instance), create_tunnel_req->rnti, + teid_t teid=newGtpuCreateTunnel(instance, create_tunnel_req->rnti, create_tunnel_req->incoming_rb_id[i], create_tunnel_req->pdusession_id[i], create_tunnel_req->outgoing_teid[i], From 7e1febcecf28e83860388b24a93ac0ee171ac0ff Mon Sep 17 00:00:00 2001 From: matzakos Date: Thu, 2 Sep 2021 19:17:03 +0200 Subject: [PATCH 044/110] Change the order of sequence of bytes in IP conversion functions used in F1AP -Now IP address appears correctly in wireshark --- openair3/UTILS/conversions.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/openair3/UTILS/conversions.h b/openair3/UTILS/conversions.h index cce89eca1c..00b650a302 100644 --- a/openair3/UTILS/conversions.h +++ b/openair3/UTILS/conversions.h @@ -400,10 +400,10 @@ do { \ #define TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(mACRO, bITsTRING) \ do { \ (bITsTRING)->buf = calloc(4, sizeof(uint8_t)); \ - (bITsTRING)->buf[0] = (mACRO) >> 24 & 0xFF; \ - (bITsTRING)->buf[1] = (mACRO) >> 16 & 0xFF; \ - (bITsTRING)->buf[2] = (mACRO) >> 8 & 0xFF; \ - (bITsTRING)->buf[3] = (mACRO) & 0xFF; \ + (bITsTRING)->buf[3] = (mACRO) >> 24 & 0xFF; \ + (bITsTRING)->buf[2] = (mACRO) >> 16 & 0xFF; \ + (bITsTRING)->buf[1] = (mACRO) >> 8 & 0xFF; \ + (bITsTRING)->buf[0] = (mACRO) & 0xFF; \ (bITsTRING)->size = 4; \ (bITsTRING)->bits_unused = 0; \ } while(0) @@ -412,10 +412,10 @@ do { \ do { \ DevCheck((bITsTRING)->size == 4, (bITsTRING)->size, 4, 0); \ DevCheck((bITsTRING)->bits_unused == 0, (bITsTRING)->bits_unused, 0, 0); \ - mACRO = ((bITsTRING)->buf[0] << 24) + \ - ((bITsTRING)->buf[1] << 16) + \ - ((bITsTRING)->buf[2] << 8) + \ - ((bITsTRING)->buf[3]); \ + mACRO = ((bITsTRING)->buf[3] << 24) + \ + ((bITsTRING)->buf[2] << 16) + \ + ((bITsTRING)->buf[1] << 8) + \ + ((bITsTRING)->buf[0]); \ } while (0) From 00a47807b1071ce3abfb83c8654dfb60c7cb53b4 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Thu, 2 Sep 2021 19:28:28 +0200 Subject: [PATCH 045/110] some progress in du ue context setup --- openair2/F1AP/f1ap_du_ue_context_management.c | 146 ++++++++++-------- openair2/GNB_APP/gnb_config.c | 4 +- openair3/ocp-gtpu/gtp_itf.cpp | 4 +- 3 files changed, 83 insertions(+), 71 deletions(-) diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 0986b1fd90..8815ecb562 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -55,78 +55,95 @@ boolean_t DURecvCb( protocol_ctxt_t *ctxt_pP, return true; } -int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, rnti_t rntiP); +int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, rnti_t rntiP, int nbTEID, teid_t * teids); int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { MessageDef *msg_p; // message to RRC F1AP_UEContextSetupRequest_t *container; - F1AP_UEContextSetupRequestIEs_t *ie; int i; DevAssert(pdu); msg_p = itti_alloc_new_message(TASK_DU_F1, 0, F1AP_UE_CONTEXT_SETUP_REQ); f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_req = &F1AP_UE_CONTEXT_SETUP_REQ(msg_p); container = &pdu->choice.initiatingMessage->value.choice.UEContextSetupRequest; /* GNB_CU_UE_F1AP_ID */ - F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container, + F1AP_UEContextSetupRequestIEs_t *ieCU; + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ieCU, container, F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true); - f1ap_ue_context_setup_req->gNB_CU_ue_id = ie->value.choice.GNB_CU_UE_F1AP_ID; + f1ap_ue_context_setup_req->gNB_CU_ue_id = ieCU->value.choice.GNB_CU_UE_F1AP_ID; /* optional */ /* GNB_DU_UE_F1AP_ID */ - F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container, + F1AP_UEContextSetupRequestIEs_t *ieDU_UE; + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ieDU_UE, container, F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, false); - if (ie) { + if (ieDU_UE) { f1ap_ue_context_setup_req->gNB_DU_ue_id = malloc(sizeof(uint32_t)); - if (f1ap_ue_context_setup_req->gNB_DU_ue_id) - *f1ap_ue_context_setup_req->gNB_DU_ue_id = ie->value.choice.GNB_DU_UE_F1AP_ID; + *f1ap_ue_context_setup_req->gNB_DU_ue_id = + ieDU_UE->value.choice.GNB_DU_UE_F1AP_ID; } else { f1ap_ue_context_setup_req->gNB_DU_ue_id = NULL; } + + if(f1ap_ue_context_setup_req->gNB_DU_ue_id!=NULL) + f1ap_ue_context_setup_req->rnti = f1ap_get_rnti_by_du_id(false, instance, *f1ap_ue_context_setup_req->gNB_DU_ue_id); + else + f1ap_ue_context_setup_req->rnti = f1ap_get_rnti_by_cu_id(false, instance, f1ap_ue_context_setup_req->gNB_CU_ue_id); + if(f1ap_ue_context_setup_req->rnti<0) + LOG_E(F1AP, "Could not retrieve UE rnti based on the CU/DU UE id \n"); + else + LOG_I(F1AP, "Retrieved rnti is: %d \n", f1ap_ue_context_setup_req->rnti); + /* SpCell_ID */ - F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container, + F1AP_UEContextSetupRequestIEs_t *ieNet; + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ieNet, container, F1AP_ProtocolIE_ID_id_SpCell_ID, true); - PLMNID_TO_MCC_MNC(&ie->value.choice.NRCGI.pLMN_Identity, + PLMNID_TO_MCC_MNC(&ieNet->value.choice.NRCGI.pLMN_Identity, f1ap_ue_context_setup_req->mcc, f1ap_ue_context_setup_req->mnc, f1ap_ue_context_setup_req->mnc_digit_length); - BIT_STRING_TO_NR_CELL_IDENTITY(&ie->value.choice.NRCGI.nRCellIdentity, f1ap_ue_context_setup_req->nr_cellid); + BIT_STRING_TO_NR_CELL_IDENTITY(&ieNet->value.choice.NRCGI.nRCellIdentity, f1ap_ue_context_setup_req->nr_cellid); /* ServCellIndex */ - F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container, + F1AP_UEContextSetupRequestIEs_t *ieCell; + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ieCell, container, F1AP_ProtocolIE_ID_id_ServCellIndex, true); - f1ap_ue_context_setup_req->servCellIndex = ie->value.choice.ServCellIndex; + f1ap_ue_context_setup_req->servCellIndex = ieCell->value.choice.ServCellIndex; /* optional */ /* CellULConfigured */ - F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container, + F1AP_UEContextSetupRequestIEs_t *ieULCell; + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ieULCell, container, F1AP_ProtocolIE_ID_id_SpCellULConfigured, false); // SpCellULConfigured - if (ie) { + if (ieULCell) { /* correct here */ f1ap_ue_context_setup_req->cellULConfigured = malloc(sizeof(uint32_t)); if (f1ap_ue_context_setup_req->cellULConfigured) - *f1ap_ue_context_setup_req->cellULConfigured = ie->value.choice.CellULConfigured; + *f1ap_ue_context_setup_req->cellULConfigured = ieULCell->value.choice.CellULConfigured; } else { f1ap_ue_context_setup_req->cellULConfigured = NULL; } + teid_t *teids=NULL; if (RC.nrrrc) { /* RRCContainer */ - F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container, + F1AP_UEContextSetupRequestIEs_t *ieDrb; + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ieDrb, container, F1AP_ProtocolIE_ID_id_DRBs_ToBeSetup_List, true); - f1ap_ue_context_setup_req->drbs_to_be_setup_length = ie->value.choice.DRBs_ToBeSetup_List.list.count; + f1ap_ue_context_setup_req->drbs_to_be_setup_length = ieDrb->value.choice.DRBs_ToBeSetup_List.list.count; f1ap_ue_context_setup_req->drbs_to_be_setup = calloc(f1ap_ue_context_setup_req->drbs_to_be_setup_length, sizeof(f1ap_drb_to_be_setup_t)); AssertFatal(f1ap_ue_context_setup_req->drbs_to_be_setup, "could not allocate memory for f1ap_ue_context_setup_req->drbs_to_be_setup\n"); + teids=malloc(f1ap_ue_context_setup_req->drbs_to_be_setup_length*sizeof(*teids)); for (i = 0; i < f1ap_ue_context_setup_req->drbs_to_be_setup_length; ++i) { f1ap_drb_to_be_setup_t *drb_p = &f1ap_ue_context_setup_req->drbs_to_be_setup[i]; F1AP_DRBs_ToBeSetup_Item_t *drbs_tobesetup_item_p; - drbs_tobesetup_item_p = &((F1AP_DRBs_ToBeSetup_ItemIEs_t *)ie->value.choice.DRBs_ToBeSetup_List.list.array[i])->value.choice.DRBs_ToBeSetup_Item; + drbs_tobesetup_item_p = &((F1AP_DRBs_ToBeSetup_ItemIEs_t *)ieDrb->value.choice.DRBs_ToBeSetup_List.list.array[i])->value.choice.DRBs_ToBeSetup_Item; drb_p->drb_id = drbs_tobesetup_item_p->dRBID; /* TODO in the following, assume only one UP UL TNL is present. * this matches/assumes OAI CU implementation, can be up to 2! */ @@ -151,9 +168,9 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, memcpy(addr.buffer, &drb_p->up_ul_tnl[0].tl_address, sizeof(drb_p->up_ul_tnl[0].tl_address)); addr.length=sizeof(drb_p->up_ul_tnl[0].tl_address)*8; rnti_t ue_rnti = (f1ap_ue_context_setup_req->gNB_DU_ue_id!=NULL) ? - f1ap_get_rnti_by_du_id(false, instance, *f1ap_ue_context_setup_req->gNB_DU_ue_id): - f1ap_get_rnti_by_cu_id(false, instance, f1ap_ue_context_setup_req->gNB_CU_ue_id); - teid_t t=newGtpuCreateTunnel(INSTANCE_DEFAULT, + f1ap_get_rnti_by_du_id(false, instance, *f1ap_ue_context_setup_req->gNB_DU_ue_id): + f1ap_get_rnti_by_cu_id(false, instance, f1ap_ue_context_setup_req->gNB_CU_ue_id); + teid_t x=newGtpuCreateTunnel(INSTANCE_DEFAULT, ue_rnti, drb_p->drb_id , drb_p->drb_id, @@ -161,11 +178,13 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, addr, 2152, DURecvCb); + teids[i]=x; } - F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container, + F1AP_UEContextSetupRequestIEs_t *ieSrb; + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ieSrb, container, F1AP_ProtocolIE_ID_id_SRBs_ToBeSetup_List, true); - f1ap_ue_context_setup_req->srbs_to_be_setup_length = ie->value.choice.SRBs_ToBeSetup_List.list.count; + f1ap_ue_context_setup_req->srbs_to_be_setup_length = ieSrb->value.choice.SRBs_ToBeSetup_List.list.count; f1ap_ue_context_setup_req->srbs_to_be_setup = calloc(f1ap_ue_context_setup_req->srbs_to_be_setup_length, sizeof(f1ap_srb_to_be_setup_t)); AssertFatal(f1ap_ue_context_setup_req->srbs_to_be_setup, @@ -174,68 +193,56 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, for (i = 0; i < f1ap_ue_context_setup_req->srbs_to_be_setup_length; ++i) { f1ap_srb_to_be_setup_t *srb_p = &f1ap_ue_context_setup_req->srbs_to_be_setup[i]; F1AP_SRBs_ToBeSetup_Item_t *srbs_tobesetup_item_p; - srbs_tobesetup_item_p = &((F1AP_SRBs_ToBeSetup_ItemIEs_t *)ie->value.choice.SRBs_ToBeSetup_List.list.array[i])->value.choice.SRBs_ToBeSetup_Item; + srbs_tobesetup_item_p = &((F1AP_SRBs_ToBeSetup_ItemIEs_t *)ieSrb->value.choice.SRBs_ToBeSetup_List.list.array[i])->value.choice.SRBs_ToBeSetup_Item; srb_p->srb_id = srbs_tobesetup_item_p->sRBID; } } /* RRCContainer */ - F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ie, container, + F1AP_UEContextSetupRequestIEs_t *ieRRC; + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ieRRC, container, F1AP_ProtocolIE_ID_id_RRCContainer, false); - if(f1ap_ue_context_setup_req->gNB_DU_ue_id!=NULL){ - f1ap_ue_context_setup_req->rnti = f1ap_get_rnti_by_du_id(false, instance, *f1ap_ue_context_setup_req->gNB_DU_ue_id); - } - else{ - f1ap_ue_context_setup_req->rnti = f1ap_get_rnti_by_cu_id(false, instance, f1ap_ue_context_setup_req->gNB_CU_ue_id); - } - - if(f1ap_ue_context_setup_req->rnti<0){ - LOG_E(F1AP, "Could not retrieve UE rnti based on the CU/DU UE id \n"); - } - else{ - LOG_I(F1AP, "Retrieved rnti is: %d \n", f1ap_ue_context_setup_req->rnti); - } - - if (ie) { + if (ieRRC) { /* correct here */ - f1ap_ue_context_setup_req->rrc_container = malloc(ie->value.choice.RRCContainer.size); - memcpy(f1ap_ue_context_setup_req->rrc_container, ie->value.choice.RRCContainer.buf, ie->value.choice.RRCContainer.size); + if ( ieRRC->value.choice.RRCContainer.size ) { + f1ap_ue_context_setup_req->rrc_container = malloc(ieRRC->value.choice.RRCContainer.size); + memcpy(f1ap_ue_context_setup_req->rrc_container, + ieRRC->value.choice.RRCContainer.buf, ieRRC->value.choice.RRCContainer.size); - - // AssertFatal(0, "check configuration, send to appropriate handler\n"); - protocol_ctxt_t ctxt; + + // AssertFatal(0, "check configuration, send to appropriate handler\n"); + protocol_ctxt_t ctxt; // decode RRC Container and act on the message type - //FIXME - //rnti_t rnti = f1ap_get_rnti_by_du_id(false, instance, du_ue_f1ap_id); - ctxt.module_id = instance; - ctxt.instance = instance; - ctxt.enb_flag = 1; - if ( ie->value.choice.RRCContainer.size ) { - mem_block_t *pdcp_pdu_p = NULL; - pdcp_pdu_p = get_free_mem_block(ie->value.choice.RRCContainer.size, __func__); - memset(pdcp_pdu_p->data, 0, ie->value.choice.RRCContainer.size); - memcpy(&pdcp_pdu_p->data[0], ie->value.choice.RRCContainer.buf, ie->value.choice.RRCContainer.size); + //FIXME + //rnti_t rnti = f1ap_get_rnti_by_du_id(false, instance, du_ue_f1ap_id); + ctxt.module_id = instance; + ctxt.instance = instance; + ctxt.enb_flag = 1; + mem_block_t *pdcp_pdu_p = get_free_mem_block(ieRRC->value.choice.RRCContainer.size, __func__); + memcpy(&pdcp_pdu_p->data[0], ieRRC->value.choice.RRCContainer.buf, ieRRC->value.choice.RRCContainer.size); /* for rfsim */ - du_rlc_data_req(&ctxt, 1, 0x00, 1, 1, 0, ie->value.choice.RRCContainer.size, pdcp_pdu_p); - - DU_send_UE_CONTEXT_SETUP_RESPONSE(instance, ctxt.rnti); + du_rlc_data_req(&ctxt, 1, 0x00, 1, 1, 0, ieRRC->value.choice.RRCContainer.size, pdcp_pdu_p); + } else { - LOG_E(F1AP, " RRCContainer in UEContextSetupRequestIEs size id 0\n"); + LOG_E(F1AP, " RRCContainer in UEContextSetupRequestIEs size id 0\n"); } } else { - LOG_E(F1AP, "can't find RRCContainer in UEContextSetupRequestIEs by id %ld \n", F1AP_ProtocolIE_ID_id_RRCContainer); + LOG_W(F1AP, "can't find RRCContainer in UEContextSetupRequestIEs by id %ld \n", F1AP_ProtocolIE_ID_id_RRCContainer); } - + DU_send_UE_CONTEXT_SETUP_RESPONSE(instance, f1ap_ue_context_setup_req->rnti, + f1ap_ue_context_setup_req->drbs_to_be_setup_length, teids); + + if (teids) + free(teids); itti_send_msg_to_task(TASK_RRC_GNB, instance, msg_p); return 0; } -//void DU_send_UE_CONTEXT_SETUP_RESPONSE(F1AP_UEContextSetupResponse_t *UEContextSetupResponse) { -int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, rnti_t rntiP) { +int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, rnti_t rntiP, int nbTEID, teid_t * teids) { F1AP_F1AP_PDU_t pdu= {0}; F1AP_UEContextSetupResponse_t *out; uint8_t *buffer=NULL; @@ -330,7 +337,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, rnti_t rntiP) { ie7->criticality = F1AP_Criticality_ignore; ie7->value.present = F1AP_UEContextSetupResponseIEs__value_PR_DRBs_Setup_List; - for (int i=0; i<1; i++) { + for (int i=0; ivalue.choice.DRBs_Setup_List.list, F1AP_DRBs_Setup_ItemIEs_t, drbs_setup_item_ies); @@ -357,10 +364,13 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, rnti_t rntiP) { asn1cCalloc(dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.choice.gTPTunnel, F1AP_GTPTunnel_t, gTPTunnel); /* transportLayerAddress */ - TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &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); + TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(addr.sin_addr.s_addr, + &gTPTunnel->transportLayerAddress); /* gTP_TEID */ - OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "1204", - strlen("1204")); + INT32_TO_OCTET_STRING(teids[i], &gTPTunnel->gTP_TEID); } // for j } // for i diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index e65566a752..18bc0503eb 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -1663,7 +1663,9 @@ int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) { //strcpy(F1AP_SETUP_REQ (msg_p).CU_f1_ip_address.ipv6_address, ""); strcpy(F1AP_SETUP_REQ (msg_p).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 %d\n",F1AP_SETUP_REQ (msg_p).DU_f1_ip_address.ipv4_address,(int)strlen(RC.nrmac[k]->eth_params_n.my_addr)); + LOG_I(GNB_APP,"FIAP: DU_ip4_address in DU %p, strlen %ld\n", + F1AP_SETUP_REQ (msg_p).DU_f1_ip_address.ipv4_address, + strlen(RC.nrmac[k]->eth_params_n.my_addr)); F1AP_SETUP_REQ (msg_p).DU_f1_ip_address.ipv6 = 0; F1AP_SETUP_REQ (msg_p).DU_f1_ip_address.ipv4 = 1; //strcpy(F1AP_SETUP_REQ (msg_p).DU_f1_ip_address.ipv6_address, ""); diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index f53e5d8cd6..b78fd72f50 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -86,7 +86,7 @@ class gtpEndPoints { gtpEndPoints globGtp; // note TEid 0 is reserved for specific usage: echo req/resp, error and supported extensions -static uint32_t gtpv1uNewTeid(void) { +static teid_t gtpv1uNewTeid(void) { #ifdef GTPV1U_LINEAR_TEID_ALLOCATION g_gtpv1u_teid = g_gtpv1u_teid + 1; return g_gtpv1u_teid; @@ -400,7 +400,7 @@ teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int incoming_bearer inst->ue2te_mapping.erase(it); } - uint32_t incoming_teid=gtpv1uNewTeid(); + teid_t incoming_teid=gtpv1uNewTeid(); while ( inst->te2ue_mapping.find(incoming_teid) != inst->te2ue_mapping.end() ) { LOG_W(GTPU, "generated a random Teid that exists, re-generating (%x)\n",incoming_teid); From 7fab01472edbeca24b79c596de476c9c1043c0d5 Mon Sep 17 00:00:00 2001 From: matzakos Date: Fri, 3 Sep 2021 11:17:48 +0200 Subject: [PATCH 046/110] Preliminary work to handle UE context setup response at F1AP layer of the CU -Remaining to handle the incoming information at RRC layer of the CU as well --- openair2/COMMON/f1ap_messages_types.h | 11 +++ openair2/F1AP/f1ap_cu_ue_context_management.c | 86 +++++++++++++++++++ openair2/F1AP/f1ap_du_ue_context_management.c | 61 ++++++------- openair2/RRC/NR/rrc_gNB.c | 6 +- 4 files changed, 134 insertions(+), 30 deletions(-) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index 865de1cb77..c486ceec93 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -324,14 +324,21 @@ typedef struct f1ap_drb_to_be_setup_s { long drb_id; f1ap_up_tnl_t up_ul_tnl[2]; uint8_t up_ul_tnl_length; + f1ap_up_tnl_t up_dl_tnl[2]; + uint8_t up_dl_tnl_length; rlc_mode_t rlc_mode; } f1ap_drb_to_be_setup_t; typedef struct f1ap_srb_to_be_setup_s { long srb_id; rlc_mode_t rlc_mode; + uint8_t lcid; } f1ap_srb_to_be_setup_t; +typedef struct f1ap_rb_failed_to_be_setup_s { + long rb_id; +} f1ap_rb_failed_to_be_setup_t; + typedef struct f1ap_ue_context_setup_req_s { uint32_t gNB_CU_ue_id; // BK: need to replace by use from rnti uint32_t *gNB_DU_ue_id; @@ -366,6 +373,10 @@ typedef struct f1ap_ue_context_setup_resp_s { uint8_t drbs_setup_length; // BK: need to replace by s1ap_initial_context_setup_req f1ap_srb_to_be_setup_t *srbs_setup; uint8_t srbs_setup_length; + uint8_t srbs_failed_to_be_setup_length; + f1ap_rb_failed_to_be_setup_t *srbs_failed_to_be_setup; + uint8_t drbs_failed_to_be_setup_length; + f1ap_rb_failed_to_be_setup_t *drbs_failed_to_be_setup; } f1ap_ue_context_setup_resp_t; typedef enum F1ap_Cause_e { diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 2eaa4a1edd..12e08c644e 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -625,31 +625,117 @@ int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { + MessageDef *msg_p; F1AP_UEContextSetupResponse_t *container; F1AP_UEContextSetupResponseIEs_t *ie; DevAssert(pdu); + msg_p = itti_alloc_new_message(TASK_DU_F1, 0, F1AP_UE_CONTEXT_SETUP_RESP); + f1ap_ue_context_setup_resp_t *f1ap_ue_context_setup_resp = &F1AP_UE_CONTEXT_SETUP_RESP(msg_p); container = &pdu->choice.successfulOutcome->value.choice.UEContextSetupResponse; + int i; + /* GNB_CU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true); + f1ap_ue_context_setup_resp->gNB_CU_ue_id = ie->value.choice.GNB_CU_UE_F1AP_ID; + /* GNB_DU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true); + f1ap_ue_context_setup_resp->gNB_DU_ue_id = ie->value.choice.GNB_DU_UE_F1AP_ID; + /* DUtoCURRCInformation */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, F1AP_ProtocolIE_ID_id_DUtoCURRCInformation, true); + if (ie == NULL){ + LOG_E(F1AP,"%s %d: ie is a NULL pointer \n",__FILE__,__LINE__); + return -1; + } + memcpy(f1ap_ue_context_setup_resp->du_to_cu_rrc_information, ie->value.choice.DUtoCURRCInformation.cellGroupConfig.buf, ie->value.choice.DUtoCURRCInformation.cellGroupConfig.size); + f1ap_ue_context_setup_resp->du_to_cu_rrc_information_length = ie->value.choice.DUtoCURRCInformation.cellGroupConfig.size; + /* DRBs_Setup_List */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, F1AP_ProtocolIE_ID_id_DRBs_Setup_List, true); + if(ie!=NULL){ + f1ap_ue_context_setup_resp->drbs_setup_length = ie->value.choice.DRBs_Setup_List.list.count; + f1ap_ue_context_setup_resp->drbs_setup = calloc(f1ap_ue_context_setup_resp->drbs_setup_length, + sizeof(f1ap_drb_to_be_setup_t)); + AssertFatal(f1ap_ue_context_setup_resp->drbs_setup, + "could not allocate memory for f1ap_ue_context_setup_resp->drbs_setup\n"); + for (i = 0; i < f1ap_ue_context_setup_resp->drbs_setup_length; ++i) { + f1ap_drb_to_be_setup_t *drb_p = &f1ap_ue_context_setup_resp->drbs_setup[i]; + F1AP_DRBs_Setup_Item_t *drbs_setup_item_p; + drbs_setup_item_p = &((F1AP_DRBs_Setup_ItemIEs_t *)ie->value.choice.DRBs_Setup_List.list.array[i])->value.choice.DRBs_Setup_Item; + drb_p->drb_id = drbs_setup_item_p->dRBID; + /* TODO in the following, assume only one UP UL TNL is present. + * this matches/assumes OAI CU/DU implementation, can be up to 2! */ + drb_p->up_dl_tnl_length = 1; + AssertFatal(drbs_setup_item_p->dLUPTNLInformation_ToBeSetup_List.list.count > 0, + "no DL UP TNL Information in DRBs to be Setup list\n"); + F1AP_DLUPTNLInformation_ToBeSetup_Item_t *dl_up_tnl_info_p = (F1AP_DLUPTNLInformation_ToBeSetup_Item_t *)drbs_setup_item_p->dLUPTNLInformation_ToBeSetup_List.list.array[0]; + 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_INT32(&dl_up_tnl0->gTP_TEID, drb_p->up_dl_tnl[0].gtp_teid); + + } + } /* SRBs_FailedToBeSetup_List */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, F1AP_ProtocolIE_ID_id_SRBs_FailedToBeSetup_List, true); + if(ie!=NULL){ + f1ap_ue_context_setup_resp->srbs_failed_to_be_setup_length = ie->value.choice.SRBs_FailedToBeSetup_List.list.count; + f1ap_ue_context_setup_resp->srbs_failed_to_be_setup = calloc(f1ap_ue_context_setup_resp->srbs_failed_to_be_setup_length, + sizeof(f1ap_rb_failed_to_be_setup_t)); + AssertFatal(f1ap_ue_context_setup_resp->srbs_failed_to_be_setup, + "could not allocate memory for f1ap_ue_context_setup_resp->srbs_failed_to_be_setup\n"); + for (i = 0; i < f1ap_ue_context_setup_resp->srbs_failed_to_be_setup_length; ++i) { + f1ap_rb_failed_to_be_setup_t *srb_p = &f1ap_ue_context_setup_resp->srbs_failed_to_be_setup[i]; + srb_p->rb_id = ((F1AP_SRBs_FailedToBeSetup_Item_t *)ie->value.choice.SRBs_FailedToBeSetup_List.list.array[i])->sRBID; + } + + } /* DRBs_FailedToBeSetup_List */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, F1AP_ProtocolIE_ID_id_DRBs_FailedToBeSetup_List, true); + if(ie!=NULL){ + f1ap_ue_context_setup_resp->drbs_failed_to_be_setup_length = ie->value.choice.DRBs_FailedToBeSetup_List.list.count; + f1ap_ue_context_setup_resp->drbs_failed_to_be_setup = calloc(f1ap_ue_context_setup_resp->drbs_failed_to_be_setup_length, + sizeof(f1ap_rb_failed_to_be_setup_t)); + AssertFatal(f1ap_ue_context_setup_resp->drbs_failed_to_be_setup, + "could not allocate memory for f1ap_ue_context_setup_resp->drbs_failed_to_be_setup\n"); + for (i = 0; i < f1ap_ue_context_setup_resp->drbs_failed_to_be_setup_length; ++i) { + f1ap_rb_failed_to_be_setup_t *drb_p = &f1ap_ue_context_setup_resp->drbs_failed_to_be_setup[i]; + drb_p->rb_id = ((F1AP_DRBs_FailedToBeSetup_Item_t *)ie->value.choice.DRBs_FailedToBeSetup_List.list.array[i])->dRBID; + } + } + /* SCell_FailedtoSetup_List */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, F1AP_ProtocolIE_ID_id_SCell_FailedtoSetup_List, true); + if(ie!=NULL){ + LOG_E (F1AP, "Not supporting handling of SCell_FailedtoSetup_List \n"); + } + + /* SRBs_Setup_List */ + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, + F1AP_ProtocolIE_ID_id_SRBs_Setup_List, true); + if(ie!=NULL){ + f1ap_ue_context_setup_resp->srbs_setup_length = ie->value.choice.SRBs_Setup_List.list.count; + f1ap_ue_context_setup_resp->srbs_setup = calloc(f1ap_ue_context_setup_resp->srbs_setup_length, + sizeof(f1ap_srb_to_be_setup_t)); + AssertFatal(f1ap_ue_context_setup_resp->drbs_setup, + "could not allocate memory for f1ap_ue_context_setup_resp->drbs_setup\n"); + for (i = 0; i < f1ap_ue_context_setup_resp->srbs_setup_length; ++i) { + f1ap_srb_to_be_setup_t *srb_p = &f1ap_ue_context_setup_resp->srbs_setup[i]; + F1AP_SRBs_Setup_Item_t *srbs_setup_item_p; + srbs_setup_item_p = &((F1AP_SRBs_Setup_ItemIEs_t *)ie->value.choice.SRBs_Setup_List.list.array[i])->value.choice.SRBs_Setup_Item; + srb_p->srb_id = srbs_setup_item_p->sRBID; + srb_p->lcid = srbs_setup_item_p->lCID; + } + } + + itti_send_msg_to_task(TASK_RRC_GNB, instance, msg_p); return 0; } diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 8815ecb562..10ff9e9edf 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -133,33 +133,33 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, F1AP_UEContextSetupRequestIEs_t *ieDrb; F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ieDrb, container, F1AP_ProtocolIE_ID_id_DRBs_ToBeSetup_List, true); - f1ap_ue_context_setup_req->drbs_to_be_setup_length = ieDrb->value.choice.DRBs_ToBeSetup_List.list.count; - f1ap_ue_context_setup_req->drbs_to_be_setup = calloc(f1ap_ue_context_setup_req->drbs_to_be_setup_length, + if(ieDrb!=NULL){ + f1ap_ue_context_setup_req->drbs_to_be_setup_length = ieDrb->value.choice.DRBs_ToBeSetup_List.list.count; + f1ap_ue_context_setup_req->drbs_to_be_setup = calloc(f1ap_ue_context_setup_req->drbs_to_be_setup_length, sizeof(f1ap_drb_to_be_setup_t)); - AssertFatal(f1ap_ue_context_setup_req->drbs_to_be_setup, + AssertFatal(f1ap_ue_context_setup_req->drbs_to_be_setup, "could not allocate memory for f1ap_ue_context_setup_req->drbs_to_be_setup\n"); - teids=malloc(f1ap_ue_context_setup_req->drbs_to_be_setup_length*sizeof(*teids)); - for (i = 0; i < f1ap_ue_context_setup_req->drbs_to_be_setup_length; ++i) { - f1ap_drb_to_be_setup_t *drb_p = &f1ap_ue_context_setup_req->drbs_to_be_setup[i]; - F1AP_DRBs_ToBeSetup_Item_t *drbs_tobesetup_item_p; - drbs_tobesetup_item_p = &((F1AP_DRBs_ToBeSetup_ItemIEs_t *)ieDrb->value.choice.DRBs_ToBeSetup_List.list.array[i])->value.choice.DRBs_ToBeSetup_Item; - drb_p->drb_id = drbs_tobesetup_item_p->dRBID; - /* TODO in the following, assume only one UP UL TNL is present. - * this matches/assumes OAI CU implementation, can be up to 2! */ - drb_p->up_ul_tnl_length = 1; - AssertFatal(drbs_tobesetup_item_p->uLUPTNLInformation_ToBeSetup_List.list.count > 0, + teids=malloc(f1ap_ue_context_setup_req->drbs_to_be_setup_length*sizeof(*teids)); + for (i = 0; i < f1ap_ue_context_setup_req->drbs_to_be_setup_length; ++i) { + f1ap_drb_to_be_setup_t *drb_p = &f1ap_ue_context_setup_req->drbs_to_be_setup[i]; + F1AP_DRBs_ToBeSetup_Item_t *drbs_tobesetup_item_p; + drbs_tobesetup_item_p = &((F1AP_DRBs_ToBeSetup_ItemIEs_t *)ieDrb->value.choice.DRBs_ToBeSetup_List.list.array[i])->value.choice.DRBs_ToBeSetup_Item; + drb_p->drb_id = drbs_tobesetup_item_p->dRBID; + /* TODO in the following, assume only one UP UL TNL is present. + * this matches/assumes OAI CU implementation, can be up to 2! */ + drb_p->up_ul_tnl_length = 1; + AssertFatal(drbs_tobesetup_item_p->uLUPTNLInformation_ToBeSetup_List.list.count > 0, "no UL UP TNL Information in DRBs to be Setup list\n"); - F1AP_ULUPTNLInformation_ToBeSetup_Item_t *ul_up_tnl_info_p = (F1AP_ULUPTNLInformation_ToBeSetup_Item_t *)drbs_tobesetup_item_p->uLUPTNLInformation_ToBeSetup_List.list.array[0]; - F1AP_GTPTunnel_t *ul_up_tnl0 = ul_up_tnl_info_p->uLUPTNLInformation.choice.gTPTunnel; - BIT_STRING_TO_TRANSPORT_LAYER_ADDRESS_IPv4(&ul_up_tnl0->transportLayerAddress, drb_p->up_ul_tnl[0].tl_address); - OCTET_STRING_TO_INT32(&ul_up_tnl0->gTP_TEID, drb_p->up_ul_tnl[0].gtp_teid); + F1AP_ULUPTNLInformation_ToBeSetup_Item_t *ul_up_tnl_info_p = (F1AP_ULUPTNLInformation_ToBeSetup_Item_t *)drbs_tobesetup_item_p->uLUPTNLInformation_ToBeSetup_List.list.array[0]; + F1AP_GTPTunnel_t *ul_up_tnl0 = ul_up_tnl_info_p->uLUPTNLInformation.choice.gTPTunnel; + BIT_STRING_TO_TRANSPORT_LAYER_ADDRESS_IPv4(&ul_up_tnl0->transportLayerAddress, drb_p->up_ul_tnl[0].tl_address); + OCTET_STRING_TO_INT32(&ul_up_tnl0->gTP_TEID, drb_p->up_ul_tnl[0].gtp_teid); - switch (drbs_tobesetup_item_p->rLCMode) { - case F1AP_RLCMode_rlc_am: - drb_p->rlc_mode = RLC_MODE_AM; + switch (drbs_tobesetup_item_p->rLCMode) { + case F1AP_RLCMode_rlc_am: + drb_p->rlc_mode = RLC_MODE_AM; break; - default: drb_p->rlc_mode = RLC_MODE_TM; break; @@ -180,21 +180,24 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, DURecvCb); teids[i]=x; + } } F1AP_UEContextSetupRequestIEs_t *ieSrb; F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ieSrb, container, F1AP_ProtocolIE_ID_id_SRBs_ToBeSetup_List, true); - f1ap_ue_context_setup_req->srbs_to_be_setup_length = ieSrb->value.choice.SRBs_ToBeSetup_List.list.count; - f1ap_ue_context_setup_req->srbs_to_be_setup = calloc(f1ap_ue_context_setup_req->srbs_to_be_setup_length, + if(ieSrb != NULL){ + f1ap_ue_context_setup_req->srbs_to_be_setup_length = ieSrb->value.choice.SRBs_ToBeSetup_List.list.count; + f1ap_ue_context_setup_req->srbs_to_be_setup = calloc(f1ap_ue_context_setup_req->srbs_to_be_setup_length, sizeof(f1ap_srb_to_be_setup_t)); - AssertFatal(f1ap_ue_context_setup_req->srbs_to_be_setup, + AssertFatal(f1ap_ue_context_setup_req->srbs_to_be_setup, "could not allocate memory for f1ap_ue_context_setup_req->srbs_to_be_setup\n"); - for (i = 0; i < f1ap_ue_context_setup_req->srbs_to_be_setup_length; ++i) { - f1ap_srb_to_be_setup_t *srb_p = &f1ap_ue_context_setup_req->srbs_to_be_setup[i]; - F1AP_SRBs_ToBeSetup_Item_t *srbs_tobesetup_item_p; - srbs_tobesetup_item_p = &((F1AP_SRBs_ToBeSetup_ItemIEs_t *)ieSrb->value.choice.SRBs_ToBeSetup_List.list.array[i])->value.choice.SRBs_ToBeSetup_Item; - srb_p->srb_id = srbs_tobesetup_item_p->sRBID; + for (i = 0; i < f1ap_ue_context_setup_req->srbs_to_be_setup_length; ++i) { + f1ap_srb_to_be_setup_t *srb_p = &f1ap_ue_context_setup_req->srbs_to_be_setup[i]; + F1AP_SRBs_ToBeSetup_Item_t *srbs_tobesetup_item_p; + srbs_tobesetup_item_p = &((F1AP_SRBs_ToBeSetup_ItemIEs_t *)ieSrb->value.choice.SRBs_ToBeSetup_List.list.array[i])->value.choice.SRBs_ToBeSetup_Item; + srb_p->srb_id = srbs_tobesetup_item_p->sRBID; + } } } diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 992855f9d7..1995715e24 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -1365,7 +1365,7 @@ rrc_gNB_process_RRCReconfigurationComplete( /* Here the callback function used as input is not the right one. Need to create a new one probably for F1-U, not sure * if the kind of input parameters to the callback function are convenient though for gtp-u over F1-U.*/ - ue_context_pP->ue_context.incoming_teid[i] = newGtpuCreateTunnel(0, create_tunnel_req.rnti, + ue_context_pP->ue_context.incoming_teid[i] = newGtpuCreateTunnel(INSTANCE_DEFAULT, create_tunnel_req.rnti, create_tunnel_req.incoming_rb_id[i], create_tunnel_req.incoming_rb_id[i], create_tunnel_req.outgoing_teid[i], @@ -3671,6 +3671,10 @@ void *rrc_gnb_task(void *args_p) { rrc_DU_process_ue_context_setup_request(msg_p, msg_name_p, instance); break; + case F1AP_UE_CONTEXT_SETUP_RESP: + LOG_W(NR_RRC, "Handling of F1 UE context setup response context at the RRC layer of the CU is pending \n"); + break; + /* Messages from X2AP */ case X2AP_ENDC_SGNB_ADDITION_REQ: LOG_I(NR_RRC, "Received ENDC sgNB addition request from X2AP \n"); From 14775c9dd2b65b8522ea1413576c32dbf49afe72 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Fri, 3 Sep 2021 13:51:17 +0200 Subject: [PATCH 047/110] partial coding ue context setup resp --- openair2/COMMON/f1ap_messages_types.h | 9 +-- openair2/F1AP/f1ap_cu_ue_context_management.c | 9 +-- openair2/F1AP/f1ap_du_ue_context_management.c | 70 ++++++++----------- openair2/RRC/NR/rrc_gNB.c | 6 +- 4 files changed, 42 insertions(+), 52 deletions(-) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index 865de1cb77..32f9913cbc 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -317,13 +317,14 @@ typedef struct f1ap_ul_rrc_message_s { typedef struct f1ap_up_tnl_s { in_addr_t tl_address; // currently only IPv4 supported - uint32_t gtp_teid; + teid_t outgoingTeid; + teid_t incomingTeid; } f1ap_up_tnl_t; typedef struct f1ap_drb_to_be_setup_s { long drb_id; - f1ap_up_tnl_t up_ul_tnl[2]; - uint8_t up_ul_tnl_length; + f1ap_up_tnl_t tnl[2]; + uint8_t tnl_length; rlc_mode_t rlc_mode; } f1ap_drb_to_be_setup_t; @@ -334,7 +335,7 @@ typedef struct f1ap_srb_to_be_setup_s { typedef struct f1ap_ue_context_setup_req_s { uint32_t gNB_CU_ue_id; // BK: need to replace by use from rnti - uint32_t *gNB_DU_ue_id; + uint32_t gNB_DU_ue_id; uint16_t rnti; // SpCell Info uint16_t mcc; diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 2eaa4a1edd..155a28b24a 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -509,8 +509,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, } // if some_decide_qos /* 12.1.3 uLUPTNLInformation_ToBeSetup_List */ - for (int j = 0; j < f1ap_ue_context_setup_req->drbs_to_be_setup[i].up_ul_tnl_length; j++) { - f1ap_up_tnl_t *up_tnl = &f1ap_ue_context_setup_req->drbs_to_be_setup[i].up_ul_tnl[j]; + for (int j = 0; j < f1ap_ue_context_setup_req->drbs_to_be_setup[i].tnl_length; j++) { /* 12.3.1 ULTunnels_ToBeSetup_Item */ asn1cSequenceAdd(drbs_toBeSetup_item->uLUPTNLInformation_ToBeSetup_List.list, F1AP_ULUPTNLInformation_ToBeSetup_Item_t, uLUPTNLInformation_ToBeSetup_Item); @@ -518,9 +517,11 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, asn1cCalloc( uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.choice.gTPTunnel, F1AP_GTPTunnel_t, gTPTunnel); /* 12.3.1.1.1 transportLayerAddress */ - TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(up_tnl->tl_address, &gTPTunnel->transportLayerAddress); + TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(f1ap_ue_context_setup_req->drbs_to_be_setup[i].tnl[j].tl_address, + &gTPTunnel->transportLayerAddress); /* 12.3.1.1.2 gTP_TEID */ - INT32_TO_OCTET_STRING(up_tnl->gtp_teid, &gTPTunnel->gTP_TEID); + INT32_TO_OCTET_STRING(f1ap_ue_context_setup_req->drbs_to_be_setup[i].tnl[j].outgoingTeid, + &gTPTunnel->gTP_TEID); } /* 12.1.4 rLCMode */ diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 8815ecb562..eda970dbe0 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -55,7 +55,7 @@ boolean_t DURecvCb( protocol_ctxt_t *ctxt_pP, return true; } -int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, rnti_t rntiP, int nbTEID, teid_t * teids); +int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup_req_t * req); int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, uint32_t assoc_id, uint32_t stream, @@ -79,19 +79,16 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, false); if (ieDU_UE) { - f1ap_ue_context_setup_req->gNB_DU_ue_id = malloc(sizeof(uint32_t)); - if (f1ap_ue_context_setup_req->gNB_DU_ue_id) - *f1ap_ue_context_setup_req->gNB_DU_ue_id = + f1ap_ue_context_setup_req->gNB_DU_ue_id = ieDU_UE->value.choice.GNB_DU_UE_F1AP_ID; + f1ap_ue_context_setup_req->rnti = + f1ap_get_rnti_by_du_id(false, instance, f1ap_ue_context_setup_req->gNB_DU_ue_id); } else { - f1ap_ue_context_setup_req->gNB_DU_ue_id = NULL; + f1ap_ue_context_setup_req->gNB_DU_ue_id = -1; + f1ap_ue_context_setup_req->rnti = + f1ap_get_rnti_by_cu_id(false, instance, f1ap_ue_context_setup_req->gNB_CU_ue_id); } - - if(f1ap_ue_context_setup_req->gNB_DU_ue_id!=NULL) - f1ap_ue_context_setup_req->rnti = f1ap_get_rnti_by_du_id(false, instance, *f1ap_ue_context_setup_req->gNB_DU_ue_id); - else - f1ap_ue_context_setup_req->rnti = f1ap_get_rnti_by_cu_id(false, instance, f1ap_ue_context_setup_req->gNB_CU_ue_id); - + if(f1ap_ue_context_setup_req->rnti<0) LOG_E(F1AP, "Could not retrieve UE rnti based on the CU/DU UE id \n"); else @@ -127,7 +124,6 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, f1ap_ue_context_setup_req->cellULConfigured = NULL; } - teid_t *teids=NULL; if (RC.nrrrc) { /* RRCContainer */ F1AP_UEContextSetupRequestIEs_t *ieDrb; @@ -139,21 +135,20 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, AssertFatal(f1ap_ue_context_setup_req->drbs_to_be_setup, "could not allocate memory for f1ap_ue_context_setup_req->drbs_to_be_setup\n"); - teids=malloc(f1ap_ue_context_setup_req->drbs_to_be_setup_length*sizeof(*teids)); for (i = 0; i < f1ap_ue_context_setup_req->drbs_to_be_setup_length; ++i) { f1ap_drb_to_be_setup_t *drb_p = &f1ap_ue_context_setup_req->drbs_to_be_setup[i]; - F1AP_DRBs_ToBeSetup_Item_t *drbs_tobesetup_item_p; - drbs_tobesetup_item_p = &((F1AP_DRBs_ToBeSetup_ItemIEs_t *)ieDrb->value.choice.DRBs_ToBeSetup_List.list.array[i])->value.choice.DRBs_ToBeSetup_Item; + F1AP_DRBs_ToBeSetup_Item_t *drbs_tobesetup_item_p = + &((F1AP_DRBs_ToBeSetup_ItemIEs_t *)ieDrb->value.choice.DRBs_ToBeSetup_List.list.array[i])->value.choice.DRBs_ToBeSetup_Item; drb_p->drb_id = drbs_tobesetup_item_p->dRBID; /* TODO in the following, assume only one UP UL TNL is present. * this matches/assumes OAI CU implementation, can be up to 2! */ - drb_p->up_ul_tnl_length = 1; + drb_p->tnl_length = 1; AssertFatal(drbs_tobesetup_item_p->uLUPTNLInformation_ToBeSetup_List.list.count > 0, "no UL UP TNL Information in DRBs to be Setup list\n"); F1AP_ULUPTNLInformation_ToBeSetup_Item_t *ul_up_tnl_info_p = (F1AP_ULUPTNLInformation_ToBeSetup_Item_t *)drbs_tobesetup_item_p->uLUPTNLInformation_ToBeSetup_List.list.array[0]; F1AP_GTPTunnel_t *ul_up_tnl0 = ul_up_tnl_info_p->uLUPTNLInformation.choice.gTPTunnel; - BIT_STRING_TO_TRANSPORT_LAYER_ADDRESS_IPv4(&ul_up_tnl0->transportLayerAddress, drb_p->up_ul_tnl[0].tl_address); - OCTET_STRING_TO_INT32(&ul_up_tnl0->gTP_TEID, drb_p->up_ul_tnl[0].gtp_teid); + BIT_STRING_TO_TRANSPORT_LAYER_ADDRESS_IPv4(&ul_up_tnl0->transportLayerAddress, drb_p->tnl[0].tl_address); + OCTET_STRING_TO_INT32(&ul_up_tnl0->gTP_TEID, drb_p->tnl[0].outgoingTeid); switch (drbs_tobesetup_item_p->rLCMode) { case F1AP_RLCMode_rlc_am: @@ -165,21 +160,16 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, break; } transport_layer_addr_t addr; - memcpy(addr.buffer, &drb_p->up_ul_tnl[0].tl_address, sizeof(drb_p->up_ul_tnl[0].tl_address)); - addr.length=sizeof(drb_p->up_ul_tnl[0].tl_address)*8; - rnti_t ue_rnti = (f1ap_ue_context_setup_req->gNB_DU_ue_id!=NULL) ? - f1ap_get_rnti_by_du_id(false, instance, *f1ap_ue_context_setup_req->gNB_DU_ue_id): - f1ap_get_rnti_by_cu_id(false, instance, f1ap_ue_context_setup_req->gNB_CU_ue_id); - teid_t x=newGtpuCreateTunnel(INSTANCE_DEFAULT, - ue_rnti, + memcpy(addr.buffer, &drb_p->tnl[0].tl_address, sizeof(drb_p->tnl[0].tl_address)); + addr.length=sizeof(drb_p->tnl[0].tl_address)*8; + drb_p->tnl[0].incomingTeid=newGtpuCreateTunnel(INSTANCE_DEFAULT, + f1ap_ue_context_setup_req->rnti, drb_p->drb_id , drb_p->drb_id, - drb_p->up_ul_tnl[0].gtp_teid, + drb_p->tnl[0].outgoingTeid, addr, 2152, DURecvCb); - teids[i]=x; - } F1AP_UEContextSetupRequestIEs_t *ieSrb; F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ieSrb, container, @@ -231,18 +221,14 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, LOG_W(F1AP, "can't find RRCContainer in UEContextSetupRequestIEs by id %ld \n", F1AP_ProtocolIE_ID_id_RRCContainer); } - DU_send_UE_CONTEXT_SETUP_RESPONSE(instance, f1ap_ue_context_setup_req->rnti, - f1ap_ue_context_setup_req->drbs_to_be_setup_length, teids); - - if (teids) - free(teids); + DU_send_UE_CONTEXT_SETUP_RESPONSE(instance, f1ap_ue_context_setup_req); itti_send_msg_to_task(TASK_RRC_GNB, instance, msg_p); return 0; } -int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, rnti_t rntiP, int nbTEID, teid_t * teids) { +int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup_req_t * req) { F1AP_F1AP_PDU_t pdu= {0}; F1AP_UEContextSetupResponse_t *out; uint8_t *buffer=NULL; @@ -261,16 +247,17 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, rnti_t rntiP, int nbT ie1->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; ie1->criticality = F1AP_Criticality_reject; ie1->value.present = F1AP_UEContextSetupResponseIEs__value_PR_GNB_CU_UE_F1AP_ID; - ie1->value.choice.GNB_CU_UE_F1AP_ID = 126L; + ie1->value.choice.GNB_CU_UE_F1AP_ID = req->gNB_CU_ue_id; /* mandatory */ /* c2. GNB_DU_UE_F1AP_ID */ asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie2); ie2->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; ie2->criticality = F1AP_Criticality_reject; ie2->value.present = F1AP_UEContextSetupResponseIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie2->value.choice.GNB_DU_UE_F1AP_ID = 651L; + ie2->value.choice.GNB_DU_UE_F1AP_ID = req->gNB_DU_ue_id; /* mandatory */ /* c3. DUtoCURRCInformation */ + if (0) { asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie3); ie3->id = F1AP_ProtocolIE_ID_id_DUtoCURRCInformation; ie3->criticality = F1AP_Criticality_reject; @@ -296,6 +283,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, rnti_t rntiP, int nbT OCTET_STRING_fromBuf(tmp, "asdsa", strlen("asdsa")); } } + } /* optional */ /* c4. C_RNTI */ @@ -305,7 +293,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, rnti_t rntiP, int nbT ie4->criticality = F1AP_Criticality_ignore; ie4->value.present = F1AP_UEContextSetupResponseIEs__value_PR_C_RNTI; //C_RNTI_TO_BIT_STRING(rntiP, &ie->value.choice.C_RNTI); - ie4->value.choice.C_RNTI=rntiP; + ie4->value.choice.C_RNTI=req->rnti; LOG_E(F1AP,"RNTI to code!\n"); } @@ -337,7 +325,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, rnti_t rntiP, int nbT ie7->criticality = F1AP_Criticality_ignore; ie7->value.present = F1AP_UEContextSetupResponseIEs__value_PR_DRBs_Setup_List; - for (int i=0; idrbs_to_be_setup_length; i++) { // asn1cSequenceAdd(ie7->value.choice.DRBs_Setup_List.list, F1AP_DRBs_Setup_ItemIEs_t, drbs_setup_item_ies); @@ -348,14 +336,14 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, rnti_t rntiP, int nbT /* ADD */ F1AP_DRBs_Setup_Item_t *drbs_setup_item=&drbs_setup_item_ies->value.choice.DRBs_Setup_Item; /* dRBID */ - drbs_setup_item->dRBID = 12; + drbs_setup_item->dRBID = req->drbs_to_be_setup[i].drb_id; /* OPTIONAL */ /* lCID */ //drbs_setup_item.lCID = (F1AP_LCID_t *)calloc(1, sizeof(F1AP_LCID_t)); //drbs_setup_item.lCID = 1L; - for (int j=0; j<1; j++) { + for (int j=0; jdrbs_to_be_setup[i].tnl_length; j++) { /* ADD */ asn1cSequenceAdd(drbs_setup_item->dLUPTNLInformation_ToBeSetup_List.list, F1AP_DLUPTNLInformation_ToBeSetup_Item_t, dLUPTNLInformation_ToBeSetup_Item); @@ -370,7 +358,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, rnti_t rntiP, int nbT TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(addr.sin_addr.s_addr, &gTPTunnel->transportLayerAddress); /* gTP_TEID */ - INT32_TO_OCTET_STRING(teids[i], &gTPTunnel->gTP_TEID); + INT32_TO_OCTET_STRING(req->drbs_to_be_setup[i].tnl[j].incomingTeid, &gTPTunnel->gTP_TEID); } // for j } // for i diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 992855f9d7..f3a7ab567f 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -1374,9 +1374,9 @@ rrc_gNB_process_RRCReconfigurationComplete( F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].drb_id = DRB_configList->list.array[i]->drb_Identity; F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].rlc_mode = RLC_MODE_AM; - F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].up_ul_tnl[0].gtp_teid = ue_context_pP->ue_context.incoming_teid[i]; - F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].up_ul_tnl[0].tl_address = inet_addr(rrc->eth_params_s.my_addr); - F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].up_ul_tnl_length = 1; + F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].tnl[0].incomingTeid = ue_context_pP->ue_context.incoming_teid[i]; + F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].tnl[0].tl_address = inet_addr(rrc->eth_params_s.my_addr); + F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].tnl_length = 1; } F1AP_UE_CONTEXT_SETUP_REQ (message_p).gNB_CU_ue_id = 0; F1AP_UE_CONTEXT_SETUP_REQ (message_p).gNB_DU_ue_id = 0; From 842bf6e346eb4bd3dd0a02ebb2d1f285d5c6fc53 Mon Sep 17 00:00:00 2001 From: matzakos Date: Mon, 6 Sep 2021 14:44:53 +0200 Subject: [PATCH 048/110] Add rrc handling for F1 UE context setup response message at the CU and gtp-u tunnel update functionality -Remains to be tested --- openair2/RRC/NR/rrc_gNB.c | 52 +++++++++++++++++++++++++++++++++++ openair3/ocp-gtpu/gtp_itf.cpp | 19 +++++++++++++ openair3/ocp-gtpu/gtp_itf.h | 1 + 3 files changed, 72 insertions(+) diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index b2a8f0821c..7ad4475c2f 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -3172,6 +3172,57 @@ static void rrc_DU_process_ue_context_setup_request(MessageDef *msg_p, const cha } +static void rrc_CU_process_ue_context_setup_response(MessageDef *msg_p, const char *msg_name, instance_t instance){ + + f1ap_ue_context_setup_resp_t * resp=&F1AP_UE_CONTEXT_SETUP_RESP(msg_p); + protocol_ctxt_t ctxt; + ctxt.rnti = resp->rnti; + ctxt.module_id = instance; + ctxt.instance = instance; + ctxt.enb_flag = 1; + gNB_RRC_INST *rrc = RC.nrrrc[ctxt.module_id]; + struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_get_ue_context(rrc, ctxt.rnti); + NR_CellGroupConfig_t *cellGroupConfig = NULL; + int i; + int j; + + asn_dec_rval_t dec_rval = uper_decode_complete( NULL, + &asn_DEF_NR_CellGroupConfig, + (void **)&cellGroupConfig, + (uint8_t *)resp->du_to_cu_rrc_information, + (int) resp->du_to_cu_rrc_information_length); + + if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { + AssertFatal(1==0,"Cell group config decode error\n"); + // free the memory + SEQUENCE_free( &asn_DEF_NR_CellGroupConfig, cellGroupConfig, 1 ); + return; + } + xer_fprint(stdout,&asn_DEF_NR_CellGroupConfig, cellGroupConfig); + + if(ue_context_p->ue_context.masterCellGroup == NULL){ + ue_context_p->ue_context.masterCellGroup = calloc(1, sizeof(NR_CellGroupConfig_t)); + } + if(cellGroupConfig->rlc_BearerToAddModList!=NULL){ + if(ue_context_p->ue_context.masterCellGroup->rlc_BearerToAddModList != NULL){ + LOG_I(NR_RRC, "rlc_BearerToAddModList not empty before filling it \n"); + free(ue_context_p->ue_context.masterCellGroup->rlc_BearerToAddModList); + } + ue_context_p->ue_context.masterCellGroup->rlc_BearerToAddModList = calloc(1, sizeof(cellGroupConfig->rlc_BearerToAddModList)); + memcpy(ue_context_p->ue_context.masterCellGroup->rlc_BearerToAddModList, cellGroupConfig->rlc_BearerToAddModList, + sizeof(struct NR_CellGroupConfig__rlc_BearerToAddModList)); + } + + for(i=0; idrbs_setup_length; i++){ + for(j=0; jdrbs_setup[i].up_dl_tnl_length; j++){ + GtpuUpdateTunnelOutgoingTeid(INSTANCE_DEFAULT, ue_context_p->ue_context.rnti, (ebi_t)resp->drbs_setup[i].drb_id, resp->drbs_setup[i].up_dl_tnl[j].teid); + } + } + free(cellGroupConfig->rlc_BearerToAddModList); + free(cellGroupConfig); + +} + unsigned int mask_flip(unsigned int x) { return((((x>>8) + (x<<8))&0xffff)>>6); } @@ -3672,6 +3723,7 @@ void *rrc_gnb_task(void *args_p) { break; case F1AP_UE_CONTEXT_SETUP_RESP: + rrc_CU_process_ue_context_setup_response(msg_p, msg_name_p, instance); LOG_W(NR_RRC, "Handling of F1 UE context setup response context at the RRC layer of the CU is pending \n"); break; diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index b78fd72f50..66a4eb00ea 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -388,6 +388,25 @@ instance_t ocp_gtpv1Init(openAddr_t context) { return id; } +void GtpuUpdateTunnelOutgoingTeid(instance_t instance, rnti_t rnti, ebi_t bearer_id, teid_t newOutgoingTeid) { + pthread_mutex_lock(&globGtp.gtp_lock); + auto inst=&globGtp.instances[compatInst(instance)]; + auto ptrRnti=inst->ue2te_mapping.find(rnti); + if ( ptrRnti == inst->ue2te_mapping.end() ) { + LOG_E(GTPU,"Update tunnel for a not existing rnti %x\n", rnti); + pthread_mutex_unlock(&globGtp.gtp_lock); + return; + } auto tmp=ptrRnti->second.bearers; + auto ptrBearer=tmp.find(bearer_id); if ( ptrBearer == tmp.end() ) { + LOG_E(GTPU,"Update tunnel for a existing rnti %x, but wrong bearer_id %u\n", rnti, bearer_id); + pthread_mutex_unlock(&globGtp.gtp_lock); + return; + } //AssertFatal(ptrBearer.second.teid_outgoing == oldOutGoingTeid, ""); + ptrBearer->second.teid_outgoing = newOutgoingTeid; + pthread_mutex_unlock(&globGtp.gtp_lock); + return; +} + teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int incoming_bearer_id, int outgoing_bearer_id, teid_t outgoing_teid, transport_layer_addr_t remoteAddr, int port, gtpCallback callBack) { pthread_mutex_lock(&globGtp.gtp_lock); diff --git a/openair3/ocp-gtpu/gtp_itf.h b/openair3/ocp-gtpu/gtp_itf.h index dd406e27cd..07c23baf98 100644 --- a/openair3/ocp-gtpu/gtp_itf.h +++ b/openair3/ocp-gtpu/gtp_itf.h @@ -62,6 +62,7 @@ int ocp_gtpv1u_create_x2u_tunnel( // New API teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int incoming_bearer_id, int outgoing_rb_id, teid_t teid, transport_layer_addr_t remoteAddr, int port, gtpCallback callBack); +void GtpuUpdateTunnelOutgoingTeid(instance_t instance, rnti_t rnti, ebi_t bearer_id, teid_t newOutgoingTeid); instance_t ocp_gtpv1Init(openAddr_t context); void *ocp_gtpv1uTask(void *args); From 36000a3e898a2c1cd1a4e427604071d95ea3f566 Mon Sep 17 00:00:00 2001 From: Laurent Thomas Date: Mon, 6 Sep 2021 18:27:51 +0200 Subject: [PATCH 049/110] add F1-U callbacks implem --- common/utils/assertions.h | 8 +---- common/utils/backtrace.c | 7 +--- common/utils/backtrace.h | 3 -- openair2/F1AP/f1ap_du_ue_context_management.c | 5 +++ openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c | 33 +++++++++++++------ 5 files changed, 30 insertions(+), 26 deletions(-) diff --git a/common/utils/assertions.h b/common/utils/assertions.h index 06d43bdbfa..166d759808 100644 --- a/common/utils/assertions.h +++ b/common/utils/assertions.h @@ -26,14 +26,8 @@ #include #include #include +#include -#if defined(ENB_MODE) -# define display_backtrace() -#else -# include "backtrace.h" -#endif - -void output_log_mem(void); #define _Assert_Exit_ \ fprintf(stderr, "\nExiting execution\n"); \ display_backtrace(); \ diff --git a/common/utils/backtrace.c b/common/utils/backtrace.c index f61cf0349a..634bb3a834 100644 --- a/common/utils/backtrace.c +++ b/common/utils/backtrace.c @@ -28,7 +28,7 @@ #include #include -#include "backtrace.h" +#include /* Obtain a backtrace and print it to stdout. */ void display_backtrace(void) { @@ -49,8 +49,3 @@ void display_backtrace(void) { free(strings); } - -void backtrace_handle_signal(siginfo_t *info) { - display_backtrace(); - //exit(EXIT_FAILURE); -} diff --git a/common/utils/backtrace.h b/common/utils/backtrace.h index 3977d0321c..9aaf718453 100644 --- a/common/utils/backtrace.h +++ b/common/utils/backtrace.h @@ -26,10 +26,7 @@ #ifdef __cplusplus extern "C" { #endif - void display_backtrace(void); - -void backtrace_handle_signal(siginfo_t *info); #ifdef __cplusplus } #endif diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index a4d277d320..1c8eaedb1a 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -52,6 +52,10 @@ boolean_t DURecvCb( protocol_ctxt_t *ctxt_pP, const pdcp_transmission_mode_t modeP, const uint32_t *sourceL2Id, const uint32_t *destinationL2Id) { + // The buffer comes from the stack in gtp-u thread, we have a make a separate buffer to enqueue in a inter-thread message queue + mem_block_t *sdu=get_free_mem_block(sdu_buffer_sizeP, __func__); + memcpy(sdu->data, sdu_buffer_pP, sdu_buffer_sizeP); + du_rlc_data_req(ctxt_pP,srb_flagP, false, rb_idP,muiP, confirmP, sdu_buffer_sizeP, sdu); return true; } @@ -64,6 +68,7 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, F1AP_UEContextSetupRequest_t *container; int i; DevAssert(pdu); +AssertFatal(0,""); msg_p = itti_alloc_new_message(TASK_DU_F1, 0, F1AP_UE_CONTEXT_SETUP_REQ); f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_req = &F1AP_UE_CONTEXT_SETUP_REQ(msg_p); container = &pdu->choice.initiatingMessage->value.choice.UEContextSetupRequest; diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index 9f3f3370d4..78ea9bfbf9 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -160,8 +160,7 @@ static void enqueue_rlc_data_req(const protocol_ctxt_t *const ctxt_pP, const mui_t muiP, confirm_t confirmP, sdu_size_t sdu_sizeP, - mem_block_t *sdu_pP, - void *_unused1, void *_unused2) + mem_block_t *sdu_pP) { int i; int logged = 0; @@ -206,9 +205,7 @@ void du_rlc_data_req(const protocol_ctxt_t *const ctxt_pP, rb_idP, muiP, confirmP, sdu_sizeP, - sdu_pP, - NULL, - NULL); + sdu_pP); } /****************************************************************************/ @@ -529,7 +526,7 @@ rb_found: LOG_D(PDCP, "%s(): (srb %d) calling rlc_data_req size %d\n", __func__, rb_id, size); //for (i = 0; i < size; i++) printf(" %2.2x", (unsigned char)memblock->data[i]); //printf("\n"); - enqueue_rlc_data_req(&ctxt, 0, MBMS_FLAG_NO, rb_id, sdu_id, 0, size, memblock, NULL, NULL); + enqueue_rlc_data_req(&ctxt, 0, MBMS_FLAG_NO, rb_id, sdu_id, 0, size, memblock); } static void deliver_sdu_srb(void *_ue, nr_pdcp_entity_t *entity, @@ -613,7 +610,7 @@ srb_found: memblock = get_free_mem_block(size, __FUNCTION__); memcpy(memblock->data, buf, size); - enqueue_rlc_data_req(&ctxt, 1, MBMS_FLAG_NO, srb_id, sdu_id, 0, size, memblock, NULL, NULL); + enqueue_rlc_data_req(&ctxt, 1, MBMS_FLAG_NO, srb_id, sdu_id, 0, size, memblock); } else { MessageDef *message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_DL_RRC_MESSAGE); @@ -1225,9 +1222,25 @@ boolean_t cu_f1u_data_req( ,const uint32_t *const sourceL2Id ,const uint32_t *const destinationL2Id #endif - ) -{ - LOG_E(PDCP, "Implementation is pending"); + ) { + MessageDef *message_p = itti_alloc_new_message_sized(TASK_PDCP_ENB, 0, + GTPV1U_GNB_TUNNEL_DATA_REQ, + sizeof(gtpv1u_gnb_tunnel_data_req_t) + + sdu_buffer_size + + GTPU_HEADER_OVERHEAD_MAX); + AssertFatal(message_p != NULL, "OUT OF MEMORY"); + gtpv1u_gnb_tunnel_data_req_t *req=>PV1U_GNB_TUNNEL_DATA_REQ(message_p); + uint8_t *gtpu_buffer_p = (uint8_t*)(req+1); + memcpy(gtpu_buffer_p+GTPU_HEADER_OVERHEAD_MAX, + sdu_buffer, sdu_buffer_size); + req->buffer = gtpu_buffer_p; + req->length = sdu_buffer_size; + req->offset = GTPU_HEADER_OVERHEAD_MAX; + req->rnti = ctxt_pP->rnti; + req->pdusession_id = rb_id; + LOG_D(PDCP, "%s() (drb %ld) sending message to gtp size %d\n", + __func__, rb_id, sdu_buffer_size); + itti_send_msg_to_task(TASK_VARIABLE, INSTANCE_DEFAULT, message_p); return true; } From 16ea018601d4ef9ca6564a18f489b93d0e0b9296 Mon Sep 17 00:00:00 2001 From: Laurent Thomas Date: Tue, 7 Sep 2021 11:57:58 +0200 Subject: [PATCH 050/110] fix a abort() call let in the source --- openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c | 76 +++++-------------- openair2/F1AP/f1ap_du_ue_context_management.c | 1 - 2 files changed, 17 insertions(+), 60 deletions(-) diff --git a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c index 3aad4980bc..3df96c4364 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c +++ b/openair1/PHY/NR_TRANSPORT/nr_ulsch_decoding.c @@ -120,68 +120,26 @@ NR_gNB_ULSCH_t *new_gNB_ulsch(uint8_t max_ldpc_iterations,uint16_t N_RB_UL, uint } uint16_t ulsch_bytes = a_segments*1056; // allocated bytes per segment - ulsch = (NR_gNB_ULSCH_t *)malloc16(sizeof(NR_gNB_ULSCH_t)); - - if (ulsch) { - - memset(ulsch,0,sizeof(NR_gNB_ULSCH_t)); - - ulsch->max_ldpc_iterations = max_ldpc_iterations; - ulsch->Mlimit = 4; - - for (i=0; iharq_processes[i] = (NR_UL_gNB_HARQ_t *)malloc16(sizeof(NR_UL_gNB_HARQ_t)); - - if (ulsch->harq_processes[i]) { - - memset(ulsch->harq_processes[i],0,sizeof(NR_UL_gNB_HARQ_t)); - - ulsch->harq_processes[i]->b = (uint8_t*)malloc16(ulsch_bytes); - - if (ulsch->harq_processes[i]->b) - memset(ulsch->harq_processes[i]->b,0,ulsch_bytes); - else - exit_flag=3; - - if (abstraction_flag == 0) { - for (r=0; rharq_processes[i]->p_nrLDPC_procBuf[r] = nrLDPC_init_mem(); - - ulsch->harq_processes[i]->c[r] = (uint8_t*)malloc16(8448*sizeof(uint8_t)); - - if (ulsch->harq_processes[i]->c[r]) - memset(ulsch->harq_processes[i]->c[r],0,8448*sizeof(uint8_t)); - else - exit_flag=2; - - ulsch->harq_processes[i]->d[r] = (int16_t*)malloc16((68*384)*sizeof(int16_t)); - - if (ulsch->harq_processes[i]->d[r]) - memset(ulsch->harq_processes[i]->d[r],0,(68*384)*sizeof(int16_t)); - else - exit_flag=2; - - ulsch->harq_processes[i]->w[r] = (int16_t*)malloc16((3*(6144+64))*sizeof(int16_t)); - - if (ulsch->harq_processes[i]->w[r]) - memset(ulsch->harq_processes[i]->w[r],0,(3*(6144+64))*sizeof(int16_t)); - else - exit_flag=2; - } - } - } else { - exit_flag=1; + ulsch = (NR_gNB_ULSCH_t *)malloc16_clear(sizeof(NR_gNB_ULSCH_t)); + + ulsch->max_ldpc_iterations = max_ldpc_iterations; + ulsch->Mlimit = 4; + + for (i=0; iharq_processes[i] = (NR_UL_gNB_HARQ_t *)malloc16_clear(sizeof(NR_UL_gNB_HARQ_t)); + ulsch->harq_processes[i]->b = (uint8_t*)malloc16_clear(ulsch_bytes); + if (abstraction_flag == 0) { + for (r=0; rharq_processes[i]->p_nrLDPC_procBuf[r] = nrLDPC_init_mem(); + ulsch->harq_processes[i]->c[r] = (uint8_t*)malloc16_clear(8448*sizeof(uint8_t)); + ulsch->harq_processes[i]->d[r] = (int16_t*)malloc16_clear((68*384)*sizeof(int16_t)); + ulsch->harq_processes[i]->w[r] = (int16_t*)malloc16_clear((3*(6144+64))*sizeof(int16_t)); } } - - if (exit_flag==0) - return(ulsch); } - printf("new_gNB_ulsch with size %zu: exit_flag = %hhu\n",sizeof(NR_UL_gNB_HARQ_t), exit_flag); - free_gNB_ulsch(&ulsch,N_RB_UL); - return(NULL); + + return(ulsch); } void clean_gNB_ulsch(NR_gNB_ULSCH_t *ulsch) diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 1c8eaedb1a..6f18e484d6 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -68,7 +68,6 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, F1AP_UEContextSetupRequest_t *container; int i; DevAssert(pdu); -AssertFatal(0,""); msg_p = itti_alloc_new_message(TASK_DU_F1, 0, F1AP_UE_CONTEXT_SETUP_REQ); f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_req = &F1AP_UE_CONTEXT_SETUP_REQ(msg_p); container = &pdu->choice.initiatingMessage->value.choice.UEContextSetupRequest; From a75d200888c50c19d9ddf4331891eba636174127 Mon Sep 17 00:00:00 2001 From: matzakos Date: Tue, 7 Sep 2021 15:30:14 +0200 Subject: [PATCH 051/110] Trigger UE context response from RRC by sending ITTI to F1AP task -Fix contents of F1AP UE context setup response message --- openair2/COMMON/f1ap_messages_def.h | 2 +- openair2/COMMON/f1ap_messages_types.h | 2 + openair2/F1AP/f1ap_du_task.c | 4 ++ openair2/F1AP/f1ap_du_ue_context_management.c | 65 +++++++++-------- openair2/RRC/NR/rrc_gNB.c | 72 ++++++++++++++++++- 5 files changed, 114 insertions(+), 31 deletions(-) diff --git a/openair2/COMMON/f1ap_messages_def.h b/openair2/COMMON/f1ap_messages_def.h index aa4dcd581f..a17c80c845 100644 --- a/openair2/COMMON/f1ap_messages_def.h +++ b/openair2/COMMON/f1ap_messages_def.h @@ -45,7 +45,7 @@ MESSAGE_DEF(F1AP_UE_CONTEXT_RELEASE_CMD, MESSAGE_PRIORITY_MED, f1ap_ue_context_r MESSAGE_DEF(F1AP_DL_RRC_MESSAGE , MESSAGE_PRIORITY_MED, f1ap_dl_rrc_message_t , f1ap_dl_rrc_message ) //MESSAGE_DEF(F1AP_INITIAL_CONTEXT_SETUP_REQ , MESSAGE_PRIORITY_MED, f1ap_initial_context_setup_req_t , f1ap_initial_context_setup_req ) MESSAGE_DEF(F1AP_UE_CONTEXT_SETUP_REQ, MESSAGE_PRIORITY_MED, f1ap_ue_context_setup_req_t, f1ap_ue_context_setup_req) -MESSAGE_DEF(F1AP_UE_CONTEXT_SETUP_RESP, MESSAGE_PRIORITY_MED, f1ap_ue_context_setup_resp_t, f1ap_ue_context_setup_resp) +MESSAGE_DEF(F1AP_UE_CONTEXT_SETUP_RESP, MESSAGE_PRIORITY_MED, f1ap_ue_context_setup_req_t, f1ap_ue_context_setup_resp) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index 5e195f3716..494dd525ba 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -353,6 +353,8 @@ typedef struct f1ap_ue_context_setup_req_s { uint32_t servCellId; uint8_t *cu_to_du_rrc_information; uint8_t cu_to_du_rrc_information_length; + uint8_t *du_to_cu_rrc_information; + uint8_t du_to_cu_rrc_information_length; f1ap_drb_to_be_setup_t *drbs_to_be_setup; // BK: need to replace by s1ap_initial_context_setup_req uint8_t drbs_to_be_setup_length; // BK: need to replace by s1ap_initial_context_setup_req f1ap_srb_to_be_setup_t *srbs_to_be_setup; diff --git a/openair2/F1AP/f1ap_du_task.c b/openair2/F1AP/f1ap_du_task.c index ba14bf90da..5a63e67946 100644 --- a/openair2/F1AP/f1ap_du_task.c +++ b/openair2/F1AP/f1ap_du_task.c @@ -178,6 +178,10 @@ void *F1AP_DU_task(void *arg) { break; + case F1AP_UE_CONTEXT_SETUP_RESP: + DU_send_UE_CONTEXT_SETUP_RESPONSE(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &F1AP_UE_CONTEXT_SETUP_RESP(received_msg)); + break; + case F1AP_UE_CONTEXT_RELEASE_REQ: // from MAC LOG_I(F1AP, "DU Task Received F1AP_UE_CONTEXT_RELEASE_REQ\n"); DU_send_UE_CONTEXT_RELEASE_REQUEST(ITTI_MSG_DESTINATION_INSTANCE(received_msg), diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 6f18e484d6..9532b4f903 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -42,22 +42,6 @@ #include "openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h" #include -boolean_t DURecvCb( protocol_ctxt_t *ctxt_pP, - const srb_flag_t srb_flagP, - const rb_id_t rb_idP, - const mui_t muiP, - const confirm_t confirmP, - const sdu_size_t sdu_buffer_sizeP, - unsigned char *const sdu_buffer_pP, - const pdcp_transmission_mode_t modeP, - const uint32_t *sourceL2Id, - const uint32_t *destinationL2Id) { - // The buffer comes from the stack in gtp-u thread, we have a make a separate buffer to enqueue in a inter-thread message queue - mem_block_t *sdu=get_free_mem_block(sdu_buffer_sizeP, __func__); - memcpy(sdu->data, sdu_buffer_pP, sdu_buffer_sizeP); - du_rlc_data_req(ctxt_pP,srb_flagP, false, rb_idP,muiP, confirmP, sdu_buffer_sizeP, sdu); - return true; -} int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup_req_t *req); int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, @@ -166,7 +150,7 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, break; } - transport_layer_addr_t addr; + /*transport_layer_addr_t addr; memcpy(addr.buffer, &drb_p->up_ul_tnl[0].tl_address, sizeof(drb_p->up_ul_tnl[0].tl_address)); addr.length=sizeof(drb_p->up_ul_tnl[0].tl_address)*8; drb_p->up_dl_tnl[0].teid=newGtpuCreateTunnel(INSTANCE_DEFAULT, @@ -176,7 +160,7 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, drb_p->up_ul_tnl[0].teid, addr, 2152, - DURecvCb); + DURecvCb);*/ } } @@ -230,7 +214,7 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, LOG_W(F1AP, "can't find RRCContainer in UEContextSetupRequestIEs by id %ld \n", F1AP_ProtocolIE_ID_id_RRCContainer); } - DU_send_UE_CONTEXT_SETUP_RESPONSE(instance, f1ap_ue_context_setup_req); + //DU_send_UE_CONTEXT_SETUP_RESPONSE(instance, f1ap_ue_context_setup_req); itti_send_msg_to_task(TASK_RRC_GNB, instance, msg_p); return 0; } @@ -254,26 +238,26 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup ie1->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; ie1->criticality = F1AP_Criticality_reject; ie1->value.present = F1AP_UEContextSetupResponseIEs__value_PR_GNB_CU_UE_F1AP_ID; - ie1->value.choice.GNB_CU_UE_F1AP_ID = req->gNB_CU_ue_id; + ie1->value.choice.GNB_CU_UE_F1AP_ID = req->gNB_CU_ue_id; //f1ap_get_cu_ue_f1ap_id(true, instance, req->rnti); /* mandatory */ /* c2. GNB_DU_UE_F1AP_ID */ asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie2); ie2->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; ie2->criticality = F1AP_Criticality_reject; ie2->value.present = F1AP_UEContextSetupResponseIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie2->value.choice.GNB_DU_UE_F1AP_ID = req->gNB_DU_ue_id; + ie2->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(false, instance, req->rnti); /* mandatory */ /* c3. DUtoCURRCInformation */ - if (0) { + //if (0) { asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie3); ie3->id = F1AP_ProtocolIE_ID_id_DUtoCURRCInformation; ie3->criticality = F1AP_Criticality_reject; ie3->value.present = F1AP_UEContextSetupResponseIEs__value_PR_DUtoCURRCInformation; { /* cellGroupConfig */ - OCTET_STRING_fromBuf(&ie3->value.choice.DUtoCURRCInformation.cellGroupConfig, "asdsa", - strlen("asdsa")); + OCTET_STRING_fromBuf(&ie3->value.choice.DUtoCURRCInformation.cellGroupConfig, (const char *)req->du_to_cu_rrc_information, + req->du_to_cu_rrc_information_length); /* OPTIONAL */ /* measGapConfig */ @@ -291,7 +275,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup OCTET_STRING_fromBuf(tmp, "asdsa", strlen("asdsa")); } } - } + //} /* optional */ /* c4. C_RNTI */ @@ -332,7 +316,6 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup ie7->id = F1AP_ProtocolIE_ID_id_DRBs_Setup_List; ie7->criticality = F1AP_Criticality_ignore; ie7->value.present = F1AP_UEContextSetupResponseIEs__value_PR_DRBs_Setup_List; - for (int i=0; i< req->drbs_to_be_setup_length; i++) { // asn1cSequenceAdd(ie7->value.choice.DRBs_Setup_List.list, @@ -372,6 +355,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup /* mandatory */ /* c8. SRBs_FailedToBeSetup_List */ + if(0){ asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie8); ie8->id = F1AP_ProtocolIE_ID_id_SRBs_FailedToBeSetup_List; ie8->criticality = F1AP_Criticality_ignore; @@ -416,9 +400,11 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup break; } // switch } // for i + } /* */ /* c9. DRBs_FailedToBeSetup_List */ + if(0){ asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie9); ie9->id = F1AP_ProtocolIE_ID_id_DRBs_FailedToBeSetup_List; ie9->criticality = F1AP_Criticality_ignore; @@ -463,9 +449,11 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup break; } // switch } // for i + } // /* */ /* c10. SCell_FailedtoSetup_List */ + if(0){ asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie10); ie10->id = F1AP_ProtocolIE_ID_id_SCell_FailedtoSetup_List; ie10->criticality = F1AP_Criticality_ignore; @@ -509,9 +497,30 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup break; } // switch } // for i + } + + /* mandatory */ + /* c11. SRBs_Setup_List */ + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie11); + ie11->id = F1AP_ProtocolIE_ID_id_SRBs_Setup_List; + ie11->criticality = F1AP_Criticality_ignore; + ie11->value.present = F1AP_UEContextSetupResponseIEs__value_PR_SRBs_Setup_List; + + for (int i=0; i< req->srbs_to_be_setup_length; i++) {// + asn1cSequenceAdd(ie11->value.choice.SRBs_Setup_List.list, + F1AP_SRBs_Setup_ItemIEs_t, srbs_setup_item_ies); + srbs_setup_item_ies->id = F1AP_ProtocolIE_ID_id_SRBs_Setup_Item; + srbs_setup_item_ies->criticality = F1AP_Criticality_ignore; + srbs_setup_item_ies->value.present = F1AP_SRBs_Setup_ItemIEs__value_PR_SRBs_Setup_Item; + /* 11.1 SRBs_Setup_Item */ + /* ADD */ + F1AP_SRBs_Setup_Item_t *srbs_setup_item=&srbs_setup_item_ies->value.choice.SRBs_Setup_Item; + /* sRBID */ + srbs_setup_item->sRBID = req->srbs_to_be_setup[i].srb_id; + } /* Optional */ - /* c11. InactivityMonitoringResponse */ + /* c12. InactivityMonitoringResponse */ if (0) { asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie11); ie11->id = F1AP_ProtocolIE_ID_id_InactivityMonitoringResponse; @@ -521,7 +530,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup } /* Optional */ - /* c12. CriticalityDiagnostics */ + /* c13. CriticalityDiagnostics */ if (0) { asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie12); ie12->id = F1AP_ProtocolIE_ID_id_CriticalityDiagnostics; diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 7ad4475c2f..7a7fb867d4 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -134,6 +134,23 @@ uint8_t first_rrcreconfiguration = 0; ///---------------------------------------------------------------------------------------------------------------/// ///---------------------------------------------------------------------------------------------------------------/// +boolean_t DURecvCb( protocol_ctxt_t *ctxt_pP, + const srb_flag_t srb_flagP, + const rb_id_t rb_idP, + const mui_t muiP, + const confirm_t confirmP, + const sdu_size_t sdu_buffer_sizeP, + unsigned char *const sdu_buffer_pP, + const pdcp_transmission_mode_t modeP, + const uint32_t *sourceL2Id, + const uint32_t *destinationL2Id) { + // The buffer comes from the stack in gtp-u thread, we have a make a separate buffer to enqueue in a inter-thread message queue + mem_block_t *sdu=get_free_mem_block(sdu_buffer_sizeP, __func__); + memcpy(sdu->data, sdu_buffer_pP, sdu_buffer_sizeP); + du_rlc_data_req(ctxt_pP,srb_flagP, false, rb_idP,muiP, confirmP, sdu_buffer_sizeP, sdu); + return true; +} + void openair_nr_rrc_on(const protocol_ctxt_t *const ctxt_pP) { LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_FMT" gNB:OPENAIR NR RRC IN....\n",PROTOCOL_NR_RRC_CTXT_ARGS(ctxt_pP)); rrc_config_nr_buffer (&RC.nrrrc[ctxt_pP->module_id]->carrier.SI, BCCH, 1); @@ -1365,7 +1382,8 @@ rrc_gNB_process_RRCReconfigurationComplete( /* Here the callback function used as input is not the right one. Need to create a new one probably for F1-U, not sure * if the kind of input parameters to the callback function are convenient though for gtp-u over F1-U.*/ - ue_context_pP->ue_context.incoming_teid[i] = newGtpuCreateTunnel(INSTANCE_DEFAULT, create_tunnel_req.rnti, + uint32_t incoming_teid; + incoming_teid = newGtpuCreateTunnel(INSTANCE_DEFAULT, create_tunnel_req.rnti, create_tunnel_req.incoming_rb_id[i], create_tunnel_req.incoming_rb_id[i], create_tunnel_req.outgoing_teid[i], @@ -1374,7 +1392,7 @@ rrc_gNB_process_RRCReconfigurationComplete( F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].drb_id = DRB_configList->list.array[i]->drb_Identity; F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].rlc_mode = RLC_MODE_AM; - F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].up_ul_tnl[0].teid = ue_context_pP->ue_context.incoming_teid[i]; + F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].up_ul_tnl[0].teid = incoming_teid; F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].up_ul_tnl[0].tl_address = inet_addr(rrc->eth_params_s.my_addr); F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].up_ul_tnl_length = 1; } @@ -3134,8 +3152,13 @@ static void rrc_DU_process_ue_context_setup_request(MessageDef *msg_p, const cha ctxt.instance = instance; ctxt.enb_flag = 1; gNB_RRC_INST *rrc = RC.nrrrc[ctxt.module_id]; + gNB_MAC_INST *mac = RC.nrmac[ctxt.module_id]; struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_get_ue_context(rrc, ctxt.rnti); + MessageDef *message_p; + message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_UE_CONTEXT_SETUP_RESP); + f1ap_ue_context_setup_req_t * resp=&F1AP_UE_CONTEXT_SETUP_RESP(message_p); + uint32_t incoming_teid = 0; NR_CellGroupConfig_t *cellGroupConfig; @@ -3145,6 +3168,7 @@ static void rrc_DU_process_ue_context_setup_request(MessageDef *msg_p, const cha /* Configure SRB2 */ NR_SRB_ToAddMod_t *SRB2_config = NULL; NR_SRB_ToAddModList_t *SRB_configList = ue_context_p->ue_context.SRB_configList; + uint8_t SRBs_before_new_addition = ue_context_p->ue_context.SRB_configList->list.count; if(SRB_configList != NULL){ for (int i=0; isrbs_to_be_setup_length; i++){ SRB2_config = CALLOC(1, sizeof(*SRB2_config)); @@ -3167,9 +3191,53 @@ static void rrc_DU_process_ue_context_setup_request(MessageDef *msg_p, const cha DRB_config = CALLOC(1, sizeof(*DRB_config)); DRB_config->drb_Identity = req->drbs_to_be_setup[i].drb_id; ASN_SEQUENCE_ADD(&DRB_configList->list, DRB_config); + f1ap_drb_to_be_setup_t drb_p = req->drbs_to_be_setup[i]; + transport_layer_addr_t addr; + memcpy(addr.buffer, &drb_p.up_ul_tnl[0].tl_address, sizeof(drb_p.up_ul_tnl[0].tl_address)); + addr.length=sizeof(drb_p.up_ul_tnl[0].tl_address)*8; + incoming_teid=newGtpuCreateTunnel(INSTANCE_DEFAULT, + req->rnti, + drb_p.drb_id, + drb_p.drb_id, + drb_p.up_ul_tnl[0].teid, + addr, + 2152, + DURecvCb); + } apply_macrlc_config(rrc, ue_context_p, &ctxt); + /* Fill the UE context setup response ITTI message to send to F1AP */ + resp->gNB_CU_ue_id = req->gNB_CU_ue_id; + resp->rnti = ctxt.rnti; + resp->drbs_to_be_setup = calloc(1,DRB_configList->list.count*sizeof(f1ap_drb_to_be_setup_t)); + resp->drbs_to_be_setup_length = DRB_configList->list.count; + for (int i=0; ilist.count; i++){ + resp->drbs_to_be_setup[i].drb_id = DRB_configList->list.array[i]->drb_Identity; + resp->drbs_to_be_setup[i].rlc_mode = RLC_MODE_AM; + resp->drbs_to_be_setup[i].up_dl_tnl[0].teid = incoming_teid; + resp->drbs_to_be_setup[i].up_dl_tnl[0].tl_address = inet_addr(mac->eth_params_n.my_addr); + resp->drbs_to_be_setup[i].up_dl_tnl_length = 1; + } + if(SRBs_before_new_addition < SRB_configList->list.count){ + resp->srbs_to_be_setup = calloc(1,req->srbs_to_be_setup_length*sizeof(f1ap_srb_to_be_setup_t)); + resp->srbs_to_be_setup_length = req->srbs_to_be_setup_length; + for (int i=SRBs_before_new_addition; ilist.count; i++){ + resp->srbs_to_be_setup[i-SRBs_before_new_addition].srb_id = SRB_configList->list.array[i]->srb_Identity; + } + } + else{ + LOG_E(NR_RRC, "SRB failed to get added \n"); + } + resp->du_to_cu_rrc_information = calloc(1,1024*sizeof(uint8_t)); + asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig, + NULL, + (void *)ue_context_p->ue_context.masterCellGroup, + resp->du_to_cu_rrc_information, + 1024); + resp->du_to_cu_rrc_information_length = (enc_rval.encoded+7)>>3; + itti_send_msg_to_task (TASK_DU_F1, ctxt.module_id, message_p); + } static void rrc_CU_process_ue_context_setup_response(MessageDef *msg_p, const char *msg_name, instance_t instance){ From c0e9c0eac9821245efc2890edf270bbe77995d02 Mon Sep 17 00:00:00 2001 From: matzakos Date: Wed, 8 Sep 2021 16:37:18 +0200 Subject: [PATCH 052/110] Update handling of UE context setup Response at F1AP and RRC of the CU --- openair2/COMMON/f1ap_messages_types.h | 4 ++ openair2/F1AP/f1ap_cu_ue_context_management.c | 57 +++++++++++-------- openair2/F1AP/f1ap_decoder.c | 4 ++ openair2/F1AP/f1ap_du_ue_context_management.c | 1 - openair2/F1AP/f1ap_du_ue_context_management.h | 2 + openair2/RRC/NR/rrc_gNB.c | 11 ++-- openair3/ocp-gtpu/gtp_itf.cpp | 4 +- 7 files changed, 52 insertions(+), 31 deletions(-) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index 494dd525ba..a7526ce4b3 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -357,8 +357,12 @@ typedef struct f1ap_ue_context_setup_req_s { uint8_t du_to_cu_rrc_information_length; f1ap_drb_to_be_setup_t *drbs_to_be_setup; // BK: need to replace by s1ap_initial_context_setup_req uint8_t drbs_to_be_setup_length; // BK: need to replace by s1ap_initial_context_setup_req + uint8_t drbs_failed_to_be_setup_length; + f1ap_rb_failed_to_be_setup_t *drbs_failed_to_be_setup; f1ap_srb_to_be_setup_t *srbs_to_be_setup; uint8_t srbs_to_be_setup_length; + uint8_t srbs_failed_to_be_setup_length; + f1ap_rb_failed_to_be_setup_t *srbs_failed_to_be_setup; s1ap_initial_context_setup_req_t *s1ap_initial_context_setup_req; // coniatner for the rrc_eNB_generate_SecurityModeCommand message uint8_t *rrc_container; diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index c8bc6da47f..0e1d6dac1b 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -631,46 +631,55 @@ int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, F1AP_UEContextSetupResponseIEs_t *ie; DevAssert(pdu); msg_p = itti_alloc_new_message(TASK_DU_F1, 0, F1AP_UE_CONTEXT_SETUP_RESP); - f1ap_ue_context_setup_resp_t *f1ap_ue_context_setup_resp = &F1AP_UE_CONTEXT_SETUP_RESP(msg_p); + f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_resp = &F1AP_UE_CONTEXT_SETUP_RESP(msg_p); container = &pdu->choice.successfulOutcome->value.choice.UEContextSetupResponse; int i; /* GNB_CU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, - F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true); - f1ap_ue_context_setup_resp->gNB_CU_ue_id = ie->value.choice.GNB_CU_UE_F1AP_ID; + F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, false); + f1ap_ue_context_setup_resp->gNB_CU_ue_id = ie->value.choice.GNB_CU_UE_F1AP_ID; + + LOG_D(F1AP, "f1ap_ue_context_setup_resp->gNB_CU_ue_id is: %d \n", f1ap_ue_context_setup_resp->gNB_CU_ue_id); /* GNB_DU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true); f1ap_ue_context_setup_resp->gNB_DU_ue_id = ie->value.choice.GNB_DU_UE_F1AP_ID; - /* DUtoCURRCInformation */ + LOG_D(F1AP, "f1ap_ue_context_setup_resp->gNB_DU_ue_id is: %d \n", f1ap_ue_context_setup_resp->gNB_DU_ue_id); + + f1ap_ue_context_setup_resp->rnti = + f1ap_get_rnti_by_du_id(true, instance, f1ap_ue_context_setup_resp->gNB_DU_ue_id); + + // DUtoCURRCInformation F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, F1AP_ProtocolIE_ID_id_DUtoCURRCInformation, true); if (ie == NULL){ LOG_E(F1AP,"%s %d: ie is a NULL pointer \n",__FILE__,__LINE__); return -1; } + f1ap_ue_context_setup_resp->du_to_cu_rrc_information = (uint8_t *)calloc(1,ie->value.choice.DUtoCURRCInformation.cellGroupConfig.size); + memcpy(f1ap_ue_context_setup_resp->du_to_cu_rrc_information, ie->value.choice.DUtoCURRCInformation.cellGroupConfig.buf, ie->value.choice.DUtoCURRCInformation.cellGroupConfig.size); f1ap_ue_context_setup_resp->du_to_cu_rrc_information_length = ie->value.choice.DUtoCURRCInformation.cellGroupConfig.size; - /* DRBs_Setup_List */ + // DRBs_Setup_List F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, F1AP_ProtocolIE_ID_id_DRBs_Setup_List, true); if(ie!=NULL){ - f1ap_ue_context_setup_resp->drbs_setup_length = ie->value.choice.DRBs_Setup_List.list.count; - f1ap_ue_context_setup_resp->drbs_setup = calloc(f1ap_ue_context_setup_resp->drbs_setup_length, + f1ap_ue_context_setup_resp->drbs_to_be_setup_length = ie->value.choice.DRBs_Setup_List.list.count; + f1ap_ue_context_setup_resp->drbs_to_be_setup = calloc(f1ap_ue_context_setup_resp->drbs_to_be_setup_length, sizeof(f1ap_drb_to_be_setup_t)); - AssertFatal(f1ap_ue_context_setup_resp->drbs_setup, + AssertFatal(f1ap_ue_context_setup_resp->drbs_to_be_setup, "could not allocate memory for f1ap_ue_context_setup_resp->drbs_setup\n"); - for (i = 0; i < f1ap_ue_context_setup_resp->drbs_setup_length; ++i) { - f1ap_drb_to_be_setup_t *drb_p = &f1ap_ue_context_setup_resp->drbs_setup[i]; + for (i = 0; i < f1ap_ue_context_setup_resp->drbs_to_be_setup_length; ++i) { + f1ap_drb_to_be_setup_t *drb_p = &f1ap_ue_context_setup_resp->drbs_to_be_setup[i]; F1AP_DRBs_Setup_Item_t *drbs_setup_item_p; drbs_setup_item_p = &((F1AP_DRBs_Setup_ItemIEs_t *)ie->value.choice.DRBs_Setup_List.list.array[i])->value.choice.DRBs_Setup_Item; drb_p->drb_id = drbs_setup_item_p->dRBID; - /* TODO in the following, assume only one UP UL TNL is present. - * this matches/assumes OAI CU/DU implementation, can be up to 2! */ + // TODO in the following, assume only one UP UL TNL is present. + // this matches/assumes OAI CU/DU implementation, can be up to 2! drb_p->up_dl_tnl_length = 1; AssertFatal(drbs_setup_item_p->dLUPTNLInformation_ToBeSetup_List.list.count > 0, "no DL UP TNL Information in DRBs to be Setup list\n"); @@ -681,9 +690,9 @@ int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, } } - /* SRBs_FailedToBeSetup_List */ + // SRBs_FailedToBeSetup_List F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, - F1AP_ProtocolIE_ID_id_SRBs_FailedToBeSetup_List, true); + F1AP_ProtocolIE_ID_id_SRBs_FailedToBeSetup_List, false); if(ie!=NULL){ f1ap_ue_context_setup_resp->srbs_failed_to_be_setup_length = ie->value.choice.SRBs_FailedToBeSetup_List.list.count; f1ap_ue_context_setup_resp->srbs_failed_to_be_setup = calloc(f1ap_ue_context_setup_resp->srbs_failed_to_be_setup_length, @@ -696,9 +705,9 @@ int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, } } - /* DRBs_FailedToBeSetup_List */ + // DRBs_FailedToBeSetup_List F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, - F1AP_ProtocolIE_ID_id_DRBs_FailedToBeSetup_List, true); + F1AP_ProtocolIE_ID_id_DRBs_FailedToBeSetup_List, false); if(ie!=NULL){ f1ap_ue_context_setup_resp->drbs_failed_to_be_setup_length = ie->value.choice.DRBs_FailedToBeSetup_List.list.count; f1ap_ue_context_setup_resp->drbs_failed_to_be_setup = calloc(f1ap_ue_context_setup_resp->drbs_failed_to_be_setup_length, @@ -711,24 +720,24 @@ int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, } } - /* SCell_FailedtoSetup_List */ + // SCell_FailedtoSetup_List F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, - F1AP_ProtocolIE_ID_id_SCell_FailedtoSetup_List, true); + F1AP_ProtocolIE_ID_id_SCell_FailedtoSetup_List, false); if(ie!=NULL){ LOG_E (F1AP, "Not supporting handling of SCell_FailedtoSetup_List \n"); } - /* SRBs_Setup_List */ + // SRBs_Setup_List F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, F1AP_ProtocolIE_ID_id_SRBs_Setup_List, true); if(ie!=NULL){ - f1ap_ue_context_setup_resp->srbs_setup_length = ie->value.choice.SRBs_Setup_List.list.count; - f1ap_ue_context_setup_resp->srbs_setup = calloc(f1ap_ue_context_setup_resp->srbs_setup_length, + f1ap_ue_context_setup_resp->srbs_to_be_setup_length = ie->value.choice.SRBs_Setup_List.list.count; + f1ap_ue_context_setup_resp->srbs_to_be_setup = calloc(f1ap_ue_context_setup_resp->srbs_to_be_setup_length, sizeof(f1ap_srb_to_be_setup_t)); - AssertFatal(f1ap_ue_context_setup_resp->drbs_setup, + AssertFatal(f1ap_ue_context_setup_resp->srbs_to_be_setup, "could not allocate memory for f1ap_ue_context_setup_resp->drbs_setup\n"); - for (i = 0; i < f1ap_ue_context_setup_resp->srbs_setup_length; ++i) { - f1ap_srb_to_be_setup_t *srb_p = &f1ap_ue_context_setup_resp->srbs_setup[i]; + for (i = 0; i < f1ap_ue_context_setup_resp->srbs_to_be_setup_length; ++i) { + f1ap_srb_to_be_setup_t *srb_p = &f1ap_ue_context_setup_resp->srbs_to_be_setup[i]; F1AP_SRBs_Setup_Item_t *srbs_setup_item_p; srbs_setup_item_p = &((F1AP_SRBs_Setup_ItemIEs_t *)ie->value.choice.SRBs_Setup_List.list.array[i])->value.choice.SRBs_Setup_Item; srb_p->srb_id = srbs_setup_item_p->sRBID; diff --git a/openair2/F1AP/f1ap_decoder.c b/openair2/F1AP/f1ap_decoder.c index d871ff63a7..6ebf1cc16d 100644 --- a/openair2/F1AP/f1ap_decoder.c +++ b/openair2/F1AP/f1ap_decoder.c @@ -119,6 +119,10 @@ static int f1ap_decode_successful_outcome(F1AP_F1AP_PDU_t *pdu) { LOG_I(F1AP, "%s(): F1AP_ProcedureCode_id_UEContextRelease\n", __func__); break; + case F1AP_ProcedureCode_id_UEContextSetup: + LOG_I(F1AP, "%s(): F1AP_ProcedureCode_id_UEContextSetup\n", __func__); + break; + default: LOG_E(F1AP,"Unknown procedure ID (%d) for successfull outcome message\n", (int)pdu->choice.successfulOutcome->procedureCode); diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 9532b4f903..213126d9a0 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -43,7 +43,6 @@ #include -int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup_req_t *req); int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, uint32_t assoc_id, uint32_t stream, diff --git a/openair2/F1AP/f1ap_du_ue_context_management.h b/openair2/F1AP/f1ap_du_ue_context_management.h index 320061672a..94c6c40de9 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.h +++ b/openair2/F1AP/f1ap_du_ue_context_management.h @@ -36,6 +36,8 @@ /* * UE Context Setup */ +int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup_req_t *req); + int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, uint32_t assoc_id, uint32_t stream, diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 37ad133db8..fcaa27c80d 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -3249,7 +3249,7 @@ static void rrc_DU_process_ue_context_setup_request(MessageDef *msg_p, const cha static void rrc_CU_process_ue_context_setup_response(MessageDef *msg_p, const char *msg_name, instance_t instance){ - f1ap_ue_context_setup_resp_t * resp=&F1AP_UE_CONTEXT_SETUP_RESP(msg_p); + f1ap_ue_context_setup_req_t * resp=&F1AP_UE_CONTEXT_SETUP_RESP(msg_p); protocol_ctxt_t ctxt; ctxt.rnti = resp->rnti; ctxt.module_id = instance; @@ -3273,7 +3273,7 @@ static void rrc_CU_process_ue_context_setup_response(MessageDef *msg_p, const ch SEQUENCE_free( &asn_DEF_NR_CellGroupConfig, cellGroupConfig, 1 ); return; } - xer_fprint(stdout,&asn_DEF_NR_CellGroupConfig, cellGroupConfig); + //xer_fprint(stdout,&asn_DEF_NR_CellGroupConfig, cellGroupConfig); if(ue_context_p->ue_context.masterCellGroup == NULL){ ue_context_p->ue_context.masterCellGroup = calloc(1, sizeof(NR_CellGroupConfig_t)); @@ -3287,10 +3287,11 @@ static void rrc_CU_process_ue_context_setup_response(MessageDef *msg_p, const ch memcpy(ue_context_p->ue_context.masterCellGroup->rlc_BearerToAddModList, cellGroupConfig->rlc_BearerToAddModList, sizeof(struct NR_CellGroupConfig__rlc_BearerToAddModList)); } + xer_fprint(stdout,&asn_DEF_NR_CellGroupConfig, ue_context_p->ue_context.masterCellGroup); - for(i=0; idrbs_setup_length; i++){ - for(j=0; jdrbs_setup[i].up_dl_tnl_length; j++){ - GtpuUpdateTunnelOutgoingTeid(INSTANCE_DEFAULT, ue_context_p->ue_context.rnti, (ebi_t)resp->drbs_setup[i].drb_id, resp->drbs_setup[i].up_dl_tnl[j].teid); + for(i=0; idrbs_to_be_setup_length; i++){ + for(j=0; jdrbs_to_be_setup[i].up_dl_tnl_length; j++){ + GtpuUpdateTunnelOutgoingTeid(INSTANCE_DEFAULT, ue_context_p->ue_context.rnti, (ebi_t)resp->drbs_to_be_setup[i].drb_id, resp->drbs_to_be_setup[i].up_dl_tnl[j].teid); } } free(cellGroupConfig->rlc_BearerToAddModList); diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index bf379c4677..7a1fda1c72 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -396,13 +396,15 @@ void GtpuUpdateTunnelOutgoingTeid(instance_t instance, rnti_t rnti, ebi_t bearer LOG_E(GTPU,"Update tunnel for a not existing rnti %x\n", rnti); pthread_mutex_unlock(&globGtp.gtp_lock); return; - } auto tmp=ptrRnti->second.bearers; + } + auto tmp=ptrRnti->second.bearers; auto ptrBearer=tmp.find(bearer_id); if ( ptrBearer == tmp.end() ) { LOG_E(GTPU,"Update tunnel for a existing rnti %x, but wrong bearer_id %u\n", rnti, bearer_id); pthread_mutex_unlock(&globGtp.gtp_lock); return; } //AssertFatal(ptrBearer.second.teid_outgoing == oldOutGoingTeid, ""); ptrBearer->second.teid_outgoing = newOutgoingTeid; + LOG_I(GTPU, "Tunnel Outgoing TEID updated to %d \n", ptrBearer->second.teid_outgoing); pthread_mutex_unlock(&globGtp.gtp_lock); return; } From b5f300171d6583ece8fbe5e9d2022abf46b0c1a2 Mon Sep 17 00:00:00 2001 From: Laurent Thomas Date: Thu, 9 Sep 2021 11:37:00 +0200 Subject: [PATCH 053/110] change instance id to 3GPP length --- common/utils/assertions.h | 3 +- common/utils/system.c | 50 ++-------- executables/nr-softmodem.c | 51 ++++------ executables/softmodem-common.c | 2 + openair2/F1AP/f1ap_common.c | 98 +++++++++---------- openair2/F1AP/f1ap_common.h | 56 +++++------ openair2/F1AP/f1ap_cu_interface_management.c | 12 +-- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 6 +- openair2/F1AP/f1ap_cu_task.c | 43 +++++--- openair2/F1AP/f1ap_cu_task.h | 5 - openair2/F1AP/f1ap_cu_ue_context_management.c | 2 +- openair2/F1AP/f1ap_du_interface_management.c | 4 +- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 28 +++--- openair2/F1AP/f1ap_du_rrc_message_transfer.h | 2 +- openair2/F1AP/f1ap_du_ue_context_management.c | 7 +- openair2/F1AP/f1ap_du_ue_context_management.h | 2 + openair2/RRC/NR/MESSAGES/asn1_msg.c | 2 +- 17 files changed, 166 insertions(+), 207 deletions(-) diff --git a/common/utils/assertions.h b/common/utils/assertions.h index 166d759808..d85dab79a0 100644 --- a/common/utils/assertions.h +++ b/common/utils/assertions.h @@ -26,11 +26,10 @@ #include #include #include -#include +#include "backtrace.h" #define _Assert_Exit_ \ fprintf(stderr, "\nExiting execution\n"); \ - display_backtrace(); \ fflush(stdout); \ fflush(stderr); \ abort(); diff --git a/common/utils/system.c b/common/utils/system.c index 9a7ee8ba2b..6cbe71fb6e 100644 --- a/common/utils/system.c +++ b/common/utils/system.c @@ -96,39 +96,6 @@ static void read_pipe(int p, char *b, int size) { } } -static int baseRunTimeCommand(char* cmd) { - return system(cmd); -} - -int checkIfFedoraDistribution(void) { - char cmd[200]; - - memset(cmd, 0, 200); - sprintf(cmd, "cat /etc/os-release | grep ID_LIKE | grep -ic fedora"); - return baseRunTimeCommand(cmd); -} - -int checkIfGenericKernelOnFedora(void) { - char cmd[200]; - - memset(cmd, 0, 200); - sprintf(cmd, "uname -a | grep -c rt"); - return (1 - baseRunTimeCommand(cmd)); -} - -int checkIfInsideContainer(void) { - char cmd[200]; - int res = 0; - - memset(cmd, 0, 200); - sprintf(cmd, "cat /proc/self/cgroup | egrep -c 'libpod|podman|kubepods'"); - res = baseRunTimeCommand(cmd); - if (res > 0) - return 1; - else - return 0; -} - /********************************************************************/ /* background process */ /********************************************************************/ @@ -242,16 +209,13 @@ void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name, AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno); ret=pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno); - ret=pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); - AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno); - - if (checkIfFedoraDistribution()) - if (checkIfGenericKernelOnFedora()) - if (checkIfInsideContainer()) - - settingPriority = 0; - + /* + if (system("grep -iq 'ID_LIKE.*fedora' /etc/os-release && uname -a | grep -c rt")==0) + if (system("cat /proc/self/cgroup | egrep -c 'libpod|podman|kubepods'")==0) + settingPriority = 0; if (settingPriority) { + ret=pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED); + AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno); ret=pthread_attr_setschedpolicy(&attr, SCHED_OAI); AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno); if(prioritysched_get_priority_max(SCHED_OAI)) { @@ -270,7 +234,7 @@ void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name, ret=pthread_attr_setschedparam(&attr, &sparam); AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno); } - + */ ret=pthread_create(t, &attr, func, param); AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno); diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index 90165d0c8a..c6c367a0bb 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -328,48 +328,32 @@ int create_gNB_tasks(uint32_t gnb_nb) { } } - paramdef_t NETParams[] = GNBNETPARAMS_DESC; - char aprefix[MAX_OPTNAME_SIZE*2 + 8]; - sprintf(aprefix,"%s.[%i].%s",GNB_CONFIG_STRING_GNB_LIST,0,GNB_CONFIG_STRING_NETWORK_INTERFACES_CONFIG); - config_get( NETParams,sizeof(NETParams)/sizeof(paramdef_t),aprefix); - - for(int i = GNB_INTERFACE_NAME_FOR_NG_AMF_IDX; i <= GNB_IPV4_ADDRESS_FOR_NG_AMF_IDX; i++) { - if( NETParams[i].strptr == NULL) { - LOG_E(NGAP, "No configuration in the file.\n"); - NGAP_CONF_MODE = 0; - } else { - LOG_D(NGAP, "Configuration in the file: %s.\n",*NETParams[i].strptr); - } - } - if (AMF_MODE_ENABLED) { - if (gnb_nb > 0) { - /* - if (itti_create_task (TASK_SCTP, sctp_eNB_task, NULL) < 0) { - LOG_E(SCTP, "Create task for SCTP failed\n"); - return -1; + + paramdef_t NETParams[] = GNBNETPARAMS_DESC; + char aprefix[MAX_OPTNAME_SIZE*2 + 8]; + sprintf(aprefix,"%s.[%i].%s",GNB_CONFIG_STRING_GNB_LIST,0,GNB_CONFIG_STRING_NETWORK_INTERFACES_CONFIG); + config_get( NETParams,sizeof(NETParams)/sizeof(paramdef_t),aprefix); + + for(int i = GNB_INTERFACE_NAME_FOR_NG_AMF_IDX; i <= GNB_IPV4_ADDRESS_FOR_NG_AMF_IDX; i++) { + if( NETParams[i].strptr == NULL) { + LOG_E(NGAP, "No configuration in the file.\n"); + NGAP_CONF_MODE = 0; + } else { + LOG_D(NGAP, "Configuration in the file: %s.\n",*NETParams[i].strptr); } - */ + } + + if (gnb_nb > 0) { if(NGAP_CONF_MODE) { if (itti_create_task (TASK_NGAP, ngap_gNB_task, NULL) < 0) { LOG_E(NGAP, "Create task for NGAP failed\n"); return -1; } } else { - LOG_E(NGAP, "Ngap task not created\n"); + LOG_I(NGAP, "Ngap task not created\n"); } - if(!emulate_rf) { - if (itti_create_task (TASK_UDP, udp_eNB_task, NULL) < 0) { - LOG_E(UDP_, "Create task for UDP failed\n"); - return -1; - } - } - - /*if (itti_create_task (TASK_GTPV1_U, &nr_gtpv1u_gNB_task, NULL) < 0) { - LOG_E(GTPU, "Create task for GTPV1U failed\n"); - return -1; - }*/ } } @@ -710,7 +694,8 @@ int main( int argc, char **argv ) { RCconfig_NR_L1(); // don't create if node doesn't connect to RRC/S1/GTP - AssertFatal(create_gNB_tasks(1) == 0,"cannot create ITTI tasks\n"); + int ret=create_gNB_tasks(1); + AssertFatal(ret==0,"cannot create ITTI tasks\n"); /* Start the agent. If it is turned off in the configuration, it won't start */ /* RCconfig_nr_flexran(); diff --git a/executables/softmodem-common.c b/executables/softmodem-common.c index e10515ea1a..bdec733408 100644 --- a/executables/softmodem-common.c +++ b/executables/softmodem-common.c @@ -185,10 +185,12 @@ void signal_handler(int sig) { if (sig==SIGSEGV) { // get void*'s for all entries on the stack + /* size = backtrace(array, 10); // print out all the frames to stderr fprintf(stderr, "Error: signal %d:\n", sig); backtrace_symbols_fd(array, size, 2); + */ exit(-1); } else { if(sig==SIGINT ||sig==SOFTMODEM_RTSIGNAL) diff --git a/openair2/F1AP/f1ap_common.c b/openair2/F1AP/f1ap_common.c index 85f1286557..5b67b17f23 100644 --- a/openair2/F1AP/f1ap_common.c +++ b/openair2/F1AP/f1ap_common.c @@ -56,7 +56,7 @@ inline void ASN_DEBUG(const char *fmt, ...) { } #endif -uint8_t F1AP_get_next_transaction_identifier(module_id_t enb_mod_idP, module_id_t cu_mod_idP) { +uint8_t F1AP_get_next_transaction_identifier(instance_t enb_mod_idP, instance_t cu_mod_idP) { static uint8_t transaction_identifier[NUMBER_OF_eNB_MAX]; transaction_identifier[enb_mod_idP+cu_mod_idP] = (transaction_identifier[enb_mod_idP+cu_mod_idP] + 1) % F1AP_TRANSACTION_IDENTIFIER_NUMBER; @@ -64,36 +64,36 @@ uint8_t F1AP_get_next_transaction_identifier(module_id_t enb_mod_idP, module_id_ return transaction_identifier[enb_mod_idP+cu_mod_idP]; } -f1ap_cudu_inst_t *getCxt(bool isCU, module_id_t module_idP) { +f1ap_cudu_inst_t *getCxt(bool isCU, instance_t instanceP) { static pid_t t=-1; pid_t tNew=gettid(); AssertFatal ( t==-1 || t==tNew, "This is not thread safe\n"); t=tNew; - AssertFatal( module_idP < sizeofArray(f1_cu_inst), ""); - return isCU? f1_cu_inst[ module_idP]: f1_du_inst[ module_idP]; + AssertFatal( instanceP < sizeofArray(f1_cu_inst), ""); + return isCU? f1_cu_inst[ instanceP]: f1_du_inst[ instanceP]; } -void createF1inst(bool isCU, module_id_t module_idP, f1ap_setup_req_t *req) { +void createF1inst(bool isCU, instance_t instanceP, 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) ); + 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[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) ); + 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) ); } } int f1ap_add_ue(bool isCu, - module_id_t module_idP, + instance_t instanceP, rnti_t rntiP) { - f1ap_cudu_inst_t *f1_inst=getCxt(isCu, module_idP); + f1ap_cudu_inst_t *f1_inst=getCxt(isCu, instanceP); 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; - LOG_I(F1AP, "Updating the index of UE with RNTI %x and du_ue_f1ap_id %d\n", f1_inst->f1ap_ue[i].rnti, f1_inst->f1ap_ue[i].du_ue_f1ap_id); + LOG_I(F1AP, "Updating the index of UE with RNTI %x and du_ue_f1ap_id %ld\n", f1_inst->f1ap_ue[i].rnti, f1_inst->f1ap_ue[i].du_ue_f1ap_id); return i; } } @@ -105,7 +105,7 @@ int f1ap_add_ue(bool isCu, f1_inst->f1ap_ue[i].du_ue_f1ap_id = rntiP; f1_inst->f1ap_ue[i].cu_ue_f1ap_id = rntiP; f1_inst->num_ues++; - LOG_I(F1AP, "Adding a new UE with RNTI %x and cu/du ue_f1ap_id %d\n", f1_inst->f1ap_ue[i].rnti, f1_inst->f1ap_ue[i].du_ue_f1ap_id); + LOG_I(F1AP, "Adding a new UE with RNTI %x and cu/du ue_f1ap_id %ld\n", f1_inst->f1ap_ue[i].rnti, f1_inst->f1ap_ue[i].du_ue_f1ap_id); return i; } } @@ -114,9 +114,9 @@ int f1ap_add_ue(bool isCu, } -int f1ap_remove_ue(bool isCu, module_id_t module_idP, +int f1ap_remove_ue(bool isCu, instance_t instanceP, rnti_t rntiP) { - f1ap_cudu_inst_t *f1_inst=getCxt(isCu, module_idP); + f1ap_cudu_inst_t *f1_inst=getCxt(isCu, instanceP); for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) { if (f1_inst->f1ap_ue[i].rnti == rntiP) { @@ -129,9 +129,9 @@ int f1ap_remove_ue(bool isCu, module_id_t module_idP, return 0; } -int f1ap_get_du_ue_f1ap_id(bool isCu, module_id_t module_idP, +int f1ap_get_du_ue_f1ap_id(bool isCu, instance_t instanceP, rnti_t rntiP) { - f1ap_cudu_inst_t *f1_inst=getCxt(isCu, module_idP); + f1ap_cudu_inst_t *f1_inst=getCxt(isCu, instanceP); for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) { if (f1_inst->f1ap_ue[i].rnti == rntiP) { @@ -142,9 +142,9 @@ int f1ap_get_du_ue_f1ap_id(bool isCu, module_id_t module_idP, return -1; } -int f1ap_get_cu_ue_f1ap_id(bool isCu, module_id_t module_idP, +int f1ap_get_cu_ue_f1ap_id(bool isCu, instance_t instanceP, rnti_t rntiP) { - f1ap_cudu_inst_t *f1_inst=getCxt(isCu, module_idP); + f1ap_cudu_inst_t *f1_inst=getCxt(isCu, instanceP); for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) { if (f1_inst->f1ap_ue[i].rnti == rntiP) { @@ -155,9 +155,9 @@ int f1ap_get_cu_ue_f1ap_id(bool isCu, module_id_t module_idP, return -1; } -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); +int f1ap_get_rnti_by_du_id(bool isCu, instance_t instanceP, + instance_t du_ue_f1ap_id ) { + f1ap_cudu_inst_t *f1_inst=getCxt(isCu, instanceP); for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) { if (f1_inst->f1ap_ue[i].du_ue_f1ap_id == du_ue_f1ap_id) { @@ -168,9 +168,9 @@ int f1ap_get_rnti_by_du_id(bool isCu, module_id_t module_idP, return -1; } -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); +int f1ap_get_rnti_by_cu_id(bool isCu, instance_t instanceP, + instance_t cu_ue_f1ap_id ) { + f1ap_cudu_inst_t *f1_inst=getCxt(isCu, instanceP); for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) { if (f1_inst->f1ap_ue[i].cu_ue_f1ap_id == cu_ue_f1ap_id) { @@ -181,9 +181,9 @@ int f1ap_get_rnti_by_cu_id(bool isCu, module_id_t module_idP, return -1; } -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); +int f1ap_get_du_uid(bool isCu, instance_t instanceP, + instance_t du_ue_f1ap_id ) { + f1ap_cudu_inst_t *f1_inst=getCxt(isCu, instanceP); for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) { if (f1_inst->f1ap_ue[i].du_ue_f1ap_id == du_ue_f1ap_id) { @@ -194,9 +194,9 @@ int f1ap_get_du_uid(bool isCu, module_id_t module_idP, return -1; } -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); +int f1ap_get_cu_uid(bool isCu, instance_t instanceP, + instance_t cu_ue_f1ap_id ) { + f1ap_cudu_inst_t *f1_inst=getCxt(isCu, instanceP); for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) { if (f1_inst->f1ap_ue[i].cu_ue_f1ap_id == cu_ue_f1ap_id) { @@ -207,9 +207,9 @@ int f1ap_get_cu_uid(bool isCu, module_id_t module_idP, return -1; } -int f1ap_get_uid_by_rnti(bool isCu, module_id_t module_idP, +int f1ap_get_uid_by_rnti(bool isCu, instance_t instanceP, rnti_t rntiP ) { - f1ap_cudu_inst_t *f1_inst=getCxt(isCu, module_idP); + f1ap_cudu_inst_t *f1_inst=getCxt(isCu, instanceP); for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) { if (f1_inst->f1ap_ue[i].rnti == rntiP) { @@ -220,35 +220,35 @@ int f1ap_get_uid_by_rnti(bool isCu, module_id_t module_idP, return -1; } -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) { - 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); +int f1ap_du_add_cu_ue_id(bool isCu, instance_t instanceP, + instance_t du_ue_f1ap_id, + instance_t cu_ue_f1ap_id) { + f1ap_cudu_inst_t *f1_inst=getCxt(isCu, instanceP); + instance_t f1ap_uid = f1ap_get_du_uid(isCu, instanceP,du_ue_f1ap_id); if (f1ap_uid < 0 || f1ap_uid >= MAX_MOBILES_PER_ENB) return -1; f1_inst->f1ap_ue[f1ap_uid].cu_ue_f1ap_id = cu_ue_f1ap_id; - LOG_I(F1AP, "Adding cu_ue_f1ap_id %d for UE with RNTI %x\n", cu_ue_f1ap_id, f1_inst->f1ap_ue[f1ap_uid].rnti); + LOG_I(F1AP, "Adding cu_ue_f1ap_id %ld for UE with RNTI %x\n", cu_ue_f1ap_id, f1_inst->f1ap_ue[f1ap_uid].rnti); return 0; } -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) { - 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); +int f1ap_cu_add_du_ue_id(bool isCu, instance_t instanceP, + instance_t cu_ue_f1ap_id, + instance_t du_ue_f1ap_id) { + f1ap_cudu_inst_t *f1_inst=getCxt(isCu, instanceP); + instance_t f1ap_uid = f1ap_get_cu_uid(isCu,instanceP,cu_ue_f1ap_id); if (f1ap_uid < 0 || f1ap_uid >= MAX_MOBILES_PER_ENB) return -1; f1_inst->f1ap_ue[f1ap_uid].du_ue_f1ap_id = du_ue_f1ap_id; - 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); + LOG_I(F1AP, "Adding du_ue_f1ap_id %ld 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); +int f1ap_assoc_id(bool isCu, instance_t instanceP) { + f1ap_setup_req_t *f1_inst=f1ap_req(isCu, instanceP); return f1_inst->assoc_id; } diff --git a/openair2/F1AP/f1ap_common.h b/openair2/F1AP/f1ap_common.h index 2c357cd199..8e11f17258 100644 --- a/openair2/F1AP/f1ap_common.h +++ b/openair2/F1AP/f1ap_common.h @@ -421,9 +421,9 @@ int f1ap_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, typedef struct f1ap_cudu_ue_inst_s { // used for eNB stats generation rnti_t rnti; - module_id_t f1ap_uid; - module_id_t du_ue_f1ap_id; - module_id_t cu_ue_f1ap_id; + instance_t f1ap_uid; + instance_t du_ue_f1ap_id; + instance_t cu_ue_f1ap_id; } f1ap_cudu_ue_t; typedef struct f1ap_cudu_inst_s { @@ -438,54 +438,54 @@ 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); +uint8_t F1AP_get_next_transaction_identifier(instance_t enb_mod_idP, instance_t cu_mod_idP); -f1ap_cudu_inst_t *getCxt(bool isCU, module_id_t module_idP); +f1ap_cudu_inst_t *getCxt(bool isCU, instance_t instanceP); -void createF1inst(bool isCU, module_id_t module_idP, f1ap_setup_req_t *req); +void createF1inst(bool isCU, instance_t instanceP, f1ap_setup_req_t *req); int f1ap_add_ue(bool isCu, - module_id_t module_idP, + instance_t instanceP, rnti_t rntiP); -int f1ap_remove_ue(bool isCu, module_id_t module_idP, +int f1ap_remove_ue(bool isCu, instance_t instanceP, rnti_t rntiP); -int f1ap_get_du_ue_f1ap_id (bool isCu, module_id_t module_idP, +int f1ap_get_du_ue_f1ap_id (bool isCu, instance_t instanceP, rnti_t rntiP); -int f1ap_get_cu_ue_f1ap_id (bool isCu, module_id_t module_idP, +int f1ap_get_cu_ue_f1ap_id (bool isCu, instance_t instanceP, rnti_t rntiP); -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_du_id(bool isCu, instance_t instanceP, + instance_t du_ue_f1ap_id ); -int f1ap_get_rnti_by_cu_id(bool isCu, module_id_t module_idP, - module_id_t cu_ue_f1ap_id ); +int f1ap_get_rnti_by_cu_id(bool isCu, instance_t instanceP, + instance_t cu_ue_f1ap_id ); -int f1ap_get_du_uid(bool isCu, module_id_t module_idP, - module_id_t du_ue_f1ap_id ); +int f1ap_get_du_uid(bool isCu, instance_t instanceP, + instance_t du_ue_f1ap_id ); -int f1ap_get_cu_uid(bool isCu, module_id_t module_idP, - module_id_t cu_ue_f1ap_id ); +int f1ap_get_cu_uid(bool isCu, instance_t instanceP, + instance_t cu_ue_f1ap_id ); -int f1ap_get_uid_by_rnti(bool isCu, module_id_t module_idP, +int f1ap_get_uid_by_rnti(bool isCu, instance_t instanceP, rnti_t rntiP ); -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_du_add_cu_ue_id(bool isCu, instance_t instanceP, + instance_t du_ue_f1ap_id, + instance_t cu_ue_f1ap_id); -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_cu_add_du_ue_id(bool isCu, instance_t instanceP, + instance_t cu_ue_f1ap_id, + instance_t du_ue_f1ap_id); -int f1ap_assoc_id(bool isCu, module_id_t module_idP); +int f1ap_assoc_id(bool isCu, instance_t instanceP); -static inline f1ap_setup_req_t *f1ap_req(bool isCu, module_id_t module_idP) { - return &getCxt(isCu, module_idP)->setupReq; +static inline f1ap_setup_req_t *f1ap_req(bool isCu, instance_t instanceP) { + return &getCxt(isCu, instanceP)->setupReq; } #define asn1cCalloc(VaR, TyPe, lOcPtr) TyPe *lOcPtr=VaR=(TyPe*) calloc(1,sizeof(TyPe)); diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index d65a58e27d..4e3191e62c 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -228,11 +228,11 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, int CU_send_F1_SETUP_RESPONSE(instance_t instance, f1ap_setup_resp_t *f1ap_setup_resp) { - module_id_t enb_mod_idP; - module_id_t cu_mod_idP; + instance_t enb_mod_idP; + instance_t cu_mod_idP; // This should be fixed - enb_mod_idP = (module_id_t)0; - cu_mod_idP = (module_id_t)0; + enb_mod_idP = (instance_t)0; + cu_mod_idP = (instance_t)0; F1AP_F1AP_PDU_t pdu= {0}; uint8_t *buffer=NULL; uint32_t len=0; @@ -335,8 +335,8 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance, int CU_send_F1_SETUP_FAILURE(instance_t instance) { LOG_D(F1AP, "CU_send_F1_SETUP_FAILURE\n"); - module_id_t enb_mod_idP=0; - module_id_t cu_mod_idP=0; + instance_t enb_mod_idP=0; + instance_t cu_mod_idP=0; // This should be fixed F1AP_F1AP_PDU_t pdu= {0}; uint8_t *buffer=NULL; diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index e005b999fd..78e7ae2c30 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -68,7 +68,7 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, /* 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); - module_id_t du_ue_f1ap_id = ie->value.choice.GNB_DU_UE_F1AP_ID; + instance_t du_ue_f1ap_id = ie->value.choice.GNB_DU_UE_F1AP_ID; /* NRCGI * Fixme: process NRCGI */ @@ -308,13 +308,13 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, RRC_DCCH_DATA_IND (message_p).dcch_index = srb_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).instance = instance; RRC_DCCH_DATA_IND (message_p).eNB_index = instance; // not needed for CU itti_send_msg_to_task(TASK_RRC_ENB, instance, message_p); */ protocol_ctxt_t ctxt; - ctxt.module_id = instance; + ctxt.instance = instance; ctxt.instance = instance; ctxt.rnti = f1ap_get_rnti_by_cu_id(true, instance, cu_ue_f1ap_id); ctxt.enb_flag = 1; diff --git a/openair2/F1AP/f1ap_cu_task.c b/openair2/F1AP/f1ap_cu_task.c index 9ffa3ab800..ae320c03a3 100644 --- a/openair2/F1AP/f1ap_cu_task.c +++ b/openair2/F1AP/f1ap_cu_task.c @@ -36,8 +36,9 @@ #include "f1ap_cu_ue_context_management.h" #include "f1ap_cu_task.h" #include "proto_agent.h" +#include -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,instance_t gtpuInstance, sctp_new_association_ind_t *sctp_new_association_ind) { createF1inst(true, instance, NULL); // save the assoc id f1ap_setup_req_t *f1ap_cu_data=f1ap_req(true, instance); @@ -48,7 +49,7 @@ void cu_task_handle_sctp_association_ind(instance_t instance, sctp_new_associati // Nothing } -void cu_task_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp) { +static void cu_task_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp) { DevAssert(sctp_new_association_resp != NULL); if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) { @@ -63,7 +64,7 @@ void cu_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat } } -void cu_task_handle_sctp_data_ind(instance_t instance, sctp_data_ind_t *sctp_data_ind) { +static void cu_task_handle_sctp_data_ind(instance_t instance, sctp_data_ind_t *sctp_data_ind) { int result; DevAssert(sctp_data_ind != NULL); f1ap_handle_message(instance, sctp_data_ind->assoc_id, sctp_data_ind->stream, @@ -72,7 +73,7 @@ void cu_task_handle_sctp_data_ind(instance_t instance, sctp_data_ind_t *sctp_dat AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); } -void cu_task_send_sctp_init_req(instance_t enb_id) { +static void cu_task_send_sctp_init_req(instance_t instance, char * my_addr) { // 1. get the itti msg, and retrive the enb_id from the message // 2. use RC.rrc[enb_id] to fill the sctp_init_t with the ip, port // 3. creat an itti message to init @@ -84,12 +85,7 @@ void cu_task_send_sctp_init_req(instance_t enb_id) { message_p->ittiMsg.sctp_init.ipv4 = 1; message_p->ittiMsg.sctp_init.ipv6 = 0; message_p->ittiMsg.sctp_init.nb_ipv4_addr = 1; - - if (RC.nrrrc[0]->node_type == ngran_gNB_CU) { - message_p->ittiMsg.sctp_init.ipv4_address[0] = inet_addr(RC.nrrrc[enb_id]->eth_params_s.my_addr); - } else { - message_p->ittiMsg.sctp_init.ipv4_address[0] = inet_addr(RC.rrc[enb_id]->eth_params_s.my_addr); - } + message_p->ittiMsg.sctp_init.ipv4_address[0] = inet_addr(my_addr); /* * SR WARNING: ipv6 multi-homing fails sometimes for localhost. @@ -97,19 +93,35 @@ void cu_task_send_sctp_init_req(instance_t enb_id) { */ message_p->ittiMsg.sctp_init.nb_ipv6_addr = 0; message_p->ittiMsg.sctp_init.ipv6_address[0] = "0:0:0:0:0:0:0:1"; - itti_send_msg_to_task(TASK_SCTP, enb_id, message_p); + itti_send_msg_to_task(TASK_SCTP, instance, message_p); } -void * -F1AP_CU_task(void *arg) { +instance_t cu_task_create_gtpu_instance_to_du(eth_params_t *IPaddrs) { + openAddr_t tmp={0}; + strncpy(tmp.originHost, IPaddrs->my_addr, sizeof(tmp.originHost)-1); + strncpy(tmp.destinationHost, IPaddrs->remote_addr, sizeof(tmp.destinationHost)-1); + sprintf(tmp.originService, "%d", GTPV1U_UDP_PORT); + sprintf(tmp.destinationService, "%d", GTPV1U_UDP_PORT); + return ocp_gtpv1Init(tmp); +} + +void * F1AP_CU_task(void *arg) { MessageDef *received_msg = NULL; int result; LOG_I(F1AP, "Starting F1AP at CU\n"); // no RLC in CU, initialize mem pool for PDCP pool_buffer_init(); itti_mark_task_ready(TASK_CU_F1); - cu_task_send_sctp_init_req(0); - + eth_params_t *IPaddrs; + // Hardcoded instance id! + if (RC.nrrrc[0]->node_type == ngran_gNB_CU) + IPaddrs=&RC.nrrrc[0]->eth_params_s; + else + IPaddrs=&RC.rrc[0]->eth_params_s; + cu_task_send_sctp_init_req(0, IPaddrs->my_addr); + instance_t gtpInstance=cu_task_create_gtpu_instance_to_du(IPaddrs); + AssertFatal(gtpInstance>0,"Failed to create CU F1-U UDP listener"); + while (1) { itti_receive_msg(TASK_CU_F1, &received_msg); @@ -118,6 +130,7 @@ F1AP_CU_task(void *arg) { 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_ORIGIN_INSTANCE(received_msg), + gtpInstance, &received_msg->ittiMsg.sctp_new_association_ind); break; diff --git a/openair2/F1AP/f1ap_cu_task.h b/openair2/F1AP/f1ap_cu_task.h index dec844accf..9048d2b157 100644 --- a/openair2/F1AP/f1ap_cu_task.h +++ b/openair2/F1AP/f1ap_cu_task.h @@ -22,11 +22,6 @@ #ifndef F1AP_CU_TASK_H_ #define F1AP_CU_TASK_H_ -void cu_task_handle_sctp_association_ind(instance_t instance, sctp_new_association_ind_t *sctp_new_association_ind); -void cu_task_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp); -void cu_task_handle_sctp_data_ind(instance_t instance, sctp_data_ind_t *sctp_data_ind); -void cu_task_send_sctp_init_req(instance_t enb_id); - void *F1AP_CU_task(void *arg); #endif /* F1AP_CU_TASK_H_ */ diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index c8bc6da47f..16316465ba 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -631,7 +631,7 @@ int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, F1AP_UEContextSetupResponseIEs_t *ie; DevAssert(pdu); msg_p = itti_alloc_new_message(TASK_DU_F1, 0, F1AP_UE_CONTEXT_SETUP_RESP); - f1ap_ue_context_setup_resp_t *f1ap_ue_context_setup_resp = &F1AP_UE_CONTEXT_SETUP_RESP(msg_p); + f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_resp = &F1AP_UE_CONTEXT_SETUP_RESP(msg_p); container = &pdu->choice.successfulOutcome->value.choice.UEContextSetupResponse; int i; diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index a646ef1107..9c06597ecb 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -93,8 +93,8 @@ int DU_handle_ERROR_INDICATION(instance_t instance, // SETUP REQUEST int DU_send_F1_SETUP_REQUEST(instance_t instance) { - module_id_t enb_mod_idP=0; - module_id_t du_mod_idP=0; + instance_t enb_mod_idP=0; + instance_t du_mod_idP=0; F1AP_F1AP_PDU_t pdu= {0}; uint8_t *buffer; uint32_t len; diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index dbb10cd4a0..fcf6476958 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -165,11 +165,11 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, AssertFatal(srb_id<3,"illegal srb_id\n"); protocol_ctxt_t ctxt; ctxt.rnti = f1ap_get_rnti_by_du_id(false, instance, du_ue_f1ap_id); - ctxt.module_id = instance; + ctxt.instance = instance; ctxt.instance = instance; ctxt.enb_flag = 1; struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context( - RC.rrc[ctxt.module_id], + RC.rrc[ctxt.instance], ctxt.rnti); if (srb_id == 0) { @@ -260,7 +260,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, mac_MainConfig = &radioResourceConfigDedicated->mac_MainConfig->choice.explicitValue; rrc_mac_config_req_eNB( - ctxt.module_id, + ctxt.instance, 0, //primaryCC_id, 0,0,0,0,0,0, ctxt.rnti, @@ -387,7 +387,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, message_p = itti_alloc_new_message(TASK_DU_F1, 0, RRC_MAC_DRX_CONFIG_REQ); RRC_MAC_DRX_CONFIG_REQ(message_p).rnti = ctxt.rnti; RRC_MAC_DRX_CONFIG_REQ(message_p).drx_Configuration = mac_MainConfig->drx_Config; - itti_send_msg_to_task(TASK_MAC_ENB, ctxt.module_id, message_p); + itti_send_msg_to_task(TASK_MAC_ENB, ctxt.instance, message_p); LOG_D(F1AP, "DRX configured in MAC Main Configuration for RRC Connection Reconfiguration\n"); } @@ -410,9 +410,9 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, } else if (SRB_configList->list.array[i]->srb_Identity == 2 ) { ue_context_p->ue_context.Srb2.Active=1; ue_context_p->ue_context.Srb2.Srb_info.Srb_id=2; - LOG_I(F1AP, "[DU %d] SRB2 is now active\n",ctxt.module_id); + LOG_I(F1AP, "[DU %ld] SRB2 is now active\n",ctxt.instance); } else { - LOG_W(F1AP, "[DU %d] invalide SRB identity %ld\n",ctxt.module_id, + LOG_W(F1AP, "[DU %ld] invalide SRB identity %ld\n",ctxt.instance, SRB_configList->list.array[i]->srb_Identity); } } @@ -423,8 +423,8 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, if (DRB_configList->list.array[i]) { drb_id = (int)DRB_configList->list.array[i]->drb_Identity; LOG_I(F1AP, - "[DU %d] Logical Channel UL-DCCH, Received RRCConnectionReconfiguration for UE rnti %x, reconfiguring DRB %d/LCID %d\n", - ctxt.module_id, + "[DU %ld] Logical Channel UL-DCCH, Received RRCConnectionReconfiguration for UE rnti %x, reconfiguring DRB %d/LCID %d\n", + ctxt.instance, ctxt.rnti, (int)DRB_configList->list.array[i]->drb_Identity, (int)*DRB_configList->list.array[i]->logicalChannelIdentity); @@ -437,7 +437,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, } rrc_mac_config_req_eNB( - ctxt.module_id, + ctxt.instance, 0,0,0,0,0,0, 0, ue_context_p->ue_context.rnti, @@ -746,7 +746,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance, /* UL RRC Message Transfer */ -int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, +int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instanceP, int CC_idP, int UE_id, rnti_t rntiP, @@ -758,7 +758,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, F1AP_InitialULRRCMessageTransfer_t *out; uint8_t *buffer=NULL; uint32_t len=0; - int f1ap_uid = f1ap_add_ue (false, module_idP, rntiP); + int f1ap_uid = f1ap_add_ue (false, instanceP, rntiP); if (f1ap_uid < 0 ) { LOG_E(F1AP, "Failed to add UE \n"); @@ -779,7 +779,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, ie1->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; ie1->criticality = F1AP_Criticality_reject; ie1->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie1->value.choice.GNB_DU_UE_F1AP_ID = getCxt(false, module_idP)->f1ap_ue[f1ap_uid].du_ue_f1ap_id; + ie1->value.choice.GNB_DU_UE_F1AP_ID = getCxt(false, instanceP)->f1ap_ue[f1ap_uid].du_ue_f1ap_id; /* mandatory */ /* c2. NRCGI */ asn1cSequenceAdd(out->protocolIEs.list, F1AP_InitialULRRCMessageTransferIEs_t, ie2); @@ -787,7 +787,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, 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(false, module_idP)->setupReq.cell); + addnRCGI(ie2->value.choice.NRCGI, getCxt(false, instanceP)->setupReq.cell); /* mandatory */ /* c3. C_RNTI */ // 16 asn1cSequenceAdd(out->protocolIEs.list, F1AP_InitialULRRCMessageTransferIEs_t, ie3); @@ -821,7 +821,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, return -1; } - f1ap_itti_send_sctp_data_req(false, module_idP, buffer, len, getCxt(false, module_idP)->default_sctp_stream_id); + f1ap_itti_send_sctp_data_req(false, instanceP, buffer, len, getCxt(false, instanceP)->default_sctp_stream_id); return 0; } diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.h b/openair2/F1AP/f1ap_du_rrc_message_transfer.h index 563898224c..d6f196e384 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.h +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.h @@ -44,7 +44,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance, const f1ap_ul_rrc_message_t *msg); int DU_send_UL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, const f1ap_ul_rrc_message_t *msg); -int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, +int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instanceP, int CC_idP, int UE_id, rnti_t rntiP, diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 9532b4f903..a4c1b0d314 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -43,7 +43,6 @@ #include -int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup_req_t *req); int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, uint32_t assoc_id, uint32_t stream, @@ -200,7 +199,7 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, // decode RRC Container and act on the message type //FIXME //rnti_t rnti = f1ap_get_rnti_by_du_id(false, instance, du_ue_f1ap_id); - ctxt.module_id = instance; + ctxt.instance = instance; ctxt.instance = instance; ctxt.enb_flag = 1; mem_block_t *pdcp_pdu_p = get_free_mem_block(ieRRC->value.choice.RRCContainer.size, __func__); @@ -648,7 +647,7 @@ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, 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(false, instance, ie->value.choice.GNB_CU_UE_F1AP_ID); - ctxt.module_id = instance; + ctxt.instance = instance; ctxt.instance = instance; ctxt.enb_flag = 1; /* GNB_DU_UE_F1AP_ID */ @@ -735,7 +734,7 @@ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, struct rrc_eNB_ue_context_s *ue_context_p; - ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ctxt.module_id], ctxt.rnti); + ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ctxt.instance], ctxt.rnti); if (ue_context_p && !UE_out_of_sync) { /* UE exists and is in sync so we start a timer before releasing the diff --git a/openair2/F1AP/f1ap_du_ue_context_management.h b/openair2/F1AP/f1ap_du_ue_context_management.h index 320061672a..7d2d719f08 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.h +++ b/openair2/F1AP/f1ap_du_ue_context_management.h @@ -85,6 +85,8 @@ int DU_handle_UE_CONTEXT_MODIFICATION_CONFIRM(instance_t instance, uint32_t stream, F1AP_F1AP_PDU_t *pdu); +int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup_req_t *req); + /* * UE Inactivity Notification */ diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 1f22ce4c76..3ebd882885 100755 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -418,7 +418,7 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, //sib1->ServCellCom->downlinkConfigCommon.frequencyInfoDL.offsetToPointA = configuration->scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier; ServCellCom->downlinkConfigCommon.frequencyInfoDL.offsetToPointA = 86; - int ref_scs; + int ref_scs=0; if (configuration->scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA < 600000) ref_scs = 0; // 15 khz if (configuration->scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA > 2016666) From 21a9ca8ccedfcf5a8f82e0ea955b5ed2eaa6aca1 Mon Sep 17 00:00:00 2001 From: Laurent Thomas Date: Thu, 9 Sep 2021 11:46:34 +0200 Subject: [PATCH 054/110] gcc warning fix --- executables/softmodem-common.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/executables/softmodem-common.c b/executables/softmodem-common.c index bdec733408..01aec42c01 100644 --- a/executables/softmodem-common.c +++ b/executables/softmodem-common.c @@ -180,12 +180,13 @@ void softmodem_printresources(int sig, telnet_printfunc_t pf) { } void signal_handler(int sig) { - void *array[10]; - size_t size; + //void *array[10]; + //size_t size; if (sig==SIGSEGV) { // get void*'s for all entries on the stack - /* + /* backtrace uses malloc, that is not good in signal handlers + * I let the code, because it would be nice to make it better size = backtrace(array, 10); // print out all the frames to stderr fprintf(stderr, "Error: signal %d:\n", sig); From a8550e42156c8b77318eeb71da0cc1ec9776c1ac Mon Sep 17 00:00:00 2001 From: matzakos Date: Thu, 9 Sep 2021 12:17:10 +0200 Subject: [PATCH 055/110] Fix memory allocation issue at UE ctxt setup response handling --- openair2/RRC/NR/rrc_gNB.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index fcaa27c80d..80da3a9cdf 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -3283,9 +3283,9 @@ static void rrc_CU_process_ue_context_setup_response(MessageDef *msg_p, const ch LOG_I(NR_RRC, "rlc_BearerToAddModList not empty before filling it \n"); free(ue_context_p->ue_context.masterCellGroup->rlc_BearerToAddModList); } - ue_context_p->ue_context.masterCellGroup->rlc_BearerToAddModList = calloc(1, sizeof(cellGroupConfig->rlc_BearerToAddModList)); + ue_context_p->ue_context.masterCellGroup->rlc_BearerToAddModList = calloc(1, sizeof(*cellGroupConfig->rlc_BearerToAddModList)); memcpy(ue_context_p->ue_context.masterCellGroup->rlc_BearerToAddModList, cellGroupConfig->rlc_BearerToAddModList, - sizeof(struct NR_CellGroupConfig__rlc_BearerToAddModList)); + sizeof(*cellGroupConfig->rlc_BearerToAddModList)); } xer_fprint(stdout,&asn_DEF_NR_CellGroupConfig, ue_context_p->ue_context.masterCellGroup); @@ -3800,7 +3800,6 @@ void *rrc_gnb_task(void *args_p) { case F1AP_UE_CONTEXT_SETUP_RESP: rrc_CU_process_ue_context_setup_response(msg_p, msg_name_p, instance); - LOG_W(NR_RRC, "Handling of F1 UE context setup response context at the RRC layer of the CU is pending \n"); break; /* Messages from X2AP */ From 8e66c6a4892d1390bace5951f6598f93761884d6 Mon Sep 17 00:00:00 2001 From: Laurent Thomas Date: Thu, 9 Sep 2021 19:37:07 +0200 Subject: [PATCH 056/110] F1-U development --- openair2/COMMON/f1ap_messages_types.h | 3 + openair2/F1AP/f1ap_common.h | 1 + openair2/F1AP/f1ap_cu_task.c | 29 ++-- openair2/F1AP/f1ap_cu_ue_context_management.c | 23 ++- openair2/F1AP/f1ap_du_task.c | 91 +++++++----- openair2/GNB_APP/gnb_app.c | 2 - openair2/GNB_APP/gnb_config.c | 139 +++++++++--------- openair2/RRC/NR/rrc_gNB.c | 41 +----- openair3/ocp-gtpu/gtp_itf.cpp | 5 +- 9 files changed, 175 insertions(+), 159 deletions(-) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index a7526ce4b3..de4366ce72 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -108,6 +108,8 @@ typedef struct f1ap_setup_req_s { /* 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; @@ -318,6 +320,7 @@ typedef struct f1ap_ul_rrc_message_s { typedef struct f1ap_up_tnl_s { in_addr_t tl_address; // currently only IPv4 supported teid_t teid; + uint16_t port; } f1ap_up_tnl_t; typedef struct f1ap_drb_to_be_setup_s { diff --git a/openair2/F1AP/f1ap_common.h b/openair2/F1AP/f1ap_common.h index 8e11f17258..f60c900224 100644 --- a/openair2/F1AP/f1ap_common.h +++ b/openair2/F1AP/f1ap_common.h @@ -431,6 +431,7 @@ typedef struct f1ap_cudu_inst_s { uint16_t sctp_in_streams; uint16_t sctp_out_streams; uint16_t default_sctp_stream_id; + instance_t gtpInst; uint64_t gNB_DU_id; uint16_t num_ues; f1ap_cudu_ue_t f1ap_ue[MAX_MOBILES_PER_ENB]; diff --git a/openair2/F1AP/f1ap_cu_task.c b/openair2/F1AP/f1ap_cu_task.c index ae320c03a3..a9388d743a 100644 --- a/openair2/F1AP/f1ap_cu_task.c +++ b/openair2/F1AP/f1ap_cu_task.c @@ -38,7 +38,17 @@ #include "proto_agent.h" #include -static void cu_task_handle_sctp_association_ind(instance_t instance,instance_t gtpuInstance, sctp_new_association_ind_t *sctp_new_association_ind) { +static instance_t cu_task_create_gtpu_instance_to_du(eth_params_t *IPaddrs) { + openAddr_t tmp={0}; + strncpy(tmp.originHost, IPaddrs->my_addr, sizeof(tmp.originHost)-1); + strncpy(tmp.destinationHost, IPaddrs->remote_addr, sizeof(tmp.destinationHost)-1); + sprintf(tmp.originService, "%d", GTPV1U_UDP_PORT); + sprintf(tmp.destinationService, "%d", GTPV1U_UDP_PORT); + return ocp_gtpv1Init(tmp); +} + +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); // save the assoc id f1ap_setup_req_t *f1ap_cu_data=f1ap_req(true, instance); @@ -46,6 +56,8 @@ static void cu_task_handle_sctp_association_ind(instance_t instance,instance_t g 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->default_sctp_stream_id = 0; + getCxt(true, instance)->gtpInst=cu_task_create_gtpu_instance_to_du(IPaddrs); + AssertFatal(getCxt(true, instance)->gtpInst>0,"Failed to create CU F1-U UDP listener"); // Nothing } @@ -96,15 +108,6 @@ static void cu_task_send_sctp_init_req(instance_t instance, char * my_addr) { itti_send_msg_to_task(TASK_SCTP, instance, message_p); } -instance_t cu_task_create_gtpu_instance_to_du(eth_params_t *IPaddrs) { - openAddr_t tmp={0}; - strncpy(tmp.originHost, IPaddrs->my_addr, sizeof(tmp.originHost)-1); - strncpy(tmp.destinationHost, IPaddrs->remote_addr, sizeof(tmp.destinationHost)-1); - sprintf(tmp.originService, "%d", GTPV1U_UDP_PORT); - sprintf(tmp.destinationService, "%d", GTPV1U_UDP_PORT); - return ocp_gtpv1Init(tmp); -} - void * F1AP_CU_task(void *arg) { MessageDef *received_msg = NULL; int result; @@ -119,8 +122,6 @@ void * F1AP_CU_task(void *arg) { else IPaddrs=&RC.rrc[0]->eth_params_s; cu_task_send_sctp_init_req(0, IPaddrs->my_addr); - instance_t gtpInstance=cu_task_create_gtpu_instance_to_du(IPaddrs); - AssertFatal(gtpInstance>0,"Failed to create CU F1-U UDP listener"); while (1) { itti_receive_msg(TASK_CU_F1, &received_msg); @@ -130,8 +131,8 @@ void * F1AP_CU_task(void *arg) { 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_ORIGIN_INSTANCE(received_msg), - gtpInstance, - &received_msg->ittiMsg.sctp_new_association_ind); + &received_msg->ittiMsg.sctp_new_association_ind, + IPaddrs); break; case SCTP_NEW_ASSOCIATION_RESP: diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 0e1d6dac1b..6669b315cc 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -43,6 +43,7 @@ #include "rrc_eNB_S1AP.h" #include "rrc_eNB_GTPV1U.h" #include "openair2/RRC/NR/rrc_gNB_NGAP.h" +#include static void setQos(F1AP_NonDynamic5QIDescriptor_t *toFill) { asn1cCalloc(toFill,F1AP_NonDynamic5QIDescriptor_t, tmp); @@ -510,6 +511,23 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* 12.1.3 uLUPTNLInformation_ToBeSetup_List */ for (int j = 0; j < f1ap_ue_context_setup_req->drbs_to_be_setup[i].up_ul_tnl_length; j++) { + /* Here the callback function used as input is not the right one. Need to create a new one probably for F1-U, not sure + * if the kind of input parameters to the callback function are convenient though for gtp-u over F1-U.*/ + //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 + transport_layer_addr_t addr; + int sz=sizeof(f1ap_ue_context_setup_req->drbs_to_be_setup[i].up_dl_tnl[0].tl_address); + memcpy(addr.buffer,&f1ap_ue_context_setup_req->drbs_to_be_setup[i].up_dl_tnl[0].tl_address, sz); + addr.length = sz*8; + + f1ap_ue_context_setup_req->drbs_to_be_setup[i].up_ul_tnl[j].teid= + newGtpuCreateTunnel(getCxt(true, instance)->gtpInst, + f1ap_ue_context_setup_req->rnti, + f1ap_ue_context_setup_req->drbs_to_be_setup[i].drb_id, + f1ap_ue_context_setup_req->drbs_to_be_setup[i].drb_id, + 0xFFFF, // We will set the right value from DU answer + addr, + f1ap_ue_context_setup_req->drbs_to_be_setup[i].up_dl_tnl[0].port, + cu_f1u_data_req); /* 12.3.1 ULTunnels_ToBeSetup_Item */ asn1cSequenceAdd(drbs_toBeSetup_item->uLUPTNLInformation_ToBeSetup_List.list, F1AP_ULUPTNLInformation_ToBeSetup_Item_t, uLUPTNLInformation_ToBeSetup_Item); @@ -687,7 +705,10 @@ 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_INT32(&dl_up_tnl0->gTP_TEID, drb_p->up_dl_tnl[0].teid); - + GtpuUpdateTunnelOutgoingTeid(getCxt(true, instance)->gtpInst, + f1ap_ue_context_setup_resp->rnti, + (ebi_t)drbs_setup_item_p->dRBID, + drb_p->up_dl_tnl[0].teid); } } // SRBs_FailedToBeSetup_List diff --git a/openair2/F1AP/f1ap_du_task.c b/openair2/F1AP/f1ap_du_task.c index 5a63e67946..4fdfc7b178 100644 --- a/openair2/F1AP/f1ap_du_task.c +++ b/openair2/F1AP/f1ap_du_task.c @@ -36,6 +36,7 @@ #include "f1ap_du_rrc_message_transfer.h" #include "f1ap_du_task.h" #include "proto_agent.h" +#include void du_task_send_sctp_association_req(instance_t instance, f1ap_setup_req_t *f1ap_setup_req) { DevAssert(f1ap_setup_req != NULL); @@ -87,7 +88,8 @@ void du_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat .remote_ipv4_address = RC.nrmac[instance]->eth_params_n.remote_addr, .remote_port = RC.nrmac[instance]->eth_params_n.remote_portd }; - AssertFatal(proto_agent_start(instance, ¶ms) == 0, + if (!RC.nrrrc) + AssertFatal(proto_agent_start(instance, ¶ms) == 0, "could not start PROTO_AGENT for F1U on instance %ld!\n", instance); DU_send_F1_SETUP_REQUEST(instance); } @@ -101,67 +103,81 @@ void du_task_handle_sctp_data_ind(instance_t instance, sctp_data_ind_t *sctp_dat AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); } +static instance_t du_create_gtpu_instance_to_cu(char* CUaddr, uint16_t CUport, char * DUaddr, uint16_t DUport) { + openAddr_t tmp={0}; + strncpy(tmp.originHost, DUaddr, sizeof(tmp.originHost)-1); + strncpy(tmp.destinationHost, CUaddr, sizeof(tmp.destinationHost)-1); + sprintf(tmp.originService, "%d", DUport); + sprintf(tmp.destinationService, "%d", CUport); + return ocp_gtpv1Init(tmp); +} void *F1AP_DU_task(void *arg) { //sctp_cu_init(); - MessageDef *received_msg = NULL; - int result; LOG_I(F1AP, "Starting F1AP at DU\n"); //f1ap_eNB_prepare_internal_data(); itti_mark_task_ready(TASK_DU_F1); // SCTP while (1) { - itti_receive_msg(TASK_DU_F1, &received_msg); + MessageDef *msg = NULL; + itti_receive_msg(TASK_DU_F1, &msg); + instance_t myInstance=ITTI_MSG_DESTINATION_INSTANCE(msg); - switch (ITTI_MSG_ID(received_msg)) { - // case TERMINATE_MESSAGE: - // //F1AP_WARN(" *** Exiting F1AP DU thread\n"); - // itti_exit_task(); - // break; - case F1AP_SETUP_REQ: // this is not a true F1 message, but rather an ITTI message sent by enb_app + switch (ITTI_MSG_ID(msg)) { + case F1AP_SETUP_REQ: + // this is not a true F1 message, but rather an ITTI message sent by enb_app // 1. save the itti msg so that you can use it to sen f1ap_setup_req, 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)); + LOG_I(F1AP, "DU Task Received F1AP_SETUP_REQ\n"); + f1ap_setup_req_t * msgSetup=&F1AP_SETUP_REQ(msg); + createF1inst(false, myInstance, msgSetup); + getCxt(false, myInstance)->gtpInst=du_create_gtpu_instance_to_cu(msgSetup->CU_f1_ip_address.ipv4_address, + msgSetup->CUport, + msgSetup->DU_f1_ip_address.ipv4_address, + msgSetup->DUport); + AssertFatal(getCxt(false, myInstance)->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=getCxt(false, myInstance)->gtpInst; + du_task_send_sctp_association_req(myInstance,msgSetup); break; case F1AP_GNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE: - DU_send_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(ITTI_MSG_ORIGIN_INSTANCE(received_msg), - &F1AP_GNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(received_msg)); + DU_send_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(ITTI_MSG_ORIGIN_INSTANCE(msg), + &F1AP_GNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(msg)); break; case F1AP_GNB_CU_CONFIGURATION_UPDATE_FAILURE: - DU_send_gNB_CU_CONFIGURATION_UPDATE_FAILURE(ITTI_MSG_DESTINATION_INSTANCE(received_msg), - &F1AP_GNB_CU_CONFIGURATION_UPDATE_FAILURE(received_msg)); + DU_send_gNB_CU_CONFIGURATION_UPDATE_FAILURE(myInstance, + &F1AP_GNB_CU_CONFIGURATION_UPDATE_FAILURE(msg)); break; case SCTP_NEW_ASSOCIATION_RESP: // 1. store the respon // 2. send the f1setup_req LOG_I(F1AP, "DU Task Received SCTP_NEW_ASSOCIATION_RESP\n"); - du_task_handle_sctp_association_resp(ITTI_MSG_DESTINATION_INSTANCE(received_msg), - &received_msg->ittiMsg.sctp_new_association_resp); + du_task_handle_sctp_association_resp(myInstance, + &msg->ittiMsg.sctp_new_association_resp); break; case SCTP_DATA_IND: // ex: any F1 incoming message for DU ends here LOG_I(F1AP, "DU Task Received SCTP_DATA_IND\n"); - du_task_handle_sctp_data_ind(ITTI_MSG_DESTINATION_INSTANCE(received_msg), - &received_msg->ittiMsg.sctp_data_ind); + du_task_handle_sctp_data_ind(myInstance, + &msg->ittiMsg.sctp_data_ind); break; case F1AP_INITIAL_UL_RRC_MESSAGE: // from rrc LOG_I(F1AP, "DU Task Received F1AP_INITIAL_UL_RRC_MESSAGE\n"); - f1ap_initial_ul_rrc_message_t *msg = &F1AP_INITIAL_UL_RRC_MESSAGE(received_msg); - DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(0,0,0,msg->crnti, - msg->rrc_container, - msg->rrc_container_length, - msg->du2cu_rrc_container, - msg->du2cu_rrc_container_length + f1ap_initial_ul_rrc_message_t *msgRrc = &F1AP_INITIAL_UL_RRC_MESSAGE(msg); + DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(0,0,0,msgRrc->crnti, + msgRrc->rrc_container, + msgRrc->rrc_container_length, + msgRrc->du2cu_rrc_container, + msgRrc->du2cu_rrc_container_length ); break; @@ -169,23 +185,23 @@ void *F1AP_DU_task(void *arg) { LOG_I(F1AP, "DU Task Received F1AP_UL_RRC_MESSAGE\n"); if (RC.nrrrc && RC.nrrrc[0]->node_type == ngran_gNB_DU) { - DU_send_UL_NR_RRC_MESSAGE_TRANSFER(ITTI_MSG_DESTINATION_INSTANCE(received_msg), - &F1AP_UL_RRC_MESSAGE(received_msg)); + DU_send_UL_NR_RRC_MESSAGE_TRANSFER(myInstance, + &F1AP_UL_RRC_MESSAGE(msg)); } else { - DU_send_UL_RRC_MESSAGE_TRANSFER(ITTI_MSG_DESTINATION_INSTANCE(received_msg), - &F1AP_UL_RRC_MESSAGE(received_msg)); + DU_send_UL_RRC_MESSAGE_TRANSFER(myInstance, + &F1AP_UL_RRC_MESSAGE(msg)); } break; case F1AP_UE_CONTEXT_SETUP_RESP: - DU_send_UE_CONTEXT_SETUP_RESPONSE(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &F1AP_UE_CONTEXT_SETUP_RESP(received_msg)); + DU_send_UE_CONTEXT_SETUP_RESPONSE(myInstance, &F1AP_UE_CONTEXT_SETUP_RESP(msg)); break; case F1AP_UE_CONTEXT_RELEASE_REQ: // from MAC LOG_I(F1AP, "DU Task Received F1AP_UE_CONTEXT_RELEASE_REQ\n"); - DU_send_UE_CONTEXT_RELEASE_REQUEST(ITTI_MSG_DESTINATION_INSTANCE(received_msg), - &F1AP_UE_CONTEXT_RELEASE_REQ(received_msg)); + DU_send_UE_CONTEXT_RELEASE_REQUEST(myInstance, + &F1AP_UE_CONTEXT_RELEASE_REQ(msg)); break; case TERMINATE_MESSAGE: @@ -195,13 +211,12 @@ void *F1AP_DU_task(void *arg) { default: LOG_E(F1AP, "DU Received unhandled message: %d:%s\n", - ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg)); + ITTI_MSG_ID(msg), ITTI_MSG_NAME(msg)); break; } // switch - result = itti_free (ITTI_MSG_ORIGIN_ID(received_msg), received_msg); + int result = itti_free (ITTI_MSG_ORIGIN_ID(msg), msg); AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); - received_msg = NULL; } // while return NULL; diff --git a/openair2/GNB_APP/gnb_app.c b/openair2/GNB_APP/gnb_app.c index 94b0820d08..cd041aabe4 100644 --- a/openair2/GNB_APP/gnb_app.c +++ b/openair2/GNB_APP/gnb_app.c @@ -240,8 +240,6 @@ void *gNB_app_task(void *args_p) RCconfig_NR_DU_F1(msg_p, 0); itti_send_msg_to_task (TASK_DU_F1, GNB_MODULE_ID_TO_INSTANCE(0), msg_p); - //start F1-U - RCconfig_nr_gtpu(); } } do { diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 428c06d830..bcce5a367a 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -1621,8 +1621,9 @@ int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) { config_getlist( &GNBParamList,GNBParams,sizeof(GNBParams)/sizeof(paramdef_t),NULL); 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; + f1ap_setup_req_t * f1Setup=&F1AP_SETUP_REQ(msg_p); + f1Setup->num_cells_available = 0; + f1Setup->cell_type=CELL_MACRO_GNB; for (k=0; k num_cells_available++; + 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); + f1Setup->gNB_DU_name = strdup(*(GNBParamList.paramarray[0][GNB_GNB_NAME_IDX].strptr)); + LOG_I(GNB_APP,"F1AP: gNB_DU_name[%d] %s\n",k,f1Setup->gNB_DU_name); + f1Setup->cell[k].tac = *GNBParamList.paramarray[i][GNB_TRACKING_AREA_CODE_IDX].uptr; + LOG_I(GNB_APP,"F1AP: tac[%d] %d\n",k,f1Setup->cell[k].tac); + f1Setup->cell[k].mcc = *PLMNParamList.paramarray[0][GNB_MOBILE_COUNTRY_CODE_IDX].uptr; + LOG_I(GNB_APP,"F1AP: mcc[%d] %d\n",k,f1Setup->cell[k].mcc); + f1Setup->cell[k].mnc = *PLMNParamList.paramarray[0][GNB_MOBILE_NETWORK_CODE_IDX].uptr; + LOG_I(GNB_APP,"F1AP: mnc[%d] %d\n",k,f1Setup->cell[k].mnc); + f1Setup->cell[k].mnc_digit_length = *PLMNParamList.paramarray[0][GNB_MNC_DIGIT_LENGTH].u8ptr; + LOG_I(GNB_APP,"F1AP: mnc_digit_length[%d] %d\n",k,f1Setup->cell[k].mnc_digit_length); + AssertFatal((f1Setup->cell[k].mnc_digit_length == 2) || + (f1Setup->cell[k].mnc_digit_length == 3), "BAD MNC DIGIT LENGTH %d", - F1AP_SETUP_REQ (msg_p).cell[k].mnc_digit_length); - F1AP_SETUP_REQ (msg_p).cell[k].nr_cellid = (uint64_t)*(GNBParamList.paramarray[i][GNB_NRCELLID_IDX].u64ptr); - LOG_I(GNB_APP,"F1AP: nr_cellid[%d] %ld\n",k,F1AP_SETUP_REQ (msg_p).cell[k].nr_cellid); + f1Setup->cell[k].mnc_digit_length); + 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: 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",F1AP_SETUP_REQ (msg_p).CU_f1_ip_address.ipv4_address,(int)strlen(RC.nrmac[k]->eth_params_n.remote_addr)); - F1AP_SETUP_REQ (msg_p).CU_f1_ip_address.ipv6 = 0; - F1AP_SETUP_REQ (msg_p).CU_f1_ip_address.ipv4 = 1; - //strcpy(F1AP_SETUP_REQ (msg_p).CU_f1_ip_address.ipv6_address, ""); - strcpy(F1AP_SETUP_REQ (msg_p).CU_f1_ip_address.ipv4_address, 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; + 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", - F1AP_SETUP_REQ (msg_p).DU_f1_ip_address.ipv4_address, + f1Setup->DU_f1_ip_address.ipv4_address, strlen(RC.nrmac[k]->eth_params_n.my_addr)); - F1AP_SETUP_REQ (msg_p).DU_f1_ip_address.ipv6 = 0; - F1AP_SETUP_REQ (msg_p).DU_f1_ip_address.ipv4 = 1; - //strcpy(F1AP_SETUP_REQ (msg_p).DU_f1_ip_address.ipv6_address, ""); - strcpy(F1AP_SETUP_REQ (msg_p).DU_f1_ip_address.ipv4_address, RC.nrmac[k]->eth_params_n.my_addr); - //strcpy(F1AP_SETUP_REQ (msg_p).CU_ip_address[l].ipv6_address,*(F1ParamList.paramarray[l][ENB_CU_IPV6_ADDRESS_IDX].strptr)); + 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); - F1AP_SETUP_REQ (msg_p).sctp_in_streams = (uint16_t)*(SCTPParams[GNB_SCTP_INSTREAMS_IDX].uptr); - F1AP_SETUP_REQ (msg_p).sctp_out_streams = (uint16_t)*(SCTPParams[GNB_SCTP_OUTSTREAMS_IDX].uptr); + 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]; // wait until RRC cell information is configured int cell_info_configured = 0; @@ -1688,53 +1691,53 @@ int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) { pthread_mutex_unlock(&rrc->cell_info_mutex); } while (cell_info_configured == 0); - rrc->configuration.mcc[0] = F1AP_SETUP_REQ (msg_p).cell[k].mcc; - rrc->configuration.mnc[0] = F1AP_SETUP_REQ (msg_p).cell[k].mnc; - rrc->configuration.tac = F1AP_SETUP_REQ (msg_p).cell[k].tac; - rrc->nr_cellid = F1AP_SETUP_REQ (msg_p).cell[k].nr_cellid; - F1AP_SETUP_REQ (msg_p).cell[k].nr_pci = *rrc->configuration.scc->physCellId; - F1AP_SETUP_REQ (msg_p).cell[k].num_ssi = 0; + rrc->configuration.mcc[0] = f1Setup->cell[k].mcc; + rrc->configuration.mnc[0] = f1Setup->cell[k].mnc; + rrc->configuration.tac = f1Setup->cell[k].tac; + rrc->nr_cellid = f1Setup->cell[k].nr_cellid; + f1Setup->cell[k].nr_pci = *rrc->configuration.scc->physCellId; + f1Setup->cell[k].num_ssi = 0; if (rrc->configuration.scc->tdd_UL_DL_ConfigurationCommon) { LOG_I(GNB_APP,"ngran_DU: Configuring Cell %d for TDD\n",k); - F1AP_SETUP_REQ (msg_p).fdd_flag = 0; - F1AP_SETUP_REQ (msg_p).nr_mode_info[k].tdd.nr_arfcn = rrc->configuration.scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA; - F1AP_SETUP_REQ (msg_p).nr_mode_info[k].tdd.scs = rrc->configuration.scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; - F1AP_SETUP_REQ (msg_p).nr_mode_info[k].tdd.nrb = rrc->configuration.scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; - F1AP_SETUP_REQ (msg_p).nr_mode_info[k].tdd.num_frequency_bands = 1; - F1AP_SETUP_REQ (msg_p).nr_mode_info[k].tdd.nr_band[0] = *rrc->configuration.scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; - F1AP_SETUP_REQ (msg_p).nr_mode_info[k].tdd.sul_active = 0; + f1Setup->fdd_flag = 0; + f1Setup->nr_mode_info[k].tdd.nr_arfcn = rrc->configuration.scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA; + f1Setup->nr_mode_info[k].tdd.scs = rrc->configuration.scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; + f1Setup->nr_mode_info[k].tdd.nrb = rrc->configuration.scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; + f1Setup->nr_mode_info[k].tdd.num_frequency_bands = 1; + f1Setup->nr_mode_info[k].tdd.nr_band[0] = *rrc->configuration.scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; + f1Setup->nr_mode_info[k].tdd.sul_active = 0; } else { /***************** for test *****************/ LOG_I(GNB_APP,"ngran_DU: Configuring Cell %d for FDD\n",k); - F1AP_SETUP_REQ (msg_p).fdd_flag = 1; - F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.dl_nr_arfcn = 26200UL; - F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.ul_nr_arfcn = 26200UL; + f1Setup->fdd_flag = 1; + f1Setup->nr_mode_info[k].fdd.dl_nr_arfcn = 26200UL; + f1Setup->nr_mode_info[k].fdd.ul_nr_arfcn = 26200UL; // For LTE use scs field to carry prefix type and number of antennas - F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.dl_scs = 0; - F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.ul_scs = 0; + f1Setup->nr_mode_info[k].fdd.dl_scs = 0; + f1Setup->nr_mode_info[k].fdd.ul_scs = 0; // use nrb field to hold LTE N_RB_DL (0...5) - F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.ul_nrb = 3; - F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.ul_nrb = 3; + f1Setup->nr_mode_info[k].fdd.ul_nrb = 3; + f1Setup->nr_mode_info[k].fdd.ul_nrb = 3; // RK: we need to check there value for FDD's frequency_bands DL/UL - F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.ul_num_frequency_bands = 1; - F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.ul_nr_band[0] = 7; - F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.dl_num_frequency_bands = 1; - F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.dl_nr_band[0] = 7; - F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.ul_num_sul_frequency_bands = 0; - F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.ul_nr_sul_band[0] = 7; - F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.dl_num_sul_frequency_bands = 0; - F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.dl_nr_sul_band[0] = 7; - F1AP_SETUP_REQ (msg_p).nr_mode_info[k].fdd.sul_active = 0; + f1Setup->nr_mode_info[k].fdd.ul_num_frequency_bands = 1; + f1Setup->nr_mode_info[k].fdd.ul_nr_band[0] = 7; + f1Setup->nr_mode_info[k].fdd.dl_num_frequency_bands = 1; + f1Setup->nr_mode_info[k].fdd.dl_nr_band[0] = 7; + f1Setup->nr_mode_info[k].fdd.ul_num_sul_frequency_bands = 0; + f1Setup->nr_mode_info[k].fdd.ul_nr_sul_band[0] = 7; + f1Setup->nr_mode_info[k].fdd.dl_num_sul_frequency_bands = 0; + f1Setup->nr_mode_info[k].fdd.dl_nr_sul_band[0] = 7; + f1Setup->nr_mode_info[k].fdd.sul_active = 0; /***************** for test *****************/ } - F1AP_SETUP_REQ (msg_p).measurement_timing_information[k] = "0"; - F1AP_SETUP_REQ (msg_p).ranac[k] = 0; - F1AP_SETUP_REQ (msg_p).mib[k] = rrc->carrier.MIB; - F1AP_SETUP_REQ (msg_p).sib1[k] = rrc->carrier.SIB1; - F1AP_SETUP_REQ (msg_p).mib_length[k] = rrc->carrier.sizeof_MIB; - F1AP_SETUP_REQ (msg_p).sib1_length[k] = rrc->carrier.sizeof_SIB1; + f1Setup->measurement_timing_information[k] = "0"; + f1Setup->ranac[k] = 0; + f1Setup->mib[k] = rrc->carrier.MIB; + f1Setup->sib1[k] = rrc->carrier.SIB1; + f1Setup->mib_length[k] = rrc->carrier.sizeof_MIB; + f1Setup->sib1_length[k] = rrc->carrier.sizeof_SIB1; break; } } diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index fcaa27c80d..73b13188f6 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -1375,33 +1375,15 @@ rrc_gNB_process_RRCReconfigurationComplete( message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_UE_CONTEXT_SETUP_REQ); F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup = malloc(DRB_configList->list.count*sizeof(f1ap_drb_to_be_setup_t)); F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup_length = DRB_configList->list.count; + f1ap_drb_to_be_setup_t *DRBs=F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup; LOG_I(RRC, "Length of DRB list:%d, %d \n", DRB_configList->list.count, F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup_length); for (int i = 0; i < DRB_configList->list.count; i++){ - //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 - //create_tunnel_req.outgoing_teid[i] = 0xFFFF; - create_tunnel_req.outgoing_teid[i] = 0xFFFF; - create_tunnel_req.rnti = ue_context_pP->ue_context.rnti; - in_addr_t tmp_addr = inet_addr(rrc->eth_params_s.remote_addr); - memcpy(create_tunnel_req.dst_addr[i].buffer, &tmp_addr, sizeof(tmp_addr)); - LOG_D(NR_RRC, "The remote tunnel IP address of the DU is: %u.%u.%u.%u \n", create_tunnel_req.dst_addr[i].buffer[0], create_tunnel_req.dst_addr[i].buffer[1],create_tunnel_req.dst_addr[i].buffer[2], create_tunnel_req.dst_addr[i].buffer[3]); - create_tunnel_req.dst_addr[i].length = sizeof(tmp_addr)*8; - create_tunnel_req.incoming_rb_id[i] = DRB_configList->list.array[i]->drb_Identity; - - /* Here the callback function used as input is not the right one. Need to create a new one probably for F1-U, not sure - * if the kind of input parameters to the callback function are convenient though for gtp-u over F1-U.*/ - uint32_t incoming_teid; - incoming_teid = newGtpuCreateTunnel(INSTANCE_DEFAULT, create_tunnel_req.rnti, - create_tunnel_req.incoming_rb_id[i], - create_tunnel_req.incoming_rb_id[i], - create_tunnel_req.outgoing_teid[i], - create_tunnel_req.dst_addr[i], 2152, - cu_f1u_data_req); - - F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].drb_id = DRB_configList->list.array[i]->drb_Identity; - F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].rlc_mode = RLC_MODE_AM; - F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].up_ul_tnl[0].teid = incoming_teid; - F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].up_ul_tnl[0].tl_address = inet_addr(rrc->eth_params_s.my_addr); - F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].up_ul_tnl_length = 1; + DRBs[i].drb_id = DRB_configList->list.array[i]->drb_Identity; + DRBs[i].rlc_mode = RLC_MODE_AM; + DRBs[i].up_ul_tnl[0].tl_address = inet_addr(rrc->eth_params_s.my_addr); + DRBs[i].up_ul_tnl_length = 1; + DRBs[i].up_dl_tnl[0].tl_address = inet_addr(rrc->eth_params_s.remote_addr); + DRBs[i].up_dl_tnl_length = 1; } F1AP_UE_CONTEXT_SETUP_REQ (message_p).gNB_CU_ue_id = 0; F1AP_UE_CONTEXT_SETUP_REQ (message_p).gNB_DU_ue_id = 0; @@ -3258,8 +3240,6 @@ static void rrc_CU_process_ue_context_setup_response(MessageDef *msg_p, const ch gNB_RRC_INST *rrc = RC.nrrrc[ctxt.module_id]; struct rrc_gNB_ue_context_s *ue_context_p = rrc_gNB_get_ue_context(rrc, ctxt.rnti); NR_CellGroupConfig_t *cellGroupConfig = NULL; - int i; - int j; asn_dec_rval_t dec_rval = uper_decode_complete( NULL, &asn_DEF_NR_CellGroupConfig, @@ -3283,17 +3263,12 @@ static void rrc_CU_process_ue_context_setup_response(MessageDef *msg_p, const ch LOG_I(NR_RRC, "rlc_BearerToAddModList not empty before filling it \n"); free(ue_context_p->ue_context.masterCellGroup->rlc_BearerToAddModList); } - ue_context_p->ue_context.masterCellGroup->rlc_BearerToAddModList = calloc(1, sizeof(cellGroupConfig->rlc_BearerToAddModList)); + ue_context_p->ue_context.masterCellGroup->rlc_BearerToAddModList = calloc(1, sizeof(*cellGroupConfig->rlc_BearerToAddModList)); memcpy(ue_context_p->ue_context.masterCellGroup->rlc_BearerToAddModList, cellGroupConfig->rlc_BearerToAddModList, sizeof(struct NR_CellGroupConfig__rlc_BearerToAddModList)); } xer_fprint(stdout,&asn_DEF_NR_CellGroupConfig, ue_context_p->ue_context.masterCellGroup); - for(i=0; idrbs_to_be_setup_length; i++){ - for(j=0; jdrbs_to_be_setup[i].up_dl_tnl_length; j++){ - GtpuUpdateTunnelOutgoingTeid(INSTANCE_DEFAULT, ue_context_p->ue_context.rnti, (ebi_t)resp->drbs_to_be_setup[i].drb_id, resp->drbs_to_be_setup[i].up_dl_tnl[j].teid); - } - } free(cellGroupConfig->rlc_BearerToAddModList); free(cellGroupConfig); diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index 7a1fda1c72..2a5e697f8d 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -95,7 +95,7 @@ static teid_t gtpv1uNewTeid(void) { #endif } -int legacyInstanceMapping=0; +instance_t legacyInstanceMapping=0; #define compatInst(a) ((a)==0 || (a)==INSTANCE_DEFAULT?legacyInstanceMapping:a) #define GTPV1U_HEADER_SIZE (8) @@ -141,8 +141,7 @@ static int gtpv1uCreateAndSendMsg(int h, uint32_t peerIp, uint16_t peerPort, te int ret; if ((ret=sendto(h, (void *)buffer, (size_t)fullSize, 0,(struct sockaddr *)&to, sizeof(to) )) != fullSize ) { - LOG_E(GTPU, - "[SD %d] Failed to send data to " IPV4_ADDR " on port %d, buffer size %u, ret: %d, errno: %d\n", + LOG_E(GTPU, "[SD %d] Failed to send data to " IPV4_ADDR " on port %d, buffer size %u, ret: %d, errno: %d\n", h, IPV4_ADDR_FORMAT(peerIp), peerPort, fullSize, ret, errno); free(buffer); return GTPNOK; From a455ce7cab5df1c0127586c30f787e60b7006d4d Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Mon, 13 Sep 2021 11:04:38 +0200 Subject: [PATCH 057/110] fix F1-U bugs --- common/utils/system.c | 16 +++++ openair2/COMMON/platform_types.h | 1 - openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 1 - openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 4 -- .../LAYER2/PROTO_AGENT/proto_agent_common.c | 1 - openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c | 63 +++++++++++-------- openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c | 57 ++++++++--------- openair2/LAYER2/rlc_v2/rlc_oai_api.c | 9 ++- openair2/RRC/NR/rrc_gNB.c | 1 - openair3/GTPV1-U/gtpv1u_eNB.c | 6 +- openair3/GTPV1-U/gtpv1u_gNB.c | 6 -- openair3/ocp-gtpu/gtp_itf.cpp | 2 - 12 files changed, 87 insertions(+), 80 deletions(-) diff --git a/common/utils/system.c b/common/utils/system.c index 96daf6f747..4eb8c8cb19 100644 --- a/common/utils/system.c +++ b/common/utils/system.c @@ -95,6 +95,22 @@ static void read_pipe(int p, char *b, int size) { size -= ret; } } +int checkIfFedoraDistribution(void) { + return system("grep -iq 'ID_LIKE.*fedora' /etc/os-release "); +} + +int checkIfGenericKernelOnFedora(void) { + int ret=system("uname -a | grep -q rt"); + return 1 - ret; +} + +int checkIfInsideContainer(void) { + int res=system("egrep -q 'libpod|podman|kubepods' /proc/self/cgroup"); + if (res > 0) + return 1; + else + return 0; +} /********************************************************************/ /* background process */ diff --git a/openair2/COMMON/platform_types.h b/openair2/COMMON/platform_types.h index 23b33dd8b1..7f8e4ee568 100644 --- a/openair2/COMMON/platform_types.h +++ b/openair2/COMMON/platform_types.h @@ -233,7 +233,6 @@ typedef struct protocol_ctxt_s { frame_t frame; /*!< \brief LTE frame number.*/ sub_frame_t subframe; /*!< \brief LTE sub frame number.*/ eNB_index_t eNB_index; /*!< \brief valid for UE indicating the index of connected eNB(s) */ - boolean_t configured; /*!< \brief flag indicating whether the instance is configured or not */ boolean_t brOption; } protocol_ctxt_t; // warning time hardcoded diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index 78e7ae2c30..abb846e923 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -319,7 +319,6 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, 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; mem_block_t *mb = get_free_mem_block(ie->value.choice.RRCContainer.size,__func__); memcpy((void *)mb->data,(void *)ie->value.choice.RRCContainer.buf,ie->value.choice.RRCContainer.size); LOG_I(F1AP, "Calling pdcp_data_ind for UE RNTI %x srb_id %lu with size %ld (DCCH) \n", ctxt.rnti, srb_id, ie->value.choice.RRCContainer.size); diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index cddb666bfd..7fac0bdfca 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -249,12 +249,8 @@ boolean_t pdcp_data_req( LOG_W(PDCP, PROTOCOL_CTXT_FMT" Instance is not configured for rb_id %ld Ignoring SDU...\n", PROTOCOL_CTXT_ARGS(ctxt_pP), rb_idP); - ctxt_pP->configured=FALSE; return FALSE; } - } else { - // instance for a given RB is configured - ctxt_pP->configured=TRUE; } if (ctxt_pP->enb_flag == ENB_FLAG_YES) { diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c index f19d7526fe..50c97f06be 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c @@ -525,7 +525,6 @@ int proto_agent_pdcp_data_ind_process(mod_id_t mod_id, const void *params, Proto ctxt_pP.rnti = ctxt->fsp_rnti; ctxt_pP.frame = ctxt->fsp_frame; ctxt_pP.subframe = ctxt->fsp_subframe; - ctxt_pP.configured = 1; ctxt_pP.brOption = 0; ctxt_pP.eNB_index = ctxt->fsp_enb_index; srb_flagP = rlc_data->fsp_srb_flag; diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index 78ea9bfbf9..486a032e8a 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -263,7 +263,6 @@ static void *enb_tun_read_thread(void *_) ctxt.frame = 0; ctxt.subframe = 0; ctxt.eNB_index = 0; - ctxt.configured = 1; ctxt.brOption = 0; ctxt.rnti = rnti; @@ -307,7 +306,6 @@ static void *ue_tun_read_thread(void *_) ctxt.frame = 0; ctxt.subframe = 0; ctxt.eNB_index = 0; - ctxt.configured = 1; ctxt.brOption = 0; ctxt.rnti = rnti; @@ -515,11 +513,31 @@ rb_found: ctxt.frame = 0; ctxt.subframe = 0; ctxt.eNB_index = 0; - ctxt.configured = 1; ctxt.brOption = 0; ctxt.rnti = ue->rnti; - + if (RC.nrrrc != NULL && NODE_IS_CU(RC.nrrrc[0]->node_type)) { + MessageDef *message_p = itti_alloc_new_message_sized(TASK_PDCP_ENB, 0, + GTPV1U_GNB_TUNNEL_DATA_REQ, + sizeof(gtpv1u_gnb_tunnel_data_req_t) + + size + + GTPU_HEADER_OVERHEAD_MAX); + AssertFatal(message_p != NULL, "OUT OF MEMORY"); + gtpv1u_gnb_tunnel_data_req_t *req=>PV1U_GNB_TUNNEL_DATA_REQ(message_p); + uint8_t *gtpu_buffer_p = (uint8_t*)(req+1); + memcpy(gtpu_buffer_p+GTPU_HEADER_OVERHEAD_MAX, + buf, size); + req->buffer = gtpu_buffer_p; + req->length = size; + req->offset = GTPU_HEADER_OVERHEAD_MAX; + req->rnti = ue->rnti; + req->pdusession_id = rb_id; + LOG_D(PDCP, "%s() (drb %d) sending message to gtp size %d\n", + __func__, rb_id, size); + itti_send_msg_to_task(TASK_VARIABLE, INSTANCE_DEFAULT, message_p); + return; + } + memblock = get_free_mem_block(size, __FUNCTION__); memcpy(memblock->data, buf, size); @@ -603,7 +621,6 @@ srb_found: ctxt.frame = 0; ctxt.subframe = 0; ctxt.eNB_index = 0; - ctxt.configured = 1; ctxt.brOption = 0; ctxt.rnti = ue->rnti; @@ -646,7 +663,6 @@ boolean_t pdcp_data_ind( //ctxt_pP->enb_flag != 1 || ctxt_pP->instance != 0 || ctxt_pP->eNB_index != 0 || - ctxt_pP->configured != 1 || ctxt_pP->brOption != 0) { LOG_E(PDCP, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__); exit(1); @@ -697,7 +713,6 @@ void pdcp_run(const protocol_ctxt_t *const ctxt_pP) .frame=-1, .subframe=-1, .eNB_index=0, - .configured=true, .brOption=false }; @@ -1223,25 +1238,21 @@ boolean_t cu_f1u_data_req( ,const uint32_t *const destinationL2Id #endif ) { - MessageDef *message_p = itti_alloc_new_message_sized(TASK_PDCP_ENB, 0, - GTPV1U_GNB_TUNNEL_DATA_REQ, - sizeof(gtpv1u_gnb_tunnel_data_req_t) - + sdu_buffer_size - + GTPU_HEADER_OVERHEAD_MAX); - AssertFatal(message_p != NULL, "OUT OF MEMORY"); - gtpv1u_gnb_tunnel_data_req_t *req=>PV1U_GNB_TUNNEL_DATA_REQ(message_p); - uint8_t *gtpu_buffer_p = (uint8_t*)(req+1); - memcpy(gtpu_buffer_p+GTPU_HEADER_OVERHEAD_MAX, - sdu_buffer, sdu_buffer_size); - req->buffer = gtpu_buffer_p; - req->length = sdu_buffer_size; - req->offset = GTPU_HEADER_OVERHEAD_MAX; - req->rnti = ctxt_pP->rnti; - req->pdusession_id = rb_id; - LOG_D(PDCP, "%s() (drb %ld) sending message to gtp size %d\n", - __func__, rb_id, sdu_buffer_size); - itti_send_msg_to_task(TASK_VARIABLE, INSTANCE_DEFAULT, message_p); - return true; + + //Force instance id to 0, OAI incoherent instance management + ctxt_pP->instance=0; + mem_block_t *memblock = get_free_mem_block(sdu_buffer_size, __func__); + if (memblock == NULL) { + LOG_E(RLC, "%s:%d:%s: ERROR: get_free_mem_block failed\n", __FILE__, __LINE__, __FUNCTION__); + exit(1); + } + memcpy(memblock->data,sdu_buffer, sdu_buffer_size); + int ret=pdcp_data_ind(ctxt_pP,srb_flagP, false, rb_id, sdu_buffer_size, memblock); + if (!ret) { + LOG_E(RLC, "%s:%d:%s: ERROR: pdcp_data_ind failed\n", __FILE__, __LINE__, __FUNCTION__); + /* what to do in case of failure? for the moment: nothing */ + } + return ret; } boolean_t pdcp_data_req( diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index 8c8067e7de..44a7b7ac01 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -461,7 +461,6 @@ rb_found: ctx.frame = 0; ctx.subframe = 0; ctx.eNB_index = 0; - ctx.configured = 1; ctx.brOption = 0; /* used fields? */ @@ -486,30 +485,32 @@ rb_found: // return; // } - if (NODE_IS_DU(type) && is_srb == 1) { - MessageDef *msg; - msg = itti_alloc_new_message(TASK_RLC_ENB, 0, F1AP_UL_RRC_MESSAGE); - uint8_t *message_buffer = itti_malloc (TASK_RLC_ENB, TASK_DU_F1, size); - memcpy (message_buffer, buf, size); - F1AP_UL_RRC_MESSAGE(msg).rnti = ue->rnti; - F1AP_UL_RRC_MESSAGE(msg).srb_id = rb_id; - F1AP_UL_RRC_MESSAGE(msg).rrc_container = message_buffer; - F1AP_UL_RRC_MESSAGE(msg).rrc_container_length = size; - itti_send_msg_to_task(TASK_DU_F1, ENB_MODULE_ID_TO_INSTANCE(0 /*ctxt_pP->module_id*/), msg); - return; - } - else if(NODE_IS_DU(type) && is_srb == 0) { - MessageDef *msg = itti_alloc_new_message_sized(TASK_RLC_ENB, 0, GTPV1U_GNB_TUNNEL_DATA_REQ, sizeof(gtpv1u_gnb_tunnel_data_req_t) + size); - gtpv1u_gnb_tunnel_data_req_t *req=>PV1U_GNB_TUNNEL_DATA_REQ(msg); - req->buffer=(uint8_t*)(req+1); - memcpy(req->buffer,buf,size); - req->length=size; - req->offset=0; - req->rnti=ue->rnti; - req->pdusession_id=rb_id; - LOG_D(RLC, "Received uplink user-plane traffic at RLC-DU to be sent to the CU, size %d \n", size); - itti_send_msg_to_task(OCP_GTPV1_U, 0, msg); - return; + if (NODE_IS_DU(type)) { + if(is_srb) { + MessageDef *msg; + msg = itti_alloc_new_message(TASK_RLC_ENB, 0, F1AP_UL_RRC_MESSAGE); + uint8_t *message_buffer = itti_malloc (TASK_RLC_ENB, TASK_DU_F1, size); + memcpy (message_buffer, buf, size); + F1AP_UL_RRC_MESSAGE(msg).rnti = ue->rnti; + F1AP_UL_RRC_MESSAGE(msg).srb_id = rb_id; + F1AP_UL_RRC_MESSAGE(msg).rrc_container = message_buffer; + F1AP_UL_RRC_MESSAGE(msg).rrc_container_length = size; + itti_send_msg_to_task(TASK_DU_F1, ENB_MODULE_ID_TO_INSTANCE(0 /*ctxt_pP->module_id*/), msg); + return; + } else { + MessageDef *msg = itti_alloc_new_message_sized(TASK_RLC_ENB, 0, GTPV1U_GNB_TUNNEL_DATA_REQ, + sizeof(gtpv1u_gnb_tunnel_data_req_t) + size); + gtpv1u_gnb_tunnel_data_req_t *req=>PV1U_GNB_TUNNEL_DATA_REQ(msg); + req->buffer=(uint8_t*)(req+1); + memcpy(req->buffer,buf,size); + req->length=size; + req->offset=0; + req->rnti=ue->rnti; + req->pdusession_id=rb_id; + LOG_D(RLC, "Received uplink user-plane traffic at RLC-DU to be sent to the CU, size %d \n", size); + itti_send_msg_to_task(OCP_GTPV1_U, 0, msg); + return; + } } } @@ -923,10 +924,10 @@ rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt if (/*ctxt_pP->enb_flag != 1 ||*/ ctxt_pP->module_id != 0 /*|| ctxt_pP->instance != 0 || ctxt_pP->eNB_index != 0 || - ctxt_pP->configured != 1 || ctxt_pP->brOption != 0 */) { - LOG_E(RLC, "%s: ctxt_pP not handled (%d %d %ld %d %d %d)\n", __FUNCTION__, + ctxt_pP->brOption != 0 */) { + LOG_E(RLC, "%s: ctxt_pP not handled (%d %d %ld %d %d)\n", __FUNCTION__, ctxt_pP->enb_flag , ctxt_pP->module_id, ctxt_pP->instance, - ctxt_pP->eNB_index, ctxt_pP->configured, ctxt_pP->brOption); + ctxt_pP->eNB_index, ctxt_pP->brOption); exit(1); } diff --git a/openair2/LAYER2/rlc_v2/rlc_oai_api.c b/openair2/LAYER2/rlc_v2/rlc_oai_api.c index 0cf4b85fa2..799beac258 100644 --- a/openair2/LAYER2/rlc_v2/rlc_oai_api.c +++ b/openair2/LAYER2/rlc_v2/rlc_oai_api.c @@ -406,7 +406,6 @@ rb_found: ctx.frame = 0; ctx.subframe = 0; ctx.eNB_index = 0; - ctx.configured = 1; ctx.brOption = 0; /* used fields? */ @@ -832,10 +831,10 @@ rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP if (0 /*|| ctxt_pP->instance != 0 || ctxt_pP->eNB_index != 0 || - ctxt_pP->configured != 1 || ctxt_pP->brOption != 0 */) { - LOG_E(RLC, "%s: ctxt_pP not handled (%d %d %ld %d %d %d)\n", __FUNCTION__, + ctxt_pP->brOption != 0 */) { + LOG_E(RLC, "%s: ctxt_pP not handled (%d %d %ld %d %d)\n", __FUNCTION__, ctxt_pP->enb_flag , ctxt_pP->module_id, ctxt_pP->instance, - ctxt_pP->eNB_index, ctxt_pP->configured, ctxt_pP->brOption); + ctxt_pP->eNB_index, ctxt_pP->brOption); exit(1); } @@ -1041,4 +1040,4 @@ void du_rlc_data_req(const protocol_ctxt_t *const ctxt_pP, sdu_size_t sdu_sizeP, mem_block_t *sdu_pP){ -} \ No newline at end of file +} diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 891d7957c4..5826e838f9 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -3586,7 +3586,6 @@ void *rrc_gnb_task(void *args_p) { .frame=-1, .subframe=-1, .eNB_index=0, - .configured=true, .brOption=false }; itti_mark_task_ready(TASK_RRC_GNB); diff --git a/openair3/GTPV1-U/gtpv1u_eNB.c b/openair3/GTPV1-U/gtpv1u_eNB.c index 0fe2741d7b..9cf429426c 100644 --- a/openair3/GTPV1-U/gtpv1u_eNB.c +++ b/openair3/GTPV1-U/gtpv1u_eNB.c @@ -432,11 +432,7 @@ NwGtpv1uRcT gtpv1u_eNB_process_stack_req( ); if ( result == FALSE ) { - if (ctxt.configured == FALSE ) - LOG_W(GTPU, "PDCP data request failed, cause: [UE:%x]RB is not configured!\n", ctxt.rnti) ; - else - LOG_W(GTPU, "PDCP data request failed\n"); - + LOG_W(GTPU, "PDCP data request failed\n"); return NW_GTPV1U_FAILURE; } } else { diff --git a/openair3/GTPV1-U/gtpv1u_gNB.c b/openair3/GTPV1-U/gtpv1u_gNB.c index 1535396803..ff7c8c0604 100644 --- a/openair3/GTPV1-U/gtpv1u_gNB.c +++ b/openair3/GTPV1-U/gtpv1u_gNB.c @@ -191,9 +191,6 @@ NwGtpv1uRcT gtpv1u_gNB_process_stack_req( ); if ( result == FALSE ) { - if (ctxt.configured == FALSE ) - LOG_W(GTPU, "gNB node PDCP data request failed, cause: [UE:%x]RB is not configured!\n", ctxt.rnti) ; - else LOG_W(GTPU, "PDCP data request failed\n"); return NW_GTPV1U_FAILURE; @@ -390,9 +387,6 @@ NwGtpv1uRcT nr_gtpv1u_gNB_process_stack_req( ); if ( result == FALSE ) { - if (ctxt.configured == FALSE ) - LOG_W(GTPU, "gNB node PDCP data request failed, cause: [UE:%x]RB is not configured!\n", ctxt.rnti) ; - else LOG_W(GTPU, "PDCP data request failed\n"); return NW_GTPV1U_FAILURE; diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index 2a5e697f8d..e7c73be14f 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -691,7 +691,6 @@ static int Gtpv1uHandleEndMarker(int h, ctxt.frame = 0; ctxt.subframe = 0; ctxt.eNB_index = 0; - ctxt.configured = 0; ctxt.brOption = 0; const srb_flag_t srb_flag=SRB_FLAG_NO; const rb_id_t rb_id=tunnel->second.incoming_rb_id; @@ -757,7 +756,6 @@ static int Gtpv1uHandleGpdu(int h, ctxt.frame = 0; ctxt.subframe = 0; ctxt.eNB_index = 0; - ctxt.configured = 0; ctxt.brOption = 0; const srb_flag_t srb_flag=SRB_FLAG_NO; const rb_id_t rb_id=tunnel->second.incoming_rb_id; From b94aee2e977f9b495b16b876a2b4805dabad6ff2 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Mon, 13 Sep 2021 15:54:01 +0200 Subject: [PATCH 058/110] fixing F1-U --- executables/nr-uesoftmodem.c | 4 +- openair2/F1AP/f1ap_common.c | 88 +++++-------------- openair2/F1AP/f1ap_common.h | 40 ++++----- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 14 +-- openair2/F1AP/f1ap_cu_task.c | 11 ++- openair2/F1AP/f1ap_cu_ue_context_management.c | 22 ++--- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 38 ++++---- openair2/F1AP/f1ap_du_task.c | 10 ++- openair2/F1AP/f1ap_du_ue_context_management.c | 24 ++--- openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c | 3 +- openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c | 3 +- openair2/RRC/NR/rrc_gNB.c | 5 +- openair3/ocp-gtpu/gtp_itf.cpp | 2 +- 13 files changed, 111 insertions(+), 153 deletions(-) diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 52ffdd2fa1..e9f23b8977 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -103,7 +103,9 @@ pthread_mutex_t sync_mutex; int sync_var=-1; //!< protected by mutex \ref sync_mutex. int config_sync_var=-1; - +// not used in UE +instance_t CUuniqInstance=0; +instance_t DUuniqInstance=0; RAN_CONTEXT_t RC; volatile int oai_exit = 0; diff --git a/openair2/F1AP/f1ap_common.c b/openair2/F1AP/f1ap_common.c index 5b67b17f23..0d887b7a61 100644 --- a/openair2/F1AP/f1ap_common.c +++ b/openair2/F1AP/f1ap_common.c @@ -64,17 +64,17 @@ uint8_t F1AP_get_next_transaction_identifier(instance_t enb_mod_idP, instance_t return transaction_identifier[enb_mod_idP+cu_mod_idP]; } -f1ap_cudu_inst_t *getCxt(bool isCU, instance_t instanceP) { +f1ap_cudu_inst_t *getCxt(F1_t isCU, instance_t instanceP) { 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? f1_cu_inst[ instanceP]: f1_du_inst[ instanceP]; + return isCU == CUtype ? f1_cu_inst[ instanceP]: f1_du_inst[ instanceP]; } -void createF1inst(bool isCU, instance_t instanceP, f1ap_setup_req_t *req) { - if (isCU) { +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) ); @@ -85,7 +85,7 @@ void createF1inst(bool isCU, instance_t instanceP, f1ap_setup_req_t *req) { } } -int f1ap_add_ue(bool isCu, +int f1ap_add_ue(F1_t isCu, instance_t instanceP, rnti_t rntiP) { f1ap_cudu_inst_t *f1_inst=getCxt(isCu, instanceP); @@ -114,7 +114,7 @@ int f1ap_add_ue(bool isCu, } -int f1ap_remove_ue(bool isCu, instance_t instanceP, +int f1ap_remove_ue(F1_t isCu, instance_t instanceP, rnti_t rntiP) { f1ap_cudu_inst_t *f1_inst=getCxt(isCu, instanceP); @@ -129,7 +129,7 @@ int f1ap_remove_ue(bool isCu, instance_t instanceP, return 0; } -int f1ap_get_du_ue_f1ap_id(bool isCu, instance_t instanceP, +int f1ap_get_du_ue_f1ap_id(F1_t isCu, instance_t instanceP, rnti_t rntiP) { f1ap_cudu_inst_t *f1_inst=getCxt(isCu, instanceP); @@ -142,7 +142,7 @@ int f1ap_get_du_ue_f1ap_id(bool isCu, instance_t instanceP, return -1; } -int f1ap_get_cu_ue_f1ap_id(bool isCu, instance_t instanceP, +int f1ap_get_cu_ue_f1ap_id(F1_t isCu, instance_t instanceP, rnti_t rntiP) { f1ap_cudu_inst_t *f1_inst=getCxt(isCu, instanceP); @@ -155,7 +155,7 @@ int f1ap_get_cu_ue_f1ap_id(bool isCu, instance_t instanceP, return -1; } -int f1ap_get_rnti_by_du_id(bool isCu, instance_t instanceP, +int f1ap_get_rnti_by_du_id(F1_t isCu, instance_t instanceP, instance_t du_ue_f1ap_id ) { f1ap_cudu_inst_t *f1_inst=getCxt(isCu, instanceP); @@ -168,7 +168,7 @@ int f1ap_get_rnti_by_du_id(bool isCu, instance_t instanceP, return -1; } -int f1ap_get_rnti_by_cu_id(bool isCu, instance_t instanceP, +int f1ap_get_rnti_by_cu_id(F1_t isCu, instance_t instanceP, instance_t cu_ue_f1ap_id ) { f1ap_cudu_inst_t *f1_inst=getCxt(isCu, instanceP); @@ -181,50 +181,18 @@ int f1ap_get_rnti_by_cu_id(bool isCu, instance_t instanceP, return -1; } -int f1ap_get_du_uid(bool isCu, instance_t instanceP, - instance_t du_ue_f1ap_id ) { - f1ap_cudu_inst_t *f1_inst=getCxt(isCu, instanceP); - - 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; - } - } - - return -1; -} - -int f1ap_get_cu_uid(bool isCu, instance_t instanceP, - instance_t cu_ue_f1ap_id ) { - f1ap_cudu_inst_t *f1_inst=getCxt(isCu, instanceP); - - 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; - } - } - - return -1; -} - -int f1ap_get_uid_by_rnti(bool isCu, instance_t instanceP, - rnti_t rntiP ) { - f1ap_cudu_inst_t *f1_inst=getCxt(isCu, instanceP); - - for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) { - if (f1_inst->f1ap_ue[i].rnti == rntiP) { - return i; - } - } - - return -1; -} - -int f1ap_du_add_cu_ue_id(bool isCu, instance_t instanceP, +int f1ap_du_add_cu_ue_id(instance_t instanceP, instance_t du_ue_f1ap_id, instance_t cu_ue_f1ap_id) { - f1ap_cudu_inst_t *f1_inst=getCxt(isCu, instanceP); - instance_t f1ap_uid = f1ap_get_du_uid(isCu, instanceP,du_ue_f1ap_id); + f1ap_cudu_inst_t *f1_inst=getCxt(DUtype, instanceP); + + instance_t f1ap_uid=-1; + for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) { + if (f1_inst->f1ap_ue[i].du_ue_f1ap_id == du_ue_f1ap_id) { + f1ap_uid=i; + break; + } + } if (f1ap_uid < 0 || f1ap_uid >= MAX_MOBILES_PER_ENB) return -1; @@ -234,21 +202,7 @@ int f1ap_du_add_cu_ue_id(bool isCu, instance_t instanceP, return 0; } -int f1ap_cu_add_du_ue_id(bool isCu, instance_t instanceP, - instance_t cu_ue_f1ap_id, - instance_t du_ue_f1ap_id) { - f1ap_cudu_inst_t *f1_inst=getCxt(isCu, instanceP); - instance_t f1ap_uid = f1ap_get_cu_uid(isCu,instanceP,cu_ue_f1ap_id); - - if (f1ap_uid < 0 || f1ap_uid >= MAX_MOBILES_PER_ENB) - return -1; - - f1_inst->f1ap_ue[f1ap_uid].du_ue_f1ap_id = du_ue_f1ap_id; - LOG_I(F1AP, "Adding du_ue_f1ap_id %ld 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, instance_t 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; } diff --git a/openair2/F1AP/f1ap_common.h b/openair2/F1AP/f1ap_common.h index f60c900224..5fd3c486c8 100644 --- a/openair2/F1AP/f1ap_common.h +++ b/openair2/F1AP/f1ap_common.h @@ -437,55 +437,45 @@ typedef struct f1ap_cudu_inst_s { f1ap_cudu_ue_t f1ap_ue[MAX_MOBILES_PER_ENB]; } f1ap_cudu_inst_t; +typedef enum { + DUtype=0, + CUtype +} F1_t; uint8_t F1AP_get_next_transaction_identifier(instance_t enb_mod_idP, instance_t cu_mod_idP); -f1ap_cudu_inst_t *getCxt(bool isCU, instance_t instanceP); +f1ap_cudu_inst_t *getCxt(F1_t isCU, instance_t instanceP); -void createF1inst(bool isCU, instance_t instanceP, f1ap_setup_req_t *req); -int f1ap_add_ue(bool isCu, +void createF1inst(F1_t isCU, instance_t instanceP, f1ap_setup_req_t *req); +int f1ap_add_ue(F1_t isCu, instance_t instanceP, rnti_t rntiP); -int f1ap_remove_ue(bool isCu, instance_t instanceP, +int f1ap_remove_ue(F1_t isCu, instance_t instanceP, rnti_t rntiP); -int f1ap_get_du_ue_f1ap_id (bool isCu, instance_t instanceP, +int f1ap_get_du_ue_f1ap_id (F1_t isCu, instance_t instanceP, rnti_t rntiP); -int f1ap_get_cu_ue_f1ap_id (bool isCu, instance_t instanceP, +int f1ap_get_cu_ue_f1ap_id (F1_t isCu, instance_t instanceP, rnti_t rntiP); -int f1ap_get_rnti_by_du_id(bool isCu, instance_t instanceP, +int f1ap_get_rnti_by_du_id(F1_t isCu, instance_t instanceP, instance_t du_ue_f1ap_id ); -int f1ap_get_rnti_by_cu_id(bool isCu, instance_t instanceP, +int f1ap_get_rnti_by_cu_id(F1_t isCu, instance_t instanceP, instance_t cu_ue_f1ap_id ); - -int f1ap_get_du_uid(bool isCu, instance_t instanceP, - instance_t du_ue_f1ap_id ); - -int f1ap_get_cu_uid(bool isCu, instance_t instanceP, - instance_t cu_ue_f1ap_id ); - -int f1ap_get_uid_by_rnti(bool isCu, instance_t instanceP, - rnti_t rntiP ); - -int f1ap_du_add_cu_ue_id(bool isCu, instance_t instanceP, +int f1ap_du_add_cu_ue_id(instance_t instanceP, instance_t du_ue_f1ap_id, instance_t cu_ue_f1ap_id); -int f1ap_cu_add_du_ue_id(bool isCu, instance_t instanceP, - instance_t cu_ue_f1ap_id, - instance_t du_ue_f1ap_id); +int f1ap_assoc_id(F1_t isCu, instance_t instanceP); -int f1ap_assoc_id(bool isCu, instance_t instanceP); - -static inline f1ap_setup_req_t *f1ap_req(bool isCu, instance_t instanceP) { +static inline f1ap_setup_req_t *f1ap_req(F1_t isCu, instance_t instanceP) { return &getCxt(isCu, instanceP)->setupReq; } diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index abb846e923..b57ca013a1 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -120,7 +120,7 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, ie->value.choice.DUtoCURRCContainer.size); } - int f1ap_uid = f1ap_add_ue(true, instance, rnti); + int f1ap_uid = f1ap_add_ue(CUtype, instance, rnti); if (f1ap_uid < 0 ) { LOG_E(F1AP, "Failed to add UE \n"); @@ -164,7 +164,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(true, instance, f1ap_dl_rrc->rnti); + ie1->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(CUtype, 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 */ @@ -173,7 +173,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(true, instance, f1ap_dl_rrc->rnti); + ie2->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(CUtype, 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 */ @@ -271,13 +271,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(true, instance, cu_ue_f1ap_id)); + cu_ue_f1ap_id, f1ap_get_rnti_by_cu_id(CUtype, 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(true, instance, du_ue_f1ap_id)); + du_ue_f1ap_id, f1ap_get_rnti_by_cu_id(CUtype, instance, du_ue_f1ap_id)); /* mandatory */ /* SRBID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_ULRRCMessageTransferIEs_t, ie, container, @@ -307,7 +307,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(true, instance, cu_ue_f1ap_id); + RRC_DCCH_DATA_IND (message_p).rnti = f1ap_get_rnti_by_cu_id(CUtype, instance, cu_ue_f1ap_id); RRC_DCCH_DATA_IND (message_p).instance = instance; RRC_DCCH_DATA_IND (message_p).eNB_index = instance; // not needed for CU @@ -316,7 +316,7 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, protocol_ctxt_t ctxt; ctxt.instance = instance; ctxt.instance = instance; - ctxt.rnti = f1ap_get_rnti_by_cu_id(true, instance, cu_ue_f1ap_id); + ctxt.rnti = f1ap_get_rnti_by_cu_id(CUtype, instance, cu_ue_f1ap_id); ctxt.enb_flag = 1; ctxt.eNB_index = 0; mem_block_t *mb = get_free_mem_block(ie->value.choice.RRCContainer.size,__func__); diff --git a/openair2/F1AP/f1ap_cu_task.c b/openair2/F1AP/f1ap_cu_task.c index a9388d743a..b6d97dea62 100644 --- a/openair2/F1AP/f1ap_cu_task.c +++ b/openair2/F1AP/f1ap_cu_task.c @@ -38,6 +38,9 @@ #include "proto_agent.h" #include +//Fixme: Uniq dirty DU instance, by global var, datamodel need better management +instance_t CUuniqInstance=0; + static instance_t cu_task_create_gtpu_instance_to_du(eth_params_t *IPaddrs) { openAddr_t tmp={0}; strncpy(tmp.originHost, IPaddrs->my_addr, sizeof(tmp.originHost)-1); @@ -56,9 +59,11 @@ static void cu_task_handle_sctp_association_ind(instance_t instance, sctp_new_as 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->default_sctp_stream_id = 0; - getCxt(true, instance)->gtpInst=cu_task_create_gtpu_instance_to_du(IPaddrs); - AssertFatal(getCxt(true, instance)->gtpInst>0,"Failed to create CU F1-U UDP listener"); - // Nothing + getCxt(CUtype, instance)->gtpInst=cu_task_create_gtpu_instance_to_du(IPaddrs); + AssertFatal(getCxt(CUtype, instance)->gtpInst>0,"Failed to create CU F1-U UDP listener"); + // Fixme: fully inconsistent instances management + // dirty global var is a bad fix + CUuniqInstance=getCxt(CUtype, instance)->gtpInst; } static void cu_task_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp) { diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 6669b315cc..51035975fb 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -88,7 +88,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, ie1->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; ie1->criticality = F1AP_Criticality_reject; ie1->value.present = F1AP_UEContextSetupRequestIEs__value_PR_GNB_CU_UE_F1AP_ID; - ie1->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(true, instance, f1ap_ue_context_setup_req->rnti); //f1ap_ue_context_setup_req->gNB_CU_ue_id; + ie1->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(CUtype, instance, f1ap_ue_context_setup_req->rnti); //f1ap_ue_context_setup_req->gNB_CU_ue_id; /* optional */ /* c2. GNB_DU_UE_F1AP_ID */ @@ -97,7 +97,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, ie2->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; ie2->criticality = F1AP_Criticality_ignore; ie2->value.present = F1AP_UEContextSetupRequestIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie2->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(true, instance, f1ap_ue_context_setup_req->rnti); //*f1ap_ue_context_setup_req->gNB_DU_ue_id; + ie2->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(CUtype, instance, f1ap_ue_context_setup_req->rnti); //*f1ap_ue_context_setup_req->gNB_DU_ue_id; } /* mandatory */ @@ -520,7 +520,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, addr.length = sz*8; f1ap_ue_context_setup_req->drbs_to_be_setup[i].up_ul_tnl[j].teid= - newGtpuCreateTunnel(getCxt(true, instance)->gtpInst, + newGtpuCreateTunnel(getCxt(CUtype, instance)->gtpInst, f1ap_ue_context_setup_req->rnti, f1ap_ue_context_setup_req->drbs_to_be_setup[i].drb_id, f1ap_ue_context_setup_req->drbs_to_be_setup[i].drb_id, @@ -668,7 +668,7 @@ int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, LOG_D(F1AP, "f1ap_ue_context_setup_resp->gNB_DU_ue_id is: %d \n", f1ap_ue_context_setup_resp->gNB_DU_ue_id); f1ap_ue_context_setup_resp->rnti = - f1ap_get_rnti_by_du_id(true, instance, f1ap_ue_context_setup_resp->gNB_DU_ue_id); + f1ap_get_rnti_by_du_id(CUtype, instance, f1ap_ue_context_setup_resp->gNB_DU_ue_id); // DUtoCURRCInformation F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, @@ -705,7 +705,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_INT32(&dl_up_tnl0->gTP_TEID, drb_p->up_dl_tnl[0].teid); - GtpuUpdateTunnelOutgoingTeid(getCxt(true, instance)->gtpInst, + GtpuUpdateTunnelOutgoingTeid(getCxt(CUtype, instance)->gtpInst, f1ap_ue_context_setup_resp->rnti, (ebi_t)drbs_setup_item_p->dRBID, drb_p->up_dl_tnl[0].teid); @@ -793,7 +793,7 @@ int CU_handle_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, /* 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(true, instance, + const rnti_t rnti2 = f1ap_get_rnti_by_du_id(CUtype, 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); @@ -859,14 +859,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(true, instance, cmd->rnti); + ie1->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(CUtype, 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(true, instance, cmd->rnti); + ie2->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(CUtype, instance, cmd->rnti); /* mandatory */ /* c3. Cause */ asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextReleaseCommandIEs_t, ie3); @@ -930,12 +930,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(true, instance, + const rnti_t rnti = f1ap_get_rnti_by_cu_id(CUtype, 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(true, instance, + const rnti_t rnti2 = f1ap_get_rnti_by_du_id(CUtype, 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); @@ -1011,7 +1011,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(true, instance, rnti); + f1ap_remove_ue(CUtype, instance, rnti); return 0; } //void CU_send_UE_CONTEXT_MODIFICATION_REQUEST(F1AP_UEContextModificationRequest_t *UEContextModificationRequest) { diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index fcf6476958..ebdeabb6ce 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -101,10 +101,10 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, du_ue_f1ap_id = ie->value.choice.GNB_DU_UE_F1AP_ID; LOG_D(F1AP, "du_ue_f1ap_id %lu associated with UE RNTI %x \n", du_ue_f1ap_id, - f1ap_get_rnti_by_du_id(false, instance, du_ue_f1ap_id)); + f1ap_get_rnti_by_du_id(DUtype, instance, du_ue_f1ap_id)); // this should be the one transmitted via initial ul rrc message transfer - if (f1ap_du_add_cu_ue_id(false, instance,du_ue_f1ap_id, cu_ue_f1ap_id) < 0 ) { + if (f1ap_du_add_cu_ue_id(instance,du_ue_f1ap_id, cu_ue_f1ap_id) < 0 ) { LOG_E(F1AP, "Failed to find the F1AP UID \n"); //return -1; } @@ -164,7 +164,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, // decode RRC Container and act on the message type AssertFatal(srb_id<3,"illegal srb_id\n"); protocol_ctxt_t ctxt; - ctxt.rnti = f1ap_get_rnti_by_du_id(false, instance, du_ue_f1ap_id); + ctxt.rnti = f1ap_get_rnti_by_du_id(DUtype, instance, du_ue_f1ap_id); ctxt.instance = instance; ctxt.instance = instance; ctxt.enb_flag = 1; @@ -206,7 +206,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, LOG_I(F1AP, "Logical Channel DL-CCCH (SRB0), Received RRCConnectionSetup DU_ID %lx/RNTI %x\n", du_ue_f1ap_id, - f1ap_get_rnti_by_du_id(false, instance, du_ue_f1ap_id)); + f1ap_get_rnti_by_du_id(DUtype, instance, du_ue_f1ap_id)); // Get configuration LTE_RRCConnectionSetup_t *rrcConnectionSetup = &dl_ccch_msg->message.choice.c1.choice.rrcConnectionSetup; AssertFatal(rrcConnectionSetup!=NULL,"rrcConnectionSetup is null\n"); @@ -245,7 +245,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, // This should be somewhere in the f1ap_cudu_ue_inst_t /*int macrlc_instance = 0; - rnti_t rnti = f1ap_get_rnti_by_du_id(false, instance, du_ue_f1ap_id); + rnti_t rnti = f1ap_get_rnti_by_du_id(DUtype, instance, du_ue_f1ap_id); struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[macrlc_instance],rnti); */ eNB_RRC_UE_t *ue_p = &ue_context_p->ue_context; @@ -342,7 +342,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, LOG_I(F1AP, "Logical Channel DL-DCCH (SRB1), Received RRCConnectionReconfiguration DU_ID %lx/RNTI %x\n", du_ue_f1ap_id, - f1ap_get_rnti_by_du_id(false, instance, du_ue_f1ap_id)); + f1ap_get_rnti_by_du_id(DUtype, instance, du_ue_f1ap_id)); LTE_RRCConnectionReconfiguration_t *rrcConnectionReconfiguration = &dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration; if (rrcConnectionReconfiguration->criticalExtensions.present == LTE_RRCConnectionReconfiguration__criticalExtensions_PR_c1) { @@ -601,7 +601,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance, ie->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_GNB_CU_UE_F1AP_ID; - ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(false, instance, rnti); + ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(DUtype, instance, rnti); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ /* c2. GNB_DU_UE_F1AP_ID */ @@ -609,7 +609,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance, ie->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(false, instance, rnti); + ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(DUtype, instance, rnti); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ /* c3. SRBID */ @@ -740,7 +740,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance, } ASN_STRUCT_RESET(asn_DEF_F1AP_F1AP_PDU, &pdu); - f1ap_itti_send_sctp_data_req(false, instance, buffer, len, getCxt(false, instance)->default_sctp_stream_id); + f1ap_itti_send_sctp_data_req(false, instance, buffer, len, getCxt(DUtype, instance)->default_sctp_stream_id); return 0; } @@ -758,7 +758,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instanceP, F1AP_InitialULRRCMessageTransfer_t *out; uint8_t *buffer=NULL; uint32_t len=0; - int f1ap_uid = f1ap_add_ue (false, instanceP, rntiP); + int f1ap_uid = f1ap_add_ue (DUtype, instanceP, rntiP); if (f1ap_uid < 0 ) { LOG_E(F1AP, "Failed to add UE \n"); @@ -779,7 +779,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instanceP, ie1->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; ie1->criticality = F1AP_Criticality_reject; ie1->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie1->value.choice.GNB_DU_UE_F1AP_ID = getCxt(false, instanceP)->f1ap_ue[f1ap_uid].du_ue_f1ap_id; + ie1->value.choice.GNB_DU_UE_F1AP_ID = getCxt(DUtype, instanceP)->f1ap_ue[f1ap_uid].du_ue_f1ap_id; /* mandatory */ /* c2. NRCGI */ asn1cSequenceAdd(out->protocolIEs.list, F1AP_InitialULRRCMessageTransferIEs_t, ie2); @@ -787,7 +787,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instanceP, 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(false, instanceP)->setupReq.cell); + addnRCGI(ie2->value.choice.NRCGI, getCxt(DUtype, instanceP)->setupReq.cell); /* mandatory */ /* c3. C_RNTI */ // 16 asn1cSequenceAdd(out->protocolIEs.list, F1AP_InitialULRRCMessageTransferIEs_t, ie3); @@ -821,7 +821,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instanceP, return -1; } - f1ap_itti_send_sctp_data_req(false, instanceP, buffer, len, getCxt(false, instanceP)->default_sctp_stream_id); + f1ap_itti_send_sctp_data_req(false, instanceP, buffer, len, getCxt(DUtype, instanceP)->default_sctp_stream_id); return 0; } @@ -853,14 +853,14 @@ int DU_send_UL_NR_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_ULRRCMessageTransferIEs__value_PR_GNB_CU_UE_F1AP_ID; - ie1->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(false, instance, rnti); + ie1->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(DUtype, instance, rnti); /* mandatory */ /* c2. GNB_DU_UE_F1AP_ID */ asn1cSequenceAdd(out->protocolIEs.list, F1AP_ULRRCMessageTransferIEs_t, ie2); ie2->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; ie2->criticality = F1AP_Criticality_reject; ie2->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie2->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(false, instance, rnti); + ie2->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(DUtype, instance, rnti); /* mandatory */ /* c3. SRBID */ asn1cSequenceAdd(out->protocolIEs.list, F1AP_ULRRCMessageTransferIEs_t, ie3); @@ -885,7 +885,7 @@ int DU_send_UL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, return -1; } - f1ap_itti_send_sctp_data_req(false, instance, buffer, len, getCxt(false, instance)->default_sctp_stream_id); + f1ap_itti_send_sctp_data_req(false, instance, buffer, len, getCxt(DUtype, instance)->default_sctp_stream_id); return 0; } @@ -915,9 +915,9 @@ int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, du_ue_f1ap_id = ie->value.choice.GNB_DU_UE_F1AP_ID; LOG_D(F1AP, "du_ue_f1ap_id %lu associated with UE RNTI %x \n", du_ue_f1ap_id, - f1ap_get_rnti_by_du_id(false, instance, du_ue_f1ap_id)); // this should be the one transmitted via initial ul rrc message transfer + f1ap_get_rnti_by_du_id(DUtype, instance, du_ue_f1ap_id)); // this should be the one transmitted via initial ul rrc message transfer - if (f1ap_du_add_cu_ue_id(false, instance,du_ue_f1ap_id, cu_ue_f1ap_id) < 0 ) { + if (f1ap_du_add_cu_ue_id(instance,du_ue_f1ap_id, cu_ue_f1ap_id) < 0 ) { LOG_E(F1AP, "Failed to find the F1AP UID \n"); //return -1; } @@ -988,7 +988,7 @@ int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, AssertFatal(srb_id<3,"illegal srb_id\n"); MessageDef * msg = itti_alloc_new_message(TASK_DU_F1, 0, NR_DU_RRC_DL_INDICATION); NRDuDlReq_t * req=&NRDuDlReq(msg); - req->rnti=f1ap_get_rnti_by_du_id(false, instance, du_ue_f1ap_id); + req->rnti=f1ap_get_rnti_by_du_id(DUtype, instance, du_ue_f1ap_id); req->srb_id=srb_id; req->buf= get_free_mem_block( ie->value.choice.RRCContainer.size, __func__); memcpy(req->buf->data, ie->value.choice.RRCContainer.buf, ie->value.choice.RRCContainer.size); diff --git a/openair2/F1AP/f1ap_du_task.c b/openair2/F1AP/f1ap_du_task.c index 4fdfc7b178..4e3d756f4a 100644 --- a/openair2/F1AP/f1ap_du_task.c +++ b/openair2/F1AP/f1ap_du_task.c @@ -38,6 +38,9 @@ #include "proto_agent.h" #include +//Fixme: Uniq dirty DU instance, by global var, datamodel need better management +instance_t DUuniqInstance=0; + 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; @@ -133,15 +136,14 @@ void *F1AP_DU_task(void *arg) { LOG_I(F1AP, "DU Task Received F1AP_SETUP_REQ\n"); f1ap_setup_req_t * msgSetup=&F1AP_SETUP_REQ(msg); createF1inst(false, myInstance, msgSetup); - getCxt(false, myInstance)->gtpInst=du_create_gtpu_instance_to_cu(msgSetup->CU_f1_ip_address.ipv4_address, + getCxt(DUtype, myInstance)->gtpInst=du_create_gtpu_instance_to_cu(msgSetup->CU_f1_ip_address.ipv4_address, msgSetup->CUport, msgSetup->DU_f1_ip_address.ipv4_address, msgSetup->DUport); - AssertFatal(getCxt(false, myInstance)->gtpInst>0,"Failed to create CU F1-U UDP listener"); + AssertFatal(getCxt(DUtype, myInstance)->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=getCxt(false, myInstance)->gtpInst; + DUuniqInstance=getCxt(DUtype, myInstance)->gtpInst; du_task_send_sctp_association_req(myInstance,msgSetup); break; diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index a4c1b0d314..44535ac2a4 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -69,11 +69,11 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, f1ap_ue_context_setup_req->gNB_DU_ue_id = ieDU_UE->value.choice.GNB_DU_UE_F1AP_ID; f1ap_ue_context_setup_req->rnti = - f1ap_get_rnti_by_du_id(false, instance, f1ap_ue_context_setup_req->gNB_DU_ue_id); + f1ap_get_rnti_by_du_id(DUtype, instance, f1ap_ue_context_setup_req->gNB_DU_ue_id); } else { f1ap_ue_context_setup_req->gNB_DU_ue_id = -1; f1ap_ue_context_setup_req->rnti = - f1ap_get_rnti_by_cu_id(false, instance, f1ap_ue_context_setup_req->gNB_CU_ue_id); + f1ap_get_rnti_by_cu_id(DUtype, instance, f1ap_ue_context_setup_req->gNB_CU_ue_id); } if(f1ap_ue_context_setup_req->rnti<0) @@ -198,7 +198,7 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, protocol_ctxt_t ctxt; // decode RRC Container and act on the message type //FIXME - //rnti_t rnti = f1ap_get_rnti_by_du_id(false, instance, du_ue_f1ap_id); + //rnti_t rnti = f1ap_get_rnti_by_du_id(DUtype, instance, du_ue_f1ap_id); ctxt.instance = instance; ctxt.instance = instance; ctxt.enb_flag = 1; @@ -237,14 +237,14 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup ie1->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; ie1->criticality = F1AP_Criticality_reject; ie1->value.present = F1AP_UEContextSetupResponseIEs__value_PR_GNB_CU_UE_F1AP_ID; - ie1->value.choice.GNB_CU_UE_F1AP_ID = req->gNB_CU_ue_id; //f1ap_get_cu_ue_f1ap_id(true, instance, req->rnti); + ie1->value.choice.GNB_CU_UE_F1AP_ID = req->gNB_CU_ue_id; /* mandatory */ /* c2. GNB_DU_UE_F1AP_ID */ asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie2); ie2->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID; ie2->criticality = F1AP_Criticality_reject; ie2->value.present = F1AP_UEContextSetupResponseIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie2->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(false, instance, req->rnti); + ie2->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(DUtype, instance, req->rnti); /* mandatory */ /* c3. DUtoCURRCInformation */ @@ -580,14 +580,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(false, instance, req->rnti); + ie1->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(DUtype, 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(false, instance, req->rnti); + ie2->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(DUtype, instance, req->rnti); /* mandatory */ /* c3. Cause */ asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextReleaseRequestIEs_t, ie3); @@ -646,14 +646,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(false, instance, ie->value.choice.GNB_CU_UE_F1AP_ID); + ctxt.rnti = f1ap_get_rnti_by_cu_id(DUtype, instance, ie->value.choice.GNB_CU_UE_F1AP_ID); ctxt.instance = 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(false, instance, + const rnti_t rnti = f1ap_get_rnti_by_du_id(DUtype, 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", @@ -792,14 +792,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(false, instance, cplt->rnti); + ie1->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(DUtype, 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(false, instance, cplt->rnti); + ie2->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(DUtype, instance, cplt->rnti); /* optional -> currently not used */ /* c3. CriticalityDiagnostics */ //if (0) { @@ -861,7 +861,7 @@ int DU_send_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, buffer, len, getCxt(false, instance)->default_sctp_stream_id); - f1ap_remove_ue(false, instance, cplt->rnti); + f1ap_remove_ue(DUtype, instance, cplt->rnti); return 0; } int DU_handle_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index 486a032e8a..85e485cd63 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -534,7 +534,8 @@ rb_found: req->pdusession_id = rb_id; LOG_D(PDCP, "%s() (drb %d) sending message to gtp size %d\n", __func__, rb_id, size); - itti_send_msg_to_task(TASK_VARIABLE, INSTANCE_DEFAULT, message_p); + extern instance_t CUuniqInstance; + itti_send_msg_to_task(TASK_VARIABLE, CUuniqInstance, message_p); return; } diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index 44a7b7ac01..2b6b40dbdb 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -508,7 +508,8 @@ rb_found: req->rnti=ue->rnti; req->pdusession_id=rb_id; LOG_D(RLC, "Received uplink user-plane traffic at RLC-DU to be sent to the CU, size %d \n", size); - itti_send_msg_to_task(OCP_GTPV1_U, 0, msg); + extern instance_t DUuniqInstance; + itti_send_msg_to_task(OCP_GTPV1_U, DUuniqInstance, msg); return; } } diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 5826e838f9..725ab02758 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -1381,8 +1381,10 @@ rrc_gNB_process_RRCReconfigurationComplete( DRBs[i].drb_id = DRB_configList->list.array[i]->drb_Identity; DRBs[i].rlc_mode = RLC_MODE_AM; DRBs[i].up_ul_tnl[0].tl_address = inet_addr(rrc->eth_params_s.my_addr); + DRBs[i].up_ul_tnl[0].port=rrc->eth_params_s.my_portd; DRBs[i].up_ul_tnl_length = 1; DRBs[i].up_dl_tnl[0].tl_address = inet_addr(rrc->eth_params_s.remote_addr); + DRBs[i].up_dl_tnl[0].port=rrc->eth_params_s.remote_portd; DRBs[i].up_dl_tnl_length = 1; } F1AP_UE_CONTEXT_SETUP_REQ (message_p).gNB_CU_ue_id = 0; @@ -3184,7 +3186,8 @@ static void rrc_DU_process_ue_context_setup_request(MessageDef *msg_p, const cha transport_layer_addr_t addr; memcpy(addr.buffer, &drb_p.up_ul_tnl[0].tl_address, sizeof(drb_p.up_ul_tnl[0].tl_address)); addr.length=sizeof(drb_p.up_ul_tnl[0].tl_address)*8; - incoming_teid=newGtpuCreateTunnel(INSTANCE_DEFAULT, + extern instance_t DUuniqInstance; + incoming_teid=newGtpuCreateTunnel(DUuniqInstance, req->rnti, drb_p.drb_id, drb_p.drb_id, diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index e7c73be14f..e4259f3820 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -95,7 +95,7 @@ static teid_t gtpv1uNewTeid(void) { #endif } -instance_t legacyInstanceMapping=0; +static instance_t legacyInstanceMapping=0; #define compatInst(a) ((a)==0 || (a)==INSTANCE_DEFAULT?legacyInstanceMapping:a) #define GTPV1U_HEADER_SIZE (8) From 8078e0b4a124e1cf76ca1ec2ffe5c631ac5e58fe Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Mon, 13 Sep 2021 16:58:09 +0200 Subject: [PATCH 059/110] F1-U ping first full user plane ping working --- openair3/ocp-gtpu/gtp_itf.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index e4259f3820..3dff973f1c 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -182,7 +182,7 @@ static void gtpv1uSend(instance_t instance, gtpv1u_enb_tunnel_data_req_t *req, b if(npduNumFlag) ptr[rab_id].npduNum++; - // We will release the lock, let's copy data before + ocp_gtpv1u_bearer_t tmp=ptr[rab_id]; pthread_mutex_unlock(&globGtp.gtp_lock); gtpv1uCreateAndSendMsg(compatInst(instance), @@ -396,8 +396,9 @@ void GtpuUpdateTunnelOutgoingTeid(instance_t instance, rnti_t rnti, ebi_t bearer pthread_mutex_unlock(&globGtp.gtp_lock); return; } - auto tmp=ptrRnti->second.bearers; - auto ptrBearer=tmp.find(bearer_id); if ( ptrBearer == tmp.end() ) { + auto tmp=&ptrRnti->second.bearers; + auto ptrBearer=tmp->find(bearer_id); + if ( ptrBearer == tmp->end() ) { LOG_E(GTPU,"Update tunnel for a existing rnti %x, but wrong bearer_id %u\n", rnti, bearer_id); pthread_mutex_unlock(&globGtp.gtp_lock); return; From af19655763f2043eb3c98b292189d5cd6ef4d632 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Tue, 14 Sep 2021 09:37:06 +0200 Subject: [PATCH 060/110] Compile all targets to fix compilation regression --- cmake_targets/CMakeLists.txt | 13 +- openair1/SIMULATION/LTE_PHY/common_sim.h | 11 +- openair1/SIMULATION/LTE_PHY/dlsim.c | 2 +- openair1/SIMULATION/NR_PHY/dlsim.c | 14 +- openair1/SIMULATION/NR_PHY/prachsim.c | 14 +- openair1/SIMULATION/NR_PHY/ulsim.c | 13 +- openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 16 ++ openair2/LAYER2/PDCP_v10.1.0/pdcp.h | 8 +- .../PDCP_v10.1.0/pdcp_control_primitive.c | 53 ---- .../pdcp_control_primitives_proto_extern.h | 36 --- openair2/LAYER2/PDCP_v10.1.0/pdcp_thread.c | 132 ---------- .../L2_INTERFACE/openair_rrc_L2_interface.c | 247 ------------------ openair2/UTIL/OPT/vars.h | 28 -- openair3/ocp-gtpu/gtp_itf.cpp | 84 +++--- 14 files changed, 101 insertions(+), 570 deletions(-) delete mode 100644 openair2/LAYER2/PDCP_v10.1.0/pdcp_control_primitive.c delete mode 100644 openair2/LAYER2/PDCP_v10.1.0/pdcp_control_primitives_proto_extern.h delete mode 100644 openair2/LAYER2/PDCP_v10.1.0/pdcp_thread.c delete mode 100644 openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.c delete mode 100644 openair2/UTIL/OPT/vars.h diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 0ebaf2abba..85688732ad 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -1076,6 +1076,7 @@ add_boolean_option(TRACE_RLC_UM_TX_STATUS False "TRACE for RLC UM, TO BE CHANGE #add_boolean_option(PDCP_USE_NETLINK_QUEUES False "When PDCP_USE_NETLINK is true, incoming IP packets are stored in queues") #add_boolean_option(LINK_ENB_PDCP_TO_IP_DRIVER False "For eNB, PDCP communicate with a IP driver") #add_boolean_option(LINK_ENB_PDCP_TO_GTPV1U True "For eNB, PDCP communicate with GTP-U protocol (eNB<->S-GW)") +add_compile_definitions(NEW_GTPU) ########################## # RRC LAYER OPTIONS @@ -2829,7 +2830,7 @@ add_dependencies(lte-softmodem rrc_flag s1ap_flag x2_flag oai_iqplayer) target_link_libraries (lte-softmodem -Wl,--start-group - RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB NR_GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB SCHED_RU_LIB + RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB GTPV1U_OCP SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB SCHED_RU_LIB PHY_COMMON PHY PHY_RU LFDS L2 L2_LTE NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB MISC_NFAPI_LTE_LIB LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ITTI ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB} ${PROTO_AGENT_LIB} -Wl,--end-group z dl) @@ -2872,7 +2873,7 @@ add_dependencies(ocp-enb rrc_flag s1ap_flag x2_flag oai_iqplayer coding params_l target_link_libraries (ocp-enb -Wl,--start-group - RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB NR_GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB SCHED_RU_LIB + RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB GTPV1U_OCP SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB SCHED_RU_LIB PHY_COMMON PHY PHY_RU LFDS L2 L2_LTE NFAPI_COMMON_LIB NFAPI_LIB MISC_NFAPI_LTE_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB LFDS7 SIMU_COMMON ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ITTI ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB} ${PROTO_AGENT_LIB} -Wl,--end-group z dl) @@ -2969,7 +2970,7 @@ target_link_libraries (lte-uesoftmodem -Wl,--start-group RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB F1AP F1AP_LIB - NR_GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON + GTPV1U_OCP SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_UE PHY_RU LFDS L2_UE L2_LTE LFDS7 SIMU_COMMON SIMU NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB MISC_NFAPI_LTE_LIB ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ITTI ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${ATLAS_LIBRARIES} -Wl,--end-group z dl) @@ -3367,7 +3368,7 @@ add_executable(test_epc_generate_scenario ${OPENAIR3_DIR}/S1AP/s1ap_eNB_defs.h ) target_link_libraries (test_epc_generate_scenario - -Wl,--start-group RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP NR_GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY LFDS ITTI ${MSC_LIB} L2 -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB} + -Wl,--start-group RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP GTPV1U_OCP LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY LFDS ITTI ${MSC_LIB} L2 -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB} ) add_executable(test_epc_play_scenario @@ -3386,7 +3387,7 @@ add_executable(test_epc_play_scenario ) target_include_directories(test_epc_play_scenario PUBLIC /usr/local/share/asn1c) target_link_libraries (test_epc_play_scenario - -Wl,--start-group RRC_LIB S1AP_LIB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP NR_GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY_NR_COMMON PHY_COMMON PHY PHY_UE LFDS ITTI ${MSC_LIB} -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB} + -Wl,--start-group RRC_LIB S1AP_LIB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP GTPV1U_OCP LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY_NR_COMMON PHY_COMMON PHY PHY_UE LFDS ITTI ${MSC_LIB} -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB} ) @@ -3432,7 +3433,7 @@ if (${T_TRACER}) NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_VNF_LIB NFAPI_USER_LIB PHY_COMMON PHY PHY_UE PHY_NR PHY_NR_COMMON PHY_NR_UE PHY_RU PHY_MEX L2 L2_LTE L2_NR L2_LTE_NR L2_UE NR_L2_UE L2_UE_LTE_NR MAC_NR_COMMON MAC_NR MAC_UE_NR NGAP_GNB - CN_UTILS NR_GTPV1U GTPV1U_OCP SCTP_CLIENT MME_APP UDP LIB_NAS_UE NB_IoT LFDS LFDS7 SIMU_COMMON SIMU SIMU_ETH OPENAIR0_LIB + CN_UTILS GTPV1U_OCP GTPV1U_OCP SCTP_CLIENT MME_APP UDP LIB_NAS_UE NB_IoT LFDS LFDS7 SIMU_COMMON SIMU SIMU_ETH OPENAIR0_LIB ldpc_orig ldpc_optim ldpc_optim8seg ldpc PROTO_AGENT dfts) if (TARGET ${i}) add_dependencies(${i} generate_T) diff --git a/openair1/SIMULATION/LTE_PHY/common_sim.h b/openair1/SIMULATION/LTE_PHY/common_sim.h index 5e0be3de89..5625cf8e2f 100644 --- a/openair1/SIMULATION/LTE_PHY/common_sim.h +++ b/openair1/SIMULATION/LTE_PHY/common_sim.h @@ -134,16 +134,16 @@ struct option * parse_oai_options(paramdef_t *options) { void display_options_values(paramdef_t *options, int verbose) { for(paramdef_t * ptr=options; ptr->optname[0]!=0; ptr++) { - char varText[256]="need specific display"; + char varText[256]={0}; if (ptr->voidptr != NULL) { if ( (ptr->paramflags & PARAMFLAG_BOOL) ) strcpy(varText, *(bool *)ptr->iptr ? "True": "False" ); else switch (ptr->type) { - case TYPE_INT: - sprintf(varText,"%d",*ptr->iptr); - break; - + case TYPE_INT: + sprintf(varText,"%d",*ptr->iptr); + break; + case TYPE_DOUBLE: sprintf(varText,"%.2f",*ptr->dblptr); break; @@ -157,6 +157,7 @@ void display_options_values(paramdef_t *options, int verbose) { break; default: + strcpy(varText,"Need specific display"); printf("not decoded type\n"); exit(1); } diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index 9a9ccaf1f7..3a34efbb93 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -634,7 +634,7 @@ int main(int argc, char **argv) { // num_layers = 1; perfect_ce = 0; static paramdef_t options[] = { - { "awgn", "Use AWGN channel and not multipath", PARAMFLAG_BOOL, strptr:NULL, defintval:0, TYPE_INT, 0, NULL, NULL }, + { "awgn", "Use AWGN channel and not multipath", PARAMFLAG_BOOL, iptr:&awgn_flag, defintval:0, TYPE_INT, 0, NULL, NULL }, { "Abstx", "Turns on calibration mode for abstraction.", PARAMFLAG_BOOL, iptr:&abstx, defintval:0, TYPE_INT, 0 }, { "bTDD", "Set the tdd configuration mode",0, iptr:&tdd_config, defintval:3, TYPE_INT, 0 }, { "BnbRBs", "The LTE bandwith in RBs (100 is 20MHz)",0, iptr:&N_RB_DL, defintval:25, TYPE_INT, 0 }, diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 5df03a903b..9c81443e0f 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -70,6 +70,7 @@ #include #include +#include LCHAN_DESC DCCH_LCHAN_DESC,DTCH_DL_LCHAN_DESC,DTCH_UL_LCHAN_DESC; rlc_info_t Rlc_info_um,Rlc_info_am_config; @@ -88,6 +89,13 @@ uint64_t downlink_frequency[MAX_NUM_CCs][4]; THREAD_STRUCT thread_struct; nfapi_ue_release_request_body_t release_rntis; uint32_t N_RB_DL = 106; +//Fixme: Uniq dirty DU instance, by global var, datamodel need better management +instance_t DUuniqInstance=0; +instance_t CUuniqInstance=0; +teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int incoming_bearer_id, int outgoing_bearer_id, teid_t outgoing_teid, + transport_layer_addr_t remoteAddr, int port, gtpCallback callBack) { +return 0; +} // dummy functions int dummy_nr_ue_ul_indication(nr_uplink_indication_t *ul_info) { return(0); } @@ -130,12 +138,6 @@ rrc_data_ind( { } -int ocp_gtpv1u_create_s1u_tunnel(instance_t instance, - const gtpv1u_enb_create_tunnel_req_t *create_tunnel_req, - gtpv1u_enb_create_tunnel_resp_t *create_tunnel_resp) { - return 0; -} - int gtpv1u_create_s1u_tunnel( const instance_t instanceP, diff --git a/openair1/SIMULATION/NR_PHY/prachsim.c b/openair1/SIMULATION/NR_PHY/prachsim.c index 6167c809ff..96f6fe4990 100644 --- a/openair1/SIMULATION/NR_PHY/prachsim.c +++ b/openair1/SIMULATION/NR_PHY/prachsim.c @@ -51,6 +51,7 @@ #include #include //#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c" +#include #define NR_PRACH_DEBUG 1 #define PRACH_WRITE_OUTPUT_DEBUG 1 @@ -87,6 +88,13 @@ int oai_nfapi_nr_crc_indication(nfapi_nr_crc_indication_t *ind) { return(0); } int oai_nfapi_nr_srs_indication(nfapi_nr_srs_indication_t *ind) { return(0); } int oai_nfapi_nr_uci_indication(nfapi_nr_uci_indication_t *ind) { return(0); } int oai_nfapi_nr_rach_indication(nfapi_nr_rach_indication_t *ind) { return(0); } +//Fixme: Uniq dirty DU instance, by global var, datamodel need better management +instance_t DUuniqInstance=0; +instance_t CUuniqInstance=0; +teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int incoming_bearer_id, int outgoing_bearer_id, teid_t outgoing_teid, + transport_layer_addr_t remoteAddr, int port, gtpCallback callBack) { +return 0; +} void rrc_data_ind( @@ -98,12 +106,6 @@ rrc_data_ind( { } -int ocp_gtpv1u_create_s1u_tunnel(instance_t instance, - const gtpv1u_enb_create_tunnel_req_t *create_tunnel_req, - gtpv1u_enb_create_tunnel_resp_t *create_tunnel_resp) { - return 0; -} - int gtpv1u_create_s1u_tunnel( const instance_t instanceP, diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index e267c8b6d7..4a87f9f17c 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -65,6 +65,7 @@ #include #include "PHY/NR_REFSIG/ul_ref_seq_nr.h" +#include //#define DEBUG_ULSIM LCHAN_DESC DCCH_LCHAN_DESC,DTCH_DL_LCHAN_DESC,DTCH_UL_LCHAN_DESC; @@ -85,6 +86,13 @@ THREAD_STRUCT thread_struct; nfapi_ue_release_request_body_t release_rntis; uint32_t N_RB_DL = 106; +//Fixme: Uniq dirty DU instance, by global var, datamodel need better management +instance_t DUuniqInstance=0; +instance_t CUuniqInstance=0; +teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int incoming_bearer_id, int outgoing_bearer_id, teid_t outgoing_teid, + transport_layer_addr_t remoteAddr, int port, gtpCallback callBack) { +return 0; +} extern void fix_scd(NR_ServingCellConfig_t *scd);// forward declaration int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, @@ -120,11 +128,6 @@ rrc_data_ind( { } -int ocp_gtpv1u_create_s1u_tunnel(instance_t instance, - const gtpv1u_enb_create_tunnel_req_t *create_tunnel_req, - gtpv1u_enb_create_tunnel_resp_t *create_tunnel_resp) { - return 0; -} int gtpv1u_create_s1u_tunnel( diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index 7fac0bdfca..090cf9531b 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -140,6 +140,22 @@ extern volatile int oai_exit; pthread_t pdcp_stats_thread_desc; +// will be called when 4G F1 implementation will use GTP-U instead of protobuf +boolean_t cu_f1u_data_req( + protocol_ctxt_t *ctxt_pP, + const srb_flag_t srb_flagP, + const rb_id_t rb_id, + const mui_t muiP, + const confirm_t confirmP, + const sdu_size_t sdu_buffer_size, + unsigned char *const sdu_buffer, + const pdcp_transmission_mode_t mode, + const uint32_t *const sourceL2Id, + const uint32_t *const destinationL2Id + ) +{ + return true; +} void *pdcp_stats_thread(void *param) { FILE *fd; diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h index 94d19e9c01..2d11fc6613 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h @@ -264,11 +264,9 @@ boolean_t cu_f1u_data_req( const confirm_t confirmP, const sdu_size_t sdu_buffer_size, unsigned char *const sdu_buffer, - const pdcp_transmission_mode_t mode -#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - ,const uint32_t *const sourceL2Id - ,const uint32_t *const destinationL2Id -#endif + const pdcp_transmission_mode_t mode, + const uint32_t *const sourceL2Id, + const uint32_t *const destinationL2Id ); /*! \fn boolean_t pdcp_data_ind(const protocol_ctxt_t* const, srb_flag_t, MBMS_flag_t, rb_id_t, sdu_size_t, mem_block_t*, boolean_t) diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_control_primitive.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_control_primitive.c deleted file mode 100644 index c2736ddd84..0000000000 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_control_primitive.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*************************************************************************** - pdcp_control_primitives.c - ------------------- - begin : Mon Dec 10 2001 - email : Lionel.Gauthier@eurecom.fr - ------------------- - description - This file contains the functions used for configuration of pdcp - - ***************************************************************************/ -#include "rtos_header.h" -#include "platform.h" -#include "protocol_vars_extern.h" -//----------------------------------------------------------------------------- -#include "rlc.h" -#include "pdcp.h" -#include "debug_l2.h" -//----------------------------------------------------------------------------- -void -configure_pdcp_req (struct pdcp_entity *pdcpP, void *rlcP, uint8_t rlc_sap_typeP, uint8_t header_compression_typeP) -{ - //----------------------------------------------------------------------------- - mem_block *mb; - - mb = get_free_mem_block (sizeof (struct cpdcp_primitive), __func__); - if(mb==NULL) return; - ((struct cpdcp_primitive *) mb->data)->type = CPDCP_CONFIG_REQ; - ((struct cpdcp_primitive *) mb->data)->primitive.config_req.rlc_sap = rlcP; - ((struct cpdcp_primitive *) mb->data)->primitive.config_req.rlc_type_sap = rlc_sap_typeP; - ((struct cpdcp_primitive *) mb->data)->primitive.config_req.header_compression_type = header_compression_typeP; - send_pdcp_control_primitive (pdcpP, mb); -} diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_control_primitives_proto_extern.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp_control_primitives_proto_extern.h deleted file mode 100644 index 6226dccc33..0000000000 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_control_primitives_proto_extern.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*************************************************************************** - pdcp_control_primitives_proto_extern.h - ------------------- - begin : Mon Dec 10 2001 - email : Lionel.Gauthier@eurecom.fr - ------------------- - description - This file contains the prototypes of functions used for configuration of pdcp - - ***************************************************************************/ -#ifndef PDCP_CONTROL_PRIMITIVES_PROTO_EXTERN_H -# define PDCP_CONTROL_PRIMITIVES_PROTO_EXTERN_H -# include "pdcp.h" -void rrc_configure_pdcp (struct pdcp_entity *pdcpP, void *rlcP, uint8_t rlc_sap_typeP, uint8_t header_compression_typeP); -#endif diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_thread.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_thread.c deleted file mode 100644 index f1f6ebb794..0000000000 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_thread.c +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file pdcp_thread.c - * \brief - * \author F. Kaltenberger - * \date 2013 - * \version 0.1 - * \company Eurecom - * \email: florian.kaltenberger@eurecom.fr - * \note - * \warning - */ -#include -//#include - -#include "pdcp.h" -#include "PHY/extern.h" //for PHY_vars -#include "UTIL/LOG/log.h" -#include "UTIL/LOG/vcd_signal_dumper.h" -#include "msc.h" - -#define OPENAIR_THREAD_STACK_SIZE 8192 -#define OPENAIR_THREAD_PRIORITY 255 - -extern int oai_exit; -extern char UE_flag; - -pthread_t pdcp_thread; -pthread_mutex_t pdcp_mutex; -pthread_cond_t pdcp_cond; -int pdcp_instance_cnt; - -static void *pdcp_thread_main(void* param); - -static void *pdcp_thread_main(void* param) -{ - uint8_t eNB_flag = !UE_flag; - - LOG_I(PDCP,"This is pdcp_thread eNB_flag = %d\n",eNB_flag); - MSC_START_USE(); - - while (!oai_exit) { - - if (pthread_mutex_lock(&pdcp_mutex) != 0) { - LOG_E(PDCP,"Error locking mutex.\n"); - } else { - while (pdcp_instance_cnt < 0) { - pthread_cond_wait(&pdcp_cond,&pdcp_mutex); - } - - if (pthread_mutex_unlock(&pdcp_mutex) != 0) { - LOG_E(PDCP,"Error unlocking mutex.\n"); - } - } - - if (oai_exit) break; - - if (eNB_flag) { - pdcp_run(PHY_vars_eNB_g[0]->frame, eNB_flag, PHY_vars_eNB_g[0]->Mod_id, 0); - LOG_D(PDCP,"Calling pdcp_run (eNB) for frame %d\n",PHY_vars_eNB_g[0]->frame); - } else { - pdcp_run(PHY_vars_UE_g[0]->frame, eNB_flag, 0, PHY_vars_UE_g[0]->Mod_id); - LOG_D(PDCP,"Calling pdcp_run (UE) for frame %d\n",PHY_vars_UE_g[0]->frame); - } - - if (pthread_mutex_lock(&pdcp_mutex) != 0) { - LOG_E(PDCP,"Error locking mutex.\n"); - } else { - pdcp_instance_cnt--; - - if (pthread_mutex_unlock(&pdcp_mutex) != 0) { - LOG_E(PDCP,"Error unlocking mutex.\n"); - } - } - } - - return(NULL); -} - - -int init_pdcp_thread(void) -{ - - pthread_mutex_init(&pdcp_mutex,NULL); - pthread_cond_init(&pdcp_cond,NULL); - - pdcp_instance_cnt = -1; - LOG_I(PDCP,"Allocating PDCP thread\n"); - threadCreate(&pdcp_thread, pdcp_thread_main, (void*)NULL, "PDCP", -1, OAI_PRIORITY_RT); - - return(0); -} - - -void cleanup_pdcp_thread(void) -{ - void *status_p = NULL; - - LOG_I(PDCP,"Scheduling PDCP thread to exit\n"); - - pdcp_instance_cnt = 0; - - if (pthread_cond_signal(&pdcp_cond) != 0) { - LOG_I(PDCP,"ERROR pthread_cond_signal\n"); - } else { - LOG_I(PDCP,"Signalled PDCP thread to exit\n"); - } - - pthread_join(pdcp_thread,&status_p); - LOG_I(PDCP,"PDCP thread exited\n"); - pthread_cond_destroy(&pdcp_cond); - pthread_mutex_destroy(&pdcp_mutex); -} diff --git a/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.c b/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.c deleted file mode 100644 index c64fd09bfc..0000000000 --- a/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.c +++ /dev/null @@ -1,247 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file l2_interface.c -* \brief layer 2 interface -* \author Navid Nikaein and Raymond Knopp -* \date 2011 -* \version 1.0 -* \company Eurecom -* \email: navid.nikaein@eurecom.fr -*/ - -#include -#include -#include - -#include "platform_types.h" -#include "openair_defs.h" - -#ifdef CELLULAR -#include "rrc_L2_proto.h" -#else -#include "RRC/LTE/defs.h" -#endif //CELLULAR -#include "COMMON/mac_rrc_primitives.h" -#include "openair_rrc_L2_interface.h" - -//------------------------------------------------------------------------------ -int8_t -mac_rrc_data_req( - const module_id_t module_idP, - const int CC_idP, - const frame_t frameP, - const rb_id_t srb_idP, - const uint8_t nb_tbP, - uint8_t* const buffer_pP, - const eNB_flag_t eNB_flagP, - const uint8_t eNB_indexP, - const uint8_t mbsfn_sync_areaP -) -//------------------------------------------------------------------------------ -{ - return(mac_rrc_lite_data_req( - module_idP, - CC_idP, - frameP, - srb_idP, - nb_tbP, - buffer_pP, - eNB_flagP, - eNB_indexP, - mbsfn_sync_areaP) - ); -} - -//------------------------------------------------------------------------------ -/*int8_t -mac_rrc_data_ind( - const module_id_t module_idP, - const int CC_idP, - const frame_t frameP, - const sub_frame_t subframeP, - const rnti_t rntiP, - const rb_id_t srb_idP, - const uint8_t *sduP, - const sdu_size_t sdu_lenP, - const eNB_flag_t eNB_flagP, - const mac_enb_index_t eNB_indexP, - const uint8_t mbsfn_sync_area -) -//------------------------------------------------------------------------------ -{ - return(mac_rrc_lite_data_ind( - module_idP, - CC_idP, - frameP,subframeP, - rntiP, - srb_idP, - sduP, - sdu_lenP, - eNB_flagP, - eNB_indexP, - mbsfn_sync_area) - ); -}*/ - -//------------------------------------------------------------------------------ -void -rlcrrc_data_ind( - const protocol_ctxt_t* const ctxt_pP, - const rb_id_t srb_idP, - const sdu_size_t sdu_lenP, - const uint8_t * const buffer_pP -) -//------------------------------------------------------------------------------ -{ - rrc_data_ind(ctxt_pP, - srb_idP, - sdu_lenP, - buffer_pP); -} - -//------------------------------------------------------------------------------ -uint8_t -pdcp_rrc_data_req( - const protocol_ctxt_t* const ctxt_pP, - const rb_id_t rb_idP, - const mui_t muiP, - const confirm_t confirmP, - const sdu_size_t sdu_buffer_sizeP, - uint8_t* const sdu_buffer_pP, - const pdcp_transmission_mode_t modeP -) -//------------------------------------------------------------------------------ -{ - return rrc_lite_data_req ( - ctxt_pP, - rb_idP, - muiP, - confirmP, - sdu_buffer_sizeP, - sdu_buffer_pP, - modeP); -} - -//------------------------------------------------------------------------------ -void -pdcp_rrc_data_ind( - const protocol_ctxt_t* const ctxt_pP, - const rb_id_t srb_idP, - const sdu_size_t sdu_sizeP, - uint8_t * const buffer_pP -) -//------------------------------------------------------------------------------ -{ - rrc_lite_data_ind( - ctxt_pP, - srb_idP, - sdu_sizeP, - buffer_pP); -} - -//------------------------------------------------------------------------------ -void -mac_rrc_meas_ind( - const module_id_t module_idP, - MAC_MEAS_REQ_ENTRY * const Meas_entry_pP -) -//------------------------------------------------------------------------------ -{ - // mac_rrc_meas_ind(module_idP,Meas_entry_pP); -} - -//------------------------------------------------------------------------------ -void -mac_sync_ind( - const module_id_t module_idP, - const uint8_t Status -) -//------------------------------------------------------------------------------ -{ - mac_lite_sync_ind(module_idP,Status); -} - -//------------------------------------------------------------------------------ -void -mac_in_sync_ind( - const module_id_t module_idP, - const frame_t frameP, - const uint16_t eNB_indexP -) -//------------------------------------------------------------------------------ -{ - rrc_lite_in_sync_ind(module_idP,frameP,eNB_indexP); -} - -//------------------------------------------------------------------------------ -void -mac_out_of_sync_ind( - const module_id_t module_idP, - const frame_t frameP, - const uint16_t eNB_indexP -) -//------------------------------------------------------------------------------ -{ - rrc_lite_out_of_sync_ind(module_idP,frameP,eNB_indexP); -} - -//------------------------------------------------------------------------------ -int -mac_eNB_get_rrc_status( - const module_id_t module_idP, - const rnti_t rntiP -) -//------------------------------------------------------------------------------ -{ - return mac_eNB_get_rrc_lite_status(module_idP, rntiP); -} -//------------------------------------------------------------------------------ -int -mac_UE_get_rrc_status( - const module_id_t module_idP, - const uint8_t sig_indexP -) -//------------------------------------------------------------------------------ -{ - return mac_UE_get_rrc_lite_status(module_idP, sig_indexP); -} - -//------------------------------------------------------------------------------ -char -openair_rrc_ue_init( - const module_id_t module_idP, - const unsigned char eNB_indexP -) -//------------------------------------------------------------------------------ -{ - return openair_rrc_lite_ue_init(module_idP, eNB_indexP); -} - -//------------------------------------------------------------------------------ -char -openair_rrc_eNB_init( - const module_id_t module_idP -) -//------------------------------------------------------------------------------ -{ - return openair_rrc_lite_eNB_init(module_idP); -} diff --git a/openair2/UTIL/OPT/vars.h b/openair2/UTIL/OPT/vars.h deleted file mode 100644 index 0da315aa8b..0000000000 --- a/openair2/UTIL/OPT/vars.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under - * the OAI Public License, Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*____________________________OPT/var.h___________________________ -Authors: Navid NIKAIEN -Company: EURECOM -Emails: -*/ -extern mac_lte_tap_info *WS_mac_lte_tap_info; -extern mac_lte_info *WS_mac_lte_info; diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index 3dff973f1c..8db7cafb7a 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -121,8 +121,10 @@ static int gtpv1uCreateAndSendMsg(int h, uint32_t peerIp, uint16_t peerPort, te msgHdr->version=1; msgHdr->msgType=GTP_GPDU; msgHdr->msgLength=htons(msgLen); + if ( seqNumFlag || extHdrFlag || npduNumFlag) msgHdr->msgLength+=4; + msgHdr->teid=htonl(teid); if(seqNumFlag || extHdrFlag || npduNumFlag) { @@ -138,8 +140,8 @@ static int gtpv1uCreateAndSendMsg(int h, uint32_t peerIp, uint16_t peerPort, te to.sin_port = htons(peerPort); to.sin_addr.s_addr = peerIp ; LOG_D(GTPU,"sending packet size: %d to %s\n",fullSize, inet_ntoa(to.sin_addr) ); - int ret; + if ((ret=sendto(h, (void *)buffer, (size_t)fullSize, 0,(struct sockaddr *)&to, sizeof(to) )) != fullSize ) { LOG_E(GTPU, "[SD %d] Failed to send data to " IPV4_ADDR " on port %d, buffer size %u, ret: %d, errno: %d\n", h, IPV4_ADDR_FORMAT(peerIp), peerPort, fullSize, ret, errno); @@ -166,24 +168,25 @@ static void gtpv1uSend(instance_t instance, gtpv1u_enb_tunnel_data_req_t *req, b return; } - auto ptr=ptrRnti->second.bearers; + map::iterator ptr2=ptrRnti->second.bearers.find(rab_id); - if ( ptr.find(rab_id) == ptr.end() ) { + if ( ptr2 == ptrRnti->second.bearers.end() ) { LOG_E(GTPU,"sending a packet to a non existant RNTI:RAB: %x/%x\n", rnti, rab_id); pthread_mutex_unlock(&globGtp.gtp_lock); return; - } else - LOG_D(GTPU,"sending a packet to RNTI:RAB:teid %x/%x/%x, len %lu, oldseq %d, oldnum %d\n", - rnti, rab_id,ptr[rab_id].teid_outgoing,length, ptr[rab_id].seqNum,ptr[rab_id].npduNum ); + } + + LOG_D(GTPU,"sending a packet to RNTI:RAB:teid %x/%x/%x, len %lu, oldseq %d, oldnum %d\n", + rnti, rab_id,ptr2->second.teid_outgoing,length, ptr2->second.seqNum,ptr2->second.npduNum ); if(seqNumFlag) - ptr[rab_id].seqNum++; + ptr2->second.seqNum++; if(npduNumFlag) - ptr[rab_id].npduNum++; + ptr2->second.npduNum++; - - ocp_gtpv1u_bearer_t tmp=ptr[rab_id]; + // copy to release the mutex + ocp_gtpv1u_bearer_t tmp=ptr2->second; pthread_mutex_unlock(&globGtp.gtp_lock); gtpv1uCreateAndSendMsg(compatInst(instance), tmp.outgoing_ip_addr, @@ -207,24 +210,25 @@ static void gtpv1uSend2(instance_t instance, gtpv1u_gnb_tunnel_data_req_t *req, return; } - auto ptr=ptrRnti->second.bearers; + map::iterator ptr2=ptrRnti->second.bearers.find(rab_id); - if ( ptr.find(rab_id) == ptr.end() ) { + if ( ptr2 == ptrRnti->second.bearers.end() ) { LOG_E(GTPU,"sending a packet to a non existant RNTI:RAB: %x/%x\n", rnti, rab_id); pthread_mutex_unlock(&globGtp.gtp_lock); return; - } else - LOG_D(GTPU,"sending a packet to RNTI:RAB:teid %x/%x/%x, len %lu, oldseq %d, oldnum %d\n", - rnti, rab_id,ptr[rab_id].teid_outgoing,length, ptr[rab_id].seqNum,ptr[rab_id].npduNum ); + } + + LOG_D(GTPU,"sending a packet to RNTI:RAB:teid %x/%x/%x, len %lu, oldseq %d, oldnum %d\n", + rnti, rab_id,ptr2->second.teid_outgoing,length, ptr2->second.seqNum,ptr2->second.npduNum ); if(seqNumFlag) - ptr[rab_id].seqNum++; + ptr2->second.seqNum++; if(npduNumFlag) - ptr[rab_id].npduNum++; + ptr2->second.npduNum++; - // We will release the lock, let's copy data before - ocp_gtpv1u_bearer_t tmp=ptr[rab_id]; + // copy to release the mutex + ocp_gtpv1u_bearer_t tmp=ptr2->second; pthread_mutex_unlock(&globGtp.gtp_lock); gtpv1uCreateAndSendMsg(compatInst(instance), tmp.outgoing_ip_addr, @@ -246,17 +250,17 @@ static void gtpv1uEndTunnel(instance_t instance, gtpv1u_enb_tunnel_data_req_t *r return; } - auto ptr=ptrRnti->second.bearers; + map::iterator ptr2=ptrRnti->second.bearers.find(rab_id); - if ( ptr.find(rab_id) == ptr.end() ) { + if ( ptr2 == ptrRnti->second.bearers.end() ) { LOG_E(GTPU,"sending a packet to a non existant RNTI:RAB: %x/%x\n", rnti, rab_id); pthread_mutex_unlock(&globGtp.gtp_lock); return; - } else - LOG_D(GTPU,"sending a end packet packet to RNTI:RAB:teid %x/%x/%x\n", - rnti, rab_id,ptr[rab_id].teid_outgoing); + } - ocp_gtpv1u_bearer_t tmp=ptr[rab_id]; + LOG_D(GTPU,"sending a end packet packet to RNTI:RAB:teid %x/%x/%x\n", + rnti, rab_id,ptr2->second.teid_outgoing); + ocp_gtpv1u_bearer_t tmp=ptr2->second; pthread_mutex_unlock(&globGtp.gtp_lock); Gtpv1uMsgHeaderT msgHdr; // N should be 0 for us (it was used only in 2G and 3G) @@ -275,7 +279,6 @@ static void gtpv1uEndTunnel(instance_t instance, gtpv1u_enb_tunnel_data_req_t *r to.sin_family = AF_INET; to.sin_port = htons(tmp.outgoing_port); to.sin_addr.s_addr = tmp.outgoing_ip_addr; - char ip4[INET_ADDRSTRLEN]; //char ip6[INET6_ADDRSTRLEN]; LOG_D(GTPU,"sending end packet to %s\n", inet_ntoa(to.sin_addr) ); @@ -391,22 +394,25 @@ void GtpuUpdateTunnelOutgoingTeid(instance_t instance, rnti_t rnti, ebi_t bearer pthread_mutex_lock(&globGtp.gtp_lock); auto inst=&globGtp.instances[compatInst(instance)]; auto ptrRnti=inst->ue2te_mapping.find(rnti); + if ( ptrRnti == inst->ue2te_mapping.end() ) { LOG_E(GTPU,"Update tunnel for a not existing rnti %x\n", rnti); pthread_mutex_unlock(&globGtp.gtp_lock); return; } - auto tmp=&ptrRnti->second.bearers; - auto ptrBearer=tmp->find(bearer_id); - if ( ptrBearer == tmp->end() ) { + + map::iterator ptr2=ptrRnti->second.bearers.find(bearer_id); + + if ( ptr2 == ptrRnti->second.bearers.end() ) { LOG_E(GTPU,"Update tunnel for a existing rnti %x, but wrong bearer_id %u\n", rnti, bearer_id); pthread_mutex_unlock(&globGtp.gtp_lock); return; - } //AssertFatal(ptrBearer.second.teid_outgoing == oldOutGoingTeid, ""); - ptrBearer->second.teid_outgoing = newOutgoingTeid; - LOG_I(GTPU, "Tunnel Outgoing TEID updated to %d \n", ptrBearer->second.teid_outgoing); - pthread_mutex_unlock(&globGtp.gtp_lock); - return; + } + + ptr2->second.teid_outgoing = newOutgoingTeid; + LOG_I(GTPU, "Tunnel Outgoing TEID updated to %d \n", ptr2->second.teid_outgoing); + pthread_mutex_unlock(&globGtp.gtp_lock); + return; } teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int incoming_bearer_id, int outgoing_bearer_id, teid_t outgoing_teid, @@ -434,7 +440,7 @@ teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int incoming_bearer inst->te2ue_mapping[incoming_teid].callBack=callBack; - auto tmp=&inst->ue2te_mapping[rnti].bearers[outgoing_bearer_id]; + ocp_gtpv1u_bearer_t *tmp=&inst->ue2te_mapping[rnti].bearers[outgoing_bearer_id]; int addrs_length_in_bytes = remoteAddr.length / 8; @@ -464,14 +470,12 @@ teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int incoming_bearer pthread_mutex_unlock(&globGtp.gtp_lock); char ip4[INET_ADDRSTRLEN]; char ip6[INET6_ADDRSTRLEN]; - LOG_I(GTPU, "Created tunnel for RNTI %x, teid for DL: %u, teid for UL %u to remote IPv4: %s, IPv6 %s\n", rnti, tmp->teid_incoming, tmp->teid_outgoing, - inet_ntop(AF_INET,(void*)&tmp->outgoing_ip_addr, ip4,INET_ADDRSTRLEN ), - inet_ntop(AF_INET6,(void*)&tmp->outgoing_ip6_addr.s6_addr, ip6, INET6_ADDRSTRLEN)); - + inet_ntop(AF_INET,(void *)&tmp->outgoing_ip_addr, ip4,INET_ADDRSTRLEN ), + inet_ntop(AF_INET6,(void *)&tmp->outgoing_ip6_addr.s6_addr, ip6, INET6_ADDRSTRLEN)); return incoming_teid; } @@ -862,7 +866,7 @@ void *ocp_gtpv1uTask(void *args) { case GTPV1U_GNB_TUNNEL_DATA_REQ: { gtpv1uSend2(compatInst(ITTI_MSG_DESTINATION_INSTANCE(message_p)), >PV1U_GNB_TUNNEL_DATA_REQ(message_p), false, false); - } + } break; case TERMINATE_MESSAGE: From e77a177f285035c0bed7842172a96b81aa5b3a78 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Tue, 14 Sep 2021 10:37:14 +0200 Subject: [PATCH 061/110] use older cmake version --- cmake_targets/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 85688732ad..e3843fe279 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -1076,7 +1076,7 @@ add_boolean_option(TRACE_RLC_UM_TX_STATUS False "TRACE for RLC UM, TO BE CHANGE #add_boolean_option(PDCP_USE_NETLINK_QUEUES False "When PDCP_USE_NETLINK is true, incoming IP packets are stored in queues") #add_boolean_option(LINK_ENB_PDCP_TO_IP_DRIVER False "For eNB, PDCP communicate with a IP driver") #add_boolean_option(LINK_ENB_PDCP_TO_GTPV1U True "For eNB, PDCP communicate with GTP-U protocol (eNB<->S-GW)") -add_compile_definitions(NEW_GTPU) +add_definitions(-DNEW_GTPU=1) ########################## # RRC LAYER OPTIONS From 7d8224863e513cf2286dd204fdf6e00f07b69c4f Mon Sep 17 00:00:00 2001 From: matzakos Date: Tue, 14 Sep 2021 12:14:48 +0200 Subject: [PATCH 062/110] Add gtpu instance print in gtpu_send logs --- openair3/ocp-gtpu/gtp_itf.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index 8db7cafb7a..03d2ccce48 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -205,7 +205,7 @@ static void gtpv1uSend2(instance_t instance, gtpv1u_gnb_tunnel_data_req_t *req, auto ptrRnti=inst->ue2te_mapping.find(rnti); if ( ptrRnti==inst->ue2te_mapping.end() ) { - LOG_E(GTPU, "gtpv1uSend failed: while getting ue rnti %x in hashtable ue_mapping\n", rnti); + LOG_E(GTPU, "GTP-U instance: %d gtpv1uSend failed: while getting ue rnti %x in hashtable ue_mapping\n", instance, rnti); pthread_mutex_unlock(&globGtp.gtp_lock); return; } @@ -213,13 +213,13 @@ static void gtpv1uSend2(instance_t instance, gtpv1u_gnb_tunnel_data_req_t *req, map::iterator ptr2=ptrRnti->second.bearers.find(rab_id); if ( ptr2 == ptrRnti->second.bearers.end() ) { - LOG_E(GTPU,"sending a packet to a non existant RNTI:RAB: %x/%x\n", rnti, rab_id); + LOG_D(GTPU,"GTP-U instance: %d sending a packet to a non existant RNTI:RAB: %x/%x\n", instance, rnti, rab_id); pthread_mutex_unlock(&globGtp.gtp_lock); return; } - LOG_D(GTPU,"sending a packet to RNTI:RAB:teid %x/%x/%x, len %lu, oldseq %d, oldnum %d\n", - rnti, rab_id,ptr2->second.teid_outgoing,length, ptr2->second.seqNum,ptr2->second.npduNum ); + LOG_D(GTPU,"GTP-U instance: %d sending a packet to RNTI:RAB:teid %x/%x/%x, len %lu, oldseq %d, oldnum %d\n", + instance, rnti, rab_id,ptr2->second.teid_outgoing,length, ptr2->second.seqNum,ptr2->second.npduNum ); if(seqNumFlag) ptr2->second.seqNum++; @@ -387,6 +387,7 @@ instance_t ocp_gtpv1Init(openAddr_t context) { LOG_E(GTPU,"can't create GTP-U instance\n"); pthread_mutex_unlock(&globGtp.gtp_lock); + LOG_I(GTPU, "Created gtpu instance id: %d\n", id); return id; } From 97bedd6481eef21afa0e3d93d2225d0ec29bcc5a Mon Sep 17 00:00:00 2001 From: matzakos Date: Tue, 14 Sep 2021 12:15:52 +0200 Subject: [PATCH 063/110] Update config. files for CU, DU and UE --- .../PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf | 275 +++--------------- .../PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf | 87 +++--- targets/PROJECTS/GENERIC-NR-5GC/CONF/ue.conf | 8 + 3 files changed, 96 insertions(+), 274 deletions(-) create mode 100644 targets/PROJECTS/GENERIC-NR-5GC/CONF/ue.conf diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf index bfb268fef8..c6fa68c223 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf @@ -1,4 +1,4 @@ -Active_gNBs = ( "gNB-CU-Eurecom-5GNRBox"); +Active_gNBs = ( "gNB-Eurecom-CU"); # Asn1_verbosity, choice in: none, info, annoying Asn1_verbosity = "none"; Num_Threads_PUSCH = 8; @@ -7,203 +7,44 @@ gNBs = ( { ////////// Identification parameters: - gNB_ID = 0xe00; + gNB_CU_ID = 0xe00; - cell_type = "CELL_MACRO_GNB"; +# cell_type = "CELL_MACRO_GNB"; - gNB_name = "gNB-CU-Eurecom-5GNRBox"; + gNB_name = "gNB-Eurecom-CU"; + // Tracking area code, 0x0000 and 0xfffe are reserved values // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; + plmn_list = ({ + mcc = 208; + mnc = 99; + mnc_length = 2; + snssaiList = ( + { + sst = 1; + sd = 0x010203; // 0 false, else true + }, + { + sst = 1; + sd = 0x1; #112233; // 0 false, else true + } + ); - plmn_list = ({mcc = 208; mnc = 93; mnc_length = 2;}); + }); - nr_cellid = 12345678L - tr_s_preference = "f1" + nr_cellid = 12345678L - local_s_if_name = "lo"; + tr_s_preference = "f1"; + + local_s_if_name = "lo"; + local_s_address = "127.0.0.4"; #"192.168.18.207"; #"127.0.0.4"; remote_s_address = "127.0.0.3"; - local_s_address = "127.0.0.4"; - local_s_portc = 501; - remote_s_portc = 500; - local_s_portd = 601; - remote_s_portd = 600; - - ////////// Physical parameters: - - ssb_SubcarrierOffset = 0; - pdsch_AntennaPorts = 1; - pusch_AntennaPorts = 1; - sib1_tda = 0; - - servingCellConfigCommon = ( - { - #spCellConfigCommon - - physCellId = 0; - -# downlinkConfigCommon - #frequencyInfoDL - # this is 3600 MHz + 43 PRBs@30kHz SCS (same as initial BWP) - absoluteFrequencySSB = 641032; - dl_frequencyBand = 78; - # this is 3600 MHz - dl_absoluteFrequencyPointA = 640000; - #scs-SpecificCarrierList - dl_offstToCarrier = 0; -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - dl_subcarrierSpacing = 1; - dl_carrierBandwidth = 106; - #initialDownlinkBWP - #genericParameters - # this is RBstart=41,L=24 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 6366; -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - initialDLBWPsubcarrierSpacing = 1; - #pdcch-ConfigCommon - initialDLBWPcontrolResourceSetZero = 12; - initialDLBWPsearchSpaceZero = 0; - #pdsch-ConfigCommon - #pdschTimeDomainAllocationList (up to 16 entries) - initialDLBWPk0_0 = 0; - #initialULBWPmappingType - #0=typeA,1=typeB - initialDLBWPmappingType_0 = 0; - #this is SS=1,L=13 - initialDLBWPstartSymbolAndLength_0 = 40; - - initialDLBWPk0_1 = 0; - initialDLBWPmappingType_1 = 0; - #this is SS=2,L=12 - initialDLBWPstartSymbolAndLength_1 = 53; - - initialDLBWPk0_2 = 0; - initialDLBWPmappingType_2 = 0; - #this is SS=1,L=12 - initialDLBWPstartSymbolAndLength_2 = 54; - - initialDLBWPk0_3 = 0; - initialDLBWPmappingType_3 = 0; - #this is SS=1,L=5 - initialDLBWPstartSymbolAndLength_3 = 57; - - #uplinkConfigCommon - #frequencyInfoUL - ul_frequencyBand = 78; - #scs-SpecificCarrierList - ul_offstToCarrier = 0; -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - ul_subcarrierSpacing = 1; - ul_carrierBandwidth = 106; - pMax = 20; - #initialUplinkBWP - #genericParameters - initialULBWPlocationAndBandwidth = 6366; -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - initialULBWPsubcarrierSpacing = 1; - #rach-ConfigCommon - #rach-ConfigGeneric - prach_ConfigurationIndex = 98; -#prach_msg1_FDM -#0 = one, 1=two, 2=four, 3=eight - prach_msg1_FDM = 0; - prach_msg1_FrequencyStart = 0; - zeroCorrelationZoneConfig = 13; - preambleReceivedTargetPower = -118; -#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) - preambleTransMax = 6; -#powerRampingStep -# 0=dB0,1=dB2,2=dB4,3=dB6 - powerRampingStep = 1; -#ra_ReponseWindow -#1,2,4,8,10,20,40,80 - ra_ResponseWindow = 4; -#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR -#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen - ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4; -#oneHalf (0..15) 4,8,12,16,...60,64 - ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 15; -#ra_ContentionResolutionTimer -#(0..7) 8,16,24,32,40,48,56,64 - ra_ContentionResolutionTimer = 7; - rsrp_ThresholdSSB = 19; -#prach-RootSequenceIndex_PR -#1 = 839, 2 = 139 - prach_RootSequenceIndex_PR = 2; - prach_RootSequenceIndex = 1; - # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex - # - msg1_SubcarrierSpacing = 1, -# restrictedSetConfig -# 0=unrestricted, 1=restricted type A, 2=restricted type B - restrictedSetConfig = 0, - - # pusch-ConfigCommon (up to 16 elements) - initialULBWPk2_0 = 6; - initialULBWPmappingType_0 = 1 - # this is SS=0 L=11 - initialULBWPstartSymbolAndLength_0 = 55; - - initialULBWPk2_1 = 6; - initialULBWPmappingType_1 = 1; - # this is SS=0 L=12 - initialULBWPstartSymbolAndLength_1 = 69; - - initialULBWPk2_2 = 7; - initialULBWPmappingType_2 = 1; - # this is SS=10 L=4 - initialULBWPstartSymbolAndLength_2 = 52; - - msg3_DeltaPreamble = 1; - p0_NominalWithGrant =-90; - -# pucch-ConfigCommon setup : -# pucchGroupHopping -# 0 = neither, 1= group hopping, 2=sequence hopping - pucchGroupHopping = 0; - hoppingId = 40; - p0_nominal = -90; -# ssb_PositionsInBurs_BitmapPR -# 1=short, 2=medium, 3=long - ssb_PositionsInBurst_PR = 2; - ssb_PositionsInBurst_Bitmap = 1; - -# ssb_periodicityServingCell -# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 - ssb_periodicityServingCell = 2; - -# dmrs_TypeA_position -# 0 = pos2, 1 = pos3 - dmrs_TypeA_Position = 0; - -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - subcarrierSpacing = 1; - - - #tdd-UL-DL-ConfigurationCommon -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - referenceSubcarrierSpacing = 1; - # pattern1 - # dl_UL_TransmissionPeriodicity - # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 - dl_UL_TransmissionPeriodicity = 6; - nrofDownlinkSlots = 7; - nrofDownlinkSymbols = 6; - nrofUplinkSlots = 2; - nrofUplinkSymbols = 4; - - ssPBCH_BlockPower = 10; - } - - ); - + local_s_portc = 501; + local_s_portd = 2152; + remote_s_portc = 501; + remote_s_portd = 2152; # ------- SCTP definitions SCTP : @@ -214,8 +55,8 @@ gNBs = }; - ////////// MME parameters: - mme_ip_address = ( { ipv4 = "192.168.12.26"; + ////////// AMF parameters: + amf_ip_address = ( { ipv4 = "192.168.69.131"; ipv6 = "192:168:30::17"; active = "yes"; preference = "ipv4"; @@ -225,49 +66,15 @@ gNBs = NETWORK_INTERFACES : { - GNB_INTERFACE_NAME_FOR_S1_MME = "eth0"; - GNB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.111/24"; - GNB_INTERFACE_NAME_FOR_S1U = "eth0"; - GNB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24"; + GNB_INTERFACE_NAME_FOR_NG_AMF = "bond0"; + GNB_IPV4_ADDRESS_FOR_NG_AMF = "192.168.18.207/24"; + GNB_INTERFACE_NAME_FOR_NGU = "bond0"; + GNB_IPV4_ADDRESS_FOR_NGU = "192.168.18.207/24"; GNB_PORT_FOR_S1U = 2152; # Spec 2152 }; } ); -# RUs = ( -# { -# local_rf = "yes" -# nb_tx = 1 -# nb_rx = 1 -# att_tx = 0 -# att_rx = 0; -# bands = [7]; -# max_pdschReferenceSignalPower = -27; -# max_rxgain = 75; -# eNB_instances = [0]; -# ##beamforming 1x2 matrix: 1 layer x 2 antennas -# bf_weights = [0x00007fff, 0x0000]; -# ##beamforming 1x4 matrix: 1 layer x 4 antennas -# #bf_weights = [0x00007fff, 0x0000,0x0000, 0x0000]; -# ## beamforming 2x2 matrix: -# # bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; -# ## beamforming 4x4 matrix: -# #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; - -# sdr_addrs = "addr=192.168.10.2,mgmt_addr=192.168.10.2,second_addr=192.168.20.2"; -# clock_src = "external"; -# } -# ); - -THREAD_STRUCT = ( - { - #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" - parallel_config = "PARALLEL_RU_L1_TRX_SPLIT"; - #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" - worker_config = "WORKER_ENABLE"; - } -); - log_config : { global_log_level ="info"; @@ -278,13 +85,15 @@ THREAD_STRUCT = ( phy_log_verbosity ="medium"; mac_log_level ="info"; mac_log_verbosity ="high"; - rlc_log_level ="info"; + rlc_log_level ="debug"; rlc_log_verbosity ="medium"; - pdcp_log_level ="debug"; + pdcp_log_level ="info"; pdcp_log_verbosity ="medium"; - rrc_log_level ="debug"; + rrc_log_level ="info"; rrc_log_verbosity ="medium"; - f1ap_log_level ="info"; - f1ap_log_verbosity ="medium"; + f1ap_log_level ="debug"; + f1ap_log_verbosity ="medium"; + ngap_log_level ="debug"; + ngap_log_verbosity ="medium"; }; diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf index 7b3535ce1f..d725d5fc08 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf @@ -1,7 +1,6 @@ Active_gNBs = ( "gNB-Eurecom-DU"); # Asn1_verbosity, choice in: none, info, annoying Asn1_verbosity = "none"; -Num_Threads_PUSCH = 8; gNBs = ( @@ -13,10 +12,26 @@ gNBs = gNB_name = "gNB-Eurecom-DU"; + // Tracking area code, 0x0000 and 0xfffe are reserved values // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; + plmn_list = ({ + mcc = 208; + mnc = 99; + mnc_length = 2; + snssaiList = ( + { + sst = 1; + sd = 0x010203; // 0 false, else true + }, + { + sst = 1; + sd = 0x1; #112233; // 0 false, else true + } + ); + + }); - plmn_list = ({mcc = 208; mnc = 93; mnc_length = 2;}); nr_cellid = 12345678L @@ -26,8 +41,13 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; - pusch_AntennaPorts = 1; - sib1_tda = 0; + + pdcch_ConfigSIB1 = ( + { + controlResourceSetZero = 12; + searchSpaceZero = 0; + } + ); servingCellConfigCommon = ( { @@ -38,10 +58,10 @@ gNBs = # downlinkConfigCommon #frequencyInfoDL # this is 3600 MHz + 43 PRBs@30kHz SCS (same as initial BWP) - absoluteFrequencySSB = 641032; + absoluteFrequencySSB = 641280; dl_frequencyBand = 78; # this is 3600 MHz - dl_absoluteFrequencyPointA = 640000; + dl_absoluteFrequencyPointA = 640008; #scs-SpecificCarrierList dl_offstToCarrier = 0; # subcarrierSpacing @@ -50,8 +70,8 @@ gNBs = dl_carrierBandwidth = 106; #initialDownlinkBWP #genericParameters - # this is RBstart=41,L=24 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 6366; + # this is RBstart=27,L=48 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 12952; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialDLBWPsubcarrierSpacing = 1; @@ -65,12 +85,12 @@ gNBs = #0=typeA,1=typeB initialDLBWPmappingType_0 = 0; #this is SS=1,L=13 - initialDLBWPstartSymbolAndLength_0 = 40; + initialDLBWPstartSymbolAndLength_0 = 53; initialDLBWPk0_1 = 0; initialDLBWPmappingType_1 = 0; #this is SS=2,L=12 - initialDLBWPstartSymbolAndLength_1 = 53; + initialDLBWPstartSymbolAndLength_1 = 81; initialDLBWPk0_2 = 0; initialDLBWPmappingType_2 = 0; @@ -94,7 +114,7 @@ gNBs = pMax = 20; #initialUplinkBWP #genericParameters - initialULBWPlocationAndBandwidth = 6366; + initialULBWPlocationAndBandwidth = 12952; # subcarrierSpacing # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialULBWPsubcarrierSpacing = 1; @@ -117,7 +137,7 @@ gNBs = ra_ResponseWindow = 4; #ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR #1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen - ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4; + ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 3; #oneHalf (0..15) 4,8,12,16,...60,64 ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 15; #ra_ContentionResolutionTimer @@ -138,8 +158,8 @@ gNBs = # pusch-ConfigCommon (up to 16 elements) initialULBWPk2_0 = 6; initialULBWPmappingType_0 = 1 - # this is SS=0 L=11 - initialULBWPstartSymbolAndLength_0 = 55; + # this is SS=2 L=12 + initialULBWPstartSymbolAndLength_0 = 53; initialULBWPk2_1 = 6; initialULBWPmappingType_1 = 1; @@ -191,8 +211,8 @@ gNBs = nrofUplinkSlots = 2; nrofUplinkSymbols = 4; - ssPBCH_BlockPower = 10; - } + ssPBCH_BlockPower = 10; + } ); @@ -204,25 +224,6 @@ gNBs = SCTP_INSTREAMS = 2; SCTP_OUTSTREAMS = 2; }; - - - ////////// MME parameters: - mme_ip_address = ( { ipv4 = "192.168.12.26"; - ipv6 = "192:168:30::17"; - active = "yes"; - preference = "ipv4"; - } - ); - - NETWORK_INTERFACES : - { - - GNB_INTERFACE_NAME_FOR_S1_MME = "eth0"; - GNB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.111/24"; - GNB_INTERFACE_NAME_FOR_S1U = "eth0"; - GNB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24"; - GNB_PORT_FOR_S1U = 2152; # Spec 2152 - }; } ); @@ -231,13 +232,14 @@ MACRLCs = ( num_cc = 1; tr_s_preference = "local_L1"; tr_n_preference = "f1"; - local_n_if_name = "lo"; + local_n_if_name = "lo"; + local_n_address = "127.0.0.3"; remote_n_address = "127.0.0.4"; - local_n_address = "127.0.0.3"; - local_n_portc = 500; - remote_n_portc = 501; - local_n_portd = 600; - remote_n_portd = 601; + local_n_portc = 601; + local_n_portd = 2152; + remote_n_portc = 600; + remote_n_portd = 2152; + } ); @@ -245,6 +247,7 @@ L1s = ( { num_cc = 1; tr_n_preference = "local_mac"; + pusch_proc_threads = 2; } ); @@ -300,5 +303,7 @@ THREAD_STRUCT = ( rrc_log_verbosity ="medium"; f1ap_log_level ="debug"; f1ap_log_verbosity ="medium"; + ngap_log_level ="debug"; + ngap_log_verbosity ="medium"; }; diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/ue.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/ue.conf new file mode 100644 index 0000000000..545b44f888 --- /dev/null +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/ue.conf @@ -0,0 +1,8 @@ +uicc0 = { +imsi = "2089900007487"; +key = "fec86ba6eb707ed08905757b1bb44b8f"; +opc= "C42449363BBAD02B66D16BC975D77CC1"; +dnn= "oai"; +nssai_sst=1; +nssai_sd=1; +} From 222419ddbfa30366dacde2adaf2c82f80179d1b4 Mon Sep 17 00:00:00 2001 From: matzakos Date: Tue, 14 Sep 2021 13:22:59 +0200 Subject: [PATCH 064/110] Bring back sib1 tda from config file in du conf. file --- targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf index d725d5fc08..05e441d396 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf @@ -41,6 +41,9 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; + sib1_tda = 0; + pdcch_ConfigSIB1 = ( { From 4325b1fcda85ad52d3b2688d0b9df4e5a327c0aa Mon Sep 17 00:00:00 2001 From: matzakos Date: Wed, 15 Sep 2021 16:37:01 +0200 Subject: [PATCH 065/110] Updates in the UE context setup request handling function at the DU --- openair2/RRC/NR/rrc_gNB.c | 114 +++++++++++++++++++--------------- openair3/ocp-gtpu/gtp_itf.cpp | 6 +- 2 files changed, 68 insertions(+), 52 deletions(-) diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 725ab02758..9a5723f68f 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -1381,11 +1381,11 @@ rrc_gNB_process_RRCReconfigurationComplete( DRBs[i].drb_id = DRB_configList->list.array[i]->drb_Identity; DRBs[i].rlc_mode = RLC_MODE_AM; DRBs[i].up_ul_tnl[0].tl_address = inet_addr(rrc->eth_params_s.my_addr); - DRBs[i].up_ul_tnl[0].port=rrc->eth_params_s.my_portd; + DRBs[i].up_ul_tnl[0].port=rrc->eth_params_s.my_portd; DRBs[i].up_ul_tnl_length = 1; - DRBs[i].up_dl_tnl[0].tl_address = inet_addr(rrc->eth_params_s.remote_addr); - DRBs[i].up_dl_tnl[0].port=rrc->eth_params_s.remote_portd; - DRBs[i].up_dl_tnl_length = 1; + DRBs[i].up_dl_tnl[0].tl_address = inet_addr(rrc->eth_params_s.remote_addr); + DRBs[i].up_dl_tnl[0].port=rrc->eth_params_s.remote_portd; + DRBs[i].up_dl_tnl_length = 1; } F1AP_UE_CONTEXT_SETUP_REQ (message_p).gNB_CU_ue_id = 0; F1AP_UE_CONTEXT_SETUP_REQ (message_p).gNB_DU_ue_id = 0; @@ -3158,67 +3158,85 @@ static void rrc_DU_process_ue_context_setup_request(MessageDef *msg_p, const cha /* Configure SRB2 */ NR_SRB_ToAddMod_t *SRB2_config = NULL; - NR_SRB_ToAddModList_t *SRB_configList = ue_context_p->ue_context.SRB_configList; - uint8_t SRBs_before_new_addition = ue_context_p->ue_context.SRB_configList->list.count; - if(SRB_configList != NULL){ + NR_SRB_ToAddModList_t *SRB_configList = NULL; + uint8_t SRBs_before_new_addition = 0; + + if(req->srbs_to_be_setup_length>0){ + if(ue_context_p->ue_context.SRB_configList == NULL){ + LOG_W(NR_RRC, "The SRB list of the UE context is empty before the addition of new SRB at the DU \n"); + ue_context_p->ue_context.SRB_configList = CALLOC(1, sizeof(*ue_context_p->ue_context.SRB_configList)); + } + SRB_configList = ue_context_p->ue_context.SRB_configList; + SRBs_before_new_addition = SRB_configList->list.count; for (int i=0; isrbs_to_be_setup_length; i++){ SRB2_config = CALLOC(1, sizeof(*SRB2_config)); SRB2_config->srb_Identity = req->srbs_to_be_setup[i].srb_id; ASN_SEQUENCE_ADD(&SRB_configList->list, SRB2_config); } } - else{ - LOG_E(NR_RRC, "The SRB list of the UE context is empty before the addition of SRB2 \n"); - return; - } + /* Configure DRB */ NR_DRB_ToAddMod_t *DRB_config = NULL; - if(ue_context_p->ue_context.DRB_configList == NULL){ - ue_context_p->ue_context.DRB_configList = CALLOC(1, sizeof(*ue_context_p->ue_context.DRB_configList)); + NR_DRB_ToAddModList_t *DRB_configList = NULL; + if(req->drbs_to_be_setup_length>0){ + if(ue_context_p->ue_context.DRB_configList == NULL){ + ue_context_p->ue_context.DRB_configList = CALLOC(1, sizeof(*ue_context_p->ue_context.DRB_configList)); + } + DRB_configList = ue_context_p->ue_context.DRB_configList; + for (int i=0; idrbs_to_be_setup_length; i++){ + DRB_config = CALLOC(1, sizeof(*DRB_config)); + DRB_config->drb_Identity = req->drbs_to_be_setup[i].drb_id; + ASN_SEQUENCE_ADD(&DRB_configList->list, DRB_config); + f1ap_drb_to_be_setup_t drb_p = req->drbs_to_be_setup[i]; + transport_layer_addr_t addr; + memcpy(addr.buffer, &drb_p.up_ul_tnl[0].tl_address, sizeof(drb_p.up_ul_tnl[0].tl_address)); + addr.length=sizeof(drb_p.up_ul_tnl[0].tl_address)*8; + extern instance_t DUuniqInstance; + incoming_teid=newGtpuCreateTunnel(DUuniqInstance, + req->rnti, + drb_p.drb_id, + drb_p.drb_id, + drb_p.up_ul_tnl[0].teid, + addr, + 2152, + DURecvCb); + } } - NR_DRB_ToAddModList_t *DRB_configList = ue_context_p->ue_context.DRB_configList; - for (int i=0; idrbs_to_be_setup_length; i++){ - DRB_config = CALLOC(1, sizeof(*DRB_config)); - DRB_config->drb_Identity = req->drbs_to_be_setup[i].drb_id; - ASN_SEQUENCE_ADD(&DRB_configList->list, DRB_config); - f1ap_drb_to_be_setup_t drb_p = req->drbs_to_be_setup[i]; - transport_layer_addr_t addr; - memcpy(addr.buffer, &drb_p.up_ul_tnl[0].tl_address, sizeof(drb_p.up_ul_tnl[0].tl_address)); - addr.length=sizeof(drb_p.up_ul_tnl[0].tl_address)*8; - extern instance_t DUuniqInstance; - incoming_teid=newGtpuCreateTunnel(DUuniqInstance, - req->rnti, - drb_p.drb_id, - drb_p.drb_id, - drb_p.up_ul_tnl[0].teid, - addr, - 2152, - DURecvCb); - - } apply_macrlc_config(rrc, ue_context_p, &ctxt); /* Fill the UE context setup response ITTI message to send to F1AP */ resp->gNB_CU_ue_id = req->gNB_CU_ue_id; resp->rnti = ctxt.rnti; - resp->drbs_to_be_setup = calloc(1,DRB_configList->list.count*sizeof(f1ap_drb_to_be_setup_t)); - resp->drbs_to_be_setup_length = DRB_configList->list.count; - for (int i=0; ilist.count; i++){ - resp->drbs_to_be_setup[i].drb_id = DRB_configList->list.array[i]->drb_Identity; - resp->drbs_to_be_setup[i].rlc_mode = RLC_MODE_AM; - resp->drbs_to_be_setup[i].up_dl_tnl[0].teid = incoming_teid; - resp->drbs_to_be_setup[i].up_dl_tnl[0].tl_address = inet_addr(mac->eth_params_n.my_addr); - resp->drbs_to_be_setup[i].up_dl_tnl_length = 1; + if(DRB_configList){ + if(DRB_configList->list.count > 0){ + resp->drbs_to_be_setup = calloc(1,DRB_configList->list.count*sizeof(f1ap_drb_to_be_setup_t)); + resp->drbs_to_be_setup_length = DRB_configList->list.count; + for (int i=0; ilist.count; i++){ + resp->drbs_to_be_setup[i].drb_id = DRB_configList->list.array[i]->drb_Identity; + resp->drbs_to_be_setup[i].rlc_mode = RLC_MODE_AM; + resp->drbs_to_be_setup[i].up_dl_tnl[0].teid = incoming_teid; + resp->drbs_to_be_setup[i].up_dl_tnl[0].tl_address = inet_addr(mac->eth_params_n.my_addr); + resp->drbs_to_be_setup[i].up_dl_tnl_length = 1; + } + } + else{ + LOG_W(NR_RRC, "No DRB added upon reception of F1 UE context setup request with a DRB to setup list\n"); + } } - if(SRBs_before_new_addition < SRB_configList->list.count){ - resp->srbs_to_be_setup = calloc(1,req->srbs_to_be_setup_length*sizeof(f1ap_srb_to_be_setup_t)); - resp->srbs_to_be_setup_length = req->srbs_to_be_setup_length; - for (int i=SRBs_before_new_addition; ilist.count; i++){ - resp->srbs_to_be_setup[i-SRBs_before_new_addition].srb_id = SRB_configList->list.array[i]->srb_Identity; + if(SRB_configList){ + if(SRB_configList->list.count >0 && SRBs_before_new_addition < SRB_configList->list.count){ + resp->srbs_to_be_setup = calloc(1,req->srbs_to_be_setup_length*sizeof(f1ap_srb_to_be_setup_t)); + resp->srbs_to_be_setup_length = req->srbs_to_be_setup_length; + for (int i=SRBs_before_new_addition; ilist.count; i++){ + resp->srbs_to_be_setup[i-SRBs_before_new_addition].srb_id = SRB_configList->list.array[i]->srb_Identity; + } + } + else{ + LOG_W(NR_RRC, "No SRB added upon reception of F1 UE Context setup request at the DU\n"); } } else{ - LOG_E(NR_RRC, "SRB failed to get added \n"); + LOG_W(NR_RRC, "No SRB added upon reception of F1 UE Context setup request at the DU\n"); } resp->du_to_cu_rrc_information = calloc(1,1024*sizeof(uint8_t)); asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig, @@ -3228,8 +3246,6 @@ static void rrc_DU_process_ue_context_setup_request(MessageDef *msg_p, const cha 1024); resp->du_to_cu_rrc_information_length = (enc_rval.encoded+7)>>3; itti_send_msg_to_task (TASK_DU_F1, ctxt.module_id, message_p); - - } static void rrc_CU_process_ue_context_setup_response(MessageDef *msg_p, const char *msg_name, instance_t instance){ diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index 03d2ccce48..b6d093d1af 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -205,7 +205,7 @@ static void gtpv1uSend2(instance_t instance, gtpv1u_gnb_tunnel_data_req_t *req, auto ptrRnti=inst->ue2te_mapping.find(rnti); if ( ptrRnti==inst->ue2te_mapping.end() ) { - LOG_E(GTPU, "GTP-U instance: %d gtpv1uSend failed: while getting ue rnti %x in hashtable ue_mapping\n", instance, rnti); + LOG_E(GTPU, "GTP-U instance: %ld gtpv1uSend failed: while getting ue rnti %x in hashtable ue_mapping\n", instance, rnti); pthread_mutex_unlock(&globGtp.gtp_lock); return; } @@ -213,12 +213,12 @@ static void gtpv1uSend2(instance_t instance, gtpv1u_gnb_tunnel_data_req_t *req, map::iterator ptr2=ptrRnti->second.bearers.find(rab_id); if ( ptr2 == ptrRnti->second.bearers.end() ) { - LOG_D(GTPU,"GTP-U instance: %d sending a packet to a non existant RNTI:RAB: %x/%x\n", instance, rnti, rab_id); + LOG_D(GTPU,"GTP-U instance: %ld sending a packet to a non existant RNTI:RAB: %x/%x\n", instance, rnti, rab_id); pthread_mutex_unlock(&globGtp.gtp_lock); return; } - LOG_D(GTPU,"GTP-U instance: %d sending a packet to RNTI:RAB:teid %x/%x/%x, len %lu, oldseq %d, oldnum %d\n", + LOG_D(GTPU,"GTP-U instance: %ld sending a packet to RNTI:RAB:teid %x/%x/%x, len %lu, oldseq %d, oldnum %d\n", instance, rnti, rab_id,ptr2->second.teid_outgoing,length, ptr2->second.seqNum,ptr2->second.npduNum ); if(seqNumFlag) From c0aadc70e0db6ea497bb35bb8ab566928adf79e4 Mon Sep 17 00:00:00 2001 From: matzakos Date: Wed, 15 Sep 2021 17:23:00 +0200 Subject: [PATCH 066/110] Change name for common itti message structure used for handling F1 UE context setup request and response messages --- openair2/COMMON/f1ap_messages_def.h | 4 ++-- openair2/COMMON/f1ap_messages_types.h | 4 ++-- openair2/F1AP/f1ap_cu_ue_context_management.c | 4 ++-- openair2/F1AP/f1ap_cu_ue_context_management.h | 2 +- openair2/F1AP/f1ap_du_ue_context_management.c | 4 ++-- openair2/F1AP/f1ap_du_ue_context_management.h | 4 ++-- openair2/RRC/NR/rrc_gNB.c | 6 +++--- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/openair2/COMMON/f1ap_messages_def.h b/openair2/COMMON/f1ap_messages_def.h index a17c80c845..0e857f3a83 100644 --- a/openair2/COMMON/f1ap_messages_def.h +++ b/openair2/COMMON/f1ap_messages_def.h @@ -44,8 +44,8 @@ MESSAGE_DEF(F1AP_UE_CONTEXT_RELEASE_CMD, MESSAGE_PRIORITY_MED, f1ap_ue_context_r /* RRC -> F1AP messages */ MESSAGE_DEF(F1AP_DL_RRC_MESSAGE , MESSAGE_PRIORITY_MED, f1ap_dl_rrc_message_t , f1ap_dl_rrc_message ) //MESSAGE_DEF(F1AP_INITIAL_CONTEXT_SETUP_REQ , MESSAGE_PRIORITY_MED, f1ap_initial_context_setup_req_t , f1ap_initial_context_setup_req ) -MESSAGE_DEF(F1AP_UE_CONTEXT_SETUP_REQ, MESSAGE_PRIORITY_MED, f1ap_ue_context_setup_req_t, f1ap_ue_context_setup_req) -MESSAGE_DEF(F1AP_UE_CONTEXT_SETUP_RESP, MESSAGE_PRIORITY_MED, f1ap_ue_context_setup_req_t, f1ap_ue_context_setup_resp) +MESSAGE_DEF(F1AP_UE_CONTEXT_SETUP_REQ, MESSAGE_PRIORITY_MED, f1ap_ue_context_setup_t, f1ap_ue_context_setup_req) +MESSAGE_DEF(F1AP_UE_CONTEXT_SETUP_RESP, MESSAGE_PRIORITY_MED, f1ap_ue_context_setup_t, f1ap_ue_context_setup_resp) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index de4366ce72..5559fc2f89 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -342,7 +342,7 @@ typedef struct f1ap_rb_failed_to_be_setup_s { long rb_id; } f1ap_rb_failed_to_be_setup_t; -typedef struct f1ap_ue_context_setup_req_s { +typedef struct f1ap_ue_context_setup_s { uint32_t gNB_CU_ue_id; // BK: need to replace by use from rnti uint32_t gNB_DU_ue_id; uint16_t rnti; @@ -370,7 +370,7 @@ typedef struct f1ap_ue_context_setup_req_s { // coniatner for the rrc_eNB_generate_SecurityModeCommand message uint8_t *rrc_container; int rrc_container_length; -} f1ap_ue_context_setup_req_t; +} f1ap_ue_context_setup_t; typedef struct f1ap_ue_context_setup_resp_s { uint32_t gNB_CU_ue_id; // BK: need to replace by use from rnti diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 51035975fb..34d7aad27b 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -72,7 +72,7 @@ static void setQos(F1AP_NonDynamic5QIDescriptor_t *toFill) { } int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, - f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_req) { + f1ap_ue_context_setup_t *f1ap_ue_context_setup_req) { F1AP_F1AP_PDU_t pdu= {0}; /* Create */ /* 0. Message Type */ @@ -649,7 +649,7 @@ int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, F1AP_UEContextSetupResponseIEs_t *ie; DevAssert(pdu); msg_p = itti_alloc_new_message(TASK_DU_F1, 0, F1AP_UE_CONTEXT_SETUP_RESP); - f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_resp = &F1AP_UE_CONTEXT_SETUP_RESP(msg_p); + f1ap_ue_context_setup_t *f1ap_ue_context_setup_resp = &F1AP_UE_CONTEXT_SETUP_RESP(msg_p); container = &pdu->choice.successfulOutcome->value.choice.UEContextSetupResponse; int i; diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.h b/openair2/F1AP/f1ap_cu_ue_context_management.h index a0df3a53d9..09af51ec54 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.h +++ b/openair2/F1AP/f1ap_cu_ue_context_management.h @@ -37,7 +37,7 @@ * UE Context Setup */ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, - f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_req); + f1ap_ue_context_setup_t *f1ap_ue_context_setup_req); int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, uint32_t assoc_id, diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 44535ac2a4..05ccc3815b 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -52,7 +52,7 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, int i; DevAssert(pdu); msg_p = itti_alloc_new_message(TASK_DU_F1, 0, F1AP_UE_CONTEXT_SETUP_REQ); - f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_req = &F1AP_UE_CONTEXT_SETUP_REQ(msg_p); + f1ap_ue_context_setup_t *f1ap_ue_context_setup_req = &F1AP_UE_CONTEXT_SETUP_REQ(msg_p); container = &pdu->choice.initiatingMessage->value.choice.UEContextSetupRequest; /* GNB_CU_UE_F1AP_ID */ F1AP_UEContextSetupRequestIEs_t *ieCU; @@ -218,7 +218,7 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, return 0; } -int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup_req_t *req) { +int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup_t *req) { F1AP_F1AP_PDU_t pdu= {0}; F1AP_UEContextSetupResponse_t *out; uint8_t *buffer=NULL; diff --git a/openair2/F1AP/f1ap_du_ue_context_management.h b/openair2/F1AP/f1ap_du_ue_context_management.h index 183ed83583..82643fa933 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.h +++ b/openair2/F1AP/f1ap_du_ue_context_management.h @@ -36,7 +36,7 @@ /* * UE Context Setup */ -int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup_req_t *req); +int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup_t *req); int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, uint32_t assoc_id, @@ -87,7 +87,7 @@ int DU_handle_UE_CONTEXT_MODIFICATION_CONFIRM(instance_t instance, uint32_t stream, F1AP_F1AP_PDU_t *pdu); -int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup_req_t *req); +int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup_t *req); /* * UE Inactivity Notification diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 9a5723f68f..e2da5b6456 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -3136,7 +3136,7 @@ return 0; static void rrc_DU_process_ue_context_setup_request(MessageDef *msg_p, const char *msg_name, instance_t instance){ - f1ap_ue_context_setup_req_t * req=&F1AP_UE_CONTEXT_SETUP_REQ(msg_p); + f1ap_ue_context_setup_t * req=&F1AP_UE_CONTEXT_SETUP_REQ(msg_p); protocol_ctxt_t ctxt; ctxt.rnti = req->rnti; ctxt.module_id = instance; @@ -3148,7 +3148,7 @@ static void rrc_DU_process_ue_context_setup_request(MessageDef *msg_p, const cha rrc_gNB_get_ue_context(rrc, ctxt.rnti); MessageDef *message_p; message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_UE_CONTEXT_SETUP_RESP); - f1ap_ue_context_setup_req_t * resp=&F1AP_UE_CONTEXT_SETUP_RESP(message_p); + f1ap_ue_context_setup_t * resp=&F1AP_UE_CONTEXT_SETUP_RESP(message_p); uint32_t incoming_teid = 0; @@ -3250,7 +3250,7 @@ static void rrc_DU_process_ue_context_setup_request(MessageDef *msg_p, const cha static void rrc_CU_process_ue_context_setup_response(MessageDef *msg_p, const char *msg_name, instance_t instance){ - f1ap_ue_context_setup_req_t * resp=&F1AP_UE_CONTEXT_SETUP_RESP(msg_p); + f1ap_ue_context_setup_t * resp=&F1AP_UE_CONTEXT_SETUP_RESP(msg_p); protocol_ctxt_t ctxt; ctxt.rnti = resp->rnti; ctxt.module_id = instance; From 4ac02d07fa019029aa2c75cc64503ae24c332e08 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Wed, 15 Sep 2021 18:56:31 +0200 Subject: [PATCH 067/110] seevral fixes for F1 in 4G --- ci-scripts/conf_files/cu.band7.tm1.100PRB.conf | 10 +++++----- .../du.band7.tm1.100PRB.usrpb210.conf | 2 +- openair2/COMMON/f1ap_messages_types.h | 1 + openair2/ENB_APP/enb_config.c | 4 ++-- openair2/F1AP/f1ap_cu_interface_management.c | 4 +++- openair2/F1AP/f1ap_cu_task.c | 2 +- openair2/F1AP/f1ap_du_interface_management.c | 4 +++- openair2/F1AP/f1ap_du_task.c | 18 ++++++++++++------ 8 files changed, 28 insertions(+), 17 deletions(-) diff --git a/ci-scripts/conf_files/cu.band7.tm1.100PRB.conf b/ci-scripts/conf_files/cu.band7.tm1.100PRB.conf index e2c94b14ab..aefcb7a714 100644 --- a/ci-scripts/conf_files/cu.band7.tm1.100PRB.conf +++ b/ci-scripts/conf_files/cu.band7.tm1.100PRB.conf @@ -13,7 +13,7 @@ eNBs = ( // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ( { mcc = 208; mnc = 92; mnc_length = 2; } ) + plmn_list = ( { mcc = 450; mnc = 05; mnc_length = 2; } ) nr_cellid = 12345678L @@ -179,7 +179,7 @@ eNBs = ( ////////// MME parameters: mme_ip_address = ( { - ipv4 = "CI_MME_IP_ADDR"; + ipv4 = "192.168.5.233"; ipv6 = "192:168:30::17"; port = 36412 ; active = "yes"; @@ -189,11 +189,11 @@ eNBs = ( NETWORK_INTERFACES : { ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "CI_ENB_IP_ADDR"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.5.244"; ENB_INTERFACE_NAME_FOR_S1U = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1U = "CI_ENB_IP_ADDR"; + ENB_IPV4_ADDRESS_FOR_S1U = "192.168.5.244"; ENB_PORT_FOR_S1U = 2152; # Spec 2152 - ENB_IPV4_ADDRESS_FOR_X2C = "CI_ENB_IP_ADDR"; + ENB_IPV4_ADDRESS_FOR_X2C = "192.168.5.244"; ENB_PORT_FOR_X2C = 36422; # Spec 36422 }; } diff --git a/ci-scripts/conf_files/du.band7.tm1.100PRB.usrpb210.conf b/ci-scripts/conf_files/du.band7.tm1.100PRB.usrpb210.conf index a3ecffb9be..28a6bc0779 100644 --- a/ci-scripts/conf_files/du.band7.tm1.100PRB.usrpb210.conf +++ b/ci-scripts/conf_files/du.band7.tm1.100PRB.usrpb210.conf @@ -12,7 +12,7 @@ eNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ( { mcc = 208; mnc = 92; mnc_length = 2; } ) + plmn_list = ( { mcc = 450; mnc = 05; mnc_length = 2; } ) nr_cellid = 12345678L diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index de4366ce72..66a07eebfc 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -202,6 +202,7 @@ typedef struct served_cells_to_activate_s { /// SI message containers (up to 21 messages per cell) uint8_t *SI_container[21]; int SI_container_length[21]; + int SI_type[21]; } served_cells_to_activate_t; typedef struct f1ap_setup_resp_s { diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index 34fd7cb1dd..7dc5fb37e5 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -3168,7 +3168,7 @@ void handle_f1ap_setup_resp(f1ap_setup_resp_t *resp) { (check_plmn_identity(carrier, resp->cells_to_activate[j].mcc, resp->cells_to_activate[j].mnc, resp->cells_to_activate[j].mnc_digit_length)>0 && resp->cells_to_activate[j].nrpci == carrier->physCellId)) { // copy system information and decode it - for (si_ind=2; si_indcells_to_activate[j].num_SI + 2; si_ind++) { + for (si_ind=0; si_indcells_to_activate[j].num_SI; si_ind++) { //printf("SI %d size %d: ", si_ind, resp->cells_to_activate[j].SI_container_length[si_ind]); //for (int n=0;ncells_to_activate[j].SI_container_length[si_ind];n++) // printf("%02x ",resp->cells_to_activate[j].SI_container[si_ind][n]); @@ -3176,7 +3176,7 @@ void handle_f1ap_setup_resp(f1ap_setup_resp_t *resp) { if (si_ind==6) si_ind=9; if (resp->cells_to_activate[j].SI_container[si_ind] != NULL) { extract_and_decode_SI(i, - si_ind, + resp->cells_to_activate[j].SI_type[si_ind], resp->cells_to_activate[j].SI_container[si_ind], resp->cells_to_activate[j].SI_container_length[si_ind]); } diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index 4e3191e62c..f955f4b758 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -151,7 +151,9 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, // Furthermore, cell_type is not a attribute of a cell in the data structure !!!!!!!!!! if (RC.nrrrc && RC.nrrrc[GNB_INSTANCE_TO_MODULE_ID(instance)]->node_type == ngran_gNB_CU) f1ap_req(true, instance)->cell_type=CELL_MACRO_GNB; - LOG_I(F1AP, "Received Cell in %d context\n", f1ap_req(true, instance)->cell_type=CELL_MACRO_GNB); + else + f1ap_req(true, instance)->cell_type=CELL_MACRO_ENB; + LOG_I(F1AP, "Received Cell in %d context\n", f1ap_req(true, instance)->cell_type==CELL_MACRO_GNB); // System Information /* mib */ req->mib[i] = calloc(served_cells_item_p->gNB_DU_System_Information->mIB_message.size + 1, sizeof(char)); diff --git a/openair2/F1AP/f1ap_cu_task.c b/openair2/F1AP/f1ap_cu_task.c index b6d97dea62..30b15fedad 100644 --- a/openair2/F1AP/f1ap_cu_task.c +++ b/openair2/F1AP/f1ap_cu_task.c @@ -122,7 +122,7 @@ void * F1AP_CU_task(void *arg) { itti_mark_task_ready(TASK_CU_F1); eth_params_t *IPaddrs; // Hardcoded instance id! - if (RC.nrrrc[0]->node_type == ngran_gNB_CU) + if (RC.nrrrc && RC.nrrrc[0]->node_type == ngran_gNB_CU) IPaddrs=&RC.nrrrc[0]->eth_params_s; else IPaddrs=&RC.rrc[0]->eth_params_s; diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index 9c06597ecb..4f8fd2e32b 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -44,7 +44,8 @@ int to_NRNRB(int nrb) { for (int i=0; isIBmessage.buf, size); + F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].SI_type[si]=sib_item->sIBtype; } break; diff --git a/openair2/F1AP/f1ap_du_task.c b/openair2/F1AP/f1ap_du_task.c index 4e3d756f4a..a6ff3d3211 100644 --- a/openair2/F1AP/f1ap_du_task.c +++ b/openair2/F1AP/f1ap_du_task.c @@ -85,12 +85,18 @@ void du_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat f1ap_du_data->sctp_out_streams = sctp_new_association_resp->out_streams; f1ap_du_data->default_sctp_stream_id = 0; /* setup parameters for F1U and start the server */ - const cudu_params_t params = { - .local_ipv4_address = RC.nrmac[instance]->eth_params_n.my_addr, - .local_port = RC.nrmac[instance]->eth_params_n.my_portd, - .remote_ipv4_address = RC.nrmac[instance]->eth_params_n.remote_addr, - .remote_port = RC.nrmac[instance]->eth_params_n.remote_portd - }; + eth_params_t *tmp; + if ( RC.nrmac ) + tmp= &RC.nrmac[instance]->eth_params_n; + else + tmp= &RC.mac[instance]->eth_params_n; + const cudu_params_t params = { + .local_ipv4_address = tmp->my_addr, + .local_port = tmp->my_portd, + .remote_ipv4_address = tmp->remote_addr, + .remote_port = tmp->remote_portd + }; + if (!RC.nrrrc) AssertFatal(proto_agent_start(instance, ¶ms) == 0, "could not start PROTO_AGENT for F1U on instance %ld!\n", instance); From f20125f7174cb83bc3c45a6d77a951c3ab28ffb9 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Thu, 16 Sep 2021 09:59:27 +0200 Subject: [PATCH 068/110] fix 4GF1 regressions --- openair2/F1AP/f1ap_common.c | 11 +++++++---- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 9 ++------- openair2/F1AP/f1ap_du_interface_management.c | 5 +++-- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/openair2/F1AP/f1ap_common.c b/openair2/F1AP/f1ap_common.c index 0d887b7a61..0b957bd32f 100644 --- a/openair2/F1AP/f1ap_common.c +++ b/openair2/F1AP/f1ap_common.c @@ -65,10 +65,13 @@ uint8_t F1AP_get_next_transaction_identifier(instance_t enb_mod_idP, instance_t } f1ap_cudu_inst_t *getCxt(F1_t isCU, instance_t instanceP) { - static pid_t t=-1; - pid_t tNew=gettid(); - AssertFatal ( t==-1 || t==tNew, "This is not thread safe\n"); - t=tNew; + //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]; } diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index b57ca013a1..0813acc433 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -100,16 +100,11 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, ccch_sdu_len); } - LOG_I(F1AP, "%s() RRCContainer (CCCH) size %ld: ", __func__, - ie->value.choice.RRCContainer.size); + LOG_I(F1AP, "%s() RRCContainer (CCCH) size %ld: ", __func__, ie->value.choice.RRCContainer.size); - for (int i = 0; i < ie->value.choice.RRCContainer.size; i++) - printf("%02x ", RRC_MAC_CCCH_DATA_IND (message_p).sdu[i]); - - printf("\n"); /* DUtoCURRCContainer */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container, - F1AP_ProtocolIE_ID_id_DUtoCURRCContainer, true); + F1AP_ProtocolIE_ID_id_DUtoCURRCContainer, false); if (ie) { NR_RRC_MAC_CCCH_DATA_IND (message_p).du_to_cu_rrc_container = malloc(sizeof(OCTET_STRING_t)); diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index 4f8fd2e32b..4ee1a064f9 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -430,11 +430,12 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, F1AP_SibtypetobeupdatedListItem_t *sib_item = gNB_CUSystemInformation->sibtypetobeupdatedlist.list.array[si]; size_t size = sib_item->sIBmessage.size; F1AP_SETUP_RESP (msg_p).cells_to_activate[i].SI_container_length[si] = size; - LOG_D(F1AP, "F1AP: SI_container_length[%d][%d] %ld bytes\n", i, (int)sib_item->sIBtype, size); + LOG_D(F1AP, "F1AP: SI_container_length[%d][%ld] %ld bytes\n", i, sib_item->sIBtype, size); F1AP_SETUP_RESP (msg_p).cells_to_activate[i].SI_container[si] = malloc(F1AP_SETUP_RESP (msg_p).cells_to_activate[i].SI_container_length[si]); memcpy((void *)F1AP_SETUP_RESP (msg_p).cells_to_activate[i].SI_container[si], (void *)sib_item->sIBmessage.buf, size); + F1AP_SETUP_RESP (msg_p).cells_to_activate[i].SI_type[si]=sib_item->sIBtype; } break; @@ -863,7 +864,7 @@ int DU_handle_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, F1AP_SibtypetobeupdatedListItem_t *sib_item = gNB_CUSystemInformation->sibtypetobeupdatedlist.list.array[si]; size_t size = sib_item->sIBmessage.size; F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].SI_container_length[si] = size; - LOG_D(F1AP, "F1AP: SI_container_length[%d][%d] %ld bytes\n", i, (int)sib_item->sIBtype, size); + LOG_D(F1AP, "F1AP: SI_container_length[%d][%ld] %ld bytes\n", i, sib_item->sIBtype, size); F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].SI_container[si] = malloc(F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].SI_container_length[si]); memcpy((void *)F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].SI_container[si], (void *)sib_item->sIBmessage.buf, From c1220b37e2a4105e4d53d9c2d3bcff3ea5a8dd01 Mon Sep 17 00:00:00 2001 From: matzakos Date: Thu, 16 Sep 2021 11:42:30 +0200 Subject: [PATCH 069/110] Avoid hardcoding SRB2 id in F1 UE context setup request message and extract from RRC itti message instead --- openair2/F1AP/f1ap_cu_ue_context_management.c | 4 +-- openair2/RRC/NR/rrc_gNB.c | 33 ++++++++++++------- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 34d7aad27b..5030e84e35 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -243,7 +243,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, ie11->criticality = F1AP_Criticality_reject; // ? ie11->value.present = F1AP_UEContextSetupRequestIEs__value_PR_SRBs_ToBeSetup_List; - for (int i=0; i<1; i++) { + for (int i=0; isrbs_to_be_setup_length; i++) { // asn1cSequenceAdd(ie11->value.choice.SRBs_ToBeSetup_List.list, F1AP_SRBs_ToBeSetup_ItemIEs_t, srbs_toBeSetup_item_ies); srbs_toBeSetup_item_ies->id = F1AP_ProtocolIE_ID_id_SRBs_ToBeSetup_Item; // 73 @@ -252,7 +252,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* 11.1 SRBs_ToBeSetup_Item */ F1AP_SRBs_ToBeSetup_Item_t *srbs_toBeSetup_item=&srbs_toBeSetup_item_ies->value.choice.SRBs_ToBeSetup_Item; /* 11.1.1 sRBID */ - srbs_toBeSetup_item->sRBID = 2L; + srbs_toBeSetup_item->sRBID = f1ap_ue_context_setup_req->srbs_to_be_setup[i].srb_id; /* OPTIONAL */ /* 11.1.2 duplicationIndication */ //if (0) { diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index e2da5b6456..1f0f0be923 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -1367,12 +1367,30 @@ rrc_gNB_process_RRCReconfigurationComplete( NULL, get_softmodem_params()->sa ? ue_context_pP->ue_context.masterCellGroup->rlc_BearerToAddModList : NULL); } - else { + else if(SRB_configList!=NULL || DRB_configList!=NULL){ + MessageDef *message_p; + message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_UE_CONTEXT_SETUP_REQ); + F1AP_UE_CONTEXT_SETUP_REQ (message_p).gNB_CU_ue_id = 0; + F1AP_UE_CONTEXT_SETUP_REQ (message_p).gNB_DU_ue_id = 0; + F1AP_UE_CONTEXT_SETUP_REQ (message_p).rnti = ue_context_pP->ue_context.rnti; + F1AP_UE_CONTEXT_SETUP_REQ (message_p).mcc = RC.nrrrc[0]->configuration.mcc[0]; + F1AP_UE_CONTEXT_SETUP_REQ (message_p).mnc = RC.nrrrc[0]->configuration.mnc[0]; + F1AP_UE_CONTEXT_SETUP_REQ (message_p).mnc_digit_length = RC.nrrrc[0]->configuration.mnc_digit_length[0]; + F1AP_UE_CONTEXT_SETUP_REQ (message_p).nr_cellid = RC.nrrrc[0]->nr_cellid; + if(SRB_configList!=NULL){ + F1AP_UE_CONTEXT_SETUP_REQ (message_p).srbs_to_be_setup = malloc(SRB_configList->list.count*sizeof(f1ap_srb_to_be_setup_t)); + F1AP_UE_CONTEXT_SETUP_REQ (message_p).srbs_to_be_setup_length = SRB_configList->list.count; + f1ap_srb_to_be_setup_t *SRBs=F1AP_UE_CONTEXT_SETUP_REQ (message_p).srbs_to_be_setup; + for (int i = 0; i < SRB_configList->list.count; i++){ + if(SRB_configList->list.array[i]->srb_Identity > 1){ + SRBs[i].srb_id = SRB_configList->list.array[i]->srb_Identity; + SRBs[i].lcid = SRB_configList->list.array[i]->srb_Identity; + } + } + } if(DRB_configList!=NULL){ gtpv1u_gnb_create_tunnel_req_t create_tunnel_req; memset(&create_tunnel_req, 0, sizeof(gtpv1u_gnb_create_tunnel_req_t)); - MessageDef *message_p; - message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_UE_CONTEXT_SETUP_REQ); F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup = malloc(DRB_configList->list.count*sizeof(f1ap_drb_to_be_setup_t)); F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup_length = DRB_configList->list.count; f1ap_drb_to_be_setup_t *DRBs=F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup; @@ -1387,16 +1405,9 @@ rrc_gNB_process_RRCReconfigurationComplete( DRBs[i].up_dl_tnl[0].port=rrc->eth_params_s.remote_portd; DRBs[i].up_dl_tnl_length = 1; } - F1AP_UE_CONTEXT_SETUP_REQ (message_p).gNB_CU_ue_id = 0; - F1AP_UE_CONTEXT_SETUP_REQ (message_p).gNB_DU_ue_id = 0; - F1AP_UE_CONTEXT_SETUP_REQ (message_p).rnti = ue_context_pP->ue_context.rnti; - F1AP_UE_CONTEXT_SETUP_REQ (message_p).mcc = RC.nrrrc[0]->configuration.mcc[0]; - F1AP_UE_CONTEXT_SETUP_REQ (message_p).mnc = RC.nrrrc[0]->configuration.mnc[0]; - F1AP_UE_CONTEXT_SETUP_REQ (message_p).mnc_digit_length = RC.nrrrc[0]->configuration.mnc_digit_length[0]; - F1AP_UE_CONTEXT_SETUP_REQ (message_p).nr_cellid = RC.nrrrc[0]->nr_cellid; - itti_send_msg_to_task (TASK_CU_F1, ctxt_pP->module_id, message_p); LOG_I(RRC, "Send F1AP_UE_CONTEXT_SETUP_REQ with ITTI\n"); } + itti_send_msg_to_task (TASK_CU_F1, ctxt_pP->module_id, message_p); } #endif From df82ee1b9c3a233c5faaa7291af8184b7675004d Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Thu, 16 Sep 2021 19:14:28 +0200 Subject: [PATCH 070/110] F1 4G signaling working, up to user data, 5G F1 config files example, documentation update --- ci-scripts/conf_files/gNB_SA_CU.conf | 99 +++++++++ ci-scripts/conf_files/gNB_SA_DU.conf | 313 +++++++++++++++++++++++++++ doc/F1-design.md | 13 +- openair2/LAYER2/rlc_v2/rlc_oai_api.c | 19 +- 4 files changed, 433 insertions(+), 11 deletions(-) create mode 100644 ci-scripts/conf_files/gNB_SA_CU.conf create mode 100644 ci-scripts/conf_files/gNB_SA_DU.conf diff --git a/ci-scripts/conf_files/gNB_SA_CU.conf b/ci-scripts/conf_files/gNB_SA_CU.conf new file mode 100644 index 0000000000..8479f0f7a2 --- /dev/null +++ b/ci-scripts/conf_files/gNB_SA_CU.conf @@ -0,0 +1,99 @@ +Active_gNBs = ( "gNB-Eurecom-CU"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; +Num_Threads_PUSCH = 8; + +gNBs = +( + { + ////////// Identification parameters: + gNB_CU_ID = 0xe00; + +# cell_type = "CELL_MACRO_GNB"; + + gNB_name = "gNB-Eurecom-CU"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + plmn_list = ({ + mcc = 450; + mnc = 05; + mnc_length = 2; + snssaiList = ( + { + sst = 1; + sd = 0x010203; // 0 false, else true + }, + { + sst = 1; + sd = 0x112233; // 0 false, else true + } + ); + + }); + + + nr_cellid = 12345678L + + tr_s_preference = "f1"; + + local_s_if_name = "lo"; + local_s_address = "127.0.0.4"; + remote_s_address = "127.0.0.3"; + local_s_portc = 501; + local_s_portd = 2152; + remote_s_portc = 500; + remote_s_portd = 2152; + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// AMF parameters: + amf_ip_address = ( { ipv4 = "192.168.5.233"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + + GNB_INTERFACE_NAME_FOR_NG_AMF = "enp0s31f6:"; + GNB_IPV4_ADDRESS_FOR_NG_AMF = "192.168.5.244/24"; + GNB_INTERFACE_NAME_FOR_NGU = "bond0"; + GNB_IPV4_ADDRESS_FOR_NGU = "192.168.5.244/24"; + GNB_PORT_FOR_S1U = 2152; # Spec 2152 + }; + } +); + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="debug"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + f1ap_log_level ="debug"; + f1ap_log_verbosity ="medium"; + ngap_log_level ="debug"; + ngap_log_verbosity ="medium"; + }; + diff --git a/ci-scripts/conf_files/gNB_SA_DU.conf b/ci-scripts/conf_files/gNB_SA_DU.conf new file mode 100644 index 0000000000..c1183ce4f8 --- /dev/null +++ b/ci-scripts/conf_files/gNB_SA_DU.conf @@ -0,0 +1,313 @@ +Active_gNBs = ( "gNB-Eurecom-DU"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +gNBs = +( + { + ////////// Identification parameters: + gNB_CU_ID = 0xe00; + +# cell_type = "CELL_MACRO_GNB"; + + gNB_name = "gNB-Eurecom-DU"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + plmn_list = ({ + mcc = 450; + mnc = 05; + mnc_length = 2; + snssaiList = ( + { + sst = 1; + sd = 0x010203; // 0 false, else true + }, + { + sst = 1; + sd = 0x112233; // 0 false, else true + } + ); + + }); + + + nr_cellid = 12345678L + +# tr_s_preference = "local_mac" + + ////////// Physical parameters: + + ssb_SubcarrierOffset = 0; + pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; + + pdcch_ConfigSIB1 = ( + { + controlResourceSetZero = 12; + searchSpaceZero = 0; + } + ); + + servingCellConfigCommon = ( + { + #spCellConfigCommon + + physCellId = 0; + +# downlinkConfigCommon + #frequencyInfoDL + # this is 3600 MHz + 43 PRBs@30kHz SCS (same as initial BWP) + absoluteFrequencySSB = 641280; + dl_frequencyBand = 78; + # this is 3600 MHz + dl_absoluteFrequencyPointA = 640008; + #scs-SpecificCarrierList + dl_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + dl_subcarrierSpacing = 1; + dl_carrierBandwidth = 106; + #initialDownlinkBWP + #genericParameters + # this is RBstart=27,L=48 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 12952; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialDLBWPsubcarrierSpacing = 1; + #pdcch-ConfigCommon + initialDLBWPcontrolResourceSetZero = 12; + initialDLBWPsearchSpaceZero = 0; + #pdsch-ConfigCommon + #pdschTimeDomainAllocationList (up to 16 entries) + initialDLBWPk0_0 = 0; + #initialULBWPmappingType + #0=typeA,1=typeB + initialDLBWPmappingType_0 = 0; + #this is SS=1,L=13 + initialDLBWPstartSymbolAndLength_0 = 40; + + initialDLBWPk0_1 = 0; + initialDLBWPmappingType_1 = 0; + #this is SS=2,L=12 + initialDLBWPstartSymbolAndLength_1 = 53; + + initialDLBWPk0_2 = 0; + initialDLBWPmappingType_2 = 0; + #this is SS=1,L=12 + initialDLBWPstartSymbolAndLength_2 = 54; + + initialDLBWPk0_3 = 0; + initialDLBWPmappingType_3 = 0; + #this is SS=1,L=5 + initialDLBWPstartSymbolAndLength_3 = 57; + + #uplinkConfigCommon + #frequencyInfoUL + ul_frequencyBand = 78; + #scs-SpecificCarrierList + ul_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + ul_subcarrierSpacing = 1; + ul_carrierBandwidth = 106; + pMax = 20; + #initialUplinkBWP + #genericParameters + initialULBWPlocationAndBandwidth = 12952; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialULBWPsubcarrierSpacing = 1; + #rach-ConfigCommon + #rach-ConfigGeneric + prach_ConfigurationIndex = 98; +#prach_msg1_FDM +#0 = one, 1=two, 2=four, 3=eight + prach_msg1_FDM = 0; + prach_msg1_FrequencyStart = 0; + zeroCorrelationZoneConfig = 13; + preambleReceivedTargetPower = -118; +#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) + preambleTransMax = 6; +#powerRampingStep +# 0=dB0,1=dB2,2=dB4,3=dB6 + powerRampingStep = 1; +#ra_ReponseWindow +#1,2,4,8,10,20,40,80 + ra_ResponseWindow = 4; +#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR +#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen + ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4; +#oneHalf (0..15) 4,8,12,16,...60,64 + ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 14; +#ra_ContentionResolutionTimer +#(0..7) 8,16,24,32,40,48,56,64 + ra_ContentionResolutionTimer = 7; + rsrp_ThresholdSSB = 19; +#prach-RootSequenceIndex_PR +#1 = 839, 2 = 139 + prach_RootSequenceIndex_PR = 2; + prach_RootSequenceIndex = 1; + # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex + # + msg1_SubcarrierSpacing = 1, +# restrictedSetConfig +# 0=unrestricted, 1=restricted type A, 2=restricted type B + restrictedSetConfig = 0, + + # pusch-ConfigCommon (up to 16 elements) + initialULBWPk2_0 = 6; + initialULBWPmappingType_0 = 1 + # this is SS=0 L=11 + initialULBWPstartSymbolAndLength_0 = 55; + + initialULBWPk2_1 = 6; + initialULBWPmappingType_1 = 1; + # this is SS=0 L=12 + initialULBWPstartSymbolAndLength_1 = 69; + + initialULBWPk2_2 = 7; + initialULBWPmappingType_2 = 1; + # this is SS=10 L=4 + initialULBWPstartSymbolAndLength_2 = 52; + + msg3_DeltaPreamble = 1; + p0_NominalWithGrant =-90; + +# pucch-ConfigCommon setup : +# pucchGroupHopping +# 0 = neither, 1= group hopping, 2=sequence hopping + pucchGroupHopping = 0; + hoppingId = 40; + p0_nominal = -90; +# ssb_PositionsInBurs_BitmapPR +# 1=short, 2=medium, 3=long + ssb_PositionsInBurst_PR = 2; + ssb_PositionsInBurst_Bitmap = 1; + +# ssb_periodicityServingCell +# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 + ssb_periodicityServingCell = 2; + +# dmrs_TypeA_position +# 0 = pos2, 1 = pos3 + dmrs_TypeA_Position = 0; + +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + subcarrierSpacing = 1; + + + #tdd-UL-DL-ConfigurationCommon +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + referenceSubcarrierSpacing = 1; + # pattern1 + # dl_UL_TransmissionPeriodicity + # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 + dl_UL_TransmissionPeriodicity = 6; + nrofDownlinkSlots = 7; + nrofDownlinkSymbols = 6; + nrofUplinkSlots = 2; + nrofUplinkSymbols = 4; + + ssPBCH_BlockPower = -25; + } + + ); + + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + } +); + +MACRLCs = ( + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "f1"; + local_n_if_name = "lo"; + local_n_address = "127.0.0.3"; + remote_n_address = "127.0.0.4"; + local_n_portc = 601; + local_n_portd = 2152; + remote_n_portc = 600; + remote_n_portd = 2152; + + } +); + +L1s = ( + { + num_cc = 1; + tr_n_preference = "local_mac"; + pusch_proc_threads = 8; + } +); + +RUs = ( + { + local_rf = "yes" + nb_tx = 1 + nb_rx = 1 + att_tx = 0 + att_rx = 0; + bands = [7]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 75; + eNB_instances = [0]; + ##beamforming 1x2 matrix: 1 layer x 2 antennas + bf_weights = [0x00007fff, 0x0000]; + ##beamforming 1x4 matrix: 1 layer x 4 antennas + #bf_weights = [0x00007fff, 0x0000,0x0000, 0x0000]; + ## beamforming 2x2 matrix: + # bf_weights = [0x00007fff, 0x00000000, 0x00000000, 0x00007fff]; + ## beamforming 4x4 matrix: + #bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000, 0x00000000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x00007fff]; + + sdr_addrs = "addr=192.168.10.2,mgmt_addr=192.168.10.2,second_addr=192.168.20.2"; + clock_src = "external"; + } +); + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + parallel_config = "PARALLEL_SINGLE_THREAD"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_ENABLE"; + } +); +rfsimulator: { +serveraddr = "server"; +} + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="debug"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + f1ap_log_level ="debug"; + f1ap_log_verbosity ="medium"; + ngap_log_level ="debug"; + ngap_log_verbosity ="medium"; + }; + diff --git a/doc/F1-design.md b/doc/F1-design.md index e97d3c32f1..80417b1ae3 100644 --- a/doc/F1-design.md +++ b/doc/F1-design.md @@ -64,7 +64,6 @@ All GTP-U tunnels are managed in a Linux Thread, that have partially ITTI design 3. incoming packets are sent to the tunnel creator using a C callback (the callback function is given in tunnel creation order). The callback should not block - # 3. CU F1AP messages # ## startup @@ -170,7 +169,17 @@ The data path by itself doesn't make any difficulty: The SRB are sent in DU RRC tasks via itti F1AP_UL_RRC_MESSAGE (see above the processing) 2. For DL, pdcp (in CU for DRBs) calls rlc_data_req (by a decoupling queue and thread rlc_data_req_thread, so function du_rlc_data_req() or enqueue_rlc_data_req()). in DU, assuming the gtp-u tunnel exists, a reception call back (du_dl_recv()) decapsulate the gtp-u packet and calls du_rlc_data_req() -Hereafter the processing design, that doesn't require to setup a new context storage, as we can use the GTP-U internal tables: rnti+rb=>teid for outgoing gtp-u packets and teid=>rnti+rb for incoming gtp-u packets +Hereafter the processing design, that doesn't require to setup a new context storage, as we can use the GTP-U internal tables: rnti+rb=>teid for outgoing gtp-u packets and teid=>rnti+rb for incoming gtp-u packets + +In CU case, the DRB tunnel to DU and the tunnel on N3 have the same key (rnti, rb id), but they run in two different GTP-U instances. +Each instance binds on diffrent sockets. + +For F1-U, both DU and CU binds on the full quadruplet (IP source, port source, IP destination, port destination) from the configuration file parameters: +local_s_address, remote_s_address,local_s_portd, remote_s_portd + +These 4 values are in: +CU: at cell level (same level as nr_cellid parameter), they are read if tr_s_preference = "f1"; is set +DU: in block MACRLCs, if tr_n_preference = "f1"; is set in this block ## tunnels setup In GTP-U, TS 29.281 specifies a option header (NR RAN Container This extension header may be transmitted in a G-PDU over the X2-U, Xn-U and F1-U user plane interfaces), but it is not mandatory optional header (as is the N3 one). diff --git a/openair2/LAYER2/rlc_v2/rlc_oai_api.c b/openair2/LAYER2/rlc_v2/rlc_oai_api.c index 799beac258..24e36ec03d 100644 --- a/openair2/LAYER2/rlc_v2/rlc_oai_api.c +++ b/openair2/LAYER2/rlc_v2/rlc_oai_api.c @@ -394,12 +394,6 @@ rb_found: LOG_D(RLC, "%s:%d:%s: delivering SDU (rnti %d is_srb %d rb_id %d) size %d", __FILE__, __LINE__, __FUNCTION__, ue->rnti, is_srb, rb_id, size); - memblock = get_free_mem_block(size, __func__); - if (memblock == NULL) { - LOG_E(RLC, "%s:%d:%s: ERROR: get_free_mem_block failed\n", __FILE__, __LINE__, __FUNCTION__); - exit(1); - } - memcpy(memblock->data, buf, size); /* unused fields? */ ctx.instance = ue->module_id; @@ -425,16 +419,23 @@ rb_found: "Can't be CU, bad node type %d\n", type); if (NODE_IS_DU(type) && is_srb == 1) { - MessageDef *msg = itti_alloc_new_message(TASK_RLC_ENB, 0, F1AP_UL_RRC_MESSAGE); + MessageDef *msg = itti_alloc_new_message_sized(TASK_RLC_ENB, 0, F1AP_UL_RRC_MESSAGE, sizeof(*msg) + size); + F1AP_UL_RRC_MESSAGE(msg).rrc_container = (uint8_t*)(msg+1); + memcpy(F1AP_UL_RRC_MESSAGE(msg).rrc_container, buf, size); F1AP_UL_RRC_MESSAGE(msg).rnti = ue->rnti; F1AP_UL_RRC_MESSAGE(msg).srb_id = rb_id; - F1AP_UL_RRC_MESSAGE(msg).rrc_container = (unsigned char *)buf; F1AP_UL_RRC_MESSAGE(msg).rrc_container_length = size; itti_send_msg_to_task(TASK_DU_F1, ENB_MODULE_ID_TO_INSTANCE(0 /*ctxt_pP->module_id*/), msg); return; } } - + + memblock = get_free_mem_block(size, __func__); + if (memblock == NULL) { + LOG_E(RLC, "%s:%d:%s: ERROR: get_free_mem_block failed\n", __FILE__, __LINE__, __FUNCTION__); + exit(1); + } + memcpy(memblock->data, buf, size); if (!get_pdcp_data_ind_func()(&ctx, is_srb, is_mbms, rb_id, size, memblock, NULL, NULL)) { LOG_E(RLC, "%s:%d:%s: ERROR: pdcp_data_ind failed (is_srb %d rb_id %d rnti %d)\n", __FILE__, __LINE__, __FUNCTION__, From 686e5856662de79cd11d63f25f9d57ede579d67d Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Tue, 21 Sep 2021 10:30:46 +0200 Subject: [PATCH 071/110] replace protobuf in 4G F1 split, first step: UL packets --- cmake_targets/CMakeLists.txt | 2 +- common/utils/LOG/log.c | 2 + common/utils/LOG/log.h | 2 + common/utils/T/T_messages.txt | 42 ++++ common/utils/ocp_itti/intertask_interface.cpp | 26 +- common/utils/system.c | 2 +- common/utils/threadPool/thread-pool.h | 2 +- openair2/ENB_APP/enb_config.c | 3 + openair2/F1AP/f1ap_cu_task.c | 4 +- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 3 +- openair2/F1AP/f1ap_du_task.c | 7 +- openair2/F1AP/f1ap_du_ue_context_management.c | 233 ++++++++++-------- openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 14 +- openair2/LAYER2/PROTO_AGENT/proto_agent.c | 1 + openair2/LAYER2/rlc_v2/rlc_oai_api.c | 14 ++ openair2/RRC/LTE/rrc_eNB_S1AP.c | 58 +++-- openair2/RRC/NR/rrc_gNB.c | 29 +-- openair3/ocp-gtpu/gtp_itf.cpp | 2 +- targets/COMMON/create_tasks.c | 3 + 19 files changed, 282 insertions(+), 167 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index e3843fe279..2bbe8db1a7 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -2830,7 +2830,7 @@ add_dependencies(lte-softmodem rrc_flag s1ap_flag x2_flag oai_iqplayer) target_link_libraries (lte-softmodem -Wl,--start-group - RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB GTPV1U_OCP SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB SCHED_RU_LIB + RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB M2AP_LIB M2AP_ENB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB GTPV1U_OCP F1AP_LIB F1AP SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB SCHED_RU_LIB PHY_COMMON PHY PHY_RU LFDS L2 L2_LTE NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB MISC_NFAPI_LTE_LIB LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ITTI ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB} ${PROTO_AGENT_LIB} -Wl,--end-group z dl) diff --git a/common/utils/LOG/log.c b/common/utils/LOG/log.c index d0a53a755b..7b913e6dc9 100644 --- a/common/utils/LOG/log.c +++ b/common/utils/LOG/log.c @@ -476,6 +476,8 @@ int logInit (void) register_log_component("NR_MAC","log",NR_MAC); register_log_component("NR_PHY","log",NR_PHY); register_log_component("NGAP","",NGAP); + register_log_component("ITTI","log",ITTI); + register_log_component("UTIL","log",UTIL); for (int i=0 ; log_level_names[i].name != NULL ; i++) g_log->level2string[i] = toupper(log_level_names[i].name[0]); // uppercased first letter of level name diff --git a/common/utils/LOG/log.h b/common/utils/LOG/log.h index fa95d5a6fe..0acfbca9db 100644 --- a/common/utils/LOG/log.h +++ b/common/utils/LOG/log.h @@ -237,6 +237,8 @@ typedef enum { ASN, NFAPI_VNF, NFAPI_PNF, + ITTI, + UTIL, MAX_LOG_PREDEF_COMPONENTS, } comp_name_t; diff --git a/common/utils/T/T_messages.txt b/common/utils/T/T_messages.txt index cd66be73f5..a4f76c42ad 100644 --- a/common/utils/T/T_messages.txt +++ b/common/utils/T/T_messages.txt @@ -1057,6 +1057,48 @@ ID = LEGACY_NFAPI_PNF_TRACE DESC = NFAPI_PNF legacy logs - trace level GROUP = ALL:LEGACY_NFAPI_PNF:LEGACY_GROUP_TRACE:LEGACY FORMAT = string,log + +ID = LEGACY_ITTI_INFO + DESC = ITTI legacy logs - info level + GROUP = ALL:LEGACY_ITTI:LEGACY_GROUP_INFO:LEGACY + FORMAT = string,log +ID = LEGACY_ITTI_ERROR + DESC = ITTI legacy logs - error level + GROUP = ALL:LEGACY_ITTI:LEGACY_GROUP_ERROR:LEGACY + FORMAT = string,log +ID = LEGACY_ITTI_WARNING + DESC = ITTI legacy logs - warning level + GROUP = ALL:LEGACY_ITTI:LEGACY_GROUP_WARNING:LEGACY + FORMAT = string,log +ID = LEGACY_ITTI_DEBUG + DESC = ITTI legacy logs - debug level + GROUP = ALL:LEGACY_ITTI:LEGACY_GROUP_DEBUG:LEGACY + FORMAT = string,log +ID = LEGACY_ITTI_TRACE + DESC = ITTI legacy logs - trace level + GROUP = ALL:LEGACY_ITTI:LEGACY_GROUP_TRACE:LEGACY + FORMAT = string,log + +ID = LEGACY_UTIL_INFO + DESC = UTIL legacy logs - info level + GROUP = ALL:LEGACY_UTIL:LEGACY_GROUP_INFO:LEGACY + FORMAT = string,log +ID = LEGACY_UTIL_ERROR + DESC = UTIL legacy logs - error level + GROUP = ALL:LEGACY_UTIL:LEGACY_GROUP_ERROR:LEGACY + FORMAT = string,log +ID = LEGACY_UTIL_WARNING + DESC = UTIL legacy logs - warning level + GROUP = ALL:LEGACY_UTIL:LEGACY_GROUP_WARNING:LEGACY + FORMAT = string,log +ID = LEGACY_UTIL_DEBUG + DESC = UTIL legacy logs - debug level + GROUP = ALL:LEGACY_UTIL:LEGACY_GROUP_DEBUG:LEGACY + FORMAT = string,log +ID = LEGACY_UTIL_TRACE + DESC = UTIL legacy logs - trace level + GROUP = ALL:LEGACY_UTIL:LEGACY_GROUP_TRACE:LEGACY + FORMAT = string,log # this is a bad hack but I won't fix (function util_print_hex_octets # in openairinterface5g/openair2/LAYER2/PDCP_v10.1.0/pdcp_util.c # does funky things with the LOG_x macros but we work on the C pre-processor diff --git a/common/utils/ocp_itti/intertask_interface.cpp b/common/utils/ocp_itti/intertask_interface.cpp index 4e5323aec9..1c9b50d2f2 100644 --- a/common/utils/ocp_itti/intertask_interface.cpp +++ b/common/utils/ocp_itti/intertask_interface.cpp @@ -136,12 +136,12 @@ extern "C" { LOG_E(TMR,"Queue for %s task contains %ld messages\n", itti_get_task_name(destination_task_id), s ); if ( s > 50 ) - LOG_I(TMR,"Queue for %s task size: %ld (last message %s)\n",itti_get_task_name(destination_task_id), s+1,ITTI_MSG_NAME(message)); + LOG_I(ITTI,"Queue for %s task size: %ld (last message %s)\n",itti_get_task_name(destination_task_id), s+1,ITTI_MSG_NAME(message)); t->message_queue.insert(t->message_queue.begin(), message); eventfd_t sem_counter = 1; AssertFatal ( sizeof(sem_counter) == write(t->sem_fd, &sem_counter, sizeof(sem_counter)), ""); - LOG_D(TMR,"sent messages id=%d to %s\n",message_id, t->admin.name); + LOG_D(ITTI,"sent messages id=%d to %s\n",message_id, t->admin.name); return 0; } @@ -152,7 +152,7 @@ extern "C" { while ( t->message_queue.size()>0 && t->admin.func != NULL ) { if (t->message_queue.size()>1) - LOG_W(TMR,"queue in no thread mode is %ld\n", t->message_queue.size()); + LOG_W(ITTI,"queue in no thread mode is %ld\n", t->message_queue.size()); pthread_mutex_unlock (&t->queue_cond_lock); t->admin.func(NULL); @@ -208,7 +208,7 @@ extern "C" { message->ittiMsg.timer_has_expired.arg=it->second.timer_arg; if (itti_send_msg_to_task_locked(task_id, it->second.instance, message) < 0) { - LOG_W(TMR,"Failed to send msg TIMER_HAS_EXPIRED to task %u\n", task_id); + LOG_W(ITTI,"Failed to send msg TIMER_HAS_EXPIRED to task %u\n", task_id); free(message); t->timer_map.erase(it); return -1; @@ -233,7 +233,7 @@ extern "C" { epoll_timeout = t->next_timer-current_time; pthread_mutex_unlock(&t->queue_cond_lock); - LOG_D(TMR,"enter blocking wait for %s\n", itti_get_task_name(task_id)); + LOG_D(ITTI,"enter blocking wait for %s, timeout: %d ms\n", itti_get_task_name(task_id), epoll_timeout); t->nb_events = epoll_wait(t->epoll_fd,t->events,t->nb_fd_epoll, epoll_timeout); if ( t->nb_events < 0 && (errno == EINTR || errno == EAGAIN ) ) @@ -243,7 +243,7 @@ extern "C" { AssertFatal (t->nb_events >=0, "epoll_wait failed for task %s, nb fds %d, timeout %lu: %s!\n", itti_get_task_name(task_id), t->nb_fd_epoll, t->next_timer != UINT64_MAX ? t->next_timer-current_time : -1, strerror(errno)); - LOG_D(TMR,"receive on %d descriptors for %s\n", t->nb_events, itti_get_task_name(task_id)); + LOG_D(ITTI,"receive on %d descriptors for %s\n", t->nb_events, itti_get_task_name(task_id)); if (t->nb_events == 0) /* No data to read -> return */ @@ -292,11 +292,11 @@ extern "C" { // in this case, *received_msg is NULL if (t->message_queue.empty()) { *received_msg=NULL; - LOG_D(TMR,"task %s received even from other fd (total fds: %d), returning msg NULL\n",t->admin.name, t->nb_fd_epoll); + LOG_D(ITTI,"task %s received even from other fd (total fds: %d), returning msg NULL\n",t->admin.name, t->nb_fd_epoll); } else { *received_msg=t->message_queue.back(); t->message_queue.pop_back(); - LOG_D(TMR,"task %s received a message\n",t->admin.name); + LOG_D(ITTI,"task %s received a message\n",t->admin.name); } pthread_mutex_unlock (&t->queue_cond_lock); @@ -308,7 +308,7 @@ extern "C" { pthread_mutex_lock(&t->queue_cond_lock); if (!t->message_queue.empty()) { - LOG_D(TMR,"task %s received a message in polling mode\n",t->admin.name); + LOG_D(ITTI,"task %s received a message in polling mode\n",t->admin.name); *received_msg=t->message_queue.back(); t->message_queue.pop_back(); } else @@ -322,7 +322,7 @@ extern "C" { void *args_p) { task_list_t *t=tasks[task_id]; threadCreate (&t->thread, start_routine, args_p, (char *)itti_get_task_name(task_id),-1,OAI_PRIORITY_RT); - LOG_I(TMR,"Created Posix thread %s\n", itti_get_task_name(task_id) ); + LOG_I(ITTI,"Created Posix thread %s\n", itti_get_task_name(task_id) ); return 0; } @@ -344,7 +344,7 @@ extern "C" { tasks = new_tasks; tasks[newQueue]= new task_list_t; pthread_mutex_unlock (&lock_nb_queues); - LOG_I(TMR,"Starting itti queue: %s as task %d\n", taskInfo->name, newQueue); + LOG_I(ITTI,"Starting itti queue: %s as task %d\n", taskInfo->name, newQueue); pthread_mutex_init(&tasks[newQueue]->queue_cond_lock, NULL); memcpy(&tasks[newQueue]->admin, taskInfo, sizeof(task_info_t)); AssertFatal( ( tasks[newQueue]->epoll_fd = epoll_create1(0) ) >=0, ""); @@ -392,7 +392,7 @@ extern "C" { clock_gettime(CLOCK_MONOTONIC, &tp); if (interval_us%1000 != 0) - LOG_W(TMR, "Can't set timer precision below 1ms, rounding it\n"); + LOG_W(ITTI, "Can't set timer precision below 1ms, rounding it\n"); timer.duration = interval_sec*1000+interval_us/1000; timer.timeout= ((uint64_t)tp.tv_sec*1000+tp.tv_nsec/(1000*1000)+timer.duration); @@ -421,7 +421,7 @@ extern "C" { if (ret==1) return 0; else { - LOG_W(TMR, "tried to remove a non existing timer\n"); + LOG_W(ITTI, "tried to remove a non existing timer\n"); return 1; } } diff --git a/common/utils/system.c b/common/utils/system.c index 4eb8c8cb19..72b0c71a21 100644 --- a/common/utils/system.c +++ b/common/utils/system.c @@ -236,7 +236,7 @@ void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name, ret=pthread_attr_setschedpolicy(&attr, SCHED_OAI); AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno); if(prioritysched_get_priority_max(SCHED_OAI)) { - LOG_E(TMR,"Prio not possible: %d, min is %d, max: %d, forced in the range\n", + LOG_E(UTIL,"Prio not possible: %d, min is %d, max: %d, forced in the range\n", priority, sched_get_priority_min(SCHED_OAI), sched_get_priority_max(SCHED_OAI)); diff --git a/common/utils/threadPool/thread-pool.h b/common/utils/threadPool/thread-pool.h index a32b7c3859..b5e446119e 100644 --- a/common/utils/threadPool/thread-pool.h +++ b/common/utils/threadPool/thread-pool.h @@ -141,7 +141,7 @@ static inline notifiedFIFO_elt_t *pullNotifiedFIFO_nothreadSafe(notifiedFIFO_t notifiedFIFO_elt_t *ret=nf->outF; if (nf->outF==nf->outF->next) - LOG_E(TMR,"Circular list in thread pool: push several times the same buffer is forbidden\n"); + LOG_E(UTIL,"Circular list in thread pool: push several times the same buffer is forbidden\n"); nf->outF=nf->outF->next; diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index 7dc5fb37e5..7b82ec31a1 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -1970,8 +1970,11 @@ int RCconfig_DU_F1(MessageDef *msg_p, uint32_t i) { LOG_I(ENB_APP,"FIAP: DU_ip4_address in DU %p, strlen %d\n",F1AP_SETUP_REQ (msg_p).DU_f1_ip_address.ipv4_address,(int)strlen(RC.mac[k]->eth_params_n.my_addr)); F1AP_SETUP_REQ (msg_p).DU_f1_ip_address.ipv6 = 0; F1AP_SETUP_REQ (msg_p).DU_f1_ip_address.ipv4 = 1; + //strcpy(F1AP_SETUP_REQ (msg_p).DU_f1_ip_address.ipv6_address, ""); strcpy(F1AP_SETUP_REQ (msg_p).DU_f1_ip_address.ipv4_address, RC.mac[k]->eth_params_n.my_addr); + F1AP_SETUP_REQ (msg_p).DUport= RC.mac[k]->eth_params_n.my_portd; + F1AP_SETUP_REQ (msg_p).CUport= RC.mac[k]->eth_params_n.remote_portd; //strcpy(F1AP_SETUP_REQ (msg_p).CU_ip_address[l].ipv6_address,*(F1ParamList.paramarray[l][ENB_CU_IPV6_ADDRESS_IDX].strptr)); //F1AP_SETUP_REQ (msg_p).CU_port = RC.mac[k]->eth_params_n.remote_portc; // maybe we dont need it sprintf(aprefix,"%s.[%i].%s",ENB_CONFIG_STRING_ENB_LIST,k,ENB_CONFIG_STRING_SCTP_CONFIG); diff --git a/openair2/F1AP/f1ap_cu_task.c b/openair2/F1AP/f1ap_cu_task.c index 30b15fedad..fbe0508f60 100644 --- a/openair2/F1AP/f1ap_cu_task.c +++ b/openair2/F1AP/f1ap_cu_task.c @@ -45,8 +45,8 @@ static instance_t cu_task_create_gtpu_instance_to_du(eth_params_t *IPaddrs) { openAddr_t tmp={0}; strncpy(tmp.originHost, IPaddrs->my_addr, sizeof(tmp.originHost)-1); strncpy(tmp.destinationHost, IPaddrs->remote_addr, sizeof(tmp.destinationHost)-1); - sprintf(tmp.originService, "%d", GTPV1U_UDP_PORT); - sprintf(tmp.destinationService, "%d", GTPV1U_UDP_PORT); + sprintf(tmp.originService, "%d", IPaddrs->my_portd); + sprintf(tmp.destinationService, "%d", IPaddrs->remote_portd); return ocp_gtpv1Init(tmp); } diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index ebdeabb6ce..adfbff2823 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -744,7 +744,6 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance, return 0; } - /* UL RRC Message Transfer */ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instanceP, int CC_idP, @@ -764,7 +763,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instanceP, LOG_E(F1AP, "Failed to add UE \n"); return -1; } - + /* Create */ /* 0. Message Type */ pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; diff --git a/openair2/F1AP/f1ap_du_task.c b/openair2/F1AP/f1ap_du_task.c index a6ff3d3211..6c5094d248 100644 --- a/openair2/F1AP/f1ap_du_task.c +++ b/openair2/F1AP/f1ap_du_task.c @@ -96,10 +96,12 @@ void du_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat .remote_ipv4_address = tmp->remote_addr, .remote_port = tmp->remote_portd }; - + + /* if (!RC.nrrrc) AssertFatal(proto_agent_start(instance, ¶ms) == 0, "could not start PROTO_AGENT for F1U on instance %ld!\n", instance); + */ DU_send_F1_SETUP_REQUEST(instance); } @@ -149,7 +151,8 @@ void *F1AP_DU_task(void *arg) { AssertFatal(getCxt(DUtype, myInstance)->gtpInst>0,"Failed to create CU F1-U UDP listener"); // Fixme: fully inconsistent instances management // dirty global var is a bad fix - DUuniqInstance=getCxt(DUtype, myInstance)->gtpInst; + extern instance_t legacyInstanceMapping; + legacyInstanceMapping = DUuniqInstance = getCxt(DUtype, myInstance)->gtpInst; du_task_send_sctp_association_req(myInstance,msgSetup); break; diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 05ccc3815b..33a40bd8ac 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -42,6 +42,22 @@ #include "openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h" #include +boolean_t lteDURecvCb( protocol_ctxt_t *ctxt_pP, + const srb_flag_t srb_flagP, + const rb_id_t rb_idP, + const mui_t muiP, + const confirm_t confirmP, + const sdu_size_t sdu_buffer_sizeP, + unsigned char *const sdu_buffer_pP, + const pdcp_transmission_mode_t modeP, + const uint32_t *sourceL2Id, + const uint32_t *destinationL2Id) { + // The buffer comes from the stack in gtp-u thread, we have a make a separate buffer to enqueue in a inter-thread message queue + mem_block_t *sdu=get_free_mem_block(sdu_buffer_sizeP, __func__); + memcpy(sdu->data, sdu_buffer_pP, sdu_buffer_sizeP); + du_rlc_data_req(ctxt_pP,srb_flagP, false, rb_idP,muiP, confirmP, sdu_buffer_sizeP, sdu); + return true; +} int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, uint32_t assoc_id, @@ -111,75 +127,75 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, f1ap_ue_context_setup_req->cellULConfigured = NULL; } - if (RC.nrrrc) { - /* RRCContainer */ - F1AP_UEContextSetupRequestIEs_t *ieDrb; - F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ieDrb, container, - F1AP_ProtocolIE_ID_id_DRBs_ToBeSetup_List, true); - - if(ieDrb!=NULL) { - f1ap_ue_context_setup_req->drbs_to_be_setup_length = ieDrb->value.choice.DRBs_ToBeSetup_List.list.count; - f1ap_ue_context_setup_req->drbs_to_be_setup = calloc(f1ap_ue_context_setup_req->drbs_to_be_setup_length, - sizeof(f1ap_drb_to_be_setup_t)); - AssertFatal(f1ap_ue_context_setup_req->drbs_to_be_setup, - "could not allocate memory for f1ap_ue_context_setup_req->drbs_to_be_setup\n"); - - for (i = 0; i < f1ap_ue_context_setup_req->drbs_to_be_setup_length; ++i) { - f1ap_drb_to_be_setup_t *drb_p = &f1ap_ue_context_setup_req->drbs_to_be_setup[i]; - F1AP_DRBs_ToBeSetup_Item_t *drbs_tobesetup_item_p = - &((F1AP_DRBs_ToBeSetup_ItemIEs_t *)ieDrb->value.choice.DRBs_ToBeSetup_List.list.array[i])->value.choice.DRBs_ToBeSetup_Item; - drb_p->drb_id = drbs_tobesetup_item_p->dRBID; - /* TODO in the following, assume only one UP UL TNL is present. - * this matches/assumes OAI CU implementation, can be up to 2! */ - drb_p->up_ul_tnl_length = 1; - AssertFatal(drbs_tobesetup_item_p->uLUPTNLInformation_ToBeSetup_List.list.count > 0, - "no UL UP TNL Information in DRBs to be Setup list\n"); - F1AP_ULUPTNLInformation_ToBeSetup_Item_t *ul_up_tnl_info_p = (F1AP_ULUPTNLInformation_ToBeSetup_Item_t *)drbs_tobesetup_item_p->uLUPTNLInformation_ToBeSetup_List.list.array[0]; - F1AP_GTPTunnel_t *ul_up_tnl0 = ul_up_tnl_info_p->uLUPTNLInformation.choice.gTPTunnel; - BIT_STRING_TO_TRANSPORT_LAYER_ADDRESS_IPv4(&ul_up_tnl0->transportLayerAddress, drb_p->up_ul_tnl[0].tl_address); - OCTET_STRING_TO_INT32(&ul_up_tnl0->gTP_TEID, drb_p->up_ul_tnl[0].teid); - - switch (drbs_tobesetup_item_p->rLCMode) { - case F1AP_RLCMode_rlc_am: - drb_p->rlc_mode = RLC_MODE_AM; - break; - - default: - drb_p->rlc_mode = RLC_MODE_TM; - break; - } - - /*transport_layer_addr_t addr; + /* DRB */ + F1AP_UEContextSetupRequestIEs_t *ieDrb; + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ieDrb, container, + F1AP_ProtocolIE_ID_id_DRBs_ToBeSetup_List, true); + + if(ieDrb!=NULL) { + f1ap_ue_context_setup_req->drbs_to_be_setup_length = ieDrb->value.choice.DRBs_ToBeSetup_List.list.count; + f1ap_ue_context_setup_req->drbs_to_be_setup = calloc(f1ap_ue_context_setup_req->drbs_to_be_setup_length, + sizeof(f1ap_drb_to_be_setup_t)); + AssertFatal(f1ap_ue_context_setup_req->drbs_to_be_setup, + "could not allocate memory for f1ap_ue_context_setup_req->drbs_to_be_setup\n"); + + for (i = 0; i < f1ap_ue_context_setup_req->drbs_to_be_setup_length; ++i) { + f1ap_drb_to_be_setup_t *drb_p = &f1ap_ue_context_setup_req->drbs_to_be_setup[i]; + F1AP_DRBs_ToBeSetup_Item_t *drbs_tobesetup_item_p = + &((F1AP_DRBs_ToBeSetup_ItemIEs_t *)ieDrb->value.choice.DRBs_ToBeSetup_List.list.array[i])->value.choice.DRBs_ToBeSetup_Item; + drb_p->drb_id = drbs_tobesetup_item_p->dRBID; + /* TODO in the following, assume only one UP UL TNL is present. + * this matches/assumes OAI CU implementation, can be up to 2! */ + drb_p->up_ul_tnl_length = 1; + AssertFatal(drbs_tobesetup_item_p->uLUPTNLInformation_ToBeSetup_List.list.count > 0, + "no UL UP TNL Information in DRBs to be Setup list\n"); + F1AP_ULUPTNLInformation_ToBeSetup_Item_t *ul_up_tnl_info_p = (F1AP_ULUPTNLInformation_ToBeSetup_Item_t *)drbs_tobesetup_item_p->uLUPTNLInformation_ToBeSetup_List.list.array[0]; + F1AP_GTPTunnel_t *ul_up_tnl0 = ul_up_tnl_info_p->uLUPTNLInformation.choice.gTPTunnel; + BIT_STRING_TO_TRANSPORT_LAYER_ADDRESS_IPv4(&ul_up_tnl0->transportLayerAddress, drb_p->up_ul_tnl[0].tl_address); + OCTET_STRING_TO_INT32(&ul_up_tnl0->gTP_TEID, drb_p->up_ul_tnl[0].teid); + + switch (drbs_tobesetup_item_p->rLCMode) { + case F1AP_RLCMode_rlc_am: + drb_p->rlc_mode = RLC_MODE_AM; + break; + + default: + drb_p->rlc_mode = RLC_MODE_TM; + break; + } + if (!(RC.nrrrc && RC.nrrrc[instance]->node_type == ngran_gNB_DU)) { + transport_layer_addr_t addr; memcpy(addr.buffer, &drb_p->up_ul_tnl[0].tl_address, sizeof(drb_p->up_ul_tnl[0].tl_address)); addr.length=sizeof(drb_p->up_ul_tnl[0].tl_address)*8; drb_p->up_dl_tnl[0].teid=newGtpuCreateTunnel(INSTANCE_DEFAULT, - f1ap_ue_context_setup_req->rnti, - drb_p->drb_id, - drb_p->drb_id, - drb_p->up_ul_tnl[0].teid, - addr, - 2152, - DURecvCb);*/ + f1ap_ue_context_setup_req->rnti, + drb_p->drb_id, + drb_p->drb_id, + drb_p->up_ul_tnl[0].teid, + addr, + 2152, + lteDURecvCb); } } + } - F1AP_UEContextSetupRequestIEs_t *ieSrb; - F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ieSrb, container, - F1AP_ProtocolIE_ID_id_SRBs_ToBeSetup_List, true); - - if(ieSrb != NULL) { - f1ap_ue_context_setup_req->srbs_to_be_setup_length = ieSrb->value.choice.SRBs_ToBeSetup_List.list.count; - f1ap_ue_context_setup_req->srbs_to_be_setup = calloc(f1ap_ue_context_setup_req->srbs_to_be_setup_length, - sizeof(f1ap_srb_to_be_setup_t)); - AssertFatal(f1ap_ue_context_setup_req->srbs_to_be_setup, - "could not allocate memory for f1ap_ue_context_setup_req->srbs_to_be_setup\n"); - - for (i = 0; i < f1ap_ue_context_setup_req->srbs_to_be_setup_length; ++i) { - f1ap_srb_to_be_setup_t *srb_p = &f1ap_ue_context_setup_req->srbs_to_be_setup[i]; - F1AP_SRBs_ToBeSetup_Item_t *srbs_tobesetup_item_p; - srbs_tobesetup_item_p = &((F1AP_SRBs_ToBeSetup_ItemIEs_t *)ieSrb->value.choice.SRBs_ToBeSetup_List.list.array[i])->value.choice.SRBs_ToBeSetup_Item; - srb_p->srb_id = srbs_tobesetup_item_p->sRBID; - } + /* SRB */ + F1AP_UEContextSetupRequestIEs_t *ieSrb; + F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ieSrb, container, + F1AP_ProtocolIE_ID_id_SRBs_ToBeSetup_List, true); + + if(ieSrb != NULL) { + f1ap_ue_context_setup_req->srbs_to_be_setup_length = ieSrb->value.choice.SRBs_ToBeSetup_List.list.count; + f1ap_ue_context_setup_req->srbs_to_be_setup = calloc(f1ap_ue_context_setup_req->srbs_to_be_setup_length, + sizeof(f1ap_srb_to_be_setup_t)); + AssertFatal(f1ap_ue_context_setup_req->srbs_to_be_setup, + "could not allocate memory for f1ap_ue_context_setup_req->srbs_to_be_setup\n"); + + for (i = 0; i < f1ap_ue_context_setup_req->srbs_to_be_setup_length; ++i) { + f1ap_srb_to_be_setup_t *srb_p = &f1ap_ue_context_setup_req->srbs_to_be_setup[i]; + F1AP_SRBs_ToBeSetup_Item_t *srbs_tobesetup_item_p; + srbs_tobesetup_item_p = &((F1AP_SRBs_ToBeSetup_ItemIEs_t *)ieSrb->value.choice.SRBs_ToBeSetup_List.list.array[i])->value.choice.SRBs_ToBeSetup_Item; + srb_p->srb_id = srbs_tobesetup_item_p->sRBID; } } @@ -214,7 +230,8 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, } //DU_send_UE_CONTEXT_SETUP_RESPONSE(instance, f1ap_ue_context_setup_req); - itti_send_msg_to_task(TASK_RRC_GNB, instance, msg_p); + if (RC.nrrrc && RC.nrrrc[instance]->node_type == ngran_gNB_DU) + itti_send_msg_to_task(TASK_RRC_GNB, instance, msg_p); return 0; } @@ -658,9 +675,10 @@ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, AssertFatal(ctxt.rnti == rnti, "RNTI obtained through DU ID (%x) is different from CU ID (%x)\n", rnti, ctxt.rnti); + int UE_out_of_sync = 0; - if (RC.nrrrc[instance]->node_type == ngran_gNB_DU) { + if (RC.nrrrc && RC.nrrrc[instance]->node_type == ngran_gNB_DU) { for (int n = 0; n < MAX_MOBILES_PER_GNB; ++n) { if (RC.nrmac[instance]->UE_info.active[n] == TRUE && rnti == RC.nrmac[instance]->UE_info.rnti[n]) { @@ -724,55 +742,56 @@ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, } } - if (RC.nrrrc[instance]->node_type == ngran_gNB_DU) { + if (RC.nrrrc && RC.nrrrc[instance]->node_type == ngran_gNB_DU) { // struct rrc_gNB_ue_context_s *ue_context_p; f1ap_ue_context_release_cplt_t cplt; cplt.rnti = ctxt.rnti; DU_send_UE_CONTEXT_RELEASE_COMPLETE(instance, &cplt); return 0; - } - - struct rrc_eNB_ue_context_s *ue_context_p; - - ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ctxt.instance], ctxt.rnti); - - if (ue_context_p && !UE_out_of_sync) { - /* UE exists and is in sync so we start a timer before releasing the - * connection */ - pthread_mutex_lock(&rrc_release_freelist); - - for (uint16_t release_num = 0; release_num < NUMBER_OF_UE_MAX; release_num++) { - if (rrc_release_info.RRC_release_ctrl[release_num].flag == 0) { - if (ue_context_p->ue_context.ue_release_timer_s1 > 0) - rrc_release_info.RRC_release_ctrl[release_num].flag = 1; - else - rrc_release_info.RRC_release_ctrl[release_num].flag = 2; - - rrc_release_info.RRC_release_ctrl[release_num].rnti = ctxt.rnti; - LOG_D(F1AP, "add rrc_release_info RNTI %x\n", ctxt.rnti); - // TODO: how to provide the correct MUI? - rrc_release_info.RRC_release_ctrl[release_num].rrc_eNB_mui = 0; - rrc_release_info.num_UEs++; - LOG_D(RRC,"Generate DLSCH Release send: index %d rnti %x mui %d flag %d \n",release_num, - ctxt.rnti, 0, rrc_release_info.RRC_release_ctrl[release_num].flag); - break; - } - } - - pthread_mutex_unlock(&rrc_release_freelist); - ue_context_p->ue_context.ue_release_timer_s1 = 0; - } else if (ue_context_p && UE_out_of_sync) { - /* UE exists and is out of sync, drop the connection */ - mac_eNB_rrc_ul_failure(instance, 0, 0, 0, rnti); } else { - LOG_E(F1AP, "no ue_context for RNTI %x, acknowledging release\n", rnti); + + struct rrc_eNB_ue_context_s *ue_context_p; + + ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ctxt.instance], ctxt.rnti); + + if (ue_context_p && !UE_out_of_sync) { + /* UE exists and is in sync so we start a timer before releasing the + * connection */ + pthread_mutex_lock(&rrc_release_freelist); + + for (uint16_t release_num = 0; release_num < NUMBER_OF_UE_MAX; release_num++) { + if (rrc_release_info.RRC_release_ctrl[release_num].flag == 0) { + if (ue_context_p->ue_context.ue_release_timer_s1 > 0) + rrc_release_info.RRC_release_ctrl[release_num].flag = 1; + else + rrc_release_info.RRC_release_ctrl[release_num].flag = 2; + + rrc_release_info.RRC_release_ctrl[release_num].rnti = ctxt.rnti; + LOG_D(F1AP, "add rrc_release_info RNTI %x\n", ctxt.rnti); + // TODO: how to provide the correct MUI? + rrc_release_info.RRC_release_ctrl[release_num].rrc_eNB_mui = 0; + rrc_release_info.num_UEs++; + LOG_D(RRC,"Generate DLSCH Release send: index %d rnti %x mui %d flag %d \n",release_num, + ctxt.rnti, 0, rrc_release_info.RRC_release_ctrl[release_num].flag); + break; + } + } + + pthread_mutex_unlock(&rrc_release_freelist); + ue_context_p->ue_context.ue_release_timer_s1 = 0; + } else if (ue_context_p && UE_out_of_sync) { + /* UE exists and is out of sync, drop the connection */ + mac_eNB_rrc_ul_failure(instance, 0, 0, 0, rnti); + } else { + LOG_E(F1AP, "no ue_context for RNTI %x, acknowledging release\n", rnti); + } + + /* TODO send this once the connection has really been released */ + f1ap_ue_context_release_cplt_t cplt; + cplt.rnti = ctxt.rnti; + DU_send_UE_CONTEXT_RELEASE_COMPLETE(instance, &cplt); + return 0; } - - /* TODO send this once the connection has really been released */ - f1ap_ue_context_release_cplt_t cplt; - cplt.rnti = ctxt.rnti; - DU_send_UE_CONTEXT_RELEASE_COMPLETE(instance, &cplt); - return 0; } int DU_send_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, f1ap_ue_context_release_cplt_t *cplt) { diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index 090cf9531b..9a57c6f269 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -154,7 +154,19 @@ boolean_t cu_f1u_data_req( const uint32_t *const destinationL2Id ) { - return true; + mem_block_t *memblock = get_free_mem_block(sdu_buffer_size, __func__); + if (memblock == NULL) { + LOG_E(RLC, "%s:%d:%s: ERROR: get_free_mem_block failed\n", __FILE__, __LINE__, __FUNCTION__); + exit(1); + } + memcpy(memblock->data,sdu_buffer, sdu_buffer_size); + // These -4 are boring + int ret=pdcp_data_ind(ctxt_pP,srb_flagP, false, rb_id-4, sdu_buffer_size, memblock); + if (!ret) { + LOG_E(RLC, "%s:%d:%s: ERROR: pdcp_data_ind failed\n", __FILE__, __LINE__, __FUNCTION__); + /* what to do in case of failure? for the moment: nothing */ + } + return ret; } void *pdcp_stats_thread(void *param) { diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.c b/openair2/LAYER2/PROTO_AGENT/proto_agent.c index 6bf9cdce22..b7844d9b8d 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.c @@ -192,6 +192,7 @@ error: boolean_t + proto_agent_send_pdcp_data_ind(const protocol_ctxt_t *const ctxt_pP, const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP, sdu_size_t sdu_sizeP, mem_block_t *sdu_pP) { uint8_t *msg = NULL; diff --git a/openair2/LAYER2/rlc_v2/rlc_oai_api.c b/openair2/LAYER2/rlc_v2/rlc_oai_api.c index 24e36ec03d..b31393d67f 100644 --- a/openair2/LAYER2/rlc_v2/rlc_oai_api.c +++ b/openair2/LAYER2/rlc_v2/rlc_oai_api.c @@ -427,6 +427,20 @@ rb_found: F1AP_UL_RRC_MESSAGE(msg).rrc_container_length = size; itti_send_msg_to_task(TASK_DU_F1, ENB_MODULE_ID_TO_INSTANCE(0 /*ctxt_pP->module_id*/), msg); return; + } else { + // Fixme: very dirty workaround of incomplete F1-U implementation + instance_t DUuniqInstance=0; + MessageDef *msg = itti_alloc_new_message(TASK_RLC_ENB, 0, GTPV1U_ENB_TUNNEL_DATA_REQ); + gtpv1u_enb_tunnel_data_req_t *req=>PV1U_ENB_TUNNEL_DATA_REQ(msg); + req->buffer=malloc(size); + memcpy(req->buffer,buf,size); + req->length=size; + req->offset=0; + req->rnti=ue->rnti; + req->rab_id=rb_id+4; + LOG_D(RLC, "Received uplink user-plane traffic at RLC-DU to be sent to the CU, size %d \n", size); + itti_send_msg_to_task(OCP_GTPV1_U, DUuniqInstance, msg); + return; } } diff --git a/openair2/RRC/LTE/rrc_eNB_S1AP.c b/openair2/RRC/LTE/rrc_eNB_S1AP.c index 1cb575d1dd..4a472c8841 100644 --- a/openair2/RRC/LTE/rrc_eNB_S1AP.c +++ b/openair2/RRC/LTE/rrc_eNB_S1AP.c @@ -1078,29 +1078,43 @@ int rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ(MessageDef *msg_p, const char rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP(&ctxt,ue_context_p); } - /* - if ((RC.rrc[ctxt.module_id]->node_type == ngran_eNB_CU) || - (RC.rrc[ctxt.module_id]->node_type == ngran_ng_eNB_CU) || - (RC.rrc[ctxt.module_id]->node_type == ngran_gNB_CU) ){ - - message_p = itti_alloc_new_message (TASK_RRC_ENB, 0, F1AP_UE_CONTEXT_SETUP_REQ); - F1AP_UE_CONTEXT_SETUP_REQ (message_p).rrc_container = ue_p->Srb0.Tx_buffer.Payload; - - F1AP_UE_CONTEXT_SETUP_REQ (message_p).rrc_container_length = ue_p->Srb0.Tx_buffer.payload_size; - F1AP_UE_CONTEXT_SETUP_REQ (message_p).gNB_CU_ue_id = 0; - F1AP_UE_CONTEXT_SETUP_REQ (message_p).gNB_DU_ue_id = 0; - F1AP_UE_CONTEXT_SETUP_REQ (message_p).old_gNB_DU_ue_id = 0xFFFFFFFF; // unknown - F1AP_UE_CONTEXT_SETUP_REQ (message_p).rnti = ue_p->rnti; - F1AP_UE_CONTEXT_SETUP_REQ (message_p).srb_id = CCCH; - F1AP_UE_CONTEXT_SETUP_REQ (message_p).execute_duplication = 1; - F1AP_UE_CONTEXT_SETUP_REQ (message_p).RAT_frequency_priority_information.en_dc = 0; - itti_send_msg_to_task (TASK_CU_F1, ctxt_pP->module_id, message_p); - LOG_D(RRC, "Send F1AP_UE_CONTEXT_SETUP_REQ with ITTI\n"); - - } - */ - return (0); + + if ((RC.rrc[ctxt.module_id]->node_type == ngran_eNB_CU) || + (RC.rrc[ctxt.module_id]->node_type == ngran_ng_eNB_CU) || + (RC.rrc[ctxt.module_id]->node_type == ngran_gNB_CU) ){ + struct eNB_RRC_INST_s *rrc= RC.rrc[0]; + MessageDef *message_p = itti_alloc_new_message (TASK_RRC_ENB, 0, F1AP_UE_CONTEXT_SETUP_REQ); + f1ap_ue_context_setup_t *req=&F1AP_UE_CONTEXT_SETUP_REQ (message_p); + req->gNB_CU_ue_id = 0; + req->gNB_DU_ue_id = 0; + req->rnti = ue_context_p->ue_context.rnti; + req->mcc = rrc->configuration.mcc[0]; + req->mnc = rrc->configuration.mnc[0]; + req->mnc_digit_length = rrc->configuration.mnc_digit_length[0]; + req->nr_cellid = rrc->nr_cellid; + req->srbs_to_be_setup = malloc(sizeof(f1ap_srb_to_be_setup_t)); + req->srbs_to_be_setup_length = 1; + f1ap_srb_to_be_setup_t *SRBs=req->srbs_to_be_setup; + SRBs[0].srb_id=CCCH; + req->drbs_to_be_setup_length = S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).nb_of_e_rabs; + req->drbs_to_be_setup = malloc(req->drbs_to_be_setup_length * sizeof(f1ap_drb_to_be_setup_t)); + f1ap_drb_to_be_setup_t *DRBs=req->drbs_to_be_setup; + for (int i = 0; i < req->drbs_to_be_setup_length ; i++) { + DRBs[i].drb_id=S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).e_rab_param[i].e_rab_id; + DRBs[i].rlc_mode = RLC_MODE_AM; + DRBs[i].up_ul_tnl[0].tl_address = inet_addr(rrc->eth_params_s.my_addr); + DRBs[i].up_ul_tnl[0].port=rrc->eth_params_s.my_portd; + DRBs[i].up_ul_tnl_length = 1; + DRBs[i].up_dl_tnl[0].tl_address = inet_addr(rrc->eth_params_s.remote_addr); + DRBs[i].up_dl_tnl[0].port=rrc->eth_params_s.remote_portd; + DRBs[i].up_dl_tnl_length = 1; + } + LOG_I(RRC, "Send F1AP_UE_CONTEXT_SETUP_REQ with ITTI\n"); + itti_send_msg_to_task (TASK_CU_F1, 0, message_p); + } } + + return (0); } /*------------------------------------------------------------------------------*/ diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 1f0f0be923..8fd2be14f4 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -1370,17 +1370,18 @@ rrc_gNB_process_RRCReconfigurationComplete( else if(SRB_configList!=NULL || DRB_configList!=NULL){ MessageDef *message_p; message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_UE_CONTEXT_SETUP_REQ); - F1AP_UE_CONTEXT_SETUP_REQ (message_p).gNB_CU_ue_id = 0; - F1AP_UE_CONTEXT_SETUP_REQ (message_p).gNB_DU_ue_id = 0; - F1AP_UE_CONTEXT_SETUP_REQ (message_p).rnti = ue_context_pP->ue_context.rnti; - F1AP_UE_CONTEXT_SETUP_REQ (message_p).mcc = RC.nrrrc[0]->configuration.mcc[0]; - F1AP_UE_CONTEXT_SETUP_REQ (message_p).mnc = RC.nrrrc[0]->configuration.mnc[0]; - F1AP_UE_CONTEXT_SETUP_REQ (message_p).mnc_digit_length = RC.nrrrc[0]->configuration.mnc_digit_length[0]; - F1AP_UE_CONTEXT_SETUP_REQ (message_p).nr_cellid = RC.nrrrc[0]->nr_cellid; + f1ap_ue_context_setup_t *req=&F1AP_UE_CONTEXT_SETUP_REQ (message_p); + req->gNB_CU_ue_id = 0; + req->gNB_DU_ue_id = 0; + req->rnti = ue_context_pP->ue_context.rnti; + req->mcc = RC.nrrrc[0]->configuration.mcc[0]; + req->mnc = RC.nrrrc[0]->configuration.mnc[0]; + req->mnc_digit_length = RC.nrrrc[0]->configuration.mnc_digit_length[0]; + req->nr_cellid = RC.nrrrc[0]->nr_cellid; if(SRB_configList!=NULL){ - F1AP_UE_CONTEXT_SETUP_REQ (message_p).srbs_to_be_setup = malloc(SRB_configList->list.count*sizeof(f1ap_srb_to_be_setup_t)); - F1AP_UE_CONTEXT_SETUP_REQ (message_p).srbs_to_be_setup_length = SRB_configList->list.count; - f1ap_srb_to_be_setup_t *SRBs=F1AP_UE_CONTEXT_SETUP_REQ (message_p).srbs_to_be_setup; + req->srbs_to_be_setup = malloc(SRB_configList->list.count*sizeof(f1ap_srb_to_be_setup_t)); + req->srbs_to_be_setup_length = SRB_configList->list.count; + f1ap_srb_to_be_setup_t *SRBs=req->srbs_to_be_setup; for (int i = 0; i < SRB_configList->list.count; i++){ if(SRB_configList->list.array[i]->srb_Identity > 1){ SRBs[i].srb_id = SRB_configList->list.array[i]->srb_Identity; @@ -1391,10 +1392,10 @@ rrc_gNB_process_RRCReconfigurationComplete( if(DRB_configList!=NULL){ gtpv1u_gnb_create_tunnel_req_t create_tunnel_req; memset(&create_tunnel_req, 0, sizeof(gtpv1u_gnb_create_tunnel_req_t)); - F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup = malloc(DRB_configList->list.count*sizeof(f1ap_drb_to_be_setup_t)); - F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup_length = DRB_configList->list.count; - f1ap_drb_to_be_setup_t *DRBs=F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup; - LOG_I(RRC, "Length of DRB list:%d, %d \n", DRB_configList->list.count, F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup_length); + req->drbs_to_be_setup = malloc(DRB_configList->list.count*sizeof(f1ap_drb_to_be_setup_t)); + req->drbs_to_be_setup_length = DRB_configList->list.count; + f1ap_drb_to_be_setup_t *DRBs=req->drbs_to_be_setup; + LOG_I(RRC, "Length of DRB list:%d, %d \n", DRB_configList->list.count, req->drbs_to_be_setup_length); for (int i = 0; i < DRB_configList->list.count; i++){ DRBs[i].drb_id = DRB_configList->list.array[i]->drb_Identity; DRBs[i].rlc_mode = RLC_MODE_AM; diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index b6d093d1af..b90b89b21a 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -95,7 +95,7 @@ static teid_t gtpv1uNewTeid(void) { #endif } -static instance_t legacyInstanceMapping=0; +instance_t legacyInstanceMapping=0; #define compatInst(a) ((a)==0 || (a)==INSTANCE_DEFAULT?legacyInstanceMapping:a) #define GTPV1U_HEADER_SIZE (8) diff --git a/targets/COMMON/create_tasks.c b/targets/COMMON/create_tasks.c index 3e0d97f60a..d302b418c5 100644 --- a/targets/COMMON/create_tasks.c +++ b/targets/COMMON/create_tasks.c @@ -91,6 +91,9 @@ int create_tasks(uint32_t enb_nb) { if (NODE_IS_DU(type)) { rc = itti_create_task(TASK_DU_F1, F1AP_DU_task, NULL); AssertFatal(rc >= 0, "Create task for DU F1AP failed\n"); + // DU is now GTP-U instead of protobuf + rc = itti_create_task(TASK_GTPV1_U, gtpv1u_eNB_task, NULL); + AssertFatal(rc >= 0, "Create task for GTPV1U failed\n"); } if (!NODE_IS_CU(type)) { From 9463741fc78d539cf3dadd4b0105812407fa9cc5 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Tue, 21 Sep 2021 12:14:38 +0200 Subject: [PATCH 072/110] feat(docker): adding CU/DU conf file to gNB docker image Signed-off-by: Raphael Defosseux --- docker/scripts/generateTemplate.py | 6 +++ docker/scripts/gnb_entrypoint.sh | 2 + docker/scripts/gnb_parameters.yaml | 70 ++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+) diff --git a/docker/scripts/generateTemplate.py b/docker/scripts/generateTemplate.py index cc4b72a703..3d037294e6 100644 --- a/docker/scripts/generateTemplate.py +++ b/docker/scripts/generateTemplate.py @@ -55,6 +55,8 @@ def main(): "rcc.band40.tm1.25PRB": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}', "gnb.band78.tm1.fr1.106PRB.usrpb210.conf": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}', "gnb.band78.sa.fr1.106PRB.usrpn310.conf": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}', + "gNB_SA_CU.conf": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}', + "gNB_SA_DU.conf": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}', "ue.nfapi": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}', "ue_sim_ci": f'{data[0]["paths"]["dest_dir"]}/{outputfilename}' } @@ -77,6 +79,10 @@ def main(): templine = re.sub(r'sd = 0x1;', 'sd = 0x@NSSAI_SD0@;', line) outputfile.write(templine) continue + if re.search(r'sd = 0x010203;', line): + templine = re.sub(r'sd = 0x010203;', 'sd = 0x@NSSAI_SD0@;', line) + outputfile.write(templine) + continue if re.search(r'sd = 0x112233;', line): templine = re.sub(r'sd = 0x112233;', 'sd = 0x@NSSAI_SD1@;', line) outputfile.write(templine) diff --git a/docker/scripts/gnb_entrypoint.sh b/docker/scripts/gnb_entrypoint.sh index 678ec6cb1b..d59018b56f 100755 --- a/docker/scripts/gnb_entrypoint.sh +++ b/docker/scripts/gnb_entrypoint.sh @@ -9,6 +9,8 @@ THREAD_PARALLEL_CONFIG=${THREAD_PARALLEL_CONFIG:-PARALLEL_SINGLE_THREAD} # Based another env var, pick one template to use if [[ -v USE_NSA_TDD_MONO ]]; then ln -s $PREFIX/etc/gnb.nsa.tdd.conf $PREFIX/etc/gnb.conf; fi if [[ -v USE_SA_TDD_MONO ]]; then ln -s $PREFIX/etc/gnb.sa.tdd.conf $PREFIX/etc/gnb.conf; fi +if [[ -v USE_SA_CU ]]; then ln -s $PREFIX/etc/gnb.sa.cu.conf $PREFIX/etc/gnb.conf; fi +if [[ -v USE_SA_TDD_CU ]]; then ln -s $PREFIX/etc/gnb.sa.du.tdd.conf $PREFIX/etc/gnb.conf; fi # Only this template will be manipulated CONFIG_FILES=`ls $PREFIX/etc/gnb.conf || true` diff --git a/docker/scripts/gnb_parameters.yaml b/docker/scripts/gnb_parameters.yaml index ac5a6cb971..8cce081397 100644 --- a/docker/scripts/gnb_parameters.yaml +++ b/docker/scripts/gnb_parameters.yaml @@ -94,3 +94,73 @@ - key: parallel_config env: "@THREAD_PARALLEL_CONFIG@" + - filePrefix: gNB_SA_CU.conf + outputfilename: "gnb.sa.cu.conf" + config: + - key: Active_gNBs + env: "@GNB_NAME@" + - key: gNB_name + env: "@GNB_NAME@" + - key: mcc + env: "@MCC@" + - key: mnc + env: "@MNC@" + - key: mnc_length + env: "@MNC_LENGTH@" + - key: tracking_area_code + env: "@TAC@" + - key: sst + env: "@NSSAI_SST@" + - key: ipv4 + env: "@AMF_IP_ADDRESS@" + - key: GNB_INTERFACE_NAME_FOR_NG_AMF + env: "@GNB_NGA_IF_NAME@" + - key: GNB_IPV4_ADDRESS_FOR_NG_AMF + env: "@GNB_NGA_IP_ADDRESS@" + - key: GNB_INTERFACE_NAME_FOR_NGU + env: "@GNB_NGU_IF_NAME@" + - key: GNB_IPV4_ADDRESS_FOR_NGU + env: "@GNB_NGU_IP_ADDRESS@" + - key: local_s_if_name + env: "@F1_IF_NAME@" + - key: local_s_address + env: "@F1_CU_IP_ADDRESS@" + - key: remote_s_address + env: "@F1_DU_IP_ADDRESS@" + + - filePrefix: gNB_SA_DU.conf + outputfilename: "gnb.sa.du.tdd.conf" + config: + - key: Active_gNBs + env: "@GNB_NAME@" + - key: gNB_name + env: "@GNB_NAME@" + - key: mcc + env: "@MCC@" + - key: mnc + env: "@MNC@" + - key: mnc_length + env: "@MNC_LENGTH@" + - key: tracking_area_code + env: "@TAC@" + - key: sst + env: "@NSSAI_SST@" + - key: ipv4 + env: "@AMF_IP_ADDRESS@" + - key: GNB_INTERFACE_NAME_FOR_NG_AMF + env: "@GNB_NGA_IF_NAME@" + - key: GNB_IPV4_ADDRESS_FOR_NG_AMF + env: "@GNB_NGA_IP_ADDRESS@" + - key: GNB_INTERFACE_NAME_FOR_NGU + env: "@GNB_NGU_IF_NAME@" + - key: GNB_IPV4_ADDRESS_FOR_NGU + env: "@GNB_NGU_IP_ADDRESS@" + - key: parallel_config + env: "@THREAD_PARALLEL_CONFIG@" + - key: local_n_if_name + env: "@F1_IF_NAME@" + - key: local_n_address + env: "@F1_DU_IP_ADDRESS@" + - key: remote_n_address + env: "@F1_CU_IP_ADDRESS@" + From edb093f1732ea67cab1423a3230790966b81532b Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Tue, 21 Sep 2021 16:01:32 +0200 Subject: [PATCH 073/110] test(ci): adding 5G F1 RF simulator scenario Signed-off-by: Raphael Defosseux --- .../xml_files/container_5g_f1_rfsim.xml | 113 ++++++ .../xml_files/container_5g_f1_rfsim_down.xml | 38 ++ .../5g_f1_rfsimulator/amf-healthcheck.sh | 57 +++ .../5g_f1_rfsimulator/docker-compose.yaml | 334 ++++++++++++++++++ .../5g_f1_rfsimulator/mysql-healthcheck.sh | 46 +++ .../5g_f1_rfsimulator/nrf-healthcheck.sh | 20 ++ .../yaml_files/5g_f1_rfsimulator/oai-smf.conf | 133 +++++++ .../yaml_files/5g_f1_rfsimulator/oai_db.sql | 217 ++++++++++++ .../5g_f1_rfsimulator/smf-healthcheck.sh | 21 ++ .../5g_f1_rfsimulator/spgwu-healthcheck.sh | 28 ++ docker/scripts/gnb_parameters.yaml | 8 + 11 files changed, 1015 insertions(+) create mode 100644 ci-scripts/xml_files/container_5g_f1_rfsim.xml create mode 100644 ci-scripts/xml_files/container_5g_f1_rfsim_down.xml create mode 100755 ci-scripts/yaml_files/5g_f1_rfsimulator/amf-healthcheck.sh create mode 100644 ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml create mode 100755 ci-scripts/yaml_files/5g_f1_rfsimulator/mysql-healthcheck.sh create mode 100755 ci-scripts/yaml_files/5g_f1_rfsimulator/nrf-healthcheck.sh create mode 100644 ci-scripts/yaml_files/5g_f1_rfsimulator/oai-smf.conf create mode 100755 ci-scripts/yaml_files/5g_f1_rfsimulator/oai_db.sql create mode 100755 ci-scripts/yaml_files/5g_f1_rfsimulator/smf-healthcheck.sh create mode 100755 ci-scripts/yaml_files/5g_f1_rfsimulator/spgwu-healthcheck.sh diff --git a/ci-scripts/xml_files/container_5g_f1_rfsim.xml b/ci-scripts/xml_files/container_5g_f1_rfsim.xml new file mode 100644 index 0000000000..30a1eb98d0 --- /dev/null +++ b/ci-scripts/xml_files/container_5g_f1_rfsim.xml @@ -0,0 +1,113 @@ + + + rfsim-5gnr + Testing 5G NR RF sim in containers + wrench + + 100021 + 000021 + 000022 + 000023 + 000024 + 020021 + 020022 + 030021 + 030022 + 100021 + + + + + DeployGenObject + Deploy OAI 5G CoreNetwork + yaml_files/5g_f1_rfsimulator + mysql oai-nrf oai-amf oai-smf oai-spgwu oai-ext-dn + 6 + + + + DeployGenObject + Deploy OAI 5G CU RF sim SA + yaml_files/5g_f1_rfsimulator + oai-cu + 7 + + + + DeployGenObject + Deploy OAI 5G DU RF sim SA + yaml_files/5g_f1_rfsimulator + oai-du + 8 + + + + DeployGenObject + Deploy OAI 5G NR-UE RF sim SA + yaml_files/5g_f1_rfsimulator + oai-nr-ue + 9 + + + + PingFromContainer + Ping ext-dn from NR-UE + rfsim5g-oai-nr-ue + -I oaitun_ue1 -c 20 192.168.72.135 + 5 + + + + PingFromContainer + Ping NR-UE from ext-dn + rfsim5g-oai-ext-dn + -c 20 12.1.1.2 + 5 + + + + IperfFromContainer + Iperf UDP Downlink + rfsim5g-oai-nr-ue + rfsim5g-oai-ext-dn + -B 12.1.1.2 -u -i 1 -s + -c 12.1.1.2 -u -i 1 -t 30 -b 400K + + + + IperfFromContainer + Iperf UDP Uplink + rfsim5g-oai-ext-dn + rfsim5g-oai-nr-ue + -u -i 1 -s + -B 12.1.1.2 -c 192.168.72.135 -u -i 1 -t 30 -b 20K + + + + UndeployGenObject + Undeploy all OAI 5G stack + yaml_files/5g_f1_rfsimulator + + + diff --git a/ci-scripts/xml_files/container_5g_f1_rfsim_down.xml b/ci-scripts/xml_files/container_5g_f1_rfsim_down.xml new file mode 100644 index 0000000000..fe24247bc4 --- /dev/null +++ b/ci-scripts/xml_files/container_5g_f1_rfsim_down.xml @@ -0,0 +1,38 @@ + + + rfsim-5gnr-down + CleanUp 5G RF + trash + + 100022 + + + + + UndeployGenObject + Undeploy all OAI 5G stack + yaml_files/5g_f1_rfsimulator + + + diff --git a/ci-scripts/yaml_files/5g_f1_rfsimulator/amf-healthcheck.sh b/ci-scripts/yaml_files/5g_f1_rfsimulator/amf-healthcheck.sh new file mode 100755 index 0000000000..8bfdee2aac --- /dev/null +++ b/ci-scripts/yaml_files/5g_f1_rfsimulator/amf-healthcheck.sh @@ -0,0 +1,57 @@ +#!/bin/bash +set -eo pipefail + +STATUS=0 +AMF_PORT_FOR_NGAP=38412 +AMF_PORT_FOR_N11_HTTP=80 +AMF_IP_NGAP_INTERFACE=$(ifconfig $AMF_INTERFACE_NAME_FOR_NGAP | grep inet | awk {'print $2'}) +AMF_IP_N11_INTERFACE=$(ifconfig $AMF_INTERFACE_NAME_FOR_N11 | grep inet | awk {'print $2'}) +N2_PORT_STATUS=$(netstat -Snpl | grep -o "$AMF_IP_NGAP_INTERFACE:$AMF_PORT_FOR_NGAP") +N11_PORT_STATUS=$(netstat -tnpl | grep -o "$AMF_IP_N11_INTERFACE:$AMF_PORT_FOR_N11_HTTP") +#Check if entrypoint properly configured the conf file and no parameter is unset (optional) +NB_UNREPLACED_AT=`cat /openair-amf/etc/*.conf | grep -v contact@openairinterface.org | grep -c @ || true` + +if [ $NB_UNREPLACED_AT -ne 0 ]; then + STATUS=1 + echo "Healthcheck error: configuration file is not configured properly" +fi + +if [[ -z $N2_PORT_STATUS ]]; then + STATUS=1 + echo "Healthcheck error: N2 SCTP port $AMF_PORT_FOR_NGAP is not listening" +fi + +if [[ -z $N11_PORT_STATUS ]]; then + STATUS=1 + echo "Healthcheck error: N11/SBI TCP/HTTP port $AMF_PORT_FOR_N11_HTTP is not listening" +fi + +#host="${MYSQL_SERVER}" +#user="${MYSQL_USER:-root}" +#export MYSQL_PWD="${MYSQL_PASS}" + +#args=( +# -h"$host" +# -u"$user" +# --silent +#) + +#if ! command -v mysql &> /dev/null; then +# echo "Installing mysql command" +# apt update +# apt-get -y install mysql-client +#else +# if select="$(echo 'SELECT 1' | mysql "${args[@]}")" && [ "$select" = '1' ]; then +# database_check=$(mysql -h$host -u$user -D oai_db --silent -e "SELECT * FROM users;") +# if [[ -z $database_check ]]; then +# echo "Healthcheck error: oai_db not populated" +# STATUS=1 +# fi +# STATUS=0 +# else +# echo "Healthcheck error: Mysql port inactive" +# STATUS=1 +# fi +#fi + +exit $STATUS diff --git a/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml b/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml new file mode 100644 index 0000000000..1e30c6bf51 --- /dev/null +++ b/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml @@ -0,0 +1,334 @@ +version: '3.8' +services: + oai-nrf: + container_name: "rfsim5g-oai-nrf" + image: oai-nrf:latest + environment: + - NRF_INTERFACE_NAME_FOR_SBI=eth0 + - NRF_INTERFACE_PORT_FOR_SBI=80 + - NRF_INTERFACE_HTTP2_PORT_FOR_SBI=9090 + - NRF_API_VERSION=v1 + - INSTANCE=0 + - PID_DIRECTORY=/var/run + networks: + public_net: + ipv4_address: 192.168.71.130 + volumes: + - ./nrf-healthcheck.sh:/openair-nrf/bin/nrf-healthcheck.sh + healthcheck: + test: /bin/bash -c "/openair-nrf/bin/nrf-healthcheck.sh" + interval: 10s + timeout: 5s + retries: 5 + mysql: + container_name: "rfsim5g-mysql" + image: mysql:5.7 + volumes: + - ./oai_db.sql:/docker-entrypoint-initdb.d/oai_db.sql + - ./mysql-healthcheck.sh:/tmp/mysql-healthcheck.sh + environment: + - TZ=Europe/Paris + - MYSQL_DATABASE=oai_db + - MYSQL_USER=test + - MYSQL_PASSWORD=test + - MYSQL_ROOT_PASSWORD=linux + healthcheck: + test: /bin/bash -c "/tmp/mysql-healthcheck.sh" + interval: 10s + timeout: 5s + retries: 5 + networks: + public_net: + ipv4_address: 192.168.71.131 + oai-amf: + container_name: "rfsim5g-oai-amf" + image: oai-amf:latest + environment: + - TZ=Europe/paris + - INSTANCE=0 + - PID_DIRECTORY=/var/run + - MCC=208 + - MNC=99 + - REGION_ID=128 + - AMF_SET_ID=1 + - SERVED_GUAMI_MCC_0=208 + - SERVED_GUAMI_MNC_0=99 + - SERVED_GUAMI_REGION_ID_0=128 + - SERVED_GUAMI_AMF_SET_ID_0=1 + - SERVED_GUAMI_MCC_1=460 + - SERVED_GUAMI_MNC_1=11 + - SERVED_GUAMI_REGION_ID_1=10 + - SERVED_GUAMI_AMF_SET_ID_1=1 + - PLMN_SUPPORT_MCC=208 + - PLMN_SUPPORT_MNC=99 + - PLMN_SUPPORT_TAC=0x0001 + - SST_0=1 + - SD_0=1 + - SST_1=1 + - SD_1=12 + - AMF_INTERFACE_NAME_FOR_NGAP=eth0 + - AMF_INTERFACE_NAME_FOR_N11=eth0 + - SMF_INSTANCE_ID_0=1 + - SMF_FQDN_0=oai-smf + - SMF_IPV4_ADDR_0=0.0.0.0 + - SMF_HTTP_VERSION_0=v1 + - SELECTED_0=true + - SMF_INSTANCE_ID_1=2 + - SMF_FQDN_1=oai-smf + - SMF_IPV4_ADDR_1=0.0.0.0 + - SMF_HTTP_VERSION_1=v1 + - SELECTED_1=false + - MYSQL_SERVER=192.168.71.131 + - MYSQL_USER=root + - MYSQL_PASS=linux + - MYSQL_DB=oai_db + - OPERATOR_KEY=c42449363bbad02b66d16bc975d77cc1 + - NRF_IPV4_ADDRESS=192.168.71.130 + - NRF_PORT=80 + - NF_REGISTRATION=yes + - SMF_SELECTION=yes + - USE_FQDN_DNS=yes + - NRF_API_VERSION=v1 + - NRF_FQDN=oai-nrf + - AUSF_IPV4_ADDRESS=127.0.0.1 + - AUSF_PORT=80 + - AUSF_API_VERSION=v1 + depends_on: + - oai-nrf + volumes: + - ./amf-healthcheck.sh:/openair-amf/bin/amf-healthcheck.sh + healthcheck: + test: /bin/bash -c "/openair-amf/bin/amf-healthcheck.sh" + interval: 10s + timeout: 15s + retries: 5 + networks: + public_net: + ipv4_address: 192.168.71.132 + oai-smf: + container_name: "rfsim5g-oai-smf" + image: oai-smf:latest + entrypoint: /bin/bash -c "/openair-smf/bin/oai_smf -c /openair-smf/bin/oai-smf.conf -o" + environment: + - TZ=Europe/Paris + - INSTANCE=0 + - PID_DIRECTORY=/var/run + - SMF_INTERFACE_NAME_FOR_N4=eth0 + - SMF_INTERFACE_NAME_FOR_SBI=eth0 + - SMF_INTERFACE_PORT_FOR_SBI=80 + - SMF_INTERFACE_HTTP2_PORT_FOR_SBI=9090 + - SMF_API_VERSION=v1 + - DEFAULT_DNS_IPV4_ADDRESS=192.168.18.129 + - DEFAULT_DNS_SEC_IPV4_ADDRESS=4.4.4.4 + - AMF_IPV4_ADDRESS=0.0.0.0 + - AMF_PORT=80 + - AMF_API_VERSION=v1 + - AMF_FQDN=oai-amf + - UDM_IPV4_ADDRESS=127.0.0.1 + - UDM_PORT=80 + - UDM_API_VERSION=v1 + - UDM_FQDN=localhost + - UPF_IPV4_ADDRESS=192.168.71.134 + - UPF_FQDN_0=oai-spgwu + - NRF_IPV4_ADDRESS=192.168.71.130 + - NRF_PORT=80 + - NRF_API_VERSION=v1 + - NRF_FQDN=oai-nrf + - REGISTER_NRF=yes + - DISCOVER_UPF=yes + - USE_FQDN_DNS=yes + depends_on: + - oai-nrf + volumes: + - ./smf-healthcheck.sh:/openair-smf/bin/smf-healthcheck.sh + - ./oai-smf.conf:/openair-smf/bin/oai-smf.conf + healthcheck: + test: /bin/bash -c "/openair-smf/bin/smf-healthcheck.sh" + interval: 10s + timeout: 5s + retries: 5 + networks: + public_net: + ipv4_address: 192.168.71.133 + oai-spgwu: + container_name: "rfsim5g-oai-spgwu" + image: oai-spgwu-tiny:latest + environment: + - TZ=Europe/Paris + - PID_DIRECTORY=/var/run + - SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP=eth0 + - SGW_INTERFACE_NAME_FOR_SX=eth0 + - PGW_INTERFACE_NAME_FOR_SGI=eth0 + - NETWORK_UE_NAT_OPTION=yes + - NETWORK_UE_IP=12.1.1.0/24 + - SPGWC0_IP_ADDRESS=192.168.71.133 + - BYPASS_UL_PFCP_RULES=no + - MCC=208 + - MNC=99 + - MNC03=099 + - TAC=1 + - GTP_EXTENSION_HEADER_PRESENT=yes + - GW_ID=1 + - REALM=openairinterface.org + - ENABLE_5G_FEATURES=yes + - REGISTER_NRF=yes + - USE_FQDN_NRF=yes + - UPF_FQDN_5G=oai-spgwu + - NRF_IPV4_ADDRESS=192.168.71.130 + - NRF_PORT=80 + - NRF_API_VERSION=v1 + - NRF_FQDN=oai-nrf + - NSSAI_SST_0=1 + - NSSAI_SD_0=1 + - DNN_0=oai + depends_on: + - oai-nrf + cap_add: + - NET_ADMIN + - SYS_ADMIN + cap_drop: + - ALL + privileged: true + volumes: + - ./spgwu-healthcheck.sh:/openair-spgwu-tiny/bin/spgwu-healthcheck.sh + healthcheck: + test: /bin/bash -c "/openair-spgwu-tiny/bin/spgwu-healthcheck.sh" + interval: 10s + timeout: 5s + retries: 5 + networks: + public_net: + ipv4_address: 192.168.71.134 + traffic_net: + ipv4_address: 192.168.72.134 + oai-ext-dn: + image: ubuntu:bionic + privileged: true + container_name: rfsim5g-oai-ext-dn + entrypoint: /bin/bash -c \ + "apt update; apt install -y procps iptables iproute2 iperf iputils-ping;"\ + "iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE;"\ + "ip route add 12.1.1.0/24 via 192.168.72.134 dev eth0; sleep infinity" + depends_on: + - oai-spgwu + networks: + traffic_net: + ipv4_address: 192.168.72.135 + healthcheck: + test: /bin/bash -c "ping -c 2 192.168.72.134" + interval: 10s + timeout: 5s + retries: 5 + oai-cu: + image: oai-gnb:f1-test + privileged: true + container_name: rfsim5g-oai-cu + environment: + RFSIMULATOR: server + USE_SA_CU: 'yes' + GNB_NAME: cu-rfsim + TAC: 1 + MCC: '208' + MNC: '99' + MNC_LENGTH: 2 + NSSAI_SST: 1 + NSSAI_SD0: 1 + NSSAI_SD1: 112233 + AMF_IP_ADDRESS: 192.168.71.132 + GNB_NGA_IF_NAME: eth0 + GNB_NGA_IP_ADDRESS: 192.168.71.136 + GNB_NGU_IF_NAME: eth0 + GNB_NGU_IP_ADDRESS: 192.168.71.136 + F1_IF_NAME: eth0 + F1_CU_IP_ADDRESS: 192.168.71.136 + F1_DU_IP_ADDRESS: 192.168.71.138 + F1_CU_D_PORT: 2153 + F1_DU_D_PORT: 2153 + USE_ADDITIONAL_OPTIONS: --sa --rfsim + depends_on: + - oai-ext-dn + networks: + public_net: + ipv4_address: 192.168.71.136 + healthcheck: + test: /bin/bash -c "pgrep nr-softmodem" + interval: 10s + timeout: 5s + retries: 5 + oai-du: + image: oai-gnb:f1-test + privileged: true + container_name: rfsim5g-oai-du + environment: + RFSIMULATOR: server + USE_SA_TDD_CU: 'yes' + GNB_NAME: du-rfsim + TAC: 1 + MCC: '208' + MNC: '99' + MNC_LENGTH: 2 + NSSAI_SST: 1 + NSSAI_SD0: 1 + NSSAI_SD1: 112233 + AMF_IP_ADDRESS: 192.168.71.132 + GNB_NGA_IF_NAME: eth0 + GNB_NGA_IP_ADDRESS: 192.168.71.138 + GNB_NGU_IF_NAME: eth0 + GNB_NGU_IP_ADDRESS: 192.168.71.138 + F1_IF_NAME: eth0 + F1_CU_IP_ADDRESS: 192.168.71.136 + F1_DU_IP_ADDRESS: 192.168.71.138 + F1_CU_D_PORT: 2153 + F1_DU_D_PORT: 2153 + USE_ADDITIONAL_OPTIONS: --sa --rfsim + depends_on: + - oai-cu + networks: + public_net: + ipv4_address: 192.168.71.138 + healthcheck: + test: /bin/bash -c "pgrep nr-softmodem" + interval: 10s + timeout: 5s + retries: 5 + oai-nr-ue: + image: oai-nr-ue:develop + privileged: true + container_name: rfsim5g-oai-nr-ue + environment: + RFSIMULATOR: 192.168.71.138 + FULL_IMSI: '208990100001100' + FULL_KEY: 'fec86ba6eb707ed08905757b1bb44b8f' + OPC: 'C42449363BBAD02B66D16BC975D77CC1' + DNN: oai + NSSAI_SST: 1 + NSSAI_SD: 1 + USE_ADDITIONAL_OPTIONS: --sa --rfsim -r 106 --numerology 1 -C 3619200000 --nokrnmod + depends_on: + - oai-du + networks: + public_net: + ipv4_address: 192.168.71.137 + healthcheck: + test: /bin/bash -c "pgrep nr-uesoftmodem" + interval: 10s + timeout: 5s + retries: 5 + +networks: + public_net: + driver: bridge + name: rfsim5g-oai-public-net + ipam: + config: + - subnet: 192.168.71.128/26 + driver_opts: + com.docker.network.bridge.name: "rfsim5g-public" + traffic_net: + driver: bridge + name: rfsim5g-oai-traffic_net-net + ipam: + config: + - subnet: 192.168.72.128/26 + driver_opts: + com.docker.network.bridge.name: "rfsim5g-traffic" diff --git a/ci-scripts/yaml_files/5g_f1_rfsimulator/mysql-healthcheck.sh b/ci-scripts/yaml_files/5g_f1_rfsimulator/mysql-healthcheck.sh new file mode 100755 index 0000000000..c92efb9f00 --- /dev/null +++ b/ci-scripts/yaml_files/5g_f1_rfsimulator/mysql-healthcheck.sh @@ -0,0 +1,46 @@ +#!/bin/bash +set -eo pipefail + +if [ "$MYSQL_ROOT_PASSWORD" ] && [ -z "$MYSQL_USER" ] && [ -z "$MYSQL_PASSWORD" ]; then + echo >&2 'Healthcheck error: cannot determine root password (and MYSQL_USER and MYSQL_PASSWORD were not set)' + exit 0 +fi + +host="$(hostname --ip-address || echo '127.0.0.1')" +user="${MYSQL_USER:-root}" +export MYSQL_PWD="${MYSQL_PASSWORD:-$MYSQL_ROOT_PASSWORD}" + +args=( + # force mysql to not use the local "mysqld.sock" (test "external" connectivity) + -h"$host" + -u"$user" + --silent +) + +STATUS=0 +if command -v mysqladmin &> /dev/null; then + if mysqladmin "${args[@]}" ping > /dev/null; then + database_check=$(mysql -u$user -D oai_db --silent -e "SELECT * FROM users;") + if [[ -z $database_check ]]; then + echo "Healthcheck error: oai_db not populated" + STATUS=1 + fi + STATUS=0 + else + echo "Healthcheck error: Mysql port inactive" + STATUS=1 + fi +else + if select="$(echo 'SELECT 1' | mysql "${args[@]}")" && [ "$select" = '1' ]; then + database_check=$(mysql -u$user -D oai_db --silent -e "SELECT * FROM users;") + if [[ -z $database_check ]]; then + echo "Healthcheck error: oai_db not populated" + STATUS=1 + fi + STATUS=0 + else + echo "Healthcheck error: Mysql port inactive" + STATUS=1 + fi +fi +exit $STATUS diff --git a/ci-scripts/yaml_files/5g_f1_rfsimulator/nrf-healthcheck.sh b/ci-scripts/yaml_files/5g_f1_rfsimulator/nrf-healthcheck.sh new file mode 100755 index 0000000000..3479c092e8 --- /dev/null +++ b/ci-scripts/yaml_files/5g_f1_rfsimulator/nrf-healthcheck.sh @@ -0,0 +1,20 @@ +#!/bin/bash +set -eo pipefail + +STATUS=0 +NRF_IP_SBI_INTERFACE=$(ifconfig $NRF_INTERFACE_NAME_FOR_SBI | grep inet | awk {'print $2'}) +NRF_SBI_PORT_STATUS=$(netstat -tnpl | grep -o "$NRF_IP_SBI_INTERFACE:$NRF_INTERFACE_PORT_FOR_SBI") +#Check if entrypoint properly configured the conf file and no parameter is unset(optional) +NB_UNREPLACED_AT=`cat /openair-nrf/etc/*.conf | grep -v contact@openairinterface.org | grep -c @ || true` + +if [ $NB_UNREPLACED_AT -ne 0 ]; then + STATUS=1 + echo "Healthcheck error: UNHEALTHY configuration file is not configured properly" +fi + +if [[ -z $NRF_SBI_PORT_STATUS ]]; then + STATUS=1 + echo "Healthcheck error: UNHEALTHY SBI TCP/HTTP port $NRF_INTERFACE_PORT_FOR_SBI is not listening." +fi + +exit $STATUS \ No newline at end of file diff --git a/ci-scripts/yaml_files/5g_f1_rfsimulator/oai-smf.conf b/ci-scripts/yaml_files/5g_f1_rfsimulator/oai-smf.conf new file mode 100644 index 0000000000..0c83ab8be9 --- /dev/null +++ b/ci-scripts/yaml_files/5g_f1_rfsimulator/oai-smf.conf @@ -0,0 +1,133 @@ +################################################################################ +# Licensed to the OpenAirInterface (OAI) Software Alliance under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The OpenAirInterface Software Alliance licenses this file to You under +# the OAI Public License, Version 1.1 (the "License"); you may not use this file +# except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.openairinterface.org/?page_id=698 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#------------------------------------------------------------------------------- +# For more information about the OpenAirInterface (OAI) Software Alliance: +# contact@openairinterface.org +################################################################################ + +SMF = +{ + FQDN = "oai-smf-svc"; + INSTANCE = 0; # 0 is the default + PID_DIRECTORY = "/var/run"; # /var/run is the default + + INTERFACES : + { + N4 : + { + # SMF binded interface for N4 communication (UPF) + INTERFACE_NAME = "eth0"; # YOUR NETWORK CONFIG HERE + IPV4_ADDRESS = "read"; + }; + + SBI : + { + # SMF binded interface for SBI interface (e.g., communication with AMF, UDM) + INTERFACE_NAME = "eth0"; # YOUR NETWORK CONFIG HERE + IPV4_ADDRESS = "read"; + PORT = 80; # YOUR NETWORK CONFIG HERE (default: 80) + HTTP2_PORT = 9090; # YOUR NETWORK CONFIG HERE + API_VERSION = "v1"; # YOUR SMF API VERSION CONFIG HERE + }; + + }; + + + # Pool of UE assigned IP addresses + # Do not make IP pools overlap + # first IPv4 address X.Y.Z.1 is reserved for GTP network device on UPF + IP_ADDRESS_POOL : + { + IPV4_LIST = ( + {RANGE = "12.1.1.2 - 12.1.1.128";}, # STRING, IPv4 RANGE IP_start - IP_end, YOUR NETWORK CONFIG HERE. + {RANGE = "12.1.1.129 - 12.1.1.224";}, # STRING, IPv4 RANGE IP_start - IP_end, YOUR NETWORK CONFIG HERE. + {RANGE = "10.10.10.2 - 10.10.10.253";} # STRING, IPv4 RANGE IP_start - IP_end, YOUR NETWORK CONFIG HERE. + + ); + IPV6_LIST = ( + {PREFIX = "2001:1:2::/64";}, # STRING, IPv6 prefix, YOUR NETWORK CONFIG HERE. + {PREFIX = "3001:1:2::/64";}, # STRING, IPv6 prefix, YOUR NETWORK CONFIG HERE. + {PREFIX = "4001:1:2::/64";} # STRING, IPv6 prefix, YOUR NETWORK CONFIG HERE. + ); + }; + + DNN_LIST = ( + # IPV4_POOL, IPV6_POOL are index in IPV4_LIST, IPV6_LIST, PDU_SESSION_TYPE choice in {IPv4, IPv6, IPv4v6} + {DNN_NI = "default"; PDU_SESSION_TYPE = "IPv4"; IPV4_POOL = 2; IPV6_POOL = -1}, + {DNN_NI = "carrier.com"; PDU_SESSION_TYPE = "IPv4"; IPV4_POOL = 1; IPV6_POOL = -1}, + {DNN_NI = "oai"; PDU_SESSION_TYPE = "IPv4"; IPV4_POOL = 0; IPV6_POOL = -1} + ); + + # DNS address communicated to UEs + DEFAULT_DNS_IPV4_ADDRESS = "192.168.18.129"; # YOUR DNS CONFIG HERE + DEFAULT_DNS_SEC_IPV4_ADDRESS = "192.168.18.129"; # YOUR DNS CONFIG HERE + DEFAULT_DNS_IPV6_ADDRESS = "2001:4860:4860::8888"; # YOUR DNS CONFIG HERE + DEFAULT_DNS_SEC_IPV6_ADDRESS = "2001:4860:4860::8844"; # YOUR DNS CONFIG HERE + + SUPPORT_FEATURES: + { + # STRING, {"yes", "no"}, + REGISTER_NRF = "yes"; # Set to yes if SMF resgisters to an NRF + DISCOVER_UPF = "yes"; # Set to yes to enable UPF discovery and selection + FORCE_PUSH_PROTOCOL_CONFIGURATION_OPTIONS = "no"; # Non standard feature, normally should be set to "no", + # but you may need to set to yes for UE that do not explicitly request a PDN address through NAS signalling + USE_LOCAL_SUBSCRIPTION_INFO = "yes"; # Set to yes if SMF uses local subscription information instead of from an UDM + USE_FQDN_DNS = "yes"; # Set to yes if AMF/UDM/NRF/UPF will relying on a DNS to resolve FQDN + } + + AMF : + { + IPV4_ADDRESS = "0.0.0.0"; # YOUR AMF CONFIG HERE + PORT = 80; # YOUR AMF CONFIG HERE (default: 80) + API_VERSION = "v1"; # YOUR AMF API VERSION FOR SBI CONFIG HERE + FQDN = "oai-amf" # YOUR AMF FQDN CONFIG HERE + }; + + UDM : + { + IPV4_ADDRESS = "127.0.0.1"; # YOUR UDM CONFIG HERE + PORT = 80; # YOUR UDM CONFIG HERE (default: 80) + API_VERSION = "v1"; # YOUR UDM API VERSION FOR SBI CONFIG HERE + FQDN = "localhost" # YOUR UDM FQDN CONFIG HERE + }; + + NRF : + { + IPV4_ADDRESS = "192.168.71.130"; # YOUR NRF CONFIG HERE + PORT = 80; # YOUR NRF CONFIG HERE (default: 80) + API_VERSION = "v1"; # YOUR NRF API VERSION FOR SBI CONFIG HERE + FQDN = "oai-nrf" # YOUR NRF FQDN CONFIG HERE + }; + + UPF_LIST = ( + {IPV4_ADDRESS = "192.168.71.134" ; FQDN = "oai-spgwu"} # YOUR UPF CONFIG HERE + ); + + LOCAL_CONFIGURATION : + { + SESSION_MANAGEMENT_SUBSCRIPTION_LIST = ( + { NSSAI_SST = 222, NSSAI_SD = "123", DNN = "default", DEFAULT_SESSION_TYPE = "IPV4", DEFAULT_SSC_MODE = 1, + QOS_PROFILE_5QI = 7, QOS_PROFILE_PRIORITY_LEVEL = 1, QOS_PROFILE_ARP_PRIORITY_LEVEL = 1, QOS_PROFILE_ARP_PREEMPTCAP = "NOT_PREEMPT", + QOS_PROFILE_ARP_PREEMPTVULN = "NOT_PREEMPTABLE", SESSION_AMBR_UL = "20Mbps", SESSION_AMBR_DL = "22Mbps"}, + { NSSAI_SST = 1; NSSAI_SD = "1", DNN = "oai", DEFAULT_SESSION_TYPE = "IPV4", DEFAULT_SSC_MODE = 1, + QOS_PROFILE_5QI = 6, QOS_PROFILE_PRIORITY_LEVEL = 1, QOS_PROFILE_ARP_PRIORITY_LEVEL = 1, QOS_PROFILE_ARP_PREEMPTCAP = "NOT_PREEMPT", + QOS_PROFILE_ARP_PREEMPTVULN = "NOT_PREEMPTABLE", SESSION_AMBR_UL = "20Mbps", SESSION_AMBR_DL = "22Mbps"} + ); + }; + +}; + diff --git a/ci-scripts/yaml_files/5g_f1_rfsimulator/oai_db.sql b/ci-scripts/yaml_files/5g_f1_rfsimulator/oai_db.sql new file mode 100755 index 0000000000..fbd7907a71 --- /dev/null +++ b/ci-scripts/yaml_files/5g_f1_rfsimulator/oai_db.sql @@ -0,0 +1,217 @@ +-- MySQL dump 10.13 Distrib 5.5.46, for debian-linux-gnu (x86_64) +-- +-- Host: localhost Database: oai_db +-- ------------------------------------------------------ +-- Server version 5.5.46-0ubuntu0.14.04.2 + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `apn` +-- + +DROP TABLE IF EXISTS `apn`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `apn` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `apn-name` varchar(60) NOT NULL, + `pdn-type` enum('IPv4','IPv6','IPv4v6','IPv4_or_IPv6') NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `apn-name` (`apn-name`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `apn` +-- + +LOCK TABLES `apn` WRITE; +/*!40000 ALTER TABLE `apn` DISABLE KEYS */; +/*!40000 ALTER TABLE `apn` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `mmeidentity` +-- + +DROP TABLE IF EXISTS `mmeidentity`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `mmeidentity` ( + `idmmeidentity` int(11) NOT NULL AUTO_INCREMENT, + `mmehost` varchar(255) DEFAULT NULL, + `mmerealm` varchar(200) DEFAULT NULL, + `UE-Reachability` tinyint(1) NOT NULL COMMENT 'Indicates whether the MME supports UE Reachability Notifcation', + PRIMARY KEY (`idmmeidentity`) +) ENGINE=MyISAM AUTO_INCREMENT=46 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `mmeidentity` +-- + +LOCK TABLES `mmeidentity` WRITE; +/*!40000 ALTER TABLE `mmeidentity` DISABLE KEYS */; +INSERT INTO `mmeidentity` VALUES (2,'mme2.openair4G.eur','openair4G.eur',0),(1,'nano.openair4G.eur','openair4G.eur',0),(5,'abeille.openair4G.eur','openair4G.eur',0),(4,'yang.openair4G.eur','openair4G.eur',0),(3,'mme3.openair4G.eur','openair4G.eur',0),(6,'calisson.openair4G.eur','openair4G.eur',0); +/*!40000 ALTER TABLE `mmeidentity` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `pdn` +-- + +DROP TABLE IF EXISTS `pdn`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `pdn` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `apn` varchar(60) NOT NULL, + `pdn_type` enum('IPv4','IPv6','IPv4v6','IPv4_or_IPv6') NOT NULL DEFAULT 'IPv4', + `pdn_ipv4` varchar(15) DEFAULT '0.0.0.0', + `pdn_ipv6` varchar(45) CHARACTER SET latin1 COLLATE latin1_general_ci DEFAULT '0:0:0:0:0:0:0:0', + `aggregate_ambr_ul` int(10) unsigned DEFAULT '50000000', + `aggregate_ambr_dl` int(10) unsigned DEFAULT '100000000', + `pgw_id` int(11) NOT NULL, + `users_imsi` varchar(15) NOT NULL, + `qci` tinyint(3) unsigned NOT NULL DEFAULT '9', + `priority_level` tinyint(3) unsigned NOT NULL DEFAULT '15', + `pre_emp_cap` enum('ENABLED','DISABLED') DEFAULT 'DISABLED', + `pre_emp_vul` enum('ENABLED','DISABLED') DEFAULT 'DISABLED', + `LIPA-Permissions` enum('LIPA-prohibited','LIPA-only','LIPA-conditional') NOT NULL DEFAULT 'LIPA-only', + PRIMARY KEY (`id`,`pgw_id`,`users_imsi`), + KEY `fk_pdn_pgw1_idx` (`pgw_id`), + KEY `fk_pdn_users1_idx` (`users_imsi`) +) ENGINE=MyISAM AUTO_INCREMENT=60 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `pdn` +-- + +LOCK TABLES `pdn` WRITE; +/*!40000 ALTER TABLE `pdn` DISABLE KEYS */; +INSERT INTO `pdn` VALUES (1,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930000000001',9,15,'DISABLED','ENABLED','LIPA-only'),(41,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'20834123456789',9,15,'DISABLED','ENABLED','LIPA-only'),(40,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'20810000001234',9,15,'DISABLED','ENABLED','LIPA-only'),(42,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'31002890832150',9,15,'DISABLED','ENABLED','LIPA-only'),(16,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000002',9,15,'DISABLED','ENABLED','LIPA-only'),(43,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'001010123456789',9,15,'DISABLED','ENABLED','LIPA-only'),(2,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930000000002',9,15,'DISABLED','ENABLED','LIPA-only'),(3,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930000000003',9,15,'DISABLED','ENABLED','LIPA-only'),(4,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930000000004',9,15,'DISABLED','ENABLED','LIPA-only'),(5,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930000000005',9,15,'DISABLED','ENABLED','LIPA-only'),(6,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930000000006',9,15,'DISABLED','ENABLED','LIPA-only'),(7,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930000000007',9,15,'DISABLED','ENABLED','LIPA-only'),(8,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208940000000001',9,15,'DISABLED','ENABLED','LIPA-only'),(9,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208940000000002',9,15,'DISABLED','ENABLED','LIPA-only'),(10,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208940000000003',9,15,'DISABLED','ENABLED','LIPA-only'),(11,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208940000000004',9,15,'DISABLED','ENABLED','LIPA-only'),(12,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208940000000005',9,15,'DISABLED','ENABLED','LIPA-only'),(13,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208940000000006',9,15,'DISABLED','ENABLED','LIPA-only'),(14,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208940000000007',9,15,'DISABLED','ENABLED','LIPA-only'),(15,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000001',9,15,'DISABLED','ENABLED','LIPA-only'),(17,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000003',9,15,'DISABLED','ENABLED','LIPA-only'),(18,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000004',9,15,'DISABLED','ENABLED','LIPA-only'),(19,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000005',9,15,'DISABLED','ENABLED','LIPA-only'),(20,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000006',9,15,'DISABLED','ENABLED','LIPA-only'),(21,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000007',9,15,'DISABLED','ENABLED','LIPA-only'),(22,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001100',9,15,'DISABLED','ENABLED','LIPA-only'),(23,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001101',9,15,'DISABLED','ENABLED','LIPA-only'),(24,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001102',9,15,'DISABLED','ENABLED','LIPA-only'),(25,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001103',9,15,'DISABLED','ENABLED','LIPA-only'),(26,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001104',9,15,'DISABLED','ENABLED','LIPA-only'),(27,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001105',9,15,'DISABLED','ENABLED','LIPA-only'),(28,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001106',9,15,'DISABLED','ENABLED','LIPA-only'),(29,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001107',9,15,'DISABLED','ENABLED','LIPA-only'),(30,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001108',9,15,'DISABLED','ENABLED','LIPA-only'),(31,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001109',9,15,'DISABLED','ENABLED','LIPA-only'),(32,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001110',9,15,'DISABLED','ENABLED','LIPA-only'),(33,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930100001111',9,15,'DISABLED','ENABLED','LIPA-only'),(34,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930100001112',9,15,'DISABLED','ENABLED','LIPA-only'),(35,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930100001113',9,15,'DISABLED','ENABLED','LIPA-only'),(44,'operator','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930100001113',9,15,'DISABLED','ENABLED','LIPA-only'),(45,'operator','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930100001112',9,15,'DISABLED','ENABLED','LIPA-only'),(46,'operator','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208930100001111',9,15,'DISABLED','ENABLED','LIPA-only'),(47,'operator','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000002',9,15,'DISABLED','ENABLED','LIPA-only'),(48,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000008',9,15,'DISABLED','ENABLED','LIPA-only'),(49,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000009',9,15,'DISABLED','ENABLED','LIPA-only'),(50,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000010',9,15,'DISABLED','ENABLED','LIPA-only'),(51,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000011',9,15,'DISABLED','ENABLED','LIPA-only'),(52,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000012',9,15,'DISABLED','ENABLED','LIPA-only'),(53,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000013',9,15,'DISABLED','ENABLED','LIPA-only'),(54,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000014',9,15,'DISABLED','ENABLED','LIPA-only'),(55,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208950000000015',9,15,'DISABLED','ENABLED','LIPA-only'),(56,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001118',9,15,'DISABLED','ENABLED','LIPA-only'),(57,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001121',9,15,'DISABLED','ENABLED','LIPA-only'),(58,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001120',9,15,'DISABLED','ENABLED','LIPA-only'),(59,'oai.ipv4','IPv4','0.0.0.0','0:0:0:0:0:0:0:0',50000000,100000000,3,'208920100001119',9,15,'DISABLED','ENABLED','LIPA-only'); +/*!40000 ALTER TABLE `pdn` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `pgw` +-- + +DROP TABLE IF EXISTS `pgw`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `pgw` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `ipv4` varchar(15) NOT NULL, + `ipv6` varchar(39) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `ipv4` (`ipv4`), + UNIQUE KEY `ipv6` (`ipv6`) +) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `pgw` +-- + +LOCK TABLES `pgw` WRITE; +/*!40000 ALTER TABLE `pgw` DISABLE KEYS */; +INSERT INTO `pgw` VALUES (1,'127.0.0.1','0:0:0:0:0:0:0:1'),(2,'192.168.56.101',''),(3,'10.0.0.2','0'); +/*!40000 ALTER TABLE `pgw` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `terminal-info` +-- + +DROP TABLE IF EXISTS `terminal-info`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `terminal-info` ( + `imei` varchar(15) NOT NULL, + `sv` varchar(2) NOT NULL, + UNIQUE KEY `imei` (`imei`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `terminal-info` +-- + +LOCK TABLES `terminal-info` WRITE; +/*!40000 ALTER TABLE `terminal-info` DISABLE KEYS */; +/*!40000 ALTER TABLE `terminal-info` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `users` +-- + +DROP TABLE IF EXISTS `users`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `users` ( + `imsi` varchar(15) NOT NULL COMMENT 'IMSI is the main reference key.', + `msisdn` varchar(46) DEFAULT NULL COMMENT 'The basic MSISDN of the UE (Presence of MSISDN is optional).', + `imei` varchar(15) DEFAULT NULL COMMENT 'International Mobile Equipment Identity', + `imei_sv` varchar(2) DEFAULT NULL COMMENT 'International Mobile Equipment Identity Software Version Number', + `ms_ps_status` enum('PURGED','NOT_PURGED') DEFAULT 'PURGED' COMMENT 'Indicates that ESM and EMM status are purged from MME', + `rau_tau_timer` int(10) unsigned DEFAULT '120', + `ue_ambr_ul` bigint(20) unsigned DEFAULT '50000000' COMMENT 'The Maximum Aggregated uplink MBRs to be shared across all Non-GBR bearers according to the subscription of the user.', + `ue_ambr_dl` bigint(20) unsigned DEFAULT '100000000' COMMENT 'The Maximum Aggregated downlink MBRs to be shared across all Non-GBR bearers according to the subscription of the user.', + `access_restriction` int(10) unsigned DEFAULT '60' COMMENT 'Indicates the access restriction subscription information. 3GPP TS.29272 #7.3.31', + `mme_cap` int(10) unsigned zerofill DEFAULT NULL COMMENT 'Indicates the capabilities of the MME with respect to core functionality e.g. regional access restrictions.', + `mmeidentity_idmmeidentity` int(11) NOT NULL DEFAULT '0', + `key` varbinary(16) NOT NULL DEFAULT '0' COMMENT 'UE security key', + `RFSP-Index` smallint(5) unsigned NOT NULL DEFAULT '1' COMMENT 'An index to specific RRM configuration in the E-UTRAN. Possible values from 1 to 256', + `urrp_mme` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'UE Reachability Request Parameter indicating that UE activity notification from MME has been requested by the HSS.', + `sqn` bigint(20) unsigned zerofill NOT NULL, + `rand` varbinary(16) NOT NULL, + `OPc` varbinary(16) DEFAULT NULL COMMENT 'Can be computed by HSS', + PRIMARY KEY (`imsi`,`mmeidentity_idmmeidentity`), + KEY `fk_users_mmeidentity_idx1` (`mmeidentity_idmmeidentity`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `users` +-- + +LOCK TABLES `users` WRITE; +/*!40000 ALTER TABLE `users` DISABLE KEYS */; +INSERT INTO `users` VALUES ('20834123456789','380561234567','35609204079300',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,'+�E��ų\0�,IH��H',0,0,00000000000000000096,'Px�X \Z1��x��','^��K�����FeU���'),('20810000001234','33611123456','35609204079299',NULL,'PURGED',120,40000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000281454575616225,'\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0','�4�s@���z��~�'),('31002890832150','33638060059','35611302209414',NULL,'PURGED',120,40000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012416,'`�F�݆��D��ϛ���','�4�s@���z��~�'),('001010123456789','33600101789','35609204079298',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'\0 \n \r',1,0,00000000000000000351,'\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0','L�*\\�����^��]� '),('208930000000001','33638030001','35609204079301',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208950000000002','33638050002','35609204079502',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000020471,'\0 \n \r','�4�s@���z��~�'),('208950000000003','33638050003','35609204079503',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012343,'\0 \n \r','�4�s@���z��~�'),('208950000000004','33638050004','35609204079504',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012215,'56f0261d9d051063','�4�s@���z��~�'),('208950000000005','33638050005','35609204079505',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012215,'56f0261d9d051063','�4�s@���z��~�'),('208950000000001','33638050001','35609204079501',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208950000000006','33638050006','35609204079506',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012215,'56f0261d9d051063','�4�s@���z��~�'),('208950000000007','33638050007','35609204079507',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012215,'56f0261d9d051063','�4�s@���z��~�'),('208930000000002','33638030002','35609204079302',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208930000000003','33638030003','35609204079303',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208930000000004','33638030004','35609204079304',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208930000000005','33638030005','35609204079305',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208930000000006','33638030006','35609204079306',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208930000000007','33638030007','35609204079307',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208940000000007','33638040007','35609204079407',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208940000000006','33638040006','35609204079406',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208940000000005','33638040005','35609204079405',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208940000000004','33638040004','35609204079404',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208940000000003','33638040003','35609204079403',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208940000000002','33638040002','35609204079402',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208940000000001','33638040001','35609204079401',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'��wq��gzW�Ё��Z]','�4�s@���z��~�'),('208920100001100','33638020001','35609204079201',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'ebd07771ace8677a','�4�s@���z��~�'),('208920100001101','33638020001','35609204079201',NULL,'NOT_PURGED',120,50000000,100000000,47,0000000000,1,'��k��p~Љu{�K�',1,0,00000281044204937234,'\0 \n \r','�$I6;��+f�k�u�|�'),('208920100001102','33638020002','35609204079202',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'ebd07771ace8677a','�4�s@���z��~�'),('208920100001103','33638020003','35609204079203',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'ebd07771ace8677a','�4�s@���z��~�'),('208920100001104','33638020004','35609204079204',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'ebd07771ace8677a','�4�s@���z��~�'),('208920100001105','33638020005','35609204079205',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'ebd07771ace8677a','�4�s@���z��~�'),('208920100001106','33638020006','35609204079206',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��k��p~Љu{�K�',1,0,00000000000000006103,'ebd07771ace8677a','�$I6;��+f�k�u�|�'),('208920100001107','33638020007','35609204079207',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'ebd07771ace8677a','�4�s@���z��~�'),('208920100001108','33638020008','35609204079208',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'ebd07771ace8677a','�4�s@���z��~�'),('208920100001109','33638020009','35609204079209',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'ebd07771ace8677a','�4�s@���z��~�'),('208920100001110','33638020010','35609204079210',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'ebd07771ace8677a','�4�s@���z��~�'),('208930100001111','33638030011','35609304079211',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'ebd07771ace8677a','�4�s@���z��~�'),('208930100001112','33638030012','35609304079212',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006103,'ebd07771ace8677a','�4�s@���z��~�'),('208930100001113','33638030013','35609304079213',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000006263,'�SNܒ�Iv��e�6','�4�s@���z��~�'),('208950000000008','33638050008','35609204079508',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012215,'56f0261d9d051063','�4�s@���z��~�'),('208950000000009','33638050009','35609204079509',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012215,'56f0261d9d051063','�4�s@���z��~�'),('208950000000010','33638050010','35609204079510',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012215,'56f0261d9d051063','�4�s@���z��~�'),('208950000000011','33638050011','35609204079511',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012215,'56f0261d9d051063','�4�s@���z��~�'),('208950000000012','33638050012','35609204079512',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012215,'56f0261d9d051063','�4�s@���z��~�'),('208950000000013','33638050013','35609204079513',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012215,'56f0261d9d051063','�4�s@���z��~�'),('208950000000014','33638050014','35609204079514',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000012215,'56f0261d9d051063','�4�s@���z��~�'),('208950000000015','33638050015','35609204079515',NULL,'PURGED',120,50000000,100000000,47,0000000000,1,'��G?/�Д���� |hb',1,0,00000000000000000000,'3536663032363164','�4�s@���z��~�'),('208920100001118','33638020010','35609204079210',NULL,'NOT_PURGED',120,50000000,100000000,47,0000000000,1,'��k��p~Љu{�K�',1,0,00000281044204934762,'~?03�u-%�ey�y�','�$I6;��+f�k�u�|�'),('208920100001121','33638020010','35609204079210',NULL,'NOT_PURGED',120,50000000,100000000,47,0000000000,1,'��k��p~Љu{�K�',1,0,00000281044204935293,'&��@xg�]���\n��Vp','�$I6;��+f�k�u�|�'),('208920100001119','33638020010','35609204079210',NULL,'NOT_PURGED',120,50000000,100000000,47,0000000000,1,'��k��p~Љu{�K�',1,0,00000281044204935293,'269482407867805d','�$I6;��+f�k�u�|�'),('208920100001120','33638020010','35609204079210',NULL,'NOT_PURGED',120,50000000,100000000,47,0000000000,1,'��k��p~Љu{�K�',1,0,00000281044204935293,'3236393438323430','�$I6;��+f�k�u�|�'); +INSERT INTO `users` VALUES ('208990100001100','1','55000000000000',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0xfec86ba6eb707ed08905757b1bb44b8f,0,0,0x40,'ebd07771ace8677a',0xc42449363bbad02b66d16bc975d77cc1); +INSERT INTO `users` VALUES ('208950000000031','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d); +INSERT INTO `users` VALUES ('208950000000032','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d); +INSERT INTO `users` VALUES ('208950000000033','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d); +INSERT INTO `users` VALUES ('208950000000034','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d); +INSERT INTO `users` VALUES ('208950000000035','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d); +INSERT INTO `users` VALUES ('208950000000036','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d); +INSERT INTO `users` VALUES ('208950000000037','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d); +INSERT INTO `users` VALUES ('208950000000038','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d); +INSERT INTO `users` VALUES ('208950000000039','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d); +INSERT INTO `users` VALUES ('208950000000040','380561234567','55000000000001',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0x0C0A34601D4F07677303652C0462535B,0,0,0x40,'ebd07771ace8677a',0x63bfa50ee6523365ff14c1f45f88737d); +/*!40000 ALTER TABLE `users` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2016-06-28 11:41:40 diff --git a/ci-scripts/yaml_files/5g_f1_rfsimulator/smf-healthcheck.sh b/ci-scripts/yaml_files/5g_f1_rfsimulator/smf-healthcheck.sh new file mode 100755 index 0000000000..d9ff7608e8 --- /dev/null +++ b/ci-scripts/yaml_files/5g_f1_rfsimulator/smf-healthcheck.sh @@ -0,0 +1,21 @@ +#!/bin/bash +set -eo pipefail + +STATUS=0 +SMF_IP_SBI_INTERFACE=$(ifconfig $SMF_INTERFACE_NAME_FOR_SBI | grep inet | awk {'print $2'}) +SMF_SBI_PORT_STATUS=$(netstat -tnpl | grep -o "$SMF_IP_SBI_INTERFACE:$SMF_INTERFACE_PORT_FOR_SBI") + +#Check if entrypoint properly configured the conf file and no parameter is unset(optional) +#NB_UNREPLACED_AT=`cat /openair-smf/etc/*.conf | grep -v contact@openairinterface.org | grep -c @ || true` + +#if [ $NB_UNREPLACED_AT -ne 0 ]; then +# STATUS=-1 +# echo "Healthcheck error: UNHEALTHY configuration file is not configured properly" +#fi +# +if [[ -z $SMF_SBI_PORT_STATUS ]]; then + STATUS=-1 + echo "Healthcheck error: UNHEALTHY SBI TCP/HTTP port $SMF_INTERFACE_PORT_FOR_SBI is not listening." +fi + +exit $STATUS diff --git a/ci-scripts/yaml_files/5g_f1_rfsimulator/spgwu-healthcheck.sh b/ci-scripts/yaml_files/5g_f1_rfsimulator/spgwu-healthcheck.sh new file mode 100755 index 0000000000..0e3b67ee7e --- /dev/null +++ b/ci-scripts/yaml_files/5g_f1_rfsimulator/spgwu-healthcheck.sh @@ -0,0 +1,28 @@ +#!/bin/bash +set -eo pipefail + +STATUS=0 +SGW_PORT_FOR_S1U_S12_S4_UP=2152 +SGW_PORT_FOR_SX=8805 +SGW_IP_S1U_INTERFACE=$(ifconfig $SGW_INTERFACE_NAME_FOR_S1U_S12_S4_UP | grep inet | awk {'print $2'}) +SGW_IP_SX_INTERFACE=$(ifconfig $SGW_INTERFACE_NAME_FOR_SX | grep inet | awk {'print $2'}) +S1U_S12_S4_UP_PORT_STATUS=$(netstat -unpl | grep -o "$SGW_IP_S1U_INTERFACE:$SGW_PORT_FOR_S1U_S12_S4_UP") +SX_PORT_STATUS=$(netstat -unpl | grep -o "$SGW_IP_SX_INTERFACE:$SGW_PORT_FOR_SX") +#Check if entrypoint properly configured the conf file and no parameter is unset (optional) +NB_UNREPLACED_AT=`cat /openair-spgwu/etc/*.conf | grep -v contact@openairinterface.org | grep -c @ || true` +if [ $NB_UNREPLACED_AT -ne 0 ]; then + STATUS=1 + echo "Healthcheck error: UNHEALTHY configuration file is not configured properly" +fi + +if [[ -z $S1U_S12_S4_UP_PORT_STATUS ]]; then + STATUS=1 + echo "Healthcheck error: UNHEALTHY S1U port $SGW_PORT_FOR_S1U_S12_S4_UP is not listening." +fi + +if [[ -z $SX_PORT_STATUS ]]; then + STATUS=1 + echo "Healthcheck error: UNHEALTHY SX port $SGW_PORT_FOR_SX is not listening." +fi + +exit $STATUS \ No newline at end of file diff --git a/docker/scripts/gnb_parameters.yaml b/docker/scripts/gnb_parameters.yaml index 8cce081397..2f150d394a 100644 --- a/docker/scripts/gnb_parameters.yaml +++ b/docker/scripts/gnb_parameters.yaml @@ -125,8 +125,12 @@ env: "@F1_IF_NAME@" - key: local_s_address env: "@F1_CU_IP_ADDRESS@" + - key: local_s_portd + env: "@F1_CU_D_PORT@" - key: remote_s_address env: "@F1_DU_IP_ADDRESS@" + - key: remote_s_portd + env: "@F1_DU_D_PORT@" - filePrefix: gNB_SA_DU.conf outputfilename: "gnb.sa.du.tdd.conf" @@ -161,6 +165,10 @@ env: "@F1_IF_NAME@" - key: local_n_address env: "@F1_DU_IP_ADDRESS@" + - key: local_n_portd + env: "@F1_DU_D_PORT@" - key: remote_n_address env: "@F1_CU_IP_ADDRESS@" + - key: remote_n_portd + env: "@F1_CU_D_PORT@" From 9b691b3ecfe89305091cd1805c975f391366c52f Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Tue, 21 Sep 2021 20:33:35 +0200 Subject: [PATCH 074/110] fix old code errors, add CU to DU, 4G F1-U --- cmake_targets/CMakeLists.txt | 5 +-- executables/main-ocp.c | 8 ++-- executables/nr-softmodem.c | 8 ++-- executables/nr-uesoftmodem.c | 4 +- executables/ocp-gnb.c | 4 +- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 2 +- openair2/F1AP/f1ap_cu_ue_context_management.c | 4 +- openair2/GNB_APP/gnb_app.c | 8 ++-- openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 37 ++++++++++++++++--- openair2/LAYER2/PDCP_v10.1.0/pdcp.h | 25 ++++++------- openair2/LAYER2/PROTO_AGENT/proto_agent.c | 10 ++--- openair2/LAYER2/PROTO_AGENT/proto_agent.h | 6 +-- .../LAYER2/PROTO_AGENT/proto_agent_common.c | 10 +---- openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c | 13 +++---- openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c | 22 +++++------ openair2/SIMULATION/NR_RRC/itti_sim.c | 4 +- openair3/ocp-gtpu/gtp_itf.h | 3 +- targets/RT/USER/lte-softmodem.c | 8 ++-- targets/RT/USER/lte-uesoftmodem.c | 6 +-- 19 files changed, 101 insertions(+), 86 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 2bbe8db1a7..cad45fd7ef 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -2968,9 +2968,8 @@ if (NOT ${NOS1}) endif() target_link_libraries (lte-uesoftmodem -Wl,--start-group - RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB F1AP F1AP_LIB - - GTPV1U_OCP SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON + RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB + SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_UE PHY_RU LFDS L2_UE L2_LTE LFDS7 SIMU_COMMON SIMU NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB MISC_NFAPI_LTE_LIB ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ITTI ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${ATLAS_LIBRARIES} -Wl,--end-group z dl) diff --git a/executables/main-ocp.c b/executables/main-ocp.c index 0dd670790c..69fb438906 100644 --- a/executables/main-ocp.c +++ b/executables/main-ocp.c @@ -1046,13 +1046,13 @@ void init_pdcp(void) { pdcp_module_init(pdcp_initmask); if (NODE_IS_CU(RC.rrc[0]->node_type)) { - //pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t)proto_agent_send_rlc_data_req); + //pdcp_set_rlc_data_req_func(proto_agent_send_rlc_data_req); } else { - pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t) rlc_data_req); - pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) pdcp_data_ind); + pdcp_set_rlc_data_req_func(rlc_data_req); + pdcp_set_pdcp_data_ind_func(pdcp_data_ind); } } else { - //pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) proto_agent_send_pdcp_data_ind); + //pdcp_set_pdcp_data_ind_func(proto_agent_send_pdcp_data_ind); } } diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index c6c367a0bb..1ccd49aef9 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -610,15 +610,15 @@ void init_pdcp(void) { if (NODE_IS_CU(RC.nrrrc[0]->node_type)) { LOG_I(PDCP, "node is CU, pdcp send rlc_data_req by proto_agent \n"); - pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t)proto_agent_send_rlc_data_req); + pdcp_set_rlc_data_req_func(proto_agent_send_rlc_data_req); } else { LOG_I(PDCP, "node is gNB \n"); - pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t) rlc_data_req); - pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) pdcp_data_ind); + pdcp_set_rlc_data_req_func(rlc_data_req); + pdcp_set_pdcp_data_ind_func(pdcp_data_ind); } } else { LOG_I(PDCP, "node is DU, rlc send pdcp_data_ind by proto_agent \n"); - pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) proto_agent_send_pdcp_data_ind); + pdcp_set_pdcp_data_ind_func(proto_agent_send_pdcp_data_ind); } } diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index e9f23b8977..76347ced5a 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -397,8 +397,8 @@ static void init_pdcp(void) { nr_DRB_preconfiguration();*/ pdcp_layer_init(); pdcp_module_init(pdcp_initmask); - pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t) rlc_data_req); - pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) pdcp_data_ind); + pdcp_set_rlc_data_req_func(rlc_data_req); + pdcp_set_pdcp_data_ind_func(pdcp_data_ind); } // Stupid function addition because UE itti messages queues definition is common with eNB diff --git a/executables/ocp-gnb.c b/executables/ocp-gnb.c index 326f7d277f..e8349eb1d8 100644 --- a/executables/ocp-gnb.c +++ b/executables/ocp-gnb.c @@ -329,8 +329,8 @@ static void init_pdcp(void) { } pdcp_module_init(pdcp_initmask); - pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t) rlc_data_req); - pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) pdcp_data_ind); + pdcp_set_rlc_data_req_func(rlc_data_req); + pdcp_set_pdcp_data_ind_func(pdcp_data_ind); } void init_main_gNB(void) { diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index 0813acc433..e725272b09 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -326,6 +326,6 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, 0, // embms_flag srb_id, ie->value.choice.RRCContainer.size, - mb); + mb, NULL, NULL); return 0; } diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 5030e84e35..15a0e39cca 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -522,8 +522,8 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, 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->rnti, - f1ap_ue_context_setup_req->drbs_to_be_setup[i].drb_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-4, + f1ap_ue_context_setup_req->drbs_to_be_setup[i].drb_id-4, 0xFFFF, // We will set the right value from DU answer addr, f1ap_ue_context_setup_req->drbs_to_be_setup[i].up_dl_tnl[0].port, diff --git a/openair2/GNB_APP/gnb_app.c b/openair2/GNB_APP/gnb_app.c index cd041aabe4..fa721b67a7 100644 --- a/openair2/GNB_APP/gnb_app.c +++ b/openair2/GNB_APP/gnb_app.c @@ -148,15 +148,15 @@ static void init_pdcp(void) { if (NODE_IS_CU(RC.nrrrc[0]->node_type)) { LOG_I(PDCP, "node is CU, pdcp send rlc_data_req by proto_agent \n"); - pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t)proto_agent_send_rlc_data_req); + pdcp_set_rlc_data_req_func(proto_agent_send_rlc_data_req); } else { LOG_I(PDCP, "node is gNB \n"); - pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t) rlc_data_req); - pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) pdcp_data_ind); + pdcp_set_rlc_data_req_func(rlc_data_req); + pdcp_set_pdcp_data_ind_func(pdcp_data_ind); } } else { LOG_I(PDCP, "node is DU, rlc send pdcp_data_ind by proto_agent \n"); - pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) proto_agent_send_pdcp_data_ind); + pdcp_set_pdcp_data_ind_func(proto_agent_send_pdcp_data_ind); } } diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index 9a57c6f269..c507d83dcc 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -152,16 +152,14 @@ boolean_t cu_f1u_data_req( const pdcp_transmission_mode_t mode, const uint32_t *const sourceL2Id, const uint32_t *const destinationL2Id - ) -{ + ) { mem_block_t *memblock = get_free_mem_block(sdu_buffer_size, __func__); if (memblock == NULL) { LOG_E(RLC, "%s:%d:%s: ERROR: get_free_mem_block failed\n", __FILE__, __LINE__, __FUNCTION__); exit(1); } memcpy(memblock->data,sdu_buffer, sdu_buffer_size); - // These -4 are boring - int ret=pdcp_data_ind(ctxt_pP,srb_flagP, false, rb_id-4, sdu_buffer_size, memblock); + int ret=pdcp_data_ind(ctxt_pP,srb_flagP, false, rb_id, sdu_buffer_size, memblock, NULL, NULL); if (!ret) { LOG_E(RLC, "%s:%d:%s: ERROR: pdcp_data_ind failed\n", __FILE__, __LINE__, __FUNCTION__); /* what to do in case of failure? for the moment: nothing */ @@ -204,6 +202,33 @@ void *pdcp_stats_thread(void *param) { uint64_t get_pdcp_optmask(void) { return pdcp_params.optmask; } + +rlc_op_status_t cu_send_to_du(const protocol_ctxt_t *const ctxt, + const srb_flag_t srb_flag, const MBMS_flag_t MBMS_flag, + const rb_id_t rb_id, const mui_t mui, + confirm_t confirm, sdu_size_t size, mem_block_t *sdu, + const uint32_t *const sourceID, const uint32_t *const destID) { + uint8_t *gtpu_buffer_p = itti_malloc(TASK_PDCP_ENB, TASK_GTPV1_U, + size + GTPU_HEADER_OVERHEAD_MAX); + AssertFatal(gtpu_buffer_p != NULL, "OUT OF MEMORY"); + memcpy(gtpu_buffer_p+GTPU_HEADER_OVERHEAD_MAX, + sdu->data, + size ); + MessageDef *message_p = itti_alloc_new_message(TASK_PDCP_ENB, 0, GTPV1U_ENB_TUNNEL_DATA_REQ); + AssertFatal(message_p != NULL, "OUT OF MEMORY"); + gtpv1u_enb_tunnel_data_req_t *req=>PV1U_ENB_TUNNEL_DATA_REQ(message_p); + req->buffer = gtpu_buffer_p; + req->length = size; + req->offset = GTPU_HEADER_OVERHEAD_MAX; + req->rnti = ctxt->rnti; + req->rab_id = rb_id; + LOG_D(PDCP, "%s() (drb %ld) sending message to gtp size %d\n", + __func__, rb_id, size); + extern instance_t CUuniqInstance; + itti_send_msg_to_task(TASK_VARIABLE, CUuniqInstance, message_p); + return TRUE; +} + //----------------------------------------------------------------------------- /* * If PDCP_UNIT_TEST is set here then data flow between PDCP and RLC is broken @@ -599,7 +624,9 @@ pdcp_data_ind( const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP, const sdu_size_t sdu_buffer_sizeP, - mem_block_t *const sdu_buffer_pP + mem_block_t *const sdu_buffer_pP, + const uint32_t *const srcID, + const uint32_t *const dstID ) //----------------------------------------------------------------------------- { diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h index 2d11fc6613..3ffedf4b7c 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h @@ -47,12 +47,14 @@ typedef rlc_op_status_t (*send_rlc_data_req_func_t)(const protocol_ctxt_t *const, - const srb_flag_t, const MBMS_flag_t, - const rb_id_t, const mui_t, + const srb_flag_t, const MBMS_flag_t, + const rb_id_t, const mui_t, confirm_t, sdu_size_t, mem_block_t *,const uint32_t *const, const uint32_t *const); -typedef boolean_t (*pdcp_data_ind_func_t)( const protocol_ctxt_t *, const srb_flag_t, - const MBMS_flag_t, const rb_id_t, const sdu_size_t, - mem_block_t *,const uint32_t *const, const uint32_t *const); + +typedef boolean_t (pdcp_data_ind_t)( const protocol_ctxt_t *, const srb_flag_t, + const MBMS_flag_t, const rb_id_t, const sdu_size_t, + mem_block_t *,const uint32_t *const, const uint32_t *const); +typedef pdcp_data_ind_t* pdcp_data_ind_func_t; #define ENB_NAS_USE_TUN_W_MBMS_BIT (1<< 10) #define PDCP_USE_NETLINK_BIT (1<< 11) @@ -282,13 +284,7 @@ boolean_t cu_f1u_data_req( * \note None * @ingroup _pdcp */ -boolean_t pdcp_data_ind( - const protocol_ctxt_t *const ctxt_pP, - const srb_flag_t srb_flagP, - const MBMS_flag_t MBMS_flagP, - const rb_id_t rb_id, - const sdu_size_t sdu_buffer_size, - mem_block_t *const sdu_buffer); +pdcp_data_ind_t pdcp_data_ind; /*! \fn void rrc_pdcp_config_req(const protocol_ctxt_t* const ,uint32_t,rb_id_t,uint8_t) * \brief This functions initializes relevant PDCP entity @@ -434,7 +430,10 @@ pdcp_data_ind_func_t get_pdcp_data_ind_func(void); //----------------------------------------------------------------------------- int pdcp_fifo_flush_mbms_sdus ( const protocol_ctxt_t *const ctxt_pP); int pdcp_fifo_read_input_mbms_sdus_fromtun ( const protocol_ctxt_t *const ctxt_pP); - +rlc_op_status_t cu_send_to_du(const protocol_ctxt_t *const ctxt_pP, + const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, + const rb_id_t rb_idP, const mui_t muiP, + confirm_t confirmP, sdu_size_t sdu_sizeP, mem_block_t *sdu_pP, const uint32_t *const, const uint32_t *const); /* * Following two types are utilized between NAS driver and PDCP diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.c b/openair2/LAYER2/PROTO_AGENT/proto_agent.c index b7844d9b8d..5cf71b826d 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.c @@ -157,7 +157,7 @@ void proto_agent_stop(mod_id_t mod_id) { rlc_op_status_t proto_agent_send_rlc_data_req(const protocol_ctxt_t *const ctxt_pP, const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP, const mui_t muiP, - confirm_t confirmP, sdu_size_t sdu_sizeP, mem_block_t *sdu_pP) { + confirm_t confirmP, sdu_size_t sdu_sizeP, mem_block_t *sdu_pP,const uint32_t *const SrcID, const uint32_t *const DstID) { uint8_t *msg = NULL; Protocol__FlexsplitMessage *init_msg=NULL; int msg_flag = 0; @@ -191,10 +191,10 @@ error: } -boolean_t - -proto_agent_send_pdcp_data_ind(const protocol_ctxt_t *const ctxt_pP, const srb_flag_t srb_flagP, - const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP, sdu_size_t sdu_sizeP, mem_block_t *sdu_pP) { +boolean_t proto_agent_send_pdcp_data_ind(const protocol_ctxt_t *const ctxt_pP, const srb_flag_t srb_flagP, + const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP, + sdu_size_t sdu_sizeP, mem_block_t *sdu_pP, + const uint32_t *const SrcID, const uint32_t *const DstID) { uint8_t *msg = NULL; Protocol__FlexsplitMessage *init_msg = NULL; int msg_flag = 0; diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.h b/openair2/LAYER2/PROTO_AGENT/proto_agent.h index 32bf5aa13c..4badda43b7 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent.h +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.h @@ -42,10 +42,8 @@ void proto_agent_stop(mod_id_t mod_id); rlc_op_status_t proto_agent_send_rlc_data_req( const protocol_ctxt_t *const ctxt_pP, const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP, const mui_t muiP, confirm_t confirmP, - sdu_size_t sdu_sizeP, mem_block_t *sdu_pP); + sdu_size_t sdu_sizeP, mem_block_t *sdu_pP,const uint32_t *const SrcID, const uint32_t *const DstID); -boolean_t proto_agent_send_pdcp_data_ind(const protocol_ctxt_t *const ctxt_pP, - const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, - const rb_id_t rb_idP, sdu_size_t sdu_sizeP, mem_block_t *sdu_pP); +pdcp_data_ind_t proto_agent_send_pdcp_data_ind; #endif diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c index 50c97f06be..d3d00d1ada 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent_common.c @@ -496,14 +496,6 @@ error: return -1; } -boolean_t pdcp_data_ind( - const protocol_ctxt_t *const ctxt_pP, - const srb_flag_t srb_flagP, - const MBMS_flag_t MBMS_flagP, - const rb_id_t rb_id, - const sdu_size_t sdu_buffer_size, - mem_block_t *const sdu_buffer); - int proto_agent_pdcp_data_ind_process(mod_id_t mod_id, const void *params, Protocol__FlexsplitMessage **msg) { boolean_t result = 0; Protocol__FlexsplitMessage *input = (Protocol__FlexsplitMessage *)params; @@ -545,7 +537,7 @@ int proto_agent_pdcp_data_ind_process(mod_id_t mod_id, const void *params, Proto flag_MBMS, rb_idP, pdcp_pdu_size, - pdcp_pdu_p); + pdcp_pdu_p, NULL, NULL); return result; error: diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index 85e485cd63..d466ee904b 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -463,7 +463,8 @@ static void deliver_sdu_drb(void *_ue, nr_pdcp_entity_t *entity, rb_found: { int offset=0; - if (entity->has_sdap == 1 && entity->has_sdapULheader == 1) offset = 1; // this is the offset of the SDAP header in bytes + if (entity->has_sdap == 1 && entity->has_sdapULheader == 1) + offset = 1; // this is the offset of the SDAP header in bytes message_p = itti_alloc_new_message_sized(TASK_PDCP_ENB, 0, GTPV1U_GNB_TUNNEL_DATA_REQ, @@ -654,7 +655,9 @@ boolean_t pdcp_data_ind( const MBMS_flag_t MBMS_flagP, const rb_id_t rb_id, const sdu_size_t sdu_buffer_size, - mem_block_t *const sdu_buffer) + mem_block_t *const sdu_buffer, + const uint32_t *const sourceL2Id, + const uint32_t *const destinationL2Id) { nr_pdcp_ue_t *ue; nr_pdcp_entity_t *rb; @@ -1234,10 +1237,8 @@ boolean_t cu_f1u_data_req( const sdu_size_t sdu_buffer_size, unsigned char *const sdu_buffer, const pdcp_transmission_mode_t mode -#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,const uint32_t *const sourceL2Id ,const uint32_t *const destinationL2Id -#endif ) { //Force instance id to 0, OAI incoherent instance management @@ -1248,7 +1249,7 @@ boolean_t cu_f1u_data_req( exit(1); } memcpy(memblock->data,sdu_buffer, sdu_buffer_size); - int ret=pdcp_data_ind(ctxt_pP,srb_flagP, false, rb_id, sdu_buffer_size, memblock); + int ret=pdcp_data_ind(ctxt_pP,srb_flagP, false, rb_id, sdu_buffer_size, memblock, NULL, NULL); if (!ret) { LOG_E(RLC, "%s:%d:%s: ERROR: pdcp_data_ind failed\n", __FILE__, __LINE__, __FUNCTION__); /* what to do in case of failure? for the moment: nothing */ @@ -1265,10 +1266,8 @@ boolean_t pdcp_data_req( const sdu_size_t sdu_buffer_size, unsigned char *const sdu_buffer, const pdcp_transmission_mode_t mode -#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) ,const uint32_t *const sourceL2Id ,const uint32_t *const destinationL2Id -#endif ) { if (srb_flagP) { diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index 2b6b40dbdb..17af5611f1 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -344,16 +344,16 @@ rlc_buffer_occupancy_t mac_rlc_get_buffer_occupancy_ind( rlc_op_status_t rlc_data_req (const protocol_ctxt_t *const ctxt_pP, - const srb_flag_t srb_flagP, - const MBMS_flag_t MBMS_flagP, - const rb_id_t rb_idP, - const mui_t muiP, - confirm_t confirmP, - sdu_size_t sdu_sizeP, - mem_block_t *sdu_pP, - const uint32_t *const sourceL2Id, - const uint32_t *const destinationL2Id - ) + const srb_flag_t srb_flagP, + const MBMS_flag_t MBMS_flagP, + const rb_id_t rb_idP, + const mui_t muiP, + confirm_t confirmP, + sdu_size_t sdu_sizeP, + mem_block_t *sdu_pP, + const uint32_t *const sourceL2Id, + const uint32_t *const destinationL2Id + ) { int rnti = ctxt_pP->rnti; nr_rlc_ue_t *ue; @@ -521,7 +521,7 @@ rb_found: exit(1); } memcpy(memblock->data, buf, size); - if (!pdcp_data_ind(&ctx, is_srb, 0, rb_id, size, memblock)) { + if (!pdcp_data_ind(&ctx, is_srb, 0, rb_id, size, memblock, NULL, NULL)) { LOG_E(RLC, "%s:%d:%s: ERROR: pdcp_data_ind failed\n", __FILE__, __LINE__, __FUNCTION__); /* what to do in case of failure? for the moment: nothing */ } diff --git a/openair2/SIMULATION/NR_RRC/itti_sim.c b/openair2/SIMULATION/NR_RRC/itti_sim.c index ed063beae5..1c248b6b48 100644 --- a/openair2/SIMULATION/NR_RRC/itti_sim.c +++ b/openair2/SIMULATION/NR_RRC/itti_sim.c @@ -400,8 +400,8 @@ statis void init_pdcp(void) { pdcp_module_init(pdcp_initmask); - pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t) rlc_data_req); - pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) pdcp_data_ind); + pdcp_set_rlc_data_req_func(rlc_data_req); + pdcp_set_pdcp_data_ind_func(pdcp_data_ind); } diff --git a/openair3/ocp-gtpu/gtp_itf.h b/openair3/ocp-gtpu/gtp_itf.h index 07c23baf98..3893acf40f 100644 --- a/openair3/ocp-gtpu/gtp_itf.h +++ b/openair3/ocp-gtpu/gtp_itf.h @@ -1,5 +1,6 @@ #ifndef __GTPUNEW_ITF_H__ #define __GTPUNEW_ITF_H__ + #define GTPNOK -1 # define GTPU_HEADER_OVERHEAD_MAX 64 @@ -31,7 +32,7 @@ typedef boolean_t (*gtpCallback)( const pdcp_transmission_mode_t modeP, const uint32_t *sourceL2Id, const uint32_t *destinationL2Id); - + typedef struct openAddr_s { char originHost[HOST_NAME_MAX]; char originService[HOST_NAME_MAX]; diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index c3cc9699bf..a20a377ea5 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -496,13 +496,13 @@ static void init_pdcp(void) { pdcp_module_init(pdcp_initmask); if (NODE_IS_CU(RC.rrc[0]->node_type)) { - pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t)proto_agent_send_rlc_data_req); + pdcp_set_rlc_data_req_func(cu_send_to_du); } else { - pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t) rlc_data_req); - pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) pdcp_data_ind); + pdcp_set_rlc_data_req_func(rlc_data_req); + pdcp_set_pdcp_data_ind_func(pdcp_data_ind); } } else { - pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) proto_agent_send_pdcp_data_ind); + pdcp_set_pdcp_data_ind_func(proto_agent_send_pdcp_data_ind); } } diff --git a/targets/RT/USER/lte-uesoftmodem.c b/targets/RT/USER/lte-uesoftmodem.c index e6aa74f39e..2797a69514 100644 --- a/targets/RT/USER/lte-uesoftmodem.c +++ b/targets/RT/USER/lte-uesoftmodem.c @@ -194,7 +194,7 @@ uint8_t abstraction_flag=0; // needed for pdcp.c RAN_CONTEXT_t RC; - +instance_t CUuniqInstance=0; /* forward declarations */ void set_default_frame_parms(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]); @@ -535,8 +535,8 @@ static void init_pdcp(void) { pdcp_initmask = pdcp_initmask | UE_NAS_USE_TUN_BIT; pdcp_module_init(pdcp_initmask); - pdcp_set_rlc_data_req_func((send_rlc_data_req_func_t) rlc_data_req); - pdcp_set_pdcp_data_ind_func((pdcp_data_ind_func_t) pdcp_data_ind); + pdcp_set_rlc_data_req_func(rlc_data_req); + pdcp_set_pdcp_data_ind_func(pdcp_data_ind); } // Stupid function addition because UE itti messages queues definition is common with eNB From 32ebb876f48c920967896fadc3f23a989144e4dc Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Wed, 22 Sep 2021 10:52:38 +0200 Subject: [PATCH 075/110] F1-U in gtp-U LTE case, working --- openair2/F1AP/f1ap_cu_ue_context_management.c | 4 ++-- openair2/F1AP/f1ap_du_ue_context_management.c | 12 +++++++++--- openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 8 ++++++-- openair2/LAYER2/rlc_v2/rlc_oai_api.c | 9 ++++++++- openair3/ocp-gtpu/gtp_itf.cpp | 4 ++-- 5 files changed, 27 insertions(+), 10 deletions(-) diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 15a0e39cca..5030e84e35 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -522,8 +522,8 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, 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->rnti, - f1ap_ue_context_setup_req->drbs_to_be_setup[i].drb_id-4, - f1ap_ue_context_setup_req->drbs_to_be_setup[i].drb_id-4, + f1ap_ue_context_setup_req->drbs_to_be_setup[i].drb_id, + f1ap_ue_context_setup_req->drbs_to_be_setup[i].drb_id, 0xFFFF, // We will set the right value from DU answer addr, f1ap_ue_context_setup_req->drbs_to_be_setup[i].up_dl_tnl[0].port, diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 33a40bd8ac..70556e78c7 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -55,7 +55,11 @@ boolean_t lteDURecvCb( protocol_ctxt_t *ctxt_pP, // The buffer comes from the stack in gtp-u thread, we have a make a separate buffer to enqueue in a inter-thread message queue mem_block_t *sdu=get_free_mem_block(sdu_buffer_sizeP, __func__); memcpy(sdu->data, sdu_buffer_pP, sdu_buffer_sizeP); - du_rlc_data_req(ctxt_pP,srb_flagP, false, rb_idP,muiP, confirmP, sdu_buffer_sizeP, sdu); + // weird rb id management in 4G, not fully understand (looks bad design) + // overcomplex: if i understand, on the interface DRB start at 4 because there can be SRB 0..3 + // but it would be much simpler to use absolute numbering + // instead of this "srb flag" associated to these +/-4 + du_rlc_data_req(ctxt_pP,srb_flagP, false, rb_idP-4,muiP, confirmP, sdu_buffer_sizeP, sdu); return true; } @@ -175,6 +179,7 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, addr, 2152, lteDURecvCb); + drb_p->up_dl_tnl_length++; } } } @@ -220,7 +225,6 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, ctxt.enb_flag = 1; mem_block_t *pdcp_pdu_p = get_free_mem_block(ieRRC->value.choice.RRCContainer.size, __func__); memcpy(&pdcp_pdu_p->data[0], ieRRC->value.choice.RRCContainer.buf, ieRRC->value.choice.RRCContainer.size); - /* for rfsim */ du_rlc_data_req(&ctxt, 1, 0x00, 1, 1, 0, ieRRC->value.choice.RRCContainer.size, pdcp_pdu_p); } else { LOG_E(F1AP, " RRCContainer in UEContextSetupRequestIEs size id 0\n"); @@ -229,9 +233,11 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, LOG_W(F1AP, "can't find RRCContainer in UEContextSetupRequestIEs by id %ld \n", F1AP_ProtocolIE_ID_id_RRCContainer); } - //DU_send_UE_CONTEXT_SETUP_RESPONSE(instance, f1ap_ue_context_setup_req); if (RC.nrrrc && RC.nrrrc[instance]->node_type == ngran_gNB_DU) itti_send_msg_to_task(TASK_RRC_GNB, instance, msg_p); + else + // in 4G, race conditon is to fix + DU_send_UE_CONTEXT_SETUP_RESPONSE(instance, f1ap_ue_context_setup_req); return 0; } diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index c507d83dcc..ee6fce8670 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -159,7 +159,11 @@ boolean_t cu_f1u_data_req( exit(1); } memcpy(memblock->data,sdu_buffer, sdu_buffer_size); - int ret=pdcp_data_ind(ctxt_pP,srb_flagP, false, rb_id, sdu_buffer_size, memblock, NULL, NULL); + // weird rb id management in 4G, not fully understand (looks bad design) + // overcomplex: if i understand, on the interface DRB start at 4 because there can be SRB 0..3 + // but it would be much simpler to use absolute numbering + // instead of this "srb flag" associated to these +/-4 + int ret=pdcp_data_ind(ctxt_pP,srb_flagP, false, rb_id-4, sdu_buffer_size, memblock, NULL, NULL); if (!ret) { LOG_E(RLC, "%s:%d:%s: ERROR: pdcp_data_ind failed\n", __FILE__, __LINE__, __FUNCTION__); /* what to do in case of failure? for the moment: nothing */ @@ -221,7 +225,7 @@ rlc_op_status_t cu_send_to_du(const protocol_ctxt_t *const ctxt, req->length = size; req->offset = GTPU_HEADER_OVERHEAD_MAX; req->rnti = ctxt->rnti; - req->rab_id = rb_id; + req->rab_id = rb_id+4; LOG_D(PDCP, "%s() (drb %ld) sending message to gtp size %d\n", __func__, rb_id, size); extern instance_t CUuniqInstance; diff --git a/openair2/LAYER2/rlc_v2/rlc_oai_api.c b/openair2/LAYER2/rlc_v2/rlc_oai_api.c index b31393d67f..12a8d286c0 100644 --- a/openair2/LAYER2/rlc_v2/rlc_oai_api.c +++ b/openair2/LAYER2/rlc_v2/rlc_oai_api.c @@ -1054,5 +1054,12 @@ void du_rlc_data_req(const protocol_ctxt_t *const ctxt_pP, confirm_t confirmP, sdu_size_t sdu_sizeP, mem_block_t *sdu_pP){ - + rlc_data_req (ctxt_pP, + srb_flagP, + MBMS_flagP, + rb_idP, + muiP, + confirmP, + sdu_sizeP, + sdu_pP, NULL, NULL); } diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index b90b89b21a..330e680d3e 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -171,7 +171,7 @@ static void gtpv1uSend(instance_t instance, gtpv1u_enb_tunnel_data_req_t *req, b map::iterator ptr2=ptrRnti->second.bearers.find(rab_id); if ( ptr2 == ptrRnti->second.bearers.end() ) { - LOG_E(GTPU,"sending a packet to a non existant RNTI:RAB: %x/%x\n", rnti, rab_id); + LOG_E(GTPU,"GTP-U instance: %ld sending a packet to a non existant RNTI:RAB: %x/%x\n", instance, rnti, rab_id); pthread_mutex_unlock(&globGtp.gtp_lock); return; } @@ -253,7 +253,7 @@ static void gtpv1uEndTunnel(instance_t instance, gtpv1u_enb_tunnel_data_req_t *r map::iterator ptr2=ptrRnti->second.bearers.find(rab_id); if ( ptr2 == ptrRnti->second.bearers.end() ) { - LOG_E(GTPU,"sending a packet to a non existant RNTI:RAB: %x/%x\n", rnti, rab_id); + LOG_E(GTPU,"GTP-U instance: %ld sending a packet to a non existant RNTI:RAB: %x/%x\n", instance, rnti, rab_id); pthread_mutex_unlock(&globGtp.gtp_lock); return; } From 8c55ccc9b74f97c418bf84ab5a92ca7707618c84 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Wed, 22 Sep 2021 17:09:24 +0200 Subject: [PATCH 076/110] Fix a critical bug introduced by F1-U in 4G --- openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 2 +- openair2/LAYER2/rlc_v2/rlc_oai_api.c | 48 +++++++++++++++------------- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index ee6fce8670..8d8b734b44 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -1546,7 +1546,7 @@ void pdcp_add_UE(const protocol_ctxt_t *const ctxt_pP) { pdcp_enb[ctxt_pP->module_id].rnti[i]=ctxt_pP->rnti; pdcp_enb[ctxt_pP->module_id].uid[i]=i; pdcp_enb[ctxt_pP->module_id].num_ues++; - printf("add new uid is %d %x\n\n", i, ctxt_pP->rnti); + LOG_I(PDCP,"add new uid is %d %x\n", i, ctxt_pP->rnti); pdcp_init_stats_UE(ctxt_pP->module_id, i); // ret=1; break; diff --git a/openair2/LAYER2/rlc_v2/rlc_oai_api.c b/openair2/LAYER2/rlc_v2/rlc_oai_api.c index 12a8d286c0..16c3db0cae 100644 --- a/openair2/LAYER2/rlc_v2/rlc_oai_api.c +++ b/openair2/LAYER2/rlc_v2/rlc_oai_api.c @@ -418,29 +418,31 @@ rb_found: AssertFatal(type != ngran_eNB_CU && type != ngran_ng_eNB_CU && type != ngran_gNB_CU, "Can't be CU, bad node type %d\n", type); - if (NODE_IS_DU(type) && is_srb == 1) { - MessageDef *msg = itti_alloc_new_message_sized(TASK_RLC_ENB, 0, F1AP_UL_RRC_MESSAGE, sizeof(*msg) + size); - F1AP_UL_RRC_MESSAGE(msg).rrc_container = (uint8_t*)(msg+1); - memcpy(F1AP_UL_RRC_MESSAGE(msg).rrc_container, buf, size); - F1AP_UL_RRC_MESSAGE(msg).rnti = ue->rnti; - F1AP_UL_RRC_MESSAGE(msg).srb_id = rb_id; - F1AP_UL_RRC_MESSAGE(msg).rrc_container_length = size; - itti_send_msg_to_task(TASK_DU_F1, ENB_MODULE_ID_TO_INSTANCE(0 /*ctxt_pP->module_id*/), msg); - return; - } else { - // Fixme: very dirty workaround of incomplete F1-U implementation - instance_t DUuniqInstance=0; - MessageDef *msg = itti_alloc_new_message(TASK_RLC_ENB, 0, GTPV1U_ENB_TUNNEL_DATA_REQ); - gtpv1u_enb_tunnel_data_req_t *req=>PV1U_ENB_TUNNEL_DATA_REQ(msg); - req->buffer=malloc(size); - memcpy(req->buffer,buf,size); - req->length=size; - req->offset=0; - req->rnti=ue->rnti; - req->rab_id=rb_id+4; - LOG_D(RLC, "Received uplink user-plane traffic at RLC-DU to be sent to the CU, size %d \n", size); - itti_send_msg_to_task(OCP_GTPV1_U, DUuniqInstance, msg); - return; + if (NODE_IS_DU(type)) { + if (is_srb == 1) { + MessageDef *msg = itti_alloc_new_message_sized(TASK_RLC_ENB, 0, F1AP_UL_RRC_MESSAGE, sizeof(*msg) + size); + F1AP_UL_RRC_MESSAGE(msg).rrc_container = (uint8_t*)(msg+1); + memcpy(F1AP_UL_RRC_MESSAGE(msg).rrc_container, buf, size); + F1AP_UL_RRC_MESSAGE(msg).rnti = ue->rnti; + F1AP_UL_RRC_MESSAGE(msg).srb_id = rb_id; + F1AP_UL_RRC_MESSAGE(msg).rrc_container_length = size; + itti_send_msg_to_task(TASK_DU_F1, ENB_MODULE_ID_TO_INSTANCE(0 /*ctxt_pP->module_id*/), msg); + return; + } else { + // Fixme: very dirty workaround of incomplete F1-U implementation + instance_t DUuniqInstance=0; + MessageDef *msg = itti_alloc_new_message(TASK_RLC_ENB, 0, GTPV1U_ENB_TUNNEL_DATA_REQ); + gtpv1u_enb_tunnel_data_req_t *req=>PV1U_ENB_TUNNEL_DATA_REQ(msg); + req->buffer=malloc(size); + memcpy(req->buffer,buf,size); + req->length=size; + req->offset=0; + req->rnti=ue->rnti; + req->rab_id=rb_id+4; + LOG_D(RLC, "Received uplink user-plane traffic at RLC-DU to be sent to the CU, size %d \n", size); + itti_send_msg_to_task(OCP_GTPV1_U, DUuniqInstance, msg); + return; + } } } From 9fa353b7196981b64f322636312a9bafcf245aa5 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Thu, 23 Sep 2021 13:30:46 +0200 Subject: [PATCH 077/110] fix(ci): better handling of logs Signed-off-by: Raphael Defosseux --- ci-scripts/cls_containerize.py | 18 ++++++++++++------ ci-scripts/xml_files/container_5g_f1_rfsim.xml | 4 ++-- .../xml_files/container_5g_f1_rfsim_down.xml | 2 +- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index 3e65f83e06..6cf3e95db7 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -606,6 +606,8 @@ class Containerize(): def UndeployGenObject(self, HTML): self.exitStatus = 0 + ymlPath = self.yamlPath[0].split('/') + logPath = '../cmake_targets/log/' + ymlPath[1] if (self.ranAllowMerge): cmd = 'cd ' + self.yamlPath[0] + ' && sed -e "s@develop@ci-temp@" docker-compose.y*ml > docker-compose-ci.yml' @@ -633,7 +635,7 @@ class Containerize(): logging.debug(cmd) deployStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=10) if anyLogs: - cmd = 'mkdir -p ../cmake_targets/log && mv ' + self.yamlPath[0] + '/*.log ../cmake_targets/log' + cmd = 'mkdir -p '+ logPath + ' && mv ' + self.yamlPath[0] + '/*.log ' + logPath logging.debug(cmd) deployStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=10) @@ -653,10 +655,12 @@ class Containerize(): def PingFromContainer(self, HTML): self.exitStatus = 0 - cmd = 'mkdir -p ../cmake_targets/log' + ymlPath = self.yamlPath[0].split('/') + logPath = '../cmake_targets/log/' + ymlPath[1] + cmd = 'mkdir -p ' + logPath deployStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=10) - cmd = 'docker exec ' + self.pingContName + ' /bin/bash -c "ping ' + self.pingOptions + '" 2>&1 | tee ../cmake_targets/log/ping_' + HTML.testCase_id + '.log' + cmd = 'docker exec ' + self.pingContName + ' /bin/bash -c "ping ' + self.pingOptions + '" 2>&1 | tee ' + logPath + '/ping_' + HTML.testCase_id + '.log' logging.debug(cmd) deployStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=100) @@ -718,7 +722,9 @@ class Containerize(): def IperfFromContainer(self, HTML): self.exitStatus = 0 - cmd = 'mkdir -p ../cmake_targets/log' + ymlPath = self.yamlPath[0].split('/') + logPath = '../cmake_targets/log/' + ymlPath[1] + cmd = 'mkdir -p ' + logPath logStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=10) # Start the server process @@ -728,7 +734,7 @@ class Containerize(): time.sleep(5) # Start the client process - cmd = 'docker exec ' + self.cliContName + ' /bin/bash -c "iperf ' + self.cliOptions + '" 2>&1 | tee ../cmake_targets/log/iperf_client_' + HTML.testCase_id + '.log' + cmd = 'docker exec ' + self.cliContName + ' /bin/bash -c "iperf ' + self.cliOptions + '" 2>&1 | tee ' + logPath + '/iperf_client_' + HTML.testCase_id + '.log' logging.debug(cmd) clientStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=100) @@ -737,7 +743,7 @@ class Containerize(): logging.debug(cmd) serverStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=10) time.sleep(5) - cmd = 'docker cp ' + self.svrContName + ':/tmp/iperf_server.log ../cmake_targets/log/iperf_server_' + HTML.testCase_id + '.log' + cmd = 'docker cp ' + self.svrContName + ':/tmp/iperf_server.log '+ logPath + '/iperf_server_' + HTML.testCase_id + '.log' logging.debug(cmd) serverStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=10) diff --git a/ci-scripts/xml_files/container_5g_f1_rfsim.xml b/ci-scripts/xml_files/container_5g_f1_rfsim.xml index 30a1eb98d0..36591cbaea 100644 --- a/ci-scripts/xml_files/container_5g_f1_rfsim.xml +++ b/ci-scripts/xml_files/container_5g_f1_rfsim.xml @@ -21,8 +21,8 @@ --> - rfsim-5gnr - Testing 5G NR RF sim in containers + rfsim-5gnr-f1 + Testing 5G NR RF sim in containers (CU/DU) wrench 100021 diff --git a/ci-scripts/xml_files/container_5g_f1_rfsim_down.xml b/ci-scripts/xml_files/container_5g_f1_rfsim_down.xml index fe24247bc4..340bb9d06e 100644 --- a/ci-scripts/xml_files/container_5g_f1_rfsim_down.xml +++ b/ci-scripts/xml_files/container_5g_f1_rfsim_down.xml @@ -21,7 +21,7 @@ --> - rfsim-5gnr-down + rfsim-5gnr-down-f1 CleanUp 5G RF trash From 5e0c05dd618c395fcc25b5d1099a35baa40fa617 Mon Sep 17 00:00:00 2001 From: matzakos Date: Thu, 23 Sep 2021 17:11:09 +0200 Subject: [PATCH 078/110] Remove a hardcoding of RRC instance --- openair2/RRC/NR/rrc_gNB.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 8fd2be14f4..e240c9d269 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -1374,10 +1374,10 @@ rrc_gNB_process_RRCReconfigurationComplete( req->gNB_CU_ue_id = 0; req->gNB_DU_ue_id = 0; req->rnti = ue_context_pP->ue_context.rnti; - req->mcc = RC.nrrrc[0]->configuration.mcc[0]; - req->mnc = RC.nrrrc[0]->configuration.mnc[0]; - req->mnc_digit_length = RC.nrrrc[0]->configuration.mnc_digit_length[0]; - req->nr_cellid = RC.nrrrc[0]->nr_cellid; + req->mcc = rrc->configuration.mcc[0]; + req->mnc = rrc->configuration.mnc[0]; + req->mnc_digit_length = rrc->configuration.mnc_digit_length[0]; + req->nr_cellid = rrc->nr_cellid; if(SRB_configList!=NULL){ req->srbs_to_be_setup = malloc(SRB_configList->list.count*sizeof(f1ap_srb_to_be_setup_t)); req->srbs_to_be_setup_length = SRB_configList->list.count; From fefeb1694e1ac2fbe19defdaa89abfb2f4ac4d35 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Tue, 28 Sep 2021 10:52:21 +0200 Subject: [PATCH 079/110] fix(ci): proper tab names for scenarios Signed-off-by: Raphael Defosseux --- ci-scripts/xml_files/container_4g_rfsim.xml | 2 +- ci-scripts/xml_files/container_4g_rfsim_down.xml | 2 +- ci-scripts/xml_files/container_5g_f1_rfsim.xml | 2 +- ci-scripts/xml_files/container_5g_f1_rfsim_down.xml | 2 +- ci-scripts/xml_files/container_5g_rfsim.xml | 2 +- ci-scripts/xml_files/container_5g_rfsim_down.xml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ci-scripts/xml_files/container_4g_rfsim.xml b/ci-scripts/xml_files/container_4g_rfsim.xml index 5430b2b056..ab6422b86d 100644 --- a/ci-scripts/xml_files/container_4g_rfsim.xml +++ b/ci-scripts/xml_files/container_4g_rfsim.xml @@ -22,7 +22,7 @@ --> rfsim-4glte - Testing 4G LTE RF sim in containers + Testing 4G LTE RF sim - Monolithic eNB wrench 100011 diff --git a/ci-scripts/xml_files/container_4g_rfsim_down.xml b/ci-scripts/xml_files/container_4g_rfsim_down.xml index dee516d924..651447a9ca 100644 --- a/ci-scripts/xml_files/container_4g_rfsim_down.xml +++ b/ci-scripts/xml_files/container_4g_rfsim_down.xml @@ -22,7 +22,7 @@ --> rfsim-4glte-down - CleanUp 4G RF + CleanUp 4G RF - Monolithic eNB trash 100011 diff --git a/ci-scripts/xml_files/container_5g_f1_rfsim.xml b/ci-scripts/xml_files/container_5g_f1_rfsim.xml index 36591cbaea..400cd86fcd 100644 --- a/ci-scripts/xml_files/container_5g_f1_rfsim.xml +++ b/ci-scripts/xml_files/container_5g_f1_rfsim.xml @@ -22,7 +22,7 @@ --> rfsim-5gnr-f1 - Testing 5G NR RF sim in containers (CU/DU) + Testing 5G NR RF sim in containers - CU-DU F1 split wrench 100021 diff --git a/ci-scripts/xml_files/container_5g_f1_rfsim_down.xml b/ci-scripts/xml_files/container_5g_f1_rfsim_down.xml index 340bb9d06e..ac3f7347ba 100644 --- a/ci-scripts/xml_files/container_5g_f1_rfsim_down.xml +++ b/ci-scripts/xml_files/container_5g_f1_rfsim_down.xml @@ -22,7 +22,7 @@ --> rfsim-5gnr-down-f1 - CleanUp 5G RF + CleanUp 5G RF - CU-DU F1 split trash 100022 diff --git a/ci-scripts/xml_files/container_5g_rfsim.xml b/ci-scripts/xml_files/container_5g_rfsim.xml index 660cd7cde8..31d7c1429b 100644 --- a/ci-scripts/xml_files/container_5g_rfsim.xml +++ b/ci-scripts/xml_files/container_5g_rfsim.xml @@ -22,7 +22,7 @@ --> rfsim-5gnr - Testing 5G NR RF sim in containers + Testing 5G NR RF sim - Monolithic gNB wrench 100001 diff --git a/ci-scripts/xml_files/container_5g_rfsim_down.xml b/ci-scripts/xml_files/container_5g_rfsim_down.xml index 57b0f67a21..9acc3f85a1 100644 --- a/ci-scripts/xml_files/container_5g_rfsim_down.xml +++ b/ci-scripts/xml_files/container_5g_rfsim_down.xml @@ -22,7 +22,7 @@ --> rfsim-5gnr-down - CleanUp 5G RF + CleanUp 5G RF - Monolithic gNB trash 100002 From c739058c5b77fd5e087f8f4a0ada33b34e75ccce Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Tue, 28 Sep 2021 11:38:59 +0200 Subject: [PATCH 080/110] enhanced macros for asn1c --- openair2/F1AP/f1ap_common.h | 5 +- openair2/F1AP/f1ap_cu_interface_management.c | 16 +-- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 2 +- openair2/F1AP/f1ap_cu_ue_context_management.c | 100 ++++++++---------- openair2/F1AP/f1ap_du_interface_management.c | 32 +++--- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 4 +- openair2/F1AP/f1ap_du_ue_context_management.c | 44 ++++---- openair2/RRC/LTE/MESSAGES/asn1_msg.h | 8 ++ openair2/RRC/NR/MESSAGES/asn1_msg.c | 9 ++ openair2/RRC/NR/MESSAGES/asn1_msg.h | 9 ++ 10 files changed, 118 insertions(+), 111 deletions(-) diff --git a/openair2/F1AP/f1ap_common.h b/openair2/F1AP/f1ap_common.h index 5fd3c486c8..18b8f18a6d 100644 --- a/openair2/F1AP/f1ap_common.h +++ b/openair2/F1AP/f1ap_common.h @@ -38,6 +38,7 @@ #define F1AP_COMMON_H_ #include "openairinterface5g_limits.h" +#include #define F1AP_UE_IDENTIFIER_NUMBER 3 #define F1AP_TRANSACTION_IDENTIFIER_NUMBER 3 @@ -479,10 +480,6 @@ static inline f1ap_setup_req_t *f1ap_req(F1_t isCu, instance_t instanceP) { return &getCxt(isCu, instanceP)->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 diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index f955f4b758..6d63394f8a 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -241,7 +241,7 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance, /* Create */ /* 0. Message Type */ pdu.present = F1AP_F1AP_PDU_PR_successfulOutcome; - asn1cCalloc(pdu.choice.successfulOutcome, F1AP_SuccessfulOutcome_t, tmp); + asn1cCalloc(pdu.choice.successfulOutcome, tmp); tmp->procedureCode = F1AP_ProcedureCode_id_F1Setup; tmp->criticality = F1AP_Criticality_reject; tmp->value.present = F1AP_SuccessfulOutcome__value_PR_F1SetupResponse; @@ -345,7 +345,7 @@ int CU_send_F1_SETUP_FAILURE(instance_t instance) { uint32_t len=0; /* Create */ /* 0. Message Type */ - asn1cCalloc(pdu.choice.unsuccessfulOutcome, F1AP_UnsuccessfulOutcome_t, UnsuccessfulOutcome); + asn1cCalloc(pdu.choice.unsuccessfulOutcome, UnsuccessfulOutcome); pdu.present = F1AP_F1AP_PDU_PR_unsuccessfulOutcome; UnsuccessfulOutcome->procedureCode = F1AP_ProcedureCode_id_F1Setup; UnsuccessfulOutcome->criticality = F1AP_Criticality_reject; @@ -385,13 +385,13 @@ int CU_send_F1_SETUP_FAILURE(instance_t instance) { ie4->criticality = F1AP_Criticality_ignore; ie4->value.present = F1AP_F1SetupFailureIEs__value_PR_CriticalityDiagnostics; asn1cCallocOne(ie4->value.choice.CriticalityDiagnostics.procedureCode, - F1AP_ProcedureCode_t, F1AP_ProcedureCode_id_UEContextSetup); + F1AP_ProcedureCode_id_UEContextSetup); asn1cCallocOne(ie4->value.choice.CriticalityDiagnostics.triggeringMessage, - F1AP_TriggeringMessage_t, F1AP_TriggeringMessage_initiating_message); + F1AP_TriggeringMessage_initiating_message); asn1cCallocOne(ie4->value.choice.CriticalityDiagnostics.procedureCriticality, - F1AP_Criticality_t, F1AP_Criticality_reject); + F1AP_Criticality_reject); asn1cCallocOne(ie4->value.choice.CriticalityDiagnostics.transactionID, - F1AP_TransactionID_t, 0); + 0); } /* encode */ @@ -438,7 +438,7 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu /* Create */ /* 0. Message Type */ pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; - asn1cCalloc(pdu.choice.initiatingMessage, F1AP_InitiatingMessage_t, initMsg); + asn1cCalloc(pdu.choice.initiatingMessage, initMsg); initMsg->procedureCode = F1AP_ProcedureCode_id_gNBCUConfigurationUpdate; initMsg->criticality = F1AP_Criticality_reject; initMsg->value.present = F1AP_InitiatingMessage__value_PR_GNBCUConfigurationUpdate; @@ -472,7 +472,7 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu addnRCGI(cells_to_be_activated_list_item->nRCGI, f1ap_gnb_cu_configuration_update->cells_to_activate+i); // optional // -nRPCI - asn1cCalloc(cells_to_be_activated_list_item->nRPCI, F1AP_NRPCI_t, tmp); + asn1cCalloc(cells_to_be_activated_list_item->nRPCI, tmp); *tmp = f1ap_gnb_cu_configuration_update->cells_to_activate[i].nrpci; // int 0..1007 // optional // 3.1.2 gNB-CUSystem Information diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index e725272b09..50490d2897 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -148,7 +148,7 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance, /* Create */ /* 0. Message Type */ pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; - asn1cCalloc(pdu.choice.initiatingMessage, F1AP_InitiatingMessage_t, tmp); + asn1cCalloc(pdu.choice.initiatingMessage, tmp); tmp->procedureCode = F1AP_ProcedureCode_id_DLRRCMessageTransfer; tmp->criticality = F1AP_Criticality_ignore; tmp->value.present = F1AP_InitiatingMessage__value_PR_DLRRCMessageTransfer; diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 5030e84e35..f54218a3b8 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -46,28 +46,26 @@ #include static void setQos(F1AP_NonDynamic5QIDescriptor_t *toFill) { - asn1cCalloc(toFill,F1AP_NonDynamic5QIDescriptor_t, tmp); + asn1cCalloc(toFill, tmp); /* fiveQI */ tmp->fiveQI = 1L; /* OPTIONAL */ /* qoSPriorityLevel */ if (0) { - asn1cCallocOne(toFill->qoSPriorityLevel, long, 1L); + asn1cCallocOne(toFill->qoSPriorityLevel, 1L); } /* OPTIONAL */ /* averagingWindow */ if (0) { - asn1cCallocOne(toFill->averagingWindow, - F1AP_AveragingWindow_t, 1L); + asn1cCallocOne(toFill->averagingWindow, 1L); } /* OPTIONAL */ /* maxDataBurstVolume */ if (0) { - asn1cCallocOne(toFill->maxDataBurstVolume, - F1AP_MaxDataBurstVolume_t, 1L); + asn1cCallocOne(toFill->maxDataBurstVolume, 1L); } } @@ -77,7 +75,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* Create */ /* 0. Message Type */ pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; - asn1cCalloc(pdu.choice.initiatingMessage, F1AP_InitiatingMessage_t, tmp); + asn1cCalloc(pdu.choice.initiatingMessage, tmp); tmp->procedureCode = F1AP_ProcedureCode_id_UEContextSetup; tmp->criticality = F1AP_Criticality_reject; tmp->value.present = F1AP_InitiatingMessage__value_PR_UEContextSetupRequest; @@ -136,15 +134,15 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* 6.1 cG_ConfigInfo */ if (0) { const char cG_ConfigInfoStr[]="asdsa1d32sa1d31asd31as"; - asn1cCalloc(ie6->value.choice.CUtoDURRCInformation.cG_ConfigInfo, F1AP_CG_ConfigInfo_t, cG_ConfigInfo); + asn1cCalloc(ie6->value.choice.CUtoDURRCInformation.cG_ConfigInfo, cG_ConfigInfo); OCTET_STRING_fromBuf(cG_ConfigInfo, cG_ConfigInfoStr, strlen( cG_ConfigInfoStr )) ; /* optional */ /* 6.2 uE_CapabilityRAT_ContainerList */ - asn1cCalloc(ie6->value.choice.CUtoDURRCInformation.uE_CapabilityRAT_ContainerList, F1AP_UE_CapabilityRAT_ContainerList_t, uE_CapabilityRAT_ContainerList ); + asn1cCalloc(ie6->value.choice.CUtoDURRCInformation.uE_CapabilityRAT_ContainerList, uE_CapabilityRAT_ContainerList ); OCTET_STRING_fromBuf(uE_CapabilityRAT_ContainerList, cG_ConfigInfoStr, strlen( cG_ConfigInfoStr )) ; /* optional */ /* 6.3 measConfig */ - asn1cCalloc(ie6->value.choice.CUtoDURRCInformation.measConfig, F1AP_MeasConfig_t, measConfig); + asn1cCalloc(ie6->value.choice.CUtoDURRCInformation.measConfig, measConfig); OCTET_STRING_fromBuf(measConfig, cG_ConfigInfoStr, strlen( cG_ConfigInfoStr )) ; } @@ -183,14 +181,14 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* 8.2 shortDRXCycleLength */ if (0) { asn1cCallocOne(ie6->value.choice.DRXCycle.shortDRXCycleLength, - F1AP_ShortDRXCycleLength_t, F1AP_ShortDRXCycleLength_ms2); // enum + F1AP_ShortDRXCycleLength_ms2); // enum } /* optional */ /* 8.3 shortDRXCycleTimer */ if (0) { asn1cCallocOne(ie8->value.choice.DRXCycle.shortDRXCycleTimer, - F1AP_ShortDRXCycleTimer_t, 123L); + 123L); } } @@ -232,7 +230,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* 10.1.3 sCellULConfigured*/ if (0) { asn1cCallocOne(scell_toBeSetup_item->sCellULConfigured, - F1AP_CellULConfigured_t, F1AP_CellULConfigured_ul_and_sul); // enum + F1AP_CellULConfigured_ul_and_sul); // enum } } @@ -257,7 +255,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* 11.1.2 duplicationIndication */ //if (0) { asn1cCallocOne(srbs_toBeSetup_item->duplicationIndication, - F1AP_DuplicationIndication_t, F1AP_DuplicationIndication_true); // enum + F1AP_DuplicationIndication_true); // enum //} } @@ -285,7 +283,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, if (some_decide_qos) { drbs_toBeSetup_item->qoSInformation.present = F1AP_QoSInformation_PR_eUTRANQoS; /* 12.1.2.1 eUTRANQoS */ - asn1cCalloc(drbs_toBeSetup_item->qoSInformation.choice.eUTRANQoS, F1AP_EUTRANQoS_t, eUTRANQoS); + asn1cCalloc(drbs_toBeSetup_item->qoSInformation.choice.eUTRANQoS, eUTRANQoS); /* 12.1.2.1.1 qCI */ eUTRANQoS->qCI = 254L; /* 12.1.2.1.2 allocationAndRetentionPriority */ @@ -327,7 +325,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, setQos(DRB_Information->dRB_QoS.qoS_Characteristics.choice.non_Dynamic_5QI); } else { DRB_Information->dRB_QoS.qoS_Characteristics.present = F1AP_QoS_Characteristics_PR_dynamic_5QI; - asn1cCalloc(DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI, F1AP_Dynamic5QIDescriptor_t, tmp); + asn1cCalloc(DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI, tmp); /* qoSPriorityLevel */ tmp->qoSPriorityLevel = 1L; /* packetDelayBudget */ @@ -339,22 +337,19 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* OPTIONAL */ /* delayCritical */ if (0) { - asn1cCallocOne(DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->delayCritical, - long, 1L); + asn1cCallocOne(DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->delayCritical, 1L); } /* OPTIONAL */ /* averagingWindow */ if (0) { - asn1cCallocOne(DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->averagingWindow, - F1AP_AveragingWindow_t, 1L); + asn1cCallocOne(DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->averagingWindow, 1L); } /* OPTIONAL */ /* maxDataBurstVolume */ if (0) { - asn1cCallocOne(DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->maxDataBurstVolume, - F1AP_MaxDataBurstVolume_t, 1L); + asn1cCallocOne(DRB_Information->dRB_QoS.qoS_Characteristics.choice.dynamic_5QI->maxDataBurstVolume, 1L); } } // if some_decide_qoS_characteristics } // qoS_Characteristics @@ -368,7 +363,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* OPTIONAL */ /* gBR_QoS_Flow_Information */ if (0) { - asn1cCalloc(DRB_Information->dRB_QoS.gBR_QoS_Flow_Information, F1AP_GBR_QoSFlowInformation_t, tmp); + asn1cCalloc(DRB_Information->dRB_QoS.gBR_QoS_Flow_Information, tmp); asn_long2INTEGER(&tmp->maxFlowBitRateDownlink, 1L); asn_long2INTEGER(&tmp->maxFlowBitRateUplink, 1L); asn_long2INTEGER(&tmp->guaranteedFlowBitRateDownlink, 1L); @@ -377,23 +372,20 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* OPTIONAL */ /* maxPacketLossRateDownlink */ if (0) { - asn1cCallocOne(DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateDownlink, - F1AP_MaxPacketLossRate_t, 1L); + asn1cCallocOne(DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateDownlink, 1L); } /* OPTIONAL */ /* maxPacketLossRateUplink */ if (0) { - asn1cCallocOne(DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateUplink, - F1AP_MaxPacketLossRate_t, 1L); + asn1cCallocOne(DRB_Information->dRB_QoS.gBR_QoS_Flow_Information->maxPacketLossRateUplink, 1L); } } /* OPTIONAL */ /* reflective_QoS_Attribute */ if (0) { - asn1cCallocOne(DRB_Information->dRB_QoS.reflective_QoS_Attribute, - long, 1L); + asn1cCallocOne(DRB_Information->dRB_QoS.reflective_QoS_Attribute, 1L); } } // dRB_QoS /* 12.1.2.2 sNSSAI */ @@ -405,7 +397,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* OPTIONAL */ /* sD */ if (0) { - asn1cCalloc(DRB_Information->sNSSAI.sD, OCTET_STRING_t, tmp); + asn1cCalloc(DRB_Information->sNSSAI.sD, tmp); OCTET_STRING_fromBuf(tmp, "asdsa1d32sa1d31asd31as", strlen("asdsa1d32sa1d31asd31as")); } @@ -415,7 +407,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* 12.1.2.3 notificationControl */ if (0) { asn1cCallocOne(DRB_Information->notificationControl, - F1AP_NotificationControl_t, F1AP_NotificationControl_active); // enum + F1AP_NotificationControl_active); // enum } /* 12.1.2.4 flows_Mapped_To_DRB_List */ // BK: need verifiy @@ -437,7 +429,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, setQos(QosParams->choice.non_Dynamic_5QI); } else { QosParams->present = F1AP_QoS_Characteristics_PR_dynamic_5QI; - asn1cCalloc(QosParams->choice.dynamic_5QI, F1AP_Dynamic5QIDescriptor_t, tmp); + asn1cCalloc(QosParams->choice.dynamic_5QI, tmp); /* qoSPriorityLevel */ tmp->qoSPriorityLevel = 1L; /* packetDelayBudget */ @@ -449,21 +441,21 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* OPTIONAL */ /* delayCritical */ if (0) { - asn1cCalloc(QosParams->choice.dynamic_5QI->delayCritical, long, tmp); + asn1cCalloc(QosParams->choice.dynamic_5QI->delayCritical, tmp); *tmp = 1L; } /* OPTIONAL */ /* averagingWindow */ if (0) { - asn1cCalloc(QosParams->choice.dynamic_5QI->averagingWindow, F1AP_AveragingWindow_t, tmp); + asn1cCalloc(QosParams->choice.dynamic_5QI->averagingWindow, tmp); *tmp = 1L; } /* OPTIONAL */ /* maxDataBurstVolume */ if (0) { - asn1cCalloc(QosParams->choice.dynamic_5QI->maxDataBurstVolume, F1AP_MaxDataBurstVolume_t, tmp); + asn1cCalloc(QosParams->choice.dynamic_5QI->maxDataBurstVolume, tmp); *tmp= 1L; } } // if some_decide_qoS_characteristics @@ -478,7 +470,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* OPTIONAL */ /* gBR_QoS_Flow_Information */ if (0) { - asn1cCalloc(flows_mapped_to_drb_item->qoSFlowLevelQoSParameters.gBR_QoS_Flow_Information, F1AP_GBR_QoSFlowInformation_t, tmp); + asn1cCalloc(flows_mapped_to_drb_item->qoSFlowLevelQoSParameters.gBR_QoS_Flow_Information, tmp); asn_long2INTEGER(&tmp->maxFlowBitRateDownlink, 1L); asn_long2INTEGER(&tmp->maxFlowBitRateUplink, 1L); asn_long2INTEGER(&tmp->guaranteedFlowBitRateDownlink, 1L); @@ -487,23 +479,20 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* OPTIONAL */ /* maxPacketLossRateDownlink */ if (0) { - asn1cCalloc(flows_mapped_to_drb_item->qoSFlowLevelQoSParameters.gBR_QoS_Flow_Information->maxPacketLossRateDownlink, F1AP_MaxPacketLossRate_t, tmp); - *tmp = 1L; + asn1cCallocOne(flows_mapped_to_drb_item->qoSFlowLevelQoSParameters.gBR_QoS_Flow_Information->maxPacketLossRateDownlink, 1L); } /* OPTIONAL */ /* maxPacketLossRateUplink */ if (0) { - asn1cCalloc(flows_mapped_to_drb_item->qoSFlowLevelQoSParameters.gBR_QoS_Flow_Information->maxPacketLossRateUplink, F1AP_MaxPacketLossRate_t, tmp); - *tmp = 1L; + asn1cCallocOne(flows_mapped_to_drb_item->qoSFlowLevelQoSParameters.gBR_QoS_Flow_Information->maxPacketLossRateUplink, 1L); } } /* OPTIONAL */ /* reflective_QoS_Attribute */ if (0) { - asn1cCalloc(flows_mapped_to_drb_item->qoSFlowLevelQoSParameters.reflective_QoS_Attribute, long, tmp); - *tmp = 1L; + asn1cCallocOne(flows_mapped_to_drb_item->qoSFlowLevelQoSParameters.reflective_QoS_Attribute, 1L); } } // qoSFlowLevelQoSParameters } @@ -533,7 +522,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, F1AP_ULUPTNLInformation_ToBeSetup_Item_t, uLUPTNLInformation_ToBeSetup_Item); uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; asn1cCalloc( uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.choice.gTPTunnel, - F1AP_GTPTunnel_t, gTPTunnel); + gTPTunnel); /* 12.3.1.1.1 transportLayerAddress */ TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(f1ap_ue_context_setup_req->drbs_to_be_setup[i].up_ul_tnl[j].tl_address, &gTPTunnel->transportLayerAddress); @@ -556,14 +545,14 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* OPTIONAL */ /* 12.1.5 ULConfiguration */ if (0) { - asn1cCalloc(drbs_toBeSetup_item->uLConfiguration, F1AP_ULConfiguration_t, tmp); + asn1cCalloc(drbs_toBeSetup_item->uLConfiguration, tmp); tmp->uLUEConfiguration = F1AP_ULUEConfiguration_no_data; } /* OPTIONAL */ /* 12.1.6 duplicationActivation */ if (0) { - asn1cCalloc(drbs_toBeSetup_item->duplicationActivation, F1AP_DuplicationActivation_t, tmp); + asn1cCalloc(drbs_toBeSetup_item->duplicationActivation, tmp); *tmp = F1AP_DuplicationActivation_active; // enum } } @@ -848,7 +837,7 @@ int CU_send_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, /* Create */ /* 0. Message Type */ pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; - asn1cCalloc(pdu.choice.initiatingMessage, F1AP_InitiatingMessage_t, tmp); + asn1cCalloc(pdu.choice.initiatingMessage, tmp); tmp->procedureCode = F1AP_ProcedureCode_id_UEContextRelease; tmp->criticality = F1AP_Criticality_reject; tmp->value.present = F1AP_InitiatingMessage__value_PR_UEContextReleaseCommand; @@ -1025,7 +1014,7 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance) { /* Create */ /* 0. Message Type */ pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; - asn1cCalloc(pdu.choice.initiatingMessage, F1AP_InitiatingMessage_t, tmp); + asn1cCalloc(pdu.choice.initiatingMessage, tmp); tmp->procedureCode = F1AP_ProcedureCode_id_UEContextModification; tmp->criticality = F1AP_Criticality_reject; tmp->value.present = F1AP_InitiatingMessage__value_PR_UEContextModificationRequest; @@ -1074,13 +1063,12 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance) { ie5->value.choice.DRXCycle.longDRXCycleLength = F1AP_LongDRXCycleLength_ms10; // enum if (0) { - asn1cCalloc(ie5->value.choice.DRXCycle.shortDRXCycleLength, F1AP_ShortDRXCycleLength_t,tmp); - *tmp = F1AP_ShortDRXCycleLength_ms2; // enum + asn1cCallocOne(ie5->value.choice.DRXCycle.shortDRXCycleLength, + F1AP_ShortDRXCycleLength_ms2); // enum } if (0) { - asn1cCalloc(ie5->value.choice.DRXCycle.shortDRXCycleTimer, F1AP_ShortDRXCycleTimer_t, tmp); - *tmp = 123L; + asn1cCallocOne(ie5->value.choice.DRXCycle.shortDRXCycleTimer, 123L); } } @@ -1091,12 +1079,12 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance) { ie5->id = F1AP_ProtocolIE_ID_id_CUtoDURRCInformation; ie5->criticality = F1AP_Criticality_reject; ie5->value.present = F1AP_UEContextModificationRequestIEs__value_PR_CUtoDURRCInformation; - asn1cCalloc(ie5->value.choice.CUtoDURRCInformation.cG_ConfigInfo, F1AP_CG_ConfigInfo_t, tmp); + asn1cCalloc(ie5->value.choice.CUtoDURRCInformation.cG_ConfigInfo, tmp); /* optional */ OCTET_STRING_fromBuf(tmp, "asdsa1d32sa1d31asd31as", strlen("asdsa1d32sa1d31asd31as")); asn1cCalloc(ie5->value.choice.CUtoDURRCInformation.uE_CapabilityRAT_ContainerList, - F1AP_UE_CapabilityRAT_ContainerList_t,tmp2); + tmp2); /* optional */ OCTET_STRING_fromBuf(tmp2, "asdsa1d32sa1d31asd31as", strlen("asdsa1d32sa1d31asd31as")); @@ -1243,7 +1231,7 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance) { F1AP_ULUPTNLInformation_ToBeSetup_Item_t, uLUPTNLInformation_ToBeSetup_Item); uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; asn1cCalloc(uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.choice.gTPTunnel, - F1AP_GTPTunnel_t, gTPTunnel) + gTPTunnel) /* transportLayerAddress */ TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); /* gTP_TEID */ @@ -1281,7 +1269,7 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance) { /* dRBID */ drbs_toBeModified_item->dRBID = 30L; /* qoSInformation */ - asn1cCalloc(drbs_toBeModified_item->qoSInformation, F1AP_QoSInformation_t, tmp); + asn1cCalloc(drbs_toBeModified_item->qoSInformation, tmp); tmp->present = F1AP_QoSInformation_PR_eUTRANQoS; tmp->choice.eUTRANQoS = (F1AP_EUTRANQoS_t *)calloc(1, sizeof(F1AP_EUTRANQoS_t)); tmp->choice.eUTRANQoS->qCI = 254L; @@ -1294,7 +1282,7 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance) { F1AP_ULUPTNLInformation_ToBeSetup_Item_t, uLUPTNLInformation_ToBeSetup_Item); uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; asn1cCalloc(uLUPTNLInformation_ToBeSetup_Item->uLUPTNLInformation.choice.gTPTunnel, - F1AP_GTPTunnel_t, gTPTunnel); + gTPTunnel); TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "1204", strlen("1204")); diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index 4ee1a064f9..22a370024e 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -102,7 +102,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { /* Create */ /* 0. pdu Type */ pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; - asn1cCalloc(pdu.choice.initiatingMessage, F1AP_InitiatingMessage_t, initMsg); + asn1cCalloc(pdu.choice.initiatingMessage, initMsg); initMsg->procedureCode = F1AP_ProcedureCode_id_F1Setup; initMsg->criticality = F1AP_Criticality_reject; initMsg->value.present = F1AP_InitiatingMessage__value_PR_F1SetupRequest; @@ -159,7 +159,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { served_cell_information->nRPCI = cell->nr_pci; // int 0..1007 /* - fiveGS_TAC */ uint32_t tac=htonl(cell->tac); - asn1cCalloc(served_cell_information->fiveGS_TAC, F1AP_FiveGS_TAC_t, netOrder); + asn1cCalloc(served_cell_information->fiveGS_TAC, netOrder); OCTET_STRING_fromBuf(netOrder, ((char *)&tac)+1, 3); /* - Configured_EPS_TAC */ @@ -176,14 +176,14 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { if (f1ap_req(false, instance)->fdd_flag) { // FDD nR_Mode_Info->present = F1AP_NR_Mode_Info_PR_fDD; - asn1cCalloc(nR_Mode_Info->choice.fDD, F1AP_FDD_Info_t, fDD_Info); + asn1cCalloc(nR_Mode_Info->choice.fDD, fDD_Info); /* FDD.1 UL NRFreqInfo */ /* FDD.1.1 UL NRFreqInfo ARFCN */ fDD_Info->uL_NRFreqInfo.nRARFCN = f1ap_req(false,instance)->nr_mode_info[i].fdd.ul_nr_arfcn; // Integer /* FDD.1.2 F1AP_SUL_Information */ if(0) { // Optional - asn1cCalloc(fDD_Info->uL_NRFreqInfo.sul_Information, F1AP_SUL_Information_t, fdd_sul_info); + asn1cCalloc(fDD_Info->uL_NRFreqInfo.sul_Information, fdd_sul_info); fdd_sul_info->sUL_NRARFCN = 0; fdd_sul_info->sUL_transmission_Bandwidth.nRSCS = 0; fdd_sul_info->sUL_transmission_Bandwidth.nRNRB = 0; @@ -247,7 +247,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { fDD_Info->dL_Transmission_Bandwidth.nRNRB = to_NRNRB(f1ap_req(false,instance)->nr_mode_info[i].fdd.dl_nrb); } else { // TDD nR_Mode_Info->present = F1AP_NR_Mode_Info_PR_tDD; - asn1cCalloc(nR_Mode_Info->choice.tDD, F1AP_TDD_Info_t, tDD_Info); + asn1cCalloc(nR_Mode_Info->choice.tDD, tDD_Info); /* TDD.1 nRFreqInfo */ /* TDD.1.1 nRFreqInfo ARFCN */ tDD_Info->nRFreqInfo.nRARFCN = f1ap_req(false,instance)->nr_mode_info[i].tdd.nr_arfcn; // Integer @@ -289,7 +289,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { OCTET_STRING_fromBuf(&served_cell_information->measurementTimingConfiguration, measurementTimingConfiguration, strlen(measurementTimingConfiguration)); - asn1cCalloc(gnb_du_served_cells_item->gNB_DU_System_Information, F1AP_GNB_DU_System_Information_t, gNB_DU_System_Information); + asn1cCalloc(gnb_du_served_cells_item->gNB_DU_System_Information, gNB_DU_System_Information); /* 4.1.2 gNB-DU System Information */ OCTET_STRING_fromBuf(&gNB_DU_System_Information->mIB_message, // sept. 2018 (const char *)f1ap_req(false,instance)->mib[i], //f1ap_du_data->mib, @@ -535,7 +535,7 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, /* Create */ /* 0. Message Type */ pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; - asn1cCalloc(pdu.choice.initiatingMessage,F1AP_InitiatingMessage_t, initMsg); + asn1cCalloc(pdu.choice.initiatingMessage, initMsg); initMsg->procedureCode = F1AP_ProcedureCode_id_gNBDUConfigurationUpdate; initMsg->criticality = F1AP_Criticality_reject; initMsg->value.present = F1AP_InitiatingMessage__value_PR_GNBDUConfigurationUpdate; @@ -587,7 +587,7 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, if (f1ap_setup_req->fdd_flag) { nR_Mode_Info->present = F1AP_NR_Mode_Info_PR_fDD; /* > FDD >> FDD Info */ - asn1cCalloc(nR_Mode_Info->choice.fDD, F1AP_FDD_Info_t, fDD_Info); + asn1cCalloc(nR_Mode_Info->choice.fDD, fDD_Info); /* >>> UL NRFreqInfo */ fDD_Info->uL_NRFreqInfo.nRARFCN = 999L; asn1cSequenceAdd(fDD_Info->uL_NRFreqInfo.freqBandListNr.list, F1AP_FreqBandNrItem_t, ul_freqBandNrItem); @@ -609,7 +609,7 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, } else { // TDD nR_Mode_Info->present = F1AP_NR_Mode_Info_PR_tDD; /* > TDD >> TDD Info */ - asn1cCalloc(nR_Mode_Info->choice.tDD, F1AP_TDD_Info_t, tDD_Info); + asn1cCalloc(nR_Mode_Info->choice.tDD, tDD_Info); /* >>> ARFCN */ tDD_Info->nRFreqInfo.nRARFCN = 999L; // Integer asn1cSequenceAdd(tDD_Info->nRFreqInfo.freqBandListNr.list, F1AP_FreqBandNrItem_t, nr_freqBandNrItem); @@ -626,7 +626,7 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, measurementTimingConfiguration, strlen(measurementTimingConfiguration)); /* 2.1.2 gNB-DU System Information */ - asn1cCalloc(served_cells_to_add_item->gNB_DU_System_Information, F1AP_GNB_DU_System_Information_t, gNB_DU_System_Information); + asn1cCalloc(served_cells_to_add_item->gNB_DU_System_Information, gNB_DU_System_Information); OCTET_STRING_fromBuf(&gNB_DU_System_Information->mIB_message, // sept. 2018 "1", sizeof("1")); @@ -659,14 +659,14 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, /* - nRPCI */ served_cell_information->nRPCI = f1ap_setup_req->cell[i].nr_pci; // int 0..1007 /* - fiveGS_TAC */ - asn1cCalloc(served_cell_information->fiveGS_TAC,F1AP_FiveGS_TAC_t, tac ); + asn1cCalloc(served_cell_information->fiveGS_TAC, tac ); OCTET_STRING_fromBuf(tac, (const char *) &f1ap_setup_req->cell[i].tac, 3); /* - Configured_EPS_TAC */ if(1) { - asn1cCalloc(served_cell_information->configured_EPS_TAC, F1AP_Configured_EPS_TAC_t, tmp2); + asn1cCalloc(served_cell_information->configured_EPS_TAC, tmp2); OCTET_STRING_fromBuf(tmp2, "2", 2); @@ -680,7 +680,7 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, if (f1ap_setup_req->fdd_flag) { nR_Mode_Info->present = F1AP_NR_Mode_Info_PR_fDD; /* > FDD >> FDD Info */ - asn1cCalloc(nR_Mode_Info->choice.fDD, F1AP_FDD_Info_t, fDD_Info); + asn1cCalloc(nR_Mode_Info->choice.fDD, fDD_Info); /* >>> UL NRFreqInfo */ fDD_Info->uL_NRFreqInfo.nRARFCN = 999L; asn1cSequenceAdd(fDD_Info->uL_NRFreqInfo.freqBandListNr.list, F1AP_FreqBandNrItem_t, ul_freqBandNrItem); @@ -703,7 +703,7 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, } else { // TDD nR_Mode_Info->present = F1AP_NR_Mode_Info_PR_tDD; /* > TDD >> TDD Info */ - asn1cCalloc(nR_Mode_Info->choice.tDD, F1AP_TDD_Info_t, tDD_Info); + asn1cCalloc(nR_Mode_Info->choice.tDD, tDD_Info); /* >>> ARFCN */ tDD_Info->nRFreqInfo.nRARFCN = 999L; // Integer asn1cSequenceAdd(tDD_Info->nRFreqInfo.freqBandListNr.list, F1AP_FreqBandNrItem_t, nr_freqBandNrItem); @@ -720,7 +720,7 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, measurementTimingConfiguration, strlen(measurementTimingConfiguration)); /* 3.2.2 gNB-DU System Information */ - asn1cCalloc( served_cells_to_modify_item->gNB_DU_System_Information, F1AP_GNB_DU_System_Information_t, gNB_DU_System_Information); + asn1cCalloc( served_cells_to_modify_item->gNB_DU_System_Information, gNB_DU_System_Information); OCTET_STRING_fromBuf(&gNB_DU_System_Information->mIB_message, // sept. 2018 "1", sizeof("1")); @@ -949,7 +949,7 @@ int DU_send_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, /* Create */ /* 0. pdu Type */ pdu.present = F1AP_F1AP_PDU_PR_successfulOutcome; - asn1cCalloc(pdu.choice.successfulOutcome, F1AP_SuccessfulOutcome_t, tmp); + asn1cCalloc(pdu.choice.successfulOutcome, tmp); tmp->procedureCode = F1AP_ProcedureCode_id_gNBCUConfigurationUpdate; tmp->criticality = F1AP_Criticality_reject; tmp->value.present = F1AP_SuccessfulOutcome__value_PR_GNBCUConfigurationUpdateAcknowledge; diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index adfbff2823..c456f9e2d2 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -767,7 +767,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instanceP, /* Create */ /* 0. Message Type */ pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; - asn1cCalloc(pdu.choice.initiatingMessage, F1AP_InitiatingMessage_t, tmp); + asn1cCalloc(pdu.choice.initiatingMessage, tmp); tmp->procedureCode = F1AP_ProcedureCode_id_InitialULRRCMessageTransfer; tmp->criticality = F1AP_Criticality_ignore; tmp->value.present = F1AP_InitiatingMessage__value_PR_InitialULRRCMessageTransfer; @@ -841,7 +841,7 @@ int DU_send_UL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, /* Create */ /* 0. Message Type */ pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; - asn1cCalloc(pdu.choice.initiatingMessage, F1AP_InitiatingMessage_t, tmp); + asn1cCalloc(pdu.choice.initiatingMessage, tmp); tmp->procedureCode = F1AP_ProcedureCode_id_ULRRCMessageTransfer; tmp->criticality = F1AP_Criticality_ignore; tmp->value.present = F1AP_InitiatingMessage__value_PR_ULRRCMessageTransfer; diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 70556e78c7..5580741a63 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -249,7 +249,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup /* Create */ /* 0. Message Type */ pdu.present = F1AP_F1AP_PDU_PR_successfulOutcome; - asn1cCalloc(pdu.choice.successfulOutcome, F1AP_SuccessfulOutcome_t,tmp); + asn1cCalloc(pdu.choice.successfulOutcome, tmp); tmp->procedureCode = F1AP_ProcedureCode_id_UEContextSetup; tmp->criticality = F1AP_Criticality_reject; tmp->value.present = F1AP_SuccessfulOutcome__value_PR_UEContextSetupResponse; @@ -284,16 +284,14 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup /* OPTIONAL */ /* measGapConfig */ if (0) { - asn1cCalloc(ie3->value.choice.DUtoCURRCInformation.measGapConfig, - F1AP_MeasGapConfig_t, tmp); + asn1cCalloc(ie3->value.choice.DUtoCURRCInformation.measGapConfig, tmp); OCTET_STRING_fromBuf(tmp, "asdsa", strlen("asdsa")); } /* OPTIONAL */ /* requestedP_MaxFR1 */ if (0) { - asn1cCalloc(ie3->value.choice.DUtoCURRCInformation.requestedP_MaxFR1, - OCTET_STRING_t, tmp); + asn1cCalloc(ie3->value.choice.DUtoCURRCInformation.requestedP_MaxFR1, tmp); OCTET_STRING_fromBuf(tmp, "asdsa", strlen("asdsa")); } } @@ -362,8 +360,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup F1AP_DLUPTNLInformation_ToBeSetup_Item_t, dLUPTNLInformation_ToBeSetup_Item); dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; /* gTPTunnel */ - asn1cCalloc(dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.choice.gTPTunnel, - F1AP_GTPTunnel_t, gTPTunnel); + 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, @@ -396,7 +393,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup /* sRBID */ srbs_failedToBeSetup_item->sRBID = 13L; /* cause */ - asn1cCalloc(srbs_failedToBeSetup_item->cause, F1AP_Cause_t,tmp); + asn1cCalloc(srbs_failedToBeSetup_item->cause, tmp); // dummy value tmp->present = F1AP_Cause_PR_radioNetwork; @@ -445,7 +442,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup /* dRBID */ drbs_failedToBeSetup_item->dRBID = 14; /* cause */ - asn1cCalloc(drbs_failedToBeSetup_item->cause, F1AP_Cause_t,tmp); + asn1cCalloc(drbs_failedToBeSetup_item->cause,tmp); // dummy value tmp->present = F1AP_Cause_PR_radioNetwork; @@ -493,7 +490,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup /* sCell_ID */ addnRCGI(sCell_FailedtoSetup_item->sCell_ID,f1ap_req(false, instance)->cell+i); /* cause */ - asn1cCalloc(sCell_FailedtoSetup_item->cause, F1AP_Cause_t, tmp); + asn1cCalloc(sCell_FailedtoSetup_item->cause, tmp); // dummy value tmp->present = F1AP_Cause_PR_radioNetwork; @@ -559,13 +556,13 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup ie12->criticality = F1AP_Criticality_ignore; ie12->value.present = F1AP_UEContextSetupResponseIEs__value_PR_CriticalityDiagnostics; asn1cCallocOne(ie12->value.choice.CriticalityDiagnostics.procedureCode, - F1AP_ProcedureCode_t, F1AP_ProcedureCode_id_UEContextSetup); + F1AP_ProcedureCode_id_UEContextSetup); asn1cCallocOne(ie12->value.choice.CriticalityDiagnostics.triggeringMessage, - F1AP_TriggeringMessage_t, F1AP_TriggeringMessage_initiating_message); + F1AP_TriggeringMessage_initiating_message); asn1cCallocOne(ie12->value.choice.CriticalityDiagnostics.procedureCriticality, - F1AP_Criticality_t, F1AP_Criticality_reject); + F1AP_Criticality_reject); asn1cCallocOne(ie12->value.choice.CriticalityDiagnostics.transactionID, - F1AP_TransactionID_t, 0); + 0); } /* encode */ @@ -592,7 +589,7 @@ int DU_send_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, /* Create */ /* 0. Message Type */ pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; - asn1cCalloc(pdu.choice.initiatingMessage, F1AP_InitiatingMessage_t, tmp); + asn1cCalloc(pdu.choice.initiatingMessage, tmp); tmp->procedureCode = F1AP_ProcedureCode_id_UEContextReleaseRequest; tmp->criticality = F1AP_Criticality_reject; tmp->value.present = F1AP_InitiatingMessage__value_PR_UEContextReleaseRequest; @@ -806,7 +803,7 @@ int DU_send_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, /* Create */ /* 0. Message Type */ pdu.present = F1AP_F1AP_PDU_PR_successfulOutcome; - asn1cCalloc(pdu.choice.successfulOutcome, F1AP_SuccessfulOutcome_t, tmp); + asn1cCalloc(pdu.choice.successfulOutcome, tmp); tmp->procedureCode = F1AP_ProcedureCode_id_UEContextRelease; tmp->criticality = F1AP_Criticality_reject; tmp->value.present = F1AP_SuccessfulOutcome__value_PR_UEContextReleaseComplete; @@ -904,7 +901,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance) { /* Create */ /* 0. Message Type */ pdu.present = F1AP_F1AP_PDU_PR_successfulOutcome; - asn1cCalloc(pdu.choice.successfulOutcome,F1AP_SuccessfulOutcome_t, tmp); + asn1cCalloc(pdu.choice.successfulOutcome,tmp); tmp->procedureCode = F1AP_ProcedureCode_id_UEContextModification; tmp->criticality = F1AP_Criticality_reject; tmp->value.present = F1AP_SuccessfulOutcome__value_PR_UEContextModificationResponse; @@ -981,7 +978,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance) { F1AP_DLUPTNLInformation_ToBeSetup_Item_t, dLUPTNLInformation_ToBeSetup_Item); dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; asn1cCalloc(dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.choice.gTPTunnel, - F1AP_GTPTunnel_t, gTPTunnel); + gTPTunnel); TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "1204", strlen("1204")); @@ -1014,10 +1011,9 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance) { /* DLTunnels_Modified_Item */ asn1cSequenceAdd(drbs_modified_item->dLUPTNLInformation_ToBeSetup_List.list, F1AP_DLUPTNLInformation_ToBeSetup_Item_t, dLUPTNLInformation_ToBeSetup_Item); - asn1cCalloc(dLUPTNLInformation_ToBeSetup_Item, F1AP_DLUPTNLInformation_ToBeSetup_Item_t, tmp); + asn1cCalloc(dLUPTNLInformation_ToBeSetup_Item, tmp); tmp->dLUPTNLInformation.present = F1AP_UPTransportLayerInformation_PR_gTPTunnel; - asn1cCalloc(dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.choice.gTPTunnel, - F1AP_GTPTunnel_t, gTPTunnel); + asn1cCalloc(dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.choice.gTPTunnel, gTPTunnel); TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &gTPTunnel->transportLayerAddress); OCTET_STRING_fromBuf(&gTPTunnel->gTP_TEID, "1204", strlen("1204")); } @@ -1042,7 +1038,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance) { &srbs_failedToBeSetupMod_item_ies->value.choice.SRBs_FailedToBeSetupMod_Item; /* - sRBID */ srbs_failedToBeSetupMod_item->sRBID = 50L; - asn1cCalloc(srbs_failedToBeSetupMod_item->cause, F1AP_Cause_t, tmp) + asn1cCalloc(srbs_failedToBeSetupMod_item->cause, tmp) tmp->present = F1AP_Cause_PR_radioNetwork; tmp->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnb_du_ue_f1ap_id; } @@ -1089,7 +1085,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance) { 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]); - asn1cCalloc(scell_failedtoSetupMod_item->cause, F1AP_Cause_t, tmp); + 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; } @@ -1113,7 +1109,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance) { &drbs_failedToBeModified_item_ies->value.choice.DRBs_FailedToBeModified_Item ; /* dRBID */ drbs_failedToBeModified_item->dRBID = 30L; - asn1cCalloc(drbs_failedToBeModified_item->cause, F1AP_Cause_t, tmp); + asn1cCalloc(drbs_failedToBeModified_item->cause, tmp); tmp->present = F1AP_Cause_PR_radioNetwork; tmp->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnb_du_ue_f1ap_id; } diff --git a/openair2/RRC/LTE/MESSAGES/asn1_msg.h b/openair2/RRC/LTE/MESSAGES/asn1_msg.h index 0d9fe65aeb..28eb91a5b0 100644 --- a/openair2/RRC/LTE/MESSAGES/asn1_msg.h +++ b/openair2/RRC/LTE/MESSAGES/asn1_msg.h @@ -52,6 +52,14 @@ */ int xer_sprint(char *string, size_t string_size, struct asn_TYPE_descriptor_s *td, void *sptr); +#define asn1cCallocOne(VaR, VaLue) \ + VaR = calloc(1,sizeof(*VaR)); *VaR=VaLue; +#define asn1cCalloc(VaR, lOcPtr) \ + typeof(VaR) lOcPtr = VaR = calloc(1,sizeof(*VaR)); +#define asn1cSequenceAdd(VaR, TyPe, lOcPtr) \ + TyPe *lOcPtr= calloc(1,sizeof(TyPe)); \ + ASN_SEQUENCE_ADD(&VaR,lOcPtr); + uint16_t get_adjacent_cell_id(uint8_t Mod_id,uint8_t index); uint8_t get_adjacent_cell_mod_id(uint16_t phyCellId); diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index f1930f65a4..097353f43a 100755 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -153,6 +153,15 @@ typedef struct xer_sprint_string_s { size_t string_index; } xer_sprint_string_t; + +#define asn1cCallocOne(VaR, VaLue) \ + VaR = calloc(1,sizeof(*VaR)); *VaR=VaLue; +#define asn1cCalloc(VaR, lOcPtr) \ + typeof(VaR) lOcPtr = VaR = calloc(1,sizeof(*VaR)); +#define asn1cSequenceAdd(VaR, TyPe, lOcPtr) \ + TyPe *lOcPtr= calloc(1,sizeof(TyPe)); \ + ASN_SEQUENCE_ADD(&VaR,lOcPtr); + //replace LTE //extern unsigned char NB_eNB_INST; extern unsigned char NB_gNB_INST; diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.h b/openair2/RRC/NR/MESSAGES/asn1_msg.h index 419352255a..744e651ca3 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.h +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.h @@ -53,6 +53,15 @@ */ int xer_sprint_NR(char *string, size_t string_size, struct asn_TYPE_descriptor_s *td, void *sptr); + +#define asn1cCallocOne(VaR, VaLue) \ + VaR = calloc(1,sizeof(*VaR)); *VaR=VaLue; +#define asn1cCalloc(VaR, lOcPtr) \ + typeof(VaR) lOcPtr = VaR = calloc(1,sizeof(*VaR)); +#define asn1cSequenceAdd(VaR, TyPe, lOcPtr) \ + TyPe *lOcPtr= calloc(1,sizeof(TyPe)); \ + ASN_SEQUENCE_ADD(&VaR,lOcPtr); + uint8_t do_MIB_NR(gNB_RRC_INST *rrc, uint32_t frame); From 2a1e7b739f61e7fa582bf14f0d263cec9b34bb95 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Thu, 30 Sep 2021 21:40:11 +0200 Subject: [PATCH 081/110] fix gcc warnings, hardcode gtpu debug level for ci debug --- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 1 - openair2/F1AP/f1ap_du_task.c | 11 --- openair2/RRC/NR/MESSAGES/asn1_msg.c | 21 +---- openair3/ocp-gtpu/gtp_itf.cpp | 85 +++++++++++--------- 4 files changed, 48 insertions(+), 70 deletions(-) diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index 50490d2897..2200071971 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -68,7 +68,6 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, /* 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); - instance_t du_ue_f1ap_id = ie->value.choice.GNB_DU_UE_F1AP_ID; /* NRCGI * Fixme: process NRCGI */ diff --git a/openair2/F1AP/f1ap_du_task.c b/openair2/F1AP/f1ap_du_task.c index 6c5094d248..49df62d078 100644 --- a/openair2/F1AP/f1ap_du_task.c +++ b/openair2/F1AP/f1ap_du_task.c @@ -90,18 +90,7 @@ void du_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat tmp= &RC.nrmac[instance]->eth_params_n; else tmp= &RC.mac[instance]->eth_params_n; - const cudu_params_t params = { - .local_ipv4_address = tmp->my_addr, - .local_port = tmp->my_portd, - .remote_ipv4_address = tmp->remote_addr, - .remote_port = tmp->remote_portd - }; - /* - if (!RC.nrrrc) - AssertFatal(proto_agent_start(instance, ¶ms) == 0, - "could not start PROTO_AGENT for F1U on instance %ld!\n", instance); - */ DU_send_F1_SETUP_REQUEST(instance); } diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 097353f43a..e0dd1e0a0a 100755 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -153,15 +153,6 @@ typedef struct xer_sprint_string_s { size_t string_index; } xer_sprint_string_t; - -#define asn1cCallocOne(VaR, VaLue) \ - VaR = calloc(1,sizeof(*VaR)); *VaR=VaLue; -#define asn1cCalloc(VaR, lOcPtr) \ - typeof(VaR) lOcPtr = VaR = calloc(1,sizeof(*VaR)); -#define asn1cSequenceAdd(VaR, TyPe, lOcPtr) \ - TyPe *lOcPtr= calloc(1,sizeof(TyPe)); \ - ASN_SEQUENCE_ADD(&VaR,lOcPtr); - //replace LTE //extern unsigned char NB_eNB_INST; extern unsigned char NB_gNB_INST; @@ -310,9 +301,6 @@ uint8_t do_MIB_NR(gNB_RRC_INST *rrc,uint32_t frame) { return((enc_rval.encoded+7)/8); } -#define asn1cCalloc(VaR, TyPe, lOcPtr) TyPe *lOcPtr=VaR=(TyPe*) calloc(1,sizeof(TyPe)); -#define asn1cCallocOne(VaR, VaLue) VaR=calloc(1,sizeof(*VaR)); *VaR=VaLue; -#define asn1cSequenceAdd(VaR, TyPe, lOcPtr) TyPe *lOcPtr=(TyPe*) calloc(1,sizeof(TyPe)); ASN_SEQUENCE_ADD(&VaR,lOcPtr); uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, gNB_RrcConfigurationReq *configuration @@ -342,7 +330,7 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, asn1cSequenceAdd(sib1->cellAccessRelatedInfo.plmn_IdentityList.list, struct NR_PLMN_IdentityInfo, nr_plmn_info); for (int i = 0; i < num_plmn; ++i) { asn1cSequenceAdd(nr_plmn_info->plmn_IdentityList.list, struct NR_PLMN_Identity, nr_plmn); - asn1cCalloc(nr_plmn->mcc, struct NR_MCC, mcc); + asn1cCalloc(nr_plmn->mcc, mcc); int confMcc=configuration->mcc[i]; asn1cSequenceAdd(mcc->list, NR_MCC_MNC_Digit_t, mcc0); *mcc0=(confMcc/100)%10; @@ -411,8 +399,7 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, ASN_SEQUENCE_ADD(&sib1->si_SchedulingInfo->schedulingInfoList.list,schedulingInfo);*/ // servingCellConfigCommon - asn1cCalloc(sib1->servingCellConfigCommon, - struct NR_ServingCellConfigCommonSIB, ServCellCom); + asn1cCalloc(sib1->servingCellConfigCommon, ServCellCom); NR_BWP_DownlinkCommon_t *initialDownlinkBWP=&ServCellCom->downlinkConfigCommon.initialDownlinkBWP; initialDownlinkBWP->genericParameters= configuration->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters; @@ -547,19 +534,17 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, ServCellCom->downlinkConfigCommon.pcch_Config.ns = NR_PCCH_Config__ns_one; asn1cCalloc(ServCellCom->downlinkConfigCommon.pcch_Config.firstPDCCH_MonitoringOccasionOfPO, - struct NR_PCCH_Config__firstPDCCH_MonitoringOccasionOfPO, P0); P0->present = NR_PCCH_Config__firstPDCCH_MonitoringOccasionOfPO_PR_sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT; asn1cCalloc(P0->choice.sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT, - struct NR_PCCH_Config__firstPDCCH_MonitoringOccasionOfPO__sCS120KHZoneT_SCS60KHZhalfT_SCS30KHZquarterT_SCS15KHZoneEighthT, Z8); asn1cSequenceAdd(Z8->list, long, ZoneEight); asn1cCallocOne(ZoneEight, 0); - asn1cCalloc(ServCellCom->uplinkConfigCommon, struct NR_UplinkConfigCommonSIB, UL) + asn1cCalloc(ServCellCom->uplinkConfigCommon, UL) asn_set_empty(&UL->frequencyInfoUL.scs_SpecificCarrierList.list); for(int i = 0; i< configuration->scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.count; i++) { ASN_SEQUENCE_ADD(&UL->frequencyInfoUL.scs_SpecificCarrierList.list, diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index 330e680d3e..0b8c533c88 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -163,7 +163,7 @@ static void gtpv1uSend(instance_t instance, gtpv1u_enb_tunnel_data_req_t *req, b auto ptrRnti=inst->ue2te_mapping.find(rnti); if ( ptrRnti==inst->ue2te_mapping.end() ) { - LOG_E(GTPU, "gtpv1uSend failed: while getting ue rnti %x in hashtable ue_mapping\n", rnti); + LOG_E(GTPU, "[%ld] gtpv1uSend failed: while getting ue rnti %x in hashtable ue_mapping\n", instance, rnti); pthread_mutex_unlock(&globGtp.gtp_lock); return; } @@ -171,13 +171,13 @@ static void gtpv1uSend(instance_t instance, gtpv1u_enb_tunnel_data_req_t *req, b map::iterator ptr2=ptrRnti->second.bearers.find(rab_id); if ( ptr2 == ptrRnti->second.bearers.end() ) { - LOG_E(GTPU,"GTP-U instance: %ld sending a packet to a non existant RNTI:RAB: %x/%x\n", instance, rnti, rab_id); + LOG_E(GTPU,"[%ld] GTP-U instance: sending a packet to a non existant RNTI:RAB: %x/%x\n", instance, rnti, rab_id); pthread_mutex_unlock(&globGtp.gtp_lock); return; } - LOG_D(GTPU,"sending a packet to RNTI:RAB:teid %x/%x/%x, len %lu, oldseq %d, oldnum %d\n", - rnti, rab_id,ptr2->second.teid_outgoing,length, ptr2->second.seqNum,ptr2->second.npduNum ); + LOG_D(GTPU,"[%ld] sending a packet to RNTI:RAB:teid %x/%x/%x, len %lu, oldseq %d, oldnum %d\n", + instance, rnti, rab_id,ptr2->second.teid_outgoing,length, ptr2->second.seqNum,ptr2->second.npduNum ); if(seqNumFlag) ptr2->second.seqNum++; @@ -205,7 +205,7 @@ static void gtpv1uSend2(instance_t instance, gtpv1u_gnb_tunnel_data_req_t *req, auto ptrRnti=inst->ue2te_mapping.find(rnti); if ( ptrRnti==inst->ue2te_mapping.end() ) { - LOG_E(GTPU, "GTP-U instance: %ld gtpv1uSend failed: while getting ue rnti %x in hashtable ue_mapping\n", instance, rnti); + LOG_E(GTPU, "[%ld] GTP-U gtpv1uSend failed: while getting ue rnti %x in hashtable ue_mapping\n", instance, rnti); pthread_mutex_unlock(&globGtp.gtp_lock); return; } @@ -218,7 +218,7 @@ static void gtpv1uSend2(instance_t instance, gtpv1u_gnb_tunnel_data_req_t *req, return; } - LOG_D(GTPU,"GTP-U instance: %ld sending a packet to RNTI:RAB:teid %x/%x/%x, len %lu, oldseq %d, oldnum %d\n", + LOG_D(GTPU,"[%ld] GTP-U sending a packet to RNTI:RAB:teid %x/%x/%x, len %lu, oldseq %d, oldnum %d\n", instance, rnti, rab_id,ptr2->second.teid_outgoing,length, ptr2->second.seqNum,ptr2->second.npduNum ); if(seqNumFlag) @@ -245,7 +245,7 @@ static void gtpv1uEndTunnel(instance_t instance, gtpv1u_enb_tunnel_data_req_t *r auto ptrRnti=inst->ue2te_mapping.find(rnti); if ( ptrRnti==inst->ue2te_mapping.end() ) { - LOG_E(GTPU, "gtpv1uSend failed: while getting ue rnti %x in hashtable ue_mapping\n", rnti); + LOG_E(GTPU, "[%ld] gtpv1uSend failed: while getting ue rnti %x in hashtable ue_mapping\n", instance, rnti); pthread_mutex_unlock(&globGtp.gtp_lock); return; } @@ -253,13 +253,13 @@ static void gtpv1uEndTunnel(instance_t instance, gtpv1u_enb_tunnel_data_req_t *r map::iterator ptr2=ptrRnti->second.bearers.find(rab_id); if ( ptr2 == ptrRnti->second.bearers.end() ) { - LOG_E(GTPU,"GTP-U instance: %ld sending a packet to a non existant RNTI:RAB: %x/%x\n", instance, rnti, rab_id); + LOG_E(GTPU,"[%ld] GTP-U sending a packet to a non existant RNTI:RAB: %x/%x\n", instance, rnti, rab_id); pthread_mutex_unlock(&globGtp.gtp_lock); return; } - LOG_D(GTPU,"sending a end packet packet to RNTI:RAB:teid %x/%x/%x\n", - rnti, rab_id,ptr2->second.teid_outgoing); + LOG_D(GTPU,"[%ld] sending a end packet packet to RNTI:RAB:teid %x/%x/%x\n", + instance, rnti, rab_id,ptr2->second.teid_outgoing); ocp_gtpv1u_bearer_t tmp=ptr2->second; pthread_mutex_unlock(&globGtp.gtp_lock); Gtpv1uMsgHeaderT msgHdr; @@ -281,11 +281,11 @@ static void gtpv1uEndTunnel(instance_t instance, gtpv1u_enb_tunnel_data_req_t *r to.sin_addr.s_addr = tmp.outgoing_ip_addr; char ip4[INET_ADDRSTRLEN]; //char ip6[INET6_ADDRSTRLEN]; - LOG_D(GTPU,"sending end packet to %s\n", inet_ntoa(to.sin_addr) ); + LOG_D(GTPU,"[%ld] sending end packet to %s\n", instance, inet_ntoa(to.sin_addr) ); if (sendto(compatInst(instance), (void *)&msgHdr, sizeof(msgHdr), 0,(struct sockaddr *)&to, sizeof(to) ) != sizeof(msgHdr)) { LOG_E(GTPU, - "[SD %ld] Failed to send data to %s on port %d, buffer size %lu\n", + "[%ld] Failed to send data to %s on port %d, buffer size %lu\n", compatInst(instance), inet_ntop(AF_INET, &tmp.outgoing_ip_addr, ip4, INET_ADDRSTRLEN), tmp.outgoing_port, sizeof(msgHdr)); } } @@ -373,7 +373,7 @@ static int udpServerSocket(openAddr_s addr) { int sendbuff = 1000*1000*10; AssertFatal(0==setsockopt(sockfd, SOL_SOCKET, SO_SNDBUF, &sendbuff, sizeof(sendbuff)),""); - LOG_D(GTPU,"Created listener for paquets to: %s:%s, send buffer size: %d\n", addr.originHost, addr.originService,sendbuff); + LOG_D(GTPU,"[%d] Created listener for paquets to: %s:%s, send buffer size: %d\n", sockfd, addr.originHost, addr.originService,sendbuff); return sockfd; } @@ -397,7 +397,7 @@ void GtpuUpdateTunnelOutgoingTeid(instance_t instance, rnti_t rnti, ebi_t bearer auto ptrRnti=inst->ue2te_mapping.find(rnti); if ( ptrRnti == inst->ue2te_mapping.end() ) { - LOG_E(GTPU,"Update tunnel for a not existing rnti %x\n", rnti); + LOG_E(GTPU,"[%ld] Update tunnel for a not existing rnti %x\n", instance, rnti); pthread_mutex_unlock(&globGtp.gtp_lock); return; } @@ -405,13 +405,13 @@ void GtpuUpdateTunnelOutgoingTeid(instance_t instance, rnti_t rnti, ebi_t bearer map::iterator ptr2=ptrRnti->second.bearers.find(bearer_id); if ( ptr2 == ptrRnti->second.bearers.end() ) { - LOG_E(GTPU,"Update tunnel for a existing rnti %x, but wrong bearer_id %u\n", rnti, bearer_id); + LOG_E(GTPU,"[%ld] Update tunnel for a existing rnti %x, but wrong bearer_id %u\n", instance, rnti, bearer_id); pthread_mutex_unlock(&globGtp.gtp_lock); return; } ptr2->second.teid_outgoing = newOutgoingTeid; - LOG_I(GTPU, "Tunnel Outgoing TEID updated to %d \n", ptr2->second.teid_outgoing); + LOG_I(GTPU, "[%ld] Tunnel Outgoing TEID updated to %d \n", instance, ptr2->second.teid_outgoing); pthread_mutex_unlock(&globGtp.gtp_lock); return; } @@ -424,14 +424,14 @@ teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int incoming_bearer auto it=inst->ue2te_mapping.find(rnti); if ( it != inst->ue2te_mapping.end() ) { - LOG_W(GTPU,"Create a config for a already existing GTP tunnel (rnti %x)\n", rnti); + LOG_W(GTPU,"[%ld] Create a config for a already existing GTP tunnel (rnti %x)\n", instance, rnti); inst->ue2te_mapping.erase(it); } teid_t incoming_teid=gtpv1uNewTeid(); while ( inst->te2ue_mapping.find(incoming_teid) != inst->te2ue_mapping.end() ) { - LOG_W(GTPU, "generated a random Teid that exists, re-generating (%x)\n",incoming_teid); + LOG_W(GTPU, "[%ld] generated a random Teid that exists, re-generating (%x)\n", instance, incoming_teid); incoming_teid=gtpv1uNewTeid(); }; @@ -471,7 +471,8 @@ teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int incoming_bearer pthread_mutex_unlock(&globGtp.gtp_lock); char ip4[INET_ADDRSTRLEN]; char ip6[INET6_ADDRSTRLEN]; - LOG_I(GTPU, "Created tunnel for RNTI %x, teid for DL: %u, teid for UL %u to remote IPv4: %s, IPv6 %s\n", + LOG_I(GTPU, "[%ld] Created tunnel for RNTI %x, teid for DL: %u, teid for UL %u to remote IPv4: %s, IPv6 %s\n", + instance, rnti, tmp->teid_incoming, tmp->teid_outgoing, @@ -483,7 +484,8 @@ teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int incoming_bearer int ocp_gtpv1u_create_s1u_tunnel(instance_t instance, const gtpv1u_enb_create_tunnel_req_t *create_tunnel_req, gtpv1u_enb_create_tunnel_resp_t *create_tunnel_resp) { - LOG_D(GTPU, "Start create tunnels for RNTI %x, num_tunnels %d, sgw_S1u_teid %x\n", + LOG_D(GTPU, "[%ld] Start create tunnels for RNTI %x, num_tunnels %d, sgw_S1u_teid %x\n", + instance, create_tunnel_req->rnti, create_tunnel_req->num_tunnels, create_tunnel_req->sgw_S1u_teid[0]); @@ -517,7 +519,8 @@ int ocp_gtpv1u_update_s1u_tunnel( const gtpv1u_enb_create_tunnel_req_t *const create_tunnel_req, const rnti_t prior_rnti ) { - LOG_D(GTPU, "Start update tunnels for old RNTI %x, new RNTI %x, num_tunnels %d, sgw_S1u_teid %x, eps_bearer_id %x\n", + LOG_D(GTPU, "[%ld] Start update tunnels for old RNTI %x, new RNTI %x, num_tunnels %d, sgw_S1u_teid %x, eps_bearer_id %x\n", + instance, prior_rnti, create_tunnel_req->rnti, create_tunnel_req->num_tunnels, @@ -527,13 +530,13 @@ int ocp_gtpv1u_update_s1u_tunnel( auto inst=&globGtp.instances[compatInst(instance)]; if ( inst->ue2te_mapping.find(create_tunnel_req->rnti) == inst->ue2te_mapping.end() ) { - LOG_E(GTPU,"Update not already existing tunnel (new rnti %x, old rnti %x)\n", create_tunnel_req->rnti, prior_rnti); + LOG_E(GTPU,"[%ld] Update not already existing tunnel (new rnti %x, old rnti %x)\n", instance, create_tunnel_req->rnti, prior_rnti); } auto it=inst->ue2te_mapping.find(prior_rnti); if ( it != inst->ue2te_mapping.end() ) { - LOG_W(GTPU,"Update a not existing tunnel, start create the new one (new rnti %x, old rnti %x)\n", create_tunnel_req->rnti, prior_rnti); + LOG_W(GTPU,"[%ld] Update a not existing tunnel, start create the new one (new rnti %x, old rnti %x)\n", instance, create_tunnel_req->rnti, prior_rnti); pthread_mutex_unlock(&globGtp.gtp_lock); gtpv1u_enb_create_tunnel_resp_t tmp; (void)ocp_gtpv1u_create_s1u_tunnel(instance, create_tunnel_req, &tmp); @@ -549,7 +552,8 @@ int ocp_gtpv1u_update_s1u_tunnel( int gtpv1u_create_ngu_tunnel( const instance_t instance, const gtpv1u_gnb_create_tunnel_req_t *const create_tunnel_req, gtpv1u_gnb_create_tunnel_resp_t *const create_tunnel_resp) { - LOG_D(GTPU, "Start create tunnels for RNTI %x, num_tunnels %d, sgw_S1u_teid %x\n", + LOG_D(GTPU, "[%ld] Start create tunnels for RNTI %x, num_tunnels %d, sgw_S1u_teid %x\n", + instance, create_tunnel_req->rnti, create_tunnel_req->num_tunnels, create_tunnel_req->outgoing_teid[0]); @@ -590,14 +594,14 @@ int ocp_gtpv1u_create_x2u_tunnel( } int newGtpuDeleteTunnel(instance_t instance, rnti_t rnti) { - LOG_D(GTPU, "Start delete tunnels for RNTI %x\n", - rnti); + LOG_D(GTPU, "[%ld] Start delete tunnels for RNTI %x\n", + instance, rnti); pthread_mutex_lock(&globGtp.gtp_lock); auto inst=&globGtp.instances[compatInst(instance)]; auto it=inst->ue2te_mapping.find(rnti); if ( it == inst->ue2te_mapping.end() ) { - LOG_W(GTPU,"Delete a non existing GTP tunnel\n"); + LOG_W(GTPU,"[%ld] Delete a non existing GTP tunnel\n", instance); pthread_mutex_unlock(&globGtp.gtp_lock); return -1; } @@ -613,7 +617,7 @@ int newGtpuDeleteTunnel(instance_t instance, rnti_t rnti) { inst->ue2te_mapping.erase(it); pthread_mutex_unlock(&globGtp.gtp_lock); - LOG_I(GTPU, "Deleted all tunnels for RNTI %d (%d tunnels deleted)\n", rnti, nb); + LOG_I(GTPU, "[%ld] Deleted all tunnels for RNTI %d (%d tunnels deleted)\n", instance, rnti, nb); return !GTPNOK; } @@ -671,7 +675,7 @@ static int Gtpv1uHandleEndMarker(int h, Gtpv1uMsgHeaderT *msgHdr = (Gtpv1uMsgHeaderT *) msgBuf; if ( msgHdr->version != 1 || msgHdr->PT != 1 ) { - LOG_E(GTPU, "Received a packet that is not GTP header\n"); + LOG_E(GTPU, "[%d] Received a packet that is not GTP header\n", h); return GTPNOK; } @@ -681,7 +685,7 @@ static int Gtpv1uHandleEndMarker(int h, auto tunnel=inst->te2ue_mapping.find(ntohl(msgHdr->teid)); if ( tunnel == inst->te2ue_mapping.end() ) { - LOG_E(GTPU,"Received a incoming packet on unknown teid (%x) Dropping!\n", msgHdr->teid); + LOG_E(GTPU,"[%d] Received a incoming packet on unknown teid (%x) Dropping!\n", h, msgHdr->teid); pthread_mutex_unlock(&globGtp.gtp_lock); return GTPNOK; } @@ -717,9 +721,9 @@ static int Gtpv1uHandleEndMarker(int h, mode, &sourceL2Id, &destinationL2Id) ) - LOG_E(GTPU,"down layer refused incoming packet\n"); + LOG_E(GTPU,"[%d] down layer refused incoming packet\n", h); - LOG_D(GTPU,"Received END marker packet for: teid:%x\n", ntohl(msgHdr->teid)); + LOG_D(GTPU,"[%d] Received END marker packet for: teid:%x\n", h, ntohl(msgHdr->teid)); return !GTPNOK; } @@ -731,7 +735,7 @@ static int Gtpv1uHandleGpdu(int h, Gtpv1uMsgHeaderT *msgHdr = (Gtpv1uMsgHeaderT *) msgBuf; if ( msgHdr->version != 1 || msgHdr->PT != 1 ) { - LOG_E(GTPU, "Received a packet that is not GTP header\n"); + LOG_E(GTPU, "[%d] Received a packet that is not GTP header\n", h); return GTPNOK; } @@ -741,7 +745,7 @@ static int Gtpv1uHandleGpdu(int h, auto tunnel=inst->te2ue_mapping.find(ntohl(msgHdr->teid)); if ( tunnel == inst->te2ue_mapping.end() ) { - LOG_E(GTPU,"Received a incoming packet on unknown teid (%x) Dropping!\n", msgHdr->teid); + LOG_E(GTPU,"[%d] Received a incoming packet on unknown teid (%x) Dropping!\n", h, ntohl(msgHdr->teid)); pthread_mutex_unlock(&globGtp.gtp_lock); return GTPNOK; } @@ -784,9 +788,9 @@ static int Gtpv1uHandleGpdu(int h, mode, &sourceL2Id, &destinationL2Id) ) - LOG_E(GTPU,"down layer refused incoming packet\n"); + LOG_E(GTPU,"[%d] down layer refused incoming packet\n", h); - LOG_D(GTPU,"Received a %d bytes packet for: teid:%x\n", + LOG_D(GTPU,"[%d] Received a %d bytes packet for: teid:%x\n", h, msgBufLen-offset, ntohl(msgHdr->teid)); return !GTPNOK; @@ -801,14 +805,14 @@ void gtpv1uReceiver(int h) { if ((udpDataLen = recvfrom(h, udpData, sizeof(udpData), 0, (struct sockaddr *)&addr, &from_len)) < 0) { - LOG_E(GTPU, "Recvfrom failed on %d (%s)\n", h, strerror(errno)); + LOG_E(GTPU, "[%d] Recvfrom failed (%s)\n", h, strerror(errno)); return; } else if (udpDataLen == 0) { - LOG_W(GTPU, "Recvfrom returned 0\n"); + LOG_W(GTPU, "[%d] Recvfrom returned 0\n", h); return; } else { uint8_t msgType = *((uint8_t *)(udpData + 1)); - LOG_D(GTPU, "Received GTP data, msg type: %x\n", msgType); + LOG_D(GTPU, "[%d] Received GTP data, msg type: %x\n", h, msgType); switch(msgType) { case GTP_ECHO_RSP: @@ -835,7 +839,7 @@ void gtpv1uReceiver(int h) { break; default: - LOG_E(GTPU, "Received a GTP packet of unknown type: %d\n",msgType); + LOG_E(GTPU, "[%d] Received a GTP packet of unknown type: %d\n", h, msgType); break; } } @@ -844,6 +848,7 @@ void gtpv1uReceiver(int h) { #include void *ocp_gtpv1uTask(void *args) { + set_log(GTPU, OAILOG_DEBUG); while(1) { /* Trying to fetch a message from the message queue. If the queue is empty, this function will block till a From c43bde33f5ba712fccb68b9615434af014f71a37 Mon Sep 17 00:00:00 2001 From: matzakos Date: Fri, 1 Oct 2021 10:58:35 +0200 Subject: [PATCH 082/110] Use the updates of the masterCellGroup configuration as input to UE context setup response, instead of the whole mastercellgroup configuration stored at the UE context of the DU. -Deallocate memory for the updates on masterCellGroup config. after the information is encoded. --- openair2/RRC/NR/rrc_gNB.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index e240c9d269..d2132b4e30 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -3253,10 +3253,11 @@ static void rrc_DU_process_ue_context_setup_request(MessageDef *msg_p, const cha resp->du_to_cu_rrc_information = calloc(1,1024*sizeof(uint8_t)); asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig, NULL, - (void *)ue_context_p->ue_context.masterCellGroup, + (void *)cellGroupConfig, resp->du_to_cu_rrc_information, 1024); resp->du_to_cu_rrc_information_length = (enc_rval.encoded+7)>>3; + free(cellGroupConfig); itti_send_msg_to_task (TASK_DU_F1, ctxt.module_id, message_p); } From b75fc441c594a16f196ff210eb10ae778ae75fb5 Mon Sep 17 00:00:00 2001 From: matzakos Date: Fri, 1 Oct 2021 12:23:11 +0200 Subject: [PATCH 083/110] Change presence of gNB_CU_UE_F1AP_ID as mandatory field in handling UE context setup response --- openair2/F1AP/f1ap_cu_ue_context_management.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index f54218a3b8..d4ebafa2a8 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -644,7 +644,7 @@ int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, /* GNB_CU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, - F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, false); + F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true); f1ap_ue_context_setup_resp->gNB_CU_ue_id = ie->value.choice.GNB_CU_UE_F1AP_ID; LOG_D(F1AP, "f1ap_ue_context_setup_resp->gNB_CU_ue_id is: %d \n", f1ap_ue_context_setup_resp->gNB_CU_ue_id); From da65316765b6ff089734cec7806ff0992d1fa298 Mon Sep 17 00:00:00 2001 From: matzakos Date: Fri, 1 Oct 2021 12:42:37 +0200 Subject: [PATCH 084/110] Additional corrections for non-mandatory presence of DRB,SRB setup lists in handling of F1AP UE ctxt setup request,response messages --- openair2/F1AP/f1ap_cu_ue_context_management.c | 4 ++-- openair2/F1AP/f1ap_du_ue_context_management.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index d4ebafa2a8..096cd21bac 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -673,7 +673,7 @@ int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, // DRBs_Setup_List F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, - F1AP_ProtocolIE_ID_id_DRBs_Setup_List, true); + F1AP_ProtocolIE_ID_id_DRBs_Setup_List, false); if(ie!=NULL){ f1ap_ue_context_setup_resp->drbs_to_be_setup_length = ie->value.choice.DRBs_Setup_List.list.count; f1ap_ue_context_setup_resp->drbs_to_be_setup = calloc(f1ap_ue_context_setup_resp->drbs_to_be_setup_length, @@ -739,7 +739,7 @@ int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, // SRBs_Setup_List F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, - F1AP_ProtocolIE_ID_id_SRBs_Setup_List, true); + F1AP_ProtocolIE_ID_id_SRBs_Setup_List, false); if(ie!=NULL){ f1ap_ue_context_setup_resp->srbs_to_be_setup_length = ie->value.choice.SRBs_Setup_List.list.count; f1ap_ue_context_setup_resp->srbs_to_be_setup = calloc(f1ap_ue_context_setup_resp->srbs_to_be_setup_length, diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 5580741a63..35251ec248 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -134,7 +134,7 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* DRB */ F1AP_UEContextSetupRequestIEs_t *ieDrb; F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ieDrb, container, - F1AP_ProtocolIE_ID_id_DRBs_ToBeSetup_List, true); + F1AP_ProtocolIE_ID_id_DRBs_ToBeSetup_List, false); if(ieDrb!=NULL) { f1ap_ue_context_setup_req->drbs_to_be_setup_length = ieDrb->value.choice.DRBs_ToBeSetup_List.list.count; @@ -187,7 +187,7 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* SRB */ F1AP_UEContextSetupRequestIEs_t *ieSrb; F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ieSrb, container, - F1AP_ProtocolIE_ID_id_SRBs_ToBeSetup_List, true); + F1AP_ProtocolIE_ID_id_SRBs_ToBeSetup_List, false); if(ieSrb != NULL) { f1ap_ue_context_setup_req->srbs_to_be_setup_length = ieSrb->value.choice.SRBs_ToBeSetup_List.list.count; From 2acecb40a25fb4dbabb818426f8101125af743c2 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Fri, 1 Oct 2021 12:59:08 +0200 Subject: [PATCH 085/110] code review, CI result configuration issues, gcc warnings --- .../conf_files/cu.band7.tm1.100PRB.conf | 10 ++++----- ci-scripts/conf_files/gNB_SA_CU.conf | 10 ++++----- ci-scripts/conf_files/gNB_SA_DU.conf | 4 ++-- openair2/F1AP/f1ap_cu_interface_management.c | 2 +- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 21 +------------------ openair2/F1AP/f1ap_du_task.c | 5 ----- openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c | 18 ++++++++-------- openair3/ocp-gtpu/gtp_itf.cpp | 10 ++++----- 8 files changed, 28 insertions(+), 52 deletions(-) diff --git a/ci-scripts/conf_files/cu.band7.tm1.100PRB.conf b/ci-scripts/conf_files/cu.band7.tm1.100PRB.conf index aefcb7a714..e2c94b14ab 100644 --- a/ci-scripts/conf_files/cu.band7.tm1.100PRB.conf +++ b/ci-scripts/conf_files/cu.band7.tm1.100PRB.conf @@ -13,7 +13,7 @@ eNBs = ( // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ( { mcc = 450; mnc = 05; mnc_length = 2; } ) + plmn_list = ( { mcc = 208; mnc = 92; mnc_length = 2; } ) nr_cellid = 12345678L @@ -179,7 +179,7 @@ eNBs = ( ////////// MME parameters: mme_ip_address = ( { - ipv4 = "192.168.5.233"; + ipv4 = "CI_MME_IP_ADDR"; ipv6 = "192:168:30::17"; port = 36412 ; active = "yes"; @@ -189,11 +189,11 @@ eNBs = ( NETWORK_INTERFACES : { ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.5.244"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "CI_ENB_IP_ADDR"; ENB_INTERFACE_NAME_FOR_S1U = "eth0"; - ENB_IPV4_ADDRESS_FOR_S1U = "192.168.5.244"; + ENB_IPV4_ADDRESS_FOR_S1U = "CI_ENB_IP_ADDR"; ENB_PORT_FOR_S1U = 2152; # Spec 2152 - ENB_IPV4_ADDRESS_FOR_X2C = "192.168.5.244"; + ENB_IPV4_ADDRESS_FOR_X2C = "CI_ENB_IP_ADDR"; ENB_PORT_FOR_X2C = 36422; # Spec 36422 }; } diff --git a/ci-scripts/conf_files/gNB_SA_CU.conf b/ci-scripts/conf_files/gNB_SA_CU.conf index 8479f0f7a2..0e9a5e2b45 100644 --- a/ci-scripts/conf_files/gNB_SA_CU.conf +++ b/ci-scripts/conf_files/gNB_SA_CU.conf @@ -17,8 +17,8 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; plmn_list = ({ - mcc = 450; - mnc = 05; + mcc = 208; + mnc = 99; mnc_length = 2; snssaiList = ( { @@ -66,10 +66,10 @@ gNBs = NETWORK_INTERFACES : { - GNB_INTERFACE_NAME_FOR_NG_AMF = "enp0s31f6:"; - GNB_IPV4_ADDRESS_FOR_NG_AMF = "192.168.5.244/24"; + GNB_INTERFACE_NAME_FOR_NG_AMF = "eth0"; + GNB_IPV4_ADDRESS_FOR_NG_AMF = "CI_GNB_IP_ADDR"; GNB_INTERFACE_NAME_FOR_NGU = "bond0"; - GNB_IPV4_ADDRESS_FOR_NGU = "192.168.5.244/24"; + GNB_IPV4_ADDRESS_FOR_NGU = ""CI_GNB_IP_ADDR"; GNB_PORT_FOR_S1U = 2152; # Spec 2152 }; } diff --git a/ci-scripts/conf_files/gNB_SA_DU.conf b/ci-scripts/conf_files/gNB_SA_DU.conf index c1183ce4f8..be1e78464f 100644 --- a/ci-scripts/conf_files/gNB_SA_DU.conf +++ b/ci-scripts/conf_files/gNB_SA_DU.conf @@ -16,8 +16,8 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; plmn_list = ({ - mcc = 450; - mnc = 05; + mcc = 208; + mnc = 99; mnc_length = 2; snssaiList = ( { diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index 6d63394f8a..dac78154e7 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -221,7 +221,7 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, } } else { CU_send_F1_SETUP_FAILURE(instance); - itti_free(TASK_RRC_GNB,message_p); + itti_free(TASK_CU_F1,message_p); return -1; } diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index 2200071971..1f6d7d7f44 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -288,28 +288,9 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, /* RRC Container */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_ULRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_RRCContainer, true); - // print message in debug mode - // create an ITTI message and copy SDU - /* - - message_p = itti_alloc_new_message (TASK_CU_F1, 0, RRC_DCCH_DATA_IND); - - RRC_DCCH_DATA_IND (message_p).sdu_p = malloc(ie->value.choice.RRCContainer.size); - - RRC_DCCH_DATA_IND (message_p).sdu_size = ie->value.choice.RRCContainer.size; - memcpy(RRC_DCCH_DATA_IND (message_p).sdu_p, ie->value.choice.RRCContainer.buf, - 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(CUtype, instance, cu_ue_f1ap_id); - RRC_DCCH_DATA_IND (message_p).instance = instance; - RRC_DCCH_DATA_IND (message_p).eNB_index = instance; // not needed for CU - - itti_send_msg_to_task(TASK_RRC_ENB, instance, message_p); - */ protocol_ctxt_t ctxt; ctxt.instance = instance; - ctxt.instance = instance; + ctxt.module_id = instance; ctxt.rnti = f1ap_get_rnti_by_cu_id(CUtype, instance, cu_ue_f1ap_id); ctxt.enb_flag = 1; ctxt.eNB_index = 0; diff --git a/openair2/F1AP/f1ap_du_task.c b/openair2/F1AP/f1ap_du_task.c index 49df62d078..ff072f3269 100644 --- a/openair2/F1AP/f1ap_du_task.c +++ b/openair2/F1AP/f1ap_du_task.c @@ -85,11 +85,6 @@ void du_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat f1ap_du_data->sctp_out_streams = sctp_new_association_resp->out_streams; f1ap_du_data->default_sctp_stream_id = 0; /* setup parameters for F1U and start the server */ - eth_params_t *tmp; - if ( RC.nrmac ) - tmp= &RC.nrmac[instance]->eth_params_n; - else - tmp= &RC.mac[instance]->eth_params_n; DU_send_F1_SETUP_REQUEST(instance); } diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index d466ee904b..35ef057527 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -537,16 +537,16 @@ rb_found: __func__, rb_id, size); extern instance_t CUuniqInstance; itti_send_msg_to_task(TASK_VARIABLE, CUuniqInstance, message_p); - return; - } + } else { - memblock = get_free_mem_block(size, __FUNCTION__); - memcpy(memblock->data, buf, size); - - LOG_D(PDCP, "%s(): (srb %d) calling rlc_data_req size %d\n", __func__, rb_id, size); - //for (i = 0; i < size; i++) printf(" %2.2x", (unsigned char)memblock->data[i]); - //printf("\n"); - enqueue_rlc_data_req(&ctxt, 0, MBMS_FLAG_NO, rb_id, sdu_id, 0, size, memblock); + memblock = get_free_mem_block(size, __FUNCTION__); + memcpy(memblock->data, buf, size); + + LOG_D(PDCP, "%s(): (srb %d) calling rlc_data_req size %d\n", __func__, rb_id, size); + //for (i = 0; i < size; i++) printf(" %2.2x", (unsigned char)memblock->data[i]); + //printf("\n"); + enqueue_rlc_data_req(&ctxt, 0, MBMS_FLAG_NO, rb_id, sdu_id, 0, size, memblock); + } } static void deliver_sdu_srb(void *_ue, nr_pdcp_entity_t *entity, diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index 0b8c533c88..7c2027e96b 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -601,7 +601,7 @@ int newGtpuDeleteTunnel(instance_t instance, rnti_t rnti) { auto it=inst->ue2te_mapping.find(rnti); if ( it == inst->ue2te_mapping.end() ) { - LOG_W(GTPU,"[%ld] Delete a non existing GTP tunnel\n", instance); + LOG_W(GTPU,"[%ld] Delete GTP tunnels for rnti: %x, but no tunnel exits\n", instance, rnti); pthread_mutex_unlock(&globGtp.gtp_lock); return -1; } @@ -617,7 +617,7 @@ int newGtpuDeleteTunnel(instance_t instance, rnti_t rnti) { inst->ue2te_mapping.erase(it); pthread_mutex_unlock(&globGtp.gtp_lock); - LOG_I(GTPU, "[%ld] Deleted all tunnels for RNTI %d (%d tunnels deleted)\n", instance, rnti, nb); + LOG_I(GTPU, "[%ld] Deleted all tunnels for RNTI %x (%d tunnels deleted)\n", instance, rnti, nb); return !GTPNOK; } @@ -639,7 +639,7 @@ static int Gtpv1uHandleEchoReq(int h, uint32_t msgBufLen, uint16_t peerPort, uint32_t peerIp) { - LOG_E(GTPU,"to be dev\n"); + LOG_E(GTPU,"EchoReq reply to be dev\n"); int rc = GTPNOK; return rc; } @@ -649,7 +649,7 @@ static int Gtpv1uHandleError(int h, uint32_t msgBufLen, uint16_t peerPort, uint32_t peerIp) { - LOG_E(GTPU,"to be dev\n"); + LOG_E(GTPU,"Hadle error to be dev\n"); int rc = GTPNOK; return rc; } @@ -659,7 +659,7 @@ static int Gtpv1uHandleSupportedExt(int h, uint32_t msgBufLen, uint16_t peerPort, uint32_t peerIp) { - LOG_E(GTPU,"to be dev\n"); + LOG_E(GTPU,"Supported extensions to be dev\n"); int rc = GTPNOK; return rc; } From 1e3c0fa7e38c265d8075d6edfc43baaaf0f591c7 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Fri, 1 Oct 2021 15:05:52 +0200 Subject: [PATCH 086/110] only change LOG_x format --- openair3/ocp-gtpu/gtp_itf.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index 7c2027e96b..2d8d56ba7b 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -411,7 +411,7 @@ void GtpuUpdateTunnelOutgoingTeid(instance_t instance, rnti_t rnti, ebi_t bearer } ptr2->second.teid_outgoing = newOutgoingTeid; - LOG_I(GTPU, "[%ld] Tunnel Outgoing TEID updated to %d \n", instance, ptr2->second.teid_outgoing); + LOG_I(GTPU, "[%ld] Tunnel Outgoing TEID updated to %x \n", instance, ptr2->second.teid_outgoing); pthread_mutex_unlock(&globGtp.gtp_lock); return; } @@ -471,7 +471,7 @@ teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int incoming_bearer pthread_mutex_unlock(&globGtp.gtp_lock); char ip4[INET_ADDRSTRLEN]; char ip6[INET6_ADDRSTRLEN]; - LOG_I(GTPU, "[%ld] Created tunnel for RNTI %x, teid for DL: %u, teid for UL %u to remote IPv4: %s, IPv6 %s\n", + LOG_I(GTPU, "[%ld] Created tunnel for RNTI %x, teid for DL: %x, teid for UL %x to remote IPv4: %s, IPv6 %s\n", instance, rnti, tmp->teid_incoming, From fd816a037c63abd6bfd787a4b55debb2428af210 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Fri, 1 Oct 2021 15:43:49 +0200 Subject: [PATCH 087/110] remove hardcoded log level --- ci-scripts/conf_files/gNB_SA_CU.conf | 5 +---- ci-scripts/conf_files/gNB_SA_DU.conf | 5 +---- openair3/ocp-gtpu/gtp_itf.cpp | 1 - 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/ci-scripts/conf_files/gNB_SA_CU.conf b/ci-scripts/conf_files/gNB_SA_CU.conf index 0e9a5e2b45..684588de36 100644 --- a/ci-scripts/conf_files/gNB_SA_CU.conf +++ b/ci-scripts/conf_files/gNB_SA_CU.conf @@ -16,10 +16,7 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({ - mcc = 208; - mnc = 99; - mnc_length = 2; + plmn_list = ({ mcc = 208; mnc = 99; mnc_length = 2; snssaiList = ( { sst = 1; diff --git a/ci-scripts/conf_files/gNB_SA_DU.conf b/ci-scripts/conf_files/gNB_SA_DU.conf index be1e78464f..61ebcc1f09 100644 --- a/ci-scripts/conf_files/gNB_SA_DU.conf +++ b/ci-scripts/conf_files/gNB_SA_DU.conf @@ -15,10 +15,7 @@ gNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({ - mcc = 208; - mnc = 99; - mnc_length = 2; + plmn_list = ({ mcc = 208; mnc = 99; mnc_length = 2; snssaiList = ( { sst = 1; diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index 2d8d56ba7b..a12a53814c 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -848,7 +848,6 @@ void gtpv1uReceiver(int h) { #include void *ocp_gtpv1uTask(void *args) { - set_log(GTPU, OAILOG_DEBUG); while(1) { /* Trying to fetch a message from the message queue. If the queue is empty, this function will block till a From 0fcb4098d863ed0bdcba9978f8fb9b399530641a Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Fri, 1 Oct 2021 15:54:42 +0200 Subject: [PATCH 088/110] fix(ci): wrong plmn Signed-off-by: Raphael Defosseux --- ci-scripts/conf_files/du.band7.tm1.100PRB.usrpb210.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci-scripts/conf_files/du.band7.tm1.100PRB.usrpb210.conf b/ci-scripts/conf_files/du.band7.tm1.100PRB.usrpb210.conf index 28a6bc0779..a3ecffb9be 100644 --- a/ci-scripts/conf_files/du.band7.tm1.100PRB.usrpb210.conf +++ b/ci-scripts/conf_files/du.band7.tm1.100PRB.usrpb210.conf @@ -12,7 +12,7 @@ eNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ( { mcc = 450; mnc = 05; mnc_length = 2; } ) + plmn_list = ( { mcc = 208; mnc = 92; mnc_length = 2; } ) nr_cellid = 12345678L From c17ba044bc45666b3f9bd44ad753de73c198b792 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Fri, 1 Oct 2021 17:14:02 +0200 Subject: [PATCH 089/110] make gtp-u port on F1-U configurable --- ci-scripts/conf_files/du.band7.tm1.100PRB.usrpb210.conf | 2 +- ci-scripts/conf_files/gNB_SA_DU.conf | 4 ++-- openair2/F1AP/f1ap_du_ue_context_management.c | 5 +++-- openair2/RRC/NR/rrc_gNB.c | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ci-scripts/conf_files/du.band7.tm1.100PRB.usrpb210.conf b/ci-scripts/conf_files/du.band7.tm1.100PRB.usrpb210.conf index 28a6bc0779..a3ecffb9be 100644 --- a/ci-scripts/conf_files/du.band7.tm1.100PRB.usrpb210.conf +++ b/ci-scripts/conf_files/du.band7.tm1.100PRB.usrpb210.conf @@ -12,7 +12,7 @@ eNBs = // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ( { mcc = 450; mnc = 05; mnc_length = 2; } ) + plmn_list = ( { mcc = 208; mnc = 92; mnc_length = 2; } ) nr_cellid = 12345678L diff --git a/ci-scripts/conf_files/gNB_SA_DU.conf b/ci-scripts/conf_files/gNB_SA_DU.conf index 61ebcc1f09..cc20066721 100644 --- a/ci-scripts/conf_files/gNB_SA_DU.conf +++ b/ci-scripts/conf_files/gNB_SA_DU.conf @@ -233,9 +233,9 @@ MACRLCs = ( local_n_if_name = "lo"; local_n_address = "127.0.0.3"; remote_n_address = "127.0.0.4"; - local_n_portc = 601; + local_n_portc = 500; local_n_portd = 2152; - remote_n_portc = 600; + remote_n_portc = 501; remote_n_portd = 2152; } diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 35251ec248..ce1743b349 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -157,7 +157,8 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, F1AP_GTPTunnel_t *ul_up_tnl0 = ul_up_tnl_info_p->uLUPTNLInformation.choice.gTPTunnel; BIT_STRING_TO_TRANSPORT_LAYER_ADDRESS_IPv4(&ul_up_tnl0->transportLayerAddress, drb_p->up_ul_tnl[0].tl_address); OCTET_STRING_TO_INT32(&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; switch (drbs_tobesetup_item_p->rLCMode) { case F1AP_RLCMode_rlc_am: drb_p->rlc_mode = RLC_MODE_AM; @@ -177,7 +178,7 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, drb_p->drb_id, drb_p->up_ul_tnl[0].teid, addr, - 2152, + drb_p->up_ul_tnl[0].port, lteDURecvCb); drb_p->up_dl_tnl_length++; } diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index d2132b4e30..b034825bab 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -3210,7 +3210,7 @@ static void rrc_DU_process_ue_context_setup_request(MessageDef *msg_p, const cha drb_p.drb_id, drb_p.up_ul_tnl[0].teid, addr, - 2152, + drb_p.up_ul_tnl[0].port, DURecvCb); } } From f9bb4150cbce61e6f555a92917abd4d8158a0522 Mon Sep 17 00:00:00 2001 From: Laurent Thomas Date: Sun, 3 Oct 2021 22:04:17 +0200 Subject: [PATCH 090/110] astyle only --- openair2/F1AP/f1ap_common.c | 7 +- openair2/F1AP/f1ap_cu_interface_management.c | 39 +- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 1 - openair2/F1AP/f1ap_cu_task.c | 17 +- openair2/F1AP/f1ap_cu_ue_context_management.c | 106 ++--- openair2/F1AP/f1ap_du_interface_management.c | 6 +- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 11 +- openair2/F1AP/f1ap_du_task.c | 29 +- openair2/F1AP/f1ap_du_ue_context_management.c | 400 +++++++++--------- openair2/F1AP/f1ap_encoder.c | 2 + openair3/ocp-gtpu/gtp_itf.cpp | 8 +- 11 files changed, 315 insertions(+), 311 deletions(-) diff --git a/openair2/F1AP/f1ap_common.c b/openair2/F1AP/f1ap_common.c index 0b957bd32f..338b5f0c2b 100644 --- a/openair2/F1AP/f1ap_common.c +++ b/openair2/F1AP/f1ap_common.c @@ -100,6 +100,7 @@ int f1ap_add_ue(F1_t isCu, return i; } } + // We didn't find the rnti for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) { if (f1_inst->f1ap_ue[i].rnti == 0 ) { @@ -188,12 +189,12 @@ int f1ap_du_add_cu_ue_id(instance_t instanceP, instance_t du_ue_f1ap_id, instance_t cu_ue_f1ap_id) { f1ap_cudu_inst_t *f1_inst=getCxt(DUtype, instanceP); - instance_t f1ap_uid=-1; + for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) { if (f1_inst->f1ap_ue[i].du_ue_f1ap_id == du_ue_f1ap_id) { - f1ap_uid=i; - break; + f1ap_uid=i; + break; } } diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index dac78154e7..7e9105a970 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -97,8 +97,6 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, /* assoc_id */ f1ap_setup_req_t *req=&getCxt(true, instance)->setupReq; - - req->assoc_id = assoc_id; /* gNB_DU_id */ // this function exits if the ie is mandatory @@ -124,8 +122,8 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, for (i=0; ivalue.choice.GNB_DU_Served_Cells_List.list.array[i])-> - value.choice.GNB_DU_Served_Cells_Item); + ie->value.choice.GNB_DU_Served_Cells_List.list.array[i])-> + value.choice.GNB_DU_Served_Cells_Item); /* tac */ if (served_cells_item_p->served_Cell_Information.fiveGS_TAC) { @@ -153,6 +151,7 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, f1ap_req(true, instance)->cell_type=CELL_MACRO_GNB; else f1ap_req(true, instance)->cell_type=CELL_MACRO_ENB; + LOG_I(F1AP, "Received Cell in %d context\n", f1ap_req(true, instance)->cell_type==CELL_MACRO_GNB); // System Information /* mib */ @@ -209,10 +208,10 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, // uint16_t nr_sul_band[32]; // } tdd; // } nr_mode_info[F1AP_MAX_NB_CELLS]; - // We copy and store in F1 task data, RRC will free "req" as it frees all itti received messages message_p = itti_alloc_new_message(TASK_CU_F1, 0, F1AP_SETUP_REQ); memcpy(&F1AP_SETUP_REQ(message_p), req, sizeof(f1ap_setup_req_t) ); + if (num_cells_available > 0) { if (f1ap_req(true, instance)->cell_type == CELL_MACRO_GNB) { itti_send_msg_to_task(TASK_RRC_GNB, GNB_MODULE_ID_TO_INSTANCE(instance), message_p); @@ -521,14 +520,14 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu ieC3->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_Cells_to_be_Deactivated_List; for (int i=0; i<1; i++) { - asn1cSequenceAdd(ieC3->value.choice.Cells_to_be_Deactivated_List.list, - F1AP_Cells_to_be_Deactivated_List_ItemIEs_t, cells_to_be_deactivated); + asn1cSequenceAdd(ieC3->value.choice.Cells_to_be_Deactivated_List.list, + F1AP_Cells_to_be_Deactivated_List_ItemIEs_t, cells_to_be_deactivated); cells_to_be_deactivated->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item; cells_to_be_deactivated->criticality = F1AP_Criticality_reject; cells_to_be_deactivated->value.present = F1AP_Cells_to_be_Deactivated_List_ItemIEs__value_PR_Cells_to_be_Deactivated_List_Item; // 3.1 cells to be Deactivated list item F1AP_Cells_to_be_Deactivated_List_Item_t *cells_to_be_deactivated_list= - cells_to_be_deactivated->value.choice.Cells_to_be_Deactivated_List_Item; + cells_to_be_deactivated->value.choice.Cells_to_be_Deactivated_List_Item; addnRCGI(cells_to_be_deactivated_item->nRCGI, f1ap_setup_resp->cells_to_deactivate+i); } } @@ -543,19 +542,19 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu for (int i=0; i<1; i++) { asn1cSequenceAdd(ieC4->value.choice.GNB_CU_TNL_Association_To_Add_List.list, - F1AP_GNB_CU_TNL_Association_To_Add_ItemIEs_t, gnb_cu_tnl_association_to_add; + F1AP_GNB_CU_TNL_Association_To_Add_ItemIEs_t, gnb_cu_tnl_association_to_add; gnb_cu_tnl_association_to_add->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Add_Item; gnb_cu_tnl_association_to_add->criticality = F1AP_Criticality_reject; gnb_cu_tnl_association_to_add->value.present = F1AP_GNB_CU_TNL_Association_To_Add_ItemIEs__value_PR_GNB_CU_TNL_Association_To_Add_Item; // 4.1 GNB_CU_TNL_Association_To_Add_Item F1AP_GNB_CU_TNL_Association_To_Add_Item_t *gnb_cu_tnl_association_to_add_item= - &gnb_cu_tnl_association_to_add_item_ies->value.choice.GNB_CU_TNL_Association_To_Add_Item; + &gnb_cu_tnl_association_to_add_item_ies->value.choice.GNB_CU_TNL_Association_To_Add_Item; // 4.1.1 tNLAssociationTransportLayerAddress F1AP_CP_TransportLayerAddress_t *transportLayerAddress=; - gnb_cu_tnl_association_to_add->value.choice.GNB_CU_TNL_Association_To_Add_Item; - + gnb_cu_tnl_association_to_add->value.choice.GNB_CU_TNL_Association_To_Add_Item; + transportLayerAddress->present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address; TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &transportLayerAddress->choice.endpoint_IP_address); @@ -577,18 +576,18 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu ieC5->value.present = F1AP_GNBCUConfigurationUpdateIEs__value_PR_GNB_CU_TNL_Association_To_Remove_List; for (int i=0; i<1; i++) { asn1cSequenceAdd(ieC5->value.choice.GNB_CU_TNL_Association_To_Remove_List.list, - F1AP_GNB_CU_TNL_Association_To_Remove_ItemIEs_t, gnb_cu_tnl_association_to_remove); + F1AP_GNB_CU_TNL_Association_To_Remove_ItemIEs_t, gnb_cu_tnl_association_to_remove); gnb_cu_tnl_association_to_remove->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Remove_Item; gnb_cu_tnl_association_to_remove->criticality = F1AP_Criticality_reject; gnb_cu_tnl_association_to_remove->value.present = F1AP_GNB_CU_TNL_Association_To_Remove_ItemIEs__value_PR_GNB_CU_TNL_Association_To_Remove_Item; // 4.1 GNB_CU_TNL_Association_To_Remove_Item F1AP_GNB_CU_TNL_Association_To_Remove_Item_t *gnb_cu_tnl_association_to_remove_item= - &gnb_cu_tnl_association_to_remove->value.choice.GNB_CU_TNL_Association_To_Remove_Item; + &gnb_cu_tnl_association_to_remove->value.choice.GNB_CU_TNL_Association_To_Remove_Item; // 4.1.1 tNLAssociationTransportLayerAddress F1AP_CP_TransportLayerAddress_t *transportLayerAddress= - &gnb_cu_tnl_association_to_remove_item->tNLAssociationTransportLayerAddress; + &gnb_cu_tnl_association_to_remove_item->tNLAssociationTransportLayerAddress; transportLayerAddress->present = F1AP_CP_TransportLayerAddress_PR_endpoint_IP_address; TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(1234, &transportLayerAddress->choice.endpoint_IP_address); @@ -609,7 +608,7 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu for (int i=0; i<1; i++) { asn1cSequenceAdd(ieC3->value.choice.GNB_CU_TNL_Association_To_Update_List.list, - F1AP_GNB_CU_TNL_Association_To_Update_ItemIEs_t, gnb_cu_tnl_association_to_update); + F1AP_GNB_CU_TNL_Association_To_Update_ItemIEs_t, gnb_cu_tnl_association_to_update); gnb_cu_tnl_association_to_update->id = F1AP_ProtocolIE_ID_id_GNB_CU_TNL_Association_To_Update_Item; gnb_cu_tnl_association_to_update->criticality = F1AP_Criticality_reject; gnb_cu_tnl_association_to_update->value.present = F1AP_GNB_CU_TNL_Association_To_Update_ItemIEs__value_PR_GNB_CU_TNL_Association_To_Update_Item; @@ -642,7 +641,7 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu for (int i=0; i<1; i++) { asn1cSequenceAdd(ieC7->value.choice.Cells_to_be_Barred_List.list, - F1AP_Cells_to_be_Barred_ItemIEs_t,cells_to_be_barred); + F1AP_Cells_to_be_Barred_ItemIEs_t,cells_to_be_barred); cells_to_be_barred->id = F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List_Item; cells_to_be_barred->criticality = F1AP_Criticality_reject; cells_to_be_barred->value.present = F1AP_Cells_to_be_Barred_ItemIEs__value_PR_Cells_to_be_Barred_Item; @@ -665,7 +664,7 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu for (int i=0; i<1; i++) { asn1cSequenceAdd(ieC8->value.choice.Protected_EUTRA_Resources_List.list, - F1AP_Protected_EUTRA_Resources_ItemIEs_t, protected_eutra_resources); + F1AP_Protected_EUTRA_Resources_ItemIEs_t, protected_eutra_resources); // 8.1 SpectrumSharingGroupID protected_eutra_resources->id = F1AP_ProtocolIE_ID_id_Protected_EUTRA_Resources_List; protected_eutra_resources->criticality = F1AP_Criticality_reject; @@ -675,11 +674,11 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu sizeof(F1AP_Protected_EUTRA_Resources_Item_t)); asn1cSequenceAdd(protected_eutra_resources->value.choice.ListofEUTRACellsinGNBDUCoordination.list, - F1AP_Served_EUTRA_Cells_Information_t, served_eutra_cells_information); + F1AP_Served_EUTRA_Cells_Information_t, served_eutra_cells_information); memset((void *)&served_eutra_cells_information, 0, sizeof(F1AP_Served_EUTRA_Cells_Information_t)); F1AP_EUTRA_Mode_Info_t *eUTRA_Mode_Info= - &served_eutra_cells_information.eUTRA_Mode_Info; + &served_eutra_cells_information.eUTRA_Mode_Info; // eUTRAFDD eUTRA_Mode_Info->present = F1AP_EUTRA_Mode_Info_PR_eUTRAFDD; diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index 1f6d7d7f44..747ca7be59 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -100,7 +100,6 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, } LOG_I(F1AP, "%s() RRCContainer (CCCH) size %ld: ", __func__, ie->value.choice.RRCContainer.size); - /* DUtoCURRCContainer */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_DUtoCURRCContainer, false); diff --git a/openair2/F1AP/f1ap_cu_task.c b/openair2/F1AP/f1ap_cu_task.c index fbe0508f60..13f08b9458 100644 --- a/openair2/F1AP/f1ap_cu_task.c +++ b/openair2/F1AP/f1ap_cu_task.c @@ -42,7 +42,7 @@ instance_t CUuniqInstance=0; static instance_t cu_task_create_gtpu_instance_to_du(eth_params_t *IPaddrs) { - openAddr_t tmp={0}; + openAddr_t tmp= {0}; strncpy(tmp.originHost, IPaddrs->my_addr, sizeof(tmp.originHost)-1); strncpy(tmp.destinationHost, IPaddrs->remote_addr, sizeof(tmp.destinationHost)-1); sprintf(tmp.originService, "%d", IPaddrs->my_portd); @@ -51,7 +51,7 @@ static instance_t cu_task_create_gtpu_instance_to_du(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) { + eth_params_t *IPaddrs) { createF1inst(true, instance, NULL); // save the assoc id f1ap_setup_req_t *f1ap_cu_data=f1ap_req(true, instance); @@ -90,7 +90,7 @@ static void cu_task_handle_sctp_data_ind(instance_t instance, sctp_data_ind_t *s AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); } -static void cu_task_send_sctp_init_req(instance_t instance, char * my_addr) { +static void cu_task_send_sctp_init_req(instance_t instance, char *my_addr) { // 1. get the itti msg, and retrive the enb_id from the message // 2. use RC.rrc[enb_id] to fill the sctp_init_t with the ip, port // 3. creat an itti message to init @@ -103,7 +103,6 @@ static void cu_task_send_sctp_init_req(instance_t instance, char * my_addr) { message_p->ittiMsg.sctp_init.ipv6 = 0; message_p->ittiMsg.sctp_init.nb_ipv4_addr = 1; message_p->ittiMsg.sctp_init.ipv4_address[0] = inet_addr(my_addr); - /* * SR WARNING: ipv6 multi-homing fails sometimes for localhost. * * * * Disable it for now. @@ -113,7 +112,7 @@ static void cu_task_send_sctp_init_req(instance_t instance, char * my_addr) { itti_send_msg_to_task(TASK_SCTP, instance, message_p); } -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"); @@ -121,13 +120,15 @@ void * F1AP_CU_task(void *arg) { pool_buffer_init(); itti_mark_task_ready(TASK_CU_F1); eth_params_t *IPaddrs; + // Hardcoded instance id! if (RC.nrrrc && RC.nrrrc[0]->node_type == ngran_gNB_CU) IPaddrs=&RC.nrrrc[0]->eth_params_s; - else + else IPaddrs=&RC.rrc[0]->eth_params_s; + cu_task_send_sctp_init_req(0, IPaddrs->my_addr); - + while (1) { itti_receive_msg(TASK_CU_F1, &received_msg); @@ -137,7 +138,7 @@ void * F1AP_CU_task(void *arg) { 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, - IPaddrs); + IPaddrs); break; case SCTP_NEW_ASSOCIATION_RESP: diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 096cd21bac..c68bfb3852 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -113,7 +113,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, ie4->criticality = F1AP_Criticality_reject; ie4->value.present = F1AP_UEContextSetupRequestIEs__value_PR_ServCellIndex; ie4->value.choice.ServCellIndex = 0; - + /* optional */ /* c5. CellULConfigured */ if (0) { @@ -130,6 +130,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, ie6->id = F1AP_ProtocolIE_ID_id_CUtoDURRCInformation; ie6->criticality = F1AP_Criticality_reject; ie6->value.present = F1AP_UEContextSetupRequestIEs__value_PR_CUtoDURRCInformation; + /* optional */ /* 6.1 cG_ConfigInfo */ if (0) { @@ -152,7 +153,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, ie7->id = F1AP_ProtocolIE_ID_id_Candidate_SpCell_List; //90 ie7->criticality = F1AP_Criticality_ignore; ie7->value.present = F1AP_UEContextSetupRequestIEs__value_PR_Candidate_SpCell_List; - + for (int i=0; i<1; i++) { asn1cSequenceAdd(ie7->value.choice.Candidate_SpCell_List.list,F1AP_Candidate_SpCell_ItemIEs_t, candidate_spCell_item_ies); candidate_spCell_item_ies->id = F1AP_ProtocolIE_ID_id_Candidate_SpCell_Item; // 91 @@ -205,13 +206,14 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, OCTET_STRING_fromBuf(&ie9->value.choice.ResourceCoordinationTransferContainer, "asdsa1d32sa1d31asd31as", strlen("asdsa1d32sa1d31asd31as")); } - /* mandatory */ + + /* mandatory */ /* c10. SCell_ToBeSetup_List */ asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupRequestIEs_t, ie10); ie10->id = F1AP_ProtocolIE_ID_id_SCell_ToBeSetup_List; ie10->criticality = F1AP_Criticality_ignore; ie10->value.present = F1AP_UEContextSetupRequestIEs__value_PR_SCell_ToBeSetup_List; - + for (int i=0; i<1; i++) { // asn1cSequenceAdd(ie10->value.choice.SCell_ToBeSetup_List.list, F1AP_SCell_ToBeSetup_ItemIEs_t, scell_toBeSetup_item_ies); @@ -391,7 +393,6 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* 12.1.2.2 sNSSAI */ { /* sST */ - OCTET_STRING_fromBuf(&DRB_Information->sNSSAI.sST, "1", 1); /* OPTIONAL */ @@ -507,16 +508,15 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, int sz=sizeof(f1ap_ue_context_setup_req->drbs_to_be_setup[i].up_dl_tnl[0].tl_address); memcpy(addr.buffer,&f1ap_ue_context_setup_req->drbs_to_be_setup[i].up_dl_tnl[0].tl_address, sz); addr.length = sz*8; - 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->rnti, - f1ap_ue_context_setup_req->drbs_to_be_setup[i].drb_id, - f1ap_ue_context_setup_req->drbs_to_be_setup[i].drb_id, - 0xFFFF, // We will set the right value from DU answer - addr, - f1ap_ue_context_setup_req->drbs_to_be_setup[i].up_dl_tnl[0].port, - cu_f1u_data_req); + newGtpuCreateTunnel(getCxt(CUtype, instance)->gtpInst, + f1ap_ue_context_setup_req->rnti, + f1ap_ue_context_setup_req->drbs_to_be_setup[i].drb_id, + f1ap_ue_context_setup_req->drbs_to_be_setup[i].drb_id, + 0xFFFF, // We will set the right value from DU answer + addr, + f1ap_ue_context_setup_req->drbs_to_be_setup[i].up_dl_tnl[0].port, + cu_f1u_data_req); /* 12.3.1 ULTunnels_ToBeSetup_Item */ asn1cSequenceAdd(drbs_toBeSetup_item->uLUPTNLInformation_ToBeSetup_List.list, F1AP_ULUPTNLInformation_ToBeSetup_Item_t, uLUPTNLInformation_ToBeSetup_Item); @@ -525,10 +525,10 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, gTPTunnel); /* 12.3.1.1.1 transportLayerAddress */ TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(f1ap_ue_context_setup_req->drbs_to_be_setup[i].up_ul_tnl[j].tl_address, - &gTPTunnel->transportLayerAddress); + &gTPTunnel->transportLayerAddress); /* 12.3.1.1.2 gTP_TEID */ INT32_TO_OCTET_STRING(f1ap_ue_context_setup_req->drbs_to_be_setup[i].up_ul_tnl[j].teid, - &gTPTunnel->gTP_TEID); + &gTPTunnel->gTP_TEID); } /* 12.1.4 rLCMode */ @@ -641,111 +641,115 @@ int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup_t *f1ap_ue_context_setup_resp = &F1AP_UE_CONTEXT_SETUP_RESP(msg_p); container = &pdu->choice.successfulOutcome->value.choice.UEContextSetupResponse; int i; - /* GNB_CU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true); - f1ap_ue_context_setup_resp->gNB_CU_ue_id = ie->value.choice.GNB_CU_UE_F1AP_ID; - + f1ap_ue_context_setup_resp->gNB_CU_ue_id = ie->value.choice.GNB_CU_UE_F1AP_ID; LOG_D(F1AP, "f1ap_ue_context_setup_resp->gNB_CU_ue_id is: %d \n", f1ap_ue_context_setup_resp->gNB_CU_ue_id); - /* GNB_DU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true); f1ap_ue_context_setup_resp->gNB_DU_ue_id = ie->value.choice.GNB_DU_UE_F1AP_ID; - LOG_D(F1AP, "f1ap_ue_context_setup_resp->gNB_DU_ue_id is: %d \n", f1ap_ue_context_setup_resp->gNB_DU_ue_id); - f1ap_ue_context_setup_resp->rnti = - f1ap_get_rnti_by_du_id(CUtype, instance, f1ap_ue_context_setup_resp->gNB_DU_ue_id); - - // DUtoCURRCInformation + f1ap_get_rnti_by_du_id(CUtype, instance, f1ap_ue_context_setup_resp->gNB_DU_ue_id); + // DUtoCURRCInformation F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, F1AP_ProtocolIE_ID_id_DUtoCURRCInformation, true); - if (ie == NULL){ + + if (ie == NULL) { LOG_E(F1AP,"%s %d: ie is a NULL pointer \n",__FILE__,__LINE__); return -1; } - f1ap_ue_context_setup_resp->du_to_cu_rrc_information = (uint8_t *)calloc(1,ie->value.choice.DUtoCURRCInformation.cellGroupConfig.size); + f1ap_ue_context_setup_resp->du_to_cu_rrc_information = (uint8_t *)calloc(1,ie->value.choice.DUtoCURRCInformation.cellGroupConfig.size); memcpy(f1ap_ue_context_setup_resp->du_to_cu_rrc_information, ie->value.choice.DUtoCURRCInformation.cellGroupConfig.buf, ie->value.choice.DUtoCURRCInformation.cellGroupConfig.size); f1ap_ue_context_setup_resp->du_to_cu_rrc_information_length = ie->value.choice.DUtoCURRCInformation.cellGroupConfig.size; - - // DRBs_Setup_List + // DRBs_Setup_List F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, F1AP_ProtocolIE_ID_id_DRBs_Setup_List, false); - if(ie!=NULL){ + + if(ie!=NULL) { f1ap_ue_context_setup_resp->drbs_to_be_setup_length = ie->value.choice.DRBs_Setup_List.list.count; f1ap_ue_context_setup_resp->drbs_to_be_setup = calloc(f1ap_ue_context_setup_resp->drbs_to_be_setup_length, sizeof(f1ap_drb_to_be_setup_t)); AssertFatal(f1ap_ue_context_setup_resp->drbs_to_be_setup, - "could not allocate memory for f1ap_ue_context_setup_resp->drbs_setup\n"); + "could not allocate memory for f1ap_ue_context_setup_resp->drbs_setup\n"); + for (i = 0; i < f1ap_ue_context_setup_resp->drbs_to_be_setup_length; ++i) { f1ap_drb_to_be_setup_t *drb_p = &f1ap_ue_context_setup_resp->drbs_to_be_setup[i]; F1AP_DRBs_Setup_Item_t *drbs_setup_item_p; drbs_setup_item_p = &((F1AP_DRBs_Setup_ItemIEs_t *)ie->value.choice.DRBs_Setup_List.list.array[i])->value.choice.DRBs_Setup_Item; drb_p->drb_id = drbs_setup_item_p->dRBID; // TODO in the following, assume only one UP UL TNL is present. - // this matches/assumes OAI CU/DU implementation, can be up to 2! + // this matches/assumes OAI CU/DU implementation, can be up to 2! drb_p->up_dl_tnl_length = 1; AssertFatal(drbs_setup_item_p->dLUPTNLInformation_ToBeSetup_List.list.count > 0, - "no DL UP TNL Information in DRBs to be Setup list\n"); + "no DL UP TNL Information in DRBs to be Setup list\n"); F1AP_DLUPTNLInformation_ToBeSetup_Item_t *dl_up_tnl_info_p = (F1AP_DLUPTNLInformation_ToBeSetup_Item_t *)drbs_setup_item_p->dLUPTNLInformation_ToBeSetup_List.list.array[0]; 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_INT32(&dl_up_tnl0->gTP_TEID, drb_p->up_dl_tnl[0].teid); GtpuUpdateTunnelOutgoingTeid(getCxt(CUtype, instance)->gtpInst, - f1ap_ue_context_setup_resp->rnti, - (ebi_t)drbs_setup_item_p->dRBID, - drb_p->up_dl_tnl[0].teid); + f1ap_ue_context_setup_resp->rnti, + (ebi_t)drbs_setup_item_p->dRBID, + drb_p->up_dl_tnl[0].teid); } } - // SRBs_FailedToBeSetup_List + + // SRBs_FailedToBeSetup_List F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, F1AP_ProtocolIE_ID_id_SRBs_FailedToBeSetup_List, false); - if(ie!=NULL){ + + if(ie!=NULL) { f1ap_ue_context_setup_resp->srbs_failed_to_be_setup_length = ie->value.choice.SRBs_FailedToBeSetup_List.list.count; f1ap_ue_context_setup_resp->srbs_failed_to_be_setup = calloc(f1ap_ue_context_setup_resp->srbs_failed_to_be_setup_length, sizeof(f1ap_rb_failed_to_be_setup_t)); AssertFatal(f1ap_ue_context_setup_resp->srbs_failed_to_be_setup, - "could not allocate memory for f1ap_ue_context_setup_resp->srbs_failed_to_be_setup\n"); + "could not allocate memory for f1ap_ue_context_setup_resp->srbs_failed_to_be_setup\n"); + for (i = 0; i < f1ap_ue_context_setup_resp->srbs_failed_to_be_setup_length; ++i) { f1ap_rb_failed_to_be_setup_t *srb_p = &f1ap_ue_context_setup_resp->srbs_failed_to_be_setup[i]; srb_p->rb_id = ((F1AP_SRBs_FailedToBeSetup_Item_t *)ie->value.choice.SRBs_FailedToBeSetup_List.list.array[i])->sRBID; } - } - // DRBs_FailedToBeSetup_List + + // DRBs_FailedToBeSetup_List F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, F1AP_ProtocolIE_ID_id_DRBs_FailedToBeSetup_List, false); - if(ie!=NULL){ + + if(ie!=NULL) { f1ap_ue_context_setup_resp->drbs_failed_to_be_setup_length = ie->value.choice.DRBs_FailedToBeSetup_List.list.count; f1ap_ue_context_setup_resp->drbs_failed_to_be_setup = calloc(f1ap_ue_context_setup_resp->drbs_failed_to_be_setup_length, sizeof(f1ap_rb_failed_to_be_setup_t)); AssertFatal(f1ap_ue_context_setup_resp->drbs_failed_to_be_setup, - "could not allocate memory for f1ap_ue_context_setup_resp->drbs_failed_to_be_setup\n"); + "could not allocate memory for f1ap_ue_context_setup_resp->drbs_failed_to_be_setup\n"); + for (i = 0; i < f1ap_ue_context_setup_resp->drbs_failed_to_be_setup_length; ++i) { f1ap_rb_failed_to_be_setup_t *drb_p = &f1ap_ue_context_setup_resp->drbs_failed_to_be_setup[i]; drb_p->rb_id = ((F1AP_DRBs_FailedToBeSetup_Item_t *)ie->value.choice.DRBs_FailedToBeSetup_List.list.array[i])->dRBID; } } - // SCell_FailedtoSetup_List + // SCell_FailedtoSetup_List F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, F1AP_ProtocolIE_ID_id_SCell_FailedtoSetup_List, false); - if(ie!=NULL){ + + if(ie!=NULL) { LOG_E (F1AP, "Not supporting handling of SCell_FailedtoSetup_List \n"); } - // SRBs_Setup_List + // SRBs_Setup_List F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupResponseIEs_t, ie, container, - F1AP_ProtocolIE_ID_id_SRBs_Setup_List, false); - if(ie!=NULL){ + F1AP_ProtocolIE_ID_id_SRBs_Setup_List, false); + + if(ie!=NULL) { f1ap_ue_context_setup_resp->srbs_to_be_setup_length = ie->value.choice.SRBs_Setup_List.list.count; f1ap_ue_context_setup_resp->srbs_to_be_setup = calloc(f1ap_ue_context_setup_resp->srbs_to_be_setup_length, sizeof(f1ap_srb_to_be_setup_t)); AssertFatal(f1ap_ue_context_setup_resp->srbs_to_be_setup, - "could not allocate memory for f1ap_ue_context_setup_resp->drbs_setup\n"); + "could not allocate memory for f1ap_ue_context_setup_resp->drbs_setup\n"); + for (i = 0; i < f1ap_ue_context_setup_resp->srbs_to_be_setup_length; ++i) { f1ap_srb_to_be_setup_t *srb_p = &f1ap_ue_context_setup_resp->srbs_to_be_setup[i]; F1AP_SRBs_Setup_Item_t *srbs_setup_item_p; @@ -1063,8 +1067,8 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance) { ie5->value.choice.DRXCycle.longDRXCycleLength = F1AP_LongDRXCycleLength_ms10; // enum if (0) { - asn1cCallocOne(ie5->value.choice.DRXCycle.shortDRXCycleLength, - F1AP_ShortDRXCycleLength_ms2); // enum + asn1cCallocOne(ie5->value.choice.DRXCycle.shortDRXCycleLength, + F1AP_ShortDRXCycleLength_ms2); // enum } if (0) { diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index 22a370024e..12b0559003 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -44,8 +44,10 @@ int to_NRNRB(int nrb) { for (int i=0; isIBmessage.buf, size); - F1AP_SETUP_RESP (msg_p).cells_to_activate[i].SI_type[si]=sib_item->sIBtype; + F1AP_SETUP_RESP (msg_p).cells_to_activate[i].SI_type[si]=sib_item->sIBtype; } break; @@ -869,7 +871,7 @@ int DU_handle_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, memcpy((void *)F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].SI_container[si], (void *)sib_item->sIBmessage.buf, size); - F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].SI_type[si]=sib_item->sIBtype; + F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p).cells_to_activate[i].SI_type[si]=sib_item->sIBtype; } break; diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index c456f9e2d2..ba7a32398e 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -137,7 +137,6 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, /* RRC Container */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_RRCContainer, true); - rrc_dl_sdu_len = ie->value.choice.RRCContainer.size; /* optional */ @@ -763,7 +762,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instanceP, LOG_E(F1AP, "Failed to add UE \n"); return -1; } - + /* Create */ /* 0. Message Type */ pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; @@ -920,7 +919,7 @@ int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, LOG_E(F1AP, "Failed to find the F1AP UID \n"); //return -1; } - + /* optional */ /* oldgNB_DU_UE_F1AP_ID */ if (0) { @@ -932,7 +931,6 @@ int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, /* SRBID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_SRBID, true); - uint64_t srb_id = ie->value.choice.SRBID; LOG_D(F1AP, "srb_id %lu \n", srb_id); @@ -985,13 +983,12 @@ int DU_handle_DL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, // decode RRC Container and act on the message type AssertFatal(srb_id<3,"illegal srb_id\n"); - MessageDef * msg = itti_alloc_new_message(TASK_DU_F1, 0, NR_DU_RRC_DL_INDICATION); - NRDuDlReq_t * req=&NRDuDlReq(msg); + MessageDef *msg = itti_alloc_new_message(TASK_DU_F1, 0, NR_DU_RRC_DL_INDICATION); + NRDuDlReq_t *req=&NRDuDlReq(msg); req->rnti=f1ap_get_rnti_by_du_id(DUtype, instance, du_ue_f1ap_id); req->srb_id=srb_id; req->buf= get_free_mem_block( ie->value.choice.RRCContainer.size, __func__); memcpy(req->buf->data, ie->value.choice.RRCContainer.buf, ie->value.choice.RRCContainer.size); itti_send_msg_to_task(TASK_RRC_GNB, instance, msg); - return 0; } diff --git a/openair2/F1AP/f1ap_du_task.c b/openair2/F1AP/f1ap_du_task.c index ff072f3269..537f0060ae 100644 --- a/openair2/F1AP/f1ap_du_task.c +++ b/openair2/F1AP/f1ap_du_task.c @@ -85,7 +85,6 @@ void du_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat f1ap_du_data->sctp_out_streams = sctp_new_association_resp->out_streams; f1ap_du_data->default_sctp_stream_id = 0; /* setup parameters for F1U and start the server */ - DU_send_F1_SETUP_REQUEST(instance); } @@ -98,8 +97,8 @@ void du_task_handle_sctp_data_ind(instance_t instance, sctp_data_ind_t *sctp_dat AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); } -static instance_t du_create_gtpu_instance_to_cu(char* CUaddr, uint16_t CUport, char * DUaddr, uint16_t DUport) { - openAddr_t tmp={0}; +static instance_t du_create_gtpu_instance_to_cu(char *CUaddr, uint16_t CUport, char *DUaddr, uint16_t DUport) { + openAddr_t tmp= {0}; strncpy(tmp.originHost, DUaddr, sizeof(tmp.originHost)-1); strncpy(tmp.destinationHost, CUaddr, sizeof(tmp.destinationHost)-1); sprintf(tmp.originService, "%d", DUport); @@ -121,22 +120,22 @@ void *F1AP_DU_task(void *arg) { switch (ITTI_MSG_ID(msg)) { case F1AP_SETUP_REQ: - // this is not a true F1 message, but rather an ITTI message sent by enb_app + // this is not a true F1 message, but rather an ITTI message sent by enb_app // 1. save the itti msg so that you can use it to sen f1ap_setup_req, 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 - LOG_I(F1AP, "DU Task Received F1AP_SETUP_REQ\n"); - f1ap_setup_req_t * msgSetup=&F1AP_SETUP_REQ(msg); + LOG_I(F1AP, "DU Task Received F1AP_SETUP_REQ\n"); + f1ap_setup_req_t *msgSetup=&F1AP_SETUP_REQ(msg); createF1inst(false, myInstance, msgSetup); - getCxt(DUtype, myInstance)->gtpInst=du_create_gtpu_instance_to_cu(msgSetup->CU_f1_ip_address.ipv4_address, - msgSetup->CUport, - msgSetup->DU_f1_ip_address.ipv4_address, - msgSetup->DUport); - AssertFatal(getCxt(DUtype, myInstance)->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, myInstance)->gtpInst; + getCxt(DUtype, myInstance)->gtpInst=du_create_gtpu_instance_to_cu(msgSetup->CU_f1_ip_address.ipv4_address, + msgSetup->CUport, + msgSetup->DU_f1_ip_address.ipv4_address, + msgSetup->DUport); + AssertFatal(getCxt(DUtype, myInstance)->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, myInstance)->gtpInst; du_task_send_sctp_association_req(myInstance,msgSetup); break; diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index ce1743b349..a825fab7ff 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -43,15 +43,15 @@ #include boolean_t lteDURecvCb( protocol_ctxt_t *ctxt_pP, - const srb_flag_t srb_flagP, - const rb_id_t rb_idP, - const mui_t muiP, - const confirm_t confirmP, - const sdu_size_t sdu_buffer_sizeP, - unsigned char *const sdu_buffer_pP, - const pdcp_transmission_mode_t modeP, - const uint32_t *sourceL2Id, - const uint32_t *destinationL2Id) { + const srb_flag_t srb_flagP, + const rb_id_t rb_idP, + const mui_t muiP, + const confirm_t confirmP, + const sdu_size_t sdu_buffer_sizeP, + unsigned char *const sdu_buffer_pP, + const pdcp_transmission_mode_t modeP, + const uint32_t *sourceL2Id, + const uint32_t *destinationL2Id) { // The buffer comes from the stack in gtp-u thread, we have a make a separate buffer to enqueue in a inter-thread message queue mem_block_t *sdu=get_free_mem_block(sdu_buffer_sizeP, __func__); memcpy(sdu->data, sdu_buffer_pP, sdu_buffer_sizeP); @@ -134,53 +134,55 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* DRB */ F1AP_UEContextSetupRequestIEs_t *ieDrb; F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ieDrb, container, - F1AP_ProtocolIE_ID_id_DRBs_ToBeSetup_List, false); - + F1AP_ProtocolIE_ID_id_DRBs_ToBeSetup_List, false); + if(ieDrb!=NULL) { f1ap_ue_context_setup_req->drbs_to_be_setup_length = ieDrb->value.choice.DRBs_ToBeSetup_List.list.count; f1ap_ue_context_setup_req->drbs_to_be_setup = calloc(f1ap_ue_context_setup_req->drbs_to_be_setup_length, - sizeof(f1ap_drb_to_be_setup_t)); + sizeof(f1ap_drb_to_be_setup_t)); AssertFatal(f1ap_ue_context_setup_req->drbs_to_be_setup, - "could not allocate memory for f1ap_ue_context_setup_req->drbs_to_be_setup\n"); - + "could not allocate memory for f1ap_ue_context_setup_req->drbs_to_be_setup\n"); + for (i = 0; i < f1ap_ue_context_setup_req->drbs_to_be_setup_length; ++i) { f1ap_drb_to_be_setup_t *drb_p = &f1ap_ue_context_setup_req->drbs_to_be_setup[i]; F1AP_DRBs_ToBeSetup_Item_t *drbs_tobesetup_item_p = - &((F1AP_DRBs_ToBeSetup_ItemIEs_t *)ieDrb->value.choice.DRBs_ToBeSetup_List.list.array[i])->value.choice.DRBs_ToBeSetup_Item; + &((F1AP_DRBs_ToBeSetup_ItemIEs_t *)ieDrb->value.choice.DRBs_ToBeSetup_List.list.array[i])->value.choice.DRBs_ToBeSetup_Item; drb_p->drb_id = drbs_tobesetup_item_p->dRBID; /* TODO in the following, assume only one UP UL TNL is present. * this matches/assumes OAI CU implementation, can be up to 2! */ drb_p->up_ul_tnl_length = 1; AssertFatal(drbs_tobesetup_item_p->uLUPTNLInformation_ToBeSetup_List.list.count > 0, - "no UL UP TNL Information in DRBs to be Setup list\n"); + "no UL UP TNL Information in DRBs to be Setup list\n"); F1AP_ULUPTNLInformation_ToBeSetup_Item_t *ul_up_tnl_info_p = (F1AP_ULUPTNLInformation_ToBeSetup_Item_t *)drbs_tobesetup_item_p->uLUPTNLInformation_ToBeSetup_List.list.array[0]; F1AP_GTPTunnel_t *ul_up_tnl0 = ul_up_tnl_info_p->uLUPTNLInformation.choice.gTPTunnel; BIT_STRING_TO_TRANSPORT_LAYER_ADDRESS_IPv4(&ul_up_tnl0->transportLayerAddress, drb_p->up_ul_tnl[0].tl_address); OCTET_STRING_TO_INT32(&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; + switch (drbs_tobesetup_item_p->rLCMode) { - case F1AP_RLCMode_rlc_am: - drb_p->rlc_mode = RLC_MODE_AM; - break; - - default: - drb_p->rlc_mode = RLC_MODE_TM; - break; + case F1AP_RLCMode_rlc_am: + drb_p->rlc_mode = RLC_MODE_AM; + break; + + default: + drb_p->rlc_mode = RLC_MODE_TM; + break; } + if (!(RC.nrrrc && RC.nrrrc[instance]->node_type == ngran_gNB_DU)) { - transport_layer_addr_t addr; + transport_layer_addr_t addr; memcpy(addr.buffer, &drb_p->up_ul_tnl[0].tl_address, sizeof(drb_p->up_ul_tnl[0].tl_address)); addr.length=sizeof(drb_p->up_ul_tnl[0].tl_address)*8; drb_p->up_dl_tnl[0].teid=newGtpuCreateTunnel(INSTANCE_DEFAULT, - f1ap_ue_context_setup_req->rnti, - drb_p->drb_id, - drb_p->drb_id, - drb_p->up_ul_tnl[0].teid, - addr, - drb_p->up_ul_tnl[0].port, - lteDURecvCb); - drb_p->up_dl_tnl_length++; + f1ap_ue_context_setup_req->rnti, + drb_p->drb_id, + drb_p->drb_id, + drb_p->up_ul_tnl[0].teid, + addr, + drb_p->up_ul_tnl[0].port, + lteDURecvCb); + drb_p->up_dl_tnl_length++; } } } @@ -188,15 +190,15 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /* SRB */ F1AP_UEContextSetupRequestIEs_t *ieSrb; F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ieSrb, container, - F1AP_ProtocolIE_ID_id_SRBs_ToBeSetup_List, false); - + F1AP_ProtocolIE_ID_id_SRBs_ToBeSetup_List, false); + if(ieSrb != NULL) { f1ap_ue_context_setup_req->srbs_to_be_setup_length = ieSrb->value.choice.SRBs_ToBeSetup_List.list.count; f1ap_ue_context_setup_req->srbs_to_be_setup = calloc(f1ap_ue_context_setup_req->srbs_to_be_setup_length, - sizeof(f1ap_srb_to_be_setup_t)); + sizeof(f1ap_srb_to_be_setup_t)); AssertFatal(f1ap_ue_context_setup_req->srbs_to_be_setup, - "could not allocate memory for f1ap_ue_context_setup_req->srbs_to_be_setup\n"); - + "could not allocate memory for f1ap_ue_context_setup_req->srbs_to_be_setup\n"); + for (i = 0; i < f1ap_ue_context_setup_req->srbs_to_be_setup_length; ++i) { f1ap_srb_to_be_setup_t *srb_p = &f1ap_ue_context_setup_req->srbs_to_be_setup[i]; F1AP_SRBs_ToBeSetup_Item_t *srbs_tobesetup_item_p; @@ -234,11 +236,12 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, LOG_W(F1AP, "can't find RRCContainer in UEContextSetupRequestIEs by id %ld \n", F1AP_ProtocolIE_ID_id_RRCContainer); } - if (RC.nrrrc && RC.nrrrc[instance]->node_type == ngran_gNB_DU) + if (RC.nrrrc && RC.nrrrc[instance]->node_type == ngran_gNB_DU) itti_send_msg_to_task(TASK_RRC_GNB, instance, msg_p); else // in 4G, race conditon is to fix DU_send_UE_CONTEXT_SETUP_RESPONSE(instance, f1ap_ue_context_setup_req); + return 0; } @@ -261,7 +264,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup ie1->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID; ie1->criticality = F1AP_Criticality_reject; ie1->value.present = F1AP_UEContextSetupResponseIEs__value_PR_GNB_CU_UE_F1AP_ID; - ie1->value.choice.GNB_CU_UE_F1AP_ID = req->gNB_CU_ue_id; + ie1->value.choice.GNB_CU_UE_F1AP_ID = req->gNB_CU_ue_id; /* mandatory */ /* c2. GNB_DU_UE_F1AP_ID */ asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie2); @@ -269,33 +272,32 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup ie2->criticality = F1AP_Criticality_reject; ie2->value.present = F1AP_UEContextSetupResponseIEs__value_PR_GNB_DU_UE_F1AP_ID; ie2->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(DUtype, instance, req->rnti); - /* mandatory */ /* c3. DUtoCURRCInformation */ //if (0) { - asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie3); - ie3->id = F1AP_ProtocolIE_ID_id_DUtoCURRCInformation; - ie3->criticality = F1AP_Criticality_reject; - ie3->value.present = F1AP_UEContextSetupResponseIEs__value_PR_DUtoCURRCInformation; - { - /* cellGroupConfig */ - OCTET_STRING_fromBuf(&ie3->value.choice.DUtoCURRCInformation.cellGroupConfig, (const char *)req->du_to_cu_rrc_information, - req->du_to_cu_rrc_information_length); + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie3); + ie3->id = F1AP_ProtocolIE_ID_id_DUtoCURRCInformation; + ie3->criticality = F1AP_Criticality_reject; + ie3->value.present = F1AP_UEContextSetupResponseIEs__value_PR_DUtoCURRCInformation; + { + /* cellGroupConfig */ + OCTET_STRING_fromBuf(&ie3->value.choice.DUtoCURRCInformation.cellGroupConfig, (const char *)req->du_to_cu_rrc_information, + req->du_to_cu_rrc_information_length); - /* OPTIONAL */ - /* measGapConfig */ - if (0) { - asn1cCalloc(ie3->value.choice.DUtoCURRCInformation.measGapConfig, tmp); - OCTET_STRING_fromBuf(tmp, "asdsa", strlen("asdsa")); - } - - /* OPTIONAL */ - /* requestedP_MaxFR1 */ - if (0) { - asn1cCalloc(ie3->value.choice.DUtoCURRCInformation.requestedP_MaxFR1, tmp); - OCTET_STRING_fromBuf(tmp, "asdsa", strlen("asdsa")); - } + /* OPTIONAL */ + /* measGapConfig */ + if (0) { + asn1cCalloc(ie3->value.choice.DUtoCURRCInformation.measGapConfig, tmp); + OCTET_STRING_fromBuf(tmp, "asdsa", strlen("asdsa")); } + + /* OPTIONAL */ + /* requestedP_MaxFR1 */ + if (0) { + asn1cCalloc(ie3->value.choice.DUtoCURRCInformation.requestedP_MaxFR1, tmp); + OCTET_STRING_fromBuf(tmp, "asdsa", strlen("asdsa")); + } + } //} /* optional */ @@ -337,6 +339,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup ie7->id = F1AP_ProtocolIE_ID_id_DRBs_Setup_List; ie7->criticality = F1AP_Criticality_ignore; ie7->value.present = F1AP_UEContextSetupResponseIEs__value_PR_DRBs_Setup_List; + for (int i=0; i< req->drbs_to_be_setup_length; i++) { // asn1cSequenceAdd(ie7->value.choice.DRBs_Setup_List.list, @@ -375,148 +378,148 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup /* mandatory */ /* c8. SRBs_FailedToBeSetup_List */ - if(0){ - asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie8); - ie8->id = F1AP_ProtocolIE_ID_id_SRBs_FailedToBeSetup_List; - ie8->criticality = F1AP_Criticality_ignore; - ie8->value.present = F1AP_UEContextSetupResponseIEs__value_PR_SRBs_FailedToBeSetup_List; + if(0) { + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie8); + ie8->id = F1AP_ProtocolIE_ID_id_SRBs_FailedToBeSetup_List; + ie8->criticality = F1AP_Criticality_ignore; + ie8->value.present = F1AP_UEContextSetupResponseIEs__value_PR_SRBs_FailedToBeSetup_List; - for (int i=0; i<1; i++) { - // - asn1cSequenceAdd(ie8->value.choice.SRBs_FailedToBeSetup_List.list, - F1AP_SRBs_FailedToBeSetup_ItemIEs_t, srbs_failedToBeSetup_item_ies); - srbs_failedToBeSetup_item_ies->id = F1AP_ProtocolIE_ID_id_SRBs_FailedToBeSetup_Item; - srbs_failedToBeSetup_item_ies->criticality = F1AP_Criticality_ignore; - srbs_failedToBeSetup_item_ies->value.present = F1AP_SRBs_FailedToBeSetup_ItemIEs__value_PR_SRBs_FailedToBeSetup_Item; - /* 8.1 SRBs_Setup_Item */ - F1AP_SRBs_FailedToBeSetup_Item_t *srbs_failedToBeSetup_item= - &srbs_failedToBeSetup_item_ies->value.choice.SRBs_FailedToBeSetup_Item; - /* sRBID */ - srbs_failedToBeSetup_item->sRBID = 13L; - /* cause */ - asn1cCalloc(srbs_failedToBeSetup_item->cause, tmp); - // dummy value - tmp->present = F1AP_Cause_PR_radioNetwork; + for (int i=0; i<1; i++) { + // + asn1cSequenceAdd(ie8->value.choice.SRBs_FailedToBeSetup_List.list, + F1AP_SRBs_FailedToBeSetup_ItemIEs_t, srbs_failedToBeSetup_item_ies); + srbs_failedToBeSetup_item_ies->id = F1AP_ProtocolIE_ID_id_SRBs_FailedToBeSetup_Item; + srbs_failedToBeSetup_item_ies->criticality = F1AP_Criticality_ignore; + srbs_failedToBeSetup_item_ies->value.present = F1AP_SRBs_FailedToBeSetup_ItemIEs__value_PR_SRBs_FailedToBeSetup_Item; + /* 8.1 SRBs_Setup_Item */ + F1AP_SRBs_FailedToBeSetup_Item_t *srbs_failedToBeSetup_item= + &srbs_failedToBeSetup_item_ies->value.choice.SRBs_FailedToBeSetup_Item; + /* sRBID */ + srbs_failedToBeSetup_item->sRBID = 13L; + /* cause */ + asn1cCalloc(srbs_failedToBeSetup_item->cause, tmp); + // dummy value + tmp->present = F1AP_Cause_PR_radioNetwork; - switch(tmp->present) { - case F1AP_Cause_PR_radioNetwork: - tmp->choice.radioNetwork = F1AP_CauseRadioNetwork_unspecified; - break; + switch(tmp->present) { + case F1AP_Cause_PR_radioNetwork: + tmp->choice.radioNetwork = F1AP_CauseRadioNetwork_unspecified; + break; - case F1AP_Cause_PR_transport: - tmp->choice.transport = F1AP_CauseTransport_unspecified; - break; + case F1AP_Cause_PR_transport: + tmp->choice.transport = F1AP_CauseTransport_unspecified; + break; - case F1AP_Cause_PR_protocol: - tmp->choice.protocol = F1AP_CauseProtocol_unspecified; - break; + case F1AP_Cause_PR_protocol: + tmp->choice.protocol = F1AP_CauseProtocol_unspecified; + break; - case F1AP_Cause_PR_misc: - tmp->choice.misc = F1AP_CauseMisc_unspecified; - break; + case F1AP_Cause_PR_misc: + tmp->choice.misc = F1AP_CauseMisc_unspecified; + break; - case F1AP_Cause_PR_NOTHING: - default: - break; - } // switch - } // for i + case F1AP_Cause_PR_NOTHING: + default: + break; + } // switch + } // for i } /* */ /* c9. DRBs_FailedToBeSetup_List */ - if(0){ - asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie9); - ie9->id = F1AP_ProtocolIE_ID_id_DRBs_FailedToBeSetup_List; - ie9->criticality = F1AP_Criticality_ignore; - ie9->value.present = F1AP_UEContextSetupResponseIEs__value_PR_DRBs_FailedToBeSetup_List; + if(0) { + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie9); + ie9->id = F1AP_ProtocolIE_ID_id_DRBs_FailedToBeSetup_List; + ie9->criticality = F1AP_Criticality_ignore; + ie9->value.present = F1AP_UEContextSetupResponseIEs__value_PR_DRBs_FailedToBeSetup_List; - for (int i=0; i<1; i++) { - asn1cSequenceAdd(ie9->value.choice.DRBs_FailedToBeSetup_List.list, - F1AP_DRBs_FailedToBeSetup_ItemIEs_t, drbs_failedToBeSetup_item_ies); - drbs_failedToBeSetup_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_FailedToBeSetup_Item; - drbs_failedToBeSetup_item_ies->criticality = F1AP_Criticality_ignore; - drbs_failedToBeSetup_item_ies->value.present = F1AP_DRBs_FailedToBeSetup_ItemIEs__value_PR_DRBs_FailedToBeSetup_Item; - /* 9.1 DRBs_Setup_Item */ - /* ADD */ - F1AP_DRBs_FailedToBeSetup_Item_t *drbs_failedToBeSetup_item= - &drbs_failedToBeSetup_item_ies->value.choice.DRBs_FailedToBeSetup_Item; - /* dRBID */ - drbs_failedToBeSetup_item->dRBID = 14; - /* cause */ - asn1cCalloc(drbs_failedToBeSetup_item->cause,tmp); - // dummy value - tmp->present = F1AP_Cause_PR_radioNetwork; + for (int i=0; i<1; i++) { + asn1cSequenceAdd(ie9->value.choice.DRBs_FailedToBeSetup_List.list, + F1AP_DRBs_FailedToBeSetup_ItemIEs_t, drbs_failedToBeSetup_item_ies); + drbs_failedToBeSetup_item_ies->id = F1AP_ProtocolIE_ID_id_DRBs_FailedToBeSetup_Item; + drbs_failedToBeSetup_item_ies->criticality = F1AP_Criticality_ignore; + drbs_failedToBeSetup_item_ies->value.present = F1AP_DRBs_FailedToBeSetup_ItemIEs__value_PR_DRBs_FailedToBeSetup_Item; + /* 9.1 DRBs_Setup_Item */ + /* ADD */ + F1AP_DRBs_FailedToBeSetup_Item_t *drbs_failedToBeSetup_item= + &drbs_failedToBeSetup_item_ies->value.choice.DRBs_FailedToBeSetup_Item; + /* dRBID */ + drbs_failedToBeSetup_item->dRBID = 14; + /* cause */ + asn1cCalloc(drbs_failedToBeSetup_item->cause,tmp); + // dummy value + tmp->present = F1AP_Cause_PR_radioNetwork; - switch(tmp->present) { - case F1AP_Cause_PR_radioNetwork: - tmp->choice.radioNetwork = F1AP_CauseRadioNetwork_unspecified; - break; + switch(tmp->present) { + case F1AP_Cause_PR_radioNetwork: + tmp->choice.radioNetwork = F1AP_CauseRadioNetwork_unspecified; + break; - case F1AP_Cause_PR_transport: - tmp->choice.transport = F1AP_CauseTransport_unspecified; - break; + case F1AP_Cause_PR_transport: + tmp->choice.transport = F1AP_CauseTransport_unspecified; + break; - case F1AP_Cause_PR_protocol: - tmp->choice.protocol = F1AP_CauseProtocol_unspecified; - break; + case F1AP_Cause_PR_protocol: + tmp->choice.protocol = F1AP_CauseProtocol_unspecified; + break; - case F1AP_Cause_PR_misc: - tmp->choice.misc = F1AP_CauseMisc_unspecified; - break; + case F1AP_Cause_PR_misc: + tmp->choice.misc = F1AP_CauseMisc_unspecified; + break; - case F1AP_Cause_PR_NOTHING: - default: - break; - } // switch - } // for i + case F1AP_Cause_PR_NOTHING: + default: + break; + } // switch + } // for i } // /* */ /* c10. SCell_FailedtoSetup_List */ - if(0){ - asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie10); - ie10->id = F1AP_ProtocolIE_ID_id_SCell_FailedtoSetup_List; - ie10->criticality = F1AP_Criticality_ignore; - ie10->value.present = F1AP_UEContextSetupResponseIEs__value_PR_SCell_FailedtoSetup_List; + if(0) { + asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie10); + ie10->id = F1AP_ProtocolIE_ID_id_SCell_FailedtoSetup_List; + ie10->criticality = F1AP_Criticality_ignore; + ie10->value.present = F1AP_UEContextSetupResponseIEs__value_PR_SCell_FailedtoSetup_List; - for (int i=0; i<1; i++) { - asn1cSequenceAdd(ie10->value.choice.SCell_FailedtoSetup_List.list, - F1AP_SCell_FailedtoSetup_ItemIEs_t, sCell_FailedtoSetup_item_ies); - sCell_FailedtoSetup_item_ies->id = F1AP_ProtocolIE_ID_id_SCell_FailedtoSetup_Item; - 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= - &sCell_FailedtoSetup_item_ies->value.choice.SCell_FailedtoSetup_Item; - /* sCell_ID */ - addnRCGI(sCell_FailedtoSetup_item->sCell_ID,f1ap_req(false, instance)->cell+i); - /* cause */ - asn1cCalloc(sCell_FailedtoSetup_item->cause, tmp); - // dummy value - tmp->present = F1AP_Cause_PR_radioNetwork; + for (int i=0; i<1; i++) { + asn1cSequenceAdd(ie10->value.choice.SCell_FailedtoSetup_List.list, + F1AP_SCell_FailedtoSetup_ItemIEs_t, sCell_FailedtoSetup_item_ies); + sCell_FailedtoSetup_item_ies->id = F1AP_ProtocolIE_ID_id_SCell_FailedtoSetup_Item; + 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= + &sCell_FailedtoSetup_item_ies->value.choice.SCell_FailedtoSetup_Item; + /* sCell_ID */ + addnRCGI(sCell_FailedtoSetup_item->sCell_ID,f1ap_req(false, instance)->cell+i); + /* cause */ + asn1cCalloc(sCell_FailedtoSetup_item->cause, tmp); + // dummy value + tmp->present = F1AP_Cause_PR_radioNetwork; - switch(tmp->present) { - case F1AP_Cause_PR_radioNetwork: - tmp->choice.radioNetwork = F1AP_CauseRadioNetwork_unspecified; - break; + switch(tmp->present) { + case F1AP_Cause_PR_radioNetwork: + tmp->choice.radioNetwork = F1AP_CauseRadioNetwork_unspecified; + break; - case F1AP_Cause_PR_transport: - tmp->choice.transport = F1AP_CauseTransport_unspecified; - break; + case F1AP_Cause_PR_transport: + tmp->choice.transport = F1AP_CauseTransport_unspecified; + break; - case F1AP_Cause_PR_protocol: - tmp->choice.protocol = F1AP_CauseProtocol_unspecified; - break; + case F1AP_Cause_PR_protocol: + tmp->choice.protocol = F1AP_CauseProtocol_unspecified; + break; - case F1AP_Cause_PR_misc: - tmp->choice.misc = F1AP_CauseMisc_unspecified; - break; + case F1AP_Cause_PR_misc: + tmp->choice.misc = F1AP_CauseMisc_unspecified; + break; - case F1AP_Cause_PR_NOTHING: - default: - break; - } // switch - } // for i + case F1AP_Cause_PR_NOTHING: + default: + break; + } // switch + } // for i } /* mandatory */ @@ -528,7 +531,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup for (int i=0; i< req->srbs_to_be_setup_length; i++) {// asn1cSequenceAdd(ie11->value.choice.SRBs_Setup_List.list, - F1AP_SRBs_Setup_ItemIEs_t, srbs_setup_item_ies); + F1AP_SRBs_Setup_ItemIEs_t, srbs_setup_item_ies); srbs_setup_item_ies->id = F1AP_ProtocolIE_ID_id_SRBs_Setup_Item; srbs_setup_item_ies->criticality = F1AP_Criticality_ignore; srbs_setup_item_ies->value.present = F1AP_SRBs_Setup_ItemIEs__value_PR_SRBs_Setup_Item; @@ -679,7 +682,6 @@ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, AssertFatal(ctxt.rnti == rnti, "RNTI obtained through DU ID (%x) is different from CU ID (%x)\n", rnti, ctxt.rnti); - int UE_out_of_sync = 0; if (RC.nrrrc && RC.nrrrc[instance]->node_type == ngran_gNB_DU) { @@ -753,34 +755,32 @@ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, DU_send_UE_CONTEXT_RELEASE_COMPLETE(instance, &cplt); return 0; } else { - struct rrc_eNB_ue_context_s *ue_context_p; - ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ctxt.instance], ctxt.rnti); - + if (ue_context_p && !UE_out_of_sync) { /* UE exists and is in sync so we start a timer before releasing the * connection */ pthread_mutex_lock(&rrc_release_freelist); - + for (uint16_t release_num = 0; release_num < NUMBER_OF_UE_MAX; release_num++) { - if (rrc_release_info.RRC_release_ctrl[release_num].flag == 0) { - if (ue_context_p->ue_context.ue_release_timer_s1 > 0) - rrc_release_info.RRC_release_ctrl[release_num].flag = 1; - else - rrc_release_info.RRC_release_ctrl[release_num].flag = 2; - - rrc_release_info.RRC_release_ctrl[release_num].rnti = ctxt.rnti; - LOG_D(F1AP, "add rrc_release_info RNTI %x\n", ctxt.rnti); - // TODO: how to provide the correct MUI? - rrc_release_info.RRC_release_ctrl[release_num].rrc_eNB_mui = 0; - rrc_release_info.num_UEs++; - LOG_D(RRC,"Generate DLSCH Release send: index %d rnti %x mui %d flag %d \n",release_num, - ctxt.rnti, 0, rrc_release_info.RRC_release_ctrl[release_num].flag); - break; - } + if (rrc_release_info.RRC_release_ctrl[release_num].flag == 0) { + if (ue_context_p->ue_context.ue_release_timer_s1 > 0) + rrc_release_info.RRC_release_ctrl[release_num].flag = 1; + else + rrc_release_info.RRC_release_ctrl[release_num].flag = 2; + + rrc_release_info.RRC_release_ctrl[release_num].rnti = ctxt.rnti; + LOG_D(F1AP, "add rrc_release_info RNTI %x\n", ctxt.rnti); + // TODO: how to provide the correct MUI? + rrc_release_info.RRC_release_ctrl[release_num].rrc_eNB_mui = 0; + rrc_release_info.num_UEs++; + LOG_D(RRC,"Generate DLSCH Release send: index %d rnti %x mui %d flag %d \n",release_num, + ctxt.rnti, 0, rrc_release_info.RRC_release_ctrl[release_num].flag); + break; + } } - + pthread_mutex_unlock(&rrc_release_freelist); ue_context_p->ue_context.ue_release_timer_s1 = 0; } else if (ue_context_p && UE_out_of_sync) { @@ -789,7 +789,7 @@ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, } else { LOG_E(F1AP, "no ue_context for RNTI %x, acknowledging release\n", rnti); } - + /* TODO send this once the connection has really been released */ f1ap_ue_context_release_cplt_t cplt; cplt.rnti = ctxt.rnti; diff --git a/openair2/F1AP/f1ap_encoder.c b/openair2/F1AP/f1ap_encoder.c index f1208565bb..e623e66536 100644 --- a/openair2/F1AP/f1ap_encoder.c +++ b/openair2/F1AP/f1ap_encoder.c @@ -50,10 +50,12 @@ int f1ap_encode_pdu(F1AP_F1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *length) { char errbuf[128]; /* Buffer for error message */ size_t errlen = sizeof(errbuf); /* Size of the buffer */ int ret = asn_check_constraints(&asn_DEF_F1AP_F1AP_PDU, pdu, errbuf, &errlen); + /* assert(errlen < sizeof(errbuf)); // Guaranteed: you may rely on that */ if(ret) { fprintf(stderr, "Constraint validation failed: %s\n", errbuf); } + encoded = aper_encode_to_new_buffer(&asn_DEF_F1AP_F1AP_PDU, 0, pdu, (void **)buffer); if (encoded < 0) { diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index a12a53814c..86899520a0 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -472,7 +472,7 @@ teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int incoming_bearer char ip4[INET_ADDRSTRLEN]; char ip6[INET6_ADDRSTRLEN]; LOG_I(GTPU, "[%ld] Created tunnel for RNTI %x, teid for DL: %x, teid for UL %x to remote IPv4: %s, IPv6 %s\n", - instance, + instance, rnti, tmp->teid_incoming, tmp->teid_outgoing, @@ -485,7 +485,7 @@ int ocp_gtpv1u_create_s1u_tunnel(instance_t instance, const gtpv1u_enb_create_tunnel_req_t *create_tunnel_req, gtpv1u_enb_create_tunnel_resp_t *create_tunnel_resp) { LOG_D(GTPU, "[%ld] Start create tunnels for RNTI %x, num_tunnels %d, sgw_S1u_teid %x\n", - instance, + instance, create_tunnel_req->rnti, create_tunnel_req->num_tunnels, create_tunnel_req->sgw_S1u_teid[0]); @@ -520,7 +520,7 @@ int ocp_gtpv1u_update_s1u_tunnel( const rnti_t prior_rnti ) { LOG_D(GTPU, "[%ld] Start update tunnels for old RNTI %x, new RNTI %x, num_tunnels %d, sgw_S1u_teid %x, eps_bearer_id %x\n", - instance, + instance, prior_rnti, create_tunnel_req->rnti, create_tunnel_req->num_tunnels, @@ -553,7 +553,7 @@ int gtpv1u_create_ngu_tunnel( const instance_t instance, const gtpv1u_gnb_create_tunnel_req_t *const create_tunnel_req, gtpv1u_gnb_create_tunnel_resp_t *const create_tunnel_resp) { LOG_D(GTPU, "[%ld] Start create tunnels for RNTI %x, num_tunnels %d, sgw_S1u_teid %x\n", - instance, + instance, create_tunnel_req->rnti, create_tunnel_req->num_tunnels, create_tunnel_req->outgoing_teid[0]); From cbd6a2ff1b4a64668cc9c4db1e97755d0667b23a Mon Sep 17 00:00:00 2001 From: matzakos Date: Mon, 4 Oct 2021 11:35:31 +0200 Subject: [PATCH 091/110] Remove typo in 5G CU config. file used from the CI --- ci-scripts/conf_files/gNB_SA_CU.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci-scripts/conf_files/gNB_SA_CU.conf b/ci-scripts/conf_files/gNB_SA_CU.conf index 684588de36..b00d5691d6 100644 --- a/ci-scripts/conf_files/gNB_SA_CU.conf +++ b/ci-scripts/conf_files/gNB_SA_CU.conf @@ -65,8 +65,8 @@ gNBs = GNB_INTERFACE_NAME_FOR_NG_AMF = "eth0"; GNB_IPV4_ADDRESS_FOR_NG_AMF = "CI_GNB_IP_ADDR"; - GNB_INTERFACE_NAME_FOR_NGU = "bond0"; - GNB_IPV4_ADDRESS_FOR_NGU = ""CI_GNB_IP_ADDR"; + GNB_INTERFACE_NAME_FOR_NGU = "eth0"; + GNB_IPV4_ADDRESS_FOR_NGU = "CI_GNB_IP_ADDR"; GNB_PORT_FOR_S1U = 2152; # Spec 2152 }; } From ef5f43707e470596fffdbaa41d8f255b170f8449 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Mon, 4 Oct 2021 16:28:24 +0200 Subject: [PATCH 092/110] fix(docker): proper formatting for docker image generation Signed-off-by: Raphael Defosseux --- ci-scripts/conf_files/gNB_SA_CU.conf | 6 ++++-- ci-scripts/conf_files/gNB_SA_DU.conf | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ci-scripts/conf_files/gNB_SA_CU.conf b/ci-scripts/conf_files/gNB_SA_CU.conf index b00d5691d6..029f02006e 100644 --- a/ci-scripts/conf_files/gNB_SA_CU.conf +++ b/ci-scripts/conf_files/gNB_SA_CU.conf @@ -13,10 +13,12 @@ gNBs = gNB_name = "gNB-Eurecom-CU"; - // Tracking area code, 0x0000 and 0xfffe are reserved values // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({ mcc = 208; mnc = 99; mnc_length = 2; + plmn_list = ({ + mcc = 208; + mnc = 99; + mnc_length = 2; snssaiList = ( { sst = 1; diff --git a/ci-scripts/conf_files/gNB_SA_DU.conf b/ci-scripts/conf_files/gNB_SA_DU.conf index cc20066721..255905e74d 100644 --- a/ci-scripts/conf_files/gNB_SA_DU.conf +++ b/ci-scripts/conf_files/gNB_SA_DU.conf @@ -12,10 +12,12 @@ gNBs = gNB_name = "gNB-Eurecom-DU"; - // Tracking area code, 0x0000 and 0xfffe are reserved values // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = 1; - plmn_list = ({ mcc = 208; mnc = 99; mnc_length = 2; + plmn_list = ({ + mcc = 208; + mnc = 99; + mnc_length = 2; snssaiList = ( { sst = 1; From 64ad04b552bc55d3a1f991213257d7de3974ed4c Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Tue, 5 Oct 2021 10:56:07 +0200 Subject: [PATCH 093/110] doc(release): Updating the 5F RF simulator documentation and docker-compose following the v1.2.0 release of OAI-CN5G Signed-off-by: Raphael Defosseux --- .../yaml_files/5g_rfsimulator/README.md | 67 +++++++++++++++++++ .../5g_rfsimulator/docker-compose.yaml | 9 ++- 2 files changed, 74 insertions(+), 2 deletions(-) diff --git a/ci-scripts/yaml_files/5g_rfsimulator/README.md b/ci-scripts/yaml_files/5g_rfsimulator/README.md index 1351d6742b..915b71296f 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator/README.md +++ b/ci-scripts/yaml_files/5g_rfsimulator/README.md @@ -14,6 +14,8 @@ This page is only valid for an `Ubuntu18` host. +**NOTE: this version (2021-10-05) is valid for the `v1.1.0` and `v1.2.0` versions of the `OAI 5G CN`.** + **TABLE OF CONTENTS** 1. [Retrieving the images on Docker-Hub](#1-retrieving-the-images-on-docker-hub) @@ -26,6 +28,9 @@ This page is only valid for an `Ubuntu18` host. 2. [Start the iperf server inside the NR-UE container](#32-start-the-iperf-server-inside-the-nr-ue-container) 3. [Start the iperf client inside the ext-dn container](#33-start-the-iperf-client-inside-the-ext-dn-container) 4. [Un-deployment](#4-un-deployment) +5. [Explanations on the configuration in the docker-compose.yaml](##5-explanations-on-the-configuration-in-the-docker-composeyaml) + 1. [Making the NR-UE connect to the core network](#51-making-the-nr-ue-connect-to-the-core-network) + 2. [Making the gNB connect to the core network](#52-making-the-gnb-connect-to-the-core-network) # 1. Retrieving the images on Docker-Hub # @@ -71,6 +76,10 @@ $ docker image tag rdefosseoai/oai-nr-ue:develop oai-nr-ue:develop $ docker logout ``` +**CAUTION: 2021/10/05 with the release `v1.2.0` of the `CN5G`, the previous version was not compatible any-more.** + +**This new version is working for both the `v1.1.0` and `v1.2.0` of the `CN5G`.** + # 2. Deploy containers # ![Deployment](./oai-end-to-end.jpg) @@ -137,6 +146,8 @@ rfsim5g-traffic: flags=4163 mtu 1500 ## 2.2. Deploy OAI gNB in RF simulator mode and in Standalone Mode ## +**CAUTION: To execute this 2nd step, the whole `CN5G` SHALL be in `healthy` state (especially the `mysql` container).** + ```bash $ docker-compose up -d oai-gnb rfsim5g-oai-nrf is up-to-date @@ -160,6 +171,18 @@ rfsim5g-oai-smf /bin/bash -c /openair-smf/ ... Up (healthy) 80/tcp, 880 rfsim5g-oai-spgwu /openair-spgwu-tiny/bin/en ... Up (healthy) 2152/udp, 8805/udp ``` +You can verify that the `gNB` is connected with the `AMF`: + +```bagh +$ docker logs rfsim5g-oai-amf +... +[AMF] [amf_app] [info ] |----------------------------------------------------gNBs' information-------------------------------------------| +[AMF] [amf_app] [info ] | Index | Status | Global ID | gNB Name | PLMN | +[AMF] [amf_app] [info ] | 1 | Connected | 0x0 | gnb-rfsim | 208, 99 | +[AMF] [amf_app] [info ] |----------------------------------------------------------------------------------------------------------------| +... +``` + ## 2.3. Deploy OAI NR-UE in RF simulator mode and in Standalone Mode ## ```bash @@ -366,3 +389,47 @@ Removing rfsim5g-mysql ... done Removing network rfsim5g-oai-public-net Removing network rfsim5g-oai-traffic_net-net ``` + +# 5. Explanations on the configuration in the `docker-compose.yaml` # + +## 5.1. Making the NR-UE connect to the core network ## + +The NR-UE **SHALL** be provisioned in the core network, especially in the `SQL` database and in the `AMF`. + +* in AMF section of `docker-compose.yaml` --> `OPERATOR_KEY=c42449363bbad02b66d16bc975d77cc1` +* in NR-UE section --> `OPC: 'C42449363BBAD02B66D16BC975D77CC1' + +Both values shall match! + +This value is also present in the `oai_db.sql` file: + +```bash +INSERT INTO `users` VALUES ('208990100001100','1','55000000000000',NULL,'PURGED',50,40000000,100000000,47,0000000000,1,0xfec86ba6eb707ed08905757b1bb44b8f,0,0,0x40,'ebd07771ace8677a',0xc42449363bbad02b66d16bc975d77cc1); +``` + +As you can see, 2 other values shall match in the NR-UE section of `docker-compose.yaml`: + +* `FULL_IMSI: '208990100001100'` +* `FULL_KEY: 'fec86ba6eb707ed08905757b1bb44b8f'` + +We are also using a dedicated `oai-smf.conf` for the `SMF` container: the `oai` DNN shall match the one in the NR-UE section of `docker-compose.yaml` (`DNN: oai`). + +## 5.2. Making the gNB connect to the core network ## + +Mainly you need to match the PLMN in `gNB`, `AMF` and `SPGWU` parameters: + +* `AMF` + - `MCC=208` + - `MNC=99` + - `PLMN_SUPPORT_TAC=0x0001` + - ... +* `SPGWU` + - `MCC=208` + - `MNC=99` + - `TAC=1` +* `gNB` + - `MCC: '208'` + - `MNC: '99'` + - `TAC: 1` + +The `ST` and `SD` values shall also match. diff --git a/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml b/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml index 5da7a353ab..31d64f35dc 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_rfsimulator/docker-compose.yaml @@ -90,11 +90,14 @@ services: - USE_FQDN_DNS=yes - NRF_API_VERSION=v1 - NRF_FQDN=oai-nrf - - AUSF_IPV4_ADDRESS=127.0.0.1 + - EXTERNAL_AUSF=no + - AUSF_IPV4_ADDRESS=0.0.0.0 - AUSF_PORT=80 - AUSF_API_VERSION=v1 + - AUSF_FQDN=localhost depends_on: - oai-nrf + - mysql volumes: - ./amf-healthcheck.sh:/openair-amf/bin/amf-healthcheck.sh healthcheck: @@ -139,6 +142,7 @@ services: - USE_FQDN_DNS=yes depends_on: - oai-nrf + - oai-amf volumes: - ./smf-healthcheck.sh:/openair-smf/bin/smf-healthcheck.sh - ./oai-smf.conf:/openair-smf/bin/oai-smf.conf @@ -183,6 +187,7 @@ services: - DNN_0=oai depends_on: - oai-nrf + - oai-smf cap_add: - NET_ADMIN - SYS_ADMIN @@ -285,7 +290,7 @@ networks: com.docker.network.bridge.name: "rfsim5g-public" traffic_net: driver: bridge - name: rfsim5g-oai-traffic_net-net + name: rfsim5g-oai-traffic-net ipam: config: - subnet: 192.168.72.128/26 From 52367f270115692477d976e81413c0cc5d1b03d0 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Tue, 5 Oct 2021 11:57:51 +0200 Subject: [PATCH 094/110] fix(ci): fixing docker-compose for F1 RF split following the v1.2.0 release of OAI-CN5G Signed-off-by: Raphael Defosseux --- .../yaml_files/5g_f1_rfsimulator/docker-compose.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml b/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml index 1e30c6bf51..a536de14f2 100644 --- a/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml @@ -90,11 +90,14 @@ services: - USE_FQDN_DNS=yes - NRF_API_VERSION=v1 - NRF_FQDN=oai-nrf - - AUSF_IPV4_ADDRESS=127.0.0.1 + - EXTERNAL_AUSF=no + - AUSF_IPV4_ADDRESS=0.0.0.0 - AUSF_PORT=80 - AUSF_API_VERSION=v1 + - AUSF_FQDN=localhost depends_on: - oai-nrf + - mysql volumes: - ./amf-healthcheck.sh:/openair-amf/bin/amf-healthcheck.sh healthcheck: @@ -139,6 +142,7 @@ services: - USE_FQDN_DNS=yes depends_on: - oai-nrf + - oai-amf volumes: - ./smf-healthcheck.sh:/openair-smf/bin/smf-healthcheck.sh - ./oai-smf.conf:/openair-smf/bin/oai-smf.conf @@ -183,6 +187,7 @@ services: - DNN_0=oai depends_on: - oai-nrf + - oai-smf cap_add: - NET_ADMIN - SYS_ADMIN From df36de9b491417e1438264698fd4284f01ca6dd4 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Wed, 6 Oct 2021 10:03:39 +0200 Subject: [PATCH 095/110] fix(ci): better handling of wrong exit during iperf/ping tests; adding PCAP capture Signed-off-by: Raphael Defosseux --- ci-scripts/cls_containerize.py | 52 +++++++++++++++++-- .../xml_files/container_5g_f1_rfsim.xml | 16 ++++-- ci-scripts/xml_files/container_5g_rfsim.xml | 11 +++- 3 files changed, 71 insertions(+), 8 deletions(-) diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index 6cf3e95db7..ea09cd0585 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -93,6 +93,7 @@ class Containerize(): self.allImagesSize = {} self.collectInfo = {} + self.tsharkStarted = False self.pingContName = '' self.pingOptions = '' self.pingLossThreshold = '' @@ -597,6 +598,10 @@ class Containerize(): time.sleep(10) if count == 100 and healthy == self.nb_healthy[0]: + if self.tsharkStarted == False: + logging.debug('Starting tshark on public network') + self.CaptureOnDockerNetworks() + self.tsharkStarted = True HTML.CreateHtmlTestRow('n/a', 'OK', CONST.ALL_PROCESSES_OK) logging.info('\u001B[1m Deploying OAI Object(s) PASS\u001B[0m') else: @@ -604,6 +609,20 @@ class Containerize(): HTML.CreateHtmlTestRow('Could not deploy in time', 'KO', CONST.ALL_PROCESSES_OK) logging.error('\u001B[1m Deploying OAI Object(s) FAILED\u001B[0m') + def CaptureOnDockerNetworks(self): + cmd = 'cd ' + self.yamlPath[0] + ' && docker-compose -f docker-compose-ci.yml config | grep com.docker.network.bridge.name | sed -e "s@^.*name: @@"' + networkNames = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=10) + cmd = 'sudo nohup tshark -f "not tcp and not arp and not port 53 and not host archive.ubuntu.com and not host security.ubuntu.com"' + for name in networkNames.split('\n'): + res = re.search('rfsim', name) + if res is not None: + cmd += ' -i ' + name + cmd += ' -w /tmp/capture_' + ymlPath = self.yamlPath[0].split('/') + cmd += ymlPath[1] + '.pcap > /tmp/tshark.log 2>&1 &' + logging.debug(cmd) + networkNames = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=10) + def UndeployGenObject(self, HTML): self.exitStatus = 0 ymlPath = self.yamlPath[0].split('/') @@ -638,6 +657,18 @@ class Containerize(): cmd = 'mkdir -p '+ logPath + ' && mv ' + self.yamlPath[0] + '/*.log ' + logPath logging.debug(cmd) deployStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=10) + if self.tsharkStarted: + self.tsharkStarted = True + ymlPath = self.yamlPath[0].split('/') + cmd = 'sudo chmod 666 /tmp/capture_' + ymlPath[1] + '.pcap' + logging.debug(cmd) + copyStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=10) + cmd = 'cp /tmp/capture_' + ymlPath[1] + '.pcap ' + logPath + logging.debug(cmd) + copyStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=10) + cmd = 'sudo rm /tmp/capture_' + ymlPath[1] + '.pcap' + logging.debug(cmd) + copyStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=10) cmd = 'cd ' + self.yamlPath[0] + ' && docker-compose -f docker-compose-ci.yml down' logging.debug(cmd) @@ -715,9 +746,16 @@ class Containerize(): if status: HTML.CreateHtmlTestRowQueue(self.pingOptions, 'OK', 1, html_queue) else: - self.exitStatus = 1 - logging.error('\u001B[1;37;41m ' + message + ' \u001B[0m') + logging.error('\u001B[1;37;41m ping test FAIL -- ' + message + ' \u001B[0m') HTML.CreateHtmlTestRowQueue(self.pingOptions, 'KO', 1, html_queue) + # Automatic undeployment + logging.debug('----------------------------------------') + logging.debug('\u001B[1m Starting Automatic undeployment \u001B[0m') + logging.debug('----------------------------------------') + HTML.testCase_id = 'AUTO-UNDEPLOY' + HTML.desc = 'Automatic Un-Deployment' + self.UndeployGenObject(HTML) + self.exitStatus = 1 def IperfFromContainer(self, HTML): self.exitStatus = 0 @@ -836,5 +874,13 @@ class Containerize(): if status: HTML.CreateHtmlTestRowQueue(self.cliOptions, 'OK', 1, html_queue) else: - self.exitStatus = 1 + logging.error('\u001B[1m Iperf Test FAIL -- ' + message + ' \u001B[0m') HTML.CreateHtmlTestRowQueue(self.cliOptions, 'KO', 1, html_queue) + # Automatic undeployment + logging.debug('----------------------------------------') + logging.debug('\u001B[1m Starting Automatic undeployment \u001B[0m') + logging.debug('----------------------------------------') + HTML.testCase_id = 'AUTO-UNDEPLOY' + HTML.desc = 'Automatic Un-Deployment' + self.UndeployGenObject(HTML) + self.exitStatus = 1 diff --git a/ci-scripts/xml_files/container_5g_f1_rfsim.xml b/ci-scripts/xml_files/container_5g_f1_rfsim.xml index 400cd86fcd..501f2fe46f 100644 --- a/ci-scripts/xml_files/container_5g_f1_rfsim.xml +++ b/ci-scripts/xml_files/container_5g_f1_rfsim.xml @@ -26,6 +26,7 @@ wrench 100021 + 000020 000021 000022 000023 @@ -33,16 +34,23 @@ 020021 020022 030021 - 030022 100021 + + DeployGenObject + Deploy MySql Database + yaml_files/5g_f1_rfsimulator + mysql + 1 + + DeployGenObject Deploy OAI 5G CoreNetwork yaml_files/5g_f1_rfsimulator - mysql oai-nrf oai-amf oai-smf oai-spgwu oai-ext-dn + oai-nrf oai-amf oai-smf oai-spgwu oai-ext-dn 6 @@ -92,7 +100,7 @@ rfsim5g-oai-nr-ue rfsim5g-oai-ext-dn -B 12.1.1.2 -u -i 1 -s - -c 12.1.1.2 -u -i 1 -t 30 -b 400K + -c 12.1.1.2 -u -i 1 -t 30 -b 200K @@ -101,7 +109,7 @@ rfsim5g-oai-ext-dn rfsim5g-oai-nr-ue -u -i 1 -s - -B 12.1.1.2 -c 192.168.72.135 -u -i 1 -t 30 -b 20K + -B 12.1.1.2 -c 192.168.72.135 -u -i 1 -t 30 -b 5K diff --git a/ci-scripts/xml_files/container_5g_rfsim.xml b/ci-scripts/xml_files/container_5g_rfsim.xml index 31d7c1429b..da727f59c4 100644 --- a/ci-scripts/xml_files/container_5g_rfsim.xml +++ b/ci-scripts/xml_files/container_5g_rfsim.xml @@ -26,6 +26,7 @@ wrench 100001 + 000000 000001 000002 000003 @@ -37,11 +38,19 @@ + + DeployGenObject + Deploy MySql Database + yaml_files/5g_rfsimulator + mysql + 1 + + DeployGenObject Deploy OAI 5G CoreNetwork yaml_files/5g_rfsimulator - mysql oai-nrf oai-amf oai-smf oai-spgwu oai-ext-dn + oai-nrf oai-amf oai-smf oai-spgwu oai-ext-dn 6 From 3105a232484ab048f67beb3847a0bc8bbc4cd064 Mon Sep 17 00:00:00 2001 From: matzakos Date: Wed, 6 Oct 2021 13:39:29 +0200 Subject: [PATCH 096/110] Address two remaining review comments --- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 2 +- openair2/F1AP/f1ap_du_ue_context_management.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index ba7a32398e..ac281af81d 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -165,7 +165,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, protocol_ctxt_t ctxt; ctxt.rnti = f1ap_get_rnti_by_du_id(DUtype, instance, du_ue_f1ap_id); ctxt.instance = instance; - ctxt.instance = instance; + ctxt.module_id = instance; ctxt.enb_flag = 1; struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context( RC.rrc[ctxt.instance], diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index a825fab7ff..7b20bfb2aa 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -672,7 +672,7 @@ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true); ctxt.rnti = f1ap_get_rnti_by_cu_id(DUtype, instance, ie->value.choice.GNB_CU_UE_F1AP_ID); ctxt.instance = instance; - ctxt.instance = instance; + ctxt.module_id = instance; ctxt.enb_flag = 1; /* GNB_DU_UE_F1AP_ID */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseCommandIEs_t, ie, container, From 4349e436ba06eebefe5e001db7daef8ae3fd5779 Mon Sep 17 00:00:00 2001 From: Panos Matzakos Date: Wed, 6 Oct 2021 13:20:27 +0000 Subject: [PATCH 097/110] Update README.md for CU/DU split deployment option --- ci-scripts/yaml_files/5g_rfsimulator/README.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/ci-scripts/yaml_files/5g_rfsimulator/README.md b/ci-scripts/yaml_files/5g_rfsimulator/README.md index 915b71296f..88dfa81a81 100644 --- a/ci-scripts/yaml_files/5g_rfsimulator/README.md +++ b/ci-scripts/yaml_files/5g_rfsimulator/README.md @@ -88,7 +88,9 @@ $ docker logout **Just `docker-compose up -d` WILL NOT WORK!** -All the following commands **SHALL** be run from the `ci-scripts/yaml_files/5g_rfsimulator` folder. +All the following commands **SHALL** be run from the `ci-scripts/yaml_files/5g_rfsimulator` folder for a deployment with monolithic gNB. + +For a deployment with the gNB split in CU and DU components, the following commands **SHALL** be run from the `ci-scripts/yaml_files/5g_f1_rfsimulator` folder. ## 2.1. Deploy OAI 5G Core Network ## @@ -148,6 +150,8 @@ rfsim5g-traffic: flags=4163 mtu 1500 **CAUTION: To execute this 2nd step, the whole `CN5G` SHALL be in `healthy` state (especially the `mysql` container).** +The gNB can be deployed either in monolithic mode, or in CU/DU split mode. +- For a deployment with a monolithic gNB: ```bash $ docker-compose up -d oai-gnb rfsim5g-oai-nrf is up-to-date @@ -155,7 +159,16 @@ rfsim5g-oai-spgwu is up-to-date rfsim5g-oai-ext-dn is up-to-date Creating rfsim5g-oai-gnb ... done ``` +- For a deployment with the gNB split in CU and DU components: +```bash +#Deployment of the CU +$ docker-compose up -d oai-cu +``` +```bash +#Deployment of the DU +$ docker-compose up -d oai-du +``` Wait for a bit. ```bash From 67e91af2f1a17ee3bf2179e8044ee726cf3fa06d Mon Sep 17 00:00:00 2001 From: Panos Matzakos Date: Wed, 6 Oct 2021 13:55:21 +0000 Subject: [PATCH 098/110] Update TESTING_5GSA_setup.md --- doc/TESTING_5GSA_setup.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/TESTING_5GSA_setup.md b/doc/TESTING_5GSA_setup.md index 475123c990..048d8c86ff 100644 --- a/doc/TESTING_5GSA_setup.md +++ b/doc/TESTING_5GSA_setup.md @@ -95,7 +95,7 @@ To get the code and build the gNB executable: ./build_oai --gNB -w USRP ``` -A reference configuration file for the gNB is provided [here](https://gitlab.eurecom.fr/oai/openairinterface5g/-/blob/develop/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf). +A reference configuration file for the **monolithic** gNB is provided [here](https://gitlab.eurecom.fr/oai/openairinterface5g/-/blob/develop/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf). In the following, we highlight the fields of the file that have to be configured according to the configuration and interfaces of the Core Network. First, the PLMN section has to be filled with the proper values that match the configuration of the AMF and the UE USIM. @@ -194,6 +194,8 @@ The SA setup with OAI UE has been validated with **RFSIMULATOR**. Both control p In the following, we provide the instructions on how to build, configure and execute this SA setup. +As another option, if you do not want to build anything and instead deploy the OAI RAN (RFSIMULATOR) and Core Network components directly using docker images and docker-compose, please have a look at [this tutorial](https://gitlab.eurecom.fr/oai/openairinterface5g/-/blob/develop/ci-scripts/yaml_files/5g_rfsimulator/README.md). + ### NAS configuration for the OAI UE The NAS configuration parameters of the OAI UE can be set as input parameters, configuration file or can be hardcoded. More specifically: - SUCI (*Subscription Concealed Identifier*) @@ -245,7 +247,6 @@ The gNB configuration can be performed according to what is described in [sectio ## 2.2 OAI 5G Core Network installation and configuration The instructions for the installation of OAI CN components (AMF, SMF, NRF, UPF) using `docker-compose` can be found [here](https://gitlab.eurecom.fr/oai/cn5g/oai-cn5g-fed/-/blob/master/README.md). -In addition, if you do not want to build anything, please have a look at [this tutorial](https://gitlab.eurecom.fr/oai/openairinterface5g/-/blob/develop/ci-scripts/yaml_files/5g_rfsimulator/README.md). ## 2.3 Execution of SA scenario From 24cd2887d207754ba1add6b753656bda4543e7d0 Mon Sep 17 00:00:00 2001 From: matzakos Date: Fri, 5 Nov 2021 11:20:44 +0100 Subject: [PATCH 099/110] Change size parameter in encoding function for initial cellgroupconfig --- openair2/RRC/NR/L2_nr_interface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/RRC/NR/L2_nr_interface.c b/openair2/RRC/NR/L2_nr_interface.c index 1d5f832195..0be843d26b 100644 --- a/openair2/RRC/NR/L2_nr_interface.c +++ b/openair2/RRC/NR/L2_nr_interface.c @@ -333,7 +333,7 @@ int8_t nr_mac_rrc_data_ind(const module_id_t module_idP, NULL, (void *)&cellGroupConfig, msg->du2cu_rrc_container, - sizeof(msg->du2cu_rrc_container)); + 1024); //sizeof(msg->du2cu_rrc_container)); if (enc_rval.encoded == -1) { LOG_E(F1AP,"Could not encoded cellGroupConfig, failed element %s\n",enc_rval.failed_type->name); From c8f76a2469f8750c49d1de3e8ac18d0d053923b7 Mon Sep 17 00:00:00 2001 From: matzakos Date: Fri, 12 Nov 2021 15:29:44 +0100 Subject: [PATCH 100/110] Increase size of RRC container carrying cellGroupConfig info for F1 initial UL RRC message transfer -Fixing issue with decoding cellGroupConfig later --- openair2/COMMON/f1ap_messages_types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index 1aba05e82d..5809f0fc15 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -307,7 +307,7 @@ typedef struct f1ap_initial_ul_rrc_message_s { uint16_t crnti; uint8_t *rrc_container; int rrc_container_length; - char du2cu_rrc_container[100]; + char du2cu_rrc_container[200]; int du2cu_rrc_container_length; } f1ap_initial_ul_rrc_message_t; From a8bfb201215226e06417d6de2522510b3c675f37 Mon Sep 17 00:00:00 2001 From: matzakos Date: Fri, 12 Nov 2021 16:16:33 +0100 Subject: [PATCH 101/110] Update du config file after update with develop --- .../PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf | 20 +++++-------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf index 05e441d396..ca11c5f852 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/du_gnb.conf @@ -79,7 +79,7 @@ gNBs = # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialDLBWPsubcarrierSpacing = 1; #pdcch-ConfigCommon - initialDLBWPcontrolResourceSetZero = 12; + initialDLBWPcontrolResourceSetZero = 11; initialDLBWPsearchSpaceZero = 0; #pdsch-ConfigCommon #pdschTimeDomainAllocationList (up to 16 entries) @@ -88,22 +88,12 @@ gNBs = #0=typeA,1=typeB initialDLBWPmappingType_0 = 0; #this is SS=1,L=13 - initialDLBWPstartSymbolAndLength_0 = 53; + initialDLBWPstartSymbolAndLength_0 = 40; initialDLBWPk0_1 = 0; initialDLBWPmappingType_1 = 0; #this is SS=2,L=12 - initialDLBWPstartSymbolAndLength_1 = 81; - - initialDLBWPk0_2 = 0; - initialDLBWPmappingType_2 = 0; - #this is SS=1,L=12 - initialDLBWPstartSymbolAndLength_2 = 54; - - initialDLBWPk0_3 = 0; - initialDLBWPmappingType_3 = 0; - #this is SS=1,L=5 - initialDLBWPstartSymbolAndLength_3 = 57; + initialDLBWPstartSymbolAndLength_1 = 57; #uplinkConfigCommon #frequencyInfoUL @@ -162,12 +152,12 @@ gNBs = initialULBWPk2_0 = 6; initialULBWPmappingType_0 = 1 # this is SS=2 L=12 - initialULBWPstartSymbolAndLength_0 = 53; + initialULBWPstartSymbolAndLength_0 = 41; initialULBWPk2_1 = 6; initialULBWPmappingType_1 = 1; # this is SS=0 L=12 - initialULBWPstartSymbolAndLength_1 = 69; + initialULBWPstartSymbolAndLength_1 = 52; initialULBWPk2_2 = 7; initialULBWPmappingType_2 = 1; From a38e368be29b816ded5107cafa54505da978ef27 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Tue, 16 Nov 2021 22:03:27 +0100 Subject: [PATCH 102/110] fix gtp-u address between NSA and SA modes --- executables/nr-softmodem.c | 4 +++ openair2/GNB_APP/gnb_config.c | 56 +++++++++++++++++---------------- openair2/GNB_APP/gnb_paramdef.h | 34 +++++++------------- openair3/ocp-gtpu/gtp_itf.cpp | 1 - 4 files changed, 44 insertions(+), 51 deletions(-) diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index 04fdef8679..c012e9f57d 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -326,6 +326,10 @@ int create_gNB_tasks(uint32_t gnb_nb) { if (AMF_MODE_ENABLED) { + char* gnb_ipv4_address_for_NGU = NULL; + uint32_t gnb_port_for_NGU = 0; + char* gnb_ipv4_address_for_S1U = NULL; + uint32_t gnb_port_for_S1U = 0; paramdef_t NETParams[] = GNBNETPARAMS_DESC; char aprefix[MAX_OPTNAME_SIZE*2 + 8]; sprintf(aprefix,"%s.[%i].%s",GNB_CONFIG_STRING_GNB_LIST,0,GNB_CONFIG_STRING_NETWORK_INTERFACES_CONFIG); diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index a5a5cf8a8a..d619eb7f63 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -1126,22 +1126,14 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { int RCconfig_nr_gtpu(void ) { int num_gnbs = 0; - - - - char* gnb_interface_name_for_NGU = NULL; char* gnb_ipv4_address_for_NGU = NULL; uint32_t gnb_port_for_NGU = 0; - char* gnb_interface_name_for_S1U = NULL; char* gnb_ipv4_address_for_S1U = NULL; uint32_t gnb_port_for_S1U = 0; - char *address = NULL; - char *cidr = NULL; char gtpupath[MAX_OPTNAME_SIZE*2 + 8]; paramdef_t GNBSParams[] = GNBSPARAMS_DESC; paramdef_t NETParams[] = GNBNETPARAMS_DESC; - paramdef_t GTPUParams[] = GNBGTPUPARAMS_DESC; LOG_I(GTPU,"Configuring GTPu\n"); /* get number of active eNodeBs */ @@ -1151,31 +1143,32 @@ int RCconfig_nr_gtpu(void ) { "Failed to parse config file no active gNodeBs in %s \n", GNB_CONFIG_STRING_ACTIVE_GNBS); sprintf(gtpupath,"%s.[%i].%s",GNB_CONFIG_STRING_GNB_LIST,0,GNB_CONFIG_STRING_NETWORK_INTERFACES_CONFIG); - config_get(GTPUParams,sizeof(GTPUParams)/sizeof(paramdef_t),gtpupath); - config_get(NETParams,sizeof(NETParams)/sizeof(paramdef_t),gtpupath); - - if (NETParams[0].strptr != NULL) + char *cidr=NULL, *address = NULL; + int port; + if (NETParams[1].strptr != NULL) { LOG_I(GTPU, "SA mode \n"); - else + address = strtok_r(gnb_ipv4_address_for_NGU, "/", &cidr); + port=gnb_port_for_NGU; + } else { LOG_I(GTPU, "NSA mode \n"); - - cidr = gnb_ipv4_address_for_S1U; - address = strtok(cidr, "/"); - + address = strtok_r(gnb_ipv4_address_for_S1U, "/", &cidr); + port=gnb_port_for_S1U; + } + if (address) { MessageDef *message; message = itti_alloc_new_message(TASK_GNB_APP, 0, GTPV1U_REQ); - AssertFatal(message!=NULL,""); - IPV4_STR_ADDR_TO_INT_NWBO (address, GTPV1U_REQ(message).localAddr, "BAD IP ADDRESS FORMAT FOR gNB NG_U !\n" ); - LOG_I(GTPU,"Configuring GTPu address : %s -> %x\n",address,GTPV1U_REQ(message).localAddr); - GTPV1U_REQ(message).localPort = gnb_port_for_NGU; - strcpy(GTPV1U_REQ(message).localAddrStr,address); - sprintf(GTPV1U_REQ(message).localPortStr,"%d", gnb_port_for_NGU); - itti_send_msg_to_task (TASK_VARIABLE, 0, message); // data model is wrong: gtpu doesn't have enb_id (or module_id) - } else - LOG_E(GTPU,"invalid address for NGU\n"); - + AssertFatal(message!=NULL,""); + IPV4_STR_ADDR_TO_INT_NWBO (address, GTPV1U_REQ(message).localAddr, "BAD IP ADDRESS FORMAT FOR gNB NG_U !\n" ); + LOG_I(GTPU,"Configuring GTPu address : %s -> %x\n",address,GTPV1U_REQ(message).localAddr); + GTPV1U_REQ(message).localPort = port; + strcpy(GTPV1U_REQ(message).localAddrStr,address); + sprintf(GTPV1U_REQ(message).localPortStr,"%d", port); + itti_send_msg_to_task (TASK_VARIABLE, 0, message); // data model is wrong: gtpu doesn't have enb_id (or module_id) + } else + LOG_E(GTPU,"invalid address for NGU or S1U\n"); + return 0; } @@ -1193,6 +1186,10 @@ int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i) { (void) my_int; memset((char*)active_gnb,0,MAX_GNB* sizeof(char*)); + char* gnb_ipv4_address_for_NGU = NULL; + uint32_t gnb_port_for_NGU = 0; + char* gnb_ipv4_address_for_S1U = NULL; + uint32_t gnb_port_for_S1U = 0; paramdef_t GNBSParams[] = GNBSPARAMS_DESC; paramdef_t GNBParams[] = GNBPARAMS_DESC; @@ -1534,6 +1531,11 @@ int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i) { paramdef_t X2Params[] = X2PARAMS_DESC; paramlist_def_t X2ParamList = {ENB_CONFIG_STRING_TARGET_ENB_X2_IP_ADDRESS,NULL,0}; paramdef_t SCTPParams[] = GNBSCTPPARAMS_DESC; + char* gnb_ipv4_address_for_NGU = NULL; + uint32_t gnb_port_for_NGU = 0; + char* gnb_ipv4_address_for_S1U = NULL; + uint32_t gnb_port_for_S1U = 0; + paramdef_t NETParams[] = GNBNETPARAMS_DESC; /* TODO: fix the size - if set lower we have a crash (MAX_OPTNAME_SIZE was 64 when this code was written) */ /* this is most probably a problem with the config module */ diff --git a/openair2/GNB_APP/gnb_paramdef.h b/openair2/GNB_APP/gnb_paramdef.h index bf1d12825e..206df1ceb3 100644 --- a/openair2/GNB_APP/gnb_paramdef.h +++ b/openair2/GNB_APP/gnb_paramdef.h @@ -334,29 +334,17 @@ typedef enum { /* optname helpstr paramflags XXXptr defXXXval type numelt */ /*--------------------------------------------------------------------------------------------------------------------------------------------------*/ #define GNBNETPARAMS_DESC { \ -{GNB_CONFIG_STRING_GNB_INTERFACE_NAME_FOR_NG_AMF, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \ -{GNB_CONFIG_STRING_GNB_IPV4_ADDRESS_FOR_NG_AMF, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \ -{GNB_CONFIG_STRING_GNB_INTERFACE_NAME_FOR_NGU, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \ -{GNB_CONFIG_STRING_GNB_IPV4_ADDR_FOR_NGU, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \ -{GNB_CONFIG_STRING_GNB_PORT_FOR_NGU, NULL, 0, uptr:NULL, defintval:2152L, TYPE_UINT, 0}, \ -{GNB_CONFIG_STRING_ENB_IPV4_ADDR_FOR_X2C, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \ -{GNB_CONFIG_STRING_ENB_PORT_FOR_X2C, NULL, 0, uptr:NULL, defintval:0L, TYPE_UINT, 0} \ -} - - - -/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ -/* GTPU configuration parameters */ -/* optname helpstr paramflags XXXptr defXXXval type numelt */ -/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ -#define GNBGTPUPARAMS_DESC { \ -{GNB_CONFIG_STRING_GNB_INTERFACE_NAME_FOR_NGU, NULL, 0, strptr:&gnb_interface_name_for_NGU, defstrval:"lo", TYPE_STRING, 0}, \ -{GNB_CONFIG_STRING_GNB_IPV4_ADDR_FOR_NGU, NULL, 0, strptr:&gnb_ipv4_address_for_NGU, defstrval:"127.0.0.1", TYPE_STRING, 0}, \ -{GNB_CONFIG_STRING_GNB_PORT_FOR_NGU, NULL, 0, uptr:&gnb_port_for_NGU, defintval:2152, TYPE_UINT, 0}, \ -{GNB_CONFIG_STRING_GNB_INTERFACE_NAME_FOR_S1U, NULL, 0, strptr:&gnb_interface_name_for_S1U, defstrval:"lo", TYPE_STRING, 0}, \ -{GNB_CONFIG_STRING_GNB_IPV4_ADDRESS_FOR_S1U, NULL, 0, strptr:&gnb_ipv4_address_for_S1U, defstrval:"127.0.0.1", TYPE_STRING, 0}, \ -{GNB_CONFIG_STRING_GNB_PORT_FOR_S1U, NULL, 0, uptr:&gnb_port_for_S1U, defintval:2152, TYPE_UINT, 0} \ -} + {GNB_CONFIG_STRING_GNB_INTERFACE_NAME_FOR_NG_AMF, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \ + {GNB_CONFIG_STRING_GNB_IPV4_ADDRESS_FOR_NG_AMF, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \ + {GNB_CONFIG_STRING_GNB_INTERFACE_NAME_FOR_NGU, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \ + {GNB_CONFIG_STRING_GNB_IPV4_ADDR_FOR_NGU, NULL, 0, strptr:&gnb_ipv4_address_for_NGU, defstrval:"127.0.0.1",TYPE_STRING, 0}, \ + {GNB_CONFIG_STRING_GNB_PORT_FOR_NGU, NULL, 0, uptr:&gnb_port_for_NGU, defintval:2152L, TYPE_UINT, 0}, \ + {GNB_CONFIG_STRING_ENB_IPV4_ADDR_FOR_X2C, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \ + {GNB_CONFIG_STRING_ENB_PORT_FOR_X2C, NULL, 0, uptr:NULL, defintval:0L, TYPE_UINT, 0}, \ + {GNB_CONFIG_STRING_GNB_INTERFACE_NAME_FOR_S1U, NULL, 0, strptr:NULL, defstrval:NULL, TYPE_STRING, 0}, \ + {GNB_CONFIG_STRING_GNB_IPV4_ADDRESS_FOR_S1U, NULL, 0, strptr:&gnb_ipv4_address_for_S1U, defstrval:"127.0.0.1",TYPE_STRING, 0}, \ + {GNB_CONFIG_STRING_GNB_PORT_FOR_S1U, NULL, 0, uptr:&gnb_port_for_S1U, defintval:2152L, TYPE_UINT, 0} \ + } /*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index 78a130b672..59aeb824fb 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -150,7 +150,6 @@ static int gtpv1uCreateAndSendMsg(int h, uint32_t peerIp, uint16_t peerPort, te to.sin_addr.s_addr = peerIp ; LOG_D(GTPU,"sending packet size: %d to %s\n",fullSize, inet_ntoa(to.sin_addr) ); int ret; - if ((ret=sendto(h, (void *)buffer, (size_t)fullSize, 0,(struct sockaddr *)&to, sizeof(to) )) != fullSize ) { LOG_E(GTPU, "[SD %d] Failed to send data to " IPV4_ADDR " on port %d, buffer size %u, ret: %d, errno: %d\n", h, IPV4_ADDR_FORMAT(peerIp), peerPort, fullSize, ret, errno); From 55313184ea2db67cc66d439b13f477665ee232c3 Mon Sep 17 00:00:00 2001 From: matzakos Date: Wed, 17 Nov 2021 17:15:37 +0100 Subject: [PATCH 103/110] Update DU configuration file for CI --- ci-scripts/conf_files/gNB_SA_DU.conf | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/ci-scripts/conf_files/gNB_SA_DU.conf b/ci-scripts/conf_files/gNB_SA_DU.conf index 255905e74d..e8c7d0ae3f 100644 --- a/ci-scripts/conf_files/gNB_SA_DU.conf +++ b/ci-scripts/conf_files/gNB_SA_DU.conf @@ -76,7 +76,7 @@ gNBs = # 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 initialDLBWPsubcarrierSpacing = 1; #pdcch-ConfigCommon - initialDLBWPcontrolResourceSetZero = 12; + initialDLBWPcontrolResourceSetZero = 11; initialDLBWPsearchSpaceZero = 0; #pdsch-ConfigCommon #pdschTimeDomainAllocationList (up to 16 entries) @@ -90,17 +90,7 @@ gNBs = initialDLBWPk0_1 = 0; initialDLBWPmappingType_1 = 0; #this is SS=2,L=12 - initialDLBWPstartSymbolAndLength_1 = 53; - - initialDLBWPk0_2 = 0; - initialDLBWPmappingType_2 = 0; - #this is SS=1,L=12 - initialDLBWPstartSymbolAndLength_2 = 54; - - initialDLBWPk0_3 = 0; - initialDLBWPmappingType_3 = 0; - #this is SS=1,L=5 - initialDLBWPstartSymbolAndLength_3 = 57; + initialDLBWPstartSymbolAndLength_1 = 57; #uplinkConfigCommon #frequencyInfoUL @@ -159,12 +149,12 @@ gNBs = initialULBWPk2_0 = 6; initialULBWPmappingType_0 = 1 # this is SS=0 L=11 - initialULBWPstartSymbolAndLength_0 = 55; + initialULBWPstartSymbolAndLength_0 = 41; initialULBWPk2_1 = 6; initialULBWPmappingType_1 = 1; # this is SS=0 L=12 - initialULBWPstartSymbolAndLength_1 = 69; + initialULBWPstartSymbolAndLength_1 = 52; initialULBWPk2_2 = 7; initialULBWPmappingType_2 = 1; From 4ccc1c722d4eb4023e021047568294ffcdae3711 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Wed, 17 Nov 2021 20:42:11 +0100 Subject: [PATCH 104/110] fix(ci): one last missing parameter in CU conf file Signed-off-by: Raphael Defosseux --- ci-scripts/conf_files/gNB_SA_DU.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/ci-scripts/conf_files/gNB_SA_DU.conf b/ci-scripts/conf_files/gNB_SA_DU.conf index e8c7d0ae3f..d4f7851104 100644 --- a/ci-scripts/conf_files/gNB_SA_DU.conf +++ b/ci-scripts/conf_files/gNB_SA_DU.conf @@ -41,6 +41,7 @@ gNBs = ssb_SubcarrierOffset = 0; pdsch_AntennaPorts = 1; pusch_AntennaPorts = 1; + sib1_tda = 1; pdcch_ConfigSIB1 = ( { From 4876c7a33dc684f91a0445f45a6f542930017622 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Thu, 25 Nov 2021 14:06:08 +0100 Subject: [PATCH 105/110] fix bug in WORKER_DISABLE --- openair1/SCHED_NR/nr_ru_procedures.c | 7 ++++--- openair2/LAYER2/nr_pdcp/nr_pdcp_timer_thread.c | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/openair1/SCHED_NR/nr_ru_procedures.c b/openair1/SCHED_NR/nr_ru_procedures.c index d8fa11d157..3f4c2f71fb 100644 --- a/openair1/SCHED_NR/nr_ru_procedures.c +++ b/openair1/SCHED_NR/nr_ru_procedures.c @@ -477,9 +477,10 @@ void nr_feptx_prec(RU_t *ru,int frame_tx,int tti_tx) { memcpy((void*)ru->common.txdataF[i], (void*)&gNB->common_vars.txdataF[i][txdataF_offset], fp->samples_per_slot_wCP*sizeof(int32_t)); - memcpy((void*)&ru->common.beam_id[i][slot_tx*fp->symbols_per_slot], - (void*)&gNB->common_vars.beam_id[i][slot_tx*fp->symbols_per_slot], - fp->symbols_per_slot*sizeof(uint8_t)); + if (ru->do_precoding == 1) + memcpy((void*)&ru->common.beam_id[i][slot_tx*fp->symbols_per_slot], + (void*)&gNB->common_vars.beam_id[i][slot_tx*fp->symbols_per_slot], + fp->symbols_per_slot*sizeof(uint8_t)); } if (ru->nb_tx == 1 && ru->nb_log_antennas == 1) { diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_timer_thread.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_timer_thread.c index 36e9b16024..5f6939e165 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_timer_thread.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_timer_thread.c @@ -19,6 +19,7 @@ * contact@openairinterface.org */ +#define _GNU_SOURCE #include "nr_pdcp_timer_thread.h" #include @@ -33,6 +34,7 @@ static volatile uint64_t timer_thread_curtime = 0; static void *nr_pdcp_timer_thread(void *_nr_pdcp_ue_manager) { + pthread_setname_np(pthread_self(),"pdcp_timer"); nr_pdcp_ue_manager_t *nr_pdcp_ue_manager = (nr_pdcp_ue_manager_t *)_nr_pdcp_ue_manager; nr_pdcp_ue_t **ue_list; int ue_count; From 37cc53cffca34b8661b3990b4b3345eb66610ce4 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Fri, 26 Nov 2021 12:15:07 +0100 Subject: [PATCH 106/110] fix(ci): wrong image tag to deploy CU/DU containers Signed-off-by: Raphael Defosseux --- ci-scripts/cls_containerize.py | 4 ++-- ci-scripts/cls_oaicitest.py | 2 +- ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index dfa9a0eae2..0e31635d42 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -757,7 +757,7 @@ class Containerize(): cmd = 'mkdir -p ' + logPath deployStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=10) - cmd = 'docker exec ' + self.pingContName + ' /bin/bash -c "ping ' + self.pingOptions + '" 2>&1 | tee ../cmake_targets/log/ping_' + HTML.testCase_id + '.log || true' + cmd = 'docker exec ' + self.pingContName + ' /bin/bash -c "ping ' + self.pingOptions + '" 2>&1 | tee ' + logPath + '/ping_' + HTML.testCase_id + '.log || true' logging.debug(cmd) deployStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=100) @@ -840,7 +840,7 @@ class Containerize(): # Start the client process - cmd = 'docker exec ' + self.cliContName + ' /bin/bash -c "iperf ' + self.cliOptions + '" 2>&1 | tee ../cmake_targets/log/iperf_client_' + HTML.testCase_id + '.log || true' + cmd = 'docker exec ' + self.cliContName + ' /bin/bash -c "iperf ' + self.cliOptions + '" 2>&1 | tee '+ logPath + '/iperf_client_' + HTML.testCase_id + '.log || true' logging.debug(cmd) clientStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=100) diff --git a/ci-scripts/cls_oaicitest.py b/ci-scripts/cls_oaicitest.py index cc6e235ab3..7ef5bb296e 100644 --- a/ci-scripts/cls_oaicitest.py +++ b/ci-scripts/cls_oaicitest.py @@ -3348,7 +3348,7 @@ class OaiCiTest(): self.desc = 'Automatic Termination of OAI-UE' HTML.desc = self.desc self.ShowTestID() - self.TerminateOAIUE(HTML,RAN,COTS_UE,EPC,InfraUE) + self.TerminateOAIUE(HTML,RAN,COTS_UE,EPC,InfraUE,CONTAINERS) if (RAN.Initialize_eNB_args != ''): self.testCase_id = 'AUTO-KILL-RAN' HTML.testCase_id = self.testCase_id diff --git a/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml b/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml index a536de14f2..ec5f4d1323 100644 --- a/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml +++ b/ci-scripts/yaml_files/5g_f1_rfsimulator/docker-compose.yaml @@ -225,7 +225,7 @@ services: timeout: 5s retries: 5 oai-cu: - image: oai-gnb:f1-test + image: oai-gnb:develop privileged: true container_name: rfsim5g-oai-cu environment: @@ -261,7 +261,7 @@ services: timeout: 5s retries: 5 oai-du: - image: oai-gnb:f1-test + image: oai-gnb:develop privileged: true container_name: rfsim5g-oai-du environment: From e46737e7e78a1429d69f63942bb8ba93ff00c5a0 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Fri, 26 Nov 2021 10:38:00 +0100 Subject: [PATCH 107/110] fix(ci): CI runs won't leave commands in CI servers' history Signed-off-by: Raphael Defosseux --- ci-scripts/sshconnection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci-scripts/sshconnection.py b/ci-scripts/sshconnection.py index 65e9c961d0..67e0b832e6 100644 --- a/ci-scripts/sshconnection.py +++ b/ci-scripts/sshconnection.py @@ -100,7 +100,7 @@ class SSHConnection(): time.sleep(1) count += 1 if connect_status: - pass + self.command('unset HISTFILE', '\$', 5, silent=True) else: sys.exit('SSH Connection Failed') self.ipaddress = ipaddress From 9ea6f5716d6ae94b8b0d063f2c0ceebb3a5d8ce5 Mon Sep 17 00:00:00 2001 From: hardy Date: Sat, 27 Nov 2021 14:35:29 +0100 Subject: [PATCH 108/110] tentative to fix 2x b200 plugged on the same server --- ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf | 1 + ci-scripts/xml_files/fr1_nsa_quectel.xml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf b/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf index a72147ee99..9376d9f496 100644 --- a/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf +++ b/ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf @@ -250,6 +250,7 @@ RUs = ( max_pdschReferenceSignalPower = -27; max_rxgain = 111; eNB_instances = [0]; + sdr_addrs = "serial=30C51D4" # clock_src = "external"; } ); diff --git a/ci-scripts/xml_files/fr1_nsa_quectel.xml b/ci-scripts/xml_files/fr1_nsa_quectel.xml index ba1e478efc..2d0ff53525 100644 --- a/ci-scripts/xml_files/fr1_nsa_quectel.xml +++ b/ci-scripts/xml_files/fr1_nsa_quectel.xml @@ -73,7 +73,7 @@ Initialize_eNB Initialize gNB - -O ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf -E -q --usrp-args "serial=30C51D4" + -O ci-scripts/conf_files/gnb.band78.tm1.fr1.106PRB.usrpb210.conf -E -q 1 1 nr From cfbced8b5fa884ce5ca7e29fccbe657b10a9db6f Mon Sep 17 00:00:00 2001 From: Eurecom Date: Fri, 10 Dec 2021 13:18:58 +0100 Subject: [PATCH 109/110] Remove wrong abort call for the case of affinity!= -1 --- common/utils/system.c | 1 - 1 file changed, 1 deletion(-) diff --git a/common/utils/system.c b/common/utils/system.c index 72b0c71a21..1bdad55529 100644 --- a/common/utils/system.c +++ b/common/utils/system.c @@ -257,7 +257,6 @@ void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name, pthread_setname_np(*t, name); if (affinity != -1 ) { - abort(); cpu_set_t cpuset; CPU_ZERO(&cpuset); CPU_SET(affinity, &cpuset); From 3fde37a28d56fb18295f457ee412981a25cfa79d Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Fri, 17 Dec 2021 21:57:00 +0100 Subject: [PATCH 110/110] fix after merge and a ci bug (containers) --- common/utils/system.c | 11 +++-------- openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c | 5 +++-- openair2/RRC/NR/rrc_gNB_NGAP.c | 2 +- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/common/utils/system.c b/common/utils/system.c index 1bdad55529..93b13f03f2 100644 --- a/common/utils/system.c +++ b/common/utils/system.c @@ -96,20 +96,15 @@ static void read_pipe(int p, char *b, int size) { } } int checkIfFedoraDistribution(void) { - return system("grep -iq 'ID_LIKE.*fedora' /etc/os-release "); + return !system("grep -iq 'ID_LIKE.*fedora' /etc/os-release "); } int checkIfGenericKernelOnFedora(void) { - int ret=system("uname -a | grep -q rt"); - return 1 - ret; + return system("uname -a | grep -q rt"); } int checkIfInsideContainer(void) { - int res=system("egrep -q 'libpod|podman|kubepods' /proc/self/cgroup"); - if (res > 0) - return 1; - else - return 0; + return !system("egrep -q 'libpod|podman|kubepods' /proc/self/cgroup"); } /********************************************************************/ diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index f3dfba4d39..322c39c49b 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -254,7 +254,6 @@ static void do_pdcp_data_ind( //ctxt_pP->enb_flag != 1 || ctxt_pP->instance != 0 || ctxt_pP->eNB_index != 0 || - ctxt_pP->configured != 1 || ctxt_pP->brOption != 0) { LOG_E(PDCP, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__); exit(1); @@ -374,7 +373,9 @@ boolean_t pdcp_data_ind( const MBMS_flag_t MBMS_flagP, const rb_id_t rb_id, const sdu_size_t sdu_buffer_size, - mem_block_t *const sdu_buffer) + mem_block_t *const sdu_buffer, + const uint32_t *const srcID, + const uint32_t *const dstID) { enqueue_pdcp_data_ind(ctxt_pP, srb_flagP, diff --git a/openair2/RRC/NR/rrc_gNB_NGAP.c b/openair2/RRC/NR/rrc_gNB_NGAP.c index b59b42dc4c..00a2a56566 100644 --- a/openair2/RRC/NR/rrc_gNB_NGAP.c +++ b/openair2/RRC/NR/rrc_gNB_NGAP.c @@ -306,7 +306,7 @@ nr_rrc_pdcp_config_security( uint8_t *kRRCenc = NULL; uint8_t *kRRCint = NULL; uint8_t *kUPenc = NULL; - uint8_t *k_kdf = NULL; + //uint8_t *k_kdf = NULL; static int print_keys= 1;