From a46079479259c8e4c98832c581f46db58ae9c914 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 16 Aug 2023 21:27:01 +0200 Subject: [PATCH 01/63] Delete dead code --- openair2/RRC/NR/MESSAGES/asn1_msg.c | 41 ----------------------------- openair2/RRC/NR/MESSAGES/asn1_msg.h | 21 --------------- 2 files changed, 62 deletions(-) diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 3935c18bfe..33ceceff28 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -242,16 +242,6 @@ uint8_t do_SIB23_NR(rrc_gNB_carrier_data_t *carrier, return((enc_rval.encoded+7)/8); } -void do_SpCellConfig(gNB_RRC_INST *rrc, - struct NR_SpCellConfig *spconfig){ - //gNB_RrcConfigurationReq *common_configuration; - //common_configuration = CALLOC(1,sizeof(gNB_RrcConfigurationReq)); - //Fill servingcellconfigcommon config value - //Fill common config to structure - // rrc->configuration = common_configuration; - spconfig->reconfigurationWithSync = CALLOC(1,sizeof(struct NR_ReconfigurationWithSync)); -} - //------------------------------------------------------------------------------ int do_RRCReject(uint8_t Mod_id, uint8_t *const buffer) @@ -474,37 +464,6 @@ void free_nr_noS1_bearer_config(NR_RadioBearerConfig_t **rbconfig, *rlc_rbconfig = NULL; } -void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, - NR_CellGroupConfig_t *ue_context_mastercellGroup, - int use_rlc_um_for_drb, - uint8_t configure_srb, - NR_DRB_ToAddModList_t *drb_configList, - long *priority) -{ - cellGroupConfig->cellGroupId = 0; - cellGroupConfig->rlc_BearerToReleaseList = NULL; - cellGroupConfig->rlc_BearerToAddModList = calloc(1, sizeof(*cellGroupConfig->rlc_BearerToAddModList)); - - // RLC Bearer Config - // TS38.331 9.2.1 Default SRB configurations - if (configure_srb){ - NR_RLC_BearerConfig_t *rlc_BearerConfig = get_SRB_RLC_BearerConfig(2, 3, NR_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms5); - asn1cSeqAdd(&cellGroupConfig->rlc_BearerToAddModList->list, rlc_BearerConfig); - asn1cSeqAdd(&ue_context_mastercellGroup->rlc_BearerToAddModList->list, rlc_BearerConfig); - } - - // DRB Configuration - if (drb_configList != NULL) { - for (int i = 0; i < drb_configList->list.count; ++i) { - const NR_RLC_Config_PR rlc_conf = use_rlc_um_for_drb ? NR_RLC_Config_PR_um_Bi_Directional : NR_RLC_Config_PR_am; - int rb_id = drb_configList->list.array[i]->drb_Identity; - NR_RLC_BearerConfig_t *rlc_BearerConfig = get_DRB_RLC_BearerConfig(3 + rb_id, rb_id, rlc_conf, priority[rb_id - 1]); - asn1cSeqAdd(&cellGroupConfig->rlc_BearerToAddModList->list, rlc_BearerConfig); - asn1cSeqAdd(&ue_context_mastercellGroup->rlc_BearerToAddModList->list, rlc_BearerConfig); - } - } -} - //------------------------------------------------------------------------------ int do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP, uint8_t *const buffer, diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.h b/openair2/RRC/NR/MESSAGES/asn1_msg.h index 5e9a9fa756..d2f61acd10 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.h +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.h @@ -58,8 +58,6 @@ int xer_sprint_NR(char *string, size_t string_size, struct asn_TYPE_descriptor_s uint8_t do_SIB23_NR(rrc_gNB_carrier_data_t *carrier, gNB_RrcConfigurationReq *configuration); -void do_SpCellConfig(gNB_RRC_INST *rrc, - struct NR_SpCellConfig *spconfig); int do_RRCReject(uint8_t Mod_id, uint8_t *const buffer); @@ -79,25 +77,6 @@ void fill_nr_noS1_bearer_config(NR_RadioBearerConfig_t **rbconfig, NR_RLC_BearerConfig_t **rlc_rbconfig); void free_nr_noS1_bearer_config(NR_RadioBearerConfig_t **rbconfig, NR_RLC_BearerConfig_t **rlc_rbconfig); -/** - * @brief Function to fill out the master cell group config to be used in RRCReconfiguration. - * If it is misused the ue_context_mastercellGroup, might lead to ASN1 encoding failure, - * because in ue_context_mastercellGroup the rlc_BearerConfigs are added but never removed, - * so the maximum number of rlc_BearerConfigs is exceeded. - * - * @param cellGroupConfig The MCG that will be used in do_RRCReconfiguration. - * @param ue_context_mastercellGroup The MCG that is stored in the ue context. - * @param[in] use_rlc_um_for_drb Set to 1, if RLC uses 'Unacknowledged Mode' for the DRB. - * @param[in] configure_srb Set to 1, if SRB2 needs be added to MCG. - * @param[in] drb_configList The Data Radio Bearer list, to be added. - * @param[in] priority The priorities set for the Data Radio Bearers. - */ -void fill_mastercellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, - NR_CellGroupConfig_t *ue_context_mastercellGroup, - int use_rlc_um_for_drb, - uint8_t configure_srb, - NR_DRB_ToAddModList_t *drb_configList, - long *priority); int do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP, uint8_t *const buffer, From 15c2af23846218177efc0df442ad3136f0f2ffb6 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 21 Aug 2023 11:20:31 +0200 Subject: [PATCH 02/63] get_initial_SpCellConfig(): don't reuse memory In the case of MIMO, we reused memory to point to the same PUCCH resource. This is problematic, since ASN_STRUCT_FREE() would try to free this resource twice. This commit changes to create distinct memory for the PUCCH resources, while putting the same configuration to still use the same PUCCH resource from a radio configuration point of view. --- openair2/RRC/NR/nr_rrc_config.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/openair2/RRC/NR/nr_rrc_config.c b/openair2/RRC/NR/nr_rrc_config.c index 266d842276..d146498e2c 100644 --- a/openair2/RRC/NR/nr_rrc_config.c +++ b/openair2/RRC/NR/nr_rrc_config.c @@ -2260,9 +2260,7 @@ static NR_SpCellConfig_t *get_initial_SpCellConfig(int uid, csires1->resourceType = NR_CSI_ResourceConfig__resourceType_periodic; asn1cSeqAdd(&csi_MeasConfig->csi_ResourceConfigToAddModList->list, csires1); - NR_PUCCH_CSI_Resource_t *pucchcsires1 = calloc(1, sizeof(*pucchcsires1)); - pucchcsires1->uplinkBandwidthPartId = bwp_id; - pucchcsires1->pucch_Resource = 2; + int pucch_Resource = 2; if (configuration->do_CSIRS) { NR_CSI_ResourceConfig_t *csires0 = calloc(1, sizeof(*csires0)); @@ -2293,16 +2291,22 @@ static NR_SpCellConfig_t *get_initial_SpCellConfig(int uid, csires2->resourceType = NR_CSI_ResourceConfig__resourceType_periodic; asn1cSeqAdd(&csi_MeasConfig->csi_ResourceConfigToAddModList->list, csires2); + NR_PUCCH_CSI_Resource_t *pucchcsi = calloc(1, sizeof(*pucchcsi)); + pucchcsi->uplinkBandwidthPartId = bwp_id; + pucchcsi->pucch_Resource = pucch_Resource; config_csi_meas_report(csi_MeasConfig, scc, - pucchcsires1, + pucchcsi, pdsch_Config, &configuration->pdsch_AntennaPorts, NR_MAX_SUPPORTED_DL_LAYERS, bwp_id, uid); } - config_rsrp_meas_report(csi_MeasConfig, scc, pucchcsires1, configuration->do_CSIRS, bwp_id + 10, uid); + NR_PUCCH_CSI_Resource_t *pucchrsrp = calloc(1, sizeof(*pucchrsrp)); + pucchrsrp->uplinkBandwidthPartId = bwp_id; + pucchrsrp->pucch_Resource = pucch_Resource; + config_rsrp_meas_report(csi_MeasConfig, scc, pucchrsrp, configuration->do_CSIRS, bwp_id + 10, uid); } pdsch_servingcellconfig->codeBlockGroupTransmission = NULL; pdsch_servingcellconfig->xOverhead = NULL; From 3b8c1cd59e3b53512898bed04836ed70c2b3f11f Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 21 Aug 2023 11:52:48 +0200 Subject: [PATCH 03/63] Fix memory leak in config_srs() --- openair2/RRC/NR/nr_rrc_config.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/openair2/RRC/NR/nr_rrc_config.c b/openair2/RRC/NR/nr_rrc_config.c index d146498e2c..5418f5dc9f 100644 --- a/openair2/RRC/NR/nr_rrc_config.c +++ b/openair2/RRC/NR/nr_rrc_config.c @@ -495,19 +495,7 @@ static void config_srs(const NR_ServingCellConfigCommon_t *scc, NR_SRS_Config_t *srs_Config; if (setup_release_srs_Config->choice.setup) { srs_Config = setup_release_srs_Config->choice.setup; - if (srs_Config->srs_ResourceSetToReleaseList) { - free(srs_Config->srs_ResourceSetToReleaseList); - } - if (srs_Config->srs_ResourceSetToAddModList) { - free(srs_Config->srs_ResourceSetToAddModList); - } - if (srs_Config->srs_ResourceToReleaseList) { - free(srs_Config->srs_ResourceToReleaseList); - } - if (srs_Config->srs_ResourceToAddModList) { - free(srs_Config->srs_ResourceToAddModList); - } - free(srs_Config); + ASN_STRUCT_FREE(asn_DEF_NR_SRS_Config, srs_Config); } setup_release_srs_Config->choice.setup = calloc(1,sizeof(*setup_release_srs_Config->choice.setup)); From e7b971a4af61da9e9853e40fac684aaa80fc97fe Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 21 Jul 2023 15:07:57 +0200 Subject: [PATCH 04/63] RRC: remove useless/unused variable --- openair2/RRC/NR/nr_rrc_defs.h | 1 - 1 file changed, 1 deletion(-) diff --git a/openair2/RRC/NR/nr_rrc_defs.h b/openair2/RRC/NR/nr_rrc_defs.h index 35ff709378..a7c1d0fdfc 100644 --- a/openair2/RRC/NR/nr_rrc_defs.h +++ b/openair2/RRC/NR/nr_rrc_defs.h @@ -342,7 +342,6 @@ typedef struct { NR_BCCH_DL_SCH_Message_t *siblock1; NR_ServingCellConfigCommon_t *servingcellconfigcommon; NR_CellGroupConfig_t *secondaryCellGroup[MAX_NR_RRC_UE_CONTEXTS]; - int p_gNB; } rrc_gNB_carrier_data_t; //--------------------------------------------------- From 4be567bb77bea4e5b75ae0f09593788c7a96027e Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 12 Jul 2023 09:30:22 +0200 Subject: [PATCH 05/63] Remove unneeded eth_params_n from eNB/UE MAC --- openair2/LAYER2/MAC/mac.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/openair2/LAYER2/MAC/mac.h b/openair2/LAYER2/MAC/mac.h index c1f9a51335..702d0d6f56 100644 --- a/openair2/LAYER2/MAC/mac.h +++ b/openair2/LAYER2/MAC/mac.h @@ -1298,8 +1298,6 @@ typedef struct { /*! \brief top level eNB MAC structure */ typedef struct eNB_MAC_INST_s { - /// Ethernet parameters for northbound midhaul interface - eth_params_t eth_params_n; /// Ethernet parameters for fronthaul interface eth_params_t eth_params_s; /// @@ -1662,8 +1660,6 @@ typedef struct { int ra_frame; // This variable keeps the frame in which the RA started for the specific UE. It is used in order // to make sure that different UEs RA starts within a number of frames difference. - eth_params_t eth_params_n; - } UE_MAC_INST; typedef struct { From 515b71f9957b5624c1a6be2ba6cb717d1fffbf14 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 17 Jul 2023 12:15:48 +0200 Subject: [PATCH 06/63] Remove useless type f1ap_cu_setup_req_t --- openair2/COMMON/f1ap_messages_def.h | 3 --- openair2/COMMON/f1ap_messages_types.h | 9 --------- openair2/F1AP/f1ap_cu_interface_management.c | 4 ---- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 1 - openair2/GNB_APP/gnb_config.c | 1 - 5 files changed, 18 deletions(-) diff --git a/openair2/COMMON/f1ap_messages_def.h b/openair2/COMMON/f1ap_messages_def.h index 08f552d9d3..125d6a0d6a 100644 --- a/openair2/COMMON/f1ap_messages_def.h +++ b/openair2/COMMON/f1ap_messages_def.h @@ -19,9 +19,6 @@ * contact@openairinterface.org */ -/* F1AP -> SCTP */ -MESSAGE_DEF(F1AP_CU_SCTP_REQ , MESSAGE_PRIORITY_MED, f1ap_cu_setup_req_t , f1ap_cu_setup_req) - /* eNB_DU application layer -> F1AP messages or CU F1AP -> RRC*/ MESSAGE_DEF(F1AP_SETUP_REQ , MESSAGE_PRIORITY_MED, f1ap_setup_req_t , f1ap_setup_req) MESSAGE_DEF(F1AP_GNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE , MESSAGE_PRIORITY_MED, f1ap_gnb_cu_configuration_update_acknowledge_t , f1ap_gnb_cu_configuration_update_acknowledge) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index 2f95ee8cdc..75f286b19e 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -75,12 +75,6 @@ typedef struct f1ap_net_ip_address_s { char ipv6_address[46]; } f1ap_net_ip_address_t; -typedef struct f1ap_cu_setup_req_s { - // This dummy element is to avoid CLANG warning: empty struct has size 0 in C, size 1 in C++ - // To be removed if the structure is filled - uint32_t dummy; -} f1ap_cu_setup_req_t; - typedef struct cellIDs_s { // Served Cell Information @@ -129,9 +123,6 @@ typedef struct f1ap_setup_req_s { // F1_Setup_Req payload uint64_t gNB_DU_id; char *gNB_DU_name; - - /* The type of the cell */ - enum cell_type_e cell_type; /// number of DU cells available uint16_t num_cells_available; //0< num_cells_available <= 512; diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index 6b2384b7c8..35eed597fe 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -141,9 +141,6 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, /* - nRPCI */ req->cell[i].nr_pci = servedCellInformation->nRPCI; LOG_D(F1AP, "req->nr_pci[%d] %d \n", i, req->cell[i].nr_pci); - - // LTS: FIXME cell_type is not a attribute of a cell in the data structure !!!!!!!!!! - f1ap_req(true, instance)->cell_type = CELL_MACRO_GNB; // FDD Cells if (servedCellInformation->nR_Mode_Info.present==F1AP_NR_Mode_Info_PR_fDD) { @@ -197,7 +194,6 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, } struct F1AP_GNB_DU_System_Information * DUsi=served_cells_item->gNB_DU_System_Information; - 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(DUsi->mIB_message.size + 1, sizeof(char)); diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index 13bc9954a3..840ab7354d 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -89,7 +89,6 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, F1AP_ProtocolIE_ID_id_DUtoCURRCContainer, false); // create an ITTI message and copy SDU - AssertFatal(f1ap_req(true, instance)->cell_type == CELL_MACRO_GNB, "illegal cell type %d\n", f1ap_req(true, instance)->cell_type); message_p = itti_alloc_new_message(TASK_CU_F1, 0, F1AP_INITIAL_UL_RRC_MESSAGE); f1ap_initial_ul_rrc_message_t *ul_rrc = &F1AP_INITIAL_UL_RRC_MESSAGE(message_p); ul_rrc->gNB_DU_ue_id = du_ue_id; diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index d724785399..bc73db3b54 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -1898,7 +1898,6 @@ int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) { "gNB id %u is not defined in configuration file\n",i); 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 Date: Tue, 18 Jul 2023 17:33:59 +0200 Subject: [PATCH 07/63] Remove unused function nr_read_config_and_init() --- openair2/GNB_APP/gnb_config.c | 35 ----------------------------------- openair2/GNB_APP/gnb_config.h | 1 - 2 files changed, 36 deletions(-) diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index bc73db3b54..1e924ed725 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -2329,41 +2329,6 @@ ngran_node_t get_node_type(void) return ngran_gNB_DU; } -void nr_read_config_and_init(void) { - MessageDef *msg_p = NULL; - uint32_t gnb_id; - uint32_t gnb_nb = RC.nb_nr_inst; - - RCconfig_NR_L1(); - RCconfig_nr_prs(); - RCconfig_nr_macrlc(); - - LOG_I(PHY, "%s() RC.nb_nr_L1_inst:%d\n", __FUNCTION__, RC.nb_nr_L1_inst); - - if (RC.nb_nr_L1_inst>0) AssertFatal(l1_north_init_gNB()==0,"could not initialize L1 north interface\n"); - - AssertFatal (gnb_nb <= RC.nb_nr_inst, - "Number of gNB is greater than gNB defined in configuration file (%u/%u)!", - gnb_nb, RC.nb_nr_inst); - - LOG_I(GNB_APP,"Allocating gNB_RRC_INST for %d instances\n",RC.nb_nr_inst); - - RC.nrrrc = (gNB_RRC_INST **)malloc(RC.nb_nr_inst*sizeof(gNB_RRC_INST *)); - LOG_I(PHY, "%s() RC.nb_nr_inst:%d RC.nrrrc:%p\n", __FUNCTION__, RC.nb_nr_inst, RC.nrrrc); - - for (gnb_id = 0; gnb_id < RC.nb_nr_inst ; gnb_id++) { - RC.nrrrc[gnb_id] = (gNB_RRC_INST*)malloc(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, RC.nb_nr_inst); - memset((void *)RC.nrrrc[gnb_id],0,sizeof(gNB_RRC_INST)); - msg_p = itti_alloc_new_message (TASK_GNB_APP, 0, NRRRC_CONFIGURATION_REQ); - RCconfig_NRRRC(msg_p,gnb_id, RC.nrrrc[gnb_id]); - } - - if (NODE_IS_CU(RC.nrrrc[0]->node_type) && RC.nrrrc[0]->node_type != ngran_gNB_CUCP) { - nr_pdcp_layer_init(); - } -} - #ifdef E2_AGENT e2_agent_args_t RCconfig_NR_E2agent(void) diff --git a/openair2/GNB_APP/gnb_config.h b/openair2/GNB_APP/gnb_config.h index 0a23ebea74..3e5b43b0f0 100644 --- a/openair2/GNB_APP/gnb_config.h +++ b/openair2/GNB_APP/gnb_config.h @@ -106,7 +106,6 @@ int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i); int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i); int gNB_app_handle_f1ap_setup_resp(f1ap_setup_resp_t *resp); int gNB_app_handle_f1ap_gnb_cu_configuration_update(f1ap_gnb_cu_configuration_update_t *gnb_cu_cfg_update); -void nr_read_config_and_init(void); MessageDef *RCconfig_NR_CU_E1(bool separate_CUUP_process); ngran_node_t get_node_type(void); From 96e300dabddb939ca530114dba70569433de38ad Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 30 Jun 2023 08:07:22 +0200 Subject: [PATCH 08/63] F1AP: remove default stream ID, we never use anything else but 0 --- openair2/COMMON/f1ap_messages_types.h | 2 -- openair2/F1AP/f1ap_common.h | 1 - openair2/F1AP/f1ap_cu_interface_management.c | 6 +++--- openair2/F1AP/f1ap_cu_paging.c | 2 +- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 2 +- openair2/F1AP/f1ap_cu_task.c | 1 - openair2/F1AP/f1ap_cu_ue_context_management.c | 10 +++++----- openair2/F1AP/f1ap_du_interface_management.c | 4 ++-- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 4 ++-- openair2/F1AP/f1ap_du_task.c | 1 - openair2/F1AP/f1ap_du_ue_context_management.c | 19 +++++-------------- openair2/F1AP/f1ap_itti_messaging.c | 6 +++--- openair2/F1AP/f1ap_itti_messaging.h | 3 +-- 13 files changed, 23 insertions(+), 38 deletions(-) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index 75f286b19e..cb51f9f374 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -118,8 +118,6 @@ typedef struct f1ap_setup_req_s { uint16_t sctp_in_streams; uint16_t sctp_out_streams; - uint16_t default_sctp_stream_id; - // F1_Setup_Req payload uint64_t gNB_DU_id; char *gNB_DU_name; diff --git a/openair2/F1AP/f1ap_common.h b/openair2/F1AP/f1ap_common.h index a346d9682a..0be765e441 100644 --- a/openair2/F1AP/f1ap_common.h +++ b/openair2/F1AP/f1ap_common.h @@ -408,7 +408,6 @@ typedef struct f1ap_cudu_inst_s { f1ap_setup_req_t setupReq; 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; diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index 35eed597fe..23614ccb82 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -366,7 +366,7 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance, } ASN_STRUCT_RESET(asn_DEF_F1AP_F1AP_PDU, &pdu); - f1ap_itti_send_sctp_data_req(true, instance, buffer, len, 0); + f1ap_itti_send_sctp_data_req(true, instance, buffer, len); return 0; } @@ -436,7 +436,7 @@ int CU_send_F1_SETUP_FAILURE(instance_t instance) { } ASN_STRUCT_RESET(asn_DEF_F1AP_F1AP_PDU, &pdu); - f1ap_itti_send_sctp_data_req(true,instance, buffer, len, 0); + f1ap_itti_send_sctp_data_req(true,instance, buffer, len); return 0; } @@ -552,7 +552,7 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu LOG_DUMPMSG(F1AP, LOG_DUMP_CHAR, buffer, len, "F1AP gNB-CU CONFIGURATION UPDATE : "); ASN_STRUCT_RESET(asn_DEF_F1AP_F1AP_PDU, &pdu); - f1ap_itti_send_sctp_data_req(true,instance, buffer, len, 0); + f1ap_itti_send_sctp_data_req(true,instance, buffer, len); return 0; } diff --git a/openair2/F1AP/f1ap_cu_paging.c b/openair2/F1AP/f1ap_cu_paging.c index f0e68bf1fc..5f35331e65 100644 --- a/openair2/F1AP/f1ap_cu_paging.c +++ b/openair2/F1AP/f1ap_cu_paging.c @@ -115,6 +115,6 @@ int CU_send_Paging(instance_t instance, f1ap_paging_ind_t *paging) { return -1; } ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, &pdu); - f1ap_itti_send_sctp_data_req(true, instance, buffer, len, 0); + f1ap_itti_send_sctp_data_req(true, instance, buffer, len); return 0; } diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index 840ab7354d..9f25236720 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -209,7 +209,7 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance, return -1; } - f1ap_itti_send_sctp_data_req(true, instance, buffer, len, 0 /* BK: fix me*/); + f1ap_itti_send_sctp_data_req(true, instance, buffer, len); return 0; } diff --git a/openair2/F1AP/f1ap_cu_task.c b/openair2/F1AP/f1ap_cu_task.c index 617366563c..8284d8581e 100644 --- a/openair2/F1AP/f1ap_cu_task.c +++ b/openair2/F1AP/f1ap_cu_task.c @@ -56,7 +56,6 @@ static void cu_task_handle_sctp_association_ind(instance_t instance, sctp_new_as 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; if (RC.nrrrc[instance]->node_type != ngran_gNB_CUCP) { getCxt(CUtype, instance)->gtpInst = cu_task_create_gtpu_instance(IPaddrs); AssertFatal(getCxt(CUtype, instance)->gtpInst > 0, "Failed to create CU F1-U UDP listener"); diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 4b91903d5f..e80eaec30a 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -628,7 +628,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, // return -1; // } LOG_D(F1AP,"F1AP UEContextSetupRequest Encoded %u bits\n", len); - f1ap_itti_send_sctp_data_req(true, instance, buffer, len, 0 /* BK: fix me*/); + f1ap_itti_send_sctp_data_req(true, instance, buffer, len); return 0; } @@ -916,7 +916,7 @@ int CU_send_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, return -1; } - f1ap_itti_send_sctp_data_req(true, instance, buffer, len, 0); + f1ap_itti_send_sctp_data_req(true, instance, buffer, len); return 0; } int CU_handle_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, @@ -1562,7 +1562,7 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, f1ap_ue_context LOG_E(F1AP, "Failed to encode F1 UE CONTEXT_MODIFICATION REQUEST\n"); return -1; } - f1ap_itti_send_sctp_data_req(true, instance, buffer, len, 0 /* BK: fix me*/); + f1ap_itti_send_sctp_data_req(true, instance, buffer, len); return 0; } @@ -1892,7 +1892,7 @@ int CU_send_UE_CONTEXT_MODIFICATION_CONFIRM(instance_t instance, f1ap_ue_context LOG_E(F1AP, "Failed to encode F1 UE Context Modification Confirm\n"); return -1; } - f1ap_itti_send_sctp_data_req(true, instance, buffer, len, 0); + f1ap_itti_send_sctp_data_req(true, instance, buffer, len); return 0; } @@ -1959,6 +1959,6 @@ int CU_send_UE_CONTEXT_MODIFICATION_REFUSE(instance_t instance, f1ap_ue_context_ LOG_E(F1AP, "Failed to encode F1 UE Context Modification Refuse\n"); return -1; } - f1ap_itti_send_sctp_data_req(true, instance, buffer, len, 0); + f1ap_itti_send_sctp_data_req(true, instance, buffer, len); return 0; } diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index 053e302f13..ccac43013d 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -348,7 +348,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { } ASN_STRUCT_RESET(asn_DEF_F1AP_F1AP_PDU, &pdu); - f1ap_itti_send_sctp_data_req(false, instance, buffer, len, 0); + f1ap_itti_send_sctp_data_req(false, instance, buffer, len); return 0; } @@ -985,7 +985,7 @@ int DU_send_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, } ASN_STRUCT_RESET(asn_DEF_F1AP_F1AP_PDU, &pdu); - f1ap_itti_send_sctp_data_req(false, instance, buffer, len, 0); + f1ap_itti_send_sctp_data_req(false, instance, buffer, len); return 0; } diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index bcb38029cd..85a8738c1b 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -213,7 +213,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instanceP, const f1ap_ini return -1; } - f1ap_itti_send_sctp_data_req(false, instanceP, buffer, len, getCxt(DUtype, instanceP)->default_sctp_stream_id); + f1ap_itti_send_sctp_data_req(false, instanceP, buffer, len); return 0; } @@ -279,6 +279,6 @@ int DU_send_UL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, const f1ap_ul_rrc_me return -1; } - f1ap_itti_send_sctp_data_req(false, instance, buffer, len, getCxt(DUtype, instance)->default_sctp_stream_id); + f1ap_itti_send_sctp_data_req(false, instance, buffer, len); return 0; } diff --git a/openair2/F1AP/f1ap_du_task.c b/openair2/F1AP/f1ap_du_task.c index 8f8258a1f8..4a8be033dc 100644 --- a/openair2/F1AP/f1ap_du_task.c +++ b/openair2/F1AP/f1ap_du_task.c @@ -82,7 +82,6 @@ void du_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat 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 */ DU_send_F1_SETUP_REQUEST(instance); } diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 352a29bd06..e59dd31426 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -544,10 +544,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup return -1; } - f1ap_itti_send_sctp_data_req(false, instance, - buffer, - len, - getCxt(false, instance)->default_sctp_stream_id); + f1ap_itti_send_sctp_data_req(false, instance, buffer, len); return 0; } @@ -622,10 +619,7 @@ int DU_send_UE_CONTEXT_RELEASE_REQUEST(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); return 0; } @@ -772,10 +766,7 @@ int DU_send_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, f1ap_ue_context_rel return -1; } - f1ap_itti_send_sctp_data_req(false, instance, - buffer, - len, - getCxt(false, instance)->default_sctp_stream_id); + f1ap_itti_send_sctp_data_req(false, instance, buffer, len); return 0; } @@ -1278,7 +1269,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance, f1ap_ue_contex return -1; } - f1ap_itti_send_sctp_data_req(false, instance, buffer, len, getCxt(false, instance)->default_sctp_stream_id); + f1ap_itti_send_sctp_data_req(false, instance, buffer, len); return 0; } @@ -1402,7 +1393,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_REQUIRED(instance_t instance, f1ap_ue_contex return -1; } - f1ap_itti_send_sctp_data_req(false, instance, buffer, len, getCxt(false, instance)->default_sctp_stream_id); + f1ap_itti_send_sctp_data_req(false, instance, buffer, len); return 0; } diff --git a/openair2/F1AP/f1ap_itti_messaging.c b/openair2/F1AP/f1ap_itti_messaging.c index 12386b69d6..befaf7707b 100644 --- a/openair2/F1AP/f1ap_itti_messaging.c +++ b/openair2/F1AP/f1ap_itti_messaging.c @@ -22,8 +22,8 @@ #include "f1ap_common.h" #include "f1ap_itti_messaging.h" -void f1ap_itti_send_sctp_data_req(bool isCu, instance_t instance, uint8_t *buffer, - uint32_t buffer_length, uint16_t stream) { +void f1ap_itti_send_sctp_data_req(bool isCu, instance_t instance, uint8_t *buffer, uint32_t buffer_length) +{ MessageDef *message_p; sctp_data_req_t *sctp_data_req; message_p = itti_alloc_new_message(isCu?TASK_CU_F1:TASK_DU_F1, 0, SCTP_DATA_REQ); @@ -31,7 +31,7 @@ void f1ap_itti_send_sctp_data_req(bool isCu, instance_t instance, uint8_t *buffe 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; + sctp_data_req->stream = 0; LOG_D(F1AP, "Sending ITTI message to SCTP Task\n"); 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 a6499849a9..a1b3762757 100644 --- a/openair2/F1AP/f1ap_itti_messaging.h +++ b/openair2/F1AP/f1ap_itti_messaging.h @@ -22,7 +22,6 @@ #ifndef F1AP_ITTI_MESSAGING_H_ #define F1AP_ITTI_MESSAGING_H_ -void f1ap_itti_send_sctp_data_req(bool isCu,instance_t instance, uint8_t *buffer, - uint32_t buffer_length, uint16_t stream); +void f1ap_itti_send_sctp_data_req(bool isCu,instance_t instance, uint8_t *buffer, uint32_t buffer_length); #endif /* F1AP_ITTI_MESSAGING_H_ */ From 45a678cb603716d259d61e17fe934cc2189170d0 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 30 Jun 2023 08:33:27 +0200 Subject: [PATCH 09/63] Harmonize call to F1AP_get_next_transaction_identifier() We ever only have one instance, so hard code that. --- openair2/F1AP/f1ap_common.c | 4 +++- openair2/F1AP/f1ap_cu_interface_management.c | 18 +++++------------- openair2/F1AP/f1ap_du_interface_management.c | 9 ++++----- 3 files changed, 12 insertions(+), 19 deletions(-) diff --git a/openair2/F1AP/f1ap_common.c b/openair2/F1AP/f1ap_common.c index f396d570df..1dd62df0f0 100644 --- a/openair2/F1AP/f1ap_common.c +++ b/openair2/F1AP/f1ap_common.c @@ -35,7 +35,9 @@ static f1ap_cudu_inst_t *f1_du_inst[NUMBER_OF_gNB_MAX]= {0}; static f1ap_cudu_inst_t *f1_cu_inst[NUMBER_OF_gNB_MAX]= {0}; -uint8_t F1AP_get_next_transaction_identifier(instance_t mod_idP, instance_t cu_mod_idP) { +uint8_t F1AP_get_next_transaction_identifier(instance_t mod_idP, instance_t cu_mod_idP) +{ + DevAssert(mod_idP == 0 && cu_mod_idP == 0); static uint8_t transaction_identifier[NUMBER_OF_gNB_MAX] = {0}; transaction_identifier[mod_idP+cu_mod_idP] = (transaction_identifier[mod_idP+cu_mod_idP] + 1) % F1AP_TRANSACTION_IDENTIFIER_NUMBER; diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index 23614ccb82..0e741b663f 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -263,13 +263,8 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, return 0; } -int CU_send_F1_SETUP_RESPONSE(instance_t instance, - f1ap_setup_resp_t *f1ap_setup_resp) { - instance_t enb_mod_idP; - instance_t cu_mod_idP; - // This should be fixed - enb_mod_idP = (instance_t)0; - cu_mod_idP = (instance_t)0; +int CU_send_F1_SETUP_RESPONSE(instance_t instance, f1ap_setup_resp_t *f1ap_setup_resp) +{ F1AP_F1AP_PDU_t pdu= {0}; uint8_t *buffer=NULL; uint32_t len=0; @@ -287,7 +282,7 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance, 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); + ie1->value.choice.TransactionID = F1AP_get_next_transaction_identifier(0, 0); /* optional */ /* c2. GNB_CU_Name */ @@ -372,9 +367,6 @@ 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"); - 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; uint32_t len=0; @@ -392,7 +384,7 @@ int CU_send_F1_SETUP_FAILURE(instance_t instance) { 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); + ie1->value.choice.TransactionID = F1AP_get_next_transaction_identifier(0, 0); /* mandatory */ /* c2. Cause */ asn1cSequenceAdd(out->protocolIEs.list, F1AP_F1SetupFailureIEs_t, ie2); @@ -484,7 +476,7 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu 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); + ieC1->value.choice.TransactionID = F1AP_get_next_transaction_identifier(0, 0); // mandatory // c2. Cells_to_be_Activated_List diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index ccac43013d..2612698e77 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -93,9 +93,8 @@ int DU_handle_ERROR_INDICATION(instance_t instance, */ // SETUP REQUEST -int DU_send_F1_SETUP_REQUEST(instance_t instance) { - instance_t nb_mod_idP=0; - instance_t du_mod_idP=0; +int DU_send_F1_SETUP_REQUEST(instance_t instance) +{ F1AP_F1AP_PDU_t pdu= {0}; uint8_t *buffer; uint32_t len; @@ -113,7 +112,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) { 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(nb_mod_idP, du_mod_idP); + ieC1->value.choice.TransactionID = F1AP_get_next_transaction_identifier(0, 0); /* mandatory */ /* c2. GNB_DU_ID (integer value) */ asn1cSequenceAdd(f1Setup->protocolIEs.list, F1AP_F1SetupRequestIEs_t, ieC2); @@ -569,7 +568,7 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, 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); + ie1->value.choice.TransactionID = F1AP_get_next_transaction_identifier(0, 0); /* mandatory */ /* c2. Served_Cells_To_Add */ asn1cSequenceAdd(out, F1AP_GNBDUConfigurationUpdateIEs_t, ie2); From 57876fc13f6ad063938180cb83811a8f29279e9a Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 30 Jun 2023 07:52:19 +0200 Subject: [PATCH 10/63] F1 setup request: message encoder takes struct Instead of storing the F1 Setup Request implicitly in F1 context, we provide the F1 Setup Request message to be encoded explicitly to the encoding function. --- openair2/F1AP/f1ap_cu_interface_management.c | 12 +--- openair2/F1AP/f1ap_du_interface_management.c | 70 ++++++++++---------- openair2/F1AP/f1ap_du_interface_management.h | 2 +- openair2/F1AP/f1ap_du_task.c | 2 +- 4 files changed, 39 insertions(+), 47 deletions(-) diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index 0e741b663f..2f8f18ab40 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -81,7 +81,6 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, uint32_t stream, 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; @@ -94,9 +93,8 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, assoc_id, stream); } - /* assoc_id */ - f1ap_setup_req_t *req=&getCxt(true, instance)->setupReq; - req->assoc_id = assoc_id; + MessageDef *message_p = itti_alloc_new_message(TASK_CU_F1, 0, F1AP_SETUP_REQ); + f1ap_setup_req_t *req = &F1AP_SETUP_REQ(message_p); /* gNB_DU_id */ // this function exits if the ie is mandatory F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupRequestIEs_t, ie, container, @@ -245,12 +243,6 @@ 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 (req->num_cells_available > 0) { itti_send_msg_to_task(TASK_RRC_GNB, GNB_MODULE_ID_TO_INSTANCE(instance), message_p); diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index 2612698e77..d7586536c4 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -93,7 +93,7 @@ int DU_handle_ERROR_INDICATION(instance_t instance, */ // SETUP REQUEST -int DU_send_F1_SETUP_REQUEST(instance_t instance) +int DU_send_F1_SETUP_REQUEST(instance_t instance, f1ap_setup_req_t *setup_req) { F1AP_F1AP_PDU_t pdu= {0}; uint8_t *buffer; @@ -119,16 +119,16 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) 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_req(false, instance)->gNB_DU_id); + asn_int642INTEGER(&ieC2->value.choice.GNB_DU_ID, setup_req->gNB_DU_id); /* optional */ /* c3. GNB_DU_Name */ - if (f1ap_req(false,instance)->gNB_DU_name != NULL) { + if (setup_req->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; - char *gNB_DU_name=f1ap_req(false, instance)->gNB_DU_name; + char *gNB_DU_name=setup_req->gNB_DU_name; OCTET_STRING_fromBuf(&ieC3->value.choice.GNB_DU_Name, gNB_DU_name, strlen(gNB_DU_name)); } @@ -138,13 +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_req(false, instance)->num_cells_available; + int num_cells_available = setup_req->num_cells_available; LOG_D(F1AP, "num_cells_available = %d \n", num_cells_available); for (int i=0; icell[i]; + cellIDs_t *cell=&setup_req->cell[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; @@ -204,12 +204,12 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) } } - if (f1ap_req(false, instance)->fdd_flag) { // FDD + if (setup_req->fdd_flag) { // FDD nR_Mode_Info->present = F1AP_NR_Mode_Info_PR_fDD; 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_Info->uL_NRFreqInfo.nRARFCN = setup_req->nr_mode_info[i].fdd.ul_nr_arfcn; // Integer /* FDD.1.2 F1AP_SUL_Information */ if(0) { // Optional @@ -220,27 +220,27 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) } /* FDD.1.3 freqBandListNr */ - int fdd_ul_num_available_freq_Bands = f1ap_req(false,instance)->nr_mode_info[i].fdd.ul_num_frequency_bands; + int fdd_ul_num_available_freq_Bands = setup_req->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_req(false,instance)->nr_mode_info[i].fdd.ul_nr_band[fdd_ul_j]; // + nr_freqBandNrItem->freqBandIndicatorNr = setup_req->nr_mode_info[i].fdd.ul_nr_band[fdd_ul_j]; // /* FDD.1.3.2 supportedSULBandList*/ - int num_available_supported_SULBands = f1ap_req(false,instance)->nr_mode_info[i].fdd.ul_num_sul_frequency_bands; + int num_available_supported_SULBands = setup_req->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_req(false,instance)->nr_mode_info[i].fdd.ul_nr_sul_band[fdd_ul_k]; // + nr_supportedSULFreqBandItem->freqBandIndicatorNr = setup_req->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_req(false,instance)->nr_mode_info[i].fdd.dl_nr_arfcn; // Integer + fDD_Info->dL_NRFreqInfo.nRARFCN = setup_req->nr_mode_info[i].fdd.dl_nr_arfcn; // Integer /* FDD.2.2 F1AP_SUL_Information */ if(0) { // Optional @@ -251,36 +251,36 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) } /* FDD.2.3 freqBandListNr */ - int fdd_dl_num_available_freq_Bands = f1ap_req(false,instance)->nr_mode_info[i].fdd.dl_num_frequency_bands; + int fdd_dl_num_available_freq_Bands = setup_req->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_req(false,instance)->nr_mode_info[i].fdd.dl_nr_band[fdd_dl_j]; // + nr_freqBandNrItem->freqBandIndicatorNr = setup_req->nr_mode_info[i].fdd.dl_nr_band[fdd_dl_j]; // /* FDD.2.3.2 supportedSULBandList*/ - int num_available_supported_SULBands = f1ap_req(false,instance)->nr_mode_info[i].fdd.dl_num_sul_frequency_bands; + int num_available_supported_SULBands = setup_req->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_req(false,instance)->nr_mode_info[i].fdd.dl_nr_sul_band[fdd_dl_k]; // + nr_supportedSULFreqBandItem->freqBandIndicatorNr = setup_req->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_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_Info->uL_Transmission_Bandwidth.nRSCS = setup_req->nr_mode_info[i].fdd.ul_scs; + fDD_Info->uL_Transmission_Bandwidth.nRNRB = to_NRNRB(setup_req->nr_mode_info[i].fdd.ul_nrb); /* FDD.4 DL Transmission Bandwidth */ - 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); + fDD_Info->dL_Transmission_Bandwidth.nRSCS = setup_req->nr_mode_info[i].fdd.dl_scs; + fDD_Info->dL_Transmission_Bandwidth.nRNRB = to_NRNRB(setup_req->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, 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 + tDD_Info->nRFreqInfo.nRARFCN = setup_req->nr_mode_info[i].tdd.nr_arfcn; // Integer /* TDD.1.2 F1AP_SUL_Information */ if(0) { // Optional @@ -291,42 +291,42 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance) } /* TDD.1.3 freqBandListNr */ - int tdd_num_available_freq_Bands = f1ap_req(false,instance)->nr_mode_info[i].tdd.num_frequency_bands; + int tdd_num_available_freq_Bands = setup_req->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_req(false,instance)->nr_mode_info[i].tdd.nr_band; // + nr_freqBandNrItem->freqBandIndicatorNr = *setup_req->nr_mode_info[i].tdd.nr_band; // /* TDD.1.3.2 supportedSULBandList*/ - int num_available_supported_SULBands = f1ap_req(false,instance)->nr_mode_info[i].tdd.num_sul_frequency_bands; + int num_available_supported_SULBands = setup_req->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_req(false,instance)->nr_mode_info[i].tdd.nr_sul_band; // + nr_supportedSULFreqBandItem->freqBandIndicatorNr = *setup_req->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_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); + tDD_Info->transmission_Bandwidth.nRSCS = setup_req->nr_mode_info[i].tdd.scs; + tDD_Info->transmission_Bandwidth.nRNRB = to_NRNRB(setup_req->nr_mode_info[i].tdd.nrb); } // if nR_Mode_Info /* - measurementTimingConfiguration */ - char *measurementTimingConfiguration = f1ap_req(false,instance)->measurement_timing_information[i]; // sept. 2018 + char *measurementTimingConfiguration = setup_req->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, 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, - f1ap_req(false,instance)->mib_length[i]); + (const char *)setup_req->mib[i], //f1ap_du_data->mib, + setup_req->mib_length[i]); OCTET_STRING_fromBuf(&gNB_DU_System_Information->sIB1_message, // sept. 2018 - (const char *)f1ap_req(false,instance)->sib1[i], - f1ap_req(false,instance)->sib1_length[i]); + (const char *)setup_req->sib1[i], + setup_req->sib1_length[i]); } /* mandatory */ @@ -588,7 +588,7 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, addnRCGI(served_cell_information->nRCGI, &f1ap_setup_req->cell[j]); /* - nRPCI */ /* 2.1.1 serverd cell Information */ - cellIDs_t *cell=&f1ap_req(false, instance)->cell[j]; + cellIDs_t *cell = &f1ap_setup_req->cell[j]; served_cell_information->nRPCI = cell->nr_pci; // int 0..1007 /* - fiveGS_TAC */ uint32_t tac=htonl(cell->tac); @@ -667,7 +667,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]; + cellIDs_t *cell = &f1ap_setup_req->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; diff --git a/openair2/F1AP/f1ap_du_interface_management.h b/openair2/F1AP/f1ap_du_interface_management.h index 83cd69cf6c..a81958880b 100644 --- a/openair2/F1AP/f1ap_du_interface_management.h +++ b/openair2/F1AP/f1ap_du_interface_management.h @@ -60,7 +60,7 @@ int DU_handle_ERROR_INDICATION(instance_t instance, /* * F1 Setup */ -int DU_send_F1_SETUP_REQUEST(instance_t instance); +int DU_send_F1_SETUP_REQUEST(instance_t instance, f1ap_setup_req_t *setup_req); int DU_handle_F1_SETUP_RESPONSE(instance_t instance, uint32_t assoc_id, diff --git a/openair2/F1AP/f1ap_du_task.c b/openair2/F1AP/f1ap_du_task.c index 4a8be033dc..6c901b2cc1 100644 --- a/openair2/F1AP/f1ap_du_task.c +++ b/openair2/F1AP/f1ap_du_task.c @@ -83,7 +83,7 @@ void du_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat f1ap_du_data->sctp_in_streams = sctp_new_association_resp->in_streams; f1ap_du_data->sctp_out_streams = sctp_new_association_resp->out_streams; /* setup parameters for F1U and start the server */ - DU_send_F1_SETUP_REQUEST(instance); + DU_send_F1_SETUP_REQUEST(instance, f1ap_du_data); } void du_task_handle_sctp_data_ind(instance_t instance, sctp_data_ind_t *sctp_data_ind) { From 4f7ae5dd2aa8cf6a463ce143a55ad0868851b777 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 18 Jul 2023 13:10:32 +0200 Subject: [PATCH 11/63] No double instance book keeping --- executables/nr-cuup.c | 2 +- openair2/F1AP/f1ap_common.c | 39 +++++------------ openair2/F1AP/f1ap_common.h | 15 +------ openair2/F1AP/f1ap_cu_interface_management.c | 6 +-- openair2/F1AP/f1ap_cu_paging.c | 2 +- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 2 +- openair2/F1AP/f1ap_cu_task.c | 10 ++--- openair2/F1AP/f1ap_cu_ue_context_management.c | 16 +++---- openair2/F1AP/f1ap_du_interface_management.c | 4 +- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 8 ++-- openair2/F1AP/f1ap_du_task.c | 4 +- openair2/F1AP/f1ap_du_ue_context_management.c | 42 +++++++++---------- openair2/F1AP/f1ap_itti_messaging.c | 11 ++--- openair2/F1AP/f1ap_itti_messaging.h | 2 +- openair2/RRC/NR/cucp_cuup_direct.c | 4 +- 15 files changed, 68 insertions(+), 99 deletions(-) diff --git a/executables/nr-cuup.c b/executables/nr-cuup.c index 81d255b87d..2992953ef0 100644 --- a/executables/nr-cuup.c +++ b/executables/nr-cuup.c @@ -106,7 +106,7 @@ void prepare_and_send_ue_context_modification_f1(rrc_gNB_ue_context_t *ue_contex abort(); } -f1ap_cudu_inst_t *getCxt(F1_t isCU, instance_t instanceP) +f1ap_cudu_inst_t *getCxt(instance_t instanceP) { abort(); return NULL; diff --git a/openair2/F1AP/f1ap_common.c b/openair2/F1AP/f1ap_common.c index 1dd62df0f0..03fc6cc527 100644 --- a/openair2/F1AP/f1ap_common.c +++ b/openair2/F1AP/f1ap_common.c @@ -32,8 +32,7 @@ #include "f1ap_common.h" -static f1ap_cudu_inst_t *f1_du_inst[NUMBER_OF_gNB_MAX]= {0}; -static f1ap_cudu_inst_t *f1_cu_inst[NUMBER_OF_gNB_MAX]= {0}; +static f1ap_cudu_inst_t *f1_inst[NUMBER_OF_gNB_MAX]= {0}; uint8_t F1AP_get_next_transaction_identifier(instance_t mod_idP, instance_t cu_mod_idP) { @@ -44,32 +43,16 @@ uint8_t F1AP_get_next_transaction_identifier(instance_t mod_idP, instance_t cu_m return transaction_identifier[mod_idP+cu_mod_idP]; } -f1ap_cudu_inst_t *getCxt(F1_t isCU, instance_t instanceP) { - //Fixme: 4G F1 has race condtions, someone may debug it, using this test - /* - static pid_t t=-1; - pid_t tNew=gettid(); - AssertFatal ( t==-1 || t==tNew, "This is not thread safe\n"); - t=tNew; - */ - AssertFatal( instanceP < sizeofArray(f1_cu_inst), ""); - return isCU == CUtype ? f1_cu_inst[ instanceP]: f1_du_inst[ instanceP]; +f1ap_cudu_inst_t *getCxt(instance_t instanceP) +{ + DevAssert(instanceP == 0); + return f1_inst[instanceP]; } -void createF1inst(F1_t isCU, instance_t instanceP, f1ap_setup_req_t *req) { - if (isCU == CUtype) { - AssertFatal(f1_cu_inst[instanceP] == NULL, "Double call to F1 CU init\n"); - f1_cu_inst[instanceP]=( f1ap_cudu_inst_t *) calloc(1, sizeof( f1ap_cudu_inst_t)); - //memcpy(f1_cu_inst[instanceP]->setupReq, req, sizeof(f1ap_setup_req_t) ); - } else { - AssertFatal(f1_du_inst[instanceP] == NULL, "Double call to F1 DU init\n"); - f1_du_inst[instanceP]=( f1ap_cudu_inst_t *) calloc(1, sizeof(f1ap_cudu_inst_t)); - memcpy(&f1_du_inst[instanceP]->setupReq, req, sizeof(f1ap_setup_req_t) ); - } -} - - -int f1ap_assoc_id(F1_t isCu, instance_t instanceP) { - f1ap_setup_req_t *f1_inst=f1ap_req(isCu, instanceP); - return f1_inst->assoc_id; +void createF1inst(instance_t instanceP, f1ap_setup_req_t *req) +{ + AssertFatal(f1_inst[instanceP] == NULL, "Double call to F1 DU init\n"); + f1_inst[instanceP] = (f1ap_cudu_inst_t *)calloc(1, sizeof(f1ap_cudu_inst_t)); + if (req) + memcpy(&f1_inst[instanceP]->setupReq, req, sizeof(f1ap_setup_req_t)); } diff --git a/openair2/F1AP/f1ap_common.h b/openair2/F1AP/f1ap_common.h index 0be765e441..c3f0a402b2 100644 --- a/openair2/F1AP/f1ap_common.h +++ b/openair2/F1AP/f1ap_common.h @@ -414,24 +414,13 @@ typedef struct f1ap_cudu_inst_s { f1ap_cudu_ue_t f1ap_ue[MAX_MOBILES_PER_GNB]; } f1ap_cudu_inst_t; -typedef enum { - DUtype=0, - CUtype -} F1_t; - static const int nrb_lut[29] = {11, 18, 24, 25, 31, 32, 38, 51, 52, 65, 66, 78, 79, 93, 106, 107, 121, 132, 133, 135, 160, 162, 189, 216, 217, 245, 264, 270, 273}; uint8_t F1AP_get_next_transaction_identifier(instance_t mod_idP, instance_t cu_mod_idP); -f1ap_cudu_inst_t *getCxt(F1_t isCU, instance_t instanceP); +f1ap_cudu_inst_t *getCxt(instance_t instanceP); -void createF1inst(F1_t isCU, instance_t instanceP, f1ap_setup_req_t *req); - -int f1ap_assoc_id(F1_t isCu, instance_t instanceP); - -static inline f1ap_setup_req_t *f1ap_req(F1_t isCu, instance_t instanceP) { - return &getCxt(isCu, instanceP)->setupReq; -} +void createF1inst(instance_t instanceP, f1ap_setup_req_t *req); //lts: C struct type is not homogeneous, so we need macros instead of functions #define addnRCGI(nRCGi, servedCelL) \ diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index 2f8f18ab40..fea6a545fc 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -353,7 +353,7 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance, f1ap_setup_resp_t *f1ap_setup } ASN_STRUCT_RESET(asn_DEF_F1AP_F1AP_PDU, &pdu); - f1ap_itti_send_sctp_data_req(true, instance, buffer, len); + f1ap_itti_send_sctp_data_req(instance, buffer, len); return 0; } @@ -420,7 +420,7 @@ int CU_send_F1_SETUP_FAILURE(instance_t instance) { } ASN_STRUCT_RESET(asn_DEF_F1AP_F1AP_PDU, &pdu); - f1ap_itti_send_sctp_data_req(true,instance, buffer, len); + f1ap_itti_send_sctp_data_req(instance, buffer, len); return 0; } @@ -536,7 +536,7 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu LOG_DUMPMSG(F1AP, LOG_DUMP_CHAR, buffer, len, "F1AP gNB-CU CONFIGURATION UPDATE : "); ASN_STRUCT_RESET(asn_DEF_F1AP_F1AP_PDU, &pdu); - f1ap_itti_send_sctp_data_req(true,instance, buffer, len); + f1ap_itti_send_sctp_data_req(instance, buffer, len); return 0; } diff --git a/openair2/F1AP/f1ap_cu_paging.c b/openair2/F1AP/f1ap_cu_paging.c index 5f35331e65..af89f449bc 100644 --- a/openair2/F1AP/f1ap_cu_paging.c +++ b/openair2/F1AP/f1ap_cu_paging.c @@ -115,6 +115,6 @@ int CU_send_Paging(instance_t instance, f1ap_paging_ind_t *paging) { return -1; } ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, &pdu); - f1ap_itti_send_sctp_data_req(true, instance, buffer, len); + f1ap_itti_send_sctp_data_req(instance, buffer, len); return 0; } diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index 9f25236720..18560e5751 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -209,7 +209,7 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance, return -1; } - f1ap_itti_send_sctp_data_req(true, instance, buffer, len); + f1ap_itti_send_sctp_data_req(instance, buffer, len); return 0; } diff --git a/openair2/F1AP/f1ap_cu_task.c b/openair2/F1AP/f1ap_cu_task.c index 8284d8581e..d3eb4ec0c7 100644 --- a/openair2/F1AP/f1ap_cu_task.c +++ b/openair2/F1AP/f1ap_cu_task.c @@ -50,20 +50,20 @@ static instance_t cu_task_create_gtpu_instance(eth_params_t *IPaddrs) { static void cu_task_handle_sctp_association_ind(instance_t instance, sctp_new_association_ind_t *sctp_new_association_ind, eth_params_t *IPaddrs) { - createF1inst(true, instance, NULL); + createF1inst(instance, NULL); // save the assoc id - f1ap_setup_req_t *f1ap_cu_data=f1ap_req(true, instance); + f1ap_setup_req_t *f1ap_cu_data = &getCxt(instance)->setupReq; f1ap_cu_data->assoc_id = sctp_new_association_ind->assoc_id; f1ap_cu_data->sctp_in_streams = sctp_new_association_ind->in_streams; f1ap_cu_data->sctp_out_streams = sctp_new_association_ind->out_streams; if (RC.nrrrc[instance]->node_type != ngran_gNB_CUCP) { - getCxt(CUtype, instance)->gtpInst = cu_task_create_gtpu_instance(IPaddrs); - AssertFatal(getCxt(CUtype, instance)->gtpInst > 0, "Failed to create CU F1-U UDP listener"); + getCxt(instance)->gtpInst = cu_task_create_gtpu_instance(IPaddrs); + AssertFatal(getCxt(instance)->gtpInst > 0, "Failed to create CU F1-U UDP listener"); } else LOG_I(F1AP, "In F1AP connection, don't start GTP-U, as we have also E1AP\n"); // Fixme: fully inconsistent instances management // dirty global var is a bad fix - CUuniqInstance=getCxt(CUtype, instance)->gtpInst; + CUuniqInstance=getCxt(instance)->gtpInst; } static void cu_task_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp) { diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index e80eaec30a..1646499c9a 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -509,7 +509,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, /*Use a dummy teid for the outgoing GTP-U tunnel (DU) which will be updated once we get the UE context setup response from the DU*/ /* Use a dummy address and teid for the outgoing GTP-U tunnel (DU) which will be updated once we get the UE context setup response from the DU */ transport_layer_addr_t addr = { .length= 32, .buffer= { 0 } }; - f1ap_ue_context_setup_req->drbs_to_be_setup[i].up_ul_tnl[j].teid = newGtpuCreateTunnel(getCxt(CUtype, instance)->gtpInst, + f1ap_ue_context_setup_req->drbs_to_be_setup[i].up_ul_tnl[j].teid = newGtpuCreateTunnel(getCxt(instance)->gtpInst, f1ap_ue_context_setup_req->gNB_CU_ue_id, f1ap_ue_context_setup_req->drbs_to_be_setup[i].drb_id, f1ap_ue_context_setup_req->drbs_to_be_setup[i].drb_id, @@ -628,7 +628,7 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, // return -1; // } LOG_D(F1AP,"F1AP UEContextSetupRequest Encoded %u bits\n", len); - f1ap_itti_send_sctp_data_req(true, instance, buffer, len); + f1ap_itti_send_sctp_data_req(instance, buffer, len); return 0; } @@ -692,7 +692,7 @@ int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, F1AP_GTPTunnel_t *dl_up_tnl0 = dl_up_tnl_info_p->dLUPTNLInformation.choice.gTPTunnel; BIT_STRING_TO_TRANSPORT_LAYER_ADDRESS_IPv4(&dl_up_tnl0->transportLayerAddress, drb_p->up_dl_tnl[0].tl_address); OCTET_STRING_TO_UINT32(&dl_up_tnl0->gTP_TEID, drb_p->up_dl_tnl[0].teid); - GtpuUpdateTunnelOutgoingAddressAndTeid(getCxt(CUtype, instance)->gtpInst, + GtpuUpdateTunnelOutgoingAddressAndTeid(getCxt(instance)->gtpInst, f1ap_ue_context_setup_resp->gNB_DU_ue_id, (ebi_t)drbs_setup_item_p->dRBID, drb_p->up_dl_tnl[0].tl_address, @@ -916,7 +916,7 @@ int CU_send_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, return -1; } - f1ap_itti_send_sctp_data_req(true, instance, buffer, len); + f1ap_itti_send_sctp_data_req(instance, buffer, len); return 0; } int CU_handle_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, @@ -1562,7 +1562,7 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, f1ap_ue_context LOG_E(F1AP, "Failed to encode F1 UE CONTEXT_MODIFICATION REQUEST\n"); return -1; } - f1ap_itti_send_sctp_data_req(true, instance, buffer, len); + f1ap_itti_send_sctp_data_req(instance, buffer, len); return 0; } @@ -1628,7 +1628,7 @@ int CU_handle_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance, F1AP_GTPTunnel_t *dl_up_tnl0 = dl_up_tnl_info_p->dLUPTNLInformation.choice.gTPTunnel; BIT_STRING_TO_TRANSPORT_LAYER_ADDRESS_IPv4(&dl_up_tnl0->transportLayerAddress, drb_p->up_dl_tnl[0].tl_address); OCTET_STRING_TO_UINT32(&dl_up_tnl0->gTP_TEID, drb_p->up_dl_tnl[0].teid); - GtpuUpdateTunnelOutgoingAddressAndTeid(getCxt(CUtype, instance)->gtpInst, + GtpuUpdateTunnelOutgoingAddressAndTeid(getCxt(instance)->gtpInst, f1ap_ue_context_modification_resp->gNB_CU_ue_id, (ebi_t)drbs_setupmod_item_p->dRBID, drb_p->up_dl_tnl[0].tl_address, @@ -1892,7 +1892,7 @@ int CU_send_UE_CONTEXT_MODIFICATION_CONFIRM(instance_t instance, f1ap_ue_context LOG_E(F1AP, "Failed to encode F1 UE Context Modification Confirm\n"); return -1; } - f1ap_itti_send_sctp_data_req(true, instance, buffer, len); + f1ap_itti_send_sctp_data_req(instance, buffer, len); return 0; } @@ -1959,6 +1959,6 @@ int CU_send_UE_CONTEXT_MODIFICATION_REFUSE(instance_t instance, f1ap_ue_context_ LOG_E(F1AP, "Failed to encode F1 UE Context Modification Refuse\n"); return -1; } - f1ap_itti_send_sctp_data_req(true, instance, buffer, len); + f1ap_itti_send_sctp_data_req(instance, buffer, len); return 0; } diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index d7586536c4..517b2d1dc4 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -347,7 +347,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance, f1ap_setup_req_t *setup_req) } ASN_STRUCT_RESET(asn_DEF_F1AP_F1AP_PDU, &pdu); - f1ap_itti_send_sctp_data_req(false, instance, buffer, len); + f1ap_itti_send_sctp_data_req(instance, buffer, len); return 0; } @@ -984,7 +984,7 @@ int DU_send_gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, } ASN_STRUCT_RESET(asn_DEF_F1AP_F1AP_PDU, &pdu); - f1ap_itti_send_sctp_data_req(false, instance, buffer, len); + f1ap_itti_send_sctp_data_req(instance, buffer, len); return 0; } diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index 85a8738c1b..48ca7aa201 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -85,7 +85,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, /* strange: it is not named OLD_GNB_DU_UE... */ old_gNB_DU_ue_id_stack = ie->value.choice.GNB_DU_UE_F1AP_ID_1; old_gNB_DU_ue_id = &old_gNB_DU_ue_id_stack; - gtpv1u_update_ue_id(getCxt(false, instance)->gtpInst, old_gNB_DU_ue_id_stack, du_ue_f1ap_id); + gtpv1u_update_ue_id(getCxt(instance)->gtpInst, old_gNB_DU_ue_id_stack, du_ue_f1ap_id); } /* mandatory */ @@ -172,7 +172,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instanceP, const f1ap_ini ie2->criticality = F1AP_Criticality_reject; ie2->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_NRCGI; //Fixme: takes always the first cell - addnRCGI(ie2->value.choice.NRCGI, getCxt(DUtype, instanceP)->setupReq.cell); + addnRCGI(ie2->value.choice.NRCGI, getCxt(instanceP)->setupReq.cell); /* mandatory */ /* c3. C_RNTI */ // 16 asn1cSequenceAdd(out->protocolIEs.list, F1AP_InitialULRRCMessageTransferIEs_t, ie3); @@ -213,7 +213,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instanceP, const f1ap_ini return -1; } - f1ap_itti_send_sctp_data_req(false, instanceP, buffer, len); + f1ap_itti_send_sctp_data_req(instanceP, buffer, len); return 0; } @@ -279,6 +279,6 @@ int DU_send_UL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, const f1ap_ul_rrc_me return -1; } - f1ap_itti_send_sctp_data_req(false, instance, buffer, len); + f1ap_itti_send_sctp_data_req(instance, buffer, len); return 0; } diff --git a/openair2/F1AP/f1ap_du_task.c b/openair2/F1AP/f1ap_du_task.c index 6c901b2cc1..020d03794b 100644 --- a/openair2/F1AP/f1ap_du_task.c +++ b/openair2/F1AP/f1ap_du_task.c @@ -78,7 +78,7 @@ void du_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat } // save the assoc id - f1ap_setup_req_t *f1ap_du_data=f1ap_req(false, instance); + f1ap_setup_req_t *f1ap_du_data = &getCxt(instance)->setupReq; f1ap_du_data->assoc_id = sctp_new_association_resp->assoc_id; f1ap_du_data->sctp_in_streams = sctp_new_association_resp->in_streams; f1ap_du_data->sctp_out_streams = sctp_new_association_resp->out_streams; @@ -114,7 +114,7 @@ void *F1AP_DU_task(void *arg) { // 2. store the message in f1ap context, that is also stored in RC // 2. send a sctp_association req f1ap_setup_req_t *msgSetup = &F1AP_SETUP_REQ(msg); - createF1inst(false, myInstance, msgSetup); + createF1inst(myInstance, msgSetup); du_task_send_sctp_association_req(myInstance, msgSetup); } break; diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index e59dd31426..a99e2eb418 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -150,7 +150,7 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, BIT_STRING_TO_TRANSPORT_LAYER_ADDRESS_IPv4(&ul_up_tnl0->transportLayerAddress, drb_p->up_ul_tnl[0].tl_address); OCTET_STRING_TO_UINT32(&ul_up_tnl0->gTP_TEID, drb_p->up_ul_tnl[0].teid); // 3GPP assumes GTP-U is on port 2152, but OAI is configurable - drb_p->up_ul_tnl[0].port=getCxt(false,instance)->setupReq.CUport; + drb_p->up_ul_tnl[0].port = getCxt(instance)->setupReq.CUport; switch (drbs_tobesetup_item_p->rLCMode) { case F1AP_RLCMode_rlc_am: @@ -332,8 +332,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup asn1cCalloc(dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.choice.gTPTunnel,gTPTunnel); /* transportLayerAddress */ struct sockaddr_in addr= {0}; - inet_pton(AF_INET, getCxt(false,instance)->setupReq.DU_f1_ip_address.ipv4_address, - &addr.sin_addr.s_addr); + inet_pton(AF_INET, getCxt(instance)->setupReq.DU_f1_ip_address.ipv4_address, &addr.sin_addr.s_addr); TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(addr.sin_addr.s_addr, &gTPTunnel->transportLayerAddress); /* gTP_TEID */ @@ -459,7 +458,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup F1AP_SCell_FailedtoSetup_Item_t *sCell_FailedtoSetup_item= &sCell_FailedtoSetup_item_ies->value.choice.SCell_FailedtoSetup_Item; /* sCell_ID */ - addnRCGI(sCell_FailedtoSetup_item->sCell_ID,f1ap_req(false, instance)->cell+i); + addnRCGI(sCell_FailedtoSetup_item->sCell_ID, getCxt(instance)->setupReq.cell+i); /* cause */ asn1cCalloc(sCell_FailedtoSetup_item->cause, tmp); // dummy value @@ -544,7 +543,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup return -1; } - f1ap_itti_send_sctp_data_req(false, instance, buffer, len); + f1ap_itti_send_sctp_data_req(instance, buffer, len); return 0; } @@ -619,7 +618,7 @@ int DU_send_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, return -1; } - f1ap_itti_send_sctp_data_req(false, instance, buffer, len); + f1ap_itti_send_sctp_data_req(instance, buffer, len); return 0; } @@ -766,7 +765,7 @@ int DU_send_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, f1ap_ue_context_rel return -1; } - f1ap_itti_send_sctp_data_req(false, instance, buffer, len); + f1ap_itti_send_sctp_data_req(instance, buffer, len); return 0; } @@ -849,7 +848,7 @@ int DU_handle_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, uint32_t asso BIT_STRING_TO_TRANSPORT_LAYER_ADDRESS_IPv4(&ul_up_tnl0->transportLayerAddress, drb_p->up_ul_tnl[0].tl_address); OCTET_STRING_TO_UINT32(&ul_up_tnl0->gTP_TEID, drb_p->up_ul_tnl[0].teid); // 3GPP assumes GTP-U is on port 2152, but OAI is configurable - drb_p->up_ul_tnl[0].port=getCxt(false,instance)->setupReq.CUport; + drb_p->up_ul_tnl[0].port = getCxt(instance)->setupReq.CUport; extern instance_t DUuniqInstance; if (DUuniqInstance == 0) { @@ -861,16 +860,15 @@ int DU_handle_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, uint32_t asso (drb_p->up_ul_tnl[0].tl_address >> 8) & 0xff, (drb_p->up_ul_tnl[0].tl_address >> 16) & 0xff, (drb_p->up_ul_tnl[0].tl_address >> 24) & 0xff); - getCxt(DUtype, instance)->gtpInst=du_create_gtpu_instance_to_cu( - gtp_tunnel_ip_address, - getCxt(false,instance)->setupReq.CUport, - getCxt(false,instance)->setupReq.DU_f1_ip_address.ipv4_address, - getCxt(false,instance)->setupReq.DUport); - AssertFatal(getCxt(DUtype, instance)->gtpInst>0,"Failed to create CU F1-U UDP listener"); + getCxt(instance)->gtpInst = du_create_gtpu_instance_to_cu(gtp_tunnel_ip_address, + getCxt(instance)->setupReq.CUport, + getCxt(instance)->setupReq.DU_f1_ip_address.ipv4_address, + getCxt(instance)->setupReq.DUport); + AssertFatal(getCxt(instance)->gtpInst > 0, "Failed to create CU F1-U UDP listener"); // Fixme: fully inconsistent instances management // dirty global var is a bad fix extern instance_t legacyInstanceMapping; - legacyInstanceMapping = DUuniqInstance = getCxt(DUtype, instance)->gtpInst; + legacyInstanceMapping = DUuniqInstance = getCxt(instance)->gtpInst; } switch (drbs_tobesetupmod_item_p->rLCMode) { @@ -1026,7 +1024,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance, f1ap_ue_contex transport_layer_addr_t tl_addr = {0}; memcpy(tl_addr.buffer, &drb->up_ul_tnl[0].tl_address, sizeof(drb->up_ul_tnl[0].tl_address)); tl_addr.length = sizeof(drb->up_ul_tnl[0].tl_address) * 8; - drb->up_dl_tnl[j].teid = newGtpuCreateTunnel(getCxt(false, instance)->gtpInst, + drb->up_dl_tnl[j].teid = newGtpuCreateTunnel(getCxt(instance)->gtpInst, resp->gNB_DU_ue_id, drb->drb_id, drb->drb_id, @@ -1045,8 +1043,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance, f1ap_ue_contex asn1cCalloc(dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.choice.gTPTunnel,gTPTunnel); /* transportLayerAddress */ struct sockaddr_in addr= {0}; - inet_pton(AF_INET, getCxt(false,instance)->setupReq.DU_f1_ip_address.ipv4_address, - &addr.sin_addr.s_addr); + inet_pton(AF_INET, getCxt(instance)->setupReq.DU_f1_ip_address.ipv4_address, &addr.sin_addr.s_addr); TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(addr.sin_addr.s_addr, &gTPTunnel->transportLayerAddress); /* gTP_TEID */ @@ -1084,8 +1081,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance, f1ap_ue_contex asn1cCalloc(dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.choice.gTPTunnel, gTPTunnel); /* transportLayerAddress */ struct sockaddr_in addr= {0}; - inet_pton(AF_INET, getCxt(false,instance)->setupReq.DU_f1_ip_address.ipv4_address, - &addr.sin_addr.s_addr); + inet_pton(AF_INET, getCxt(instance)->setupReq.DU_f1_ip_address.ipv4_address, &addr.sin_addr.s_addr); TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(addr.sin_addr.s_addr, &gTPTunnel->transportLayerAddress); /* gTP_TEID */ INT32_TO_OCTET_STRING(resp->drbs_to_be_modified[i].up_dl_tnl[j].teid, &gTPTunnel->gTP_TEID); @@ -1160,7 +1156,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance, f1ap_ue_contex /* 8.1 SCell_ToBeSetup_Item */ F1AP_SCell_FailedtoSetupMod_Item_t *scell_failedtoSetupMod_item=&scell_failedtoSetupMod_item_ies->value.choice.SCell_FailedtoSetupMod_Item; /* - sCell_ID */ - addnRCGI(scell_failedtoSetupMod_item->sCell_ID, &f1ap_req(false, instance)->cell[i]); + addnRCGI(scell_failedtoSetupMod_item->sCell_ID, &getCxt(instance)->setupReq.cell[i]); asn1cCalloc(scell_failedtoSetupMod_item->cause, tmp); tmp->present = F1AP_Cause_PR_radioNetwork; tmp->choice.radioNetwork = F1AP_CauseRadioNetwork_unknown_or_already_allocated_gnb_du_ue_f1ap_id; @@ -1269,7 +1265,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance, f1ap_ue_contex return -1; } - f1ap_itti_send_sctp_data_req(false, instance, buffer, len); + f1ap_itti_send_sctp_data_req(instance, buffer, len); return 0; } @@ -1393,7 +1389,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_REQUIRED(instance_t instance, f1ap_ue_contex return -1; } - f1ap_itti_send_sctp_data_req(false, instance, buffer, len); + f1ap_itti_send_sctp_data_req(instance, buffer, len); return 0; } diff --git a/openair2/F1AP/f1ap_itti_messaging.c b/openair2/F1AP/f1ap_itti_messaging.c index befaf7707b..eae58e4743 100644 --- a/openair2/F1AP/f1ap_itti_messaging.c +++ b/openair2/F1AP/f1ap_itti_messaging.c @@ -22,13 +22,13 @@ #include "f1ap_common.h" #include "f1ap_itti_messaging.h" -void f1ap_itti_send_sctp_data_req(bool isCu, instance_t instance, uint8_t *buffer, uint32_t buffer_length) +void f1ap_itti_send_sctp_data_req(instance_t instance, uint8_t *buffer, uint32_t buffer_length) { MessageDef *message_p; sctp_data_req_t *sctp_data_req; - message_p = itti_alloc_new_message(isCu?TASK_CU_F1:TASK_DU_F1, 0, SCTP_DATA_REQ); + message_p = itti_alloc_new_message(TASK_CU_F1, 0, SCTP_DATA_REQ); sctp_data_req = &message_p->ittiMsg.sctp_data_req; - sctp_data_req->assoc_id = f1ap_assoc_id(isCu,instance); + sctp_data_req->assoc_id = getCxt(instance)->setupReq.assoc_id; sctp_data_req->buffer = buffer; sctp_data_req->buffer_length = buffer_length; sctp_data_req->stream = 0; @@ -36,12 +36,13 @@ void f1ap_itti_send_sctp_data_req(bool isCu, instance_t instance, uint8_t *buffe itti_send_msg_to_task(TASK_SCTP, instance, message_p); } -void f1ap_itti_send_sctp_close_association(bool isCu, instance_t instance) { +void f1ap_itti_send_sctp_close_association(instance_t instance) +{ MessageDef *message_p = NULL; sctp_close_association_t *sctp_close_association_p = NULL; message_p = itti_alloc_new_message(TASK_S1AP, 0, SCTP_CLOSE_ASSOCIATION); sctp_close_association_p = &message_p->ittiMsg.sctp_close_association; - sctp_close_association_p->assoc_id = f1ap_assoc_id(isCu,instance); + sctp_close_association_p->assoc_id = getCxt(instance)->setupReq.assoc_id; itti_send_msg_to_task(TASK_SCTP, instance, message_p); } diff --git a/openair2/F1AP/f1ap_itti_messaging.h b/openair2/F1AP/f1ap_itti_messaging.h index a1b3762757..b132b3d826 100644 --- a/openair2/F1AP/f1ap_itti_messaging.h +++ b/openair2/F1AP/f1ap_itti_messaging.h @@ -22,6 +22,6 @@ #ifndef F1AP_ITTI_MESSAGING_H_ #define F1AP_ITTI_MESSAGING_H_ -void f1ap_itti_send_sctp_data_req(bool isCu,instance_t instance, uint8_t *buffer, uint32_t buffer_length); +void f1ap_itti_send_sctp_data_req(instance_t instance, uint8_t *buffer, uint32_t buffer_length); #endif /* F1AP_ITTI_MESSAGING_H_ */ diff --git a/openair2/RRC/NR/cucp_cuup_direct.c b/openair2/RRC/NR/cucp_cuup_direct.c index 9dccef4286..1d51f67ec6 100644 --- a/openair2/RRC/NR/cucp_cuup_direct.c +++ b/openair2/RRC/NR/cucp_cuup_direct.c @@ -195,7 +195,7 @@ static void cucp_cuup_bearer_context_setup_direct(e1ap_bearer_setup_req_t *const } else { int remote_port = RC.nrrrc[ctxt.module_id]->eth_params_s.remote_portd; in_addr_t my_addr = inet_addr(RC.nrrrc[ctxt.module_id]->eth_params_s.my_addr); - instance_t gtpInst = getCxt(CUtype, instance)->gtpInst; + instance_t gtpInst = getCxt(instance)->gtpInst; // GTP tunnel for DL fill_e1ap_bearer_setup_resp(&resp, req, gtpInst, UE->rrc_ue_id, remote_port, my_addr); } @@ -210,7 +210,7 @@ static void cucp_cuup_bearer_context_mod_direct(e1ap_bearer_setup_req_t *const r // only update GTP tunnels if it is really a CU if (!NODE_IS_CU(RC.nrrrc[0]->node_type)) return; - instance_t gtpInst = getCxt(CUtype, instance)->gtpInst; + instance_t gtpInst = getCxt(instance)->gtpInst; CU_update_UP_DL_tunnel(req, gtpInst, req->gNB_cu_cp_ue_id); } From 632ca1575269eeff60ce2bfbfd6fa1ee7e189c8d Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 30 Jun 2023 08:25:05 +0200 Subject: [PATCH 12/63] Separate F1 Setup Request and network configuration This branch series implements the usage of the F1 Setup Request internally at the gNB, even if CU and DU run in the same process. Until now, the F1 Setup Request contained struct fields to pass IP configuration to the F1AP module; this information is not necessary in monolithic, nor should it be relevant when passing the information in F1 Setup Request. Therefore, this commit moves all IP connection-related information out of the F1 Setup Request and into a separate structure instead. In order to give the F1AP module the necessary connection information, the DU_REGISTER_REQ message is introduced that combines the F1 Setup Request and IP configuration, such that the F1AP module can setup the SCTP connection and then send the F1 Setup Request message. In a later commit, there will be a callback for F1 Setup Request at MAC to simply register the DU at the CU. The monolithic callback will simply forward the F1 Setup Request The F1AP callback will look up the IP configuration and create DU_REGISTER_REQ message containing IP configuration and F1 Setup Request, which is then handled by the F1AP module. To this end, a separate function in gnb_config.c allows to read IP information from configuration. --- openair2/COMMON/f1ap_messages_def.h | 3 ++ openair2/COMMON/f1ap_messages_types.h | 32 +++++------ openair2/F1AP/f1ap_common.c | 13 +++-- openair2/F1AP/f1ap_common.h | 10 +++- openair2/F1AP/f1ap_cu_task.c | 9 ++-- openair2/F1AP/f1ap_du_task.c | 38 ++++++------- openair2/F1AP/f1ap_du_task.h | 3 +- openair2/F1AP/f1ap_du_ue_context_management.c | 20 +++---- openair2/F1AP/f1ap_itti_messaging.c | 4 +- openair2/GNB_APP/gnb_app.c | 2 +- openair2/GNB_APP/gnb_config.c | 53 +++++++++++-------- 11 files changed, 105 insertions(+), 82 deletions(-) diff --git a/openair2/COMMON/f1ap_messages_def.h b/openair2/COMMON/f1ap_messages_def.h index 125d6a0d6a..9cb63a0a06 100644 --- a/openair2/COMMON/f1ap_messages_def.h +++ b/openair2/COMMON/f1ap_messages_def.h @@ -19,6 +19,9 @@ * contact@openairinterface.org */ +/* To setup F1 at DU */ +MESSAGE_DEF(F1AP_DU_REGISTER_REQ, MESSAGE_PRIORITY_MED, f1ap_du_register_req_t, f1ap_du_register_req) + /* eNB_DU application layer -> F1AP messages or CU F1AP -> RRC*/ MESSAGE_DEF(F1AP_SETUP_REQ , MESSAGE_PRIORITY_MED, f1ap_setup_req_t , f1ap_setup_req) MESSAGE_DEF(F1AP_GNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE , MESSAGE_PRIORITY_MED, f1ap_gnb_cu_configuration_update_acknowledge_t , f1ap_gnb_cu_configuration_update_acknowledge) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index cb51f9f374..2e1fd7e9ad 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -30,6 +30,8 @@ #define F1AP_CU_SCTP_REQ(mSGpTR) (mSGpTR)->ittiMsg.f1ap_cu_sctp_req +#define F1AP_DU_REGISTER_REQ(mSGpTR) (mSGpTR)->ittiMsg.f1ap_du_register_req + #define F1AP_SETUP_REQ(mSGpTR) (mSGpTR)->ittiMsg.f1ap_setup_req #define F1AP_SETUP_RESP(mSGpTR) (mSGpTR)->ittiMsg.f1ap_setup_resp #define F1AP_GNB_CU_CONFIGURATION_UPDATE(mSGpTR) (mSGpTR)->ittiMsg.f1ap_gnb_cu_configuration_update @@ -75,6 +77,13 @@ typedef struct f1ap_net_ip_address_s { char ipv6_address[46]; } f1ap_net_ip_address_t; +typedef struct f1ap_net_config_t { + f1ap_net_ip_address_t CU_f1_ip_address; + f1ap_net_ip_address_t DU_f1_ip_address; + uint16_t CUport; + uint16_t DUport; +} f1ap_net_config_t; + typedef struct cellIDs_s { // Served Cell Information @@ -100,24 +109,6 @@ typedef struct cellIDs_s { typedef struct f1ap_setup_req_s { - // Midhaul networking parameters - - /* Connexion id used between SCTP/F1AP */ - uint16_t cnx_id; - - /* SCTP association id */ - int32_t assoc_id; - - /* The eNB IP address to bind */ - f1ap_net_ip_address_t CU_f1_ip_address; - f1ap_net_ip_address_t DU_f1_ip_address; - uint16_t CUport; - uint16_t DUport; - - /* Number of SCTP streams used for a mme association */ - uint16_t sctp_in_streams; - uint16_t sctp_out_streams; - // F1_Setup_Req payload uint64_t gNB_DU_id; char *gNB_DU_name; @@ -184,6 +175,11 @@ typedef struct f1ap_setup_req_s { } f1ap_setup_req_t; +typedef struct f1ap_du_register_req_t { + f1ap_setup_req_t setup_req; + f1ap_net_config_t net_config; +} f1ap_du_register_req_t; + typedef struct served_cells_to_activate_s { /// mcc of DU cells uint16_t mcc; diff --git a/openair2/F1AP/f1ap_common.c b/openair2/F1AP/f1ap_common.c index 03fc6cc527..2e8d6073a8 100644 --- a/openair2/F1AP/f1ap_common.c +++ b/openair2/F1AP/f1ap_common.c @@ -49,10 +49,13 @@ f1ap_cudu_inst_t *getCxt(instance_t instanceP) return f1_inst[instanceP]; } -void createF1inst(instance_t instanceP, f1ap_setup_req_t *req) +void createF1inst(instance_t instanceP, f1ap_setup_req_t *req, f1ap_net_config_t *nc) { - AssertFatal(f1_inst[instanceP] == NULL, "Double call to F1 DU init\n"); - f1_inst[instanceP] = (f1ap_cudu_inst_t *)calloc(1, sizeof(f1ap_cudu_inst_t)); - if (req) - memcpy(&f1_inst[instanceP]->setupReq, req, sizeof(f1ap_setup_req_t)); + DevAssert(instanceP == 0); + DevAssert(req != NULL); + AssertFatal(f1_inst[0] == NULL, "Double call to F1 DU init\n"); + f1_inst[0] = calloc(1, sizeof(f1ap_cudu_inst_t)); + AssertFatal(f1_inst[0] != NULL, "out of memory\n"); + f1_inst[0]->setupReq = *req; + f1_inst[0]->net_config = *nc; } diff --git a/openair2/F1AP/f1ap_common.h b/openair2/F1AP/f1ap_common.h index c3f0a402b2..d91ee3a0c0 100644 --- a/openair2/F1AP/f1ap_common.h +++ b/openair2/F1AP/f1ap_common.h @@ -406,8 +406,16 @@ typedef struct f1ap_cudu_ue_inst_s { typedef struct f1ap_cudu_inst_s { f1ap_setup_req_t setupReq; + + /* The eNB IP address to bind */ + f1ap_net_config_t net_config; + + /* SCTP information */ + int32_t assoc_id; uint16_t sctp_in_streams; uint16_t sctp_out_streams; + + /* GTP instance used by F1 */ instance_t gtpInst; uint64_t gNB_DU_id; uint16_t num_ues; @@ -420,7 +428,7 @@ uint8_t F1AP_get_next_transaction_identifier(instance_t mod_idP, instance_t cu_m f1ap_cudu_inst_t *getCxt(instance_t instanceP); -void createF1inst(instance_t instanceP, f1ap_setup_req_t *req); +void createF1inst(instance_t instanceP, f1ap_setup_req_t *req, f1ap_net_config_t *nc); //lts: C struct type is not homogeneous, so we need macros instead of functions #define addnRCGI(nRCGi, servedCelL) \ diff --git a/openair2/F1AP/f1ap_cu_task.c b/openair2/F1AP/f1ap_cu_task.c index d3eb4ec0c7..0003146d44 100644 --- a/openair2/F1AP/f1ap_cu_task.c +++ b/openair2/F1AP/f1ap_cu_task.c @@ -48,11 +48,12 @@ static instance_t cu_task_create_gtpu_instance(eth_params_t *IPaddrs) { return 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(instance, NULL); +static void cu_task_handle_sctp_association_ind(instance_t instance, + sctp_new_association_ind_t *sctp_new_association_ind, + eth_params_t *IPaddrs) +{ // save the assoc id - f1ap_setup_req_t *f1ap_cu_data = &getCxt(instance)->setupReq; + f1ap_cudu_inst_t *f1ap_cu_data = getCxt(instance); f1ap_cu_data->assoc_id = sctp_new_association_ind->assoc_id; f1ap_cu_data->sctp_in_streams = sctp_new_association_ind->in_streams; f1ap_cu_data->sctp_out_streams = sctp_new_association_ind->out_streams; diff --git a/openair2/F1AP/f1ap_du_task.c b/openair2/F1AP/f1ap_du_task.c index 020d03794b..8ce88a44f8 100644 --- a/openair2/F1AP/f1ap_du_task.c +++ b/openair2/F1AP/f1ap_du_task.c @@ -40,8 +40,9 @@ //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); +void du_task_send_sctp_association_req(instance_t instance, f1ap_net_config_t *nc) +{ + DevAssert(nc != 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); @@ -49,19 +50,13 @@ void du_task_send_sctp_association_req(instance_t instance, f1ap_setup_req_t *f1 sctp_new_association_req_p->ulp_cnx_id = instance; sctp_new_association_req_p->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; + sctp_new_association_req_p->in_streams = 2; //du_inst->sctp_in_streams; + sctp_new_association_req_p->out_streams = 2; //du_inst->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)); + memcpy(&sctp_new_association_req_p->remote_address, &nc->CU_f1_ip_address, sizeof(nc->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)); - //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 + memcpy(&sctp_new_association_req_p->local_address, &nc->DU_f1_ip_address, sizeof(nc->DU_f1_ip_address)); + // du_f1ap_register_to_sctp itti_send_msg_to_task(TASK_SCTP, instance, message_p); } @@ -78,12 +73,12 @@ void du_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat } // save the assoc id - f1ap_setup_req_t *f1ap_du_data = &getCxt(instance)->setupReq; + f1ap_cudu_inst_t *f1ap_du_data = getCxt(instance); f1ap_du_data->assoc_id = sctp_new_association_resp->assoc_id; f1ap_du_data->sctp_in_streams = sctp_new_association_resp->in_streams; f1ap_du_data->sctp_out_streams = sctp_new_association_resp->out_streams; /* setup parameters for F1U and start the server */ - DU_send_F1_SETUP_REQUEST(instance, f1ap_du_data); + DU_send_F1_SETUP_REQUEST(instance, &f1ap_du_data->setupReq); } void du_task_handle_sctp_data_ind(instance_t instance, sctp_data_ind_t *sctp_data_ind) { @@ -108,14 +103,19 @@ void *F1AP_DU_task(void *arg) { LOG_D(F1AP, "DU Task Received %s for instance %ld\n", ITTI_MSG_NAME(msg),myInstance); switch (ITTI_MSG_ID(msg)) { - case F1AP_SETUP_REQ: { + case F1AP_SETUP_REQ: + AssertFatal(false, "the F1AP_SETUP_REQ should not be received; use the F1AP_DU_REGISTER_REQ instead\n"); + break; + + case F1AP_DU_REGISTER_REQ: { // this is not a true F1 message, but rather an ITTI message sent by gnb_app // 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 - f1ap_setup_req_t *msgSetup = &F1AP_SETUP_REQ(msg); - createF1inst(myInstance, msgSetup); - du_task_send_sctp_association_req(myInstance, msgSetup); + f1ap_setup_req_t *msgSetup = &F1AP_DU_REGISTER_REQ(msg).setup_req; + f1ap_net_config_t *nc = &F1AP_DU_REGISTER_REQ(msg).net_config; + createF1inst(myInstance, msgSetup, nc); + du_task_send_sctp_association_req(myInstance, nc); } break; case F1AP_GNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE: diff --git a/openair2/F1AP/f1ap_du_task.h b/openair2/F1AP/f1ap_du_task.h index 2d5195baed..8ce8aacab6 100644 --- a/openair2/F1AP/f1ap_du_task.h +++ b/openair2/F1AP/f1ap_du_task.h @@ -22,7 +22,8 @@ #ifndef F1AP_DU_TASK_H_ #define F1AP_DU_TASK_H_ -void du_task_send_sctp_association_req(instance_t instance, f1ap_setup_req_t *f1ap_setup_req); +struct f1ap_net_config_t; +void du_task_send_sctp_association_req(instance_t instance, struct f1ap_net_config_t *du_inst); void du_task_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp); void du_task_handle_sctp_data_ind(instance_t instance, sctp_data_ind_t *sctp_data_ind); void *F1AP_DU_task(void *arg); diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index a99e2eb418..c9cb5ed809 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -150,7 +150,7 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, BIT_STRING_TO_TRANSPORT_LAYER_ADDRESS_IPv4(&ul_up_tnl0->transportLayerAddress, drb_p->up_ul_tnl[0].tl_address); OCTET_STRING_TO_UINT32(&ul_up_tnl0->gTP_TEID, drb_p->up_ul_tnl[0].teid); // 3GPP assumes GTP-U is on port 2152, but OAI is configurable - drb_p->up_ul_tnl[0].port = getCxt(instance)->setupReq.CUport; + drb_p->up_ul_tnl[0].port = getCxt(instance)->net_config.CUport; switch (drbs_tobesetup_item_p->rLCMode) { case F1AP_RLCMode_rlc_am: @@ -332,7 +332,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup asn1cCalloc(dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.choice.gTPTunnel,gTPTunnel); /* transportLayerAddress */ struct sockaddr_in addr= {0}; - inet_pton(AF_INET, getCxt(instance)->setupReq.DU_f1_ip_address.ipv4_address, &addr.sin_addr.s_addr); + inet_pton(AF_INET, getCxt(instance)->net_config.DU_f1_ip_address.ipv4_address, &addr.sin_addr.s_addr); TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(addr.sin_addr.s_addr, &gTPTunnel->transportLayerAddress); /* gTP_TEID */ @@ -458,7 +458,9 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup F1AP_SCell_FailedtoSetup_Item_t *sCell_FailedtoSetup_item= &sCell_FailedtoSetup_item_ies->value.choice.SCell_FailedtoSetup_Item; /* sCell_ID */ - addnRCGI(sCell_FailedtoSetup_item->sCell_ID, getCxt(instance)->setupReq.cell+i); + AssertFatal(false, "handle correct CellID\n"); + cellIDs_t cellID = {0}; + addnRCGI(sCell_FailedtoSetup_item->sCell_ID, &cellID); /* cause */ asn1cCalloc(sCell_FailedtoSetup_item->cause, tmp); // dummy value @@ -848,7 +850,7 @@ int DU_handle_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, uint32_t asso BIT_STRING_TO_TRANSPORT_LAYER_ADDRESS_IPv4(&ul_up_tnl0->transportLayerAddress, drb_p->up_ul_tnl[0].tl_address); OCTET_STRING_TO_UINT32(&ul_up_tnl0->gTP_TEID, drb_p->up_ul_tnl[0].teid); // 3GPP assumes GTP-U is on port 2152, but OAI is configurable - drb_p->up_ul_tnl[0].port = getCxt(instance)->setupReq.CUport; + drb_p->up_ul_tnl[0].port = getCxt(instance)->net_config.CUport; extern instance_t DUuniqInstance; if (DUuniqInstance == 0) { @@ -861,9 +863,9 @@ int DU_handle_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, uint32_t asso (drb_p->up_ul_tnl[0].tl_address >> 16) & 0xff, (drb_p->up_ul_tnl[0].tl_address >> 24) & 0xff); getCxt(instance)->gtpInst = du_create_gtpu_instance_to_cu(gtp_tunnel_ip_address, - getCxt(instance)->setupReq.CUport, - getCxt(instance)->setupReq.DU_f1_ip_address.ipv4_address, - getCxt(instance)->setupReq.DUport); + getCxt(instance)->net_config.CUport, + getCxt(instance)->net_config.DU_f1_ip_address.ipv4_address, + getCxt(instance)->net_config.DUport); AssertFatal(getCxt(instance)->gtpInst > 0, "Failed to create CU F1-U UDP listener"); // Fixme: fully inconsistent instances management // dirty global var is a bad fix @@ -1043,7 +1045,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance, f1ap_ue_contex asn1cCalloc(dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.choice.gTPTunnel,gTPTunnel); /* transportLayerAddress */ struct sockaddr_in addr= {0}; - inet_pton(AF_INET, getCxt(instance)->setupReq.DU_f1_ip_address.ipv4_address, &addr.sin_addr.s_addr); + inet_pton(AF_INET, getCxt(instance)->net_config.DU_f1_ip_address.ipv4_address, &addr.sin_addr.s_addr); TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(addr.sin_addr.s_addr, &gTPTunnel->transportLayerAddress); /* gTP_TEID */ @@ -1081,7 +1083,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance, f1ap_ue_contex asn1cCalloc(dLUPTNLInformation_ToBeSetup_Item->dLUPTNLInformation.choice.gTPTunnel, gTPTunnel); /* transportLayerAddress */ struct sockaddr_in addr= {0}; - inet_pton(AF_INET, getCxt(instance)->setupReq.DU_f1_ip_address.ipv4_address, &addr.sin_addr.s_addr); + inet_pton(AF_INET, getCxt(instance)->net_config.DU_f1_ip_address.ipv4_address, &addr.sin_addr.s_addr); TRANSPORT_LAYER_ADDRESS_IPv4_TO_BIT_STRING(addr.sin_addr.s_addr, &gTPTunnel->transportLayerAddress); /* gTP_TEID */ INT32_TO_OCTET_STRING(resp->drbs_to_be_modified[i].up_dl_tnl[j].teid, &gTPTunnel->gTP_TEID); diff --git a/openair2/F1AP/f1ap_itti_messaging.c b/openair2/F1AP/f1ap_itti_messaging.c index eae58e4743..d4e112d1d5 100644 --- a/openair2/F1AP/f1ap_itti_messaging.c +++ b/openair2/F1AP/f1ap_itti_messaging.c @@ -28,7 +28,7 @@ void f1ap_itti_send_sctp_data_req(instance_t instance, uint8_t *buffer, uint32_t sctp_data_req_t *sctp_data_req; 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 = getCxt(instance)->setupReq.assoc_id; + sctp_data_req->assoc_id = getCxt(instance)->assoc_id; sctp_data_req->buffer = buffer; sctp_data_req->buffer_length = buffer_length; sctp_data_req->stream = 0; @@ -42,7 +42,7 @@ void f1ap_itti_send_sctp_close_association(instance_t instance) 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 = getCxt(instance)->setupReq.assoc_id; + sctp_close_association_p->assoc_id = getCxt(instance)->assoc_id; itti_send_msg_to_task(TASK_SCTP, instance, message_p); } diff --git a/openair2/GNB_APP/gnb_app.c b/openair2/GNB_APP/gnb_app.c index 337f907a20..1366624414 100644 --- a/openair2/GNB_APP/gnb_app.c +++ b/openair2/GNB_APP/gnb_app.c @@ -181,7 +181,7 @@ void *gNB_app_task(void *args_p) } // configure F1AP here for F1C LOG_I(GNB_APP,"ngran_gNB_DU: Allocating ITTI message for F1AP_SETUP_REQ\n"); - msg_p = itti_alloc_new_message (TASK_GNB_APP, 0, F1AP_SETUP_REQ); + msg_p = itti_alloc_new_message (TASK_GNB_APP, 0, F1AP_DU_REGISTER_REQ); RCconfig_NR_DU_F1(msg_p, 0); itti_send_msg_to_task (TASK_DU_F1, GNB_MODULE_ID_TO_INSTANCE(0), msg_p); diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 1e924ed725..7af5cd0c39 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -47,6 +47,7 @@ #include "sctp_eNB_task.h" #include "sctp_default_values.h" #include "F1AP_CauseRadioNetwork.h" +#include "f1ap_common.h" // #include "SystemInformationBlockType2.h" // #include "LAYER2/MAC/extern.h" // #include "LAYER2/MAC/proto.h" @@ -1881,6 +1882,32 @@ int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i) { return 0; } +static f1ap_net_config_t read_DU_IP_config(const eth_params_t* f1_params) +{ + f1ap_net_config_t nc = {0}; + + nc.CU_f1_ip_address.ipv6 = 0; + nc.CU_f1_ip_address.ipv4 = 1; + strcpy(nc.CU_f1_ip_address.ipv4_address, f1_params->remote_addr); + nc.CUport = f1_params->remote_portd; + LOG_I(GNB_APP, + "FIAP: CU_ip4_address in DU %p, strlen %d\n", + nc.CU_f1_ip_address.ipv4_address, + (int)strlen(f1_params->remote_addr)); + + nc.DU_f1_ip_address.ipv6 = 0; + nc.DU_f1_ip_address.ipv4 = 1; + strcpy(nc.DU_f1_ip_address.ipv4_address, f1_params->my_addr); + nc.DUport = f1_params->my_portd; + LOG_I(GNB_APP, + "FIAP: DU_ip4_address in DU %p, strlen %ld\n", + nc.DU_f1_ip_address.ipv4_address, + strlen(f1_params->my_addr)); + + // sctp_in_streams/sctp_out_streams are given by SCTP layer + return nc; +} + int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) { int k; paramdef_t GNBSParams[] = GNBSPARAMS_DESC; @@ -1896,7 +1923,7 @@ int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) { config_getlist( &GNBParamList,GNBParams,sizeof(GNBParams)/sizeof(paramdef_t),NULL); AssertFatal(GNBParamList.paramarray[i][GNB_GNB_ID_IDX].uptr != NULL, "gNB id %u is not defined in configuration file\n",i); - f1ap_setup_req_t * f1Setup=&F1AP_SETUP_REQ(msg_p); + f1ap_setup_req_t *f1Setup = &F1AP_DU_REGISTER_REQ(msg_p).setup_req; f1Setup->num_cells_available = 0; 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); @@ -1933,26 +1959,9 @@ int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) { f1Setup->cell[k].nr_cellid = (uint64_t)*(GNBParamList.paramarray[i][GNB_NRCELLID_IDX].u64ptr); 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",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", - f1Setup->DU_f1_ip_address.ipv4_address, - strlen(RC.nrmac[k]->eth_params_n.my_addr)); - f1Setup->DU_f1_ip_address.ipv6 = 0; - f1Setup->DU_f1_ip_address.ipv4 = 1; - //strcpy(f1Setup->DU_f1_ip_address.ipv6_address, ""); - strcpy(f1Setup->DU_f1_ip_address.ipv4_address, RC.nrmac[k]->eth_params_n.my_addr); - f1Setup->DUport= RC.nrmac[k]->eth_params_n.my_portd; - f1Setup->CUport= RC.nrmac[k]->eth_params_n.remote_portd; - //strcpy(f1Setup->CU_ip_address[l].ipv6_address,*(F1ParamList.paramarray[l][ENB_CU_IPV6_ADDRESS_IDX].strptr)); - sprintf(aprefix,"%s.[%i].%s",GNB_CONFIG_STRING_GNB_LIST,k,GNB_CONFIG_STRING_SCTP_CONFIG); - config_get(SCTPParams,sizeof(SCTPParams)/sizeof(paramdef_t),aprefix); - f1Setup->sctp_in_streams = (uint16_t)*(SCTPParams[GNB_SCTP_INSTREAMS_IDX].uptr); - f1Setup->sctp_out_streams = (uint16_t)*(SCTPParams[GNB_SCTP_OUTSTREAMS_IDX].uptr); + + F1AP_DU_REGISTER_REQ(msg_p).net_config = read_DU_IP_config(&RC.nrmac[k]->eth_params_n); + gNB_RRC_INST *rrc = RC.nrrrc[k]; // wait until RRC cell information is configured int cell_info_configured = 0; From a2419226148245642cb15cadd1b6a241f7f8f258 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 18 Jul 2023 14:10:31 +0200 Subject: [PATCH 13/63] DU: Retry on unsuccessful SCTP connection attempt --- openair2/F1AP/f1ap_du_task.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/openair2/F1AP/f1ap_du_task.c b/openair2/F1AP/f1ap_du_task.c index 8ce88a44f8..797099a480 100644 --- a/openair2/F1AP/f1ap_du_task.c +++ b/openair2/F1AP/f1ap_du_task.c @@ -62,18 +62,20 @@ void du_task_send_sctp_association_req(instance_t instance, f1ap_net_config_t *n 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); + f1ap_cudu_inst_t *f1ap_du_data = getCxt(instance); + DevAssert(f1ap_du_data != 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", + LOG_W(F1AP, "Received unsuccessful result for SCTP association (%u), instance %ld, cnx_id %u, retrying...\n", 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); + sleep(3); + du_task_send_sctp_association_req(instance, &f1ap_du_data->net_config); return; // exit -1 for debugging } // save the assoc id - f1ap_cudu_inst_t *f1ap_du_data = getCxt(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; From 4badf66973d8c74583950223e1c829e6d767f77e Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 18 Jul 2023 15:28:37 +0200 Subject: [PATCH 14/63] Add mutexes to CreateF1Inst(), only save data if provided --- openair2/F1AP/f1ap_common.c | 12 ++++++++---- openair2/F1AP/f1ap_cu_task.c | 1 + 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/openair2/F1AP/f1ap_common.c b/openair2/F1AP/f1ap_common.c index 2e8d6073a8..91e7d85efe 100644 --- a/openair2/F1AP/f1ap_common.c +++ b/openair2/F1AP/f1ap_common.c @@ -49,13 +49,17 @@ f1ap_cudu_inst_t *getCxt(instance_t instanceP) return f1_inst[instanceP]; } +static pthread_mutex_t f1_inst_mtx = PTHREAD_MUTEX_INITIALIZER; void createF1inst(instance_t instanceP, f1ap_setup_req_t *req, f1ap_net_config_t *nc) { DevAssert(instanceP == 0); - DevAssert(req != NULL); - AssertFatal(f1_inst[0] == NULL, "Double call to F1 DU init\n"); + pthread_mutex_lock(&f1_inst_mtx); + AssertFatal(f1_inst[0] == NULL, "Attempted to initialize multiple F1 instances\n"); f1_inst[0] = calloc(1, sizeof(f1ap_cudu_inst_t)); AssertFatal(f1_inst[0] != NULL, "out of memory\n"); - f1_inst[0]->setupReq = *req; - f1_inst[0]->net_config = *nc; + if (req) + f1_inst[0]->setupReq = *req; + if (nc) + f1_inst[0]->net_config = *nc; + pthread_mutex_unlock(&f1_inst_mtx); } diff --git a/openair2/F1AP/f1ap_cu_task.c b/openair2/F1AP/f1ap_cu_task.c index 0003146d44..330d4f5422 100644 --- a/openair2/F1AP/f1ap_cu_task.c +++ b/openair2/F1AP/f1ap_cu_task.c @@ -52,6 +52,7 @@ 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(instance, NULL, NULL); // save the assoc id f1ap_cudu_inst_t *f1ap_cu_data = getCxt(instance); f1ap_cu_data->assoc_id = sctp_new_association_ind->assoc_id; From fd3ecb29b0978dd370c4f523f1992bf5b18a1d55 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 18 Jul 2023 13:26:27 +0200 Subject: [PATCH 15/63] Remove unused stuff in F1 module --- openair2/F1AP/f1ap_common.h | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/openair2/F1AP/f1ap_common.h b/openair2/F1AP/f1ap_common.h index d91ee3a0c0..ee468ce66a 100644 --- a/openair2/F1AP/f1ap_common.h +++ b/openair2/F1AP/f1ap_common.h @@ -396,14 +396,6 @@ typedef int (*f1ap_message_processing_t)( 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 NB stats generation - rnti_t rnti; - 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 { f1ap_setup_req_t setupReq; @@ -417,9 +409,6 @@ typedef struct f1ap_cudu_inst_s { /* GTP instance used by F1 */ instance_t gtpInst; - uint64_t gNB_DU_id; - uint16_t num_ues; - f1ap_cudu_ue_t f1ap_ue[MAX_MOBILES_PER_GNB]; } f1ap_cudu_inst_t; static const int nrb_lut[29] = {11, 18, 24, 25, 31, 32, 38, 51, 52, 65, 66, 78, 79, 93, 106, 107, 121, 132, 133, 135, 160, 162, 189, 216, 217, 245, 264, 270, 273}; From d6e99a8218248d84eaabc31172cfdaae8005dbeb Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 12 Jul 2023 08:36:33 +0200 Subject: [PATCH 16/63] gnb_config.c: Simplify F1 Setup reading --- openair2/GNB_APP/gnb_config.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 7af5cd0c39..63fd341544 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -1940,25 +1940,27 @@ int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) { config_getlist(&PLMNParamList, PLMNParams, sizeof(PLMNParams)/sizeof(paramdef_t), aprefix); f1Setup->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); + f1Setup->gNB_DU_id = *(GNBParamList.paramarray[k][GNB_GNB_ID_IDX].uptr); + f1Setup->gNB_DU_name = strdup(*(GNBParamList.paramarray[k][GNB_GNB_NAME_IDX].strptr)); + f1Setup->cell[k].tac = *GNBParamList.paramarray[k][GNB_TRACKING_AREA_CODE_IDX].uptr; + f1Setup->cell[k].mcc = *PLMNParamList.paramarray[k][GNB_MOBILE_COUNTRY_CODE_IDX].uptr; + f1Setup->cell[k].mnc = *PLMNParamList.paramarray[k][GNB_MOBILE_NETWORK_CODE_IDX].uptr; + f1Setup->cell[k].mnc_digit_length = *PLMNParamList.paramarray[k][GNB_MNC_DIGIT_LENGTH].u8ptr; AssertFatal((f1Setup->cell[k].mnc_digit_length == 2) || (f1Setup->cell[k].mnc_digit_length == 3), "BAD MNC DIGIT LENGTH %d", 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, + "F1AP: gNB idx %d gNB_DU_id %ld, gNB_DU_name %s, TAC %d MCC/MNC/length %d/%d/%d cellID %ld\n", + k, + f1Setup->gNB_DU_id, + f1Setup->gNB_DU_name, + f1Setup->cell[k].tac, + f1Setup->cell[k].mcc, + f1Setup->cell[k].mnc, + f1Setup->cell[k].mnc_digit_length, + f1Setup->cell[k].nr_cellid); F1AP_DU_REGISTER_REQ(msg_p).net_config = read_DU_IP_config(&RC.nrmac[k]->eth_params_n); From d8276eed3e011e88ff2ae93e588ee041014fdfca Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 17 Jul 2023 12:22:42 +0200 Subject: [PATCH 17/63] F1AP: harmonize f1ap_plmn_t type in all messages --- openair2/COMMON/f1ap_messages_types.h | 48 ++++++------------- openair2/F1AP/f1ap_common.h | 2 +- openair2/F1AP/f1ap_cu_interface_management.c | 10 ++-- openair2/F1AP/f1ap_cu_paging.c | 3 +- openair2/F1AP/f1ap_cu_ue_context_management.c | 3 +- openair2/F1AP/f1ap_du_interface_management.c | 38 ++++++++++----- openair2/F1AP/f1ap_du_ue_context_management.c | 6 +-- openair2/GNB_APP/gnb_config.c | 46 ++++++++++-------- .../LAYER2/NR_MAC_gNB/mac_rrc_ul_direct.c | 4 +- openair2/RRC/NR/rrc_gNB.c | 34 ++++++------- openair2/RRC/NR/rrc_gNB_NGAP.c | 6 +-- 11 files changed, 101 insertions(+), 99 deletions(-) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index 2e1fd7e9ad..45564b1518 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -84,21 +84,21 @@ typedef struct f1ap_net_config_t { uint16_t DUport; } f1ap_net_config_t; -typedef struct cellIDs_s { +typedef struct f1ap_plmn_t { + uint16_t mcc; + uint16_t mnc; + uint8_t mnc_digit_length; +} f1ap_plmn_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 CGI + f1ap_plmn_t plmn; + uint64_t nr_cellid; // NR Global Cell Id - // 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) @@ -181,12 +181,7 @@ typedef struct f1ap_du_register_req_t { } f1ap_du_register_req_t; typedef struct served_cells_to_activate_s { - /// mcc of DU cells - uint16_t mcc; - /// mnc of DU cells - uint16_t mnc; - /// mnc digit length of DU cells - uint8_t mnc_digit_length; + f1ap_plmn_t plmn; // NR Global Cell Id uint64_t nr_cellid; /// NRPCI @@ -243,9 +238,7 @@ typedef struct f1ap_setup_failure_s { typedef struct f1ap_gnb_cu_configuration_update_acknowledge_s { uint16_t num_cells_failed_to_be_activated; - uint16_t mcc[F1AP_MAX_NB_CELLS]; - uint16_t mnc[F1AP_MAX_NB_CELLS]; - uint8_t mnc_digit_length[F1AP_MAX_NB_CELLS]; + f1ap_plmn_t plmn[F1AP_MAX_NB_CELLS]; uint64_t nr_cellid[F1AP_MAX_NB_CELLS]; uint16_t cause[F1AP_MAX_NB_CELLS]; int have_criticality; @@ -258,9 +251,7 @@ typedef struct f1ap_gnb_cu_configuration_update_acknowledge_s { uint16_t cause_failed[F1AP_MAX_NO_OF_TNL_ASSOCIATIONS]; uint16_t noofDedicatedSIDeliveryNeededUEs; uint32_t gNB_CU_ue_id[F1AP_MAX_NO_UE_ID]; - uint16_t ue_mcc[F1AP_MAX_NO_UE_ID]; - uint16_t ue_mnc[F1AP_MAX_NO_UE_ID]; - uint8_t ue_mnc_digit_length[F1AP_MAX_NO_UE_ID]; + f1ap_plmn_t ue_plmn[F1AP_MAX_NO_UE_ID]; uint64_t ue_nr_cellid[F1AP_MAX_NO_UE_ID]; } f1ap_gnb_cu_configuration_update_acknowledge_t; @@ -288,12 +279,7 @@ typedef struct f1ap_dl_rrc_message_s { typedef struct f1ap_initial_ul_rrc_message_s { uint32_t gNB_DU_ue_id; - /// mcc of DU cell - uint16_t mcc; - /// mnc of DU cell - uint16_t mnc; - /// mnc digit length of DU cells - uint8_t mnc_digit_length; + f1ap_plmn_t plmn; /// nr cell id uint64_t nr_cellid; /// crnti @@ -369,9 +355,7 @@ typedef struct f1ap_ue_context_setup_s { uint32_t gNB_CU_ue_id; uint32_t gNB_DU_ue_id; // SpCell Info - uint16_t mcc; - uint16_t mnc; - uint8_t mnc_digit_length; + f1ap_plmn_t plmn; uint64_t nr_cellid; uint8_t servCellIndex; uint8_t *cellULConfigured; @@ -441,9 +425,7 @@ typedef struct f1ap_paging_ind_s { uint16_t ueidentityindexvalue; uint64_t fiveg_s_tmsi; uint8_t fiveg_s_tmsi_length; - uint16_t mcc; - uint16_t mnc; - uint8_t mnc_digit_length; + f1ap_plmn_t plmn; uint64_t nr_cellid; uint8_t paging_drx; } f1ap_paging_ind_t; diff --git a/openair2/F1AP/f1ap_common.h b/openair2/F1AP/f1ap_common.h index ee468ce66a..1329ebdfce 100644 --- a/openair2/F1AP/f1ap_common.h +++ b/openair2/F1AP/f1ap_common.h @@ -421,7 +421,7 @@ void createF1inst(instance_t instanceP, f1ap_setup_req_t *req, f1ap_net_config_t //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, \ + MCC_MNC_TO_PLMNID((servedCelL)->plmn.mcc,(servedCelL)->plmn.mnc,(servedCelL)->plmn.mnc_digit_length, \ &((nRCGi).pLMN_Identity)); \ NR_CELL_ID_TO_BIT_STRING((servedCelL)->nr_cellid, &((nRCGi).nRCellIdentity)); extern RAN_CONTEXT_t RC; diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index fea6a545fc..354b0124c4 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -127,14 +127,16 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, } /* - nRCGI */ - TBCD_TO_MCC_MNC(&(servedCellInformation->nRCGI.pLMN_Identity), req->cell[i].mcc, - req->cell[i].mnc,req->cell[i].mnc_digit_length); + TBCD_TO_MCC_MNC(&(servedCellInformation->nRCGI.pLMN_Identity), + req->cell[i].plmn.mcc, + req->cell[i].plmn.mnc, + req->cell[i].plmn.mnc_digit_length); // NR cellID BIT_STRING_TO_NR_CELL_IDENTITY(&servedCellInformation->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, + req->cell[i].plmn.mcc, + req->cell[i].plmn.mnc, (long long unsigned int)req->cell[i].nr_cellid); /* - nRPCI */ req->cell[i].nr_pci = servedCellInformation->nRPCI; diff --git a/openair2/F1AP/f1ap_cu_paging.c b/openair2/F1AP/f1ap_cu_paging.c index af89f449bc..5175456c4e 100644 --- a/openair2/F1AP/f1ap_cu_paging.c +++ b/openair2/F1AP/f1ap_cu_paging.c @@ -101,8 +101,7 @@ int CU_send_Paging(instance_t instance, f1ap_paging_ind_t *paging) { itemies->criticality = F1AP_Criticality_reject; itemies->value.present = F1AP_PagingCell_ItemIEs__value_PR_PagingCell_Item; F1AP_NRCGI_t *nRCGI = &itemies->value.choice.PagingCell_Item.nRCGI; - MCC_MNC_TO_PLMNID(paging->mcc, paging->mnc, paging->mnc_digit_length, - &nRCGI->pLMN_Identity); + MCC_MNC_TO_PLMNID(paging->plmn.mcc, paging->plmn.mnc, paging->plmn.mnc_digit_length, &nRCGI->pLMN_Identity); NR_CELL_ID_TO_BIT_STRING(paging->nr_cellid, &nRCGI->nRCellIdentity); } diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 1646499c9a..6a96bb62f8 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -963,7 +963,8 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, f1ap_ue_context uint8_t *buffer=NULL; uint32_t len=0; // for test - cellIDs_t hardCoded= { .mcc=208, .mnc=93, .mnc_digit_length=2}; + LOG_W(F1AP, "UE Context Modification Request PLMN is hardcoded!\n"); + cellIDs_t hardCoded= { .plmn.mcc=208, .plmn.mnc=93, .plmn.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 517b2d1dc4..09549bafdd 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -169,7 +169,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance, f1ap_setup_req_t *setup_req) /* servedPLMN information */ asn1cSequenceAdd(served_cell_information->servedPLMNs.list, F1AP_ServedPLMNs_Item_t,servedPLMN_item); - MCC_MNC_TO_PLMNID(cell->mcc, cell->mnc, cell->mnc_digit_length, &servedPLMN_item->pLMN_Identity); + MCC_MNC_TO_PLMNID(cell->plmn.mcc, cell->plmn.mnc, cell->plmn.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_ProtocolExtensionContainer_10696P34_t *p = calloc(1, sizeof(*p)); @@ -420,8 +420,10 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, 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"); 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].plmn.mcc, + F1AP_SETUP_RESP(msg_p).cells_to_activate[i].plmn.mnc, + F1AP_SETUP_RESP(msg_p).cells_to_activate[i].plmn.mnc_digit_length); LOG_D(F1AP, "nr_cellId : %x %x %x %x %x\n", cell->nRCGI.nRCellIdentity.buf[0], cell->nRCGI.nRCellIdentity.buf[1], @@ -452,9 +454,13 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, 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); + 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].plmn.mcc, + F1AP_SETUP_RESP(msg_p).cells_to_activate[i].plmn.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++) { F1AP_SibtypetobeupdatedListItem_t *sib_item = gNB_CUSystemInformation->sibtypetobeupdatedlist.list.array[si]; @@ -602,7 +608,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(cell->mcc, cell->mnc, cell->mnc_digit_length, &servedPLMN_item->pLMN_Identity); + MCC_MNC_TO_PLMNID(cell->plmn.mcc, cell->plmn.mnc, cell->plmn.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; LOG_E(F1AP,"Here hardcoded values instead of values from configuration file\n"); @@ -696,7 +702,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(cell->mcc, cell->mnc, cell->mnc_digit_length, &servedPLMN_item->pLMN_Identity); + MCC_MNC_TO_PLMNID(cell->plmn.mcc, cell->plmn.mnc, cell->plmn.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; @@ -847,8 +853,10 @@ int DU_handle_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, 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"); 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].plmn.mcc, + F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p).cells_to_activate[i].plmn.mnc, + F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p).cells_to_activate[i].plmn.mnc_digit_length); LOG_D(F1AP, "nr_cellId : %x %x %x %x %x\n", cell->nRCGI.nRCellIdentity.buf[0], cell->nRCGI.nRCellIdentity.buf[1], @@ -879,9 +887,13 @@ int DU_handle_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, 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); + 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].plmn.mcc, + F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p).cells_to_activate[i].plmn.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++) { F1AP_SibtypetobeupdatedListItem_t *sib_item = gNB_CUSystemInformation->sibtypetobeupdatedlist.list.array[si]; diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index c9cb5ed809..a887c1a812 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -85,9 +85,9 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextSetupRequestIEs_t, ieNet, container, F1AP_ProtocolIE_ID_id_SpCell_ID, true); 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); + f1ap_ue_context_setup_req->plmn.mcc, + f1ap_ue_context_setup_req->plmn.mnc, + f1ap_ue_context_setup_req->plmn.mnc_digit_length); BIT_STRING_TO_NR_CELL_IDENTITY(&ieNet->value.choice.NRCGI.nRCellIdentity, f1ap_ue_context_setup_req->nr_cellid); /* ServCellIndex */ F1AP_UEContextSetupRequestIEs_t *ieCell; diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 63fd341544..3a15191a0e 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -1943,13 +1943,13 @@ int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) { f1Setup->gNB_DU_id = *(GNBParamList.paramarray[k][GNB_GNB_ID_IDX].uptr); f1Setup->gNB_DU_name = strdup(*(GNBParamList.paramarray[k][GNB_GNB_NAME_IDX].strptr)); f1Setup->cell[k].tac = *GNBParamList.paramarray[k][GNB_TRACKING_AREA_CODE_IDX].uptr; - f1Setup->cell[k].mcc = *PLMNParamList.paramarray[k][GNB_MOBILE_COUNTRY_CODE_IDX].uptr; - f1Setup->cell[k].mnc = *PLMNParamList.paramarray[k][GNB_MOBILE_NETWORK_CODE_IDX].uptr; - f1Setup->cell[k].mnc_digit_length = *PLMNParamList.paramarray[k][GNB_MNC_DIGIT_LENGTH].u8ptr; - AssertFatal((f1Setup->cell[k].mnc_digit_length == 2) || - (f1Setup->cell[k].mnc_digit_length == 3), + f1Setup->cell[k].plmn.mcc = *PLMNParamList.paramarray[k][GNB_MOBILE_COUNTRY_CODE_IDX].uptr; + f1Setup->cell[k].plmn.mnc = *PLMNParamList.paramarray[k][GNB_MOBILE_NETWORK_CODE_IDX].uptr; + f1Setup->cell[k].plmn.mnc_digit_length = *PLMNParamList.paramarray[k][GNB_MNC_DIGIT_LENGTH].u8ptr; + AssertFatal((f1Setup->cell[k].plmn.mnc_digit_length == 2) || + (f1Setup->cell[k].plmn.mnc_digit_length == 3), "BAD MNC DIGIT LENGTH %d", - f1Setup->cell[k].mnc_digit_length); + f1Setup->cell[k].plmn.mnc_digit_length); f1Setup->cell[k].nr_cellid = (uint64_t)*(GNBParamList.paramarray[i][GNB_NRCELLID_IDX].u64ptr); LOG_I(GNB_APP, "F1AP: gNB idx %d gNB_DU_id %ld, gNB_DU_name %s, TAC %d MCC/MNC/length %d/%d/%d cellID %ld\n", @@ -1957,9 +1957,9 @@ int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) { f1Setup->gNB_DU_id, f1Setup->gNB_DU_name, f1Setup->cell[k].tac, - f1Setup->cell[k].mcc, - f1Setup->cell[k].mnc, - f1Setup->cell[k].mnc_digit_length, + f1Setup->cell[k].plmn.mcc, + f1Setup->cell[k].plmn.mnc, + f1Setup->cell[k].plmn.mnc_digit_length, f1Setup->cell[k].nr_cellid); F1AP_DU_REGISTER_REQ(msg_p).net_config = read_DU_IP_config(&RC.nrmac[k]->eth_params_n); @@ -1976,8 +1976,8 @@ 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] = f1Setup->cell[k].mcc; - rrc->configuration.mnc[0] = f1Setup->cell[k].mnc; + rrc->configuration.mcc[0] = f1Setup->cell[k].plmn.mcc; + rrc->configuration.mnc[0] = f1Setup->cell[k].plmn.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; @@ -2225,9 +2225,13 @@ int gNB_app_handle_f1ap_setup_resp(f1ap_setup_resp_t *resp) { LOG_I(GNB_APP, "Checking cell %d, rrc inst %d : rrc->nr_cellid %lx, resp->nr_cellid %lx\n", j, i, RC.nrrrc[i]->nr_cellid, resp->cells_to_activate[j].nr_cellid); - if (RC.nrrrc[i]->nr_cellid == resp->cells_to_activate[j].nr_cellid && - (du_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)) { + if (RC.nrrrc[i]->nr_cellid == resp->cells_to_activate[j].nr_cellid + && (du_check_plmn_identity(carrier, + resp->cells_to_activate[j].plmn.mcc, + resp->cells_to_activate[j].plmn.mnc, + resp->cells_to_activate[j].plmn.mnc_digit_length) + > 0 + && resp->cells_to_activate[j].nrpci == carrier->physCellId)) { // copy system information and decode it for (si_ind=0; si_indcells_to_activate[j].num_SI; si_ind++) { @@ -2257,11 +2261,15 @@ int gNB_app_handle_f1ap_gnb_cu_configuration_update(f1ap_gnb_cu_configuration_up LOG_I(GNB_APP, "Checking cell %d, rrc inst %d : rrc->nr_cellid %lx, gnb_cu_cfg_updatenr_cellid %lx\n", j, i, RC.nrrrc[i]->nr_cellid, gnb_cu_cfg_update->cells_to_activate[j].nr_cellid); - if (RC.nrrrc[i]->nr_cellid == gnb_cu_cfg_update->cells_to_activate[j].nr_cellid && - (du_check_plmn_identity(carrier, gnb_cu_cfg_update->cells_to_activate[j].mcc, gnb_cu_cfg_update->cells_to_activate[j].mnc, gnb_cu_cfg_update->cells_to_activate[j].mnc_digit_length)>0 && - gnb_cu_cfg_update->cells_to_activate[j].nrpci == carrier->physCellId)) { - // copy system information and decode it - for (si_ind=0; si_indcells_to_activate[j].num_SI; si_ind++) { + if (RC.nrrrc[i]->nr_cellid == gnb_cu_cfg_update->cells_to_activate[j].nr_cellid + && (du_check_plmn_identity(carrier, + gnb_cu_cfg_update->cells_to_activate[j].plmn.mcc, + gnb_cu_cfg_update->cells_to_activate[j].plmn.mnc, + gnb_cu_cfg_update->cells_to_activate[j].plmn.mnc_digit_length) + > 0 + && gnb_cu_cfg_update->cells_to_activate[j].nrpci == carrier->physCellId)) { + // copy system information and decode it + for (si_ind = 0; si_ind < gnb_cu_cfg_update->cells_to_activate[j].num_SI; si_ind++) { du_extract_and_decode_SI(i, si_ind, diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_direct.c b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_direct.c index dab70b5e82..299c5cb24a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_direct.c +++ b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_direct.c @@ -64,9 +64,7 @@ static void ue_context_modification_response_direct(const f1ap_ue_context_modif_ f1ap_msg->gNB_CU_ue_id = resp->gNB_CU_ue_id; f1ap_msg->gNB_DU_ue_id = resp->gNB_DU_ue_id; - f1ap_msg->mcc = resp->mcc; - f1ap_msg->mnc = resp->mnc; - f1ap_msg->mnc_digit_length = resp->mnc_digit_length; + f1ap_msg->plmn = resp->plmn; f1ap_msg->nr_cellid = resp->nr_cellid; f1ap_msg->servCellIndex = resp->servCellIndex; AssertFatal(resp->cellULConfigured == NULL, "not handled\n"); diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 2e4c46983f..969ca6c44a 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -1701,9 +1701,9 @@ static void handle_rrcReconfigurationComplete(const protocol_ctxt_t *const ctxt_ f1ap_ue_context_modif_req_t ue_context_modif_req = { .gNB_CU_ue_id = UE->rrc_ue_id, .gNB_DU_ue_id = ue_data.secondary_ue, - .mcc = rrc->configuration.mcc[0], - .mnc = rrc->configuration.mnc[0], - .mnc_digit_length = rrc->configuration.mnc_digit_length[0], + .plmn.mcc = rrc->configuration.mcc[0], + .plmn.mnc = rrc->configuration.mnc[0], + .plmn.mnc_digit_length = rrc->configuration.mnc_digit_length[0], .nr_cellid = rrc->nr_cellid, .servCellId = 0, /* TODO: correct value? */ .ReconfigComplOutcome = successful_reconfig ? RRCreconf_success : RRCreconf_failure, @@ -1867,8 +1867,8 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) { for (int j=0; jconfiguration.mcc[0] == f1_setup_req->cell[i].mcc && - rrc->configuration.mnc[0] == f1_setup_req->cell[i].mnc && + if (rrc->configuration.mcc[0] == f1_setup_req->cell[i].plmn.mcc && + rrc->configuration.mnc[0] == f1_setup_req->cell[i].plmn.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; @@ -1905,10 +1905,10 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) { rrc->carrier.physCellId = f1_setup_req->cell[i].nr_pci; 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]; - 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].plmn.mcc = rrc->configuration.mcc[0]; + F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p2).cells_to_activate[cu_cell_ind].plmn.mnc = rrc->configuration.mnc[0]; + F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p2).cells_to_activate[cu_cell_ind].plmn.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->cell[i].nr_pci; int num_SI= 0; @@ -1925,8 +1925,8 @@ 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->cell[i].mcc, - rrc->configuration.mnc[0], f1_setup_req->cell[i].mnc, + j, rrc->configuration.mcc[0], f1_setup_req->cell[i].plmn.mcc, + rrc->configuration.mnc[0], f1_setup_req->cell[i].plmn.mnc, rrc->nr_cellid, f1_setup_req->cell[i].nr_cellid); } }// for (int j=0;jrrc_ue_id, .gNB_DU_ue_id = ue_data.secondary_ue, - .mcc = rrc->configuration.mcc[0], - .mnc = rrc->configuration.mnc[0], - .mnc_digit_length = rrc->configuration.mnc_digit_length[0], + .plmn.mcc = rrc->configuration.mcc[0], + .plmn.mnc = rrc->configuration.mnc[0], + .plmn.mnc_digit_length = rrc->configuration.mnc_digit_length[0], .nr_cellid = rrc->nr_cellid, .servCellId = 0, /* TODO: correct value? */ .srbs_to_be_setup_length = nb_srb, @@ -2741,9 +2741,9 @@ rrc_gNB_generate_SecurityModeCommand( f1ap_ue_context_setup_t ue_context_setup_req = { .gNB_CU_ue_id = ue_p->rrc_ue_id, .gNB_DU_ue_id = ue_data.secondary_ue, - .mcc = rrc->configuration.mcc[0], - .mnc = rrc->configuration.mnc[0], - .mnc_digit_length = rrc->configuration.mnc_digit_length[0], + .plmn.mcc = rrc->configuration.mcc[0], + .plmn.mnc = rrc->configuration.mnc[0], + .plmn.mnc_digit_length = rrc->configuration.mnc_digit_length[0], .nr_cellid = rrc->nr_cellid, .servCellId = 0, /* TODO: correct value? */ .srbs_to_be_setup = 0, /* no new SRBs */ diff --git a/openair2/RRC/NR/rrc_gNB_NGAP.c b/openair2/RRC/NR/rrc_gNB_NGAP.c index 8a9a08abd7..d2313761dd 100644 --- a/openair2/RRC/NR/rrc_gNB_NGAP.c +++ b/openair2/RRC/NR/rrc_gNB_NGAP.c @@ -1333,9 +1333,9 @@ int rrc_gNB_process_PAGING_IND(MessageDef *msg_p, instance_t instance) for (uint8_t CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { if (NODE_IS_CU(RC.nrrrc[instance]->node_type)) { MessageDef *m = itti_alloc_new_message(TASK_RRC_GNB, 0, F1AP_PAGING_IND); - F1AP_PAGING_IND (m).mcc = RC.nrrrc[j]->configuration.mcc[0]; - F1AP_PAGING_IND (m).mnc = RC.nrrrc[j]->configuration.mnc[0]; - F1AP_PAGING_IND (m).mnc_digit_length = RC.nrrrc[j]->configuration.mnc_digit_length[0]; + F1AP_PAGING_IND(m).plmn.mcc = RC.nrrrc[j]->configuration.mcc[0]; + F1AP_PAGING_IND(m).plmn.mnc = RC.nrrrc[j]->configuration.mnc[0]; + F1AP_PAGING_IND(m).plmn.mnc_digit_length = RC.nrrrc[j]->configuration.mnc_digit_length[0]; F1AP_PAGING_IND (m).nr_cellid = RC.nrrrc[j]->nr_cellid; F1AP_PAGING_IND (m).ueidentityindexvalue = (uint16_t)(NGAP_PAGING_IND(msg_p).ue_paging_identity.s_tmsi.m_tmsi%1024); F1AP_PAGING_IND (m).fiveg_s_tmsi = NGAP_PAGING_IND(msg_p).ue_paging_identity.s_tmsi.m_tmsi; From 3dbcadf24419aecb16e2d4574a94357c0652142a Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 17 Jul 2023 13:47:07 +0200 Subject: [PATCH 18/63] Refactor F1 Setup Req: TAC is optional --- openair2/COMMON/f1ap_messages_types.h | 2 +- openair2/F1AP/f1ap_cu_interface_management.c | 6 ++++-- openair2/F1AP/f1ap_du_interface_management.c | 16 ++++++++++------ openair2/GNB_APP/gnb_config.c | 8 +++++--- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index 45564b1518..9ea3a02e00 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -93,7 +93,7 @@ typedef struct f1ap_plmn_t { typedef struct cellIDs_s { // Served Cell Information /* Tracking area code */ - uint32_t tac; + uint32_t *tac; // NR CGI f1ap_plmn_t plmn; diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index 354b0124c4..76f4235474 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -122,8 +122,10 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, F1AP_Served_Cell_Information_t *servedCellInformation= &served_cells_item->served_Cell_Information; /* tac */ if (servedCellInformation->fiveGS_TAC) { - OCTET_STRING_TO_INT16(servedCellInformation->fiveGS_TAC, req->cell[i].tac); - LOG_D(F1AP, "req->tac[%d] %d \n", i, req->cell[i].tac); + req->cell[i].tac = malloc(sizeof(*req->cell[i].tac)); + AssertFatal(req->cell[i].tac != NULL, "out of memory\n"); + OCTET_STRING_TO_INT16(servedCellInformation->fiveGS_TAC, *req->cell[i].tac); + LOG_D(F1AP, "req->tac[%d] %d \n", i, *req->cell[i].tac); } /* - nRCGI */ diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index 09549bafdd..a993d80eff 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -157,9 +157,11 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance, f1ap_setup_req_t *setup_req) /* - nRPCI */ served_cell_information->nRPCI = cell->nr_pci; // int 0..1007 /* - fiveGS_TAC */ - uint32_t tac=htonl(cell->tac); - asn1cCalloc(served_cell_information->fiveGS_TAC, netOrder); - OCTET_STRING_fromBuf(netOrder, ((char *)&tac)+1, 3); + if (cell->tac != NULL) { + uint32_t tac=htonl(*cell->tac); + asn1cCalloc(served_cell_information->fiveGS_TAC, netOrder); + OCTET_STRING_fromBuf(netOrder, ((char *)&tac)+1, 3); + } /* - Configured_EPS_TAC */ if(0) { @@ -597,9 +599,11 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, cellIDs_t *cell = &f1ap_setup_req->cell[j]; served_cell_information->nRPCI = cell->nr_pci; // int 0..1007 /* - fiveGS_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); + if (cell->tac != NULL) { + uint32_t tac = htonl(*cell->tac); + served_cell_information->fiveGS_TAC = calloc(1, sizeof(*served_cell_information->fiveGS_TAC)); + OCTET_STRING_fromBuf(served_cell_information->fiveGS_TAC, ((char *)&tac)+1, 3); + } /* - Configured_EPS_TAC */ if(1) { diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 3a15191a0e..d4fa30d72f 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -1942,7 +1942,9 @@ int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) { f1Setup->num_cells_available++; f1Setup->gNB_DU_id = *(GNBParamList.paramarray[k][GNB_GNB_ID_IDX].uptr); f1Setup->gNB_DU_name = strdup(*(GNBParamList.paramarray[k][GNB_GNB_NAME_IDX].strptr)); - f1Setup->cell[k].tac = *GNBParamList.paramarray[k][GNB_TRACKING_AREA_CODE_IDX].uptr; + f1Setup->cell[k].tac = malloc(sizeof(*f1Setup->cell[k].tac)); + AssertFatal(f1Setup->cell[k].tac != NULL, "out of memory\n"); + *f1Setup->cell[k].tac = *GNBParamList.paramarray[k][GNB_TRACKING_AREA_CODE_IDX].uptr; f1Setup->cell[k].plmn.mcc = *PLMNParamList.paramarray[k][GNB_MOBILE_COUNTRY_CODE_IDX].uptr; f1Setup->cell[k].plmn.mnc = *PLMNParamList.paramarray[k][GNB_MOBILE_NETWORK_CODE_IDX].uptr; f1Setup->cell[k].plmn.mnc_digit_length = *PLMNParamList.paramarray[k][GNB_MNC_DIGIT_LENGTH].u8ptr; @@ -1956,7 +1958,7 @@ int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) { k, f1Setup->gNB_DU_id, f1Setup->gNB_DU_name, - f1Setup->cell[k].tac, + *f1Setup->cell[k].tac, f1Setup->cell[k].plmn.mcc, f1Setup->cell[k].plmn.mnc, f1Setup->cell[k].plmn.mnc_digit_length, @@ -1978,7 +1980,7 @@ int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) { rrc->configuration.mcc[0] = f1Setup->cell[k].plmn.mcc; rrc->configuration.mnc[0] = f1Setup->cell[k].plmn.mnc; - rrc->configuration.tac = f1Setup->cell[k].tac; + 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; From 7456cf945d24a2867ee3c78e8973c5170d8a2c12 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 17 Jul 2023 13:56:19 +0200 Subject: [PATCH 19/63] Refactor F1 Setup Req: Reorganize cellIDs_t and rename to f1ap_served_cell_info_t --- openair2/COMMON/f1ap_messages_types.h | 17 ++++---- openair2/F1AP/f1ap_cu_interface_management.c | 26 ++++++------ openair2/F1AP/f1ap_cu_ue_context_management.c | 2 +- openair2/F1AP/f1ap_du_interface_management.c | 16 +++---- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 2 +- openair2/F1AP/f1ap_du_ue_context_management.c | 4 +- openair2/GNB_APP/gnb_config.c | 42 +++++++++---------- openair2/RRC/NR/rrc_gNB.c | 16 +++---- 8 files changed, 64 insertions(+), 61 deletions(-) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index 9ea3a02e00..7cc5b6ca01 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -90,22 +90,22 @@ typedef struct f1ap_plmn_t { uint8_t mnc_digit_length; } f1ap_plmn_t; -typedef struct cellIDs_s { - // Served Cell Information - /* Tracking area code */ - uint32_t *tac; - +typedef struct f1ap_served_cell_info_t { // NR CGI f1ap_plmn_t plmn; uint64_t nr_cellid; // NR Global Cell Id // NR Physical Cell Ids uint16_t nr_pci; + + /* Tracking area code */ + uint32_t *tac; + // 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; +} f1ap_served_cell_info_t; typedef struct f1ap_setup_req_s { @@ -115,7 +115,10 @@ typedef struct f1ap_setup_req_s { /// number of DU cells available uint16_t num_cells_available; //0< num_cells_available <= 512; - cellIDs_t cell[F1AP_MAX_NB_CELLS]; + struct { + f1ap_served_cell_info_t info; + } cell[F1AP_MAX_NB_CELLS]; + // fdd_flag = 1 means FDD, 0 means TDD int fdd_flag; diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index 76f4235474..e0e4c90f45 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -122,27 +122,27 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, F1AP_Served_Cell_Information_t *servedCellInformation= &served_cells_item->served_Cell_Information; /* tac */ if (servedCellInformation->fiveGS_TAC) { - req->cell[i].tac = malloc(sizeof(*req->cell[i].tac)); - AssertFatal(req->cell[i].tac != NULL, "out of memory\n"); - OCTET_STRING_TO_INT16(servedCellInformation->fiveGS_TAC, *req->cell[i].tac); - LOG_D(F1AP, "req->tac[%d] %d \n", i, *req->cell[i].tac); + req->cell[i].info.tac = malloc(sizeof(*req->cell[i].info.tac)); + AssertFatal(req->cell[i].info.tac != NULL, "out of memory\n"); + OCTET_STRING_TO_INT16(servedCellInformation->fiveGS_TAC, *req->cell[i].info.tac); + LOG_D(F1AP, "req->tac[%d] %d \n", i, *req->cell[i].info.tac); } /* - nRCGI */ TBCD_TO_MCC_MNC(&(servedCellInformation->nRCGI.pLMN_Identity), - req->cell[i].plmn.mcc, - req->cell[i].plmn.mnc, - req->cell[i].plmn.mnc_digit_length); + req->cell[i].info.plmn.mcc, + req->cell[i].info.plmn.mnc, + req->cell[i].info.plmn.mnc_digit_length); // NR cellID BIT_STRING_TO_NR_CELL_IDENTITY(&servedCellInformation->nRCGI.nRCellIdentity, - req->cell[i].nr_cellid); + req->cell[i].info.nr_cellid); LOG_D(F1AP, "[SCTP %d] Received nRCGI: MCC %d, MNC %d, CELL_ID %llu\n", assoc_id, - req->cell[i].plmn.mcc, - req->cell[i].plmn.mnc, - (long long unsigned int)req->cell[i].nr_cellid); + req->cell[i].info.plmn.mcc, + req->cell[i].info.plmn.mnc, + (long long unsigned int)req->cell[i].info.nr_cellid); /* - nRPCI */ - req->cell[i].nr_pci = servedCellInformation->nRPCI; - LOG_D(F1AP, "req->nr_pci[%d] %d \n", i, req->cell[i].nr_pci); + req->cell[i].info.nr_pci = servedCellInformation->nRPCI; + LOG_D(F1AP, "req->nr_pci[%d] %d \n", i, req->cell[i].info.nr_pci); // FDD Cells if (servedCellInformation->nR_Mode_Info.present==F1AP_NR_Mode_Info_PR_fDD) { diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index 6a96bb62f8..f4c1042cad 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -964,7 +964,7 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, f1ap_ue_context uint32_t len=0; // for test LOG_W(F1AP, "UE Context Modification Request PLMN is hardcoded!\n"); - cellIDs_t hardCoded= { .plmn.mcc=208, .plmn.mnc=93, .plmn.mnc_digit_length=2}; + f1ap_served_cell_info_t hardCoded= { .plmn.mcc=208, .plmn.mnc=93, .plmn.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 a993d80eff..9b1276285d 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -144,7 +144,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance, f1ap_setup_req_t *setup_req) for (int i=0; icell[i]; + f1ap_served_cell_info_t *cell = &setup_req->cell[i].info; 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; @@ -153,7 +153,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance, f1ap_setup_req_t *setup_req) 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,cell); + addnRCGI(served_cell_information->nRCGI, cell); /* - nRPCI */ served_cell_information->nRPCI = cell->nr_pci; // int 0..1007 /* - fiveGS_TAC */ @@ -593,10 +593,10 @@ 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].info); /* - nRPCI */ /* 2.1.1 serverd cell Information */ - cellIDs_t *cell = &f1ap_setup_req->cell[j]; + f1ap_served_cell_info_t *cell = &f1ap_setup_req->cell[j].info; served_cell_information->nRPCI = cell->nr_pci; // int 0..1007 /* - fiveGS_TAC */ if (cell->tac != NULL) { @@ -677,7 +677,7 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, for (int i=0; i<1; i++) { // - cellIDs_t *cell = &f1ap_setup_req->cell[i]; + f1ap_served_cell_info_t *cell = &f1ap_setup_req->cell[i].info; 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; @@ -690,11 +690,11 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, /* - nRCGI */ //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 + served_cell_information->nRPCI = cell->nr_pci; // int 0..1007 /* - fiveGS_TAC */ asn1cCalloc(served_cell_information->fiveGS_TAC, tac ); OCTET_STRING_fromBuf(tac, - (const char *) &f1ap_setup_req->cell[i].tac, + (const char *) &cell->tac, 3); /* - Configured_EPS_TAC */ @@ -777,7 +777,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 */ - addnRCGI(served_cells_to_delete_item->oldNRCGI, &f1ap_setup_req->cell[i]); + addnRCGI(served_cells_to_delete_item->oldNRCGI, &f1ap_setup_req->cell[i].info); } if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index 48ca7aa201..e30f26fc6c 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -172,7 +172,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instanceP, const f1ap_ini ie2->criticality = F1AP_Criticality_reject; ie2->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_NRCGI; //Fixme: takes always the first cell - addnRCGI(ie2->value.choice.NRCGI, getCxt(instanceP)->setupReq.cell); + addnRCGI(ie2->value.choice.NRCGI, &getCxt(instanceP)->setupReq.cell[0].info); /* mandatory */ /* c3. C_RNTI */ // 16 asn1cSequenceAdd(out->protocolIEs.list, F1AP_InitialULRRCMessageTransferIEs_t, ie3); diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index a887c1a812..08c4d6e27b 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -459,7 +459,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup &sCell_FailedtoSetup_item_ies->value.choice.SCell_FailedtoSetup_Item; /* sCell_ID */ AssertFatal(false, "handle correct CellID\n"); - cellIDs_t cellID = {0}; + f1ap_served_cell_info_t cellID = {0}; addnRCGI(sCell_FailedtoSetup_item->sCell_ID, &cellID); /* cause */ asn1cCalloc(sCell_FailedtoSetup_item->cause, tmp); @@ -1158,7 +1158,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance, f1ap_ue_contex /* 8.1 SCell_ToBeSetup_Item */ F1AP_SCell_FailedtoSetupMod_Item_t *scell_failedtoSetupMod_item=&scell_failedtoSetupMod_item_ies->value.choice.SCell_FailedtoSetupMod_Item; /* - sCell_ID */ - addnRCGI(scell_failedtoSetupMod_item->sCell_ID, &getCxt(instance)->setupReq.cell[i]); + addnRCGI(scell_failedtoSetupMod_item->sCell_ID, &getCxt(instance)->setupReq.cell[i].info); 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; diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index d4fa30d72f..2e84b56bc3 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -1942,27 +1942,27 @@ int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) { f1Setup->num_cells_available++; f1Setup->gNB_DU_id = *(GNBParamList.paramarray[k][GNB_GNB_ID_IDX].uptr); f1Setup->gNB_DU_name = strdup(*(GNBParamList.paramarray[k][GNB_GNB_NAME_IDX].strptr)); - f1Setup->cell[k].tac = malloc(sizeof(*f1Setup->cell[k].tac)); - AssertFatal(f1Setup->cell[k].tac != NULL, "out of memory\n"); - *f1Setup->cell[k].tac = *GNBParamList.paramarray[k][GNB_TRACKING_AREA_CODE_IDX].uptr; - f1Setup->cell[k].plmn.mcc = *PLMNParamList.paramarray[k][GNB_MOBILE_COUNTRY_CODE_IDX].uptr; - f1Setup->cell[k].plmn.mnc = *PLMNParamList.paramarray[k][GNB_MOBILE_NETWORK_CODE_IDX].uptr; - f1Setup->cell[k].plmn.mnc_digit_length = *PLMNParamList.paramarray[k][GNB_MNC_DIGIT_LENGTH].u8ptr; - AssertFatal((f1Setup->cell[k].plmn.mnc_digit_length == 2) || - (f1Setup->cell[k].plmn.mnc_digit_length == 3), + f1Setup->cell[k].info.tac = malloc(sizeof(*f1Setup->cell[k].info.tac)); + AssertFatal(f1Setup->cell[k].info.tac != NULL, "out of memory\n"); + *f1Setup->cell[k].info.tac = *GNBParamList.paramarray[k][GNB_TRACKING_AREA_CODE_IDX].uptr; + f1Setup->cell[k].info.plmn.mcc = *PLMNParamList.paramarray[k][GNB_MOBILE_COUNTRY_CODE_IDX].uptr; + f1Setup->cell[k].info.plmn.mnc = *PLMNParamList.paramarray[k][GNB_MOBILE_NETWORK_CODE_IDX].uptr; + f1Setup->cell[k].info.plmn.mnc_digit_length = *PLMNParamList.paramarray[k][GNB_MNC_DIGIT_LENGTH].u8ptr; + AssertFatal((f1Setup->cell[k].info.plmn.mnc_digit_length == 2) || + (f1Setup->cell[k].info.plmn.mnc_digit_length == 3), "BAD MNC DIGIT LENGTH %d", - f1Setup->cell[k].plmn.mnc_digit_length); - f1Setup->cell[k].nr_cellid = (uint64_t)*(GNBParamList.paramarray[i][GNB_NRCELLID_IDX].u64ptr); + f1Setup->cell[k].info.plmn.mnc_digit_length); + f1Setup->cell[k].info.nr_cellid = (uint64_t)*(GNBParamList.paramarray[i][GNB_NRCELLID_IDX].u64ptr); LOG_I(GNB_APP, "F1AP: gNB idx %d gNB_DU_id %ld, gNB_DU_name %s, TAC %d MCC/MNC/length %d/%d/%d cellID %ld\n", k, f1Setup->gNB_DU_id, f1Setup->gNB_DU_name, - *f1Setup->cell[k].tac, - f1Setup->cell[k].plmn.mcc, - f1Setup->cell[k].plmn.mnc, - f1Setup->cell[k].plmn.mnc_digit_length, - f1Setup->cell[k].nr_cellid); + *f1Setup->cell[k].info.tac, + f1Setup->cell[k].info.plmn.mcc, + f1Setup->cell[k].info.plmn.mnc, + f1Setup->cell[k].info.plmn.mnc_digit_length, + f1Setup->cell[k].info.nr_cellid); F1AP_DU_REGISTER_REQ(msg_p).net_config = read_DU_IP_config(&RC.nrmac[k]->eth_params_n); @@ -1978,12 +1978,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] = f1Setup->cell[k].plmn.mcc; - rrc->configuration.mnc[0] = f1Setup->cell[k].plmn.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; + rrc->configuration.mcc[0] = f1Setup->cell[k].info.plmn.mcc; + rrc->configuration.mnc[0] = f1Setup->cell[k].info.plmn.mnc; + rrc->configuration.tac = *f1Setup->cell[k].info.tac; + rrc->nr_cellid = f1Setup->cell[k].info.nr_cellid; + f1Setup->cell[k].info.nr_pci = *rrc->configuration.scc->physCellId; + f1Setup->cell[k].info.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/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 969ca6c44a..5f57ed6d31 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -1867,9 +1867,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->cell[i].plmn.mcc && - rrc->configuration.mnc[0] == f1_setup_req->cell[i].plmn.mnc && - rrc->nr_cellid == f1_setup_req->cell[i].nr_cellid) { + if (rrc->configuration.mcc[0] == f1_setup_req->cell[i].info.plmn.mcc && + rrc->configuration.mnc[0] == f1_setup_req->cell[i].info.plmn.mnc && + rrc->nr_cellid == f1_setup_req->cell[i].info.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) @@ -1902,14 +1902,14 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) { xer_fprint(stdout, &asn_DEF_NR_SIB1,(void *)rrc->carrier.sib1); } - rrc->carrier.physCellId = f1_setup_req->cell[i].nr_pci; + rrc->carrier.physCellId = f1_setup_req->cell[i].info.nr_pci; 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].plmn.mcc = rrc->configuration.mcc[0]; F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p2).cells_to_activate[cu_cell_ind].plmn.mnc = rrc->configuration.mnc[0]; F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p2).cells_to_activate[cu_cell_ind].plmn.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->cell[i].nr_pci; + F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].nrpci = f1_setup_req->cell[i].info.nr_pci; int num_SI= 0; if (rrc->carrier.SIB23) { @@ -1925,9 +1925,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->cell[i].plmn.mcc, - rrc->configuration.mnc[0], f1_setup_req->cell[i].plmn.mnc, - rrc->nr_cellid, f1_setup_req->cell[i].nr_cellid); + j, rrc->configuration.mcc[0], f1_setup_req->cell[i].info.plmn.mcc, + rrc->configuration.mnc[0], f1_setup_req->cell[i].info.plmn.mnc, + rrc->nr_cellid, f1_setup_req->cell[i].info.nr_cellid); } }// for (int j=0;j Date: Mon, 17 Jul 2023 16:49:40 +0200 Subject: [PATCH 20/63] Refactor F1 Setup Req: Move radio info into cell --- openair2/COMMON/f1ap_messages_types.h | 76 ++++++-------- openair2/F1AP/f1ap_cu_interface_management.c | 68 ++++++------- openair2/F1AP/f1ap_du_interface_management.c | 102 ++++++------------- openair2/GNB_APP/gnb_config.c | 42 +++----- 4 files changed, 108 insertions(+), 180 deletions(-) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index 7cc5b6ca01..b003b46b3d 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -90,6 +90,30 @@ typedef struct f1ap_plmn_t { uint8_t mnc_digit_length; } f1ap_plmn_t; +typedef enum f1ap_mode_t { F1AP_MODE_TDD = 0, F1AP_MODE_FDD = 1 } f1ap_mode_t; + +typedef struct f1ap_nr_frequency_info_t { + uint32_t arfcn; + int band; +} f1ap_nr_frequency_info_t; + +typedef struct f1ap_transmission_bandwidth_t { + uint8_t scs; + uint16_t nrb; +} f1ap_transmission_bandwidth_t; + +typedef struct f1ap_fdd_info_t { + f1ap_nr_frequency_info_t ul_freqinfo; + f1ap_nr_frequency_info_t dl_freqinfo; + f1ap_transmission_bandwidth_t ul_tbw; + f1ap_transmission_bandwidth_t dl_tbw; +} f1ap_fdd_info_t; + +typedef struct f1ap_tdd_info_t { + f1ap_nr_frequency_info_t freqinfo; + f1ap_transmission_bandwidth_t tbw; +} f1ap_tdd_info_t; + typedef struct f1ap_served_cell_info_t { // NR CGI f1ap_plmn_t plmn; @@ -105,6 +129,12 @@ typedef struct f1ap_served_cell_info_t { uint16_t num_ssi; uint8_t sst; uint8_t sd; + + f1ap_mode_t mode; + union { + f1ap_fdd_info_t fdd; + f1ap_tdd_info_t tdd; + }; } f1ap_served_cell_info_t; typedef struct f1ap_setup_req_s { @@ -119,52 +149,6 @@ typedef struct f1ap_setup_req_s { f1ap_served_cell_info_t info; } cell[F1AP_MAX_NB_CELLS]; - // fdd_flag = 1 means FDD, 0 means TDD - int fdd_flag; - - union { - struct fdd_s { - uint32_t ul_nr_arfcn; - uint8_t ul_scs; - uint16_t ul_nrb; - - uint32_t dl_nr_arfcn; - uint8_t dl_scs; - uint16_t dl_nrb; - - uint32_t sul_active; - uint32_t sul_nr_arfcn; - uint8_t sul_scs; - uint16_t sul_nrb; - - uint8_t ul_num_frequency_bands; - uint16_t ul_nr_band[32]; - uint8_t ul_num_sul_frequency_bands; - uint16_t ul_nr_sul_band[32]; - - uint8_t dl_num_frequency_bands; - uint16_t dl_nr_band[32]; - uint8_t dl_num_sul_frequency_bands; - uint16_t dl_nr_sul_band[32]; - } fdd; - struct tdd_s { - - uint32_t nr_arfcn; - uint8_t scs; - uint16_t nrb; - - uint32_t sul_active; - uint32_t sul_nr_arfcn; - uint8_t sul_scs; - uint16_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]; char *measurement_timing_information[F1AP_MAX_NB_CELLS]; uint8_t ranac[F1AP_MAX_NB_CELLS]; diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index e0e4c90f45..5ac722f629 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -146,53 +146,45 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, // FDD Cells if (servedCellInformation->nR_Mode_Info.present==F1AP_NR_Mode_Info_PR_fDD) { - struct fdd_s *FDDs=&req->nr_mode_info[i].fdd; + req->cell[i].info.mode = F1AP_MODE_FDD; + f1ap_fdd_info_t *FDDs = &req->cell[i].info.fdd; F1AP_FDD_Info_t * fDD_Info=servedCellInformation->nR_Mode_Info.choice.fDD; - FDDs->ul_nr_arfcn=fDD_Info->uL_NRFreqInfo.nRARFCN; - FDDs->ul_num_frequency_bands=fDD_Info->uL_NRFreqInfo.freqBandListNr.list.count; + FDDs->ul_freqinfo.arfcn = fDD_Info->uL_NRFreqInfo.nRARFCN; + AssertFatal(fDD_Info->uL_NRFreqInfo.freqBandListNr.list.count == 1, "cannot handle more than one frequency band\n"); for (int f=0; f < fDD_Info->uL_NRFreqInfo.freqBandListNr.list.count; f++) { - F1AP_FreqBandNrItem_t * FreqItem=fDD_Info->uL_NRFreqInfo.freqBandListNr.list.array[f]; - FDDs->ul_nr_band[f]=FreqItem->freqBandIndicatorNr; - int num_available_supported_SULBands=FreqItem->supportedSULBandList.list.count; - for (int sul=0; sul < num_available_supported_SULBands; sul ++ ) { - F1AP_SupportedSULFreqBandItem_t * SulItem= FreqItem->supportedSULBandList.list.array[sul]; - FDDs->ul_nr_sul_band[sul]=SulItem->freqBandIndicatorNr; - } + F1AP_FreqBandNrItem_t * FreqItem=fDD_Info->uL_NRFreqInfo.freqBandListNr.list.array[f]; + FDDs->ul_freqinfo.band = FreqItem->freqBandIndicatorNr; + AssertFatal(FreqItem->supportedSULBandList.list.count == 0, "cannot handle SUL bands!\n"); } - FDDs->dl_nr_arfcn=fDD_Info->dL_NRFreqInfo.nRARFCN; + FDDs->dl_freqinfo.arfcn = fDD_Info->dL_NRFreqInfo.nRARFCN; int dlBands=fDD_Info->dL_NRFreqInfo.freqBandListNr.list.count; + AssertFatal(dlBands == 0, "cannot handled more than one frequency band\n"); for (int dlB=0; dlB < dlBands; dlB++) { F1AP_FreqBandNrItem_t * FreqItem=fDD_Info->dL_NRFreqInfo.freqBandListNr.list.array[dlB]; - FDDs->dl_nr_band[dlB]=FreqItem->freqBandIndicatorNr; - int num_available_supported_SULBands = FreqItem->supportedSULBandList.list.count; - for (int sul=0; sul < num_available_supported_SULBands; sul ++ ) { - F1AP_SupportedSULFreqBandItem_t * SulItem= FreqItem->supportedSULBandList.list.array[sul]; - FDDs->ul_nr_sul_band[sul]=SulItem->freqBandIndicatorNr; - } + FDDs->dl_freqinfo.band = FreqItem->freqBandIndicatorNr; + int num_available_supported_SULBands = FreqItem->supportedSULBandList.list.count; + AssertFatal(num_available_supported_SULBands == 0, "cannot handle SUL bands!\n"); } - FDDs->ul_scs=fDD_Info->uL_Transmission_Bandwidth.nRSCS; - FDDs->ul_nrb=nrb_lut[fDD_Info->uL_Transmission_Bandwidth.nRNRB]; - FDDs->dl_scs=fDD_Info->dL_Transmission_Bandwidth.nRSCS; - FDDs->dl_nrb=nrb_lut[fDD_Info->dL_Transmission_Bandwidth.nRNRB]; - } - - // TDD - if (servedCellInformation->nR_Mode_Info.present==F1AP_NR_Mode_Info_PR_tDD) { - struct tdd_s *TDDs=&req->nr_mode_info[i].tdd; - F1AP_TDD_Info_t * tDD_Info=servedCellInformation->nR_Mode_Info.choice.tDD; - TDDs->nr_arfcn=tDD_Info->nRFreqInfo.nRARFCN; - TDDs->num_frequency_bands=tDD_Info->nRFreqInfo.freqBandListNr.list.count; + FDDs->ul_tbw.scs = fDD_Info->uL_Transmission_Bandwidth.nRSCS; + FDDs->ul_tbw.nrb = nrb_lut[fDD_Info->uL_Transmission_Bandwidth.nRNRB]; + FDDs->dl_tbw.scs = fDD_Info->dL_Transmission_Bandwidth.nRSCS; + FDDs->dl_tbw.nrb = nrb_lut[fDD_Info->dL_Transmission_Bandwidth.nRNRB]; + } else if (servedCellInformation->nR_Mode_Info.present==F1AP_NR_Mode_Info_PR_tDD) { + req->cell[i].info.mode = F1AP_MODE_TDD; + f1ap_tdd_info_t *TDDs = &req->cell[i].info.tdd; + F1AP_TDD_Info_t *tDD_Info = servedCellInformation->nR_Mode_Info.choice.tDD; + TDDs->freqinfo.arfcn = tDD_Info->nRFreqInfo.nRARFCN; + AssertFatal(tDD_Info->nRFreqInfo.freqBandListNr.list.count == 1, "cannot handle more than one frequency band\n"); for (int f=0; f < tDD_Info->nRFreqInfo.freqBandListNr.list.count; f++) { - struct F1AP_FreqBandNrItem * FreqItem=tDD_Info->nRFreqInfo.freqBandListNr.list.array[f]; - TDDs->nr_band[f]=FreqItem->freqBandIndicatorNr; - int num_available_supported_SULBands=FreqItem->supportedSULBandList.list.count; - for (int sul=0; sul < num_available_supported_SULBands; sul ++ ) { - struct F1AP_SupportedSULFreqBandItem * SulItem= FreqItem->supportedSULBandList.list.array[sul]; - TDDs->nr_sul_band[sul]=SulItem->freqBandIndicatorNr; - } + struct F1AP_FreqBandNrItem * FreqItem=tDD_Info->nRFreqInfo.freqBandListNr.list.array[f]; + TDDs->freqinfo.band = FreqItem->freqBandIndicatorNr; + int num_available_supported_SULBands = FreqItem->supportedSULBandList.list.count; + AssertFatal(num_available_supported_SULBands == 0, "cannot hanlde SUL bands!\n"); } - TDDs->scs=tDD_Info->transmission_Bandwidth.nRSCS; - TDDs->nrb=nrb_lut[tDD_Info->transmission_Bandwidth.nRNRB]; + TDDs->tbw.scs = tDD_Info->transmission_Bandwidth.nRSCS; + TDDs->tbw.nrb = nrb_lut[tDD_Info->transmission_Bandwidth.nRNRB]; + } else { + AssertFatal(false, "unknown NR Mode info %d\n", servedCellInformation->nR_Mode_Info.present); } struct F1AP_GNB_DU_System_Information * DUsi=served_cells_item->gNB_DU_System_Information; diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index 9b1276285d..91629762ee 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -206,115 +206,73 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance, f1ap_setup_req_t *setup_req) } } - if (setup_req->fdd_flag) { // FDD + if (setup_req->cell[i].info.mode == F1AP_MODE_FDD) { // FDD + const f1ap_fdd_info_t *fdd = &setup_req->cell[i].info.fdd; nR_Mode_Info->present = F1AP_NR_Mode_Info_PR_fDD; asn1cCalloc(nR_Mode_Info->choice.fDD, fDD_Info); /* FDD.1 UL NRFreqInfo */ /* FDD.1.1 UL NRFreqInfo ARFCN */ - fDD_Info->uL_NRFreqInfo.nRARFCN = setup_req->nr_mode_info[i].fdd.ul_nr_arfcn; // Integer + fDD_Info->uL_NRFreqInfo.nRARFCN = fdd->ul_freqinfo.arfcn; // Integer /* FDD.1.2 F1AP_SUL_Information */ - if(0) { // Optional - 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; - } /* FDD.1.3 freqBandListNr */ - int fdd_ul_num_available_freq_Bands = setup_req->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_num_available_freq_Bands = 1; 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 = setup_req->nr_mode_info[i].fdd.ul_nr_band[fdd_ul_j]; // - /* FDD.1.3.2 supportedSULBandList*/ - int num_available_supported_SULBands = setup_req->nr_mode_info[i].fdd.ul_num_sul_frequency_bands; - LOG_D(F1AP, "num_available_supported_SULBands = %d \n", num_available_supported_SULBands); + nr_freqBandNrItem->freqBandIndicatorNr = fdd->ul_freqinfo.band; - for (int fdd_ul_k=0; fdd_ul_ksupportedSULBandList.list, F1AP_SupportedSULFreqBandItem_t, nr_supportedSULFreqBandItem); - /* FDD.1.3.2.1 freqBandIndicatorNr */ - nr_supportedSULFreqBandItem->freqBandIndicatorNr = setup_req->nr_mode_info[i].fdd.ul_nr_sul_band[fdd_ul_k]; // - } // for FDD : UL supported_SULBands + /* FDD.1.3.2 supportedSULBandList*/ } // for FDD : UL freq_Bands /* FDD.2 DL NRFreqInfo */ /* FDD.2.1 DL NRFreqInfo ARFCN */ - fDD_Info->dL_NRFreqInfo.nRARFCN = setup_req->nr_mode_info[i].fdd.dl_nr_arfcn; // Integer + fDD_Info->dL_NRFreqInfo.nRARFCN = fdd->dl_freqinfo.arfcn; // Integer /* 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; - } /* FDD.2.3 freqBandListNr */ - int fdd_dl_num_available_freq_Bands = setup_req->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_num_available_freq_Bands = 1; 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 = setup_req->nr_mode_info[i].fdd.dl_nr_band[fdd_dl_j]; // - /* FDD.2.3.2 supportedSULBandList*/ - int num_available_supported_SULBands = setup_req->nr_mode_info[i].fdd.dl_num_sul_frequency_bands; - LOG_D(F1AP, "num_available_supported_SULBands = %d \n", num_available_supported_SULBands); + nr_freqBandNrItem->freqBandIndicatorNr = fdd->dl_freqinfo.band; - for (int fdd_dl_k=0; fdd_dl_ksupportedSULBandList.list, F1AP_SupportedSULFreqBandItem_t, nr_supportedSULFreqBandItem); - /* FDD.2.3.2.1 freqBandIndicatorNr */ - nr_supportedSULFreqBandItem->freqBandIndicatorNr = setup_req->nr_mode_info[i].fdd.dl_nr_sul_band[fdd_dl_k]; // - } // for FDD : DL supported_SULBands + /* FDD.2.3.2 supportedSULBandList*/ } // for FDD : DL freq_Bands /* FDD.3 UL Transmission Bandwidth */ - fDD_Info->uL_Transmission_Bandwidth.nRSCS = setup_req->nr_mode_info[i].fdd.ul_scs; - fDD_Info->uL_Transmission_Bandwidth.nRNRB = to_NRNRB(setup_req->nr_mode_info[i].fdd.ul_nrb); + fDD_Info->uL_Transmission_Bandwidth.nRSCS = fdd->ul_tbw.scs; + fDD_Info->uL_Transmission_Bandwidth.nRNRB = to_NRNRB(fdd->ul_tbw.nrb); /* FDD.4 DL Transmission Bandwidth */ - fDD_Info->dL_Transmission_Bandwidth.nRSCS = setup_req->nr_mode_info[i].fdd.dl_scs; - fDD_Info->dL_Transmission_Bandwidth.nRNRB = to_NRNRB(setup_req->nr_mode_info[i].fdd.dl_nrb); - } else { // TDD + fDD_Info->dL_Transmission_Bandwidth.nRSCS = fdd->dl_tbw.scs; + fDD_Info->dL_Transmission_Bandwidth.nRNRB = to_NRNRB(fdd->dl_tbw.nrb); + } else if (setup_req->cell[i].info.mode == F1AP_MODE_TDD) { // TDD + const f1ap_tdd_info_t *tdd = &setup_req->cell[i].info.tdd; nR_Mode_Info->present = F1AP_NR_Mode_Info_PR_tDD; asn1cCalloc(nR_Mode_Info->choice.tDD, tDD_Info); /* TDD.1 nRFreqInfo */ /* TDD.1.1 nRFreqInfo ARFCN */ - tDD_Info->nRFreqInfo.nRARFCN = setup_req->nr_mode_info[i].tdd.nr_arfcn; // Integer + tDD_Info->nRFreqInfo.nRARFCN = tdd->freqinfo.arfcn; // Integer /* 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; - } /* TDD.1.3 freqBandListNr */ - int tdd_num_available_freq_Bands = setup_req->nr_mode_info[i].tdd.num_frequency_bands; - LOG_D(F1AP, "tdd_num_available_freq_Bands = %d \n", tdd_num_available_freq_Bands); - + int tdd_num_available_freq_Bands = 1; for (int j=0; jnRFreqInfo.freqBandListNr.list, F1AP_FreqBandNrItem_t, nr_freqBandNrItem); /* TDD.1.3.1 freqBandIndicatorNr*/ - nr_freqBandNrItem->freqBandIndicatorNr = *setup_req->nr_mode_info[i].tdd.nr_band; // + nr_freqBandNrItem->freqBandIndicatorNr = tdd->freqinfo.band; /* TDD.1.3.2 supportedSULBandList*/ - int num_available_supported_SULBands = setup_req->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 = *setup_req->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 = setup_req->nr_mode_info[i].tdd.scs; - tDD_Info->transmission_Bandwidth.nRNRB = to_NRNRB(setup_req->nr_mode_info[i].tdd.nrb); - } // if nR_Mode_Info + tDD_Info->transmission_Bandwidth.nRSCS = tdd->tbw.scs; + tDD_Info->transmission_Bandwidth.nRNRB = to_NRNRB(tdd->tbw.nrb); + } else { + AssertFatal(false, "unknown mode %d\n", setup_req->cell[i].info.mode); + } /* - measurementTimingConfiguration */ char *measurementTimingConfiguration = setup_req->measurement_timing_information[i]; // sept. 2018 @@ -617,7 +575,7 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, F1AP_NR_Mode_Info_t *nR_Mode_Info=&served_cell_information->nR_Mode_Info; LOG_E(F1AP,"Here hardcoded values instead of values from configuration file\n"); - if (f1ap_setup_req->fdd_flag) { + if (cell->mode == F1AP_MODE_FDD) { nR_Mode_Info->present = F1AP_NR_Mode_Info_PR_fDD; /* > FDD >> FDD Info */ asn1cCalloc(nR_Mode_Info->choice.fDD, fDD_Info); @@ -639,7 +597,7 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, /* >>> DL Transmission Bandwidth */ fDD_Info->dL_Transmission_Bandwidth.nRSCS = F1AP_NRSCS_scs15; fDD_Info->dL_Transmission_Bandwidth.nRNRB = F1AP_NRNRB_nrb11; - } else { // TDD + } else if (cell->mode == F1AP_MODE_TDD) { // TDD nR_Mode_Info->present = F1AP_NR_Mode_Info_PR_tDD; /* > TDD >> TDD Info */ asn1cCalloc(nR_Mode_Info->choice.tDD, tDD_Info); @@ -651,6 +609,8 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, nr_supportedSULFreqBandItem->freqBandIndicatorNr = 444L; tDD_Info->transmission_Bandwidth.nRSCS= F1AP_NRSCS_scs15; tDD_Info->transmission_Bandwidth.nRNRB= F1AP_NRNRB_nrb11; + } else { + AssertFatal(false, "illegal mode %d\n", cell->mode); } /* - measurementTimingConfiguration */ @@ -710,7 +670,7 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, // // /* - CHOICE NR-MODE-Info */ F1AP_NR_Mode_Info_t *nR_Mode_Info= &served_cell_information->nR_Mode_Info; - if (f1ap_setup_req->fdd_flag) { + if (cell->mode == F1AP_MODE_FDD) { nR_Mode_Info->present = F1AP_NR_Mode_Info_PR_fDD; /* > FDD >> FDD Info */ asn1cCalloc(nR_Mode_Info->choice.fDD, fDD_Info); @@ -733,7 +693,7 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, /* >>> DL Transmission Bandwidth */ fDD_Info->dL_Transmission_Bandwidth.nRSCS = F1AP_NRSCS_scs15; fDD_Info->dL_Transmission_Bandwidth.nRNRB = F1AP_NRNRB_nrb11; - } else { // TDD + } else if (cell->mode == F1AP_MODE_TDD) { // TDD nR_Mode_Info->present = F1AP_NR_Mode_Info_PR_tDD; /* > TDD >> TDD Info */ asn1cCalloc(nR_Mode_Info->choice.tDD, tDD_Info); @@ -745,6 +705,8 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, nr_supportedSULFreqBandItem->freqBandIndicatorNr = 444L; tDD_Info->transmission_Bandwidth.nRSCS= F1AP_NRSCS_scs15; tDD_Info->transmission_Bandwidth.nRNRB= F1AP_NRNRB_nrb11; + } else { + AssertFatal(false, "unknown mode %d\n", cell->mode); } /* - measurementTimingConfiguration */ diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 2e84b56bc3..44da60010c 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -1987,35 +1987,25 @@ int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) { if (rrc->configuration.scc->tdd_UL_DL_ConfigurationCommon) { LOG_I(GNB_APP,"ngran_DU: Configuring Cell %d for TDD\n",k); - 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; + f1Setup->cell[k].info.mode = F1AP_MODE_TDD; + f1ap_tdd_info_t *tdd = &f1Setup->cell[k].info.tdd; + tdd->freqinfo.arfcn = rrc->configuration.scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA; + tdd->tbw.scs = rrc->configuration.scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; + tdd->tbw.nrb = rrc->configuration.scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; + tdd->freqinfo.band = *rrc->configuration.scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; } else { /***************** for test *****************/ LOG_I(GNB_APP,"ngran_DU: Configuring Cell %d for FDD\n",k); - 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 - 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) - 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 - 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; + f1Setup->cell[k].info.mode = F1AP_MODE_FDD; + f1ap_fdd_info_t *fdd = &f1Setup->cell[k].info.fdd; + fdd->dl_freqinfo.arfcn = 26200UL; + fdd->ul_freqinfo.arfcn = 26200UL; + fdd->dl_tbw.scs = 0; + fdd->ul_tbw.scs = 0; + fdd->dl_tbw.nrb = 3; + fdd->ul_tbw.nrb = 3; + fdd->dl_freqinfo.band = 7; + fdd->ul_freqinfo.band = 7; /***************** for test *****************/ } From d21aa79fe0a656fadff59c3c7b17df780009b35b Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 17 Jul 2023 17:32:30 +0200 Subject: [PATCH 21/63] Refactor F1 Setup Req: MeasurementTimingInformation is part of cell info --- openair2/COMMON/f1ap_messages_types.h | 5 ++--- openair2/F1AP/f1ap_du_interface_management.c | 2 +- openair2/GNB_APP/gnb_config.c | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index b003b46b3d..777b5a7550 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -135,6 +135,8 @@ typedef struct f1ap_served_cell_info_t { f1ap_fdd_info_t fdd; f1ap_tdd_info_t tdd; }; + + char *measurement_timing_information; } f1ap_served_cell_info_t; typedef struct f1ap_setup_req_s { @@ -150,9 +152,6 @@ typedef struct f1ap_setup_req_s { } cell[F1AP_MAX_NB_CELLS]; - char *measurement_timing_information[F1AP_MAX_NB_CELLS]; - uint8_t ranac[F1AP_MAX_NB_CELLS]; - // System Information uint8_t *mib[F1AP_MAX_NB_CELLS]; int mib_length[F1AP_MAX_NB_CELLS]; diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index 91629762ee..be0429a2ba 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -275,7 +275,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance, f1ap_setup_req_t *setup_req) } /* - measurementTimingConfiguration */ - char *measurementTimingConfiguration = setup_req->measurement_timing_information[i]; // sept. 2018 + char *measurementTimingConfiguration = cell->measurement_timing_information; // sept. 2018 OCTET_STRING_fromBuf(&served_cell_information->measurementTimingConfiguration, measurementTimingConfiguration, strlen(measurementTimingConfiguration)); diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 44da60010c..ec4a8c18bb 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -2009,8 +2009,8 @@ int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) { /***************** for test *****************/ } - f1Setup->measurement_timing_information[k] = "0"; - f1Setup->ranac[k] = 0; + f1Setup->cell[k].info.measurement_timing_information = "0"; + DevAssert(rrc->carrier.mib != NULL); int buf_len = 3; // this is what we assume in monolithic f1Setup->mib[k] = calloc(buf_len, sizeof(*f1Setup->mib[k])); From ca374e86eb3387ffaf2b84ee115b1726e501fab7 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 18 Jul 2023 11:55:45 +0200 Subject: [PATCH 22/63] Refactor F1 Setup Req: sys_info is specific to each cell --- openair2/COMMON/f1ap_messages_types.h | 17 +++++++------- openair2/F1AP/f1ap_cu_interface_management.c | 21 ++++++++--------- openair2/F1AP/f1ap_du_interface_management.c | 10 ++++---- openair2/GNB_APP/gnb_config.c | 24 ++++++++++---------- openair2/RRC/NR/rrc_gNB.c | 16 +++++++------ 5 files changed, 42 insertions(+), 46 deletions(-) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index 777b5a7550..52f1bc8a2d 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -139,6 +139,13 @@ typedef struct f1ap_served_cell_info_t { char *measurement_timing_information; } f1ap_served_cell_info_t; +typedef struct f1ap_gnb_du_system_info_t { + uint8_t *mib; + int mib_length; + uint8_t *sib1; + int sib1_length; +} f1ap_gnb_du_system_info_t; + typedef struct f1ap_setup_req_s { // F1_Setup_Req payload @@ -149,16 +156,8 @@ typedef struct f1ap_setup_req_s { uint16_t num_cells_available; //0< num_cells_available <= 512; struct { f1ap_served_cell_info_t info; + f1ap_gnb_du_system_info_t *sys_info; } cell[F1AP_MAX_NB_CELLS]; - - - // System Information - uint8_t *mib[F1AP_MAX_NB_CELLS]; - int mib_length[F1AP_MAX_NB_CELLS]; - uint8_t *sib1[F1AP_MAX_NB_CELLS]; - int sib1_length[F1AP_MAX_NB_CELLS]; - - } f1ap_setup_req_t; typedef struct f1ap_du_register_req_t { diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index 5ac722f629..f264734227 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -189,20 +189,17 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, struct F1AP_GNB_DU_System_Information * DUsi=served_cells_item->gNB_DU_System_Information; // System Information + req->cell[i].sys_info = calloc(1, sizeof(*req->cell[i].sys_info)); + AssertFatal(req->cell[i].sys_info != NULL, "out of memory\n"); + f1ap_gnb_du_system_info_t *sys_info = req->cell[i].sys_info; /* mib */ - req->mib[i] = calloc(DUsi->mIB_message.size + 1, sizeof(char)); - memcpy(req->mib[i], DUsi->mIB_message.buf, DUsi->mIB_message.size); - /* Convert the mme name to a printable string */ - req->mib[i][DUsi->mIB_message.size] = '\0'; - req->mib_length[i] = DUsi->mIB_message.size; - LOG_D(F1AP, "req->mib[%d] len = %d \n", i, req->mib_length[i]); + sys_info->mib = calloc(DUsi->mIB_message.size, sizeof(char)); + memcpy(sys_info->mib, DUsi->mIB_message.buf, DUsi->mIB_message.size); + sys_info->mib_length = DUsi->mIB_message.size; /* sib1 */ - req->sib1[i] = calloc(DUsi->sIB1_message.size + 1, sizeof(char)); - memcpy(req->sib1[i], DUsi->sIB1_message.buf, DUsi->sIB1_message.size); - /* Convert the mme name to a printable string */ - req->sib1[i][DUsi->sIB1_message.size] = '\0'; - req->sib1_length[i] = DUsi->sIB1_message.size; - LOG_D(F1AP, "req->sib1[%d] len = %d \n", i, req->sib1_length[i]); + sys_info->sib1 = calloc(DUsi->sIB1_message.size, sizeof(char)); + memcpy(sys_info->sib1, DUsi->sIB1_message.buf, DUsi->sIB1_message.size); + sys_info->sib1_length = DUsi->sIB1_message.size; } // char *measurement_timing_information[F1AP_MAX_NB_CELLS]; diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index be0429a2ba..5dfe19119f 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -281,12 +281,10 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance, f1ap_setup_req_t *setup_req) strlen(measurementTimingConfiguration)); 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 *)setup_req->mib[i], //f1ap_du_data->mib, - setup_req->mib_length[i]); - OCTET_STRING_fromBuf(&gNB_DU_System_Information->sIB1_message, // sept. 2018 - (const char *)setup_req->sib1[i], - setup_req->sib1_length[i]); + AssertFatal(setup_req->cell[i].sys_info != NULL, "assume that sys_info is present, which is not the case\n"); + const f1ap_gnb_du_system_info_t *sys_info = setup_req->cell[i].sys_info; + OCTET_STRING_fromBuf(&gNB_DU_System_Information->mIB_message, (const char *)sys_info->mib, sys_info->mib_length); + OCTET_STRING_fromBuf(&gNB_DU_System_Information->sIB1_message, (const char *)sys_info->sib1, sys_info->sib1_length); } /* mandatory */ diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index ec4a8c18bb..f96c0033ae 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -2013,10 +2013,13 @@ int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) { DevAssert(rrc->carrier.mib != NULL); int buf_len = 3; // this is what we assume in monolithic - f1Setup->mib[k] = calloc(buf_len, sizeof(*f1Setup->mib[k])); - DevAssert(f1Setup->mib[k] != NULL); - f1Setup->mib_length[k] = encode_MIB_NR(rrc->carrier.mib, 0, f1Setup->mib[k], buf_len); - DevAssert(f1Setup->mib_length[k] == buf_len); + f1Setup->cell[k].sys_info = calloc(1, sizeof(*f1Setup->cell[k].sys_info)); + AssertFatal(f1Setup->cell[k].sys_info != NULL, "out of memory\n"); + f1ap_gnb_du_system_info_t *sys_info = f1Setup->cell[k].sys_info; + sys_info->mib = calloc(buf_len, sizeof(*sys_info->mib)); + DevAssert(sys_info->mib != NULL); + sys_info->mib_length = encode_MIB_NR(rrc->carrier.mib, 0, sys_info->mib, buf_len); + DevAssert(sys_info->mib_length == buf_len); NR_BCCH_DL_SCH_Message_t *bcch_message = NULL; asn_codec_ctx_t st={100*1000}; @@ -2034,12 +2037,9 @@ int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) { } NR_SIB1_t *bcch_SIB1 = bcch_message->message.choice.c1->choice.systemInformationBlockType1; - f1Setup->sib1[k] = calloc(1,rrc->carrier.sizeof_SIB1); - asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_SIB1, - NULL, - (void *)bcch_SIB1, - f1Setup->sib1[k], - NR_MAX_SIB_LENGTH/8); + sys_info->sib1 = calloc(1,rrc->carrier.sizeof_SIB1); + asn_enc_rval_t enc_rval = + uper_encode_to_buffer(&asn_DEF_NR_SIB1, NULL, (void *)bcch_SIB1, sys_info->sib1, NR_MAX_SIB_LENGTH / 8); AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); @@ -2047,8 +2047,8 @@ int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) { LOG_I(NR_RRC, "SIB1 container to be integrated in F1 Setup request:\n"); xer_fprint(stdout, &asn_DEF_NR_SIB1,(void *)bcch_message->message.choice.c1->choice.systemInformationBlockType1 ); //} - f1Setup->sib1_length[k] = (enc_rval.encoded+7)/8; - break; + sys_info->sib1_length = (enc_rval.encoded + 7) / 8; + break; } } } diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 5f57ed6d31..f9ee1db1a5 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -1873,13 +1873,15 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) { //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) - LOG_W(NR_RRC, "instance %d sib1 length %d\n", i, f1_setup_req->sib1_length[i]); + const f1ap_gnb_du_system_info_t *sys_info = f1_setup_req->cell[i].sys_info; + AssertFatal(sys_info != NULL, "no system information found, should send F1 Setup Failure\n"); + LOG_W(NR_RRC, "instance %d sib1 length %d\n", i, sys_info->sib1_length); AssertFatal(rrc->carrier.mib == NULL, "CU MIB is already initialized: double F1 setup request?\n"); asn_dec_rval_t dec_rval = uper_decode_complete(NULL, - &asn_DEF_NR_BCCH_BCH_Message, - (void **)&rrc->carrier.mib, - f1_setup_req->mib[i], - f1_setup_req->mib_length[i]); + &asn_DEF_NR_BCCH_BCH_Message, + (void **)&rrc->carrier.mib, + sys_info->mib, + sys_info->mib_length); AssertFatal(dec_rval.code == RC_OK, "[gNB_CU %"PRIu8"] Failed to decode NR_BCCH_BCH_MESSAGE (%zu bits)\n", j, @@ -1888,8 +1890,8 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *f1_setup_req) { dec_rval = uper_decode_complete(NULL, &asn_DEF_NR_SIB1, //&asn_DEF_NR_BCCH_DL_SCH_Message, (void **)&rrc->carrier.siblock1_DU, - f1_setup_req->sib1[i], - f1_setup_req->sib1_length[i]); + sys_info->sib1, + sys_info->sib1_length); AssertFatal(dec_rval.code == RC_OK, "[gNB_DU %"PRIu8"] Failed to decode NR_BCCH_DLSCH_MESSAGE (%zu bits)\n", j, From 0a1b728051b4b153774e76ae64b054eee2a3c105 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 18 Jul 2023 16:31:41 +0200 Subject: [PATCH 23/63] F1 Setup Response: remove unused struct fields --- openair2/COMMON/f1ap_messages_types.h | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index 52f1bc8a2d..b3875c01bf 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -180,16 +180,6 @@ typedef struct served_cells_to_activate_s { } served_cells_to_activate_t; typedef struct f1ap_setup_resp_s { - /* Connexion id used between SCTP/F1AP */ - uint16_t cnx_id; - - /* SCTP association id */ - int32_t assoc_id; - - /* Number of SCTP streams used for a mme association */ - uint16_t sctp_in_streams; - uint16_t sctp_out_streams; - /// string holding gNB_CU_name char *gNB_CU_name; /// number of DU cells to activate From ddd37ca145c1d50621d62c2dd561ea2c2978acd9 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 18 Jul 2023 12:03:57 +0200 Subject: [PATCH 24/63] Read SCC in separate function, and fill FDD values - Simplify code by reading the SCC in a separate function - Fill the F1 Setup Request message correctly in case of FDD, from SCC --- openair2/GNB_APP/gnb_config.c | 107 +++++++++++++++++++--------------- 1 file changed, 59 insertions(+), 48 deletions(-) diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index f96c0033ae..44e33d6558 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -873,6 +873,47 @@ void RCconfig_NR_L1(void) } } +static void check_ssb_raster(uint64_t freq, int band, int scs); + +static NR_ServingCellConfigCommon_t *get_scc_config(void) +{ + NR_ServingCellConfigCommon_t *scc = calloc(1,sizeof(*scc)); + uint64_t ssb_bitmap=0xff; + prepare_scc(scc); + paramdef_t SCCsParams[] = SCCPARAMS_DESC(scc); + paramlist_def_t SCCsParamList = {GNB_CONFIG_STRING_SERVINGCELLCONFIGCOMMON, NULL, 0}; + + char aprefix[MAX_OPTNAME_SIZE*2 + 8]; + sprintf(aprefix, "%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, 0); + config_getlist(&SCCsParamList, NULL, 0, aprefix); + if (SCCsParamList.numelt > 0) { + sprintf(aprefix, "%s.[%i].%s.[%i]", GNB_CONFIG_STRING_GNB_LIST,0,GNB_CONFIG_STRING_SERVINGCELLCONFIGCOMMON, 0); + config_get(SCCsParams,sizeof(SCCsParams) / sizeof(paramdef_t), aprefix); + LOG_I(RRC, + "Read in ServingCellConfigCommon (PhysCellId %d, ABSFREQSSB %d, DLBand %d, ABSFREQPOINTA %d, DLBW " + "%d,RACH_TargetReceivedPower %d\n", + (int)*scc->physCellId, + (int)*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB, + (int)*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], + (int)scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA, + (int)scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth, + (int)scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric + .preambleReceivedTargetPower); + // SSB of the PCell is always on the sync raster + uint64_t ssb_freq = from_nrarfcn(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], + *scc->ssbSubcarrierSpacing, + *scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB); + LOG_I(RRC, "absoluteFrequencySSB %ld corresponds to %lu Hz\n", + *scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB, ssb_freq); + if (get_softmodem_params()->sa) + check_ssb_raster(ssb_freq, + *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], + *scc->ssbSubcarrierSpacing); + fix_scc(scc, ssb_bitmap); + } + return scc; +} + void RCconfig_nr_macrlc() { int j = 0; uint16_t prbbl[275] = {0}; @@ -1119,7 +1160,7 @@ void config_security(gNB_RRC_INST *rrc) } // Section 5.4.3 of 38.101-1 and -2 -void check_ssb_raster(uint64_t freq, int band, int scs) +static void check_ssb_raster(uint64_t freq, int band, int scs) { int start_gscn = 0, step_gscn = 0, end_gscn = 0; for (int i = 0; i < sizeof(sync_raster) / sizeof(sync_raster_t); i++) { @@ -1181,11 +1222,7 @@ 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(*scc)); - uint64_t ssb_bitmap=0xff; - prepare_scc(scc); - paramdef_t SCCsParams[] = SCCPARAMS_DESC(scc); - paramlist_def_t SCCsParamList = {GNB_CONFIG_STRING_SERVINGCELLCONFIGCOMMON, NULL, 0}; + NR_ServingCellConfigCommon_t *scc = get_scc_config(); // Serving Cell Config Dedicated NR_ServingCellConfig_t *scd = calloc(1,sizeof(NR_ServingCellConfig_t)); @@ -1221,32 +1258,6 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) sprintf(aprefix, "%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, 0); - config_getlist(&SCCsParamList, NULL, 0, aprefix); - if (SCCsParamList.numelt > 0) { - sprintf(aprefix, "%s.[%i].%s.[%i]", GNB_CONFIG_STRING_GNB_LIST,0,GNB_CONFIG_STRING_SERVINGCELLCONFIGCOMMON, 0); - config_get(SCCsParams,sizeof(SCCsParams) / sizeof(paramdef_t), aprefix); - LOG_I(RRC,"Read in ServingCellConfigCommon (PhysCellId %d, ABSFREQSSB %d, DLBand %d, ABSFREQPOINTA %d, DLBW %d,RACH_TargetReceivedPower %d\n", - (int)*scc->physCellId, - (int)*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB, - (int)*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], - (int)scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA, - (int)scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth, - (int)scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->rach_ConfigGeneric.preambleReceivedTargetPower); - // SSB of the PCell is always on the sync raster - uint64_t ssb_freq = from_nrarfcn(*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], - *scc->ssbSubcarrierSpacing, - *scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB); - LOG_I(RRC, "absoluteFrequencySSB %ld corresponds to %lu Hz\n", - *scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB, ssb_freq); - if (get_softmodem_params()->sa) - check_ssb_raster(ssb_freq, - *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], - *scc->ssbSubcarrierSpacing); - fix_scc(scc, ssb_bitmap); - } - - sprintf(aprefix, "%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, 0); - config_getlist(&SCDsParamList, NULL, 0, aprefix); if (SCDsParamList.numelt > 0) { sprintf(aprefix, "%s.[%i].%s.[%i]", GNB_CONFIG_STRING_GNB_LIST,0,GNB_CONFIG_STRING_SERVINGCELLCONFIGDEDICATED, 0); @@ -1982,31 +1993,31 @@ int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) { rrc->configuration.mnc[0] = f1Setup->cell[k].info.plmn.mnc; rrc->configuration.tac = *f1Setup->cell[k].info.tac; rrc->nr_cellid = f1Setup->cell[k].info.nr_cellid; - f1Setup->cell[k].info.nr_pci = *rrc->configuration.scc->physCellId; + const NR_ServingCellConfigCommon_t *scc = rrc->configuration.scc; + DevAssert(scc != NULL); + f1Setup->cell[k].info.nr_pci = *scc->physCellId; f1Setup->cell[k].info.num_ssi = 0; - if (rrc->configuration.scc->tdd_UL_DL_ConfigurationCommon) { + if (scc->tdd_UL_DL_ConfigurationCommon) { LOG_I(GNB_APP,"ngran_DU: Configuring Cell %d for TDD\n",k); f1Setup->cell[k].info.mode = F1AP_MODE_TDD; f1ap_tdd_info_t *tdd = &f1Setup->cell[k].info.tdd; - tdd->freqinfo.arfcn = rrc->configuration.scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA; - tdd->tbw.scs = rrc->configuration.scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; - tdd->tbw.nrb = rrc->configuration.scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; - tdd->freqinfo.band = *rrc->configuration.scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; + tdd->freqinfo.arfcn = scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA; + tdd->tbw.scs = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; + tdd->tbw.nrb = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; + tdd->freqinfo.band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; } else { - /***************** for test *****************/ LOG_I(GNB_APP,"ngran_DU: Configuring Cell %d for FDD\n",k); f1Setup->cell[k].info.mode = F1AP_MODE_FDD; f1ap_fdd_info_t *fdd = &f1Setup->cell[k].info.fdd; - fdd->dl_freqinfo.arfcn = 26200UL; - fdd->ul_freqinfo.arfcn = 26200UL; - fdd->dl_tbw.scs = 0; - fdd->ul_tbw.scs = 0; - fdd->dl_tbw.nrb = 3; - fdd->ul_tbw.nrb = 3; - fdd->dl_freqinfo.band = 7; - fdd->ul_freqinfo.band = 7; - /***************** for test *****************/ + fdd->dl_freqinfo.arfcn = scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA; + fdd->ul_freqinfo.arfcn = *scc->uplinkConfigCommon->frequencyInfoUL->absoluteFrequencyPointA; + fdd->dl_tbw.scs = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; + fdd->ul_tbw.scs = scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; + fdd->dl_tbw.nrb = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; + fdd->ul_tbw.nrb = scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; + fdd->dl_freqinfo.band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; + fdd->ul_freqinfo.band = *scc->uplinkConfigCommon->frequencyInfoUL->frequencyBandList->list.array[0]; } f1Setup->cell[k].info.measurement_timing_information = "0"; From 24c61fe1f9fc6055b4f42f30f035020f6dc84cda Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 28 Jul 2023 20:34:13 +0200 Subject: [PATCH 25/63] Completely read ServingCellConfigCommon when reading conf Before this commit, we did not read the ServingCellConfigCommon (SCC) completely at start; rather, we read most (but not all) of it, then also the minRXTXTIME, and at RRC initialization in openair_rrc_gNB_configuration(), we filled the pusch-TimeDomainAllocationList into the SCC, depending on the minRXTXTIME. The reason might be that we read part of the SCC, use that to fill the NRRRC_CONFIGURATION_REQ, read also the minRXTXTIME (part of the RRC config), and then we have all we need to "finalize the SCC". Since we move everything to the MAC, I avoid too much upfront code changes, hardcode the minRXTXTIME (and check with an assert), and undo this in a later commit when the "RRC config" relevant for radio parameters, e.g., minRXTXTIME, is moved to MAC. I verified the equality of the SCC before (at the end openair_rrc_gNB_configuration()) and after (at the end of get_scc_config()) this commit manually using a printf, assuming that after RRC initialization, we didn't do any further modifications to the SCC. But in fact, I cannot know that we don't do it... --- openair2/GNB_APP/gnb_config.c | 8 ++++++-- openair2/RRC/NR/rrc_gNB.c | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 44e33d6558..03905c6207 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -875,7 +875,7 @@ void RCconfig_NR_L1(void) static void check_ssb_raster(uint64_t freq, int band, int scs); -static NR_ServingCellConfigCommon_t *get_scc_config(void) +static NR_ServingCellConfigCommon_t *get_scc_config(int minRXTXTIME) { NR_ServingCellConfigCommon_t *scc = calloc(1,sizeof(*scc)); uint64_t ssb_bitmap=0xff; @@ -911,6 +911,7 @@ static NR_ServingCellConfigCommon_t *get_scc_config(void) *scc->ssbSubcarrierSpacing); fix_scc(scc, ssb_bitmap); } + nr_rrc_config_ul_tda(scc, minRXTXTIME); return scc; } @@ -1222,7 +1223,9 @@ 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 = get_scc_config(); + int minRXTXTIME = 6; + NR_ServingCellConfigCommon_t *scc = get_scc_config(minRXTXTIME); + //xer_fprint(stdout, &asn_DEF_NR_ServingCellConfigCommon, scc); // Serving Cell Config Dedicated NR_ServingCellConfig_t *scd = calloc(1,sizeof(NR_ServingCellConfig_t)); @@ -1376,6 +1379,7 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) NRRRC_CONFIGURATION_REQ (msg_p).pusch_AntennaPorts = *GNBParamList.paramarray[i][GNB_PUSCH_ANTENNAPORTS_IDX].iptr; LOG_I(GNB_APP,"minTXRXTIME %d\n",*GNBParamList.paramarray[i][GNB_MINRXTXTIME_IDX].iptr); NRRRC_CONFIGURATION_REQ (msg_p).minRXTXTIME = *GNBParamList.paramarray[i][GNB_MINRXTXTIME_IDX].iptr; + DevAssert(NRRRC_CONFIGURATION_REQ (msg_p).minRXTXTIME == minRXTXTIME); LOG_I(GNB_APP,"SIB1 TDA %d\n",*GNBParamList.paramarray[i][GNB_SIB1_TDA_IDX].iptr); NRRRC_CONFIGURATION_REQ (msg_p).sib1_tda = *GNBParamList.paramarray[i][GNB_SIB1_TDA_IDX].iptr; LOG_I(GNB_APP,"Do CSI-RS %d\n",*GNBParamList.paramarray[i][GNB_DO_CSIRS_IDX].iptr); diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index f9ee1db1a5..746216d12a 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -222,6 +222,7 @@ static void init_NR_SI(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *configuration if((get_softmodem_params()->sa) && ( (NODE_IS_DU(rrc->node_type) || NODE_IS_MONOLITHIC(rrc->node_type)))) { NR_BCCH_DL_SCH_Message_t *sib1 = get_SIB1_NR(configuration); + //xer_fprint(stdout, &asn_DEF_NR_BCCH_DL_SCH_Message, sib1); rrc->carrier.SIB1 = calloc(NR_MAX_SIB_LENGTH / 8, sizeof(*rrc->carrier.SIB1)); AssertFatal(rrc->carrier.SIB1 != NULL, "out of memory\n"); rrc->carrier.sizeof_SIB1 = encode_SIB1_NR(sib1, rrc->carrier.SIB1, NR_MAX_SIB_LENGTH / 8); @@ -312,7 +313,6 @@ static void openair_rrc_gNB_configuration(const module_id_t gnb_mod_idP, gNB_Rrc RB_INIT(&rrc->rrc_ue_head); rrc->configuration = *configuration; rrc->carrier.servingcellconfigcommon = configuration->scc; - nr_rrc_config_ul_tda(configuration->scc,configuration->minRXTXTIME); /// System Information INIT pthread_mutex_init(&rrc->cell_info_mutex,NULL); rrc->cell_info_configured = 0; From 5315d69692d69be7de6fe1e064193a27269e7bc2 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 18 Jul 2023 16:47:54 +0200 Subject: [PATCH 26/63] Read SCD in separate function to simplify code --- openair2/GNB_APP/gnb_config.c | 57 ++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 24 deletions(-) diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 03905c6207..88a784225c 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -915,6 +915,38 @@ static NR_ServingCellConfigCommon_t *get_scc_config(int minRXTXTIME) return scc; } +static NR_ServingCellConfig_t *get_scd_config(void) +{ + char aprefix[MAX_OPTNAME_SIZE*2 + 8]; + NR_ServingCellConfig_t *scd = calloc(1, sizeof(*scd)); + prepare_scd(scd); + paramdef_t SCDsParams[] = SCDPARAMS_DESC(scd); + paramlist_def_t SCDsParamList = {GNB_CONFIG_STRING_SERVINGCELLCONFIGDEDICATED, NULL, 0}; + config_getlist(&SCDsParamList, NULL, 0, aprefix); + if (SCDsParamList.numelt > 0) { + sprintf(aprefix, "%s.[%i].%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, 0, GNB_CONFIG_STRING_SERVINGCELLCONFIGDEDICATED, 0); + config_get(SCDsParams, sizeof(SCDsParams) / sizeof(paramdef_t), aprefix); + const NR_BWP_UplinkDedicated_t *bwp_Dedicated = scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated; + const NR_PTRS_UplinkConfig_t *setup = + bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup; + LOG_I(RRC, + "Read in ServingCellConfigDedicated UL (FreqDensity_0 %ld, FreqDensity_1 %ld, TimeDensity_0 %ld, TimeDensity_1 %ld, " + "TimeDensity_2 %ld, RE offset %ld, First_active_BWP_ID %ld SCS %ld, LocationandBW %ld\n", + *setup->transformPrecoderDisabled->frequencyDensity->list.array[0], + *setup->transformPrecoderDisabled->frequencyDensity->list.array[1], + *setup->transformPrecoderDisabled->timeDensity->list.array[0], + *setup->transformPrecoderDisabled->timeDensity->list.array[1], + *setup->transformPrecoderDisabled->timeDensity->list.array[2], + *setup->transformPrecoderDisabled->resourceElementOffset, + *scd->firstActiveDownlinkBWP_Id, + scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Common->genericParameters.subcarrierSpacing, + scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Common->genericParameters.locationAndBandwidth); + } + fix_scd(scd); + + return scd; +} + void RCconfig_nr_macrlc() { int j = 0; uint16_t prbbl[275] = {0}; @@ -1227,12 +1259,7 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) NR_ServingCellConfigCommon_t *scc = get_scc_config(minRXTXTIME); //xer_fprint(stdout, &asn_DEF_NR_ServingCellConfigCommon, scc); - // Serving Cell Config Dedicated - NR_ServingCellConfig_t *scd = calloc(1,sizeof(NR_ServingCellConfig_t)); - memset((void*)scd,0,sizeof(NR_ServingCellConfig_t)); - prepare_scd(scd); - paramdef_t SCDsParams[] = SCDPARAMS_DESC(scd); - paramlist_def_t SCDsParamList = {GNB_CONFIG_STRING_SERVINGCELLCONFIGDEDICATED, NULL, 0}; + NR_ServingCellConfig_t *scd = get_scd_config(); ////////// Physical parameters @@ -1261,24 +1288,6 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) sprintf(aprefix, "%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, 0); - config_getlist(&SCDsParamList, NULL, 0, aprefix); - if (SCDsParamList.numelt > 0) { - sprintf(aprefix, "%s.[%i].%s.[%i]", GNB_CONFIG_STRING_GNB_LIST,0,GNB_CONFIG_STRING_SERVINGCELLCONFIGDEDICATED, 0); - config_get( SCDsParams,sizeof(SCDsParams)/sizeof(paramdef_t),aprefix); - LOG_I(RRC,"Read in ServingCellConfigDedicated UL (FreqDensity_0 %d, FreqDensity_1 %d, TimeDensity_0 %d, TimeDensity_1 %d, TimeDensity_2 %d, RE offset %d, First_active_BWP_ID %d SCS %d, LocationandBW %d \n", - (int)*scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->frequencyDensity->list.array[0], - (int)*scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->frequencyDensity->list.array[1], - (int)*scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->timeDensity->list.array[0], - (int)*scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->timeDensity->list.array[1], - (int)*scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->timeDensity->list.array[2], - (int)*scd->uplinkConfig->uplinkBWP_ToAddModList->list.array[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup->transformPrecoderDisabled->resourceElementOffset, - (int)*scd->firstActiveDownlinkBWP_Id, - (int)scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Common->genericParameters.subcarrierSpacing, - (int)scd->downlinkBWP_ToAddModList->list.array[0]->bwp_Common->genericParameters.locationAndBandwidth - ); - } - fix_scd(scd); - printf("NRRRC %u: Southbound Transport %s\n",i,*(GNBParamList.paramarray[i][GNB_TRANSPORT_S_PREFERENCE_IDX].strptr)); rrc->node_type = get_node_type(); From 84d8f6c272c77094dcfef8a044599a4cdb0bcfd6 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 18 Jul 2023 17:19:07 +0200 Subject: [PATCH 27/63] Add stubs for F1 Setup Request/Response/Failure messages --- openair2/F1AP/f1ap_du_interface_management.c | 71 ++++++++----------- .../LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c | 11 +++ .../LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.h | 3 + openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul.h | 2 + .../LAYER2/NR_MAC_gNB/mac_rrc_ul_direct.c | 6 ++ openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_f1ap.c | 6 ++ openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 1 + openair2/RRC/NR/mac_rrc_dl.h | 3 + openair2/RRC/NR/mac_rrc_dl_direct.c | 2 + openair2/RRC/NR/mac_rrc_dl_f1ap.c | 12 ++++ openair2/RRC/NR/nr_rrc_defs.h | 2 + 11 files changed, 78 insertions(+), 41 deletions(-) diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index 5dfe19119f..5cb3ab4b83 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -34,6 +34,7 @@ #include "f1ap_encoder.h" #include "f1ap_itti_messaging.h" #include "f1ap_du_interface_management.h" +#include "openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.h" #include "assertions.h" #include "GNB_APP/gnb_paramdef.h" @@ -309,10 +310,8 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance, f1ap_setup_req_t *setup_req) return 0; } -int DU_handle_F1_SETUP_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { +int DU_handle_F1_SETUP_RESPONSE(instance_t instance, 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"); @@ -327,9 +326,7 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, 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); + f1ap_setup_resp_t resp = {0}; for (int i=0; i < in->protocolIEs.list.count; i++) { ie = in->protocolIEs.list.array[i]; @@ -350,11 +347,10 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, "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"); - 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); + resp.gNB_CU_name = malloc(ie->value.choice.GNB_CU_Name.size+1); + memcpy(resp.gNB_CU_name, ie->value.choice.GNB_CU_Name.buf, ie->value.choice.GNB_CU_Name.size); + resp.gNB_CU_name[ie->value.choice.GNB_CU_Name.size] = '\0'; + LOG_D(F1AP, "F1AP: F1Setup-Resp: gNB_CU_name %s\n", resp.gNB_CU_name); break; case F1AP_ProtocolIE_ID_id_GNB_CU_RRC_Version: @@ -379,17 +375,16 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, "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].plmn.mcc, - F1AP_SETUP_RESP(msg_p).cells_to_activate[i].plmn.mnc, - F1AP_SETUP_RESP(msg_p).cells_to_activate[i].plmn.mnc_digit_length); + resp.cells_to_activate[i].plmn.mcc, + resp.cells_to_activate[i].plmn.mnc, + resp.cells_to_activate[i].plmn.mnc_digit_length); LOG_D(F1AP, "nr_cellId : %x %x %x %x %x\n", cell->nRCGI.nRCellIdentity.buf[0], cell->nRCGI.nRCellIdentity.buf[1], cell->nRCGI.nRCellIdentity.buf[2], 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); + BIT_STRING_TO_NR_CELL_IDENTITY(&cell->nRCGI.nRCellIdentity, resp.cells_to_activate[i].nr_cellid); F1AP_ProtocolExtensionContainer_10696P112_t *ext = (F1AP_ProtocolExtensionContainer_10696P112_t *)cell->iE_Extensions; if (ext==NULL) @@ -408,28 +403,26 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, 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; + resp.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_SETUP_RESP (msg_p).cells_to_activate[i].num_SI = gNB_CUSystemInformation->sibtypetobeupdatedlist.list.count; + resp.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].plmn.mcc, - F1AP_SETUP_RESP(msg_p).cells_to_activate[i].plmn.mnc, - F1AP_SETUP_RESP(msg_p).cells_to_activate[i].nr_cellid, - F1AP_SETUP_RESP(msg_p).cells_to_activate[i].num_SI); + resp.cells_to_activate[i].plmn.mcc, + resp.cells_to_activate[i].plmn.mnc, + resp.cells_to_activate[i].nr_cellid, + resp.cells_to_activate[i].num_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; + resp.cells_to_activate[i].SI_container_length[si] = 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; + resp.cells_to_activate[i].SI_container[si] = malloc(resp.cells_to_activate[i].SI_container_length[si]); + memcpy(resp.cells_to_activate[i].SI_container[si], sib_item->sIBmessage.buf, size); + resp.cells_to_activate[i].SI_type[si]=sib_item->sIBtype; } break; @@ -469,30 +462,26 @@ int DU_handle_F1_SETUP_RESPONSE(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_SETUP_RESP (msg_p).num_cells_to_activate = num_cells_to_activate; + resp.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); + AssertFatal(resp.cells_to_activate[i].num_SI > 0, "System Information %d is missing", i); LOG_D(F1AP, "Sending F1AP_SETUP_RESP ITTI message\n"); - itti_send_msg_to_task(TASK_GNB_APP, GNB_MODULE_ID_TO_INSTANCE(assoc_id), msg_p); + f1_setup_response(&resp); return 0; } // SETUP FAILURE -int DU_handle_F1_SETUP_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { - LOG_E(F1AP, "DU_handle_F1_SETUP_FAILURE\n"); +int DU_handle_F1_SETUP_FAILURE(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +{ F1AP_F1SetupFailure_t *out; F1AP_F1SetupFailureIEs_t *ie; + f1ap_setup_failure_t fail = {0}; 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_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupFailureIEs_t, ie, out, F1AP_ProtocolIE_ID_id_TransactionID, true); /* Cause */ F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_F1SetupFailureIEs_t, ie, out, F1AP_ProtocolIE_ID_id_Cause, true); @@ -503,10 +492,10 @@ int DU_handle_F1_SETUP_FAILURE(instance_t instance, F1AP_ProtocolIE_ID_id_TimeToWait, true); } + f1_setup_failure(&fail); return 0; } - /* gNB-DU Configuration Update */ diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c index e78b66fded..ae88609d5a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c +++ b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c @@ -30,6 +30,17 @@ #include "uper_decoder.h" #include "uper_encoder.h" +void f1_setup_response(const f1ap_setup_resp_t *resp) +{ + AssertFatal(false, "not implemented\n"); +} + +void f1_setup_failure(const f1ap_setup_failure_t *failure) +{ + LOG_E(MAC, "the CU reported F1AP Setup Failure, is there a configuration mismatch?\n"); + exit(1); +} + static NR_RLC_BearerConfig_t *get_bearerconfig_from_srb(const f1ap_srb_to_be_setup_t *srb) { long priority = srb->srb_id; // high priority for SRB diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.h b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.h index ebe6ba5adc..32759b304f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.h @@ -25,6 +25,9 @@ #include "platform_types.h" #include "f1ap_messages_types.h" +void f1_setup_response(const f1ap_setup_resp_t *resp); +void f1_setup_failure(const f1ap_setup_failure_t *failure); + void ue_context_setup_request(const f1ap_ue_context_setup_t *req); void ue_context_modification_request(const f1ap_ue_context_modif_req_t *req); void ue_context_modification_confirm(const f1ap_ue_context_modif_confirm_t *confirm); diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul.h b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul.h index 43a4818e93..b90e490302 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul.h @@ -25,6 +25,8 @@ #include "platform_types.h" #include "f1ap_messages_types.h" +typedef void (*f1_setup_request_func_t)(const f1ap_setup_req_t* req); + typedef void (*ue_context_setup_response_func_t)(const f1ap_ue_context_setup_t* req, const f1ap_ue_context_setup_t *resp); typedef void (*ue_context_modification_response_func_t)(const f1ap_ue_context_modif_req_t *req, const f1ap_ue_context_modif_resp_t *resp); diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_direct.c b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_direct.c index 299c5cb24a..fabd0df99e 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_direct.c +++ b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_direct.c @@ -24,6 +24,11 @@ #include "mac_rrc_ul.h" +static void f1_setup_request_direct(const f1ap_setup_req_t *req) +{ + AssertFatal(false, "not implemented\n"); +} + static void ue_context_setup_response_direct(const f1ap_ue_context_setup_t *req, const f1ap_ue_context_setup_t *resp) { DevAssert(req->drbs_to_be_setup_length == resp->drbs_to_be_setup_length); @@ -172,6 +177,7 @@ static void initial_ul_rrc_message_transfer_direct(module_id_t module_id, const void mac_rrc_ul_direct_init(struct nr_mac_rrc_ul_if_s *mac_rrc) { + mac_rrc->f1_setup_request = f1_setup_request_direct; mac_rrc->ue_context_setup_response = ue_context_setup_response_direct; mac_rrc->ue_context_modification_response = ue_context_modification_response_direct; mac_rrc->ue_context_modification_required = ue_context_modification_required_direct; diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_f1ap.c b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_f1ap.c index c873c569e5..1a65b70581 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_f1ap.c +++ b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_f1ap.c @@ -29,6 +29,11 @@ #include "mac_rrc_ul.h" +static void f1_setup_request_f1ap(const f1ap_setup_req_t *req) +{ + AssertFatal(false, "not implemented\n"); +} + static void ue_context_setup_response_f1ap(const f1ap_ue_context_setup_t *req, const f1ap_ue_context_setup_t *resp) { DevAssert(req->drbs_to_be_setup_length == resp->drbs_to_be_setup_length); @@ -161,6 +166,7 @@ static void initial_ul_rrc_message_transfer_f1ap(module_id_t module_id, const f1 void mac_rrc_ul_f1ap_init(struct nr_mac_rrc_ul_if_s *mac_rrc) { + mac_rrc->f1_setup_request = f1_setup_request_f1ap; mac_rrc->ue_context_setup_response = ue_context_setup_response_f1ap; mac_rrc->ue_context_modification_response = ue_context_modification_response_f1ap; mac_rrc->ue_context_modification_required = ue_context_modification_required_f1ap; diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 4bec3664c8..44e7eadb8a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -656,6 +656,7 @@ typedef struct NR_bler_options { } NR_bler_options_t; typedef struct nr_mac_rrc_ul_if_s { + f1_setup_request_func_t f1_setup_request; ue_context_setup_response_func_t ue_context_setup_response; ue_context_modification_response_func_t ue_context_modification_response; ue_context_modification_required_func_t ue_context_modification_required; diff --git a/openair2/RRC/NR/mac_rrc_dl.h b/openair2/RRC/NR/mac_rrc_dl.h index 0180f972fe..9fc75b3073 100644 --- a/openair2/RRC/NR/mac_rrc_dl.h +++ b/openair2/RRC/NR/mac_rrc_dl.h @@ -25,6 +25,9 @@ #include "platform_types.h" #include "f1ap_messages_types.h" +typedef void (*f1_setup_response_func_t)(const f1ap_setup_resp_t *resp); +typedef void (*f1_setup_failure_func_t)(const f1ap_setup_failure_t *fail); + typedef void (*ue_context_setup_request_func_t)(const f1ap_ue_context_setup_t *req); typedef void (*ue_context_modification_request_func_t)(const f1ap_ue_context_modif_req_t *req); typedef void (*ue_context_modification_confirm_func_t)(const f1ap_ue_context_modif_confirm_t *confirm); diff --git a/openair2/RRC/NR/mac_rrc_dl_direct.c b/openair2/RRC/NR/mac_rrc_dl_direct.c index 423eac2462..c18a33954c 100644 --- a/openair2/RRC/NR/mac_rrc_dl_direct.c +++ b/openair2/RRC/NR/mac_rrc_dl_direct.c @@ -26,6 +26,8 @@ void mac_rrc_dl_direct_init(nr_mac_rrc_dl_if_t *mac_rrc) { + mac_rrc->f1_setup_response = f1_setup_response; + mac_rrc->f1_setup_failure = f1_setup_failure; mac_rrc->ue_context_setup_request = ue_context_setup_request; mac_rrc->ue_context_modification_request = ue_context_modification_request; mac_rrc->ue_context_modification_confirm = ue_context_modification_confirm; diff --git a/openair2/RRC/NR/mac_rrc_dl_f1ap.c b/openair2/RRC/NR/mac_rrc_dl_f1ap.c index 40eea4861c..8a827afe1b 100644 --- a/openair2/RRC/NR/mac_rrc_dl_f1ap.c +++ b/openair2/RRC/NR/mac_rrc_dl_f1ap.c @@ -24,6 +24,16 @@ #include "mac_rrc_dl.h" #include "nr_rrc_defs.h" +static void f1_setup_response_f1ap(const f1ap_setup_resp_t *resp) +{ + AssertFatal(false, "not implemented\n"); +} + +static void f1_setup_failure_f1ap(const f1ap_setup_failure_t *fail) +{ + AssertFatal(false, "not implemented\n"); +} + static void ue_context_setup_request_f1ap(const f1ap_ue_context_setup_t *req) { MessageDef *msg = itti_alloc_new_message(TASK_RRC_GNB, 0, F1AP_UE_CONTEXT_SETUP_REQ); @@ -133,6 +143,8 @@ static void dl_rrc_message_transfer_f1ap(const f1ap_dl_rrc_message_t *dl_rrc) void mac_rrc_dl_f1ap_init(nr_mac_rrc_dl_if_t *mac_rrc) { + mac_rrc->f1_setup_response = f1_setup_response_f1ap; + mac_rrc->f1_setup_failure = f1_setup_failure_f1ap; mac_rrc->ue_context_setup_request = ue_context_setup_request_f1ap; mac_rrc->ue_context_modification_request = ue_context_modification_request_f1ap; mac_rrc->ue_context_modification_confirm = ue_context_modification_confirm_f1ap; diff --git a/openair2/RRC/NR/nr_rrc_defs.h b/openair2/RRC/NR/nr_rrc_defs.h index a7c1d0fdfc..8e2a9d2842 100644 --- a/openair2/RRC/NR/nr_rrc_defs.h +++ b/openair2/RRC/NR/nr_rrc_defs.h @@ -362,6 +362,8 @@ typedef struct { } nr_security_configuration_t; typedef struct nr_mac_rrc_dl_if_s { + f1_setup_response_func_t f1_setup_response; + f1_setup_failure_func_t f1_setup_failure; ue_context_setup_request_func_t ue_context_setup_request; ue_context_modification_request_func_t ue_context_modification_request; ue_context_modification_confirm_func_t ue_context_modification_confirm; From 925c2d0f1e46e5cdd25e95523a7c28cfdcb20e6d Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 18 Jul 2023 18:02:35 +0200 Subject: [PATCH 28/63] Remove NRRRC_CONFIGURATION_REQ and initalize RRC properly Use a struct to initialize the RRC at the beginning, and remove the NRRRC_CONFIGURATION_REQ. This message is not necessary; the RRC/CU should be initialized from the F1 Setup Request, coming from the DU. --- executables/nr-softmodem.c | 13 +++--- openair2/COMMON/rrc_messages_def.h | 1 - openair2/COMMON/rrc_messages_types.h | 2 - openair2/GNB_APP/gnb_app.c | 19 --------- openair2/GNB_APP/gnb_app.h | 1 - openair2/GNB_APP/gnb_config.c | 59 +++++++++++++++------------- openair2/GNB_APP/gnb_config.h | 2 +- openair2/RRC/NR/nr_rrc_extern.h | 2 + openair2/RRC/NR/rrc_gNB.c | 16 +------- 9 files changed, 42 insertions(+), 73 deletions(-) diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index 5c419f1905..dfe2193d70 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -298,6 +298,7 @@ static int create_gNB_tasks(void) { LOG_D(GNB_APP, "%s(gnb_nb:%d)\n", __FUNCTION__, gnb_nb); itti_wait_ready(1); LOG_I(PHY, "%s() Task ready initialize structures\n", __FUNCTION__); + ngran_node_t node_type = get_node_type(); RCconfig_NR_L1(); RCconfig_nr_prs(); @@ -314,13 +315,11 @@ static int create_gNB_tasks(void) { LOG_I(GNB_APP,"Allocating gNB_RRC_INST for %d instances\n",RC.nb_nr_inst); - RC.nrrrc = (gNB_RRC_INST **)malloc(RC.nb_nr_inst*sizeof(gNB_RRC_INST *)); - LOG_I(PHY, "%s() RC.nb_nr_inst:%d RC.nrrrc:%p\n", __FUNCTION__, RC.nb_nr_inst, RC.nrrrc); - ngran_node_t node_type = get_node_type(); - for (int gnb_id = gnb_id_start; (gnb_id < gnb_id_end) ; gnb_id++) { - 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); - configure_nr_rrc(gnb_id); + if (RC.nb_nr_inst > 0) { + AssertFatal(RC.nb_nr_inst == 1, "multiple RRC instances are not supported\n"); + RC.nrrrc = calloc(1, sizeof(*RC.nrrrc)); + RC.nrrrc[0] = calloc(1,sizeof(gNB_RRC_INST)); + RCconfig_NRRRC(RC.nrrrc[0]); } if (RC.nb_nr_inst > 0 && diff --git a/openair2/COMMON/rrc_messages_def.h b/openair2/COMMON/rrc_messages_def.h index 19a339db7c..8609aa45d2 100644 --- a/openair2/COMMON/rrc_messages_def.h +++ b/openair2/COMMON/rrc_messages_def.h @@ -55,7 +55,6 @@ MESSAGE_DEF(RRC_STATE_IND, MESSAGE_PRIORITY_MED, RrcStateInd, // eNB: ENB_APP -> RRC messages MESSAGE_DEF(RRC_CONFIGURATION_REQ, MESSAGE_PRIORITY_MED, RrcConfigurationReq, rrc_configuration_req) MESSAGE_DEF(NBIOTRRC_CONFIGURATION_REQ, MESSAGE_PRIORITY_MED, NbIoTRrcConfigurationReq, nbiotrrc_configuration_req) -MESSAGE_DEF(NRRRC_CONFIGURATION_REQ, MESSAGE_PRIORITY_MED, gNB_RrcConfigurationReq, nrrrc_configuration_req) // UE: NAS -> RRC messages MESSAGE_DEF(NAS_KENB_REFRESH_REQ, MESSAGE_PRIORITY_MED, NasKenbRefreshReq, nas_kenb_refresh_req) diff --git a/openair2/COMMON/rrc_messages_types.h b/openair2/COMMON/rrc_messages_types.h index 6a29ee1ae7..ef44b31e69 100644 --- a/openair2/COMMON/rrc_messages_types.h +++ b/openair2/COMMON/rrc_messages_types.h @@ -69,8 +69,6 @@ #define NBIOTRRC_CONFIGURATION_REQ(mSGpTR) (mSGpTR)->ittiMsg.nbiotrrc_configuration_req -#define NRRRC_CONFIGURATION_REQ(mSGpTR) (mSGpTR)->ittiMsg.nrrrc_configuration_req - #define NAS_KENB_REFRESH_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_kenb_refresh_req #define NAS_CELL_SELECTION_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_cell_selection_req #define NAS_CONN_ESTABLI_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_conn_establi_req diff --git a/openair2/GNB_APP/gnb_app.c b/openair2/GNB_APP/gnb_app.c index 1366624414..5769d98626 100644 --- a/openair2/GNB_APP/gnb_app.c +++ b/openair2/GNB_APP/gnb_app.c @@ -58,25 +58,6 @@ extern RAN_CONTEXT_t RC; #define GNB_REGISTER_RETRY_DELAY 10 -/*------------------------------------------------------------------------------*/ -void configure_nr_rrc(uint32_t gnb_id) -{ - MessageDef *msg_p = NULL; - // int CC_id; - - msg_p = itti_alloc_new_message (TASK_GNB_APP, 0, NRRRC_CONFIGURATION_REQ); - - if (RC.nrrrc[gnb_id]) { - RCconfig_NRRRC(msg_p,gnb_id, RC.nrrrc[gnb_id]); - - LOG_I(GNB_APP, "RRC starting with node type %d\n", RC.nrrrc[gnb_id]->node_type); - LOG_I(GNB_APP,"Sending configuration message to NR_RRC task\n"); - itti_send_msg_to_task (TASK_RRC_GNB, GNB_MODULE_ID_TO_INSTANCE(gnb_id), msg_p); - - } - else AssertFatal(0,"NRRRC context for gNB %u not allocated\n",gnb_id); -} - /*------------------------------------------------------------------------------*/ diff --git a/openair2/GNB_APP/gnb_app.h b/openair2/GNB_APP/gnb_app.h index 44c4374fc3..0b70ca0bdb 100644 --- a/openair2/GNB_APP/gnb_app.h +++ b/openair2/GNB_APP/gnb_app.h @@ -33,7 +33,6 @@ #include void *gNB_app_task(void *args_p); -void configure_nr_rrc(uint32_t gnb_id); uint32_t gNB_app_register(uint32_t gnb_id_start, uint32_t gnb_id_end); uint32_t gNB_app_register_x2(uint32_t gnb_id_start, uint32_t gnb_id_end); #endif /* GNB_APP_H_ */ diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 88a784225c..d1d24dd484 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -1242,13 +1242,14 @@ static void check_ssb_raster(uint64_t freq, int band, int scs) gscn, freq, band); } -void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) +void RCconfig_NRRRC(gNB_RRC_INST *rrc) { int num_gnbs = 0; char aprefix[MAX_OPTNAME_SIZE*2 + 8]; int32_t gnb_id = 0; int k = 0; + int i = 0; paramdef_t GNBSParams[] = GNBSPARAMS_DESC; ////////// Identification parameters @@ -1268,6 +1269,7 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) config_get( GNBSParams,sizeof(GNBSParams)/sizeof(paramdef_t),NULL); num_gnbs = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt; AssertFatal (i 0) { @@ -1334,6 +1336,7 @@ void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) // search if in active list + gNB_RrcConfigurationReq nrrrc_config = {0}; for (k=0; k configuration, &NRRRC_CONFIGURATION_REQ(msg_p), sizeof(NRRRC_CONFIGURATION_REQ(msg_p))); + openair_rrc_gNB_configuration(rrc, &nrrrc_config); }//End if (num_gnbs>0) config_security(rrc); diff --git a/openair2/GNB_APP/gnb_config.h b/openair2/GNB_APP/gnb_config.h index 3e5b43b0f0..d00ac09e43 100644 --- a/openair2/GNB_APP/gnb_config.h +++ b/openair2/GNB_APP/gnb_config.h @@ -100,7 +100,7 @@ extern void NRRCConfig(void); //void enb_config_display(void); //void ru_config_display(void); -void RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc); +void RCconfig_NRRRC(gNB_RRC_INST *rrc); int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i); int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i); int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i); diff --git a/openair2/RRC/NR/nr_rrc_extern.h b/openair2/RRC/NR/nr_rrc_extern.h index 18185fa081..64e6095dcd 100644 --- a/openair2/RRC/NR/nr_rrc_extern.h +++ b/openair2/RRC/NR/nr_rrc_extern.h @@ -35,6 +35,8 @@ #include "LAYER2/RLC/rlc.h" #include "openair2/RRC/common.h" +void openair_rrc_gNB_configuration(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *configuration); + extern UE_RRC_INST *UE_rrc_inst; extern uint8_t DRB2LCHAN[8]; diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 746216d12a..4731745771 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -296,18 +296,12 @@ static void rrc_gNB_CU_DU_init(gNB_RRC_INST *rrc) cu_init_f1_ue_data(); } -static void openair_rrc_gNB_configuration(const module_id_t gnb_mod_idP, gNB_RrcConfigurationReq *configuration) +void openair_rrc_gNB_configuration(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *configuration) { - protocol_ctxt_t ctxt = { 0 }; - gNB_RRC_INST *rrc=RC.nrrrc[gnb_mod_idP]; - PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, gnb_mod_idP, GNB_FLAG_YES, NOT_A_RNTI, 0, 0,gnb_mod_idP); - LOG_I(NR_RRC, - PROTOCOL_NR_RRC_CTXT_FMT" Init...\n", - PROTOCOL_NR_RRC_CTXT_ARGS(&ctxt)); AssertFatal(rrc != NULL, "RC.nrrrc not initialized!"); AssertFatal(NUMBER_OF_UE_MAX < (module_id_t)0xFFFFFFFFFFFFFFFF, " variable overflow"); AssertFatal(configuration!=NULL,"configuration input is null\n"); - rrc->module_id = gnb_mod_idP; + rrc->module_id = 0; rrc_gNB_CU_DU_init(rrc); uid_linear_allocator_init(&rrc->uid_allocator); RB_INIT(&rrc->rrc_ue_head); @@ -316,7 +310,6 @@ static void openair_rrc_gNB_configuration(const module_id_t gnb_mod_idP, gNB_Rrc /// System Information INIT pthread_mutex_init(&rrc->cell_info_mutex,NULL); rrc->cell_info_configured = 0; - LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_FMT" Checking release \n",PROTOCOL_NR_RRC_CTXT_ARGS(&ctxt)); init_NR_SI(rrc, configuration); return; } // END openair_rrc_gNB_configuration @@ -2620,11 +2613,6 @@ void *rrc_gnb_task(void *args_p) { rrc_gNB_process_NGAP_PDUSESSION_RELEASE_COMMAND(msg_p, instance); break; - /* Messages from gNB app */ - case NRRRC_CONFIGURATION_REQ: - openair_rrc_gNB_configuration(instance, &NRRRC_CONFIGURATION_REQ(msg_p)); - break; - /* Messages from F1AP task */ case F1AP_SETUP_REQ: AssertFatal(NODE_IS_CU(RC.nrrrc[instance]->node_type), "should not receive F1AP_SETUP_REQUEST, need call by CU!\n"); From aaae82d7b42c99585b1fd1aa82f695ad6aa1185f Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 18 Jul 2023 19:12:42 +0200 Subject: [PATCH 29/63] Implement F1 Setup Request/Response to be used internally - send F1 Setup using callback - store f1 setup req locally for reference - check F1 Setup Req against RRC data structures: * if matches: send F1 Setup Response using callback * if not matching: send F1 Setup Failure using callback - don't send CU config update by default, we don't need this - if the Setup Response does not contain a cell, don't activate. It is possible the CU sends a gNB-CU configuration update, which will initialize the structures --- openair2/GNB_APP/gnb_app.c | 19 +- openair2/GNB_APP/gnb_config.c | 490 +++++------------- openair2/GNB_APP/gnb_config.h | 3 +- .../LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c | 30 +- .../LAYER2/NR_MAC_gNB/mac_rrc_ul_direct.c | 37 +- openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 7 + openair2/RRC/NR/nr_rrc_defs.h | 8 +- openair2/RRC/NR/rrc_gNB.c | 195 ++++--- 8 files changed, 326 insertions(+), 463 deletions(-) diff --git a/openair2/GNB_APP/gnb_app.c b/openair2/GNB_APP/gnb_app.c index 5769d98626..18ca27db58 100644 --- a/openair2/GNB_APP/gnb_app.c +++ b/openair2/GNB_APP/gnb_app.c @@ -160,12 +160,9 @@ void *gNB_app_task(void *args_p) LOG_E(F1AP, "Create task for F1AP DU failed\n"); AssertFatal(1==0,"exiting"); } - // configure F1AP here for F1C - LOG_I(GNB_APP,"ngran_gNB_DU: Allocating ITTI message for F1AP_SETUP_REQ\n"); - msg_p = itti_alloc_new_message (TASK_GNB_APP, 0, F1AP_DU_REGISTER_REQ); - RCconfig_NR_DU_F1(msg_p, 0); - - itti_send_msg_to_task (TASK_DU_F1, GNB_MODULE_ID_TO_INSTANCE(0), msg_p); + } + if (NODE_IS_DU(node_type) || NODE_IS_MONOLITHIC(node_type)) { + RC_config_trigger_F1Setup(); } } do { @@ -230,15 +227,9 @@ void *gNB_app_task(void *args_p) break; case F1AP_SETUP_RESP: - AssertFatal(NODE_IS_DU(node_type), "Should not have received F1AP_SETUP_RESP in CU/gNB\n"); - - LOG_I(GNB_APP, "Received %s: associated ngran_gNB_CU %s with %d cells to activate\n", ITTI_MSG_NAME (msg_p), - F1AP_SETUP_RESP(msg_p).gNB_CU_name,F1AP_SETUP_RESP(msg_p).num_cells_to_activate); - cell_to_activate = F1AP_SETUP_RESP(msg_p).num_cells_to_activate; - - gNB_app_handle_f1ap_setup_resp(&F1AP_SETUP_RESP(msg_p)); - + AssertFatal(false, "Should not received this, logic bug\n"); break; + case F1AP_GNB_CU_CONFIGURATION_UPDATE: AssertFatal(NODE_IS_DU(node_type), "Should not have received F1AP_GNB_CU_CONFIGURATION_UPDATE in CU/gNB\n"); diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index d1d24dd484..e395c4c866 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -1909,398 +1909,174 @@ int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i) { return 0; } -static f1ap_net_config_t read_DU_IP_config(const eth_params_t* f1_params) + +int RC_config_trigger_F1Setup() { - f1ap_net_config_t nc = {0}; - - nc.CU_f1_ip_address.ipv6 = 0; - nc.CU_f1_ip_address.ipv4 = 1; - strcpy(nc.CU_f1_ip_address.ipv4_address, f1_params->remote_addr); - nc.CUport = f1_params->remote_portd; - LOG_I(GNB_APP, - "FIAP: CU_ip4_address in DU %p, strlen %d\n", - nc.CU_f1_ip_address.ipv4_address, - (int)strlen(f1_params->remote_addr)); - - nc.DU_f1_ip_address.ipv6 = 0; - nc.DU_f1_ip_address.ipv4 = 1; - strcpy(nc.DU_f1_ip_address.ipv4_address, f1_params->my_addr); - nc.DUport = f1_params->my_portd; - LOG_I(GNB_APP, - "FIAP: DU_ip4_address in DU %p, strlen %ld\n", - nc.DU_f1_ip_address.ipv4_address, - strlen(f1_params->my_addr)); - - // sctp_in_streams/sctp_out_streams are given by SCTP layer - return nc; -} - -int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i) { - int k; paramdef_t GNBSParams[] = GNBSPARAMS_DESC; paramdef_t GNBParams[] = GNBPARAMS_DESC; paramlist_def_t GNBParamList = {GNB_CONFIG_STRING_GNB_LIST,NULL,0}; config_get( GNBSParams,sizeof(GNBSParams)/sizeof(paramdef_t),NULL); int num_gnbs = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt; - AssertFatal (i < num_gnbs, - "Failed to parse config file no %uth element in %s \n",i, GNB_CONFIG_STRING_ACTIVE_GNBS); + AssertFatal(num_gnbs == 1, "cannot configure DU: required config section \"gNBs\" missing\n"); - if (num_gnbs > 0) { - // Output a list of all eNBs. - 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_t *f1Setup = &F1AP_DU_REGISTER_REQ(msg_p).setup_req; - f1Setup->num_cells_available = 0; + // Output a list of all eNBs. + config_getlist(&GNBParamList, GNBParams, sizeof(GNBParams) / sizeof(paramdef_t), NULL); + AssertFatal(GNBParamList.paramarray[0][GNB_GNB_ID_IDX].uptr != NULL, "gNB id %u is not defined in configuration file\n", 0); - for (k=0; k num_cells_available++; - f1Setup->gNB_DU_id = *(GNBParamList.paramarray[k][GNB_GNB_ID_IDX].uptr); - f1Setup->gNB_DU_name = strdup(*(GNBParamList.paramarray[k][GNB_GNB_NAME_IDX].strptr)); - f1Setup->cell[k].info.tac = malloc(sizeof(*f1Setup->cell[k].info.tac)); - AssertFatal(f1Setup->cell[k].info.tac != NULL, "out of memory\n"); - *f1Setup->cell[k].info.tac = *GNBParamList.paramarray[k][GNB_TRACKING_AREA_CODE_IDX].uptr; - f1Setup->cell[k].info.plmn.mcc = *PLMNParamList.paramarray[k][GNB_MOBILE_COUNTRY_CODE_IDX].uptr; - f1Setup->cell[k].info.plmn.mnc = *PLMNParamList.paramarray[k][GNB_MOBILE_NETWORK_CODE_IDX].uptr; - f1Setup->cell[k].info.plmn.mnc_digit_length = *PLMNParamList.paramarray[k][GNB_MNC_DIGIT_LENGTH].u8ptr; - AssertFatal((f1Setup->cell[k].info.plmn.mnc_digit_length == 2) || - (f1Setup->cell[k].info.plmn.mnc_digit_length == 3), - "BAD MNC DIGIT LENGTH %d", - f1Setup->cell[k].info.plmn.mnc_digit_length); - f1Setup->cell[k].info.nr_cellid = (uint64_t)*(GNBParamList.paramarray[i][GNB_NRCELLID_IDX].u64ptr); - LOG_I(GNB_APP, - "F1AP: gNB idx %d gNB_DU_id %ld, gNB_DU_name %s, TAC %d MCC/MNC/length %d/%d/%d cellID %ld\n", - k, - f1Setup->gNB_DU_id, - f1Setup->gNB_DU_name, - *f1Setup->cell[k].info.tac, - f1Setup->cell[k].info.plmn.mcc, - f1Setup->cell[k].info.plmn.mnc, - f1Setup->cell[k].info.plmn.mnc_digit_length, - f1Setup->cell[k].info.nr_cellid); + for (int I = 0; I < sizeof(PLMNParams) / sizeof(paramdef_t); ++I) + PLMNParams[I].chkPptr = &(config_check_PLMNParams[I]); - F1AP_DU_REGISTER_REQ(msg_p).net_config = read_DU_IP_config(&RC.nrmac[k]->eth_params_n); + config_getlist(&PLMNParamList, PLMNParams, sizeof(PLMNParams) / sizeof(paramdef_t), aprefix); - gNB_RRC_INST *rrc = RC.nrrrc[k]; - // wait until RRC cell information is configured - int cell_info_configured = 0; + f1ap_setup_req_t *req = calloc(1, sizeof(*req)); + req->num_cells_available = 1; + req->gNB_DU_id = *(GNBParamList.paramarray[0][GNB_GNB_ID_IDX].uptr); + req->gNB_DU_name = strdup(*(GNBParamList.paramarray[0][GNB_GNB_NAME_IDX].strptr)); + req->cell[0].info.tac = malloc(sizeof(*req->cell[0].info.tac)); + AssertFatal(req->cell[0].info.tac != NULL, "out of memory\n"); + *req->cell[0].info.tac = *GNBParamList.paramarray[0][GNB_TRACKING_AREA_CODE_IDX].uptr; + req->cell[0].info.plmn.mcc = *PLMNParamList.paramarray[0][GNB_MOBILE_COUNTRY_CODE_IDX].uptr; + req->cell[0].info.plmn.mnc = *PLMNParamList.paramarray[0][GNB_MOBILE_NETWORK_CODE_IDX].uptr; + req->cell[0].info.plmn.mnc_digit_length = *PLMNParamList.paramarray[0][GNB_MNC_DIGIT_LENGTH].u8ptr; + AssertFatal((req->cell[0].info.plmn.mnc_digit_length == 2) || (req->cell[0].info.plmn.mnc_digit_length == 3), + "BAD MNC DIGIT LENGTH %d", + req->cell[0].info.plmn.mnc_digit_length); + req->cell[0].info.nr_cellid = (uint64_t) * (GNBParamList.paramarray[0][GNB_NRCELLID_IDX].u64ptr); + LOG_I(GNB_APP, + "F1AP: gNB idx %d gNB_DU_id %ld, gNB_DU_name %s, TAC %d MCC/MNC/length %d/%d/%d cellID %ld\n", + 0, + req->gNB_DU_id, + req->gNB_DU_name, + *req->cell[0].info.tac, + req->cell[0].info.plmn.mcc, + req->cell[0].info.plmn.mnc, + req->cell[0].info.plmn.mnc_digit_length, + req->cell[0].info.nr_cellid); - do { - LOG_I(GNB_APP,"ngran_gNB_DU: Waiting for basic cell configuration\n"); - usleep(100000); - pthread_mutex_lock(&rrc->cell_info_mutex); - cell_info_configured = rrc->cell_info_configured; - pthread_mutex_unlock(&rrc->cell_info_mutex); - } while (cell_info_configured == 0); + gNB_RRC_INST *rrc = RC.nrrrc[0]; + DevAssert(rrc); + // wait until RRC cell information is configured + const NR_ServingCellConfigCommon_t *scc = rrc->configuration.scc; + DevAssert(scc != NULL); + req->cell[0].info.nr_pci = *scc->physCellId; + LOG_W(GNB_APP, "no slices transported via F1 Setup Request!\n"); + req->cell[0].info.num_ssi = 0; - rrc->configuration.mcc[0] = f1Setup->cell[k].info.plmn.mcc; - rrc->configuration.mnc[0] = f1Setup->cell[k].info.plmn.mnc; - rrc->configuration.tac = *f1Setup->cell[k].info.tac; - rrc->nr_cellid = f1Setup->cell[k].info.nr_cellid; - const NR_ServingCellConfigCommon_t *scc = rrc->configuration.scc; - DevAssert(scc != NULL); - f1Setup->cell[k].info.nr_pci = *scc->physCellId; - f1Setup->cell[k].info.num_ssi = 0; - - if (scc->tdd_UL_DL_ConfigurationCommon) { - LOG_I(GNB_APP,"ngran_DU: Configuring Cell %d for TDD\n",k); - f1Setup->cell[k].info.mode = F1AP_MODE_TDD; - f1ap_tdd_info_t *tdd = &f1Setup->cell[k].info.tdd; - tdd->freqinfo.arfcn = scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA; - tdd->tbw.scs = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; - tdd->tbw.nrb = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; - tdd->freqinfo.band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; - } else { - LOG_I(GNB_APP,"ngran_DU: Configuring Cell %d for FDD\n",k); - f1Setup->cell[k].info.mode = F1AP_MODE_FDD; - f1ap_fdd_info_t *fdd = &f1Setup->cell[k].info.fdd; - fdd->dl_freqinfo.arfcn = scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA; - fdd->ul_freqinfo.arfcn = *scc->uplinkConfigCommon->frequencyInfoUL->absoluteFrequencyPointA; - fdd->dl_tbw.scs = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; - fdd->ul_tbw.scs = scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; - fdd->dl_tbw.nrb = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; - fdd->ul_tbw.nrb = scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; - fdd->dl_freqinfo.band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; - fdd->ul_freqinfo.band = *scc->uplinkConfigCommon->frequencyInfoUL->frequencyBandList->list.array[0]; - } - - f1Setup->cell[k].info.measurement_timing_information = "0"; - - DevAssert(rrc->carrier.mib != NULL); - int buf_len = 3; // this is what we assume in monolithic - f1Setup->cell[k].sys_info = calloc(1, sizeof(*f1Setup->cell[k].sys_info)); - AssertFatal(f1Setup->cell[k].sys_info != NULL, "out of memory\n"); - f1ap_gnb_du_system_info_t *sys_info = f1Setup->cell[k].sys_info; - sys_info->mib = calloc(buf_len, sizeof(*sys_info->mib)); - DevAssert(sys_info->mib != NULL); - sys_info->mib_length = encode_MIB_NR(rrc->carrier.mib, 0, sys_info->mib, buf_len); - DevAssert(sys_info->mib_length == buf_len); - - NR_BCCH_DL_SCH_Message_t *bcch_message = NULL; - asn_codec_ctx_t st={100*1000}; - asn_dec_rval_t dec_rval = uper_decode_complete( &st, - &asn_DEF_NR_BCCH_DL_SCH_Message, - (void **)&bcch_message, - (const void *)rrc->carrier.SIB1, - rrc->carrier.sizeof_SIB1); - - if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { - LOG_E(RRC,"SIB1 decode error\n"); - // free the memory - SEQUENCE_free( &asn_DEF_NR_BCCH_DL_SCH_Message, bcch_message, 1 ); - exit(1); - } - - NR_SIB1_t *bcch_SIB1 = bcch_message->message.choice.c1->choice.systemInformationBlockType1; - sys_info->sib1 = calloc(1,rrc->carrier.sizeof_SIB1); - asn_enc_rval_t enc_rval = - uper_encode_to_buffer(&asn_DEF_NR_SIB1, NULL, (void *)bcch_SIB1, sys_info->sib1, NR_MAX_SIB_LENGTH / 8); - AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", - enc_rval.failed_type->name, enc_rval.encoded); - - //if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { - LOG_I(NR_RRC, "SIB1 container to be integrated in F1 Setup request:\n"); - xer_fprint(stdout, &asn_DEF_NR_SIB1,(void *)bcch_message->message.choice.c1->choice.systemInformationBlockType1 ); - //} - sys_info->sib1_length = (enc_rval.encoded + 7) / 8; - break; - } - } + if (scc->tdd_UL_DL_ConfigurationCommon) { + LOG_I(GNB_APP, "ngran_DU: Configuring Cell %d for TDD\n", 0); + req->cell[0].info.mode = F1AP_MODE_TDD; + f1ap_tdd_info_t *tdd = &req->cell[0].info.tdd; + tdd->freqinfo.arfcn = scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA; + tdd->tbw.scs = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; + tdd->tbw.nrb = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; + tdd->freqinfo.band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; + } else { + LOG_I(GNB_APP, "ngran_DU: Configuring Cell %d for FDD\n", 0); + req->cell[0].info.mode = F1AP_MODE_FDD; + f1ap_fdd_info_t *fdd = &req->cell[0].info.fdd; + fdd->dl_freqinfo.arfcn = scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA; + fdd->ul_freqinfo.arfcn = *scc->uplinkConfigCommon->frequencyInfoUL->absoluteFrequencyPointA; + fdd->dl_tbw.scs = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; + fdd->ul_tbw.scs = scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; + fdd->dl_tbw.nrb = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; + fdd->ul_tbw.nrb = scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; + fdd->dl_freqinfo.band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; + fdd->ul_freqinfo.band = *scc->uplinkConfigCommon->frequencyInfoUL->frequencyBandList->list.array[0]; } + + req->cell[0].info.measurement_timing_information = "0"; + + DevAssert(rrc->carrier.mib != NULL); + int buf_len = 3; // this is what we assume in monolithic + req->cell[0].sys_info = calloc(1, sizeof(*req->cell[0].sys_info)); + AssertFatal(req->cell[0].sys_info != NULL, "out of memory\n"); + f1ap_gnb_du_system_info_t *sys_info = req->cell[0].sys_info; + sys_info->mib = calloc(buf_len, sizeof(*sys_info->mib)); + DevAssert(sys_info->mib != NULL); + sys_info->mib_length = encode_MIB_NR(rrc->carrier.mib, 0, sys_info->mib, buf_len); + DevAssert(sys_info->mib_length == buf_len); + + NR_BCCH_DL_SCH_Message_t *bcch_message = NULL; + asn_codec_ctx_t st = {100 * 1000}; + asn_dec_rval_t dec_rval = uper_decode_complete(&st, + &asn_DEF_NR_BCCH_DL_SCH_Message, + (void **)&bcch_message, + (const void *)rrc->carrier.SIB1, + rrc->carrier.sizeof_SIB1); + + if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { + LOG_E(RRC, "SIB1 decode error\n"); + // free the memory + SEQUENCE_free(&asn_DEF_NR_BCCH_DL_SCH_Message, bcch_message, 1); + exit(1); + } + + NR_SIB1_t *bcch_SIB1 = bcch_message->message.choice.c1->choice.systemInformationBlockType1; + sys_info->sib1 = calloc(1, rrc->carrier.sizeof_SIB1); + asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_SIB1, NULL, (void *)bcch_SIB1, sys_info->sib1, NR_MAX_SIB_LENGTH / 8); + AssertFatal(enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); + sys_info->sib1_length = (enc_rval.encoded + 7) / 8; + + if (LOG_DEBUGFLAG(DEBUG_ASN1)) + xer_fprint(stdout, &asn_DEF_NR_SIB1, (void *)bcch_message->message.choice.c1->choice.systemInformationBlockType1); + + gNB_MAC_INST *mac = RC.nrmac[0]; + mac->mac_rrc.f1_setup_request(req); + mac->f1_config.setup_req = req; + return 0; } -int du_check_plmn_identity(rrc_gNB_carrier_data_t *carrier,uint16_t mcc,uint16_t mnc,uint8_t mnc_digit_length) { - NR_SIB1_t *sib1 = carrier->siblock1->message.choice.c1->choice.systemInformationBlockType1; - AssertFatal(sib1->cellAccessRelatedInfo.plmn_IdentityInfoList.list.array[0]->plmn_IdentityList.list.count > 0, - "plmn info isn't there\n"); - AssertFatal(mnc_digit_length == 2 || mnc_digit_length == 3, - "impossible mnc_digit_length %d\n", mnc_digit_length); - NR_PLMN_Identity_t *plmn_Identity = sib1->cellAccessRelatedInfo.plmn_IdentityInfoList.list.array[0] - ->plmn_IdentityList.list.array[0]; - - // check if mcc is different and return failure if so - if (mcc != - ((*plmn_Identity->mcc->list.array[0])*100)+ - ((*plmn_Identity->mcc->list.array[1])*10) + - (*plmn_Identity->mcc->list.array[2])) { - LOG_E(GNB_APP, "mcc in F1AP_SETUP_RESP message is different from mcc in DU \n"); - return(0); - } - - // check that mnc digit length is different and return failure if so - if (mnc_digit_length != plmn_Identity->mnc.list.count) { - LOG_E(GNB_APP, "mnc(length: %d) in F1AP_SETUP_RESP message is different from mnc(length: %d) in DU \n", - mnc_digit_length, plmn_Identity->mnc.list.count); - return 0; - } - - // check that 2 digit mnc is different and return failure if so - if (mnc_digit_length == 2 && - (mnc != - (*plmn_Identity->mnc.list.array[0]*10) + - (*plmn_Identity->mnc.list.array[1]))) { - LOG_E(GNB_APP, "mnc(%d) in F1AP_SETUP_RESP message is different from mnc(%ld%ld) in DU \n", - mnc, *plmn_Identity->mnc.list.array[0], *plmn_Identity->mnc.list.array[1]); - return(0); - } - else if (mnc_digit_length == 3 && - (mnc != - (*plmn_Identity->mnc.list.array[0]*100) + - (*plmn_Identity->mnc.list.array[1]*10) + - (*plmn_Identity->mnc.list.array[2]))) { - LOG_E(GNB_APP, "mnc(%d) in F1AP_SETUP_RESP message is different from mnc(%ld%ld%ld) in DU \n", - mnc, *plmn_Identity->mnc.list.array[0], *plmn_Identity->mnc.list.array[1], *plmn_Identity->mnc.list.array[2]); - return(0); - } - - // if we're here, the mcc/mnc match so return success - return(1); -} - -void du_extract_and_decode_SI(int inst, int si_ind, uint8_t *si_container, int si_container_length) { - gNB_RRC_INST *rrc = RC.nrrrc[inst]; - rrc_gNB_carrier_data_t *carrier = &rrc->carrier; - NR_BCCH_DL_SCH_Message_t *bcch_message ; - AssertFatal(si_ind == 0, "Can only handle a single SI block for now\n"); - LOG_I(GNB_APP, "rrc inst %d: Trying to decode SI block %d @ %p, length %d\n", inst, si_ind, si_container, si_container_length); - // point to first SI block - bcch_message = &carrier->systemInformation; - asn_dec_rval_t dec_rval = uper_decode_complete( NULL, - &asn_DEF_NR_BCCH_DL_SCH_Message, - (void **)&bcch_message, - (const void *)si_container, - si_container_length); - - if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { - AssertFatal(1==0, "[GNB_APP][NR_RRC inst %"PRIu8"] Failed to decode BCCH_DLSCH_MESSAGE (%zu bits)\n", - inst, - dec_rval.consumed ); - } - - if (bcch_message->message.present == NR_BCCH_DL_SCH_MessageType_PR_c1) { - switch (bcch_message->message.choice.c1->present) { - case NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1: - AssertFatal(1 == 0, "Should have received SIB1 from CU\n"); - break; - - case NR_BCCH_DL_SCH_MessageType__c1_PR_systemInformation: - { - NR_SystemInformation_t *si = bcch_message->message.choice.c1->choice.systemInformation; - - if (si->criticalExtensions.present == NR_SystemInformation__criticalExtensions_PR_systemInformation) { - for (int i = 0; i < si->criticalExtensions.choice.systemInformation->sib_TypeAndInfo.list.count; i++) { - LOG_I(GNB_APP, "Extracting SI %d/%d\n", i, si->criticalExtensions.choice.systemInformation->sib_TypeAndInfo.list.count); - SystemInformation_IEs__sib_TypeAndInfo__Member *typeAndInfo; - typeAndInfo = si->criticalExtensions.choice.systemInformation->sib_TypeAndInfo.list.array[i]; - - switch(typeAndInfo->present) { - case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_NOTHING: - AssertFatal(0, "Should have received SIB2 SIB3 from CU\n"); - break; - case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib2: - LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB2 in CU F1AP_SETUP_RESP message\n", inst); - carrier->sib2 = typeAndInfo->choice.sib2; - carrier->SIB23 = (uint8_t *)malloc(64); - memcpy((void *)carrier->SIB23, (void *)si_container, si_container_length); - carrier->sizeof_SIB23 = si_container_length; - break; - case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib3: - carrier->sib3 = typeAndInfo->choice.sib3; - LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB3 in CU F1AP_SETUP_RESP message\n", inst); - break; - case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib4: - LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB4 in CU F1AP_SETUP_RESP message\n", inst); - break; - case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib5: - LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB5 in CU F1AP_SETUP_RESP message\n", inst); - break; - case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib6: - LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB6 in CU F1AP_SETUP_RESP message\n", inst); - break; - case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib7: - LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB7 in CU F1AP_SETUP_RESP message\n", inst); - break; - case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib8: - LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB8 in CU F1AP_SETUP_RESP message\n", inst); - break; - case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib9: - LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB9 in CU F1AP_SETUP_RESP message\n", inst); - break; - case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib10_v1610: - LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB10 in CU F1AP_SETUP_RESP message\n", inst); - break; - case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib11_v1610: - LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB11 in CU F1AP_SETUP_RESP message\n", inst); - break; - case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib12_v1610: - LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB12 in CU F1AP_SETUP_RESP message\n", inst); - break; - case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib13_v1610: - LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB13 in CU F1AP_SETUP_RESP message\n", inst); - break; - case NR_SystemInformation_IEs__sib_TypeAndInfo__Member_PR_sib14_v1610: - LOG_I(GNB_APP, "[NR_RRC %"PRIu8"] Found SIB14 in CU F1AP_SETUP_RESP message\n", inst); - break; - default: - AssertFatal(1 == 0,"Shouldn't have received this SI %d\n", typeAndInfo->present); - break; - } - } - } - - break; - } - - case NR_BCCH_DL_SCH_MessageType__c1_PR_NOTHING: - AssertFatal(0, "Should have received SIB1 from CU\n"); - break; - } - } else AssertFatal(1 == 0, "No SI messages\n"); -} - -int gNB_app_handle_f1ap_setup_resp(f1ap_setup_resp_t *resp) { - int i, j, si_ind; - int ret=0; - LOG_I(GNB_APP, "cells_to_activate %d, RRC instances %d\n", - resp->num_cells_to_activate, RC.nb_nr_inst); - - for (j = 0; j < resp->num_cells_to_activate; j++) { - for (i = 0; i < RC.nb_nr_inst; i++) { - rrc_gNB_carrier_data_t *carrier = &RC.nrrrc[i]->carrier; - // identify local index of cell j by nr_cellid, plmn identity and physical cell ID - LOG_I(GNB_APP, "Checking cell %d, rrc inst %d : rrc->nr_cellid %lx, resp->nr_cellid %lx\n", - j, i, RC.nrrrc[i]->nr_cellid, resp->cells_to_activate[j].nr_cellid); - - if (RC.nrrrc[i]->nr_cellid == resp->cells_to_activate[j].nr_cellid - && (du_check_plmn_identity(carrier, - resp->cells_to_activate[j].plmn.mcc, - resp->cells_to_activate[j].plmn.mnc, - resp->cells_to_activate[j].plmn.mnc_digit_length) - > 0 - && resp->cells_to_activate[j].nrpci == carrier->physCellId)) { - // copy system information and decode it - for (si_ind=0; si_indcells_to_activate[j].num_SI; si_ind++) { - - du_extract_and_decode_SI(i, - si_ind, - resp->cells_to_activate[j].SI_container[si_ind], - resp->cells_to_activate[j].SI_container_length[si_ind]); - } - ret++; - } else { - LOG_E(GNB_APP, "F1 Setup Response not matching\n"); - } - } - } - return(ret); +static bool check_plmn_identity(const f1ap_plmn_t *check_plmn, const f1ap_plmn_t *plmn) +{ + return plmn->mcc == check_plmn->mcc && plmn->mnc_digit_length == check_plmn->mnc_digit_length && plmn->mnc == check_plmn->mnc; } int gNB_app_handle_f1ap_gnb_cu_configuration_update(f1ap_gnb_cu_configuration_update_t *gnb_cu_cfg_update) { - int i, j, si_ind, ret=0; + int i, j, ret=0; LOG_I(GNB_APP, "cells_to_activate %d, RRC instances %d\n", gnb_cu_cfg_update->num_cells_to_activate, RC.nb_nr_inst); + AssertFatal(gnb_cu_cfg_update->num_cells_to_activate == 1, "only one cell supported at the moment\n"); + AssertFatal(RC.nb_nr_inst == 1, "expected one instance\n"); + gNB_MAC_INST *mac = RC.nrmac[0]; + NR_SCHED_LOCK(&mac->sched_lock); for (j = 0; j < gnb_cu_cfg_update->num_cells_to_activate; j++) { for (i = 0; i < RC.nb_nr_inst; i++) { rrc_gNB_carrier_data_t *carrier = &RC.nrrrc[i]->carrier; + f1ap_setup_req_t *setup_req = RC.nrmac[i]->f1_config.setup_req; // identify local index of cell j by nr_cellid, plmn identity and physical cell ID - LOG_I(GNB_APP, "Checking cell %d, rrc inst %d : rrc->nr_cellid %lx, gnb_cu_cfg_updatenr_cellid %lx\n", - j, i, RC.nrrrc[i]->nr_cellid, gnb_cu_cfg_update->cells_to_activate[j].nr_cellid); if (RC.nrrrc[i]->nr_cellid == gnb_cu_cfg_update->cells_to_activate[j].nr_cellid - && (du_check_plmn_identity(carrier, - gnb_cu_cfg_update->cells_to_activate[j].plmn.mcc, - gnb_cu_cfg_update->cells_to_activate[j].plmn.mnc, - gnb_cu_cfg_update->cells_to_activate[j].plmn.mnc_digit_length) - > 0 - && gnb_cu_cfg_update->cells_to_activate[j].nrpci == carrier->physCellId)) { - // copy system information and decode it - for (si_ind = 0; si_ind < gnb_cu_cfg_update->cells_to_activate[j].num_SI; si_ind++) { - - du_extract_and_decode_SI(i, - 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]); - } - ret++; + && check_plmn_identity(&setup_req->cell[0].info.plmn, &gnb_cu_cfg_update->cells_to_activate[j].plmn) > 0 + && gnb_cu_cfg_update->cells_to_activate[j].nrpci == carrier->physCellId) { + // copy system information and decode it + AssertFatal(gnb_cu_cfg_update->cells_to_activate[j].num_SI == 0, + "gNB-CU Configuration Update: handling of additional SIs not implemend\n"); + ret++; + mac->f1_config.setup_resp = malloc(sizeof(*mac->f1_config.setup_resp)); + AssertFatal(mac->f1_config.setup_resp != NULL, "out of memory\n"); + mac->f1_config.setup_resp->gNB_CU_name = gnb_cu_cfg_update->gNB_CU_name; + mac->f1_config.setup_resp->num_cells_to_activate = gnb_cu_cfg_update->num_cells_to_activate; + mac->f1_config.setup_resp->cells_to_activate[0] = gnb_cu_cfg_update->cells_to_activate[0]; } else { LOG_E(GNB_APP, "GNB_CU_CONFIGURATION_UPDATE not matching\n"); } } } + NR_SCHED_UNLOCK(&mac->sched_lock); MessageDef *msg_ack_p = NULL; if (ret > 0) { // generate gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE diff --git a/openair2/GNB_APP/gnb_config.h b/openair2/GNB_APP/gnb_config.h index d00ac09e43..9d8a9487cb 100644 --- a/openair2/GNB_APP/gnb_config.h +++ b/openair2/GNB_APP/gnb_config.h @@ -103,8 +103,7 @@ extern void NRRCConfig(void); void RCconfig_NRRRC(gNB_RRC_INST *rrc); int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i); int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i); -int RCconfig_NR_DU_F1(MessageDef *msg_p, uint32_t i); -int gNB_app_handle_f1ap_setup_resp(f1ap_setup_resp_t *resp); +int RC_config_trigger_F1Setup(void); int gNB_app_handle_f1ap_gnb_cu_configuration_update(f1ap_gnb_cu_configuration_update_t *gnb_cu_cfg_update); MessageDef *RCconfig_NR_CU_E1(bool separate_CUUP_process); ngran_node_t get_node_type(void); diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c index ae88609d5a..6b341424b2 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c +++ b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c @@ -30,9 +30,37 @@ #include "uper_decoder.h" #include "uper_encoder.h" +static bool check_plmn_identity(const f1ap_plmn_t *check_plmn, const f1ap_plmn_t *plmn) +{ + return plmn->mcc == check_plmn->mcc && plmn->mnc_digit_length == check_plmn->mnc_digit_length && plmn->mnc == check_plmn->mnc; +} + void f1_setup_response(const f1ap_setup_resp_t *resp) { - AssertFatal(false, "not implemented\n"); + LOG_I(MAC, "received F1 Setup Response from CU %s\n", resp->gNB_CU_name); + + if (resp->num_cells_to_activate == 0) { + LOG_W(NR_MAC, "no cell to activate: cell remains blocked\n"); + return; + } + + gNB_MAC_INST *mac = RC.nrmac[0]; + NR_SCHED_LOCK(&mac->sched_lock); + const f1ap_setup_req_t *setup_req = mac->f1_config.setup_req; + const f1ap_served_cell_info_t *du_cell = &setup_req->cell[0].info; + + AssertFatal(resp->num_cells_to_activate == 1, "can only handle one cell, but %d activated\n", resp->num_cells_to_activate); + const served_cells_to_activate_t *cu_cell = &resp->cells_to_activate[0]; + + AssertFatal(du_cell->nr_cellid == cu_cell->nr_cellid, "CellID mismatch: DU %ld vs CU %ld\n", du_cell->nr_cellid, cu_cell->nr_cellid); + AssertFatal(check_plmn_identity(&du_cell->plmn, &cu_cell->plmn), "PLMN mismatch\n"); + AssertFatal(du_cell->nr_pci == cu_cell->nrpci, "PCI mismatch: DU %d vs CU %d\n", du_cell->nr_pci, cu_cell->nrpci); + + AssertFatal(cu_cell->num_SI == 0, "handling of CU-provided SIBs: not implemented\n"); + + NR_SCHED_UNLOCK(&mac->sched_lock); + + /* TODO: handling of pre-operational state? */ } void f1_setup_failure(const f1ap_setup_failure_t *failure) diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_direct.c b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_direct.c index fabd0df99e..905b9255e4 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_direct.c +++ b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_direct.c @@ -26,7 +26,42 @@ static void f1_setup_request_direct(const f1ap_setup_req_t *req) { - AssertFatal(false, "not implemented\n"); + MessageDef *msg = itti_alloc_new_message(TASK_MAC_GNB, 0, F1AP_SETUP_REQ); + f1ap_setup_req_t *f1ap_msg = &F1AP_SETUP_REQ(msg); + f1ap_msg->gNB_DU_id = req->gNB_DU_id; + f1ap_msg->gNB_DU_name = strdup(req->gNB_DU_name); + f1ap_msg->num_cells_available = req->num_cells_available; + for (int n = 0; n < req->num_cells_available; ++n) { + f1ap_msg->cell[n].info = req->cell[n].info; // copy most fields + if (req->cell[n].info.tac) { + f1ap_msg->cell[n].info.tac = malloc(sizeof(*f1ap_msg->cell[n].info.tac)); + AssertFatal(f1ap_msg->cell[n].info.tac != NULL, "out of memory\n"); + *f1ap_msg->cell[n].info.tac = *req->cell[n].info.tac; + } + if (req->cell[n].info.measurement_timing_information) + f1ap_msg->cell[n].info.measurement_timing_information = strdup(req->cell[n].info.measurement_timing_information); + + if (req->cell[n].sys_info) { + f1ap_gnb_du_system_info_t *orig_sys_info = req->cell[n].sys_info; + f1ap_gnb_du_system_info_t *copy_sys_info = calloc(1, sizeof(*copy_sys_info)); + AssertFatal(copy_sys_info != NULL, "out of memory\n"); + f1ap_msg->cell[n].sys_info = copy_sys_info; + + copy_sys_info->mib = calloc(orig_sys_info->mib_length, sizeof(uint8_t)); + AssertFatal(copy_sys_info->mib != NULL, "out of memory\n"); + memcpy(copy_sys_info->mib, orig_sys_info->mib, orig_sys_info->mib_length); + copy_sys_info->mib_length = orig_sys_info->mib_length; + + if (orig_sys_info->sib1_length > 0) { + copy_sys_info->sib1 = calloc(orig_sys_info->sib1_length, sizeof(uint8_t)); + AssertFatal(copy_sys_info->sib1 != NULL, "out of memory\n"); + memcpy(copy_sys_info->sib1, orig_sys_info->sib1, orig_sys_info->sib1_length); + copy_sys_info->sib1_length = orig_sys_info->sib1_length; + } + } + } + + itti_send_msg_to_task(TASK_RRC_GNB, 0, msg); } static void ue_context_setup_response_direct(const f1ap_ue_context_setup_t *req, const f1ap_ue_context_setup_t *resp) diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 44e7eadb8a..0f272bbd2d 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -709,6 +709,11 @@ typedef bool (*nr_pp_impl_ul)(module_id_t mod_id, frame_t frame, sub_frame_t slot); +typedef struct f1_config_t { + f1ap_setup_req_t *setup_req; + f1ap_setup_resp_t *setup_resp; +} f1_config_t; + /*! \brief top level eNB MAC structure */ typedef struct gNB_MAC_INST_s { /// Ethernet parameters for northbound midhaul interface @@ -816,7 +821,9 @@ typedef struct gNB_MAC_INST_s { uint8_t min_grant_prb; uint8_t min_grant_mcs; bool identity_pm; + nr_mac_rrc_ul_if_t mac_rrc; + f1_config_t f1_config; int16_t frame; int16_t slot; diff --git a/openair2/RRC/NR/nr_rrc_defs.h b/openair2/RRC/NR/nr_rrc_defs.h index 8e2a9d2842..ae9a08ef73 100644 --- a/openair2/RRC/NR/nr_rrc_defs.h +++ b/openair2/RRC/NR/nr_rrc_defs.h @@ -377,6 +377,10 @@ typedef struct cucp_cuup_if_s { cucp_cuup_bearer_context_setup_func_t bearer_context_mod; } cucp_cuup_if_t; +typedef struct nr_rrc_du_container_t { + f1ap_setup_req_t *setup_req; +} nr_rrc_du_container_t; + //---NR---(completely change)--------------------- typedef struct gNB_RRC_INST_s { @@ -416,8 +420,6 @@ typedef struct gNB_RRC_INST_s { int srs_enable[MAX_NUM_CCs]; uint16_t sctp_in_streams; uint16_t sctp_out_streams; - int cell_info_configured; - pthread_mutex_t cell_info_mutex; char *uecap_file; @@ -427,6 +429,8 @@ typedef struct gNB_RRC_INST_s { nr_mac_rrc_dl_if_t mac_rrc; cucp_cuup_if_t cucp_cuup; + nr_rrc_du_container_t *du; + } gNB_RRC_INST; #include "nr_rrc_proto.h" //should be put here otherwise compilation error diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 4731745771..a181c3ed46 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -251,12 +251,6 @@ static void init_NR_SI(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *configuration nr_mac_config_mib(RC.nrmac[rrc->module_id], rrc->carrier.mib); } - /* set flag to indicate that cell information is configured. This is required - * in DU to trigger F1AP_SETUP procedure */ - pthread_mutex_lock(&rrc->cell_info_mutex); - rrc->cell_info_configured=1; - pthread_mutex_unlock(&rrc->cell_info_mutex); - if (get_softmodem_params()->phy_test > 0 || get_softmodem_params()->do_ra > 0) { rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_allocate_new_ue_context(rrc); gNB_RRC_UE_t *UE = &ue_context_p->ue_context; @@ -308,8 +302,6 @@ void openair_rrc_gNB_configuration(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *c rrc->configuration = *configuration; rrc->carrier.servingcellconfigcommon = configuration->scc; /// System Information INIT - pthread_mutex_init(&rrc->cell_info_mutex,NULL); - rrc->cell_info_configured = 0; init_NR_SI(rrc, configuration); return; } // END openair_rrc_gNB_configuration @@ -1849,95 +1841,126 @@ int rrc_gNB_decode_dcch(const protocol_ctxt_t *const ctxt_pP, return 0; } -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 =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); +static bool rrc_gNB_plmn_matches(const gNB_RRC_INST *rrc, const f1ap_served_cell_info_t *info) +{ + const gNB_RrcConfigurationReq *conf = &rrc->configuration; + return conf->num_plmn == 1 // F1 supports only one + && conf->mcc[0] == info->plmn.mcc + && conf->mnc[0] == info->plmn.mnc + && rrc->nr_cellid == info->nr_cellid; +} - for (int i = 0; i < f1_setup_req->num_cells_available; i++) { - for (int j=0; jconfiguration.mcc[0] == f1_setup_req->cell[i].info.plmn.mcc && - rrc->configuration.mnc[0] == f1_setup_req->cell[i].info.plmn.mnc && - rrc->nr_cellid == f1_setup_req->cell[i].info.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) - const f1ap_gnb_du_system_info_t *sys_info = f1_setup_req->cell[i].sys_info; - AssertFatal(sys_info != NULL, "no system information found, should send F1 Setup Failure\n"); - LOG_W(NR_RRC, "instance %d sib1 length %d\n", i, sys_info->sib1_length); - AssertFatal(rrc->carrier.mib == NULL, "CU MIB is already initialized: double F1 setup request?\n"); - asn_dec_rval_t dec_rval = uper_decode_complete(NULL, - &asn_DEF_NR_BCCH_BCH_Message, - (void **)&rrc->carrier.mib, - sys_info->mib, - sys_info->mib_length); - AssertFatal(dec_rval.code == RC_OK, - "[gNB_CU %"PRIu8"] Failed to decode NR_BCCH_BCH_MESSAGE (%zu bits)\n", - j, - dec_rval.consumed ); + LOG_I(NR_RRC, "Received F1 Setup Request from gNB_DU %lu (%s)\n", req->gNB_DU_id, req->gNB_DU_name); - dec_rval = uper_decode_complete(NULL, - &asn_DEF_NR_SIB1, //&asn_DEF_NR_BCCH_DL_SCH_Message, - (void **)&rrc->carrier.siblock1_DU, - sys_info->sib1, - sys_info->sib1_length); - AssertFatal(dec_rval.code == RC_OK, - "[gNB_DU %"PRIu8"] Failed to decode NR_BCCH_DLSCH_MESSAGE (%zu bits)\n", - j, - dec_rval.consumed ); + // check: + // - it is the first DU + // - it is one cell + // - PLMN and Cell ID matches + // else reject + f1ap_setup_failure_t fail = {.cause = F1AP_CauseRadioNetwork_gNB_CU_Cell_Capacity_Exceeded}; + if (rrc->du != NULL) { + const f1ap_setup_req_t *other = rrc->du->setup_req; + LOG_E(NR_RRC, "can only handle one DU, but already serving DU %ld (%s)\n", other->gNB_DU_id, other->gNB_DU_name); + rrc->mac_rrc.f1_setup_failure(&fail); + return; + } + if (req->num_cells_available != 1) { + LOG_E(NR_RRC, "can only handle on DU cell, but gNB_DU %ld has %d\n", req->gNB_DU_id, req->num_cells_available); + rrc->mac_rrc.f1_setup_failure(&fail); + return; + } + f1ap_served_cell_info_t *cell_info = &req->cell[0].info; + if (!rrc_gNB_plmn_matches(rrc, cell_info)) { + LOG_E(NR_RRC, + "PLMN mismatch: CU %d%d cellID %ld, DU %d%d cellID %ld\n", + rrc->configuration.mcc[0], + rrc->configuration.mnc[0], + rrc->nr_cellid, + cell_info->plmn.mcc, + cell_info->plmn.mnc, + cell_info->nr_cellid); + rrc->mac_rrc.f1_setup_failure(&fail); + return; + } + // if there is no system info or no SIB1 and we run in SA mode, we cannot handle it + const f1ap_gnb_du_system_info_t *sys_info = req->cell[0].sys_info; + if (sys_info == NULL || sys_info->mib == NULL || (sys_info->sib1 == NULL && get_softmodem_params()->sa)) { + LOG_E(NR_RRC, "no system information provided by DU, rejecting\n"); + rrc->mac_rrc.f1_setup_failure(&fail); + return; + } - // Parse message and extract SystemInformationBlockType1 field - rrc->carrier.sib1 = rrc->carrier.siblock1_DU; - if ( LOG_DEBUGFLAG(DEBUG_ASN1)){ - LOG_I(NR_RRC, "Printing received SIB1 container inside F1 setup request message:\n"); - xer_fprint(stdout, &asn_DEF_NR_SIB1,(void *)rrc->carrier.sib1); - } + LOG_I(RRC, "Accepting DU %ld (%s), sending F1 Setup Response\n", req->gNB_DU_id, req->gNB_DU_name); - rrc->carrier.physCellId = f1_setup_req->cell[i].info.nr_pci; + // we accept the DU + rrc->du = calloc(1, sizeof(*rrc->du)); + AssertFatal(rrc->du != NULL, "out of memory\n"); - 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].plmn.mcc = rrc->configuration.mcc[0]; - F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p2).cells_to_activate[cu_cell_ind].plmn.mnc = rrc->configuration.mnc[0]; - F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p2).cells_to_activate[cu_cell_ind].plmn.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->cell[i].info.nr_pci; - int num_SI= 0; + /* ITTI will free the setup request message via free(). So the memory + * "inside" of the message will remain, but the "outside" container no, so + * allocate memory and copy it in */ + rrc->du->setup_req = malloc(sizeof(*rrc->du->setup_req)); + AssertFatal(rrc->du->setup_req != NULL, "out of memory\n"); + *rrc->du->setup_req = *req; - if (rrc->carrier.SIB23) { - F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].SI_container[2] = rrc->carrier.SIB23; - F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].SI_container_length[2] = rrc->carrier.sizeof_SIB23; - num_SI++; - } + rrc->carrier.physCellId = cell_info->nr_pci; - F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).cells_to_activate[cu_cell_ind].num_SI = num_SI; - cu_cell_ind++; - F1AP_GNB_CU_CONFIGURATION_UPDATE (msg_p2).num_cells_to_activate = cu_cell_ind; - // send - 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->cell[i].info.plmn.mcc, - rrc->configuration.mnc[0], f1_setup_req->cell[i].info.plmn.mnc, - rrc->nr_cellid, f1_setup_req->cell[i].info.nr_cellid); - } - }// for (int j=0;jcarrier.mib != NULL) { + LOG_E(NR_RRC, "CU MIB is already initialized: double F1 setup request?\n"); + } else { + asn_dec_rval_t dec_rval = + uper_decode_complete(NULL, &asn_DEF_NR_BCCH_BCH_Message, (void **)&rrc->carrier.mib, sys_info->mib, sys_info->mib_length); + AssertFatal(dec_rval.code == RC_OK, "Failed to decode NR_BCCH_BCH_MESSAGE (%zu bits)\n", dec_rval.consumed); + } - if (cu_cell_ind == 0) { - AssertFatal(1 == 0, "No cell found\n"); - } else { - // send ITTI message to F1AP-CU task - itti_send_msg_to_task (TASK_CU_F1, 0, msg_p); + if (rrc->carrier.sib1 != NULL) { + LOG_E(NR_RRC, "CU SIB1 is already initiaized: double F1 setup request?\n"); + } else { + asn_dec_rval_t dec_rval = + uper_decode_complete(NULL, &asn_DEF_NR_SIB1, (void **)&rrc->carrier.sib1, sys_info->sib1, sys_info->sib1_length); + AssertFatal(dec_rval.code == RC_OK, "Failed to decode NR_BCCH_DLSCH_MESSAGE (%zu bits)\n", dec_rval.consumed); - itti_send_msg_to_task (TASK_CU_F1, 0, msg_p2); + if (LOG_DEBUGFLAG(DEBUG_ASN1)) + xer_fprint(stdout, &asn_DEF_NR_SIB1, (void *)rrc->carrier.sib1); + } - } + served_cells_to_activate_t cell = { + .plmn = cell_info->plmn, + .nr_cellid = cell_info->nr_cellid, + .nrpci = cell_info->nr_pci, + .num_SI = 0, + }; + f1ap_setup_resp_t resp = {.num_cells_to_activate = 1, .cells_to_activate[0] = cell}; + if (rrc->node_name != NULL) + resp.gNB_CU_name = strdup(rrc->node_name); + rrc->mac_rrc.f1_setup_response(&resp); - // handle other failure cases - }//for (int i=0;inum_cells_available;i++) + /* + MessageDef *msg_p2 = itti_alloc_new_message(TASK_RRC_GNB, 0, F1AP_GNB_CU_CONFIGURATION_UPDATE); + F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p2).gNB_CU_name = rrc->node_name; + F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p2).cells_to_activate[0].plmn.mcc = rrc->configuration.mcc[0]; + F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p2).cells_to_activate[0].plmn.mnc = rrc->configuration.mnc[0]; + F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p2).cells_to_activate[0].plmn.mnc_digit_length = rrc->configuration.mnc_digit_length[0]; + F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p2).cells_to_activate[0].nr_cellid = rrc->nr_cellid; + F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p2).cells_to_activate[0].nrpci = req->cell[0].info.nr_pci; + int num_SI = 0; + + if (rrc->carrier.SIB23) { + F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p2).cells_to_activate[0].SI_container[2] = rrc->carrier.SIB23; + F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p2).cells_to_activate[0].SI_container_length[2] = rrc->carrier.sizeof_SIB23; + num_SI++; + } + + F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p2).cells_to_activate[0].num_SI = num_SI; + F1AP_GNB_CU_CONFIGURATION_UPDATE(msg_p2).num_cells_to_activate = 1; + // send + itti_send_msg_to_task(TASK_CU_F1, 0, msg_p2); + */ } void rrc_gNB_process_initial_ul_rrc_message(const f1ap_initial_ul_rrc_message_t *ul_rrc) @@ -2615,7 +2638,7 @@ void *rrc_gnb_task(void *args_p) { /* Messages from F1AP task */ case F1AP_SETUP_REQ: - AssertFatal(NODE_IS_CU(RC.nrrrc[instance]->node_type), "should not receive F1AP_SETUP_REQUEST, need call by CU!\n"); + AssertFatal(!NODE_IS_DU(RC.nrrrc[instance]->node_type), "should not receive F1AP_SETUP_REQUEST in DU!\n"); rrc_gNB_process_f1_setup_req(&F1AP_SETUP_REQ(msg_p)); break; From 89f3ea3dd0b0305046b41cecf258d5eae7c365e4 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 19 Jul 2023 18:38:04 +0200 Subject: [PATCH 30/63] Wait for F1 Setup Response before unblocking cell The F1 Setup Response contains the cell(s) to activate. Hence, prevent the radio from starting by waiting for the F1 Setup Response before continuing. --- executables/nr-ru.c | 15 +++++++++++--- executables/nr-softmodem.c | 16 ++++++++++----- executables/nr-softmodem.h | 1 + openair2/GNB_APP/gnb_config.c | 20 +++++++++++++++++++ openair2/GNB_APP/gnb_config.h | 1 + .../LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c | 8 ++++++-- 6 files changed, 51 insertions(+), 10 deletions(-) diff --git a/executables/nr-ru.c b/executables/nr-ru.c index 4a4fa8e7af..0f7c7e57fd 100644 --- a/executables/nr-ru.c +++ b/executables/nr-ru.c @@ -95,8 +95,8 @@ extern void nr_phy_config_request(NR_PHY_Config_t *gNB); //extern WORKER_CONF_t get_thread_worker_conf(void); void init_NR_RU(char *); +void start_NR_RU(); void stop_RU(int nb_ru); -void do_ru_sync(RU_t *ru); void configure_ru(int idx, void *arg); void configure_rru(int idx, void *arg); @@ -1398,7 +1398,6 @@ int start_write_thread(RU_t *ru) { void init_RU_proc(RU_t *ru) { int i=0; RU_proc_t *proc; - LOG_I(PHY,"Initializing RU proc %d (%s,%s),\n",ru->idx,NB_functions[ru->function],NB_timing[ru->if_timing]); proc = &ru->proc; memset((void *)proc,0,sizeof(RU_proc_t)); proc->ru = ru; @@ -1413,7 +1412,6 @@ void init_RU_proc(RU_t *ru) { pthread_mutex_init( &proc->mutex_emulateRF,NULL); pthread_cond_init( &proc->cond_emulateRF, NULL); - threadCreate( &proc->pthread_FH, ru_thread, (void *)ru, "ru_thread", ru->ru_thread_core, OAI_PRIORITY_RT_MAX ); if(emulate_rf) threadCreate( &proc->pthread_emulateRF, emulatedRF_thread, (void *)proc, "emulateRF", -1, OAI_PRIORITY_RT ); @@ -1421,7 +1419,12 @@ void init_RU_proc(RU_t *ru) { threadCreate( &ru->ru_stats_thread, ru_stats_thread, (void *)ru,"ru_stats", -1, OAI_PRIORITY_RT ); if (get_thread_worker_conf() == WORKER_ENABLE) { } + LOG_I(PHY, "Initialized RU proc %d (%s,%s),\n", ru->idx, NB_functions[ru->function], NB_timing[ru->if_timing]); +} +void start_RU_proc(RU_t *ru) +{ + threadCreate(&ru->proc.pthread_FH, ru_thread, (void *)ru, "ru_thread", ru->ru_thread_core, OAI_PRIORITY_RT_MAX); } @@ -1875,6 +1878,12 @@ void init_NR_RU(char *rf_config_file) { LOG_D(HW,"[nr-softmodem.c] RU threads created\n"); } +void start_NR_RU() +{ + RU_t *ru = RC.ru[0]; + start_RU_proc(ru); +} + void stop_RU(int nb_ru) { for (int inst = 0; inst < nb_ru; inst++) { diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index dfe2193d70..ff5f33e37b 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -289,16 +289,14 @@ void exit_function(const char *file, const char *function, const int line, const } } - - -static int create_gNB_tasks(void) { +static int create_gNB_tasks(ngran_node_t node_type) +{ uint32_t gnb_nb = RC.nb_nr_inst; uint32_t gnb_id_start = 0; uint32_t gnb_id_end = gnb_id_start + gnb_nb; LOG_D(GNB_APP, "%s(gnb_nb:%d)\n", __FUNCTION__, gnb_nb); itti_wait_ready(1); LOG_I(PHY, "%s() Task ready initialize structures\n", __FUNCTION__); - ngran_node_t node_type = get_node_type(); RCconfig_NR_L1(); RCconfig_nr_prs(); @@ -634,8 +632,9 @@ int main( int argc, char **argv ) { RCconfig_NR_L1(); // don't create if node doesn't connect to RRC/S1/GTP + const ngran_node_t node_type = get_node_type(); if (NFAPI_MODE != NFAPI_MODE_PNF) { - int ret = create_gNB_tasks(); + int ret = create_gNB_tasks(node_type); AssertFatal(ret == 0, "cannot create ITTI tasks\n"); } @@ -735,6 +734,13 @@ int main( int argc, char **argv ) { wait_nfapi_init("main?"); } + // wait for F1 Setup Response before starting L1 for real + if (NODE_IS_DU(node_type) || NODE_IS_MONOLITHIC(node_type)) + wait_f1_setup_response(); + + if (RC.nb_RU > 0) + start_NR_RU(); + if (RC.nb_nr_L1_inst > 0) { printf("wait RUs\n"); wait_RUs(); diff --git a/executables/nr-softmodem.h b/executables/nr-softmodem.h index 63a2391826..96b70d0f90 100644 --- a/executables/nr-softmodem.h +++ b/executables/nr-softmodem.h @@ -54,6 +54,7 @@ extern void kill_gNB_proc(int inst); // In nr-ru.c extern void init_NR_RU(char *); extern void init_RU_proc(RU_t *ru); +extern void start_NR_RU(void); extern void stop_RU(int nb_ru); extern void kill_NR_RU_proc(int inst); extern void set_function_spec_param(RU_t *ru); diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index e395c4c866..e996f70c48 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -2039,6 +2039,26 @@ int RC_config_trigger_F1Setup() return 0; } +void wait_f1_setup_response(void) +{ + gNB_MAC_INST *mac = RC.nrmac[0]; + NR_SCHED_LOCK(&mac->sched_lock); + if (mac->f1_config.setup_resp != NULL) { + NR_SCHED_UNLOCK(&mac->sched_lock); + return; + } + + LOG_W(GNB_APP, "waiting for F1 Setup Response before activating radio\n"); + + /* for the moment, we keep it simple and just sleep to periodically check. + * The actual check is protected by a mutex */ + while (mac->f1_config.setup_resp == NULL) { + NR_SCHED_UNLOCK(&mac->sched_lock); + sleep(1); + NR_SCHED_LOCK(&mac->sched_lock); + } + NR_SCHED_UNLOCK(&mac->sched_lock); +} static bool check_plmn_identity(const f1ap_plmn_t *check_plmn, const f1ap_plmn_t *plmn) { return plmn->mcc == check_plmn->mcc && plmn->mnc_digit_length == check_plmn->mnc_digit_length && plmn->mnc == check_plmn->mnc; diff --git a/openair2/GNB_APP/gnb_config.h b/openair2/GNB_APP/gnb_config.h index 9d8a9487cb..55bc913d0f 100644 --- a/openair2/GNB_APP/gnb_config.h +++ b/openair2/GNB_APP/gnb_config.h @@ -104,6 +104,7 @@ void RCconfig_NRRRC(gNB_RRC_INST *rrc); int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i); int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i); int RC_config_trigger_F1Setup(void); +void wait_f1_setup_response(void); int gNB_app_handle_f1ap_gnb_cu_configuration_update(f1ap_gnb_cu_configuration_update_t *gnb_cu_cfg_update); MessageDef *RCconfig_NR_CU_E1(bool separate_CUUP_process); ngran_node_t get_node_type(void); diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c index 6b341424b2..c6dfab563a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c +++ b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c @@ -58,9 +58,13 @@ void f1_setup_response(const f1ap_setup_resp_t *resp) AssertFatal(cu_cell->num_SI == 0, "handling of CU-provided SIBs: not implemented\n"); - NR_SCHED_UNLOCK(&mac->sched_lock); + mac->f1_config.setup_resp = malloc(sizeof(*mac->f1_config.setup_resp)); + AssertFatal(mac->f1_config.setup_resp != NULL, "out of memory\n"); + *mac->f1_config.setup_resp = *resp; + if (resp->gNB_CU_name) + mac->f1_config.setup_resp->gNB_CU_name = strdup(resp->gNB_CU_name); - /* TODO: handling of pre-operational state? */ + NR_SCHED_UNLOCK(&mac->sched_lock); } void f1_setup_failure(const f1ap_setup_failure_t *failure) From f670cc67493f21e1a5ffb31a0b10a9a0cb776005 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 20 Jul 2023 17:46:12 +0200 Subject: [PATCH 31/63] Bug fix F1 Setup Response encoder: check if SIs present --- openair2/F1AP/f1ap_cu_interface_management.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index f264734227..ad3880c71b 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -312,7 +312,7 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance, f1ap_setup_resp_t *f1ap_setup /* optional */ /* - gNB-CU System Information */ - if (1) { + if (f1ap_setup_resp->cells_to_activate[i].num_SI > 0) { /* 3.1.2 gNB-CUSystem Information */ F1AP_ProtocolExtensionContainer_10696P112_t *p = calloc(1, sizeof(* p)); cells_to_be_activated_item->iE_Extensions = (struct F1AP_ProtocolExtensionContainer *) p; From a23a702acb89464efc4df4bc19673006aa09747f Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 20 Jul 2023 17:46:32 +0200 Subject: [PATCH 32/63] Setup response handler decoder no SI --- openair2/F1AP/f1ap_du_interface_management.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index 5cb3ab4b83..5a483f85c6 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -466,7 +466,7 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, uint32_t assoc_id, uint32_t // tmp for (int i=0; i 0, "System Information %d is missing", i); + AssertFatal(resp.cells_to_activate[i].num_SI == 0, "System Information handling not implemented"); LOG_D(F1AP, "Sending F1AP_SETUP_RESP ITTI message\n"); f1_setup_response(&resp); From b93368f46dacea2a5104006545126613d0b4bbd6 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 19 Jul 2023 19:03:50 +0200 Subject: [PATCH 33/63] Implement Setup Request/Response for F1AP --- openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_f1ap.c | 67 +++++++++++++++++++- openair2/RRC/NR/mac_rrc_dl_f1ap.c | 12 +++- 2 files changed, 76 insertions(+), 3 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_f1ap.c b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_f1ap.c index 1a65b70581..b98de08a0d 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_f1ap.c +++ b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_ul_f1ap.c @@ -29,9 +29,74 @@ #include "mac_rrc_ul.h" +static f1ap_net_config_t read_DU_IP_config(const eth_params_t* f1_params) +{ + f1ap_net_config_t nc = {0}; + + nc.CU_f1_ip_address.ipv6 = 0; + nc.CU_f1_ip_address.ipv4 = 1; + strcpy(nc.CU_f1_ip_address.ipv4_address, f1_params->remote_addr); + nc.CUport = f1_params->remote_portd; + LOG_I(GNB_APP, + "FIAP: CU_ip4_address in DU %p, strlen %d\n", + nc.CU_f1_ip_address.ipv4_address, + (int)strlen(f1_params->remote_addr)); + + nc.DU_f1_ip_address.ipv6 = 0; + nc.DU_f1_ip_address.ipv4 = 1; + strcpy(nc.DU_f1_ip_address.ipv4_address, f1_params->my_addr); + nc.DUport = f1_params->my_portd; + LOG_I(GNB_APP, + "FIAP: DU_ip4_address in DU %p, strlen %ld\n", + nc.DU_f1_ip_address.ipv4_address, + strlen(f1_params->my_addr)); + + // sctp_in_streams/sctp_out_streams are given by SCTP layer + return nc; +} + + static void f1_setup_request_f1ap(const f1ap_setup_req_t *req) { - AssertFatal(false, "not implemented\n"); + MessageDef *msg = itti_alloc_new_message(TASK_MAC_GNB, 0, F1AP_DU_REGISTER_REQ); + + f1ap_setup_req_t *f1ap_setup = &F1AP_DU_REGISTER_REQ(msg).setup_req; + f1ap_setup->gNB_DU_id = req->gNB_DU_id; + f1ap_setup->gNB_DU_name = strdup(req->gNB_DU_name); + f1ap_setup->num_cells_available = req->num_cells_available; + for (int n = 0; n < req->num_cells_available; ++n) { + f1ap_setup->cell[n].info = req->cell[n].info; // copy most fields + if (req->cell[n].info.tac) { + f1ap_setup->cell[n].info.tac = malloc(sizeof(*f1ap_setup->cell[n].info.tac)); + AssertFatal(f1ap_setup->cell[n].info.tac != NULL, "out of memory\n"); + *f1ap_setup->cell[n].info.tac = *req->cell[n].info.tac; + } + if (req->cell[n].info.measurement_timing_information) + f1ap_setup->cell[n].info.measurement_timing_information = strdup(req->cell[n].info.measurement_timing_information); + + if (req->cell[n].sys_info) { + f1ap_gnb_du_system_info_t *orig_sys_info = req->cell[n].sys_info; + f1ap_gnb_du_system_info_t *copy_sys_info = calloc(1, sizeof(*copy_sys_info)); + AssertFatal(copy_sys_info != NULL, "out of memory\n"); + f1ap_setup->cell[n].sys_info = copy_sys_info; + + copy_sys_info->mib = calloc(orig_sys_info->mib_length, sizeof(uint8_t)); + AssertFatal(copy_sys_info->mib != NULL, "out of memory\n"); + memcpy(copy_sys_info->mib, orig_sys_info->mib, orig_sys_info->mib_length); + copy_sys_info->mib_length = orig_sys_info->mib_length; + + if (orig_sys_info->sib1_length > 0) { + copy_sys_info->sib1 = calloc(orig_sys_info->sib1_length, sizeof(uint8_t)); + AssertFatal(copy_sys_info->sib1 != NULL, "out of memory\n"); + memcpy(copy_sys_info->sib1, orig_sys_info->sib1, orig_sys_info->sib1_length); + copy_sys_info->sib1_length = orig_sys_info->sib1_length; + } + } + } + + F1AP_DU_REGISTER_REQ(msg).net_config = read_DU_IP_config(&RC.nrmac[0]->eth_params_n); + + itti_send_msg_to_task(TASK_DU_F1, 0, msg); } static void ue_context_setup_response_f1ap(const f1ap_ue_context_setup_t *req, const f1ap_ue_context_setup_t *resp) diff --git a/openair2/RRC/NR/mac_rrc_dl_f1ap.c b/openair2/RRC/NR/mac_rrc_dl_f1ap.c index 8a827afe1b..270541a4b9 100644 --- a/openair2/RRC/NR/mac_rrc_dl_f1ap.c +++ b/openair2/RRC/NR/mac_rrc_dl_f1ap.c @@ -26,12 +26,20 @@ static void f1_setup_response_f1ap(const f1ap_setup_resp_t *resp) { - AssertFatal(false, "not implemented\n"); + MessageDef *msg = itti_alloc_new_message(TASK_RRC_GNB, 0, F1AP_SETUP_RESP); + f1ap_setup_resp_t *f1ap_msg = &F1AP_SETUP_RESP(msg); + *f1ap_msg = *resp; + if (resp->gNB_CU_name != NULL) + f1ap_msg->gNB_CU_name = strdup(resp->gNB_CU_name); + itti_send_msg_to_task(TASK_CU_F1, 0, msg); } static void f1_setup_failure_f1ap(const f1ap_setup_failure_t *fail) { - AssertFatal(false, "not implemented\n"); + MessageDef *msg = itti_alloc_new_message(TASK_RRC_GNB, 0, F1AP_SETUP_FAILURE); + f1ap_setup_failure_t *f1ap_msg = &F1AP_SETUP_FAILURE(msg); + *f1ap_msg = *fail; + itti_send_msg_to_task(TASK_CU_F1, 0, msg); } static void ue_context_setup_request_f1ap(const f1ap_ue_context_setup_t *req) From f709ee815be52ed3f1adb504b56899e3a341937e Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 20 Jul 2023 17:49:42 +0200 Subject: [PATCH 34/63] Move physCellId to MAC The PCI is given to the CU from the DU in the F1 Setup Request message. It is a part of the DU, so move it "down". --- openair2/GNB_APP/gnb_config.c | 3 +-- openair2/RRC/NR/MESSAGES/asn1_msg.c | 11 +++------- openair2/RRC/NR/MESSAGES/asn1_msg.h | 7 ++----- openair2/RRC/NR/nr_rrc_defs.h | 2 -- openair2/RRC/NR/rrc_gNB.c | 31 ++++++++++++++++------------- 5 files changed, 23 insertions(+), 31 deletions(-) diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index e996f70c48..30e9404c76 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -1317,7 +1317,6 @@ void RCconfig_NRRRC(gNB_RRC_INST *rrc) rrc->nr_cellid = (uint64_t)*(GNBParamList.paramarray[i][GNB_NRCELLID_IDX].u64ptr); - rrc->carrier.physCellId = *scc->physCellId; rrc->um_on_default_drb = *(GNBParamList.paramarray[i][GNB_UMONDEFAULTDRB_IDX].uptr); if (strcmp(*(GNBParamList.paramarray[i][GNB_TRANSPORT_S_PREFERENCE_IDX].strptr), "local_mac") == 0) { @@ -2081,7 +2080,7 @@ int gNB_app_handle_f1ap_gnb_cu_configuration_update(f1ap_gnb_cu_configuration_up if (RC.nrrrc[i]->nr_cellid == gnb_cu_cfg_update->cells_to_activate[j].nr_cellid && check_plmn_identity(&setup_req->cell[0].info.plmn, &gnb_cu_cfg_update->cells_to_activate[j].plmn) > 0 - && gnb_cu_cfg_update->cells_to_activate[j].nrpci == carrier->physCellId) { + && setup_req->cell[0].info.nr_pci == gnb_cu_cfg_update->cells_to_activate[j].nrpci) { // copy system information and decode it AssertFatal(gnb_cu_cfg_update->cells_to_activate[j].num_SI == 0, "gNB-CU Configuration Update: handling of additional SIs not implemend\n"); diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 33ceceff28..2ea998dd65 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -1060,14 +1060,11 @@ uint8_t do_RRCReestablishmentRequest(uint8_t Mod_id, uint8_t *buffer, uint16_t c //------------------------------------------------------------------------------ int do_RRCReestablishment(rrc_gNB_ue_context_t *const ue_context_pP, - int CC_id, uint8_t *const buffer, size_t buffer_size, const uint8_t Transaction_id, - NR_SRB_ToAddModList_t *SRB_configList, - const uint8_t *masterCellGroup_from_DU, - NR_ServingCellConfigCommon_t *scc, - rrc_gNB_carrier_data_t *carrier) + uint16_t pci, + NR_ServingCellConfigCommon_t *scc) { asn_enc_rval_t enc_rval; NR_DL_DCCH_Message_t dl_dcch_msg = {0}; @@ -1084,8 +1081,6 @@ int do_RRCReestablishment(rrc_gNB_ue_context_t *const ue_context_pP, rrcReestablishment->criticalExtensions.present = NR_RRCReestablishment__criticalExtensions_PR_rrcReestablishment; rrcReestablishment->criticalExtensions.choice.rrcReestablishment = CALLOC(1, sizeof(NR_RRCReestablishment_IEs_t)); - int module_id = 0; - uint16_t pci = RC.nrrrc[module_id]->carrier.physCellId; uint32_t nr_arfcn_dl = (uint64_t)*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB; LOG_I(NR_RRC, "Reestablishment update key pci=%d, earfcn_dl=%u\n", pci, nr_arfcn_dl); @@ -1107,7 +1102,7 @@ int do_RRCReestablishment(rrc_gNB_ue_context_t *const ue_context_pP, xer_fprint(stdout, &asn_DEF_NR_DL_DCCH_Message, (void *)&dl_dcch_msg); } - enc_rval = uper_encode_to_buffer(&asn_DEF_NR_DL_DCCH_Message, NULL, (void *)&dl_dcch_msg, buffer, 100); + enc_rval = uper_encode_to_buffer(&asn_DEF_NR_DL_DCCH_Message, NULL, (void *)&dl_dcch_msg, buffer, buffer_size); AssertFatal(enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.h b/openair2/RRC/NR/MESSAGES/asn1_msg.h index d2f61acd10..1ae0c905b8 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.h +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.h @@ -152,14 +152,11 @@ uint8_t do_NR_ULInformationTransfer(uint8_t **buffer, uint8_t do_RRCReestablishmentRequest(uint8_t Mod_id, uint8_t *buffer, uint16_t c_rnti); int do_RRCReestablishment(rrc_gNB_ue_context_t *const ue_context_pP, - int CC_id, uint8_t *const buffer, size_t buffer_size, const uint8_t Transaction_id, - NR_SRB_ToAddModList_t *SRB_configList, - const uint8_t *masterCellGroup_from_DU, - NR_ServingCellConfigCommon_t *scc, - rrc_gNB_carrier_data_t *carrier); + uint16_t pci, + NR_ServingCellConfigCommon_t *scc); int do_RRCReestablishmentComplete(uint8_t *buffer, size_t buffer_size, int64_t rrc_TransactionIdentifier); diff --git a/openair2/RRC/NR/nr_rrc_defs.h b/openair2/RRC/NR/nr_rrc_defs.h index ae9a08ef73..637c43bd4a 100644 --- a/openair2/RRC/NR/nr_rrc_defs.h +++ b/openair2/RRC/NR/nr_rrc_defs.h @@ -331,8 +331,6 @@ typedef struct { uint8_t *SIB23; uint8_t sizeof_SIB23; - long physCellId; - NR_BCCH_BCH_Message_t *mib; NR_SIB1_t *siblock1_DU; NR_SIB1_t *sib1; diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index a181c3ed46..35c4dc4d68 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -1024,19 +1024,16 @@ static void rrc_gNB_generate_RRCReestablishment(rrc_gNB_ue_context_t *ue_context int enable_ciphering = 0; gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context; + /* look up corresponding DU. For the moment, there is only one */ + const nr_rrc_du_container_t *du = rrc->du; + AssertFatal(du != NULL, "received CCCH message, but no corresponding DU found\n"); + const f1ap_served_cell_info_t *cell_info = &du->setup_req->cell[0].info; + uint8_t buffer[RRC_BUF_SIZE] = {0}; uint8_t xid = rrc_gNB_get_next_transaction_identifier(module_id); ue_p->xids[xid] = RRC_REESTABLISH; NR_SRB_ToAddModList_t *SRBs = createSRBlist(ue_p, true); - int size = do_RRCReestablishment(ue_context_pP, - 0 /* CC_id */, - buffer, - RRC_BUF_SIZE, - xid, - SRBs, - masterCellGroup_from_DU, - scc, - &rrc->carrier); + int size = do_RRCReestablishment(ue_context_pP, buffer, RRC_BUF_SIZE, xid, cell_info->nr_pci, scc); LOG_I(NR_RRC, "[RAPROC] UE %04x Logical Channel DL-DCCH, Generating NR_RRCReestablishment (bytes %d)\n", ue_p->rnti, size); @@ -1234,6 +1231,10 @@ static int nr_rrc_gNB_decode_ccch(module_id_t module_id, const f1ap_initial_ul_r NR_RRCReestablishmentRequest_IEs_t rrcReestablishmentRequest; rnti_t rnti = msg->crnti; + /* look up corresponding DU. For the moment, there is only one */ + const nr_rrc_du_container_t *du = gnb_rrc_inst->du; + AssertFatal(du != NULL, "received CCCH message, but no corresponding DU found\n"); + LOG_I(NR_RRC, "Decoding CCCH: RNTI %04x, payload_size %d\n", rnti, msg->rrc_container_length); dec_rval = uper_decode(NULL, &asn_DEF_NR_UL_CCCH_Message, (void **)&ul_ccch_msg, msg->rrc_container, msg->rrc_container_length, 0, 0); @@ -1349,12 +1350,16 @@ static int nr_rrc_gNB_decode_ccch(module_id_t module_id, const f1ap_initial_ul_r cause == NR_ReestablishmentCause_otherFailure ? "Other Failure" : (cause == NR_ReestablishmentCause_handoverFailure ? "Handover Failure" : "reconfigurationFailure")); - if (physCellId != gnb_rrc_inst->carrier.physCellId) { + + uint8_t xid = -1; + AssertFatal(du->setup_req->num_cells_available == 1, "cannot handle more than one cell\n"); + const f1ap_served_cell_info_t *cell_info = &du->setup_req->cell[0].info; + if (physCellId != cell_info->nr_pci) { /* UE was moving from previous cell so quickly that RRCReestablishment for previous cell was received in this cell */ LOG_E(NR_RRC, - " NR_RRCReestablishmentRequest ue_Identity.physCellId(%ld) is not equal to current physCellId(%ld), fallback to RRC establishment\n", + " NR_RRCReestablishmentRequest ue_Identity.physCellId(%ld) is not equal to current physCellId(%d), fallback to RRC establishment\n", physCellId, - gnb_rrc_inst->carrier.physCellId); + cell_info->nr_pci); /* 38.401 8.7: "If the UE accessed from a gNB-DU other than the * original one, the gNB-CU should trigger the UE Context Setup * procedure" we did not implement this yet; TBD for Multi-DU */ @@ -1908,8 +1913,6 @@ static void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *req) AssertFatal(rrc->du->setup_req != NULL, "out of memory\n"); *rrc->du->setup_req = *req; - rrc->carrier.physCellId = cell_info->nr_pci; - if (rrc->carrier.mib != NULL) { LOG_E(NR_RRC, "CU MIB is already initialized: double F1 setup request?\n"); } else { From 2b2953159159bfa7cb1b00f7496d1b956644d229 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 19 Jul 2023 19:16:29 +0200 Subject: [PATCH 35/63] Move ServingCellConfigCommon to MAC Note: the reestablishment is broken, and a later commit fixes it. The ServingCellConfigCommon is an inherently radio-related configuration. As such, it should be handled by the DU, not the CU. Therefore, move it "down" to the MAC. --- openair1/SIMULATION/NR_PHY/dlsim.c | 16 +- openair1/SIMULATION/NR_PHY/ulsim.c | 14 +- openair2/COMMON/rrc_messages_types.h | 1 - openair2/GNB_APP/gnb_config.c | 18 +-- openair2/LAYER2/NR_MAC_gNB/config.c | 7 +- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 3 +- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 5 +- openair2/LAYER2/NR_MAC_gNB/main.c | 6 +- openair2/RRC/NR/MESSAGES/asn1_msg.c | 35 ++--- openair2/RRC/NR/MESSAGES/asn1_msg.h | 36 +++-- openair2/RRC/NR/nr_rrc_config.c | 63 ++++---- openair2/RRC/NR/nr_rrc_config.h | 5 +- openair2/RRC/NR/nr_rrc_defs.h | 1 - openair2/RRC/NR/rrc_gNB.c | 142 +++++++++++------- openair2/RRC/NR/rrc_gNB_nsa.c | 9 +- 15 files changed, 201 insertions(+), 160 deletions(-) diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index b42edf31e0..b90ccc835c 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -622,11 +622,17 @@ int main(int argc, char **argv) frame_parms->N_RB_DL = N_RB_DL; frame_parms->N_RB_UL = N_RB_DL; + NR_ServingCellConfigCommon_t *scc = calloc(1,sizeof(*scc));; + prepare_scc(scc); + uint64_t ssb_bitmap = 1; // Enable only first SSB with index ssb_indx=0 + fill_scc_sim(scc, &ssb_bitmap, N_RB_DL, N_RB_DL, mu, mu); + fix_scc(scc, ssb_bitmap); + RC.nb_nr_macrlc_inst = 1; RC.nb_nr_mac_CC = (int*)malloc(RC.nb_nr_macrlc_inst*sizeof(int)); for (i = 0; i < RC.nb_nr_macrlc_inst; i++) RC.nb_nr_mac_CC[i] = 1; - mac_top_init_gNB(ngran_gNB); + mac_top_init_gNB(ngran_gNB, scc); gNB_mac = RC.nrmac[0]; gNB_mac->dl_bler.harq_round_max = num_rounds; @@ -673,12 +679,6 @@ int main(int argc, char **argv) NR_ServingCellConfigCommon_t *scc = secondaryCellGroup->spCellConfig->reconfigurationWithSync->spCellConfigCommon; */ - NR_ServingCellConfigCommon_t *scc = calloc(1,sizeof(*scc));; - prepare_scc(scc); - uint64_t ssb_bitmap = 1; // Enable only first SSB with index ssb_indx=0 - fill_scc_sim(scc, &ssb_bitmap, N_RB_DL, N_RB_DL, mu, mu); - fix_scc(scc, ssb_bitmap); - NR_ServingCellConfig_t *scd = calloc(1,sizeof(*scd)); prepare_scd(scd); @@ -723,7 +723,7 @@ int main(int argc, char **argv) gNB->if_inst->NR_PHY_config_req = nr_phy_config_request; // common configuration - nr_mac_config_scc(RC.nrmac[0], pdsch_AntennaPorts, n_tx, 0, 6, scc); + nr_mac_config_scc(RC.nrmac[0], pdsch_AntennaPorts, n_tx, 0, 6); // UE dedicated configuration nr_mac_add_test_ue(RC.nrmac[0], secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity, secondaryCellGroup); // reset preprocessor to the one of DLSIM after it has been set during diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index f307884d45..8f2eb42d63 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -613,18 +613,18 @@ int main(int argc, char *argv[]) r_re = malloc(n_rx*sizeof(double*)); r_im = malloc(n_rx*sizeof(double*)); - RC.nb_nr_macrlc_inst = 1; - RC.nb_nr_mac_CC = (int*)malloc(RC.nb_nr_macrlc_inst*sizeof(int)); - for (i = 0; i < RC.nb_nr_macrlc_inst; i++) - RC.nb_nr_mac_CC[i] = 1; - mac_top_init_gNB(ngran_gNB); - NR_ServingCellConfigCommon_t *scc = calloc(1,sizeof(*scc));; prepare_scc(scc); uint64_t ssb_bitmap; fill_scc_sim(scc, &ssb_bitmap, N_RB_DL, N_RB_DL, mu, mu); fix_scc(scc,ssb_bitmap); + RC.nb_nr_macrlc_inst = 1; + RC.nb_nr_mac_CC = (int*)malloc(RC.nb_nr_macrlc_inst*sizeof(int)); + for (i = 0; i < RC.nb_nr_macrlc_inst; i++) + RC.nb_nr_mac_CC[i] = 1; + mac_top_init_gNB(ngran_gNB, scc); + NR_ServingCellConfig_t *scd = calloc(1,sizeof(NR_ServingCellConfig_t)); prepare_scd(scd); @@ -651,7 +651,7 @@ int main(int argc, char *argv[]) gNB->if_inst->NR_PHY_config_req = nr_phy_config_request; // common configuration - nr_mac_config_scc(RC.nrmac[0], conf.pdsch_AntennaPorts, n_tx, 0, 6, scc); + nr_mac_config_scc(RC.nrmac[0], conf.pdsch_AntennaPorts, n_tx, 0, 6); nr_mac_config_mib(RC.nrmac[0], mib); // UE dedicated configuration nr_mac_add_test_ue(RC.nrmac[0], secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity, secondaryCellGroup); diff --git a/openair2/COMMON/rrc_messages_types.h b/openair2/COMMON/rrc_messages_types.h index ef44b31e69..1781eb5d18 100644 --- a/openair2/COMMON/rrc_messages_types.h +++ b/openair2/COMMON/rrc_messages_types.h @@ -415,7 +415,6 @@ typedef struct NRRrcConfigurationReq_s { uint16_t mnc[PLMN_LIST_MAX_SIZE]; uint8_t mnc_digit_length[PLMN_LIST_MAX_SIZE]; uint8_t num_plmn; - NR_ServingCellConfigCommon_t *scc; NR_ServingCellConfig_t *scd; int sib1_tda; rrc_pdsch_AntennaPorts_t pdsch_AntennaPorts; diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 30e9404c76..e237114459 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -947,6 +947,8 @@ static NR_ServingCellConfig_t *get_scd_config(void) return scd; } +// temporary minRXTXTIME, to be taken out once all radio config is read at DU +static int minRXTXTIME = 6; void RCconfig_nr_macrlc() { int j = 0; uint16_t prbbl[275] = {0}; @@ -983,10 +985,13 @@ void RCconfig_nr_macrlc() { MacRLC_Params[i].chkPptr = &(config_check_MacRLCParams[i]); config_getlist(&MacRLC_ParamList, MacRLC_Params, sizeof(MacRLC_Params) / sizeof(paramdef_t), NULL); + NR_ServingCellConfigCommon_t *scc = get_scc_config(minRXTXTIME); + //xer_fprint(stdout, &asn_DEF_NR_ServingCellConfigCommon, scc); + if (MacRLC_ParamList.numelt > 0) { RC.nb_nr_macrlc_inst = MacRLC_ParamList.numelt; ngran_node_t node_type = get_node_type(); - mac_top_init_gNB(node_type); + mac_top_init_gNB(node_type, scc); RC.nb_nr_mac_CC = (int *)malloc(RC.nb_nr_macrlc_inst * sizeof(int)); for (j = 0; j < RC.nb_nr_macrlc_inst; j++) { @@ -1256,10 +1261,6 @@ void RCconfig_NRRRC(gNB_RRC_INST *rrc) paramdef_t GNBParams[] = GNBPARAMS_DESC; paramlist_def_t GNBParamList = {GNB_CONFIG_STRING_GNB_LIST,NULL,0}; - int minRXTXTIME = 6; - NR_ServingCellConfigCommon_t *scc = get_scc_config(minRXTXTIME); - //xer_fprint(stdout, &asn_DEF_NR_ServingCellConfigCommon, scc); - NR_ServingCellConfig_t *scd = get_scd_config(); ////////// Physical parameters @@ -1399,7 +1400,6 @@ void RCconfig_NRRRC(gNB_RRC_INST *rrc) nrrrc_config.do_SRS = *GNBParamList.paramarray[i][GNB_DO_SRS_IDX].iptr; nrrrc_config.force_256qam_off = *GNBParamList.paramarray[i][GNB_FORCE256QAMOFF_IDX].iptr; LOG_I(GNB_APP, "256 QAM: %s\n", nrrrc_config.force_256qam_off ? "force off" : "may be on"); - nrrrc_config.scc = scc; nrrrc_config.scd = scd; nrrrc_config.enable_sdap = *GNBParamList.paramarray[i][GNB_ENABLE_SDAP_IDX].iptr; LOG_I(GNB_APP, "SDAP layer is %s\n", nrrrc_config.enable_sdap ? "enabled" : "disabled"); @@ -1966,8 +1966,7 @@ int RC_config_trigger_F1Setup() gNB_RRC_INST *rrc = RC.nrrrc[0]; DevAssert(rrc); - // wait until RRC cell information is configured - const NR_ServingCellConfigCommon_t *scc = rrc->configuration.scc; + const NR_ServingCellConfigCommon_t *scc = RC.nrmac[0]->common_channels[0].ServingCellConfigCommon; DevAssert(scc != NULL); req->cell[0].info.nr_pci = *scc->physCellId; LOG_W(GNB_APP, "no slices transported via F1 Setup Request!\n"); @@ -2074,11 +2073,10 @@ int gNB_app_handle_f1ap_gnb_cu_configuration_update(f1ap_gnb_cu_configuration_up NR_SCHED_LOCK(&mac->sched_lock); for (j = 0; j < gnb_cu_cfg_update->num_cells_to_activate; j++) { for (i = 0; i < RC.nb_nr_inst; i++) { - rrc_gNB_carrier_data_t *carrier = &RC.nrrrc[i]->carrier; f1ap_setup_req_t *setup_req = RC.nrmac[i]->f1_config.setup_req; // identify local index of cell j by nr_cellid, plmn identity and physical cell ID - if (RC.nrrrc[i]->nr_cellid == gnb_cu_cfg_update->cells_to_activate[j].nr_cellid + if (setup_req->cell[0].info.nr_cellid == gnb_cu_cfg_update->cells_to_activate[j].nr_cellid && check_plmn_identity(&setup_req->cell[0].info.plmn, &gnb_cu_cfg_update->cells_to_activate[j].plmn) > 0 && setup_req->cell[0].info.nr_pci == gnb_cu_cfg_update->cells_to_activate[j].nrpci) { // copy system information and decode it diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 853770887e..c7371a3ef4 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -471,13 +471,14 @@ void nr_mac_config_scc(gNB_MAC_INST *nrmac, rrc_pdsch_AntennaPorts_t pdsch_AntennaPorts, int pusch_AntennaPorts, int sib1_tda, - int minRXTXTIMEpdsch, - NR_ServingCellConfigCommon_t *scc) + int minRXTXTIMEpdsch) { + int CC_id = 0; DevAssert(nrmac != NULL); - AssertFatal(nrmac->common_channels[0].ServingCellConfigCommon == NULL, "logic error: multiple configurations of SCC\n"); + AssertFatal(nrmac->common_channels[0].ServingCellConfigCommon != NULL, "logic error: SCC not in MAC\n"); NR_SCHED_LOCK(&nrmac->sched_lock); + NR_ServingCellConfigCommon_t *scc = nrmac->common_channels[CC_id].ServingCellConfigCommon; DevAssert(scc != NULL); AssertFatal(scc->ssb_PositionsInBurst->present > 0 && scc->ssb_PositionsInBurst->present < 4, "SSB Bitmap type %d is not valid\n", diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index f475ed385a..0bbe82ef3a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -2887,8 +2887,9 @@ void prepare_initial_ul_rrc_message(gNB_MAC_INST *mac, NR_UE_info_t *UE) /* Note: relying on the RRC is a hack, as we are in the DU; there should be * no RRC, remove in the future */ module_id_t mod_id = 0; + int CC_id = 0; gNB_RRC_INST *rrc = RC.nrrrc[mod_id]; - const NR_ServingCellConfigCommon_t *scc = rrc->carrier.servingcellconfigcommon; + const NR_ServingCellConfigCommon_t *scc = mac->common_channels[CC_id].ServingCellConfigCommon; const NR_ServingCellConfig_t *sccd = rrc->configuration.scd; NR_CellGroupConfig_t *cellGroupConfig = get_initial_cellGroupConfig(UE->uid, scc, sccd, &rrc->configuration); diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 15d823aaf2..c12fa69eb0 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -38,7 +38,7 @@ void set_cset_offset(uint16_t); -void mac_top_init_gNB(ngran_node_t node_type); +void mac_top_init_gNB(ngran_node_t node_type, NR_ServingCellConfigCommon_t *scc); int nr_mac_enable_ue_rrc_processing_timer(module_id_t Mod_idP, rnti_t rnti, @@ -49,8 +49,7 @@ void nr_mac_config_scc(gNB_MAC_INST *nrmac, rrc_pdsch_AntennaPorts_t pdsch_AntennaPorts, int pusch_AntennaPorts, int sib1_tda, - int minRXTXTIMEpdsch, - NR_ServingCellConfigCommon_t *scc); + int minRXTXTIMEpdsch); void nr_mac_config_mib(gNB_MAC_INST *nrmac, NR_BCCH_BCH_Message_t *mib); void nr_mac_config_sib1(gNB_MAC_INST *nrmac, NR_BCCH_DL_SCH_Message_t *sib1); bool nr_mac_add_test_ue(gNB_MAC_INST *nrmac, uint32_t rnti, NR_CellGroupConfig_t *CellGroup); diff --git a/openair2/LAYER2/NR_MAC_gNB/main.c b/openair2/LAYER2/NR_MAC_gNB/main.c index 7fd559fdcd..a7f8de1d8f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/main.c +++ b/openair2/LAYER2/NR_MAC_gNB/main.c @@ -205,11 +205,13 @@ static void mac_rrc_init(gNB_MAC_INST *mac, ngran_node_t node_type) } } -void mac_top_init_gNB(ngran_node_t node_type) +void mac_top_init_gNB(ngran_node_t node_type, NR_ServingCellConfigCommon_t *scc) { module_id_t i; gNB_MAC_INST *nrmac; + AssertFatal(RC.nb_nr_macrlc_inst == 1, "what is the point of calling %s() if you don't need exactly one MAC?\n", __func__); + LOG_I(MAC, "[MAIN] Init function start:nb_nr_macrlc_inst=%d\n",RC.nb_nr_macrlc_inst); if (RC.nb_nr_macrlc_inst > 0) { @@ -239,6 +241,8 @@ void mac_top_init_gNB(ngran_node_t node_type) RC.nrmac[i]->ul_handle = 0; + RC.nrmac[i]->common_channels[0].ServingCellConfigCommon = scc; + RC.nrmac[i]->first_MIB = true; RC.nrmac[i]->cset0_bwp_start = 0; diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 2ea998dd65..3768782b06 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -689,9 +689,8 @@ int16_t do_RRCReconfiguration( NR_MeasConfig_t *meas_config, struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList *dedicatedNAS_MessageList, rrc_gNB_ue_context_t *const ue_context_pP, - rrc_gNB_carrier_data_t *carrier, const gNB_RrcConfigurationReq *configuration, - NR_MAC_CellGroupConfig_t *mac_CellGroupConfig, + const NR_ServingCellConfigCommon_t *scc, NR_CellGroupConfig_t *cellGroupConfig) //------------------------------------------------------------------------------ { @@ -742,7 +741,17 @@ int16_t do_RRCReconfiguration( } if(cellGroupConfig!=NULL){ - update_cellGroupConfig(cellGroupConfig, ue_context_pP->ue_context.rrc_ue_id, ue_context_pP ? ue_context_pP->ue_context.UE_Capability_nr : NULL, configuration); + /* TODO UECAP: update_cellGroupConfig should not even be here, it is + * updated by DU */ + if (scc != NULL) { + update_cellGroupConfig(cellGroupConfig, + ue_context_pP->ue_context.rrc_ue_id, + ue_context_pP ? ue_context_pP->ue_context.UE_Capability_nr : NULL, + configuration, + scc); + } else { + LOG_W(RRC, "no scc, cannot update cellGroup\n"); + } enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig, NULL, @@ -1064,7 +1073,7 @@ int do_RRCReestablishment(rrc_gNB_ue_context_t *const ue_context_pP, size_t buffer_size, const uint8_t Transaction_id, uint16_t pci, - NR_ServingCellConfigCommon_t *scc) + NR_ARFCN_ValueNR_t absoluteFrequencySSB) { asn_enc_rval_t enc_rval; NR_DL_DCCH_Message_t dl_dcch_msg = {0}; @@ -1081,15 +1090,14 @@ int do_RRCReestablishment(rrc_gNB_ue_context_t *const ue_context_pP, rrcReestablishment->criticalExtensions.present = NR_RRCReestablishment__criticalExtensions_PR_rrcReestablishment; rrcReestablishment->criticalExtensions.choice.rrcReestablishment = CALLOC(1, sizeof(NR_RRCReestablishment_IEs_t)); - uint32_t nr_arfcn_dl = (uint64_t)*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB; - LOG_I(NR_RRC, "Reestablishment update key pci=%d, earfcn_dl=%u\n", pci, nr_arfcn_dl); + LOG_I(NR_RRC, "Reestablishment update key pci=%d, earfcn_dl=%lu\n", pci, absoluteFrequencySSB); // 3GPP TS 33.501 Section 6.11 Security handling for RRC connection re-establishment procedure if (ue_context_pP->ue_context.nh_ncc >= 0) { - nr_derive_key_ng_ran_star(pci, nr_arfcn_dl, ue_context_pP->ue_context.nh, ue_context_pP->ue_context.kgnb); + nr_derive_key_ng_ran_star(pci, absoluteFrequencySSB, ue_context_pP->ue_context.nh, ue_context_pP->ue_context.kgnb); rrcReestablishment->criticalExtensions.choice.rrcReestablishment->nextHopChainingCount = ue_context_pP->ue_context.nh_ncc; } else { // first HO - nr_derive_key_ng_ran_star(pci, nr_arfcn_dl, ue_context_pP->ue_context.kgnb, ue_context_pP->ue_context.kgnb); + nr_derive_key_ng_ran_star(pci, absoluteFrequencySSB, ue_context_pP->ue_context.kgnb, ue_context_pP->ue_context.kgnb); // LG: really 1 rrcReestablishment->criticalExtensions.choice.rrcReestablishment->nextHopChainingCount = 0; } @@ -1144,15 +1152,8 @@ int do_RRCReestablishmentComplete(uint8_t *buffer, size_t buffer_size, int64_t r return((enc_rval.encoded+7)/8); } -NR_MeasConfig_t *get_defaultMeasConfig(const gNB_RrcConfigurationReq *conf) +NR_MeasConfig_t *get_defaultMeasConfig(int arfcn, int band, int scs) { - const NR_FrequencyInfoDL_t *freqInfoDL = conf->scc->downlinkConfigCommon->frequencyInfoDL; - const NR_ARFCN_ValueNR_t absFreqSSB = *freqInfoDL->absoluteFrequencySSB; - DevAssert(freqInfoDL->scs_SpecificCarrierList.list.count == 1); - const NR_SubcarrierSpacing_t scs = freqInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; - DevAssert(freqInfoDL->frequencyBandList.list.count == 1); - const NR_FreqBandIndicatorNR_t band = *freqInfoDL->frequencyBandList.list.array[0]; - NR_MeasConfig_t *mc = calloc(1, sizeof(*mc)); mc->measObjectToAddModList = calloc(1, sizeof(*mc->measObjectToAddModList)); mc->reportConfigToAddModList = calloc(1, sizeof(*mc->reportConfigToAddModList)); @@ -1163,7 +1164,7 @@ NR_MeasConfig_t *get_defaultMeasConfig(const gNB_RrcConfigurationReq *conf) mo1->measObjectId = 1; mo1->measObject.present = NR_MeasObjectToAddMod__measObject_PR_measObjectNR; NR_MeasObjectNR_t *monr1 = calloc(1, sizeof(*monr1)); - asn1cCallocOne(monr1->ssbFrequency, absFreqSSB); + asn1cCallocOne(monr1->ssbFrequency, arfcn); asn1cCallocOne(monr1->ssbSubcarrierSpacing, scs); monr1->referenceSignalConfig.ssb_ConfigMobility = calloc(1, sizeof(*monr1->referenceSignalConfig.ssb_ConfigMobility)); monr1->referenceSignalConfig.ssb_ConfigMobility->deriveSSB_IndexFromCell = true; diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.h b/openair2/RRC/NR/MESSAGES/asn1_msg.h index 1ae0c905b8..d041c39a7c 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.h +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.h @@ -99,23 +99,21 @@ uint8_t do_NR_SA_UECapabilityEnquiry( const protocol_ctxt_t *const ctxt_pP, int do_NR_RRCRelease(uint8_t *buffer, size_t buffer_size, uint8_t Transaction_id); -int16_t do_RRCReconfiguration( - const protocol_ctxt_t *const ctxt_pP, - uint8_t *buffer, - size_t buffer_size, - uint8_t Transaction_id, - NR_SRB_ToAddModList_t *SRB_configList, - NR_DRB_ToAddModList_t *DRB_configList, - NR_DRB_ToReleaseList_t *DRB_releaseList, - NR_SecurityConfig_t *security_config, - NR_SDAP_Config_t *sdap_config, - NR_MeasConfig_t *meas_config, - struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList *dedicatedNAS_MessageList, - rrc_gNB_ue_context_t *const ue_context_pP, - rrc_gNB_carrier_data_t *carrier, - const gNB_RrcConfigurationReq *configuration, - NR_MAC_CellGroupConfig_t *mac_CellGroupConfig, - NR_CellGroupConfig_t *cellGroupConfig); +int16_t do_RRCReconfiguration(const protocol_ctxt_t *const ctxt_pP, + uint8_t *buffer, + size_t buffer_size, + uint8_t Transaction_id, + NR_SRB_ToAddModList_t *SRB_configList, + NR_DRB_ToAddModList_t *DRB_configList, + NR_DRB_ToReleaseList_t *DRB_releaseList, + NR_SecurityConfig_t *security_config, + NR_SDAP_Config_t *sdap_config, + NR_MeasConfig_t *meas_config, + struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList *dedicatedNAS_MessageList, + rrc_gNB_ue_context_t *const ue_context_pP, + const gNB_RrcConfigurationReq *configuration, + const NR_ServingCellConfigCommon_t *scc, + NR_CellGroupConfig_t *cellGroupConfig); uint8_t do_RRCSetupComplete(uint8_t Mod_id, uint8_t *buffer, @@ -156,11 +154,11 @@ int do_RRCReestablishment(rrc_gNB_ue_context_t *const ue_context_pP, size_t buffer_size, const uint8_t Transaction_id, uint16_t pci, - NR_ServingCellConfigCommon_t *scc); + NR_ARFCN_ValueNR_t absoluteFrequencySSB); int do_RRCReestablishmentComplete(uint8_t *buffer, size_t buffer_size, int64_t rrc_TransactionIdentifier); -NR_MeasConfig_t *get_defaultMeasConfig(const gNB_RrcConfigurationReq *conf); +NR_MeasConfig_t *get_defaultMeasConfig(int absFreqSSB, int band, int scs); uint8_t do_NR_Paging(uint8_t Mod_id, uint8_t *buffer, uint32_t tmsi); #endif /* __RRC_NR_MESSAGES_ASN1_MSG__H__ */ diff --git a/openair2/RRC/NR/nr_rrc_config.c b/openair2/RRC/NR/nr_rrc_config.c index 5418f5dc9f..4d4ea4f860 100644 --- a/openair2/RRC/NR/nr_rrc_config.c +++ b/openair2/RRC/NR/nr_rrc_config.c @@ -1712,7 +1712,7 @@ int encode_MIB_NR(NR_BCCH_BCH_Message_t *mib, int frame, uint8_t *buf, int buf_s return (enc_rval.encoded + 7) / 8; } -NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const gNB_RrcConfigurationReq *configuration) +NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const gNB_RrcConfigurationReq *configuration, const NR_ServingCellConfigCommon_t *scc) { NR_BCCH_DL_SCH_Message_t *sib1_message = CALLOC(1,sizeof(NR_BCCH_DL_SCH_Message_t)); AssertFatal(sib1_message != NULL, "out of memory\n"); @@ -1812,9 +1812,9 @@ NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const gNB_RrcConfigurationReq *configurati // servingCellConfigCommon asn1cCalloc(sib1->servingCellConfigCommon, ServCellCom); NR_BWP_DownlinkCommon_t *initialDownlinkBWP = &ServCellCom->downlinkConfigCommon.initialDownlinkBWP; - initialDownlinkBWP->genericParameters = configuration->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters; + initialDownlinkBWP->genericParameters = scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters; - const NR_FrequencyInfoDL_t *frequencyInfoDL = configuration->scc->downlinkConfigCommon->frequencyInfoDL; + const NR_FrequencyInfoDL_t *frequencyInfoDL = scc->downlinkConfigCommon->frequencyInfoDL; for (int i = 0; i < frequencyInfoDL->frequencyBandList.list.count; i++) { asn1cSequenceAdd(ServCellCom->downlinkConfigCommon.frequencyInfoDL.frequencyBandList.list, struct NR_NR_MultiBandInfo, @@ -1823,11 +1823,11 @@ NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const gNB_RrcConfigurationReq *configurati frequencyInfoDL->frequencyBandList.list.array[i]; } - const NR_FreqBandIndicatorNR_t band = *configuration->scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; + const NR_FreqBandIndicatorNR_t band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; frequency_range_t frequency_range = band < 100 ? FR1 : FR2; - sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.offsetToPointA = get_ssb_offset_to_pointA(*configuration->scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB, - configuration->scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA, - configuration->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.subcarrierSpacing, + sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL.offsetToPointA = get_ssb_offset_to_pointA(*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB, + scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA, + scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.subcarrierSpacing, frequency_range); LOG_I(NR_RRC, @@ -1839,7 +1839,7 @@ NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const gNB_RrcConfigurationReq *configurati frequencyInfoDL->scs_SpecificCarrierList.list.array[i]); } - initialDownlinkBWP->pdcch_ConfigCommon = configuration->scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon; + initialDownlinkBWP->pdcch_ConfigCommon = scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon; initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList = CALLOC(1, sizeof(struct NR_PDCCH_ConfigCommon__commonSearchSpaceList)); AssertFatal(initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->commonSearchSpaceList != NULL, "out of memory\n"); @@ -1858,7 +1858,7 @@ NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const gNB_RrcConfigurationReq *configurati asn1cCallocOne(initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->pagingSearchSpace, 2); asn1cCallocOne(initialDownlinkBWP->pdcch_ConfigCommon->choice.setup->ra_SearchSpace, 1); - initialDownlinkBWP->pdsch_ConfigCommon = configuration->scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon; + initialDownlinkBWP->pdsch_ConfigCommon = 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; @@ -1874,7 +1874,7 @@ NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const gNB_RrcConfigurationReq *configurati asn1cCalloc(ServCellCom->uplinkConfigCommon, UL); asn_set_empty(&UL->frequencyInfoUL.scs_SpecificCarrierList.list); - const NR_FrequencyInfoUL_t *frequencyInfoUL = configuration->scc->uplinkConfigCommon->frequencyInfoUL; + const NR_FrequencyInfoUL_t *frequencyInfoUL = scc->uplinkConfigCommon->frequencyInfoUL; for (int i = 0; i < frequencyInfoUL->scs_SpecificCarrierList.list.count; i++) { asn1cSeqAdd(&UL->frequencyInfoUL.scs_SpecificCarrierList.list, frequencyInfoUL->scs_SpecificCarrierList.list.array[i]); } @@ -1882,14 +1882,14 @@ NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const gNB_RrcConfigurationReq *configurati asn1cCallocOne(UL->frequencyInfoUL.p_Max, *frequencyInfoUL->p_Max); frame_type_t frame_type = - get_frame_type((int)*configuration->scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], - *configuration->scc->ssbSubcarrierSpacing); + get_frame_type((int)*scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0], + *scc->ssbSubcarrierSpacing); if (frame_type == FDD) { UL->frequencyInfoUL.absoluteFrequencyPointA = malloc(sizeof(*UL->frequencyInfoUL.absoluteFrequencyPointA)); AssertFatal(UL->frequencyInfoUL.absoluteFrequencyPointA != NULL, "out of memory\n"); *UL->frequencyInfoUL.absoluteFrequencyPointA = - *configuration->scc->uplinkConfigCommon->frequencyInfoUL->absoluteFrequencyPointA; + *scc->uplinkConfigCommon->frequencyInfoUL->absoluteFrequencyPointA; UL->frequencyInfoUL.frequencyBandList = calloc(1, sizeof(*UL->frequencyInfoUL.frequencyBandList)); AssertFatal(UL->frequencyInfoUL.frequencyBandList != NULL, "out of memory\n"); for (int i = 0; i < frequencyInfoUL->frequencyBandList->list.count; i++) { @@ -1898,25 +1898,25 @@ NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const gNB_RrcConfigurationReq *configurati } } - 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.genericParameters = scc->uplinkConfigCommon->initialUplinkBWP->genericParameters; + UL->initialUplinkBWP.rach_ConfigCommon = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon; + UL->initialUplinkBWP.pusch_ConfigCommon = scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon; UL->initialUplinkBWP.pusch_ConfigCommon->choice.setup->groupHoppingEnabledTransformPrecoding = NULL; - UL->initialUplinkBWP.pucch_ConfigCommon = configuration->scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon; + UL->initialUplinkBWP.pucch_ConfigCommon = scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon; UL->timeAlignmentTimerCommon = NR_TimeAlignmentTimer_infinity; - ServCellCom->n_TimingAdvanceOffset = configuration->scc->n_TimingAdvanceOffset; + ServCellCom->n_TimingAdvanceOffset = scc->n_TimingAdvanceOffset; ServCellCom->ssb_PositionsInBurst.inOneGroup.buf = calloc(1, sizeof(uint8_t)); uint8_t bitmap8,temp_bitmap=0; - switch (configuration->scc->ssb_PositionsInBurst->present) { + switch (scc->ssb_PositionsInBurst->present) { case NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_shortBitmap: - ServCellCom->ssb_PositionsInBurst.inOneGroup = configuration->scc->ssb_PositionsInBurst->choice.shortBitmap; + ServCellCom->ssb_PositionsInBurst.inOneGroup = scc->ssb_PositionsInBurst->choice.shortBitmap; break; case NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_mediumBitmap: - ServCellCom->ssb_PositionsInBurst.inOneGroup = configuration->scc->ssb_PositionsInBurst->choice.mediumBitmap; + ServCellCom->ssb_PositionsInBurst.inOneGroup = 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 @@ -1940,7 +1940,7 @@ NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const gNB_RrcConfigurationReq *configurati AssertFatal(ServCellCom->ssb_PositionsInBurst.groupPresence->buf != NULL, "out of memory\n"); ServCellCom->ssb_PositionsInBurst.groupPresence->buf[0] = 0; for (int i = 0; i < 8; i++) { - bitmap8 = configuration->scc->ssb_PositionsInBurst->choice.longBitmap.buf[i]; + bitmap8 = scc->ssb_PositionsInBurst->choice.longBitmap.buf[i]; if (bitmap8 != 0) { if (temp_bitmap == 0) temp_bitmap = bitmap8; @@ -1958,15 +1958,15 @@ NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const gNB_RrcConfigurationReq *configurati break; } - ServCellCom->ssb_PeriodicityServingCell = *configuration->scc->ssb_periodicityServingCell; - if (configuration->scc->tdd_UL_DL_ConfigurationCommon) { + ServCellCom->ssb_PeriodicityServingCell = *scc->ssb_periodicityServingCell; + if (scc->tdd_UL_DL_ConfigurationCommon) { ServCellCom->tdd_UL_DL_ConfigurationCommon = CALLOC(1,sizeof(struct NR_TDD_UL_DL_ConfigCommon)); AssertFatal(ServCellCom->tdd_UL_DL_ConfigurationCommon != NULL, "out of memory\n"); - 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->tdd_UL_DL_ConfigurationCommon->referenceSubcarrierSpacing = scc->tdd_UL_DL_ConfigurationCommon->referenceSubcarrierSpacing; + ServCellCom->tdd_UL_DL_ConfigurationCommon->pattern1 = scc->tdd_UL_DL_ConfigurationCommon->pattern1; + ServCellCom->tdd_UL_DL_ConfigurationCommon->pattern2 = scc->tdd_UL_DL_ConfigurationCommon->pattern2; } - ServCellCom->ss_PBCH_BlockPower = configuration->scc->ss_PBCH_BlockPower; + ServCellCom->ss_PBCH_BlockPower = scc->ss_PBCH_BlockPower; // ims-EmergencySupport // TODO: add ims-EmergencySupport @@ -2345,7 +2345,8 @@ NR_CellGroupConfig_t *get_initial_cellGroupConfig(int uid, void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, const int uid, NR_UE_NR_Capability_t *uecap, - const gNB_RrcConfigurationReq *configuration) + const gNB_RrcConfigurationReq *configuration, + const NR_ServingCellConfigCommon_t *scc) { DevAssert(cellGroupConfig != NULL); /* this is wrong: we should not call this function is spCellConfig is not @@ -2355,7 +2356,8 @@ void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, /* same as for spCellConfig */ if (configuration == NULL) return; - DevAssert(configuration->scc != NULL); + /* if scc is not allocated, there is a serious problem */ + DevAssert(scc != NULL); /* This is a hack and will be removed once the CellGroupConfig is fully * handled at the DU */ @@ -2365,7 +2367,6 @@ void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, } NR_SpCellConfig_t *SpCellConfig = cellGroupConfig->spCellConfig; - NR_ServingCellConfigCommon_t *scc = configuration->scc; int curr_bwp = NRRIV2BW(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); NR_UplinkConfig_t *uplinkConfig = diff --git a/openair2/RRC/NR/nr_rrc_config.h b/openair2/RRC/NR/nr_rrc_config.h index 592d14bf01..dbb97c14a8 100644 --- a/openair2/RRC/NR/nr_rrc_config.h +++ b/openair2/RRC/NR/nr_rrc_config.h @@ -53,7 +53,7 @@ int encode_MIB_NR(NR_BCCH_BCH_Message_t *mib, int frame, uint8_t *buf, int buf_s #define NR_MAX_SIB_LENGTH 2976 // 3GPP TS 38.331 section 5.2.1 -NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const gNB_RrcConfigurationReq *configuration); +NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const gNB_RrcConfigurationReq *configuration, const NR_ServingCellConfigCommon_t *scc); void free_SIB1_NR(NR_BCCH_DL_SCH_Message_t *sib1); int encode_SIB1_NR(NR_BCCH_DL_SCH_Message_t *sib1, uint8_t *buffer, int max_buffer_size); @@ -64,7 +64,8 @@ NR_CellGroupConfig_t *get_initial_cellGroupConfig(int uid, void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, const int uid, NR_UE_NR_Capability_t *uecap, - const gNB_RrcConfigurationReq *configuration); + const gNB_RrcConfigurationReq *configuration, + const NR_ServingCellConfigCommon_t *scc); void free_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig); int encode_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, uint8_t *buffer, int max_buffer_size); NR_CellGroupConfig_t *decode_cellGroupConfig(const uint8_t *buffer, int max_buffer_size); diff --git a/openair2/RRC/NR/nr_rrc_defs.h b/openair2/RRC/NR/nr_rrc_defs.h index 637c43bd4a..3bb5cdfccd 100644 --- a/openair2/RRC/NR/nr_rrc_defs.h +++ b/openair2/RRC/NR/nr_rrc_defs.h @@ -338,7 +338,6 @@ typedef struct { NR_SIB3_t *sib3; NR_BCCH_DL_SCH_Message_t systemInformation; // SIB23 NR_BCCH_DL_SCH_Message_t *siblock1; - NR_ServingCellConfigCommon_t *servingcellconfigcommon; NR_CellGroupConfig_t *secondaryCellGroup[MAX_NR_RRC_UE_CONTEXTS]; } rrc_gNB_carrier_data_t; diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 35c4dc4d68..2f8fa42eae 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -210,18 +210,40 @@ void nr_rrc_transfer_protected_rrc_message(const gNB_RRC_INST *rrc, const gNB_RR nr_pdcp_data_req_srb(ue_p->rrc_ue_id, srb_id, rrc_gNB_mui++, size, (unsigned char *const)buffer, rrc_deliver_dl_rrc_message, &data); } +static int get_dl_band(const f1ap_served_cell_info_t *cell_info) +{ + return cell_info->mode == F1AP_MODE_TDD ? cell_info->tdd.freqinfo.band : cell_info->fdd.dl_freqinfo.band; +} + +static int get_ul_band(const f1ap_served_cell_info_t *cell_info) +{ + return cell_info->mode == F1AP_MODE_TDD ? cell_info->tdd.freqinfo.band : cell_info->fdd.ul_freqinfo.band; +} + +static int get_ssb_scs(const f1ap_served_cell_info_t *cell_info) +{ + return cell_info->mode == F1AP_MODE_TDD ? cell_info->tdd.tbw.scs : cell_info->fdd.dl_tbw.scs; +} + +static int get_dl_arfcn(const f1ap_served_cell_info_t *cell_info) +{ + return cell_info->mode == F1AP_MODE_TDD ? cell_info->tdd.freqinfo.arfcn : cell_info->fdd.dl_freqinfo.arfcn; +} + ///---------------------------------------------------------------------------------------------------------------/// ///---------------------------------------------------------------------------------------------------------------/// static void init_NR_SI(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *configuration) { + const NR_ServingCellConfigCommon_t *scc = RC.nrmac[0]->common_channels[0].ServingCellConfigCommon; LOG_D(RRC,"%s()\n\n\n\n",__FUNCTION__); - if (NODE_IS_DU(rrc->node_type) || NODE_IS_MONOLITHIC(rrc->node_type)) - rrc->carrier.mib = get_new_MIB_NR(rrc->carrier.servingcellconfigcommon); + if (NODE_IS_DU(rrc->node_type) || NODE_IS_MONOLITHIC(rrc->node_type)) { + rrc->carrier.mib = get_new_MIB_NR(scc); + } if((get_softmodem_params()->sa) && ( (NODE_IS_DU(rrc->node_type) || NODE_IS_MONOLITHIC(rrc->node_type)))) { - NR_BCCH_DL_SCH_Message_t *sib1 = get_SIB1_NR(configuration); + NR_BCCH_DL_SCH_Message_t *sib1 = get_SIB1_NR(configuration, scc); //xer_fprint(stdout, &asn_DEF_NR_BCCH_DL_SCH_Message, sib1); rrc->carrier.SIB1 = calloc(NR_MAX_SIB_LENGTH / 8, sizeof(*rrc->carrier.SIB1)); AssertFatal(rrc->carrier.SIB1 != NULL, "out of memory\n"); @@ -242,12 +264,12 @@ static void init_NR_SI(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *configuration if (NODE_IS_MONOLITHIC(rrc->node_type) || NODE_IS_DU(rrc->node_type)){ // update SI info + /* 1. move this to MAC */ nr_mac_config_scc(RC.nrmac[rrc->module_id], rrc->configuration.pdsch_AntennaPorts, rrc->configuration.pusch_AntennaPorts, rrc->configuration.sib1_tda, - rrc->configuration.minRXTXTIME, - rrc->carrier.servingcellconfigcommon); + rrc->configuration.minRXTXTIME); nr_mac_config_mib(RC.nrmac[rrc->module_id], rrc->carrier.mib); } @@ -300,7 +322,6 @@ void openair_rrc_gNB_configuration(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *c uid_linear_allocator_init(&rrc->uid_allocator); RB_INIT(&rrc->rrc_ue_head); rrc->configuration = *configuration; - rrc->carrier.servingcellconfigcommon = configuration->scc; /// System Information INIT init_NR_SI(rrc, configuration); return; @@ -491,6 +512,9 @@ static void rrc_gNB_generate_defaultRRCReconfiguration(const protocol_ctxt_t *co uint8_t xid = rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id); ue_p->xids[xid] = RRC_DEFAULT_RECONF; + const nr_rrc_du_container_t *du = rrc->du; + DevAssert(du != NULL); + struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList *dedicatedNAS_MessageList = CALLOC(1, sizeof(*dedicatedNAS_MessageList)); /* Add all NAS PDUs to the list */ @@ -515,7 +539,12 @@ static void rrc_gNB_generate_defaultRRCReconfiguration(const protocol_ctxt_t *co dedicatedNAS_MessageList = NULL; } - NR_MeasConfig_t *measconfig = get_defaultMeasConfig(&rrc->configuration); + AssertFatal(du->setup_req->num_cells_available == 1, "cannot handle more than one cell, but have %d\n", du->setup_req->num_cells_available); + f1ap_served_cell_info_t *cell_info = &du->setup_req->cell[0].info; + int scs = get_ssb_scs(cell_info); + int band = get_dl_band(cell_info); + int arfcn = get_dl_arfcn(cell_info); + NR_MeasConfig_t *measconfig = get_defaultMeasConfig(arfcn, band, scs); uint8_t buffer[RRC_BUF_SIZE] = {0}; int size = do_RRCReconfiguration(ctxt_pP, @@ -530,7 +559,6 @@ static void rrc_gNB_generate_defaultRRCReconfiguration(const protocol_ctxt_t *co measconfig, dedicatedNAS_MessageList, ue_context_pP, - &rrc->carrier, &rrc->configuration, NULL, ue_p->masterCellGroup); @@ -572,7 +600,10 @@ static void rrc_gNB_generate_defaultRRCReconfiguration(const protocol_ctxt_t *co ? NR_RRC_RECONFIGURATION_DELAY_MS + NR_RRC_BWP_SWITCHING_DELAY_MS : NR_RRC_RECONFIGURATION_DELAY_MS; - nr_mac_enable_ue_rrc_processing_timer(ctxt_pP->module_id, ue_p->rnti, *rrc->carrier.servingcellconfigcommon->ssbSubcarrierSpacing, delay_ms); + const nr_rrc_du_container_t *du = rrc->du; + DevAssert(du != NULL); + int scs = get_ssb_scs(&du->setup_req->cell[0].info); + nr_mac_enable_ue_rrc_processing_timer(ctxt_pP->module_id, ue_p->rnti, scs, delay_ms); } } @@ -650,7 +681,6 @@ void rrc_gNB_generate_dedicatedRRCReconfiguration(const protocol_ctxt_t *const c NULL, dedicatedNAS_MessageList, ue_context_pP, - &rrc->carrier, &rrc->configuration, NULL, cellGroupConfig); @@ -678,7 +708,10 @@ void rrc_gNB_generate_dedicatedRRCReconfiguration(const protocol_ctxt_t *const c ? NR_RRC_RECONFIGURATION_DELAY_MS + NR_RRC_BWP_SWITCHING_DELAY_MS : NR_RRC_RECONFIGURATION_DELAY_MS; - nr_mac_enable_ue_rrc_processing_timer(ctxt_pP->module_id, ue_p->rnti, *rrc->carrier.servingcellconfigcommon->ssbSubcarrierSpacing, delay_ms); + const nr_rrc_du_container_t *du = rrc->du; + DevAssert(du != NULL); + int scs = get_ssb_scs(&du->setup_req->cell[0].info); + nr_mac_enable_ue_rrc_processing_timer(ctxt_pP->module_id, ue_p->rnti, scs, delay_ms); } } @@ -796,7 +829,6 @@ rrc_gNB_modify_dedicatedRRCReconfiguration( NULL, NULL, NULL, - NULL, NULL); LOG_DUMPMSG(NR_RRC, DEBUG_RRC, (char *)buffer, size, "[MSG] RRC Reconfiguration\n"); @@ -829,7 +861,10 @@ rrc_gNB_modify_dedicatedRRCReconfiguration( ? NR_RRC_RECONFIGURATION_DELAY_MS + NR_RRC_BWP_SWITCHING_DELAY_MS : NR_RRC_RECONFIGURATION_DELAY_MS; - nr_mac_enable_ue_rrc_processing_timer(ctxt_pP->module_id, ue_p->rnti, *rrc->carrier.servingcellconfigcommon->ssbSubcarrierSpacing, delay_ms); + const nr_rrc_du_container_t *du = rrc->du; + DevAssert(du != NULL); + int scs = get_ssb_scs(&du->setup_req->cell[0].info); + nr_mac_enable_ue_rrc_processing_timer(ctxt_pP->module_id, ue_p->rnti, scs, delay_ms); } } @@ -880,7 +915,6 @@ rrc_gNB_generate_dedicatedRRCReconfiguration_release( NULL, NULL, NULL, - NULL, NULL); LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)buffer,size, "[MSG] RRC Reconfiguration\n"); @@ -910,7 +944,10 @@ rrc_gNB_generate_dedicatedRRCReconfiguration_release( ? NR_RRC_RECONFIGURATION_DELAY_MS + NR_RRC_BWP_SWITCHING_DELAY_MS : NR_RRC_RECONFIGURATION_DELAY_MS; - nr_mac_enable_ue_rrc_processing_timer(ctxt_pP->module_id, ue_p->rnti, *rrc->carrier.servingcellconfigcommon->ssbSubcarrierSpacing, delay_ms); + const nr_rrc_du_container_t *du = rrc->du; + DevAssert(du != NULL); + int scs = get_ssb_scs(&du->setup_req->cell[0].info); + nr_mac_enable_ue_rrc_processing_timer(ctxt_pP->module_id, ue_p->rnti, scs, delay_ms); } } @@ -1015,8 +1052,8 @@ static void rrc_gNB_process_RRCReconfigurationComplete(const protocol_ctxt_t *co //----------------------------------------------------------------------------- static void rrc_gNB_generate_RRCReestablishment(rrc_gNB_ue_context_t *ue_context_pP, const uint8_t *masterCellGroup_from_DU, - NR_ServingCellConfigCommon_t *scc, - const rnti_t old_rnti) + const rnti_t old_rnti, + const f1ap_served_cell_info_t *cell_info) //----------------------------------------------------------------------------- { module_id_t module_id = 0; @@ -1024,16 +1061,12 @@ static void rrc_gNB_generate_RRCReestablishment(rrc_gNB_ue_context_t *ue_context int enable_ciphering = 0; gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context; - /* look up corresponding DU. For the moment, there is only one */ - const nr_rrc_du_container_t *du = rrc->du; - AssertFatal(du != NULL, "received CCCH message, but no corresponding DU found\n"); - const f1ap_served_cell_info_t *cell_info = &du->setup_req->cell[0].info; - uint8_t buffer[RRC_BUF_SIZE] = {0}; uint8_t xid = rrc_gNB_get_next_transaction_identifier(module_id); ue_p->xids[xid] = RRC_REESTABLISH; NR_SRB_ToAddModList_t *SRBs = createSRBlist(ue_p, true); - int size = do_RRCReestablishment(ue_context_pP, buffer, RRC_BUF_SIZE, xid, cell_info->nr_pci, scc); + uint32_t arfcn = get_dl_arfcn(cell_info); + int size = do_RRCReestablishment(ue_context_pP, buffer, RRC_BUF_SIZE, xid, cell_info->nr_pci, arfcn); LOG_I(NR_RRC, "[RAPROC] UE %04x Logical Channel DL-DCCH, Generating NR_RRCReestablishment (bytes %d)\n", ue_p->rnti, size); @@ -1133,7 +1166,6 @@ static void rrc_gNB_process_RRCReestablishmentComplete(const protocol_ctxt_t *co NULL, // MeasObj_list, NULL, ue_context_pP, - &rrc->carrier, NULL, NULL, cellGroupConfig); @@ -1156,10 +1188,10 @@ static void rrc_gNB_process_RRCReestablishmentComplete(const protocol_ctxt_t *co ? NR_RRC_RECONFIGURATION_DELAY_MS + NR_RRC_BWP_SWITCHING_DELAY_MS : NR_RRC_RECONFIGURATION_DELAY_MS; - nr_mac_enable_ue_rrc_processing_timer(ctxt_pP->module_id, - ue_p->rnti, - *RC.nrrrc[ctxt_pP->module_id]->carrier.servingcellconfigcommon->ssbSubcarrierSpacing, - delay_ms); + const nr_rrc_du_container_t *du = RC.nrrrc[0]->du; + DevAssert(du != NULL); + int scs = get_ssb_scs(&du->setup_req->cell[0].info); + nr_mac_enable_ue_rrc_processing_timer(ctxt_pP->module_id, ue_p->rnti, scs, delay_ms); } } //----------------------------------------------------------------------------- @@ -1197,7 +1229,6 @@ int nr_rrc_reconfiguration_req(rrc_gNB_ue_context_t *const ue_context_pP ue_context_pP, NULL, NULL, - NULL, masterCellGroup); gNB_RRC_INST *rrc = RC.nrrrc[ctxt_pP->module_id]; @@ -1212,10 +1243,10 @@ int nr_rrc_reconfiguration_req(rrc_gNB_ue_context_t *const ue_context_pP ? NR_RRC_RECONFIGURATION_DELAY_MS + NR_RRC_BWP_SWITCHING_DELAY_MS : NR_RRC_RECONFIGURATION_DELAY_MS; - nr_mac_enable_ue_rrc_processing_timer(ctxt_pP->module_id, - ue_p->rnti, - *rrc->carrier.servingcellconfigcommon->ssbSubcarrierSpacing, - delay_ms); + const nr_rrc_du_container_t *du = rrc->du; + DevAssert(du != NULL); + int scs = get_ssb_scs(&du->setup_req->cell[0].info); + nr_mac_enable_ue_rrc_processing_timer(ctxt_pP->module_id, ue_p->rnti, scs, delay_ms); } return 0; @@ -1351,7 +1382,6 @@ static int nr_rrc_gNB_decode_ccch(module_id_t module_id, const f1ap_initial_ul_r ? "Other Failure" : (cause == NR_ReestablishmentCause_handoverFailure ? "Handover Failure" : "reconfigurationFailure")); - uint8_t xid = -1; AssertFatal(du->setup_req->num_cells_available == 1, "cannot handle more than one cell\n"); const f1ap_served_cell_info_t *cell_info = &du->setup_req->cell[0].info; if (physCellId != cell_info->nr_pci) { @@ -1412,8 +1442,8 @@ static int nr_rrc_gNB_decode_ccch(module_id_t module_id, const f1ap_initial_ul_r rrc_gNB_generate_RRCReestablishment(ue_context_p, msg->du2cu_rrc_container, - gnb_rrc_inst->carrier.servingcellconfigcommon, - old_rnti); + old_rnti, + cell_info); } break; case NR_UL_CCCH_MessageType__c1_PR_rrcSystemInfoRequest: @@ -2195,10 +2225,10 @@ unsigned int mask_flip(unsigned int x) { return((((x>>8) + (x<<8))&0xffff)>>6); } -static unsigned int get_dl_bw_mask(const gNB_RRC_INST *rrc, const NR_UE_NR_Capability_t *cap) +static unsigned int get_dl_bw_mask(const f1ap_served_cell_info_t *cell_info, const NR_UE_NR_Capability_t *cap) { - int common_band = *rrc->carrier.servingcellconfigcommon->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; - int common_scs = rrc->carrier.servingcellconfigcommon->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; + int common_band = get_dl_band(cell_info); + int common_scs = get_ssb_scs(cell_info); for (int i=0;irf_Parameters.supportedBandListNR.list.count;i++) { NR_BandNR_t *bandNRinfo = cap->rf_Parameters.supportedBandListNR.list.array[i]; if (bandNRinfo->bandNR == common_band) { @@ -2245,10 +2275,10 @@ static unsigned int get_dl_bw_mask(const gNB_RRC_INST *rrc, const NR_UE_NR_Capab return(0); } -static unsigned int get_ul_bw_mask(const gNB_RRC_INST *rrc, const NR_UE_NR_Capability_t *cap) +static unsigned int get_ul_bw_mask(const f1ap_served_cell_info_t *cell_info, const NR_UE_NR_Capability_t *cap) { - int common_band = *rrc->carrier.servingcellconfigcommon->uplinkConfigCommon->frequencyInfoUL->frequencyBandList->list.array[0]; - int common_scs = rrc->carrier.servingcellconfigcommon->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; + int common_band = get_ul_band(cell_info); + int common_scs = get_ssb_scs(cell_info); for (int i=0;irf_Parameters.supportedBandListNR.list.count;i++) { NR_BandNR_t *bandNRinfo = cap->rf_Parameters.supportedBandListNR.list.array[i]; if (bandNRinfo->bandNR == common_band) { @@ -2295,9 +2325,9 @@ static unsigned int get_ul_bw_mask(const gNB_RRC_INST *rrc, const NR_UE_NR_Capab return(0); } -static int get_ul_mimo_layersCB(const gNB_RRC_INST *rrc, const NR_UE_NR_Capability_t *cap) +static int get_ul_mimo_layersCB(const f1ap_served_cell_info_t *cell_info, const NR_UE_NR_Capability_t *cap) { - int common_scs = rrc->carrier.servingcellconfigcommon->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; + int common_scs = get_ssb_scs(cell_info); // check featureSet NR_FeatureSets_t *fs=cap->featureSets; @@ -2313,9 +2343,9 @@ static int get_ul_mimo_layersCB(const gNB_RRC_INST *rrc, const NR_UE_NR_Capabili return(1); } -static int get_ul_mimo_layers(const gNB_RRC_INST *rrc, const NR_UE_NR_Capability_t *cap) +static int get_ul_mimo_layers(const f1ap_served_cell_info_t *cell_info, const NR_UE_NR_Capability_t *cap) { - int common_scs = rrc->carrier.servingcellconfigcommon->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; + int common_scs = get_ssb_scs(cell_info); // check featureSet NR_FeatureSets_t *fs=cap->featureSets; @@ -2330,9 +2360,9 @@ static int get_ul_mimo_layers(const gNB_RRC_INST *rrc, const NR_UE_NR_Capability return(1); } -static int get_dl_mimo_layers(const gNB_RRC_INST *rrc, const NR_UE_NR_Capability_t *cap) +static int get_dl_mimo_layers(const f1ap_served_cell_info_t *cell_info, const NR_UE_NR_Capability_t *cap) { - int common_scs = rrc->carrier.servingcellconfigcommon->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; + int common_scs = get_ssb_scs(cell_info); // check featureSet NR_FeatureSets_t *fs=cap->featureSets; @@ -2517,6 +2547,10 @@ static void write_rrc_stats(const gNB_RRC_INST *rrc) { const gNB_RRC_UE_t *ue_ctxt = &ue_context_p->ue_context; f1_ue_data_t ue_data = cu_get_f1_ue_data(ue_ctxt->rrc_ue_id); + /* currently, we support only one DU. If we support multiple, need to + * search for the DU corresponding to this UE here */ + const nr_rrc_du_container_t *du = rrc->du; + DevAssert(du != NULL); fprintf(f, "UE %d CU UE ID %d DU UE ID %d RNTI %04x random identity %016lx", @@ -2539,13 +2573,15 @@ static void write_rrc_stats(const gNB_RRC_INST *rrc) } if (ue_ctxt->UE_Capability_nr) { + AssertFatal(du->setup_req->num_cells_available == 1, "only one cell supported at the moment\n"); + const f1ap_served_cell_info_t *cell_info = &du->setup_req->cell[0].info; fprintf(f, " UE cap: BW DL %x. BW UL %x, DL MIMO Layers %d UL MIMO Layers (CB) %d UL MIMO Layers (nonCB) %d\n", - get_dl_bw_mask(rrc, ue_ctxt->UE_Capability_nr), - get_ul_bw_mask(rrc, ue_ctxt->UE_Capability_nr), - get_dl_mimo_layers(rrc, ue_ctxt->UE_Capability_nr), - get_ul_mimo_layersCB(rrc, ue_ctxt->UE_Capability_nr), - get_ul_mimo_layers(rrc, ue_ctxt->UE_Capability_nr)); + get_dl_bw_mask(cell_info, ue_ctxt->UE_Capability_nr), + get_ul_bw_mask(cell_info, ue_ctxt->UE_Capability_nr), + get_dl_mimo_layers(cell_info, ue_ctxt->UE_Capability_nr), + get_ul_mimo_layersCB(cell_info, ue_ctxt->UE_Capability_nr), + get_ul_mimo_layers(cell_info, ue_ctxt->UE_Capability_nr)); } if (ue_ctxt->measResults) diff --git a/openair2/RRC/NR/rrc_gNB_nsa.c b/openair2/RRC/NR/rrc_gNB_nsa.c index 79adaa3737..8289ec73de 100644 --- a/openair2/RRC/NR/rrc_gNB_nsa.c +++ b/openair2/RRC/NR/rrc_gNB_nsa.c @@ -119,7 +119,6 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc, rrc_gNB_ue_context_t *ue_context_p, x2a { AssertFatal(!get_softmodem_params()->sa, "%s() cannot be called in SA mode, it is intrinsically for NSA\n", __func__); // generate nr-Config-r15 containers for LTE RRC : inside message for X2 EN-DC (CG-Config Message from 38.331) - rrc_gNB_carrier_data_t *carrier=&rrc->carrier; const gNB_RrcConfigurationReq *configuration = &rrc->configuration; MessageDef *msg; msg = itti_alloc_new_message(TASK_RRC_ENB, 0, X2AP_ENDC_SGNB_ADDITION_REQ_ACK); @@ -243,7 +242,11 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc, rrc_gNB_ue_context_t *ue_context_p, x2a } NR_ServingCellConfig_t *scc = UE->spCellConfig ? UE->spCellConfig->spCellConfigDedicated : NULL; - UE->secondaryCellGroup = get_default_secondaryCellGroup(carrier->servingcellconfigcommon, + // The MAC has the ServingCellConfigCommon; the below code is incorrect: the + // CU should send a UE Context Setup Request to request the creating of the + // MAC Context + NR_ServingCellConfigCommon_t *sccc = RC.nrmac[0]->common_channels[0].ServingCellConfigCommon; + UE->secondaryCellGroup = get_default_secondaryCellGroup(sccc, scc, UE->UE_Capability_nr, 1, @@ -253,7 +256,7 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc, rrc_gNB_ue_context_t *ue_context_p, x2a AssertFatal(UE->secondaryCellGroup != NULL, "out of memory\n"); xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, UE->secondaryCellGroup); - fill_default_reconfig(carrier->servingcellconfigcommon, scc, reconfig_ies, UE->secondaryCellGroup, UE->UE_Capability_nr, configuration, ue_context_p->ue_context.rrc_ue_id); + fill_default_reconfig(sccc, scc, reconfig_ies, UE->secondaryCellGroup, UE->UE_Capability_nr, configuration, ue_context_p->ue_context.rrc_ue_id); UE->rnti = UE->secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity; NR_CG_Config_t *CG_Config = calloc(1,sizeof(*CG_Config)); memset((void *)CG_Config,0,sizeof(*CG_Config)); From 0f897b4007d652575b109b47a32ae5acaeb06f7a Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 18 Jul 2023 12:17:05 +0200 Subject: [PATCH 36/63] Move ServingCellConfigDedicated to MAC As with the ServingCellConfigCommon, the ServingCellConfigDedicated is a radio-related structure to be handled at the DU. --- openair1/SIMULATION/NR_PHY/dlsim.c | 2 +- openair1/SIMULATION/NR_PHY/ulsim.c | 2 +- openair2/COMMON/rrc_messages_types.h | 1 - openair2/GNB_APP/gnb_config.c | 6 ++---- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c | 2 +- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 2 +- openair2/LAYER2/NR_MAC_gNB/main.c | 3 ++- openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 2 ++ openair2/RRC/NR/rrc_gNB.c | 3 ++- openair2/RRC/NR/rrc_gNB_nsa.c | 3 ++- 10 files changed, 14 insertions(+), 12 deletions(-) diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index b90ccc835c..47659eb039 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -632,7 +632,7 @@ int main(int argc, char **argv) RC.nb_nr_mac_CC = (int*)malloc(RC.nb_nr_macrlc_inst*sizeof(int)); for (i = 0; i < RC.nb_nr_macrlc_inst; i++) RC.nb_nr_mac_CC[i] = 1; - mac_top_init_gNB(ngran_gNB, scc); + mac_top_init_gNB(ngran_gNB, scc, NULL); gNB_mac = RC.nrmac[0]; gNB_mac->dl_bler.harq_round_max = num_rounds; diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 8f2eb42d63..626bc65270 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -623,7 +623,7 @@ int main(int argc, char *argv[]) RC.nb_nr_mac_CC = (int*)malloc(RC.nb_nr_macrlc_inst*sizeof(int)); for (i = 0; i < RC.nb_nr_macrlc_inst; i++) RC.nb_nr_mac_CC[i] = 1; - mac_top_init_gNB(ngran_gNB, scc); + mac_top_init_gNB(ngran_gNB, scc, NULL /* scd will be updated further below */); NR_ServingCellConfig_t *scd = calloc(1,sizeof(NR_ServingCellConfig_t)); prepare_scd(scd); diff --git a/openair2/COMMON/rrc_messages_types.h b/openair2/COMMON/rrc_messages_types.h index 1781eb5d18..2e592b88cc 100644 --- a/openair2/COMMON/rrc_messages_types.h +++ b/openair2/COMMON/rrc_messages_types.h @@ -415,7 +415,6 @@ typedef struct NRRrcConfigurationReq_s { uint16_t mnc[PLMN_LIST_MAX_SIZE]; uint8_t mnc_digit_length[PLMN_LIST_MAX_SIZE]; uint8_t num_plmn; - NR_ServingCellConfig_t *scd; int sib1_tda; rrc_pdsch_AntennaPorts_t pdsch_AntennaPorts; int pusch_AntennaPorts; diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index e237114459..6fb9f5578e 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -987,11 +987,12 @@ void RCconfig_nr_macrlc() { NR_ServingCellConfigCommon_t *scc = get_scc_config(minRXTXTIME); //xer_fprint(stdout, &asn_DEF_NR_ServingCellConfigCommon, scc); + NR_ServingCellConfig_t *scd = get_scd_config(); if (MacRLC_ParamList.numelt > 0) { RC.nb_nr_macrlc_inst = MacRLC_ParamList.numelt; ngran_node_t node_type = get_node_type(); - mac_top_init_gNB(node_type, scc); + mac_top_init_gNB(node_type, scc, scd); RC.nb_nr_mac_CC = (int *)malloc(RC.nb_nr_macrlc_inst * sizeof(int)); for (j = 0; j < RC.nb_nr_macrlc_inst; j++) { @@ -1261,8 +1262,6 @@ void RCconfig_NRRRC(gNB_RRC_INST *rrc) paramdef_t GNBParams[] = GNBPARAMS_DESC; paramlist_def_t GNBParamList = {GNB_CONFIG_STRING_GNB_LIST,NULL,0}; - NR_ServingCellConfig_t *scd = get_scd_config(); - ////////// Physical parameters /* get global parameters, defined outside any section in the config file */ @@ -1400,7 +1399,6 @@ void RCconfig_NRRRC(gNB_RRC_INST *rrc) nrrrc_config.do_SRS = *GNBParamList.paramarray[i][GNB_DO_SRS_IDX].iptr; nrrrc_config.force_256qam_off = *GNBParamList.paramarray[i][GNB_FORCE256QAMOFF_IDX].iptr; LOG_I(GNB_APP, "256 QAM: %s\n", nrrrc_config.force_256qam_off ? "force off" : "may be on"); - nrrrc_config.scd = scd; nrrrc_config.enable_sdap = *GNBParamList.paramarray[i][GNB_ENABLE_SDAP_IDX].iptr; LOG_I(GNB_APP, "SDAP layer is %s\n", nrrrc_config.enable_sdap ? "enabled" : "disabled"); nrrrc_config.drbs = *GNBParamList.paramarray[i][GNB_DRBS].iptr; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 0bbe82ef3a..5c3db39699 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -2890,7 +2890,7 @@ void prepare_initial_ul_rrc_message(gNB_MAC_INST *mac, NR_UE_info_t *UE) int CC_id = 0; gNB_RRC_INST *rrc = RC.nrrrc[mod_id]; const NR_ServingCellConfigCommon_t *scc = mac->common_channels[CC_id].ServingCellConfigCommon; - const NR_ServingCellConfig_t *sccd = rrc->configuration.scd; + const NR_ServingCellConfig_t *sccd = mac->common_channels[CC_id].pre_ServingCellConfig; NR_CellGroupConfig_t *cellGroupConfig = get_initial_cellGroupConfig(UE->uid, scc, sccd, &rrc->configuration); UE->CellGroup = cellGroupConfig; diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index c12fa69eb0..cb907e7af5 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -38,7 +38,7 @@ void set_cset_offset(uint16_t); -void mac_top_init_gNB(ngran_node_t node_type, NR_ServingCellConfigCommon_t *scc); +void mac_top_init_gNB(ngran_node_t node_type, NR_ServingCellConfigCommon_t *scc, NR_ServingCellConfig_t *scd); int nr_mac_enable_ue_rrc_processing_timer(module_id_t Mod_idP, rnti_t rnti, diff --git a/openair2/LAYER2/NR_MAC_gNB/main.c b/openair2/LAYER2/NR_MAC_gNB/main.c index a7f8de1d8f..1d07f39630 100644 --- a/openair2/LAYER2/NR_MAC_gNB/main.c +++ b/openair2/LAYER2/NR_MAC_gNB/main.c @@ -205,7 +205,7 @@ static void mac_rrc_init(gNB_MAC_INST *mac, ngran_node_t node_type) } } -void mac_top_init_gNB(ngran_node_t node_type, NR_ServingCellConfigCommon_t *scc) +void mac_top_init_gNB(ngran_node_t node_type, NR_ServingCellConfigCommon_t *scc, NR_ServingCellConfig_t *scd) { module_id_t i; gNB_MAC_INST *nrmac; @@ -242,6 +242,7 @@ void mac_top_init_gNB(ngran_node_t node_type, NR_ServingCellConfigCommon_t *scc) RC.nrmac[i]->ul_handle = 0; RC.nrmac[i]->common_channels[0].ServingCellConfigCommon = scc; + RC.nrmac[i]->common_channels[0].pre_ServingCellConfig = scd; RC.nrmac[i]->first_MIB = true; diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 0f272bbd2d..ef35bc0a8e 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -220,6 +220,8 @@ typedef struct { NR_BCCH_BCH_Message_t *mib; NR_BCCH_DL_SCH_Message_t *sib1; NR_ServingCellConfigCommon_t *ServingCellConfigCommon; + /// pre-configured ServingCellConfig that is default for every UE + NR_ServingCellConfig_t *pre_ServingCellConfig; NR_ARFCN_ValueEUTRA_t ul_CarrierFreq; long ul_Bandwidth; /// Outgoing MIB PDU for PHY diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 2f8fa42eae..455ded6c02 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -274,10 +274,11 @@ static void init_NR_SI(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *configuration } if (get_softmodem_params()->phy_test > 0 || get_softmodem_params()->do_ra > 0) { + AssertFatal(NODE_IS_MONOLITHIC(rrc->node_type), "phy_test and do_ra only work in monolithic\n"); rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_allocate_new_ue_context(rrc); gNB_RRC_UE_t *UE = &ue_context_p->ue_context; UE->spCellConfig = calloc(1, sizeof(struct NR_SpCellConfig)); - UE->spCellConfig->spCellConfigDedicated = configuration->scd; + UE->spCellConfig->spCellConfigDedicated = RC.nrmac[0]->common_channels[0].pre_ServingCellConfig; LOG_I(NR_RRC,"Adding new user (%p)\n",ue_context_p); if (!NODE_IS_CU(RC.nrrrc[0]->node_type)) { rrc_add_nsa_user(rrc,ue_context_p,NULL); diff --git a/openair2/RRC/NR/rrc_gNB_nsa.c b/openair2/RRC/NR/rrc_gNB_nsa.c index 8289ec73de..e03dcc4705 100644 --- a/openair2/RRC/NR/rrc_gNB_nsa.c +++ b/openair2/RRC/NR/rrc_gNB_nsa.c @@ -105,8 +105,9 @@ void rrc_parse_ue_capabilities(gNB_RRC_INST *rrc, NR_UE_CapabilityRAT_ContainerL } LOG_A(NR_RRC, "Successfully decoded UE NR capabilities (NR and MRDC)\n"); + AssertFatal(NODE_IS_MONOLITHIC(rrc->node_type), "phy_test and do_ra only work in monolithic\n"); UE->spCellConfig = calloc(1, sizeof(struct NR_SpCellConfig)); - UE->spCellConfig->spCellConfigDedicated = rrc->configuration.scd; + UE->spCellConfig->spCellConfigDedicated = RC.nrmac[0]->common_channels[0].pre_ServingCellConfig; LOG_I(NR_RRC,"Adding new NSA user (%p)\n",ue_context_p); rrc_add_nsa_user(rrc,ue_context_p, m); } From 6142d1d74cd991a7ddb79675216f09bab5130945 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 25 Jul 2023 15:56:31 +0200 Subject: [PATCH 37/63] RRC sctp_in/out_streams not used --- openair2/GNB_APP/gnb_config.c | 2 -- openair2/RRC/NR/nr_rrc_defs.h | 2 -- 2 files changed, 4 deletions(-) diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 6fb9f5578e..cf84570cf3 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -1310,8 +1310,6 @@ void RCconfig_NRRRC(gNB_RRC_INST *rrc) rrc->eth_params_s.my_portd = *(GNBParamList.paramarray[i][GNB_LOCAL_S_PORTD_IDX].uptr); rrc->eth_params_s.remote_portd = *(GNBParamList.paramarray[i][GNB_REMOTE_S_PORTD_IDX].uptr); rrc->eth_params_s.transp_preference = ETH_UDP_MODE; - rrc->sctp_in_streams = (uint16_t)*(SCTPParams[GNB_SCTP_INSTREAMS_IDX].uptr); - rrc->sctp_out_streams = (uint16_t)*(SCTPParams[GNB_SCTP_OUTSTREAMS_IDX].uptr); } diff --git a/openair2/RRC/NR/nr_rrc_defs.h b/openair2/RRC/NR/nr_rrc_defs.h index 3bb5cdfccd..055ef88fbe 100644 --- a/openair2/RRC/NR/nr_rrc_defs.h +++ b/openair2/RRC/NR/nr_rrc_defs.h @@ -415,8 +415,6 @@ typedef struct gNB_RRC_INST_s { int srb1_timer_status_prohibit; int um_on_default_drb; int srs_enable[MAX_NUM_CCs]; - uint16_t sctp_in_streams; - uint16_t sctp_out_streams; char *uecap_file; From 5d0ae84ad23b858636e0b5cfa3a76669506fbe5a Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 21 Jul 2023 16:34:55 +0200 Subject: [PATCH 38/63] Move MIB to MAC The MasterInformationBlock is handled at the DU and sent to the CU in the F1 Setup Response. Hence, move it down to the MAC. Furthermore: - Change type because MIB_PDU_t is 4G type - Simplify schedule_nr_mib() --- doc/SW_archi.md | 2 +- openair1/SIMULATION/NR_PHY/ulsim.c | 1 - openair2/GNB_APP/gnb_config.c | 14 +++++---- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c | 2 +- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h | 2 +- openair2/LAYER2/NR_MAC_gNB/config.c | 12 -------- .../LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 26 +++++++++++------ openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 1 - openair2/LAYER2/NR_MAC_gNB/main.c | 1 + openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 2 +- openair2/RRC/NR/L2_nr_interface.c | 8 +---- openair2/RRC/NR/nr_rrc_defs.h | 2 +- openair2/RRC/NR/rrc_gNB.c | 29 ++++++++++--------- 13 files changed, 47 insertions(+), 55 deletions(-) diff --git a/doc/SW_archi.md b/doc/SW_archi.md index 7facfcb595..4f80c98dcd 100644 --- a/doc/SW_archi.md +++ b/doc/SW_archi.md @@ -211,7 +211,7 @@ The scheduler also calls "run_pdcp()", as this is not a autonomous thread, it ne After calling run_pdcp, it updates "rlc" time data but it doesn't actually process rlc it sends a iiti message to activate the thread for RRC, the answer will be asynchronous in ???? -Calls schedule_nr_mib() that calls mac_rrc_nr_data_req() to fill MIB, +Calls schedule_nr_mib() that fills MIB, Calls schedule_nr_prach() which schedules the (fixed) PRACH region one frame in advance. diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 626bc65270..bf65be3fa2 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -652,7 +652,6 @@ int main(int argc, char *argv[]) gNB->if_inst->NR_PHY_config_req = nr_phy_config_request; // common configuration nr_mac_config_scc(RC.nrmac[0], conf.pdsch_AntennaPorts, n_tx, 0, 6); - nr_mac_config_mib(RC.nrmac[0], mib); // UE dedicated configuration nr_mac_add_test_ue(RC.nrmac[0], secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity, secondaryCellGroup); frame_parms->nb_antennas_tx = 1; diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index cf84570cf3..67784ad8e9 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -1960,9 +1960,10 @@ int RC_config_trigger_F1Setup() req->cell[0].info.plmn.mnc_digit_length, req->cell[0].info.nr_cellid); - gNB_RRC_INST *rrc = RC.nrrrc[0]; - DevAssert(rrc); - const NR_ServingCellConfigCommon_t *scc = RC.nrmac[0]->common_channels[0].ServingCellConfigCommon; + + gNB_MAC_INST *mac = RC.nrmac[0]; + DevAssert(mac); + const NR_ServingCellConfigCommon_t *scc = mac->common_channels[0].ServingCellConfigCommon; DevAssert(scc != NULL); req->cell[0].info.nr_pci = *scc->physCellId; LOG_W(GNB_APP, "no slices transported via F1 Setup Request!\n"); @@ -1992,16 +1993,18 @@ int RC_config_trigger_F1Setup() req->cell[0].info.measurement_timing_information = "0"; - DevAssert(rrc->carrier.mib != NULL); + DevAssert(mac->common_channels[0].mib != NULL); int buf_len = 3; // this is what we assume in monolithic req->cell[0].sys_info = calloc(1, sizeof(*req->cell[0].sys_info)); AssertFatal(req->cell[0].sys_info != NULL, "out of memory\n"); f1ap_gnb_du_system_info_t *sys_info = req->cell[0].sys_info; sys_info->mib = calloc(buf_len, sizeof(*sys_info->mib)); DevAssert(sys_info->mib != NULL); - sys_info->mib_length = encode_MIB_NR(rrc->carrier.mib, 0, sys_info->mib, buf_len); + sys_info->mib_length = encode_MIB_NR(mac->common_channels[0].mib, 0, sys_info->mib, buf_len); DevAssert(sys_info->mib_length == buf_len); + gNB_RRC_INST *rrc = RC.nrrrc[0]; + DevAssert(rrc); NR_BCCH_DL_SCH_Message_t *bcch_message = NULL; asn_codec_ctx_t st = {100 * 1000}; asn_dec_rval_t dec_rval = uper_decode_complete(&st, @@ -2026,7 +2029,6 @@ int RC_config_trigger_F1Setup() if (LOG_DEBUGFLAG(DEBUG_ASN1)) xer_fprint(stdout, &asn_DEF_NR_SIB1, (void *)bcch_message->message.choice.c1->choice.systemInformationBlockType1); - gNB_MAC_INST *mac = RC.nrmac[0]; mac->mac_rrc.f1_setup_request(req); mac->f1_config.setup_req = req; diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index 656195815a..a0f3fae413 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -4105,7 +4105,7 @@ uint32_t get_Y(const NR_SearchSpace_t *ss, int slot, rnti_t rnti) { void get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config, frame_t frameP, - NR_MIB_t *mib, + const NR_MIB_t *mib, uint8_t num_slot_per_frame, uint8_t ssb_subcarrier_offset, uint16_t ssb_start_symbol, diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h index ab7a820612..3689e4a5a2 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h @@ -207,7 +207,7 @@ uint32_t nr_compute_tbslbrm(uint16_t table, void get_type0_PDCCH_CSS_config_parameters(NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config, frame_t frameP, - NR_MIB_t *mib, + const NR_MIB_t *mib, uint8_t num_slot_per_frame, uint8_t ssb_subcarrier_offset, uint16_t ssb_start_symbol, diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index c7371a3ef4..b357138da2 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -560,18 +560,6 @@ void nr_mac_config_scc(gNB_MAC_INST *nrmac, NR_SCHED_UNLOCK(&nrmac->sched_lock); } -void nr_mac_config_mib(gNB_MAC_INST *nrmac, NR_BCCH_BCH_Message_t *mib) -{ - DevAssert(nrmac != NULL); - DevAssert(mib != NULL); - NR_SCHED_LOCK(&nrmac->sched_lock); - NR_COMMON_channels_t *cc = &nrmac->common_channels[0]; - - AssertFatal(cc->mib == NULL, "logic bug: updated MIB multiple times\n"); - cc->mib = mib; - NR_SCHED_UNLOCK(&nrmac->sched_lock); -} - void nr_mac_config_sib1(gNB_MAC_INST *nrmac, NR_BCCH_DL_SCH_Message_t *sib1) { DevAssert(nrmac != NULL); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index 3c5d56893d..57e8922bf5 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -105,19 +105,26 @@ static void fill_ssb_vrb_map(NR_COMMON_channels_t *cc, int rbStart, int ssb_subc vrb_map[rbStart + rb] = SL_to_bitmap(symStart % NR_SYMBOLS_PER_SLOT, 4); } +static int encode_mib(NR_BCCH_BCH_Message_t *mib, frame_t frame, uint8_t *buffer, int buf_size) +{ + int encode_size = 3; + AssertFatal(buf_size >= encode_size, "buffer of size %d too small, need 3 bytes\n", buf_size); + int encoded = encode_MIB_NR(mib, frame, buffer, encode_size); + DevAssert(encoded == encode_size); + return encode_size; +} + void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP, nfapi_nr_dl_tti_request_t *DL_req) { gNB_MAC_INST *gNB = RC.nrmac[module_idP]; /* already mutex protected: held in gNB_dlsch_ulsch_scheduler() */ - NR_COMMON_channels_t *cc; nfapi_nr_dl_tti_request_body_t *dl_req; - NR_MIB_t *mib = RC.nrrrc[module_idP]->carrier.mib->message.choice.mib; uint8_t num_tdd_period,num_ssb; - int mib_sdu_length; int CC_id; for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { - cc = &gNB->common_channels[CC_id]; + NR_COMMON_channels_t *cc= &gNB->common_channels[CC_id]; + const NR_MIB_t *mib = cc->mib->message.choice.mib; NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; const int slots_per_frame = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; dl_req = &DL_req->dl_tti_request_body; @@ -125,8 +132,7 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP, // get MIB every 8 frames if(((slotP == 0) && (frameP & 7) == 0) || gNB->first_MIB) { - - mib_sdu_length = mac_rrc_nr_data_req(module_idP, CC_id, frameP, MIBCH, 0, 1, &cc->MIB_pdu.payload[0]); + int mib_sdu_length = encode_mib(cc->mib, frameP, cc->MIB_pdu, sizeof(cc->MIB_pdu)); // flag to avoid sending an empty MIB in the first frames of execution since gNB doesn't get at the beginning in frame 0 slot 0 gNB->first_MIB = false; @@ -139,6 +145,8 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP, mib_sdu_length); } + uint32_t mib_pdu = (*(uint32_t *)cc->MIB_pdu) & ((1 << 24) - 1); + int8_t ssb_period = *scc->ssb_periodicityServingCell; uint8_t ssb_frame_periodicity = 1; // every how many frames SSB are generated @@ -175,7 +183,7 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP, // if start symbol is in current slot, schedule current SSB, fill VRB map and call get_type0_PDCCH_CSS_config_parameters if ((ssb_start_symbol/14) == rel_slot){ const int prb_offset = offset_pointa >> scs; - schedule_ssb(frameP, slotP, scc, dl_req, i_ssb, ssbSubcarrierOffset, offset_pointa, (*(uint32_t*)cc->MIB_pdu.payload) & ((1<<24)-1)); + schedule_ssb(frameP, slotP, scc, dl_req, i_ssb, ssbSubcarrierOffset, offset_pointa, mib_pdu); fill_ssb_vrb_map(cc, prb_offset, ssbSubcarrierOffset, ssb_start_symbol, CC_id); if (get_softmodem_params()->sa == 1) { get_type0_PDCCH_CSS_config_parameters(&gNB->type0_PDCCH_CSS_config[i_ssb], @@ -204,7 +212,7 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP, // if start symbol is in current slot, schedule current SSB, fill VRB map and call get_type0_PDCCH_CSS_config_parameters if ((ssb_start_symbol/14) == rel_slot){ const int prb_offset = offset_pointa >> scs; - schedule_ssb(frameP, slotP, scc, dl_req, i_ssb, ssbSubcarrierOffset, offset_pointa, (*(uint32_t*)cc->MIB_pdu.payload) & ((1<<24)-1)); + schedule_ssb(frameP, slotP, scc, dl_req, i_ssb, ssbSubcarrierOffset, offset_pointa, mib_pdu); fill_ssb_vrb_map(cc, prb_offset, ssbSubcarrierOffset, ssb_start_symbol, CC_id); if (get_softmodem_params()->sa == 1) { get_type0_PDCCH_CSS_config_parameters(&gNB->type0_PDCCH_CSS_config[i_ssb], @@ -234,7 +242,7 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP, // if start symbol is in current slot, schedule current SSB, fill VRB map and call get_type0_PDCCH_CSS_config_parameters if ((ssb_start_symbol/14) == rel_slot){ const int prb_offset = offset_pointa >> (scs-2); // reference 60kHz - schedule_ssb(frameP, slotP, scc, dl_req, i_ssb, ssbSubcarrierOffset, offset_pointa, (*(uint32_t*)cc->MIB_pdu.payload) & ((1<<24)-1)); + schedule_ssb(frameP, slotP, scc, dl_req, i_ssb, ssbSubcarrierOffset, offset_pointa, mib_pdu); fill_ssb_vrb_map(cc, prb_offset, ssbSubcarrierOffset >> (scs - 2), ssb_start_symbol, CC_id); const NR_TDD_UL_DL_Pattern_t *tdd = &scc->tdd_UL_DL_ConfigurationCommon->pattern1; const int n_slots_frame = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index cb907e7af5..82f9f8008f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -50,7 +50,6 @@ void nr_mac_config_scc(gNB_MAC_INST *nrmac, int pusch_AntennaPorts, int sib1_tda, int minRXTXTIMEpdsch); -void nr_mac_config_mib(gNB_MAC_INST *nrmac, NR_BCCH_BCH_Message_t *mib); void nr_mac_config_sib1(gNB_MAC_INST *nrmac, NR_BCCH_DL_SCH_Message_t *sib1); bool nr_mac_add_test_ue(gNB_MAC_INST *nrmac, uint32_t rnti, NR_CellGroupConfig_t *CellGroup); bool nr_mac_prepare_ra_ue(gNB_MAC_INST *nrmac, uint32_t rnti, NR_CellGroupConfig_t *CellGroup); diff --git a/openair2/LAYER2/NR_MAC_gNB/main.c b/openair2/LAYER2/NR_MAC_gNB/main.c index 1d07f39630..17d546c62a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/main.c +++ b/openair2/LAYER2/NR_MAC_gNB/main.c @@ -245,6 +245,7 @@ void mac_top_init_gNB(ngran_node_t node_type, NR_ServingCellConfigCommon_t *scc, RC.nrmac[i]->common_channels[0].pre_ServingCellConfig = scd; RC.nrmac[i]->first_MIB = true; + RC.nrmac[i]->common_channels[0].mib = get_new_MIB_NR(scc); RC.nrmac[i]->cset0_bwp_start = 0; RC.nrmac[i]->cset0_bwp_size = 0; diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index ef35bc0a8e..f73e64b9f8 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -225,7 +225,7 @@ typedef struct { NR_ARFCN_ValueEUTRA_t ul_CarrierFreq; long ul_Bandwidth; /// Outgoing MIB PDU for PHY - MIB_PDU MIB_pdu; + uint8_t MIB_pdu[3]; /// Outgoing BCCH pdu for PHY BCCH_PDU BCCH_pdu; /// Outgoing BCCH DCI allocation diff --git a/openair2/RRC/NR/L2_nr_interface.c b/openair2/RRC/NR/L2_nr_interface.c index 3334842616..14a1838b58 100644 --- a/openair2/RRC/NR/L2_nr_interface.c +++ b/openair2/RRC/NR/L2_nr_interface.c @@ -74,13 +74,7 @@ uint16_t mac_rrc_nr_data_req(const module_id_t Mod_idP, // MIBCH if ((Srb_id & RAB_OFFSET) == MIBCH) { - int encode_size = 3; - rrc_gNB_carrier_data_t *carrier = &RC.nrrrc[Mod_idP]->carrier; - int encoded = encode_MIB_NR(carrier->mib, frameP, buffer_pP, encode_size); - DevAssert(encoded == encode_size); - LOG_D(NR_RRC, "MIB PDU buffer_pP[0]=%x , buffer_pP[1]=%x, buffer_pP[2]=%x\n", buffer_pP[0], buffer_pP[1], - buffer_pP[2]); - return encode_size; + DevAssert(false); } if ((Srb_id & RAB_OFFSET) == BCCH) { diff --git a/openair2/RRC/NR/nr_rrc_defs.h b/openair2/RRC/NR/nr_rrc_defs.h index 055ef88fbe..836f756010 100644 --- a/openair2/RRC/NR/nr_rrc_defs.h +++ b/openair2/RRC/NR/nr_rrc_defs.h @@ -331,7 +331,6 @@ typedef struct { uint8_t *SIB23; uint8_t sizeof_SIB23; - NR_BCCH_BCH_Message_t *mib; NR_SIB1_t *siblock1_DU; NR_SIB1_t *sib1; NR_SIB2_t *sib2; @@ -376,6 +375,7 @@ typedef struct cucp_cuup_if_s { typedef struct nr_rrc_du_container_t { f1ap_setup_req_t *setup_req; + NR_MIB_t *mib; } nr_rrc_du_container_t; //---NR---(completely change)--------------------- diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 455ded6c02..6a86e0cb65 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -237,11 +237,6 @@ static void init_NR_SI(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *configuration { const NR_ServingCellConfigCommon_t *scc = RC.nrmac[0]->common_channels[0].ServingCellConfigCommon; - LOG_D(RRC,"%s()\n\n\n\n",__FUNCTION__); - if (NODE_IS_DU(rrc->node_type) || NODE_IS_MONOLITHIC(rrc->node_type)) { - rrc->carrier.mib = get_new_MIB_NR(scc); - } - if((get_softmodem_params()->sa) && ( (NODE_IS_DU(rrc->node_type) || NODE_IS_MONOLITHIC(rrc->node_type)))) { NR_BCCH_DL_SCH_Message_t *sib1 = get_SIB1_NR(configuration, scc); //xer_fprint(stdout, &asn_DEF_NR_BCCH_DL_SCH_Message, sib1); @@ -270,7 +265,6 @@ static void init_NR_SI(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *configuration rrc->configuration.pusch_AntennaPorts, rrc->configuration.sib1_tda, rrc->configuration.minRXTXTIME); - nr_mac_config_mib(RC.nrmac[rrc->module_id], rrc->carrier.mib); } if (get_softmodem_params()->phy_test > 0 || get_softmodem_params()->do_ra > 0) { @@ -1931,6 +1925,18 @@ static void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *req) return; } + /* do we need the MIB? for the moment, just check it is valid, then drop it */ + NR_BCCH_BCH_Message_t *mib = NULL; + asn_dec_rval_t dec_rval = + uper_decode_complete(NULL, &asn_DEF_NR_BCCH_BCH_Message, (void **)&mib, sys_info->mib, sys_info->mib_length); + if (dec_rval.code != RC_OK || mib->message.present != NR_BCCH_BCH_MessageType_PR_mib + || mib->message.choice.messageClassExtension == NULL) { + LOG_E(RRC, "Failed to decode NR_BCCH_BCH_MESSAGE (%zu bits) of DU, rejecting DU\n", dec_rval.consumed); + rrc->mac_rrc.f1_setup_failure(&fail); + ASN_STRUCT_FREE(asn_DEF_NR_BCCH_BCH_Message, mib); + return; + } + LOG_I(RRC, "Accepting DU %ld (%s), sending F1 Setup Response\n", req->gNB_DU_id, req->gNB_DU_name); // we accept the DU @@ -1943,14 +1949,9 @@ static void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *req) rrc->du->setup_req = malloc(sizeof(*rrc->du->setup_req)); AssertFatal(rrc->du->setup_req != NULL, "out of memory\n"); *rrc->du->setup_req = *req; - - if (rrc->carrier.mib != NULL) { - LOG_E(NR_RRC, "CU MIB is already initialized: double F1 setup request?\n"); - } else { - asn_dec_rval_t dec_rval = - uper_decode_complete(NULL, &asn_DEF_NR_BCCH_BCH_Message, (void **)&rrc->carrier.mib, sys_info->mib, sys_info->mib_length); - AssertFatal(dec_rval.code == RC_OK, "Failed to decode NR_BCCH_BCH_MESSAGE (%zu bits)\n", dec_rval.consumed); - } + rrc->du->mib = mib->message.choice.mib; + mib->message.choice.mib = NULL; + ASN_STRUCT_FREE(asn_DEF_NR_BCCH_BCH_MessageType, mib); if (rrc->carrier.sib1 != NULL) { LOG_E(NR_RRC, "CU SIB1 is already initiaized: double F1 setup request?\n"); From a44a54f3d3fdb89eac467a11fdd2c765254c9b0e Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 21 Jul 2023 18:00:25 +0200 Subject: [PATCH 39/63] Move SIB1 to MAC The SystemInformationBlock 1 is handled at the DU and sent to the CU in the F1 Setup Request. Hence, move it down to the MAC. --- openair2/GNB_APP/gnb_config.c | 25 ++--------- openair2/LAYER2/NR_MAC_gNB/config.c | 12 ------ .../LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 25 ++++++----- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 1 - openair2/LAYER2/NR_MAC_gNB/main.c | 8 ++++ openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 4 +- openair2/RRC/NR/L2_nr_interface.c | 30 -------------- openair2/RRC/NR/nr_rrc_defs.h | 7 +--- openair2/RRC/NR/nr_rrc_proto.h | 8 ---- openair2/RRC/NR/rrc_gNB.c | 41 ++++++++----------- 10 files changed, 44 insertions(+), 117 deletions(-) diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 67784ad8e9..51db286e43 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -2003,32 +2003,13 @@ int RC_config_trigger_F1Setup() sys_info->mib_length = encode_MIB_NR(mac->common_channels[0].mib, 0, sys_info->mib, buf_len); DevAssert(sys_info->mib_length == buf_len); - gNB_RRC_INST *rrc = RC.nrrrc[0]; - DevAssert(rrc); - NR_BCCH_DL_SCH_Message_t *bcch_message = NULL; - asn_codec_ctx_t st = {100 * 1000}; - asn_dec_rval_t dec_rval = uper_decode_complete(&st, - &asn_DEF_NR_BCCH_DL_SCH_Message, - (void **)&bcch_message, - (const void *)rrc->carrier.SIB1, - rrc->carrier.sizeof_SIB1); - - if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { - LOG_E(RRC, "SIB1 decode error\n"); - // free the memory - SEQUENCE_free(&asn_DEF_NR_BCCH_DL_SCH_Message, bcch_message, 1); - exit(1); - } - - NR_SIB1_t *bcch_SIB1 = bcch_message->message.choice.c1->choice.systemInformationBlockType1; - sys_info->sib1 = calloc(1, rrc->carrier.sizeof_SIB1); + DevAssert(mac->common_channels[0].sib1 != NULL); + NR_SIB1_t *bcch_SIB1 = mac->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1; + sys_info->sib1 = calloc(NR_MAX_SIB_LENGTH / 8, sizeof(*sys_info->sib1)); asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_SIB1, NULL, (void *)bcch_SIB1, sys_info->sib1, NR_MAX_SIB_LENGTH / 8); AssertFatal(enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); sys_info->sib1_length = (enc_rval.encoded + 7) / 8; - if (LOG_DEBUGFLAG(DEBUG_ASN1)) - xer_fprint(stdout, &asn_DEF_NR_SIB1, (void *)bcch_message->message.choice.c1->choice.systemInformationBlockType1); - mac->mac_rrc.f1_setup_request(req); mac->f1_config.setup_req = req; diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index b357138da2..988f7b3233 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -560,18 +560,6 @@ void nr_mac_config_scc(gNB_MAC_INST *nrmac, NR_SCHED_UNLOCK(&nrmac->sched_lock); } -void nr_mac_config_sib1(gNB_MAC_INST *nrmac, NR_BCCH_DL_SCH_Message_t *sib1) -{ - DevAssert(nrmac != NULL); - DevAssert(sib1 != NULL); - NR_SCHED_LOCK(&nrmac->sched_lock); - NR_COMMON_channels_t *cc = &nrmac->common_channels[0]; - - AssertFatal(cc->sib1 == NULL, "logic bug: updated SIB1 multiple times\n"); - cc->sib1 = sib1; - NR_SCHED_UNLOCK(&nrmac->sched_lock); -} - bool nr_mac_add_test_ue(gNB_MAC_INST *nrmac, uint32_t rnti, NR_CellGroupConfig_t *CellGroup) { DevAssert(nrmac != NULL); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index 57e8922bf5..8d44a20aa1 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -569,14 +569,6 @@ void schedule_nr_sib1(module_id_t module_idP, LOG_D(NR_MAC,"(%d.%d) SIB1 transmission: ssb_index %d\n", frameP, slotP, type0_PDCCH_CSS_config->ssb_index); - // Get SIB1 - uint8_t sib1_payload[NR_MAX_SIB_LENGTH/8]; - uint16_t sib1_sdu_length = mac_rrc_nr_data_req(module_idP, CC_id, frameP, BCCH, SI_RNTI, 1, sib1_payload); - LOG_D(NR_MAC,"sib1_sdu_length = %i\n", sib1_sdu_length); - LOG_D(NR_MAC,"SIB1: \n"); - for (int k=0;ktype0_pdcch_ss_mux_pattern); // assuming normal CP NR_tda_info_t tda_info = get_info_from_tda_tables(table_type, time_domain_allocation, gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position, true); @@ -588,6 +580,8 @@ void schedule_nr_sib1(module_id_t module_idP, &tda_info, 1); + + NR_COMMON_channels_t *cc = &gNB_mac->common_channels[0]; // Configure sched_ctrlCommon for SIB1 uint32_t TBS = schedule_control_sib1(module_idP, CC_id, type0_PDCCH_CSS_config, @@ -595,7 +589,7 @@ void schedule_nr_sib1(module_id_t module_idP, &dmrs_parms, &tda_info, candidate_idx, - sib1_sdu_length); + cc->sib1_bcch_length); nfapi_nr_dl_tti_request_body_t *dl_req = &DL_req->dl_tti_request_body; int pdu_index = gNB_mac->pdu_index[0]++; @@ -605,7 +599,7 @@ void schedule_nr_sib1(module_id_t module_idP, nfapi_nr_pdu_t *tx_req = &TX_req->pdu_list[ntx_req]; // Data to be transmitted - memcpy(tx_req->TLVs[0].value.direct, sib1_payload, TBS); + memcpy(tx_req->TLVs[0].value.direct, cc->sib1_bcch_pdu, TBS); tx_req->PDU_length = TBS; tx_req->PDU_index = pdu_index; @@ -617,9 +611,14 @@ void schedule_nr_sib1(module_id_t module_idP, type0_PDCCH_CSS_config->active = false; - T(T_GNB_MAC_DL_PDU_WITH_DATA, T_INT(module_idP), T_INT(CC_id), - T_INT(0xffff), T_INT(frameP), T_INT(slotP), T_INT(0 /* harq_pid */), - T_BUFFER(sib1_payload, TBS)); + T(T_GNB_MAC_DL_PDU_WITH_DATA, + T_INT(module_idP), + T_INT(CC_id), + T_INT(0xffff), + T_INT(frameP), + T_INT(slotP), + T_INT(0 /* harq_pid */), + T_BUFFER(cc->sib1_bcch_pdu, cc->sib1_bcch_length)); } } } diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 82f9f8008f..3dd5165c88 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -50,7 +50,6 @@ void nr_mac_config_scc(gNB_MAC_INST *nrmac, int pusch_AntennaPorts, int sib1_tda, int minRXTXTIMEpdsch); -void nr_mac_config_sib1(gNB_MAC_INST *nrmac, NR_BCCH_DL_SCH_Message_t *sib1); bool nr_mac_add_test_ue(gNB_MAC_INST *nrmac, uint32_t rnti, NR_CellGroupConfig_t *CellGroup); bool nr_mac_prepare_ra_ue(gNB_MAC_INST *nrmac, uint32_t rnti, NR_CellGroupConfig_t *CellGroup); bool nr_mac_update_cellgroup(gNB_MAC_INST *nrmac, uint32_t rnti, NR_CellGroupConfig_t *CellGroup); diff --git a/openair2/LAYER2/NR_MAC_gNB/main.c b/openair2/LAYER2/NR_MAC_gNB/main.c index 17d546c62a..1ee92fa5be 100644 --- a/openair2/LAYER2/NR_MAC_gNB/main.c +++ b/openair2/LAYER2/NR_MAC_gNB/main.c @@ -250,6 +250,14 @@ void mac_top_init_gNB(ngran_node_t node_type, NR_ServingCellConfigCommon_t *scc, RC.nrmac[i]->cset0_bwp_start = 0; RC.nrmac[i]->cset0_bwp_size = 0; + /* Temporary: RRC configuration */ + gNB_RrcConfigurationReq conf = { .mcc = {208}, .mnc = {95}, .mnc_digit_length = {2}, .tac = 1, .cell_identity = 3584}; + NR_BCCH_DL_SCH_Message_t *sib1 = get_SIB1_NR(&conf, scc); + NR_COMMON_channels_t *cc = &RC.nrmac[i]->common_channels[0]; + cc->sib1 = sib1; + cc->sib1_bcch_length = encode_SIB1_NR(sib1, cc->sib1_bcch_pdu, sizeof(cc->sib1_bcch_pdu)); + AssertFatal(cc->sib1_bcch_length > 0, "could not encode SIB1\n"); + pthread_mutex_init(&RC.nrmac[i]->sched_lock, NULL); pthread_mutex_init(&RC.nrmac[i]->UE_info.mutex, NULL); diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index f73e64b9f8..1cf4efdcbb 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -71,6 +71,7 @@ #include "NR_BCCH-BCH-Message.h" #include "NR_CellGroupConfig.h" #include "NR_BCCH-DL-SCH-Message.h" +#include "openair2/RRC/NR/nr_rrc_config.h" /* PHY */ #include "time_meas.h" @@ -227,7 +228,8 @@ typedef struct { /// Outgoing MIB PDU for PHY uint8_t MIB_pdu[3]; /// Outgoing BCCH pdu for PHY - BCCH_PDU BCCH_pdu; + uint8_t sib1_bcch_pdu[NR_MAX_SIB_LENGTH / 8]; + int sib1_bcch_length; /// Outgoing BCCH DCI allocation uint32_t BCCH_alloc_pdu; /// Outgoing CCCH pdu for PHY diff --git a/openair2/RRC/NR/L2_nr_interface.c b/openair2/RRC/NR/L2_nr_interface.c index 14a1838b58..a3bc40dc9c 100644 --- a/openair2/RRC/NR/L2_nr_interface.c +++ b/openair2/RRC/NR/L2_nr_interface.c @@ -60,36 +60,6 @@ void nr_rrc_mac_update_cellgroup(rnti_t rntiMaybeUEid, NR_CellGroupConfig_t *cgc NR_SCHED_UNLOCK(&nrmac->sched_lock); } -uint16_t mac_rrc_nr_data_req(const module_id_t Mod_idP, - const int CC_id, - const frame_t frameP, - const rb_id_t Srb_id, - const rnti_t rnti, - const uint8_t Nb_tb, - uint8_t *const buffer_pP) -{ - - LOG_D(RRC,"[eNB %d] mac_rrc_data_req to SRB ID=%ld\n",Mod_idP,Srb_id); - - // MIBCH - if ((Srb_id & RAB_OFFSET) == MIBCH) { - - DevAssert(false); - } - - if ((Srb_id & RAB_OFFSET) == BCCH) { - memcpy(&buffer_pP[0], RC.nrrrc[Mod_idP]->carrier.SIB1, RC.nrrrc[Mod_idP]->carrier.sizeof_SIB1); - return RC.nrrrc[Mod_idP]->carrier.sizeof_SIB1; - } - - // CCCH - if ((Srb_id & RAB_OFFSET) == CCCH) { - AssertFatal(0, "CCCH is managed by rlc of srb 0, not anymore by mac_rrc_nr_data_req\n"); - } - - return 0; -} - int8_t nr_mac_rrc_bwp_switch_req(const module_id_t module_idP, const frame_t frameP, const sub_frame_t sub_frameP, diff --git a/openair2/RRC/NR/nr_rrc_defs.h b/openair2/RRC/NR/nr_rrc_defs.h index 836f756010..29ad2ccd35 100644 --- a/openair2/RRC/NR/nr_rrc_defs.h +++ b/openair2/RRC/NR/nr_rrc_defs.h @@ -325,18 +325,12 @@ typedef struct rrc_gNB_ue_context_s { typedef struct { - uint8_t *SIB1; - uint16_t sizeof_SIB1; - uint8_t *SIB23; uint8_t sizeof_SIB23; - NR_SIB1_t *siblock1_DU; - NR_SIB1_t *sib1; NR_SIB2_t *sib2; NR_SIB3_t *sib3; NR_BCCH_DL_SCH_Message_t systemInformation; // SIB23 - NR_BCCH_DL_SCH_Message_t *siblock1; NR_CellGroupConfig_t *secondaryCellGroup[MAX_NR_RRC_UE_CONTEXTS]; } rrc_gNB_carrier_data_t; @@ -376,6 +370,7 @@ typedef struct cucp_cuup_if_s { typedef struct nr_rrc_du_container_t { f1ap_setup_req_t *setup_req; NR_MIB_t *mib; + NR_SIB1_t *sib1; } nr_rrc_du_container_t; //---NR---(completely change)--------------------- diff --git a/openair2/RRC/NR/nr_rrc_proto.h b/openair2/RRC/NR/nr_rrc_proto.h index 7502662da3..317a4976e8 100644 --- a/openair2/RRC/NR/nr_rrc_proto.h +++ b/openair2/RRC/NR/nr_rrc_proto.h @@ -46,14 +46,6 @@ #define NR_MAX_SUPPORTED_DL_LAYERS 2 -uint16_t mac_rrc_nr_data_req(const module_id_t Mod_idP, - const int CC_id, - const frame_t frameP, - const rb_id_t Srb_id, - const rnti_t rnti, - const uint8_t Nb_tb, - uint8_t *const buffer_pP); - void rrc_gNB_process_SgNBAdditionRequest( const protocol_ctxt_t *const ctxt_pP, rrc_gNB_ue_context_t *ue_context_pP diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 6a86e0cb65..456c7c7c01 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -235,18 +235,6 @@ static int get_dl_arfcn(const f1ap_served_cell_info_t *cell_info) static void init_NR_SI(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *configuration) { - const NR_ServingCellConfigCommon_t *scc = RC.nrmac[0]->common_channels[0].ServingCellConfigCommon; - - if((get_softmodem_params()->sa) && ( (NODE_IS_DU(rrc->node_type) || NODE_IS_MONOLITHIC(rrc->node_type)))) { - NR_BCCH_DL_SCH_Message_t *sib1 = get_SIB1_NR(configuration, scc); - //xer_fprint(stdout, &asn_DEF_NR_BCCH_DL_SCH_Message, sib1); - rrc->carrier.SIB1 = calloc(NR_MAX_SIB_LENGTH / 8, sizeof(*rrc->carrier.SIB1)); - AssertFatal(rrc->carrier.SIB1 != NULL, "out of memory\n"); - rrc->carrier.sizeof_SIB1 = encode_SIB1_NR(sib1, rrc->carrier.SIB1, NR_MAX_SIB_LENGTH / 8); - rrc->carrier.siblock1 = sib1; - nr_mac_config_sib1(RC.nrmac[rrc->module_id], sib1); - } - if (!NODE_IS_DU(rrc->node_type)) { rrc->carrier.SIB23 = (uint8_t *) malloc16(100); AssertFatal(rrc->carrier.SIB23 != NULL, "cannot allocate memory for SIB"); @@ -1937,6 +1925,19 @@ static void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *req) return; } + NR_SIB1_t *sib1 = NULL; + if (sys_info->sib1) { + dec_rval = uper_decode_complete(NULL, &asn_DEF_NR_SIB1, (void **)&sib1, sys_info->sib1, sys_info->sib1_length); + if (dec_rval.code != RC_OK) { + LOG_E(RRC, "Failed to decode NR_SIB1 (%zu bits) of DU, rejecting DU\n", dec_rval.consumed); + rrc->mac_rrc.f1_setup_failure(&fail); + ASN_STRUCT_FREE(asn_DEF_NR_SIB1, sib1); + return; + } + if (LOG_DEBUGFLAG(DEBUG_ASN1)) + xer_fprint(stdout, &asn_DEF_NR_SIB1, sib1); + } + LOG_I(RRC, "Accepting DU %ld (%s), sending F1 Setup Response\n", req->gNB_DU_id, req->gNB_DU_name); // we accept the DU @@ -1952,17 +1953,7 @@ static void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *req) rrc->du->mib = mib->message.choice.mib; mib->message.choice.mib = NULL; ASN_STRUCT_FREE(asn_DEF_NR_BCCH_BCH_MessageType, mib); - - if (rrc->carrier.sib1 != NULL) { - LOG_E(NR_RRC, "CU SIB1 is already initiaized: double F1 setup request?\n"); - } else { - asn_dec_rval_t dec_rval = - uper_decode_complete(NULL, &asn_DEF_NR_SIB1, (void **)&rrc->carrier.sib1, sys_info->sib1, sys_info->sib1_length); - AssertFatal(dec_rval.code == RC_OK, "Failed to decode NR_BCCH_DLSCH_MESSAGE (%zu bits)\n", dec_rval.consumed); - - if (LOG_DEBUGFLAG(DEBUG_ASN1)) - xer_fprint(stdout, &asn_DEF_NR_SIB1, (void *)rrc->carrier.sib1); - } + rrc->du->sib1 = sib1; served_cells_to_activate_t cell = { .plmn = cell_info->plmn, @@ -2894,7 +2885,9 @@ int rrc_gNB_generate_pcch_msg(uint32_t tmsi, uint8_t paging_drx, instance_t inst uint32_t T; /* DRX cycle */ uint32_t length; uint8_t buffer[RRC_BUF_SIZE]; - struct NR_SIB1 *sib1 = RC.nrrrc[instance]->carrier.siblock1->message.choice.c1->choice.systemInformationBlockType1; + const nr_rrc_du_container_t *du = RC.nrrrc[0]->du; + DevAssert(du != NULL); + struct NR_SIB1 *sib1 = du->sib1; /* get default DRX cycle from configuration */ Tc = sib1->servingCellConfigCommon->downlinkConfigCommon.pcch_Config.defaultPagingCycle; From eaf28414ca138660a0375d1c0763f2beaeb7a2b1 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 13 Sep 2023 17:45:04 +0200 Subject: [PATCH 40/63] kssb < 16 or we cannot do reestablishment: add assert in DU --- ci-scripts/conf_files/gnb.sa.band78.51prb.usrpb200.conf | 2 +- openair2/LAYER2/NR_MAC_gNB/config.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ci-scripts/conf_files/gnb.sa.band78.51prb.usrpb200.conf b/ci-scripts/conf_files/gnb.sa.band78.51prb.usrpb200.conf index 405fb552c4..75dde393e9 100644 --- a/ci-scripts/conf_files/gnb.sa.band78.51prb.usrpb200.conf +++ b/ci-scripts/conf_files/gnb.sa.band78.51prb.usrpb200.conf @@ -30,7 +30,7 @@ gNBs = absoluteFrequencySSB = 620736; dl_frequencyBand = 78; # this is 3300.30 MHz - dl_absoluteFrequencyPointA = 620020; + dl_absoluteFrequencyPointA = 620052; #scs-SpecificCarrierList dl_offstToCarrier = 0; # subcarrierSpacing diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 988f7b3233..8d6f1d27fa 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -332,6 +332,12 @@ static void config_common(gNB_MAC_INST *nrmac, int pdsch_AntennaPorts, int pusch cfg->ssb_table.ssb_subcarrier_offset.value = get_ssb_subcarrier_offset(*scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB, scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA); + AssertFatal(cfg->ssb_table.ssb_subcarrier_offset.value < 16, + "cannot handle ssb_subcarrier_offset %d resulting from Point A %ld SSB %ld: please increase dl_absoluteFrequencyPointA " + "in the config by 16\n", + cfg->ssb_table.ssb_subcarrier_offset.value, + scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA, + *scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB); cfg->ssb_table.ssb_subcarrier_offset.tl.tag = NFAPI_NR_CONFIG_SSB_SUBCARRIER_OFFSET_TAG; cfg->num_tlv++; From a62857a74df4bab22b550268220a3aeb4db91dca Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 12 Sep 2023 15:06:09 +0200 Subject: [PATCH 41/63] Compute SSB ARFCN to repair reestablishment --- openair2/RRC/NR/rrc_gNB.c | 54 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 50 insertions(+), 4 deletions(-) diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 456c7c7c01..bcf26c0e16 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -230,6 +230,51 @@ static int get_dl_arfcn(const f1ap_served_cell_info_t *cell_info) return cell_info->mode == F1AP_MODE_TDD ? cell_info->tdd.freqinfo.arfcn : cell_info->fdd.dl_freqinfo.arfcn; } +static int get_dl_bw(const f1ap_served_cell_info_t *cell_info) +{ + return cell_info->mode == F1AP_MODE_TDD ? cell_info->tdd.tbw.nrb : cell_info->fdd.dl_tbw.nrb; +} + +static int get_ssb_arfcn(const f1ap_served_cell_info_t *cell_info, const NR_MIB_t *mib, const NR_SIB1_t *sib1) +{ + DevAssert(cell_info != NULL && sib1 != NULL && mib != NULL); + const NR_FrequencyInfoDL_SIB_t* freq_info = &sib1->servingCellConfigCommon->downlinkConfigCommon.frequencyInfoDL; + AssertFatal(freq_info->scs_SpecificCarrierList.list.count == 1, "cannot handle more than one carrier, but has %d\n", freq_info->scs_SpecificCarrierList.list.count); + AssertFatal(freq_info->scs_SpecificCarrierList.list.array[0]->offsetToCarrier == 0, "cannot handle offsetToCarrier != 0, but is %ld\n", freq_info->scs_SpecificCarrierList.list.array[0]->offsetToCarrier); + + long offsetToPointA = freq_info->offsetToPointA; + long kssb = mib->ssb_SubcarrierOffset; + uint32_t dl_arfcn = get_dl_arfcn(cell_info); + int scs = get_ssb_scs(cell_info); + int band = get_dl_band(cell_info); + uint64_t scaling = band < 100 ? 1 : 3; + + uint64_t freqpointa = from_nrarfcn(band, scs, dl_arfcn); + // offsetToPointA and kSSB are both on 15kHz SCS (see 38.211 sections 7.4.3.1 + // and 4.4.4.2) + // SSB uses the SCS of the cell and is 20 RBs wide, so use 10 + uint64_t freqssb = freqpointa + scaling * 15000 * (offsetToPointA * 12 + kssb) + 10ll * 12 * (1 << scs) * 15000; + int bw_index = get_supported_band_index(scs, band, get_dl_bw(cell_info)); + int band_size_hz = get_supported_bw_mhz(band > 256 ? FR2 : FR1, bw_index) * 1000 * 1000; + uint32_t ssb_arfcn = to_nrarfcn(band, freqssb, scs, band_size_hz); + + LOG_W(RRC, "freqpointa %ld Hz/%d offsetToPointA %ld kssb %ld scs %d band %d band_size_hz %d freqssb %ld Hz/%d\n", freqpointa, dl_arfcn, offsetToPointA, kssb, scs, band, band_size_hz, freqssb, ssb_arfcn); + + if (RC.nrmac) { + // debugging: let's test this is the correct ARFCN + // in the CU, we have no access to the SSB ARFCN and therefore need to + // compute it ourselves. If we are running in monolithic, though, we have + // access to the MAC structures and hence can read and compare to the + // original SSB ARFCN. If the below creates problems, it can safely be + // taken out (but the reestablishment will likely not work). + const NR_ServingCellConfigCommon_t *scc = RC.nrmac[0]->common_channels[0].ServingCellConfigCommon; + uint32_t scc_ssb_arfcn = *scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencySSB; + AssertFatal(ssb_arfcn == scc_ssb_arfcn, "fuck: SCC SSB ARFCN original %d vs. computed %d\n", scc_ssb_arfcn, ssb_arfcn); + } + + return ssb_arfcn; +} + ///---------------------------------------------------------------------------------------------------------------/// ///---------------------------------------------------------------------------------------------------------------/// @@ -1036,7 +1081,7 @@ static void rrc_gNB_process_RRCReconfigurationComplete(const protocol_ctxt_t *co static void rrc_gNB_generate_RRCReestablishment(rrc_gNB_ue_context_t *ue_context_pP, const uint8_t *masterCellGroup_from_DU, const rnti_t old_rnti, - const f1ap_served_cell_info_t *cell_info) + const nr_rrc_du_container_t *du) //----------------------------------------------------------------------------- { module_id_t module_id = 0; @@ -1048,8 +1093,9 @@ static void rrc_gNB_generate_RRCReestablishment(rrc_gNB_ue_context_t *ue_context uint8_t xid = rrc_gNB_get_next_transaction_identifier(module_id); ue_p->xids[xid] = RRC_REESTABLISH; NR_SRB_ToAddModList_t *SRBs = createSRBlist(ue_p, true); - uint32_t arfcn = get_dl_arfcn(cell_info); - int size = do_RRCReestablishment(ue_context_pP, buffer, RRC_BUF_SIZE, xid, cell_info->nr_pci, arfcn); + const f1ap_served_cell_info_t *cell_info = &du->setup_req->cell[0].info; + uint32_t ssb_arfcn = get_ssb_arfcn(cell_info, du->mib, du->sib1); + int size = do_RRCReestablishment(ue_context_pP, buffer, RRC_BUF_SIZE, xid, cell_info->nr_pci, ssb_arfcn); LOG_I(NR_RRC, "[RAPROC] UE %04x Logical Channel DL-DCCH, Generating NR_RRCReestablishment (bytes %d)\n", ue_p->rnti, size); @@ -1426,7 +1472,7 @@ static int nr_rrc_gNB_decode_ccch(module_id_t module_id, const f1ap_initial_ul_r rrc_gNB_generate_RRCReestablishment(ue_context_p, msg->du2cu_rrc_container, old_rnti, - cell_info); + du); } break; case NR_UL_CCCH_MessageType__c1_PR_rrcSystemInfoRequest: From 67d5f56a3cac9e8067793787437d68eb2a86e08f Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 27 Jul 2023 10:38:52 +0200 Subject: [PATCH 42/63] Read F1 Setup Req at MAC initialization Previously, filling of F1 Setup Request depended on reading the RRC; hence, for timing reasons, we only initialized and sent the F1 Setup Request once the MAC and RRC are ready. After moving SCC, SCD, MIB, and SIB1 to MAC, the MAC does not depend on an RRC being present anymore, and hence, the F1 Setup Request does neither. In this commit, we read the F1 Setup Request after initializing the MAC. --- openair2/GNB_APP/gnb_app.c | 5 ++++- openair2/GNB_APP/gnb_config.c | 30 +++++++++++++++----------- openair2/GNB_APP/gnb_config.h | 1 - openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 1 + openair2/LAYER2/NR_MAC_gNB/main.c | 7 ++++++ 5 files changed, 29 insertions(+), 15 deletions(-) diff --git a/openair2/GNB_APP/gnb_app.c b/openair2/GNB_APP/gnb_app.c index 18ca27db58..cd701f01f5 100644 --- a/openair2/GNB_APP/gnb_app.c +++ b/openair2/GNB_APP/gnb_app.c @@ -52,6 +52,8 @@ #include "openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h" #include "openair2/E1AP/e1ap.h" #include "gnb_config.h" +#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h" + extern unsigned char NB_gNB_INST; extern RAN_CONTEXT_t RC; @@ -162,7 +164,8 @@ void *gNB_app_task(void *args_p) } } if (NODE_IS_DU(node_type) || NODE_IS_MONOLITHIC(node_type)) { - RC_config_trigger_F1Setup(); + // need to check SA? + nr_mac_send_f1_setup_req(); } } do { diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 51db286e43..c8869d6113 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -949,6 +949,8 @@ static NR_ServingCellConfig_t *get_scd_config(void) // temporary minRXTXTIME, to be taken out once all radio config is read at DU static int minRXTXTIME = 6; +static f1ap_setup_req_t *RC_read_F1Setup(const NR_ServingCellConfigCommon_t *scc, NR_BCCH_BCH_Message_t *mib, const NR_BCCH_DL_SCH_Message_t *sib1); + void RCconfig_nr_macrlc() { int j = 0; uint16_t prbbl[275] = {0}; @@ -1073,6 +1075,15 @@ void RCconfig_nr_macrlc() { RC.nrmac[j]->num_ulprbbl = num_prbbl; memcpy(RC.nrmac[j]->ulprbbl, prbbl, 275 * sizeof(prbbl[0])); } // for (j=0;jcommon_channels[0].mib; + const NR_BCCH_DL_SCH_Message_t *sib1 = RC.nrmac[0]->common_channels[0].sib1; + f1ap_setup_req_t *req = RC_read_F1Setup(scc, mib, sib1); + AssertFatal(req != NULL, "could not read F1 Setup information\n"); + RC.nrmac[0]->f1_config.setup_req = req; + } else { // MacRLC_ParamList.numelt > 0 LOG_E(PHY, "No %s configuration found\n", CONFIG_STRING_MACRLC_LIST); // AssertFatal (0,"No " CONFIG_STRING_MACRLC_LIST " configuration found"); @@ -1905,7 +1916,7 @@ int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i) { } -int RC_config_trigger_F1Setup() +static f1ap_setup_req_t *RC_read_F1Setup(const NR_ServingCellConfigCommon_t *scc, NR_BCCH_BCH_Message_t *mib, const NR_BCCH_DL_SCH_Message_t *sib1) { paramdef_t GNBSParams[] = GNBSPARAMS_DESC; paramdef_t GNBParams[] = GNBPARAMS_DESC; @@ -1961,10 +1972,6 @@ int RC_config_trigger_F1Setup() req->cell[0].info.nr_cellid); - gNB_MAC_INST *mac = RC.nrmac[0]; - DevAssert(mac); - const NR_ServingCellConfigCommon_t *scc = mac->common_channels[0].ServingCellConfigCommon; - DevAssert(scc != NULL); req->cell[0].info.nr_pci = *scc->physCellId; LOG_W(GNB_APP, "no slices transported via F1 Setup Request!\n"); req->cell[0].info.num_ssi = 0; @@ -1993,27 +2000,24 @@ int RC_config_trigger_F1Setup() req->cell[0].info.measurement_timing_information = "0"; - DevAssert(mac->common_channels[0].mib != NULL); int buf_len = 3; // this is what we assume in monolithic req->cell[0].sys_info = calloc(1, sizeof(*req->cell[0].sys_info)); AssertFatal(req->cell[0].sys_info != NULL, "out of memory\n"); f1ap_gnb_du_system_info_t *sys_info = req->cell[0].sys_info; sys_info->mib = calloc(buf_len, sizeof(*sys_info->mib)); DevAssert(sys_info->mib != NULL); - sys_info->mib_length = encode_MIB_NR(mac->common_channels[0].mib, 0, sys_info->mib, buf_len); + DevAssert(mib != NULL); + sys_info->mib_length = encode_MIB_NR(mib, 0, sys_info->mib, buf_len); DevAssert(sys_info->mib_length == buf_len); - DevAssert(mac->common_channels[0].sib1 != NULL); - NR_SIB1_t *bcch_SIB1 = mac->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1; + DevAssert(sib1 != NULL); + NR_SIB1_t *bcch_SIB1 = sib1->message.choice.c1->choice.systemInformationBlockType1; sys_info->sib1 = calloc(NR_MAX_SIB_LENGTH / 8, sizeof(*sys_info->sib1)); asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_SIB1, NULL, (void *)bcch_SIB1, sys_info->sib1, NR_MAX_SIB_LENGTH / 8); AssertFatal(enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); sys_info->sib1_length = (enc_rval.encoded + 7) / 8; - mac->mac_rrc.f1_setup_request(req); - mac->f1_config.setup_req = req; - - return 0; + return req; } void wait_f1_setup_response(void) diff --git a/openair2/GNB_APP/gnb_config.h b/openair2/GNB_APP/gnb_config.h index 55bc913d0f..0999fb2d3c 100644 --- a/openair2/GNB_APP/gnb_config.h +++ b/openair2/GNB_APP/gnb_config.h @@ -103,7 +103,6 @@ extern void NRRCConfig(void); void RCconfig_NRRRC(gNB_RRC_INST *rrc); int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i); int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i); -int RC_config_trigger_F1Setup(void); void wait_f1_setup_response(void); int gNB_app_handle_f1ap_gnb_cu_configuration_update(f1ap_gnb_cu_configuration_update_t *gnb_cu_cfg_update); MessageDef *RCconfig_NR_CU_E1(bool separate_CUUP_process); diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 3dd5165c88..28900454bd 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -39,6 +39,7 @@ void set_cset_offset(uint16_t); void mac_top_init_gNB(ngran_node_t node_type, NR_ServingCellConfigCommon_t *scc, NR_ServingCellConfig_t *scd); +void nr_mac_send_f1_setup_req(void); int nr_mac_enable_ue_rrc_processing_timer(module_id_t Mod_idP, rnti_t rnti, diff --git a/openair2/LAYER2/NR_MAC_gNB/main.c b/openair2/LAYER2/NR_MAC_gNB/main.c index 1ee92fa5be..c034d30a31 100644 --- a/openair2/LAYER2/NR_MAC_gNB/main.c +++ b/openair2/LAYER2/NR_MAC_gNB/main.c @@ -320,3 +320,10 @@ void mac_top_init_gNB(ngran_node_t node_type, NR_ServingCellConfigCommon_t *scc, srand48(0); } + +void nr_mac_send_f1_setup_req(void) +{ + gNB_MAC_INST *mac = RC.nrmac[0]; + DevAssert(mac); + mac->mac_rrc.f1_setup_request(mac->f1_config.setup_req); +} From c930563929985b6069d8109907f09e227936199d Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 17 Aug 2023 08:59:30 +0200 Subject: [PATCH 43/63] Move radio configuration parameters to MAC, SIB1 not initialized! !SIB1 is not correctly filled! This commit does not work with COTS UEs! The next commit fixes this. - Move radio config (e.g., minRXTXTIME, SIB1 TDA, do_SRS, etc) down to MAC. - Some parameters in MAC are redundant: delete them. - Remove call to nr_mac_config_scc() from RRC and simulators, the MAC initialization routine calls it implicitly --- openair1/SIMULATION/NR_PHY/dlsim.c | 34 ++++----- openair1/SIMULATION/NR_PHY/ulsim.c | 26 +++---- openair2/COMMON/rrc_messages_types.h | 16 +--- openair2/GNB_APP/gnb_config.c | 75 +++++++++++-------- openair2/LAYER2/NR_MAC_gNB/config.c | 25 ++----- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 2 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 2 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 3 +- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 6 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 2 +- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 11 ++- openair2/LAYER2/NR_MAC_gNB/main.c | 14 +++- openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 26 +++++-- openair2/RRC/NR/MESSAGES/asn1_msg.c | 7 +- openair2/RRC/NR/MESSAGES/asn1_msg.h | 5 +- openair2/RRC/NR/nr_rrc_config.c | 31 ++++---- openair2/RRC/NR/nr_rrc_config.h | 12 ++- openair2/RRC/NR/nr_rrc_proto.h | 1 - openair2/RRC/NR/rrc_gNB.c | 24 +----- openair2/RRC/NR/rrc_gNB_nsa.c | 4 +- openair2/RRC/NR/rrc_gNB_reconfig.c | 1 - 21 files changed, 155 insertions(+), 172 deletions(-) diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 47659eb039..15ef948c62 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -239,7 +239,7 @@ nrUE_params_t *get_nrUE_params(void) { } -void validate_input_pmi(rrc_pdsch_AntennaPorts_t pdsch_AntennaPorts, int nrOfLayers, int pmi) +void validate_input_pmi(nr_pdsch_AntennaPorts_t pdsch_AntennaPorts, int nrOfLayers, int pmi) { if (pmi == 0) return; @@ -622,17 +622,32 @@ int main(int argc, char **argv) frame_parms->N_RB_DL = N_RB_DL; frame_parms->N_RB_UL = N_RB_DL; + AssertFatal((gNB->if_inst = NR_IF_Module_init(0)) != NULL, "Cannot register interface"); + gNB->if_inst->NR_PHY_config_req = nr_phy_config_request; + NR_ServingCellConfigCommon_t *scc = calloc(1,sizeof(*scc));; prepare_scc(scc); uint64_t ssb_bitmap = 1; // Enable only first SSB with index ssb_indx=0 fill_scc_sim(scc, &ssb_bitmap, N_RB_DL, N_RB_DL, mu, mu); fix_scc(scc, ssb_bitmap); + // TODO do a UECAP for phy-sim + nr_pdsch_AntennaPorts_t pdsch_AntennaPorts = {0}; + pdsch_AntennaPorts.N1 = n_tx > 1 ? n_tx >> 1 : 1; + pdsch_AntennaPorts.N2 = 1; + pdsch_AntennaPorts.XP = n_tx > 1 ? 2 : 1; + const nr_mac_config_t conf = {.pdsch_AntennaPorts = pdsch_AntennaPorts, + .pusch_AntennaPorts = n_tx, + .minRXTXTIME = 6, + .do_CSIRS = 0, + .do_SRS = 0, + .force_256qam_off = false}; + RC.nb_nr_macrlc_inst = 1; RC.nb_nr_mac_CC = (int*)malloc(RC.nb_nr_macrlc_inst*sizeof(int)); for (i = 0; i < RC.nb_nr_macrlc_inst; i++) RC.nb_nr_mac_CC[i] = 1; - mac_top_init_gNB(ngran_gNB, scc, NULL); + mac_top_init_gNB(ngran_gNB, scc, NULL, &conf); gNB_mac = RC.nrmac[0]; gNB_mac->dl_bler.harq_round_max = num_rounds; @@ -682,10 +697,6 @@ int main(int argc, char **argv) NR_ServingCellConfig_t *scd = calloc(1,sizeof(*scd)); prepare_scd(scd); - rrc_pdsch_AntennaPorts_t pdsch_AntennaPorts = {0}; - pdsch_AntennaPorts.N1 = n_tx>1 ? n_tx>>1 : 1; - pdsch_AntennaPorts.N2 = 1; - pdsch_AntennaPorts.XP = n_tx>1 ? 2 : 1; gNB->ap_N1 = pdsch_AntennaPorts.N1; gNB->ap_N2 = pdsch_AntennaPorts.N2; gNB->ap_XP = pdsch_AntennaPorts.XP; @@ -696,12 +707,6 @@ int main(int argc, char **argv) prepare_sim_uecap(UE_Capability_nr,scc,mu, N_RB_DL,g_mcsTableIdx,0); - // TODO do a UECAP for phy-sim - const gNB_RrcConfigurationReq conf = {.pdsch_AntennaPorts = pdsch_AntennaPorts, - .minRXTXTIME = 6, - .do_CSIRS = 0, - .do_SRS = 0, - .force_256qam_off = false}; NR_CellGroupConfig_t *secondaryCellGroup = get_default_secondaryCellGroup(scc, scd, UE_Capability_nr, 0, 1, &conf, 0); /* RRC parameter validation for secondaryCellGroup */ @@ -719,11 +724,6 @@ int main(int argc, char **argv) //xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void*)secondaryCellGroup); - AssertFatal((gNB->if_inst = NR_IF_Module_init(0))!=NULL,"Cannot register interface"); - gNB->if_inst->NR_PHY_config_req = nr_phy_config_request; - - // common configuration - nr_mac_config_scc(RC.nrmac[0], pdsch_AntennaPorts, n_tx, 0, 6); // UE dedicated configuration nr_mac_add_test_ue(RC.nrmac[0], secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity, secondaryCellGroup); // reset preprocessor to the one of DLSIM after it has been set during diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index bf65be3fa2..a8c02998ee 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -608,6 +608,9 @@ int main(int argc, char *argv[]) frame_parms->N_RB_UL = N_RB_UL; frame_parms->Ncp = extended_prefix_flag ? EXTENDED : NORMAL; + AssertFatal((gNB->if_inst = NR_IF_Module_init(0)) != NULL, "Cannot register interface"); + gNB->if_inst->NR_PHY_config_req = nr_phy_config_request; + s_re = malloc(n_tx*sizeof(double*)); s_im = malloc(n_tx*sizeof(double*)); r_re = malloc(n_rx*sizeof(double*)); @@ -619,11 +622,19 @@ int main(int argc, char *argv[]) fill_scc_sim(scc, &ssb_bitmap, N_RB_DL, N_RB_DL, mu, mu); fix_scc(scc,ssb_bitmap); + // TODO do a UECAP for phy-sim + const nr_mac_config_t conf = {.pdsch_AntennaPorts = {.N1 = 1, .N2 = 1, .XP = 1}, + .pusch_AntennaPorts = n_rx, + .minRXTXTIME = 0, + .do_CSIRS = 0, + .do_SRS = 0, + .force_256qam_off = false}; + RC.nb_nr_macrlc_inst = 1; RC.nb_nr_mac_CC = (int*)malloc(RC.nb_nr_macrlc_inst*sizeof(int)); for (i = 0; i < RC.nb_nr_macrlc_inst; i++) RC.nb_nr_mac_CC[i] = 1; - mac_top_init_gNB(ngran_gNB, scc, NULL /* scd will be updated further below */); + mac_top_init_gNB(ngran_gNB, scc, NULL /* scd will be updated further below */, &conf); NR_ServingCellConfig_t *scd = calloc(1,sizeof(NR_ServingCellConfig_t)); prepare_scd(scd); @@ -632,14 +643,6 @@ int main(int argc, char *argv[]) prepare_sim_uecap(UE_Capability_nr,scc,mu, N_RB_UL,0,mcs_table); - // TODO do a UECAP for phy-sim - const gNB_RrcConfigurationReq conf = {.pdsch_AntennaPorts = {.N1 = 1, .N2 = 1, .XP = 1}, - .pusch_AntennaPorts = n_rx, - .minRXTXTIME = 0, - .do_CSIRS = 0, - .do_SRS = 0, - .force_256qam_off = false}; - NR_CellGroupConfig_t *secondaryCellGroup = get_default_secondaryCellGroup(scc, scd, UE_Capability_nr, 0, 1, &conf, 0); /* RRC parameter validation for secondaryCellGroup */ @@ -647,11 +650,6 @@ int main(int argc, char *argv[]) NR_BCCH_BCH_Message_t *mib = get_new_MIB_NR(scc); - AssertFatal((gNB->if_inst = NR_IF_Module_init(0))!=NULL,"Cannot register interface"); - - gNB->if_inst->NR_PHY_config_req = nr_phy_config_request; - // common configuration - nr_mac_config_scc(RC.nrmac[0], conf.pdsch_AntennaPorts, n_tx, 0, 6); // UE dedicated configuration nr_mac_add_test_ue(RC.nrmac[0], secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity, secondaryCellGroup); frame_parms->nb_antennas_tx = 1; diff --git a/openair2/COMMON/rrc_messages_types.h b/openair2/COMMON/rrc_messages_types.h index 2e592b88cc..465c6c5342 100644 --- a/openair2/COMMON/rrc_messages_types.h +++ b/openair2/COMMON/rrc_messages_types.h @@ -401,12 +401,6 @@ typedef struct NbIoTRrcConfigurationReq_s { long ue_TimersAndConstants_n311_NB; } NbIoTRrcConfigurationReq; -typedef struct { - int N1; - int N2; - int XP; -} rrc_pdsch_AntennaPorts_t; - // gNB: GNB_APP -> RRC messages typedef struct NRRrcConfigurationReq_s { uint64_t cell_identity; @@ -415,15 +409,7 @@ typedef struct NRRrcConfigurationReq_s { uint16_t mnc[PLMN_LIST_MAX_SIZE]; uint8_t mnc_digit_length[PLMN_LIST_MAX_SIZE]; uint8_t num_plmn; - int sib1_tda; - rrc_pdsch_AntennaPorts_t pdsch_AntennaPorts; - int pusch_AntennaPorts; - int minRXTXTIME; - int do_CSIRS; - int do_SRS; - bool force_256qam_off; - int pusch_TargetSNRx10; - int pucch_TargetSNRx10; + bool enable_sdap; int drbs; } gNB_RrcConfigurationReq; diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index c8869d6113..4134d03ca2 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -947,26 +947,27 @@ static NR_ServingCellConfig_t *get_scd_config(void) return scd; } -// temporary minRXTXTIME, to be taken out once all radio config is read at DU -static int minRXTXTIME = 6; static f1ap_setup_req_t *RC_read_F1Setup(const NR_ServingCellConfigCommon_t *scc, NR_BCCH_BCH_Message_t *mib, const NR_BCCH_DL_SCH_Message_t *sib1); void RCconfig_nr_macrlc() { int j = 0; uint16_t prbbl[275] = {0}; int num_prbbl = 0; + + paramlist_def_t GNBParamList = {GNB_CONFIG_STRING_GNB_LIST, NULL, 0}; + paramdef_t GNBSParams[] = GNBSPARAMS_DESC; + config_get(GNBSParams, sizeof(GNBSParams) / sizeof(paramdef_t), NULL); + int num_gnbs = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt; + AssertFatal(num_gnbs == 1, + "Failed to parse config file: number of gnbs for gNB %s is %d != 1\n", + GNB_CONFIG_STRING_ACTIVE_GNBS, + num_gnbs); + paramdef_t GNBParams[] = GNBPARAMS_DESC; + config_getlist(&GNBParamList, GNBParams, sizeof(GNBParams) / sizeof(paramdef_t), NULL); + if (NFAPI_MODE != NFAPI_MODE_PNF) { - paramdef_t GNBSParams[] = GNBSPARAMS_DESC; ////////// Identification parameters - paramdef_t GNBParams[] = GNBPARAMS_DESC; - paramlist_def_t GNBParamList = {GNB_CONFIG_STRING_GNB_LIST, NULL, 0}; - - config_get(GNBSParams, sizeof(GNBSParams) / sizeof(paramdef_t), NULL); - int num_gnbs = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt; - AssertFatal(num_gnbs > 0, "Failed to parse config file no gnbs %s \n", GNB_CONFIG_STRING_ACTIVE_GNBS); - - config_getlist(&GNBParamList, GNBParams, sizeof(GNBParams) / sizeof(paramdef_t), NULL); char *ulprbbl = *GNBParamList.paramarray[0][GNB_ULPRBBLACKLIST_IDX].strptr; char *save = NULL; char *pt = strtok_r(ulprbbl, ",", &save); @@ -987,14 +988,41 @@ void RCconfig_nr_macrlc() { MacRLC_Params[i].chkPptr = &(config_check_MacRLCParams[i]); config_getlist(&MacRLC_ParamList, MacRLC_Params, sizeof(MacRLC_Params) / sizeof(paramdef_t), NULL); - NR_ServingCellConfigCommon_t *scc = get_scc_config(minRXTXTIME); + nr_mac_config_t config = {0}; + config.pdsch_AntennaPorts.N1 = *GNBParamList.paramarray[0][GNB_PDSCH_ANTENNAPORTS_N1_IDX].iptr; + config.pdsch_AntennaPorts.N2 = *GNBParamList.paramarray[0][GNB_PDSCH_ANTENNAPORTS_N2_IDX].iptr; + config.pdsch_AntennaPorts.XP = *GNBParamList.paramarray[0][GNB_PDSCH_ANTENNAPORTS_XP_IDX].iptr; + config.pusch_AntennaPorts = *GNBParamList.paramarray[0][GNB_PUSCH_ANTENNAPORTS_IDX].iptr; + LOG_I(GNB_APP, + "pdsch_AntennaPorts N1 %d N2 %d XP %d pusch_AntennaPorts %d\n", + config.pdsch_AntennaPorts.N1, + config.pdsch_AntennaPorts.N2, + config.pdsch_AntennaPorts.XP, + config.pusch_AntennaPorts); + + config.minRXTXTIME = *GNBParamList.paramarray[0][GNB_MINRXTXTIME_IDX].iptr; + LOG_I(GNB_APP, "minTXRXTIME %d\n", config.minRXTXTIME); + config.sib1_tda = *GNBParamList.paramarray[0][GNB_SIB1_TDA_IDX].iptr; + LOG_I(GNB_APP, "SIB1 TDA %d\n", config.sib1_tda); + config.do_CSIRS = *GNBParamList.paramarray[0][GNB_DO_CSIRS_IDX].iptr; + config.do_SRS = *GNBParamList.paramarray[0][GNB_DO_SRS_IDX].iptr; + config.force_256qam_off = *GNBParamList.paramarray[0][GNB_FORCE256QAMOFF_IDX].iptr; + LOG_I(GNB_APP, + "CSI-RS %d, SRS %d, 256 QAM %s\n", + config.do_CSIRS, + config.do_SRS, + config.force_256qam_off ? "force off" : "may be on"); + + // note: no need for PLMN info, it is read in RC_read_F1Setup() + + NR_ServingCellConfigCommon_t *scc = get_scc_config(config.minRXTXTIME); //xer_fprint(stdout, &asn_DEF_NR_ServingCellConfigCommon, scc); NR_ServingCellConfig_t *scd = get_scd_config(); if (MacRLC_ParamList.numelt > 0) { RC.nb_nr_macrlc_inst = MacRLC_ParamList.numelt; ngran_node_t node_type = get_node_type(); - mac_top_init_gNB(node_type, scc, scd); + mac_top_init_gNB(node_type, scc, scd, &config); RC.nb_nr_mac_CC = (int *)malloc(RC.nb_nr_macrlc_inst * sizeof(int)); for (j = 0; j < RC.nb_nr_macrlc_inst; j++) { @@ -1388,26 +1416,7 @@ void RCconfig_NRRRC(gNB_RRC_INST *rrc) AssertFatal((nrrrc_config.mnc_digit_length[l] == 2) || (nrrrc_config.mnc_digit_length[l] == 3),"BAD MNC DIGIT LENGTH %d", nrrrc_config.mnc_digit_length[l]); - } - LOG_I(GNB_APP,"pdsch_AntennaPorts N1 %d\n",*GNBParamList.paramarray[i][GNB_PDSCH_ANTENNAPORTS_N1_IDX].iptr); - nrrrc_config.pdsch_AntennaPorts.N1 = *GNBParamList.paramarray[i][GNB_PDSCH_ANTENNAPORTS_N1_IDX].iptr; - LOG_I(GNB_APP,"pdsch_AntennaPorts N2 %d\n",*GNBParamList.paramarray[i][GNB_PDSCH_ANTENNAPORTS_N2_IDX].iptr); - nrrrc_config.pdsch_AntennaPorts.N2 = *GNBParamList.paramarray[i][GNB_PDSCH_ANTENNAPORTS_N2_IDX].iptr; - LOG_I(GNB_APP,"pdsch_AntennaPorts XP %d\n",*GNBParamList.paramarray[i][GNB_PDSCH_ANTENNAPORTS_XP_IDX].iptr); - nrrrc_config.pdsch_AntennaPorts.XP = *GNBParamList.paramarray[i][GNB_PDSCH_ANTENNAPORTS_XP_IDX].iptr; - LOG_I(GNB_APP,"pusch_AntennaPorts %d\n",*GNBParamList.paramarray[i][GNB_PUSCH_ANTENNAPORTS_IDX].iptr); - nrrrc_config.pusch_AntennaPorts = *GNBParamList.paramarray[i][GNB_PUSCH_ANTENNAPORTS_IDX].iptr; - LOG_I(GNB_APP,"minTXRXTIME %d\n",*GNBParamList.paramarray[i][GNB_MINRXTXTIME_IDX].iptr); - nrrrc_config.minRXTXTIME = *GNBParamList.paramarray[i][GNB_MINRXTXTIME_IDX].iptr; - DevAssert(nrrrc_config.minRXTXTIME == minRXTXTIME); - LOG_I(GNB_APP,"SIB1 TDA %d\n",*GNBParamList.paramarray[i][GNB_SIB1_TDA_IDX].iptr); - nrrrc_config.sib1_tda = *GNBParamList.paramarray[i][GNB_SIB1_TDA_IDX].iptr; - LOG_I(GNB_APP,"Do CSI-RS %d\n",*GNBParamList.paramarray[i][GNB_DO_CSIRS_IDX].iptr); - nrrrc_config.do_CSIRS = *GNBParamList.paramarray[i][GNB_DO_CSIRS_IDX].iptr; - LOG_I(GNB_APP, "Do SRS %d\n",*GNBParamList.paramarray[i][GNB_DO_SRS_IDX].iptr); - nrrrc_config.do_SRS = *GNBParamList.paramarray[i][GNB_DO_SRS_IDX].iptr; - nrrrc_config.force_256qam_off = *GNBParamList.paramarray[i][GNB_FORCE256QAMOFF_IDX].iptr; - LOG_I(GNB_APP, "256 QAM: %s\n", nrrrc_config.force_256qam_off ? "force off" : "may be on"); + } nrrrc_config.enable_sdap = *GNBParamList.paramarray[i][GNB_ENABLE_SDAP_IDX].iptr; LOG_I(GNB_APP, "SDAP layer is %s\n", nrrrc_config.enable_sdap ? "enabled" : "disabled"); nrrrc_config.drbs = *GNBParamList.paramarray[i][GNB_DRBS].iptr; diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 8d6f1d27fa..6ea3e10458 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -473,19 +473,13 @@ int nr_mac_enable_ue_rrc_processing_timer(module_id_t Mod_idP, rnti_t rnti, NR_S return 0; } -void nr_mac_config_scc(gNB_MAC_INST *nrmac, - rrc_pdsch_AntennaPorts_t pdsch_AntennaPorts, - int pusch_AntennaPorts, - int sib1_tda, - int minRXTXTIMEpdsch) +void nr_mac_config_scc(gNB_MAC_INST *nrmac, NR_ServingCellConfigCommon_t *scc, const nr_mac_config_t *config) { - int CC_id = 0; DevAssert(nrmac != NULL); - AssertFatal(nrmac->common_channels[0].ServingCellConfigCommon != NULL, "logic error: SCC not in MAC\n"); - NR_SCHED_LOCK(&nrmac->sched_lock); - - NR_ServingCellConfigCommon_t *scc = nrmac->common_channels[CC_id].ServingCellConfigCommon; DevAssert(scc != NULL); + DevAssert(config != NULL); + //NR_SCHED_LOCK(&nrmac->sched_lock); + AssertFatal(scc->ssb_PositionsInBurst->present > 0 && scc->ssb_PositionsInBurst->present < 4, "SSB Bitmap type %d is not valid\n", scc->ssb_PositionsInBurst->present); @@ -500,9 +494,8 @@ void nr_mac_config_scc(gNB_MAC_INST *nrmac, LOG_I(NR_MAC, "Configuring common parameters from NR ServingCellConfig\n"); - int num_pdsch_antenna_ports = pdsch_AntennaPorts.N1 * pdsch_AntennaPorts.N2 * pdsch_AntennaPorts.XP; - nrmac->xp_pdsch_antenna_ports = pdsch_AntennaPorts.XP; - config_common(nrmac, num_pdsch_antenna_ports, pusch_AntennaPorts, scc); + int num_pdsch_antenna_ports = config->pdsch_AntennaPorts.N1 * config->pdsch_AntennaPorts.N2 * config->pdsch_AntennaPorts.XP; + config_common(nrmac, num_pdsch_antenna_ports, config->pusch_AntennaPorts, scc); if (NFAPI_MODE == NFAPI_MODE_PNF || NFAPI_MODE == NFAPI_MODE_VNF) { // fake that the gNB is configured in nFAPI mode, which would normally be @@ -514,7 +507,6 @@ void nr_mac_config_scc(gNB_MAC_INST *nrmac, nrmac->if_inst->NR_PHY_config_req(&phycfg); } - nrmac->minRXTXTIMEpdsch = minRXTXTIMEpdsch; find_SSB_and_RO_available(nrmac); const NR_TDD_UL_DL_Pattern_t *tdd = scc->tdd_UL_DL_ConfigurationCommon ? &scc->tdd_UL_DL_ConfigurationCommon->pattern1 : NULL; @@ -535,7 +527,7 @@ void nr_mac_config_scc(gNB_MAC_INST *nrmac, nrmac->dlsch_slot_bitmap[slot / 64] |= (uint64_t)((slot % nr_slots_period) < nr_dl_slots) << (slot % 64); nrmac->ulsch_slot_bitmap[slot / 64] |= (uint64_t)((slot % nr_slots_period) >= nr_ulstart_slot) << (slot % 64); - LOG_I(NR_MAC, + LOG_D(NR_MAC, "slot %d DL %d UL %d\n", slot, (nrmac->dlsch_slot_bitmap[slot / 64] & ((uint64_t)1 << (slot % 64))) != 0, @@ -552,7 +544,6 @@ void nr_mac_config_scc(gNB_MAC_INST *nrmac, if (get_softmodem_params()->sa > 0) { NR_COMMON_channels_t *cc = &nrmac->common_channels[0]; - nrmac->sib1_tda = sib1_tda; for (int n = 0; n < NR_NB_RA_PROC_MAX; n++) { NR_RA_t *ra = &cc->ra[n]; ra->cfra = false; @@ -563,7 +554,7 @@ void nr_mac_config_scc(gNB_MAC_INST *nrmac, ra->preambles.preamble_list[i] = i; } } - NR_SCHED_UNLOCK(&nrmac->sched_lock); + //NR_SCHED_UNLOCK(&nrmac->sched_lock); } bool nr_mac_add_test_ue(gNB_MAC_INST *nrmac, uint32_t rnti, NR_CellGroupConfig_t *CellGroup) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index bdf84ddc8e..19a1a0d34b 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -159,7 +159,7 @@ static int16_t ssb_index_from_prach(module_id_t module_idP, void find_SSB_and_RO_available(gNB_MAC_INST *nrmac) { /* already mutex protected through nr_mac_config_scc() */ - NR_SCHED_ENSURE_LOCKED(&nrmac->sched_lock); + //NR_SCHED_ENSURE_LOCKED(&nrmac->sched_lock); NR_COMMON_channels_t *cc = &nrmac->common_channels[0]; NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index 8d44a20aa1..52d6825079 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -540,7 +540,7 @@ void schedule_nr_sib1(module_id_t module_idP, gNB_MAC_INST *gNB_mac = RC.nrmac[module_idP]; NR_ServingCellConfigCommon_t *scc = gNB_mac->common_channels[CC_id].ServingCellConfigCommon; - int time_domain_allocation = gNB_mac->sib1_tda; + int time_domain_allocation = gNB_mac->radio_config.sib1_tda; int L_max; switch (scc->ssb_PositionsInBurst->present) { diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 00fefe3b31..a3ab4eb74c 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -661,7 +661,8 @@ static void pf_dl(module_id_t module_id, else sched_pdsch->mcs = get_mcs_from_bler(bo, stats, &sched_ctrl->dl_bler_stats, max_mcs, frame); sched_pdsch->nrOfLayers = get_dl_nrOfLayers(sched_ctrl, current_BWP->dci_format); - sched_pdsch->pm_index = mac->identity_pm ? 0 : get_pm_index(UE, sched_pdsch->nrOfLayers, mac->xp_pdsch_antenna_ports); + sched_pdsch->pm_index = + mac->identity_pm ? 0 : get_pm_index(UE, sched_pdsch->nrOfLayers, mac->radio_config.pdsch_AntennaPorts.XP); const uint8_t Qm = nr_get_Qm_dl(sched_pdsch->mcs, current_BWP->mcsTableIdx); const uint16_t R = nr_get_code_rate_dl(sched_pdsch->mcs, current_BWP->mcsTableIdx); uint32_t tbs = nr_compute_tbs(Qm, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 5c3db39699..9955b240b3 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -2884,14 +2884,10 @@ void prepare_initial_ul_rrc_message(gNB_MAC_INST *mac, NR_UE_info_t *UE) { NR_SCHED_ENSURE_LOCKED(&mac->sched_lock); /* create this UE's initial CellGroup */ - /* Note: relying on the RRC is a hack, as we are in the DU; there should be - * no RRC, remove in the future */ - module_id_t mod_id = 0; int CC_id = 0; - gNB_RRC_INST *rrc = RC.nrrrc[mod_id]; const NR_ServingCellConfigCommon_t *scc = mac->common_channels[CC_id].ServingCellConfigCommon; const NR_ServingCellConfig_t *sccd = mac->common_channels[CC_id].pre_ServingCellConfig; - NR_CellGroupConfig_t *cellGroupConfig = get_initial_cellGroupConfig(UE->uid, scc, sccd, &rrc->configuration); + NR_CellGroupConfig_t *cellGroupConfig = get_initial_cellGroupConfig(UE->uid, scc, sccd, &mac->radio_config); UE->CellGroup = cellGroupConfig; nr_mac_update_cellgroup(mac, UE->rnti, cellGroupConfig); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 7b130b6adb..77b0eeba9e 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -1209,7 +1209,7 @@ int nr_acknack_scheduling(gNB_MAC_INST *mac, * called often, don't try to lock every time */ const int CC_id = 0; - const int minfbtime = mac->minRXTXTIMEpdsch; + const int minfbtime = mac->radio_config.minRXTXTIME; const NR_ServingCellConfigCommon_t *scc = mac->common_channels[CC_id].ServingCellConfigCommon; const NR_UE_UL_BWP_t *ul_bwp = &UE->current_UL_BWP; const int n_slots_frame = nr_slots_per_frame[ul_bwp->scs]; diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 28900454bd..6d0896427a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -38,7 +38,10 @@ void set_cset_offset(uint16_t); -void mac_top_init_gNB(ngran_node_t node_type, NR_ServingCellConfigCommon_t *scc, NR_ServingCellConfig_t *scd); +void mac_top_init_gNB(ngran_node_t node_type, + NR_ServingCellConfigCommon_t *scc, + NR_ServingCellConfig_t *scd, + const nr_mac_config_t *conf); void nr_mac_send_f1_setup_req(void); int nr_mac_enable_ue_rrc_processing_timer(module_id_t Mod_idP, @@ -46,11 +49,7 @@ int nr_mac_enable_ue_rrc_processing_timer(module_id_t Mod_idP, NR_SubcarrierSpacing_t subcarrierSpacing, uint32_t rrc_reconfiguration_delay); -void nr_mac_config_scc(gNB_MAC_INST *nrmac, - rrc_pdsch_AntennaPorts_t pdsch_AntennaPorts, - int pusch_AntennaPorts, - int sib1_tda, - int minRXTXTIMEpdsch); +void nr_mac_config_scc(gNB_MAC_INST *nrmac, NR_ServingCellConfigCommon_t *scc, const nr_mac_config_t *mac_config); bool nr_mac_add_test_ue(gNB_MAC_INST *nrmac, uint32_t rnti, NR_CellGroupConfig_t *CellGroup); bool nr_mac_prepare_ra_ue(gNB_MAC_INST *nrmac, uint32_t rnti, NR_CellGroupConfig_t *CellGroup); bool nr_mac_update_cellgroup(gNB_MAC_INST *nrmac, uint32_t rnti, NR_CellGroupConfig_t *CellGroup); diff --git a/openair2/LAYER2/NR_MAC_gNB/main.c b/openair2/LAYER2/NR_MAC_gNB/main.c index c034d30a31..960310ff9a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/main.c +++ b/openair2/LAYER2/NR_MAC_gNB/main.c @@ -205,7 +205,10 @@ static void mac_rrc_init(gNB_MAC_INST *mac, ngran_node_t node_type) } } -void mac_top_init_gNB(ngran_node_t node_type, NR_ServingCellConfigCommon_t *scc, NR_ServingCellConfig_t *scd) +void mac_top_init_gNB(ngran_node_t node_type, + NR_ServingCellConfigCommon_t *scc, + NR_ServingCellConfig_t *scd, + const nr_mac_config_t *config) { module_id_t i; gNB_MAC_INST *nrmac; @@ -242,6 +245,8 @@ void mac_top_init_gNB(ngran_node_t node_type, NR_ServingCellConfigCommon_t *scc, RC.nrmac[i]->ul_handle = 0; RC.nrmac[i]->common_channels[0].ServingCellConfigCommon = scc; + RC.nrmac[i]->radio_config = *config; + RC.nrmac[i]->common_channels[0].pre_ServingCellConfig = scd; RC.nrmac[i]->first_MIB = true; @@ -250,9 +255,7 @@ void mac_top_init_gNB(ngran_node_t node_type, NR_ServingCellConfigCommon_t *scc, RC.nrmac[i]->cset0_bwp_start = 0; RC.nrmac[i]->cset0_bwp_size = 0; - /* Temporary: RRC configuration */ - gNB_RrcConfigurationReq conf = { .mcc = {208}, .mnc = {95}, .mnc_digit_length = {2}, .tac = 1, .cell_identity = 3584}; - NR_BCCH_DL_SCH_Message_t *sib1 = get_SIB1_NR(&conf, scc); + NR_BCCH_DL_SCH_Message_t *sib1 = get_SIB1_NR(config, scc); NR_COMMON_channels_t *cc = &RC.nrmac[i]->common_channels[0]; cc->sib1 = sib1; cc->sib1_bcch_length = encode_SIB1_NR(sib1, cc->sib1_bcch_pdu, sizeof(cc->sib1_bcch_pdu)); @@ -319,6 +322,9 @@ void mac_top_init_gNB(ngran_node_t node_type, NR_ServingCellConfigCommon_t *scc, du_init_f1_ue_data(); srand48(0); + + // triggers also PYH initialization in case we have L1 via FAPI + nr_mac_config_scc(RC.nrmac[0], scc, config); } void nr_mac_send_f1_setup_req(void) diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 1cf4efdcbb..53406b2f87 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -121,6 +121,24 @@ typedef enum { WAIT_Msg4_ACK = 6 } RA_gNB_state_t; +typedef struct nr_pdsch_AntennaPorts_t { + int N1; + int N2; + int XP; +} nr_pdsch_AntennaPorts_t; + +typedef struct nr_mac_config_t { + int sib1_tda; + nr_pdsch_AntennaPorts_t pdsch_AntennaPorts; + int pusch_AntennaPorts; + int minRXTXTIME; + int do_CSIRS; + int do_SRS; + bool force_256qam_off; + //int pusch_TargetSNRx10; + //int pucch_TargetSNRx10; +} nr_mac_config_t; + typedef struct NR_preamble_ue { uint8_t num_preambles; uint8_t *preamble_list; @@ -744,9 +762,7 @@ typedef struct gNB_MAC_INST_s { /// Subcarrier Offset int ssb_SubcarrierOffset; int ssb_OffsetPointA; - /// SIB1 Time domain allocation - int sib1_tda; - int minRXTXTIMEpdsch; + /// Common cell resources NR_COMMON_channels_t common_channels[NFAPI_CC_MAX]; /// current PDU index (BCH,DLSCH) @@ -812,13 +828,13 @@ typedef struct gNB_MAC_INST_s { /// UL preprocessor for differentiated scheduling nr_pp_impl_ul pre_processor_ul; + nr_mac_config_t radio_config; + NR_UE_sched_ctrl_t *sched_ctrlCommon; uint16_t cset0_bwp_start; uint16_t cset0_bwp_size; NR_Type0_PDCCH_CSS_config_t type0_PDCCH_CSS_config[64]; - int xp_pdsch_antenna_ports; - bool first_MIB; NR_bler_options_t dl_bler; NR_bler_options_t ul_bler; diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 3768782b06..ee3ddd08ee 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -196,8 +196,8 @@ int xer_nr_sprint (char *string, size_t string_size, asn_TYPE_descriptor_t *td, //------------------------------------------------------------------------------ -uint8_t do_SIB23_NR(rrc_gNB_carrier_data_t *carrier, - gNB_RrcConfigurationReq *configuration) { +uint8_t do_SIB23_NR(rrc_gNB_carrier_data_t *carrier) +{ asn_enc_rval_t enc_rval; SystemInformation_IEs__sib_TypeAndInfo__Member *sib2 = NULL; SystemInformation_IEs__sib_TypeAndInfo__Member *sib3 = NULL; @@ -689,7 +689,6 @@ int16_t do_RRCReconfiguration( NR_MeasConfig_t *meas_config, struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList *dedicatedNAS_MessageList, rrc_gNB_ue_context_t *const ue_context_pP, - const gNB_RrcConfigurationReq *configuration, const NR_ServingCellConfigCommon_t *scc, NR_CellGroupConfig_t *cellGroupConfig) //------------------------------------------------------------------------------ @@ -747,7 +746,7 @@ int16_t do_RRCReconfiguration( update_cellGroupConfig(cellGroupConfig, ue_context_pP->ue_context.rrc_ue_id, ue_context_pP ? ue_context_pP->ue_context.UE_Capability_nr : NULL, - configuration, + NULL, scc); } else { LOG_W(RRC, "no scc, cannot update cellGroup\n"); diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.h b/openair2/RRC/NR/MESSAGES/asn1_msg.h index d041c39a7c..a81091357a 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.h +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.h @@ -55,9 +55,7 @@ */ int xer_sprint_NR(char *string, size_t string_size, struct asn_TYPE_descriptor_s *td, void *sptr); -uint8_t do_SIB23_NR(rrc_gNB_carrier_data_t *carrier, - gNB_RrcConfigurationReq *configuration); - +uint8_t do_SIB23_NR(rrc_gNB_carrier_data_t *carrier); int do_RRCReject(uint8_t Mod_id, uint8_t *const buffer); @@ -111,7 +109,6 @@ int16_t do_RRCReconfiguration(const protocol_ctxt_t *const ctxt_pP, NR_MeasConfig_t *meas_config, struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList *dedicatedNAS_MessageList, rrc_gNB_ue_context_t *const ue_context_pP, - const gNB_RrcConfigurationReq *configuration, const NR_ServingCellConfigCommon_t *scc, NR_CellGroupConfig_t *cellGroupConfig); diff --git a/openair2/RRC/NR/nr_rrc_config.c b/openair2/RRC/NR/nr_rrc_config.c index 4d4ea4f860..97bfa73547 100644 --- a/openair2/RRC/NR/nr_rrc_config.c +++ b/openair2/RRC/NR/nr_rrc_config.c @@ -30,6 +30,7 @@ #include "nr_rrc_config.h" #include "common/utils/nr/nr_common.h" +#include "openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h" #include "executables/softmodem-common.h" #include "oai_asn1.h" #include "SIMULATION/TOOLS/sim.h" // for taus(); @@ -1249,7 +1250,7 @@ static void config_uplinkBWP(NR_BWP_Uplink_t *ubwp, long bwp_loop, bool is_SA, int uid, - const gNB_RrcConfigurationReq *configuration, + const nr_mac_config_t *configuration, const NR_ServingCellConfig_t *servingcellconfigdedicated, const NR_ServingCellConfigCommon_t *scc, const NR_UE_NR_Capability_t *uecap) @@ -1382,7 +1383,7 @@ static void set_csi_meas_periodicity(const NR_ServingCellConfigCommon_t *scc, NR } } -static void config_csi_codebook(const rrc_pdsch_AntennaPorts_t *antennaports, +static void config_csi_codebook(const nr_pdsch_AntennaPorts_t *antennaports, const int max_layers, struct NR_CodebookConfig *codebookConfig) { @@ -1487,7 +1488,7 @@ static void config_csi_meas_report(NR_CSI_MeasConfig_t *csi_MeasConfig, const NR_ServingCellConfigCommon_t *servingcellconfigcommon, NR_PUCCH_CSI_Resource_t *pucchcsires, struct NR_SetupRelease_PDSCH_Config *pdsch_Config, - const rrc_pdsch_AntennaPorts_t *antennaports, + const nr_pdsch_AntennaPorts_t *antennaports, const int max_layers, int rep_id, int uid) @@ -1712,7 +1713,7 @@ int encode_MIB_NR(NR_BCCH_BCH_Message_t *mib, int frame, uint8_t *buf, int buf_s return (enc_rval.encoded + 7) / 8; } -NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const gNB_RrcConfigurationReq *configuration, const NR_ServingCellConfigCommon_t *scc) +NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const nr_mac_config_t *configuration, const NR_ServingCellConfigCommon_t *scc) { NR_BCCH_DL_SCH_Message_t *sib1_message = CALLOC(1,sizeof(NR_BCCH_DL_SCH_Message_t)); AssertFatal(sib1_message != NULL, "out of memory\n"); @@ -1740,17 +1741,17 @@ NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const gNB_RrcConfigurationReq *configurati 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, mcc); - int confMcc = configuration->mcc[i]; + int confMcc = 0; 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) { + int mnc = 0; + if (0 == 3) { asn1cSequenceAdd(nr_plmn->mnc.list, NR_MCC_MNC_Digit_t, mnc0); - *mnc0 = (configuration->mnc[i] / 100) % 10; + *mnc0 = (0 / 100) % 10; } asn1cSequenceAdd(nr_plmn->mnc.list, NR_MCC_MNC_Digit_t, mnc1); *mnc1 = (mnc / 10) % 10; @@ -1762,13 +1763,13 @@ NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const gNB_RrcConfigurationReq *configurati AssertFatal(nr_plmn_info->cellIdentity.buf != NULL, "out of memory\n"); nr_plmn_info->cellIdentity.size = 5; nr_plmn_info->cellIdentity.bits_unused = 4; - uint64_t tmp = htobe64(configuration->cell_identity) << 4; + uint64_t tmp = htobe64(0) << 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)); AssertFatal(nr_plmn_info->trackingAreaCode != NULL, "out of memory\n"); - uint32_t tmp2 = htobe32(configuration->tac); + uint32_t tmp2 = htobe32(0); nr_plmn_info->trackingAreaCode->buf = CALLOC(1, 3); AssertFatal(nr_plmn_info->trackingAreaCode->buf != NULL, "out of memory\n"); memcpy(nr_plmn_info->trackingAreaCode->buf, ((char *)&tmp2) + 1, 3); @@ -2067,7 +2068,7 @@ static NR_MAC_CellGroupConfig_t *configure_mac_cellgroup(void) static NR_SpCellConfig_t *get_initial_SpCellConfig(int uid, const NR_ServingCellConfigCommon_t *scc, const NR_ServingCellConfig_t *servingcellconfigdedicated, - const gNB_RrcConfigurationReq *configuration) + const nr_mac_config_t *configuration) { const int pdsch_AntennaPorts = configuration->pdsch_AntennaPorts.N1 * configuration->pdsch_AntennaPorts.N2 * configuration->pdsch_AntennaPorts.XP; @@ -2314,7 +2315,7 @@ static NR_SpCellConfig_t *get_initial_SpCellConfig(int uid, NR_CellGroupConfig_t *get_initial_cellGroupConfig(int uid, const NR_ServingCellConfigCommon_t *scc, const NR_ServingCellConfig_t *servingcellconfigdedicated, - const gNB_RrcConfigurationReq *configuration) + const nr_mac_config_t *configuration) { NR_CellGroupConfig_t *cellGroupConfig = calloc(1, sizeof(*cellGroupConfig)); cellGroupConfig->cellGroupId = 0; @@ -2345,7 +2346,7 @@ NR_CellGroupConfig_t *get_initial_cellGroupConfig(int uid, void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, const int uid, NR_UE_NR_Capability_t *uecap, - const gNB_RrcConfigurationReq *configuration, + const nr_mac_config_t *configuration, const NR_ServingCellConfigCommon_t *scc) { DevAssert(cellGroupConfig != NULL); @@ -2527,10 +2528,10 @@ NR_CellGroupConfig_t *get_default_secondaryCellGroup(const NR_ServingCellConfigC const NR_UE_NR_Capability_t *uecap, int scg_id, int servCellIndex, - const gNB_RrcConfigurationReq *configuration, + const nr_mac_config_t *configuration, int uid) { - const rrc_pdsch_AntennaPorts_t *pdschap = &configuration->pdsch_AntennaPorts; + const nr_pdsch_AntennaPorts_t *pdschap = &configuration->pdsch_AntennaPorts; const int dl_antenna_ports = pdschap->N1 * pdschap->N2 * pdschap->XP; const int do_csirs = configuration->do_CSIRS; diff --git a/openair2/RRC/NR/nr_rrc_config.h b/openair2/RRC/NR/nr_rrc_config.h index dbb97c14a8..ae1e31743e 100644 --- a/openair2/RRC/NR/nr_rrc_config.h +++ b/openair2/RRC/NR/nr_rrc_config.h @@ -34,6 +34,10 @@ #include "nr_rrc_defs.h" #include "openair2/RRC/NR/MESSAGES/asn1_msg.h" +// forward declaration of MAC configuration parameters, definition is included in C file +struct nr_mac_config_t; +typedef struct nr_mac_config_t nr_mac_config_t; + void nr_rrc_config_dl_tda(struct NR_PDSCH_TimeDomainResourceAllocationList *pdsch_TimeDomainAllocationList, frame_type_t frame_type, NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon, @@ -53,18 +57,18 @@ int encode_MIB_NR(NR_BCCH_BCH_Message_t *mib, int frame, uint8_t *buf, int buf_s #define NR_MAX_SIB_LENGTH 2976 // 3GPP TS 38.331 section 5.2.1 -NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const gNB_RrcConfigurationReq *configuration, const NR_ServingCellConfigCommon_t *scc); +NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const nr_mac_config_t *configuration, const NR_ServingCellConfigCommon_t *scc); void free_SIB1_NR(NR_BCCH_DL_SCH_Message_t *sib1); int encode_SIB1_NR(NR_BCCH_DL_SCH_Message_t *sib1, uint8_t *buffer, int max_buffer_size); NR_CellGroupConfig_t *get_initial_cellGroupConfig(int uid, const NR_ServingCellConfigCommon_t *scc, const NR_ServingCellConfig_t *servingcellconfigdedicated, - const gNB_RrcConfigurationReq *configuration); + const nr_mac_config_t *configuration); void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, const int uid, NR_UE_NR_Capability_t *uecap, - const gNB_RrcConfigurationReq *configuration, + const nr_mac_config_t *configuration, const NR_ServingCellConfigCommon_t *scc); void free_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig); int encode_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, uint8_t *buffer, int max_buffer_size); @@ -78,7 +82,7 @@ NR_CellGroupConfig_t *get_default_secondaryCellGroup(const NR_ServingCellConfigC const NR_UE_NR_Capability_t *uecap, int scg_id, int servCellIndex, - const gNB_RrcConfigurationReq *configuration, + const nr_mac_config_t *configuration, int uid); #endif diff --git a/openair2/RRC/NR/nr_rrc_proto.h b/openair2/RRC/NR/nr_rrc_proto.h index 317a4976e8..69f71316ba 100644 --- a/openair2/RRC/NR/nr_rrc_proto.h +++ b/openair2/RRC/NR/nr_rrc_proto.h @@ -69,7 +69,6 @@ void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon NR_RRCReconfiguration_IEs_t *reconfig, NR_CellGroupConfig_t *secondaryCellGroup, NR_UE_NR_Capability_t *uecap, - const gNB_RrcConfigurationReq *configuration, int uid); int generate_CG_Config(gNB_RRC_INST *rrc, diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index bcf26c0e16..07c951c4e2 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -278,28 +278,16 @@ static int get_ssb_arfcn(const f1ap_served_cell_info_t *cell_info, const NR_MIB_ ///---------------------------------------------------------------------------------------------------------------/// ///---------------------------------------------------------------------------------------------------------------/// -static void init_NR_SI(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *configuration) +static void init_NR_SI(gNB_RRC_INST *rrc) { if (!NODE_IS_DU(rrc->node_type)) { rrc->carrier.SIB23 = (uint8_t *) malloc16(100); AssertFatal(rrc->carrier.SIB23 != NULL, "cannot allocate memory for SIB"); - rrc->carrier.sizeof_SIB23 = do_SIB23_NR(&rrc->carrier, configuration); + rrc->carrier.sizeof_SIB23 = do_SIB23_NR(&rrc->carrier); LOG_I(NR_RRC,"do_SIB23_NR, size %d \n ", rrc->carrier.sizeof_SIB23); AssertFatal(rrc->carrier.sizeof_SIB23 != 255,"FATAL, RC.nrrrc[mod].carrier[CC_id].sizeof_SIB23 == 255"); } - LOG_I(NR_RRC,"Done init_NR_SI\n"); - - if (NODE_IS_MONOLITHIC(rrc->node_type) || NODE_IS_DU(rrc->node_type)){ - // update SI info - /* 1. move this to MAC */ - nr_mac_config_scc(RC.nrmac[rrc->module_id], - rrc->configuration.pdsch_AntennaPorts, - rrc->configuration.pusch_AntennaPorts, - rrc->configuration.sib1_tda, - rrc->configuration.minRXTXTIME); - } - if (get_softmodem_params()->phy_test > 0 || get_softmodem_params()->do_ra > 0) { AssertFatal(NODE_IS_MONOLITHIC(rrc->node_type), "phy_test and do_ra only work in monolithic\n"); rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_allocate_new_ue_context(rrc); @@ -351,7 +339,7 @@ void openair_rrc_gNB_configuration(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *c RB_INIT(&rrc->rrc_ue_head); rrc->configuration = *configuration; /// System Information INIT - init_NR_SI(rrc, configuration); + init_NR_SI(rrc); return; } // END openair_rrc_gNB_configuration @@ -587,7 +575,6 @@ static void rrc_gNB_generate_defaultRRCReconfiguration(const protocol_ctxt_t *co measconfig, dedicatedNAS_MessageList, ue_context_pP, - &rrc->configuration, NULL, ue_p->masterCellGroup); AssertFatal(size > 0, "cannot encode RRCReconfiguration in %s()\n", __func__); @@ -709,7 +696,6 @@ void rrc_gNB_generate_dedicatedRRCReconfiguration(const protocol_ctxt_t *const c NULL, dedicatedNAS_MessageList, ue_context_pP, - &rrc->configuration, NULL, cellGroupConfig); LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)buffer,size,"[MSG] RRC Reconfiguration\n"); @@ -856,7 +842,6 @@ rrc_gNB_modify_dedicatedRRCReconfiguration( dedicatedNAS_MessageList, NULL, NULL, - NULL, NULL); LOG_DUMPMSG(NR_RRC, DEBUG_RRC, (char *)buffer, size, "[MSG] RRC Reconfiguration\n"); @@ -942,7 +927,6 @@ rrc_gNB_generate_dedicatedRRCReconfiguration_release( dedicatedNAS_MessageList, NULL, NULL, - NULL, NULL); LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)buffer,size, "[MSG] RRC Reconfiguration\n"); @@ -1196,7 +1180,6 @@ static void rrc_gNB_process_RRCReestablishmentComplete(const protocol_ctxt_t *co NULL, ue_context_pP, NULL, - NULL, cellGroupConfig); freeSRBlist(SRBs); freeDRBlist(DRBs); @@ -1257,7 +1240,6 @@ int nr_rrc_reconfiguration_req(rrc_gNB_ue_context_t *const ue_context_pP NULL, ue_context_pP, NULL, - NULL, masterCellGroup); gNB_RRC_INST *rrc = RC.nrrrc[ctxt_pP->module_id]; diff --git a/openair2/RRC/NR/rrc_gNB_nsa.c b/openair2/RRC/NR/rrc_gNB_nsa.c index e03dcc4705..0b22621c0e 100644 --- a/openair2/RRC/NR/rrc_gNB_nsa.c +++ b/openair2/RRC/NR/rrc_gNB_nsa.c @@ -120,7 +120,7 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc, rrc_gNB_ue_context_t *ue_context_p, x2a { AssertFatal(!get_softmodem_params()->sa, "%s() cannot be called in SA mode, it is intrinsically for NSA\n", __func__); // generate nr-Config-r15 containers for LTE RRC : inside message for X2 EN-DC (CG-Config Message from 38.331) - const gNB_RrcConfigurationReq *configuration = &rrc->configuration; + const nr_mac_config_t *configuration = &RC.nrmac[0]->radio_config; MessageDef *msg; msg = itti_alloc_new_message(TASK_RRC_ENB, 0, X2AP_ENDC_SGNB_ADDITION_REQ_ACK); gtpv1u_enb_create_tunnel_req_t create_tunnel_req; @@ -257,7 +257,7 @@ void rrc_add_nsa_user(gNB_RRC_INST *rrc, rrc_gNB_ue_context_t *ue_context_p, x2a AssertFatal(UE->secondaryCellGroup != NULL, "out of memory\n"); xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, UE->secondaryCellGroup); - fill_default_reconfig(sccc, scc, reconfig_ies, UE->secondaryCellGroup, UE->UE_Capability_nr, configuration, ue_context_p->ue_context.rrc_ue_id); + fill_default_reconfig(sccc, scc, reconfig_ies, UE->secondaryCellGroup, UE->UE_Capability_nr, ue_context_p->ue_context.rrc_ue_id); UE->rnti = UE->secondaryCellGroup->spCellConfig->reconfigurationWithSync->newUE_Identity; NR_CG_Config_t *CG_Config = calloc(1,sizeof(*CG_Config)); memset((void *)CG_Config,0,sizeof(*CG_Config)); diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index c657d35831..d2ef7443c3 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -54,7 +54,6 @@ void fill_default_reconfig(NR_ServingCellConfigCommon_t *servingcellconfigcommon NR_RRCReconfiguration_IEs_t *reconfig, NR_CellGroupConfig_t *secondaryCellGroup, NR_UE_NR_Capability_t *uecap, - const gNB_RrcConfigurationReq *configuration, int uid) { AssertFatal(servingcellconfigcommon!=NULL,"servingcellconfigcommon is null\n"); AssertFatal(reconfig!=NULL,"reconfig is null\n"); From 18db5f68aca138b9f6491525ebe11761af47b7af Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 23 Aug 2023 08:59:59 +0200 Subject: [PATCH 44/63] Put PLMN/TAC/CellID into SIB1, correct CellIdentity encoding --- openair2/LAYER2/NR_MAC_gNB/config.c | 12 ++++++++++++ openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 2 ++ openair2/LAYER2/NR_MAC_gNB/main.c | 6 ------ openair2/RRC/NR/nr_rrc_config.c | 20 +++++++++----------- openair2/RRC/NR/nr_rrc_config.h | 2 +- 5 files changed, 24 insertions(+), 18 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 6ea3e10458..a04ffad88d 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -557,6 +557,18 @@ void nr_mac_config_scc(gNB_MAC_INST *nrmac, NR_ServingCellConfigCommon_t *scc, c //NR_SCHED_UNLOCK(&nrmac->sched_lock); } +void nr_mac_configure_sib1(gNB_MAC_INST *nrmac, const f1ap_plmn_t *plmn, uint64_t cellID, int tac) +{ + AssertFatal(get_softmodem_params()->sa > 0, "error: SIB1 only applicable for SA\n"); + + NR_COMMON_channels_t *cc = &nrmac->common_channels[0]; + NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; + NR_BCCH_DL_SCH_Message_t *sib1 = get_SIB1_NR(scc, plmn, cellID, tac); + cc->sib1 = sib1; + cc->sib1_bcch_length = encode_SIB1_NR(sib1, cc->sib1_bcch_pdu, sizeof(cc->sib1_bcch_pdu)); + AssertFatal(cc->sib1_bcch_length > 0, "could not encode SIB1\n"); +} + bool nr_mac_add_test_ue(gNB_MAC_INST *nrmac, uint32_t rnti, NR_CellGroupConfig_t *CellGroup) { DevAssert(nrmac != NULL); diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 6d0896427a..386788170b 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -50,6 +50,8 @@ int nr_mac_enable_ue_rrc_processing_timer(module_id_t Mod_idP, uint32_t rrc_reconfiguration_delay); void nr_mac_config_scc(gNB_MAC_INST *nrmac, NR_ServingCellConfigCommon_t *scc, const nr_mac_config_t *mac_config); +void nr_mac_configure_sib1(gNB_MAC_INST *nrmac, const f1ap_plmn_t *plmn, uint64_t cellID, int tac); + bool nr_mac_add_test_ue(gNB_MAC_INST *nrmac, uint32_t rnti, NR_CellGroupConfig_t *CellGroup); bool nr_mac_prepare_ra_ue(gNB_MAC_INST *nrmac, uint32_t rnti, NR_CellGroupConfig_t *CellGroup); bool nr_mac_update_cellgroup(gNB_MAC_INST *nrmac, uint32_t rnti, NR_CellGroupConfig_t *CellGroup); diff --git a/openair2/LAYER2/NR_MAC_gNB/main.c b/openair2/LAYER2/NR_MAC_gNB/main.c index 960310ff9a..f38e70d66e 100644 --- a/openair2/LAYER2/NR_MAC_gNB/main.c +++ b/openair2/LAYER2/NR_MAC_gNB/main.c @@ -255,12 +255,6 @@ void mac_top_init_gNB(ngran_node_t node_type, RC.nrmac[i]->cset0_bwp_start = 0; RC.nrmac[i]->cset0_bwp_size = 0; - NR_BCCH_DL_SCH_Message_t *sib1 = get_SIB1_NR(config, scc); - NR_COMMON_channels_t *cc = &RC.nrmac[i]->common_channels[0]; - cc->sib1 = sib1; - cc->sib1_bcch_length = encode_SIB1_NR(sib1, cc->sib1_bcch_pdu, sizeof(cc->sib1_bcch_pdu)); - AssertFatal(cc->sib1_bcch_length > 0, "could not encode SIB1\n"); - pthread_mutex_init(&RC.nrmac[i]->sched_lock, NULL); pthread_mutex_init(&RC.nrmac[i]->UE_info.mutex, NULL); diff --git a/openair2/RRC/NR/nr_rrc_config.c b/openair2/RRC/NR/nr_rrc_config.c index 97bfa73547..d1c55d17cf 100644 --- a/openair2/RRC/NR/nr_rrc_config.c +++ b/openair2/RRC/NR/nr_rrc_config.c @@ -28,6 +28,7 @@ * \email: raymond.knopp@eurecom.fr, kroempa@gmail.com */ +#include "openair3/UTILS/conversions.h" #include "nr_rrc_config.h" #include "common/utils/nr/nr_common.h" #include "openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h" @@ -1713,8 +1714,10 @@ int encode_MIB_NR(NR_BCCH_BCH_Message_t *mib, int frame, uint8_t *buf, int buf_s return (enc_rval.encoded + 7) / 8; } -NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const nr_mac_config_t *configuration, const NR_ServingCellConfigCommon_t *scc) +NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const NR_ServingCellConfigCommon_t *scc, const f1ap_plmn_t *plmn, uint64_t cellID, int tac) { + AssertFatal(cellID < (1l << 36), "cellID must fit within 36 bits, but is %ld\n", cellID); + NR_BCCH_DL_SCH_Message_t *sib1_message = CALLOC(1,sizeof(NR_BCCH_DL_SCH_Message_t)); AssertFatal(sib1_message != NULL, "out of memory\n"); sib1_message->message.present = NR_BCCH_DL_SCH_MessageType_PR_c1; @@ -1741,15 +1744,15 @@ NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const nr_mac_config_t *configuration, cons 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, mcc); - int confMcc = 0; + int confMcc = plmn->mcc; 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 = 0; - if (0 == 3) { + int mnc = plmn->mnc; + if (plmn->mnc_digit_length == 3) { asn1cSequenceAdd(nr_plmn->mnc.list, NR_MCC_MNC_Digit_t, mnc0); *mnc0 = (0 / 100) % 10; } @@ -1759,17 +1762,12 @@ NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const nr_mac_config_t *configuration, cons *mnc2 = (mnc) % 10; } - nr_plmn_info->cellIdentity.buf = CALLOC(1, 5); - AssertFatal(nr_plmn_info->cellIdentity.buf != NULL, "out of memory\n"); - nr_plmn_info->cellIdentity.size = 5; - nr_plmn_info->cellIdentity.bits_unused = 4; - uint64_t tmp = htobe64(0) << 4; - memcpy(nr_plmn_info->cellIdentity.buf, ((char *)&tmp) + 3, 5); + NR_CELL_ID_TO_BIT_STRING(cellID, &nr_plmn_info->cellIdentity); nr_plmn_info->cellReservedForOperatorUse = NR_PLMN_IdentityInfo__cellReservedForOperatorUse_notReserved; nr_plmn_info->trackingAreaCode = CALLOC(1, sizeof(NR_TrackingAreaCode_t)); AssertFatal(nr_plmn_info->trackingAreaCode != NULL, "out of memory\n"); - uint32_t tmp2 = htobe32(0); + uint32_t tmp2 = htobe32(tac); nr_plmn_info->trackingAreaCode->buf = CALLOC(1, 3); AssertFatal(nr_plmn_info->trackingAreaCode->buf != NULL, "out of memory\n"); memcpy(nr_plmn_info->trackingAreaCode->buf, ((char *)&tmp2) + 1, 3); diff --git a/openair2/RRC/NR/nr_rrc_config.h b/openair2/RRC/NR/nr_rrc_config.h index ae1e31743e..802d57428c 100644 --- a/openair2/RRC/NR/nr_rrc_config.h +++ b/openair2/RRC/NR/nr_rrc_config.h @@ -57,7 +57,7 @@ int encode_MIB_NR(NR_BCCH_BCH_Message_t *mib, int frame, uint8_t *buf, int buf_s #define NR_MAX_SIB_LENGTH 2976 // 3GPP TS 38.331 section 5.2.1 -NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const nr_mac_config_t *configuration, const NR_ServingCellConfigCommon_t *scc); +NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const NR_ServingCellConfigCommon_t *scc, const f1ap_plmn_t *plmn, uint64_t cellID, int tac); void free_SIB1_NR(NR_BCCH_DL_SCH_Message_t *sib1); int encode_SIB1_NR(NR_BCCH_DL_SCH_Message_t *sib1, uint8_t *buffer, int max_buffer_size); From 325ac4f8e2ac1624a7a61e77f07d0d9ed76c9156 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Wed, 23 Aug 2023 16:06:54 +0200 Subject: [PATCH 45/63] Restructure config read: first PLMN info, then SIB1, then F1 Setup request In NSA case: do not send SIB1 --- openair2/GNB_APP/gnb_config.c | 241 +++++++++++++++++++--------------- 1 file changed, 132 insertions(+), 109 deletions(-) diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 4134d03ca2..28bdb9fce4 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -947,7 +947,127 @@ static NR_ServingCellConfig_t *get_scd_config(void) return scd; } -static f1ap_setup_req_t *RC_read_F1Setup(const NR_ServingCellConfigCommon_t *scc, NR_BCCH_BCH_Message_t *mib, const NR_BCCH_DL_SCH_Message_t *sib1); +static int read_du_cell_info(uint64_t *id, char **name, f1ap_served_cell_info_t *info, int max_cell_info) +{ + AssertFatal(max_cell_info == 1, "only one cell supported\n"); + memset(info, 0, sizeof(*info)); + + paramdef_t GNBSParams[] = GNBSPARAMS_DESC; + paramdef_t GNBParams[] = GNBPARAMS_DESC; + paramlist_def_t GNBParamList = {GNB_CONFIG_STRING_GNB_LIST,NULL,0}; + config_get( GNBSParams,sizeof(GNBSParams)/sizeof(paramdef_t),NULL); + int num_gnbs = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt; + AssertFatal(num_gnbs == 1, "cannot configure DU: required config section \"gNBs\" missing\n"); + + // Output a list of all eNBs. + config_getlist(&GNBParamList, GNBParams, sizeof(GNBParams) / sizeof(paramdef_t), NULL); + AssertFatal(GNBParamList.paramarray[0][GNB_GNB_ID_IDX].uptr != NULL, "gNB id %u is not defined in configuration file\n", 0); + + AssertFatal(strcmp(GNBSParams[GNB_ACTIVE_GNBS_IDX].strlistptr[0], *GNBParamList.paramarray[0][GNB_GNB_NAME_IDX].strptr) == 0, + "no active gNB found/mismatch of gNBs: %s vs %s\n", + GNBSParams[GNB_ACTIVE_GNBS_IDX].strlistptr[0], + *GNBParamList.paramarray[0][GNB_GNB_NAME_IDX].strptr); + + char aprefix[MAX_OPTNAME_SIZE * 2 + 8]; + sprintf(aprefix, "%s.[0]", GNB_CONFIG_STRING_GNB_LIST); + paramdef_t PLMNParams[] = GNBPLMNPARAMS_DESC; + /* map parameter checking array instances to parameter definition array instances */ + checkedparam_t config_check_PLMNParams[] = PLMNPARAMS_CHECK; + for (int I = 0; I < sizeof(PLMNParams) / sizeof(paramdef_t); ++I) + PLMNParams[I].chkPptr = &(config_check_PLMNParams[I]); + paramlist_def_t PLMNParamList = {GNB_CONFIG_STRING_PLMN_LIST, NULL, 0}; + config_getlist(&PLMNParamList, PLMNParams, sizeof(PLMNParams) / sizeof(paramdef_t), aprefix); + + *id = *(GNBParamList.paramarray[0][GNB_GNB_ID_IDX].uptr); + *name = strdup(*(GNBParamList.paramarray[0][GNB_GNB_NAME_IDX].strptr)); + info->tac = malloc(sizeof(*info->tac)); + AssertFatal(info->tac != NULL, "out of memory\n"); + *info->tac = *GNBParamList.paramarray[0][GNB_TRACKING_AREA_CODE_IDX].uptr; + info->plmn.mcc = *PLMNParamList.paramarray[0][GNB_MOBILE_COUNTRY_CODE_IDX].uptr; + info->plmn.mnc = *PLMNParamList.paramarray[0][GNB_MOBILE_NETWORK_CODE_IDX].uptr; + info->plmn.mnc_digit_length = *PLMNParamList.paramarray[0][GNB_MNC_DIGIT_LENGTH].u8ptr; + AssertFatal((info->plmn.mnc_digit_length == 2) || (info->plmn.mnc_digit_length == 3), + "BAD MNC DIGIT LENGTH %d", + info->plmn.mnc_digit_length); + info->nr_cellid = (uint64_t) * (GNBParamList.paramarray[0][GNB_NRCELLID_IDX].u64ptr); + + LOG_W(GNB_APP, "no slices transported via F1 Setup Request!\n"); + info->num_ssi = 0; + + return 1; +} + +static f1ap_setup_req_t *RC_read_F1Setup(uint64_t id, + const char *name, + const f1ap_served_cell_info_t *info, + const NR_ServingCellConfigCommon_t *scc, + NR_BCCH_BCH_Message_t *mib, + const NR_BCCH_DL_SCH_Message_t *sib1) +{ + f1ap_setup_req_t *req = calloc(1, sizeof(*req)); + AssertFatal(req != NULL, "out of memory\n"); + req->gNB_DU_id = id; + req->gNB_DU_name = strdup(name); + req->num_cells_available = 1; + req->cell[0].info = *info; + LOG_I(GNB_APP, + "F1AP: gNB idx %d gNB_DU_id %ld, gNB_DU_name %s, TAC %d MCC/MNC/length %d/%d/%d cellID %ld\n", + 0, + req->gNB_DU_id, + req->gNB_DU_name, + *req->cell[0].info.tac, + req->cell[0].info.plmn.mcc, + req->cell[0].info.plmn.mnc, + req->cell[0].info.plmn.mnc_digit_length, + req->cell[0].info.nr_cellid); + + req->cell[0].info.nr_pci = *scc->physCellId; + if (scc->tdd_UL_DL_ConfigurationCommon) { + LOG_I(GNB_APP, "ngran_DU: Configuring Cell %d for TDD\n", 0); + req->cell[0].info.mode = F1AP_MODE_TDD; + f1ap_tdd_info_t *tdd = &req->cell[0].info.tdd; + tdd->freqinfo.arfcn = scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA; + tdd->tbw.scs = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; + tdd->tbw.nrb = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; + tdd->freqinfo.band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; + } else { + LOG_I(GNB_APP, "ngran_DU: Configuring Cell %d for FDD\n", 0); + req->cell[0].info.mode = F1AP_MODE_FDD; + f1ap_fdd_info_t *fdd = &req->cell[0].info.fdd; + fdd->dl_freqinfo.arfcn = scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA; + fdd->ul_freqinfo.arfcn = *scc->uplinkConfigCommon->frequencyInfoUL->absoluteFrequencyPointA; + fdd->dl_tbw.scs = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; + fdd->ul_tbw.scs = scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; + fdd->dl_tbw.nrb = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; + fdd->ul_tbw.nrb = scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; + fdd->dl_freqinfo.band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; + fdd->ul_freqinfo.band = *scc->uplinkConfigCommon->frequencyInfoUL->frequencyBandList->list.array[0]; + } + + req->cell[0].info.measurement_timing_information = "0"; + + int buf_len = 3; // this is what we assume in monolithic + req->cell[0].sys_info = calloc(1, sizeof(*req->cell[0].sys_info)); + AssertFatal(req->cell[0].sys_info != NULL, "out of memory\n"); + f1ap_gnb_du_system_info_t *sys_info = req->cell[0].sys_info; + sys_info->mib = calloc(buf_len, sizeof(*sys_info->mib)); + DevAssert(sys_info->mib != NULL); + DevAssert(mib != NULL); + sys_info->mib_length = encode_MIB_NR(mib, 0, sys_info->mib, buf_len); + DevAssert(sys_info->mib_length == buf_len); + + if (get_softmodem_params()->sa) { + // in NSA we don't transmit SIB1 + DevAssert(sib1 != NULL); + NR_SIB1_t *bcch_SIB1 = sib1->message.choice.c1->choice.systemInformationBlockType1; + sys_info->sib1 = calloc(NR_MAX_SIB_LENGTH / 8, sizeof(*sys_info->sib1)); + asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_SIB1, NULL, (void *)bcch_SIB1, sys_info->sib1, NR_MAX_SIB_LENGTH / 8); + AssertFatal(enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); + sys_info->sib1_length = (enc_rval.encoded + 7) / 8; + } + + return req; +} void RCconfig_nr_macrlc() { int j = 0; @@ -1013,8 +1133,6 @@ void RCconfig_nr_macrlc() { config.do_SRS, config.force_256qam_off ? "force off" : "may be on"); - // note: no need for PLMN info, it is read in RC_read_F1Setup() - NR_ServingCellConfigCommon_t *scc = get_scc_config(config.minRXTXTIME); //xer_fprint(stdout, &asn_DEF_NR_ServingCellConfigCommon, scc); NR_ServingCellConfig_t *scd = get_scd_config(); @@ -1104,14 +1222,24 @@ void RCconfig_nr_macrlc() { memcpy(RC.nrmac[j]->ulprbbl, prbbl, 275 * sizeof(prbbl[0])); } // for (j=0;jsa) + nr_mac_configure_sib1(RC.nrmac[0], &info.plmn, info.nr_cellid, *info.tac); + // read F1 Setup information from config and generated MIB/SIB1 // and store it at MAC for sending later NR_BCCH_BCH_Message_t *mib = RC.nrmac[0]->common_channels[0].mib; const NR_BCCH_DL_SCH_Message_t *sib1 = RC.nrmac[0]->common_channels[0].sib1; - f1ap_setup_req_t *req = RC_read_F1Setup(scc, mib, sib1); + f1ap_setup_req_t *req = RC_read_F1Setup(id, name, &info, scc, mib, sib1); AssertFatal(req != NULL, "could not read F1 Setup information\n"); RC.nrmac[0]->f1_config.setup_req = req; + free(name); /* read_du_cell_info() allocated memory */ + } else { // MacRLC_ParamList.numelt > 0 LOG_E(PHY, "No %s configuration found\n", CONFIG_STRING_MACRLC_LIST); // AssertFatal (0,"No " CONFIG_STRING_MACRLC_LIST " configuration found"); @@ -1924,111 +2052,6 @@ int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i) { return 0; } - -static f1ap_setup_req_t *RC_read_F1Setup(const NR_ServingCellConfigCommon_t *scc, NR_BCCH_BCH_Message_t *mib, const NR_BCCH_DL_SCH_Message_t *sib1) -{ - paramdef_t GNBSParams[] = GNBSPARAMS_DESC; - paramdef_t GNBParams[] = GNBPARAMS_DESC; - paramlist_def_t GNBParamList = {GNB_CONFIG_STRING_GNB_LIST,NULL,0}; - config_get( GNBSParams,sizeof(GNBSParams)/sizeof(paramdef_t),NULL); - int num_gnbs = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt; - AssertFatal(num_gnbs == 1, "cannot configure DU: required config section \"gNBs\" missing\n"); - - // Output a list of all eNBs. - config_getlist(&GNBParamList, GNBParams, sizeof(GNBParams) / sizeof(paramdef_t), NULL); - AssertFatal(GNBParamList.paramarray[0][GNB_GNB_ID_IDX].uptr != NULL, "gNB id %u is not defined in configuration file\n", 0); - - AssertFatal(strcmp(GNBSParams[GNB_ACTIVE_GNBS_IDX].strlistptr[0], *GNBParamList.paramarray[0][GNB_GNB_NAME_IDX].strptr) == 0, - "no active gNB found/mismatch of gNBs: %s vs %s\n", - GNBSParams[GNB_ACTIVE_GNBS_IDX].strlistptr[0], - *GNBParamList.paramarray[0][GNB_GNB_NAME_IDX].strptr); - - char aprefix[MAX_OPTNAME_SIZE * 2 + 8]; - sprintf(aprefix, "%s.[0]", GNB_CONFIG_STRING_GNB_LIST); - paramdef_t PLMNParams[] = GNBPLMNPARAMS_DESC; - paramlist_def_t PLMNParamList = {GNB_CONFIG_STRING_PLMN_LIST, NULL, 0}; - /* map parameter checking array instances to parameter definition array instances */ - checkedparam_t config_check_PLMNParams[] = PLMNPARAMS_CHECK; - - for (int I = 0; I < sizeof(PLMNParams) / sizeof(paramdef_t); ++I) - PLMNParams[I].chkPptr = &(config_check_PLMNParams[I]); - - config_getlist(&PLMNParamList, PLMNParams, sizeof(PLMNParams) / sizeof(paramdef_t), aprefix); - - f1ap_setup_req_t *req = calloc(1, sizeof(*req)); - req->num_cells_available = 1; - req->gNB_DU_id = *(GNBParamList.paramarray[0][GNB_GNB_ID_IDX].uptr); - req->gNB_DU_name = strdup(*(GNBParamList.paramarray[0][GNB_GNB_NAME_IDX].strptr)); - req->cell[0].info.tac = malloc(sizeof(*req->cell[0].info.tac)); - AssertFatal(req->cell[0].info.tac != NULL, "out of memory\n"); - *req->cell[0].info.tac = *GNBParamList.paramarray[0][GNB_TRACKING_AREA_CODE_IDX].uptr; - req->cell[0].info.plmn.mcc = *PLMNParamList.paramarray[0][GNB_MOBILE_COUNTRY_CODE_IDX].uptr; - req->cell[0].info.plmn.mnc = *PLMNParamList.paramarray[0][GNB_MOBILE_NETWORK_CODE_IDX].uptr; - req->cell[0].info.plmn.mnc_digit_length = *PLMNParamList.paramarray[0][GNB_MNC_DIGIT_LENGTH].u8ptr; - AssertFatal((req->cell[0].info.plmn.mnc_digit_length == 2) || (req->cell[0].info.plmn.mnc_digit_length == 3), - "BAD MNC DIGIT LENGTH %d", - req->cell[0].info.plmn.mnc_digit_length); - req->cell[0].info.nr_cellid = (uint64_t) * (GNBParamList.paramarray[0][GNB_NRCELLID_IDX].u64ptr); - LOG_I(GNB_APP, - "F1AP: gNB idx %d gNB_DU_id %ld, gNB_DU_name %s, TAC %d MCC/MNC/length %d/%d/%d cellID %ld\n", - 0, - req->gNB_DU_id, - req->gNB_DU_name, - *req->cell[0].info.tac, - req->cell[0].info.plmn.mcc, - req->cell[0].info.plmn.mnc, - req->cell[0].info.plmn.mnc_digit_length, - req->cell[0].info.nr_cellid); - - - req->cell[0].info.nr_pci = *scc->physCellId; - LOG_W(GNB_APP, "no slices transported via F1 Setup Request!\n"); - req->cell[0].info.num_ssi = 0; - - if (scc->tdd_UL_DL_ConfigurationCommon) { - LOG_I(GNB_APP, "ngran_DU: Configuring Cell %d for TDD\n", 0); - req->cell[0].info.mode = F1AP_MODE_TDD; - f1ap_tdd_info_t *tdd = &req->cell[0].info.tdd; - tdd->freqinfo.arfcn = scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA; - tdd->tbw.scs = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; - tdd->tbw.nrb = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; - tdd->freqinfo.band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; - } else { - LOG_I(GNB_APP, "ngran_DU: Configuring Cell %d for FDD\n", 0); - req->cell[0].info.mode = F1AP_MODE_FDD; - f1ap_fdd_info_t *fdd = &req->cell[0].info.fdd; - fdd->dl_freqinfo.arfcn = scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA; - fdd->ul_freqinfo.arfcn = *scc->uplinkConfigCommon->frequencyInfoUL->absoluteFrequencyPointA; - fdd->dl_tbw.scs = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; - fdd->ul_tbw.scs = scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing; - fdd->dl_tbw.nrb = scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; - fdd->ul_tbw.nrb = scc->uplinkConfigCommon->frequencyInfoUL->scs_SpecificCarrierList.list.array[0]->carrierBandwidth; - fdd->dl_freqinfo.band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; - fdd->ul_freqinfo.band = *scc->uplinkConfigCommon->frequencyInfoUL->frequencyBandList->list.array[0]; - } - - req->cell[0].info.measurement_timing_information = "0"; - - int buf_len = 3; // this is what we assume in monolithic - req->cell[0].sys_info = calloc(1, sizeof(*req->cell[0].sys_info)); - AssertFatal(req->cell[0].sys_info != NULL, "out of memory\n"); - f1ap_gnb_du_system_info_t *sys_info = req->cell[0].sys_info; - sys_info->mib = calloc(buf_len, sizeof(*sys_info->mib)); - DevAssert(sys_info->mib != NULL); - DevAssert(mib != NULL); - sys_info->mib_length = encode_MIB_NR(mib, 0, sys_info->mib, buf_len); - DevAssert(sys_info->mib_length == buf_len); - - DevAssert(sib1 != NULL); - NR_SIB1_t *bcch_SIB1 = sib1->message.choice.c1->choice.systemInformationBlockType1; - sys_info->sib1 = calloc(NR_MAX_SIB_LENGTH / 8, sizeof(*sys_info->sib1)); - asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_SIB1, NULL, (void *)bcch_SIB1, sys_info->sib1, NR_MAX_SIB_LENGTH / 8); - AssertFatal(enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); - sys_info->sib1_length = (enc_rval.encoded + 7) / 8; - - return req; -} - void wait_f1_setup_response(void) { gNB_MAC_INST *mac = RC.nrmac[0]; From a3f76309b3b2c198d09acdd733b74121450b0cf8 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 24 Aug 2023 10:05:53 +0200 Subject: [PATCH 46/63] Clean up CU&DU config files according to F1 Setup changes --- .../conf_files/gnb-cu.sa.band78.106prb.conf | 130 ------------------ .../gnb-cu.sa.band78.106prb.usrpb200.conf | 129 ----------------- ci-scripts/conf_files/gnb-cucp.sa.f1.conf | 130 ------------------ .../conf_files/gnb-cucp.sa.f1.quectel.conf | 130 ------------------ .../gnb-du.band78.106prb.rfsim.conf | 1 - .../gnb-du.sa.band78.106prb.usrpb200.conf | 1 - .../PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf | 129 ----------------- 7 files changed, 650 deletions(-) diff --git a/ci-scripts/conf_files/gnb-cu.sa.band78.106prb.conf b/ci-scripts/conf_files/gnb-cu.sa.band78.106prb.conf index f9040f2ce6..e7c5dd0514 100644 --- a/ci-scripts/conf_files/gnb-cu.sa.band78.106prb.conf +++ b/ci-scripts/conf_files/gnb-cu.sa.band78.106prb.conf @@ -19,7 +19,6 @@ gNBs = nr_cellid = 12345678L; - force_256qam_off = 1; tr_s_preference = "f1"; @@ -30,136 +29,7 @@ gNBs = local_s_portd = 2153; remote_s_portc = 500; remote_s_portd = 2153; - min_rxtxtime = 6; - - 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 = 28875; # 6366 12925 12956 28875 12952 -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - initialDLBWPsubcarrierSpacing = 1; - #pdcch-ConfigCommon - initialDLBWPcontrolResourceSetZero = 11; - initialDLBWPsearchSpaceZero = 0; - - #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 = 28875; -# 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 = -96; -#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, - - 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 : { diff --git a/ci-scripts/conf_files/gnb-cu.sa.band78.106prb.usrpb200.conf b/ci-scripts/conf_files/gnb-cu.sa.band78.106prb.usrpb200.conf index 8e8eacb9e6..3d716c81ef 100644 --- a/ci-scripts/conf_files/gnb-cu.sa.band78.106prb.usrpb200.conf +++ b/ci-scripts/conf_files/gnb-cu.sa.band78.106prb.usrpb200.conf @@ -19,7 +19,6 @@ gNBs = nr_cellid = 12345678L; - force_256qam_off = 1; tr_s_preference = "f1"; @@ -30,135 +29,7 @@ gNBs = local_s_portd = 2153; remote_s_portc = 500; remote_s_portd = 2153; - min_rxtxtime = 6; - 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 = 28875; # 6366 12925 12956 28875 12952 -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - initialDLBWPsubcarrierSpacing = 1; - #pdcch-ConfigCommon - initialDLBWPcontrolResourceSetZero = 11; - initialDLBWPsearchSpaceZero = 0; - - #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 = 28875; -# 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 = -96; -#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, - - 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 : { diff --git a/ci-scripts/conf_files/gnb-cucp.sa.f1.conf b/ci-scripts/conf_files/gnb-cucp.sa.f1.conf index f92ef6842c..5eb123dba1 100644 --- a/ci-scripts/conf_files/gnb-cucp.sa.f1.conf +++ b/ci-scripts/conf_files/gnb-cucp.sa.f1.conf @@ -20,7 +20,6 @@ gNBs = nr_cellid = 12345678L; - force_256qam_off = 1; tr_s_preference = "f1"; @@ -31,136 +30,7 @@ gNBs = local_s_portd = 2152; remote_s_portc = 500; remote_s_portd = 2152; - ssb_SubcarrierOffset = 0; - min_rxtxtime = 6; - 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 = 28875; # 6366 12925 12956 28875 12952 -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - initialDLBWPsubcarrierSpacing = 1; - #pdcch-ConfigCommon - initialDLBWPcontrolResourceSetZero = 11; - initialDLBWPsearchSpaceZero = 0; - - #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 = 28875; -# 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 = -96; -#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, - - 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 : { diff --git a/ci-scripts/conf_files/gnb-cucp.sa.f1.quectel.conf b/ci-scripts/conf_files/gnb-cucp.sa.f1.quectel.conf index c403de1b64..9d0c13cd74 100644 --- a/ci-scripts/conf_files/gnb-cucp.sa.f1.quectel.conf +++ b/ci-scripts/conf_files/gnb-cucp.sa.f1.quectel.conf @@ -20,7 +20,6 @@ gNBs = nr_cellid = 12345678L; - force_256qam_off = 1; tr_s_preference = "f1"; @@ -31,136 +30,7 @@ gNBs = local_s_portd = 2153; remote_s_portc = 500; remote_s_portd = 2153; - ssb_SubcarrierOffset = 0; - min_rxtxtime = 6; - 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 = 28875; # 6366 12925 12956 28875 12952 -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - initialDLBWPsubcarrierSpacing = 1; - #pdcch-ConfigCommon - initialDLBWPcontrolResourceSetZero = 11; - initialDLBWPsearchSpaceZero = 0; - - #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 = 28875; -# 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 = -96; -#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, - - 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 : { diff --git a/ci-scripts/conf_files/gnb-du.band78.106prb.rfsim.conf b/ci-scripts/conf_files/gnb-du.band78.106prb.rfsim.conf index 95b28a38ed..09f8d5007e 100644 --- a/ci-scripts/conf_files/gnb-du.band78.106prb.rfsim.conf +++ b/ci-scripts/conf_files/gnb-du.band78.106prb.rfsim.conf @@ -22,7 +22,6 @@ gNBs = ////////// Physical parameters: min_rxtxtime = 6; - force_256qam_off = 1; servingCellConfigCommon = ( { diff --git a/ci-scripts/conf_files/gnb-du.sa.band78.106prb.usrpb200.conf b/ci-scripts/conf_files/gnb-du.sa.band78.106prb.usrpb200.conf index b30bf92370..f7891902db 100644 --- a/ci-scripts/conf_files/gnb-du.sa.band78.106prb.usrpb200.conf +++ b/ci-scripts/conf_files/gnb-du.sa.band78.106prb.usrpb200.conf @@ -22,7 +22,6 @@ gNBs = ////////// Physical parameters: min_rxtxtime = 6; - force_256qam_off = 1; servingCellConfigCommon = ( diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf index 88742a5ffa..493680900c 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/cu_gnb.conf @@ -18,7 +18,6 @@ gNBs = plmn_list = ({ mcc = 208; mnc = 99; mnc_length = 2; snssaiList = ({ sst = 1 }) }); nr_cellid = 12345678L; - force_256qam_off = 1; tr_s_preference = "f1"; @@ -29,135 +28,7 @@ gNBs = local_s_portd = 2152; remote_s_portc = 500; remote_s_portd = 2152; - min_rxtxtime = 6; - 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 = 28875; # 6366 12925 12956 28875 12952 -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - initialDLBWPsubcarrierSpacing = 1; - #pdcch-ConfigCommon - initialDLBWPcontrolResourceSetZero = 12; - initialDLBWPsearchSpaceZero = 0; - - #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 = 28875; -# 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 = -96; -#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, - - 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 : { From fb72b7b9e535c5ee287de886c79cc0ab37387e20 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 17 Aug 2023 12:10:52 +0200 Subject: [PATCH 47/63] Add parameter verification to force simplified configuration files --- executables/nr-softmodem.c | 2 ++ openair2/GNB_APP/gnb_config.c | 58 +++++++++++++++++++++++++++++++++++ openair2/GNB_APP/gnb_config.h | 2 ++ 3 files changed, 62 insertions(+) diff --git a/executables/nr-softmodem.c b/executables/nr-softmodem.c index ff5f33e37b..8bffda8f61 100644 --- a/executables/nr-softmodem.c +++ b/executables/nr-softmodem.c @@ -298,6 +298,8 @@ static int create_gNB_tasks(ngran_node_t node_type) itti_wait_ready(1); LOG_I(PHY, "%s() Task ready initialize structures\n", __FUNCTION__); + RCconfig_verify(node_type); + RCconfig_NR_L1(); RCconfig_nr_prs(); diff --git a/openair2/GNB_APP/gnb_config.c b/openair2/GNB_APP/gnb_config.c index 28bdb9fce4..e190b21748 100644 --- a/openair2/GNB_APP/gnb_config.c +++ b/openair2/GNB_APP/gnb_config.c @@ -648,6 +648,64 @@ void fix_scd(NR_ServingCellConfig_t *scd) { } } +static void verify_gnb_param_notset(paramdef_t *params, int paramidx, const char *paramname) +{ + char aprefix[MAX_OPTNAME_SIZE * 2 + 8]; + sprintf(aprefix, "%s.[%i]", GNB_CONFIG_STRING_GNB_LIST, 0); + AssertFatal(!config_isparamset(params, paramidx), + "Option \"%s." GNB_CONFIG_STRING_SERVINGCELLCONFIGCOMMON + ".%s\" is not allowed in this config, please remove it\n", + aprefix, + paramname); +} +static void verify_section_notset(char *aprefix, const char *secname) +{ + paramlist_def_t pl = {0}; + strncpy(pl.listname, secname, sizeof(pl.listname) - 1); + config_getlist(&pl, NULL, 0, aprefix); + AssertFatal(pl.numelt == 0, "Section \"%s.%s\" not allowed in this config, please remove it\n", aprefix ? aprefix : "", secname); +} +void RCconfig_verify(ngran_node_t node_type) +{ + paramdef_t GNBSParams[] = GNBSPARAMS_DESC; + config_get(GNBSParams, sizeof(GNBSParams) / sizeof(paramdef_t), NULL); + int num_gnbs = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt; + AssertFatal(num_gnbs == 1, "need to have a " GNB_CONFIG_STRING_GNB_LIST " section, but %d found\n", num_gnbs); + paramlist_def_t GNBParamList = {GNB_CONFIG_STRING_GNB_LIST, NULL, 0}; + paramdef_t GNBParams[] = GNBPARAMS_DESC; + config_getlist(&GNBParamList, GNBParams, sizeof(GNBParams) / sizeof(paramdef_t), NULL); + paramdef_t *gnbp = GNBParamList.paramarray[0]; + + if (NODE_IS_CU(node_type)) { + // verify that there is no SCC and radio config in the case of CU + verify_section_notset(GNB_CONFIG_STRING_GNB_LIST ".[0]", GNB_CONFIG_STRING_SERVINGCELLCONFIGCOMMON); + + verify_gnb_param_notset(gnbp, GNB_PDSCH_ANTENNAPORTS_N1_IDX, GNB_CONFIG_STRING_PDSCHANTENNAPORTS_N1); + verify_gnb_param_notset(gnbp, GNB_PDSCH_ANTENNAPORTS_N2_IDX, GNB_CONFIG_STRING_PDSCHANTENNAPORTS_N2); + verify_gnb_param_notset(gnbp, GNB_PDSCH_ANTENNAPORTS_XP_IDX, GNB_CONFIG_STRING_PDSCHANTENNAPORTS_XP); + verify_gnb_param_notset(gnbp, GNB_PUSCH_ANTENNAPORTS_IDX, GNB_CONFIG_STRING_PUSCHANTENNAPORTS); + verify_gnb_param_notset(gnbp, GNB_MINRXTXTIME_IDX, GNB_CONFIG_STRING_MINRXTXTIME); + verify_gnb_param_notset(gnbp, GNB_SIB1_TDA_IDX, GNB_CONFIG_STRING_SIB1TDA); + verify_gnb_param_notset(gnbp, GNB_DO_CSIRS_IDX, GNB_CONFIG_STRING_DOCSIRS); + verify_gnb_param_notset(gnbp, GNB_DO_SRS_IDX, GNB_CONFIG_STRING_DOSRS); + verify_gnb_param_notset(gnbp, GNB_FORCE256QAMOFF_IDX, GNB_CONFIG_STRING_FORCE256QAMOFF); + + // check for some general sections + verify_section_notset(NULL, CONFIG_STRING_L1_LIST); + verify_section_notset(NULL, CONFIG_STRING_RU_LIST); + verify_section_notset(NULL, CONFIG_STRING_MACRLC_LIST); + } else if (NODE_IS_DU(node_type)) { + // verify that there is no bearer config + verify_gnb_param_notset(gnbp, GNB_ENABLE_SDAP_IDX, GNB_CONFIG_STRING_ENABLE_SDAP); + verify_gnb_param_notset(gnbp, GNB_DRBS, GNB_CONFIG_STRING_DRBS); + + verify_section_notset(GNB_CONFIG_STRING_GNB_LIST ".", GNB_CONFIG_STRING_AMF_IP_ADDRESS); + verify_section_notset(NULL, CONFIG_STRING_SECURITY); + } // else nothing to be checked + + /* other possible verifications: PNF, VNF, CU-CP, CU-UP, ...? */ +} + void RCconfig_nr_prs(void) { uint16_t j = 0, k = 0; diff --git a/openair2/GNB_APP/gnb_config.h b/openair2/GNB_APP/gnb_config.h index 0999fb2d3c..6cd7d53c92 100644 --- a/openair2/GNB_APP/gnb_config.h +++ b/openair2/GNB_APP/gnb_config.h @@ -91,6 +91,8 @@ typedef struct ru_config_s { uint8_t if_compress; } ru_config_t; */ + +void RCconfig_verify(ngran_node_t node_type); extern void NRRCconfig_RU(void); extern void RCconfig_nr_prs(void); extern void RCconfig_NR_L1(void); From 7e2487c29412d6490a10b7c8c5f74783fcf6399f Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 18 Aug 2023 16:20:29 +0200 Subject: [PATCH 48/63] Handle CellGroupConfig completely at MAC - MAC creates CellGroupConfig and sends to RRC - the RRC does not manually update the CellGroupConfig - MAC handles the RRC processing timer In this commit, any updates to the CellGroupConfig previously done at the RRC don't work. In other words, MIMO etc don't work; this is implemented in the next commit. Note that the change to take out spCellConfig during reestablishment is because after reestablishment, as per spec (38.331 5.3.7.2), the UE should drop the spCellConfig, which we generate by default on the first UE connection. Furthermore, add a new variable apply_cellgroup to signal if, after RRC processing timer, we wish to apply the CellGroup. In some situations, e.g., Msg.4 ack, we do not want to apply the CellGroup, because for instance in reestablishment, we await for a reconfiguration of cellgroup that would be triggered too early. --- openair2/LAYER2/NR_MAC_gNB/config.c | 58 ++-------- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 9 +- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 109 ++++++++++++------ openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 9 +- .../LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c | 78 ++++++------- openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 5 +- openair2/RRC/NR/L2_nr_interface.c | 8 -- openair2/RRC/NR/nr_rrc_proto.h | 2 - openair2/RRC/NR/rrc_gNB.c | 82 ------------- 9 files changed, 129 insertions(+), 231 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index a04ffad88d..9710a90518 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -443,36 +443,6 @@ static void config_common(gNB_MAC_INST *nrmac, int pdsch_AntennaPorts, int pusch } } -int nr_mac_enable_ue_rrc_processing_timer(module_id_t Mod_idP, rnti_t rnti, NR_SubcarrierSpacing_t subcarrierSpacing, uint32_t rrc_reconfiguration_delay) -{ - if (rrc_reconfiguration_delay == 0) { - return -1; - } - - gNB_MAC_INST *nrmac = RC.nrmac[Mod_idP]; - NR_SCHED_LOCK(&nrmac->sched_lock); - - NR_UE_info_t *UE_info = find_nr_UE(&nrmac->UE_info,rnti); - if (!UE_info) { - LOG_W(NR_MAC, "Could not find UE for RNTI 0x%04x\n", rnti); - NR_SCHED_UNLOCK(&nrmac->sched_lock); - return -1; - } - NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl; - const uint16_t sl_ahead = nrmac->if_inst->sl_ahead; - sched_ctrl->rrc_processing_timer = (rrc_reconfiguration_delay<rnti, rrc_reconfiguration_delay); - - // it might happen that timing advance command should be sent during the RRC - // processing timer. To prevent this, set a variable as if we would have just - // sent it. This way, another TA command will for sure be sent in some - // frames, after RRC processing timer. - sched_ctrl->ta_frame = (nrmac->frame - 1 + 1024) % 1024; - - NR_SCHED_UNLOCK(&nrmac->sched_lock); - return 0; -} - void nr_mac_config_scc(gNB_MAC_INST *nrmac, NR_ServingCellConfigCommon_t *scc, const nr_mac_config_t *config) { DevAssert(nrmac != NULL); @@ -626,28 +596,24 @@ bool nr_mac_prepare_ra_ue(gNB_MAC_INST *nrmac, uint32_t rnti, NR_CellGroupConfig return true; } -bool nr_mac_update_cellgroup(gNB_MAC_INST *nrmac, uint32_t rnti, NR_CellGroupConfig_t *CellGroup) +/* Prepare a new CellGroupConfig to be applied for this UE. We cannot + * immediatly apply it, as we have to wait for the reconfiguration through RRC. + * This function sets up everything to apply the reconfiguration. Later, we + * will trigger the timer with nr_mac_enable_ue_rrc_processing_timer(); upon + * expiry nr_mac_apply_cellgroup() will apply the CellGroupConfig (radio config + * etc). */ +bool nr_mac_prepare_cellgroup_update(gNB_MAC_INST *nrmac, NR_UE_info_t *UE, NR_CellGroupConfig_t *CellGroup) { DevAssert(nrmac != NULL); + DevAssert(UE != NULL); + DevAssert(CellGroup != NULL); + /* we assume that this function is mutex-protected from outside */ NR_SCHED_ENSURE_LOCKED(&nrmac->sched_lock); - DevAssert(CellGroup != NULL); - - NR_UE_info_t *UE = find_nr_UE(&nrmac->UE_info, rnti); - AssertFatal(UE != NULL, "Can't find UE %04x for CellGroup update\n", rnti); - - /* copy CellGroup by calling asn1c encode this is a temporary hack to avoid the gNB having a pointer to RRC CellGroup structure - * (otherwise it would be applied to early) - * TODO remove once we have a proper implementation */ - UE->enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig, NULL, (void *)CellGroup, UE->cg_buf, 32768); - - if (UE->enc_rval.encoded == -1) { - LOG_E(NR_MAC, "ASN1 message CellGroupConfig encoding failed (%s, %lu)!\n", UE->enc_rval.failed_type->name, UE->enc_rval.encoded); - exit(1); - } - process_CellGroup(CellGroup, UE); + UE->reconfigCellGroup = CellGroup; + UE->expect_reconfiguration = true; return true; } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 19a1a0d34b..71dd7731e5 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -1893,14 +1893,9 @@ static void nr_check_Msg4_Ack(module_id_t module_id, int CC_id, frame_t frame, s // Pause scheduling according to: // 3GPP TS 38.331 Section 12 Table 12.1-1: UE performance requirements for RRC procedures for UEs - const NR_ServingCellConfig_t *servingCellConfig = UE->CellGroup && UE->CellGroup->spCellConfig ? UE->CellGroup->spCellConfig->spCellConfigDedicated : NULL; - uint32_t delay_ms = servingCellConfig && servingCellConfig->downlinkBWP_ToAddModList ? - NR_RRC_SETUP_DELAY_MS + NR_RRC_BWP_SWITCHING_DELAY_MS : NR_RRC_SETUP_DELAY_MS; - - sched_ctrl->rrc_processing_timer = (delay_ms << ra->DL_BWP.scs); - LOG_I(NR_MAC, "(%d.%d) Activating RRC processing timer for UE %04x with %d ms\n", frame, slot, UE->rnti, delay_ms); + nr_mac_enable_ue_rrc_processing_timer(RC.nrmac[module_id], UE, false); } else { - LOG_I(NR_MAC, "(ue rnti 0x%04x) RA Procedure failed at Msg4!\n", ra->rnti); + LOG_I(NR_MAC, "%4d.%2d UE %04x: RA Procedure failed at Msg4!\n", frame, slot, ra->rnti); } nr_clear_ra_proc(module_id, CC_id, frame, ra); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 9955b240b3..07c8da3092 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -1946,6 +1946,8 @@ int get_nrofHARQ_ProcessesForPDSCH(e_NR_PDSCH_ServingCellConfig__nrofHARQ_Proces void delete_nr_ue_data(NR_UE_info_t *UE, NR_COMMON_channels_t *ccPtr, uid_allocator_t *uia) { + ASN_STRUCT_FREE(asn_DEF_NR_CellGroupConfig, UE->CellGroup); + ASN_STRUCT_FREE(asn_DEF_NR_CellGroupConfig, UE->reconfigCellGroup); NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl; destroy_nr_list(&sched_ctrl->available_dl_harq); destroy_nr_list(&sched_ctrl->feedback_dl_harq); @@ -2727,20 +2729,80 @@ void nr_csirs_scheduling(int Mod_idP, frame_t frame, sub_frame_t slot, int n_slo } } +static void nr_mac_apply_cellgroup(gNB_MAC_INST *mac, NR_UE_info_t *UE, frame_t frame, sub_frame_t slot) +{ + LOG_I(NR_MAC, "%4d.%2d RNTI %04x: RRC processing timer expired\n", frame, slot, UE->rnti); + + /* check if there is a new CellGroupConfig to be applied */ + if (UE->apply_cellgroup && UE->reconfigCellGroup != NULL) { + LOG_I(NR_MAC, "%4d.%2d RNTI %04x: Apply CellGroupConfig after RRC processing timer expiry\n", frame, slot, UE->rnti); + ASN_STRUCT_FREE(asn_DEF_NR_CellGroupConfig, UE->CellGroup); + UE->CellGroup = UE->reconfigCellGroup; + UE->reconfigCellGroup = NULL; + UE->apply_cellgroup = false; + + if (LOG_DEBUGFLAG(DEBUG_ASN1)) + xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void *)UE->CellGroup); + } + + NR_ServingCellConfigCommon_t *scc = mac->common_channels[0].ServingCellConfigCommon; + + /* Note! we already did process_CellGroup(), so no need to do this again */ + NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl; + configure_UE_BWP(mac, scc, sched_ctrl, NULL, UE, -1, -1); + + reset_srs_stats(UE); + + if (get_softmodem_params()->sa) { + // add all available DL HARQ processes for this UE in SA + create_dl_harq_list(sched_ctrl, UE->current_DL_BWP.pdsch_servingcellconfig); + } +} + +int nr_mac_enable_ue_rrc_processing_timer(gNB_MAC_INST *mac, NR_UE_info_t *UE, bool apply_cellgroup) +{ + DevAssert(mac != NULL); + DevAssert(UE != NULL); + NR_SCHED_ENSURE_LOCKED(&mac->sched_lock); + + const uint16_t sl_ahead = mac->if_inst->sl_ahead; + // TODO: account for BWP switch with NR_RRC_BWP_SWITCHING_DELAY_MS + int delay = NR_RRC_RECONFIGURATION_DELAY_MS; + NR_SubcarrierSpacing_t scs = UE->current_UL_BWP.scs; + + UE->UE_sched_ctrl.rrc_processing_timer = (delay << scs) + sl_ahead; + UE->apply_cellgroup = apply_cellgroup; + AssertFatal(!UE->apply_cellgroup || (UE->apply_cellgroup && UE->reconfigCellGroup), + "logic bug: apply_cellgroup %d and UE->reconfigCellGroup %p: did you try to apply a cellGroup, while none is deposited?\n", + UE->apply_cellgroup, + UE->reconfigCellGroup); + + // it might happen that timing advance command should be sent during the RRC + // processing timer. To prevent this, set a variable as if we would have just + // sent it. This way, another TA command will for sure be sent in some + // frames, after RRC processing timer. + UE->UE_sched_ctrl.ta_frame = (mac->frame - 1 + 1024) % 1024; + + LOG_I(NR_MAC, "%4d.%2d UE %04x: Activate RRC processing timer (%d ms)\n", mac->frame, mac->slot, UE->rnti, delay); + return 0; +} + void nr_mac_update_timers(module_id_t module_id, frame_t frame, sub_frame_t slot) { - /* already mutex protected: held in gNB_dlsch_ulsch_scheduler() */ - NR_SCHED_ENSURE_LOCKED(&RC.nrmac[module_id]->sched_lock); + gNB_MAC_INST *mac = RC.nrmac[module_id]; - NR_UEs_t *UE_info = &RC.nrmac[module_id]->UE_info; + /* already mutex protected: held in gNB_dlsch_ulsch_scheduler() */ + NR_SCHED_ENSURE_LOCKED(&mac->sched_lock); + + NR_UEs_t *UE_info = &mac->UE_info; UE_iterator(UE_info->list, UE) { NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl; if (nr_mac_check_release(sched_ctrl, UE->rnti)) { nr_rlc_remove_ue(UE->rnti); - mac_remove_nr_ue(RC.nrmac[module_id], UE->rnti); + mac_remove_nr_ue(mac, UE->rnti); // go back to examine the next UE, which is at the position the // current UE was UE--; @@ -2748,41 +2810,12 @@ void nr_mac_update_timers(module_id_t module_id, } /* check if UL failure and trigger release request if necessary */ - nr_mac_check_ul_failure(RC.nrmac[module_id], UE->rnti, sched_ctrl); + nr_mac_check_ul_failure(mac, UE->rnti, sched_ctrl); if (sched_ctrl->rrc_processing_timer > 0) { sched_ctrl->rrc_processing_timer--; - if (sched_ctrl->rrc_processing_timer == 0) { - LOG_I(NR_MAC, "(%d.%d) De-activating RRC processing timer for UE %04x\n", frame, slot, UE->rnti); - - reset_srs_stats(UE); - - NR_CellGroupConfig_t *cg = NULL; - uper_decode(NULL, - &asn_DEF_NR_CellGroupConfig, // might be added prefix later - (void **)&cg, - (uint8_t *)UE->cg_buf, - (UE->enc_rval.encoded + 7) / 8, - 0, - 0); - UE->CellGroup = cg; - - if (LOG_DEBUGFLAG(DEBUG_ASN1)) { - xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void *) UE->CellGroup); - } - - NR_ServingCellConfigCommon_t *scc = RC.nrmac[module_id]->common_channels[0].ServingCellConfigCommon; - - LOG_I(NR_MAC,"Modified rnti %04x with CellGroup\n", UE->rnti); - process_CellGroup(cg, UE); - NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl; - configure_UE_BWP(RC.nrmac[module_id], scc, sched_ctrl, NULL, UE, -1, -1); - - if (get_softmodem_params()->sa) { - // add all available DL HARQ processes for this UE in SA - create_dl_harq_list(sched_ctrl, UE->current_DL_BWP.pdsch_servingcellconfig); - } - } + if (sched_ctrl->rrc_processing_timer == 0) + nr_mac_apply_cellgroup(mac, UE, frame, slot); } // RA timer @@ -2790,7 +2823,7 @@ void nr_mac_update_timers(module_id_t module_id, UE->ra_timer--; if (UE->ra_timer == 0) { LOG_W(NR_MAC, "Removing UE %04x because RA timer expired\n", UE->rnti); - mac_remove_nr_ue(RC.nrmac[module_id], UE->rnti); + mac_remove_nr_ue(mac, UE->rnti); } } } @@ -2890,7 +2923,7 @@ void prepare_initial_ul_rrc_message(gNB_MAC_INST *mac, NR_UE_info_t *UE) NR_CellGroupConfig_t *cellGroupConfig = get_initial_cellGroupConfig(UE->uid, scc, sccd, &mac->radio_config); UE->CellGroup = cellGroupConfig; - nr_mac_update_cellgroup(mac, UE->rnti, cellGroupConfig); + process_CellGroup(cellGroupConfig, UE); /* activate SRB0 */ nr_rlc_activate_srb0(UE->rnti, mac, UE, send_initial_ul_rrc_message); diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 386788170b..3b4a73a670 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -44,17 +44,14 @@ void mac_top_init_gNB(ngran_node_t node_type, const nr_mac_config_t *conf); void nr_mac_send_f1_setup_req(void); -int nr_mac_enable_ue_rrc_processing_timer(module_id_t Mod_idP, - rnti_t rnti, - NR_SubcarrierSpacing_t subcarrierSpacing, - uint32_t rrc_reconfiguration_delay); - void nr_mac_config_scc(gNB_MAC_INST *nrmac, NR_ServingCellConfigCommon_t *scc, const nr_mac_config_t *mac_config); void nr_mac_configure_sib1(gNB_MAC_INST *nrmac, const f1ap_plmn_t *plmn, uint64_t cellID, int tac); bool nr_mac_add_test_ue(gNB_MAC_INST *nrmac, uint32_t rnti, NR_CellGroupConfig_t *CellGroup); bool nr_mac_prepare_ra_ue(gNB_MAC_INST *nrmac, uint32_t rnti, NR_CellGroupConfig_t *CellGroup); -bool nr_mac_update_cellgroup(gNB_MAC_INST *nrmac, uint32_t rnti, NR_CellGroupConfig_t *CellGroup); + +bool nr_mac_prepare_cellgroup_update(gNB_MAC_INST *nrmac, NR_UE_info_t *UE, NR_CellGroupConfig_t *CellGroup); +int nr_mac_enable_ue_rrc_processing_timer(gNB_MAC_INST *mac, NR_UE_info_t *UE, bool apply_cellGroup); void clear_nr_nfapi_information(gNB_MAC_INST *gNB, int CC_idP, diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c index c6dfab563a..71d2ecc36a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c +++ b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c @@ -138,6 +138,18 @@ static int handle_ue_context_drbs_setup(int rnti, return drbs_len; } +static NR_CellGroupConfig_t *clone_CellGroupConfig(const NR_CellGroupConfig_t *orig) +{ + uint8_t buf[16636]; + asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig, NULL, orig, buf, sizeof(buf)); + AssertFatal(enc_rval.encoded > 0, "could not clone CellGroupConfig: problem while encoding\n"); + NR_CellGroupConfig_t *cloned = NULL; + asn_dec_rval_t dec_rval = uper_decode(NULL, &asn_DEF_NR_CellGroupConfig, (void **)&cloned, buf, enc_rval.encoded, 0, 0); + AssertFatal(dec_rval.code == RC_OK && dec_rval.consumed == enc_rval.encoded, + "could not clone CellGroupConfig: problem while decodung\n"); + return cloned; +} + void ue_context_setup_request(const f1ap_ue_context_setup_t *req) { gNB_MAC_INST *mac = RC.nrmac[0]; @@ -158,12 +170,14 @@ void ue_context_setup_request(const f1ap_ue_context_setup_t *req) NR_UE_info_t *UE = find_nr_UE(&RC.nrmac[0]->UE_info, req->gNB_DU_ue_id); AssertFatal(UE != NULL, "did not find UE with RNTI %04x, but UE Context Setup Failed not implemented\n", req->gNB_DU_ue_id); + NR_CellGroupConfig_t *new_CellGroup = clone_CellGroupConfig(UE->CellGroup); + if (req->srbs_to_be_setup_length > 0) { resp.srbs_to_be_setup_length = handle_ue_context_srbs_setup(req->gNB_DU_ue_id, req->srbs_to_be_setup_length, req->srbs_to_be_setup, &resp.srbs_to_be_setup, - UE->CellGroup); + new_CellGroup); } if (req->drbs_to_be_setup_length > 0) { @@ -171,7 +185,7 @@ void ue_context_setup_request(const f1ap_ue_context_setup_t *req) req->drbs_to_be_setup_length, req->drbs_to_be_setup, &resp.drbs_to_be_setup, - UE->CellGroup); + new_CellGroup); } if (req->rrc_container != NULL) @@ -182,16 +196,13 @@ void ue_context_setup_request(const f1ap_ue_context_setup_t *req) AssertFatal(resp.du_to_cu_rrc_information != NULL, "out of memory\n"); resp.du_to_cu_rrc_information->cellGroupConfig = calloc(1,1024); AssertFatal(resp.du_to_cu_rrc_information->cellGroupConfig != NULL, "out of memory\n"); - asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig, - NULL, - UE->CellGroup, - resp.du_to_cu_rrc_information->cellGroupConfig, - 1024); + asn_enc_rval_t enc_rval = + uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig, NULL, new_CellGroup, resp.du_to_cu_rrc_information->cellGroupConfig, 1024); AssertFatal(enc_rval.encoded > 0, "Could not encode CellGroup, failed element %s\n", enc_rval.failed_type->name); resp.du_to_cu_rrc_information->cellGroupConfig_length = (enc_rval.encoded + 7) >> 3; /* TODO: need to apply after UE context reconfiguration confirmed? */ - process_CellGroup(UE->CellGroup, UE); + nr_mac_prepare_cellgroup_update(mac, UE, new_CellGroup); NR_SCHED_UNLOCK(&mac->sched_lock); @@ -226,12 +237,14 @@ void ue_context_modification_request(const f1ap_ue_context_modif_req_t *req) NR_SCHED_LOCK(&mac->sched_lock); NR_UE_info_t *UE = find_nr_UE(&RC.nrmac[0]->UE_info, req->gNB_DU_ue_id); + NR_CellGroupConfig_t *new_CellGroup = clone_CellGroupConfig(UE->CellGroup); + if (req->srbs_to_be_setup_length > 0) { resp.srbs_to_be_setup_length = handle_ue_context_srbs_setup(req->gNB_DU_ue_id, req->srbs_to_be_setup_length, req->srbs_to_be_setup, &resp.srbs_to_be_setup, - UE->CellGroup); + new_CellGroup); } if (req->drbs_to_be_setup_length > 0) { @@ -239,7 +252,7 @@ void ue_context_modification_request(const f1ap_ue_context_modif_req_t *req) req->drbs_to_be_setup_length, req->drbs_to_be_setup, &resp.drbs_to_be_setup, - UE->CellGroup); + new_CellGroup); } if (req->rrc_container != NULL) @@ -251,23 +264,21 @@ void ue_context_modification_request(const f1ap_ue_context_modif_req_t *req) } if (req->srbs_to_be_setup_length > 0 || req->drbs_to_be_setup_length > 0) { - /* TODO: if we change e.g. BWP or MCS table, need to automatically call - * configure_UE_BWP() (form nr_mac_update_timers()) after some time? */ - resp.du_to_cu_rrc_information = calloc(1, sizeof(du_to_cu_rrc_information_t)); AssertFatal(resp.du_to_cu_rrc_information != NULL, "out of memory\n"); resp.du_to_cu_rrc_information->cellGroupConfig = calloc(1, 1024); AssertFatal(resp.du_to_cu_rrc_information->cellGroupConfig != NULL, "out of memory\n"); asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig, NULL, - UE->CellGroup, + new_CellGroup, resp.du_to_cu_rrc_information->cellGroupConfig, 1024); AssertFatal(enc_rval.encoded > 0, "Could not encode CellGroup, failed element %s\n", enc_rval.failed_type->name); resp.du_to_cu_rrc_information->cellGroupConfig_length = (enc_rval.encoded + 7) >> 3; - /* works? */ - nr_mac_update_cellgroup(RC.nrmac[0], req->gNB_DU_ue_id, UE->CellGroup); + nr_mac_prepare_cellgroup_update(mac, UE, new_CellGroup); + } else { + ASN_STRUCT_FREE(asn_DEF_NR_CellGroupConfig, new_CellGroup); // we actually don't need it } NR_SCHED_UNLOCK(&mac->sched_lock); @@ -398,26 +409,13 @@ void dl_rrc_message_transfer(const f1ap_dl_rrc_message_t *dl_rrc) if (UE->expect_reconfiguration && dl_rrc->srb_id == DCCH) { /* we expected a reconfiguration, and this is on DCCH. We assume this is - * the reconfiguration; nr_mac_update_cellgroup() brings the config into - * the form expected by nr_mac_update_timers(), and we set the timer to - * apply the real configuration at expiration. - * Calling it nr_mac_update_cellgroup() is misleading, and using an - * intermediate buffer seems not necessary. This is for historical reasons, - * when we only had pointer to an RRC structure, and wanted to duplicate - * the contents to be applied later. The actually interesting function here - * is also configure_UE_BWP(), only called in nr_mac_update_timers(). - * TODO: This should be cleaned up when the whole CellGroupConfig is - * handled entirely at the DU: no intermediate buffer, trigger the timer - * from a function (there is nr_mac_enable_ue_rrc_processing_timer(), which - * is called from the RRC, hence locks the scheduler, which we cannot use). */ - LOG_I(NR_MAC, "triggering rrc_processing_timer time UE %04x\n", UE->rnti); - pthread_mutex_lock(&mac->sched_lock); - nr_mac_update_cellgroup(mac, dl_rrc->gNB_DU_ue_id, UE->reconfigCellGroup); - pthread_mutex_unlock(&mac->sched_lock); - const uint16_t sl_ahead = mac->if_inst->sl_ahead; - NR_SubcarrierSpacing_t scs = 1; - int delay = 10; - UE->UE_sched_ctrl.rrc_processing_timer = (delay << scs) + sl_ahead; + * the reconfiguration: nr_mac_prepare_cellgroup_update() already stored + * the CellGroupConfig. Below, we trigger a timer, and the CellGroupConfig + * will be applied after its expiry in nr_mac_apply_cellgroup().*/ + NR_SCHED_LOCK(&mac->sched_lock); + nr_mac_enable_ue_rrc_processing_timer(mac, UE, /* apply_cellGroup = */ true); + NR_SCHED_UNLOCK(&mac->sched_lock); + UE->expect_reconfiguration = false; } if (dl_rrc->old_gNB_DU_ue_id != NULL) { @@ -433,9 +431,11 @@ void dl_rrc_message_transfer(const f1ap_dl_rrc_message_t *dl_rrc) * from the current configuration. Also, expect the reconfiguration from * the CU, so save the old UE's CellGroup for the new UE */ UE->CellGroup->spCellConfig = NULL; - nr_mac_update_cellgroup(mac, dl_rrc->gNB_DU_ue_id, UE->CellGroup); - UE->reconfigCellGroup = oldUE->CellGroup; - UE->expect_reconfiguration = true; + NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl; + NR_ServingCellConfigCommon_t *scc = mac->common_channels[0].ServingCellConfigCommon; + configure_UE_BWP(mac, scc, sched_ctrl, NULL, UE, -1, -1); + + nr_mac_prepare_cellgroup_update(mac, UE, oldUE->CellGroup); oldUE->CellGroup = NULL; mac_remove_nr_ue(mac, *dl_rrc->old_gNB_DU_ue_id); pthread_mutex_unlock(&mac->sched_lock); diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index 53406b2f87..d7c38f3179 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -700,10 +700,9 @@ typedef struct { /// currently active CellGroupConfig NR_CellGroupConfig_t *CellGroup; /// CellGroupConfig that is to be activated after the next reconfiguration - NR_CellGroupConfig_t *reconfigCellGroup; bool expect_reconfiguration; - char cg_buf[32768]; /* arbitrary size */ - asn_enc_rval_t enc_rval; + NR_CellGroupConfig_t *reconfigCellGroup; + bool apply_cellgroup; // UE selected beam index uint8_t UE_beam_index; bool Msg4_ACKed; diff --git a/openair2/RRC/NR/L2_nr_interface.c b/openair2/RRC/NR/L2_nr_interface.c index a3bc40dc9c..090486cf65 100644 --- a/openair2/RRC/NR/L2_nr_interface.c +++ b/openair2/RRC/NR/L2_nr_interface.c @@ -52,14 +52,6 @@ extern RAN_CONTEXT_t RC; -void nr_rrc_mac_update_cellgroup(rnti_t rntiMaybeUEid, NR_CellGroupConfig_t *cgc) -{ - gNB_MAC_INST *nrmac = RC.nrmac[0]; - NR_SCHED_LOCK(&nrmac->sched_lock); - nr_mac_update_cellgroup(nrmac, rntiMaybeUEid, cgc); - NR_SCHED_UNLOCK(&nrmac->sched_lock); -} - int8_t nr_mac_rrc_bwp_switch_req(const module_id_t module_idP, const frame_t frameP, const sub_frame_t sub_frameP, diff --git a/openair2/RRC/NR/nr_rrc_proto.h b/openair2/RRC/NR/nr_rrc_proto.h index 69f71316ba..d132b8291d 100644 --- a/openair2/RRC/NR/nr_rrc_proto.h +++ b/openair2/RRC/NR/nr_rrc_proto.h @@ -110,8 +110,6 @@ void *rrc_gnb_task(void *args_p); \ *reOffset Pointer to RE Offset Value */ void rrc_config_dl_ptrs_params(NR_BWP_Downlink_t *bwp, long *ptrsNrb, long *ptrsMcs, long *epre_Ratio, long *reOffset); -void nr_rrc_mac_update_cellgroup(rnti_t rntiMaybeUEid, NR_CellGroupConfig_t *cgc); - int8_t nr_mac_rrc_bwp_switch_req(const module_id_t module_idP, const frame_t frameP, const sub_frame_t sub_frameP, diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 07c951c4e2..1b00e380a2 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -45,7 +45,6 @@ #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" #include "LAYER2/NR_MAC_gNB/mac_proto.h" #include "common/utils/LOG/log.h" -#include "COMMON/mac_rrc_primitives.h" #include "RRC/NR/MESSAGES/asn1_msg.h" #include "NR_BCCH-BCH-Message.h" @@ -605,21 +604,6 @@ static void rrc_gNB_generate_defaultRRCReconfiguration(const protocol_ctxt_t *co AssertFatal(!NODE_IS_DU(rrc->node_type), "illegal node type DU!\n"); nr_rrc_transfer_protected_rrc_message(rrc, ue_p, DCCH, buffer, size); - - if (NODE_IS_DU(rrc->node_type) || NODE_IS_MONOLITHIC(rrc->node_type)) { - gNB_RRC_UE_t *ue_p = &ue_context_pP->ue_context; - nr_rrc_mac_update_cellgroup(ue_p->rnti, ue_p->masterCellGroup); - - uint32_t delay_ms = ue_p->masterCellGroup && ue_p->masterCellGroup->spCellConfig && ue_p->masterCellGroup->spCellConfig->spCellConfigDedicated - && ue_p->masterCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList - ? NR_RRC_RECONFIGURATION_DELAY_MS + NR_RRC_BWP_SWITCHING_DELAY_MS - : NR_RRC_RECONFIGURATION_DELAY_MS; - - const nr_rrc_du_container_t *du = rrc->du; - DevAssert(du != NULL); - int scs = get_ssb_scs(&du->setup_req->cell[0].info); - nr_mac_enable_ue_rrc_processing_timer(ctxt_pP->module_id, ue_p->rnti, scs, delay_ms); - } } //----------------------------------------------------------------------------- @@ -713,20 +697,6 @@ void rrc_gNB_generate_dedicatedRRCReconfiguration(const protocol_ctxt_t *const c DCCH); nr_rrc_transfer_protected_rrc_message(rrc, ue_p, DCCH, buffer, size); - - if (NODE_IS_DU(rrc->node_type) || NODE_IS_MONOLITHIC(rrc->node_type)) { - nr_rrc_mac_update_cellgroup(ue_context_pP->ue_context.rnti, ue_context_pP->ue_context.masterCellGroup); - - uint32_t delay_ms = ue_p->masterCellGroup && ue_p->masterCellGroup->spCellConfig && ue_p->masterCellGroup->spCellConfig->spCellConfigDedicated - && ue_p->masterCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList - ? NR_RRC_RECONFIGURATION_DELAY_MS + NR_RRC_BWP_SWITCHING_DELAY_MS - : NR_RRC_RECONFIGURATION_DELAY_MS; - - const nr_rrc_du_container_t *du = rrc->du; - DevAssert(du != NULL); - int scs = get_ssb_scs(&du->setup_req->cell[0].info); - nr_mac_enable_ue_rrc_processing_timer(ctxt_pP->module_id, ue_p->rnti, scs, delay_ms); - } } //----------------------------------------------------------------------------- @@ -867,18 +837,6 @@ rrc_gNB_modify_dedicatedRRCReconfiguration( gNB_RRC_INST *rrc = RC.nrrrc[ctxt_pP->module_id]; nr_rrc_transfer_protected_rrc_message(rrc, ue_p, DCCH, buffer, size); - - if (NODE_IS_DU(rrc->node_type) || NODE_IS_MONOLITHIC(rrc->node_type)) { - uint32_t delay_ms = ue_p->masterCellGroup && ue_p->masterCellGroup->spCellConfig && ue_p->masterCellGroup->spCellConfig->spCellConfigDedicated - && ue_p->masterCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList - ? NR_RRC_RECONFIGURATION_DELAY_MS + NR_RRC_BWP_SWITCHING_DELAY_MS - : NR_RRC_RECONFIGURATION_DELAY_MS; - - const nr_rrc_du_container_t *du = rrc->du; - DevAssert(du != NULL); - int scs = get_ssb_scs(&du->setup_req->cell[0].info); - nr_mac_enable_ue_rrc_processing_timer(ctxt_pP->module_id, ue_p->rnti, scs, delay_ms); - } } //----------------------------------------------------------------------------- @@ -949,18 +907,6 @@ rrc_gNB_generate_dedicatedRRCReconfiguration_release( gNB_RRC_INST *rrc = RC.nrrrc[ctxt_pP->module_id]; nr_rrc_transfer_protected_rrc_message(rrc, ue_p, DCCH, buffer, size); - - if (NODE_IS_DU(rrc->node_type) || NODE_IS_MONOLITHIC(rrc->node_type)) { - uint32_t delay_ms = ue_p->masterCellGroup && ue_p->masterCellGroup->spCellConfig && ue_p->masterCellGroup->spCellConfig->spCellConfigDedicated - && ue_p->masterCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList - ? NR_RRC_RECONFIGURATION_DELAY_MS + NR_RRC_BWP_SWITCHING_DELAY_MS - : NR_RRC_RECONFIGURATION_DELAY_MS; - - const nr_rrc_du_container_t *du = rrc->du; - DevAssert(du != NULL); - int scs = get_ssb_scs(&du->setup_req->cell[0].info); - nr_mac_enable_ue_rrc_processing_timer(ctxt_pP->module_id, ue_p->rnti, scs, delay_ms); - } } //----------------------------------------------------------------------------- @@ -1192,19 +1138,6 @@ static void rrc_gNB_process_RRCReestablishmentComplete(const protocol_ctxt_t *co ue_p->rnti, size); nr_rrc_transfer_protected_rrc_message(rrc, ue_p, DCCH, buffer, size); - - if (NODE_IS_DU(RC.nrrrc[ctxt_pP->module_id]->node_type) || NODE_IS_MONOLITHIC(RC.nrrrc[ctxt_pP->module_id]->node_type)) { - uint32_t delay_ms = ue_p->masterCellGroup && ue_p->masterCellGroup->spCellConfig - && ue_p->masterCellGroup->spCellConfig->spCellConfigDedicated - && ue_p->masterCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList - ? NR_RRC_RECONFIGURATION_DELAY_MS + NR_RRC_BWP_SWITCHING_DELAY_MS - : NR_RRC_RECONFIGURATION_DELAY_MS; - - const nr_rrc_du_container_t *du = RC.nrrrc[0]->du; - DevAssert(du != NULL); - int scs = get_ssb_scs(&du->setup_req->cell[0].info); - nr_mac_enable_ue_rrc_processing_timer(ctxt_pP->module_id, ue_p->rnti, scs, delay_ms); - } } //----------------------------------------------------------------------------- @@ -1245,21 +1178,6 @@ int nr_rrc_reconfiguration_req(rrc_gNB_ue_context_t *const ue_context_pP gNB_RRC_INST *rrc = RC.nrrrc[ctxt_pP->module_id]; nr_rrc_transfer_protected_rrc_message(rrc, ue_p, DCCH, buffer, size); - if (NODE_IS_DU(rrc->node_type) || NODE_IS_MONOLITHIC(rrc->node_type)) { - nr_rrc_mac_update_cellgroup(ue_context_pP->ue_context.rnti, masterCellGroup); - - uint32_t delay_ms = ue_p->masterCellGroup && ue_p->masterCellGroup->spCellConfig - && ue_p->masterCellGroup->spCellConfig->spCellConfigDedicated - && ue_p->masterCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList - ? NR_RRC_RECONFIGURATION_DELAY_MS + NR_RRC_BWP_SWITCHING_DELAY_MS - : NR_RRC_RECONFIGURATION_DELAY_MS; - - const nr_rrc_du_container_t *du = rrc->du; - DevAssert(du != NULL); - int scs = get_ssb_scs(&du->setup_req->cell[0].info); - nr_mac_enable_ue_rrc_processing_timer(ctxt_pP->module_id, ue_p->rnti, scs, delay_ms); - } - return 0; } From 3982cc2e2393446f654b8ece9dc9fceeb2b8ba1d Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 18 Aug 2023 09:33:05 +0200 Subject: [PATCH 49/63] Forward UE capabilities to DU and use for CellGroupConfig - Forward UE capabilities in F1 handlers - Store at MAC - Update CellGroupConfig with UE Capabilities of the UE --- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 1 + .../LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c | 68 ++++++++++++++++- openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h | 1 + openair2/RRC/NR/MESSAGES/asn1_msg.c | 14 +--- openair2/RRC/NR/mac_rrc_dl_f1ap.c | 16 +++- openair2/RRC/NR/nr_rrc_config.c | 17 +---- openair2/RRC/NR/nr_rrc_defs.h | 3 +- openair2/RRC/NR/rrc_gNB.c | 73 ++++++++++++++----- 8 files changed, 139 insertions(+), 54 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 07c8da3092..ec6d24a0bd 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -1948,6 +1948,7 @@ void delete_nr_ue_data(NR_UE_info_t *UE, NR_COMMON_channels_t *ccPtr, uid_alloca { ASN_STRUCT_FREE(asn_DEF_NR_CellGroupConfig, UE->CellGroup); ASN_STRUCT_FREE(asn_DEF_NR_CellGroupConfig, UE->reconfigCellGroup); + ASN_STRUCT_FREE(asn_DEF_NR_UE_NR_Capability, UE->capability); NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl; destroy_nr_list(&sched_ctrl->available_dl_harq); destroy_nr_list(&sched_ctrl->feedback_dl_harq); diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c index 71d2ecc36a..0e383e4eaf 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c +++ b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c @@ -138,6 +138,42 @@ static int handle_ue_context_drbs_setup(int rnti, return drbs_len; } +static NR_UE_NR_Capability_t *get_ue_nr_cap(int rnti, uint8_t *buf, uint32_t len) +{ + if (buf == NULL || len == 0) + return NULL; + + NR_UE_CapabilityRAT_ContainerList_t *clist = NULL; + asn_dec_rval_t dec_rval = uper_decode(NULL, &asn_DEF_NR_UE_CapabilityRAT_ContainerList, (void **)&clist, buf, len, 0, 0); + if (dec_rval.code != RC_OK) { + LOG_W(NR_MAC, "cannot decode UE capability container list of UE RNTI %04x, ignoring capabilities\n", rnti); + return NULL; + } + + NR_UE_NR_Capability_t *cap = NULL; + for (int i = 0; i < clist->list.count; i++) { + const NR_UE_CapabilityRAT_Container_t *c = clist->list.array[i]; + if (cap != NULL || c->rat_Type != NR_RAT_Type_nr) { + LOG_W(NR_MAC, "UE RNTI %04x: ignoring capability of type %ld\n", rnti, c->rat_Type); + continue; + } + + asn_dec_rval_t dec_rval = uper_decode(NULL, + &asn_DEF_NR_UE_NR_Capability, + (void **)&cap, + c->ue_CapabilityRAT_Container.buf, + c->ue_CapabilityRAT_Container.size, + 0, + 0); + if (dec_rval.code != RC_OK) { + LOG_W(NR_MAC, "cannot decode NR UE capabilities of UE RNTI %04x, ignoring NR capability\n", rnti); + cap = NULL; + continue; + } + } + return cap; +} + static NR_CellGroupConfig_t *clone_CellGroupConfig(const NR_CellGroupConfig_t *orig) { uint8_t buf[16636]; @@ -159,9 +195,12 @@ void ue_context_setup_request(const f1ap_ue_context_setup_t *req) .gNB_DU_ue_id = req->gNB_DU_ue_id, }; + NR_UE_NR_Capability_t *ue_cap = NULL; if (req->cu_to_du_rrc_information != NULL) { AssertFatal(req->cu_to_du_rrc_information->cG_ConfigInfo == NULL, "CG-ConfigInfo not handled\n"); - AssertFatal(req->cu_to_du_rrc_information->uE_CapabilityRAT_ContainerList == NULL, "UE capabilities not handled yet\n"); + ue_cap = get_ue_nr_cap(req->gNB_DU_ue_id, + req->cu_to_du_rrc_information->uE_CapabilityRAT_ContainerList, + req->cu_to_du_rrc_information->uE_CapabilityRAT_ContainerList_length); AssertFatal(req->cu_to_du_rrc_information->measConfig == NULL, "MeasConfig not handled\n"); } @@ -191,7 +230,16 @@ void ue_context_setup_request(const f1ap_ue_context_setup_t *req) if (req->rrc_container != NULL) nr_rlc_srb_recv_sdu(req->gNB_DU_ue_id, DCCH, req->rrc_container, req->rrc_container_length); - //nr_mac_update_cellgroup() + UE->capability = ue_cap; + if (ue_cap != NULL) { + // store the new UE capabilities, and update the cellGroupConfig + ASN_STRUCT_FREE(asn_DEF_NR_UE_NR_Capability, UE->capability); + UE->capability = ue_cap; + LOG_I(NR_MAC, "UE %04x: received capabilities, updating CellGroupConfig\n", UE->rnti); + NR_ServingCellConfigCommon_t *scc = mac->common_channels[0].ServingCellConfigCommon; + update_cellGroupConfig(new_CellGroup, UE->uid, UE->capability, &mac->radio_config, scc); + } + resp.du_to_cu_rrc_information = calloc(1, sizeof(du_to_cu_rrc_information_t)); AssertFatal(resp.du_to_cu_rrc_information != NULL, "out of memory\n"); resp.du_to_cu_rrc_information->cellGroupConfig = calloc(1,1024); @@ -228,9 +276,12 @@ void ue_context_modification_request(const f1ap_ue_context_modif_req_t *req) .gNB_DU_ue_id = req->gNB_DU_ue_id, }; + NR_UE_NR_Capability_t *ue_cap = NULL; if (req->cu_to_du_rrc_information != NULL) { AssertFatal(req->cu_to_du_rrc_information->cG_ConfigInfo == NULL, "CG-ConfigInfo not handled\n"); - AssertFatal(req->cu_to_du_rrc_information->uE_CapabilityRAT_ContainerList == NULL, "UE capabilities not handled yet\n"); + ue_cap = get_ue_nr_cap(req->gNB_DU_ue_id, + req->cu_to_du_rrc_information->uE_CapabilityRAT_ContainerList, + req->cu_to_du_rrc_information->uE_CapabilityRAT_ContainerList_length); AssertFatal(req->cu_to_du_rrc_information->measConfig == NULL, "MeasConfig not handled\n"); } @@ -263,7 +314,16 @@ void ue_context_modification_request(const f1ap_ue_context_modif_req_t *req) "RRC reconfiguration outcome unsuccessful, but no rollback mechanism implemented to come back to old configuration\n"); } - if (req->srbs_to_be_setup_length > 0 || req->drbs_to_be_setup_length > 0) { + if (ue_cap != NULL) { + // store the new UE capabilities, and update the cellGroupConfig + ASN_STRUCT_FREE(asn_DEF_NR_UE_NR_Capability, UE->capability); + UE->capability = ue_cap; + LOG_I(NR_MAC, "UE %04x: received capabilities, updating CellGroupConfig\n", UE->rnti); + NR_ServingCellConfigCommon_t *scc = mac->common_channels[0].ServingCellConfigCommon; + update_cellGroupConfig(new_CellGroup, UE->uid, UE->capability, &mac->radio_config, scc); + } + + if (req->srbs_to_be_setup_length > 0 || req->drbs_to_be_setup_length > 0 || ue_cap != NULL) { resp.du_to_cu_rrc_information = calloc(1, sizeof(du_to_cu_rrc_information_t)); AssertFatal(resp.du_to_cu_rrc_information != NULL, "out of memory\n"); resp.du_to_cu_rrc_information->cellGroupConfig = calloc(1, 1024); diff --git a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h index d7c38f3179..eacb8c84dd 100644 --- a/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h +++ b/openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h @@ -703,6 +703,7 @@ typedef struct { bool expect_reconfiguration; NR_CellGroupConfig_t *reconfigCellGroup; bool apply_cellgroup; + NR_UE_NR_Capability_t *capability; // UE selected beam index uint8_t UE_beam_index; bool Msg4_ACKed; diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index ee3ddd08ee..6cd4fc3500 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -739,19 +739,7 @@ int16_t do_RRCReconfiguration( ie->nonCriticalExtension->dedicatedNAS_MessageList = dedicatedNAS_MessageList; } - if(cellGroupConfig!=NULL){ - /* TODO UECAP: update_cellGroupConfig should not even be here, it is - * updated by DU */ - if (scc != NULL) { - update_cellGroupConfig(cellGroupConfig, - ue_context_pP->ue_context.rrc_ue_id, - ue_context_pP ? ue_context_pP->ue_context.UE_Capability_nr : NULL, - NULL, - scc); - } else { - LOG_W(RRC, "no scc, cannot update cellGroup\n"); - } - + if (cellGroupConfig != NULL) { enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig, NULL, (void *)cellGroupConfig, diff --git a/openair2/RRC/NR/mac_rrc_dl_f1ap.c b/openair2/RRC/NR/mac_rrc_dl_f1ap.c index 270541a4b9..88c5ad125e 100644 --- a/openair2/RRC/NR/mac_rrc_dl_f1ap.c +++ b/openair2/RRC/NR/mac_rrc_dl_f1ap.c @@ -64,7 +64,21 @@ static void ue_context_modification_request_f1ap(const f1ap_ue_context_modif_req MessageDef *msg = itti_alloc_new_message(TASK_RRC_GNB, 0, F1AP_UE_CONTEXT_MODIFICATION_REQ); f1ap_ue_context_modif_req_t *f1ap_msg = &F1AP_UE_CONTEXT_MODIFICATION_REQ(msg); *f1ap_msg = *req; - AssertFatal(req->cu_to_du_rrc_information == NULL, "cu_to_du_rrc_information not supported yet\n"); + if (req->cu_to_du_rrc_information != NULL) { + f1ap_msg->cu_to_du_rrc_information = calloc(1, sizeof(*f1ap_msg->cu_to_du_rrc_information)); + AssertFatal(f1ap_msg->cu_to_du_rrc_information != NULL, "out of memory\n"); + AssertFatal(req->cu_to_du_rrc_information->cG_ConfigInfo == NULL && req->cu_to_du_rrc_information->cG_ConfigInfo_length == 0, "cg_ConfigInfo not implemented\n"); + AssertFatal(req->cu_to_du_rrc_information->measConfig == NULL && req->cu_to_du_rrc_information->measConfig_length == 0, "cg_ConfigInfo not implemented\n"); + if (req->cu_to_du_rrc_information->uE_CapabilityRAT_ContainerList != NULL) { + const cu_to_du_rrc_information_t *du2cu_req = req->cu_to_du_rrc_information; + cu_to_du_rrc_information_t* du2cu_new = f1ap_msg->cu_to_du_rrc_information; + DevAssert(du2cu_req->uE_CapabilityRAT_ContainerList_length > 0); + du2cu_new->uE_CapabilityRAT_ContainerList_length = du2cu_req->uE_CapabilityRAT_ContainerList_length; + du2cu_new->uE_CapabilityRAT_ContainerList = malloc(du2cu_new->uE_CapabilityRAT_ContainerList_length); + AssertFatal(du2cu_new->uE_CapabilityRAT_ContainerList != NULL, "out of memory\n"); + memcpy(du2cu_new->uE_CapabilityRAT_ContainerList, du2cu_req->uE_CapabilityRAT_ContainerList, du2cu_new->uE_CapabilityRAT_ContainerList_length); + } + } AssertFatal(req->drbs_to_be_modified_length == 0, "drbs_to_be_modified not supported yet\n"); if (req->drbs_to_be_setup_length > 0) { int n = req->drbs_to_be_setup_length; diff --git a/openair2/RRC/NR/nr_rrc_config.c b/openair2/RRC/NR/nr_rrc_config.c index d1c55d17cf..5eaaf7eeac 100644 --- a/openair2/RRC/NR/nr_rrc_config.c +++ b/openair2/RRC/NR/nr_rrc_config.c @@ -2348,23 +2348,10 @@ void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, const NR_ServingCellConfigCommon_t *scc) { DevAssert(cellGroupConfig != NULL); - /* this is wrong: we should not call this function is spCellConfig is not - * allocated */ - if (cellGroupConfig->spCellConfig == NULL) - return; - /* same as for spCellConfig */ - if (configuration == NULL) - return; - /* if scc is not allocated, there is a serious problem */ + DevAssert(cellGroupConfig->spCellConfig != NULL); + DevAssert(configuration != NULL); DevAssert(scc != NULL); - /* This is a hack and will be removed once the CellGroupConfig is fully - * handled at the DU */ - if (NODE_IS_CU(RC.nrrrc[0]->node_type)) { - LOG_W(RRC, "update of CellGroupConfig not yet supported in F1\n"); - return; - } - NR_SpCellConfig_t *SpCellConfig = cellGroupConfig->spCellConfig; int curr_bwp = NRRIV2BW(scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); diff --git a/openair2/RRC/NR/nr_rrc_defs.h b/openair2/RRC/NR/nr_rrc_defs.h index 29ad2ccd35..465f968a4d 100644 --- a/openair2/RRC/NR/nr_rrc_defs.h +++ b/openair2/RRC/NR/nr_rrc_defs.h @@ -38,6 +38,7 @@ #include "collection/tree.h" #include "collection/linear_alloc.h" #include "nr_rrc_common.h" +#include "ds/byte_array.h" #include "common/ngran_types.h" #include "common/platform_constants.h" @@ -243,7 +244,7 @@ typedef struct gNB_RRC_UE_s { NR_HANDOVER_INFO *handover_info; NR_MeasResults_t *measResults; - + byte_array_t ue_cap_buffer; NR_UE_NR_Capability_t* UE_Capability_nr; int UE_Capability_size; NR_UE_MRDC_Capability_t* UE_Capability_MRDC; diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 1b00e380a2..86d50a4bb0 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -1460,6 +1460,18 @@ static int handle_ueCapabilityInformation(const protocol_ctxt_t *const ctxt_pP, if (ue_cap_info->criticalExtensions.present == NR_UECapabilityInformation__criticalExtensions_PR_ueCapabilityInformation) { const NR_UE_CapabilityRAT_ContainerList_t *ue_CapabilityRAT_ContainerList = ue_cap_info->criticalExtensions.choice.ueCapabilityInformation->ue_CapabilityRAT_ContainerList; + + /* Encode UE-CapabilityRAT-ContainerList for sending to the DU */ + free(UE->ue_cap_buffer.buf); + UE->ue_cap_buffer.len = uper_encode_to_new_buffer(&asn_DEF_NR_UE_CapabilityRAT_ContainerList, + NULL, + ue_CapabilityRAT_ContainerList, + (void **)&UE->ue_cap_buffer.buf); + if (UE->ue_cap_buffer.len <= 0) { + LOG_E(RRC, "could not encode UE-CapabilityRAT-ContainerList, abort handling capabilities\n"); + return -1; + } + for (int i = 0; i < ue_CapabilityRAT_ContainerList->list.count; i++) { const NR_UE_CapabilityRAT_Container_t *ue_cap_container = ue_CapabilityRAT_ContainerList->list.array[i]; if (ue_cap_container->rat_Type == NR_RAT_Type_nr) { @@ -2370,19 +2382,28 @@ void prepare_and_send_ue_context_modification_f1(rrc_gNB_ue_context_t *ue_contex srbs[0].lcid = 2; } + cu_to_du_rrc_information_t cu2du = {0}; + cu_to_du_rrc_information_t *cu2du_p = NULL; + if (UE->ue_cap_buffer.len > 0 && UE->ue_cap_buffer.buf != NULL) { + cu2du_p = &cu2du; + cu2du.uE_CapabilityRAT_ContainerList = UE->ue_cap_buffer.buf; + cu2du.uE_CapabilityRAT_ContainerList_length = UE->ue_cap_buffer.len; + } + f1_ue_data_t ue_data = cu_get_f1_ue_data(UE->rrc_ue_id); f1ap_ue_context_modif_req_t ue_context_modif_req = { - .gNB_CU_ue_id = UE->rrc_ue_id, - .gNB_DU_ue_id = ue_data.secondary_ue, - .plmn.mcc = rrc->configuration.mcc[0], - .plmn.mnc = rrc->configuration.mnc[0], - .plmn.mnc_digit_length = rrc->configuration.mnc_digit_length[0], - .nr_cellid = rrc->nr_cellid, - .servCellId = 0, /* TODO: correct value? */ - .srbs_to_be_setup_length = nb_srb, - .srbs_to_be_setup = srbs, - .drbs_to_be_setup_length = nb_drb, - .drbs_to_be_setup = drbs, + .gNB_CU_ue_id = UE->rrc_ue_id, + .gNB_DU_ue_id = ue_data.secondary_ue, + .plmn.mcc = rrc->configuration.mcc[0], + .plmn.mnc = rrc->configuration.mnc[0], + .plmn.mnc_digit_length = rrc->configuration.mnc_digit_length[0], + .nr_cellid = rrc->nr_cellid, + .servCellId = 0, /* TODO: correct value? */ + .srbs_to_be_setup_length = nb_srb, + .srbs_to_be_setup = srbs, + .drbs_to_be_setup_length = nb_drb, + .drbs_to_be_setup = drbs, + .cu_to_du_rrc_information = cu2du_p, }; rrc->mac_rrc.ue_context_modification_request(&ue_context_modif_req); } @@ -2727,18 +2748,30 @@ rrc_gNB_generate_SecurityModeCommand( gNB_RRC_INST *rrc = RC.nrrrc[ctxt_pP->module_id]; AssertFatal(!NODE_IS_DU(rrc->node_type), "illegal node type DU!\n"); + cu_to_du_rrc_information_t cu2du = {0}; + cu_to_du_rrc_information_t *cu2du_p = NULL; + if (ue_p->ue_cap_buffer.len > 0 && ue_p->ue_cap_buffer.buf != NULL) { + cu2du_p = &cu2du; + cu2du.uE_CapabilityRAT_ContainerList = ue_p->ue_cap_buffer.buf; + cu2du.uE_CapabilityRAT_ContainerList_length = ue_p->ue_cap_buffer.len; + } + + const nr_rrc_du_container_t *du = rrc->du; + DevAssert(du != NULL); + /* the callback will fill the UE context setup request and forward it */ f1_ue_data_t ue_data = cu_get_f1_ue_data(ue_p->rrc_ue_id); f1ap_ue_context_setup_t ue_context_setup_req = { - .gNB_CU_ue_id = ue_p->rrc_ue_id, - .gNB_DU_ue_id = ue_data.secondary_ue, - .plmn.mcc = rrc->configuration.mcc[0], - .plmn.mnc = rrc->configuration.mnc[0], - .plmn.mnc_digit_length = rrc->configuration.mnc_digit_length[0], - .nr_cellid = rrc->nr_cellid, - .servCellId = 0, /* TODO: correct value? */ - .srbs_to_be_setup = 0, /* no new SRBs */ - .drbs_to_be_setup = 0, /* no new DRBs */ + .gNB_CU_ue_id = ue_p->rrc_ue_id, + .gNB_DU_ue_id = ue_data.secondary_ue, + .plmn.mcc = rrc->configuration.mcc[0], + .plmn.mnc = rrc->configuration.mnc[0], + .plmn.mnc_digit_length = rrc->configuration.mnc_digit_length[0], + .nr_cellid = rrc->nr_cellid, + .servCellId = 0, /* TODO: correct value? */ + .srbs_to_be_setup = 0, /* no new SRBs */ + .drbs_to_be_setup = 0, /* no new DRBs */ + .cu_to_du_rrc_information = cu2du_p, }; deliver_ue_ctxt_setup_data_t data = {.rrc = rrc, .setup_req = &ue_context_setup_req}; nr_pdcp_data_req_srb(ctxt_pP->rntiMaybeUEid, DCCH, rrc_gNB_mui++, size, buffer, rrc_deliver_ue_ctxt_setup_req, &data); From c69e8b68950016f2ce92ad6d56fd41fdb5eee350 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 18 Aug 2023 18:30:17 +0200 Subject: [PATCH 50/63] Clean up do_RRCReconfiguration() --- openair2/RRC/NR/MESSAGES/asn1_msg.c | 34 +++++++++++------------- openair2/RRC/NR/MESSAGES/asn1_msg.h | 5 +--- openair2/RRC/NR/rrc_gNB.c | 40 +++++------------------------ 3 files changed, 22 insertions(+), 57 deletions(-) diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 6cd4fc3500..6cd831ff43 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -676,21 +676,17 @@ int do_NR_RRCRelease(uint8_t *buffer, size_t buffer_size, uint8_t Transaction_id } //------------------------------------------------------------------------------ -int16_t do_RRCReconfiguration( - const protocol_ctxt_t *const ctxt_pP, - uint8_t *buffer, - size_t buffer_size, - uint8_t Transaction_id, - NR_SRB_ToAddModList_t *SRB_configList, - NR_DRB_ToAddModList_t *DRB_configList, - NR_DRB_ToReleaseList_t *DRB_releaseList, - NR_SecurityConfig_t *security_config, - NR_SDAP_Config_t *sdap_config, - NR_MeasConfig_t *meas_config, - struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList *dedicatedNAS_MessageList, - rrc_gNB_ue_context_t *const ue_context_pP, - const NR_ServingCellConfigCommon_t *scc, - NR_CellGroupConfig_t *cellGroupConfig) +int16_t do_RRCReconfiguration(const gNB_RRC_UE_t *UE, + uint8_t *buffer, + size_t buffer_size, + uint8_t Transaction_id, + NR_SRB_ToAddModList_t *SRB_configList, + NR_DRB_ToAddModList_t *DRB_configList, + NR_DRB_ToReleaseList_t *DRB_releaseList, + NR_SecurityConfig_t *security_config, + NR_MeasConfig_t *meas_config, + struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList *dedicatedNAS_MessageList, + NR_CellGroupConfig_t *cellGroupConfig) //------------------------------------------------------------------------------ { NR_DL_DCCH_Message_t dl_dcch_msg={0}; @@ -771,11 +767,11 @@ int16_t do_RRCReconfiguration( AssertFatal(enc_rval.encoded >0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); - LOG_D(NR_RRC,"[gNB %d] RRCReconfiguration for UE %lx Encoded %zd bits (%zd bytes)\n", - ctxt_pP->module_id, - ctxt_pP->rntiMaybeUEid, + LOG_D(NR_RRC, + "RRCReconfiguration for UE %d: Encoded %zd bits (%zd bytes)\n", + UE->rrc_ue_id, enc_rval.encoded, - (enc_rval.encoded+7)/8); + (enc_rval.encoded + 7) / 8); return((enc_rval.encoded+7)/8); } diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.h b/openair2/RRC/NR/MESSAGES/asn1_msg.h index a81091357a..83c4e4897c 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.h +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.h @@ -97,7 +97,7 @@ uint8_t do_NR_SA_UECapabilityEnquiry( const protocol_ctxt_t *const ctxt_pP, int do_NR_RRCRelease(uint8_t *buffer, size_t buffer_size, uint8_t Transaction_id); -int16_t do_RRCReconfiguration(const protocol_ctxt_t *const ctxt_pP, +int16_t do_RRCReconfiguration(const gNB_RRC_UE_t *UE, uint8_t *buffer, size_t buffer_size, uint8_t Transaction_id, @@ -105,11 +105,8 @@ int16_t do_RRCReconfiguration(const protocol_ctxt_t *const ctxt_pP, NR_DRB_ToAddModList_t *DRB_configList, NR_DRB_ToReleaseList_t *DRB_releaseList, NR_SecurityConfig_t *security_config, - NR_SDAP_Config_t *sdap_config, NR_MeasConfig_t *meas_config, struct NR_RRCReconfiguration_v1530_IEs__dedicatedNAS_MessageList *dedicatedNAS_MessageList, - rrc_gNB_ue_context_t *const ue_context_pP, - const NR_ServingCellConfigCommon_t *scc, NR_CellGroupConfig_t *cellGroupConfig); uint8_t do_RRCSetupComplete(uint8_t Mod_id, diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 86d50a4bb0..9c6fed9bdd 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -562,7 +562,7 @@ static void rrc_gNB_generate_defaultRRCReconfiguration(const protocol_ctxt_t *co NR_MeasConfig_t *measconfig = get_defaultMeasConfig(arfcn, band, scs); uint8_t buffer[RRC_BUF_SIZE] = {0}; - int size = do_RRCReconfiguration(ctxt_pP, + int size = do_RRCReconfiguration(ue_p, buffer, RRC_BUF_SIZE, xid, @@ -570,11 +570,8 @@ static void rrc_gNB_generate_defaultRRCReconfiguration(const protocol_ctxt_t *co NULL, //*DRB_configList, NULL, NULL, - NULL, measconfig, dedicatedNAS_MessageList, - ue_context_pP, - NULL, ue_p->masterCellGroup); AssertFatal(size > 0, "cannot encode RRCReconfiguration in %s()\n", __func__); LOG_W(NR_RRC, "do_RRCReconfiguration(): size %d\n", size); @@ -668,7 +665,7 @@ void rrc_gNB_generate_dedicatedRRCReconfiguration(const protocol_ctxt_t *const c NR_SRB_ToAddModList_t *SRBs = createSRBlist(ue_p, false); NR_DRB_ToAddModList_t *DRBs = createDRBlist(ue_p, false); - int size = do_RRCReconfiguration(ctxt_pP, + int size = do_RRCReconfiguration(ue_p, buffer, RRC_BUF_SIZE, xid, @@ -677,10 +674,7 @@ void rrc_gNB_generate_dedicatedRRCReconfiguration(const protocol_ctxt_t *const c NULL, NULL, NULL, - NULL, dedicatedNAS_MessageList, - ue_context_pP, - NULL, cellGroupConfig); LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)buffer,size,"[MSG] RRC Reconfiguration\n"); freeSRBlist(SRBs); @@ -799,7 +793,7 @@ rrc_gNB_modify_dedicatedRRCReconfiguration( } uint8_t buffer[RRC_BUF_SIZE]; - int size = do_RRCReconfiguration(ctxt_pP, + int size = do_RRCReconfiguration(ue_p, buffer, RRC_BUF_SIZE, xid, @@ -808,10 +802,7 @@ rrc_gNB_modify_dedicatedRRCReconfiguration( NULL, NULL, NULL, - NULL, dedicatedNAS_MessageList, - NULL, - NULL, NULL); LOG_DUMPMSG(NR_RRC, DEBUG_RRC, (char *)buffer, size, "[MSG] RRC Reconfiguration\n"); @@ -872,7 +863,7 @@ rrc_gNB_generate_dedicatedRRCReconfiguration_release( } uint8_t buffer[RRC_BUF_SIZE] = {0}; - int size = do_RRCReconfiguration(ctxt_pP, + int size = do_RRCReconfiguration(ue_p, buffer, RRC_BUF_SIZE, xid, @@ -881,10 +872,7 @@ rrc_gNB_generate_dedicatedRRCReconfiguration_release( DRB_Release_configList2, NULL, NULL, - NULL, dedicatedNAS_MessageList, - NULL, - NULL, NULL); LOG_DUMPMSG(NR_RRC,DEBUG_RRC,(char *)buffer,size, "[MSG] RRC Reconfiguration\n"); @@ -1113,7 +1101,7 @@ static void rrc_gNB_process_RRCReestablishmentComplete(const protocol_ctxt_t *co NR_DRB_ToAddModList_t *DRBs = createDRBlist(ue_p, true); uint8_t buffer[RRC_BUF_SIZE] = {0}; - int size = do_RRCReconfiguration(ctxt_pP, + int size = do_RRCReconfiguration(ue_p, buffer, RRC_BUF_SIZE, new_xid, @@ -1121,11 +1109,8 @@ static void rrc_gNB_process_RRCReestablishmentComplete(const protocol_ctxt_t *co DRBs, NULL, NULL, - NULL, NULL, // MeasObj_list, NULL, - ue_context_pP, - NULL, cellGroupConfig); freeSRBlist(SRBs); freeDRBlist(DRBs); @@ -1160,20 +1145,7 @@ int nr_rrc_reconfiguration_req(rrc_gNB_ue_context_t *const ue_context_pP } uint8_t buffer[RRC_BUF_SIZE]; - int size = do_RRCReconfiguration(ctxt_pP, - buffer, - RRC_BUF_SIZE, - xid, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - ue_context_pP, - NULL, - masterCellGroup); + int size = do_RRCReconfiguration(ue_p, buffer, RRC_BUF_SIZE, xid, NULL, NULL, NULL, NULL, NULL, NULL, masterCellGroup); gNB_RRC_INST *rrc = RC.nrrrc[ctxt_pP->module_id]; nr_rrc_transfer_protected_rrc_message(rrc, ue_p, DCCH, buffer, size); From c325c6a232a2f3517a0009f62dc55cee05cbc735 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 21 Aug 2023 13:47:38 +0200 Subject: [PATCH 51/63] Correctly free memory in do_NR_SA_UECapabilityEnquiry() --- openair2/RRC/NR/MESSAGES/asn1_msg.c | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 6cd831ff43..0cdd309443 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -576,7 +576,6 @@ uint8_t do_NR_SA_UECapabilityEnquiry( const protocol_ctxt_t *const ctxt_pP, NR_DL_DCCH_Message_t dl_dcch_msg; NR_UE_CapabilityRAT_Request_t *ue_capabilityrat_request; - asn_enc_rval_t enc_rval; memset(&dl_dcch_msg,0,sizeof(NR_DL_DCCH_Message_t)); dl_dcch_msg.message.present = NR_DL_DCCH_MessageType_PR_c1; dl_dcch_msg.message.choice.c1 = CALLOC(1,sizeof(struct NR_DL_DCCH_MessageType__c1)); @@ -601,25 +600,16 @@ uint8_t do_NR_SA_UECapabilityEnquiry( const protocol_ctxt_t *const ctxt_pP, sa_band_filter = (NR_UE_CapabilityRequestFilterNR_t*)calloc(1,sizeof(NR_UE_CapabilityRequestFilterNR_t)); sa_band_filter->frequencyBandListFilter = sa_band_list; - OCTET_STRING_t req_freq; - unsigned char req_freq_buf[1024]; - enc_rval = uper_encode_to_buffer(&asn_DEF_NR_UE_CapabilityRequestFilterNR, - NULL, - (void *)sa_band_filter, - req_freq_buf, - 1024); - AssertFatal(enc_rval.encoded >0, "ASN1 message encoding failed (%s, %lu)!\n", - enc_rval.failed_type->name, enc_rval.encoded); - + OCTET_STRING_t *req_freq = calloc(1, sizeof(*req_freq)); + AssertFatal(req_freq != NULL, "out of memory\n"); + req_freq->size = uper_encode_to_new_buffer(&asn_DEF_NR_UE_CapabilityRequestFilterNR, NULL, sa_band_filter, (void **)&req_freq->buf); + AssertFatal(req_freq->size > 0, "ASN1 message encoding failed (encoded %lu bytes)!\n", req_freq->size); if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { xer_fprint(stdout, &asn_DEF_NR_UE_CapabilityRequestFilterNR, (void *)sa_band_filter); } - req_freq.buf = req_freq_buf; - req_freq.size = (enc_rval.encoded+7)/8; - - ue_capabilityrat_request->capabilityRequestFilter = &req_freq; + ue_capabilityrat_request->capabilityRequestFilter = req_freq; asn1cSeqAdd(&dl_dcch_msg.message.choice.c1->choice.ueCapabilityEnquiry->criticalExtensions.choice.ueCapabilityEnquiry->ue_CapabilityRAT_RequestList.list, ue_capabilityrat_request); @@ -629,14 +619,11 @@ uint8_t do_NR_SA_UECapabilityEnquiry( const protocol_ctxt_t *const ctxt_pP, xer_fprint(stdout, &asn_DEF_NR_DL_DCCH_Message, (void *)&dl_dcch_msg); } - enc_rval = uper_encode_to_buffer(&asn_DEF_NR_DL_DCCH_Message, - NULL, - (void *)&dl_dcch_msg, - buffer, - 100); + asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_DL_DCCH_Message, NULL, (void *)&dl_dcch_msg, buffer, 100); AssertFatal(enc_rval.encoded >0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NR_DL_DCCH_Message, &dl_dcch_msg); LOG_D(NR_RRC, "[gNB %d] NR UECapabilityRequest for UE %lx Encoded %zd bits (%zd bytes)\n", ctxt_pP->module_id, ctxt_pP->rntiMaybeUEid, enc_rval.encoded, (enc_rval.encoded + 7) / 8); From 1b171e798d6b2720c816929773b6fb6eec746ce1 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 21 Aug 2023 13:56:31 +0200 Subject: [PATCH 52/63] Fix memory leaks in do_RRCReconfiguration() --- openair2/RRC/NR/MESSAGES/asn1_msg.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 0cdd309443..60d808559b 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -679,7 +679,6 @@ int16_t do_RRCReconfiguration(const gNB_RRC_UE_t *UE, NR_DL_DCCH_Message_t dl_dcch_msg={0}; asn_enc_rval_t enc_rval; NR_RRCReconfiguration_IEs_t *ie; - unsigned char masterCellGroup_buf[1000]; dl_dcch_msg.message.present = NR_DL_DCCH_MessageType_PR_c1; asn1cCalloc(dl_dcch_msg.message.choice.c1, c1);// = CALLOC(1, sizeof(struct NR_DL_DCCH_MessageType__c1)); @@ -723,20 +722,15 @@ int16_t do_RRCReconfiguration(const gNB_RRC_UE_t *UE, } if (cellGroupConfig != NULL) { - enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig, - NULL, - (void *)cellGroupConfig, - masterCellGroup_buf, - 1000); - AssertFatal(enc_rval.encoded >0, "ASN1 message encoding failed (%s, %lu)!\n", - enc_rval.failed_type->name, enc_rval.encoded); + uint8_t *buf = NULL; + ssize_t len = uper_encode_to_new_buffer(&asn_DEF_NR_CellGroupConfig, NULL, cellGroupConfig, (void **)&buf); + AssertFatal(len > 0, "ASN1 message encoding failed (%lu)!\n", len); if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void *) cellGroupConfig); } ie->nonCriticalExtension->masterCellGroup = calloc(1,sizeof(OCTET_STRING_t)); - - ie->nonCriticalExtension->masterCellGroup->buf = masterCellGroup_buf; - ie->nonCriticalExtension->masterCellGroup->size = (enc_rval.encoded+7)/8; + ie->nonCriticalExtension->masterCellGroup->buf = buf; + ie->nonCriticalExtension->masterCellGroup->size = len; } dl_dcch_msg.message.choice.c1->choice.rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration = ie; @@ -754,6 +748,19 @@ int16_t do_RRCReconfiguration(const gNB_RRC_UE_t *UE, AssertFatal(enc_rval.encoded >0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); + // don't free what we did not allocate, so set fields with pointers to NULL + // if memory comes from outside + ie->measConfig = NULL; + if (ie->radioBearerConfig) { + ie->radioBearerConfig->srb_ToAddModList = NULL; + ie->radioBearerConfig->drb_ToAddModList = NULL; + ie->radioBearerConfig->securityConfig = NULL; + ie->radioBearerConfig->srb3_ToRelease = NULL; + ie->radioBearerConfig->drb_ToReleaseList = NULL; + } + if (ie->nonCriticalExtension) + ie->nonCriticalExtension->dedicatedNAS_MessageList = NULL; + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NR_DL_DCCH_Message, &dl_dcch_msg); LOG_D(NR_RRC, "RRCReconfiguration for UE %d: Encoded %zd bits (%zd bytes)\n", UE->rrc_ue_id, From a3382f8faa8e883d0ce3f0c61cee3bb98e875236 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 21 Aug 2023 13:59:51 +0200 Subject: [PATCH 53/63] Fix memory leaks in do_RRCSetup() --- openair2/RRC/NR/MESSAGES/asn1_msg.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 60d808559b..b913f448b9 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -501,9 +501,6 @@ int do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP, memcpy(ie->masterCellGroup.buf, masterCellGroup, masterCellGroup_len); ie->masterCellGroup.size = masterCellGroup_len; - // decode masterCellGroup OCTET_STRING received from DU and place in ue context - ue_p->masterCellGroup = decode_cellGroupConfig(masterCellGroup, masterCellGroup_len); - if (LOG_DEBUGFLAG(DEBUG_ASN1)) { xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, ue_p->masterCellGroup); xer_fprint(stdout, &asn_DEF_NR_DL_CCCH_Message, (void *)&dl_ccch_msg); @@ -512,6 +509,9 @@ int do_RRCSetup(rrc_gNB_ue_context_t *const ue_context_pP, asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_DL_CCCH_Message, NULL, (void *)&dl_ccch_msg, buffer, 1000); AssertFatal(enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); + // free what we did not allocate ourselves + ie->radioBearerConfig.srb_ToAddModList = NULL; + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NR_DL_CCCH_Message, &dl_ccch_msg); LOG_D(NR_RRC, "RRCSetup Encoded %zd bits (%zd bytes)\n", enc_rval.encoded, (enc_rval.encoded + 7) / 8); return ((enc_rval.encoded + 7) / 8); From a4c75620ee1cbd4adfd733fd81521fda56f8f833 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 21 Aug 2023 14:00:07 +0200 Subject: [PATCH 54/63] Fix memory leaks in do_NR_RRCRelease() --- openair2/RRC/NR/MESSAGES/asn1_msg.c | 1 + 1 file changed, 1 insertion(+) diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index b913f448b9..35ca0115e6 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -659,6 +659,7 @@ int do_NR_RRCRelease(uint8_t *buffer, size_t buffer_size, uint8_t Transaction_id buffer_size); AssertFatal(enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NR_DL_DCCH_Message, &dl_dcch_msg); return((enc_rval.encoded+7)/8); } From 885a029abcc25b29b0c28243d9c01eb9e318cc83 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 21 Aug 2023 14:00:46 +0200 Subject: [PATCH 55/63] Fix memory leaks in do_NR_DLInformationTransfer() --- openair2/RRC/NR/MESSAGES/asn1_msg.c | 55 +++++++++++++---------------- openair2/RRC/NR/MESSAGES/asn1_msg.h | 14 ++++---- openair2/RRC/NR/rrc_gNB_NGAP.c | 9 +++-- 3 files changed, 38 insertions(+), 40 deletions(-) diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 35ca0115e6..d7dbe0dd1d 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -948,41 +948,36 @@ uint8_t do_RRCSetupComplete(uint8_t Mod_id, uint8_t *buffer, size_t buffer_size, } //------------------------------------------------------------------------------ -uint8_t -do_NR_DLInformationTransfer( - uint8_t Mod_id, - uint8_t **buffer, - uint8_t transaction_id, - uint32_t pdu_length, - uint8_t *pdu_buffer -) +uint8_t do_NR_DLInformationTransfer(uint8_t Mod_id, + uint8_t *buffer, + size_t buffer_len, + uint8_t transaction_id, + uint32_t pdu_length, + uint8_t *pdu_buffer) //------------------------------------------------------------------------------ { - ssize_t encoded; - NR_DL_DCCH_Message_t dl_dcch_msg={0}; - dl_dcch_msg.message.present = NR_DL_DCCH_MessageType_PR_c1; - asn1cCalloc(dl_dcch_msg.message.choice.c1, c1); - c1->present = NR_DL_DCCH_MessageType__c1_PR_dlInformationTransfer; + NR_DL_DCCH_Message_t dl_dcch_msg = {0}; + dl_dcch_msg.message.present = NR_DL_DCCH_MessageType_PR_c1; + asn1cCalloc(dl_dcch_msg.message.choice.c1, c1); + c1->present = NR_DL_DCCH_MessageType__c1_PR_dlInformationTransfer; - asn1cCalloc(c1->choice.dlInformationTransfer, infoTransfer); - infoTransfer->rrc_TransactionIdentifier = transaction_id; - infoTransfer->criticalExtensions.present = - NR_DLInformationTransfer__criticalExtensions_PR_dlInformationTransfer; + asn1cCalloc(c1->choice.dlInformationTransfer, infoTransfer); + infoTransfer->rrc_TransactionIdentifier = transaction_id; + infoTransfer->criticalExtensions.present = NR_DLInformationTransfer__criticalExtensions_PR_dlInformationTransfer; - asn1cCalloc(infoTransfer->criticalExtensions.choice.dlInformationTransfer, dlInfoTransfer); - asn1cCalloc(dlInfoTransfer->dedicatedNAS_Message,msg); - // we will free the caller buffer, that is ok in the present code logic (else it will leak memory) but not natural, - // comprehensive code design - msg->buf = pdu_buffer; - msg->size = pdu_length; + asn1cCalloc(infoTransfer->criticalExtensions.choice.dlInformationTransfer, dlInfoTransfer); + asn1cCalloc(dlInfoTransfer->dedicatedNAS_Message, msg); + // we will free the caller buffer, that is ok in the present code logic (else it will leak memory) but not natural, + // comprehensive code design + msg->buf = pdu_buffer; + msg->size = pdu_length; - encoded = uper_encode_to_new_buffer (&asn_DEF_NR_DL_DCCH_Message, NULL, (void *) &dl_dcch_msg, (void **)buffer); - AssertFatal(encoded > 0,"ASN1 message encoding failed (%s, %ld)!\n", - "DLInformationTransfer", encoded); - ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NR_DL_DCCH_Message,&dl_dcch_msg ); - LOG_D(NR_RRC,"DLInformationTransfer Encoded %zd bytes\n", encoded); - //for (int i=0;i 0, "ASN1 message encoding failed (%s, %ld)!\n", "DLInformationTransfer", r.encoded); + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NR_DL_DCCH_Message, &dl_dcch_msg); + LOG_D(NR_RRC, "DLInformationTransfer Encoded %zd bytes\n", r.encoded); + // for (int i=0;igNB_ue_ngap_id); @@ -611,7 +611,12 @@ int rrc_gNB_process_NGAP_DOWNLINK_NAS(MessageDef *msg_p, instance_t instance, mu PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, GNB_FLAG_YES, UE->rrc_ue_id, 0, 0); /* Create message for PDCP (DLInformationTransfer_t) */ - length = do_NR_DLInformationTransfer(instance, &buffer, rrc_gNB_get_next_transaction_identifier(instance), req->nas_pdu.length, req->nas_pdu.buffer); + length = do_NR_DLInformationTransfer(instance, + buffer, + sizeof(buffer), + rrc_gNB_get_next_transaction_identifier(instance), + req->nas_pdu.length, + req->nas_pdu.buffer); LOG_DUMPMSG(NR_RRC, DEBUG_RRC, buffer, length, "[MSG] RRC DL Information Transfer\n"); /* * switch UL or DL NAS message without RRC piggybacked to SRB2 if active. From 1a09c6eeb06b3845b0e403d0269d28c67a78ed9d Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 21 Aug 2023 14:03:26 +0200 Subject: [PATCH 56/63] Fix memory leak in nr_rrc_gNB_decode_ccch() --- 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 9c6fed9bdd..7307ebac5d 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -1192,6 +1192,7 @@ static int nr_rrc_gNB_decode_ccch(module_id_t module_id, const f1ap_initial_ul_r /* randomValue BIT STRING (SIZE (39)) */ if (rrcSetupRequest->ue_Identity.choice.randomValue.size != 5) { // 39-bit random value LOG_E(NR_RRC, "wrong InitialUE-Identity randomValue size, expected 5, provided %lu", (long unsigned int)rrcSetupRequest->ue_Identity.choice.randomValue.size); + ASN_STRUCT_FREE(asn_DEF_NR_UL_CCCH_Message, ul_ccch_msg); return -1; } uint64_t random_value = 0; @@ -1212,6 +1213,7 @@ static int nr_rrc_gNB_decode_ccch(module_id_t module_id, const f1ap_initial_ul_r /* ng-5G-S-TMSI-Part1 BIT STRING (SIZE (39)) */ if (rrcSetupRequest->ue_Identity.choice.ng_5G_S_TMSI_Part1.size != 5) { LOG_E(NR_RRC, "wrong ng_5G_S_TMSI_Part1 size, expected 5, provided %lu \n", (long unsigned int)rrcSetupRequest->ue_Identity.choice.ng_5G_S_TMSI_Part1.size); + ASN_STRUCT_FREE(asn_DEF_NR_UL_CCCH_Message, ul_ccch_msg); return -1; } @@ -1232,10 +1234,7 @@ static int nr_rrc_gNB_decode_ccch(module_id_t module_id, const f1ap_initial_ul_r LOG_I(NR_RRC, "UE %04x 5G-S-TMSI-Part1 doesn't exist, setting ng_5G_S_TMSI_Part1 => %ld\n", rnti, s_tmsi_part1); ue_context_p = rrc_gNB_create_ue_context(rnti, gnb_rrc_inst, s_tmsi_part1, msg->gNB_DU_ue_id); - if (ue_context_p == NULL) { - LOG_E(NR_RRC, "rrc_gNB_get_next_free_ue_context returned NULL\n"); - return -1; - } + AssertFatal(ue_context_p != NULL, "out of memory\n"); gNB_RRC_UE_t *UE = &ue_context_p->ue_context; UE->Initialue_identity_5g_s_TMSI.presence = true; UE->ng_5G_S_TMSI_Part1 = s_tmsi_part1; @@ -1357,6 +1356,7 @@ static int nr_rrc_gNB_decode_ccch(module_id_t module_id, const f1ap_initial_ul_r break; } } + ASN_STRUCT_FREE(asn_DEF_NR_UL_CCCH_Message, ul_ccch_msg); return 0; } From 6f8a22269857af5b702e5f64071e7d271093ca9a Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 21 Aug 2023 14:11:29 +0200 Subject: [PATCH 57/63] Free default MeasConfig --- openair2/RRC/NR/MESSAGES/asn1_msg.c | 5 +++++ openair2/RRC/NR/MESSAGES/asn1_msg.h | 1 + openair2/RRC/NR/rrc_gNB.c | 1 + 3 files changed, 7 insertions(+) diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index d7dbe0dd1d..4f042d4f05 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -1206,6 +1206,11 @@ NR_MeasConfig_t *get_defaultMeasConfig(int arfcn, int band, int scs) return mc; } +void free_defaultMeasConfig(NR_MeasConfig_t *mc) +{ + ASN_STRUCT_FREE(asn_DEF_NR_MeasConfig, mc); +} + uint8_t do_NR_Paging(uint8_t Mod_id, uint8_t *buffer, uint32_t tmsi) { LOG_D(NR_RRC, "[gNB %d] do_NR_Paging start\n", Mod_id); NR_PCCH_Message_t pcch_msg; diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.h b/openair2/RRC/NR/MESSAGES/asn1_msg.h index 7971c79533..5dcff1501a 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.h +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.h @@ -151,6 +151,7 @@ int do_RRCReestablishment(rrc_gNB_ue_context_t *const ue_context_pP, int do_RRCReestablishmentComplete(uint8_t *buffer, size_t buffer_size, int64_t rrc_TransactionIdentifier); NR_MeasConfig_t *get_defaultMeasConfig(int absFreqSSB, int band, int scs); +void free_defaultMeasConfig(NR_MeasConfig_t *mc); uint8_t do_NR_Paging(uint8_t Mod_id, uint8_t *buffer, uint32_t tmsi); #endif /* __RRC_NR_MESSAGES_ASN1_MSG__H__ */ diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 7307ebac5d..0bc14ee11e 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -575,6 +575,7 @@ static void rrc_gNB_generate_defaultRRCReconfiguration(const protocol_ctxt_t *co ue_p->masterCellGroup); AssertFatal(size > 0, "cannot encode RRCReconfiguration in %s()\n", __func__); LOG_W(NR_RRC, "do_RRCReconfiguration(): size %d\n", size); + free_defaultMeasConfig(measconfig); if (LOG_DEBUGFLAG(DEBUG_ASN1)) { xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, ue_p->masterCellGroup); From 78290f91276101b39b306697891e4dad6c5b4a37 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 21 Aug 2023 14:13:44 +0200 Subject: [PATCH 58/63] Fix memory leak in rrc_gNB_decode_dcch() - Free the memory - for NGAP NAS UL and NAS First request, allocate memory to avoid use-after-free errors --- openair2/RRC/NR/rrc_gNB.c | 1 + openair2/RRC/NR/rrc_gNB_NGAP.c | 16 +++++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 0bc14ee11e..1b528f2853 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -1787,6 +1787,7 @@ int rrc_gNB_decode_dcch(const protocol_ctxt_t *const ctxt_pP, break; } } + ASN_STRUCT_FREE(asn_DEF_NR_UL_DCCH_Message, ul_dcch_msg); return 0; } diff --git a/openair2/RRC/NR/rrc_gNB_NGAP.c b/openair2/RRC/NR/rrc_gNB_NGAP.c index d75fe69fe0..cac6884631 100644 --- a/openair2/RRC/NR/rrc_gNB_NGAP.c +++ b/openair2/RRC/NR/rrc_gNB_NGAP.c @@ -190,8 +190,10 @@ rrc_gNB_send_NGAP_NAS_FIRST_REQ( req->establishment_cause = UE->establishment_cause; /* Forward NAS message */ - req->nas_pdu.buffer = rrcSetupComplete->dedicatedNAS_Message.buf; req->nas_pdu.length = rrcSetupComplete->dedicatedNAS_Message.size; + req->nas_pdu.buffer = malloc(req->nas_pdu.length); + AssertFatal(req->nas_pdu.buffer != NULL, "out of memory\n"); + memcpy(req->nas_pdu.buffer, rrcSetupComplete->dedicatedNAS_Message.buf, req->nas_pdu.length); // extract_imsi(NGAP_NAS_FIRST_REQ (message_p).nas_pdu.buffer, // NGAP_NAS_FIRST_REQ (message_p).nas_pdu.length, // ue_context_pP); @@ -637,19 +639,19 @@ rrc_gNB_send_NGAP_UPLINK_NAS( ) //------------------------------------------------------------------------------ { - uint32_t pdu_length; - uint8_t *pdu_buffer; MessageDef *msg_p; NR_ULInformationTransfer_t *ulInformationTransfer = ul_dcch_msg->message.choice.c1->choice.ulInformationTransfer; gNB_RRC_UE_t *UE = &ue_context_pP->ue_context; if (ulInformationTransfer->criticalExtensions.present == NR_ULInformationTransfer__criticalExtensions_PR_ulInformationTransfer) { - pdu_length = ulInformationTransfer->criticalExtensions.choice.ulInformationTransfer->dedicatedNAS_Message->size; - pdu_buffer = ulInformationTransfer->criticalExtensions.choice.ulInformationTransfer->dedicatedNAS_Message->buf; + NR_DedicatedNAS_Message_t *nas = ulInformationTransfer->criticalExtensions.choice.ulInformationTransfer->dedicatedNAS_Message; + uint8_t *buf = malloc(nas->size); + AssertFatal(buf != NULL, "out of memory\n"); + memcpy(buf, nas->buf, nas->size); msg_p = itti_alloc_new_message (TASK_RRC_GNB, 0, NGAP_UPLINK_NAS); NGAP_UPLINK_NAS(msg_p).gNB_ue_ngap_id = UE->rrc_ue_id; - NGAP_UPLINK_NAS (msg_p).nas_pdu.length = pdu_length; - NGAP_UPLINK_NAS (msg_p).nas_pdu.buffer = pdu_buffer; + NGAP_UPLINK_NAS (msg_p).nas_pdu.length = nas->size; + NGAP_UPLINK_NAS (msg_p).nas_pdu.buffer = buf; // extract_imsi(NGAP_UPLINK_NAS (msg_p).nas_pdu.buffer, // NGAP_UPLINK_NAS (msg_p).nas_pdu.length, // ue_context_pP); From d94a4e545de459f80d42cb10abd59434af456f43 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 21 Aug 2023 14:32:41 +0200 Subject: [PATCH 59/63] Free scheduler UE data --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c | 6 ++++++ openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 1 + 2 files changed, 7 insertions(+) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index ec6d24a0bd..b1b60a9816 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -1956,6 +1956,7 @@ void delete_nr_ue_data(NR_UE_info_t *UE, NR_COMMON_channels_t *ccPtr, uid_alloca destroy_nr_list(&sched_ctrl->available_ul_harq); destroy_nr_list(&sched_ctrl->feedback_ul_harq); destroy_nr_list(&sched_ctrl->retrans_ul_harq); + free_sched_pucch_list(sched_ctrl); uid_linear_allocator_free(uia, UE->uid); LOG_I(NR_MAC, "Remove NR rnti 0x%04x\n", UE->rnti); free(UE); @@ -2364,6 +2365,11 @@ void set_sched_pucch_list(NR_UE_sched_ctrl_t *sched_ctrl, } } +void free_sched_pucch_list(NR_UE_sched_ctrl_t *sched_ctrl) +{ + free(sched_ctrl->sched_pucch); +} + void create_dl_harq_list(NR_UE_sched_ctrl_t *sched_ctrl, const NR_PDSCH_ServingCellConfig_t *pdsch) { const int nrofHARQ = pdsch && pdsch->nrofHARQ_ProcessesForPDSCH ? diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 3b4a73a670..a39945d8fb 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -391,6 +391,7 @@ uint8_t get_dl_nrOfLayers(const NR_UE_sched_ctrl_t *sched_ctrl, const nr_dci_for void set_sched_pucch_list(NR_UE_sched_ctrl_t *sched_ctrl, const NR_UE_UL_BWP_t *ul_bwp, const NR_ServingCellConfigCommon_t *scc); +void free_sched_pucch_list(NR_UE_sched_ctrl_t *sched_ctrl); const int get_dl_tda(const gNB_MAC_INST *nrmac, const NR_ServingCellConfigCommon_t *scc, int slot); const int get_ul_tda(gNB_MAC_INST *nrmac, const NR_ServingCellConfigCommon_t *scc, int frame, int slot); From 567ab391535b379f46b00cc1352df31fdc8dbfce Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 21 Aug 2023 14:32:52 +0200 Subject: [PATCH 60/63] Free RRC UE data --- openair2/RRC/NR/rrc_gNB.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 1b528f2853..ba51d7ec3c 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -2009,6 +2009,13 @@ static void rrc_CU_process_ue_context_release_request(MessageDef *msg_p) NGAP_CAUSE_RADIO_NETWORK_RADIO_CONNECTION_WITH_UE_LOST); } +static void rrc_delete_ue_data(gNB_RRC_UE_t *UE) +{ + ASN_STRUCT_FREE(asn_DEF_NR_UE_NR_Capability, UE->UE_Capability_nr); + ASN_STRUCT_FREE(asn_DEF_NR_CellGroupConfig, UE->masterCellGroup); + ASN_STRUCT_FREE(asn_DEF_NR_MeasResults, UE->measResults); +} + static void rrc_CU_process_ue_context_release_complete(MessageDef *msg_p) { const int instance = 0; @@ -2025,6 +2032,7 @@ static void rrc_CU_process_ue_context_release_complete(MessageDef *msg_p) newGtpuDeleteAllTunnels(instance, UE->rrc_ue_id); rrc_gNB_send_NGAP_UE_CONTEXT_RELEASE_COMPLETE(instance, UE->rrc_ue_id); LOG_I(NR_RRC, "removed UE CU UE ID %u/RNTI %04x \n", UE->rrc_ue_id, UE->rnti); + rrc_delete_ue_data(UE); rrc_gNB_remove_ue_context(rrc, ue_context_p); } From 62fd56f9043684d15ec7643b0698e9fc31a71398 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 24 Aug 2023 11:13:02 +0200 Subject: [PATCH 61/63] DCCH free memory --- openair2/RRC/NR/rrc_gNB.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index ba51d7ec3c..505b22ab50 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -1384,7 +1384,7 @@ static inline uint64_t bitStr_to_uint64(BIT_STRING_t *asn) { return result; } -static void rrc_gNB_process_MeasurementReport(rrc_gNB_ue_context_t *ue_context, const NR_MeasurementReport_t *measurementReport) +static void rrc_gNB_process_MeasurementReport(rrc_gNB_ue_context_t *ue_context, NR_MeasurementReport_t *measurementReport) { if (LOG_DEBUGFLAG(DEBUG_ASN1)) xer_fprint(stdout, &asn_DEF_NR_MeasurementReport, (void *)measurementReport); @@ -1393,14 +1393,15 @@ static void rrc_gNB_process_MeasurementReport(rrc_gNB_ue_context_t *ue_context, && measurementReport->criticalExtensions.choice.measurementReport != NULL); gNB_RRC_UE_t *ue_ctxt = &ue_context->ue_context; - if (ue_ctxt->measResults != NULL) { - ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NR_MeasResults, ue_ctxt->measResults); - ue_ctxt->measResults = NULL; - } + ASN_STRUCT_FREE(asn_DEF_NR_MeasResults, ue_ctxt->measResults); + ue_ctxt->measResults = NULL; const NR_MeasId_t id = measurementReport->criticalExtensions.choice.measurementReport->measResults.measId; AssertFatal(id, "unexpected MeasResult for MeasurementId %ld received\n", id); asn1cCallocOne(ue_ctxt->measResults, measurementReport->criticalExtensions.choice.measurementReport->measResults); + /* we "keep" the measurement report, so set to 0 */ + free(measurementReport->criticalExtensions.choice.measurementReport); + measurementReport->criticalExtensions.choice.measurementReport = NULL; } static int handle_rrcReestablishmentComplete(const protocol_ctxt_t *const ctxt_pP, From f5c90ead7e37fb618ae2624e41a534921ea0e0d7 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 21 Aug 2023 17:24:47 +0200 Subject: [PATCH 62/63] Free DU at CU on lost connection, store assoc ID - store the assoc ID of a UE at the RRC - if F1 receives an SCTP shutdown, it removes the endpoint - F1 will also send an "F1 Lost Connection" message to the RRC - it is not yet possible to reconnect a DU after it had already been connected at the CU, since the CU F1AP task will try to rebind GTP, which fails --- openair2/COMMON/f1ap_messages_def.h | 3 +++ openair2/COMMON/f1ap_messages_types.h | 6 +++++ openair2/F1AP/f1ap_common.c | 10 ++++++++ openair2/F1AP/f1ap_common.h | 1 + openair2/F1AP/f1ap_cu_interface_management.c | 1 + openair2/F1AP/f1ap_cu_task.c | 12 +++++++++ openair2/RRC/NR/nr_rrc_defs.h | 1 + openair2/RRC/NR/rrc_gNB.c | 26 +++++++++++++++++--- 8 files changed, 57 insertions(+), 3 deletions(-) diff --git a/openair2/COMMON/f1ap_messages_def.h b/openair2/COMMON/f1ap_messages_def.h index 9cb63a0a06..0689dd52ac 100644 --- a/openair2/COMMON/f1ap_messages_def.h +++ b/openair2/COMMON/f1ap_messages_def.h @@ -32,6 +32,9 @@ MESSAGE_DEF(F1AP_SETUP_RESP , MESSAGE_PRIORITY_MED, f1ap_setup_resp_t MESSAGE_DEF(F1AP_SETUP_FAILURE , MESSAGE_PRIORITY_MED, f1ap_setup_failure_t , f1ap_setup_failure) MESSAGE_DEF(F1AP_GNB_CU_CONFIGURATION_UPDATE , MESSAGE_PRIORITY_MED, f1ap_gnb_cu_configuration_update_t , f1ap_gnb_cu_configuration_update) +/* F1AP -> RRC to inform about lost connection */ +MESSAGE_DEF(F1AP_LOST_CONNECTION, MESSAGE_PRIORITY_MED, f1ap_lost_connection_t, f1ap_lost_connection) + /* MAC -> F1AP messages */ MESSAGE_DEF(F1AP_INITIAL_UL_RRC_MESSAGE , MESSAGE_PRIORITY_MED, f1ap_initial_ul_rrc_message_t , f1ap_initial_ul_rrc_message) MESSAGE_DEF(F1AP_UL_RRC_MESSAGE , MESSAGE_PRIORITY_MED, f1ap_ul_rrc_message_t , f1ap_ul_rrc_message) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index b3875c01bf..b0ec1e1e35 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -39,6 +39,8 @@ #define F1AP_GNB_CU_CONFIGURATION_UPDATE_FAILURE(mSGpTR) (mSGpTR)->ittiMsg.f1ap_gnb_cu_configuration_update_failure #define F1AP_SETUP_FAILURE(mSGpTR) (mSGpTR)->ittiMsg.f1ap_setup_failure +#define F1AP_LOST_CONNECTION(mSGpTR) (mSGpTR)->ittiMsg.f1ap_lost_connection + #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 @@ -405,4 +407,8 @@ typedef struct f1ap_paging_ind_s { uint8_t paging_drx; } f1ap_paging_ind_t; +typedef struct f1ap_lost_connection_t { + int dummy; +} f1ap_lost_connection_t; + #endif /* F1AP_MESSAGES_TYPES_H_ */ diff --git a/openair2/F1AP/f1ap_common.c b/openair2/F1AP/f1ap_common.c index 91e7d85efe..3491adc48a 100644 --- a/openair2/F1AP/f1ap_common.c +++ b/openair2/F1AP/f1ap_common.c @@ -63,3 +63,13 @@ void createF1inst(instance_t instanceP, f1ap_setup_req_t *req, f1ap_net_config_t f1_inst[0]->net_config = *nc; pthread_mutex_unlock(&f1_inst_mtx); } + +void destroyF1inst(instance_t instance) +{ + DevAssert(instance == 0); + pthread_mutex_lock(&f1_inst_mtx); + AssertFatal(f1_inst[0] != NULL, "Attempted to free uninitialized F1 instances\n"); + free(f1_inst[instance]); + f1_inst[instance] = NULL; + pthread_mutex_unlock(&f1_inst_mtx); +} diff --git a/openair2/F1AP/f1ap_common.h b/openair2/F1AP/f1ap_common.h index 1329ebdfce..3e0cbb4c8a 100644 --- a/openair2/F1AP/f1ap_common.h +++ b/openair2/F1AP/f1ap_common.h @@ -418,6 +418,7 @@ uint8_t F1AP_get_next_transaction_identifier(instance_t mod_idP, instance_t cu_m f1ap_cudu_inst_t *getCxt(instance_t instanceP); void createF1inst(instance_t instanceP, f1ap_setup_req_t *req, f1ap_net_config_t *nc); +void destroyF1inst(instance_t instance); //lts: C struct type is not homogeneous, so we need macros instead of functions #define addnRCGI(nRCGi, servedCelL) \ diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index ad3880c71b..3ee88c33b5 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -94,6 +94,7 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance, } MessageDef *message_p = itti_alloc_new_message(TASK_CU_F1, 0, F1AP_SETUP_REQ); + message_p->ittiMsgHeader.originInstance = assoc_id; f1ap_setup_req_t *req = &F1AP_SETUP_REQ(message_p); /* gNB_DU_id */ // this function exits if the ie is mandatory diff --git a/openair2/F1AP/f1ap_cu_task.c b/openair2/F1AP/f1ap_cu_task.c index 330d4f5422..2d47398d51 100644 --- a/openair2/F1AP/f1ap_cu_task.c +++ b/openair2/F1AP/f1ap_cu_task.c @@ -71,6 +71,18 @@ static void cu_task_handle_sctp_association_ind(instance_t instance, 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_SHUTDOWN) { + f1ap_cudu_inst_t *f1ap_cu_data = getCxt(instance); + AssertFatal(f1ap_cu_data != NULL, "illegal state: SCTP shutdown for non-existing F1AP endpoint\n"); + LOG_I(F1AP, "Received SCTP shutdown for assoc_id %d, removing endpoint\n", sctp_new_association_resp->assoc_id); + destroyF1inst(instance); + /* inform RRC that the DU is gone */ + MessageDef *message_p = itti_alloc_new_message(TASK_CU_F1, 0, F1AP_LOST_CONNECTION); + message_p->ittiMsgHeader.originInstance = sctp_new_association_resp->assoc_id; + itti_send_msg_to_task(TASK_RRC_GNB, instance, message_p); + return; + } + 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, diff --git a/openair2/RRC/NR/nr_rrc_defs.h b/openair2/RRC/NR/nr_rrc_defs.h index 465f968a4d..362d2bcee5 100644 --- a/openair2/RRC/NR/nr_rrc_defs.h +++ b/openair2/RRC/NR/nr_rrc_defs.h @@ -369,6 +369,7 @@ typedef struct cucp_cuup_if_s { } cucp_cuup_if_t; typedef struct nr_rrc_du_container_t { + int assoc_id; f1ap_setup_req_t *setup_req; NR_MIB_t *mib; NR_SIB1_t *sib1; diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 505b22ab50..23fcbffe50 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -1801,12 +1801,12 @@ static bool rrc_gNB_plmn_matches(const gNB_RRC_INST *rrc, const f1ap_served_cell && rrc->nr_cellid == info->nr_cellid; } -static void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *req) +static void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *req, int assoc_id) { gNB_RRC_INST *rrc = RC.nrrrc[0]; DevAssert(rrc); - LOG_I(NR_RRC, "Received F1 Setup Request from gNB_DU %lu (%s)\n", req->gNB_DU_id, req->gNB_DU_name); + LOG_I(NR_RRC, "Received F1 Setup Request from gNB_DU %lu (%s) on assoc_id %d\n", req->gNB_DU_id, req->gNB_DU_name, assoc_id); // check: // - it is the first DU @@ -1876,6 +1876,7 @@ static void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *req) // we accept the DU rrc->du = calloc(1, sizeof(*rrc->du)); AssertFatal(rrc->du != NULL, "out of memory\n"); + rrc->du->assoc_id = assoc_id; /* ITTI will free the setup request message via free(). So the memory * "inside" of the message will remain, but the "outside" container no, so @@ -2423,6 +2424,21 @@ void rrc_gNB_process_e1_bearer_context_setup_resp(e1ap_bearer_setup_resp_t *resp prepare_and_send_ue_context_modification_f1(ue_context_p, resp); } +static void rrc_CU_process_f1_lost_connection(gNB_RRC_INST *rrc, f1ap_lost_connection_t *lc, int assoc_id) +{ + AssertFatal(rrc->du != NULL, "no DU connected, cannot received F1 lost connection\n"); + AssertFatal(rrc->du->assoc_id == assoc_id, + "previously connected DU (%d) does not match DU for which connection has been lost (%d)\n", + rrc->du->assoc_id, + assoc_id); + (void) lc; // unused for the moment + ASN_STRUCT_FREE(asn_DEF_NR_MIB, rrc->du->mib); + ASN_STRUCT_FREE(asn_DEF_NR_SIB1, rrc->du->sib1); + free(rrc->du); + rrc->du = NULL; + LOG_I(RRC, "dropping DU with assoc_id %d (UE connections remain, if any)\n", assoc_id); +} + static void print_rrc_meas(FILE *f, const NR_MeasResults_t *measresults) { DevAssert(measresults->measResultServingMOList.list.count >= 1); @@ -2621,7 +2637,7 @@ void *rrc_gnb_task(void *args_p) { /* Messages from F1AP task */ case F1AP_SETUP_REQ: AssertFatal(!NODE_IS_DU(RC.nrrrc[instance]->node_type), "should not receive F1AP_SETUP_REQUEST in DU!\n"); - rrc_gNB_process_f1_setup_req(&F1AP_SETUP_REQ(msg_p)); + rrc_gNB_process_f1_setup_req(&F1AP_SETUP_REQ(msg_p), msg_p->ittiMsgHeader.originInstance); break; case F1AP_UE_CONTEXT_SETUP_RESP: @@ -2644,6 +2660,10 @@ void *rrc_gnb_task(void *args_p) { rrc_CU_process_ue_context_release_complete(msg_p); break; + case F1AP_LOST_CONNECTION: + rrc_CU_process_f1_lost_connection(RC.nrrrc[0], &F1AP_LOST_CONNECTION(msg_p), msg_p->ittiMsgHeader.originInstance); + break; + /* Messages from X2AP */ case X2AP_ENDC_SGNB_ADDITION_REQ: LOG_I(NR_RRC, "Received ENDC sgNB addition request from X2AP \n"); From 3f46a71157f6092a484842323dcd8f2ca1d30afb Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 24 Aug 2023 13:35:45 +0200 Subject: [PATCH 63/63] SCTP assoc_id: Make it sctp_assoc_t, project-wide --- openair2/COMMON/e1ap_messages_types.h | 4 +- openair2/COMMON/f1ap_messages_types.h | 4 +- openair2/COMMON/m2ap_messages_types.h | 6 +- openair2/COMMON/m3ap_messages_types.h | 4 +- openair2/COMMON/s1ap_messages_types.h | 2 + openair2/COMMON/sctp_messages_types.h | 11 +- openair2/COMMON/x2ap_messages_types.h | 4 +- openair2/E1AP/e1ap.c | 86 +++-- openair2/E1AP/e1ap_common.h | 2 +- openair2/F1AP/f1ap_common.h | 16 +- openair2/F1AP/f1ap_cu_interface_management.c | 51 ++- openair2/F1AP/f1ap_cu_interface_management.h | 43 +-- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 12 +- openair2/F1AP/f1ap_cu_rrc_message_transfer.h | 14 +- openair2/F1AP/f1ap_cu_ue_context_management.c | 38 +- openair2/F1AP/f1ap_cu_ue_context_management.h | 33 +- openair2/F1AP/f1ap_du_interface_management.c | 51 ++- openair2/F1AP/f1ap_du_interface_management.h | 48 +-- openair2/F1AP/f1ap_du_paging.c | 6 +- openair2/F1AP/f1ap_du_paging.h | 5 +- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 6 +- openair2/F1AP/f1ap_du_rrc_message_transfer.h | 5 +- openair2/F1AP/f1ap_du_ue_context_management.c | 13 +- openair2/F1AP/f1ap_du_ue_context_management.h | 21 +- openair2/F1AP/f1ap_handlers.c | 2 +- openair2/M2AP/m2ap_MCE_defs.h | 2 +- openair2/M2AP/m2ap_MCE_generate_messages.c | 2 +- openair2/M2AP/m2ap_MCE_generate_messages.h | 2 +- openair2/M2AP/m2ap_MCE_handler.c | 8 +- openair2/M2AP/m2ap_MCE_handler.h | 12 +- openair2/M2AP/m2ap_MCE_interface_management.c | 142 +++----- openair2/M2AP/m2ap_MCE_interface_management.h | 98 ++---- .../M2AP/m2ap_MCE_management_procedures.c | 4 +- .../M2AP/m2ap_MCE_management_procedures.h | 4 +- openair2/M2AP/m2ap_common.h | 20 +- openair2/M2AP/m2ap_eNB_defs.h | 4 +- openair2/M2AP/m2ap_eNB_generate_messages.c | 2 +- openair2/M2AP/m2ap_eNB_generate_messages.h | 2 +- openair2/M2AP/m2ap_eNB_handler.c | 8 +- openair2/M2AP/m2ap_eNB_handler.h | 9 +- openair2/M2AP/m2ap_eNB_interface_management.c | 65 +--- openair2/M2AP/m2ap_eNB_interface_management.h | 67 +--- .../M2AP/m2ap_eNB_management_procedures.c | 4 +- .../M2AP/m2ap_eNB_management_procedures.h | 4 +- openair2/M2AP/m2ap_handler.c | 8 +- openair2/M2AP/m2ap_handler.h | 15 +- openair2/M2AP/m2ap_itti_messaging.c | 19 +- openair2/M2AP/m2ap_itti_messaging.h | 21 +- openair2/RRC/LTE/rrc_defs.h | 2 +- openair2/RRC/NR/nr_rrc_defs.h | 2 +- openair2/RRC/NR/rrc_gNB.c | 4 +- openair2/X2AP/x2ap_common.h | 8 +- openair2/X2AP/x2ap_eNB_defs.h | 2 +- openair2/X2AP/x2ap_eNB_generate_messages.c | 2 +- openair2/X2AP/x2ap_eNB_generate_messages.h | 2 +- openair2/X2AP/x2ap_eNB_handler.c | 324 ++++++------------ openair2/X2AP/x2ap_eNB_handler.h | 7 +- openair2/X2AP/x2ap_eNB_itti_messaging.c | 9 +- openair2/X2AP/x2ap_eNB_itti_messaging.h | 10 +- .../X2AP/x2ap_eNB_management_procedures.c | 4 +- .../X2AP/x2ap_eNB_management_procedures.h | 4 +- openair3/M3AP/m3ap_MCE_defs.h | 2 +- openair3/M3AP/m3ap_MCE_generate_messsages.c | 2 +- openair3/M3AP/m3ap_MCE_handler.c | 8 +- openair3/M3AP/m3ap_MCE_handler.h | 10 +- openair3/M3AP/m3ap_MCE_interface_management.c | 39 +-- openair3/M3AP/m3ap_MCE_interface_management.h | 43 +-- .../M3AP/m3ap_MCE_management_procedures.c | 4 +- .../M3AP/m3ap_MCE_management_procedures.h | 4 +- openair3/M3AP/m3ap_MME_defs.h | 2 +- openair3/M3AP/m3ap_MME_generate_messages.c | 2 +- openair3/M3AP/m3ap_MME_generate_messages.h | 2 +- openair3/M3AP/m3ap_MME_handler.c | 8 +- openair3/M3AP/m3ap_MME_handler.h | 10 +- openair3/M3AP/m3ap_MME_interface_management.c | 129 +++---- openair3/M3AP/m3ap_MME_interface_management.h | 56 +-- .../M3AP/m3ap_MME_management_procedures.c | 4 +- .../M3AP/m3ap_MME_management_procedures.h | 4 +- openair3/M3AP/m3ap_common.h | 21 +- openair3/M3AP/m3ap_handler.c | 8 +- openair3/M3AP/m3ap_handler.h | 9 +- openair3/M3AP/m3ap_itti_messaging.c | 19 +- openair3/M3AP/m3ap_itti_messaging.h | 21 +- openair3/NGAP/ngap_common.h | 6 +- openair3/NGAP/ngap_gNB_defs.h | 2 +- openair3/NGAP/ngap_gNB_handlers.c | 77 ++--- openair3/NGAP/ngap_gNB_handlers.h | 3 +- openair3/NGAP/ngap_gNB_itti_messaging.c | 9 +- openair3/NGAP/ngap_gNB_itti_messaging.h | 11 +- .../NGAP/ngap_gNB_management_procedures.c | 4 +- .../NGAP/ngap_gNB_management_procedures.h | 4 +- openair3/NGAP/ngap_gNB_nas_procedures.c | 4 +- openair3/NGAP/ngap_gNB_nas_procedures.h | 5 +- openair3/NGAP/ngap_gNB_overload.c | 8 +- openair3/NGAP/ngap_gNB_overload.h | 8 +- openair3/NGAP/ngap_gNB_trace.c | 9 +- openair3/NGAP/ngap_gNB_trace.h | 8 +- openair3/S1AP/s1ap_common.h | 8 +- openair3/S1AP/s1ap_eNB_defs.h | 2 +- openair3/S1AP/s1ap_eNB_handlers.c | 143 +++----- openair3/S1AP/s1ap_eNB_handlers.h | 3 +- openair3/S1AP/s1ap_eNB_itti_messaging.c | 9 +- openair3/S1AP/s1ap_eNB_itti_messaging.h | 14 +- .../S1AP/s1ap_eNB_management_procedures.c | 4 +- .../S1AP/s1ap_eNB_management_procedures.h | 4 +- openair3/S1AP/s1ap_eNB_nas_procedures.c | 4 +- openair3/S1AP/s1ap_eNB_nas_procedures.h | 5 +- openair3/S1AP/s1ap_eNB_overload.c | 8 +- openair3/S1AP/s1ap_eNB_overload.h | 8 +- openair3/S1AP/s1ap_eNB_trace.c | 8 +- openair3/S1AP/s1ap_eNB_trace.h | 8 +- openair3/SCTP/sctp_eNB_defs.h | 10 +- openair3/SCTP/sctp_eNB_itti_messaging.c | 29 +- openair3/SCTP/sctp_eNB_itti_messaging.h | 30 +- openair3/SCTP/sctp_eNB_task.c | 8 +- 115 files changed, 818 insertions(+), 1441 deletions(-) diff --git a/openair2/COMMON/e1ap_messages_types.h b/openair2/COMMON/e1ap_messages_types.h index 7a1a8b2698..fba56ccb14 100644 --- a/openair2/COMMON/e1ap_messages_types.h +++ b/openair2/COMMON/e1ap_messages_types.h @@ -24,6 +24,8 @@ #ifndef E1AP_MESSAGES_TYPES_H #define E1AP_MESSAGES_TYPES_H +#include +#include #include "common/ngran_types.h" #include "f1ap_messages_types.h" #include "ngap_messages_types.h" @@ -55,7 +57,7 @@ typedef struct PLMN_ID_s { typedef struct e1ap_setup_req_s { uint64_t gNB_cu_up_id; char * gNB_cu_up_name; - int assoc_id; + sctp_assoc_t assoc_id; uint64_t transac_id; int supported_plmns; PLMN_ID_t plmns[E1AP_MAX_NUM_PLMNS]; diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index b0ec1e1e35..b47a763089 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -22,6 +22,8 @@ #ifndef F1AP_MESSAGES_TYPES_H_ #define F1AP_MESSAGES_TYPES_H_ +#include +#include #include "rlc.h" #include "s1ap_messages_types.h" @@ -194,7 +196,7 @@ typedef struct f1ap_gnb_cu_configuration_update_s { uint16_t cnx_id; /* SCTP association id */ - int32_t assoc_id; + sctp_assoc_t assoc_id; /* Number of SCTP streams used for a mme association */ uint16_t sctp_in_streams; diff --git a/openair2/COMMON/m2ap_messages_types.h b/openair2/COMMON/m2ap_messages_types.h index 4187f1736c..d38c493bcb 100644 --- a/openair2/COMMON/m2ap_messages_types.h +++ b/openair2/COMMON/m2ap_messages_types.h @@ -23,6 +23,8 @@ #ifndef M2AP_MESSAGES_TYPES_H_ #define M2AP_MESSAGES_TYPES_H_ +#include +#include #include "s1ap_messages_types.h" #include "LTE_PhysCellId.h" @@ -104,7 +106,7 @@ typedef struct m2ap_setup_req_s { uint16_t cnx_id; /* SCTP association id */ - int32_t assoc_id; + sctp_assoc_t assoc_id; /* The eNB IP address to bind */ m2ap_net_ip_address_t MCE_M2_ip_address; @@ -258,7 +260,7 @@ typedef struct m2ap_setup_resp_s { uint16_t cnx_id; /* SCTP association id */ - int32_t assoc_id; + sctp_assoc_t assoc_id; /* Number of SCTP streams used for a mme association */ uint16_t sctp_in_streams; diff --git a/openair2/COMMON/m3ap_messages_types.h b/openair2/COMMON/m3ap_messages_types.h index 815f8b6df4..171631ddbd 100644 --- a/openair2/COMMON/m3ap_messages_types.h +++ b/openair2/COMMON/m3ap_messages_types.h @@ -22,6 +22,8 @@ #ifndef M3AP_MESSAGES_TYPES_H_ #define M3AP_MESSAGES_TYPES_H_ +#include +#include #include "s1ap_messages_types.h" #include "LTE_PhysCellId.h" @@ -336,7 +338,7 @@ typedef struct m3ap_setup_req_s{ /* Connexion id used between SCTP/M3AP */ uint16_t cnx_id; /* SCTP association id */ - int32_t assoc_id; + sctp_assoc_t assoc_id; /* Number of SCTP streams used for a mme association */ uint16_t sctp_in_streams; diff --git a/openair2/COMMON/s1ap_messages_types.h b/openair2/COMMON/s1ap_messages_types.h index 2151375686..3dd8fc8213 100644 --- a/openair2/COMMON/s1ap_messages_types.h +++ b/openair2/COMMON/s1ap_messages_types.h @@ -22,6 +22,8 @@ #ifndef S1AP_MESSAGES_TYPES_H_ #define S1AP_MESSAGES_TYPES_H_ +#include +#include #include "LTE_asn_constant.h" //-------------------------------------------------------------------------------------------// // Defines to access message fields. diff --git a/openair2/COMMON/sctp_messages_types.h b/openair2/COMMON/sctp_messages_types.h index c2561c0424..88790bdc1f 100644 --- a/openair2/COMMON/sctp_messages_types.h +++ b/openair2/COMMON/sctp_messages_types.h @@ -22,6 +22,9 @@ #ifndef SCTP_MESSAGES_TYPES_H_ #define SCTP_MESSAGES_TYPES_H_ +#include +#include + #define SCTP_NEW_ASSOCIATION_REQ(mSGpTR) (mSGpTR)->ittiMsg.sctp_new_association_req #define SCTP_NEW_ASSOCIATION_REQ_MULTI(mSGpTR) (mSGpTR)->ittiMsg.sctp_new_association_req_multi #define SCTP_NEW_ASSOCIATION_RESP(mSGpTR) (mSGpTR)->ittiMsg.sctp_new_association_resp @@ -87,7 +90,7 @@ typedef struct sctp_init_msg_multi_cnf_s { typedef struct sctp_new_association_ind_s { /* Assoc id of the new association */ - int32_t assoc_id; + sctp_assoc_t assoc_id; /* The port used by remote host */ uint16_t port; @@ -102,7 +105,7 @@ typedef struct sctp_new_association_resp_s { uint16_t ulp_cnx_id; /* SCTP Association ID */ - int32_t assoc_id; + sctp_assoc_t assoc_id; /* Input/output streams */ uint16_t out_streams; @@ -114,7 +117,7 @@ typedef struct sctp_new_association_resp_s { typedef struct sctp_data_ind_s { /* SCTP Association ID */ - int32_t assoc_id; + sctp_assoc_t assoc_id; /* Buffer to send over SCTP */ uint32_t buffer_length; @@ -139,7 +142,7 @@ typedef struct sctp_init_s { typedef struct sctp_close_association_s { - uint32_t assoc_id; + sctp_assoc_t assoc_id; } sctp_close_association_t; diff --git a/openair2/COMMON/x2ap_messages_types.h b/openair2/COMMON/x2ap_messages_types.h index ca01be5035..8ce43cc96c 100644 --- a/openair2/COMMON/x2ap_messages_types.h +++ b/openair2/COMMON/x2ap_messages_types.h @@ -22,6 +22,8 @@ #ifndef X2AP_MESSAGES_TYPES_H_ #define X2AP_MESSAGES_TYPES_H_ +#include +#include #include "s1ap_messages_types.h" #include "LTE_PhysCellId.h" @@ -425,7 +427,7 @@ typedef struct x2ap_ENDC_reconf_complete_s { typedef struct x2ap_ENDC_sgnb_release_request_s { int rnti; x2ap_cause_t cause; - int assoc_id; + sctp_assoc_t assoc_id; } x2ap_ENDC_sgnb_release_request_t; typedef struct x2ap_ENDC_sgnb_release_required_s { diff --git a/openair2/E1AP/e1ap.c b/openair2/E1AP/e1ap.c index 4ad4ea8415..2390b23d2e 100644 --- a/openair2/E1AP/e1ap.c +++ b/openair2/E1AP/e1ap.c @@ -67,8 +67,8 @@ const char *const e1ap_direction2String(int e1ap_dir) return(e1ap_direction_String[e1ap_dir]); } -int e1ap_handle_message(instance_t instance, uint32_t assoc_id, - const uint8_t *const data, const uint32_t data_length) { +int e1ap_handle_message(instance_t instance, sctp_assoc_t assoc_id, const uint8_t *const data, const uint32_t data_length) +{ E1AP_E1AP_PDU_t pdu= {0}; int ret; DevAssert(data != NULL); @@ -128,18 +128,14 @@ int e1ap_send_RESET_ACKNOWLEDGE(instance_t instance, E1AP_Reset_t *Reset) { return -1; } -int e1ap_handle_RESET(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - E1AP_E1AP_PDU_t *pdu) { +int e1ap_handle_RESET(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, E1AP_E1AP_PDU_t *pdu) +{ AssertFatal(false,"Not implemented yet\n"); return -1; } -int e1ap_handle_RESET_ACKNOWLEDGE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - E1AP_E1AP_PDU_t *pdu) { +int e1ap_handle_RESET_ACKNOWLEDGE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, E1AP_E1AP_PDU_t *pdu) +{ AssertFatal(false,"Not implemented yet\n"); return -1; } @@ -147,10 +143,8 @@ int e1ap_handle_RESET_ACKNOWLEDGE(instance_t instance, /* Error Indication */ -int e1ap_handle_ERROR_INDICATION(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - E1AP_E1AP_PDU_t *pdu) { +int e1ap_handle_ERROR_INDICATION(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, E1AP_E1AP_PDU_t *pdu) +{ AssertFatal(false,"Not implemented yet\n"); return -1; } @@ -465,13 +459,19 @@ int e1apCUCP_handle_CONFIGURATION_UPDATE(e1ap_setup_req_t *setupReq, E1AP_E1AP_P return -1; } -int e1apCUUP_handle_gNB_DU_CONFIGURATION_UPDATE_ACKNOWLEDGE(e1ap_setup_req_t *setupReq, uint32_t assoc_id, uint32_t stream, E1AP_E1AP_PDU_t *pdu) +int e1apCUUP_handle_gNB_DU_CONFIGURATION_UPDATE_ACKNOWLEDGE(e1ap_setup_req_t *setupReq, + sctp_assoc_t assoc_id, + uint32_t stream, + E1AP_E1AP_PDU_t *pdu) { AssertFatal(false,"Not implemented yet\n"); return -1; } -int e1apCUUP_handle_gNB_DU_CONFIGURATION_FAILURE(e1ap_setup_req_t *setupReq, uint32_t assoc_id, uint32_t stream, E1AP_E1AP_PDU_t *pdu) +int e1apCUUP_handle_gNB_DU_CONFIGURATION_FAILURE(e1ap_setup_req_t *setupReq, + sctp_assoc_t assoc_id, + uint32_t stream, + E1AP_E1AP_PDU_t *pdu) { AssertFatal(false,"Not implemented yet\n"); return -1; @@ -491,18 +491,14 @@ int e1ap_send_RELEASE_ACKNOWLEDGE(instance_t instance) { return -1; } -int e1ap_handle_RELEASE_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - E1AP_E1AP_PDU_t *pdu) { +int e1ap_handle_RELEASE_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, E1AP_E1AP_PDU_t *pdu) +{ AssertFatal(false,"Not implemented yet\n"); return -1; } -int e1ap_handle_RELEASE_ACKNOWLEDGE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - E1AP_E1AP_PDU_t *pdu) { +int e1ap_handle_RELEASE_ACKNOWLEDGE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, E1AP_E1AP_PDU_t *pdu) +{ AssertFatal(false,"Not implemented yet\n"); return -1; } @@ -1251,17 +1247,19 @@ int e1apCUUP_handle_BEARER_CONTEXT_MODIFICATION_REQUEST(e1ap_upcp_inst_t *e1_ins } int e1apCUCP_handle_BEARER_CONTEXT_MODIFICATION_RESPONSE(instance_t instance, - uint32_t assoc_id, + sctp_assoc_t assoc_id, uint32_t stream, - E1AP_E1AP_PDU_t *pdu) { + E1AP_E1AP_PDU_t *pdu) +{ AssertFatal(false,"Not implemented yet\n"); return -1; } int e1apCUCP_handle_BEARER_CONTEXT_MODIFICATION_FAILURE(instance_t instance, - uint32_t assoc_id, + sctp_assoc_t assoc_id, uint32_t stream, - E1AP_E1AP_PDU_t *pdu) { + E1AP_E1AP_PDU_t *pdu) +{ AssertFatal(false,"Not implemented yet\n"); return -1; } @@ -1277,17 +1275,19 @@ int e1apCUCP_send_BEARER_CONTEXT_MODIFICATION_CONFIRM(instance_t instance) { } int e1apCUCP_handle_BEARER_CONTEXT_MODIFICATION_REQUIRED(instance_t instance, - uint32_t assoc_id, + sctp_assoc_t assoc_id, uint32_t stream, - E1AP_E1AP_PDU_t *pdu) { + E1AP_E1AP_PDU_t *pdu) +{ AssertFatal(false,"Not implemented yet\n"); return -1; } int e1apCUUP_handle_BEARER_CONTEXT_MODIFICATION_CONFIRM(instance_t instance, - uint32_t assoc_id, + sctp_assoc_t assoc_id, uint32_t stream, - E1AP_E1AP_PDU_t *pdu) { + E1AP_E1AP_PDU_t *pdu) +{ AssertFatal(false,"Not implemented yet\n"); return -1; } @@ -1464,9 +1464,10 @@ int e1apCUCP_handle_BEARER_CONTEXT_RELEASE_COMPLETE(e1ap_upcp_inst_t *e1_inst, c } int e1apCUCP_handle_BEARER_CONTEXT_RELEASE_REQUEST(instance_t instance, - uint32_t assoc_id, + sctp_assoc_t assoc_id, uint32_t stream, - E1AP_E1AP_PDU_t *pdu) { + E1AP_E1AP_PDU_t *pdu) +{ AssertFatal(false,"Not implemented yet\n"); return -1; } @@ -1481,9 +1482,10 @@ int e1apCUUP_send_BEARER_CONTEXT_INACTIVITY_NOTIFICATION(instance_t instance) { } int e1apCUCP_handle_BEARER_CONTEXT_INACTIVITY_NOTIFICATION(instance_t instance, - uint32_t assoc_id, + sctp_assoc_t assoc_id, uint32_t stream, - E1AP_E1AP_PDU_t *pdu) { + E1AP_E1AP_PDU_t *pdu) +{ AssertFatal(false,"Not implemented yet\n"); return -1; } @@ -1501,18 +1503,14 @@ int e1apCUUP_send_DATA_USAGE_REPORT(instance_t instance) { return -1; } -int e1apCUCP_handle_DL_DATA_NOTIFICATION(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - E1AP_E1AP_PDU_t *pdu) { +int e1apCUCP_handle_DL_DATA_NOTIFICATION(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, E1AP_E1AP_PDU_t *pdu) +{ AssertFatal(false,"Not implemented yet\n"); return -1; } -int e1apCUCP_handle_send_DATA_USAGE_REPORT(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - E1AP_E1AP_PDU_t *pdu) { +int e1apCUCP_handle_send_DATA_USAGE_REPORT(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, E1AP_E1AP_PDU_t *pdu) +{ AssertFatal(false,"Not implemented yet\n"); return -1; } diff --git a/openair2/E1AP/e1ap_common.h b/openair2/E1AP/e1ap_common.h index 80a2b925e1..cddf5b9ea6 100644 --- a/openair2/E1AP/e1ap_common.h +++ b/openair2/E1AP/e1ap_common.h @@ -34,7 +34,7 @@ typedef struct e1ap_upcp_inst_s { bool same_process; E1_t type; enum sctp_state_e sockState; - uint32_t assoc_id; + sctp_assoc_t assoc_id; instance_t gtpInstN3; instance_t gtpInstF1U; e1ap_setup_req_t setupReq; diff --git a/openair2/F1AP/f1ap_common.h b/openair2/F1AP/f1ap_common.h index 3e0cbb4c8a..5dcd661b3b 100644 --- a/openair2/F1AP/f1ap_common.h +++ b/openair2/F1AP/f1ap_common.h @@ -387,14 +387,12 @@ /** \brief Function array prototype. **/ -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 int (*f1ap_message_processing_t)(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *message_p); +int f1ap_handle_message(instance_t instance, + sctp_assoc_t assoc_id, + int32_t stream, + const uint8_t *const data, + const uint32_t data_length); typedef struct f1ap_cudu_inst_s { f1ap_setup_req_t setupReq; @@ -403,7 +401,7 @@ typedef struct f1ap_cudu_inst_s { f1ap_net_config_t net_config; /* SCTP information */ - int32_t assoc_id; + sctp_assoc_t assoc_id; uint16_t sctp_in_streams; uint16_t sctp_out_streams; diff --git a/openair2/F1AP/f1ap_cu_interface_management.c b/openair2/F1AP/f1ap_cu_interface_management.c index 3ee88c33b5..03b281ea39 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.c +++ b/openair2/F1AP/f1ap_cu_interface_management.c @@ -39,17 +39,13 @@ 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) { +int CU_handle_RESET_ACKKNOWLEDGE(instance_t instance, sctp_assoc_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) { +int CU_handle_RESET(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } @@ -61,10 +57,8 @@ 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) { +int CU_handle_ERROR_INDICATION(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } @@ -76,10 +70,8 @@ int CU_send_ERROR_INDICATION(instance_t instance, F1AP_ErrorIndication_t *ErrorI /* F1 Setup */ -int CU_handle_F1_SETUP_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { +int CU_handle_F1_SETUP_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +{ LOG_D(F1AP, "CU_handle_F1_SETUP_REQUEST\n"); F1AP_F1SetupRequest_t *container; F1AP_F1SetupRequestIEs_t *ie; @@ -422,10 +414,8 @@ 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) { +int CU_handle_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } @@ -534,26 +524,25 @@ int CU_send_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, f1ap_gnb_cu_configu 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) { +int CU_handle_gNB_CU_CONFIGURATION_UPDATE_FAILURE(instance_t instance, sctp_assoc_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) { + sctp_assoc_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) { + sctp_assoc_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) +{ AssertFatal(0, "Not implemented yet\n"); } diff --git a/openair2/F1AP/f1ap_cu_interface_management.h b/openair2/F1AP/f1ap_cu_interface_management.h index 83da037925..abdb60bf88 100644 --- a/openair2/F1AP/f1ap_cu_interface_management.h +++ b/openair2/F1AP/f1ap_cu_interface_management.h @@ -37,32 +37,20 @@ * Reset */ int CU_send_RESET(instance_t instance, F1AP_Reset_t *Reset); -int CU_handle_RESET_ACKKNOWLEDGE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); -int CU_handle_RESET(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); +int CU_handle_RESET_ACKKNOWLEDGE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); +int CU_handle_RESET(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); int CU_send_RESET_ACKNOWLEDGE(instance_t instance, F1AP_ResetAcknowledge_t *ResetAcknowledge); /* * Error Indication */ -int CU_handle_ERROR_INDICATION(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); +int CU_handle_ERROR_INDICATION(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); int CU_send_ERROR_INDICATION(instance_t instance, F1AP_ErrorIndication_t *ErrorIndication); /* * F1 Setup */ -int CU_handle_F1_SETUP_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); +int CU_handle_F1_SETUP_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); int CU_send_F1_SETUP_RESPONSE(instance_t instance, f1ap_setup_resp_t *f1ap_setup_resp); @@ -71,10 +59,7 @@ 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); +int CU_handle_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, sctp_assoc_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); @@ -87,22 +72,22 @@ int CU_send_gNB_DU_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, */ 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); + sctp_assoc_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); + sctp_assoc_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); + sctp_assoc_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); diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index 18560e5751..391841cfa0 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -43,10 +43,8 @@ Initial UL RRC Message Transfer */ -int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { +int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, sctp_assoc_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 @@ -216,10 +214,8 @@ int CU_send_DL_RRC_MESSAGE_TRANSFER(instance_t instance, /* UL RRC Message Transfer */ -int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { +int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, sctp_assoc_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; diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.h b/openair2/F1AP/f1ap_cu_rrc_message_transfer.h index c8c9d3a6f9..6b7023a84d 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.h +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.h @@ -33,18 +33,10 @@ #ifndef F1AP_CU_RRC_MESSAGE_TRANSFER_H_ #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); +int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance, sctp_assoc_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); - -int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, - 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); +int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); #endif /* F1AP_CU_RRC_MESSAGE_TRANSFER_H_ */ diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index f4c1042cad..9e9a85d9e5 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -632,10 +632,8 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, return 0; } -int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { +int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +{ MessageDef *msg_p; F1AP_UEContextSetupResponse_t *container; F1AP_UEContextSetupResponseIEs_t *ie; @@ -766,14 +764,12 @@ int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, return 0; } -int CU_handle_UE_CONTEXT_SETUP_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { +int CU_handle_UE_CONTEXT_SETUP_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } -int CU_handle_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +int CU_handle_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { MessageDef *msg = itti_alloc_new_message(TASK_CU_F1, 0, F1AP_UE_CONTEXT_RELEASE_REQ); f1ap_ue_context_release_req_t *req = &F1AP_UE_CONTEXT_RELEASE_REQ(msg); @@ -919,10 +915,9 @@ int CU_send_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, f1ap_itti_send_sctp_data_req(instance, buffer, len); return 0; } -int CU_handle_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { + +int CU_handle_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +{ F1AP_UEContextReleaseComplete_t *container; F1AP_UEContextReleaseCompleteIEs_t *ie; DevAssert(pdu); @@ -1567,11 +1562,8 @@ int CU_send_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, f1ap_ue_context return 0; } -int CU_handle_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { - +int CU_handle_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +{ MessageDef *msg_p; F1AP_UEContextModificationResponse_t *container; F1AP_UEContextModificationResponseIEs_t *ie; @@ -1695,14 +1687,12 @@ int CU_handle_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance, return 0; } -int CU_handle_UE_CONTEXT_MODIFICATION_FAILURE(instance_t instance, - 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, sctp_assoc_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) +int CU_handle_UE_CONTEXT_MODIFICATION_REQUIRED(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { DevAssert(pdu != NULL); diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.h b/openair2/F1AP/f1ap_cu_ue_context_management.h index 76bbecb2b8..5409c6e53e 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.h +++ b/openair2/F1AP/f1ap_cu_ue_context_management.h @@ -39,24 +39,14 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(instance_t instance, f1ap_ue_context_setup_t *f1ap_ue_context_setup_req); -int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); - -int CU_handle_UE_CONTEXT_SETUP_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); +int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); +int CU_handle_UE_CONTEXT_SETUP_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); /* * 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); +int CU_handle_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); /* * UE Context Release (gNB-CU initiated) @@ -64,28 +54,19 @@ int CU_handle_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, 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); +int CU_handle_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, sctp_assoc_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, f1ap_ue_context_modif_req_t *f1ap_ue_context_modification_req); -int CU_handle_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance, - 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); +int CU_handle_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); +int CU_handle_UE_CONTEXT_MODIFICATION_FAILURE(instance_t instance, sctp_assoc_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); +int CU_handle_UE_CONTEXT_MODIFICATION_REQUIRED(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); int CU_send_UE_CONTEXT_MODIFICATION_CONFIRM(instance_t instance, f1ap_ue_context_modif_confirm_t *confirm); diff --git a/openair2/F1AP/f1ap_du_interface_management.c b/openair2/F1AP/f1ap_du_interface_management.c index 5a483f85c6..d271cccde8 100644 --- a/openair2/F1AP/f1ap_du_interface_management.c +++ b/openair2/F1AP/f1ap_du_interface_management.c @@ -50,10 +50,8 @@ int to_NRNRB(int nrb) { 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) { +int DU_handle_RESET(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } @@ -65,14 +63,11 @@ int DU_send_RESET(instance_t instance, F1AP_Reset_t *Reset) { AssertFatal(1==0,"Not implemented yet\n"); } -int DU_handle_RESET_ACKNOWLEDGE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { +int DU_handle_RESET_ACKNOWLEDGE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } - /* Error Indication */ @@ -81,14 +76,11 @@ int DU_send_ERROR_INDICATION(instance_t instance, F1AP_F1AP_PDU_t *pdu_p) { AssertFatal(1==0,"Not implemented yet\n"); } -int DU_handle_ERROR_INDICATION(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { +int DU_handle_ERROR_INDICATION(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } - /* F1 Setup */ @@ -310,7 +302,7 @@ int DU_send_F1_SETUP_REQUEST(instance_t instance, f1ap_setup_req_t *setup_req) return 0; } -int DU_handle_F1_SETUP_RESPONSE(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +int DU_handle_F1_SETUP_RESPONSE(instance_t instance, sctp_assoc_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, @@ -474,7 +466,7 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, uint32_t assoc_id, uint32_t } // SETUP FAILURE -int DU_handle_F1_SETUP_FAILURE(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +int DU_handle_F1_SETUP_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { F1AP_F1SetupFailure_t *out; F1AP_F1SetupFailureIEs_t *ie; @@ -738,25 +730,21 @@ 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) { +int DU_handle_gNB_DU_CONFIGURATION_FAILURE(instance_t instance, sctp_assoc_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) { + sctp_assoc_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) { +int DU_handle_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, sctp_assoc_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"); @@ -960,8 +948,9 @@ int DU_send_gNB_DU_RESOURCE_COORDINATION_REQUEST(instance_t instance, } int DU_handle_gNB_DU_RESOURCE_COORDINATION_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { + sctp_assoc_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu) +{ AssertFatal(0, "Not implemented yet\n"); } diff --git a/openair2/F1AP/f1ap_du_interface_management.h b/openair2/F1AP/f1ap_du_interface_management.h index a81958880b..f077dc547a 100644 --- a/openair2/F1AP/f1ap_du_interface_management.h +++ b/openair2/F1AP/f1ap_du_interface_management.h @@ -36,41 +36,25 @@ /* * Reset */ -int DU_handle_RESET(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); +int DU_handle_RESET(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); int DU_send_RESET_ACKKNOWLEDGE(instance_t instance, F1AP_ResetAcknowledge_t *ResetAcknowledge); int DU_send_RESET(instance_t instance, F1AP_Reset_t *Reset); -int DU_handle_RESET_ACKNOWLEDGE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); +int DU_handle_RESET_ACKNOWLEDGE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); /* * Error Indication */ 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); - +int DU_handle_ERROR_INDICATION(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); /* * F1 Setup */ int DU_send_F1_SETUP_REQUEST(instance_t instance, f1ap_setup_req_t *setup_req); -int DU_handle_F1_SETUP_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); +int DU_handle_F1_SETUP_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); -int DU_handle_F1_SETUP_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); +int DU_handle_F1_SETUP_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); /* * gNB-DU Configuration Update @@ -79,23 +63,17 @@ int DU_send_gNB_DU_CONFIGURATION_UPDATE(instance_t instance, 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); +int DU_handle_gNB_DU_CONFIGURATION_FAILURE(instance_t instance, sctp_assoc_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); + sctp_assoc_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); +int DU_handle_gNB_CU_CONFIGURATION_UPDATE(instance_t instance, sctp_assoc_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); @@ -112,8 +90,8 @@ int DU_send_gNB_DU_RESOURCE_COORDINATION_REQUEST(instance_t instance, 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); + sctp_assoc_t assoc_id, + uint32_t stream, + F1AP_F1AP_PDU_t *pdu); #endif /* F1AP_DU_INTERFACE_MANAGEMENT_H_ */ diff --git a/openair2/F1AP/f1ap_du_paging.c b/openair2/F1AP/f1ap_du_paging.c index 92601b357d..08a2b319e7 100644 --- a/openair2/F1AP/f1ap_du_paging.c +++ b/openair2/F1AP/f1ap_du_paging.c @@ -35,10 +35,8 @@ #include "oai_asn1.h" #include "openair2/RRC/LTE/rrc_proto.h" -int DU_handle_Paging(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) { +int DU_handle_Paging(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +{ F1AP_Paging_t *paging; F1AP_PagingIEs_t *ie; long tmsi; diff --git a/openair2/F1AP/f1ap_du_paging.h b/openair2/F1AP/f1ap_du_paging.h index 3e1806ae02..5ec21bcbae 100644 --- a/openair2/F1AP/f1ap_du_paging.h +++ b/openair2/F1AP/f1ap_du_paging.h @@ -33,9 +33,6 @@ #ifndef F1AP_DU_PAGING_H_ #define F1AP_DU_PAGING_H_ -int DU_handle_Paging(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); +int DU_handle_Paging(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); #endif /* F1AP_DU_PAGING_H_ */ diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index e30f26fc6c..5a61879059 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -55,10 +55,8 @@ #include "openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.h" /* 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) { +int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +{ F1AP_DLRRCMessageTransfer_t *container; F1AP_DLRRCMessageTransferIEs_t *ie; int executeDuplication; diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.h b/openair2/F1AP/f1ap_du_rrc_message_transfer.h index f784b7a0cf..e959d8b9e1 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.h +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.h @@ -36,10 +36,7 @@ #include "f1ap_common.h" -int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); +int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); int DU_send_UL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, const f1ap_ul_rrc_message_t *msg); diff --git a/openair2/F1AP/f1ap_du_ue_context_management.c b/openair2/F1AP/f1ap_du_ue_context_management.c index 08c4d6e27b..f3ee222bea 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.c +++ b/openair2/F1AP/f1ap_du_ue_context_management.c @@ -57,10 +57,7 @@ bool DURecvCb(protocol_ctxt_t *ctxt_pP, return true; } -int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu) +int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { F1AP_UEContextSetupRequest_t *container; int i; @@ -624,7 +621,7 @@ int DU_send_UE_CONTEXT_RELEASE_REQUEST(instance_t instance, return 0; } -int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { F1AP_UEContextReleaseCommand_t *container; F1AP_UEContextReleaseCommandIEs_t *ie; @@ -781,7 +778,7 @@ static instance_t du_create_gtpu_instance_to_cu(char *CUaddr, uint16_t CUport, c return gtpv1Init(tmp); } -int DU_handle_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +int DU_handle_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { F1AP_UEContextModificationRequest_t *container; int i; @@ -1395,7 +1392,7 @@ int DU_send_UE_CONTEXT_MODIFICATION_REQUIRED(instance_t instance, f1ap_ue_contex return 0; } -int DU_handle_UE_CONTEXT_MODIFICATION_CONFIRM(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +int DU_handle_UE_CONTEXT_MODIFICATION_CONFIRM(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { F1AP_UEContextModificationConfirm_t *container = &pdu->choice.successfulOutcome->value.choice.UEContextModificationConfirm; f1ap_ue_context_modif_confirm_t confirm = {0}; @@ -1471,7 +1468,7 @@ int DU_handle_UE_CONTEXT_MODIFICATION_CONFIRM(instance_t instance, uint32_t asso return 0; } -int DU_handle_UE_CONTEXT_MODIFICATION_REFUSE(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) +int DU_handle_UE_CONTEXT_MODIFICATION_REFUSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu) { F1AP_UEContextModificationRefuse_t *container = &pdu->choice.unsuccessfulOutcome->value.choice.UEContextModificationRefuse; f1ap_ue_context_modif_refuse_t refuse = {0}; diff --git a/openair2/F1AP/f1ap_du_ue_context_management.h b/openair2/F1AP/f1ap_du_ue_context_management.h index cd8565f328..536007da42 100644 --- a/openair2/F1AP/f1ap_du_ue_context_management.h +++ b/openair2/F1AP/f1ap_du_ue_context_management.h @@ -38,10 +38,7 @@ */ 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, - uint32_t stream, - F1AP_F1AP_PDU_t *pdu); +int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); int DU_send_UE_CONTEXT_SETUP_FAILURE(instance_t instance); @@ -55,10 +52,7 @@ 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); +int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); /* * UE Context Release Complete (gNB-DU initiated) @@ -68,10 +62,7 @@ int DU_send_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, f1ap_ue_context_rel /* * 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); +int DU_handle_UE_CONTEXT_MODIFICATION_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); int DU_send_UE_CONTEXT_MODIFICATION_RESPONSE(instance_t instance, f1ap_ue_context_modif_resp_t *resp); int DU_send_UE_CONTEXT_MODIFICATION_FAILURE(instance_t instance); @@ -80,10 +71,8 @@ int DU_send_UE_CONTEXT_MODIFICATION_FAILURE(instance_t instance); * UE Context Modification Required (gNB-DU initiated) */ int DU_send_UE_CONTEXT_MODIFICATION_REQUIRED(instance_t instance, f1ap_ue_context_modif_required_t *required); - -int DU_handle_UE_CONTEXT_MODIFICATION_CONFIRM(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); - -int DU_handle_UE_CONTEXT_MODIFICATION_REFUSE(instance_t instance, uint32_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); +int DU_handle_UE_CONTEXT_MODIFICATION_CONFIRM(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); +int DU_handle_UE_CONTEXT_MODIFICATION_REFUSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, F1AP_F1AP_PDU_t *pdu); /* * UE Inactivity Notification diff --git a/openair2/F1AP/f1ap_handlers.c b/openair2/F1AP/f1ap_handlers.c index cf2530c850..458299e626 100644 --- a/openair2/F1AP/f1ap_handlers.c +++ b/openair2/F1AP/f1ap_handlers.c @@ -97,7 +97,7 @@ static F1AP_F1AP_PDU_t *f1ap_decode_pdu(const uint8_t *const buffer, uint32_t le } int f1ap_handle_message(instance_t instance, - uint32_t assoc_id, + sctp_assoc_t assoc_id, int32_t stream, const uint8_t *const data, const uint32_t data_length) diff --git a/openair2/M2AP/m2ap_MCE_defs.h b/openair2/M2AP/m2ap_MCE_defs.h index dc8f9ff5ee..4f6e295d01 100644 --- a/openair2/M2AP/m2ap_MCE_defs.h +++ b/openair2/M2AP/m2ap_MCE_defs.h @@ -115,7 +115,7 @@ typedef struct m2ap_MCE_data_s { uint16_t cnx_id; /* SCTP association id */ - int32_t assoc_id; + sctp_assoc_t assoc_id; /* Nid cells */ uint32_t Nid_cell[MAX_NUM_CCs]; diff --git a/openair2/M2AP/m2ap_MCE_generate_messages.c b/openair2/M2AP/m2ap_MCE_generate_messages.c index 3a4c1bb473..d513fcd3db 100644 --- a/openair2/M2AP/m2ap_MCE_generate_messages.c +++ b/openair2/M2AP/m2ap_MCE_generate_messages.c @@ -314,7 +314,7 @@ int m2ap_MCE_generate_m2_setup_response(m2ap_MCE_instance_t *instance_p, m2ap_MC } int m2ap_MCE_generate_m2_setup_failure(instance_t instance, - uint32_t assoc_id, + sctp_assoc_t assoc_id, M2AP_Cause_PR cause_type, long cause_value, long time_to_wait) diff --git a/openair2/M2AP/m2ap_MCE_generate_messages.h b/openair2/M2AP/m2ap_MCE_generate_messages.h index 1632dc807a..17c8243a38 100644 --- a/openair2/M2AP/m2ap_MCE_generate_messages.h +++ b/openair2/M2AP/m2ap_MCE_generate_messages.h @@ -38,7 +38,7 @@ int m2ap_MCE_generate_m2_setup_request(m2ap_MCE_instance_t *instance_p, int m2ap_MCE_generate_m2_setup_response(m2ap_MCE_instance_t *instance_p, m2ap_MCE_data_t *m2ap_MCE_data_p); int m2ap_MCE_generate_m2_setup_failure(instance_t instance, - uint32_t assoc_id, + sctp_assoc_t assoc_id, M2AP_Cause_PR cause_type, long cause_value, long time_to_wait); diff --git a/openair2/M2AP/m2ap_MCE_handler.c b/openair2/M2AP/m2ap_MCE_handler.c index aacb178444..586b89750f 100644 --- a/openair2/M2AP/m2ap_MCE_handler.c +++ b/openair2/M2AP/m2ap_MCE_handler.c @@ -74,9 +74,11 @@ static char *m2ap_direction_String[] = { return(m2ap_direction_String[m2ap_dir]); } - -int m2ap_MCE_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, - const uint8_t * const data, const uint32_t data_length) +int m2ap_MCE_handle_message(instance_t instance, + sctp_assoc_t assoc_id, + int32_t stream, + const uint8_t *const data, + const uint32_t data_length) { M2AP_M2AP_PDU_t pdu; int ret; diff --git a/openair2/M2AP/m2ap_MCE_handler.h b/openair2/M2AP/m2ap_MCE_handler.h index 68cab5c8ac..164efe171e 100644 --- a/openair2/M2AP/m2ap_MCE_handler.h +++ b/openair2/M2AP/m2ap_MCE_handler.h @@ -33,11 +33,13 @@ //void m2ap_handle_m2_setup_message(m2ap_eNB_instance_t *instance_p, m2ap_eNB_data_t *eNB_desc_p, int sctp_shutdown); -int m2ap_MCE_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, - const uint8_t * const data, const uint32_t data_length); - -//int m2ap_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, - //const uint8_t * const data, const uint32_t data_length); +int m2ap_MCE_handle_message(instance_t instance, + sctp_assoc_t assoc_id, + int32_t stream, + const uint8_t *const data, + const uint32_t data_length); +// int m2ap_handle_message(instance_t instance, sctp_assoc_t assoc_id, int32_t stream, +// const uint8_t * const data, const uint32_t data_length); #endif /* __M2AP_MCE_HANDLERS__H__ */ diff --git a/openair2/M2AP/m2ap_MCE_interface_management.c b/openair2/M2AP/m2ap_MCE_interface_management.c index 58a4c7b967..9d45eac4a3 100644 --- a/openair2/M2AP/m2ap_MCE_interface_management.c +++ b/openair2/M2AP/m2ap_MCE_interface_management.c @@ -43,8 +43,9 @@ extern m2ap_setup_req_t *m2ap_mce_data_from_enb; /* * MBMS Session start */ -int MCE_send_MBMS_SESSION_START_REQUEST(instance_t instance/*, uint32_t assoc_id*/,m2ap_session_start_req_t* m2ap_session_start_req){ - +int MCE_send_MBMS_SESSION_START_REQUEST(instance_t instance /*, sctp_assoc_t assoc_id*/, + m2ap_session_start_req_t *m2ap_session_start_req) +{ //AssertFatal(1==0,"Not implemented yet\n"); //module_id_t enb_mod_idP=0; @@ -153,13 +154,10 @@ int MCE_send_MBMS_SESSION_START_REQUEST(instance_t instance/*, uint32_t assoc_id //MCE_m2ap_itti_send_sctp_data_req(instance, m2ap_mce_data_from_mce->assoid,buffer,len,0); m2ap_MCE_itti_send_sctp_data_req(instance,m2ap_mce_data_from_enb->assoc_id,buffer,len,0); return 0; - } -int MCE_handle_MBMS_SESSION_START_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu){ +int MCE_handle_MBMS_SESSION_START_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu) +{ //AssertFatal(1==0,"Not implemented yet\n"); LOG_D(M2AP, "MCE_handle_MBMS_SESSION_START_RESPONSE\n"); @@ -215,13 +213,10 @@ int MCE_handle_MBMS_SESSION_START_RESPONSE(instance_t instance, assoc_id,ENB_MODULE_ID_TO_INSTANCE(assoc_id)); itti_send_msg_to_task(TASK_MCE_APP, ENB_MODULE_ID_TO_INSTANCE(assoc_id), msg_g); return 0; - } -int MCE_handle_MBMS_SESSION_START_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu){ - AssertFatal(1==0,"Not implemented yet\n"); +int MCE_handle_MBMS_SESSION_START_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu) +{ + AssertFatal(1 == 0, "Not implemented yet\n"); } /* @@ -285,10 +280,8 @@ int MCE_send_MBMS_SESSION_STOP_REQUEST(instance_t instance, m2ap_session_stop_re } -int MCE_handle_MBMS_SESSION_STOP_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu){ +int MCE_handle_MBMS_SESSION_STOP_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu) +{ //AssertFatal(1==0,"Not implemented yet\n"); LOG_D(M2AP, "MCE_handle_MBMS_SESSION_STOP_RESPONSE\n"); @@ -347,14 +340,9 @@ int MCE_handle_MBMS_SESSION_STOP_RESPONSE(instance_t instance, return 0; } - - -int MCE_handle_MBMS_SESSION_STOP_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu){ +int MCE_handle_MBMS_SESSION_STOP_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); - } typedef struct M2AP_MBSFN_Area_Configuration{ M2AP_PMCH_Configuration_List_t PMCH_Configuration_List; @@ -375,8 +363,8 @@ int MCE_handle_MBMS_SESSION_STOP_FAILURE(instance_t instance, 0x00, 0x18, 0x00, 0x01, 0x80, 0x00, 0x1d, 0x00, 0x01, 0x01}; -int MCE_send_MBMS_SCHEDULING_INFORMATION(instance_t instance, /*uint32_t assoc_id,*/m2ap_mbms_scheduling_information_t * m2ap_mbms_scheduling_information){ - +int MCE_send_MBMS_SCHEDULING_INFORMATION(instance_t instance, /*sctp_assoc_t assoc_id,*/ m2ap_mbms_scheduling_information_t * m2ap_mbms_scheduling_information) +{ //module_id_t enb_mod_idP=0; //module_id_t du_mod_idP=0; @@ -573,14 +561,13 @@ ASN_SET_ADD(&ie->value.choice.MBSFN_Area_Configuration_List,m2ap_mbsfn_area_conf } m2ap_MCE_itti_send_sctp_data_req(instance,m2ap_mce_data_from_enb->assoc_id,buffer,len,0); return 0; - -} - -int MCE_handle_MBMS_SCHEDULING_INFORMATION_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu){ + } + int MCE_handle_MBMS_SCHEDULING_INFORMATION_RESPONSE(instance_t instance, + sctp_assoc_t assoc_id, + uint32_t stream, + M2AP_M2AP_PDU_t *pdu) + { LOG_D(M2AP, "MCE_handle_MBMS_SCHEDULING_INFORMATION_RESPONSE\n"); AssertFatal(pdu->present == M2AP_M2AP_PDU_PR_successfulOutcome, @@ -636,8 +623,7 @@ int MCE_handle_MBMS_SCHEDULING_INFORMATION_RESPONSE(instance_t instance, itti_send_msg_to_task(TASK_MCE_APP, ENB_MODULE_ID_TO_INSTANCE(instance), msg_g); // return 0; - -} + } /* * Reset @@ -649,19 +635,13 @@ int MCE_send_RESET(instance_t instance, m2ap_reset_t * m2ap_reset) { } - -int MCE_handle_RESET_ACKKNOWLEDGE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu) { +int MCE_handle_RESET_ACKKNOWLEDGE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); - } -int MCE_handle_RESET(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu) { +int MCE_handle_RESET(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } @@ -672,10 +652,7 @@ int MCE_send_RESET_ACKNOWLEDGE(instance_t instance, M2AP_ResetAcknowledge_t *Res /* * M2 Setup */ -int MCE_handle_M2_SETUP_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu) +int MCE_handle_M2_SETUP_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu) { LOG_D(M2AP, "MCE_handle_M2_SETUP_REQUEST assoc_id %d\n",assoc_id); @@ -832,7 +809,7 @@ int MCE_handle_M2_SETUP_REQUEST(instance_t instance, return 0; } -int MCE_send_M2_SETUP_RESPONSE(instance_t instance, /*uint32_t assoc_id,*/ +int MCE_send_M2_SETUP_RESPONSE(instance_t instance, /*sctp_assoc_t assoc_id,*/ m2ap_setup_resp_t *m2ap_setup_resp) { //module_id_t mce_mod_idP; @@ -1144,11 +1121,8 @@ int MCE_send_MCE_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_id } - -int MCE_handle_MCE_CONFIGURATION_UPDATE_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu){ +int MCE_handle_MCE_CONFIGURATION_UPDATE_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); LOG_D(M2AP, "MCE_handle_MCE_CONFIGURATION_UPDATE_FAILURE\n"); @@ -1192,11 +1166,12 @@ int MCE_handle_MCE_CONFIGURATION_UPDATE_FAILURE(instance_t instance, } - int MCE_handle_MCE_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu){ + sctp_assoc_t assoc_id, + uint32_t stream, + M2AP_M2AP_PDU_t *pdu) +{ + AssertFatal(1==0,"Not implemented yet\n"); LOG_D(M2AP, "MCE_handle_MCE_CONFIGURATION_UPDATE_ACKNOWLEDGE assoc_id %d\n",assoc_id); @@ -1221,19 +1196,14 @@ int MCE_handle_MCE_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, itti_send_msg_to_task(TASK_MCE_APP, ENB_MODULE_ID_TO_INSTANCE(instance), message_p); return 0; - } - /* * ENB Configuration Update */ - -int MCE_handle_ENB_CONFIGURATION_UPDATE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu){ +int MCE_handle_ENB_CONFIGURATION_UPDATE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); LOG_D(M2AP, "MCE_handle_MCE_CONFIGURATION_UPDATE_ACKNOWLEDGE assoc_id %d\n",assoc_id); @@ -1280,13 +1250,9 @@ int MCE_send_ENB_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, * Error Indication */ -int MCE_handle_ERROR_INDICATION(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu) { +int MCE_handle_ERROR_INDICATION(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); - - } int MCE_send_ERROR_INDICATION(instance_t instance, M2AP_ErrorIndication_t *ErrorIndication) { @@ -1304,18 +1270,11 @@ int MCE_send_MBMS_SESSION_UPDATE_REQUEST(instance_t instance, m2ap_mbms_session_ //M2AP_SessionUpdateRequest_t SessionUpdateRequest; } - - -int MCE_handle_MBMS_SESSION_UPDATE_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu){ +int MCE_handle_MBMS_SESSION_UPDATE_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); - } - - int MCE_handle_MBMS_SESSION_UPDATE_FAILURE(instance_t instance,module_id_t du_mod_idP){ AssertFatal(1==0,"Not implemented yet\n"); @@ -1330,12 +1289,8 @@ int MCE_send_MBMS_SERVICE_COUNTING_REQUEST(instance_t instance, module_id_t du_m //M2AP_MbmsServiceCountingRequest_t MbmsServiceCountingRequest; } - - -int MCE_handle_MBMS_SERVICE_COUNTING_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu){ +int MCE_handle_MBMS_SERVICE_COUNTING_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu) +{ //int i; //AssertFatal(1==0,"Not implemented yet\n"); LOG_D(M2AP, "MCE_handle_MBMS_SERVICE_COUNTING_RESPONSE\n"); @@ -1468,9 +1423,10 @@ int MCE_handle_MBMS_SESSION_COUNTING_FAILURE(instance_t instance, module_id_t d */ int MCE_handle_MBMS_SESSION_COUNTING_RESULTS_REPORT(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu){ + sctp_assoc_t assoc_id, + uint32_t stream, + M2AP_M2AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } @@ -1479,10 +1435,8 @@ int MCE_handle_MBMS_SESSION_COUNTING_RESULTS_REPORT(instance_t instance, /* * Overload Notification */ -int MCE_handle_MBMS_OVERLOAD_NOTIFICATION(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu){ +int MCE_handle_MBMS_OVERLOAD_NOTIFICATION(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } diff --git a/openair2/M2AP/m2ap_MCE_interface_management.h b/openair2/M2AP/m2ap_MCE_interface_management.h index 2b1d5824af..c88b3a524c 100644 --- a/openair2/M2AP/m2ap_MCE_interface_management.h +++ b/openair2/M2AP/m2ap_MCE_interface_management.h @@ -35,69 +35,50 @@ /* * MBMS Session start */ -int MCE_send_MBMS_SESSION_START_REQUEST(instance_t instance/*, - uint32_t assoc_id*/,m2ap_session_start_req_t* m2ap_session_start_req); -int MCE_handle_MBMS_SESSION_START_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); +int MCE_send_MBMS_SESSION_START_REQUEST(instance_t instance /*, + sctp_assoc_t assoc_id*/ + , + m2ap_session_start_req_t *m2ap_session_start_req); +int MCE_handle_MBMS_SESSION_START_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); -int MCE_handle_MBMS_SESSION_START_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); +int MCE_handle_MBMS_SESSION_START_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); /* * MBMS Session stop */ int MCE_send_MBMS_SESSION_STOP_REQUEST(instance_t instance, m2ap_session_stop_req_t* m2ap_session_stop_req); -int MCE_handle_MBMS_SESSION_STOP_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); +int MCE_handle_MBMS_SESSION_STOP_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); /* * MBMS Scheduling Information */ int MCE_send_MBMS_SCHEDULING_INFORMATION(instance_t instance, - /*uint32_t assoc_id,*/ m2ap_mbms_scheduling_information_t * m2ap_mbms_scheduling_information ); + /*sctp_assoc_t assoc_id,*/ m2ap_mbms_scheduling_information_t *m2ap_mbms_scheduling_information); int MCE_handle_MBMS_SCHEDULING_INFORMATION_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); - - + sctp_assoc_t assoc_id, + uint32_t stream, + M2AP_M2AP_PDU_t *pdu); /* * Reset */ int MCE_send_RESET(instance_t instance, m2ap_reset_t * m2ap_reset); -int MCE_handle_RESET_ACKKNOWLEDGE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); +int MCE_handle_RESET_ACKKNOWLEDGE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); -int MCE_handle_RESET(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); +int MCE_handle_RESET(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); int MCE_send_RESET_ACKNOWLEDGE(instance_t instance, M2AP_ResetAcknowledge_t *ResetAcknowledge); /* * M2AP Setup */ -int MCE_handle_M2_SETUP_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); +int MCE_handle_M2_SETUP_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); -int MCE_send_M2_SETUP_RESPONSE(instance_t instance,/*uint32_t assoc_id,*/ m2ap_setup_resp_t *m2ap_setup_resp); - -int MCE_send_M2_SETUP_FAILURE(instance_t instance, /*uint32_t assoc_id*/ m2ap_setup_failure_t * m2ap_setup_failure); +int MCE_send_M2_SETUP_RESPONSE(instance_t instance, /*sctp_assoc_t assoc_id,*/ m2ap_setup_resp_t *m2ap_setup_resp); +int MCE_send_M2_SETUP_FAILURE(instance_t instance, /*sctp_assoc_t assoc_id*/ m2ap_setup_failure_t *m2ap_setup_failure); /* * MCE Configuration Update @@ -105,25 +86,18 @@ int MCE_send_M2_SETUP_FAILURE(instance_t instance, /*uint32_t assoc_id*/ m2ap_se int MCE_send_MCE_CONFIGURATION_UPDATE(instance_t instance, module_id_t du_mod_idP); -int MCE_handle_MCE_CONFIGURATION_UPDATE_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); +int MCE_handle_MCE_CONFIGURATION_UPDATE_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); int MCE_handle_MCE_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); + sctp_assoc_t assoc_id, + uint32_t stream, + M2AP_M2AP_PDU_t *pdu); /* * ENB Configuration Update */ - -int MCE_handle_ENB_CONFIGURATION_UPDATE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); +int MCE_handle_ENB_CONFIGURATION_UPDATE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); int MCE_send_ENB_CONFIGURATION_UPDATE_FAILURE(instance_t instance, m2ap_enb_configuration_update_failure_t *m2ap_enb_configuration_update_failure); @@ -133,10 +107,7 @@ int MCE_send_ENB_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, /* * Error Indication */ -int MCE_handle_ERROR_INDICATION(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); +int MCE_handle_ERROR_INDICATION(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); int MCE_send_ERROR_INDICATION(instance_t instance, M2AP_ErrorIndication_t *ErrorIndication); @@ -145,10 +116,7 @@ int MCE_send_ERROR_INDICATION(instance_t instance, M2AP_ErrorIndication_t *Error */ int MCE_send_MBMS_SESSION_UPDATE_REQUEST(instance_t instance, m2ap_mbms_session_update_req_t * m2ap_mbms_session_update_req); -int MCE_handle_MBMS_SESSION_UPDATE_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); +int MCE_handle_MBMS_SESSION_UPDATE_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); int MCE_handle_MBMS_SESSION_UPDATE_FAILURE(instance_t instance,module_id_t du_mod_idP); @@ -157,10 +125,7 @@ int MCE_handle_MBMS_SESSION_UPDATE_FAILURE(instance_t instance,module_id_t du_mo */ int MCE_send_MBMS_SERVICE_COUNTING_REQUEST(instance_t instance, module_id_t du_mod_idP); -int MCE_handle_MBMS_SERVICE_COUNTING_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); +int MCE_handle_MBMS_SERVICE_COUNTING_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); int MCE_handle_MBMS_SESSION_COUNTING_FAILURE(instance_t instance, module_id_t du_mod_idP); /* @@ -168,21 +133,14 @@ int MCE_handle_MBMS_SESSION_COUNTING_FAILURE(instance_t instance, module_id_t du */ int MCE_handle_MBMS_SESSION_COUNTING_RESULTS_REPORT(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); + sctp_assoc_t assoc_id, + uint32_t stream, + M2AP_M2AP_PDU_t *pdu); /* * Overload Notification */ -int MCE_handle_MBMS_OVERLOAD_NOTIFICATION(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); - - - - +int MCE_handle_MBMS_OVERLOAD_NOTIFICATION(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); #endif /* M2AP_MCE_INTERFACE_MANAGEMENT_H_ */ diff --git a/openair2/M2AP/m2ap_MCE_management_procedures.c b/openair2/M2AP/m2ap_MCE_management_procedures.c index 3934a57c74..82ae691350 100644 --- a/openair2/M2AP/m2ap_MCE_management_procedures.c +++ b/openair2/M2AP/m2ap_MCE_management_procedures.c @@ -122,9 +122,7 @@ dump_mce_tree_m2(zz->m2ap_mce_head.rbh_root); } } -struct m2ap_MCE_data_s *m2ap_get_MCE(m2ap_MCE_instance_t *instance_p, - int32_t assoc_id, - uint16_t cnx_id) +struct m2ap_MCE_data_s *m2ap_get_MCE(m2ap_MCE_instance_t *instance_p, sctp_assoc_t assoc_id, uint16_t cnx_id) { struct m2ap_MCE_data_s temp; struct m2ap_MCE_data_s *found; diff --git a/openair2/M2AP/m2ap_MCE_management_procedures.h b/openair2/M2AP/m2ap_MCE_management_procedures.h index 4e8997dbc5..e4997a140e 100644 --- a/openair2/M2AP/m2ap_MCE_management_procedures.h +++ b/openair2/M2AP/m2ap_MCE_management_procedures.h @@ -47,8 +47,6 @@ m2ap_MCE_data_t* m2ap_is_MCE_assoc_id_in_list(uint32_t sctp_assoc_id); m2ap_MCE_data_t* m2ap_is_MCE_pci_in_list (const uint32_t pci); -struct m2ap_MCE_data_s *m2ap_get_MCE(m2ap_MCE_instance_t *instance_p, - int32_t assoc_id, - uint16_t cnx_id); +struct m2ap_MCE_data_s *m2ap_get_MCE(m2ap_MCE_instance_t *instance_p, sctp_assoc_t assoc_id, uint16_t cnx_id); #endif /* __M2AP_MCE_MANAGEMENT_PROCEDURES__H__ */ diff --git a/openair2/M2AP/m2ap_common.h b/openair2/M2AP/m2ap_common.h index 7981eaa2a5..92e3274c81 100644 --- a/openair2/M2AP/m2ap_common.h +++ b/openair2/M2AP/m2ap_common.h @@ -76,25 +76,11 @@ extern int asn1_xer_print; /** \brief Function callback prototype. **/ -typedef int (*m2ap_message_decoded_callback)( - instance_t instance, - uint32_t assocId, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); - -typedef int (*m2ap_MCE_message_decoded_callback)( - instance_t instance, - uint32_t assocId, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); - -typedef int (*m2ap_eNB_message_decoded_callback)( - instance_t instance, - uint32_t assocId, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); +typedef int (*m2ap_message_decoded_callback)(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); +typedef int (*m2ap_MCE_message_decoded_callback)(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); +typedef int (*m2ap_eNB_message_decoded_callback)(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); /** \brief Encode a successfull outcome message \param buffer pointer to buffer in which data will be encoded diff --git a/openair2/M2AP/m2ap_eNB_defs.h b/openair2/M2AP/m2ap_eNB_defs.h index 4cc409400e..c7f30c69c7 100644 --- a/openair2/M2AP/m2ap_eNB_defs.h +++ b/openair2/M2AP/m2ap_eNB_defs.h @@ -27,6 +27,8 @@ */ #include +#include +#include #include "queue.h" #include "tree.h" @@ -115,7 +117,7 @@ typedef struct m2ap_eNB_data_s { uint16_t cnx_id; /* SCTP association id */ - int32_t assoc_id; + sctp_assoc_t assoc_id; /* Nid cells */ uint32_t Nid_cell[MAX_NUM_CCs]; diff --git a/openair2/M2AP/m2ap_eNB_generate_messages.c b/openair2/M2AP/m2ap_eNB_generate_messages.c index 8e7e096d13..93ea5a1f19 100644 --- a/openair2/M2AP/m2ap_eNB_generate_messages.c +++ b/openair2/M2AP/m2ap_eNB_generate_messages.c @@ -311,7 +311,7 @@ //} //int m2ap_MCE_generate_m2_setup_failure(instance_t instance, -// uint32_t assoc_id, +// sctp_assoc_t assoc_id, // M2AP_Cause_PR cause_type, // long cause_value, // long time_to_wait) diff --git a/openair2/M2AP/m2ap_eNB_generate_messages.h b/openair2/M2AP/m2ap_eNB_generate_messages.h index 793f7f18cf..a65941ac57 100644 --- a/openair2/M2AP/m2ap_eNB_generate_messages.h +++ b/openair2/M2AP/m2ap_eNB_generate_messages.h @@ -38,7 +38,7 @@ //int m2ap_MCE_generate_m2_setup_response(m2ap_eNB_instance_t *instance_p, m2ap_eNB_data_t *m2ap_eNB_data_p); // /*int m2ap_MCE_generate_m2_setup_failure(instance_t instance, - uint32_t assoc_id, + sctp_assoc_t assoc_id, M2AP_Cause_PR cause_type, long cause_value, long time_to_wait);*/ diff --git a/openair2/M2AP/m2ap_eNB_handler.c b/openair2/M2AP/m2ap_eNB_handler.c index 0a474c72a8..14b657d6ad 100644 --- a/openair2/M2AP/m2ap_eNB_handler.c +++ b/openair2/M2AP/m2ap_eNB_handler.c @@ -72,9 +72,11 @@ static char *m2ap_direction_String[] = { return(m2ap_direction_String[m2ap_dir]); } - -int m2ap_eNB_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, - const uint8_t * const data, const uint32_t data_length) +int m2ap_eNB_handle_message(instance_t instance, + sctp_assoc_t assoc_id, + int32_t stream, + const uint8_t *const data, + const uint32_t data_length) { M2AP_M2AP_PDU_t pdu; int ret; diff --git a/openair2/M2AP/m2ap_eNB_handler.h b/openair2/M2AP/m2ap_eNB_handler.h index ea4231a6e3..1954d20de9 100644 --- a/openair2/M2AP/m2ap_eNB_handler.h +++ b/openair2/M2AP/m2ap_eNB_handler.h @@ -33,10 +33,13 @@ //void m2ap_handle_m2_setup_message(m2ap_eNB_instance_t *instance_p, m2ap_eNB_data_t *eNB_desc_p, int sctp_shutdown); -int m2ap_eNB_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, - const uint8_t * const data, const uint32_t data_length); +int m2ap_eNB_handle_message(instance_t instance, + sctp_assoc_t assoc_id, + int32_t stream, + const uint8_t *const data, + const uint32_t data_length); -//int m2ap_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, +//int m2ap_handle_message(instance_t instance, sctp_assoc_t assoc_id, int32_t stream, //const uint8_t * const data, const uint32_t data_length); diff --git a/openair2/M2AP/m2ap_eNB_interface_management.c b/openair2/M2AP/m2ap_eNB_interface_management.c index a336a559a3..987f02b613 100644 --- a/openair2/M2AP/m2ap_eNB_interface_management.c +++ b/openair2/M2AP/m2ap_eNB_interface_management.c @@ -60,10 +60,8 @@ extern m2ap_setup_req_t *m2ap_enb_data_g; //extern m2ap_setup_req_t *m2ap_mce_data_from_enb; -int eNB_handle_MBMS_SCHEDULING_INFORMATION(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu){ +int eNB_handle_MBMS_SCHEDULING_INFORMATION(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu) +{ LOG_D(M2AP, "eNB_handle_MBMS_SCHEDULING_INFORMATION assoc_id %d\n",assoc_id); MessageDef *message_p/*,*message_p2*/; @@ -258,13 +256,8 @@ int eNB_send_MBMS_SCHEDULING_INFORMATION_RESPONSE(instance_t instance, m2ap_mbms return 0; } - - - -int eNB_handle_MBMS_SESSION_START_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu){ +int eNB_handle_MBMS_SESSION_START_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu) +{ LOG_D(M2AP, "eNB_handle_MBMS_SESSION_START_REQUEST assoc_id %d\n",assoc_id); MessageDef *message_p; @@ -424,10 +417,8 @@ int eNB_send_MBMS_SESSION_START_FAILURE(instance_t instance, m2ap_session_start_ return 0; } -int eNB_handle_MBMS_SESSION_STOP_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu){ +int eNB_handle_MBMS_SESSION_STOP_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu) +{ LOG_D(M2AP, "eNB_handle_MBMS_SESSION_STOP_REQUEST assoc_id %d\n",assoc_id); MessageDef *message_p; @@ -688,10 +679,7 @@ int eNB_send_M2_SETUP_REQUEST(m2ap_eNB_instance_t *instance_p, m2ap_eNB_data_t* } -int eNB_handle_M2_SETUP_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu) +int eNB_handle_M2_SETUP_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu) { LOG_D(M2AP, "eNB_handle_M2_SETUP_RESPONSE\n"); @@ -800,10 +788,8 @@ int eNB_handle_M2_SETUP_RESPONSE(instance_t instance, } // SETUP FAILURE -int eNB_handle_M2_SETUP_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu) { +int eNB_handle_M2_SETUP_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu) +{ LOG_D(M2AP, "eNB_handle_M2_SETUP_FAILURE\n"); M2AP_M2SetupFailure_t *in = &pdu->choice.unsuccessfulOutcome.value.choice.M2SetupFailure; @@ -985,10 +971,7 @@ int eNB_send_eNB_CONFIGURATION_UPDATE(instance_t instance, m2ap_enb_configuratio return 0; } -int eNB_handle_eNB_CONFIGURATION_UPDATE_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu) +int eNB_handle_eNB_CONFIGURATION_UPDATE_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu) { AssertFatal(1==0,"Not implemented yet\n"); @@ -1032,12 +1015,10 @@ int eNB_handle_eNB_CONFIGURATION_UPDATE_FAILURE(instance_t instance, return 0; } - - int eNB_handle_eNB_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu) + sctp_assoc_t assoc_id, + uint32_t stream, + M2AP_M2AP_PDU_t *pdu) { LOG_D(M2AP, "eNB_handle_eNB_CONFIGURATION_UPDATE_ACKNOWLEDGE assoc_id %d\n",assoc_id); @@ -1069,10 +1050,7 @@ int eNB_handle_eNB_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, /* * MCE Configuration Update */ -int eNB_handle_MCE_CONFIGURATION_UPDATE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu) +int eNB_handle_MCE_CONFIGURATION_UPDATE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu) { LOG_D(M2AP, "eNB_handle_MCE_CONFIGURATION_UPDATE assoc_id %d\n",assoc_id); @@ -1126,10 +1104,7 @@ int eNB_send_ERROR_INDICATION(instance_t instance, m2ap_error_indication_t * m2a return 0; } -int eNB_handle_ERROR_INDICATION(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu) +int eNB_handle_ERROR_INDICATION(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu) { AssertFatal(1==0,"Not implemented yet\n"); return 0; @@ -1140,10 +1115,7 @@ int eNB_handle_ERROR_INDICATION(instance_t instance, /* * Session Update Request */ -int eNB_handle_MBMS_SESSION_UPDATE_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu) +int eNB_handle_MBMS_SESSION_UPDATE_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu) { LOG_D(M2AP, "eNB_handle_MBMS_SESSION_STOP_REQUEST assoc_id %d\n",assoc_id); @@ -1190,10 +1162,7 @@ int eNB_send_MBMS_SESSION_UPDATE_FAILURE(instance_t instance, m2ap_mbms_session_ * Service Counting */ -int eNB_handle_MBMS_SERVICE_COUNTING_REQ(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu) +int eNB_handle_MBMS_SERVICE_COUNTING_REQ(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu) { LOG_D(M2AP, "eNB_handle_MBMS_SERVICE_COUNTING_REQUEST assoc_id %d\n",assoc_id); diff --git a/openair2/M2AP/m2ap_eNB_interface_management.h b/openair2/M2AP/m2ap_eNB_interface_management.h index 09bab1f125..a0c38c0760 100644 --- a/openair2/M2AP/m2ap_eNB_interface_management.h +++ b/openair2/M2AP/m2ap_eNB_interface_management.h @@ -37,10 +37,7 @@ * Session Start */ -int eNB_handle_MBMS_SESSION_START_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); +int eNB_handle_MBMS_SESSION_START_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); int eNB_send_MBMS_SESSION_START_RESPONSE(instance_t instance, m2ap_session_start_resp_t * m2ap_session_start_resp); int eNB_send_MBMS_SESSION_START_FAILURE(instance_t instance, m2ap_session_start_failure_t * m2ap_session_start_failure ); @@ -49,10 +46,7 @@ int eNB_send_MBMS_SESSION_START_FAILURE(instance_t instance, m2ap_session_start_ * Session Stop */ -int eNB_handle_MBMS_SESSION_STOP_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); +int eNB_handle_MBMS_SESSION_STOP_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); int eNB_send_MBMS_SESSION_STOP_RESPONSE(instance_t instance, m2ap_session_stop_resp_t * m2ap_session_stop_resp); @@ -60,10 +54,7 @@ int eNB_send_MBMS_SESSION_STOP_RESPONSE(instance_t instance, m2ap_session_stop_r * MBMS Scheduling Information */ -int eNB_handle_MBMS_SCHEDULING_INFORMATION(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); +int eNB_handle_MBMS_SCHEDULING_INFORMATION(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); int eNB_send_MBMS_SCHEDULING_INFORMATION_RESPONSE(instance_t instance, m2ap_mbms_scheduling_information_resp_t * m2ap_mbms_scheduling_information_resp); @@ -71,54 +62,36 @@ int eNB_send_MBMS_SCHEDULING_INFORMATION_RESPONSE(instance_t instance, m2ap_mbms /* * Reset */ -int eNB_handle_RESET(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); +int eNB_handle_RESET(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); int eNB_send_RESET_ACKKNOWLEDGE(instance_t instance, M2AP_ResetAcknowledge_t *ResetAcknowledge); int eNB_send_RESET(instance_t instance, M2AP_Reset_t *Reset); -int eNB_handle_RESET_ACKNOWLEDGE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); +int eNB_handle_RESET_ACKNOWLEDGE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); /* * M2AP Setup */ int eNB_send_M2_SETUP_REQUEST( m2ap_eNB_instance_t *instance_p, m2ap_eNB_data_t *m2ap_eNB_data_p); -int eNB_handle_M2_SETUP_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); +int eNB_handle_M2_SETUP_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); -int eNB_handle_M2_SETUP_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); +int eNB_handle_M2_SETUP_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); /* * eNB Configuration Update */ int eNB_send_eNB_CONFIGURATION_UPDATE(instance_t instance, m2ap_enb_configuration_update_t * m2ap_enb_configuration_update); -int eNB_handle_eNB_CONFIGURATION_UPDATE_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); +int eNB_handle_eNB_CONFIGURATION_UPDATE_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); int eNB_handle_eNB_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); + sctp_assoc_t assoc_id, + uint32_t stream, + M2AP_M2AP_PDU_t *pdu); /* * MCE Configuration Update */ -int eNB_handle_MCE_CONFIGURATION_UPDATE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); +int eNB_handle_MCE_CONFIGURATION_UPDATE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); int eNB_send_MCE_CONFIGURATION_UPDATE_FAILURE(instance_t instance, M2AP_MCEConfigurationUpdateFailure_t *MCEConfigurationUpdateFailure); @@ -130,19 +103,12 @@ int eNB_send_MCE_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, * Error Indication */ int eNB_send_ERROR_INDICATION(instance_t instance, m2ap_error_indication_t * m2ap_error_indication); -int eNB_handle_ERROR_INDICATION(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); - +int eNB_handle_ERROR_INDICATION(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); /* * Session Update Request */ -int eNB_handle_MBMS_SESSION_UPDATE_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); +int eNB_handle_MBMS_SESSION_UPDATE_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); int eNB_send_MBMS_SESSION_UPDATE_RESPONSE(instance_t instance, m2ap_mbms_session_update_resp_t * m2ap_mbms_session_update_resp); //?? @@ -152,10 +118,7 @@ int eNB_send_MBMS_SESSION_UPDATE_FAILURE(instance_t instance, m2ap_mbms_session_ * Service Counting */ -int eNB_handle_MBMS_SERVICE_COUNTING_REQ(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M2AP_M2AP_PDU_t *pdu); +int eNB_handle_MBMS_SERVICE_COUNTING_REQ(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M2AP_M2AP_PDU_t *pdu); int eNB_send_MBMS_SERVICE_COUNTING_REPORT(instance_t instance, m2ap_mbms_service_counting_report_t * m2ap_mbms_service_counting_report); int eNB_send_MBMS_SERVICE_COUNTING_RESP(instance_t instance, m2ap_mbms_service_counting_resp_t * m2ap_mbms_service_counting_resp); int eNB_send_MBMS_SERVICE_COUNTING_FAILURE(instance_t instance, m2ap_mbms_service_counting_failure_t * m2ap_mbms_service_counting_failure); diff --git a/openair2/M2AP/m2ap_eNB_management_procedures.c b/openair2/M2AP/m2ap_eNB_management_procedures.c index 59d91afb74..014ecf08d8 100644 --- a/openair2/M2AP/m2ap_eNB_management_procedures.c +++ b/openair2/M2AP/m2ap_eNB_management_procedures.c @@ -122,9 +122,7 @@ printf("---------------------------------------------\n"); } } -struct m2ap_eNB_data_s *m2ap_get_eNB(m2ap_eNB_instance_t *instance_p, - int32_t assoc_id, - uint16_t cnx_id) +struct m2ap_eNB_data_s *m2ap_get_eNB(m2ap_eNB_instance_t *instance_p, sctp_assoc_t assoc_id, uint16_t cnx_id) { struct m2ap_eNB_data_s temp; struct m2ap_eNB_data_s *found; diff --git a/openair2/M2AP/m2ap_eNB_management_procedures.h b/openair2/M2AP/m2ap_eNB_management_procedures.h index 2b1dc4a44b..e30943b4f2 100644 --- a/openair2/M2AP/m2ap_eNB_management_procedures.h +++ b/openair2/M2AP/m2ap_eNB_management_procedures.h @@ -47,8 +47,6 @@ m2ap_eNB_data_t* m2ap_is_eNB_assoc_id_in_list(uint32_t sctp_assoc_id); m2ap_eNB_data_t* m2ap_is_eNB_pci_in_list (const uint32_t pci); -struct m2ap_eNB_data_s *m2ap_get_eNB(m2ap_eNB_instance_t *instance_p, - int32_t assoc_id, - uint16_t cnx_id); +struct m2ap_eNB_data_s *m2ap_get_eNB(m2ap_eNB_instance_t *instance_p, sctp_assoc_t assoc_id, uint16_t cnx_id); #endif /* __M2AP_ENB_MANAGEMENT_PROCEDURES__H__ */ diff --git a/openair2/M2AP/m2ap_handler.c b/openair2/M2AP/m2ap_handler.c index ce568d3c19..2840f0bce8 100644 --- a/openair2/M2AP/m2ap_handler.c +++ b/openair2/M2AP/m2ap_handler.c @@ -74,9 +74,11 @@ static char *m2ap_direction_String[] = { return(m2ap_direction_String[m2ap_dir]); } - -int m2ap_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, - const uint8_t * const data, const uint32_t data_length) +int m2ap_handle_message(instance_t instance, + sctp_assoc_t assoc_id, + int32_t stream, + const uint8_t *const data, + const uint32_t data_length) { M2AP_M2AP_PDU_t pdu; int ret; diff --git a/openair2/M2AP/m2ap_handler.h b/openair2/M2AP/m2ap_handler.h index 88fb26bc3e..f642c16cc8 100644 --- a/openair2/M2AP/m2ap_handler.h +++ b/openair2/M2AP/m2ap_handler.h @@ -33,11 +33,16 @@ void m2ap_handle_m2_setup_message(m2ap_eNB_instance_t *instance_p, m2ap_eNB_data_t *eNB_desc_p, int sctp_shutdown); -int m2ap_eNB_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, - const uint8_t * const data, const uint32_t data_length); - -int m2ap_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, - const uint8_t * const data, const uint32_t data_length); +int m2ap_eNB_handle_message(instance_t instance, + sctp_assoc_t assoc_id, + int32_t stream, + const uint8_t *const data, + const uint32_t data_length); +int m2ap_handle_message(instance_t instance, + sctp_assoc_t assoc_id, + int32_t stream, + const uint8_t *const data, + const uint32_t data_length); #endif /* M2AP_ENB_OLD_HANDLERS_H_ */ diff --git a/openair2/M2AP/m2ap_itti_messaging.c b/openair2/M2AP/m2ap_itti_messaging.c index e0dcc27175..9c9528c349 100644 --- a/openair2/M2AP/m2ap_itti_messaging.c +++ b/openair2/M2AP/m2ap_itti_messaging.c @@ -30,8 +30,11 @@ #include "m2ap_itti_messaging.h" -void m2ap_eNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer, - uint32_t buffer_length, uint16_t stream) +void m2ap_eNB_itti_send_sctp_data_req(instance_t instance, + sctp_assoc_t assoc_id, + uint8_t *buffer, + uint32_t buffer_length, + uint16_t stream) { MessageDef *message_p; sctp_data_req_t *sctp_data_req; @@ -51,7 +54,7 @@ void m2ap_eNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uin } -void m2ap_eNB_itti_send_sctp_close_association(instance_t instance, int32_t assoc_id) +void m2ap_eNB_itti_send_sctp_close_association(instance_t instance, sctp_assoc_t assoc_id) { MessageDef *message_p = NULL; sctp_close_association_t *sctp_close_association_p = NULL; @@ -63,9 +66,11 @@ void m2ap_eNB_itti_send_sctp_close_association(instance_t instance, int32_t asso itti_send_msg_to_task(TASK_SCTP, instance, message_p); } - -void m2ap_MCE_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer, - uint32_t buffer_length, uint16_t stream) +void m2ap_MCE_itti_send_sctp_data_req(instance_t instance, + sctp_assoc_t assoc_id, + uint8_t *buffer, + uint32_t buffer_length, + uint16_t stream) { MessageDef *message_p; sctp_data_req_t *sctp_data_req; @@ -83,7 +88,7 @@ void m2ap_MCE_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uin } -void m2ap_MCE_itti_send_sctp_close_association(instance_t instance, int32_t assoc_id) +void m2ap_MCE_itti_send_sctp_close_association(instance_t instance, sctp_assoc_t assoc_id) { MessageDef *message_p = NULL; sctp_close_association_t *sctp_close_association_p = NULL; diff --git a/openair2/M2AP/m2ap_itti_messaging.h b/openair2/M2AP/m2ap_itti_messaging.h index bdc416bca7..11df7c0e64 100644 --- a/openair2/M2AP/m2ap_itti_messaging.h +++ b/openair2/M2AP/m2ap_itti_messaging.h @@ -29,18 +29,21 @@ #ifndef M2AP_ENB_ITTI_MESSAGING_H_ #define M2AP_ENB_ITTI_MESSAGING_H_ -void m2ap_eNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer, - uint32_t buffer_length, uint16_t stream); +void m2ap_eNB_itti_send_sctp_data_req(instance_t instance, + sctp_assoc_t assoc_id, + uint8_t *buffer, + uint32_t buffer_length, + uint16_t stream); +void m2ap_eNB_itti_send_sctp_close_association(instance_t instance, sctp_assoc_t assoc_id); -void m2ap_eNB_itti_send_sctp_close_association(instance_t instance, int32_t assoc_id); +void m2ap_MCE_itti_send_sctp_data_req(instance_t instance, + sctp_assoc_t assoc_id, + uint8_t *buffer, + uint32_t buffer_length, + uint16_t stream); - -void m2ap_MCE_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer, - uint32_t buffer_length, uint16_t stream); - - -void m2ap_MCE_itti_send_sctp_close_association(instance_t instance, int32_t assoc_id); +void m2ap_MCE_itti_send_sctp_close_association(instance_t instance, sctp_assoc_t assoc_id); diff --git a/openair2/RRC/LTE/rrc_defs.h b/openair2/RRC/LTE/rrc_defs.h index 30f47b99ac..b233cd502d 100644 --- a/openair2/RRC/LTE/rrc_defs.h +++ b/openair2/RRC/LTE/rrc_defs.h @@ -387,7 +387,7 @@ typedef struct HANDOVER_INFO_s { HO_STATE_t state; //current state of handover uint32_t modid_s; //module_idP of serving cell uint32_t modid_t; //module_idP of target cell - int assoc_id; + sctp_assoc_t assoc_id; uint8_t ueid_s; //UE index in serving cell uint8_t ueid_t; //UE index in target cell LTE_AS_Config_t as_config; /* these two parameters are taken from 36.331 section 10.2.2: HandoverPreparationInformation-r8-IEs */ diff --git a/openair2/RRC/NR/nr_rrc_defs.h b/openair2/RRC/NR/nr_rrc_defs.h index 362d2bcee5..215fc9851d 100644 --- a/openair2/RRC/NR/nr_rrc_defs.h +++ b/openair2/RRC/NR/nr_rrc_defs.h @@ -369,7 +369,7 @@ typedef struct cucp_cuup_if_s { } cucp_cuup_if_t; typedef struct nr_rrc_du_container_t { - int assoc_id; + sctp_assoc_t assoc_id; f1ap_setup_req_t *setup_req; NR_MIB_t *mib; NR_SIB1_t *sib1; diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 23fcbffe50..228056ce37 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -1801,7 +1801,7 @@ static bool rrc_gNB_plmn_matches(const gNB_RRC_INST *rrc, const f1ap_served_cell && rrc->nr_cellid == info->nr_cellid; } -static void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *req, int assoc_id) +static void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *req, sctp_assoc_t assoc_id) { gNB_RRC_INST *rrc = RC.nrrrc[0]; DevAssert(rrc); @@ -2424,7 +2424,7 @@ void rrc_gNB_process_e1_bearer_context_setup_resp(e1ap_bearer_setup_resp_t *resp prepare_and_send_ue_context_modification_f1(ue_context_p, resp); } -static void rrc_CU_process_f1_lost_connection(gNB_RRC_INST *rrc, f1ap_lost_connection_t *lc, int assoc_id) +static void rrc_CU_process_f1_lost_connection(gNB_RRC_INST *rrc, f1ap_lost_connection_t *lc, sctp_assoc_t assoc_id) { AssertFatal(rrc->du != NULL, "no DU connected, cannot received F1 lost connection\n"); AssertFatal(rrc->du->assoc_id == assoc_id, diff --git a/openair2/X2AP/x2ap_common.h b/openair2/X2AP/x2ap_common.h index 9535e9fb69..f42ec6bc4c 100644 --- a/openair2/X2AP/x2ap_common.h +++ b/openair2/X2AP/x2ap_common.h @@ -20,6 +20,8 @@ */ #ifndef X2AP_COMMON_H_ #define X2AP_COMMON_H_ +#include +#include #include "oai_asn1.h" #include "X2AP_ProtocolIE-Field.h" #include "X2AP_X2AP-PDU.h" @@ -72,11 +74,7 @@ extern int asn1_xer_print; /** \brief Function callback prototype. **/ -typedef int (*x2ap_message_decoded_callback)( - instance_t instance, - uint32_t assocId, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu); +typedef int (*x2ap_message_decoded_callback)(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu); /** \brief Encode a successfull outcome message \param buffer pointer to buffer in which data will be encoded diff --git a/openair2/X2AP/x2ap_eNB_defs.h b/openair2/X2AP/x2ap_eNB_defs.h index 96e76f5603..d22f6efeb7 100644 --- a/openair2/X2AP/x2ap_eNB_defs.h +++ b/openair2/X2AP/x2ap_eNB_defs.h @@ -116,7 +116,7 @@ typedef struct x2ap_eNB_data_s { uint16_t cnx_id; /* SCTP association id */ - int32_t assoc_id; + sctp_assoc_t assoc_id; /* Nid cells */ uint32_t Nid_cell[MAX_NUM_CCs]; diff --git a/openair2/X2AP/x2ap_eNB_generate_messages.c b/openair2/X2AP/x2ap_eNB_generate_messages.c index de797293de..25d257eb1d 100644 --- a/openair2/X2AP/x2ap_eNB_generate_messages.c +++ b/openair2/X2AP/x2ap_eNB_generate_messages.c @@ -489,7 +489,7 @@ int x2ap_eNB_generate_x2_setup_response(x2ap_eNB_instance_t *instance_p, x2ap_eN } int x2ap_eNB_generate_x2_setup_failure(instance_t instance, - uint32_t assoc_id, + sctp_assoc_t assoc_id, X2AP_Cause_PR cause_type, long cause_value, long time_to_wait) diff --git a/openair2/X2AP/x2ap_eNB_generate_messages.h b/openair2/X2AP/x2ap_eNB_generate_messages.h index a920020b81..44ca57597b 100644 --- a/openair2/X2AP/x2ap_eNB_generate_messages.h +++ b/openair2/X2AP/x2ap_eNB_generate_messages.h @@ -38,7 +38,7 @@ int x2ap_eNB_generate_x2_setup_request(x2ap_eNB_instance_t *instance_p, int x2ap_eNB_generate_x2_setup_response(x2ap_eNB_instance_t *instance_p, x2ap_eNB_data_t *x2ap_eNB_data_p); int x2ap_eNB_generate_x2_setup_failure(instance_t instance, - uint32_t assoc_id, + sctp_assoc_t assoc_id, X2AP_Cause_PR cause_type, long cause_value, long time_to_wait); diff --git a/openair2/X2AP/x2ap_eNB_handler.c b/openair2/X2AP/x2ap_eNB_handler.c index 6fa9c4af11..09661149a4 100644 --- a/openair2/X2AP/x2ap_eNB_handler.c +++ b/openair2/X2AP/x2ap_eNB_handler.c @@ -43,127 +43,70 @@ #include "conversions.h" #include "X2AP_FreqBandNrItem.h" -static -int x2ap_eNB_handle_x2_setup_request (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu); -static -int x2ap_eNB_handle_x2_setup_response (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu); -static -int x2ap_eNB_handle_x2_reset_request (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu); -static -int x2ap_eNB_handle_x2_reset_response (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu); +static int x2ap_eNB_handle_x2_setup_request(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu); +static int x2ap_eNB_handle_x2_setup_response(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu); +static int x2ap_eNB_handle_x2_reset_request(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu); +static int x2ap_eNB_handle_x2_reset_response(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu); -static -int x2ap_eNB_handle_x2_setup_failure (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu); +static int x2ap_eNB_handle_x2_setup_failure(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu); -static -int x2ap_eNB_handle_handover_preparation (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu); -static -int x2ap_eNB_handle_handover_response (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu); +static int x2ap_eNB_handle_handover_preparation(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu); +static int x2ap_eNB_handle_handover_response(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu); -static -int x2ap_eNB_handle_ue_context_release (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu); +static int x2ap_eNB_handle_ue_context_release(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu); -static -int x2ap_eNB_handle_handover_cancel (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu); +static int x2ap_eNB_handle_handover_cancel(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu); -static -int x2ap_eNB_handle_senb_addition_request (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu); +static int x2ap_eNB_handle_senb_addition_request(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu); +static int x2ap_eNB_handle_senb_addition_request_ack(instance_t instance, + sctp_assoc_t assoc_id, + uint32_t stream, + X2AP_X2AP_PDU_t *pdu); -static -int x2ap_eNB_handle_senb_addition_request_ack (instance_t instance, - uint32_t assoc_id, +static int x2ap_eNB_handle_senb_addition_request_reject(instance_t instance, + sctp_assoc_t assoc_id, + uint32_t stream, + X2AP_X2AP_PDU_t *pdu); + +int x2ap_eNB_handle_ENDC_x2_setup_request(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu); + +int x2ap_gNB_handle_ENDC_x2_setup_response(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu); + +static int x2ap_gNB_handle_ENDC_sGNB_addition_request(instance_t instance, + sctp_assoc_t assoc_id, + uint32_t stream, + X2AP_X2AP_PDU_t *pdu); + +static int x2ap_eNB_handle_ENDC_sGNB_addition_response(instance_t instance, + sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu); -static -int x2ap_eNB_handle_senb_addition_request_reject (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu); +static int x2ap_gNB_handle_ENDC_sGNB_reconfiguration_complete(instance_t instance, + sctp_assoc_t assoc_id, + uint32_t stream, + X2AP_X2AP_PDU_t *pdu); -int x2ap_eNB_handle_ENDC_x2_setup_request(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu); +static int x2ap_gNB_handle_ENDC_sGNB_release_request(instance_t instance, + sctp_assoc_t assoc_id, + uint32_t stream, + X2AP_X2AP_PDU_t *pdu); -int -x2ap_gNB_handle_ENDC_x2_setup_response(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu); +static int x2ap_gNB_handle_ENDC_sGNB_release_request_acknowledge(instance_t instance, + sctp_assoc_t assoc_id, + uint32_t stream, + X2AP_X2AP_PDU_t *pdu); -static -int x2ap_gNB_handle_ENDC_sGNB_addition_request (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu); +static int x2ap_gNB_handle_ENDC_sGNB_release_required(instance_t instance, + sctp_assoc_t assoc_id, + uint32_t stream, + X2AP_X2AP_PDU_t *pdu); -static -int x2ap_eNB_handle_ENDC_sGNB_addition_response (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu); - -static -int x2ap_gNB_handle_ENDC_sGNB_reconfiguration_complete (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu); - -static -int x2ap_gNB_handle_ENDC_sGNB_release_request(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu); - -static -int x2ap_gNB_handle_ENDC_sGNB_release_request_acknowledge(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu); - -static -int x2ap_gNB_handle_ENDC_sGNB_release_required(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu); - -static -int x2ap_gNB_handle_ENDC_sGNB_release_confirm(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu); +static int x2ap_gNB_handle_ENDC_sGNB_release_confirm(instance_t instance, + sctp_assoc_t assoc_id, + uint32_t stream, + X2AP_X2AP_PDU_t *pdu); /* Handlers matrix. Only eNB related procedure present here. Placement of callback functions according to X2AP_ProcedureCode.h */ static const x2ap_message_decoded_callback x2ap_messages_callback[][3] = { @@ -272,9 +215,11 @@ void x2ap_handle_x2_setup_message(x2ap_eNB_instance_t *instance_p, x2ap_eNB_data } } - -int x2ap_eNB_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, - const uint8_t *const data, const uint32_t data_length) +int x2ap_eNB_handle_message(instance_t instance, + sctp_assoc_t assoc_id, + int32_t stream, + const uint8_t *const data, + const uint32_t data_length) { X2AP_X2AP_PDU_t pdu; int ret = 0; @@ -380,11 +325,7 @@ int x2ap_eNB_handle_message(instance_t instance, uint32_t assoc_id, int32_t stre return ret; } -int -x2ap_eNB_handle_x2_setup_request(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu) +int x2ap_eNB_handle_x2_setup_request(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu) { X2AP_X2SetupRequest_t *x2SetupRequest; @@ -516,22 +457,13 @@ x2ap_eNB_handle_x2_setup_request(instance_t instance, return x2ap_eNB_generate_x2_setup_response(instance_p, x2ap_eNB_data); } -int -x2ap_eNB_handle_x2_reset_response(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu) +int x2ap_eNB_handle_x2_reset_response(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu) { return (0); } - -int -x2ap_eNB_handle_x2_reset_request(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu) +int x2ap_eNB_handle_x2_reset_request(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu) { const char *const X2AP_ResetRequest_str[2] = {"X2AP_ResetRequest_IEs__value_PR_Cause", "X2AP_ResetRequest_IEs__value_PR_InterfaceInstanceIndication"}; @@ -608,12 +540,7 @@ x2ap_eNB_handle_x2_reset_request(instance_t instance, return x2ap_eNB_generate_x2_setup_response(instance_p, x2ap_eNB_data); } - -static -int x2ap_eNB_handle_x2_setup_response(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu) +static int x2ap_eNB_handle_x2_setup_response(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu) { X2AP_X2SetupResponse_t *x2SetupResponse; @@ -744,11 +671,7 @@ int x2ap_eNB_handle_x2_setup_response(instance_t instance, return 0; } -static -int x2ap_eNB_handle_x2_setup_failure(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu) +static int x2ap_eNB_handle_x2_setup_failure(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu) { X2AP_X2SetupFailure_t *x2SetupFailure; @@ -814,11 +737,7 @@ int x2ap_eNB_handle_x2_setup_failure(instance_t instance, return 0; } -static -int x2ap_eNB_handle_handover_preparation (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu) +static int x2ap_eNB_handle_handover_preparation(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu) { X2AP_HandoverRequest_t *x2HandoverRequest; @@ -960,11 +879,7 @@ int x2ap_eNB_handle_handover_preparation (instance_t instance, return 0; } -static -int x2ap_eNB_handle_handover_response (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu) +static int x2ap_eNB_handle_handover_response(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu) { X2AP_HandoverRequestAcknowledge_t *x2HandoverRequestAck; X2AP_HandoverRequestAcknowledge_IEs_t *ie; @@ -1111,12 +1026,7 @@ int x2ap_eNB_handle_handover_response (instance_t instance, return 0; } - -static -int x2ap_eNB_handle_ue_context_release (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu) +static int x2ap_eNB_handle_ue_context_release(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu) { X2AP_UEContextRelease_t *x2UEContextRelease; X2AP_UEContextRelease_IEs_t *ie; @@ -1196,11 +1106,7 @@ int x2ap_eNB_handle_ue_context_release (instance_t instance, return 0; } -static -int x2ap_eNB_handle_handover_cancel (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu) +static int x2ap_eNB_handle_handover_cancel(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu) { X2AP_HandoverCancel_t *x2HandoverCancel; X2AP_HandoverCancel_IEs_t *ie; @@ -1304,12 +1210,7 @@ int x2ap_eNB_handle_handover_cancel (instance_t instance, return 0; } - -static -int x2ap_eNB_handle_senb_addition_request (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu) +static int x2ap_eNB_handle_senb_addition_request(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu) { X2AP_SeNBAdditionRequest_t *x2SeNBAdditionRequest; @@ -1487,32 +1388,25 @@ int x2ap_eNB_handle_senb_addition_request (instance_t instance, return 0; } -static -int x2ap_eNB_handle_senb_addition_request_ack (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu) +static int x2ap_eNB_handle_senb_addition_request_ack(instance_t instance, + sctp_assoc_t assoc_id, + uint32_t stream, + X2AP_X2AP_PDU_t *pdu) { printf("%s:%d:%s:TODO\n", __FILE__, __LINE__, __FUNCTION__); return 0; } - -static -int x2ap_eNB_handle_senb_addition_request_reject (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu) +static int x2ap_eNB_handle_senb_addition_request_reject(instance_t instance, + sctp_assoc_t assoc_id, + uint32_t stream, + X2AP_X2AP_PDU_t *pdu) { printf("%s:%d:%s:TODO\n", __FILE__, __LINE__, __FUNCTION__); return 0; } -int -x2ap_eNB_handle_ENDC_x2_setup_request(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu) +int x2ap_eNB_handle_ENDC_x2_setup_request(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu) { X2AP_ENDCX2SetupRequest_t *x2_ENDC_SetupRequest; @@ -1659,11 +1553,7 @@ x2ap_eNB_handle_ENDC_x2_setup_request(instance_t instance, return x2ap_eNB_generate_ENDC_x2_setup_response(instance_p, x2ap_eNB_data); } -int -x2ap_gNB_handle_ENDC_x2_setup_response(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu) +int x2ap_gNB_handle_ENDC_x2_setup_response(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, X2AP_X2AP_PDU_t *pdu) { X2AP_ENDCX2SetupResponse_t *x2_ENDC_SetupResponse; @@ -1809,11 +1699,10 @@ x2ap_gNB_handle_ENDC_x2_setup_response(instance_t instance, return 0; } -static -int x2ap_gNB_handle_ENDC_sGNB_addition_request (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu) +static int x2ap_gNB_handle_ENDC_sGNB_addition_request(instance_t instance, + sctp_assoc_t assoc_id, + uint32_t stream, + X2AP_X2AP_PDU_t *pdu) { X2AP_SgNBAdditionRequest_t *x2SgNBAdditionRequest; X2AP_SgNBAdditionRequest_IEs_t *ie; @@ -1951,12 +1840,10 @@ LOG_I(RRC,"x2u tunnel: index %d target sgw ip %d.%d.%d.%d length %d gtp teid %u\ return 0; } - -static -int x2ap_eNB_handle_ENDC_sGNB_addition_response (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu) +static int x2ap_eNB_handle_ENDC_sGNB_addition_response(instance_t instance, + sctp_assoc_t assoc_id, + uint32_t stream, + X2AP_X2AP_PDU_t *pdu) { X2AP_SgNBAdditionRequestAcknowledge_t *x2SgNBAdditionRequest_ack; @@ -2103,11 +1990,10 @@ int x2ap_eNB_handle_ENDC_sGNB_addition_response (instance_t instance, return 0; } -static -int x2ap_gNB_handle_ENDC_sGNB_reconfiguration_complete (instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu) +static int x2ap_gNB_handle_ENDC_sGNB_reconfiguration_complete(instance_t instance, + sctp_assoc_t assoc_id, + uint32_t stream, + X2AP_X2AP_PDU_t *pdu) { X2AP_SgNBReconfigurationComplete_t *x2SgNBReconfigurationComplete; X2AP_SgNBReconfigurationComplete_IEs_t *ie; @@ -2190,11 +2076,10 @@ int x2ap_gNB_handle_ENDC_sGNB_reconfiguration_complete (instance_t instance, return 0; } -static -int x2ap_gNB_handle_ENDC_sGNB_release_request(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu) +static int x2ap_gNB_handle_ENDC_sGNB_release_request(instance_t instance, + sctp_assoc_t assoc_id, + uint32_t stream, + X2AP_X2AP_PDU_t *pdu) { /* the logic in this function is the following: when receiving a release * request, the UE may exist in X2. Or not. If it's not in X2, it can @@ -2294,22 +2179,20 @@ int x2ap_gNB_handle_ENDC_sGNB_release_request(instance_t instance, return 0; } -static -int x2ap_gNB_handle_ENDC_sGNB_release_request_acknowledge(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu) +static int x2ap_gNB_handle_ENDC_sGNB_release_request_acknowledge(instance_t instance, + sctp_assoc_t assoc_id, + uint32_t stream, + X2AP_X2AP_PDU_t *pdu) { /* nothing to do - may change at some point */ X2AP_INFO("received release request acknowledge\n"); return 0; } -static -int x2ap_gNB_handle_ENDC_sGNB_release_required(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu) +static int x2ap_gNB_handle_ENDC_sGNB_release_required(instance_t instance, + sctp_assoc_t assoc_id, + uint32_t stream, + X2AP_X2AP_PDU_t *pdu) { /* the logic in this function is the following: when receiving a release * required we don't care about the UE in X2. We simply send a message @@ -2383,11 +2266,10 @@ int x2ap_gNB_handle_ENDC_sGNB_release_required(instance_t instance, return 0; } -static -int x2ap_gNB_handle_ENDC_sGNB_release_confirm(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - X2AP_X2AP_PDU_t *pdu) +static int x2ap_gNB_handle_ENDC_sGNB_release_confirm(instance_t instance, + sctp_assoc_t assoc_id, + uint32_t stream, + X2AP_X2AP_PDU_t *pdu) { /* nothing to do - may change at some point */ X2AP_INFO("received release confirm\n"); diff --git a/openair2/X2AP/x2ap_eNB_handler.h b/openair2/X2AP/x2ap_eNB_handler.h index 65f411895f..b0a4d33d58 100644 --- a/openair2/X2AP/x2ap_eNB_handler.h +++ b/openair2/X2AP/x2ap_eNB_handler.h @@ -33,7 +33,10 @@ void x2ap_handle_x2_setup_message(x2ap_eNB_instance_t *instance_p, x2ap_eNB_data_t *eNB_desc_p, int sctp_shutdown); -int x2ap_eNB_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, - const uint8_t * const data, const uint32_t data_length); +int x2ap_eNB_handle_message(instance_t instance, + sctp_assoc_t assoc_id, + int32_t stream, + const uint8_t *const data, + const uint32_t data_length); #endif /* X2AP_ENB_HANDLERS_H_ */ diff --git a/openair2/X2AP/x2ap_eNB_itti_messaging.c b/openair2/X2AP/x2ap_eNB_itti_messaging.c index 66be3520e2..f80e2da34b 100644 --- a/openair2/X2AP/x2ap_eNB_itti_messaging.c +++ b/openair2/X2AP/x2ap_eNB_itti_messaging.c @@ -30,8 +30,11 @@ #include "x2ap_eNB_itti_messaging.h" -void x2ap_eNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer, - uint32_t buffer_length, uint16_t stream) +void x2ap_eNB_itti_send_sctp_data_req(instance_t instance, + sctp_assoc_t assoc_id, + uint8_t *buffer, + uint32_t buffer_length, + uint16_t stream) { MessageDef *message_p; sctp_data_req_t *sctp_data_req; @@ -49,7 +52,7 @@ void x2ap_eNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uin } -void x2ap_eNB_itti_send_sctp_close_association(instance_t instance, int32_t assoc_id) +void x2ap_eNB_itti_send_sctp_close_association(instance_t instance, sctp_assoc_t assoc_id) { MessageDef *message_p = NULL; sctp_close_association_t *sctp_close_association_p = NULL; diff --git a/openair2/X2AP/x2ap_eNB_itti_messaging.h b/openair2/X2AP/x2ap_eNB_itti_messaging.h index ee946880ac..7358f3bdb1 100644 --- a/openair2/X2AP/x2ap_eNB_itti_messaging.h +++ b/openair2/X2AP/x2ap_eNB_itti_messaging.h @@ -29,11 +29,13 @@ #ifndef X2AP_ENB_ITTI_MESSAGING_H_ #define X2AP_ENB_ITTI_MESSAGING_H_ -void x2ap_eNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer, - uint32_t buffer_length, uint16_t stream); +void x2ap_eNB_itti_send_sctp_data_req(instance_t instance, + sctp_assoc_t assoc_id, + uint8_t *buffer, + uint32_t buffer_length, + uint16_t stream); - -void x2ap_eNB_itti_send_sctp_close_association(instance_t instance, int32_t assoc_id); +void x2ap_eNB_itti_send_sctp_close_association(instance_t instance, sctp_assoc_t assoc_id); #endif /* X2AP_ENB_ITTI_MESSAGING_H_ */ diff --git a/openair2/X2AP/x2ap_eNB_management_procedures.c b/openair2/X2AP/x2ap_eNB_management_procedures.c index a0cc0d1124..465949a58e 100644 --- a/openair2/X2AP/x2ap_eNB_management_procedures.c +++ b/openair2/X2AP/x2ap_eNB_management_procedures.c @@ -122,9 +122,7 @@ printf("---------------------------------------------\n"); } } -struct x2ap_eNB_data_s *x2ap_get_eNB(x2ap_eNB_instance_t *instance_p, - int32_t assoc_id, - uint16_t cnx_id) +struct x2ap_eNB_data_s *x2ap_get_eNB(x2ap_eNB_instance_t *instance_p, sctp_assoc_t assoc_id, uint16_t cnx_id) { struct x2ap_eNB_data_s temp; struct x2ap_eNB_data_s *found; diff --git a/openair2/X2AP/x2ap_eNB_management_procedures.h b/openair2/X2AP/x2ap_eNB_management_procedures.h index 7082f5ac95..5b5ed993a2 100644 --- a/openair2/X2AP/x2ap_eNB_management_procedures.h +++ b/openair2/X2AP/x2ap_eNB_management_procedures.h @@ -47,8 +47,6 @@ x2ap_eNB_data_t* x2ap_is_eNB_assoc_id_in_list(uint32_t sctp_assoc_id); x2ap_eNB_data_t* x2ap_is_eNB_pci_in_list (const uint32_t pci); -struct x2ap_eNB_data_s *x2ap_get_eNB(x2ap_eNB_instance_t *instance_p, - int32_t assoc_id, - uint16_t cnx_id); +struct x2ap_eNB_data_s *x2ap_get_eNB(x2ap_eNB_instance_t *instance_p, sctp_assoc_t assoc_id, uint16_t cnx_id); #endif /* __X2AP_ENB_MANAGEMENT_PROCEDURES__H__ */ diff --git a/openair3/M3AP/m3ap_MCE_defs.h b/openair3/M3AP/m3ap_MCE_defs.h index c90ba38a66..06386301c4 100644 --- a/openair3/M3AP/m3ap_MCE_defs.h +++ b/openair3/M3AP/m3ap_MCE_defs.h @@ -115,7 +115,7 @@ typedef struct m3ap_MCE_data_s { uint16_t cnx_id; /* SCTP association id */ - int32_t assoc_id; + sctp_assoc_t assoc_id; /* Nid cells */ uint32_t Nid_cell[MAX_NUM_CCs]; diff --git a/openair3/M3AP/m3ap_MCE_generate_messsages.c b/openair3/M3AP/m3ap_MCE_generate_messsages.c index 0bedc0e4a2..490ba2fd4f 100644 --- a/openair3/M3AP/m3ap_MCE_generate_messsages.c +++ b/openair3/M3AP/m3ap_MCE_generate_messsages.c @@ -312,7 +312,7 @@ int m2ap_eNB_generate_m2_setup_request( //} //int m2ap_MCE_generate_m2_setup_failure(instance_t instance, -// uint32_t assoc_id, +// sctp_assoc_t assoc_id, // M2AP_Cause_PR cause_type, // long cause_value, // long time_to_wait) diff --git a/openair3/M3AP/m3ap_MCE_handler.c b/openair3/M3AP/m3ap_MCE_handler.c index dc40829aec..e791b2a47c 100644 --- a/openair3/M3AP/m3ap_MCE_handler.c +++ b/openair3/M3AP/m3ap_MCE_handler.c @@ -69,9 +69,11 @@ static char *m3ap_direction_String[] = { return(m3ap_direction_String[m3ap_dir]); } - -int m3ap_MCE_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, - const uint8_t * const data, const uint32_t data_length) +int m3ap_MCE_handle_message(instance_t instance, + sctp_assoc_t assoc_id, + int32_t stream, + const uint8_t *const data, + const uint32_t data_length) { M3AP_M3AP_PDU_t pdu; int ret; diff --git a/openair3/M3AP/m3ap_MCE_handler.h b/openair3/M3AP/m3ap_MCE_handler.h index 09eca351b6..b09195c180 100644 --- a/openair3/M3AP/m3ap_MCE_handler.h +++ b/openair3/M3AP/m3ap_MCE_handler.h @@ -33,11 +33,13 @@ //void m3ap_handle_m2_setup_message(m2ap_eNB_instance_t *instance_p, m2ap_eNB_data_t *eNB_desc_p, int sctp_shutdown); -//int m3ap_eNB_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, +//int m3ap_eNB_handle_message(instance_t instance, sctp_assoc_t assoc_id, int32_t stream, //const uint8_t * const data, const uint32_t data_length); -int m3ap_MCE_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, - const uint8_t * const data, const uint32_t data_length); - +int m3ap_MCE_handle_message(instance_t instance, + sctp_assoc_t assoc_id, + int32_t stream, + const uint8_t *const data, + const uint32_t data_length); #endif /* __M3AP_MCE_HANDLER__H__ */ diff --git a/openair3/M3AP/m3ap_MCE_interface_management.c b/openair3/M3AP/m3ap_MCE_interface_management.c index 82fc044d3e..5d58e49bb7 100644 --- a/openair3/M3AP/m3ap_MCE_interface_management.c +++ b/openair3/M3AP/m3ap_MCE_interface_management.c @@ -57,11 +57,8 @@ extern m3ap_setup_req_t * m3ap_mce_data_g; - -int MCE_handle_MBMS_SESSION_START_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu){ +int MCE_handle_MBMS_SESSION_START_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu) +{ // LOG_W(M3AP, "MCE_handle_MBMS_SESSION_START_REQUEST assoc_id %d\n",assoc_id); // MessageDef *message_p; @@ -212,11 +209,8 @@ int MCE_send_MBMS_SESSION_START_FAILURE(instance_t instance, m3ap_session_start_ return 0; } -int MCE_handle_MBMS_SESSION_STOP_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu){ - +int MCE_handle_MBMS_SESSION_STOP_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu) +{ //AssertFatal(1==0,"Not implemented yet\n"); LOG_D(M3AP, "MCE_handle_MBMS_SESSION_STOP_REQUEST assoc_id %d\n",assoc_id); @@ -317,10 +311,7 @@ int MCE_send_MBMS_SESSION_STOP_RESPONSE(instance_t instance, m3ap_session_start_ /* * Session Update */ -int MCE_handle_MBMS_SESSION_UPDATE_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu) +int MCE_handle_MBMS_SESSION_UPDATE_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu) { //AssertFatal(1==0,"Not implemented yet\n"); LOG_D(M3AP, "MCE_handle_MBMS_SESSION_UPDATE_REQUEST assoc_id %d\n",assoc_id); @@ -653,10 +644,7 @@ int MCE_send_M3_SETUP_REQUEST(m3ap_MCE_instance_t *instance_p, m3ap_MCE_data_t * -int MCE_handle_M3_SETUP_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu) +int MCE_handle_M3_SETUP_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu) { LOG_D(M3AP, "MCE_handle_M3_SETUP_RESPONSE\n"); @@ -700,15 +688,8 @@ int MCE_handle_M3_SETUP_RESPONSE(instance_t instance, } // SETUP FAILURE -int MCE_handle_M3_SETUP_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu) { - LOG_E(M3AP, "MCE_handle_M3_SETUP_FAILURE\n"); - return 0; +int MCE_handle_M3_SETUP_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu) +{ + LOG_E(M3AP, "MCE_handle_M3_SETUP_FAILURE\n"); + return 0; } - - - - - diff --git a/openair3/M3AP/m3ap_MCE_interface_management.h b/openair3/M3AP/m3ap_MCE_interface_management.h index 76e13bb8d8..974332f497 100644 --- a/openair3/M3AP/m3ap_MCE_interface_management.h +++ b/openair3/M3AP/m3ap_MCE_interface_management.h @@ -37,10 +37,7 @@ * Session Start */ -int MCE_handle_MBMS_SESSION_START_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu); +int MCE_handle_MBMS_SESSION_START_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu); int MCE_send_MBMS_SESSION_START_RESPONSE(instance_t instance, m3ap_session_start_resp_t * m3ap_session_start_resp); int MCE_send_MBMS_SESSION_START_FAILURE(instance_t instance, m3ap_session_start_failure_t * m3ap_session_start_failure); @@ -48,18 +45,12 @@ int MCE_send_MBMS_SESSION_START_FAILURE(instance_t instance, m3ap_session_start_ * Session Stop */ -int MCE_handle_MBMS_SESSION_STOP_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu); +int MCE_handle_MBMS_SESSION_STOP_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu); /* * Session Update */ -int MCE_handle_MBMS_SESSION_UPDATE_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu); +int MCE_handle_MBMS_SESSION_UPDATE_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu); int MCE_send_MBMS_SESSION_UPDATE_RESPONSE(instance_t instance, m3ap_mbms_session_update_resp_t * m3ap_mbms_session_update_resp); int MCE_send_MBMS_SESSION_UPDATE_FAILURE(instance_t instance, m3ap_mbms_session_update_failure_t * m3ap_mbms_session_update_failure); @@ -75,43 +66,25 @@ int MCE_send_MBMS_SESSION_STOP_RESPONSE(instance_t instance, m3ap_session_start_ /* * Reset */ -int MCE_handle_RESET(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu); +int MCE_handle_RESET(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu); int MCE_send_RESET_ACKKNOWLEDGE(instance_t instance, M3AP_ResetAcknowledge_t *ResetAcknowledge); int MCE_send_RESET(instance_t instance, M3AP_Reset_t *Reset); -int MCE_handle_RESET_ACKNOWLEDGE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu); +int MCE_handle_RESET_ACKNOWLEDGE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu); /* * M3AP Setup */ int MCE_send_M3_SETUP_REQUEST( m3ap_MCE_instance_t *instance_p, m3ap_MCE_data_t *m3ap_MCE_data_p); -int MCE_handle_M3_SETUP_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu); +int MCE_handle_M3_SETUP_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu); -int MCE_handle_M3_SETUP_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu); +int MCE_handle_M3_SETUP_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu); /* * Error Indication */ int MCE_send_ERROR_INDICATION(instance_t instance, M3AP_M3AP_PDU_t *pdu_p); -int MCE_handle_ERROR_INDICATION(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu); - - - +int MCE_handle_ERROR_INDICATION(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu); #endif /* M3AP_MCE_INTERFACE_MANAGEMENT_H_ */ diff --git a/openair3/M3AP/m3ap_MCE_management_procedures.c b/openair3/M3AP/m3ap_MCE_management_procedures.c index 065d4b9616..c58cc7c5f1 100644 --- a/openair3/M3AP/m3ap_MCE_management_procedures.c +++ b/openair3/M3AP/m3ap_MCE_management_procedures.c @@ -122,9 +122,7 @@ printf("---------------------------------------------\n"); } } -struct m3ap_MCE_data_s *m3ap_get_MCE(m3ap_MCE_instance_t *instance_p, - int32_t assoc_id, - uint16_t cnx_id) +struct m3ap_MCE_data_s *m3ap_get_MCE(m3ap_MCE_instance_t *instance_p, sctp_assoc_t assoc_id, uint16_t cnx_id) { struct m3ap_MCE_data_s temp; struct m3ap_MCE_data_s *found; diff --git a/openair3/M3AP/m3ap_MCE_management_procedures.h b/openair3/M3AP/m3ap_MCE_management_procedures.h index 27e8c928a0..2a5ada2fbe 100644 --- a/openair3/M3AP/m3ap_MCE_management_procedures.h +++ b/openair3/M3AP/m3ap_MCE_management_procedures.h @@ -46,8 +46,6 @@ m3ap_MCE_data_t* m3ap_is_MCE_assoc_id_in_list(uint32_t sctp_assoc_id); m3ap_MCE_data_t* m3ap_is_MCE_pci_in_list (const uint32_t pci); -struct m3ap_MCE_data_s *m3ap_get_MCE(m3ap_MCE_instance_t *instance_p, - int32_t assoc_id, - uint16_t cnx_id); +struct m3ap_MCE_data_s *m3ap_get_MCE(m3ap_MCE_instance_t *instance_p, sctp_assoc_t assoc_id, uint16_t cnx_id); #endif /* __M3AP_MCE_MANAGEMENT_PROCEDURES__H__ */ diff --git a/openair3/M3AP/m3ap_MME_defs.h b/openair3/M3AP/m3ap_MME_defs.h index 7d3186915f..54603c6997 100644 --- a/openair3/M3AP/m3ap_MME_defs.h +++ b/openair3/M3AP/m3ap_MME_defs.h @@ -115,7 +115,7 @@ typedef struct m3ap_MME_data_s { uint16_t cnx_id; /* SCTP association id */ - int32_t assoc_id; + sctp_assoc_t assoc_id; /* Nid cells */ uint32_t Nid_cell[MAX_NUM_CCs]; diff --git a/openair3/M3AP/m3ap_MME_generate_messages.c b/openair3/M3AP/m3ap_MME_generate_messages.c index 3a4c1bb473..d513fcd3db 100644 --- a/openair3/M3AP/m3ap_MME_generate_messages.c +++ b/openair3/M3AP/m3ap_MME_generate_messages.c @@ -314,7 +314,7 @@ int m2ap_MCE_generate_m2_setup_response(m2ap_MCE_instance_t *instance_p, m2ap_MC } int m2ap_MCE_generate_m2_setup_failure(instance_t instance, - uint32_t assoc_id, + sctp_assoc_t assoc_id, M2AP_Cause_PR cause_type, long cause_value, long time_to_wait) diff --git a/openair3/M3AP/m3ap_MME_generate_messages.h b/openair3/M3AP/m3ap_MME_generate_messages.h index 146f58825a..a1dbe837c3 100644 --- a/openair3/M3AP/m3ap_MME_generate_messages.h +++ b/openair3/M3AP/m3ap_MME_generate_messages.h @@ -38,7 +38,7 @@ int m2ap_MCE_generate_m2_setup_request(m2ap_MCE_instance_t *instance_p, int m2ap_MCE_generate_m2_setup_response(m2ap_MCE_instance_t *instance_p, m2ap_MCE_data_t *m2ap_MCE_data_p); int m2ap_MCE_generate_m2_setup_failure(instance_t instance, - uint32_t assoc_id, + sctp_assoc_t assoc_id, M2AP_Cause_PR cause_type, long cause_value, long time_to_wait); diff --git a/openair3/M3AP/m3ap_MME_handler.c b/openair3/M3AP/m3ap_MME_handler.c index 6c8184336e..a459d1000c 100644 --- a/openair3/M3AP/m3ap_MME_handler.c +++ b/openair3/M3AP/m3ap_MME_handler.c @@ -68,9 +68,11 @@ static char *m3ap_direction_String[] = { return(m3ap_direction_String[m3ap_dir]); } - -int m3ap_MME_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, - const uint8_t * const data, const uint32_t data_length) +int m3ap_MME_handle_message(instance_t instance, + sctp_assoc_t assoc_id, + int32_t stream, + const uint8_t *const data, + const uint32_t data_length) { M3AP_M3AP_PDU_t pdu; int ret; diff --git a/openair3/M3AP/m3ap_MME_handler.h b/openair3/M3AP/m3ap_MME_handler.h index feabfe256c..ce8939ada7 100644 --- a/openair3/M3AP/m3ap_MME_handler.h +++ b/openair3/M3AP/m3ap_MME_handler.h @@ -33,11 +33,13 @@ //void m3ap_handle_m2_setup_message(m2ap_eNB_instance_t *instance_p, m2ap_eNB_data_t *eNB_desc_p, int sctp_shutdown); -//int m3ap_eNB_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, +//int m3ap_eNB_handle_message(instance_t instance, sctp_assoc_t assoc_id, int32_t stream, //const uint8_t * const data, const uint32_t data_length); -int m3ap_MME_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, - const uint8_t * const data, const uint32_t data_length); - +int m3ap_MME_handle_message(instance_t instance, + sctp_assoc_t assoc_id, + int32_t stream, + const uint8_t *const data, + const uint32_t data_length); #endif /* M3AP_MME_HANDLERS_H_ */ diff --git a/openair3/M3AP/m3ap_MME_interface_management.c b/openair3/M3AP/m3ap_MME_interface_management.c index 38e58c9b98..823cccc6a1 100644 --- a/openair3/M3AP/m3ap_MME_interface_management.c +++ b/openair3/M3AP/m3ap_MME_interface_management.c @@ -61,8 +61,9 @@ uint8_t m3ap_start_message[] = { /* * MBMS Session start */ -int MME_send_MBMS_SESSION_START_REQUEST(instance_t instance/*, uint32_t assoc_id*/,m3ap_session_start_req_t* m3ap_session_start_req){ - +int MME_send_MBMS_SESSION_START_REQUEST(instance_t instance /*, sctp_assoc_t assoc_id*/, + m3ap_session_start_req_t *m3ap_session_start_req) +{ //AssertFatal(1==0,"Not implemented yet\n"); //module_id_t enb_mod_idP=0; @@ -239,13 +240,10 @@ int MME_send_MBMS_SESSION_START_REQUEST(instance_t instance/*, uint32_t assoc_id m3ap_MME_itti_send_sctp_data_req(instance, m3ap_mme_data_from_mce->assoc_id, buffer, len, 0); return 0; - } -int MME_handle_MBMS_SESSION_START_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu){ +int MME_handle_MBMS_SESSION_START_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu) +{ // AssertFatal(1==0,"Not implemented yet\n"); LOG_D(M3AP, "MME_handle_MBMS_SESSION_START_RESPONSE\n"); @@ -300,12 +298,9 @@ int MME_handle_MBMS_SESSION_START_RESPONSE(instance_t instance, // assoc_id,ENB_MODULE_ID_TO_INSTANCE(assoc_id)); itti_send_msg_to_task(TASK_MME_APP, ENB_MODULE_ID_TO_INSTANCE(assoc_id), msg_g); return 0; - } -int MME_handle_MBMS_SESSION_START_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu){ +int MME_handle_MBMS_SESSION_START_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } @@ -370,10 +365,8 @@ int MME_send_MBMS_SESSION_STOP_REQUEST(instance_t instance, m3ap_session_stop_re } -int MME_handle_MBMS_SESSION_STOP_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu){ +int MME_handle_MBMS_SESSION_STOP_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu) +{ //AssertFatal(1==0,"Not implemented yet\n"); LOG_D(M3AP, "eNB_handle_MBMS_SESSION_STOP_RESPONSE\n"); @@ -432,12 +425,8 @@ int MME_handle_MBMS_SESSION_STOP_RESPONSE(instance_t instance, return 0; } - - -int MME_handle_MBMS_SESSION_STOP_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu){ +int MME_handle_MBMS_SESSION_STOP_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } @@ -456,19 +445,14 @@ int MME_send_RESET(instance_t instance, m3ap_reset_t * m3ap_reset) { } - -int MME_handle_RESET_ACKKNOWLEDGE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu) { +int MME_handle_RESET_ACKKNOWLEDGE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } -int MME_handle_RESET(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu) { +int MME_handle_RESET(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } @@ -479,10 +463,7 @@ int MME_send_RESET_ACKNOWLEDGE(instance_t instance, M3AP_ResetAcknowledge_t *Res /* * M3 Setup */ -int MME_handle_M3_SETUP_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu) +int MME_handle_M3_SETUP_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu) { LOG_D(M2AP, "MCE_handle_M3_SETUP_REQUEST assoc_id %d\n",assoc_id); @@ -632,8 +613,9 @@ int MME_handle_M3_SETUP_REQUEST(instance_t instance, return 0; } -int MME_send_M3_SETUP_RESPONSE(instance_t instance, /*uint32_t assoc_id,*/ - m3ap_setup_resp_t *m3ap_setup_resp) { +int MME_send_M3_SETUP_RESPONSE(instance_t instance, /*sctp_assoc_t assoc_id,*/ + m3ap_setup_resp_t *m3ap_setup_resp) +{ M3AP_M3AP_PDU_t pdu; M3AP_M3SetupResponse_t *out; M3AP_M3SetupResponseIEs_t *ie; @@ -774,19 +756,16 @@ int MME_send_M3_SETUP_FAILURE(instance_t instance,m3ap_setup_failure_t* m3ap_set * MME Configuration Update */ - -int MME_handle_MME_CONFIGURATION_UPDATE_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu){ +int MME_handle_MME_CONFIGURATION_UPDATE_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } - int MME_handle_MME_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu){ + sctp_assoc_t assoc_id, + uint32_t stream, + M3AP_M3AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } @@ -795,11 +774,8 @@ int MME_handle_MME_CONFIGURATION_UPDATE_ACKNOWLEDGE(instance_t instance, * MCE Configuration Update */ - -int MME_handle_MCE_CONFIGURATION_UPDATE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu){ +int MME_handle_MCE_CONFIGURATION_UPDATE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } @@ -812,10 +788,8 @@ int MME_handle_MCE_CONFIGURATION_UPDATE(instance_t instance, * Error Indication */ -int MME_handle_ERROR_INDICATION(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu) { +int MME_handle_ERROR_INDICATION(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); @@ -1003,12 +977,8 @@ int MME_send_MBMS_SESSION_UPDATE_REQUEST(instance_t instance, m3ap_mbms_session_ } - - -int MME_handle_MBMS_SESSION_UPDATE_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu){ +int MME_handle_MBMS_SESSION_UPDATE_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu) +{ //AssertFatal(1==0,"Not implemented yet\n"); LOG_D(M3AP, "MME_handle_MBMS_SESSION_UPDATE_RESPONSE\n"); @@ -1067,30 +1037,18 @@ int MME_handle_MBMS_SESSION_UPDATE_RESPONSE(instance_t instance, } - - -int MME_handle_MBMS_SESSION_UPDATE_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu){ +int MME_handle_MBMS_SESSION_UPDATE_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } - - -int MME_handle_MBMS_SERVICE_COUNTING_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu){ +int MME_handle_MBMS_SERVICE_COUNTING_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } - - -int MME_handle_MBMS_SESSION_COUNTING_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu){ +int MME_handle_MBMS_SESSION_COUNTING_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } @@ -1101,9 +1059,10 @@ int MME_handle_MBMS_SESSION_COUNTING_FAILURE(instance_t instance, */ int MME_handle_MBMS_SESSION_COUNTING_RESULTS_REPORT(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu){ + sctp_assoc_t assoc_id, + uint32_t stream, + M3AP_M3AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } @@ -1112,10 +1071,8 @@ int MME_handle_MBMS_SESSION_COUNTING_RESULTS_REPORT(instance_t instance, /* * Overload Notification */ -int MME_handle_MBMS_OVERLOAD_NOTIFICATION(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu){ +int MME_handle_MBMS_OVERLOAD_NOTIFICATION(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu) +{ AssertFatal(1==0,"Not implemented yet\n"); } diff --git a/openair3/M3AP/m3ap_MME_interface_management.h b/openair3/M3AP/m3ap_MME_interface_management.h index d3765182ce..a4f8db8946 100644 --- a/openair3/M3AP/m3ap_MME_interface_management.h +++ b/openair3/M3AP/m3ap_MME_interface_management.h @@ -35,75 +35,45 @@ /* * MBMS Session start */ -int MME_send_MBMS_SESSION_START_REQUEST(instance_t instance/*, - uint32_t assoc_id*/,m3ap_session_start_req_t* m3ap_session_start_req); -int MME_handle_MBMS_SESSION_START_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu); +int MME_send_MBMS_SESSION_START_REQUEST(instance_t instance, + /*sctp_assoc_t assoc_id,*/ + m3ap_session_start_req_t *m3ap_session_start_req); +int MME_handle_MBMS_SESSION_START_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu); -int MME_handle_MBMS_SESSION_START_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu); +int MME_handle_MBMS_SESSION_START_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu); /* * MBMS Session stop */ int MME_send_MBMS_SESSION_STOP_REQUEST(instance_t instance, m3ap_session_stop_req_t* m3ap_session_stop_req); -int MME_handle_MBMS_SESSION_STOP_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu); +int MME_handle_MBMS_SESSION_STOP_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu); /* * Update */ -int MME_handle_MBMS_SESSION_UPDATE_RESPONSE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu); - -int MME_handle_MBMS_SESSION_UPDATE_FAILURE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu); - +int MME_handle_MBMS_SESSION_UPDATE_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu); +int MME_handle_MBMS_SESSION_UPDATE_FAILURE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu); /* * Reset */ int MME_send_RESET(instance_t instance, m3ap_reset_t * m3ap_reset); -int MME_handle_RESET_ACKKNOWLEDGE(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu); +int MME_handle_RESET_ACKKNOWLEDGE(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu); -int MME_handle_RESET(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu); +int MME_handle_RESET(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu); int MME_send_RESET_ACKNOWLEDGE(instance_t instance, M3AP_ResetAcknowledge_t *ResetAcknowledge); /* * M3AP Setup */ -int MME_handle_M3_SETUP_REQUEST(instance_t instance, - uint32_t assoc_id, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu); - -int MME_send_M3_SETUP_RESPONSE(instance_t instance,/*uint32_t assoc_id,*/ m3ap_setup_resp_t *m3ap_setup_resp); - -int MME_send_M3_SETUP_FAILURE(instance_t instance, /*uint32_t assoc_id*/ m3ap_setup_failure_t * m3ap_setup_failure); - - - +int MME_handle_M3_SETUP_REQUEST(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu); +int MME_send_M3_SETUP_RESPONSE(instance_t instance, /*sctp_assoc_t assoc_id,*/ m3ap_setup_resp_t *m3ap_setup_resp); +int MME_send_M3_SETUP_FAILURE(instance_t instance, /*sctp_assoc_t assoc_id*/ m3ap_setup_failure_t *m3ap_setup_failure); #endif /* M3AP_MME_INTERFACE_MANAGEMENT_H_ */ diff --git a/openair3/M3AP/m3ap_MME_management_procedures.c b/openair3/M3AP/m3ap_MME_management_procedures.c index 151aba04e4..1225db2213 100644 --- a/openair3/M3AP/m3ap_MME_management_procedures.c +++ b/openair3/M3AP/m3ap_MME_management_procedures.c @@ -122,9 +122,7 @@ printf("---------------------------------------------\n"); } } -struct m3ap_MME_data_s *m3ap_get_MME(m3ap_MME_instance_t *instance_p, - int32_t assoc_id, - uint16_t cnx_id) +struct m3ap_MME_data_s *m3ap_get_MME(m3ap_MME_instance_t *instance_p, sctp_assoc_t assoc_id, uint16_t cnx_id) { struct m3ap_MME_data_s temp; struct m3ap_MME_data_s *found; diff --git a/openair3/M3AP/m3ap_MME_management_procedures.h b/openair3/M3AP/m3ap_MME_management_procedures.h index b21189b915..b5a75f8a23 100644 --- a/openair3/M3AP/m3ap_MME_management_procedures.h +++ b/openair3/M3AP/m3ap_MME_management_procedures.h @@ -47,8 +47,6 @@ m3ap_MME_data_t* m3ap_is_MME_assoc_id_in_list(uint32_t sctp_assoc_id); m3ap_MME_data_t* m3ap_is_MME_pci_in_list (const uint32_t pci); -struct m3ap_MME_data_s *m3ap_get_MME(m3ap_MME_instance_t *instance_p, - int32_t assoc_id, - uint16_t cnx_id); +struct m3ap_MME_data_s *m3ap_get_MME(m3ap_MME_instance_t *instance_p, sctp_assoc_t assoc_id, uint16_t cnx_id); #endif /* __M3AP_MME_MANAGEMENT_PROCEDURES__H__ */ diff --git a/openair3/M3AP/m3ap_common.h b/openair3/M3AP/m3ap_common.h index 5d40b29363..d59407c2ec 100644 --- a/openair3/M3AP/m3ap_common.h +++ b/openair3/M3AP/m3ap_common.h @@ -74,30 +74,15 @@ extern int asn1_xer_print; /** \brief Function callback prototype. **/ -typedef int (*m3ap_message_decoded_callback)( - instance_t instance, - uint32_t assocId, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu); - +typedef int (*m3ap_message_decoded_callback)(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu); /** \brief Function callback prototype. **/ -typedef int (*m3ap_MCE_message_decoded_callback)( - instance_t instance, - uint32_t assocId, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu); +typedef int (*m3ap_MCE_message_decoded_callback)(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu); /** \brief Function callback prototype. **/ -typedef int (*m3ap_MME_message_decoded_callback)( - instance_t instance, - uint32_t assocId, - uint32_t stream, - M3AP_M3AP_PDU_t *pdu); - - +typedef int (*m3ap_MME_message_decoded_callback)(instance_t instance, sctp_assoc_t assoc_id, uint32_t stream, M3AP_M3AP_PDU_t *pdu); /** \brief Encode a successfull outcome message \param buffer pointer to buffer in which data will be encoded diff --git a/openair3/M3AP/m3ap_handler.c b/openair3/M3AP/m3ap_handler.c index 41675ac749..f4cad1bd08 100644 --- a/openair3/M3AP/m3ap_handler.c +++ b/openair3/M3AP/m3ap_handler.c @@ -69,9 +69,11 @@ static char *m3ap_direction_String[] = { return(m3ap_direction_String[m3ap_dir]); } - -int m3ap_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, - const uint8_t * const data, const uint32_t data_length) +int m3ap_handle_message(instance_t instance, + sctp_assoc_t assoc_id, + int32_t stream, + const uint8_t *const data, + const uint32_t data_length) { M3AP_M3AP_PDU_t pdu; int ret; diff --git a/openair3/M3AP/m3ap_handler.h b/openair3/M3AP/m3ap_handler.h index 4b01307807..5dcc71204e 100644 --- a/openair3/M3AP/m3ap_handler.h +++ b/openair3/M3AP/m3ap_handler.h @@ -33,11 +33,14 @@ //void m3ap_handle_m2_setup_message(m2ap_eNB_instance_t *instance_p, m2ap_eNB_data_t *eNB_desc_p, int sctp_shutdown); -//int m3ap_eNB_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, +//int m3ap_eNB_handle_message(instance_t instance, sctp_assoc_t assoc_id, int32_t stream, //const uint8_t * const data, const uint32_t data_length); -int m3ap_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream, - const uint8_t * const data, const uint32_t data_length); +int m3ap_handle_message(instance_t instance, + sctp_assoc_t assoc_id, + int32_t stream, + const uint8_t *const data, + const uint32_t data_length); #endif /* M2AP_MCE_HANDLERS_H_ */ diff --git a/openair3/M3AP/m3ap_itti_messaging.c b/openair3/M3AP/m3ap_itti_messaging.c index 42e689343f..83b51f0091 100644 --- a/openair3/M3AP/m3ap_itti_messaging.c +++ b/openair3/M3AP/m3ap_itti_messaging.c @@ -30,8 +30,11 @@ #include "m3ap_itti_messaging.h" -void m3ap_MCE_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer, - uint32_t buffer_length, uint16_t stream) +void m3ap_MCE_itti_send_sctp_data_req(instance_t instance, + sctp_assoc_t assoc_id, + uint8_t *buffer, + uint32_t buffer_length, + uint16_t stream) { MessageDef *message_p; sctp_data_req_t *sctp_data_req; @@ -51,7 +54,7 @@ void m3ap_MCE_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uin } -void m3ap_MCE_itti_send_sctp_close_association(instance_t instance, int32_t assoc_id) +void m3ap_MCE_itti_send_sctp_close_association(instance_t instance, sctp_assoc_t assoc_id) { MessageDef *message_p = NULL; sctp_close_association_t *sctp_close_association_p = NULL; @@ -63,9 +66,11 @@ void m3ap_MCE_itti_send_sctp_close_association(instance_t instance, int32_t asso itti_send_msg_to_task(TASK_SCTP, instance, message_p); } - -void m3ap_MME_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer, - uint32_t buffer_length, uint16_t stream) +void m3ap_MME_itti_send_sctp_data_req(instance_t instance, + sctp_assoc_t assoc_id, + uint8_t *buffer, + uint32_t buffer_length, + uint16_t stream) { MessageDef *message_p; sctp_data_req_t *sctp_data_req; @@ -83,7 +88,7 @@ void m3ap_MME_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uin } -void m3ap_MME_itti_send_sctp_close_association(instance_t instance, int32_t assoc_id) +void m3ap_MME_itti_send_sctp_close_association(instance_t instance, sctp_assoc_t assoc_id) { MessageDef *message_p = NULL; sctp_close_association_t *sctp_close_association_p = NULL; diff --git a/openair3/M3AP/m3ap_itti_messaging.h b/openair3/M3AP/m3ap_itti_messaging.h index 8a4069da9b..bd22cc87f8 100644 --- a/openair3/M3AP/m3ap_itti_messaging.h +++ b/openair3/M3AP/m3ap_itti_messaging.h @@ -29,18 +29,21 @@ #ifndef M3AP_MCE_ITTI_MESSAGING_H_ #define M3AP_MCE_ITTI_MESSAGING_H_ -void m3ap_MCE_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer, - uint32_t buffer_length, uint16_t stream); +void m3ap_MCE_itti_send_sctp_data_req(instance_t instance, + sctp_assoc_t assoc_id, + uint8_t *buffer, + uint32_t buffer_length, + uint16_t stream); +void m3ap_MCE_itti_send_sctp_close_association(instance_t instance, sctp_assoc_t assoc_id); -void m3ap_MCE_itti_send_sctp_close_association(instance_t instance, int32_t assoc_id); +void m3ap_MME_itti_send_sctp_data_req(instance_t instance, + sctp_assoc_t assoc_id, + uint8_t *buffer, + uint32_t buffer_length, + uint16_t stream); - -void m3ap_MME_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer, - uint32_t buffer_length, uint16_t stream); - - -void m3ap_MME_itti_send_sctp_close_association(instance_t instance, int32_t assoc_id); +void m3ap_MME_itti_send_sctp_close_association(instance_t instance, sctp_assoc_t assoc_id); diff --git a/openair3/NGAP/ngap_common.h b/openair3/NGAP/ngap_common.h index 41f6093c08..8c66a11cd0 100644 --- a/openair3/NGAP/ngap_common.h +++ b/openair3/NGAP/ngap_common.h @@ -127,11 +127,7 @@ extern int asn1_xer_print; /** \brief Function callback prototype. **/ -typedef int (*ngap_message_decoded_callback)( - uint32_t assoc_id, - uint32_t stream, - NGAP_NGAP_PDU_t *pdu -); +typedef int (*ngap_message_decoded_callback)(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu); /** \brief Handle criticality \param criticality Criticality of the IE diff --git a/openair3/NGAP/ngap_gNB_defs.h b/openair3/NGAP/ngap_gNB_defs.h index 5591ecb061..c93d448723 100644 --- a/openair3/NGAP/ngap_gNB_defs.h +++ b/openair3/NGAP/ngap_gNB_defs.h @@ -203,7 +203,7 @@ typedef struct ngap_gNB_amf_data_s { uint16_t cnx_id; /* SCTP association id */ - int32_t assoc_id; + sctp_assoc_t assoc_id; /* This is served PLMN IDs communicated to the AMF via an index over the * MCC/MNC array in ngap_gNB_instance */ diff --git a/openair3/NGAP/ngap_gNB_handlers.c b/openair3/NGAP/ngap_gNB_handlers.c index 788f56381f..1835b51cb6 100644 --- a/openair3/NGAP/ngap_gNB_handlers.c +++ b/openair3/NGAP/ngap_gNB_handlers.c @@ -105,10 +105,8 @@ void ngap_handle_ng_setup_message(ngap_gNB_amf_data_t *amf_desc_p, int sctp_shut } } -static -int ngap_gNB_handle_ng_setup_failure(uint32_t assoc_id, - uint32_t stream, - NGAP_NGAP_PDU_t *pdu) { +static int ngap_gNB_handle_ng_setup_failure(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) +{ NGAP_NGSetupFailure_t *container; NGAP_NGSetupFailureIEs_t *ie; ngap_gNB_amf_data_t *amf_desc_p; @@ -142,10 +140,8 @@ int ngap_gNB_handle_ng_setup_failure(uint32_t assoc_id, return 0; } -static -int ngap_gNB_handle_ng_setup_response(uint32_t assoc_id, - uint32_t stream, - NGAP_NGAP_PDU_t *pdu) { +static int ngap_gNB_handle_ng_setup_response(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) +{ NGAP_NGSetupResponse_t *container; NGAP_NGSetupResponseIEs_t *ie; ngap_gNB_amf_data_t *amf_desc_p; @@ -297,12 +293,8 @@ int ngap_gNB_handle_ng_setup_response(uint32_t assoc_id, return 0; } - -static -int ngap_gNB_handle_error_indication(uint32_t assoc_id, - uint32_t stream, - NGAP_NGAP_PDU_t *pdu) { - +static int ngap_gNB_handle_error_indication(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) +{ NGAP_ErrorIndication_t *container; NGAP_ErrorIndicationIEs_t *ie; ngap_gNB_amf_data_t *amf_desc_p; @@ -678,7 +670,7 @@ int ngap_gNB_handle_error_indication(uint32_t assoc_id, return 0; } -static int ngap_gNB_handle_initial_context_request(uint32_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) +static int ngap_gNB_handle_initial_context_request(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) { int i; ngap_gNB_amf_data_t *amf_desc_p = NULL; @@ -838,10 +830,8 @@ static int ngap_gNB_handle_initial_context_request(uint32_t assoc_id, uint32_t s return 0; } -static -int ngap_gNB_handle_ue_context_release_command(uint32_t assoc_id, - uint32_t stream, - NGAP_NGAP_PDU_t *pdu) { +static int ngap_gNB_handle_ue_context_release_command(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) +{ ngap_gNB_amf_data_t *amf_desc_p = NULL; MessageDef *message_p = NULL; uint64_t amf_ue_ngap_id; @@ -906,11 +896,9 @@ int ngap_gNB_handle_ue_context_release_command(uint32_t assoc_id, return 0; } -static -int ngap_gNB_handle_pdusession_setup_request(uint32_t assoc_id, - uint32_t stream, - NGAP_NGAP_PDU_t *pdu) { -// NGAP_AMF_UE_NGAP_ID_t amf_ue_ngap_id; +static int ngap_gNB_handle_pdusession_setup_request(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) +{ + // NGAP_AMF_UE_NGAP_ID_t amf_ue_ngap_id; uint64_t amf_ue_ngap_id; NGAP_RAN_UE_NGAP_ID_t ran_ue_ngap_id; ngap_gNB_amf_data_t *amf_desc_p = NULL; @@ -989,12 +977,8 @@ int ngap_gNB_handle_pdusession_setup_request(uint32_t assoc_id, return 0; } - -static -int ngap_gNB_handle_paging(uint32_t assoc_id, - uint32_t stream, - NGAP_NGAP_PDU_t *pdu) { - +static int ngap_gNB_handle_paging(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) +{ ngap_gNB_amf_data_t *amf_desc_p = NULL; ngap_gNB_instance_t *ngap_gNB_instance = NULL; NGAP_Paging_t *container; @@ -1082,7 +1066,7 @@ int ngap_gNB_handle_paging(uint32_t assoc_id, return 0; } -static int ngap_gNB_handle_pdusession_modify_request(uint32_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) +static int ngap_gNB_handle_pdusession_modify_request(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) { ngap_gNB_amf_data_t *amf_desc_p = NULL; NGAP_PDUSessionResourceModifyRequest_t *container; @@ -1176,11 +1160,8 @@ static int ngap_gNB_handle_pdusession_modify_request(uint32_t assoc_id, uint32_t } // handle pdu session release command and send it to rrc_end -static -int ngap_gNB_handle_pdusession_release_command(uint32_t assoc_id, - uint32_t stream, - NGAP_NGAP_PDU_t *pdu) { - +static int ngap_gNB_handle_pdusession_release_command(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) +{ int i; ngap_gNB_amf_data_t *amf_desc_p = NULL; NGAP_PDUSessionResourceReleaseCommand_t *container; @@ -1263,29 +1244,21 @@ int ngap_gNB_handle_pdusession_release_command(uint32_t assoc_id, return 0; } -static -int ngap_gNB_handle_ng_path_switch_request_ack(uint32_t assoc_id, - uint32_t stream, - NGAP_NGAP_PDU_t *pdu) { +static int ngap_gNB_handle_ng_path_switch_request_ack(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) +{ // TODO return 0; } -static -int ngap_gNB_handle_ng_path_switch_request_failure(uint32_t assoc_id, - uint32_t stream, - NGAP_NGAP_PDU_t *pdu) { - +static int ngap_gNB_handle_ng_path_switch_request_failure(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) +{ // TODO return 0; } -static -int ngap_gNB_handle_ng_ENDC_pdusession_modification_confirm(uint32_t assoc_id, - uint32_t stream, - NGAP_NGAP_PDU_t *pdu){ - - LOG_W(NGAP, "Implementation of NGAP Pdusession Modification confirm handler is pending...\n"); +static int ngap_gNB_handle_ng_ENDC_pdusession_modification_confirm(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) +{ + LOG_W(NGAP, "Implementation of NGAP Pdusession Modification confirm handler is pending...\n"); return 0; } @@ -1347,7 +1320,7 @@ const ngap_message_decoded_callback ngap_messages_callback[][3] = { }; -int ngap_gNB_handle_message(uint32_t assoc_id, int32_t stream, const uint8_t *const data, const uint32_t data_length) +int ngap_gNB_handle_message(sctp_assoc_t assoc_id, int32_t stream, const uint8_t *const data, const uint32_t data_length) { NGAP_NGAP_PDU_t pdu; int ret; diff --git a/openair3/NGAP/ngap_gNB_handlers.h b/openair3/NGAP/ngap_gNB_handlers.h index 889946dd44..5291b78fa8 100644 --- a/openair3/NGAP/ngap_gNB_handlers.h +++ b/openair3/NGAP/ngap_gNB_handlers.h @@ -32,7 +32,6 @@ void ngap_handle_ng_setup_message(ngap_gNB_amf_data_t *amf_desc_p, int sctp_shutdown); -int ngap_gNB_handle_message(uint32_t assoc_id, int32_t stream, - const uint8_t * const data, const uint32_t data_length); +int ngap_gNB_handle_message(sctp_assoc_t assoc_id, int32_t stream, const uint8_t *const data, const uint32_t data_length); #endif /* NGAP_GNB_HANDLERS_H_ */ diff --git a/openair3/NGAP/ngap_gNB_itti_messaging.c b/openair3/NGAP/ngap_gNB_itti_messaging.c index 87b4ba4c73..4f4a3b2654 100644 --- a/openair3/NGAP/ngap_gNB_itti_messaging.c +++ b/openair3/NGAP/ngap_gNB_itti_messaging.c @@ -31,8 +31,11 @@ #include "ngap_gNB_itti_messaging.h" -void ngap_gNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer, - uint32_t buffer_length, uint16_t stream) +void ngap_gNB_itti_send_sctp_data_req(instance_t instance, + sctp_assoc_t assoc_id, + uint8_t *buffer, + uint32_t buffer_length, + uint16_t stream) { MessageDef *message_p; sctp_data_req_t *sctp_data_req; @@ -66,7 +69,7 @@ void ngap_gNB_itti_send_nas_downlink_ind(instance_t instance, uint32_t gNB_ue_ng itti_send_msg_to_task(TASK_RRC_GNB, instance, message_p); } -void ngap_gNB_itti_send_sctp_close_association(instance_t instance, int32_t assoc_id) +void ngap_gNB_itti_send_sctp_close_association(instance_t instance, sctp_assoc_t assoc_id) { MessageDef *message_p = NULL; sctp_close_association_t *sctp_close_association_p = NULL; diff --git a/openair3/NGAP/ngap_gNB_itti_messaging.h b/openair3/NGAP/ngap_gNB_itti_messaging.h index 08224a27f5..362c9a0266 100644 --- a/openair3/NGAP/ngap_gNB_itti_messaging.h +++ b/openair3/NGAP/ngap_gNB_itti_messaging.h @@ -30,13 +30,14 @@ #ifndef NGAP_GNB_ITTI_MESSAGING_H_ #define NGAP_GNB_ITTI_MESSAGING_H_ -void ngap_gNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer, - uint32_t buffer_length, uint16_t stream); +void ngap_gNB_itti_send_sctp_data_req(instance_t instance, + sctp_assoc_t assoc_id, + uint8_t *buffer, + uint32_t buffer_length, + uint16_t stream); void ngap_gNB_itti_send_nas_downlink_ind(instance_t instance, uint32_t gNB_ue_ngap_id, uint8_t *nas_pdu, uint32_t nas_pdu_length); -void ngap_gNB_itti_send_sctp_close_association(instance_t instance, - int32_t assoc_id); - +void ngap_gNB_itti_send_sctp_close_association(instance_t instance, sctp_assoc_t assoc_id); #endif /* NGAP_GNB_ITTI_MESSAGING_H_ */ diff --git a/openair3/NGAP/ngap_gNB_management_procedures.c b/openair3/NGAP/ngap_gNB_management_procedures.c index 85167ed7f0..6ed06d9324 100644 --- a/openair3/NGAP/ngap_gNB_management_procedures.c +++ b/openair3/NGAP/ngap_gNB_management_procedures.c @@ -89,9 +89,7 @@ void ngap_gNB_insert_new_instance(ngap_gNB_instance_t *new_instance_p) new_instance_p, ngap_gNB_entries); } -struct ngap_gNB_amf_data_s *ngap_gNB_get_AMF( - ngap_gNB_instance_t *instance_p, - int32_t assoc_id, uint16_t cnx_id) +struct ngap_gNB_amf_data_s *ngap_gNB_get_AMF(ngap_gNB_instance_t *instance_p, sctp_assoc_t assoc_id, uint16_t cnx_id) { struct ngap_gNB_amf_data_s temp; struct ngap_gNB_amf_data_s *found; diff --git a/openair3/NGAP/ngap_gNB_management_procedures.h b/openair3/NGAP/ngap_gNB_management_procedures.h index e192f71be9..fa62f53382 100644 --- a/openair3/NGAP/ngap_gNB_management_procedures.h +++ b/openair3/NGAP/ngap_gNB_management_procedures.h @@ -31,9 +31,7 @@ #ifndef NGAP_GNB_MANAGEMENT_PROCEDURES_H_ #define NGAP_GNB_MANAGEMENT_PROCEDURES_H_ -struct ngap_gNB_amf_data_s *ngap_gNB_get_AMF( - ngap_gNB_instance_t *instance_p, - int32_t assoc_id, uint16_t cnx_id); +struct ngap_gNB_amf_data_s *ngap_gNB_get_AMF(ngap_gNB_instance_t *instance_p, sctp_assoc_t assoc_id, uint16_t cnx_id); struct ngap_gNB_amf_data_s *ngap_gNB_get_AMF_from_instance(ngap_gNB_instance_t *instance_p); diff --git a/openair3/NGAP/ngap_gNB_nas_procedures.c b/openair3/NGAP/ngap_gNB_nas_procedures.c index f9c7041006..690e603042 100644 --- a/openair3/NGAP/ngap_gNB_nas_procedures.c +++ b/openair3/NGAP/ngap_gNB_nas_procedures.c @@ -292,9 +292,7 @@ int ngap_gNB_handle_nas_first_req(instance_t instance, ngap_nas_first_req_t *UEf } //------------------------------------------------------------------------------ -int ngap_gNB_handle_nas_downlink(uint32_t assoc_id, - uint32_t stream, - NGAP_NGAP_PDU_t *pdu) +int ngap_gNB_handle_nas_downlink(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) //------------------------------------------------------------------------------ { diff --git a/openair3/NGAP/ngap_gNB_nas_procedures.h b/openair3/NGAP/ngap_gNB_nas_procedures.h index e7552cd47e..da55a349ed 100644 --- a/openair3/NGAP/ngap_gNB_nas_procedures.h +++ b/openair3/NGAP/ngap_gNB_nas_procedures.h @@ -31,10 +31,7 @@ #ifndef NGAP_GNB_NAS_PROCEDURES_H_ #define NGAP_GNB_NAS_PROCEDURES_H_ -int ngap_gNB_handle_nas_downlink( - uint32_t assoc_id, - uint32_t stream, - NGAP_NGAP_PDU_t *pdu); +int ngap_gNB_handle_nas_downlink(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu); int ngap_gNB_nas_uplink(instance_t instance, ngap_uplink_nas_t *ngap_uplink_nas_p); diff --git a/openair3/NGAP/ngap_gNB_overload.c b/openair3/NGAP/ngap_gNB_overload.c index 318a2124bd..d8512c0695 100644 --- a/openair3/NGAP/ngap_gNB_overload.c +++ b/openair3/NGAP/ngap_gNB_overload.c @@ -45,17 +45,13 @@ #include "assertions.h" -int ngap_gNB_handle_overload_start(uint32_t assoc_id, - uint32_t stream, - NGAP_NGAP_PDU_t *pdu) +int ngap_gNB_handle_overload_start(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) { //TODO return 0; } -int ngap_gNB_handle_overload_stop(uint32_t assoc_id, - uint32_t stream, - NGAP_NGAP_PDU_t *pdu) +int ngap_gNB_handle_overload_stop(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) { /* We received Overload stop message, meaning that the AMF is no more * overloaded. This is an empty message, with only message header and no diff --git a/openair3/NGAP/ngap_gNB_overload.h b/openair3/NGAP/ngap_gNB_overload.h index 0b7ab52c26..b893194a4b 100644 --- a/openair3/NGAP/ngap_gNB_overload.h +++ b/openair3/NGAP/ngap_gNB_overload.h @@ -36,9 +36,7 @@ // int ngap_gNB_handle_overload_start(gNB_amf_desc_t *gNB_desc_p, // sctp_queue_item_t *packet_p, // struct ngap_message_s *message_p); -int ngap_gNB_handle_overload_start(uint32_t assoc_id, - uint32_t stream, - NGAP_NGAP_PDU_t *pdu); +int ngap_gNB_handle_overload_start(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu); /** * \brief Handle an overload stop message @@ -46,8 +44,6 @@ int ngap_gNB_handle_overload_start(uint32_t assoc_id, // int ngap_gNB_handle_overload_stop(gNB_amf_desc_t *gNB_desc_p, // sctp_queue_item_t *packet_p, // struct ngap_message_s *message_p); -int ngap_gNB_handle_overload_stop(uint32_t assoc_id, - uint32_t stream, - NGAP_NGAP_PDU_t *pdu); +int ngap_gNB_handle_overload_stop(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu); #endif /* NGAP_GNB_OVERLOAD_H_ */ diff --git a/openair3/NGAP/ngap_gNB_trace.c b/openair3/NGAP/ngap_gNB_trace.c index f3e216988c..8fc0968ccd 100644 --- a/openair3/NGAP/ngap_gNB_trace.c +++ b/openair3/NGAP/ngap_gNB_trace.c @@ -45,18 +45,13 @@ #include "ngap_gNB_itti_messaging.h" #include "ngap_gNB_management_procedures.h" - -int ngap_gNB_handle_trace_start(uint32_t assoc_id, - uint32_t stream, - NGAP_NGAP_PDU_t *pdu) +int ngap_gNB_handle_trace_start(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu) { //TODO return 0; } -int ngap_gNB_handle_deactivate_trace(uint32_t assoc_id, - uint32_t stream, - NGAP_NGAP_PDU_t *message_p) +int ngap_gNB_handle_deactivate_trace(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *message_p) { // NGAP_DeactivateTraceIEs_t *deactivate_trace_p; // diff --git a/openair3/NGAP/ngap_gNB_trace.h b/openair3/NGAP/ngap_gNB_trace.h index 70863e3737..b35354a16f 100644 --- a/openair3/NGAP/ngap_gNB_trace.h +++ b/openair3/NGAP/ngap_gNB_trace.h @@ -30,12 +30,8 @@ #ifndef NGAP_GNB_TRACE_H_ #define NGAP_GNB_TRACE_H_ -int ngap_gNB_handle_trace_start(uint32_t assoc_id, - uint32_t stream, - NGAP_NGAP_PDU_t *pdu); +int ngap_gNB_handle_trace_start(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu); -int ngap_gNB_handle_deactivate_trace(uint32_t assoc_id, - uint32_t stream, - NGAP_NGAP_PDU_t *pdu); +int ngap_gNB_handle_deactivate_trace(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu); #endif /* NGAP_GNB_TRACE_H_ */ diff --git a/openair3/S1AP/s1ap_common.h b/openair3/S1AP/s1ap_common.h index 65baea44c6..a452d284e5 100644 --- a/openair3/S1AP/s1ap_common.h +++ b/openair3/S1AP/s1ap_common.h @@ -28,6 +28,8 @@ #include "common/utils/LOG/log.h" #include "oai_asn1.h" +#include "netinet/in.h" +#include "netinet/sctp.h" #include "S1AP_ProtocolIE-Field.h" #include "S1AP_S1AP-PDU.h" @@ -85,11 +87,7 @@ extern int asn1_xer_print; } while(0) /** \brief Function callback prototype. **/ -typedef int (*s1ap_message_decoded_callback)( - uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu -); +typedef int (*s1ap_message_decoded_callback)(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu); /** \brief Handle criticality \param criticality Criticality of the IE diff --git a/openair3/S1AP/s1ap_eNB_defs.h b/openair3/S1AP/s1ap_eNB_defs.h index ed0909d66e..89f31f6486 100644 --- a/openair3/S1AP/s1ap_eNB_defs.h +++ b/openair3/S1AP/s1ap_eNB_defs.h @@ -156,7 +156,7 @@ typedef struct s1ap_eNB_mme_data_s { uint16_t cnx_id; /* SCTP association id */ - int32_t assoc_id; + sctp_assoc_t assoc_id; /* This is served PLMN IDs communicated to the MME via an index over the * MCC/MNC array in s1ap_eNB_instance */ diff --git a/openair3/S1AP/s1ap_eNB_handlers.c b/openair3/S1AP/s1ap_eNB_handlers.c index 6bad1ce455..241abc459f 100644 --- a/openair3/S1AP/s1ap_eNB_handlers.c +++ b/openair3/S1AP/s1ap_eNB_handlers.c @@ -50,64 +50,28 @@ #include "assertions.h" #include "conversions.h" -static -int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu); -static -int s1ap_eNB_handle_s1_setup_failure(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu); +static int s1ap_eNB_handle_s1_setup_response(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu); +static int s1ap_eNB_handle_s1_setup_failure(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu); -static -int s1ap_eNB_handle_error_indication(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu); +static int s1ap_eNB_handle_error_indication(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu); -static -int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu); +static int s1ap_eNB_handle_initial_context_request(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu); -static -int s1ap_eNB_handle_ue_context_release_command(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu); +static int s1ap_eNB_handle_ue_context_release_command(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu); -static -int s1ap_eNB_handle_e_rab_setup_request(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu); +static int s1ap_eNB_handle_e_rab_setup_request(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu); -static -int s1ap_eNB_handle_paging(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu); +static int s1ap_eNB_handle_paging(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu); -static -int s1ap_eNB_handle_e_rab_modify_request(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu); +static int s1ap_eNB_handle_e_rab_modify_request(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu); -static -int s1ap_eNB_handle_e_rab_release_command(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu); +static int s1ap_eNB_handle_e_rab_release_command(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu); -static -int s1ap_eNB_handle_s1_path_switch_request_ack(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu); +static int s1ap_eNB_handle_s1_path_switch_request_ack(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu); -static -int s1ap_eNB_handle_s1_path_switch_request_failure(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu); +static int s1ap_eNB_handle_s1_path_switch_request_failure(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu); -static -int s1ap_eNB_handle_s1_ENDC_e_rab_modification_confirm(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu); +static int s1ap_eNB_handle_s1_ENDC_e_rab_modification_confirm(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu); static int s1ap_eNB_snd_s1_setup_request( s1ap_eNB_instance_t *instance_p, @@ -228,8 +192,8 @@ void s1ap_handle_s1_setup_message(s1ap_eNB_mme_data_t *mme_desc_p, int sctp_shut } } -int s1ap_eNB_handle_message(uint32_t assoc_id, int32_t stream, - const uint8_t *const data, const uint32_t data_length) { +int s1ap_eNB_handle_message(sctp_assoc_t assoc_id, int32_t stream, const uint8_t *const data, const uint32_t data_length) +{ S1AP_S1AP_PDU_t pdu; int ret; DevAssert(data != NULL); @@ -268,10 +232,8 @@ int s1ap_eNB_handle_message(uint32_t assoc_id, int32_t stream, return ret; } -static -int s1ap_eNB_handle_s1_setup_failure(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu) { +static int s1ap_eNB_handle_s1_setup_failure(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu) +{ S1AP_S1SetupFailure_t *container; S1AP_S1SetupFailureIEs_t *ie; s1ap_eNB_mme_data_t *mme_desc_p; @@ -361,10 +323,8 @@ int s1ap_eNB_handle_s1_setup_failure(uint32_t assoc_id, return 0; } -static -int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu) { +static int s1ap_eNB_handle_s1_setup_response(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu) +{ S1AP_S1SetupResponse_t *container; S1AP_S1SetupResponseIEs_t *ie; s1ap_eNB_mme_data_t *mme_desc_p; @@ -478,11 +438,8 @@ int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id, return 0; } - -static -int s1ap_eNB_handle_error_indication(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu) { +static int s1ap_eNB_handle_error_indication(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu) +{ S1AP_ErrorIndication_t *container; S1AP_ErrorIndicationIEs_t *ie; s1ap_eNB_mme_data_t *mme_desc_p; @@ -817,11 +774,8 @@ int s1ap_eNB_handle_error_indication(uint32_t assoc_id, return 0; } - -static -int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu) { +static int s1ap_eNB_handle_initial_context_request(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu) +{ int i; s1ap_eNB_mme_data_t *mme_desc_p = NULL; s1ap_eNB_ue_context_t *ue_desc_p = NULL; @@ -987,11 +941,8 @@ int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id, return 0; } - -static -int s1ap_eNB_handle_ue_context_release_command(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu) { +static int s1ap_eNB_handle_ue_context_release_command(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu) +{ s1ap_eNB_mme_data_t *mme_desc_p = NULL; s1ap_eNB_ue_context_t *ue_desc_p = NULL; MessageDef *message_p = NULL; @@ -1078,13 +1029,10 @@ int s1ap_eNB_handle_ue_context_release_command(uint32_t assoc_id, S1AP_ERROR( "Mandatory Element Nothing : UEContextReleaseCommand(UE_S1AP_IDs)\n" ); return -1; } - } -static -int s1ap_eNB_handle_e_rab_setup_request(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu) { +static int s1ap_eNB_handle_e_rab_setup_request(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu) +{ int i; S1AP_MME_UE_S1AP_ID_t mme_ue_s1ap_id; S1AP_ENB_UE_S1AP_ID_t enb_ue_s1ap_id; @@ -1204,10 +1152,8 @@ int s1ap_eNB_handle_e_rab_setup_request(uint32_t assoc_id, return 0; } -static -int s1ap_eNB_handle_paging(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu) { +static int s1ap_eNB_handle_paging(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu) +{ s1ap_eNB_mme_data_t *mme_desc_p = NULL; s1ap_eNB_instance_t *s1ap_eNB_instance = NULL; MessageDef *message_p = NULL; @@ -1374,10 +1320,8 @@ int s1ap_eNB_handle_paging(uint32_t assoc_id, return 0; } -static -int s1ap_eNB_handle_e_rab_modify_request(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu) { +static int s1ap_eNB_handle_e_rab_modify_request(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu) +{ int i, nb_of_e_rabs_failed; s1ap_eNB_mme_data_t *mme_desc_p = NULL; s1ap_eNB_ue_context_t *ue_desc_p = NULL; @@ -1510,10 +1454,8 @@ int s1ap_eNB_handle_e_rab_modify_request(uint32_t assoc_id, return 0; } // handle e-rab release command and send it to rrc_end -static -int s1ap_eNB_handle_e_rab_release_command(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu) { +static int s1ap_eNB_handle_e_rab_release_command(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu) +{ int i; s1ap_eNB_mme_data_t *mme_desc_p = NULL; s1ap_eNB_ue_context_t *ue_desc_p = NULL; @@ -1614,10 +1556,8 @@ int s1ap_eNB_handle_e_rab_release_command(uint32_t assoc_id, return 0; } -static -int s1ap_eNB_handle_s1_path_switch_request_ack(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu) { +static int s1ap_eNB_handle_s1_path_switch_request_ack(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu) +{ s1ap_eNB_mme_data_t *mme_desc_p = NULL; s1ap_eNB_ue_context_t *ue_desc_p = NULL; MessageDef *message_p = NULL; @@ -1776,10 +1716,8 @@ int s1ap_eNB_handle_s1_path_switch_request_ack(uint32_t assoc_id, return 0; } -static -int s1ap_eNB_handle_s1_path_switch_request_failure(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu) { +static int s1ap_eNB_handle_s1_path_switch_request_failure(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu) +{ s1ap_eNB_mme_data_t *mme_desc_p = NULL; S1AP_PathSwitchRequestFailure_t *pathSwitchRequestFailure; S1AP_PathSwitchRequestFailureIEs_t *ie; @@ -1843,12 +1781,9 @@ int s1ap_eNB_handle_s1_path_switch_request_failure(uint32_t assoc_ return 0; } -static -int s1ap_eNB_handle_s1_ENDC_e_rab_modification_confirm(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu){ - - LOG_I(S1AP, "Received S1AP E-RAB Modification confirm message \n"); +static int s1ap_eNB_handle_s1_ENDC_e_rab_modification_confirm(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu) +{ + LOG_I(S1AP, "Received S1AP E-RAB Modification confirm message \n"); return 0; } diff --git a/openair3/S1AP/s1ap_eNB_handlers.h b/openair3/S1AP/s1ap_eNB_handlers.h index d0e93faa4d..ea9873679d 100644 --- a/openair3/S1AP/s1ap_eNB_handlers.h +++ b/openair3/S1AP/s1ap_eNB_handlers.h @@ -24,7 +24,6 @@ void s1ap_handle_s1_setup_message(s1ap_eNB_mme_data_t *mme_desc_p, int sctp_shutdown); -int s1ap_eNB_handle_message(uint32_t assoc_id, int32_t stream, - const uint8_t * const data, const uint32_t data_length); +int s1ap_eNB_handle_message(sctp_assoc_t assoc_id, int32_t stream, const uint8_t *const data, const uint32_t data_length); #endif /* S1AP_ENB_HANDLERS_H_ */ diff --git a/openair3/S1AP/s1ap_eNB_itti_messaging.c b/openair3/S1AP/s1ap_eNB_itti_messaging.c index 8a6539a118..ffaed8d5fb 100644 --- a/openair3/S1AP/s1ap_eNB_itti_messaging.c +++ b/openair3/S1AP/s1ap_eNB_itti_messaging.c @@ -23,8 +23,11 @@ #include "s1ap_eNB_itti_messaging.h" -void s1ap_eNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer, - uint32_t buffer_length, uint16_t stream) +void s1ap_eNB_itti_send_sctp_data_req(instance_t instance, + sctp_assoc_t assoc_id, + uint8_t *buffer, + uint32_t buffer_length, + uint16_t stream) { MessageDef *message_p; sctp_data_req_t *sctp_data_req; @@ -63,7 +66,7 @@ void s1ap_eNB_itti_send_nas_downlink_ind(instance_t instance, itti_send_msg_to_task(TASK_RRC_ENB, instance, message_p); } -void s1ap_eNB_itti_send_sctp_close_association(instance_t instance, int32_t assoc_id) +void s1ap_eNB_itti_send_sctp_close_association(instance_t instance, sctp_assoc_t assoc_id) { MessageDef *message_p = NULL; sctp_close_association_t *sctp_close_association_p = NULL; diff --git a/openair3/S1AP/s1ap_eNB_itti_messaging.h b/openair3/S1AP/s1ap_eNB_itti_messaging.h index cd6b3cebcc..ac4ad8ffae 100644 --- a/openair3/S1AP/s1ap_eNB_itti_messaging.h +++ b/openair3/S1AP/s1ap_eNB_itti_messaging.h @@ -22,8 +22,14 @@ #ifndef S1AP_ENB_ITTI_MESSAGING_H_ #define S1AP_ENB_ITTI_MESSAGING_H_ -void s1ap_eNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer, - uint32_t buffer_length, uint16_t stream); +#include +#include + +void s1ap_eNB_itti_send_sctp_data_req(instance_t instance, + sctp_assoc_t assoc_id, + uint8_t *buffer, + uint32_t buffer_length, + uint16_t stream); void s1ap_eNB_itti_send_nas_downlink_ind(instance_t instance, uint16_t ue_initial_id, @@ -31,8 +37,6 @@ void s1ap_eNB_itti_send_nas_downlink_ind(instance_t instance, uint8_t *nas_pdu, uint32_t nas_pdu_length); -void s1ap_eNB_itti_send_sctp_close_association(instance_t instance, - int32_t assoc_id); - +void s1ap_eNB_itti_send_sctp_close_association(instance_t instance, sctp_assoc_t assoc_id); #endif /* S1AP_ENB_ITTI_MESSAGING_H_ */ diff --git a/openair3/S1AP/s1ap_eNB_management_procedures.c b/openair3/S1AP/s1ap_eNB_management_procedures.c index a870e975a2..e9effa7824 100644 --- a/openair3/S1AP/s1ap_eNB_management_procedures.c +++ b/openair3/S1AP/s1ap_eNB_management_procedures.c @@ -89,9 +89,7 @@ void s1ap_eNB_insert_new_instance(s1ap_eNB_instance_t *new_instance_p) new_instance_p, s1ap_eNB_entries); } -struct s1ap_eNB_mme_data_s *s1ap_eNB_get_MME( - s1ap_eNB_instance_t *instance_p, - int32_t assoc_id, uint16_t cnx_id) +struct s1ap_eNB_mme_data_s *s1ap_eNB_get_MME(s1ap_eNB_instance_t *instance_p, sctp_assoc_t assoc_id, uint16_t cnx_id) { struct s1ap_eNB_mme_data_s temp; struct s1ap_eNB_mme_data_s *found; diff --git a/openair3/S1AP/s1ap_eNB_management_procedures.h b/openair3/S1AP/s1ap_eNB_management_procedures.h index 83df7f8919..4ec8fba2f4 100644 --- a/openair3/S1AP/s1ap_eNB_management_procedures.h +++ b/openair3/S1AP/s1ap_eNB_management_procedures.h @@ -22,9 +22,7 @@ #ifndef S1AP_ENB_MANAGEMENT_PROCEDURES_H_ #define S1AP_ENB_MANAGEMENT_PROCEDURES_H_ -struct s1ap_eNB_mme_data_s *s1ap_eNB_get_MME( - s1ap_eNB_instance_t *instance_p, - int32_t assoc_id, uint16_t cnx_id); +struct s1ap_eNB_mme_data_s *s1ap_eNB_get_MME(s1ap_eNB_instance_t *instance_p, sctp_assoc_t assoc_id, uint16_t cnx_id); struct s1ap_eNB_mme_data_s *s1ap_eNB_get_MME_from_instance(s1ap_eNB_instance_t *instance_p); diff --git a/openair3/S1AP/s1ap_eNB_nas_procedures.c b/openair3/S1AP/s1ap_eNB_nas_procedures.c index d1eefc8b21..c8c844ac56 100644 --- a/openair3/S1AP/s1ap_eNB_nas_procedures.c +++ b/openair3/S1AP/s1ap_eNB_nas_procedures.c @@ -316,9 +316,7 @@ int s1ap_eNB_handle_nas_first_req( } //------------------------------------------------------------------------------ -int s1ap_eNB_handle_nas_downlink(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu) +int s1ap_eNB_handle_nas_downlink(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu) //------------------------------------------------------------------------------ { s1ap_eNB_mme_data_t *mme_desc_p = NULL; diff --git a/openair3/S1AP/s1ap_eNB_nas_procedures.h b/openair3/S1AP/s1ap_eNB_nas_procedures.h index 47f71cc795..35eaa94f89 100644 --- a/openair3/S1AP/s1ap_eNB_nas_procedures.h +++ b/openair3/S1AP/s1ap_eNB_nas_procedures.h @@ -22,10 +22,7 @@ #ifndef S1AP_ENB_NAS_PROCEDURES_H_ #define S1AP_ENB_NAS_PROCEDURES_H_ -int s1ap_eNB_handle_nas_downlink( - uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu); +int s1ap_eNB_handle_nas_downlink(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu); int s1ap_eNB_nas_uplink(instance_t instance, s1ap_uplink_nas_t *s1ap_uplink_nas_p); diff --git a/openair3/S1AP/s1ap_eNB_overload.c b/openair3/S1AP/s1ap_eNB_overload.c index 4266a7090c..15092c19f8 100644 --- a/openair3/S1AP/s1ap_eNB_overload.c +++ b/openair3/S1AP/s1ap_eNB_overload.c @@ -43,9 +43,7 @@ #include "assertions.h" -int s1ap_eNB_handle_overload_start(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu) +int s1ap_eNB_handle_overload_start(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu) { s1ap_eNB_mme_data_t *mme_desc_p; S1AP_OverloadStart_t *container; @@ -88,9 +86,7 @@ int s1ap_eNB_handle_overload_start(uint32_t assoc_id, return 0; } -int s1ap_eNB_handle_overload_stop(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu) +int s1ap_eNB_handle_overload_stop(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu) { /* We received Overload stop message, meaning that the MME is no more * overloaded. This is an empty message, with only message header and no diff --git a/openair3/S1AP/s1ap_eNB_overload.h b/openair3/S1AP/s1ap_eNB_overload.h index 8133345dee..bf6f95ac9d 100644 --- a/openair3/S1AP/s1ap_eNB_overload.h +++ b/openair3/S1AP/s1ap_eNB_overload.h @@ -28,9 +28,7 @@ // int s1ap_eNB_handle_overload_start(eNB_mme_desc_t *eNB_desc_p, // sctp_queue_item_t *packet_p, // struct s1ap_message_s *message_p); -int s1ap_eNB_handle_overload_start(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu); +int s1ap_eNB_handle_overload_start(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu); /** * \brief Handle an overload stop message @@ -38,8 +36,6 @@ int s1ap_eNB_handle_overload_start(uint32_t assoc_id, // int s1ap_eNB_handle_overload_stop(eNB_mme_desc_t *eNB_desc_p, // sctp_queue_item_t *packet_p, // struct s1ap_message_s *message_p); -int s1ap_eNB_handle_overload_stop(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu); +int s1ap_eNB_handle_overload_stop(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu); #endif /* S1AP_ENB_OVERLOAD_H_ */ diff --git a/openair3/S1AP/s1ap_eNB_trace.c b/openair3/S1AP/s1ap_eNB_trace.c index 38787a6999..1eb7abe704 100644 --- a/openair3/S1AP/s1ap_eNB_trace.c +++ b/openair3/S1AP/s1ap_eNB_trace.c @@ -101,9 +101,7 @@ void s1ap_eNB_generate_trace_failure(struct s1ap_eNB_ue_context_s *ue_desc_p, length, ue_desc_p->tx_stream); } -int s1ap_eNB_handle_trace_start(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu) +int s1ap_eNB_handle_trace_start(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu) { S1AP_TraceStart_t *container; S1AP_TraceStartIEs_t *ie; @@ -142,9 +140,7 @@ int s1ap_eNB_handle_trace_start(uint32_t assoc_id, return 0; } -int s1ap_eNB_handle_deactivate_trace(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *message_p) +int s1ap_eNB_handle_deactivate_trace(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *message_p) { // S1AP_DeactivateTraceIEs_t *deactivate_trace_p; // diff --git a/openair3/S1AP/s1ap_eNB_trace.h b/openair3/S1AP/s1ap_eNB_trace.h index 75f7a59dc4..b933221098 100644 --- a/openair3/S1AP/s1ap_eNB_trace.h +++ b/openair3/S1AP/s1ap_eNB_trace.h @@ -32,15 +32,11 @@ // int s1ap_eNB_handle_trace_start(eNB_mme_desc_t *eNB_desc_p, // sctp_queue_item_t *packet_p, // struct s1ap_message_s *message_p); -int s1ap_eNB_handle_trace_start(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu); +int s1ap_eNB_handle_trace_start(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu); // int s1ap_eNB_handle_deactivate_trace(eNB_mme_desc_t *eNB_desc_p, // sctp_queue_item_t *packet_p, // struct s1ap_message_s *message_p); -int s1ap_eNB_handle_deactivate_trace(uint32_t assoc_id, - uint32_t stream, - S1AP_S1AP_PDU_t *pdu); +int s1ap_eNB_handle_deactivate_trace(sctp_assoc_t assoc_id, uint32_t stream, S1AP_S1AP_PDU_t *pdu); #endif /* S1AP_ENB_TRACE_H_ */ diff --git a/openair3/SCTP/sctp_eNB_defs.h b/openair3/SCTP/sctp_eNB_defs.h index 9d3b4119b5..6f4551cd83 100644 --- a/openair3/SCTP/sctp_eNB_defs.h +++ b/openair3/SCTP/sctp_eNB_defs.h @@ -19,11 +19,13 @@ * contact@openairinterface.org */ -#include "queue.h" - #ifndef SCTP_ENB_DEFS_H_ #define SCTP_ENB_DEFS_H_ +#include "queue.h" +#include +#include + typedef struct sctp_queue_item_s { /* Pair of stream on which we received this packet */ uint16_t local_stream; @@ -32,7 +34,7 @@ typedef struct sctp_queue_item_s { uint16_t remote_port; /* Remote address */ uint32_t remote_addr; - uint32_t assoc_id; + sctp_assoc_t assoc_id; /* PPID used for the packet */ uint32_t ppid; @@ -52,7 +54,7 @@ typedef struct { /* Unique SCTP association ID (Local to host), used to distinguish * associations between MME and eNB. */ - int32_t assoc_id; + sctp_assoc_t assoc_id; /* Current remote port used for transmission */ uint16_t remote_port; diff --git a/openair3/SCTP/sctp_eNB_itti_messaging.c b/openair3/SCTP/sctp_eNB_itti_messaging.c index c31d4ba9ed..40472ed923 100644 --- a/openair3/SCTP/sctp_eNB_itti_messaging.c +++ b/openair3/SCTP/sctp_eNB_itti_messaging.c @@ -38,9 +38,12 @@ int sctp_itti_send_init_msg_multi_cnf(task_id_t task_id, instance_t instance, in return itti_send_msg_to_task(task_id, instance, message_p); } -int sctp_itti_send_new_message_ind(task_id_t task_id, instance_t instance, - uint32_t assoc_id, uint8_t *buffer, - uint32_t buffer_length, uint16_t stream) +int sctp_itti_send_new_message_ind(task_id_t task_id, + instance_t instance, + sctp_assoc_t assoc_id, + uint8_t *buffer, + uint32_t buffer_length, + uint16_t stream) { MessageDef *message_p; sctp_data_ind_t *sctp_data_ind_p; @@ -61,10 +64,13 @@ int sctp_itti_send_new_message_ind(task_id_t task_id, instance_t instance, return itti_send_msg_to_task(task_id, instance, message_p); } -int sctp_itti_send_association_resp(task_id_t task_id, instance_t instance, - int32_t assoc_id, - uint16_t cnx_id, enum sctp_state_e state, - uint16_t out_streams, uint16_t in_streams) +int sctp_itti_send_association_resp(task_id_t task_id, + instance_t instance, + sctp_assoc_t assoc_id, + uint16_t cnx_id, + enum sctp_state_e state, + uint16_t out_streams, + uint16_t in_streams) { MessageDef *message_p; sctp_new_association_resp_t *sctp_new_association_resp_p; @@ -82,9 +88,12 @@ int sctp_itti_send_association_resp(task_id_t task_id, instance_t instance, return itti_send_msg_to_task(task_id, instance, message_p); } -int sctp_itti_send_association_ind(task_id_t task_id, instance_t instance, - int32_t assoc_id, uint16_t port, - uint16_t out_streams, uint16_t in_streams) +int sctp_itti_send_association_ind(task_id_t task_id, + instance_t instance, + sctp_assoc_t assoc_id, + uint16_t port, + uint16_t out_streams, + uint16_t in_streams) { MessageDef *message_p; sctp_new_association_ind_t *sctp_new_association_ind_p; diff --git a/openair3/SCTP/sctp_eNB_itti_messaging.h b/openair3/SCTP/sctp_eNB_itti_messaging.h index a35dc2219a..a91e95493c 100644 --- a/openair3/SCTP/sctp_eNB_itti_messaging.h +++ b/openair3/SCTP/sctp_eNB_itti_messaging.h @@ -24,18 +24,26 @@ int sctp_itti_send_init_msg_multi_cnf(task_id_t task_id, instance_t instance, int multi_sd); -int sctp_itti_send_new_message_ind(task_id_t task_id, instance_t instance, - uint32_t assoc_id, uint8_t *buffer, - uint32_t buffer_length, uint16_t stream); +int sctp_itti_send_new_message_ind(task_id_t task_id, + instance_t instance, + sctp_assoc_t assoc_id, + uint8_t *buffer, + uint32_t buffer_length, + uint16_t stream); -int sctp_itti_send_association_resp(task_id_t task_id, instance_t instance, - int32_t assoc_id, - uint16_t cnx_id, enum sctp_state_e state, - uint16_t out_streams, uint16_t in_streams); - -int sctp_itti_send_association_ind(task_id_t task_id, instance_t instance, - int32_t assoc_id, uint16_t port, - uint16_t out_streams, uint16_t in_streams); +int sctp_itti_send_association_resp(task_id_t task_id, + instance_t instance, + sctp_assoc_t assoc_id, + uint16_t cnx_id, + enum sctp_state_e state, + uint16_t out_streams, + uint16_t in_streams); +int sctp_itti_send_association_ind(task_id_t task_id, + instance_t instance, + sctp_assoc_t assoc_id, + uint16_t port, + uint16_t out_streams, + uint16_t in_streams); #endif /* SCTP_ITTI_MESSAGING_H_ */ diff --git a/openair3/SCTP/sctp_eNB_task.c b/openair3/SCTP/sctp_eNB_task.c index 35a2692bd4..6701521b8c 100644 --- a/openair3/SCTP/sctp_eNB_task.c +++ b/openair3/SCTP/sctp_eNB_task.c @@ -77,7 +77,7 @@ typedef struct sctp_cnx_list_elm_s { uint16_t in_streams; ///< Number of input streams negociated for this connection uint16_t out_streams; ///< Number of output streams negotiated for this connection uint16_t ppid; ///< Payload protocol Identifier - int32_t assoc_id; ///< SCTP association id for the connection (note4debug host byte order) + sctp_assoc_t assoc_id; ///< SCTP association id for the connection (note4debug host byte order) uint32_t messages_recv; ///< Number of messages received on this connection uint32_t messages_sent; ///< Number of messages sent on this connection task_id_t task_id; ///< Task id of the task who asked for this connection @@ -93,7 +93,7 @@ static STAILQ_HEAD(sctp_cnx_list_head, sctp_cnx_list_elm_s) sctp_cnx_list; static uint16_t sctp_nb_cnx = 0; //------------------------------------------------------------------------------ -struct sctp_cnx_list_elm_s *sctp_get_cnx(int32_t assoc_id, int sd) +struct sctp_cnx_list_elm_s *sctp_get_cnx(sctp_assoc_t assoc_id, int sd) { struct sctp_cnx_list_elm_s *elm; @@ -225,7 +225,7 @@ sctp_handle_new_association_req_multi( int ns; int sd; - int32_t assoc_id = 0; + sctp_assoc_t assoc_id = 0; struct sctp_cnx_list_elm_s *sctp_cnx = NULL; enum sctp_connection_type_e connection_type = SCTP_TYPE_CLIENT; @@ -362,7 +362,7 @@ sctp_handle_new_association_req( const sctp_new_association_req_t * const sctp_new_association_req_p) { int sd = 0; - int32_t assoc_id = 0; + sctp_assoc_t assoc_id = 0; struct sctp_event_subscribe events={0};