From 988d98a4e3ace4475a44d4da3f3131fd7e1f0bbe Mon Sep 17 00:00:00 2001 From: Bing-Kai Hong Date: Tue, 18 Sep 2018 15:11:05 +0200 Subject: [PATCH 1/3] send UL RRC MESSAGE TRANSFER --- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 2 +- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 28 +++++++------ openair2/F1AP/f1ap_du_rrc_message_transfer.h | 18 ++++---- openair2/LAYER2/RLC/rlc.c | 43 ++++++++++++++++---- 4 files changed, 63 insertions(+), 28 deletions(-) diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index d9d061c6d2..fdec30ff68 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -213,7 +213,7 @@ int CU_send_DL_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_DLRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie->value.choice.GNB_DU_UE_F1AP_ID = du_ue_f1ap_id; // TODO: f1ap_dl_rrc->gNB_DU_ue_id + ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_dl_rrc->gNB_DU_ue_id; // TODO: f1ap_dl_rrc->gNB_DU_ue_id ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* optional */ diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index a2febfaa62..b539ae5cd1 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -152,7 +152,13 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, } //void DU_send_UL_RRC_MESSAGE_TRANSFER(F1AP_ULRRCMessageTransfer_t *ULRRCMessageTransfer) { -int DU_send_UL_RRC_MESSAGE_TRANSFER(void) { +int DU_send_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, + int CC_idP, + uint8_t *sduP, + sdu_size_t sdu_lenP) { + + printf("DU_send_UL_RRC_MESSAGE_TRANSFER \n"); + F1AP_F1AP_PDU_t pdu; F1AP_ULRRCMessageTransfer_t *out; F1AP_ULRRCMessageTransferIEs_t *ie; @@ -185,7 +191,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(void) { 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 = 651L; + ie->value.choice.GNB_DU_UE_F1AP_ID = F1AP_get_UE_identifier(module_idP, CC_idP, 0); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ @@ -204,8 +210,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(void) { 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, "asdsa1d32sa1d31asd31as", - strlen("asdsa1d32sa1d31asd31as")); + OCTET_STRING_fromBuf(&ie->value.choice.RRCContainer, sduP, sdu_lenP); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* encode */ @@ -227,14 +232,13 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(void) { } /* 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, - uint8_t *sduP, - sdu_size_t sdu_lenP -) { +int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, + int CC_idP, + int UE_id, + rnti_t rntiP, + uint8_t *sduP, + sdu_size_t sdu_lenP) { + F1AP_F1AP_PDU_t pdu; F1AP_InitialULRRCMessageTransfer_t *out; F1AP_InitialULRRCMessageTransferIEs_t *ie; diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.h b/openair2/F1AP/f1ap_du_rrc_message_transfer.h index a841d7a7ba..87a94f651e 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.h +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.h @@ -39,14 +39,16 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, uint32_t stream, F1AP_F1AP_PDU_t *pdu); -int DU_send_UL_RRC_MESSAGE_TRANSFER(void); +int DU_send_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, + int CC_idP, + uint8_t *sduP, + sdu_size_t sdu_lenP); -int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER( - module_id_t module_idP, - int CC_idP, - int UE_id, - rnti_t rntiP, - uint8_t *sduP, - sdu_size_t sdu_lenP); +int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, + int CC_idP, + int UE_id, + rnti_t rntiP, + uint8_t *sduP, + sdu_size_t sdu_lenP); #endif /* F1AP_DU_RRC_MESSAGE_TRANSFER_H_ */ diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c index b886d92783..10a3e77aa0 100644 --- a/openair2/LAYER2/RLC/rlc.c +++ b/openair2/LAYER2/RLC/rlc.c @@ -37,6 +37,8 @@ #include "assertions.h" +#include "common/ran_context.h" +extern RAN_CONTEXT_t RC; extern boolean_t pdcp_data_ind( const protocol_ctxt_t* const ctxt_pP, @@ -689,13 +691,40 @@ void rlc_data_ind ( else #endif /*UETARGET*/ { - pdcp_data_ind ( - ctxt_pP, - srb_flagP, - MBMS_flagP, - rb_idP, - sdu_sizeP, - sdu_pP); + + switch (RC.rrc[ctxt_pP->module_id]->node_type){ + case ngran_eNB_CU : + case ngran_ng_eNB_CU : + case ngran_gNB_CU : + pdcp_data_ind ( + ctxt_pP, + 1, // srb_flagP, + 0, // MBMS_flagP, + rb_idP, + sdu_sizeP, + sdu_pP); + break; + case ngran_eNB_DU : + case ngran_gNB_DU : + DU_send_UL_RRC_MESSAGE_TRANSFER( + ctxt_pP->module_id, + rb_idP, + sdu_pP, + sdu_sizeP + ); + break; + + default: + pdcp_data_ind ( + ctxt_pP, + srb_flagP, + MBMS_flagP, + rb_idP, + sdu_sizeP, + sdu_pP); + break; + } + } } //----------------------------------------------------------------------------- From c8742f26fb720c097ad513f0ba6e462a9c52b201 Mon Sep 17 00:00:00 2001 From: Bing-Kai Hong Date: Tue, 18 Sep 2018 16:12:01 +0200 Subject: [PATCH 2/3] Normalized message output --- openair2/F1AP/f1ap_cu_interface_management.c | 45 +++++++--------- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 35 +++++------- openair2/F1AP/f1ap_cu_task.c | 10 ++-- openair2/F1AP/f1ap_cu_ue_context_management.c | 20 +------ openair2/F1AP/f1ap_decoder.c | 36 +++++++------ openair2/F1AP/f1ap_du_interface_management.c | 54 ++++++++----------- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 33 +++++------- openair2/F1AP/f1ap_du_task.c | 8 +-- openair2/F1AP/f1ap_du_ue_context_management.c | 17 +----- openair2/F1AP/f1ap_encoder.c | 11 +++- openair2/F1AP/f1ap_handlers.c | 2 +- openair2/F1AP/f1ap_itti_messaging.c | 2 +- openair2/RRC/LTE/rrc_eNB.c | 2 +- 13 files changed, 113 insertions(+), 162 deletions(-) diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index 0d55e8be1e..7198effdad 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -84,7 +84,7 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { - printf("CU_handle_F1_SETUP_REQUEST\n"); + LOG_D(CU_F1AP, "CU_handle_F1_SETUP_REQUEST\n"); MessageDef *message_p; F1AP_F1SetupRequest_t *container; @@ -112,7 +112,7 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, 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); - printf("F1AP_SETUP_REQ(message_p).gNB_DU_id %lu \n", F1AP_SETUP_REQ(message_p).gNB_DU_id); + LOG_D(CU_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, @@ -122,13 +122,13 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, 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'; - printf ("F1AP_SETUP_REQ(message_p).gNB_DU_name %s \n", F1AP_SETUP_REQ(message_p).gNB_DU_name); + LOG_D(CU_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_SETUP_REQ(message_p).num_cells_available = ie->value.choice.GNB_DU_Served_Cells_List.list.count; - printf ("F1AP_SETUP_REQ(message_p).num_cells_available %d \n", F1AP_SETUP_REQ(message_p).num_cells_available); + LOG_D(CU_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; @@ -139,7 +139,7 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, /* tac */ OCTET_STRING_TO_INT16(&(served_celles_item_p->served_Cell_Information.fiveGS_TAC), F1AP_SETUP_REQ(message_p).tac[i]); - printf ("F1AP_SETUP_REQ(message_p).tac[%d] %d \n", i, F1AP_SETUP_REQ(message_p).tac[i]); + LOG_D(CU_F1AP, "F1AP_SETUP_REQ(message_p).tac[%d] %d \n", i, F1AP_SETUP_REQ(message_p).tac[i]); /* - nRCGI */ TBCD_TO_MCC_MNC(&(served_celles_item_p->served_Cell_Information.nRCGI.pLMN_Identity), F1AP_SETUP_REQ(message_p).mcc[i], @@ -150,11 +150,11 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, // NR cellID BIT_STRING_TO_NR_CELL_IDENTITY(&served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity, F1AP_SETUP_REQ(message_p).nr_cellid[i]); - printf("[SCTP %d] Received nRCGI: MCC %d, MNC %d, CELL_ID %d\n", assoc_id, + LOG_D(CU_F1AP, "[SCTP %d] Received nRCGI: MCC %d, MNC %d, CELL_ID %d\n", assoc_id, F1AP_SETUP_REQ(message_p).mcc[i], F1AP_SETUP_REQ(message_p).mnc[i], F1AP_SETUP_REQ(message_p).nr_cellid[i]); - printf("nr_cellId : %x %x %x %x %x\n", + LOG_D(CU_F1AP, "nr_cellId : %x %x %x %x %x\n", served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[0], served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[1], served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[2], @@ -162,7 +162,7 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, served_celles_item_p->served_Cell_Information.nRCGI.nRCellIdentity.buf[4]); /* - nRPCI */ F1AP_SETUP_REQ(message_p).nr_pci[i] = served_celles_item_p->served_Cell_Information.nRPCI; - printf ("F1AP_SETUP_REQ(message_p).nr_pci[%d] %d \n", i, F1AP_SETUP_REQ(message_p).nr_pci[i]); + LOG_D(CU_F1AP, "F1AP_SETUP_REQ(message_p).nr_pci[%d] %d \n", i, F1AP_SETUP_REQ(message_p).nr_pci[i]); // System Information /* mib */ @@ -172,7 +172,7 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, /* Convert the mme name to a printable string */ F1AP_SETUP_REQ(message_p).mib[i][served_celles_item_p->gNB_DU_System_Information->mIB_message.size] = '\0'; F1AP_SETUP_REQ(message_p).mib_length[i] = served_celles_item_p->gNB_DU_System_Information->mIB_message.size; - printf ("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]); + LOG_D(CU_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_celles_item_p->gNB_DU_System_Information->sIB1_message.size + 1, sizeof(char)); @@ -181,7 +181,7 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, /* Convert the mme name to a printable string */ F1AP_SETUP_REQ(message_p).sib1[i][served_celles_item_p->gNB_DU_System_Information->sIB1_message.size] = '\0'; F1AP_SETUP_REQ(message_p).sib1_length[i] = served_celles_item_p->gNB_DU_System_Information->sIB1_message.size; - printf ("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]); + LOG_D(CU_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]); } @@ -294,7 +294,7 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance, ie->value.present = F1AP_F1SetupResponseIEs__value_PR_Cells_to_be_Activated_List; int num_cells_to_activate = f1ap_setup_resp->num_cells_to_activate; - printf("num_cells_to_activate = %d \n", num_cells_to_activate); + LOG_D(CU_F1AP, "num_cells_to_activate = %d \n", num_cells_to_activate); for (i=0; iSI_container_length[i][0];n++) printf("%2x ",f1ap_setup_resp->SI_container[i][0][n]); - printf("\n"); + LOG_D(CU_F1AP, "SI %d: "); + for (int n=0;nSI_container_length[i][0];n++) LOG_D(CU_F1AP, "%2x ",f1ap_setup_resp->SI_container[i][0][n]); + LOG_D(CU_F1AP, "\n"); OCTET_STRING_fromBuf(&gNB_CUSystemInformation->sImessage, f1ap_setup_resp->SI_container[i][0], f1ap_setup_resp->SI_container_length[i][0]); - printf("f1ap_setup_resp->SI_container_length = %d \n" , f1ap_setup_resp->SI_container_length[0][0]); + LOG_D(CU_F1AP, "f1ap_setup_resp->SI_container_length = %d \n" , f1ap_setup_resp->SI_container_length[0][0]); cells_to_be_activated_list_itemExtIEs->extensionValue.choice.GNB_CUSystemInformation = *gNB_CUSystemInformation; @@ -362,24 +362,17 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance, /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - printf("Failed to encode F1 setup request\n"); + LOG_E(CU_F1AP, "Failed to encode F1 setup request\n"); return -1; } - // printf("\n"); cu_f1ap_itti_send_sctp_data_req(instance, f1ap_du_data_from_du->assoc_id, buffer, len, 0); - /* decode */ - // if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { - // printf("Failed to decode F1 setup request\n"); - // } - //printf("F1 setup response present = %d\n", out->value.present); - //f1ap_send_sctp_data_req(instance_p->instance, f1ap_mme_data_p->assoc_id, buffer, len, 0); return 0; } int CU_send_F1_SETUP_FAILURE(instance_t instance) { - printf("CU_send_F1_SETUP_FAILURE\n"); + LOG_D(CU_F1AP, "CU_send_F1_SETUP_FAILURE\n"); module_id_t enb_mod_idP; module_id_t cu_mod_idP; @@ -454,7 +447,7 @@ int CU_send_F1_SETUP_FAILURE(instance_t instance) { /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - printf("Failed to encode F1 setup request\n"); + LOG_E(CU_F1AP, "Failed to encode F1 setup request\n"); return -1; } @@ -858,7 +851,7 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_ /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - printf("Failed to encode F1 setup request\n"); + LOG_E(CU_F1AP, "Failed to encode F1 setup request\n"); return -1; } diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index fdec30ff68..fad0ffc06e 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -59,7 +59,7 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { - printf("CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER\n"); + LOG_D(CU_F1AP, "CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER\n"); // decode the F1 message // get the rrc message from the contauiner // call func rrc_eNB_decode_ccch: <-- needs some update here @@ -90,7 +90,7 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, 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; - printf("du_ue_f1ap_id %lu \n", du_ue_f1ap_id); + LOG_D(CU_F1AP, "du_ue_f1ap_id %lu \n", du_ue_f1ap_id); /* NRCGI * TODO: process NRCGI @@ -117,9 +117,9 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, ccch_sdu_len = ie->value.choice.RRCContainer.size; memcpy(RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf, ccch_sdu_len); - printf ("RRCContainer(CCCH) :"); - for (int i=0;ivalue.choice.RRCContainer.size;i++) printf("%2x ",RRC_MAC_CCCH_DATA_IND (message_p).sdu[i]); - + LOG_D(CU_F1AP, "RRCContainer(CCCH) :"); + for (int i=0;ivalue.choice.RRCContainer.size;i++) LOG_D(CU_F1AP, "%2x ",RRC_MAC_CCCH_DATA_IND (message_p).sdu[i]); + LOG_D(CU_F1AP, "\n"); // Find instance from nr_cellid int rrc_inst = -1; for (int i=0;i 0) { - printf("Failed to decode F1 setup request\n"); - return -1; - } -#endif - cu_f1ap_itti_send_sctp_data_req(instance, f1ap_assoc_id, buffer, len, 0); - return 0; } @@ -304,7 +294,7 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { - printf("CU_handle_UL_RRC_MESSAGE_TRANSFER \n"); + LOG_D(CU_F1AP, "CU_handle_UL_RRC_MESSAGE_TRANSFER \n"); MessageDef *message_p; F1AP_ULRRCMessageTransfer_t *container; @@ -336,14 +326,14 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, 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; - printf("cu_ue_f1ap_id %lu \n", cu_ue_f1ap_id); + LOG_D(CU_F1AP, "cu_ue_f1ap_id %lu \n", 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; - printf("du_ue_f1ap_id %lu \n", du_ue_f1ap_id); + LOG_D(CU_F1AP, "du_ue_f1ap_id %lu \n", du_ue_f1ap_id); /* mandatory */ @@ -351,7 +341,7 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_ULRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_SRBID, true); srb_id = ie->value.choice.SRBID; - printf("srb_id %lu \n", srb_id); + LOG_D(CU_F1AP, "srb_id %lu \n", srb_id); // issue in here @@ -366,8 +356,9 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, ccch_sdu_len = ie->value.choice.RRCContainer.size; memcpy(RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf, ccch_sdu_len); - printf ("RRCContainer(CCCH) :"); - for (int i=0;ivalue.choice.RRCContainer.size;i++) printf("%2x ",RRC_MAC_CCCH_DATA_IND (message_p).sdu[i]); + LOG_D(CU_F1AP, "RRCContainer(CCCH) :"); + for (int i=0;ivalue.choice.RRCContainer.size;i++) LOG_D(CU_F1AP, "%2x ",RRC_MAC_CCCH_DATA_IND (message_p).sdu[i]); + LOG_D(CU_F1AP, "\n"); return 0; } diff --git a/openair2/F1AP/f1ap_cu_task.c b/openair2/F1AP/f1ap_cu_task.c index 5da7dcba44..eeed466ceb 100644 --- a/openair2/F1AP/f1ap_cu_task.c +++ b/openair2/F1AP/f1ap_cu_task.c @@ -120,25 +120,25 @@ void *F1AP_CU_task(void *arg) { switch (ITTI_MSG_ID(received_msg)) { case SCTP_NEW_ASSOCIATION_IND: - LOG_I(CU_F1AP, "SCTP_NEW_ASSOCIATION_IND for instance %d\n",ITTI_MESSAGE_GET_INSTANCE(received_msg)); + LOG_I(CU_F1AP, "CU Task Received SCTP_NEW_ASSOCIATION_IND for instance %d\n",ITTI_MESSAGE_GET_INSTANCE(received_msg)); cu_task_handle_sctp_association_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_new_association_ind); break; case SCTP_NEW_ASSOCIATION_RESP: - LOG_I(CU_F1AP, "SCTP_NEW_ASSOCIATION_RESP for instance %d\n",ITTI_MESSAGE_GET_INSTANCE(received_msg)); + LOG_I(CU_F1AP, "CU Task Received SCTP_NEW_ASSOCIATION_RESP for instance %d\n",ITTI_MESSAGE_GET_INSTANCE(received_msg)); cu_task_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_new_association_resp); break; case SCTP_DATA_IND: - LOG_I(CU_F1AP, "SCTP_DATA_IND for Instance %d\n",ITTI_MESSAGE_GET_INSTANCE(received_msg)); + LOG_I(CU_F1AP, "CU Task Received SCTP_DATA_IND for Instance %d\n",ITTI_MESSAGE_GET_INSTANCE(received_msg)); cu_task_handle_sctp_data_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_data_ind); break; case F1AP_SETUP_RESP: // from rrc - LOG_W(CU_F1AP, "F1AP_SETUP_RESP\n"); + LOG_I(CU_F1AP, "CU Task Received F1AP_SETUP_RESP\n"); // CU_send_f1setup_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), // &F1AP_SETUP_RESP(received_msg)); CU_send_F1_SETUP_RESPONSE(ITTI_MESSAGE_GET_INSTANCE(received_msg), @@ -146,7 +146,7 @@ void *F1AP_CU_task(void *arg) { break; case F1AP_DL_RRC_MESSAGE: // from rrc - LOG_W(CU_F1AP, "F1AP_DL_RRC_MESSAGE\n"); + LOG_I(CU_F1AP, "CU Task Received F1AP_DL_RRC_MESSAGE\n"); // CU_send_f1setup_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), // &F1AP_SETUP_RESP(received_msg)); CU_send_DL_RRC_MESSAGE_TRANSFER(ITTI_MESSAGE_GET_INSTANCE(received_msg), diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 3c11d09b1e..49398f91a1 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -356,18 +356,10 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance) { /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - printf("Failed to encode F1 setup request\n"); + LOG_E(CU_F1AP, "Failed to encode F1 setup request\n"); return -1; } - printf("\n"); - - /* decode */ - if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { - printf("Failed to decode F1 setup request\n"); - return -1; - } - //AssertFatal(1==0,"Not implemented yet\n"); return 0; } @@ -869,15 +861,7 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance) { /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - printf("Failed to encode F1 setup request\n"); - return -1; - } - - printf("\n"); - - /* decode */ - if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { - printf("Failed to decode F1 setup request\n"); + LOG_E(CU_F1AP, "Failed to encode F1 setup request\n"); return -1; } diff --git a/openair2/F1AP/f1ap_decoder.c b/openair2/F1AP/f1ap_decoder.c index 08816bd82b..1de0495ce5 100644 --- a/openair2/F1AP/f1ap_decoder.c +++ b/openair2/F1AP/f1ap_decoder.c @@ -33,33 +33,35 @@ #include "f1ap_common.h" #include "f1ap_decoder.h" +int asn1_decoder_xer_print = 1; + 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} }; + //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); - printf("f1ap_eNB_decode_initiating_message!\n"); + //res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); + LOG_I(F1AP, "f1ap_eNB_decode_initiating_message!\n"); break; case F1AP_ProcedureCode_id_InitialULRRCMessageTransfer: - res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); - printf("f1ap_eNB_decode_initiating_message!\n"); + //res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); + LOG_I(F1AP, "f1ap_eNB_decode_initiating_message!\n"); break; case F1AP_ProcedureCode_id_DLRRCMessageTransfer: - res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); - printf("f1ap_eNB_decode_initiating_message!\n"); + //res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); + LOG_I(F1AP, "f1ap_eNB_decode_initiating_message!\n"); break; case F1AP_ProcedureCode_id_ULRRCMessageTransfer: - res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); - printf("f1ap_eNB_decode_initiating_message!\n"); + //res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); + LOG_I(F1AP, "f1ap_eNB_decode_initiating_message!\n"); break; // case F1AP_ProcedureCode_id_InitialContextSetup: // res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); @@ -75,7 +77,7 @@ static int f1ap_decode_initiating_message(F1AP_F1AP_PDU_t *pdu) default: // F1AP_ERROR("Unknown procedure ID (%d) for initiating message\n", // (int)pdu->choice.initiatingMessage->procedureCode); - printf("Unknown procedure ID (%d) for initiating message\n", + LOG_E(F1AP, "Unknown procedure ID (%d) for initiating message\n", (int)pdu->choice.initiatingMessage->procedureCode); AssertFatal( 0, "Unknown procedure ID (%d) for initiating message\n", (int)pdu->choice.initiatingMessage->procedureCode); @@ -137,8 +139,12 @@ int f1ap_decode_pdu(F1AP_F1AP_PDU_t *pdu, const uint8_t *const buffer, uint32_t length, 0, 0); - - xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu); + + if (asn1_decoder_xer_print) { + LOG_E(F1AP, "----------------- ASN1 DECODER PRINT START----------------- \n"); + 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) { @@ -157,7 +163,7 @@ int f1ap_decode_pdu(F1AP_F1AP_PDU_t *pdu, const uint8_t *const buffer, uint32_t return f1ap_decode_unsuccessful_outcome(pdu); default: - LOG_D(F1AP, "Unknown presence (%d) or not implemented\n", (int)pdu->present); + LOG_E(F1AP, "Unknown presence (%d) or not implemented\n", (int)pdu->present); break; } diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index 6bf5c211fc..58bdabe265 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -145,7 +145,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { ie->value.present = F1AP_F1SetupRequestIEs__value_PR_GNB_DU_Served_Cells_List; int num_cells_available = f1ap_du_data->num_cells_available; - printf("num_cells_available = %d \n", num_cells_available); + LOG_D(DU_F1AP, "num_cells_available = %d \n", num_cells_available); for (i=0; imcc[i], f1ap_du_data->mnc[i], f1ap_du_data->mnc_digit_length[i], &nRCGI.pLMN_Identity); - printf("plmn: (%d,%d)\n",f1ap_du_data->mcc[i],f1ap_du_data->mnc[i]); + LOG_D(DU_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); NR_CELL_ID_TO_BIT_STRING(f1ap_du_data->nr_cellid[i], &nRCGI.nRCellIdentity); - printf("nRCellIdentity (%llx): %x.%x.%x.%x.%x\n",f1ap_du_data->nr_cellid[i], + LOG_D(DU_F1AP, "nRCellIdentity (%llx): %x.%x.%x.%x.%x\n",f1ap_du_data->nr_cellid[i], nRCGI.nRCellIdentity.buf[0], nRCGI.nRCellIdentity.buf[1], nRCGI.nRCellIdentity.buf[2], @@ -202,7 +202,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { /* - broadcast PLMNs */ // RK: add the num_available_broadcast_PLMNs to the message int num_available_broadcast_PLMNs = 1; //f1ap_du_data->num_available_broadcast_PLMNs; - printf("num_available_broadcast_PLMNs = %d \n", num_available_broadcast_PLMNs); + LOG_D(DU_F1AP, "num_available_broadcast_PLMNs = %d \n", num_available_broadcast_PLMNs); for (j=0; jnr_mode_info[i].fdd.ul_num_frequency_bands; - printf("fdd_ul_num_available_freq_Bands = %d \n", fdd_ul_num_available_freq_Bands); + LOG_D(DU_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_jnr_mode_info[i].fdd.ul_num_sul_frequency_bands; - printf("num_available_supported_SULBands = %d \n", num_available_supported_SULBands); + LOG_D(DU_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.dl_num_frequency_bands; - printf("fdd_dl_num_available_freq_Bands = %d \n", fdd_dl_num_available_freq_Bands); + LOG_D(DU_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_jnr_mode_info[i].fdd.dl_num_sul_frequency_bands; - printf("num_available_supported_SULBands = %d \n", num_available_supported_SULBands); + LOG_D(DU_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].tdd.num_frequency_bands; - printf("tdd_num_available_freq_Bands = %d \n", tdd_num_available_freq_Bands); + LOG_D(DU_F1AP, "tdd_num_available_freq_Bands = %d \n", tdd_num_available_freq_Bands); int j; for (j=0; jnr_mode_info[i].tdd.num_sul_frequency_bands; - printf("num_available_supported_SULBands = %d \n", num_available_supported_SULBands); + LOG_D(DU_F1AP, "num_available_supported_SULBands = %d \n", num_available_supported_SULBands); int k; for (k=0; kpresent == F1AP_F1AP_PDU_PR_successfulOutcome, "pdu->present != F1AP_F1AP_PDU_PR_successfulOutcome\n"); @@ -435,7 +435,7 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, MessageDef *msg_p = itti_alloc_new_message (TASK_DU_F1, F1AP_SETUP_RESP); - printf("F1AP: F1Setup-Resp: protocolIEs.list.count %d\n", + LOG_D(DU_F1AP, "F1AP: F1Setup-Resp: protocolIEs.list.count %d\n", in->protocolIEs.list.count); for (int i=0;i < in->protocolIEs.list.count; i++) { ie = in->protocolIEs.list.array[i]; @@ -446,7 +446,7 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, AssertFatal(ie->value.present == F1AP_F1SetupResponseIEs__value_PR_TransactionID, "ie->value.present != F1AP_F1SetupResponseIEs__value_PR_TransactionID\n"); TransactionId=ie->value.choice.TransactionID; - printf("F1AP: F1Setup-Resp: TransactionId %d\n", + LOG_D(DU_F1AP, "F1AP: F1Setup-Resp: TransactionId %d\n", TransactionId); break; case F1AP_ProtocolIE_ID_id_gNB_CU_Name: @@ -457,7 +457,7 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, 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'; - printf("F1AP: F1Setup-Resp: gNB_CU_name %s\n", + LOG_D(DU_F1AP, "F1AP: F1Setup-Resp: gNB_CU_name %s\n", F1AP_SETUP_RESP (msg_p).gNB_CU_name); break; case F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List: @@ -466,7 +466,7 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, 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"); num_cells_to_activate = ie->value.choice.Cells_to_be_Activated_List.list.count; - printf("F1AP: Activating %d cells\n",num_cells_to_activate); + LOG_D(DU_F1AP, "F1AP: Activating %d cells\n",num_cells_to_activate); for (int i=0;ivalue.choice.Cells_to_be_Activated_List.list.array[i]; @@ -482,7 +482,7 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, TBCD_TO_MCC_MNC(&cell->nRCGI.pLMN_Identity, F1AP_SETUP_RESP (msg_p).mcc[i], F1AP_SETUP_RESP (msg_p).mnc[i], F1AP_SETUP_RESP (msg_p).mnc_digit_length[i]); AssertFatal(cell->nRPCI != NULL, "nRPCI is null\n"); - printf("nr_cellId : %x %x %x %x %x\n", + LOG_D(DU_F1AP, "nr_cellId : %x %x %x %x %x\n", cell->nRCGI.nRCellIdentity.buf[0], cell->nRCGI.nRCellIdentity.buf[1], cell->nRCGI.nRCellIdentity.buf[2], @@ -496,11 +496,11 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, AssertFatal(ext!=NULL,"Extension for SI is null\n"); F1AP_SETUP_RESP (msg_p).num_SI[i] = ext->list.count; AssertFatal(ext->list.count==1,"At least one SI message should be there, and only 1 for now!\n"); - printf("F1AP: F1Setup-Resp Cell %d MCC %d MNC %d NRCellid %x num_si %d\n",i,F1AP_SETUP_RESP (msg_p).mcc[i],F1AP_SETUP_RESP (msg_p).mnc[i],F1AP_SETUP_RESP (msg_p).nr_cellid[i],F1AP_SETUP_RESP (msg_p).num_SI[i]); + LOG_D(DU_F1AP, "F1AP: F1Setup-Resp Cell %d MCC %d MNC %d NRCellid %x num_si %d\n",i,F1AP_SETUP_RESP (msg_p).mcc[i],F1AP_SETUP_RESP (msg_p).mnc[i],F1AP_SETUP_RESP (msg_p).nr_cellid[i],F1AP_SETUP_RESP (msg_p).num_SI[i]); for (int si =0;si < ext->list.count;si++) { size_t size = ext->list.array[si]->extensionValue.choice.GNB_CUSystemInformation.sImessage.size; F1AP_SETUP_RESP (msg_p).SI_container_length[i][si] = size; - printf("F1AP: F1Setup-Resp SI_container_length[%d][%d] %d bytes\n",i,si,size); + LOG_D(DU_F1AP, "F1AP: F1Setup-Resp SI_container_length[%d][%d] %d bytes\n",i,si,size); F1AP_SETUP_RESP (msg_p).SI_container[i][si] = malloc(F1AP_SETUP_RESP (msg_p).SI_container_length[i][si]); memcpy((void*)F1AP_SETUP_RESP (msg_p).SI_container[i][si], @@ -519,7 +519,7 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, AssertFatal(F1AP_SETUP_RESP (msg_p).num_SI[i] > 0, "System Information %d is missing",i); - printf("Sending F1AP_SETUP_RESP ITTI message to ENB_APP with assoc_id (%d->%d)\n", + LOG_D(DU_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); @@ -600,7 +600,7 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, /* - nRCGI */ F1AP_NRCGI_t 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); - printf("nr_cellId : %x %x %x %x %x\n", + LOG_D(DU_F1AP, "nr_cellId : %x %x %x %x %x\n", nRCGI.nRCellIdentity.buf[0], nRCGI.nRCellIdentity.buf[1], nRCGI.nRCellIdentity.buf[2], @@ -975,17 +975,7 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - printf("Failed to encode F1 setup request\n"); - return -1; - } - - printf("\n"); - - //du_f1ap_itti_send_sctp_data_req(instance, f1ap_setup_req->assoc_id, buffer, len, 0); - - /* decode */ - if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { - printf("Failed to decode F1 setup request\n"); + LOG_E(DU_F1AP, "Failed to encode F1 setup request\n"); return -1; } diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index b539ae5cd1..4a6f28e3dc 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -49,7 +49,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { - printf("DU_handle_DL_RRC_MESSAGE_TRANSFER \n"); + LOG_D(DU_F1AP, "DU_handle_DL_RRC_MESSAGE_TRANSFER \n"); MessageDef *message_p; F1AP_DLRRCMessageTransfer_t *container; @@ -81,14 +81,14 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, 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; - printf("cu_ue_f1ap_id %lu \n", cu_ue_f1ap_id); + LOG_D(DU_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); du_ue_f1ap_id = ie->value.choice.GNB_DU_UE_F1AP_ID; - printf("du_ue_f1ap_id %lu \n", du_ue_f1ap_id); + LOG_D(DU_F1AP, "du_ue_f1ap_id %lu \n", du_ue_f1ap_id); /* optional */ @@ -103,7 +103,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_SRBID, true); srb_id = ie->value.choice.SRBID; - printf("srb_id %lu \n", srb_id); + LOG_D(DU_F1AP, "srb_id %lu \n", srb_id); /* optional */ @@ -112,7 +112,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_t, ie, container, F1AP_ProtocolIE_ID_id_ExecuteDuplication, true); executeDuplication = ie->value.choice.ExecuteDuplication; - printf("ExecuteDuplication %d \n", executeDuplication); + LOG_D(DU_F1AP, "ExecuteDuplication %d \n", executeDuplication); } // issue in here @@ -127,9 +127,9 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, ccch_sdu_len = ie->value.choice.RRCContainer.size; memcpy(RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf, ccch_sdu_len); - printf ("RRCContainer(CCCH) :"); - for (int i=0;ivalue.choice.RRCContainer.size;i++) printf("%2x ",RRC_MAC_CCCH_DATA_IND (message_p).sdu[i]); - + LOG_D(DU_F1AP, "RRCContainer(CCCH) :"); + for (int i=0;ivalue.choice.RRCContainer.size;i++) LOG_D(DU_F1AP, "%2x ",RRC_MAC_CCCH_DATA_IND (message_p).sdu[i]); + LOG_D(DU_F1AP, "\n"); /* optional */ /* RAT_FrequencyPriorityInformation */ @@ -157,7 +157,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, uint8_t *sduP, sdu_size_t sdu_lenP) { - printf("DU_send_UL_RRC_MESSAGE_TRANSFER \n"); + LOG_D(DU_F1AP, "DU_send_UL_RRC_MESSAGE_TRANSFER \n"); F1AP_F1AP_PDU_t pdu; F1AP_ULRRCMessageTransfer_t *out; @@ -215,19 +215,10 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - printf("Failed to encode F1 setup request\n"); + LOG_E(DU_F1AP, "Failed to encode F1 setup request\n"); return -1; } - printf("\n"); - - //du_f1ap_itti_send_sctp_data_req(instance, f1ap_setup_req->assoc_id, buffer, len, 0); - /* decode */ - // if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { - // printf("Failed to decode F1 setup request\n"); - // } - //AssertFatal(1==0,"Not implemented yet\n"); - return 0; } @@ -238,7 +229,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, rnti_t rntiP, uint8_t *sduP, sdu_size_t sdu_lenP) { - + F1AP_F1AP_PDU_t pdu; F1AP_InitialULRRCMessageTransfer_t *out; F1AP_InitialULRRCMessageTransferIEs_t *ie; @@ -313,7 +304,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - printf("Failed to encode F1 setup request\n"); + LOG_E(DU_F1AP, "Failed to encode F1 setup request\n"); return -1; } diff --git a/openair2/F1AP/f1ap_du_task.c b/openair2/F1AP/f1ap_du_task.c index 5edcf01437..3f99810a22 100644 --- a/openair2/F1AP/f1ap_du_task.c +++ b/openair2/F1AP/f1ap_du_task.c @@ -69,7 +69,7 @@ void du_task_send_sctp_association_req(instance_t instance, f1ap_setup_req_t *f1 *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]); + //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); @@ -139,7 +139,7 @@ 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 - LOG_I(DU_F1AP, "F1AP_SETUP_REQ\n"); + LOG_I(DU_F1AP, "DU Task Received F1AP_SETUP_REQ\n"); du_task_send_sctp_association_req(ITTI_MESSAGE_GET_INSTANCE(received_msg), &F1AP_SETUP_REQ(received_msg)); break; @@ -147,14 +147,14 @@ void *F1AP_DU_task(void *arg) { case SCTP_NEW_ASSOCIATION_RESP: // 1. store the respon // 2. send the f1setup_req - LOG_I(DU_F1AP, "SCTP_NEW_ASSOCIATION_RESP\n"); + LOG_I(DU_F1AP, "DU Task Received SCTP_NEW_ASSOCIATION_RESP\n"); du_task_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_new_association_resp); break; case SCTP_DATA_IND: // ex: any F1 incoming message for DU ends here - LOG_I(DU_F1AP, "SCTP_DATA_IND\n"); + LOG_I(DU_F1AP, "DU Task Received SCTP_DATA_IND\n"); du_task_handle_sctp_data_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg), &received_msg->ittiMsg.sctp_data_ind); break; diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index c81c47723c..d4d1020206 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -298,17 +298,10 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance) { /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - printf("Failed to encode F1 setup request\n"); + LOG_E(DU_F1AP, "Failed to encode F1 setup request\n"); return -1; } - printf("\n"); - - /* decode */ - // if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { - // printf("Failed to decode F1 setup request\n"); - // } - //du_f1ap_itti_send_sctp_data_req(instance, f1ap_setup_req->assoc_id, buffer, len, 0); return 0; } @@ -688,16 +681,10 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance) { /* encode */ if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - printf("Failed to encode F1 setup request\n"); + LOG_E(DU_F1AP, "Failed to encode F1 setup request\n"); return -1; } - printf("\n"); - - /* decode */ - // if (f1ap_decode_pdu(&pdu, buffer, len) > 0) { - // printf("Failed to decode F1 setup request\n"); - // } //du_f1ap_itti_send_sctp_data_req(instance, f1ap_setup_req->assoc_id, buffer, len, 0); return 0; diff --git a/openair2/F1AP/f1ap_encoder.c b/openair2/F1AP/f1ap_encoder.c index 355e52ad95..248c61fcf5 100644 --- a/openair2/F1AP/f1ap_encoder.c +++ b/openair2/F1AP/f1ap_encoder.c @@ -33,6 +33,8 @@ #include "f1ap_common.h" #include "f1ap_encoder.h" +int asn1_encoder_xer_print = 1; + /* static inline int f1ap_encode_initiating(f1ap_message *message, uint8_t **buffer, @@ -76,14 +78,21 @@ int f1ap_encode_pdu(F1AP_F1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *length) DevAssert(buffer != NULL); DevAssert(length != NULL); - xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu); + if (asn1_encoder_xer_print) { + LOG_E(F1AP, "----------------- ASN1 ENCODER PRINT START ----------------- \n"); + xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu); + LOG_E(F1AP, "----------------- ASN1 ENCODER PRINT END----------------- \n"); + } + encoded = aper_encode_to_new_buffer(&asn_DEF_F1AP_F1AP_PDU, 0, pdu, (void **)buffer); if (encoded < 0) { LOG_E(F1AP, "Failed to encode F1AP message\n"); return -1; } + *length = encoded; + /* Is the following needed? I moved the code here from CU_F1AP.c/DU_F1AP.c */ // ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, pdu); return encoded; diff --git a/openair2/F1AP/f1ap_handlers.c b/openair2/F1AP/f1ap_handlers.c index 168f6deaa9..ef0b6d1f5c 100644 --- a/openair2/F1AP/f1ap_handlers.c +++ b/openair2/F1AP/f1ap_handlers.c @@ -117,7 +117,7 @@ int f1ap_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, } /* Calling the right handler */ - printf("Calling handler with instance %d\n",instance); + LOG_I(DU_F1AP, "Calling handler with instance %d\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); diff --git a/openair2/F1AP/f1ap_itti_messaging.c b/openair2/F1AP/f1ap_itti_messaging.c index 1f0f84017e..fa8951536a 100644 --- a/openair2/F1AP/f1ap_itti_messaging.c +++ b/openair2/F1AP/f1ap_itti_messaging.c @@ -55,7 +55,7 @@ void du_f1ap_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint sctp_data_req->buffer_length = buffer_length; sctp_data_req->stream = stream; - printf("Sending ITTI message to SCTP Task\n"); + LOG_I(F1AP, "Sending ITTI message to SCTP Task\n"); itti_send_msg_to_task(TASK_SCTP, instance, message_p); } diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 9e118fecbb..8056177123 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -5775,7 +5775,7 @@ rrc_eNB_generate_RRCConnectionSetup( F1AP_DL_RRC_MESSAGE (message_p).execute_duplication = 1; F1AP_DL_RRC_MESSAGE (message_p).RAT_frequency_priority_information.en_dc = 0; itti_send_msg_to_task (TASK_CU_F1, UE_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id), message_p); - LOG_E(RRC, "F1AP_DL_RRC_MESSAGE\n"); + LOG_D(RRC, "Send F1AP_DL_RRC_MESSAGE with ITTI\n"); break; case ngran_eNB_DU : case ngran_gNB_DU : From d9661177fa9ef01394bff749c39e832c2b18488c Mon Sep 17 00:00:00 2001 From: Navid Nikaein Date: Wed, 19 Sep 2018 02:01:08 +0200 Subject: [PATCH 3/3] Better management of cu/du ue ids Fix for some variables --- openair2/COMMON/f1ap_messages_types.h | 1 + openair2/F1AP/f1ap_common.c | 155 ++++++++++++++++++- openair2/F1AP/f1ap_common.h | 61 +++++++- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 51 +++--- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 47 ++++-- openair2/F1AP/f1ap_du_rrc_message_transfer.h | 6 +- openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 2 +- openair2/LAYER2/RLC/rlc.c | 2 +- openair2/RRC/LTE/rrc_eNB.c | 3 +- 9 files changed, 277 insertions(+), 51 deletions(-) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index 1c1fe6ed42..9725431906 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -211,6 +211,7 @@ typedef struct f1ap_dl_rrc_message_s { uint32_t gNB_CU_ue_id; uint32_t gNB_DU_ue_id; uint32_t old_gNB_DU_ue_id; + uint16_t rnti; uint8_t srb_id; uint8_t execute_duplication; uint8_t *rrc_container; diff --git a/openair2/F1AP/f1ap_common.c b/openair2/F1AP/f1ap_common.c index a5ad507901..f00b159e12 100644 --- a/openair2/F1AP/f1ap_common.c +++ b/openair2/F1AP/f1ap_common.c @@ -209,9 +209,160 @@ uint8_t F1AP_get_next_transaction_identifier(module_id_t enb_mod_idP, module_id_ return transaction_identifier[enb_mod_idP+cu_mod_idP]; } -uint8_t F1AP_get_UE_identifier(module_id_t enb_mod_idP, int CC_idP, int UE_id) { - static uint8_t UE_identifier[NUMBER_OF_eNB_MAX]; +module_id_t F1AP_get_UE_identifier(module_id_t enb_mod_idP, int CC_idP, int UE_id) { + static module_id_t UE_identifier[NUMBER_OF_eNB_MAX]; UE_identifier[enb_mod_idP+CC_idP+UE_id] = (UE_identifier[enb_mod_idP+CC_idP+UE_id] + 1) % F1AP_UE_IDENTIFIER_NUMBER; //LOG_T(F1AP,"generated xid is %d\n",transaction_identifier[enb_mod_idP+du_mod_idP]); return UE_identifier[enb_mod_idP+CC_idP+UE_id]; +} + +int f1ap_add_ue(f1ap_cudu_ue_inst_t *f1_ue_inst, + module_id_t module_idP, + int CC_idP, + int UE_id, + rnti_t rntiP){ + + int i; + for (i=0; i < MAX_MOBILES_PER_ENB; i++){ + if (f1_ue_inst->rnti[i] == rntiP) { + f1_ue_inst->f1ap_uid[i] = i; + f1_ue_inst->mac_uid[i] = UE_id; + LOG_I(F1AP, "Updating the index of UE with RNTI %x and du_ue_f1ap_id %d\n", f1_ue_inst->rnti[i], f1_ue_inst->du_ue_f1ap_id[i]); + return i; + } + } + for (i=0; i < MAX_MOBILES_PER_ENB ; i++){ + if (f1_ue_inst->rnti[i] == 0 ){ + f1_ue_inst->rnti[i]=rntiP; + f1_ue_inst->f1ap_uid[i]=i; + f1_ue_inst->mac_uid[i]=UE_id; + f1_ue_inst->du_ue_f1ap_id[i] = F1AP_get_UE_identifier(module_idP, CC_idP, i); + f1_ue_inst->cu_ue_f1ap_id[i] = F1AP_get_UE_identifier(module_idP, CC_idP, i); + f1_ue_inst->num_ues++; + LOG_I(F1AP, "Adding a new UE with RNTI %x and cu/du ue_f1ap_id %d\n", f1_ue_inst->rnti[i], f1_ue_inst->du_ue_f1ap_id[i]); + return i; + } + } + return -1; +} + + +int f1ap_remove_ue(f1ap_cudu_ue_inst_t *f1_ue_inst, + rnti_t rntiP){ + + int i; + for (i=0; i < MAX_MOBILES_PER_ENB; i++){ + if (f1_ue_inst->rnti[i] == rntiP) { + f1_ue_inst->rnti[i] = 0; + break; + } + } + return 0 ; +} + +int f1ap_get_du_ue_f1ap_id (f1ap_cudu_ue_inst_t *f1_ue_inst, + rnti_t rntiP){ + + int i; + for (i=0; i < MAX_MOBILES_PER_ENB; i++){ + if (f1_ue_inst->rnti[i] == rntiP) { + return f1_ue_inst->du_ue_f1ap_id[i]; + } + } + return -1; +} + +int f1ap_get_cu_ue_f1ap_id (f1ap_cudu_ue_inst_t *f1_ue_inst, + rnti_t rntiP){ + + int i; + for (i=0; i < MAX_MOBILES_PER_ENB; i++){ + if (f1_ue_inst->rnti[i] == rntiP) { + return f1_ue_inst->cu_ue_f1ap_id[i]; + } + } + return -1; +} + +int f1ap_get_rnti_by_du_id(f1ap_cudu_ue_inst_t *f1_ue_inst, + module_id_t du_ue_f1ap_id ){ + + int i; + for (i=0; i < MAX_MOBILES_PER_ENB; i++){ + if (f1_ue_inst->du_ue_f1ap_id[i] == du_ue_f1ap_id) { + return f1_ue_inst->rnti[i]; + } + } + return -1; +} + +int f1ap_get_rnti_by_cu_id(f1ap_cudu_ue_inst_t *f1_ue_inst, + module_id_t cu_ue_f1ap_id ){ + + int i; + for (i=0; i < MAX_MOBILES_PER_ENB; i++){ + if (f1_ue_inst->cu_ue_f1ap_id[i] == cu_ue_f1ap_id) { + return f1_ue_inst->rnti[i]; + } + } + return -1; +} + +int f1ap_get_du_uid(f1ap_cudu_ue_inst_t *f1_ue_inst, + module_id_t du_ue_f1ap_id ){ + + int i; + for (i=0; i < MAX_MOBILES_PER_ENB; i++){ + if (f1_ue_inst->du_ue_f1ap_id[i] == du_ue_f1ap_id) { + return i; + } + } + return -1; +} + + +int f1ap_get_cu_uid(f1ap_cudu_ue_inst_t *f1_ue_inst, + module_id_t cu_ue_f1ap_id ){ + + int i; + for (i=0; i < MAX_MOBILES_PER_ENB; i++){ + if (f1_ue_inst->cu_ue_f1ap_id[i] == cu_ue_f1ap_id) { + return i; + } + } + return -1; +} + +int f1ap_get_uid_by_rnti(f1ap_cudu_ue_inst_t *f1_ue_inst, + rnti_t rntiP ){ + + int i; + for (i=0; i < MAX_MOBILES_PER_ENB; i++){ + if (f1_ue_inst->rnti[i] == rntiP) { + return i; + } + } + return -1; +} + +int f1ap_du_add_cu_ue_id(f1ap_cudu_ue_inst_t *f1_ue_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_ue_inst,du_ue_f1ap_id); + if (f1ap_uid < 0 ) + return -1 ; + f1_ue_inst->cu_ue_f1ap_id[f1ap_uid]=cu_ue_f1ap_id; + LOG_I(F1AP, "Adding cu_ue_f1ap_id %d for UE with RNTI %x \n", cu_ue_f1ap_id, f1_ue_inst->rnti[f1ap_uid]); + return 0 ; +} + +int f1ap_cu_add_du_ue_id(f1ap_cudu_ue_inst_t *f1_ue_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_ue_inst,cu_ue_f1ap_id); + if (f1ap_uid < 0 ) + return -1 ; + f1_ue_inst->du_ue_f1ap_id[f1ap_uid]=du_ue_f1ap_id; + LOG_I(F1AP, "Adding du_ue_f1ap_id %d for UE with RNTI %x \n", du_ue_f1ap_id, f1_ue_inst->rnti[f1ap_uid]); + return 0 ; } \ No newline at end of file diff --git a/openair2/F1AP/f1ap_common.h b/openair2/F1AP/f1ap_common.h index 384f261de2..8cd53fbef6 100644 --- a/openair2/F1AP/f1ap_common.h +++ b/openair2/F1AP/f1ap_common.h @@ -425,8 +425,67 @@ typedef int (*f1ap_message_decoded_callback)( F1AP_F1AP_PDU_t *message_p ); +// instance and module_id are assumed to be the same +typedef struct f1ap_cudu_ue_inst_s { + // used for eNB stats generation + rnti_t rnti[MAX_MOBILES_PER_ENB]; + module_id_t f1ap_uid[MAX_MOBILES_PER_ENB]; + module_id_t mac_uid[MAX_MOBILES_PER_ENB]; + module_id_t du_ue_f1ap_id[MAX_MOBILES_PER_ENB]; + module_id_t cu_ue_f1ap_id[MAX_MOBILES_PER_ENB]; + + + uint16_t num_ues; + +} f1ap_cudu_ue_inst_t; + + uint8_t F1AP_get_next_transaction_identifier(module_id_t enb_mod_idP, module_id_t cu_mod_idP); -uint8_t F1AP_get_UE_identifier(module_id_t enb_mod_idP, int CC_idP, int UE_id); +module_id_t F1AP_get_UE_identifier(module_id_t enb_mod_idP, int CC_idP, int UE_id); + + + +int f1ap_add_ue(f1ap_cudu_ue_inst_t *f1_ue_inst, + module_id_t module_idP, + int CC_idP, + int UE_id, + rnti_t rntiP); + +int f1ap_remove_ue(f1ap_cudu_ue_inst_t *f1_ue_inst, + rnti_t rntiP); + +int f1ap_get_du_ue_f1ap_id (f1ap_cudu_ue_inst_t *f1_ue_inst, + rnti_t rntiP); + +int f1ap_get_cu_ue_f1ap_id (f1ap_cudu_ue_inst_t *f1_ue_inst, + rnti_t rntiP); + + + +int f1ap_get_rnti_by_du_id(f1ap_cudu_ue_inst_t *f1_ue_inst, + module_id_t du_ue_f1ap_id ); + + +int f1ap_get_rnti_by_cu_id(f1ap_cudu_ue_inst_t *f1_ue_inst, + module_id_t cu_ue_f1ap_id ); + + +int f1ap_get_du_uid(f1ap_cudu_ue_inst_t *f1_ue_inst, + module_id_t du_ue_f1ap_id ); + +int f1ap_get_cu_uid(f1ap_cudu_ue_inst_t *f1_ue_inst, + module_id_t cu_ue_f1ap_id ); + +int f1ap_get_uid_by_rnti(f1ap_cudu_ue_inst_t *f1_ue_inst, + rnti_t rntiP ); + +int f1ap_du_add_cu_ue_id(f1ap_cudu_ue_inst_t *f1_ue_inst, + module_id_t du_ue_f1ap_id, + module_id_t cu_ue_f1ap_id); + +int f1ap_cu_add_du_ue_id(f1ap_cudu_ue_inst_t *f1_ue_inst, + module_id_t cu_ue_f1ap_id, + module_id_t du_ue_f1ap_id); #endif /* F1AP_COMMON_H_ */ diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index fad0ffc06e..802cd167a2 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -44,10 +44,15 @@ // a compile error #undef C_RNTI + // 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; + + +f1ap_cudu_ue_inst_t f1ap_cu_ue[MAX_eNB]; + /* Initial UL RRC Message Transfer */ @@ -132,6 +137,14 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, } AssertFatal(rrc_inst>=0,"couldn't find an RRC instance for nr_cell %ll\n",nr_cellid); + int f1ap_uid = f1ap_add_ue(&f1ap_cu_ue[rrc_inst], rrc_inst, CC_id, 0, rnti); + if (f1ap_uid < 0 ) { + LOG_E(CU_F1AP, "Failed to add UE \n"); + return -1; + } + f1ap_cu_ue[rrc_inst].du_ue_f1ap_id[f1ap_uid] = du_ue_f1ap_id; + + 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; @@ -141,32 +154,6 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, itti_send_msg_to_task (TASK_RRC_ENB, instance, message_p); - // OR creat the ctxt and srb_info struct required by rrc_eNB_decode_ccch -/* - PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, - instance, // to fix - ENB_FLAG_YES, - rnti, - 0, // frame - 0); // slot - - CC_id = RRC_MAC_CCCH_DATA_IND(msg_p).CC_id; - srb_info_p = &RC.rrc[instance]->carrier[CC_id].Srb0; - - if (ccch_sdu_len >= RRC_BUFFER_SIZE_MAX) { - LOG_E(RRC, "CCCH message has size %d > %d\n",ccch_sdu_len,RRC_BUFFER_SIZE_MAX); - break; - } - memcpy(srb_info_p->Rx_buffer.Payload, - ccch_sdu, - ccch_sdu_len); - srb_info->Rx_buffer.payload_size = ccch_sdu_len; - - rrc_eNB_decode_ccch(&ctxt, srb_info, CC_id); - */ - // if size > 0 - // CU_send_DL_RRC_MESSAGE_TRANSFER(C.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload, RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size) - return 0; } @@ -204,8 +191,11 @@ int CU_send_DL_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_DLRRCMessageTransferIEs__value_PR_GNB_CU_UE_F1AP_ID; - ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_dl_rrc->gNB_CU_ue_id; + ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_get_cu_ue_f1ap_id(&f1ap_cu_ue[instance],f1ap_dl_rrc->rnti); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + LOG_I(CU_F1AP, "Setting GNB_CU_UE_F1AP_ID %d associated with UE RNTI %x (instance %d)\n", + ie->value.choice.GNB_CU_UE_F1AP_ID, f1ap_dl_rrc->rnti, instance); + /* mandatory */ /* c2. GNB_DU_UE_F1AP_ID */ @@ -213,8 +203,9 @@ int CU_send_DL_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_DLRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID; - ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_dl_rrc->gNB_DU_ue_id; // TODO: f1ap_dl_rrc->gNB_DU_ue_id + ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(&f1ap_cu_ue[instance],f1ap_dl_rrc->rnti); //f1ap_dl_rrc->gNB_DU_ue_id; // TODO: f1ap_dl_rrc->gNB_DU_ue_id ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + LOG_I(CU_F1AP, "GNB_DU_UE_F1AP_ID %d associated with UE RNTI %x \n", ie->value.choice.GNB_DU_UE_F1AP_ID, f1ap_dl_rrc->rnti); /* optional */ /* c3. oldgNB_DU_UE_F1AP_ID */ @@ -326,14 +317,14 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, 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(CU_F1AP, "cu_ue_f1ap_id %lu \n", cu_ue_f1ap_id); + LOG_D(CU_F1AP, "cu_ue_f1ap_id %lu associated with RNTI %x \n", cu_ue_f1ap_id, f1ap_get_rnti_by_cu_id(&f1ap_cu_ue[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(CU_F1AP, "du_ue_f1ap_id %lu \n", du_ue_f1ap_id); + LOG_D(CU_F1AP, "du_ue_f1ap_id %lu associated with RNTI %x \n", du_ue_f1ap_id, f1ap_get_rnti_by_cu_id(&f1ap_cu_ue[instance],du_ue_f1ap_id)); /* mandatory */ diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index 4a6f28e3dc..9149607e96 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -35,6 +35,7 @@ #include "f1ap_decoder.h" #include "f1ap_itti_messaging.h" #include "f1ap_du_rrc_message_transfer.h" + // undefine C_RNTI from // openair1/PHY/LTE_TRANSPORT/transport_common.h which // replaces in ie->value.choice.C_RNTI, causing @@ -43,6 +44,11 @@ extern f1ap_setup_req_t *f1ap_du_data; + +f1ap_cudu_ue_inst_t f1ap_du_ue[MAX_eNB]; + + + /* DL RRC Message Transfer */ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, uint32_t assoc_id, @@ -88,9 +94,13 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_DLRRCMessageTransferIEs_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(DU_F1AP, "du_ue_f1ap_id %lu \n", du_ue_f1ap_id); - + LOG_D(DU_F1AP, "du_ue_f1ap_id %lu \n", 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_ue[instance],du_ue_f1ap_id,cu_ue_f1ap_id) < 0 ) { + LOG_E(DU_F1AP, "Failed to find the F1AP UID \n"); + //return -1; + } + /* optional */ /* oldgNB_DU_UE_F1AP_ID */ if (0) { @@ -105,7 +115,6 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, srb_id = ie->value.choice.SRBID; LOG_D(DU_F1AP, "srb_id %lu \n", srb_id); - /* optional */ /* ExecuteDuplication */ if (0) { @@ -122,7 +131,7 @@ 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, RRC_MAC_CCCH_DATA_IND); + message_p = itti_alloc_new_message (TASK_DU_F1, RRC_MAC_CCCH_DATA_IND); memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE); ccch_sdu_len = ie->value.choice.RRCContainer.size; memcpy(RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf, @@ -152,10 +161,10 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, } //void DU_send_UL_RRC_MESSAGE_TRANSFER(F1AP_ULRRCMessageTransfer_t *ULRRCMessageTransfer) { -int DU_send_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, - int CC_idP, - uint8_t *sduP, - sdu_size_t sdu_lenP) { +int DU_send_UL_RRC_MESSAGE_TRANSFER(protocol_ctxt_t* ctxt_pP, + rb_id_t srb_idP, + uint8_t *sduP, + sdu_size_t sdu_lenP) { LOG_D(DU_F1AP, "DU_send_UL_RRC_MESSAGE_TRANSFER \n"); @@ -182,7 +191,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, 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 = 126L; + ie->value.choice.GNB_CU_UE_F1AP_ID = f1ap_du_ue[ctxt_pP->module_id].cu_ue_f1ap_id[f1ap_get_uid_by_rnti(&f1ap_du_ue[ctxt_pP->module_id], ctxt_pP->rnti)]; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ @@ -191,7 +200,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, 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_UE_identifier(module_idP, CC_idP, 0); + ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_du_ue[ctxt_pP->module_id].du_ue_f1ap_id[f1ap_get_uid_by_rnti(&f1ap_du_ue[ctxt_pP->module_id], ctxt_pP->rnti)]; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ @@ -200,7 +209,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, ie->id = F1AP_ProtocolIE_ID_id_SRBID; ie->criticality = F1AP_Criticality_reject; ie->value.present = F1AP_ULRRCMessageTransferIEs__value_PR_SRBID; - ie->value.choice.SRBID = 1; + ie->value.choice.SRBID = srb_idP; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); // issue in here @@ -236,6 +245,12 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, uint8_t *buffer; uint32_t len; + int f1ap_uid = f1ap_add_ue (&f1ap_du_ue[module_idP], module_idP, CC_idP,UE_id, rntiP); + + if (f1ap_uid < 0 ) { + LOG_E(DU_F1AP, "Failed to add UE \n"); + return -1; + } /* Create */ /* 0. Message Type */ @@ -254,7 +269,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, 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_get_UE_identifier(module_idP, CC_idP, UE_id); + ie->value.choice.GNB_DU_UE_F1AP_ID = f1ap_du_ue[module_idP].du_ue_f1ap_id[f1ap_uid]; ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); /* mandatory */ @@ -311,3 +326,11 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, du_f1ap_itti_send_sctp_data_req(0, f1ap_du_data->assoc_id, buffer, len, 0); return 0; } + + +void init_f1ap_du_ue_inst (void) { + + memset(f1ap_du_ue, 0, sizeof(f1ap_du_ue)); +} + + diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.h b/openair2/F1AP/f1ap_du_rrc_message_transfer.h index 87a94f651e..e0f2f8f71f 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.h +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.h @@ -39,9 +39,9 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, uint32_t stream, F1AP_F1AP_PDU_t *pdu); -int DU_send_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, - int CC_idP, - uint8_t *sduP, +int DU_send_UL_RRC_MESSAGE_TRANSFER(protocol_ctxt_t* ctxt_pP, + rb_id_t srb_idP, + uint8_t *sduP, sdu_size_t sdu_lenP); int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP, diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index f07419d3ca..4f1b7f3d00 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -1135,7 +1135,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\n", i, ctxt_pP->rnti); // ret=1; break; } diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c index 10a3e77aa0..d40fc99e13 100644 --- a/openair2/LAYER2/RLC/rlc.c +++ b/openair2/LAYER2/RLC/rlc.c @@ -707,7 +707,7 @@ void rlc_data_ind ( case ngran_eNB_DU : case ngran_gNB_DU : DU_send_UL_RRC_MESSAGE_TRANSFER( - ctxt_pP->module_id, + ctxt_pP, rb_idP, sdu_pP, sdu_sizeP diff --git a/openair2/RRC/LTE/rrc_eNB.c b/openair2/RRC/LTE/rrc_eNB.c index 8056177123..720c23ce9d 100644 --- a/openair2/RRC/LTE/rrc_eNB.c +++ b/openair2/RRC/LTE/rrc_eNB.c @@ -5771,10 +5771,11 @@ rrc_eNB_generate_RRCConnectionSetup( F1AP_DL_RRC_MESSAGE (message_p).gNB_CU_ue_id = 0; F1AP_DL_RRC_MESSAGE (message_p).gNB_DU_ue_id = 0; F1AP_DL_RRC_MESSAGE (message_p).old_gNB_DU_ue_id = 0xFFFFFFFF; // unknown + F1AP_DL_RRC_MESSAGE (message_p).rnti = ue_p->rnti; F1AP_DL_RRC_MESSAGE (message_p).srb_id = CCCH; F1AP_DL_RRC_MESSAGE (message_p).execute_duplication = 1; F1AP_DL_RRC_MESSAGE (message_p).RAT_frequency_priority_information.en_dc = 0; - itti_send_msg_to_task (TASK_CU_F1, UE_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id), message_p); + itti_send_msg_to_task (TASK_CU_F1, ctxt_pP->module_id, message_p); LOG_D(RRC, "Send F1AP_DL_RRC_MESSAGE with ITTI\n"); break; case ngran_eNB_DU :