From 40cfe2e5f24d9bb7fc57a52858dd5e322d707e95 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 12 Feb 2026 06:02:59 +0100 Subject: [PATCH 01/37] Remove unused GTP types --- openair3/ocp-gtpu/gtp_itf.h | 42 ------------------------------------- 1 file changed, 42 deletions(-) diff --git a/openair3/ocp-gtpu/gtp_itf.h b/openair3/ocp-gtpu/gtp_itf.h index 9274cd52f2..8139eb3667 100644 --- a/openair3/ocp-gtpu/gtp_itf.h +++ b/openair3/ocp-gtpu/gtp_itf.h @@ -132,48 +132,6 @@ typedef struct gtpv1u_gnb_delete_tunnel_req_s gtpv1u_gnb_delete_tunnel_req_t; instance_t gtpv1Init(openAddr_t context); void *gtpv1uTask(void *args); -#define GTPV1U_BEARER_OFFSET 3 -#define GTPV1U_MAX_BEARERS_ID (32 - GTPV1U_BEARER_OFFSET) /* max_val_LTE_DRB_Identity */ - typedef enum { - BEARER_DOWN = 0, - BEARER_IN_CONFIG, - BEARER_UP, - BEARER_DL_HANDOVER, - BEARER_UL_HANDOVER, - BEARER_MAX, - } bearer_state_t; - - typedef struct fixMe_gtpv1u_bearer_s { - /* TEID used in dl and ul */ - teid_t teid_eNB; ///< eNB TEID - uintptr_t teid_eNB_stack_session; ///< eNB TEID - teid_t teid_sgw; ///< Remote TEID - in_addr_t sgw_ip_addr; - struct in6_addr sgw_ip6_addr; - teid_t teid_teNB; - in_addr_t tenb_ip_addr; ///< target eNB ipv4 - struct in6_addr tenb_ip6_addr; ///< target eNB ipv6 - tcp_udp_port_t port; - //NwGtpv1uStackSessionHandleT stack_session; - bearer_state_t state; - } fixMe_gtpv1u_bearer_t; - - typedef struct gtpv1u_ue_data_s { - /* UE identifier for oaisim stack */ - rnti_t ue_id; - - /* Unique identifier used between PDCP and GTP-U to distinguish UEs */ - uint32_t instance_id; - int num_bearers; - /* Bearer related data. - * Note that the first LCID available for data is 3 and we fixed the maximum - * number of e-rab per UE to be (32 [id range]), max RB is 11. The real rb id will 3 + rab_id (3..32). - */ - fixMe_gtpv1u_bearer_t bearers[GTPV1U_MAX_BEARERS_ID]; - - //RB_ENTRY(gtpv1u_ue_data_s) gtpv1u_ue_node; - } gtpv1u_ue_data_t; - #ifdef __cplusplus } #endif From d9d18f07fde2a91759e2dcd5f31e970facd6b9d1 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 12 Feb 2026 06:06:19 +0100 Subject: [PATCH 02/37] Remove unused functions --- openair2/RRC/LTE/rrc_eNB_GTPV1U.c | 162 ------------------------------ openair2/RRC/LTE/rrc_eNB_GTPV1U.h | 9 -- 2 files changed, 171 deletions(-) diff --git a/openair2/RRC/LTE/rrc_eNB_GTPV1U.c b/openair2/RRC/LTE/rrc_eNB_GTPV1U.c index 7010c7c831..4088e2b0c6 100644 --- a/openair2/RRC/LTE/rrc_eNB_GTPV1U.c +++ b/openair2/RRC/LTE/rrc_eNB_GTPV1U.c @@ -82,168 +82,6 @@ rrc_eNB_process_GTPV1U_CREATE_TUNNEL_RESP( } } -//------------------------------------------------------------------------------ -bool gtpv_data_req(const protocol_ctxt_t* const ctxt_pP, - const rb_id_t rb_idP, - const mui_t muiP, - const confirm_t confirmP, - const sdu_size_t sdu_sizeP, - uint8_t* const buffer_pP, - const pdcp_transmission_mode_t modeP, - uint32_t task_id) -//------------------------------------------------------------------------------ -{ - if(sdu_sizeP == 0) - { - LOG_I(GTPU,"gtpv_data_req sdu_sizeP == 0"); - return false; - } - LOG_D(GTPU, "gtpv_data_req ue rnti %lx sdu_sizeP %d rb id %ld", ctxt_pP->rntiMaybeUEid, sdu_sizeP, rb_idP); - MessageDef *message_p; - // Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling). - uint8_t *message_buffer; - - if(task_id == TASK_DATA_FORWARDING){ - - LOG_I(GTPU,"gtpv_data_req task_id = TASK_DATA_FORWARDING\n"); - - message_buffer = itti_malloc (TASK_GTPV1_U, TASK_DATA_FORWARDING, sdu_sizeP); - - memcpy (message_buffer, buffer_pP, sdu_sizeP); - - message_p = itti_alloc_new_message (TASK_GTPV1_U, 0, GTPV1U_ENB_DATA_FORWARDING_IND); - GTPV1U_ENB_DATA_FORWARDING_IND (message_p).frame = ctxt_pP->frame; - GTPV1U_ENB_DATA_FORWARDING_IND (message_p).enb_flag = ctxt_pP->enb_flag; - GTPV1U_ENB_DATA_FORWARDING_IND (message_p).rb_id = rb_idP; - GTPV1U_ENB_DATA_FORWARDING_IND (message_p).muip = muiP; - GTPV1U_ENB_DATA_FORWARDING_IND (message_p).confirmp = confirmP; - GTPV1U_ENB_DATA_FORWARDING_IND (message_p).sdu_size = sdu_sizeP; - GTPV1U_ENB_DATA_FORWARDING_IND (message_p).sdu_p = message_buffer; - GTPV1U_ENB_DATA_FORWARDING_IND (message_p).mode = modeP; - GTPV1U_ENB_DATA_FORWARDING_IND (message_p).module_id = ctxt_pP->module_id; - GTPV1U_ENB_DATA_FORWARDING_IND(message_p).rnti = ctxt_pP->rntiMaybeUEid; - GTPV1U_ENB_DATA_FORWARDING_IND (message_p).eNB_index = ctxt_pP->eNB_index; - - itti_send_msg_to_task (TASK_DATA_FORWARDING, ctxt_pP->instance, message_p); - return true; // TODO should be changed to a CNF message later, currently RRC lite does not used the returned value anyway. - } else if (task_id == TASK_END_MARKER){ - - LOG_I(GTPU,"gtpv_data_req task_id = TASK_END_MARKER\n"); - - message_buffer = itti_malloc (TASK_GTPV1_U, TASK_END_MARKER, sdu_sizeP); - - memcpy (message_buffer, buffer_pP, sdu_sizeP); - - message_p = itti_alloc_new_message (TASK_GTPV1_U, 0, GTPV1U_ENB_END_MARKER_IND); - GTPV1U_ENB_END_MARKER_IND (message_p).frame = ctxt_pP->frame; - GTPV1U_ENB_END_MARKER_IND (message_p).enb_flag = ctxt_pP->enb_flag; - GTPV1U_ENB_END_MARKER_IND (message_p).rb_id = rb_idP; - GTPV1U_ENB_END_MARKER_IND (message_p).muip = muiP; - GTPV1U_ENB_END_MARKER_IND (message_p).confirmp = confirmP; - GTPV1U_ENB_END_MARKER_IND (message_p).sdu_size = sdu_sizeP; - GTPV1U_ENB_END_MARKER_IND (message_p).sdu_p = message_buffer; - GTPV1U_ENB_END_MARKER_IND (message_p).mode = modeP; - GTPV1U_ENB_END_MARKER_IND (message_p).module_id = ctxt_pP->module_id; - GTPV1U_ENB_END_MARKER_IND(message_p).rnti = ctxt_pP->rntiMaybeUEid; - GTPV1U_ENB_END_MARKER_IND (message_p).eNB_index = ctxt_pP->eNB_index; - - itti_send_msg_to_task (TASK_END_MARKER, ctxt_pP->instance, message_p); - return true; // TODO should be changed to a CNF message later, currently RRC lite does not used the returned value anyway. - } - LOG_E(RRC, "Impossible state\n"); - return false; -} - -bool gtpv_data_req_new(protocol_ctxt_t *ctxt, - const srb_flag_t srb_flagP, - const rb_id_t rb_idP, - const mui_t muiP, - const confirm_t confirmP, - const sdu_size_t sdu_buffer_sizeP, - unsigned char *const sdu_buffer_pP, - const pdcp_transmission_mode_t modeP, - const uint32_t *sourceL2Id, - const uint32_t *destinationL2Id) { - int task; - - if (sdu_buffer_sizeP==0) - task=TASK_END_MARKER; - else - task=TASK_DATA_FORWARDING; - - struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ctxt->module_id], ctxt->rntiMaybeUEid); - if(ue_context_p == NULL || ue_context_p->ue_context.handover_info == NULL || - ue_context_p->ue_context.StatusRrc != RRC_HO_EXECUTION) { - LOG_E(RRC,"incoming GTP-U for X2 in non HO context\n"); - return false; - } - - /* in the source enb, UE in RRC_HO_EXECUTION mode */ - // We have 2*2=4 cases (data or end marker) * (from slave, from EPC) - if (ue_context_p->ue_context.handover_info->state == HO_COMPLETE) { - LOG_I(GTPU, "source receive END MARKER\n"); - /* set handover state */ - //ue_context_p->ue_context.handover_info->state = HO_END_MARKER; - MessageDef *msg; - // Configure end marker - msg = itti_alloc_new_message(TASK_GTPV1_U, 0, GTPV1U_ENB_END_MARKER_REQ); - GTPV1U_ENB_END_MARKER_REQ(msg).buffer = itti_malloc(TASK_GTPV1_U, TASK_GTPV1_U, GTPU_HEADER_OVERHEAD_MAX + sdu_buffer_sizeP); - memcpy(>PV1U_ENB_END_MARKER_REQ(msg).buffer[GTPU_HEADER_OVERHEAD_MAX], sdu_buffer_pP, sdu_buffer_sizeP); - GTPV1U_ENB_END_MARKER_REQ(msg).length = sdu_buffer_sizeP; - GTPV1U_ENB_END_MARKER_REQ(msg).rnti = ctxt->rntiMaybeUEid; - GTPV1U_ENB_END_MARKER_REQ(msg).rab_id = rb_idP; - GTPV1U_ENB_END_MARKER_REQ(msg).offset = GTPU_HEADER_OVERHEAD_MAX; - LOG_I(GTPU, "Send End Marker to GTPV1-U at frame %d and subframe %d \n", ctxt->frame,ctxt->subframe); - itti_send_msg_to_task(TASK_GTPV1_U, ENB_MODULE_ID_TO_INSTANCE(ctxt->module_id), msg); - return 0; - } - - /* target enb */ - // We have 2*2=4 cases (data or end marker) * (from source, from EPC) - if (ue_context_p->ue_context.StatusRrc == RRC_RECONFIGURED) { - // It should come from remote eNB - // case end marker by EPC is not possible ? - if (task==TASK_END_MARKER) { - LOG_I(GTPU, "target end receive END MARKER\n"); - // We close the HO, nothing to send to remote ? - ue_context_p->ue_context.handover_info->state = HO_END_MARKER; - gtpv1u_enb_delete_tunnel_req_t delete_tunnel_req; - memset(&delete_tunnel_req, 0, sizeof(delete_tunnel_req)); - delete_tunnel_req.rnti = ctxt->rntiMaybeUEid; - gtpv1u_delete_x2u_tunnel(ctxt->module_id, &delete_tunnel_req); - return true; - } else { - /* data packet */ - LOG_I(GTPU, "Received a message data forwarding length %d\n", sdu_buffer_sizeP); - // Is it from remote ENB - // We have to push it to the UE ? - if(ue_context_p->ue_context.handover_info->state != HO_COMPLETE) { - int result = pdcp_data_req( - ctxt, - srb_flagP, - rb_idP, - muiP, // mui - confirmP, // confirm - sdu_buffer_sizeP, - sdu_buffer_pP, - modeP, - sourceL2Id, - destinationL2Id - ); - ue_context_p->ue_context.handover_info->forwarding_state = FORWARDING_NO_EMPTY; - return result; - } else { /* It is from from epc message */ - /* in the source enb, UE in RRC_HO_EXECUTION mode */ - // ????? - return true; - } - } - } - LOG_E(RRC,"This function should return before the end\n"); - return false; -} - - void rrc_eNB_send_GTPV1U_ENB_DELETE_TUNNEL_REQ( module_id_t enb_mod_idP, rrc_eNB_ue_context_t* ue_context_pP diff --git a/openair2/RRC/LTE/rrc_eNB_GTPV1U.h b/openair2/RRC/LTE/rrc_eNB_GTPV1U.h index 7d1ff07e10..f23f575e9b 100644 --- a/openair2/RRC/LTE/rrc_eNB_GTPV1U.h +++ b/openair2/RRC/LTE/rrc_eNB_GTPV1U.h @@ -54,13 +54,4 @@ void rrc_eNB_send_GTPV1U_ENB_DELETE_TUNNEL_REQ( rrc_eNB_ue_context_t* ue_context_pP ); -bool gtpv_data_req(const protocol_ctxt_t* const ctxt_pP, - const rb_id_t rb_idP, - const mui_t muiP, - const confirm_t confirmP, - const sdu_size_t sdu_sizeP, - uint8_t* const buffer_pP, - const pdcp_transmission_mode_t modeP, - uint32_t task_id); - #endif /* RRC_ENB_GTPV1U_H_ */ From 9a248b441109ba44c1b3d1ebea502f0ea53f74f6 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 12 Feb 2026 06:14:35 +0100 Subject: [PATCH 03/37] Move rrc_eNB_GTPV1U.c from GTP to LTE RRC module in cmake --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bae1c590bc..ccc5e55d43 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1136,6 +1136,7 @@ set(L2_SRC ${RRC_DIR}/rrc_eNB_M2AP.c ${RRC_DIR}/rrc_eNB_UE_context.c ${NR_RRC_DIR}/rrc_gNB_UE_context.c + ${RRC_DIR}/rrc_eNB_GTPV1U.c ${RRC_DIR}/rrc_common.c ${RRC_DIR}/L2_interface.c ${RRC_DIR}/L2_interface_common.c @@ -1382,7 +1383,6 @@ include_directories("${OPENAIR1_DIR}/SCHED_NR_UE") ########################## add_library (GTPV1U - ${RRC_DIR}/rrc_eNB_GTPV1U.c ${OPENAIR3_DIR}/ocp-gtpu/gtp_itf.cpp ${OPENAIR3_DIR}/ocp-gtpu/gtpu_extensions.c ) From 11c27915270bc154280496ea693a6f76c7497bc3 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 12 Feb 2026 06:14:49 +0100 Subject: [PATCH 04/37] Remove 5G code from LTE RRC --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ccc5e55d43..7dee45a453 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1135,7 +1135,6 @@ set(L2_SRC ${RRC_DIR}/rrc_eNB_S1AP.c ${RRC_DIR}/rrc_eNB_M2AP.c ${RRC_DIR}/rrc_eNB_UE_context.c - ${NR_RRC_DIR}/rrc_gNB_UE_context.c ${RRC_DIR}/rrc_eNB_GTPV1U.c ${RRC_DIR}/rrc_common.c ${RRC_DIR}/L2_interface.c From be4461ccca3b9c8868839c8de72850f5f52954bd Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 12 Feb 2026 06:19:19 +0100 Subject: [PATCH 05/37] Move GTPV1U cmake code to subdirectory Move the module cmake code to its subdirectory for better organization, and remove superfluous include_directories() that are not recommended to be used (as it populates all other targets with those directories, most of which don't need it anyway). Slightly clean up the module by removing headers to unused dependencies. The GTP module has a dependency to 4G and 5G RLC, which should not exist (the RLC modules have a dependency on GTP, not the other way around), but in this commit, make as little modifications as possible. --- CMakeLists.txt | 9 --------- openair2/E1AP/CMakeLists.txt | 2 +- openair3/CMakeLists.txt | 1 + openair3/ocp-gtpu/CMakeLists.txt | 4 ++++ openair3/ocp-gtpu/gtp_itf.cpp | 14 +++++++------- 5 files changed, 13 insertions(+), 17 deletions(-) create mode 100644 openair3/ocp-gtpu/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 7dee45a453..ad70a1b53e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -595,7 +595,6 @@ include_directories("${OPENAIR3_DIR}/S1AP") include_directories("${OPENAIR2_DIR}/X2AP") include_directories("${OPENAIR2_DIR}/M2AP") include_directories("${OPENAIR2_DIR}/F1AP") -include_directories("${OPENAIR3_DIR}/ocp-gtpu") include_directories("${OPENAIR3_DIR}/M3AP") include_directories("${OPENAIR3_DIR}/MME_APP") include_directories("${OPENAIR_DIR}/radio/COMMON") @@ -1381,14 +1380,6 @@ include_directories("${OPENAIR1_DIR}/SCHED_NR_UE") # CN libs ########################## -add_library (GTPV1U - ${OPENAIR3_DIR}/ocp-gtpu/gtp_itf.cpp - ${OPENAIR3_DIR}/ocp-gtpu/gtpu_extensions.c - ) -target_link_libraries(GTPV1U PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs) -target_link_libraries(GTPV1U PRIVATE SIMU ds) -include_directories(${OPENAIR3_DIR}/ocp-gtp) - set (MME_APP_SRC ${OPENAIR3_DIR}/MME_APP/mme_app.c ${OPENAIR3_DIR}/MME_APP/mme_config.c diff --git a/openair2/E1AP/CMakeLists.txt b/openair2/E1AP/CMakeLists.txt index eb3bd0f546..39b768ffc3 100644 --- a/openair2/E1AP/CMakeLists.txt +++ b/openair2/E1AP/CMakeLists.txt @@ -4,7 +4,7 @@ add_subdirectory(lib) add_library(e1ap e1ap.c e1ap_common.c) target_link_libraries(e1ap PUBLIC asn1_e1ap e1ap_lib - PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs asn1_f1ap UTIL e1_if) + PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs asn1_f1ap UTIL e1_if GTPV1U) target_include_directories(e1ap PUBLIC ${CMAKE_CURRENT_DIR}) if(ENABLE_TESTS) diff --git a/openair3/CMakeLists.txt b/openair3/CMakeLists.txt index 55f9fe91d6..706d343f56 100644 --- a/openair3/CMakeLists.txt +++ b/openair3/CMakeLists.txt @@ -1,4 +1,5 @@ add_subdirectory(LPP) +add_subdirectory(ocp-gtpu) add_subdirectory(M3AP) add_subdirectory(S1AP) add_subdirectory(NAS) diff --git a/openair3/ocp-gtpu/CMakeLists.txt b/openair3/ocp-gtpu/CMakeLists.txt new file mode 100644 index 0000000000..bcb76e98c9 --- /dev/null +++ b/openair3/ocp-gtpu/CMakeLists.txt @@ -0,0 +1,4 @@ +add_library (GTPV1U gtp_itf.cpp gtpu_extensions.c) +target_link_libraries(GTPV1U PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs) # for ITTI +target_link_libraries(GTPV1U PRIVATE SIMU ds) +target_include_directories(GTPV1U PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index 6650439e81..9509c5a8a4 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -15,15 +15,15 @@ extern "C" { #include #include "common/utils/LOG/log.h" #include -#include -#include -#include -#include -#include -#include "openair2/SDAP/nr_sdap/nr_sdap.h" -#include "openair3/ocp-gtpu/gtpu_extensions.h" #include "sim.h" +// TODO these dependencies should not exist and be removed +#include "openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h" +#include "openair2/LAYER2/RLC/rlc.h" + +#include "gtp_itf.h" +#include "gtpu_extensions.h" + #pragma pack(1) typedef struct Gtpv1uMsgHeader { From 37cb8543199ee7cb171adc9e6e44d314a693c443 Mon Sep 17 00:00:00 2001 From: Maxime Date: Thu, 12 Feb 2026 10:00:42 -0500 Subject: [PATCH 06/37] Fix crash on double reestablishment: guard reconfigCellGroup overwrite --- .../LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) 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 7229b98fd0..29c6694152 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c +++ b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c @@ -663,8 +663,12 @@ static NR_CellGroupConfig_t *get_cellgroup_config(NR_UE_info_t *UE) static void update_cellgroup_for_reestablishment(NR_UE_info_t *UE, NR_CellGroupConfig_t *new_CellGroup) { DevAssert(new_CellGroup); - DevAssert(new_CellGroup->spCellConfig); DevAssert(UE->reestablish_rlc); + if (!new_CellGroup->spCellConfig) { + LOG_E(NR_MAC, "UE %04x: CellGroupConfig has no spCellConfig during reestablishment " + "(possible double reestablishment race), skipping reestablishRLC update\n", UE->rnti); + return; + } LOG_I(NR_MAC, "UE %04x: Re-establishment detected, setting reestablishRLC flags\n", UE->rnti); struct NR_CellGroupConfig__rlc_BearerToAddModList *addmod = new_CellGroup->rlc_BearerToAddModList; if (addmod && addmod->list.count > 0) { @@ -1079,6 +1083,10 @@ void dl_rrc_message_transfer(const f1ap_dl_rrc_message_t *dl_rrc) ASN_STRUCT_FREE(asn_DEF_NR_CellGroupConfig, UE->CellGroup); UE->CellGroup = oldUE->CellGroup; oldUE->CellGroup = NULL; + ASN_STRUCT_FREE(asn_DEF_NR_CellGroupConfig, UE->reconfigCellGroup); + UE->reconfigCellGroup = oldUE->reconfigCellGroup; + oldUE->reconfigCellGroup = NULL; + UE->reestablish_rlc = oldUE->reestablish_rlc; ASN_STRUCT_FREE(asn_DEF_NR_UE_NR_Capability, UE->capability); UE->capability = oldUE->capability; oldUE->capability = NULL; @@ -1095,10 +1103,18 @@ void dl_rrc_message_transfer(const f1ap_dl_rrc_message_t *dl_rrc) } /* Per TS 38.331 5.3.7.2: the UE releases the spCellConfig, so we drop it * from the current configuration. It will be reapplied when the - * reconfiguration has succeeded (indicated by the CU) */ - asn_copy(&asn_DEF_NR_CellGroupConfig, (void **)&UE->reconfigCellGroup, UE->CellGroup); - ASN_STRUCT_FREE(asn_DEF_NR_SpCellConfig, UE->CellGroup->spCellConfig); - UE->CellGroup->spCellConfig = NULL; + * reconfiguration has succeeded (indicated by the CU). + * Guard against double reestablishment: if reestablish_rlc is already set, + * reconfigCellGroup was saved by the first reestablishment and + * CellGroup.spCellConfig is already NULL — don't overwrite. */ + if (!UE->reestablish_rlc) { + asn_copy(&asn_DEF_NR_CellGroupConfig, (void **)&UE->reconfigCellGroup, UE->CellGroup); + ASN_STRUCT_FREE(asn_DEF_NR_SpCellConfig, UE->CellGroup->spCellConfig); + UE->CellGroup->spCellConfig = NULL; + } else { + LOG_W(NR_MAC, "UE %04x: reestablishment while previous reestablishment still pending, " + "keeping saved reconfigCellGroup with spCellConfig\n", UE->rnti); + } UE->reestablish_rlc = true; /* Per TS 38.331 clause 5.3.7.4: apply gNB RLC configuration for SRB1 to match the UE RLC configuration defined in 9.2.1. * Use configuration file values for timers t_poll_retransmit, t_reassembly and t_status_prohibit */ From b6171949cde4da321cc8593234451a11ab2b04ff Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Thu, 4 Dec 2025 14:14:16 +0100 Subject: [PATCH 07/37] only cleaning: remove dead code, make static functions, simplify code --- .../PHY/LTE_ESTIMATION/lte_ue_measurements.c | 5 +- .../PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c | 840 +++++++++--------- .../linear_preprocessing_rec.c | 349 +------- .../linear_preprocessing_rec.h | 109 --- openair1/PHY/LTE_UE_TRANSPORT/pmch_ue.c | 43 - .../PHY/LTE_UE_TRANSPORT/transport_proto_ue.h | 292 ------ .../NR_UE_TRANSPORT/nr_dlsch_demodulation.c | 24 - openair1/SCHED_UE/phy_procedures_lte_ue.c | 19 +- 8 files changed, 478 insertions(+), 1203 deletions(-) diff --git a/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c b/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c index 3dc55ef1f6..86af5fb81c 100644 --- a/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c +++ b/openair1/PHY/LTE_ESTIMATION/lte_ue_measurements.c @@ -549,10 +549,7 @@ void construct_HhH_elements(int *ch0conj_ch0, //00_00 } } - -void squared_matrix_element(int32_t *Hh_h_00, - int32_t *Hh_h_00_sq, - unsigned short nb_rb) +static void squared_matrix_element(int32_t *Hh_h_00, int32_t *Hh_h_00_sq, unsigned short nb_rb) { simde__m128i *Hh_h_00_128,*Hh_h_00_sq_128; diff --git a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c index 9aa520c585..aff8a60e06 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c @@ -41,8 +41,6 @@ #include #include #include -#include -#include #include "linear_preprocessing_rec.h" //#define DEBUG_MMSE @@ -53,36 +51,283 @@ * default value: 0 */ int16_t dlsch_demod_shift = 0; -int16_t interf_unaw_shift = 13; +static const int16_t interf_unaw_shift = 13; unsigned char offset_mumimo_llr_drange_fix=0; -//inferference-free case -unsigned char interf_unaw_shift_tm4_mcs[29]= {5, 3, 4, 3, 3, 2, 1, 1, 2, 0, 1, 1, 1, 1, 0, 0, - 1, 1, 1, 1, 0, 2, 1, 0, 1, 0, 1, 0, 0 - } ; -unsigned char interf_unaw_shift_tm1_mcs[29]= {5, 5, 4, 3, 3, 3, 2, 2, 4, 4, 2, 3, 3, 3, 1, 1, - 0, 1, 1, 2, 5, 4, 4, 6, 5, 1, 0, 5, 6 - } ; // mcs 21, 26, 28 seem to be errorneous +// inferference-free case -/* -//original values from sebastion + same hand tuning -unsigned char offset_mumimo_llr_drange[29][3]={{8,8,8},{7,7,7},{7,7,7},{7,7,7},{6,6,6},{6,6,6},{6,6,6},{5,5,5},{4,4,4},{1,2,4}, // QPSK -{5,5,4},{5,5,5},{5,5,5},{3,3,3},{2,2,2},{2,2,2},{2,2,2}, // 16-QAM -{2,2,1},{3,3,3},{3,3,3},{3,3,1},{2,2,2},{2,2,2},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}}; //64-QAM +static const unsigned char offset_mumimo_llr_drange[29][3] = { + {0, 6, 5}, {0, 4, 5}, {0, 4, 5}, {0, 5, 4}, {0, 5, 6}, {0, 5, 3}, {0, 4, 4}, {0, 4, 4}, {0, 3, 3}, {0, 1, 2}, + {1, 1, 0}, {1, 3, 2}, {3, 4, 1}, {2, 0, 0}, {2, 2, 2}, {1, 1, 1}, {2, 1, 0}, {2, 1, 1}, {1, 0, 1}, {1, 0, 1}, + {0, 0, 0}, {1, 0, 0}, {0, 0, 0}, {0, 1, 0}, {1, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}; + +static void mmse_processing_oai(LTE_UE_PDSCH *pdsch_vars, + LTE_DL_FRAME_PARMS *frame_parms, + PHY_MEASUREMENTS *measurements, + unsigned char first_symbol_flag, + MIMO_mode_t mimo_mode, + unsigned short mmse_flag, + int noise_power, + unsigned char symbol, + unsigned short nb_rb); + +static void precode_channel_est(int32_t **dl_ch_estimates_ext, + LTE_DL_FRAME_PARMS *frame_parms, + LTE_UE_PDSCH *pdsch_vars, + unsigned char symbol, + unsigned short nb_rb, + MIMO_mode_t mimo_mode); + +static void rxdataF_to_float(int32_t **rxdataF_ext, float complex **rxdataF_f, int n_rx, int length, int start_point); +static void chan_est_to_float(int32_t **dl_ch_estimates_ext, + float complex **dl_ch_estimates_ext_f, + int n_tx, + int n_rx, + int length, + int start_point); + +static void float_to_chan_est(int32_t **dl_ch_estimates_ext, + float complex **dl_ch_estimates_ext_f, + int n_tx, + int n_rx, + int length, + int start_point); + +static void float_to_rxdataF(int32_t **rxdataF_ext, float complex **rxdataF_f, int n_tx, int n_rx, int length, int start_point); + +static void mult_mmse_rxdataF(float complex **Wmmse, + float complex **rxdataF_ext_f, + int n_tx, + int n_rx, + int length, + int start_point); + +static void mult_mmse_chan_est(float complex **Wmmse, + float complex **dl_ch_estimates_ext_f, + int n_tx, + int n_rx, + int length, + int start_point); + +static void mmse_processing_core(int32_t **rxdataF_ext, + int32_t **dl_ch_estimates_ext, + int sigma2, + int n_tx, + int n_rx, + int length, + int start_point); + +static void dlsch_channel_compensation_TM34(LTE_DL_FRAME_PARMS *frame_parms, + LTE_UE_PDSCH *lte_ue_pdsch_vars, + PHY_MEASUREMENTS *phy_measurements, + int eNB_id, + unsigned char symbol, + unsigned char mod_order0, + unsigned char mod_order1, + int harq_pid, + int round, + MIMO_mode_t mimo_mode, + unsigned short nb_rb, + unsigned short mmse_flag, + unsigned char output_shift0, + unsigned char output_shift1); + +static void dlsch_channel_compensation_TM56(int **rxdataF_ext, + int **dl_ch_estimates_ext, + int **dl_ch_mag, + int **dl_ch_magb, + int **rxdataF_comp, + unsigned char *pmi_ext, + LTE_DL_FRAME_PARMS *frame_parms, + PHY_MEASUREMENTS *measurements, + int eNB_id, + unsigned char symbol, + unsigned char mod_order, + unsigned short nb_rb, + unsigned char output_shift, + unsigned char dl_power_off); + +static void dlsch_dual_stream_correlation(LTE_DL_FRAME_PARMS *frame_parms, + unsigned char symbol, + unsigned short nb_rb, + int **dl_ch_estimates_ext, + int **dl_ch_estimates_ext_i, + int **dl_ch_rho_ext, + unsigned char output_shift); + +/** \fn dlsch_extract_rbs_single(int32_t **rxdataF, + int32_t **dl_ch_estimates, + int32_t **rxdataF_ext, + int32_t **dl_ch_estimates_ext, + uint16_t pmi, + uint8_t *pmi_ext, + uint32_t *rb_alloc, + uint8_t symbol, + uint8_t subframe, + LTE_DL_FRAME_PARMS *frame_parms) + \brief This function extracts the received resource blocks, both channel estimates and data symbols, + for the current allocation and for single antenna eNB transmission. + @param rxdataF Raw FFT output of received signal + @param dl_ch_estimates Channel estimates of current slot + @param rxdataF_ext FFT output for RBs in this allocation + @param dl_ch_estimates_ext Channel estimates for RBs in this allocation + @param pmi subband Precoding matrix indicator + @param pmi_ext Extracted PMI for chosen RBs + @param rb_alloc RB allocation vector + @param symbol Symbol to extract + @param subframe Subframe number + @param vrb_type Flag to indicate distributed VRB type + @param high_speed_flag + @param frame_parms Pointer to frame descriptor */ -/* -//first optimization try -unsigned char offset_mumimo_llr_drange[29][3]={{7, 8, 7},{6, 6, 7},{6, 6, 7},{6, 6, 6},{5, 6, 6},{5, 5, 6},{5, 5, 6},{4, 5, 4},{4, 3, 4},{3, 2, 2},{6, 5, 5},{5, 4, 4},{5, 5, 4},{3, 3, 2},{2, 2, 1},{2, 1, 1},{2, 2, 2},{3, 3, 3},{3, 3, 2},{3, 3, 2},{3, 2, 1},{2, 2, 2},{2, 2, 2},{0, 0, 0},{0, 0, 0},{0, 0, 0},{0, 0, 0},{0, 0, 0}}; +static uint16_t dlsch_extract_rbs_single(int32_t **rxdataF, + int32_t **dl_ch_estimates, + int32_t **rxdataF_ext, + int32_t **dl_ch_estimates_ext, + uint16_t pmi, + uint8_t *pmi_ext, + uint32_t *rb_alloc, + uint8_t symbol, + uint8_t subframe, + uint32_t high_speed_flag, + LTE_DL_FRAME_PARMS *frame_parms); + +/** \fn dlsch_alamouti(LTE_DL_FRAME_PARMS *frame_parms, + int32_t **rxdataF_comp, + int32_t **dl_ch_mag, + int32_t **dl_ch_magb, + uint8_t symbol, + uint16_t nb_rb) + \brief This function does Alamouti combining on RX and prepares LLR inputs by skipping pilots, PBCH and primary/secondary + synchronization signals. + @param frame_parms Frame descriptor structure + @param rxdataF_comp Compensated channel output + @param dl_ch_mag First squared-magnitude of channel (16QAM and 64QAM) for LLR computation. Alamouti combining should be + performed on this as well. Result is stored in first antenna position + @param dl_ch_magb Second squared-magnitude of channel (64QAM only) for LLR computation. Alamouti combining should be performed + on this as well. Result is stored in first antenna position + @param symbol Symbol in sub-frame + @param nb_rb Number of RBs in this allocation */ -//second optimization try -/* - unsigned char offset_mumimo_llr_drange[29][3]={{5, 8, 7},{4, 6, 8},{3, 6, 7},{7, 7, 6},{4, 7, 8},{4, 7, 4},{6, 6, 6},{3, 6, 6},{3, 6, 6},{1, 3, 4},{1, 1, 0},{3, 3, 2},{3, 4, 1},{4, 0, 1},{4, 2, 2},{3, 1, 2},{2, 1, 0},{2, 1, 1},{1, 0, 1},{1, 0, 1},{0, 0, 0},{1, 0, 0},{0, 0, 0},{0, 1, 0},{1, 0, 0},{0, 0, 0},{0, 0, 0},{0, 0, 0},{0, 0, 0}}; w +static void dlsch_alamouti(LTE_DL_FRAME_PARMS *frame_parms, + int32_t **rxdataF_comp, + int32_t **dl_ch_mag, + int32_t **dl_ch_magb, + uint8_t symbol, + uint16_t nb_rb); + +/** \fn dlsch_detection_mrc(LTE_DL_FRAME_PARMS *frame_parms, + int32_t **rxdataF_comp, + int32_t **rxdataF_comp_i, + int32_t **rho, + int32_t **rho_i, + int32_t **dl_ch_mag, + int32_t **dl_ch_magb, + uint8_t symbol, + uint16_t nb_rb, + uint8_t dual_stream_UE) + + \brief This function does maximal-ratio combining for dual-antenna receivers. + @param frame_parms Frame descriptor structure + @param rxdataF_comp Compensated channel output + @param rxdataF_comp_i Compensated channel output for interference + @param rho Cross correlation between spatial channels + @param rho_i Cross correlation between signal and inteference channels + @param dl_ch_mag First squared-magnitude of channel (16QAM and 64QAM) for LLR computation. Alamouti combining should be + performed on this as well. Result is stored in first antenna position + @param dl_ch_magb Second squared-magnitude of channel (64QAM only) for LLR computation. Alamouti combining should be performed + on this as well. Result is stored in first antenna position + @param symbol Symbol in sub-frame + @param nb_rb Number of RBs in this allocation + @param dual_stream_UE Flag to indicate dual-stream detection */ -unsigned char offset_mumimo_llr_drange[29][3]= {{0, 6, 5},{0, 4, 5},{0, 4, 5},{0, 5, 4},{0, 5, 6},{0, 5, 3},{0, 4, 4},{0, 4, 4},{0, 3, 3},{0, 1, 2},{1, 1, 0},{1, 3, 2},{3, 4, 1},{2, 0, 0},{2, 2, 2},{1, 1, 1},{2, 1, 0},{2, 1, 1},{1, 0, 1},{1, 0, 1},{0, 0, 0},{1, 0, 0},{0, 0, 0},{0, 1, 0},{1, 0, 0},{0, 0, 0},{0, 0, 0},{0, 0, 0},{0, 0, 0}}; +static void dlsch_detection_mrc(LTE_DL_FRAME_PARMS *frame_parms, + int32_t **rxdataF_comp, + int32_t **rxdataF_comp_i, + int32_t **rho, + int32_t **rho_i, + int32_t **dl_ch_mag, + int32_t **dl_ch_magb, + int32_t **dl_ch_mag_i, + int32_t **dl_ch_magb_i, + uint8_t symbol, + uint16_t nb_rb, + uint8_t dual_stream_UE); +static void dlsch_detection_mrc_TM34(LTE_DL_FRAME_PARMS *frame_parms, + LTE_UE_PDSCH *lte_ue_pdsch_vars, + int harq_pid, + int round, + unsigned char symbol, + unsigned short nb_rb, + unsigned char dual_stream_UE); -extern void print_shorts(char *s,int16_t *x); +/** \fn dlsch_extract_rbs_dual(int32_t **rxdataF, + int32_t **dl_ch_estimates, + int32_t **rxdataF_ext, + int32_t **dl_ch_estimates_ext, + uint16_t pmi, + uint8_t *pmi_ext, + uint32_t *rb_alloc, + uint8_t symbol, + LTE_DL_FRAME_PARMS *frame_parms) + \brief This function extracts the received resource blocks, both channel estimates and data symbols, + for the current allocation and for dual antenna eNB transmission. + @param rxdataF Raw FFT output of received signal + @param dl_ch_estimates Channel estimates of current slot + @param rxdataF_ext FFT output for RBs in this allocation + @param dl_ch_estimates_ext Channel estimates for RBs in this allocation + @param pmi subband Precoding matrix indicator + @param pmi_ext Extracted PMI for chosen RBs + @param rb_alloc RB allocation vector + @param symbol Symbol to extract + @param subframe Subframe index + @param high_speed_flag + @param frame_parms Pointer to frame descriptor +*/ +static uint16_t dlsch_extract_rbs_dual(int32_t **rxdataF, + int32_t **dl_ch_estimates, + int32_t **rxdataF_ext, + int32_t **dl_ch_estimates_ext, + uint16_t pmi, + uint8_t *pmi_ext, + uint32_t *rb_alloc, + uint8_t symbol, + uint8_t subframe, + uint32_t high_speed_flag, + LTE_DL_FRAME_PARMS *frame_parms, + MIMO_mode_t mimo_mode); +/** \fn dlsch_extract_rbs_TM7(int32_t **rxdataF, + int32_t **dl_bf_ch_estimates, + int32_t **rxdataF_ext, + int32_t **dl_bf_ch_estimates_ext, + uint32_t *rb_alloc, + uint8_t symbol, + uint8_t subframe, + uint32_t high_speed_flag, + LTE_DL_FRAME_PARMS *frame_parms) + \brief This function extracts the received resource blocks, both channel estimates and data symbols, + for the current allocation and for single antenna eNB transmission. + @param rxdataF Raw FFT output of received signal + @param dl_bf_ch_estimates Beamforming channel estimates of current slot + @param rxdataF_ext FFT output for RBs in this allocation + @param dl_bf_ch_estimates_ext Beamforming channel estimates for RBs in this allocation + @param rb_alloc RB allocation vector + @param symbol Symbol to extract + @param subframe Subframe number + @param high_speed_flag + @param frame_parms Pointer to frame descriptor +*/ +static uint16_t dlsch_extract_rbs_TM7(int32_t **rxdataF, + int32_t **dl_bf_ch_estimates, + int32_t **rxdataF_ext, + int32_t **dl_bf_ch_estimates_ext, + uint32_t *rb_alloc, + uint8_t symbol, + uint8_t subframe, + uint32_t high_speed_flag, + LTE_DL_FRAME_PARMS *frame_parms); int rx_pdsch(PHY_VARS_UE *ue, PDSCH_t type, @@ -790,17 +1035,9 @@ int rx_pdsch(PHY_VARS_UE *ue, } // printf("Combining"); - if ((dlsch0_harq->mimo_mode == SISO) || - ((dlsch0_harq->mimo_mode >= UNIFORM_PRECODING11) && - (dlsch0_harq->mimo_mode <= PUSCH_PRECODING0)) || - (dlsch0_harq->mimo_mode == TM7)) { - /* - dlsch_siso(frame_parms, - pdsch_vars[eNB_id]->rxdataF_comp, - pdsch_vars[eNB_id_i]->rxdataF_comp, - symbol, - nb_rb); - */ + if ((dlsch0_harq->mimo_mode == SISO) + || ((dlsch0_harq->mimo_mode >= UNIFORM_PRECODING11) && (dlsch0_harq->mimo_mode <= PUSCH_PRECODING0)) + || (dlsch0_harq->mimo_mode == TM7)) { } else if (dlsch0_harq->mimo_mode == ALAMOUTI) { dlsch_alamouti(frame_parms, pdsch_vars[eNB_id]->rxdataF_comp0, @@ -1381,116 +1618,8 @@ void dlsch_channel_compensation(int **rxdataF_ext, } -void dlsch_channel_compensation_core(int **rxdataF_ext, - int **dl_ch_estimates_ext, - int **dl_ch_mag, - int **dl_ch_magb, - int **rxdataF_comp, - int **rho, - unsigned char n_tx, - unsigned char n_rx, - unsigned char mod_order, - unsigned char output_shift, - int length, - int start_point) - +static void prec2A_TM56_128(unsigned char pmi, simde__m128i *ch0, simde__m128i *ch1) { - unsigned short ii; - int length_mod8 = 0; - simde__m128i *dl_ch128,*dl_ch_mag128,*dl_ch_mag128b, *dl_ch128_2, *rxdataF128,*rxdataF_comp128,*rho128; - simde__m128i QAM_amp128={0}; - int aatx = 0, aarx = 0; - - for (aatx=0; aatx 1 ? n_rx : 2; - dl_ch128 = (simde__m128i *)&dl_ch_estimates_ext[aatx*x + aarx][start_point]; - dl_ch_mag128 = (simde__m128i *)&dl_ch_mag[aatx*x + aarx][start_point]; - dl_ch_mag128b = (simde__m128i *)&dl_ch_magb[aatx*x + aarx][start_point]; - rxdataF128 = (simde__m128i *)&rxdataF_ext[aarx][start_point]; - rxdataF_comp128 = (simde__m128i *)&rxdataF_comp[aatx*x + aarx][start_point]; - length_mod8 = length&7; - - if (length_mod8 == 0) { - for (ii=0; ii>3; ++ii) { - if (mod_order>2) { - simde__m128i mmtmpD0, mmtmpD1; - // get channel amplitude if not QPSK - mmtmpD0 = oai_mm_smadd(dl_ch128[0], dl_ch128[0], output_shift); - mmtmpD1 = oai_mm_smadd(dl_ch128[1], dl_ch128[1], output_shift); - mmtmpD0 = simde_mm_packs_epi32(mmtmpD0, mmtmpD1); - // store channel magnitude here in a new field of dlsch - dl_ch_mag128[0] = simde_mm_unpacklo_epi16(mmtmpD0, mmtmpD0); - dl_ch_mag128b[0] = dl_ch_mag128[0]; - dl_ch_mag128[0] = simde_mm_mulhi_epi16(dl_ch_mag128[0], QAM_amp128); - dl_ch_mag128[0] = simde_mm_slli_epi16(dl_ch_mag128[0], 1); - dl_ch_mag128[1] = simde_mm_unpackhi_epi16(mmtmpD0, mmtmpD0); - dl_ch_mag128b[1] = dl_ch_mag128[1]; - dl_ch_mag128[1] = simde_mm_mulhi_epi16(dl_ch_mag128[1], QAM_amp128); - dl_ch_mag128[1] = simde_mm_slli_epi16(dl_ch_mag128[1], 1); - dl_ch_mag128b[0] = simde_mm_mulhi_epi16(dl_ch_mag128b[0], QAM_amp128b); - dl_ch_mag128b[0] = simde_mm_slli_epi16(dl_ch_mag128b[0], 1); - dl_ch_mag128b[1] = simde_mm_mulhi_epi16(dl_ch_mag128b[1], QAM_amp128b); - dl_ch_mag128b[1] = simde_mm_slli_epi16(dl_ch_mag128b[1], 1); - } - - // multiply by conjugated channel - rxdataF_comp128[0] = oai_mm_cpx_mult_conj(dl_ch128[0], rxdataF128[0], output_shift); - rxdataF_comp128[1] = oai_mm_cpx_mult_conj(dl_ch128[1], rxdataF128[1], output_shift); - dl_ch128+=2; - dl_ch_mag128+=2; - dl_ch_mag128b+=2; - rxdataF128+=2; - rxdataF_comp128+=2; - } - } else { - printf ("Channel Compensation: Received number of subcarriers is not multiple of 8, \n" - "need to adapt the code!\n"); - } - } - } - - /*This part of code makes sense only for processing in 2x2 blocks*/ - if (rho) { - for (aarx=0; aarx>3; ++ii) { - // multiply by conjugated channel - rho128[0] = oai_mm_cpx_mult_conj(dl_ch128[0], dl_ch128_2[0], output_shift); - rho128[1] = oai_mm_cpx_mult_conj(dl_ch128[1], dl_ch128_2[1], output_shift); - dl_ch128+=2; - dl_ch128_2+=2; - rho128+=2; - } - } else { - printf ("Channel Compensation: Received number of subcarriers is not multiple of 8, \n" - "need to adapt the code!\n"); - } - } - } - -} - - -void prec2A_TM56_128(unsigned char pmi,simde__m128i *ch0,simde__m128i *ch1) { simde__m128i amp; amp = simde_mm_set1_epi16(ONE_OVER_SQRT2_Q15); @@ -1526,7 +1655,7 @@ void prec2A_TM56_128(unsigned char pmi,simde__m128i *ch0,simde__m128i *ch1) { // stream 1 .5(1,-1) .5(1,1) .5(1,-1) .5(1,1) // store "precoded" channel for stream 0 in ch0, stream 1 in ch1 -short TM3_prec[8]__attribute__((aligned(16))) = {1,1,-1,-1,1,1,-1,-1} ; +static const short TM3_prec[8] __attribute__((aligned(16))) = {1, 1, -1, -1, 1, 1, -1, -1}; void prec2A_TM3_128(simde__m128i *ch0,simde__m128i *ch1) { simde__m128i amp = simde_mm_set1_epi16(ONE_OVER_SQRT2_Q15); @@ -1558,7 +1687,8 @@ void prec2A_TM3_128(simde__m128i *ch0,simde__m128i *ch1) { // pmi = 0 => stream 0 (1,1), stream 1 (1,-1) // pmi = 1 => stream 0 (1,j), stream 2 (1,-j) -void prec2A_TM4_128(int pmi,simde__m128i *ch0,simde__m128i *ch1) { +static void prec2A_TM4_128(int pmi, simde__m128i *ch0, simde__m128i *ch1) +{ // sqrt(2) is already taken into account in computation sqrt_rho_a, sqrt_rho_b, //so divide by 2 is replaced by divide by sqrt(2). // printf ("demod pmi=%d\n", pmi); @@ -1595,20 +1725,21 @@ void prec2A_TM4_128(int pmi,simde__m128i *ch0,simde__m128i *ch1) { //print_shorts("prec2A_TM4 ch1 (end):",ch1); } -void dlsch_channel_compensation_TM56(int **rxdataF_ext, - int **dl_ch_estimates_ext, - int **dl_ch_mag, - int **dl_ch_magb, - int **rxdataF_comp, - unsigned char *pmi_ext, - LTE_DL_FRAME_PARMS *frame_parms, - PHY_MEASUREMENTS *measurements, - int eNB_id, - unsigned char symbol, - unsigned char mod_order, - unsigned short nb_rb, - unsigned char output_shift, - unsigned char dl_power_off) { +static void dlsch_channel_compensation_TM56(int **rxdataF_ext, + int **dl_ch_estimates_ext, + int **dl_ch_mag, + int **dl_ch_magb, + int **rxdataF_comp, + unsigned char *pmi_ext, + LTE_DL_FRAME_PARMS *frame_parms, + PHY_MEASUREMENTS *measurements, + int eNB_id, + unsigned char symbol, + unsigned char mod_order, + unsigned short nb_rb, + unsigned char output_shift, + unsigned char dl_power_off) +{ unsigned short rb,Nre; simde__m128i *dl_ch0_128,*dl_ch1_128,*dl_ch_mag128,*dl_ch_mag128b,*rxdataF128,*rxdataF_comp128; unsigned char aarx=0,symbol_mod,pilots=0; @@ -1719,17 +1850,17 @@ void dlsch_channel_compensation_TM56(int **rxdataF_ext, } // rx_antennas measurements->precoded_cqi_dB[eNB_id][0] = dB_fixed2(precoded_signal_strength,measurements->n0_power_tot); - //printf("eNB_id %d, symbol %d: precoded CQI %d dB\n",eNB_id,symbol, - // measurements->precoded_cqi_dB[eNB_id][0]); - + // printf("eNB_id %d, symbol %d: precoded CQI %d dB\n",eNB_id,symbol, + // measurements->precoded_cqi_dB[eNB_id][0]); } -void precode_channel_est(int32_t **dl_ch_estimates_ext, - LTE_DL_FRAME_PARMS *frame_parms, - LTE_UE_PDSCH *pdsch_vars, - unsigned char symbol, - unsigned short nb_rb, - MIMO_mode_t mimo_mode) { +static void precode_channel_est(int32_t **dl_ch_estimates_ext, + LTE_DL_FRAME_PARMS *frame_parms, + LTE_UE_PDSCH *pdsch_vars, + unsigned char symbol, + unsigned short nb_rb, + MIMO_mode_t mimo_mode) +{ unsigned short rb; simde__m128i *dl_ch0_128,*dl_ch1_128; unsigned char aarx=0,symbol_mod,pilots=0; @@ -1788,20 +1919,21 @@ void precode_channel_est(int32_t **dl_ch_estimates_ext, } } -void dlsch_channel_compensation_TM34(LTE_DL_FRAME_PARMS *frame_parms, - LTE_UE_PDSCH *pdsch_vars, - PHY_MEASUREMENTS *measurements, - int eNB_id, - unsigned char symbol, - unsigned char mod_order0, - unsigned char mod_order1, - int harq_pid, - int round, - MIMO_mode_t mimo_mode, - unsigned short nb_rb, - unsigned short mmse_flag, - unsigned char output_shift0, - unsigned char output_shift1) { +static void dlsch_channel_compensation_TM34(LTE_DL_FRAME_PARMS *frame_parms, + LTE_UE_PDSCH *pdsch_vars, + PHY_MEASUREMENTS *measurements, + int eNB_id, + unsigned char symbol, + unsigned char mod_order0, + unsigned char mod_order1, + int harq_pid, + int round, + MIMO_mode_t mimo_mode, + unsigned short nb_rb, + unsigned short mmse_flag, + unsigned char output_shift0, + unsigned char output_shift1) +{ unsigned short rb,Nre; simde__m128i *dl_ch0_128,*dl_ch1_128,*dl_ch_mag0_128,*dl_ch_mag1_128,*dl_ch_mag0_128b,*dl_ch_mag1_128b,*rxdataF128,*rxdataF_comp0_128,*rxdataF_comp1_128; unsigned char aarx=0,symbol_mod,pilots=0; @@ -2017,7 +2149,6 @@ void dlsch_channel_compensation_TM34(LTE_DL_FRAME_PARMS *frame_parms, // measurements->precoded_cqi_dB[eNB_id][0]); } - void dlsch_dual_stream_correlation(LTE_DL_FRAME_PARMS *frame_parms, unsigned char symbol, unsigned short nb_rb, @@ -2068,19 +2199,19 @@ void dlsch_dual_stream_correlation(LTE_DL_FRAME_PARMS *frame_parms, } - -void dlsch_detection_mrc(LTE_DL_FRAME_PARMS *frame_parms, - int **rxdataF_comp, - int **rxdataF_comp_i, - int **rho, - int **rho_i, - int **dl_ch_mag, - int **dl_ch_magb, - int **dl_ch_mag_i, - int **dl_ch_magb_i, - unsigned char symbol, - unsigned short nb_rb, - unsigned char dual_stream_UE) { +static void dlsch_detection_mrc(LTE_DL_FRAME_PARMS *frame_parms, + int **rxdataF_comp, + int **rxdataF_comp_i, + int **rho, + int **rho_i, + int **dl_ch_mag, + int **dl_ch_magb, + int **dl_ch_mag_i, + int **dl_ch_magb_i, + unsigned char symbol, + unsigned short nb_rb, + unsigned char dual_stream_UE) +{ unsigned char aatx; int i; simde__m128i *rxdataF_comp128_0,*rxdataF_comp128_1,*rxdataF_comp128_i0,*rxdataF_comp128_i1,*dl_ch_mag128_0,*dl_ch_mag128_1,*dl_ch_mag128_0b,*dl_ch_mag128_1b,*rho128_0,*rho128_1,*rho128_i0,*rho128_i1, @@ -2136,16 +2267,16 @@ void dlsch_detection_mrc(LTE_DL_FRAME_PARMS *frame_parms, } } } - } -void dlsch_detection_mrc_TM34(LTE_DL_FRAME_PARMS *frame_parms, - LTE_UE_PDSCH *pdsch_vars, - int harq_pid, - int round, - unsigned char symbol, - unsigned short nb_rb, - unsigned char dual_stream_UE) { +static void dlsch_detection_mrc_TM34(LTE_DL_FRAME_PARMS *frame_parms, + LTE_UE_PDSCH *pdsch_vars, + int harq_pid, + int round, + unsigned char symbol, + unsigned short nb_rb, + unsigned char dual_stream_UE) +{ int i; simde__m128i *rxdataF_comp128_0,*rxdataF_comp128_1; simde__m128i *dl_ch_mag128_0,*dl_ch_mag128_1; @@ -2259,7 +2390,6 @@ void dlsch_detection_mrc_TM34(LTE_DL_FRAME_PARMS *frame_parms, } } } - } void dlsch_scale_channel(int **dl_ch_estimates_ext, @@ -2462,15 +2592,16 @@ void dlsch_channel_level_median(int **dl_ch_estimates_ext, } -void mmse_processing_oai(LTE_UE_PDSCH *pdsch_vars, - LTE_DL_FRAME_PARMS *frame_parms, - PHY_MEASUREMENTS *measurements, - unsigned char first_symbol_flag, - MIMO_mode_t mimo_mode, - unsigned short mmse_flag, - int noise_power, - unsigned char symbol, - unsigned short nb_rb) { +static void mmse_processing_oai(LTE_UE_PDSCH *pdsch_vars, + LTE_DL_FRAME_PARMS *frame_parms, + PHY_MEASUREMENTS *measurements, + unsigned char first_symbol_flag, + MIMO_mode_t mimo_mode, + unsigned short mmse_flag, + int noise_power, + unsigned char symbol, + unsigned short nb_rb) +{ int **rxdataF_ext = pdsch_vars->rxdataF_ext; int **dl_ch_estimates_ext = pdsch_vars->dl_ch_estimates_ext; unsigned char *pmi_ext = pdsch_vars->pmi_ext; @@ -2617,107 +2748,6 @@ void mmse_processing_core(int32_t **rxdataF_ext, free(rxdataF_ext_flcpx); } - -/*THIS FUNCTION TAKES FLOAT_POINT INPUT. SHOULD NOT BE USED WITH OAI*/ -void mmse_processing_core_flp(float complex **rxdataF_ext_flcpx, - float complex **H, - int32_t **rxdataF_ext, - int32_t **dl_ch_estimates_ext, - float noise_power, - int n_tx, - int n_rx, - int length, - int start_point) { - int aatx, aarx, re; - float max = 0; - float one_over_max = 0; - float complex **W_MMSE= malloc(n_tx*n_rx*sizeof(float complex *)); - - for (int j=0; j max) - max = fabs(creal(W_MMSE_re[aatx*n_rx + aarx])); - - if (fabs(cimag(W_MMSE_re[aatx*n_rx + aarx])) > max) - max = fabs(cimag(W_MMSE_re[aatx*n_rx + aarx])); - } - } - } - - one_over_max = 1.0/max; - - for (re=0; re> 16); - real = (int16_t) (rxdataF_ext[aarx][start_point + re] & 0xffff); +static void rxdataF_to_float(int32_t **rxdataF_ext, float complex **rxdataF_f, int n_rx, int length, int start_point) +{ + for (int aarx = 0; aarx < n_rx; aarx++) { + for (int re = 0; re < length; re++) { + int16_t imag = (int16_t)(rxdataF_ext[aarx][start_point + re] >> 16); + int16_t real = (int16_t)(rxdataF_ext[aarx][start_point + re] & 0xffff); rxdataF_f[aarx][re] = (float)(real/(32768.0)) + I*(float)(imag/(32768.0)); #ifdef DEBUG_MMSE @@ -2820,24 +2842,18 @@ void rxdataF_to_float(int32_t **rxdataF_ext, } } - - -void chan_est_to_float(int32_t **dl_ch_estimates_ext, - float complex **dl_ch_estimates_ext_f, - int n_tx, - int n_rx, - int length, - int start_point) { - short re; - int aatx,aarx; - int16_t imag; - int16_t real; - - for (aatx=0; aatx> 16); - real = (int16_t) (dl_ch_estimates_ext[aatx*n_rx + aarx][start_point+ re] & 0xffff); +static void chan_est_to_float(int32_t **dl_ch_estimates_ext, + float complex **dl_ch_estimates_ext_f, + int n_tx, + int n_rx, + int length, + int start_point) +{ + for (int aatx = 0; aatx < n_tx; aatx++) { + for (int aarx = 0; aarx < n_rx; aarx++) { + for (int re = 0; re < length; re++) { + int16_t imag = (int16_t)(dl_ch_estimates_ext[aatx * n_rx + aarx][start_point + re] >> 16); + int16_t real = (int16_t)(dl_ch_estimates_ext[aatx * n_rx + aarx][start_point + re] & 0xffff); dl_ch_estimates_ext_f[aatx*n_rx + aarx][re] = (float)(real/(32768.0)) + I*(float)(imag/(32768.0)); #ifdef DEBUG_MMSE @@ -2857,15 +2873,12 @@ void float_to_chan_est(int32_t **dl_ch_estimates_ext, int n_tx, int n_rx, int length, - int start_point) { - short re; - int aarx, aatx; - int16_t imag; - int16_t real; - - for (aatx=0; aatx=1) @@ -2895,20 +2908,11 @@ void float_to_chan_est(int32_t **dl_ch_estimates_ext, } } - -void float_to_rxdataF(int32_t **rxdataF_ext, - float complex **rxdataF_f, - int n_tx, - int n_rx, - int length, - int start_point) { - short re; - int aarx; - int16_t imag; - int16_t real; - - for (aarx=0; aarx=1) @@ -2937,7 +2941,6 @@ void float_to_rxdataF(int32_t **rxdataF_ext, } } - void mult_mmse_rxdataF(float complex **Wmmse, float complex **rxdataF_ext_f, int n_tx, @@ -2946,9 +2949,9 @@ void mult_mmse_rxdataF(float complex **Wmmse, int start_point) { short re; int aarx, aatx; - float complex *rxdata_re = malloc(n_rx*sizeof(float complex)); - float complex *rxdata_mmse_re = malloc(n_rx*sizeof(float complex)); - float complex *Wmmse_re = malloc(n_tx*n_rx*sizeof(float complex)); + float complex rxdata_re[n_rx]; + float complex rxdata_mmse_re[n_rx]; + float complex Wmmse_re[n_tx][n_rx]; for (re=0; renb_antennas_rx); } -unsigned short dlsch_extract_rbs_dual(int **rxdataF, - int **dl_ch_estimates, - int **rxdataF_ext, - int **dl_ch_estimates_ext, - unsigned short pmi, - unsigned char *pmi_ext, - unsigned int *rb_alloc, - unsigned char symbol, - unsigned char subframe, - uint32_t high_speed_flag, - LTE_DL_FRAME_PARMS *frame_parms, - MIMO_mode_t mimo_mode) { +static unsigned short dlsch_extract_rbs_dual(int **rxdataF, + int **dl_ch_estimates, + int **rxdataF_ext, + int **dl_ch_estimates_ext, + unsigned short pmi, + unsigned char *pmi_ext, + unsigned int *rb_alloc, + unsigned char symbol, + unsigned char subframe, + uint32_t high_speed_flag, + LTE_DL_FRAME_PARMS *frame_parms, + MIMO_mode_t mimo_mode) +{ int prb,nb_rb=0; int prb_off,prb_off2; int rb_alloc_ind,skip_half=0,sss_symb,pss_symb=0,nsymb,l; @@ -4369,15 +4370,16 @@ unsigned short dlsch_extract_rbs_dual(int **rxdataF, return(nb_rb/frame_parms->nb_antennas_rx); } -unsigned short dlsch_extract_rbs_TM7(int **rxdataF, - int **dl_bf_ch_estimates, - int **rxdataF_ext, - int **dl_bf_ch_estimates_ext, - unsigned int *rb_alloc, - unsigned char symbol, - unsigned char subframe, - uint32_t high_speed_flag, - LTE_DL_FRAME_PARMS *frame_parms) { +static unsigned short dlsch_extract_rbs_TM7(int **rxdataF, + int **dl_bf_ch_estimates, + int **rxdataF_ext, + int **dl_bf_ch_estimates_ext, + unsigned int *rb_alloc, + unsigned char symbol, + unsigned char subframe, + uint32_t high_speed_flag, + LTE_DL_FRAME_PARMS *frame_parms) +{ unsigned short rb,nb_rb=0; unsigned char rb_alloc_ind; unsigned char i,aarx,l,nsymb,skip_half=0,sss_symb,pss_symb=0; diff --git a/openair1/PHY/LTE_UE_TRANSPORT/linear_preprocessing_rec.c b/openair1/PHY/LTE_UE_TRANSPORT/linear_preprocessing_rec.c index 86a4b93ddd..c1c1672088 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/linear_preprocessing_rec.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/linear_preprocessing_rec.c @@ -20,253 +20,80 @@ data storage. */ //#define DEBUG_PREPROC #include "common/utils/utils.h" -void transpose (int N, float complex *A, float complex *Result) -{ - // COnputes C := alpha*op(A)*op(B) + beta*C, - CBLAS_TRANSPOSE transa = CblasTrans; - CBLAS_TRANSPOSE transb = CblasNoTrans; - int rows_opA = N; // number of rows in op(A) and in C - int col_opB = N; //number of columns of op(B) and in C - int col_opA = N; //number of columns in op(A) and rows in op(B) - int col_B; //number of columns in B - float complex alpha = 1.0+I*0; - int lda = rows_opA; - float complex beta = 0.0+I*0; - int ldc = rows_opA; - int i; - float complex* B; - - int ldb = col_opB; - - if (transb == CblasNoTrans) { - B = calloc_or_fail(ldb * col_opB, sizeof(float complex)); - col_B= col_opB; - } - else { - B = calloc_or_fail(ldb * col_opA, sizeof(float complex)); - col_B = col_opA; - } - float complex* C = malloc_or_fail(ldc * col_opB * sizeof(float complex)); - - for (i=0; i>2)*sizeof(float complex)); - float complex *H1_re = malloc_or_fail(n_rx*(n_tx>>2)*sizeof(float complex)); - float complex *R_corr_col_n_0_re = malloc_or_fail(n_rx*n_tx*sizeof(float complex)); - float complex *R_corr_col_n_1_re = malloc_or_fail(n_rx*n_tx*sizeof(float complex)); - float complex *U_0_re = malloc_or_fail(n_rx*n_tx*sizeof(float complex)); - float complex *U_1_re = malloc_or_fail(n_rx*n_tx*sizeof(float complex)); - float complex *U_0_herm_re = malloc_or_fail(n_rx*n_tx*sizeof(float complex)); - float complex *U_1_herm_re = malloc_or_fail(n_rx*n_tx*sizeof(float complex)); - float complex *D_0_re = malloc_or_fail(n_rx*n_tx*sizeof(float complex)); - float complex *D_1_re = malloc_or_fail(n_rx*n_tx*sizeof(float complex)); - float complex *W_Wh_0_re = malloc_or_fail(n_rx*n_tx*sizeof(float complex)); - float complex *W_Wh_1_re = malloc_or_fail(n_rx*n_tx*sizeof(float complex)); - - for (aatx=0; aatx>2), H1_re, sigma2, R_corr_col_n_0_re); - HH_herm_plus_sigma2I(n_rx, (n_tx>>2), H0_re, sigma2, R_corr_col_n_1_re); - - eigen_vectors_values(n_rx, R_corr_col_n_0_re, U_0_re, D_0_re); - eigen_vectors_values(n_rx, R_corr_col_n_1_re, U_1_re, D_1_re); - - transpose (n_rx, U_0_re, U_0_herm_re); - transpose (n_rx, U_1_re, U_1_herm_re); - - sigma = (float)(sqrt((double)(sigma2))); - - /*The inverse of a diagonal matrix is obtained by replacing each element in the diagonal with its reciprocal. - A square root of a diagonal matrix is given by the diagonal matrix, whose diagonal entries are just the square - roots of the original matrix.*/ - - - D_0_re_inv_sqrt[0] = sqrt_float(1/D_0_re_inv[0]); - D_0_re_inv_sqrt[5] = sqrt_float(1/D_0_re_inv[5]); - D_0_re_inv_sqrt[10] = sqrt_float(1/D_0_re_inv[10]); - D_0_re_inv_sqrt[15] = sqrt_float(1/D_0_re_inv[15]); - - D_1_re_inv[0] = sqrt_float(1/D_1_re_inv[0]); - D_1_re_inv[5] = sqrt_float(1/D_1_re_inv[5]); - D_1_re_inv[10] = sqrt_float(1/D_1_re_inv[10]); - D_1_re_inv[15] = sqrt_float(1/D_1_re_inv[15]); - - now only to multiply - - free(H0); - free(H1); - free(R_corr_col_n_0); - free(R_corr_col_n_1); -} -#endif - -float sqrt_float(float x, float sqrt_x) -{ - sqrt_x = (float)(sqrt((double)(x))); - return sqrt_x; } diff --git a/openair1/PHY/LTE_UE_TRANSPORT/linear_preprocessing_rec.h b/openair1/PHY/LTE_UE_TRANSPORT/linear_preprocessing_rec.h index f38bc47556..a8b955acfd 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/linear_preprocessing_rec.h +++ b/openair1/PHY/LTE_UE_TRANSPORT/linear_preprocessing_rec.h @@ -5,117 +5,8 @@ #include #include "PHY/defs_UE.h" - /* FUNCTIONS FOR LINEAR PREPROCESSING: MMSE, WHITENNING, etc*/ -void transpose(int N, float complex *A, float complex *Result); - -void conjugate_transpose(int N, float complex *A, float complex *Result); - -void H_hermH_plus_sigma2I(int N, int M, float complex *A, float sigma2, float complex *Result); - -void HH_herm_plus_sigma2I(int M, int N, float complex *A, float sigma2, float complex *Result); - -void eigen_vectors_values(int N, float complex *A, float complex *Vectors, float *Values_Matrix); - -void lin_eq_solver(int N, float complex *A, float complex* B); -//float complex* lin_eq_solver (int N, float complex* A, float complex* B); - -/* mutl_matrix_matrix_row_based performs multiplications when matrix is row-oriented H[0], H[1]; H[2], H[3]*/ -void mutl_matrix_matrix_row_based(float complex* M0, float complex* M1, int rows_M0, int col_M0, int rows_M1, int col_M1, float complex* Result ); - /* mutl_matrix_matrix_col_based performs multiplications matrix is column-oriented H[0], H[2]; H[1], H[3]*/ void mutl_matrix_matrix_col_based(float complex* M0, float complex* M1, int rows_M0, int col_M0, int rows_M1, int col_M1, float complex* Result ); void compute_MMSE(float complex* H, int order_H, float sigma2, float complex* W_MMSE); - -void compute_white_filter(float complex* H, int order_H, float sigma2, float complex* U_1, float complex* D_1); - -void mmse_processing_oai(LTE_UE_PDSCH *pdsch_vars, - LTE_DL_FRAME_PARMS *frame_parms, - PHY_MEASUREMENTS *measurements, - unsigned char first_symbol_flag, - MIMO_mode_t mimo_mode, - unsigned short mmse_flag, - int noise_power, - unsigned char symbol, - unsigned short nb_rb); - - -void precode_channel_est(int32_t **dl_ch_estimates_ext, - LTE_DL_FRAME_PARMS *frame_parms, - LTE_UE_PDSCH *pdsch_vars, - unsigned char symbol, - unsigned short nb_rb, - MIMO_mode_t mimo_mode); - - -void rxdataF_to_float(int32_t **rxdataF_ext, - float complex **rxdataF_f, - int n_rx, - int length, - int start_point); - -void chan_est_to_float(int32_t **dl_ch_estimates_ext, - float complex **dl_ch_estimates_ext_f, - int n_tx, - int n_rx, - int length, - int start_point); - -void float_to_chan_est(int32_t **dl_ch_estimates_ext, - float complex **dl_ch_estimates_ext_f, - int n_tx, - int n_rx, - int length, - int start_point); - -void float_to_rxdataF(int32_t **rxdataF_ext, - float complex **rxdataF_f, - int n_tx, - int n_rx, - int length, - int start_point); - -void mult_mmse_rxdataF(float complex** Wmmse, - float complex** rxdataF_ext_f, - int n_tx, - int n_rx, - int length, - int start_point); - -void mult_mmse_chan_est(float complex** Wmmse, - float complex** dl_ch_estimates_ext_f, - int n_tx, - int n_rx, - int length, - int start_point); - -void mmse_processing_core(int32_t **rxdataF_ext, - int32_t **dl_ch_estimates_ext, - int sigma2, - int n_tx, - int n_rx, - int length, - int start_point); - -void mmse_processing_core_flp(float complex** rxdataF_ext_flcpx, - float complex **H, - int32_t **rxdataF_ext, - int32_t **dl_ch_estimates_ext, - float sigma2, - int n_tx, - int n_rx, - int length, - int start_point); - -void whitening_processing_core_flp(float complex** rxdataF_ext_flcpx, - float complex **H, - int32_t **rxdataF_ext, - int32_t **dl_ch_estimates_ext, - float sigma2, - int n_tx, - int n_rx, - int length, - int start_point); - -float sqrt_float(float x, float sqrt_x); diff --git a/openair1/PHY/LTE_UE_TRANSPORT/pmch_ue.c b/openair1/PHY/LTE_UE_TRANSPORT/pmch_ue.c index 81ddb264ff..14616c4259 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/pmch_ue.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/pmch_ue.c @@ -50,49 +50,6 @@ #define MBSFN_FDD_SF7 0x08 #define MBSFN_FDD_SF8 0x04 - - -void dump_mch(PHY_VARS_UE *ue,uint8_t eNB_id,uint16_t coded_bits_per_codeword,int subframe) { - char fname[32],vname[32]; -#define NSYMB_PMCH 12 - sprintf(fname,"mch_rxF_ext0.m"); - sprintf(vname,"pmch_rxF_ext0"); - LOG_M(fname,vname,ue->pdsch_vars_MCH[ue->current_thread_id[subframe]][eNB_id]->rxdataF_ext[0],12*(ue->frame_parms.N_RB_DL)*12,1,1); - sprintf(fname,"mch_ch_ext00.m"); - sprintf(vname,"pmch_ch_ext00"); - LOG_M(fname,vname,ue->pdsch_vars_MCH[ue->current_thread_id[subframe]][eNB_id]->dl_ch_estimates_ext[0],12*(ue->frame_parms.N_RB_DL)*NSYMB_PMCH,1,1); - /* - LOG_M("dlsch%d_ch_ext01.m","dl01_ch0_ext",pdsch_vars[eNB_id]->dl_ch_estimates_ext[1],12*N_RB_DL*NSYMB_PMCH,1,1); - LOG_M("dlsch%d_ch_ext10.m","dl10_ch0_ext",pdsch_vars[eNB_id]->dl_ch_estimates_ext[2],12*N_RB_DL*NSYMB_PMCH,1,1); - LOG_M("dlsch%d_ch_ext11.m","dl11_ch0_ext",pdsch_vars[eNB_id]->dl_ch_estimates_ext[3],12*N_RB_DL*NSYMB_PMCH,1,1); - LOG_M("dlsch%d_rho.m","dl_rho",pdsch_vars[eNB_id]->rho[0],12*N_RB_DL*NSYMB_PMCH,1,1); - */ - sprintf(fname,"mch_rxF_comp0.m"); - sprintf(vname,"pmch_rxF_comp0"); - LOG_M(fname,vname,ue->pdsch_vars_MCH[ue->current_thread_id[subframe]][eNB_id]->rxdataF_comp0[0],12*(ue->frame_parms.N_RB_DL)*NSYMB_PMCH,1,1); - sprintf(fname,"mch_rxF_llr.m"); - sprintf(vname,"pmch_llr"); - LOG_M(fname,vname, ue->pdsch_vars_MCH[ue->current_thread_id[subframe]][eNB_id]->llr[0],coded_bits_per_codeword,1,0); - sprintf(fname,"mch_mag1.m"); - sprintf(vname,"pmch_mag1"); - LOG_M(fname,vname,ue->pdsch_vars_MCH[ue->current_thread_id[subframe]][eNB_id]->dl_ch_mag0[0],12*(ue->frame_parms.N_RB_DL)*NSYMB_PMCH,1,1); - sprintf(fname,"mch_mag2.m"); - sprintf(vname,"pmch_mag2"); - LOG_M(fname,vname,ue->pdsch_vars_MCH[ue->current_thread_id[subframe]][eNB_id]->dl_ch_magb0[0],12*(ue->frame_parms.N_RB_DL)*NSYMB_PMCH,1,1); - LOG_M("mch00_ch0.m","pmch00_ch0", - &(ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id][0][0]), - ue->frame_parms.ofdm_symbol_size*12,1,1); - LOG_M("rxsig_mch.m","rxs_mch", - &ue->common_vars.rxdata[0][subframe*ue->frame_parms.samples_per_tti], - ue->frame_parms.samples_per_tti,1,1); - /* - if (PHY_vars_eNB_g) - LOG_M("txsig_mch.m","txs_mch", - &PHY_vars_eNB_g[0][0]->common_vars.txdata[0][0][subframe*ue->frame_parms.samples_per_tti], - ue->frame_parms.samples_per_tti,1,1);*/ -} - - void fill_UE_dlsch_MCH(PHY_VARS_UE *ue,int mcs,int ndi,int rvidx,int eNB_id) { LTE_UE_DLSCH_t *dlsch = ue->dlsch_MCH[eNB_id]; LTE_DL_FRAME_PARMS *frame_parms=&ue->frame_parms; diff --git a/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h b/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h index 06bf87fc74..8cf4020d2e 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h +++ b/openair1/PHY/LTE_UE_TRANSPORT/transport_proto_ue.h @@ -78,17 +78,6 @@ int rx_pmch_khz_1dot25(PHY_VARS_UE *ue, unsigned char symbol*/ ,int mcs); -/** \brief Dump OCTAVE/MATLAB files for PMCH debugging - @param phy_vars_ue Pointer to UE variables - @param eNB_id index of eNB in ue variables - @param coded_bits_per_codeword G from 36.211 - @param subframe Index of subframe - @returns 0 on success -*/ -void dump_mch(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint16_t coded_bits_per_codeword,int subframe); - - - /** \brief This function computes the LLRs for ML (max-logsum approximation) dual-stream QPSK/QPSK reception. @param stream0_in Input from channel compensated (MR combined) stream 0 @param stream1_in Input from channel compensated (MR combined) stream 1 @@ -580,216 +569,6 @@ void dlsch_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms, uint32_t llr_offset, uint8_t beamforming_mode); - -/** \fn dlsch_siso(LTE_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int32_t **rxdataF_comp_i, - uint8_t l, - uint16_t nb_rb) - \brief This function does the first stage of llr computation for SISO, by just extracting the pilots, PBCH and primary/secondary synchronization sequences. - @param frame_parms Frame descriptor structure - @param rxdataF_comp Compensated channel output - @param rxdataF_comp_i Compensated channel output for interference - @param l symbol in sub-frame - @param nb_rb Number of RBs in this allocation -*/ - -void dlsch_siso(LTE_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int32_t **rxdataF_comp_i, - uint8_t l, - uint16_t nb_rb); - -/** \fn dlsch_alamouti(LTE_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int32_t **dl_ch_mag, - int32_t **dl_ch_magb, - uint8_t symbol, - uint16_t nb_rb) - \brief This function does Alamouti combining on RX and prepares LLR inputs by skipping pilots, PBCH and primary/secondary synchronization signals. - @param frame_parms Frame descriptor structure - @param rxdataF_comp Compensated channel output - @param dl_ch_mag First squared-magnitude of channel (16QAM and 64QAM) for LLR computation. Alamouti combining should be performed on this as well. Result is stored in first antenna position - @param dl_ch_magb Second squared-magnitude of channel (64QAM only) for LLR computation. Alamouti combining should be performed on this as well. Result is stored in first antenna position - @param symbol Symbol in sub-frame - @param nb_rb Number of RBs in this allocation -*/ -void dlsch_alamouti(LTE_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int32_t **dl_ch_mag, - int32_t **dl_ch_magb, - uint8_t symbol, - uint16_t nb_rb); - -/** \fn dlsch_antcyc(LTE_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int32_t **dl_ch_mag, - int32_t **dl_ch_magb, - uint8_t symbol, - uint16_t nb_rb) - \brief This function does antenna selection (based on antenna cycling pattern) on RX and prepares LLR inputs by skipping pilots, PBCH and primary/secondary synchronization signals. Note that this is not LTE, it is just included for comparison purposes. - @param frame_parms Frame descriptor structure - @param rxdataF_comp Compensated channel output - @param dl_ch_mag First squared-magnitude of channel (16QAM and 64QAM) for LLR computation. Alamouti combining should be performed on this as well. Result is stored in first antenna position - @param dl_ch_magb Second squared-magnitude of channel (64QAM only) for LLR computation. Alamouti combining should be performed on this as well. Result is stored in first antenna position - @param symbol Symbol in sub-frame - @param nb_rb Number of RBs in this allocation -*/ -void dlsch_antcyc(LTE_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int32_t **dl_ch_mag, - int32_t **dl_ch_magb, - uint8_t symbol, - uint16_t nb_rb); - -/** \fn dlsch_detection_mrc(LTE_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int32_t **rxdataF_comp_i, - int32_t **rho, - int32_t **rho_i, - int32_t **dl_ch_mag, - int32_t **dl_ch_magb, - uint8_t symbol, - uint16_t nb_rb, - uint8_t dual_stream_UE) - - \brief This function does maximal-ratio combining for dual-antenna receivers. - @param frame_parms Frame descriptor structure - @param rxdataF_comp Compensated channel output - @param rxdataF_comp_i Compensated channel output for interference - @param rho Cross correlation between spatial channels - @param rho_i Cross correlation between signal and inteference channels - @param dl_ch_mag First squared-magnitude of channel (16QAM and 64QAM) for LLR computation. Alamouti combining should be performed on this as well. Result is stored in first antenna position - @param dl_ch_magb Second squared-magnitude of channel (64QAM only) for LLR computation. Alamouti combining should be performed on this as well. Result is stored in first antenna position - @param symbol Symbol in sub-frame - @param nb_rb Number of RBs in this allocation - @param dual_stream_UE Flag to indicate dual-stream detection -*/ -void dlsch_detection_mrc(LTE_DL_FRAME_PARMS *frame_parms, - int32_t **rxdataF_comp, - int32_t **rxdataF_comp_i, - int32_t **rho, - int32_t **rho_i, - int32_t **dl_ch_mag, - int32_t **dl_ch_magb, - int32_t **dl_ch_mag_i, - int32_t **dl_ch_magb_i, - uint8_t symbol, - uint16_t nb_rb, - uint8_t dual_stream_UE); - -void dlsch_detection_mrc_TM34(LTE_DL_FRAME_PARMS *frame_parms, - LTE_UE_PDSCH *lte_ue_pdsch_vars, - int harq_pid, - int round, - unsigned char symbol, - unsigned short nb_rb, - unsigned char dual_stream_UE); - -/** \fn dlsch_extract_rbs_single(int32_t **rxdataF, - int32_t **dl_ch_estimates, - int32_t **rxdataF_ext, - int32_t **dl_ch_estimates_ext, - uint16_t pmi, - uint8_t *pmi_ext, - uint32_t *rb_alloc, - uint8_t symbol, - uint8_t subframe, - LTE_DL_FRAME_PARMS *frame_parms) - \brief This function extracts the received resource blocks, both channel estimates and data symbols, - for the current allocation and for single antenna eNB transmission. - @param rxdataF Raw FFT output of received signal - @param dl_ch_estimates Channel estimates of current slot - @param rxdataF_ext FFT output for RBs in this allocation - @param dl_ch_estimates_ext Channel estimates for RBs in this allocation - @param pmi subband Precoding matrix indicator - @param pmi_ext Extracted PMI for chosen RBs - @param rb_alloc RB allocation vector - @param symbol Symbol to extract - @param subframe Subframe number - @param vrb_type Flag to indicate distributed VRB type - @param high_speed_flag - @param frame_parms Pointer to frame descriptor -*/ -uint16_t dlsch_extract_rbs_single(int32_t **rxdataF, - int32_t **dl_ch_estimates, - int32_t **rxdataF_ext, - int32_t **dl_ch_estimates_ext, - uint16_t pmi, - uint8_t *pmi_ext, - uint32_t *rb_alloc, - uint8_t symbol, - uint8_t subframe, - uint32_t high_speed_flag, - LTE_DL_FRAME_PARMS *frame_parms); - -/** \fn dlsch_extract_rbs_dual(int32_t **rxdataF, - int32_t **dl_ch_estimates, - int32_t **rxdataF_ext, - int32_t **dl_ch_estimates_ext, - uint16_t pmi, - uint8_t *pmi_ext, - uint32_t *rb_alloc, - uint8_t symbol, - LTE_DL_FRAME_PARMS *frame_parms) - \brief This function extracts the received resource blocks, both channel estimates and data symbols, - for the current allocation and for dual antenna eNB transmission. - @param rxdataF Raw FFT output of received signal - @param dl_ch_estimates Channel estimates of current slot - @param rxdataF_ext FFT output for RBs in this allocation - @param dl_ch_estimates_ext Channel estimates for RBs in this allocation - @param pmi subband Precoding matrix indicator - @param pmi_ext Extracted PMI for chosen RBs - @param rb_alloc RB allocation vector - @param symbol Symbol to extract - @param subframe Subframe index - @param high_speed_flag - @param frame_parms Pointer to frame descriptor -*/ -uint16_t dlsch_extract_rbs_dual(int32_t **rxdataF, - int32_t **dl_ch_estimates, - int32_t **rxdataF_ext, - int32_t **dl_ch_estimates_ext, - uint16_t pmi, - uint8_t *pmi_ext, - uint32_t *rb_alloc, - uint8_t symbol, - uint8_t subframe, - uint32_t high_speed_flag, - LTE_DL_FRAME_PARMS *frame_parms, - MIMO_mode_t mimo_mode); - -/** \fn dlsch_extract_rbs_TM7(int32_t **rxdataF, - int32_t **dl_bf_ch_estimates, - int32_t **rxdataF_ext, - int32_t **dl_bf_ch_estimates_ext, - uint32_t *rb_alloc, - uint8_t symbol, - uint8_t subframe, - uint32_t high_speed_flag, - LTE_DL_FRAME_PARMS *frame_parms) - \brief This function extracts the received resource blocks, both channel estimates and data symbols, - for the current allocation and for single antenna eNB transmission. - @param rxdataF Raw FFT output of received signal - @param dl_bf_ch_estimates Beamforming channel estimates of current slot - @param rxdataF_ext FFT output for RBs in this allocation - @param dl_bf_ch_estimates_ext Beamforming channel estimates for RBs in this allocation - @param rb_alloc RB allocation vector - @param symbol Symbol to extract - @param subframe Subframe number - @param high_speed_flag - @param frame_parms Pointer to frame descriptor -*/ -uint16_t dlsch_extract_rbs_TM7(int32_t **rxdataF, - int32_t **dl_bf_ch_estimates, - int32_t **rxdataF_ext, - int32_t **dl_bf_ch_estimates_ext, - uint32_t *rb_alloc, - uint8_t symbol, - uint8_t subframe, - uint32_t high_speed_flag, - LTE_DL_FRAME_PARMS *frame_parms); - /** \brief This function performs channel compensation (matched filtering) on the received RBs for this allocation. In addition, it computes the squared-magnitude of the channel with weightings for 16QAM/64QAM detection as well as dual-stream detection (cross-correlation) @param rxdataF_ext Frequency-domain received signal in RBs to be demodulated @param dl_ch_estimates_ext Frequency-domain channel estimates in RBs to be demodulated @@ -819,35 +598,6 @@ void dlsch_channel_compensation(int32_t **rxdataF_ext, uint8_t output_shift, PHY_MEASUREMENTS *phy_measurements); -void dlsch_channel_compensation_core(int **rxdataF_ext, - int **dl_ch_estimates_ext, - int **dl_ch_mag, - int **dl_ch_magb, - int **rxdataF_comp, - int **rho, - unsigned char n_tx, - unsigned char n_rx, - unsigned char mod_order, - unsigned char output_shift, - int length, - int start_point); - -void dlsch_dual_stream_correlation(LTE_DL_FRAME_PARMS *frame_parms, - unsigned char symbol, - unsigned short nb_rb, - int **dl_ch_estimates_ext, - int **dl_ch_estimates_ext_i, - int **dl_ch_rho_ext, - unsigned char output_shift); - -void dlsch_dual_stream_correlationTM34(LTE_DL_FRAME_PARMS *frame_parms, - unsigned char symbol, - unsigned short nb_rb, - int **dl_ch_estimates_ext, - int **dl_ch_estimates_ext_i, - int **dl_ch_rho_ext, - unsigned char output_shift0, - unsigned char output_shift1); //This function is used to compute multiplications in Hhermitian * H matrix void conjch0_mult_ch1(int *ch0, int *ch1, @@ -869,10 +619,6 @@ void construct_HhH_elements(int *ch0conj_ch0, int32_t *after_mf_11, unsigned short nb_rb); -void squared_matrix_element(int32_t *Hh_h_00, - int32_t *Hh_h_00_sq, - unsigned short nb_rb); - void dlsch_channel_level_TM34_meas(int *ch00, int *ch01, int *ch10, @@ -901,38 +647,6 @@ uint8_t rank_estimation_tm3_tm4(int *dl_ch_estimates_00, int *dl_ch_estimates_11, unsigned short nb_rb); -void dlsch_channel_compensation_TM56(int **rxdataF_ext, - int **dl_ch_estimates_ext, - int **dl_ch_mag, - int **dl_ch_magb, - int **rxdataF_comp, - unsigned char *pmi_ext, - LTE_DL_FRAME_PARMS *frame_parms, - PHY_MEASUREMENTS *phy_measurements, - int eNB_id, - unsigned char symbol, - unsigned char mod_order, - unsigned short nb_rb, - unsigned char output_shift, - unsigned char dl_power_off); - - -void dlsch_channel_compensation_TM34(LTE_DL_FRAME_PARMS *frame_parms, - LTE_UE_PDSCH *lte_ue_pdsch_vars, - PHY_MEASUREMENTS *phy_measurements, - int eNB_id, - unsigned char symbol, - unsigned char mod_order0, - unsigned char mod_order1, - int harq_pid, - int round, - MIMO_mode_t mimo_mode, - unsigned short nb_rb, - unsigned short mmse_flag, - unsigned char output_shift0, - unsigned char output_shift1); - - /** \brief This function computes the average channel level over all allocated RBs and antennas (TX/RX) in order to compute output shift for compensated signal @param dl_ch_estimates_ext Channel estimates in allocated RBs @param frame_parms Pointer to frame descriptor @@ -1669,12 +1383,6 @@ uint8_t is_not_pilot(uint8_t pilots, uint8_t re, uint8_t nushift, uint8_t use2nd uint8_t is_not_UEspecRS(int8_t lprime, uint8_t re, uint8_t nushift, uint8_t Ncp, uint8_t beamforming_mode); -uint32_t dlsch_decoding_abstraction(double *dlsch_MIPB, - LTE_DL_FRAME_PARMS *lte_frame_parms, - LTE_UE_DLSCH_t *dlsch, - uint8_t subframe, - uint8_t num_pdcch_symbols); - // DL power control functions double get_pa_dB(uint8_t pa); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index ab73bedb4f..980a625978 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -50,30 +50,6 @@ //#define DEBUG_DLSCH_DEMOD //#define DEBUG_PDSCH_RX -// [MCS][i_mod (0,1,2) = (2,4,6)] -//unsigned char offset_mumimo_llr_drange_fix=0; -//inferference-free case -/*unsigned char interf_unaw_shift_tm4_mcs[29]={5, 3, 4, 3, 3, 2, 1, 1, 2, 0, 1, 1, 1, 1, 0, 0, - 1, 1, 1, 1, 0, 2, 1, 0, 1, 0, 1, 0, 0} ;*/ - -//unsigned char interf_unaw_shift_tm1_mcs[29]={5, 5, 4, 3, 3, 3, 2, 2, 4, 4, 2, 3, 3, 3, 1, 1, -// 0, 1, 1, 2, 5, 4, 4, 6, 5, 1, 0, 5, 6} ; // mcs 21, 26, 28 seem to be errorneous - -/* -unsigned char offset_mumimo_llr_drange[29][3]={{8,8,8},{7,7,7},{7,7,7},{7,7,7},{6,6,6},{6,6,6},{6,6,6},{5,5,5},{4,4,4},{1,2,4}, // QPSK -{5,5,4},{5,5,5},{5,5,5},{3,3,3},{2,2,2},{2,2,2},{2,2,2}, // 16-QAM -{2,2,1},{3,3,3},{3,3,3},{3,3,1},{2,2,2},{2,2,2},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}}; //64-QAM -*/ - /* - //first optimization try - unsigned char offset_mumimo_llr_drange[29][3]={{7, 8, 7},{6, 6, 7},{6, 6, 7},{6, 6, 6},{5, 6, 6},{5, 5, 6},{5, 5, 6},{4, 5, 4},{4, 3, 4},{3, 2, 2},{6, 5, 5},{5, 4, 4},{5, 5, 4},{3, 3, 2},{2, 2, 1},{2, 1, 1},{2, 2, 2},{3, 3, 3},{3, 3, 2},{3, 3, 2},{3, 2, 1},{2, 2, 2},{2, 2, 2},{0, 0, 0},{0, 0, 0},{0, 0, 0},{0, 0, 0},{0, 0, 0}}; - */ - //second optimization try - /* - unsigned char offset_mumimo_llr_drange[29][3]={{5, 8, 7},{4, 6, 8},{3, 6, 7},{7, 7, 6},{4, 7, 8},{4, 7, 4},{6, 6, 6},{3, 6, 6},{3, 6, 6},{1, 3, 4},{1, 1, 0},{3, 3, 2},{3, 4, 1},{4, 0, 1},{4, 2, 2},{3, 1, 2},{2, 1, 0},{2, 1, 1},{1, 0, 1},{1, 0, 1},{0, 0, 0},{1, 0, 0},{0, 0, 0},{0, 1, 0},{1, 0, 0},{0, 0, 0},{0, 0, 0},{0, 0, 0},{0, 0, 0}}; w - */ -//unsigned char offset_mumimo_llr_drange[29][3]= {{0, 6, 5},{0, 4, 5},{0, 4, 5},{0, 5, 4},{0, 5, 6},{0, 5, 3},{0, 4, 4},{0, 4, 4},{0, 3, 3},{0, 1, 2},{1, 1, 0},{1, 3, 2},{3, 4, 1},{2, 0, 0},{2, 2, 2},{1, 1, 1},{2, 1, 0},{2, 1, 1},{1, 0, 1},{1, 0, 1},{0, 0, 0},{1, 0, 0},{0, 0, 0},{0, 1, 0},{1, 0, 0},{0, 0, 0},{0, 0, 0},{0, 0, 0},{0, 0, 0}}; - #define print_ints(s,x) printf("%s = %d %d %d %d\n",s,(x)[0],(x)[1],(x)[2],(x)[3]) #define print_shorts(s,x) printf("%s = [%d+j*%d, %d+j*%d, %d+j*%d, %d+j*%d]\n",s,(x)[0],(x)[1],(x)[2],(x)[3],(x)[4],(x)[5],(x)[6],(x)[7]) diff --git a/openair1/SCHED_UE/phy_procedures_lte_ue.c b/openair1/SCHED_UE/phy_procedures_lte_ue.c index 8ca02917b0..b91accc6ff 100644 --- a/openair1/SCHED_UE/phy_procedures_lte_ue.c +++ b/openair1/SCHED_UE/phy_procedures_lte_ue.c @@ -2925,19 +2925,16 @@ void ue_pmch_procedures(PHY_VARS_UE *ue, else ue->dlsch_mtch_errors[sync_area][0]++; - LOG_E(PHY,"[UE %d] Frame %d, subframe %d: PMCH in error (%d,%d), not passing to L2 (TBS %d, iter %d,G %d)\n", + LOG_E(PHY, + "[UE %d] Frame %d, subframe %d: PMCH in error (%d,%d), not passing to L2 (TBS %d, iter %d,G %d)\n", ue->Mod_id, - frame_rx,subframe_rx, + frame_rx, + subframe_rx, ue->dlsch_mcch_errors[sync_area][0], ue->dlsch_mtch_errors[sync_area][0], - ue->dlsch_MCH[0]->harq_processes[0]->TBS>>3, + ue->dlsch_MCH[0]->harq_processes[0]->TBS >> 3, ue->dlsch_MCH[0]->max_turbo_iterations, ue->dlsch_MCH[0]->harq_processes[0]->G); - // dump_mch(ue,0,ue->dlsch_MCH[0]->harq_processes[0]->G,subframe_rx); - //if(subframe_rx == 3){ - //dump_mch(ue,0,ue->dlsch_MCH[0]->harq_processes[0]->G,subframe_rx); - //exit_fun("nothing to add"); - //} if (LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) { for (int i=0; idlsch_MCH[0]->harq_processes[0]->TBS>>3; i++) { @@ -2962,11 +2959,9 @@ void ue_pmch_procedures(PHY_VARS_UE *ue, CC_id, frame_rx, ue->dlsch_MCH[0]->harq_processes[0]->b, - ue->dlsch_MCH[0]->harq_processes[0]->TBS>>3, - eNB_id,// not relevant in eMBMS context + ue->dlsch_MCH[0]->harq_processes[0]->TBS >> 3, + eNB_id, // not relevant in eMBMS context sync_area); - //dump_mch(ue,0,ue->dlsch_MCH[0]->harq_processes[0]->G,subframe_rx); - //exit_fun("nothing to add"); if (mcch_active == 1) ue->dlsch_mcch_received[sync_area][0]++; From 345b44d9b3fc85f42e7295b0b004f4c9f025b3d2 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Fri, 26 Dec 2025 17:28:49 +0100 Subject: [PATCH 08/37] re-order the functions to have them in natural C order (function implemented before call). Add a #if to be able to disable never called code, but the flag is not activated in this commit --- .../PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c | 1063 ++++++++--------- 1 file changed, 509 insertions(+), 554 deletions(-) diff --git a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c index aff8a60e06..562dc59e99 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c @@ -44,7 +44,7 @@ #include "linear_preprocessing_rec.h" //#define DEBUG_MMSE - +#define USE_MMSE /* dynamic shift for LLR computation for TM3/4 * set as command line argument, see lte-softmodem.c @@ -61,62 +61,6 @@ static const unsigned char offset_mumimo_llr_drange[29][3] = { {1, 1, 0}, {1, 3, 2}, {3, 4, 1}, {2, 0, 0}, {2, 2, 2}, {1, 1, 1}, {2, 1, 0}, {2, 1, 1}, {1, 0, 1}, {1, 0, 1}, {0, 0, 0}, {1, 0, 0}, {0, 0, 0}, {0, 1, 0}, {1, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}; -static void mmse_processing_oai(LTE_UE_PDSCH *pdsch_vars, - LTE_DL_FRAME_PARMS *frame_parms, - PHY_MEASUREMENTS *measurements, - unsigned char first_symbol_flag, - MIMO_mode_t mimo_mode, - unsigned short mmse_flag, - int noise_power, - unsigned char symbol, - unsigned short nb_rb); - -static void precode_channel_est(int32_t **dl_ch_estimates_ext, - LTE_DL_FRAME_PARMS *frame_parms, - LTE_UE_PDSCH *pdsch_vars, - unsigned char symbol, - unsigned short nb_rb, - MIMO_mode_t mimo_mode); - -static void rxdataF_to_float(int32_t **rxdataF_ext, float complex **rxdataF_f, int n_rx, int length, int start_point); -static void chan_est_to_float(int32_t **dl_ch_estimates_ext, - float complex **dl_ch_estimates_ext_f, - int n_tx, - int n_rx, - int length, - int start_point); - -static void float_to_chan_est(int32_t **dl_ch_estimates_ext, - float complex **dl_ch_estimates_ext_f, - int n_tx, - int n_rx, - int length, - int start_point); - -static void float_to_rxdataF(int32_t **rxdataF_ext, float complex **rxdataF_f, int n_tx, int n_rx, int length, int start_point); - -static void mult_mmse_rxdataF(float complex **Wmmse, - float complex **rxdataF_ext_f, - int n_tx, - int n_rx, - int length, - int start_point); - -static void mult_mmse_chan_est(float complex **Wmmse, - float complex **dl_ch_estimates_ext_f, - int n_tx, - int n_rx, - int length, - int start_point); - -static void mmse_processing_core(int32_t **rxdataF_ext, - int32_t **dl_ch_estimates_ext, - int sigma2, - int n_tx, - int n_rx, - int length, - int start_point); - static void dlsch_channel_compensation_TM34(LTE_DL_FRAME_PARMS *frame_parms, LTE_UE_PDSCH *lte_ue_pdsch_vars, PHY_MEASUREMENTS *phy_measurements, @@ -329,6 +273,511 @@ static uint16_t dlsch_extract_rbs_TM7(int32_t **rxdataF, uint32_t high_speed_flag, LTE_DL_FRAME_PARMS *frame_parms); +static const short TM3_prec[8] __attribute__((aligned(16))) = {1, 1, -1, -1, 1, 1, -1, -1}; + +void prec2A_TM3_128(simde__m128i *ch0,simde__m128i *ch1) { + simde__m128i amp = simde_mm_set1_epi16(ONE_OVER_SQRT2_Q15); + simde__m128i tmp0,tmp1; + //simde_mm_mulhi_epi16 + // print_shorts("prec2A_TM3 ch0 (before):",ch0); + // print_shorts("prec2A_TM3 ch1 (before):",ch1); + tmp0 = ch0[0]; + tmp1 = simde_mm_sign_epi16(ch1[0],((simde__m128i *)&TM3_prec)[0]); + // print_shorts("prec2A_TM3 ch1*s (mid):",(simde__m128i *)TM3_prec); + ch0[0] = simde_mm_adds_epi16(ch0[0],tmp1); + ch1[0] = simde_mm_subs_epi16(tmp0,tmp1); + ch0[0] = simde_mm_mulhi_epi16(ch0[0],amp); + ch0[0] = simde_mm_slli_epi16(ch0[0],1); + ch1[0] = simde_mm_mulhi_epi16(ch1[0],amp); + ch1[0] = simde_mm_slli_epi16(ch1[0],1); + // print_shorts("prec2A_TM3 ch0 (mid):",&tmp0); + // print_shorts("prec2A_TM3 ch1 (mid):",ch1); + //ch0[0] = simde_mm_mulhi_epi16(ch0[0],amp); + //ch0[0] = simde_mm_slli_epi16(ch0[0],1); + //ch1[0] = simde_mm_mulhi_epi16(ch1[0],amp); + //ch1[0] = simde_mm_slli_epi16(ch1[0],1); + //ch0[0] = simde_mm_srai_epi16(ch0[0],1); + //ch1[0] = simde_mm_srai_epi16(ch1[0],1); + // print_shorts("prec2A_TM3 ch0 (after):",ch0); + // print_shorts("prec2A_TM3 ch1 (after):",ch1); +} +// precoding is stream 0 .5(1,1) .5(1,-1) .5(1,1) .5(1,-1) +// stream 1 .5(1,-1) .5(1,1) .5(1,-1) .5(1,1) +// store "precoded" channel for stream 0 in ch0, stream 1 in ch1 + + + +// pmi = 0 => stream 0 (1,1), stream 1 (1,-1) +// pmi = 1 => stream 0 (1,j), stream 2 (1,-j) + +static void prec2A_TM4_128(int pmi, simde__m128i *ch0, simde__m128i *ch1) +{ + // sqrt(2) is already taken into account in computation sqrt_rho_a, sqrt_rho_b, + //so divide by 2 is replaced by divide by sqrt(2). + // printf ("demod pmi=%d\n", pmi); + simde__m128i amp; + amp = simde_mm_set1_epi16(ONE_OVER_SQRT2_Q15); + simde__m128i tmp0,tmp1; + + // print_shorts("prec2A_TM4 ch0 (before):",ch0); + // print_shorts("prec2A_TM4 ch1 (before):",ch1); + + if (pmi == 0) { //[1 1;1 -1] + tmp0 = ch0[0]; + tmp1 = ch1[0]; + ch0[0] = simde_mm_adds_epi16(tmp0,tmp1); + ch1[0] = simde_mm_subs_epi16(tmp0,tmp1); + } else { //ch0+j*ch1 ch0-j*ch1 + tmp0 = ch0[0]; + tmp1 = oai_mm_conj(oai_mm_swap(ch1[0])); + ch0[0] = simde_mm_subs_epi16(tmp0,tmp1); + ch1[0] = simde_mm_add_epi16(tmp0,tmp1); + } + + //print_shorts("prec2A_TM4 ch0 (middle):",ch0); + //print_shorts("prec2A_TM4 ch1 (middle):",ch1); + ch0[0] = simde_mm_mulhi_epi16(ch0[0],amp); + ch0[0] = simde_mm_slli_epi16(ch0[0],1); + ch1[0] = simde_mm_mulhi_epi16(ch1[0],amp); + ch1[0] = simde_mm_slli_epi16(ch1[0],1); + // ch0[0] = simde_mm_srai_epi16(ch0[0],1); //divide by 2 + // ch1[0] = simde_mm_srai_epi16(ch1[0],1); //divide by 2 + //print_shorts("prec2A_TM4 ch0 (end):",ch0); + //print_shorts("prec2A_TM4 ch1 (end):",ch1); + // print_shorts("prec2A_TM4 ch0 (end):",ch0); + //print_shorts("prec2A_TM4 ch1 (end):",ch1); +} + +#ifdef USE_MMSE +static void precode_channel_est(int32_t **dl_ch_estimates_ext, + LTE_DL_FRAME_PARMS *frame_parms, + LTE_UE_PDSCH *pdsch_vars, + unsigned char symbol, + unsigned short nb_rb, + MIMO_mode_t mimo_mode) +{ + unsigned short rb; + simde__m128i *dl_ch0_128,*dl_ch1_128; + unsigned char aarx=0,symbol_mod,pilots=0; + unsigned char *pmi_ext = pdsch_vars->pmi_ext; + symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; + + if ((symbol_mod == 0) || (symbol_mod == (4-frame_parms->Ncp))) + pilots=1; + + for (aarx=0; aarxnb_antennas_rx; aarx++) { + dl_ch0_128 = (simde__m128i *)&dl_ch_estimates_ext[aarx][symbol*frame_parms->N_RB_DL*12]; // this is h11 + dl_ch1_128 = (simde__m128i *)&dl_ch_estimates_ext[2+aarx][symbol*frame_parms->N_RB_DL*12]; // this is h12 + + for (rb=0; rb=1) + imag = INT16_MAX; + else + imag = cimag(rxdataF_f[aarx][re])*32768; + + if (creal(rxdataF_f[aarx][re])<-1) + real = -INT16_MAX; + else if (creal(rxdataF_f[aarx][re])>=1) + real = INT16_MAX; + else + real = creal(rxdataF_f[aarx][re])*32768; + + rxdataF_ext[aarx][start_point + re] = (((int32_t)imag)<<16)|(((int32_t)real) & 0xffff); +#ifdef DEBUG_MMSE + + if (re==0) { + printf(" float_to_rxdataF: real = %f, imag = %f\n",creal(rxdataF_f[aarx][re]), cimag(rxdataF_f[aarx][re])); + printf("float_to_rxdataF: real fixed = %d, imag fixed = %d\n", real, imag); + printf("float_to_rxdataF: ant %d, re = %d, rxdataF_ext = %d \n", aarx, re, rxdataF_ext[aarx][start_point + re]); + } + +#endif + } + } +} + +static void float_to_chan_est(int32_t **dl_ch_estimates_ext, + float complex **dl_ch_estimates_ext_f, + int n_tx, + int n_rx, + int length, + int start_point) +{ + for (int aatx = 0; aatx < n_tx; aatx++) { + for (int aarx = 0; aarx < n_rx; aarx++) { + for (int re = 0; re < length; re++) { + int16_t imag, real; + if (cimag(dl_ch_estimates_ext_f[aatx*n_rx + aarx][re])<-1) + imag = -INT16_MAX; + else if (cimag(dl_ch_estimates_ext_f[aatx*n_rx + aarx][re])>=1) + imag = INT16_MAX; + else + imag = cimag(dl_ch_estimates_ext_f[aatx*n_rx + aarx][re])*32768; + + if (creal(dl_ch_estimates_ext_f[aatx*n_rx + aarx][re])<-1) + real = -INT16_MAX; + else if (creal(dl_ch_estimates_ext_f[aatx*n_rx + aarx][re])>=1) + real = INT16_MAX; + else + real = creal(dl_ch_estimates_ext_f[aatx*n_rx + aarx][re])*32768; + + dl_ch_estimates_ext[aatx*n_rx + aarx][start_point + re] = (((int32_t)imag)<<16)|((int32_t)real & 0xffff); +#ifdef DEBUG_MMSE + + if (re==0) { + printf(" float_to_chan_est: chan est real = %f, chan est imag = %f\n",creal(dl_ch_estimates_ext_f[aatx*n_rx + aarx][re]), cimag(dl_ch_estimates_ext_f[aatx*n_rx + aarx][re])); + printf("float_to_chan_est: real fixed = %d, imag fixed = %d\n", real, imag); + printf("float_to_chan_est: ant %d, re = %d, dl_ch_estimates_ext = %d \n", aatx*n_rx + aarx, re, dl_ch_estimates_ext[aatx*n_rx + aarx][start_point + re]); + } + +#endif + } + } + } +} + +static void chan_est_to_float(int32_t **dl_ch_estimates_ext, + float complex **dl_ch_estimates_ext_f, + int n_tx, + int n_rx, + int length, + int start_point) +{ + for (int aatx = 0; aatx < n_tx; aatx++) { + for (int aarx = 0; aarx < n_rx; aarx++) { + for (int re = 0; re < length; re++) { + int16_t imag = (int16_t)(dl_ch_estimates_ext[aatx * n_rx + aarx][start_point + re] >> 16); + int16_t real = (int16_t)(dl_ch_estimates_ext[aatx * n_rx + aarx][start_point + re] & 0xffff); + dl_ch_estimates_ext_f[aatx*n_rx + aarx][re] = (float)(real/(32768.0)) + I*(float)(imag/(32768.0)); +#ifdef DEBUG_MMSE + + if (re==0) { + printf("ant %d, re = %d, real = %d, imag = %d \n", aatx*n_rx + aarx, re, real, imag); + printf("ant %d, re = %d, real = %f, imag = %f \n", aatx*n_rx + aarx, re, creal(dl_ch_estimates_ext_f[aatx*n_rx + aarx][re]), cimag(dl_ch_estimates_ext_f[aatx*n_rx + aarx][re])); + } + +#endif + } + } + } +} + +static void rxdataF_to_float(int32_t **rxdataF_ext, float complex **rxdataF_f, int n_rx, int length, int start_point) +{ + for (int aarx = 0; aarx < n_rx; aarx++) { + for (int re = 0; re < length; re++) { + int16_t imag = (int16_t)(rxdataF_ext[aarx][start_point + re] >> 16); + int16_t real = (int16_t)(rxdataF_ext[aarx][start_point + re] & 0xffff); + rxdataF_f[aarx][re] = (float)(real/(32768.0)) + I*(float)(imag/(32768.0)); +#ifdef DEBUG_MMSE + + if (re==0) { + printf("rxdataF_to_float: aarx = %d, real= %d, imag = %d\n", aarx, real, imag); + //printf("rxdataF_to_float: rxdataF_ext[%d][%d] = %d\n", aarx, start_point + re, rxdataF_ext[aarx][start_point + re]); + //printf("rxdataF_to_float: ant %d, re = %d, rxdataF_f real = %f, rxdataF_f imag = %f \n", aarx, re, creal(rxdataF_f[aarx][re]), cimag(rxdataF_f[aarx][re])); + } + +#endif + } + } +} + +static void mmse_processing_core(int32_t **rxdataF_ext, + int32_t **dl_ch_estimates_ext, + int noise_power, + int n_tx, + int n_rx, + int length, + int start_point) { + int aatx, aarx, re; + float imag; + float real; + float complex **W_MMSE= malloc(n_tx*n_rx*sizeof(float complex *)); + + for (int j=0; jrxdataF_ext; + int **dl_ch_estimates_ext = pdsch_vars->dl_ch_estimates_ext; + unsigned char *pmi_ext = pdsch_vars->pmi_ext; + int avg_00[frame_parms->nb_antenna_ports_eNB*frame_parms->nb_antennas_rx]; + int avg_01[frame_parms->nb_antenna_ports_eNB*frame_parms->nb_antennas_rx]; + int symbol_mod, length, start_point, nre; + symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; + + if (((symbol_mod == 0) || (symbol_mod == (frame_parms->Ncp-1)))&&(frame_parms->nb_antenna_ports_eNB!=1)) + nre=8; + else if (((symbol_mod == 0) || (symbol_mod == (frame_parms->Ncp-1)))&&(frame_parms->nb_antenna_ports_eNB==1)) + nre=10; + else + nre=12; + + length = nre*nb_rb; + start_point = symbol*nb_rb*12; + mmse_processing_core(rxdataF_ext, + dl_ch_estimates_ext, + noise_power, + frame_parms->nb_antenna_ports_eNB, + frame_parms->nb_antennas_rx, + length, + start_point); + + /*dlsch_channel_aver_band(dl_ch_estimates_ext, + frame_parms, + chan_avg, + symbol, + nb_rb); + + + for (aatx=0; aatxnb_antenna_ports_eNB; aatx++) + for (aarx=0; aarxnb_antennas_rx; aarx++) { + H[aatx*frame_parms->nb_antennas_rx + aarx] = (float)(chan_avg[aatx*frame_parms->nb_antennas_rx + aarx].r/(32768.0)) + I*(float)(chan_avg[aatx*frame_parms->nb_antennas_rx + aarx].i/(32768.0)); + // printf("H [%d] = (%f, %f) \n", aatx*frame_parms->nb_antennas_rx + aarx, creal(H[aatx*frame_parms->nb_antennas_rx + aarx]), cimag(H[aatx*frame_parms->nb_antennas_rx + aarx])); + }*/ + + if (first_symbol_flag == 1) { + dlsch_channel_level_TM34(dl_ch_estimates_ext, + frame_parms, + pmi_ext, + avg_00, + avg_01, + symbol, + nb_rb, + mmse_flag, + mimo_mode); + avg_00[0] = (log2_approx(avg_00[0])/2) + dlsch_demod_shift+4;// + 2 ;//+ 4; + avg_01[0] = (log2_approx(avg_01[0])/2) + dlsch_demod_shift+4;// + 2 ;//+ 4; + pdsch_vars->log2_maxh0 = cmax(avg_00[0],0); + pdsch_vars->log2_maxh1 = cmax(avg_01[0],0); + } +} + +#endif + int rx_pdsch(PHY_VARS_UE *ue, PDSCH_t type, unsigned char eNB_id, @@ -770,6 +1219,8 @@ int rx_pdsch(PHY_VARS_UE *ue, start_meas(&ue->generic_stat_bis[ue->current_thread_id[subframe]][slot]); #endif + #ifdef USE_MMSE + // mmse_flag is harcoded to false if (rx_type==rx_IC_dual_stream && mmse_flag==1) { precode_channel_est(pdsch_vars[eNB_id]->dl_ch_estimates_ext, frame_parms, @@ -787,6 +1238,7 @@ int rx_pdsch(PHY_VARS_UE *ue, symbol, nb_rb); } + #endif // Now channel compensation if (dlsch0_harq->mimo_mode stream 0 (1,1), stream 1 (1,-1) -// pmi = 1 => stream 0 (1,j), stream 2 (1,-j) - -static void prec2A_TM4_128(int pmi, simde__m128i *ch0, simde__m128i *ch1) -{ - // sqrt(2) is already taken into account in computation sqrt_rho_a, sqrt_rho_b, - //so divide by 2 is replaced by divide by sqrt(2). - // printf ("demod pmi=%d\n", pmi); - simde__m128i amp; - amp = simde_mm_set1_epi16(ONE_OVER_SQRT2_Q15); - simde__m128i tmp0,tmp1; - - // print_shorts("prec2A_TM4 ch0 (before):",ch0); - // print_shorts("prec2A_TM4 ch1 (before):",ch1); - - if (pmi == 0) { //[1 1;1 -1] - tmp0 = ch0[0]; - tmp1 = ch1[0]; - ch0[0] = simde_mm_adds_epi16(tmp0,tmp1); - ch1[0] = simde_mm_subs_epi16(tmp0,tmp1); - } else { //ch0+j*ch1 ch0-j*ch1 - tmp0 = ch0[0]; - tmp1 = oai_mm_conj(oai_mm_swap(ch1[0])); - ch0[0] = simde_mm_subs_epi16(tmp0,tmp1); - ch1[0] = simde_mm_add_epi16(tmp0,tmp1); - } - - //print_shorts("prec2A_TM4 ch0 (middle):",ch0); - //print_shorts("prec2A_TM4 ch1 (middle):",ch1); - ch0[0] = simde_mm_mulhi_epi16(ch0[0],amp); - ch0[0] = simde_mm_slli_epi16(ch0[0],1); - ch1[0] = simde_mm_mulhi_epi16(ch1[0],amp); - ch1[0] = simde_mm_slli_epi16(ch1[0],1); - // ch0[0] = simde_mm_srai_epi16(ch0[0],1); //divide by 2 - // ch1[0] = simde_mm_srai_epi16(ch1[0],1); //divide by 2 - //print_shorts("prec2A_TM4 ch0 (end):",ch0); - //print_shorts("prec2A_TM4 ch1 (end):",ch1); - // print_shorts("prec2A_TM4 ch0 (end):",ch0); - //print_shorts("prec2A_TM4 ch1 (end):",ch1); -} static void dlsch_channel_compensation_TM56(int **rxdataF_ext, int **dl_ch_estimates_ext, @@ -1854,71 +2234,6 @@ static void dlsch_channel_compensation_TM56(int **rxdataF_ext, // measurements->precoded_cqi_dB[eNB_id][0]); } -static void precode_channel_est(int32_t **dl_ch_estimates_ext, - LTE_DL_FRAME_PARMS *frame_parms, - LTE_UE_PDSCH *pdsch_vars, - unsigned char symbol, - unsigned short nb_rb, - MIMO_mode_t mimo_mode) -{ - unsigned short rb; - simde__m128i *dl_ch0_128,*dl_ch1_128; - unsigned char aarx=0,symbol_mod,pilots=0; - unsigned char *pmi_ext = pdsch_vars->pmi_ext; - symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; - - if ((symbol_mod == 0) || (symbol_mod == (4-frame_parms->Ncp))) - pilots=1; - - for (aarx=0; aarxnb_antennas_rx; aarx++) { - dl_ch0_128 = (simde__m128i *)&dl_ch_estimates_ext[aarx][symbol*frame_parms->N_RB_DL*12]; // this is h11 - dl_ch1_128 = (simde__m128i *)&dl_ch_estimates_ext[2+aarx][symbol*frame_parms->N_RB_DL*12]; // this is h12 - - for (rb=0; rbrxdataF_ext; - int **dl_ch_estimates_ext = pdsch_vars->dl_ch_estimates_ext; - unsigned char *pmi_ext = pdsch_vars->pmi_ext; - int avg_00[frame_parms->nb_antenna_ports_eNB*frame_parms->nb_antennas_rx]; - int avg_01[frame_parms->nb_antenna_ports_eNB*frame_parms->nb_antennas_rx]; - int symbol_mod, length, start_point, nre; - symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; - if (((symbol_mod == 0) || (symbol_mod == (frame_parms->Ncp-1)))&&(frame_parms->nb_antenna_ports_eNB!=1)) - nre=8; - else if (((symbol_mod == 0) || (symbol_mod == (frame_parms->Ncp-1)))&&(frame_parms->nb_antenna_ports_eNB==1)) - nre=10; - else - nre=12; - - length = nre*nb_rb; - start_point = symbol*nb_rb*12; - mmse_processing_core(rxdataF_ext, - dl_ch_estimates_ext, - noise_power, - frame_parms->nb_antenna_ports_eNB, - frame_parms->nb_antennas_rx, - length, - start_point); - - /*dlsch_channel_aver_band(dl_ch_estimates_ext, - frame_parms, - chan_avg, - symbol, - nb_rb); - - - for (aatx=0; aatxnb_antenna_ports_eNB; aatx++) - for (aarx=0; aarxnb_antennas_rx; aarx++) { - H[aatx*frame_parms->nb_antennas_rx + aarx] = (float)(chan_avg[aatx*frame_parms->nb_antennas_rx + aarx].r/(32768.0)) + I*(float)(chan_avg[aatx*frame_parms->nb_antennas_rx + aarx].i/(32768.0)); - // printf("H [%d] = (%f, %f) \n", aatx*frame_parms->nb_antennas_rx + aarx, creal(H[aatx*frame_parms->nb_antennas_rx + aarx]), cimag(H[aatx*frame_parms->nb_antennas_rx + aarx])); - }*/ - - if (first_symbol_flag == 1) { - dlsch_channel_level_TM34(dl_ch_estimates_ext, - frame_parms, - pmi_ext, - avg_00, - avg_01, - symbol, - nb_rb, - mmse_flag, - mimo_mode); - avg_00[0] = (log2_approx(avg_00[0])/2) + dlsch_demod_shift+4;// + 2 ;//+ 4; - avg_01[0] = (log2_approx(avg_01[0])/2) + dlsch_demod_shift+4;// + 2 ;//+ 4; - pdsch_vars->log2_maxh0 = cmax(avg_00[0],0); - pdsch_vars->log2_maxh1 = cmax(avg_01[0],0); - } -} - -void mmse_processing_core(int32_t **rxdataF_ext, - int32_t **dl_ch_estimates_ext, - int noise_power, - int n_tx, - int n_rx, - int length, - int start_point) { - int aatx, aarx, re; - float imag; - float real; - float complex **W_MMSE= malloc(n_tx*n_rx*sizeof(float complex *)); - - for (int j=0; j> 16); - int16_t real = (int16_t)(rxdataF_ext[aarx][start_point + re] & 0xffff); - rxdataF_f[aarx][re] = (float)(real/(32768.0)) + I*(float)(imag/(32768.0)); -#ifdef DEBUG_MMSE - if (re==0) { - printf("rxdataF_to_float: aarx = %d, real= %d, imag = %d\n", aarx, real, imag); - //printf("rxdataF_to_float: rxdataF_ext[%d][%d] = %d\n", aarx, start_point + re, rxdataF_ext[aarx][start_point + re]); - //printf("rxdataF_to_float: ant %d, re = %d, rxdataF_f real = %f, rxdataF_f imag = %f \n", aarx, re, creal(rxdataF_f[aarx][re]), cimag(rxdataF_f[aarx][re])); - } - -#endif - } - } -} - -static void chan_est_to_float(int32_t **dl_ch_estimates_ext, - float complex **dl_ch_estimates_ext_f, - int n_tx, - int n_rx, - int length, - int start_point) -{ - for (int aatx = 0; aatx < n_tx; aatx++) { - for (int aarx = 0; aarx < n_rx; aarx++) { - for (int re = 0; re < length; re++) { - int16_t imag = (int16_t)(dl_ch_estimates_ext[aatx * n_rx + aarx][start_point + re] >> 16); - int16_t real = (int16_t)(dl_ch_estimates_ext[aatx * n_rx + aarx][start_point + re] & 0xffff); - dl_ch_estimates_ext_f[aatx*n_rx + aarx][re] = (float)(real/(32768.0)) + I*(float)(imag/(32768.0)); -#ifdef DEBUG_MMSE - - if (re==0) { - printf("ant %d, re = %d, real = %d, imag = %d \n", aatx*n_rx + aarx, re, real, imag); - printf("ant %d, re = %d, real = %f, imag = %f \n", aatx*n_rx + aarx, re, creal(dl_ch_estimates_ext_f[aatx*n_rx + aarx][re]), cimag(dl_ch_estimates_ext_f[aatx*n_rx + aarx][re])); - } - -#endif - } - } - } -} - -void float_to_chan_est(int32_t **dl_ch_estimates_ext, - float complex **dl_ch_estimates_ext_f, - int n_tx, - int n_rx, - int length, - int start_point) -{ - for (int aatx = 0; aatx < n_tx; aatx++) { - for (int aarx = 0; aarx < n_rx; aarx++) { - for (int re = 0; re < length; re++) { - int16_t imag, real; - if (cimag(dl_ch_estimates_ext_f[aatx*n_rx + aarx][re])<-1) - imag = -INT16_MAX; - else if (cimag(dl_ch_estimates_ext_f[aatx*n_rx + aarx][re])>=1) - imag = INT16_MAX; - else - imag = cimag(dl_ch_estimates_ext_f[aatx*n_rx + aarx][re])*32768; - - if (creal(dl_ch_estimates_ext_f[aatx*n_rx + aarx][re])<-1) - real = -INT16_MAX; - else if (creal(dl_ch_estimates_ext_f[aatx*n_rx + aarx][re])>=1) - real = INT16_MAX; - else - real = creal(dl_ch_estimates_ext_f[aatx*n_rx + aarx][re])*32768; - - dl_ch_estimates_ext[aatx*n_rx + aarx][start_point + re] = (((int32_t)imag)<<16)|((int32_t)real & 0xffff); -#ifdef DEBUG_MMSE - - if (re==0) { - printf(" float_to_chan_est: chan est real = %f, chan est imag = %f\n",creal(dl_ch_estimates_ext_f[aatx*n_rx + aarx][re]), cimag(dl_ch_estimates_ext_f[aatx*n_rx + aarx][re])); - printf("float_to_chan_est: real fixed = %d, imag fixed = %d\n", real, imag); - printf("float_to_chan_est: ant %d, re = %d, dl_ch_estimates_ext = %d \n", aatx*n_rx + aarx, re, dl_ch_estimates_ext[aatx*n_rx + aarx][start_point + re]); - } - -#endif - } - } - } -} - -static void float_to_rxdataF(int32_t **rxdataF_ext, float complex **rxdataF_f, int n_tx, int n_rx, int length, int start_point) -{ - for (int aarx = 0; aarx < n_rx; aarx++) { - for (int re = 0; re < length; re++) { - int16_t imag, real; - if (cimag(rxdataF_f[aarx][re])<-1) - imag = -INT16_MAX; - else if (cimag(rxdataF_f[aarx][re])>=1) - imag = INT16_MAX; - else - imag = cimag(rxdataF_f[aarx][re])*32768; - - if (creal(rxdataF_f[aarx][re])<-1) - real = -INT16_MAX; - else if (creal(rxdataF_f[aarx][re])>=1) - real = INT16_MAX; - else - real = creal(rxdataF_f[aarx][re])*32768; - - rxdataF_ext[aarx][start_point + re] = (((int32_t)imag)<<16)|(((int32_t)real) & 0xffff); -#ifdef DEBUG_MMSE - - if (re==0) { - printf(" float_to_rxdataF: real = %f, imag = %f\n",creal(rxdataF_f[aarx][re]), cimag(rxdataF_f[aarx][re])); - printf("float_to_rxdataF: real fixed = %d, imag fixed = %d\n", real, imag); - printf("float_to_rxdataF: ant %d, re = %d, rxdataF_ext = %d \n", aarx, re, rxdataF_ext[aarx][start_point + re]); - } - -#endif - } - } -} - -void mult_mmse_rxdataF(float complex **Wmmse, - float complex **rxdataF_ext_f, - int n_tx, - int n_rx, - int length, - int start_point) { - short re; - int aarx, aatx; - float complex rxdata_re[n_rx]; - float complex rxdata_mmse_re[n_rx]; - float complex Wmmse_re[n_tx][n_rx]; - - for (re=0; re Date: Fri, 26 Dec 2025 17:52:21 +0100 Subject: [PATCH 09/37] remove cblas and lapack dependency, as the calling code can't be called in present master branch (likely never worked/fished code --- CMakeLists.txt | 12 +---------- cmake_targets/tools/build_helper | 7 ------- doc/cross-compile.md | 3 --- docker/Dockerfile.base.ubuntu.cross-arm64 | 3 --- docker/Dockerfile.eNB.ubuntu | 4 +--- docker/Dockerfile.gNB.aerial.ubuntu | 1 - ...kerfile.gNB.aerial.ubuntu.sanitize-address | 1 - docker/Dockerfile.gNB.aw2s.ubuntu | 1 - docker/Dockerfile.gNB.fhi72.rhel9 | 4 ---- docker/Dockerfile.gNB.fhi72.rocky | 4 ---- docker/Dockerfile.gNB.fhi72.ubuntu | 4 +--- docker/Dockerfile.gNB.ubuntu | 4 +--- docker/Dockerfile.lteRU.ubuntu | 1 - docker/Dockerfile.lteUE.rhel9 | 4 ---- docker/Dockerfile.lteUE.rocky | 4 ---- docker/Dockerfile.lteUE.ubuntu | 5 +---- docker/Dockerfile.nr-cuup.ubuntu | 3 +-- docker/Dockerfile.nrORU.fhi72.ubuntu | 1 - docker/Dockerfile.nrUE.ubuntu | 2 -- docker/Dockerfile.phySim.rhel9 | 4 ---- openair1/PHY/CODING/TESTBENCH/Makefile | 6 +++--- .../PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c | 2 +- openair1/SIMULATION/TOOLS/random_channel.c | 21 ------------------- openair2/UTIL/OMG/makefile | 2 +- tools/packages/packages.cmake | 2 +- 25 files changed, 12 insertions(+), 93 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 015e66e46d..4fd22fb1c2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -926,7 +926,7 @@ set(PHY_SRC_UE ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/sss_gen.c ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation.c - ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/linear_preprocessing_rec.c + #${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/linear_preprocessing_rec.c ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_decoding.c ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/uci_tools_ue.c @@ -1072,16 +1072,8 @@ add_dependencies(PHY_COMMON dfts) add_library(PHY ${PHY_SRC}) target_link_libraries(PHY PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs) -pkg_check_modules(blas REQUIRED blas) -pkg_check_modules(lapacke REQUIRED lapacke) - add_library(PHY_UE ${PHY_SRC_UE}) target_link_libraries(PHY_UE PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs UTIL) -# RHEL needs also cblas, but Ubuntu does not have it. So `cblas_LIBRARIES` and -# `cblas_INCLUDE_DIRS` will be empty for Ubuntu, a no-op -pkg_check_modules(cblas cblas) -target_link_libraries(PHY_UE PRIVATE ${blas_LIBRARIES} ${cblas_LIBRARIES} ${lapacke_LIBRARIES}) -target_include_directories(PHY_UE PRIVATE ${blas_INCLUDE_DIRS} ${cblas_INCLUDE_DIRS} ${lapacke_INCLUDE_DIRS}) add_library(PHY_NR_COMMON ${PHY_NR_SRC_COMMON}) target_link_libraries(PHY_NR_COMMON PUBLIC UTIL) @@ -1773,7 +1765,6 @@ target_link_libraries(lte-softmodem PRIVATE target_link_libraries(lte-softmodem PRIVATE pthread m CONFIG_LIB rt) target_link_libraries(lte-softmodem PRIVATE ${T_LIB}) target_link_libraries(lte-softmodem PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs) -target_link_libraries(lte-softmodem PRIVATE ${blas_LIBRARIES} ${cblas_LIBRARIES} ${lapacke_LIBRARIES} ${lapack_LIBRARIES}) if(E2_AGENT) target_link_libraries(lte-softmodem PUBLIC e2_agent e2_agent_arg e2_ran_func_du_cucp_cuup) @@ -1824,7 +1815,6 @@ target_link_libraries(lte-uesoftmodem PRIVATE target_link_libraries(lte-uesoftmodem PRIVATE pthread m CONFIG_LIB rt) target_link_libraries(lte-uesoftmodem PRIVATE ${T_LIB}) target_link_libraries(lte-uesoftmodem PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs) -target_link_libraries(lte-uesoftmodem PRIVATE ${blas_LIBRARIES} ${cblas_LIBRARIES} ${lapacke_LIBRARIES} ${lapack_LIBRARIES}) # force the generation of ASN.1 so that we don't need to wait during the build target_link_libraries(lte-uesoftmodem PRIVATE diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index 74d45cda9b..64c171276c 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -496,9 +496,6 @@ check_install_oai_software() { ninja-build \ pkg-config \ git \ - libblas-dev \ - liblapack-dev \ - liblapacke-dev \ libreadline-dev \ libconfig-dev \ libsctp-dev \ @@ -536,10 +533,6 @@ check_install_oai_software() { openssl-devel \ patch \ readline-devel \ - lapack \ - lapack-devel \ - blas \ - blas-devel \ vim-common \ zlib-devel \ yaml-cpp-devel diff --git a/doc/cross-compile.md b/doc/cross-compile.md index 69e59cb832..62ad99deb1 100644 --- a/doc/cross-compile.md +++ b/doc/cross-compile.md @@ -42,10 +42,7 @@ sudo apt install -y gcc-aarch64-linux-gnu \ g++-aarch64-linux-gnu sudo apt-get install -y \ - libblas-dev:arm64 \ libc6-dev-i386 \ - liblapack-dev:arm64 \ - liblapacke-dev:arm64 \ libreadline-dev:arm64 \ libgnutls28-dev:arm64 \ libconfig-dev:arm64 \ diff --git a/docker/Dockerfile.base.ubuntu.cross-arm64 b/docker/Dockerfile.base.ubuntu.cross-arm64 index 1365df71fe..fa9918eda8 100644 --- a/docker/Dockerfile.base.ubuntu.cross-arm64 +++ b/docker/Dockerfile.base.ubuntu.cross-arm64 @@ -57,9 +57,6 @@ RUN apt-get update && \ tzdata \ xxd \ # ARM64 packages - libblas-dev:arm64 \ - liblapack-dev:arm64 \ - liblapacke-dev:arm64 \ libreadline-dev:arm64 \ libgnutls28-dev:arm64 \ libconfig-dev:arm64 \ diff --git a/docker/Dockerfile.eNB.ubuntu b/docker/Dockerfile.eNB.ubuntu index d0312f8cce..6229bf9028 100644 --- a/docker/Dockerfile.eNB.ubuntu +++ b/docker/Dockerfile.eNB.ubuntu @@ -51,7 +51,6 @@ RUN apt-get update && \ libboost-system1.83.0 \ libboost-program-options1.83.0 \ tzdata \ - libblas3 \ libconfig9 \ openssl \ net-tools \ @@ -74,8 +73,7 @@ RUN apt-get update && \ # if the --sanitize option was used to build, additional packages are required /bin/bash -c 'if [[ "$BUILD_OPTION" = "--sanitize" ]]; then DEBIAN_FRONTEND=noninteractive apt-get install --yes \ libasan8 \ - libubsan1 \ - liblapacke; fi' && \ + libubsan1 ; fi' && \ apt-get clean -y && \ rm -rf /var/lib/apt/lists/* diff --git a/docker/Dockerfile.gNB.aerial.ubuntu b/docker/Dockerfile.gNB.aerial.ubuntu index b79ab78fa8..980c909c4d 100644 --- a/docker/Dockerfile.gNB.aerial.ubuntu +++ b/docker/Dockerfile.gNB.aerial.ubuntu @@ -70,7 +70,6 @@ RUN apt-get update && \ procps \ libsctp1 \ tzdata \ - libblas3 \ libconfig9 \ openssl \ net-tools \ diff --git a/docker/Dockerfile.gNB.aerial.ubuntu.sanitize-address b/docker/Dockerfile.gNB.aerial.ubuntu.sanitize-address index 07b6d7111b..1792836b85 100644 --- a/docker/Dockerfile.gNB.aerial.ubuntu.sanitize-address +++ b/docker/Dockerfile.gNB.aerial.ubuntu.sanitize-address @@ -69,7 +69,6 @@ RUN apt-get update && \ procps \ libsctp1 \ tzdata \ - libblas3 \ libconfig9 \ openssl \ net-tools \ diff --git a/docker/Dockerfile.gNB.aw2s.ubuntu b/docker/Dockerfile.gNB.aw2s.ubuntu index 840b4a8a28..7826afd794 100644 --- a/docker/Dockerfile.gNB.aw2s.ubuntu +++ b/docker/Dockerfile.gNB.aw2s.ubuntu @@ -48,7 +48,6 @@ RUN apt-get update && \ procps \ libsctp1 \ tzdata \ - libblas3 \ libc6 \ libconfig9 \ gdb \ diff --git a/docker/Dockerfile.gNB.fhi72.rhel9 b/docker/Dockerfile.gNB.fhi72.rhel9 index bbcfe7b42d..50ac7ab78a 100644 --- a/docker/Dockerfile.gNB.fhi72.rhel9 +++ b/docker/Dockerfile.gNB.fhi72.rhel9 @@ -101,10 +101,6 @@ COPY --from=gnb-build /usr/local/lib64/flexric /usr/local/lib64/flexric COPY --from=gnb-base \ /lib64/libconfig.so.11 \ /lib64/libforms.so.2 \ - /lib64/libblas.so.3 \ - /lib64/libcblas.so.3 \ - /lib64/liblapack.so.3 \ - /lib64/liblapacke.so.3 \ /lib64/libicudata.so.67 \ /lib64/libicui18n.so.67 \ /lib64/libicuuc.so.67 \ diff --git a/docker/Dockerfile.gNB.fhi72.rocky b/docker/Dockerfile.gNB.fhi72.rocky index ba7861d1bf..816fa16be6 100644 --- a/docker/Dockerfile.gNB.fhi72.rocky +++ b/docker/Dockerfile.gNB.fhi72.rocky @@ -90,10 +90,6 @@ COPY --from=gnb-build /usr/local/lib64/flexric /usr/local/lib64/flexric COPY --from=gnb-base \ /lib64/libconfig.so.11 \ /lib64/libforms.so.2 \ - /lib64/libblas.so.3 \ - /lib64/libcblas.so.3 \ - /lib64/liblapack.so.3 \ - /lib64/liblapacke.so.3 \ /lib64/libicudata.so.67 \ /lib64/libicui18n.so.67 \ /lib64/libicuuc.so.67 \ diff --git a/docker/Dockerfile.gNB.fhi72.ubuntu b/docker/Dockerfile.gNB.fhi72.ubuntu index 09af53eed5..03e21e4688 100644 --- a/docker/Dockerfile.gNB.fhi72.ubuntu +++ b/docker/Dockerfile.gNB.fhi72.ubuntu @@ -44,7 +44,6 @@ RUN apt-get update && \ pkg-config \ libsctp1 \ tzdata \ - libblas3 \ libconfig9 \ openssl \ net-tools \ @@ -63,8 +62,7 @@ RUN apt-get update && \ # if the --sanitize option was used to build, additional packages are required /bin/bash -c 'if [[ "$BUILD_OPTION" = "--sanitize" ]]; then DEBIAN_FRONTEND=noninteractive apt-get install --yes \ libasan8 \ - libubsan1 \ - liblapacke; fi' && \ + libubsan1 ; fi' && \ rm -rf /var/lib/apt/lists/* WORKDIR /opt/oai-gnb/bin diff --git a/docker/Dockerfile.gNB.ubuntu b/docker/Dockerfile.gNB.ubuntu index 45017486b3..9156ce98c8 100644 --- a/docker/Dockerfile.gNB.ubuntu +++ b/docker/Dockerfile.gNB.ubuntu @@ -51,7 +51,6 @@ RUN apt-get update && \ libboost-system1.83.0 \ libboost-program-options1.83.0 \ tzdata \ - libblas3 \ libconfig9 \ openssl \ net-tools \ @@ -69,8 +68,7 @@ RUN apt-get update && \ # if the --sanitize option was used to build, additional packages are required /bin/bash -c 'if [[ "$BUILD_OPTION" = "--sanitize" ]]; then DEBIAN_FRONTEND=noninteractive apt-get install --yes \ libasan8 \ - libubsan1 \ - liblapacke; fi' && \ + libubsan1; fi' && \ apt-get clean -y && \ rm -rf /var/lib/apt/lists/* diff --git a/docker/Dockerfile.lteRU.ubuntu b/docker/Dockerfile.lteRU.ubuntu index dbfc94055a..9bf886a096 100644 --- a/docker/Dockerfile.lteRU.ubuntu +++ b/docker/Dockerfile.lteRU.ubuntu @@ -49,7 +49,6 @@ RUN apt-get update && \ libboost-thread1.83.0 \ libboost-system1.83.0 \ libboost-program-options1.83.0 \ - libblas3 \ libconfig9 \ net-tools \ gdb \ diff --git a/docker/Dockerfile.lteUE.rhel9 b/docker/Dockerfile.lteUE.rhel9 index 6dee43cbac..2a8a828633 100644 --- a/docker/Dockerfile.lteUE.rhel9 +++ b/docker/Dockerfile.lteUE.rhel9 @@ -73,10 +73,6 @@ COPY --from=lte-ue-build \ COPY --from=lte-ue-base \ /lib64/libconfig.so.11 \ - /lib64/libblas.so.3 \ - /lib64/libcblas.so.3 \ - /lib64/liblapack.so.3 \ - /lib64/liblapacke.so.3 \ /lib64/libboost_chrono.so.1.75.0 \ /lib64/libboost_date_time.so.1.75.0 \ /lib64/libboost_filesystem.so.1.75.0 \ diff --git a/docker/Dockerfile.lteUE.rocky b/docker/Dockerfile.lteUE.rocky index 5f968b266a..19fea4ab4f 100644 --- a/docker/Dockerfile.lteUE.rocky +++ b/docker/Dockerfile.lteUE.rocky @@ -74,10 +74,6 @@ COPY --from=lte-ue-build \ COPY --from=lte-ue-base \ /lib64/libconfig.so.11 \ - /lib64/libblas.so.3 \ - /lib64/libcblas.so.3 \ - /lib64/liblapack.so.3 \ - /lib64/liblapacke.so.3 \ /lib64/libboost_chrono.so.1.75.0 \ /lib64/libboost_date_time.so.1.75.0 \ /lib64/libboost_filesystem.so.1.75.0 \ diff --git a/docker/Dockerfile.lteUE.ubuntu b/docker/Dockerfile.lteUE.ubuntu index 909c137ddd..7c608c0077 100644 --- a/docker/Dockerfile.lteUE.ubuntu +++ b/docker/Dockerfile.lteUE.ubuntu @@ -51,8 +51,6 @@ RUN apt-get update && \ libboost-system1.83.0 \ libboost-program-options1.83.0 \ tzdata \ - liblapacke \ - libblas3 \ libconfig9 \ openssl \ net-tools \ @@ -75,8 +73,7 @@ RUN apt-get update && \ # if the --sanitize option was used to build, additional packages are required /bin/bash -c 'if [[ "$BUILD_OPTION" = "--sanitize" ]]; then DEBIAN_FRONTEND=noninteractive apt-get install --yes \ libasan8 \ - libubsan1 \ - liblapacke; fi' && \ + libubsan1 ; fi' && \ apt-get clean -y && \ rm -rf /var/lib/apt/lists/* diff --git a/docker/Dockerfile.nr-cuup.ubuntu b/docker/Dockerfile.nr-cuup.ubuntu index 33fd01ab0e..ed00800582 100644 --- a/docker/Dockerfile.nr-cuup.ubuntu +++ b/docker/Dockerfile.nr-cuup.ubuntu @@ -47,8 +47,7 @@ RUN apt-get update && \ # if the --sanitize option was used to build, additional packages are required /bin/bash -c 'if [[ "$BUILD_OPTION" = "--sanitize" ]]; then DEBIAN_FRONTEND=noninteractive apt-get install --yes \ libasan8 \ - libubsan1 \ - liblapacke; fi' && \ + libubsan1; fi' && \ rm -rf /var/lib/apt/lists/* ## Copy E2 SM models diff --git a/docker/Dockerfile.nrORU.fhi72.ubuntu b/docker/Dockerfile.nrORU.fhi72.ubuntu index 9c4e1b3971..dc014c70d8 100644 --- a/docker/Dockerfile.nrORU.fhi72.ubuntu +++ b/docker/Dockerfile.nrORU.fhi72.ubuntu @@ -36,7 +36,6 @@ RUN apt-get update && \ pkg-config \ libsctp1 \ tzdata \ - libblas3 \ libconfig9 \ openssl \ net-tools \ diff --git a/docker/Dockerfile.nrUE.ubuntu b/docker/Dockerfile.nrUE.ubuntu index 7c8b15d013..ef700825d1 100644 --- a/docker/Dockerfile.nrUE.ubuntu +++ b/docker/Dockerfile.nrUE.ubuntu @@ -52,8 +52,6 @@ RUN apt-get update && \ libboost-system1.83.0 \ libboost-program-options1.83.0 \ tzdata \ - liblapacke \ - libblas3 \ libconfig9 \ openssl \ net-tools \ diff --git a/docker/Dockerfile.phySim.rhel9 b/docker/Dockerfile.phySim.rhel9 index 40db199bd4..bbba2060f9 100644 --- a/docker/Dockerfile.phySim.rhel9 +++ b/docker/Dockerfile.phySim.rhel9 @@ -69,10 +69,6 @@ COPY --from=phy-sim-build /opt/oai-physim/bin/ /opt/oai-physim/bin/ COPY --from=phy-sim-build \ /oai-ran/cmake_targets/ran_build/build/libcoding.so \ - /lib64/liblapacke.so.3 \ - /lib64/libblas.so.3 \ - /lib64/libcblas.so.3 \ - /lib64/liblapack.so.3 \ /usr/lib64/libasan.so.6 \ /usr/lib64/libubsan.so.1 \ /oai-ran/cmake_targets/ran_build/build/libdfts.so \ diff --git a/openair1/PHY/CODING/TESTBENCH/Makefile b/openair1/PHY/CODING/TESTBENCH/Makefile index 030f19b47b..c915bbed38 100644 --- a/openair1/PHY/CODING/TESTBENCH/Makefile +++ b/openair1/PHY/CODING/TESTBENCH/Makefile @@ -44,12 +44,12 @@ $(OBJ) : %.o : %.c $(CC) -c $(CFLAGS) -Wall -I$(TOP_DIR) -I$(TOP_DIR)/PHY/CODING -I$(OPENAIR0_DIR)/express-mimo/simulator/baseband/C/channel_decoder -o $@ $< ltetest: $(OBJ) ltetest.c - $(CC) ltetest.c -O2 -I$(TOP_DIR) -I$(TOP_DIR)/PHY/CODING -I$(OPENAIR0_DIR)/express-mimo/simulator/baseband/C/channel_decoder -o ltetest $(CFLAGS) $(OBJ) -lm -DOPENAIR_LTE -lblas -lrt + $(CC) ltetest.c -O2 -I$(TOP_DIR) -I$(TOP_DIR)/PHY/CODING -I$(OPENAIR0_DIR)/express-mimo/simulator/baseband/C/channel_decoder -o ltetest $(CFLAGS) $(OBJ) -lm -DOPENAIR_LTE -lrt pdcch_test: $(OBJ) pdcch_test.c - $(CC) pdcch_test.c -I$(TOP_DIR) -o pdcch_test $(CFLAGS) $(PHY_OBJS) -lm -lblas + $(CC) pdcch_test.c -I$(TOP_DIR) -o pdcch_test $(CFLAGS) $(PHY_OBJS) -lm viterbi_test: $(OBJ) viterbi_test.c - $(CC) viterbi_test.c -I$(TOP_DIR) -o viterbi_test $(CFLAGS) $(PHY_OBJS) -lm -lblas + $(CC) viterbi_test.c -I$(TOP_DIR) -o viterbi_test $(CFLAGS) $(PHY_OBJS) -lm clean: rm $(OBJ) diff --git a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c index 562dc59e99..cf83b40a7f 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c @@ -44,7 +44,7 @@ #include "linear_preprocessing_rec.h" //#define DEBUG_MMSE -#define USE_MMSE +//#define USE_MMSE /* dynamic shift for LLR computation for TM3/4 * set as command line argument, see lte-softmodem.c diff --git a/openair1/SIMULATION/TOOLS/random_channel.c b/openair1/SIMULATION/TOOLS/random_channel.c index cf973f5d84..7ec844329f 100644 --- a/openair1/SIMULATION/TOOLS/random_channel.c +++ b/openair1/SIMULATION/TOOLS/random_channel.c @@ -1849,27 +1849,6 @@ int random_channel(channel_desc_t *desc, uint8_t abstraction_flag) { } } - /* - FIXME: Function cblas_zgemv has an undefined output (for the same input) after a second call in RHEL8 (acorr = nan) - alpha.r = 1.0; - alpha.i = 0.0; - beta.r = 0.0; - beta.i = 0.0; - cblas_zgemv(CblasRowMajor, CblasNoTrans, desc->nb_tx*desc->nb_rx, desc->nb_tx*desc->nb_rx, - (void *) &alpha, (void *) desc->R_sqrt[i/3], desc->nb_rx*desc->nb_tx, - (void *) anew, 1, (void *) &beta, (void *) acorr, 1); - */ - - /* - for (aarx=0;aarxnb_rx;aarx++) { - for (aatx=0;aatxnb_tx;aatx++) { - desc->a[i][aarx+(aatx*desc->nb_rx)].x = acorr[aarx+(aatx*desc->nb_rx)].x; - desc->a[i][aarx+(aatx*desc->nb_rx)].y = acorr[aarx+(aatx*desc->nb_rx)].y; - printf("tap %d, acorr1(%d,%d) = %f+1j*%f\n",i,aatx,aarx,acorr[aarx+(aatx*desc->nb_rx)].x, acorr[aarx+(aatx*desc->nb_rx)].y); - } - } - */ - if (desc->first_run==1) { memcpy(desc->a[i], acorr, desc->nb_tx * desc->nb_rx * sizeof(*acorr)); } else { diff --git a/openair2/UTIL/OMG/makefile b/openair2/UTIL/OMG/makefile index 80ab8c6394..87475ed133 100644 --- a/openair2/UTIL/OMG/makefile +++ b/openair2/UTIL/OMG/makefile @@ -100,7 +100,7 @@ $(OBJ) : %.o : %.c $(L2_OBJS) : %.o : %.c $(CC) -c $(CFLAGS) $(EXTRA_CFLAGS) -DMAC_CONTEXT=1 -DPHY_CONTEXT=1 -I$(TOP_DIR) $(L2_incl) -o $@ $< -physim : $(OBJ) $(L2_OBJS) OMG.c common.c static.c job.c rwp.c rwalk.c hashtable.c mobility_parser.c trace.c -I$(TOP_DIR) $(L2_incl) -o physim $(CFLAGS) $(EXTRA_CFLAGS) $(OBJ) $(L2_OBJS) -lm -lforms -L/usr/local/lib -lforms -lX11 -L/usr/X11R6/lib -lXpm -lblas -lpthread +physim : $(OBJ) $(L2_OBJS) OMG.c common.c static.c job.c rwp.c rwalk.c hashtable.c mobility_parser.c trace.c -I$(TOP_DIR) $(L2_incl) -o physim $(CFLAGS) $(EXTRA_CFLAGS) $(OBJ) $(L2_OBJS) -lm -lforms -L/usr/local/lib -lforms -lX11 -L/usr/X11R6/lib -lXpm -lpthread clean: rm -f physim diff --git a/tools/packages/packages.cmake b/tools/packages/packages.cmake index 8ec8581354..0ec0008e5a 100644 --- a/tools/packages/packages.cmake +++ b/tools/packages/packages.cmake @@ -62,7 +62,7 @@ if(PACKAGING_LTE) set(CPACK_RPM_PACKAGE_OAI-LTE_SUMMARY "OpenAirInterface LTE package") set(CPACK_RPM_PACKAGE_OAI-LTE_DESCRIPTION "${LTE_PACKAGE_DESCRIPTION}") else() - set(CPACK_DEBIAN_OAI-LTE_PACKAGE_DEPENDS "liboai-common, libblas3, liblapacke") + set(CPACK_DEBIAN_OAI-LTE_PACKAGE_DEPENDS "liboai-common") set(CPACK_DEBIAN_OAI-LTE_SUMMARY "OpenAirInterface LTE package") set(CPACK_DEBIAN_OAI-LTE_DESCRIPTION "${LTE_PACKAGE_DESCRIPTION}") endif() From 8925654c078e762fd62e354ba82bc1824eeae18f Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 16 Feb 2026 14:57:45 +0100 Subject: [PATCH 10/37] Remove unused 4G MMSE code Since the parent commit, USE_MMSE is not defined. Thus, the corresponding code is commented out. Since there are no linker problems, it is obvious that this code is never called, and we can remove it. --- CMakeLists.txt | 1 - .../PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c | 434 ------------------ .../linear_preprocessing_rec.c | 119 ----- .../linear_preprocessing_rec.h | 12 - 4 files changed, 566 deletions(-) delete mode 100644 openair1/PHY/LTE_UE_TRANSPORT/linear_preprocessing_rec.c delete mode 100644 openair1/PHY/LTE_UE_TRANSPORT/linear_preprocessing_rec.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 4fd22fb1c2..98dba37442 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -926,7 +926,6 @@ set(PHY_SRC_UE ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/sss_gen.c ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation.c - #${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/linear_preprocessing_rec.c ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_decoding.c ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dci_tools_ue.c ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/uci_tools_ue.c diff --git a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c index cf83b40a7f..b8157652c2 100644 --- a/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c +++ b/openair1/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c @@ -41,10 +41,6 @@ #include #include #include -#include "linear_preprocessing_rec.h" - -//#define DEBUG_MMSE -//#define USE_MMSE /* dynamic shift for LLR computation for TM3/4 * set as command line argument, see lte-softmodem.c @@ -348,436 +344,6 @@ static void prec2A_TM4_128(int pmi, simde__m128i *ch0, simde__m128i *ch1) //print_shorts("prec2A_TM4 ch1 (end):",ch1); } -#ifdef USE_MMSE -static void precode_channel_est(int32_t **dl_ch_estimates_ext, - LTE_DL_FRAME_PARMS *frame_parms, - LTE_UE_PDSCH *pdsch_vars, - unsigned char symbol, - unsigned short nb_rb, - MIMO_mode_t mimo_mode) -{ - unsigned short rb; - simde__m128i *dl_ch0_128,*dl_ch1_128; - unsigned char aarx=0,symbol_mod,pilots=0; - unsigned char *pmi_ext = pdsch_vars->pmi_ext; - symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; - - if ((symbol_mod == 0) || (symbol_mod == (4-frame_parms->Ncp))) - pilots=1; - - for (aarx=0; aarxnb_antennas_rx; aarx++) { - dl_ch0_128 = (simde__m128i *)&dl_ch_estimates_ext[aarx][symbol*frame_parms->N_RB_DL*12]; // this is h11 - dl_ch1_128 = (simde__m128i *)&dl_ch_estimates_ext[2+aarx][symbol*frame_parms->N_RB_DL*12]; // this is h12 - - for (rb=0; rb=1) - imag = INT16_MAX; - else - imag = cimag(rxdataF_f[aarx][re])*32768; - - if (creal(rxdataF_f[aarx][re])<-1) - real = -INT16_MAX; - else if (creal(rxdataF_f[aarx][re])>=1) - real = INT16_MAX; - else - real = creal(rxdataF_f[aarx][re])*32768; - - rxdataF_ext[aarx][start_point + re] = (((int32_t)imag)<<16)|(((int32_t)real) & 0xffff); -#ifdef DEBUG_MMSE - - if (re==0) { - printf(" float_to_rxdataF: real = %f, imag = %f\n",creal(rxdataF_f[aarx][re]), cimag(rxdataF_f[aarx][re])); - printf("float_to_rxdataF: real fixed = %d, imag fixed = %d\n", real, imag); - printf("float_to_rxdataF: ant %d, re = %d, rxdataF_ext = %d \n", aarx, re, rxdataF_ext[aarx][start_point + re]); - } - -#endif - } - } -} - -static void float_to_chan_est(int32_t **dl_ch_estimates_ext, - float complex **dl_ch_estimates_ext_f, - int n_tx, - int n_rx, - int length, - int start_point) -{ - for (int aatx = 0; aatx < n_tx; aatx++) { - for (int aarx = 0; aarx < n_rx; aarx++) { - for (int re = 0; re < length; re++) { - int16_t imag, real; - if (cimag(dl_ch_estimates_ext_f[aatx*n_rx + aarx][re])<-1) - imag = -INT16_MAX; - else if (cimag(dl_ch_estimates_ext_f[aatx*n_rx + aarx][re])>=1) - imag = INT16_MAX; - else - imag = cimag(dl_ch_estimates_ext_f[aatx*n_rx + aarx][re])*32768; - - if (creal(dl_ch_estimates_ext_f[aatx*n_rx + aarx][re])<-1) - real = -INT16_MAX; - else if (creal(dl_ch_estimates_ext_f[aatx*n_rx + aarx][re])>=1) - real = INT16_MAX; - else - real = creal(dl_ch_estimates_ext_f[aatx*n_rx + aarx][re])*32768; - - dl_ch_estimates_ext[aatx*n_rx + aarx][start_point + re] = (((int32_t)imag)<<16)|((int32_t)real & 0xffff); -#ifdef DEBUG_MMSE - - if (re==0) { - printf(" float_to_chan_est: chan est real = %f, chan est imag = %f\n",creal(dl_ch_estimates_ext_f[aatx*n_rx + aarx][re]), cimag(dl_ch_estimates_ext_f[aatx*n_rx + aarx][re])); - printf("float_to_chan_est: real fixed = %d, imag fixed = %d\n", real, imag); - printf("float_to_chan_est: ant %d, re = %d, dl_ch_estimates_ext = %d \n", aatx*n_rx + aarx, re, dl_ch_estimates_ext[aatx*n_rx + aarx][start_point + re]); - } - -#endif - } - } - } -} - -static void chan_est_to_float(int32_t **dl_ch_estimates_ext, - float complex **dl_ch_estimates_ext_f, - int n_tx, - int n_rx, - int length, - int start_point) -{ - for (int aatx = 0; aatx < n_tx; aatx++) { - for (int aarx = 0; aarx < n_rx; aarx++) { - for (int re = 0; re < length; re++) { - int16_t imag = (int16_t)(dl_ch_estimates_ext[aatx * n_rx + aarx][start_point + re] >> 16); - int16_t real = (int16_t)(dl_ch_estimates_ext[aatx * n_rx + aarx][start_point + re] & 0xffff); - dl_ch_estimates_ext_f[aatx*n_rx + aarx][re] = (float)(real/(32768.0)) + I*(float)(imag/(32768.0)); -#ifdef DEBUG_MMSE - - if (re==0) { - printf("ant %d, re = %d, real = %d, imag = %d \n", aatx*n_rx + aarx, re, real, imag); - printf("ant %d, re = %d, real = %f, imag = %f \n", aatx*n_rx + aarx, re, creal(dl_ch_estimates_ext_f[aatx*n_rx + aarx][re]), cimag(dl_ch_estimates_ext_f[aatx*n_rx + aarx][re])); - } - -#endif - } - } - } -} - -static void rxdataF_to_float(int32_t **rxdataF_ext, float complex **rxdataF_f, int n_rx, int length, int start_point) -{ - for (int aarx = 0; aarx < n_rx; aarx++) { - for (int re = 0; re < length; re++) { - int16_t imag = (int16_t)(rxdataF_ext[aarx][start_point + re] >> 16); - int16_t real = (int16_t)(rxdataF_ext[aarx][start_point + re] & 0xffff); - rxdataF_f[aarx][re] = (float)(real/(32768.0)) + I*(float)(imag/(32768.0)); -#ifdef DEBUG_MMSE - - if (re==0) { - printf("rxdataF_to_float: aarx = %d, real= %d, imag = %d\n", aarx, real, imag); - //printf("rxdataF_to_float: rxdataF_ext[%d][%d] = %d\n", aarx, start_point + re, rxdataF_ext[aarx][start_point + re]); - //printf("rxdataF_to_float: ant %d, re = %d, rxdataF_f real = %f, rxdataF_f imag = %f \n", aarx, re, creal(rxdataF_f[aarx][re]), cimag(rxdataF_f[aarx][re])); - } - -#endif - } - } -} - -static void mmse_processing_core(int32_t **rxdataF_ext, - int32_t **dl_ch_estimates_ext, - int noise_power, - int n_tx, - int n_rx, - int length, - int start_point) { - int aatx, aarx, re; - float imag; - float real; - float complex **W_MMSE= malloc(n_tx*n_rx*sizeof(float complex *)); - - for (int j=0; jrxdataF_ext; - int **dl_ch_estimates_ext = pdsch_vars->dl_ch_estimates_ext; - unsigned char *pmi_ext = pdsch_vars->pmi_ext; - int avg_00[frame_parms->nb_antenna_ports_eNB*frame_parms->nb_antennas_rx]; - int avg_01[frame_parms->nb_antenna_ports_eNB*frame_parms->nb_antennas_rx]; - int symbol_mod, length, start_point, nre; - symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; - - if (((symbol_mod == 0) || (symbol_mod == (frame_parms->Ncp-1)))&&(frame_parms->nb_antenna_ports_eNB!=1)) - nre=8; - else if (((symbol_mod == 0) || (symbol_mod == (frame_parms->Ncp-1)))&&(frame_parms->nb_antenna_ports_eNB==1)) - nre=10; - else - nre=12; - - length = nre*nb_rb; - start_point = symbol*nb_rb*12; - mmse_processing_core(rxdataF_ext, - dl_ch_estimates_ext, - noise_power, - frame_parms->nb_antenna_ports_eNB, - frame_parms->nb_antennas_rx, - length, - start_point); - - /*dlsch_channel_aver_band(dl_ch_estimates_ext, - frame_parms, - chan_avg, - symbol, - nb_rb); - - - for (aatx=0; aatxnb_antenna_ports_eNB; aatx++) - for (aarx=0; aarxnb_antennas_rx; aarx++) { - H[aatx*frame_parms->nb_antennas_rx + aarx] = (float)(chan_avg[aatx*frame_parms->nb_antennas_rx + aarx].r/(32768.0)) + I*(float)(chan_avg[aatx*frame_parms->nb_antennas_rx + aarx].i/(32768.0)); - // printf("H [%d] = (%f, %f) \n", aatx*frame_parms->nb_antennas_rx + aarx, creal(H[aatx*frame_parms->nb_antennas_rx + aarx]), cimag(H[aatx*frame_parms->nb_antennas_rx + aarx])); - }*/ - - if (first_symbol_flag == 1) { - dlsch_channel_level_TM34(dl_ch_estimates_ext, - frame_parms, - pmi_ext, - avg_00, - avg_01, - symbol, - nb_rb, - mmse_flag, - mimo_mode); - avg_00[0] = (log2_approx(avg_00[0])/2) + dlsch_demod_shift+4;// + 2 ;//+ 4; - avg_01[0] = (log2_approx(avg_01[0])/2) + dlsch_demod_shift+4;// + 2 ;//+ 4; - pdsch_vars->log2_maxh0 = cmax(avg_00[0],0); - pdsch_vars->log2_maxh1 = cmax(avg_01[0],0); - } -} - -#endif - int rx_pdsch(PHY_VARS_UE *ue, PDSCH_t type, unsigned char eNB_id, diff --git a/openair1/PHY/LTE_UE_TRANSPORT/linear_preprocessing_rec.c b/openair1/PHY/LTE_UE_TRANSPORT/linear_preprocessing_rec.c deleted file mode 100644 index c1c1672088..0000000000 --- a/openair1/PHY/LTE_UE_TRANSPORT/linear_preprocessing_rec.c +++ /dev/null @@ -1,119 +0,0 @@ -/* These functions compute linear preprocessing for -the UE using LAPACKE and CBLAS modules of -LAPACK libraries. -MMSE and MMSE whitening filters are available. -Functions are using RowMajor storage of the -matrices, like in conventional C. Traditional -Fortran functions of LAPACK employ ColumnMajor -data storage. */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -//#define DEBUG_PREPROC -#include "common/utils/utils.h" - -static void conjugate_transpose(int N, float complex* A, float complex* Result) -{ - // Computes C := alpha*op(A)*op(B) + beta*C, - float complex alpha = 1.0 + I * 0; - float complex beta = 0.0+I*0; - float complex B[N][N]; - for (int i = 0; i < N; i++) - B[i][i] = 1.0 + I * 0; - cblas_cgemm(CblasRowMajor, CblasConjTrans, CblasNoTrans, N, N, N, &alpha, A, N, B, N, &beta, Result, N); -} - -static void H_hermH_plus_sigma2I(int N, float complex* A, float sigma2, float complex Result[N][N]) -{ - // C := alpha*op(A)*op(B) + beta*C, - float complex alpha = 1.0 + I * 0; - float complex beta = 1.0 + I * 0; - for (int i = 0; i < N; i++) - Result[i][i] = sigma2 * (1.0 + I * 0); - cblas_cgemm(CblasRowMajor, CblasConjTrans, CblasNoTrans, N, N, N, &alpha, A, N, A, N, &beta, Result, N); -} - -static void lin_eq_solver(int N, float complex* A, float complex* B, float complex* Result) -{ - int IPIV[N][N]; - - // Compute LU-factorization - LAPACKE_cgetrf(LAPACK_ROW_MAJOR, N, N, A, N, (int*)IPIV); - - // Solve AX=B - LAPACKE_cgetrs(LAPACK_ROW_MAJOR, 'N', N, N, A, N, (int*)IPIV, B, N); - - // cgetrs( "N", N, 4, A, lda, IPIV, B, ldb, INFO ) - - memcpy(Result, B, N * N * sizeof(float complex)); -} - -void mutl_matrix_matrix_col_based(float complex* M0, - float complex* M1, - int rows_M0, - int col_M0, - int rows_M1, - int col_M1, - float complex* Result) -{ - float complex alpha = 1.0; - float complex beta = 0.0; - cblas_cgemm(CblasColMajor, - CblasNoTrans, - CblasNoTrans, - rows_M0, - col_M1, - col_M0, - &alpha, - M0, - col_M0, - M1, - rows_M1, - &beta, - Result, - rows_M1); - -#ifdef DEBUG_PREPROC - for (i = 0; i < rows_M0 * col_M1; ++i) - printf(" result[%d] = (%f + i%f)\n", i , creal(Result[i]), cimag(Result[i])); -#endif -} - -/*FILTERS */ -void compute_MMSE(float complex* H, int order_H, float sigma2, float complex* W_MMSE) -{ - int N = order_H; - float complex H_hermH_sigmaI[N][N]; - memset(H_hermH_sigmaI, 0, sizeof(H_hermH_sigmaI)); - H_hermH_plus_sigma2I(N, H, sigma2, H_hermH_sigmaI); - -#ifdef DEBUG_PREPROC - int i =0; - for(i=0;i -#include -#include -#include -#include "PHY/defs_UE.h" - -/* FUNCTIONS FOR LINEAR PREPROCESSING: MMSE, WHITENNING, etc*/ -/* mutl_matrix_matrix_col_based performs multiplications matrix is column-oriented H[0], H[2]; H[1], H[3]*/ -void mutl_matrix_matrix_col_based(float complex* M0, float complex* M1, int rows_M0, int col_M0, int rows_M1, int col_M1, float complex* Result ); - -void compute_MMSE(float complex* H, int order_H, float sigma2, float complex* W_MMSE); From dcfd16bd83332f6155271efc69fd8ff982d8030c Mon Sep 17 00:00:00 2001 From: Teodora Date: Tue, 17 Feb 2026 09:58:24 +0100 Subject: [PATCH 11/37] Remove useless definitions for E&F releases in _BySymbol() functions Those functions are already encapsulated in #ifdef F_RELEASE condition. --- radio/fhi_72/oaioran.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/radio/fhi_72/oaioran.c b/radio/fhi_72/oaioran.c index d3ab42f985..0b5eb0e3a2 100644 --- a/radio/fhi_72/oaioran.c +++ b/radio/fhi_72/oaioran.c @@ -843,20 +843,8 @@ int xran_fh_rx_read_slot_BySymbol(ru_info_t *ru, int *frame, int *slot) struct xran_prb_map *pRbMap = pPrbMap; for (int idxElm = 0; idxElm < pRbMap->nPrbElm; idxElm++) { struct xran_prb_elm *pRbElm = &pRbMap->prbMap[idxElm]; -#ifdef E_RELEASE - struct xran_section_desc *p_sec_desc = pRbElm->p_sec_desc[sym_idx][0]; - uint32_t one_rb_size = - (((pRbElm->iqWidth == 0) || (pRbElm->iqWidth == 16)) ? (N_SC_PER_PRB * 2 * 2) : (3 * pRbElm->iqWidth + 1)); - if (fh_init->mtu < pRbElm->nRBSize * one_rb_size) - pData = bufs->dst[ant_id % nb_rx_per_ru][tti % XRAN_N_FE_BUF_LEN] - .pBuffers[sym_idx % XRAN_NUM_OF_SYMBOL_PER_SLOT] - .pData; - else - pData = p_sec_desc->pData; -#elif defined F_RELEASE struct xran_section_desc *p_sec_desc = &pRbElm->sec_desc[sym_idx][0]; pData = p_sec_desc->pData; -#endif ptr = pData; pos = (int32_t *)(start_ptr + (4 * sym_idx * fftsize)); if (ptr == NULL || pos == NULL) @@ -1129,11 +1117,7 @@ int xran_fh_tx_send_slot_BySymbol(ru_info_t *ru, int frame, int slot, uint64_t t p_prbMapElm->nBeamIndex = 0; // assumes one fragment per symbol -#ifdef E_RELEASE - p_sec_desc = p_prbMapElm->p_sec_desc[sym_id][0]; -#elif F_RELEASE p_sec_desc = &p_prbMapElm->sec_desc[sym_id][0]; -#endif dst = xran_add_hdr_offset(dst, p_prbMapElm->compMethod); From 7e74d4c43ef89cd33b335e2f597fa9fe482c7661 Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Thu, 12 Feb 2026 12:10:46 +0100 Subject: [PATCH 12/37] T: macpdu2wireshark: gentle exit When outputting to a file, typing ctrl+c exits the program without calling fclose(), leading to loss of traces in the output file. Let's intercept ctrl+c and exit gently, calling fclose(). --- common/utils/T/tracer/macpdu2wireshark.c | 29 ++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/common/utils/T/tracer/macpdu2wireshark.c b/common/utils/T/tracer/macpdu2wireshark.c index 831488d485..407e565bf3 100644 --- a/common/utils/T/tracer/macpdu2wireshark.c +++ b/common/utils/T/tracer/macpdu2wireshark.c @@ -1,6 +1,8 @@ #include #include #include +#include +#include #include #include #include @@ -387,6 +389,7 @@ void sr(void *_d, event e) #define MAC_NR_HARQID 0x06 #define MAC_NR_FRAME_SLOT_TAG 0x07 +#define NR_FDD_RADIO 1 #define NR_TDD_RADIO 2 #define NR_DIRECTION_UPLINK 0 @@ -948,6 +951,18 @@ void usage(void) exit(1); } +volatile int run = 1; + +static int sock = -1; + +void force_stop(int x) +{ + printf("\ngently quit...\n"); + close(sock); + sock = -1; + run = 0; +} + int main(int n, char **v) { char *database_filename = NULL; @@ -968,6 +983,9 @@ int main(int n, char **v) int live = 0; memset(&d, 0, sizeof(ev_data)); + /* write on a socket fails if the other end is closed and we get SIGPIPE */ + if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) abort(); + for (i = 0; i < 65536; i++) { d.lte_rnti_to_ueid[i] = -1; d.nr_rnti_to_ueid[i] = -1; @@ -1014,8 +1032,10 @@ int main(int n, char **v) perror(input_filename); return 1; } - } else + } else { in = connect_to(live_ip, live_port); + sock = in; + } database = parse_database(database_filename); load_config_file(database_filename); @@ -1121,10 +1141,15 @@ int main(int n, char **v) new_thread(receiver, &d); } + /* exit on ctrl+c and ctrl+z */ + if (signal(SIGQUIT, force_stop) == SIG_ERR) abort(); + if (signal(SIGINT, force_stop) == SIG_ERR) abort(); + if (signal(SIGTSTP, force_stop) == SIG_ERR) abort(); + OBUF ebuf = {.osize = 0, .omaxsize = 0, .obuf = NULL}; /* read messages */ - while (1) { + while (run) { event e; e = get_event(in, &ebuf, database); From 0c4655448f7f790bf4f80f627a7d63d3d34f188c Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Thu, 12 Feb 2026 12:14:39 +0100 Subject: [PATCH 13/37] T: minor: fix compilation of _check_vcd "make _check_vcd" was failing. --- common/utils/T/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/utils/T/Makefile b/common/utils/T/Makefile index e1b3d8c0c2..82797a93cc 100644 --- a/common/utils/T/Makefile +++ b/common/utils/T/Makefile @@ -21,7 +21,7 @@ incgen/T_IDs.h: $(GENIDS) T_messages.txt ./$(GENIDS) T_messages.txt incgen/T_IDs.h check_vcd: incgen/T_IDs.h incgen/T_messages.txt.h - gcc -Wall -I. -I.. -I../itti -I../../../openair2/COMMON -Itracer -o _check_vcd check_vcd.c tracer/database.c tracer/utils.c -lm -pthread + gcc -Wall -I. -I.. -I../../.. -I../itti -I../../../openair2/COMMON -Itracer -Iincgen -o _check_vcd check_vcd.c tracer/database.c tracer/utils.c -lm -pthread ./_check_vcd T_messages.txt ../LOG/vcd_signal_dumper.h || (rm -rf ./_check_vcd ./incgen && false) rm -f ./_check_vcd From 61bdee3e615eb69c9977cc47172ef435175e2bc0 Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Sat, 14 Feb 2026 15:30:46 +0100 Subject: [PATCH 14/37] T: extract: extract all traces by default --- common/utils/T/tracer/extract.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/common/utils/T/tracer/extract.c b/common/utils/T/tracer/extract.c index 445b166f09..a5490cdb16 100644 --- a/common/utils/T/tracer/extract.c +++ b/common/utils/T/tracer/extract.c @@ -18,6 +18,7 @@ void usage(void) " (you can use several -f options)\n" " -after 'event' time has to be greater than this\n" " -count dump 'n' matching events (less if EOF reached)\n" +" (default: no limit)\n" ); exit(1); } @@ -53,7 +54,7 @@ int main(int n, char **v) int filter_count = 0; int buffer_arg; int found; - int count = 1; + int count = -1; int check_time = 0; time_t sec = 0; /* initialization not necessary but gcc is not happy */ long nsec = 0; /* initialization not necessary but gcc is not happy */ @@ -132,12 +133,12 @@ int main(int n, char **v) if (fwrite(e.e[buffer_arg].b, e.e[buffer_arg].bsize, 1, out) != 1) { perror(output_file); exit(1); } found++; - if (found == count) + if (count != -1 && found == count) break; } if (found == 0) printf("ERROR: event not found\n"); - if (found != count) + if (count != -1 && found != count) printf("WARNING: dumped %d events (wanted %d)\n", found, count); fclose(out); From c1f41caa8dcfe6fe2d681082302160760d2e598b Mon Sep 17 00:00:00 2001 From: Cedric Roux Date: Sat, 14 Feb 2026 15:31:38 +0100 Subject: [PATCH 15/37] T: hacks: plot-ofdm: handle more skipped samples --- common/utils/T/tracer/hacks/plot-ofdm.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/common/utils/T/tracer/hacks/plot-ofdm.c b/common/utils/T/tracer/hacks/plot-ofdm.c index 3f6e0b9dce..cd73891172 100644 --- a/common/utils/T/tracer/hacks/plot-ofdm.c +++ b/common/utils/T/tracer/hacks/plot-ofdm.c @@ -135,7 +135,7 @@ int main(int n, char **v) int input_is_float = 0; int no_fft = 0; int delay = 0; - int skip = 0; + uint64_t skip = 0; int symbols_per_subframe; long sampling_rate = 61440000; int mu = 1; @@ -152,7 +152,7 @@ int main(int n, char **v) if (!strcmp(v[i], "-srate")) { if (i>n-2) usage(); sampling_rate = atol(v[++i]); continue; } if (!strcmp(v[i], "-prb")) { if (i>n-2) usage(); prb = atoi(v[++i]); continue; } if (!strcmp(v[i], "-mu")) { if (i>n-2) usage(); mu = atoi(v[++i]); continue; } - if (!strcmp(v[i], "-skip")) { if (i>n-2) usage(); skip = atoi(v[++i]); continue; } + if (!strcmp(v[i], "-skip")) { if (i>n-2) usage(); skip = atoll(v[++i]); continue; } usage(); } @@ -222,14 +222,14 @@ int main(int n, char **v) int back_color = 0; int hpixel = 0; - if (skip) { - if (input_is_float) { - float intime[skip * 2]; - if (fread(intime, skip * 8, 1, stdin) != 1) abort(); - } else { - short intime[skip * 2]; - if (fread(intime, skip * 4, 1, stdin) != 1) abort(); - } + /* skip data */ + int sample_size = input_is_float ? 8 : 4; + uint64_t to_skip = skip; + while (to_skip) { + char intime[4096 * sample_size]; + int count = to_skip > 4096 ? 4096 : to_skip; + if (fread(intime, count * sample_size, 1, stdin) != 1) abort(); + to_skip -= count; } while (1) { From f247a6cc2eeb2b3fc4169d88418a59b49a8a548e Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Fri, 13 Feb 2026 13:35:28 +0100 Subject: [PATCH 16/37] fix(RRC): add PCell to serving_cells in fallback path and refactor update logic Fix assertion failure in rrc_gNB_send_NGAP_NAS_FIRST_REQ() when RRC Reestablishment falls back to RRC Setup. The fallback path was not adding the PCell to the UE's serving_cells array, causing rrc_get_pcell_for_ue() to return NULL. Major changes: - Add rrc_update_ue_pcell() helper function that handles PCell updates for both new UEs (fallback) and existing UEs (normal reestablishment) - Refactor normal reestablishment path to use rrc_update_ue_pcell() helper instead of manual cleanup + add sequence - Add PCell update to fallback_rrc_setup path using the same helper - Move C-RNTI validation after current_cell fetch to ensure current_cell is initialized before fallback_rrc_setup label - Change error handling: return instead of fallback when PCell add fails in normal reestablishment path --- openair2/RRC/NR/rrc_gNB.c | 45 ++++++++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index a68ac6691e..50a8ed16e1 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -1490,6 +1490,26 @@ static const nr_rrc_cell_container_t *get_previous_cell_by_pci_in_du(gNB_RRC_INS return rrc_get_cell_by_pci_for_du(&du->cells, pci); } +/** @brief Update UE's PCell in serving_cells array + * @param[in] UE UE context + * @param[in] cell Cell container to set as PCell + * @return Pointer to added serving cell entry, or NULL on failure + * @note If UE already has a PCell, removes all serving cells from the old PCell's DU first */ +static ue_serving_cell_t *rrc_update_ue_pcell(gNB_RRC_UE_t *UE, const nr_rrc_cell_container_t *cell) +{ + DevAssert(UE != NULL); + DevAssert(cell != NULL); + + // If UE already has a PCell, remove all serving cells from that DU first + const ue_serving_cell_t *existing_pcell = ue_get_pcell_entry(UE); + if (existing_pcell != NULL) { + rrc_remove_ue_scells_from_du(UE, existing_pcell->assoc_id); + } + + // Add the new PCell + return rrc_add_ue_serving_cell(UE, cell, RRC_PCELL_INDEX); +} + static void rrc_handle_RRCReestablishmentRequest(gNB_RRC_INST *rrc, sctp_assoc_t assoc_id, const NR_RRCReestablishmentRequest_IEs_t *req, @@ -1501,6 +1521,7 @@ static void rrc_handle_RRCReestablishmentRequest(gNB_RRC_INST *rrc, long ngap_cause = NGAP_CAUSE_RADIO_NETWORK_UNSPECIFIED; /* cause in case of NGAP release req */ const rnti_t old_rnti = req->ue_Identity.c_RNTI; rrc_gNB_ue_context_t *ue_context_p = NULL; + ue_serving_cell_t *added = NULL; LOG_I(NR_RRC, "Reestablishment RNTI %04x req C-RNTI %04x physCellId %ld cause %s\n", msg->crnti, @@ -1514,12 +1535,6 @@ static void rrc_handle_RRCReestablishmentRequest(gNB_RRC_INST *rrc, return; } - // Validate C-RNTI range (3GPP TS 38.321 version 15.13.0 Section 7.1 Table 7.1-1) - if (old_rnti < 0x1 || old_rnti > 0xffef) { - LOG_E(NR_RRC, "NR_RRCReestablishmentRequest c_RNTI %04x range error, fallback to RRC setup\n", old_rnti); - goto fallback_rrc_setup; - } - // Fetch current cell: where the reestablishment request was received nr_rrc_cell_container_t *current_cell = get_cell_by_cell_id(&rrc->cells, msg->nr_cellid); if (current_cell == NULL || current_cell->assoc_id != du->assoc_id) { @@ -1530,6 +1545,12 @@ static void rrc_handle_RRCReestablishmentRequest(gNB_RRC_INST *rrc, return; } + // Validate C-RNTI range (3GPP TS 38.321 version 15.13.0 Section 7.1 Table 7.1-1) + if (old_rnti < 0x1 || old_rnti > 0xffef) { + LOG_E(NR_RRC, "NR_RRCReestablishmentRequest c_RNTI %04x range error, fallback to RRC setup\n", old_rnti); + goto fallback_rrc_setup; + } + if (current_cell->mtc == NULL) { // some UEs don't send MeasurementTimingConfiguration, so we don't know the // SSB ARFCN and can't do reestablishment. handle it gracefully by doing @@ -1660,14 +1681,10 @@ static void rrc_handle_RRCReestablishmentRequest(gNB_RRC_INST *rrc, /* Update PCell in serving_cells array */ DevAssert(cell->info.cell_id == msg->nr_cellid); - // Reset the serving set to the new PCell, remove all serving cells from the current PCell's DU. - const ue_serving_cell_t *existing_pcell = ue_get_pcell_entry(UE); - DevAssert(existing_pcell != NULL); - rrc_remove_ue_scells_from_du(UE, existing_pcell->assoc_id); - ue_serving_cell_t *added = rrc_add_ue_serving_cell(UE, cell, RRC_PCELL_INDEX); + added = rrc_update_ue_pcell(UE, cell); if (added == NULL) { - LOG_E(NR_RRC, "Reestablishment: failed to add PCell (cell %ld), rejecting reestablishment\n", cell->info.cell_id); - goto fallback_rrc_setup; + LOG_E(NR_RRC, "Reestablishment: failed to add PCell (cell %ld)\n", cell->info.cell_id); + return; } ue_data.secondary_ue = msg->gNB_DU_ue_id; @@ -1688,6 +1705,8 @@ fallback_rrc_setup: rrc_gNB_ue_context_t *new = rrc_gNB_create_ue_context(assoc_id, msg->crnti, rrc, random_value, msg->gNB_DU_ue_id); activate_srb(&new->ue_context, 1); + added = rrc_update_ue_pcell(&new->ue_context, current_cell); + DevAssert(added); rrc_gNB_generate_RRCSetup(0, msg->crnti, new, msg->du2cu_rrc_container, msg->du2cu_rrc_container_length); return; } From 372f121cf6e0f20cacb7f13dd839efdb19609edb Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Mon, 16 Feb 2026 10:26:21 +0100 Subject: [PATCH 17/37] Refactor (RRC): extract rrc_update_ue_pcell() to public API and adopt consistently Move rrc_update_ue_pcell() from static function in rrc_gNB.c to public function in rrc_cell_management.c, making it reusable across RRC code paths. Replace duplicate PCell addition logic in handover paths (intra-CU and inter-CU) and RRCSetup path with calls to this shared function. This eliminates code duplication between handover and RRCSetup paths, centralizes PCell update logic (including cleanup of old PCell's DU serving cells) in a single reusable function and makes the function available for future use in other RRC procedures --- openair2/RRC/NR/rrc_cell_management.c | 19 ++++++++++++++ openair2/RRC/NR/rrc_cell_management.h | 1 + openair2/RRC/NR/rrc_gNB.c | 29 +++++--------------- openair2/RRC/NR/rrc_gNB_mobility.c | 38 +++++++++------------------ 4 files changed, 39 insertions(+), 48 deletions(-) diff --git a/openair2/RRC/NR/rrc_cell_management.c b/openair2/RRC/NR/rrc_cell_management.c index 0df2665c04..844ee6ffdc 100644 --- a/openair2/RRC/NR/rrc_cell_management.c +++ b/openair2/RRC/NR/rrc_cell_management.c @@ -409,3 +409,22 @@ nr_rrc_cell_container_t *rrc_get_pcell_for_ue(gNB_RRC_INST *rrc, const gNB_RRC_U return get_cell_by_cell_id(&rrc->cells, pcell_entry->nci); } +/** @brief Update UE's PCell in serving_cells array + * @param[in] UE UE context + * @param[in] cell Cell container to set as PCell + * @return Pointer to added serving cell entry, or NULL on failure + * @note If UE already has a PCell, removes all serving cells from the old PCell's DU first */ +ue_serving_cell_t *rrc_update_ue_pcell(gNB_RRC_UE_t *UE, const nr_rrc_cell_container_t *cell) +{ + DevAssert(UE != NULL); + DevAssert(cell != NULL); + + // If UE already has a PCell, remove all serving cells from that DU first + const ue_serving_cell_t *existing_pcell = ue_get_pcell_entry(UE); + if (existing_pcell != NULL) { + rrc_remove_ue_scells_from_du(UE, existing_pcell->assoc_id); + } + + // Add the new PCell + return rrc_add_ue_serving_cell(UE, cell, RRC_PCELL_INDEX); +} diff --git a/openair2/RRC/NR/rrc_cell_management.h b/openair2/RRC/NR/rrc_cell_management.h index 99071cceb2..d24fd095dd 100644 --- a/openair2/RRC/NR/rrc_cell_management.h +++ b/openair2/RRC/NR/rrc_cell_management.h @@ -69,5 +69,6 @@ void rrc_remove_ue_scells_from_du(gNB_RRC_UE_t *ue, sctp_assoc_t assoc_id); ue_serving_cell_t *rrc_get_ue_serving_cell_by_id(const gNB_RRC_UE_t *ue, uint8_t serving_cell_id); const ue_serving_cell_t *ue_get_pcell_entry(const gNB_RRC_UE_t *ue); nr_rrc_cell_container_t *rrc_get_pcell_for_ue(gNB_RRC_INST *rrc, const gNB_RRC_UE_t *ue); +ue_serving_cell_t *rrc_update_ue_pcell(gNB_RRC_UE_t *UE, const nr_rrc_cell_container_t *cell); #endif /* RRC_CELL_MANAGEMENT_H_ */ diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 50a8ed16e1..704317febe 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -1416,8 +1416,13 @@ static void rrc_handle_RRCSetupRequest(gNB_RRC_INST *rrc, rrc_gNB_generate_RRCReject(rrc, ue_context_p); return; } - /* Add PCell to serving_cells array */ - rrc_add_ue_serving_cell(UE, cell, RRC_PCELL_INDEX); + /* Update PCell in serving_cells array */ + ue_serving_cell_t *added = rrc_update_ue_pcell(UE, cell); + if (added == NULL) { + LOG_E(NR_RRC, "RRCSetup: failed to add PCell (cell %ld)\n", cell->info.cell_id); + rrc_gNB_generate_RRCReject(rrc, ue_context_p); + return; + } UE->ongoing_reconfiguration = false; UE->measConfig = nr_rrc_get_measconfig(rrc, msg->nr_cellid); activate_srb(UE, 1); @@ -1490,26 +1495,6 @@ static const nr_rrc_cell_container_t *get_previous_cell_by_pci_in_du(gNB_RRC_INS return rrc_get_cell_by_pci_for_du(&du->cells, pci); } -/** @brief Update UE's PCell in serving_cells array - * @param[in] UE UE context - * @param[in] cell Cell container to set as PCell - * @return Pointer to added serving cell entry, or NULL on failure - * @note If UE already has a PCell, removes all serving cells from the old PCell's DU first */ -static ue_serving_cell_t *rrc_update_ue_pcell(gNB_RRC_UE_t *UE, const nr_rrc_cell_container_t *cell) -{ - DevAssert(UE != NULL); - DevAssert(cell != NULL); - - // If UE already has a PCell, remove all serving cells from that DU first - const ue_serving_cell_t *existing_pcell = ue_get_pcell_entry(UE); - if (existing_pcell != NULL) { - rrc_remove_ue_scells_from_du(UE, existing_pcell->assoc_id); - } - - // Add the new PCell - return rrc_add_ue_serving_cell(UE, cell, RRC_PCELL_INDEX); -} - static void rrc_handle_RRCReestablishmentRequest(gNB_RRC_INST *rrc, sctp_assoc_t assoc_id, const NR_RRCReestablishmentRequest_IEs_t *req, diff --git a/openair2/RRC/NR/rrc_gNB_mobility.c b/openair2/RRC/NR/rrc_gNB_mobility.c index d18937fbc5..4d2785d9a0 100644 --- a/openair2/RRC/NR/rrc_gNB_mobility.c +++ b/openair2/RRC/NR/rrc_gNB_mobility.c @@ -453,36 +453,22 @@ bool nr_rrc_update_cell_assoc_after_ho(gNB_RRC_INST *rrc, gNB_RRC_UE_t *UE) return false; } - if (UE->ho_context->source) { - /* F1 HO (intra-CU): migrate serving cells from source DU to target cell */ - nr_ho_source_cu_t *source_ctx = UE->ho_context->source; - - // Remove SCells that belong to the source DU during handover (cell group changes) - // This also removes PCell if it was on the source DU - rrc_remove_ue_scells_from_du(UE, source_ctx->cell->assoc_id); - - // Update PCell in serving_cells - ue_serving_cell_t *added = rrc_add_ue_serving_cell(UE, target_ctx->cell, RRC_PCELL_INDEX); - if (added == NULL) { - LOG_E(NR_RRC, - "UE %d handover: failed to add PCell (cell %ld) to serving cells\n", - UE->rrc_ue_id, - target_ctx->cell->info.cell_id); - return false; - } - } else { + if (!UE->ho_context->source) { /* Inter-CU (N2/Xn target): this UE context has no serving cells yet */ const ue_serving_cell_t *existing_pcell = ue_get_pcell_entry(UE); AssertFatal(existing_pcell == NULL, "UE context should not have PCell yet (inter-CU target)\n"); + } - ue_serving_cell_t *added = rrc_add_ue_serving_cell(UE, target_ctx->cell, RRC_PCELL_INDEX); - if (added == NULL) { - LOG_E(NR_RRC, - "UE %d handover: failed to add PCell (cell %ld) to serving cells\n", - UE->rrc_ue_id, - target_ctx->cell->info.cell_id); - return false; - } + /* Update PCell: removes all serving cells from existing PCell's DU (if any) + * and adds the target cell as the new PCell. For F1 HO (intra-CU), this + * migrates serving cells from source DU to target DU. */ + ue_serving_cell_t *added = rrc_update_ue_pcell(UE, target_ctx->cell); + if (added == NULL) { + LOG_E(NR_RRC, + "UE %d handover: failed to add PCell (cell %ld) to serving cells\n", + UE->rrc_ue_id, + target_ctx->cell->info.cell_id); + return false; } return true; From 2da094dd6669e98bf19be76a83a869af4cb5ac38 Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Thu, 13 Nov 2025 15:25:32 +0100 Subject: [PATCH 18/37] Cleanup (NGAP): remove NR_HandoverPreparationInformation.h from NGAP includes this is not an NGAP header and does not belong to ngap_msg_includes.h --- openair3/NGAP/ngap_gNB_mobility_management.c | 1 + openair3/NGAP/ngap_msg_includes.h | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/openair3/NGAP/ngap_gNB_mobility_management.c b/openair3/NGAP/ngap_gNB_mobility_management.c index 95290f7bc3..d40112ff00 100644 --- a/openair3/NGAP/ngap_gNB_mobility_management.c +++ b/openair3/NGAP/ngap_gNB_mobility_management.c @@ -31,6 +31,7 @@ #include "ngap_gNB_management_procedures.h" #include "ngap_gNB_encoder.h" #include "ngap_gNB_itti_messaging.h" +#include "NR_HandoverPreparationInformation.h" #include "conversions.h" /** @brief UE Mobility Management: encode Handover Required diff --git a/openair3/NGAP/ngap_msg_includes.h b/openair3/NGAP/ngap_msg_includes.h index 2a861e2e32..485c9f26ac 100644 --- a/openair3/NGAP/ngap_msg_includes.h +++ b/openair3/NGAP/ngap_msg_includes.h @@ -102,7 +102,6 @@ #include "NGAP_PDUSessionResourceAdmittedItem.h" #include "NGAP_HandoverRequestAcknowledgeTransfer.h" #include "NGAP_QosFlowItemWithDataForwarding.h" -#include "NR_HandoverPreparationInformation.h" #include "NGAP_HandoverNotify.h" #include "NGAP_DRBsSubjectToStatusTransferItem.h" #include "NGAP_DRBStatusUL.h" From b27833fbd240221b8629bce3b02f0fc3b3342ec4 Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Mon, 29 Dec 2025 18:55:16 +0100 Subject: [PATCH 19/37] Cleanup (NGAP): remove unused message definitions * NGAP_PATH_SWITCH_REQ_LOG, NGAP_PATH_SWITCH_REQ_ACK_LOG * NGAP_UE_CTXT_MODIFICATION_RESP, NGAP_UE_CTXT_MODIFICATION_FAIL, NGAP_UE_CTXT_MODIFICATION_REQ --- openair2/COMMON/ngap_messages_def.h | 5 ----- openair2/COMMON/ngap_messages_types.h | 1 - 2 files changed, 6 deletions(-) diff --git a/openair2/COMMON/ngap_messages_def.h b/openair2/COMMON/ngap_messages_def.h index 26f607f884..09e893f874 100644 --- a/openair2/COMMON/ngap_messages_def.h +++ b/openair2/COMMON/ngap_messages_def.h @@ -47,8 +47,6 @@ MESSAGE_DEF(NGAP_PAGING_LOG , MESSAGE_PRIORITY_MED, IttiMsgText MESSAGE_DEF(NGAP_PDUSESSION_RELEASE_REQUEST_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_pdusession_release_request_log) MESSAGE_DEF(NGAP_PDUSESSION_RELEASE_RESPONSE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_pdusession_release_response_log) MESSAGE_DEF(NGAP_ERROR_INDICATION_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_error_indication_log) -MESSAGE_DEF(NGAP_PATH_SWITCH_REQ_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_path_switch_req_log) -MESSAGE_DEF(NGAP_PATH_SWITCH_REQ_ACK_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , ngap_path_switch_req_ack_log) /* gNB application layer -> NGAP messages */ MESSAGE_DEF(NGAP_REGISTER_GNB_REQ , MESSAGE_PRIORITY_MED, ngap_register_gnb_req_t , ngap_register_gnb_req) @@ -65,8 +63,6 @@ MESSAGE_DEF(NGAP_INITIAL_CONTEXT_SETUP_RESP, MESSAGE_PRIORITY_MED, ngap_initial_ MESSAGE_DEF(NGAP_INITIAL_CONTEXT_SETUP_FAIL, MESSAGE_PRIORITY_MED, ngap_initial_context_setup_fail_t, ngap_initial_context_setup_fail) MESSAGE_DEF(NGAP_NAS_NON_DELIVERY_IND , MESSAGE_PRIORITY_MED, ngap_nas_non_delivery_ind_t , ngap_nas_non_delivery_ind) MESSAGE_DEF(NGAP_UE_CONTEXT_RELEASE_COMPLETE, MESSAGE_PRIORITY_MED, ngap_ue_release_complete_t , ngap_ue_release_complete) -MESSAGE_DEF(NGAP_UE_CTXT_MODIFICATION_RESP , MESSAGE_PRIORITY_MED, ngap_ue_ctxt_modification_resp_t , ngap_ue_ctxt_modification_resp) -MESSAGE_DEF(NGAP_UE_CTXT_MODIFICATION_FAIL , MESSAGE_PRIORITY_MED, ngap_ue_ctxt_modification_fail_t , ngap_ue_ctxt_modification_fail) MESSAGE_DEF(NGAP_PDUSESSION_SETUP_RESP , MESSAGE_PRIORITY_MED, ngap_pdusession_setup_resp_t , ngap_pdusession_setup_resp) MESSAGE_DEF(NGAP_PDUSESSION_MODIFY_RESP , MESSAGE_PRIORITY_MED, ngap_pdusession_modify_resp_t , ngap_pdusession_modify_resp) MESSAGE_DEF(NGAP_PDUSESSION_RELEASE_RESPONSE , MESSAGE_PRIORITY_MED, ngap_pdusession_release_resp_t , ngap_pdusession_release_resp) @@ -81,7 +77,6 @@ MESSAGE_DEF(NGAP_DL_RAN_STATUS_TRANSFER, MESSAGE_PRIORITY_MED, ngap_ran_status_t /* NGAP -> RRC messages */ MESSAGE_DEF(NGAP_DOWNLINK_NAS , MESSAGE_PRIORITY_MED, ngap_downlink_nas_t , ngap_downlink_nas ) MESSAGE_DEF(NGAP_INITIAL_CONTEXT_SETUP_REQ , MESSAGE_PRIORITY_MED, ngap_initial_context_setup_req_t , ngap_initial_context_setup_req ) -MESSAGE_DEF(NGAP_UE_CTXT_MODIFICATION_REQ , MESSAGE_PRIORITY_MED, ngap_ue_ctxt_modification_req_t , ngap_ue_ctxt_modification_req) MESSAGE_DEF(NGAP_PAGING_IND , MESSAGE_PRIORITY_MED, ngap_paging_ind_t , ngap_paging_ind ) MESSAGE_DEF(NGAP_PDUSESSION_SETUP_REQ , MESSAGE_PRIORITY_MED, ngap_pdusession_setup_req_t , ngap_pdusession_setup_req ) MESSAGE_DEF(NGAP_PDUSESSION_MODIFY_REQ , MESSAGE_PRIORITY_MED, ngap_pdusession_modify_req_t , ngap_pdusession_modify_req ) diff --git a/openair2/COMMON/ngap_messages_types.h b/openair2/COMMON/ngap_messages_types.h index 111a131f39..52fce81c13 100644 --- a/openair2/COMMON/ngap_messages_types.h +++ b/openair2/COMMON/ngap_messages_types.h @@ -58,7 +58,6 @@ #define NGAP_DOWNLINK_NAS(mSGpTR) (mSGpTR)->ittiMsg.ngap_downlink_nas #define NGAP_INITIAL_CONTEXT_SETUP_REQ(mSGpTR) (mSGpTR)->ittiMsg.ngap_initial_context_setup_req -#define NGAP_UE_CTXT_MODIFICATION_REQ(mSGpTR) (mSGpTR)->ittiMsg.ngap_ue_ctxt_modification_req #define NGAP_UE_CONTEXT_RELEASE_COMMAND(mSGpTR) (mSGpTR)->ittiMsg.ngap_ue_release_command #define NGAP_UE_CONTEXT_RELEASE_COMPLETE(mSGpTR) (mSGpTR)->ittiMsg.ngap_ue_release_complete #define NGAP_PDUSESSION_SETUP_REQ(mSGpTR) (mSGpTR)->ittiMsg.ngap_pdusession_setup_req From 3c164ef138f5f7eb58ab58a5b5313ea68ffc494a Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Mon, 29 Dec 2025 19:41:10 +0100 Subject: [PATCH 20/37] Minor (NGAP): clarify ngap_register_gnb_req_t actually refers to NG SETUP REQUEST There is no such thing as NG Register message, the naming is inaccurate, however the goal of this commit is only to clarify that and major refactoring is not yet carried out. --- openair2/COMMON/ngap_messages_types.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/openair2/COMMON/ngap_messages_types.h b/openair2/COMMON/ngap_messages_types.h index 52fce81c13..a8f787812c 100644 --- a/openair2/COMMON/ngap_messages_types.h +++ b/openair2/COMMON/ngap_messages_types.h @@ -351,7 +351,11 @@ typedef struct { } ngap_plmn_t; //-------------------------------------------------------------------------------------------// -// gNB application layer -> NGAP messages + +/** @brief NG SETUP REQUEST message (9.2.6.1 of 3GPP TS 38.413) + * This message is sent by the NG-RAN node to transfer application layer information + * for an NG-C interface instance. + * Direction: NG-RAN node -> AMF */ typedef struct ngap_register_gnb_req_s { /* Unique gNB_id to identify the gNB within EPC. * For macro gNB ids this field should be 20 bits long. From f295252b2e1805239fd76eefae169ef3601b4660 Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Wed, 12 Nov 2025 17:32:04 +0100 Subject: [PATCH 21/37] Refactor 5G-S-TMSI: harmonize 5G-S-TMSI handling with centralized helpers Centralizes 5G-S-TMSI bit manipulation logic for consistency and maintainability. All manual bit operations replaced with documented helper functions following TS 23.003 bit layout specification. - Add helper functions for 5G-S-TMSI operations: * nr_construct_5g_s_tmsi_part1: 5G-S-TMSI construction is defined in 3GPP TS 23.003 and relevant at both gNB and UE side * Add helper functions to be later used in NG Paging * Adopt in NAS UE * nr_extract_5g_s_tmsi_part1() - extract Part1 (39 bits) from full * nr_extract_5g_s_tmsi_part2() - extract Part2 (9 bits) from full * nr_build_full_5g_s_tmsi() - reconstruct full from Part1+Part2 * nr_deconstruct_5g_s_tmsi() - deconstruct into components - Refactor manual bit manipulation to use helper functions: * asn1_msg.c: use nr_extract_5g_s_tmsi_part1() in RRCSetupRequest * asn1_msg.c: use nr_extract_5g_s_tmsi_part2() in RRCSetupComplete * rrc_gNB.c: use nr_build_full_5g_s_tmsi() when reconstructing from parts * rrc_gNB.c: use nr_deconstruct_5g_s_tmsi() when extracting components - Optimize nr_construct_5g_s_tmsi_part1() to reuse extract function --- common/utils/nr/nr_common.c | 57 ++++++++++++++++++- common/utils/nr/nr_common.h | 12 ++++ openair2/RRC/NR/MESSAGES/asn1_msg.c | 4 +- openair2/RRC/NR/MESSAGES/tests/CMakeLists.txt | 2 +- openair2/RRC/NR/rrc_gNB.c | 10 ++-- 5 files changed, 77 insertions(+), 8 deletions(-) diff --git a/common/utils/nr/nr_common.c b/common/utils/nr/nr_common.c index b370b8da66..a3a8520c86 100644 --- a/common/utils/nr/nr_common.c +++ b/common/utils/nr/nr_common.c @@ -1463,6 +1463,18 @@ uint64_t nr_construct_5g_s_tmsi(uint16_t amf_set_id, uint8_t amf_pointer, uint32 return ((uint64_t)amf_set_id << 38) | ((uint64_t)amf_pointer << 32) | m_tmsi; } +/** @brief Extract 5G-S-TMSI-Part1 from full 5G-S-TMSI + * @param fiveg_s_tmsi Full 5G-S-TMSI (48 bits) + * @return 5G-S-TMSI-Part1 (rightmost 39 bits) + * @note 5G-S-TMSI-Part1 is the rightmost 39 bits of the full 5G-S-TMSI: + * - Bits 32-37: AMF Pointer (6 bits) + * - Bits 0-31: 5G-TMSI (32 bits) + * @ref 3GPP TS 23.003 */ +uint64_t nr_extract_5g_s_tmsi_part1(const uint64_t fiveg_s_tmsi) +{ + return fiveg_s_tmsi & ((1ULL << 39) - 1); +} + /** @brief Construct 5G-S-TMSI-Part1 from 5G-S-TMSI components * @param amf_set_id AMF Set ID (10 bits) * @param amf_pointer AMF Pointer (6 bits) @@ -1476,5 +1488,48 @@ uint64_t nr_construct_5g_s_tmsi_part1(uint16_t amf_set_id, uint8_t amf_pointer, { // Construct full 5G-S-TMSI and extract Part1: rightmost 39 bits uint64_t full_s_tmsi = nr_construct_5g_s_tmsi(amf_set_id, amf_pointer, m_tmsi); - return full_s_tmsi & ((1ULL << 39) - 1); + return nr_extract_5g_s_tmsi_part1(full_s_tmsi); +} + +/** @brief Extract 5G-S-TMSI-Part2 from full 5G-S-TMSI + * @param fiveg_s_tmsi Full 5G-S-TMSI (48 bits) + * @return 5G-S-TMSI-Part2 (leftmost 9 bits) + * @note 5G-S-TMSI-Part2 is the leftmost 9 bits of the full 5G-S-TMSI: + * - Bits 39-47: AMF Set ID (9 bits) + * @ref 3GPP TS 23.003 */ +uint16_t nr_extract_5g_s_tmsi_part2(const uint64_t fiveg_s_tmsi) +{ + return (fiveg_s_tmsi >> 39) & ((1ULL << 9) - 1); +} + +/** @brief Build full 5G-S-TMSI from Part1 and Part2 + * @param part1 5G-S-TMSI-Part1 (rightmost 39 bits) + * @param part2 5G-S-TMSI-Part2 (leftmost 9 bits) + * @return Full 5G-S-TMSI (48 bits) + * @note Combines Part2 (leftmost 9 bits) and Part1 (rightmost 39 bits) + * @ref 3GPP TS 23.003 */ +uint64_t nr_build_full_5g_s_tmsi(const uint64_t part1, const uint16_t part2) +{ + return ((uint64_t)part2 << 39) | part1; +} + +/** @brief Deconstruct full 5G-S-TMSI into its components + * @param fiveg_s_tmsi Full 5G-S-TMSI (48 bits) + * @param[out] amf_set_id Pointer to store AMF Set ID (10 bits) + * @param[out] amf_pointer Pointer to store AMF Pointer (6 bits) + * @param[out] m_tmsi Pointer to store 5G-TMSI (32 bits) + * @note The 5G-S-TMSI is deconstructed from a 48-bit value: + * - Bits 38-47: AMF Set ID (10 bits) + * - Bits 32-37: AMF Pointer (6 bits) + * - Bits 0-31: 5G-TMSI (32 bits) + * @ref 3GPP TS 23.003 */ +void nr_deconstruct_5g_s_tmsi(const uint64_t fiveg_s_tmsi, uint16_t *amf_set_id, uint8_t *amf_pointer, uint32_t *m_tmsi) +{ + DevAssert(amf_set_id != NULL); + DevAssert(amf_pointer != NULL); + DevAssert(m_tmsi != NULL); + + *amf_set_id = fiveg_s_tmsi >> 38; + *amf_pointer = (fiveg_s_tmsi >> 32) & 0x3F; + *m_tmsi = fiveg_s_tmsi; } diff --git a/common/utils/nr/nr_common.h b/common/utils/nr/nr_common.h index ada9813373..ca867fa694 100644 --- a/common/utils/nr/nr_common.h +++ b/common/utils/nr/nr_common.h @@ -360,6 +360,18 @@ uint64_t nr_construct_5g_s_tmsi(uint16_t amf_set_id, uint8_t amf_pointer, uint32 /** @brief Construct 5G-S-TMSI-Part1 from 5G-S-TMSI components */ uint64_t nr_construct_5g_s_tmsi_part1(uint16_t amf_set_id, uint8_t amf_pointer, uint32_t m_tmsi); +/** @brief Extract 5G-S-TMSI-Part1 from full 5G-S-TMSI */ +uint64_t nr_extract_5g_s_tmsi_part1(const uint64_t fiveg_s_tmsi); + +/** @brief Extract 5G-S-TMSI-Part2 from full 5G-S-TMSI */ +uint16_t nr_extract_5g_s_tmsi_part2(const uint64_t fiveg_s_tmsi); + +/** @brief Build full 5G-S-TMSI from Part1 and Part2 */ +uint64_t nr_build_full_5g_s_tmsi(const uint64_t part1, const uint16_t part2); + +/** @brief Deconstruct full 5G-S-TMSI into its components */ +void nr_deconstruct_5g_s_tmsi(const uint64_t fiveg_s_tmsi, uint16_t *amf_set_id, uint8_t *amf_pointer, uint32_t *m_tmsi); + #define CEILIDIV(a,b) ((a+b-1)/b) #define ROUNDIDIV(a,b) (((a<<1)+b)/(b<<1)) #define BOUNDED_EVAL(a, b, c) (min(c, max(a, b))) diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 57fb3daf12..a377236485 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -716,7 +716,7 @@ int do_RRCSetupRequest(uint8_t *buffer, size_t buffer_size, uint8_t *rv, uint64_ str->buf[3] = rv[3]; str->buf[4] = rv[4] & 0xfe; } else { - uint64_t fiveG_S_TMSI_part1 = fiveG_S_TMSI & ((1ULL << 39) - 1); + uint64_t fiveG_S_TMSI_part1 = nr_extract_5g_s_tmsi_part1(fiveG_S_TMSI); /** set the ue-Identity to ng-5G-S-TMSI-Part1 * ng-5G-S-TMSI-Part1: the rightmost 39 bits of 5G-S-TMSI * BIT STRING (SIZE (39)) - 3GPP TS 38.331 */ @@ -840,7 +840,7 @@ int do_RRCSetupComplete(uint8_t *buffer, str->size = 2; str->bits_unused = 7; str->buf = calloc_or_fail(str->size, sizeof(str->buf[0])); - uint16_t fiveG_s_tmsi_part2 = (fiveG_s_tmsi >> 39) & ((1ULL << 9) - 1); + uint16_t fiveG_s_tmsi_part2 = nr_extract_5g_s_tmsi_part2(fiveG_s_tmsi); str->buf[0] = (fiveG_s_tmsi_part2 >> (8 - str->bits_unused)) & 0xFF; str->buf[1] = (fiveG_s_tmsi_part2 << str->bits_unused) & 0xFF; LOG_D(NR_RRC, "5G-S-TMSI part 2 %d in RRCSetupComplete (5G-S-TMSI %ld)\n", fiveG_s_tmsi_part2, fiveG_s_tmsi); diff --git a/openair2/RRC/NR/MESSAGES/tests/CMakeLists.txt b/openair2/RRC/NR/MESSAGES/tests/CMakeLists.txt index 980d6160e8..ee462ba7a6 100644 --- a/openair2/RRC/NR/MESSAGES/tests/CMakeLists.txt +++ b/openair2/RRC/NR/MESSAGES/tests/CMakeLists.txt @@ -2,7 +2,7 @@ add_executable(test_asn1_msg test_asn1_msg.cpp ${OPENAIR2_DIR}/LAYER2/nr_pdcp/asn1_utils.c ${OPENAIR2_DIR}/LAYER2/nr_rlc/asn1_utils.c) -target_link_libraries(test_asn1_msg PRIVATE nr_rrc SECURITY minimal_lib GTest::gtest UTIL) +target_link_libraries(test_asn1_msg PRIVATE nr_rrc SECURITY minimal_lib GTest::gtest UTIL nr_common) add_dependencies(tests test_asn1_msg) add_test(NAME test_asn1_msg COMMAND ./test_asn1_msg) diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index a68ac6691e..4b0acd44d4 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -60,6 +60,7 @@ #include "common/openairinterface5g_limits.h" #include "common/platform_constants.h" #include "common/ran_context.h" +#include "common/utils/nr/nr_common.h" #include "common_lib.h" #include "constr_SEQUENCE.h" #include "constr_TYPE.h" @@ -2073,7 +2074,7 @@ static void handle_rrcSetupComplete(gNB_RRC_INST *rrc, gNB_RRC_UE_t *UE, const N uint16_t stmsi_part2 = BIT_STRING_to_uint16(part2); LOG_I(RRC, "s_tmsi part2 %d (%02x %02x)\n", stmsi_part2, part2->buf[0], part2->buf[1]); // Part2 is leftmost 9, Part1 is rightmost 39 bits of 5G-S-TMSI - fiveg_s_TMSI = ((uint64_t) stmsi_part2) << 39 | UE->ng_5G_S_TMSI_Part1; + fiveg_s_TMSI = nr_build_full_5g_s_tmsi(UE->ng_5G_S_TMSI_Part1, stmsi_part2); } else { LOG_W(RRC, "UE %d received 5G-S-TMSI-Part2, but no 5G-S-TMSI-Part1 present, won't send 5G-S-TMSI to core\n", UE->rrc_ue_id); UE->Initialue_identity_5g_s_TMSI.presence = false; @@ -2090,9 +2091,10 @@ static void handle_rrcSetupComplete(gNB_RRC_INST *rrc, gNB_RRC_UE_t *UE, const N } if (UE->Initialue_identity_5g_s_TMSI.presence) { - uint16_t amf_set_id = fiveg_s_TMSI >> 38; - uint8_t amf_pointer = (fiveg_s_TMSI >> 32) & 0x3F; - uint32_t fiveg_tmsi = (uint32_t) fiveg_s_TMSI; + uint16_t amf_set_id; + uint8_t amf_pointer; + uint32_t fiveg_tmsi; + nr_deconstruct_5g_s_tmsi(fiveg_s_TMSI, &amf_set_id, &amf_pointer, &fiveg_tmsi); LOG_I(NR_RRC, "5g_s_TMSI: 0x%lX, amf_set_id: 0x%X (%d), amf_pointer: 0x%X (%d), 5g TMSI: 0x%X \n", fiveg_s_TMSI, From 563a0cfa617dec79a6adceb244c28444bfaf8d9a Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Wed, 11 Feb 2026 19:37:26 +0100 Subject: [PATCH 22/37] Refactor: unify equality-check macros across protocol libs This commit centralizes equality-check behavior and removes duplicated macro implementations across protocol stacks. Major changes: - add `common/utils/eq_check.h` with shared `_EQ_CHECK_*`, `EQ_CHECK_GENERIC`, and optional-IE pointer helpers - replace E1AP/F1AP/NAS local equality macros and call sites with the shared helpers - remove duplicated layer-specific error/equality macro definitions from common headers and switch includes to `eq_check.h` - update CMake test flags to define `ENABLE_TESTS` for `e1ap_lib`, and 5GS NAS libraries; drop `E1AP_LOG_ERRORS` - equality-check/error printing is now consistently controlled by `ENABLE_TESTS` --- common/utils/eq_check.h | 81 +++ openair2/E1AP/CMakeLists.txt | 4 - openair2/E1AP/lib/CMakeLists.txt | 4 + .../E1AP/lib/e1ap_bearer_context_management.c | 415 ++++++------ openair2/E1AP/lib/e1ap_interface_management.c | 82 +-- openair2/E1AP/lib/e1ap_lib_common.h | 46 +- openair2/F1AP/lib/f1ap_interface_management.c | 255 ++++---- openair2/F1AP/lib/f1ap_lib_common.c | 40 +- openair2/F1AP/lib/f1ap_lib_common.h | 26 +- openair2/F1AP/lib/f1ap_positioning.c | 606 +++++++++--------- openair2/F1AP/lib/f1ap_rrc_message_transfer.c | 40 +- openair2/F1AP/lib/f1ap_ue_context.c | 318 ++++----- .../5GS/5GMM/MSG/FGSNASSecurityModeReject.c | 3 +- .../NR_UE/5GS/5GMM/MSG/RegistrationAccept.c | 63 +- .../5GMM/MSG/fgmm_authentication_failure.c | 11 +- .../5GS/5GMM/MSG/fgmm_authentication_reject.c | 5 +- .../5GS/5GMM/MSG/fgmm_identity_request.c | 3 +- openair3/NAS/NR_UE/5GS/5GMM/MSG/fgmm_lib.c | 23 +- .../NR_UE/5GS/5GMM/MSG/fgmm_service_accept.c | 23 +- .../NR_UE/5GS/5GMM/MSG/fgmm_service_reject.c | 19 +- .../5GSM/MSG/PduSessionEstablishmentAccept.c | 2 +- openair3/NAS/NR_UE/5GS/CMakeLists.txt | 7 + openair3/NAS/NR_UE/5GS/fgs_nas_lib.c | 13 +- openair3/NAS/NR_UE/5GS/fgs_nas_utils.h | 20 +- 24 files changed, 1059 insertions(+), 1050 deletions(-) create mode 100644 common/utils/eq_check.h diff --git a/common/utils/eq_check.h b/common/utils/eq_check.h new file mode 100644 index 0000000000..993e247fe8 --- /dev/null +++ b/common/utils/eq_check.h @@ -0,0 +1,81 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#ifndef EQ_CHECK_H_ +#define EQ_CHECK_H_ + +#include +#include + +/* + * Layers may override PRINT_ERROR() before including this header to preserve + * custom logging style (for example by mapping it to a local PRINT_ERROR()). + */ + +#ifndef PRINT_ERROR +#ifdef ENABLE_TESTS +#define PRINT_ERROR(fmt, ...) fprintf(stderr, "%s:%d: " fmt, __FILE__, __LINE__, ##__VA_ARGS__) +#else +#define PRINT_ERROR(...) \ + do { \ + } while (0) +#endif +#endif + +#ifndef EQ_CHECK_FAIL +#define EQ_CHECK_FAIL() return false +#endif + +#define EQ_CHECK_GENERIC(condition, fmt, ...) \ + do { \ + if (!(condition)) { \ + PRINT_ERROR("Equality condition '%s' failed: " fmt " != " fmt "\n", #condition, ##__VA_ARGS__); \ + EQ_CHECK_FAIL(); \ + } \ + } while (0) + +#define _EQ_CHECK_LONG(A, B) EQ_CHECK_GENERIC((A) == (B), "%ld", (A), (B)) +#define _EQ_CHECK_INT(A, B) EQ_CHECK_GENERIC((A) == (B), "%d", (A), (B)) +#define _EQ_CHECK_UINT32(A, B) EQ_CHECK_GENERIC((A) == (B), "%u", (A), (B)) +#define _EQ_CHECK_UINT64(A, B) EQ_CHECK_GENERIC((A) == (B), "%" PRIu64, (uint64_t)(A), (uint64_t)(B)) +#define _EQ_CHECK_STR(A, B) EQ_CHECK_GENERIC(strcmp((A), (B)) == 0, "'%s'", (A), (B)) + +#define _EQ_CHECK_OPTIONAL_IE(A, B, FIELD, EQ_MACRO) \ + do { \ + EQ_CHECK_GENERIC((((A)->FIELD) != NULL) == (((B)->FIELD) != NULL), "%d", ((A)->FIELD) != NULL, ((B)->FIELD) != NULL); \ + if ((A)->FIELD && (B)->FIELD) \ + EQ_MACRO(*(A)->FIELD, *(B)->FIELD); \ + } while (0) + +#define _EQ_CHECK_OPTIONAL_PTR(A, B, FIELD) \ + do { \ + if ((((A)->FIELD) != NULL) != (((B)->FIELD) != NULL)) { \ + PRINT_ERROR("%s:%d: optional IE '%s' not allocated: %p, %p\n", \ + __FILE__, \ + __LINE__, \ + #FIELD, \ + (void *)(A)->FIELD, \ + (void *)(B)->FIELD); \ + EQ_CHECK_FAIL(); \ + } \ + } while (0) + +#endif /* EQ_CHECK_H_ */ diff --git a/openair2/E1AP/CMakeLists.txt b/openair2/E1AP/CMakeLists.txt index eb3bd0f546..5849a32fe5 100644 --- a/openair2/E1AP/CMakeLists.txt +++ b/openair2/E1AP/CMakeLists.txt @@ -10,7 +10,3 @@ target_include_directories(e1ap PUBLIC ${CMAKE_CURRENT_DIR}) if(ENABLE_TESTS) add_subdirectory(tests) endif() - -if(ENABLE_TESTS) - target_compile_definitions(e1ap PRIVATE E1AP_LOG_ERRORS) -endif() diff --git a/openair2/E1AP/lib/CMakeLists.txt b/openair2/E1AP/lib/CMakeLists.txt index 332986dffb..9581853b15 100644 --- a/openair2/E1AP/lib/CMakeLists.txt +++ b/openair2/E1AP/lib/CMakeLists.txt @@ -9,3 +9,7 @@ target_include_directories(e1ap_lib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ) +if(ENABLE_TESTS) + target_compile_definitions(e1ap_lib PRIVATE ENABLE_TESTS) +endif() + diff --git a/openair2/E1AP/lib/e1ap_bearer_context_management.c b/openair2/E1AP/lib/e1ap_bearer_context_management.c index 15c472b10d..4ccfe9f3a1 100644 --- a/openair2/E1AP/lib/e1ap_bearer_context_management.c +++ b/openair2/E1AP/lib/e1ap_bearer_context_management.c @@ -96,12 +96,12 @@ static bool e1_decode_security_info(security_information_t *out, const E1AP_Secu // User Plane Security Keys (M) (9.3.1.32) // Encryption Key (M) - _E1_EQ_CHECK_INT((int)in->uPSecuritykey.encryptionKey.size, E1AP_SECURITY_KEY_SIZE); + _EQ_CHECK_INT((int)in->uPSecuritykey.encryptionKey.size, E1AP_SECURITY_KEY_SIZE); memcpy(out->encryptionKey, in->uPSecuritykey.encryptionKey.buf, in->uPSecuritykey.encryptionKey.size); // Integrity Protection Key (O) if (in->uPSecuritykey.integrityProtectionKey) { E1AP_IntegrityProtectionKey_t *ipKey = in->uPSecuritykey.integrityProtectionKey; - _E1_EQ_CHECK_INT((int)ipKey->size, E1AP_SECURITY_KEY_SIZE); + _EQ_CHECK_INT((int)ipKey->size, E1AP_SECURITY_KEY_SIZE); memcpy(out->integrityProtectionKey, ipKey->buf, E1AP_SECURITY_KEY_SIZE); } else { memset(out->integrityProtectionKey, 0, E1AP_SECURITY_KEY_SIZE); @@ -132,7 +132,7 @@ static bool e1_decode_up_tnl_info(UP_TL_information_t *out, const E1AP_UP_TNL_In // GTP Tunnel struct E1AP_GTPTunnel *gTPTunnel = in->choice.gTPTunnel; AssertFatal(gTPTunnel != NULL, "item->nG_UL_UP_TNL_Information.choice.gTPTunnel is a mandatory IE"); - _E1_EQ_CHECK_INT(in->present, E1AP_UP_TNL_Information_PR_gTPTunnel); + _EQ_CHECK_INT(in->present, E1AP_UP_TNL_Information_PR_gTPTunnel); BIT_STRING_TO_TRANSPORT_LAYER_ADDRESS_IPv4(&gTPTunnel->transportLayerAddress, out->tlAddress); // GTP-TEID OCTET_STRING_TO_INT32(&gTPTunnel->gTP_TEID, out->teId); @@ -178,12 +178,12 @@ static bool e1_decode_pdcp_config(bearer_context_pdcp_config_t *out, const E1AP_ */ static bool eq_pdcp_config(const bearer_context_pdcp_config_t *a, const bearer_context_pdcp_config_t *b) { - _E1_EQ_CHECK_LONG(a->pDCP_SN_Size_UL, b->pDCP_SN_Size_UL); - _E1_EQ_CHECK_LONG(a->pDCP_SN_Size_DL, b->pDCP_SN_Size_DL); - _E1_EQ_CHECK_LONG(a->rLC_Mode, b->rLC_Mode); - _E1_EQ_CHECK_LONG(a->reorderingTimer, b->reorderingTimer); - _E1_EQ_CHECK_LONG(a->discardTimer, b->discardTimer); - _E1_EQ_CHECK_INT(a->pDCP_Reestablishment, b->pDCP_Reestablishment); + _EQ_CHECK_LONG(a->pDCP_SN_Size_UL, b->pDCP_SN_Size_UL); + _EQ_CHECK_LONG(a->pDCP_SN_Size_DL, b->pDCP_SN_Size_DL); + _EQ_CHECK_LONG(a->rLC_Mode, b->rLC_Mode); + _EQ_CHECK_LONG(a->reorderingTimer, b->reorderingTimer); + _EQ_CHECK_LONG(a->discardTimer, b->discardTimer); + _EQ_CHECK_INT(a->pDCP_Reestablishment, b->pDCP_Reestablishment); return true; } @@ -211,9 +211,9 @@ static bool e1_decode_sdap_config(bearer_context_sdap_config_t *out, const E1AP_ */ static bool eq_sdap_config(const bearer_context_sdap_config_t *a, const bearer_context_sdap_config_t *b) { - _E1_EQ_CHECK_LONG(a->defaultDRB, b->defaultDRB); - _E1_EQ_CHECK_INT(a->sDAP_Header_UL, b->sDAP_Header_UL); - _E1_EQ_CHECK_INT(a->sDAP_Header_DL, b->sDAP_Header_DL); + _EQ_CHECK_LONG(a->defaultDRB, b->defaultDRB); + _EQ_CHECK_INT(a->sDAP_Header_UL, b->sDAP_Header_UL); + _EQ_CHECK_INT(a->sDAP_Header_DL, b->sDAP_Header_DL); return true; } @@ -285,22 +285,22 @@ bool e1_decode_qos_flow_to_setup(qos_flow_to_setup_t *out, const E1AP_QoS_Flow_Q */ static bool eq_qos_flow(const qos_flow_to_setup_t *a, const qos_flow_to_setup_t *b) { - _E1_EQ_CHECK_LONG(a->qfi, b->qfi); + _EQ_CHECK_LONG(a->qfi, b->qfi); const ngran_allocation_retention_priority_t *arp_a = &a->qos_params.alloc_reten_priority; const ngran_allocation_retention_priority_t *arp_b = &b->qos_params.alloc_reten_priority; - _E1_EQ_CHECK_INT(arp_a->preemption_capability, arp_b->preemption_capability); - _E1_EQ_CHECK_INT(arp_a->preemption_vulnerability, arp_b->preemption_vulnerability); - _E1_EQ_CHECK_INT(arp_a->priority_level, arp_b->priority_level); + _EQ_CHECK_INT(arp_a->preemption_capability, arp_b->preemption_capability); + _EQ_CHECK_INT(arp_a->preemption_vulnerability, arp_b->preemption_vulnerability); + _EQ_CHECK_INT(arp_a->priority_level, arp_b->priority_level); const qos_characteristics_t *qos_a = &a->qos_params.qos_characteristics; const qos_characteristics_t *qos_b = &b->qos_params.qos_characteristics; - _E1_EQ_CHECK_INT(qos_a->qos_type, qos_b->qos_type); - _E1_EQ_CHECK_INT(qos_a->dynamic.fiveqi, qos_b->dynamic.fiveqi); - _E1_EQ_CHECK_INT(qos_a->dynamic.packet_delay_budget, qos_b->dynamic.packet_delay_budget); - _E1_EQ_CHECK_INT(qos_a->dynamic.packet_error_rate.per_exponent, qos_b->dynamic.packet_error_rate.per_exponent); - _E1_EQ_CHECK_INT(qos_a->dynamic.packet_error_rate.per_scalar, qos_b->dynamic.packet_error_rate.per_scalar); - _E1_EQ_CHECK_INT(qos_a->dynamic.qos_priority_level, qos_b->dynamic.qos_priority_level); - _E1_EQ_CHECK_INT(qos_a->non_dynamic.fiveqi, qos_b->non_dynamic.fiveqi); - _E1_EQ_CHECK_INT(qos_a->non_dynamic.qos_priority_level, qos_b->non_dynamic.qos_priority_level); + _EQ_CHECK_INT(qos_a->qos_type, qos_b->qos_type); + _EQ_CHECK_INT(qos_a->dynamic.fiveqi, qos_b->dynamic.fiveqi); + _EQ_CHECK_INT(qos_a->dynamic.packet_delay_budget, qos_b->dynamic.packet_delay_budget); + _EQ_CHECK_INT(qos_a->dynamic.packet_error_rate.per_exponent, qos_b->dynamic.packet_error_rate.per_exponent); + _EQ_CHECK_INT(qos_a->dynamic.packet_error_rate.per_scalar, qos_b->dynamic.packet_error_rate.per_scalar); + _EQ_CHECK_INT(qos_a->dynamic.qos_priority_level, qos_b->dynamic.qos_priority_level); + _EQ_CHECK_INT(qos_a->non_dynamic.fiveqi, qos_b->non_dynamic.fiveqi); + _EQ_CHECK_INT(qos_a->non_dynamic.qos_priority_level, qos_b->non_dynamic.qos_priority_level); return true; } @@ -386,10 +386,10 @@ static e1_pdcp_status_info_t decode_pdcp_status_info(const E1AP_PDCP_SN_Status_I static bool eq_pdcp_info(const e1_pdcp_status_info_t *a, const e1_pdcp_status_info_t *b) { - _E1_EQ_CHECK_INT(a->dl_count.hfn, b->dl_count.hfn); - _E1_EQ_CHECK_INT(a->dl_count.sn, b->dl_count.sn); - _E1_EQ_CHECK_INT(a->ul_count.hfn, b->ul_count.hfn); - _E1_EQ_CHECK_INT(a->ul_count.sn, b->ul_count.sn); + _EQ_CHECK_INT(a->dl_count.hfn, b->dl_count.hfn); + _EQ_CHECK_INT(a->dl_count.sn, b->dl_count.sn); + _EQ_CHECK_INT(a->ul_count.hfn, b->ul_count.hfn); + _EQ_CHECK_INT(a->ul_count.sn, b->ul_count.sn); return true; } @@ -398,12 +398,12 @@ static bool eq_pdcp_info(const e1_pdcp_status_info_t *a, const e1_pdcp_status_in */ static bool eq_drb_to_setup(const DRB_nGRAN_to_setup_t *a, const DRB_nGRAN_to_setup_t *b) { - _E1_EQ_CHECK_LONG(a->id, b->id); - _E1_EQ_CHECK_INT(a->numCellGroups, b->numCellGroups); + _EQ_CHECK_LONG(a->id, b->id); + _EQ_CHECK_INT(a->numCellGroups, b->numCellGroups); for (int i = 0; i < a->numCellGroups; i++) { - _E1_EQ_CHECK_INT(a->cellGroupList[i], b->cellGroupList[i]); + _EQ_CHECK_INT(a->cellGroupList[i], b->cellGroupList[i]); } - _E1_EQ_CHECK_INT(a->numQosFlow2Setup, b->numQosFlow2Setup); + _EQ_CHECK_INT(a->numQosFlow2Setup, b->numQosFlow2Setup); for (int i = 0; i < a->numQosFlow2Setup; i++) { if (!eq_qos_flow(&a->qosFlows[i], &b->qosFlows[i])) return false; @@ -474,13 +474,13 @@ static bool e1_decode_pdu_session_to_setup_item(pdu_session_to_setup_t *out, E1A PRINT_ERROR("Missing mandatory IE item->nG_UL_UP_TNL_Information.choice.gTPTunnel\n"); return false; } - _E1_EQ_CHECK_INT(item->nG_UL_UP_TNL_Information.present, E1AP_UP_TNL_Information_PR_gTPTunnel); + _EQ_CHECK_INT(item->nG_UL_UP_TNL_Information.present, E1AP_UP_TNL_Information_PR_gTPTunnel); CHECK_E1AP_DEC(e1_decode_up_tnl_info(&out->UP_TL_information, &item->nG_UL_UP_TNL_Information)); /* DRB To Setup List ( > 1 item ) */ E1AP_DRB_To_Setup_List_NG_RAN_t *drb2SetupList = &item->dRB_To_Setup_List_NG_RAN; - _E1_EQ_CHECK_GENERIC(drb2SetupList->list.count > 0, "%d", drb2SetupList->list.count, 0); + EQ_CHECK_GENERIC(drb2SetupList->list.count > 0, "%d", drb2SetupList->list.count, 0); out->numDRB2Setup = drb2SetupList->list.count; - _E1_EQ_CHECK_INT(out->numDRB2Setup, 1); // can only handle one DRB per PDU session + _EQ_CHECK_INT(out->numDRB2Setup, 1); // can only handle one DRB per PDU session for (int j = 0; j < drb2SetupList->list.count; j++) { DRB_nGRAN_to_setup_t *drb = out->DRBnGRanList + j; E1AP_DRB_To_Setup_Item_NG_RAN_t *drb2Setup = drb2SetupList->list.array[j]; @@ -492,7 +492,7 @@ static bool e1_decode_pdu_session_to_setup_item(pdu_session_to_setup_t *out, E1A CHECK_E1AP_DEC(e1_decode_pdcp_config(&drb->pdcp_config, &drb2Setup->pDCP_Configuration)); // Cell Group Information (M) E1AP_Cell_Group_Information_t *cellGroupList = &drb2Setup->cell_Group_Information; - _E1_EQ_CHECK_GENERIC(cellGroupList->list.count > 0, "%d", cellGroupList->list.count, 0); + EQ_CHECK_GENERIC(cellGroupList->list.count > 0, "%d", cellGroupList->list.count, 0); drb->numCellGroups = cellGroupList->list.count; for (int k = 0; k < cellGroupList->list.count; k++) { E1AP_Cell_Group_Information_Item_t *cg2Setup = cellGroupList->list.array[k]; @@ -542,8 +542,8 @@ void free_pdu_session_to_setup_item(const pdu_session_to_setup_t *msg) /** @brief Equality check for UP Transport Layer Information (3GPP TS 38.463 9.3.2.1)*/ static bool eq_up_tl_info(const UP_TL_information_t *a, const UP_TL_information_t *b) { - _E1_EQ_CHECK_INT(a->tlAddress, b->tlAddress); - _E1_EQ_CHECK_INT(a->teId, b->teId); + _EQ_CHECK_INT(a->tlAddress, b->tlAddress); + _EQ_CHECK_INT(a->teId, b->teId); return true; } @@ -552,17 +552,17 @@ static bool eq_up_tl_info(const UP_TL_information_t *a, const UP_TL_information_ */ static bool eq_pdu_session_item(const pdu_session_to_setup_t *a, const pdu_session_to_setup_t *b) { - _E1_EQ_CHECK_LONG(a->sessionId, b->sessionId); - _E1_EQ_CHECK_LONG(a->sessionType, b->sessionType); + _EQ_CHECK_LONG(a->sessionId, b->sessionId); + _EQ_CHECK_LONG(a->sessionType, b->sessionType); eq_up_tl_info(&a->UP_TL_information, &b->UP_TL_information); - _E1_EQ_CHECK_INT(a->numDRB2Setup, b->numDRB2Setup); + _EQ_CHECK_INT(a->numDRB2Setup, b->numDRB2Setup); for (int i = 0; i < a->numDRB2Setup; i++) if (!eq_drb_to_setup(&a->DRBnGRanList[i], &b->DRBnGRanList[i])) return false; - _E1_EQ_CHECK_OPTIONAL_PTR(a, b, inactivityTimer); + _EQ_CHECK_OPTIONAL_PTR(a, b, inactivityTimer); if (a->inactivityTimer && b->inactivityTimer) - _E1_EQ_CHECK_INT(*a->inactivityTimer, *b->inactivityTimer); - _E1_EQ_CHECK_OPTIONAL_IE(a, b, dlAggregateMaxBitRate, _E1_EQ_CHECK_LONG); + _EQ_CHECK_INT(*a->inactivityTimer, *b->inactivityTimer); + _EQ_CHECK_OPTIONAL_IE(a, b, dlAggregateMaxBitRate, _EQ_CHECK_LONG); return true; } @@ -660,9 +660,9 @@ bool decode_E1_bearer_context_setup_request(const E1AP_E1AP_PDU_t *pdu, e1ap_bea DevAssert(pdu != NULL); // Check message type - _E1_EQ_CHECK_INT(pdu->present,E1AP_E1AP_PDU_PR_initiatingMessage); - _E1_EQ_CHECK_LONG(pdu->choice.initiatingMessage->procedureCode, E1AP_ProcedureCode_id_bearerContextSetup); - _E1_EQ_CHECK_INT(pdu->choice.initiatingMessage->value.present, E1AP_InitiatingMessage__value_PR_BearerContextSetupRequest); + _EQ_CHECK_INT(pdu->present, E1AP_E1AP_PDU_PR_initiatingMessage); + _EQ_CHECK_LONG(pdu->choice.initiatingMessage->procedureCode, E1AP_ProcedureCode_id_bearerContextSetup); + _EQ_CHECK_INT(pdu->choice.initiatingMessage->value.present, E1AP_InitiatingMessage__value_PR_BearerContextSetupRequest); const E1AP_BearerContextSetupRequest_t *in = &pdu->choice.initiatingMessage->value.choice.BearerContextSetupRequest; E1AP_BearerContextSetupRequestIEs_t *ie; @@ -681,22 +681,22 @@ bool decode_E1_bearer_context_setup_request(const E1AP_E1AP_PDU_t *pdu, e1ap_bea AssertFatal(ie != NULL, "in->protocolIEs.list.array[i] shall not be null"); switch (ie->id) { case E1AP_ProtocolIE_ID_id_gNB_CU_CP_UE_E1AP_ID: - _E1_EQ_CHECK_INT(ie->value.present, E1AP_BearerContextSetupRequestIEs__value_PR_GNB_CU_CP_UE_E1AP_ID); + _EQ_CHECK_INT(ie->value.present, E1AP_BearerContextSetupRequestIEs__value_PR_GNB_CU_CP_UE_E1AP_ID); out->gNB_cu_cp_ue_id = ie->value.choice.GNB_CU_CP_UE_E1AP_ID; break; case E1AP_ProtocolIE_ID_id_SecurityInformation: - _E1_EQ_CHECK_INT(ie->value.present, E1AP_BearerContextSetupRequestIEs__value_PR_SecurityInformation); + _EQ_CHECK_INT(ie->value.present, E1AP_BearerContextSetupRequestIEs__value_PR_SecurityInformation); CHECK_E1AP_DEC(e1_decode_security_info(&out->secInfo, &ie->value.choice.SecurityInformation)); break; case E1AP_ProtocolIE_ID_id_UEDLAggregateMaximumBitRate: - _E1_EQ_CHECK_INT(ie->value.present, E1AP_BearerContextSetupRequestIEs__value_PR_BitRate); + _EQ_CHECK_INT(ie->value.present, E1AP_BearerContextSetupRequestIEs__value_PR_BitRate); asn_INTEGER2long(&ie->value.choice.BitRate, &out->ueDlAggMaxBitRate); break; case E1AP_ProtocolIE_ID_id_Serving_PLMN: - _E1_EQ_CHECK_INT(ie->value.present, E1AP_BearerContextSetupRequestIEs__value_PR_PLMN_Identity); + _EQ_CHECK_INT(ie->value.present, E1AP_BearerContextSetupRequestIEs__value_PR_PLMN_Identity); PLMNID_TO_MCC_MNC(&ie->value.choice.PLMN_Identity, out->servingPLMNid.mcc, out->servingPLMNid.mnc, @@ -704,7 +704,7 @@ bool decode_E1_bearer_context_setup_request(const E1AP_E1AP_PDU_t *pdu, e1ap_bea break; case E1AP_ProtocolIE_ID_id_System_BearerContextSetupRequest: - _E1_EQ_CHECK_INT(ie->value.present, E1AP_BearerContextSetupRequestIEs__value_PR_System_BearerContextSetupRequest); + _EQ_CHECK_INT(ie->value.present, E1AP_BearerContextSetupRequestIEs__value_PR_System_BearerContextSetupRequest); E1AP_System_BearerContextSetupRequest_t *System_BearerContextSetupRequest = &ie->value.choice.System_BearerContextSetupRequest; switch (System_BearerContextSetupRequest->present) { @@ -717,8 +717,8 @@ bool decode_E1_bearer_context_setup_request(const E1AP_E1AP_PDU_t *pdu, e1ap_bea break; case E1AP_System_BearerContextSetupRequest_PR_nG_RAN_BearerContextSetupRequest: // Handle nG-RAN Bearer Context Setup Request - _E1_EQ_CHECK_INT(System_BearerContextSetupRequest->present, - E1AP_System_BearerContextSetupRequest_PR_nG_RAN_BearerContextSetupRequest); + _EQ_CHECK_INT(System_BearerContextSetupRequest->present, + E1AP_System_BearerContextSetupRequest_PR_nG_RAN_BearerContextSetupRequest); AssertFatal(System_BearerContextSetupRequest->choice.nG_RAN_BearerContextSetupRequest != NULL, "System_BearerContextSetupRequest->choice.nG_RAN_BearerContextSetupRequest shall not be null"); break; @@ -731,10 +731,9 @@ bool decode_E1_bearer_context_setup_request(const E1AP_E1AP_PDU_t *pdu, e1ap_bea (E1AP_ProtocolIE_Container_4932P19_t *)System_BearerContextSetupRequest->choice.nG_RAN_BearerContextSetupRequest; E1AP_NG_RAN_BearerContextSetupRequest_t *msgNGRAN = msgNGRAN_list->list.array[0]; // NG-RAN - _E1_EQ_CHECK_INT(msgNGRAN_list->list.count, 1); // only one RAN is expected - _E1_EQ_CHECK_LONG(msgNGRAN->id, E1AP_ProtocolIE_ID_id_PDU_Session_Resource_To_Setup_List); - _E1_EQ_CHECK_INT(msgNGRAN->value.present, - E1AP_NG_RAN_BearerContextSetupRequest__value_PR_PDU_Session_Resource_To_Setup_List); + _EQ_CHECK_INT(msgNGRAN_list->list.count, 1); // only one RAN is expected + _EQ_CHECK_LONG(msgNGRAN->id, E1AP_ProtocolIE_ID_id_PDU_Session_Resource_To_Setup_List); + _EQ_CHECK_INT(msgNGRAN->value.present, E1AP_NG_RAN_BearerContextSetupRequest__value_PR_PDU_Session_Resource_To_Setup_List); // PDU Session Resource To Setup List (9.3.3.2 of 3GPP TS 38.463) E1AP_PDU_Session_Resource_To_Setup_List_t *pdu2SetupList = &msgNGRAN->value.choice.PDU_Session_Resource_To_Setup_List; out->numPDUSessions = pdu2SetupList->list.count; @@ -791,18 +790,18 @@ e1ap_bearer_setup_req_t cp_bearer_context_setup_request(const e1ap_bearer_setup_ bool eq_bearer_context_setup_request(const e1ap_bearer_setup_req_t *a, const e1ap_bearer_setup_req_t *b) { // Primitive data types - _E1_EQ_CHECK_INT(a->gNB_cu_cp_ue_id, b->gNB_cu_cp_ue_id); - _E1_EQ_CHECK_LONG(a->secInfo.cipheringAlgorithm, b->secInfo.cipheringAlgorithm); - _E1_EQ_CHECK_LONG(a->secInfo.integrityProtectionAlgorithm, b->secInfo.integrityProtectionAlgorithm); - _E1_EQ_CHECK_LONG(a->ueDlAggMaxBitRate, b->ueDlAggMaxBitRate); - _E1_EQ_CHECK_INT(a->numPDUSessions, b->numPDUSessions); + _EQ_CHECK_INT(a->gNB_cu_cp_ue_id, b->gNB_cu_cp_ue_id); + _EQ_CHECK_LONG(a->secInfo.cipheringAlgorithm, b->secInfo.cipheringAlgorithm); + _EQ_CHECK_LONG(a->secInfo.integrityProtectionAlgorithm, b->secInfo.integrityProtectionAlgorithm); + _EQ_CHECK_LONG(a->ueDlAggMaxBitRate, b->ueDlAggMaxBitRate); + _EQ_CHECK_INT(a->numPDUSessions, b->numPDUSessions); // PLMN - _E1_EQ_CHECK_INT(a->servingPLMNid.mcc, b->servingPLMNid.mcc); - _E1_EQ_CHECK_INT(a->servingPLMNid.mnc, b->servingPLMNid.mnc); - _E1_EQ_CHECK_INT(a->servingPLMNid.mnc_digit_length, b->servingPLMNid.mnc_digit_length); + _EQ_CHECK_INT(a->servingPLMNid.mcc, b->servingPLMNid.mcc); + _EQ_CHECK_INT(a->servingPLMNid.mnc, b->servingPLMNid.mnc); + _EQ_CHECK_INT(a->servingPLMNid.mnc_digit_length, b->servingPLMNid.mnc_digit_length); // Security Keys - _E1_EQ_CHECK_STR(a->secInfo.encryptionKey, b->secInfo.encryptionKey); - _E1_EQ_CHECK_STR(a->secInfo.integrityProtectionKey, b->secInfo.integrityProtectionKey); + _EQ_CHECK_STR(a->secInfo.encryptionKey, b->secInfo.encryptionKey); + _EQ_CHECK_STR(a->secInfo.integrityProtectionKey, b->secInfo.integrityProtectionKey); // PDU Sessions if (a->numPDUSessions != b->numPDUSessions) return false; @@ -810,10 +809,10 @@ bool eq_bearer_context_setup_request(const e1ap_bearer_setup_req_t *a, const e1a if (!eq_pdu_session_item(&a->pduSession[i], &b->pduSession[i])) return false; // Check optional IEs - _E1_EQ_CHECK_OPTIONAL_PTR(a, b, inactivityTimerUE); + _EQ_CHECK_OPTIONAL_PTR(a, b, inactivityTimerUE); if (a->inactivityTimerUE && b->inactivityTimerUE) - _E1_EQ_CHECK_INT(*a->inactivityTimerUE, *b->inactivityTimerUE); - _E1_EQ_CHECK_OPTIONAL_IE(a, b, ueDlMaxIPBitRate, _E1_EQ_CHECK_LONG); + _EQ_CHECK_INT(*a->inactivityTimerUE, *b->inactivityTimerUE); + _EQ_CHECK_OPTIONAL_IE(a, b, ueDlMaxIPBitRate, _EQ_CHECK_LONG); return true; } @@ -969,9 +968,9 @@ E1AP_E1AP_PDU_t *encode_E1_bearer_context_setup_response(const e1ap_bearer_setup bool decode_E1_bearer_context_setup_response(const E1AP_E1AP_PDU_t *pdu, e1ap_bearer_setup_resp_t *out) { // Check message type - _E1_EQ_CHECK_INT(pdu->present, E1AP_E1AP_PDU_PR_successfulOutcome); - _E1_EQ_CHECK_LONG(pdu->choice.successfulOutcome->procedureCode, E1AP_ProcedureCode_id_bearerContextSetup); - _E1_EQ_CHECK_INT(pdu->choice.successfulOutcome->value.present, E1AP_SuccessfulOutcome__value_PR_BearerContextSetupResponse); + _EQ_CHECK_INT(pdu->present, E1AP_E1AP_PDU_PR_successfulOutcome); + _EQ_CHECK_LONG(pdu->choice.successfulOutcome->procedureCode, E1AP_ProcedureCode_id_bearerContextSetup); + _EQ_CHECK_INT(pdu->choice.successfulOutcome->value.present, E1AP_SuccessfulOutcome__value_PR_BearerContextSetupResponse); const E1AP_BearerContextSetupResponse_t *in = &pdu->choice.successfulOutcome->value.choice.BearerContextSetupResponse; E1AP_BearerContextSetupResponseIEs_t *ie; @@ -985,27 +984,27 @@ bool decode_E1_bearer_context_setup_response(const E1AP_E1AP_PDU_t *pdu, e1ap_be switch (ie->id) { case E1AP_ProtocolIE_ID_id_gNB_CU_CP_UE_E1AP_ID: - _E1_EQ_CHECK_INT(ie->value.present, E1AP_BearerContextSetupResponseIEs__value_PR_GNB_CU_CP_UE_E1AP_ID); + _EQ_CHECK_INT(ie->value.present, E1AP_BearerContextSetupResponseIEs__value_PR_GNB_CU_CP_UE_E1AP_ID); out->gNB_cu_cp_ue_id = ie->value.choice.GNB_CU_CP_UE_E1AP_ID; break; case E1AP_ProtocolIE_ID_id_gNB_CU_UP_UE_E1AP_ID: - _E1_EQ_CHECK_INT(ie->value.present, E1AP_BearerContextSetupResponseIEs__value_PR_GNB_CU_UP_UE_E1AP_ID); + _EQ_CHECK_INT(ie->value.present, E1AP_BearerContextSetupResponseIEs__value_PR_GNB_CU_UP_UE_E1AP_ID); out->gNB_cu_up_ue_id = ie->value.choice.GNB_CU_UP_UE_E1AP_ID; break; case E1AP_ProtocolIE_ID_id_System_BearerContextSetupResponse: - _E1_EQ_CHECK_INT(ie->value.present, E1AP_BearerContextSetupResponseIEs__value_PR_System_BearerContextSetupResponse); + _EQ_CHECK_INT(ie->value.present, E1AP_BearerContextSetupResponseIEs__value_PR_System_BearerContextSetupResponse); switch (ie->value.choice.System_BearerContextSetupResponse.present) { case E1AP_System_BearerContextSetupResponse_PR_nG_RAN_BearerContextSetupResponse: { E1AP_ProtocolIE_Container_4932P22_t *msgNGRAN_list = (E1AP_ProtocolIE_Container_4932P22_t *) ie->value.choice.System_BearerContextSetupResponse.choice.nG_RAN_BearerContextSetupResponse; - _E1_EQ_CHECK_INT(msgNGRAN_list->list.count, 1); + _EQ_CHECK_INT(msgNGRAN_list->list.count, 1); E1AP_NG_RAN_BearerContextSetupResponse_t *msgNGRAN = msgNGRAN_list->list.array[0]; - _E1_EQ_CHECK_LONG(msgNGRAN->id, E1AP_ProtocolIE_ID_id_PDU_Session_Resource_Setup_List); - _E1_EQ_CHECK_INT(msgNGRAN->value.present, - E1AP_NG_RAN_BearerContextSetupResponse__value_PR_PDU_Session_Resource_Setup_List); + _EQ_CHECK_LONG(msgNGRAN->id, E1AP_ProtocolIE_ID_id_PDU_Session_Resource_Setup_List); + _EQ_CHECK_INT(msgNGRAN->value.present, + E1AP_NG_RAN_BearerContextSetupResponse__value_PR_PDU_Session_Resource_Setup_List); E1AP_PDU_Session_Resource_Setup_List_t *pduSetupList = &msgNGRAN->value.choice.PDU_Session_Resource_Setup_List; out->numPDUSessions = pduSetupList->list.count; for (int i = 0; i < pduSetupList->list.count; i++) { @@ -1069,34 +1068,34 @@ e1ap_bearer_setup_resp_t cp_bearer_context_setup_response(const e1ap_bearer_setu bool eq_bearer_context_setup_response(const e1ap_bearer_setup_resp_t *a, const e1ap_bearer_setup_resp_t *b) { // Check basic members - _E1_EQ_CHECK_INT(a->gNB_cu_cp_ue_id, b->gNB_cu_cp_ue_id); - _E1_EQ_CHECK_INT(a->gNB_cu_up_ue_id, b->gNB_cu_up_ue_id); - _E1_EQ_CHECK_INT(a->numPDUSessions, b->numPDUSessions); + _EQ_CHECK_INT(a->gNB_cu_cp_ue_id, b->gNB_cu_cp_ue_id); + _EQ_CHECK_INT(a->gNB_cu_up_ue_id, b->gNB_cu_up_ue_id); + _EQ_CHECK_INT(a->numPDUSessions, b->numPDUSessions); // Check PDU Sessions Setup if (a->numPDUSessions != b->numPDUSessions) return false; for (int i = 0; i < a->numPDUSessions; i++) { const pdu_session_setup_t *ps_a = &a->pduSession[i]; const pdu_session_setup_t *ps_b = &b->pduSession[i]; - _E1_EQ_CHECK_LONG(ps_a->id, ps_b->id); + _EQ_CHECK_LONG(ps_a->id, ps_b->id); eq_up_tl_info(&ps_a->tl_info, &ps_b->tl_info); - _E1_EQ_CHECK_INT(ps_a->numDRBSetup, ps_b->numDRBSetup); - _E1_EQ_CHECK_INT(ps_a->numDRBFailed, ps_b->numDRBFailed); + _EQ_CHECK_INT(ps_a->numDRBSetup, ps_b->numDRBSetup); + _EQ_CHECK_INT(ps_a->numDRBFailed, ps_b->numDRBFailed); // Check DRB Setup for (int j = 0; j < ps_a->numDRBSetup; j++) { const DRB_nGRAN_setup_t *drb_a = &ps_a->DRBnGRanList[j]; const DRB_nGRAN_setup_t *drb_b = &ps_b->DRBnGRanList[j]; - _E1_EQ_CHECK_LONG(drb_a->id, drb_b->id); - _E1_EQ_CHECK_INT(drb_a->numUpParam, drb_b->numUpParam); - _E1_EQ_CHECK_INT(drb_a->numQosFlowSetup, drb_b->numQosFlowSetup); + _EQ_CHECK_LONG(drb_a->id, drb_b->id); + _EQ_CHECK_INT(drb_a->numUpParam, drb_b->numUpParam); + _EQ_CHECK_INT(drb_a->numQosFlowSetup, drb_b->numQosFlowSetup); } // Check DRB Failed for (int j = 0; j < ps_a->numDRBFailed; j++) { const DRB_nGRAN_failed_t *drbf_a = &ps_a->DRBnGRanFailedList[j]; const DRB_nGRAN_failed_t *drbf_b = &ps_b->DRBnGRanFailedList[j]; - _E1_EQ_CHECK_LONG(drbf_a->id, drbf_b->id); - _E1_EQ_CHECK_INT(drbf_a->cause.type, drbf_b->cause.type); - _E1_EQ_CHECK_INT(drbf_a->cause.value, drbf_b->cause.value); + _EQ_CHECK_LONG(drbf_a->id, drbf_b->id); + _EQ_CHECK_INT(drbf_a->cause.type, drbf_b->cause.type); + _EQ_CHECK_INT(drbf_a->cause.value, drbf_b->cause.value); } } return true; @@ -1163,10 +1162,10 @@ E1AP_E1AP_PDU_t *encode_E1_bearer_context_setup_failure(const e1ap_bearer_contex bool decode_E1_bearer_context_setup_failure(e1ap_bearer_context_setup_failure_t *out, const E1AP_E1AP_PDU_t *pdu) { DevAssert(pdu != NULL); - _E1_EQ_CHECK_INT(pdu->present, E1AP_E1AP_PDU_PR_unsuccessfulOutcome); + _EQ_CHECK_INT(pdu->present, E1AP_E1AP_PDU_PR_unsuccessfulOutcome); E1AP_UnsuccessfulOutcome_t *type = pdu->choice.unsuccessfulOutcome; - _E1_EQ_CHECK_LONG(type->procedureCode, E1AP_ProcedureCode_id_bearerContextSetup); - _E1_EQ_CHECK_INT(type->value.present, E1AP_UnsuccessfulOutcome__value_PR_BearerContextSetupFailure); + _EQ_CHECK_LONG(type->procedureCode, E1AP_ProcedureCode_id_bearerContextSetup); + _EQ_CHECK_INT(type->value.present, E1AP_UnsuccessfulOutcome__value_PR_BearerContextSetupFailure); const E1AP_BearerContextSetupFailure_t *in = &type->value.choice.BearerContextSetupFailure; // Check mandatory IEs first @@ -1210,10 +1209,10 @@ e1ap_bearer_context_setup_failure_t cp_bearer_context_setup_failure(const e1ap_b /** @brief Bearer Context Setup Failure equality check */ bool eq_bearer_context_setup_failure(const e1ap_bearer_context_setup_failure_t *a, const e1ap_bearer_context_setup_failure_t *b) { - _E1_EQ_CHECK_INT(a->gNB_cu_cp_ue_id, b->gNB_cu_cp_ue_id); - _E1_EQ_CHECK_OPTIONAL_IE(a, b, gNB_cu_up_ue_id, _E1_EQ_CHECK_INT); - _E1_EQ_CHECK_INT(a->cause.type, b->cause.type); - _E1_EQ_CHECK_INT(a->cause.value, b->cause.value); + _EQ_CHECK_INT(a->gNB_cu_cp_ue_id, b->gNB_cu_cp_ue_id); + _EQ_CHECK_OPTIONAL_IE(a, b, gNB_cu_up_ue_id, _EQ_CHECK_INT); + _EQ_CHECK_INT(a->cause.type, b->cause.type); + _EQ_CHECK_INT(a->cause.value, b->cause.value); return true; } @@ -1271,10 +1270,10 @@ E1AP_E1AP_PDU_t *encode_e1_bearer_context_release_command(const e1ap_bearer_rele bool decode_e1_bearer_context_release_command(e1ap_bearer_release_cmd_t *out, const E1AP_E1AP_PDU_t *pdu) { DevAssert(pdu != NULL); - _E1_EQ_CHECK_INT(pdu->present, E1AP_E1AP_PDU_PR_initiatingMessage); + _EQ_CHECK_INT(pdu->present, E1AP_E1AP_PDU_PR_initiatingMessage); E1AP_InitiatingMessage_t *type = pdu->choice.initiatingMessage; - _E1_EQ_CHECK_LONG(type->procedureCode, E1AP_ProcedureCode_id_bearerContextRelease); - _E1_EQ_CHECK_INT(type->value.present, E1AP_InitiatingMessage__value_PR_BearerContextReleaseCommand); + _EQ_CHECK_LONG(type->procedureCode, E1AP_ProcedureCode_id_bearerContextRelease); + _EQ_CHECK_INT(type->value.present, E1AP_InitiatingMessage__value_PR_BearerContextReleaseCommand); const E1AP_BearerContextReleaseCommand_t *in = &type->value.choice.BearerContextReleaseCommand; // Check mandatory IEs @@ -1297,7 +1296,7 @@ bool decode_e1_bearer_context_release_command(e1ap_bearer_release_cmd_t *out, co out->cause = e1_decode_cause_ie(&ie->value.choice.Cause); break; default: - PRINT_ERROR("%s decoding failure: IE %ld is invalid\n", __func__, ie->id) + PRINT_ERROR("%s decoding failure: IE %ld is invalid\n", __func__, ie->id); return false; break; } @@ -1308,10 +1307,10 @@ bool decode_e1_bearer_context_release_command(e1ap_bearer_release_cmd_t *out, co /** @brief Bearer Context Release Command equality check */ bool eq_bearer_context_release_command(const e1ap_bearer_release_cmd_t *a, const e1ap_bearer_release_cmd_t *b) { - _E1_EQ_CHECK_INT(a->gNB_cu_cp_ue_id, b->gNB_cu_cp_ue_id); - _E1_EQ_CHECK_INT(a->gNB_cu_up_ue_id, b->gNB_cu_up_ue_id); - _E1_EQ_CHECK_INT(a->cause.type, b->cause.type); - _E1_EQ_CHECK_INT(a->cause.value, b->cause.value); + _EQ_CHECK_INT(a->gNB_cu_cp_ue_id, b->gNB_cu_cp_ue_id); + _EQ_CHECK_INT(a->gNB_cu_up_ue_id, b->gNB_cu_up_ue_id); + _EQ_CHECK_INT(a->cause.type, b->cause.type); + _EQ_CHECK_INT(a->cause.value, b->cause.value); return true; } @@ -1366,10 +1365,10 @@ E1AP_E1AP_PDU_t *encode_e1_bearer_context_release_complete(const e1ap_bearer_rel bool decode_e1_bearer_context_release_complete(e1ap_bearer_release_cplt_t *out, const E1AP_E1AP_PDU_t *pdu) { DevAssert(pdu != NULL); - _E1_EQ_CHECK_INT(pdu->present, E1AP_E1AP_PDU_PR_successfulOutcome); + _EQ_CHECK_INT(pdu->present, E1AP_E1AP_PDU_PR_successfulOutcome); E1AP_SuccessfulOutcome_t *type = pdu->choice.successfulOutcome; - _E1_EQ_CHECK_LONG(type->procedureCode, E1AP_ProcedureCode_id_bearerContextRelease); - _E1_EQ_CHECK_INT(type->value.present, E1AP_SuccessfulOutcome__value_PR_BearerContextReleaseComplete); + _EQ_CHECK_LONG(type->procedureCode, E1AP_ProcedureCode_id_bearerContextRelease); + _EQ_CHECK_INT(type->value.present, E1AP_SuccessfulOutcome__value_PR_BearerContextReleaseComplete); const E1AP_BearerContextReleaseComplete_t *in = &type->value.choice.BearerContextReleaseComplete; // Check mandatory IEs @@ -1388,7 +1387,7 @@ bool decode_e1_bearer_context_release_complete(e1ap_bearer_release_cplt_t *out, out->gNB_cu_up_ue_id = ie->value.choice.GNB_CU_UP_UE_E1AP_ID; break; default: - PRINT_ERROR("%s decoding failure: IE %ld is not handled or invalid\n", __func__, ie->id) + PRINT_ERROR("%s decoding failure: IE %ld is not handled or invalid\n", __func__, ie->id); break; } } @@ -1398,8 +1397,8 @@ bool decode_e1_bearer_context_release_complete(e1ap_bearer_release_cplt_t *out, /** @brief Bearer Context Release Complete equality check */ bool eq_bearer_context_release_complete(const e1ap_bearer_release_cplt_t *a, const e1ap_bearer_release_cplt_t *b) { - _E1_EQ_CHECK_INT(a->gNB_cu_cp_ue_id, b->gNB_cu_cp_ue_id); - _E1_EQ_CHECK_INT(a->gNB_cu_up_ue_id, b->gNB_cu_up_ue_id); + _EQ_CHECK_INT(a->gNB_cu_cp_ue_id, b->gNB_cu_cp_ue_id); + _EQ_CHECK_INT(a->gNB_cu_up_ue_id, b->gNB_cu_up_ue_id); return true; } @@ -1669,13 +1668,13 @@ static bool e1_decode_pdu_session_to_setup_mod_item(pdu_session_to_setup_t *out, // Security Indication (M) CHECK_E1AP_DEC(e1_decode_security_indication(&out->securityIndication, &item->securityIndication)); /* NG UL UP Transport Layer Information (M) */ - _E1_EQ_CHECK_INT(item->nG_UL_UP_TNL_Information.present, E1AP_UP_TNL_Information_PR_gTPTunnel); + _EQ_CHECK_INT(item->nG_UL_UP_TNL_Information.present, E1AP_UP_TNL_Information_PR_gTPTunnel); CHECK_E1AP_DEC(e1_decode_up_tnl_info(&out->UP_TL_information, &item->nG_UL_UP_TNL_Information)); /* DRB To Setup List ( > 1 item ) */ const E1AP_DRB_To_Setup_Mod_List_NG_RAN_t *drb2SetupList = &item->dRB_To_Setup_Mod_List_NG_RAN; - _E1_EQ_CHECK_GENERIC(drb2SetupList->list.count > 0, "%d", drb2SetupList->list.count, 0); + EQ_CHECK_GENERIC(drb2SetupList->list.count > 0, "%d", drb2SetupList->list.count, 0); out->numDRB2Setup = drb2SetupList->list.count; - _E1_EQ_CHECK_INT(out->numDRB2Setup, 1); // can only handle one DRB per PDU session + _EQ_CHECK_INT(out->numDRB2Setup, 1); // can only handle one DRB per PDU session for (int j = 0; j < drb2SetupList->list.count; j++) { DRB_nGRAN_to_setup_t *drb = out->DRBnGRanList + j; const E1AP_DRB_To_Setup_Mod_Item_NG_RAN_t *drb2Setup = drb2SetupList->list.array[j]; @@ -1687,7 +1686,7 @@ static bool e1_decode_pdu_session_to_setup_mod_item(pdu_session_to_setup_t *out, CHECK_E1AP_DEC(e1_decode_pdcp_config(&drb->pdcp_config, &drb2Setup->pDCP_Configuration)); // Cell Group Information (M) const E1AP_Cell_Group_Information_t *cellGroupList = &drb2Setup->cell_Group_Information; - _E1_EQ_CHECK_GENERIC(cellGroupList->list.count > 0, "%d", cellGroupList->list.count, 0); + EQ_CHECK_GENERIC(cellGroupList->list.count > 0, "%d", cellGroupList->list.count, 0); drb->numCellGroups = cellGroupList->list.count; for (int k = 0; k < cellGroupList->list.count; k++) { const E1AP_Cell_Group_Information_Item_t *cg2Setup = cellGroupList->list.array[k]; @@ -1774,10 +1773,10 @@ bool decode_E1_bearer_context_mod_request(const E1AP_E1AP_PDU_t *pdu, e1ap_beare { DevAssert(pdu != NULL); // Validate message type - _E1_EQ_CHECK_INT(pdu->present, E1AP_E1AP_PDU_PR_initiatingMessage); + _EQ_CHECK_INT(pdu->present, E1AP_E1AP_PDU_PR_initiatingMessage); const E1AP_InitiatingMessage_t *im = pdu->choice.initiatingMessage; - _E1_EQ_CHECK_LONG(im->procedureCode, E1AP_ProcedureCode_id_bearerContextModification); - _E1_EQ_CHECK_INT(im->value.present, E1AP_InitiatingMessage__value_PR_BearerContextModificationRequest); + _EQ_CHECK_LONG(im->procedureCode, E1AP_ProcedureCode_id_bearerContextModification); + _EQ_CHECK_INT(im->value.present, E1AP_InitiatingMessage__value_PR_BearerContextModificationRequest); const E1AP_BearerContextModificationRequest_t *in = &im->value.choice.BearerContextModificationRequest; E1AP_BearerContextModificationRequestIEs_t *ie = NULL; @@ -1794,12 +1793,12 @@ bool decode_E1_bearer_context_mod_request(const E1AP_E1AP_PDU_t *pdu, e1ap_beare switch (ie->id) { case E1AP_ProtocolIE_ID_id_gNB_CU_CP_UE_E1AP_ID: - _E1_EQ_CHECK_INT(ie->value.present, E1AP_BearerContextModificationRequestIEs__value_PR_GNB_CU_CP_UE_E1AP_ID); + _EQ_CHECK_INT(ie->value.present, E1AP_BearerContextModificationRequestIEs__value_PR_GNB_CU_CP_UE_E1AP_ID); out->gNB_cu_cp_ue_id = ie->value.choice.GNB_CU_CP_UE_E1AP_ID; break; case E1AP_ProtocolIE_ID_id_gNB_CU_UP_UE_E1AP_ID: - _E1_EQ_CHECK_INT(ie->value.present, E1AP_BearerContextModificationRequestIEs__value_PR_GNB_CU_UP_UE_E1AP_ID); + _EQ_CHECK_INT(ie->value.present, E1AP_BearerContextModificationRequestIEs__value_PR_GNB_CU_UP_UE_E1AP_ID); out->gNB_cu_up_ue_id = ie->value.choice.GNB_CU_UP_UE_E1AP_ID; break; @@ -1819,7 +1818,7 @@ bool decode_E1_bearer_context_mod_request(const E1AP_E1AP_PDU_t *pdu, e1ap_beare break; case E1AP_ProtocolIE_ID_id_BearerContextStatusChange: - _E1_EQ_CHECK_INT(ie->value.present, E1AP_BearerContextModificationRequestIEs__value_PR_BearerContextStatusChange); + _EQ_CHECK_INT(ie->value.present, E1AP_BearerContextModificationRequestIEs__value_PR_BearerContextStatusChange); if (ie->value.choice.BearerContextStatusChange == E1AP_BearerContextStatusChange_suspend) { out->bearerContextStatus = malloc_or_fail(sizeof(*out->bearerContextStatus)); *out->bearerContextStatus = BEARER_SUSPEND; @@ -1836,8 +1835,8 @@ bool decode_E1_bearer_context_mod_request(const E1AP_E1AP_PDU_t *pdu, e1ap_beare break; case E1AP_ProtocolIE_ID_id_System_BearerContextModificationRequest: { - _E1_EQ_CHECK_INT(ie->value.present, - E1AP_BearerContextModificationRequestIEs__value_PR_System_BearerContextModificationRequest); + _EQ_CHECK_INT(ie->value.present, + E1AP_BearerContextModificationRequestIEs__value_PR_System_BearerContextModificationRequest); E1AP_System_BearerContextModificationRequest_t *modReq = &ie->value.choice.System_BearerContextModificationRequest; DevAssert(ie->value.choice.System_BearerContextModificationRequest.choice.nG_RAN_BearerContextModificationRequest != NULL); // System IE can contain either UTRAN or NG-RAN @@ -1860,9 +1859,9 @@ bool decode_E1_bearer_context_mod_request(const E1AP_E1AP_PDU_t *pdu, e1ap_beare E1AP_NG_RAN_BearerContextModificationRequest_t *msgNGRAN = msgNGRAN_list->list.array[i]; switch (msgNGRAN->id) { case E1AP_ProtocolIE_ID_id_PDU_Session_Resource_To_Setup_Mod_List: - _E1_EQ_CHECK_LONG(msgNGRAN->id, E1AP_ProtocolIE_ID_id_PDU_Session_Resource_To_Setup_Mod_List); - _E1_EQ_CHECK_INT(msgNGRAN->value.present, - E1AP_NG_RAN_BearerContextModificationRequest__value_PR_PDU_Session_Resource_To_Setup_Mod_List); + _EQ_CHECK_LONG(msgNGRAN->id, E1AP_ProtocolIE_ID_id_PDU_Session_Resource_To_Setup_Mod_List); + _EQ_CHECK_INT(msgNGRAN->value.present, + E1AP_NG_RAN_BearerContextModificationRequest__value_PR_PDU_Session_Resource_To_Setup_Mod_List); E1AP_PDU_Session_Resource_To_Setup_Mod_List_t *setupList = &msgNGRAN->value.choice.PDU_Session_Resource_To_Setup_Mod_List; // PDU Session Resource To Modify List @@ -1876,8 +1875,8 @@ bool decode_E1_bearer_context_mod_request(const E1AP_E1AP_PDU_t *pdu, e1ap_beare break; case E1AP_ProtocolIE_ID_id_PDU_Session_Resource_To_Modify_List: /* PDU Session Resource To Modify List (see 9.3.3.11 of TS 38.463) */ - _E1_EQ_CHECK_INT(msgNGRAN->value.present, - E1AP_NG_RAN_BearerContextModificationRequest__value_PR_PDU_Session_Resource_To_Modify_List); + _EQ_CHECK_INT(msgNGRAN->value.present, + E1AP_NG_RAN_BearerContextModificationRequest__value_PR_PDU_Session_Resource_To_Modify_List); E1AP_PDU_Session_Resource_To_Modify_List_t *modList = &msgNGRAN->value.choice.PDU_Session_Resource_To_Modify_List; out->numPDUSessionsMod = modList->list.count; // Loop through all PDU sessions @@ -1887,8 +1886,8 @@ bool decode_E1_bearer_context_mod_request(const E1AP_E1AP_PDU_t *pdu, e1ap_beare break; case E1AP_ProtocolIE_ID_id_PDU_Session_Resource_To_Remove_List: /* PDU Session Resource To Remove List (see 9.3.3.12 of TS 38.463) */ - _E1_EQ_CHECK_INT(msgNGRAN->value.present, - E1AP_NG_RAN_BearerContextModificationRequest__value_PR_PDU_Session_Resource_To_Remove_List); + _EQ_CHECK_INT(msgNGRAN->value.present, + E1AP_NG_RAN_BearerContextModificationRequest__value_PR_PDU_Session_Resource_To_Remove_List); E1AP_PDU_Session_Resource_To_Remove_List_t *remList = &msgNGRAN->value.choice.PDU_Session_Resource_To_Remove_List; out->numPDUSessionsRem = remList->list.count; // Loop through all PDU sessions to remove @@ -1980,9 +1979,9 @@ e1ap_bearer_mod_req_t cp_bearer_context_mod_request(const e1ap_bearer_mod_req_t /** @brief Equality check for Security Indication IE (3GPP TS 38.463 9.3.1.23) */ static bool eq_security_ind(security_indication_t *a, security_indication_t *b) { - _E1_EQ_CHECK_INT(a->confidentialityProtectionIndication, b->confidentialityProtectionIndication); - _E1_EQ_CHECK_INT(a->integrityProtectionIndication, b->integrityProtectionIndication); - _E1_EQ_CHECK_LONG(a->maxIPrate, b->maxIPrate); + _EQ_CHECK_INT(a->confidentialityProtectionIndication, b->confidentialityProtectionIndication); + _EQ_CHECK_INT(a->integrityProtectionIndication, b->integrityProtectionIndication); + _EQ_CHECK_LONG(a->maxIPrate, b->maxIPrate); return true; } @@ -1991,29 +1990,29 @@ static bool eq_security_ind(security_indication_t *a, security_indication_t *b) */ static bool eq_drb_to_mod(const DRB_nGRAN_to_mod_t *a, const DRB_nGRAN_to_mod_t *b) { - _E1_EQ_CHECK_LONG(a->id, b->id); - _E1_EQ_CHECK_INT(a->numQosFlowsMod, b->numQosFlowsMod); + _EQ_CHECK_LONG(a->id, b->id); + _EQ_CHECK_INT(a->numQosFlowsMod, b->numQosFlowsMod); for (int i = 0; i < a->numQosFlowsMod; i++) { if (!eq_qos_flow(&a->qosFlows[i], &b->qosFlows[i])) return false; } - _E1_EQ_CHECK_INT(a->numDlUpParam, b->numDlUpParam); + _EQ_CHECK_INT(a->numDlUpParam, b->numDlUpParam); for (int i = 0; i < a->numDlUpParam; i++) { - _E1_EQ_CHECK_INT(a->DlUpParamList[i].cell_group_id, b->DlUpParamList[i].cell_group_id); + _EQ_CHECK_INT(a->DlUpParamList[i].cell_group_id, b->DlUpParamList[i].cell_group_id); if (!eq_up_tl_info(&a->DlUpParamList[i].tl_info, &b->DlUpParamList[i].tl_info)) return false; } - _E1_EQ_CHECK_OPTIONAL_PTR(a, b, pdcp_config); + _EQ_CHECK_OPTIONAL_PTR(a, b, pdcp_config); if (a->pdcp_config && b->pdcp_config) { if (!eq_pdcp_config(a->pdcp_config, b->pdcp_config)) return false; } - _E1_EQ_CHECK_OPTIONAL_PTR(a, b, sdap_config); + _EQ_CHECK_OPTIONAL_PTR(a, b, sdap_config); if (a->sdap_config && b->sdap_config) { if (!eq_sdap_config(a->sdap_config, b->sdap_config)) return false; } - _E1_EQ_CHECK_OPTIONAL_PTR(a, b, pdcp_status); + _EQ_CHECK_OPTIONAL_PTR(a, b, pdcp_status); if (a->pdcp_status && b->pdcp_status) { if (!eq_pdcp_info(a->pdcp_status, b->pdcp_status)) return false; @@ -2024,26 +2023,26 @@ static bool eq_drb_to_mod(const DRB_nGRAN_to_mod_t *a, const DRB_nGRAN_to_mod_t /** @brief Equality check for PDU session item to modify */ static bool eq_pdu_session_to_mod_item(const pdu_session_to_mod_t *a, const pdu_session_to_mod_t *b) { - _E1_EQ_CHECK_LONG(a->sessionId, b->sessionId); - _E1_EQ_CHECK_OPTIONAL_PTR(a, b, UP_TL_information); + _EQ_CHECK_LONG(a->sessionId, b->sessionId); + _EQ_CHECK_OPTIONAL_PTR(a, b, UP_TL_information); if (a->UP_TL_information && b->UP_TL_information) { if (!eq_up_tl_info(a->UP_TL_information, b->UP_TL_information)) return false; } - _E1_EQ_CHECK_INT(a->numDRB2Setup, b->numDRB2Setup); + _EQ_CHECK_INT(a->numDRB2Setup, b->numDRB2Setup); for (int i = 0; i < a->numDRB2Setup; i++) { if (!eq_drb_to_setup(&a->DRBnGRanList[i], &b->DRBnGRanList[i])) return false; } - _E1_EQ_CHECK_LONG(a->numDRB2Modify, b->numDRB2Modify); + _EQ_CHECK_LONG(a->numDRB2Modify, b->numDRB2Modify); for (int i = 0; i < a->numDRB2Modify; i++) { if (!eq_drb_to_mod(&a->DRBnGRanModList[i], &b->DRBnGRanModList[i])) return false; } - _E1_EQ_CHECK_OPTIONAL_PTR(a, b, securityIndication); - _E1_EQ_CHECK_INT(a->n_drb_to_remove, b->n_drb_to_remove); + _EQ_CHECK_OPTIONAL_PTR(a, b, securityIndication); + _EQ_CHECK_INT(a->n_drb_to_remove, b->n_drb_to_remove); for (int r = 0; r < a->n_drb_to_remove; r++) { - _E1_EQ_CHECK_LONG(a->drbs_to_remove[r].id, b->drbs_to_remove[r].id); + _EQ_CHECK_LONG(a->drbs_to_remove[r].id, b->drbs_to_remove[r].id); } if (a->securityIndication && b->securityIndication) { if (!eq_security_ind(a->securityIndication, b->securityIndication)) @@ -2058,24 +2057,24 @@ static bool eq_pdu_session_to_mod_item(const pdu_session_to_mod_t *a, const pdu_ bool eq_bearer_context_mod_request(const e1ap_bearer_mod_req_t *a, const e1ap_bearer_mod_req_t *b) { // basic members - _E1_EQ_CHECK_INT(a->gNB_cu_cp_ue_id, b->gNB_cu_cp_ue_id); - _E1_EQ_CHECK_INT(a->gNB_cu_up_ue_id, b->gNB_cu_up_ue_id); - _E1_EQ_CHECK_INT(a->numPDUSessions, b->numPDUSessions); - _E1_EQ_CHECK_INT(a->numPDUSessionsMod, b->numPDUSessionsMod); + _EQ_CHECK_INT(a->gNB_cu_cp_ue_id, b->gNB_cu_cp_ue_id); + _EQ_CHECK_INT(a->gNB_cu_up_ue_id, b->gNB_cu_up_ue_id); + _EQ_CHECK_INT(a->numPDUSessions, b->numPDUSessions); + _EQ_CHECK_INT(a->numPDUSessionsMod, b->numPDUSessionsMod); // Security Info - _E1_EQ_CHECK_OPTIONAL_PTR(a, b, secInfo); + _EQ_CHECK_OPTIONAL_PTR(a, b, secInfo); if (a->secInfo && b->secInfo) { - _E1_EQ_CHECK_LONG(a->secInfo->cipheringAlgorithm, b->secInfo->cipheringAlgorithm); - _E1_EQ_CHECK_LONG(a->secInfo->integrityProtectionAlgorithm, b->secInfo->integrityProtectionAlgorithm); - _E1_EQ_CHECK_STR(a->secInfo->encryptionKey, b->secInfo->encryptionKey); - _E1_EQ_CHECK_STR(a->secInfo->integrityProtectionKey, b->secInfo->integrityProtectionKey); + _EQ_CHECK_LONG(a->secInfo->cipheringAlgorithm, b->secInfo->cipheringAlgorithm); + _EQ_CHECK_LONG(a->secInfo->integrityProtectionAlgorithm, b->secInfo->integrityProtectionAlgorithm); + _EQ_CHECK_STR(a->secInfo->encryptionKey, b->secInfo->encryptionKey); + _EQ_CHECK_STR(a->secInfo->integrityProtectionKey, b->secInfo->integrityProtectionKey); } // Bearer Context Status (O) - _E1_EQ_CHECK_OPTIONAL_IE(a, b, bearerContextStatus, _E1_EQ_CHECK_INT); + _EQ_CHECK_OPTIONAL_IE(a, b, bearerContextStatus, _EQ_CHECK_INT); // Inactivity Timer (O) - _E1_EQ_CHECK_OPTIONAL_PTR(a, b, inactivityTimer); + _EQ_CHECK_OPTIONAL_PTR(a, b, inactivityTimer); if (a->inactivityTimer && b->inactivityTimer) - _E1_EQ_CHECK_INT(*a->inactivityTimer, *b->inactivityTimer); + _EQ_CHECK_INT(*a->inactivityTimer, *b->inactivityTimer); // Activity Notification Level (O) // PDU Sessions if (a->numPDUSessions != b->numPDUSessions) @@ -2092,13 +2091,13 @@ bool eq_bearer_context_mod_request(const e1ap_bearer_mod_req_t *a, const e1ap_be return false; } // PDU Sessions to Remove - _E1_EQ_CHECK_INT(a->numPDUSessionsRem, b->numPDUSessionsRem); + _EQ_CHECK_INT(a->numPDUSessionsRem, b->numPDUSessionsRem); for (int i = 0; i < a->numPDUSessionsRem; i++) { const pdu_session_to_remove_t *pduRemA = &a->pduSessionRem[i]; const pdu_session_to_remove_t *pduRemB = &b->pduSessionRem[i]; - _E1_EQ_CHECK_LONG(pduRemA->sessionId, pduRemB->sessionId); - _E1_EQ_CHECK_INT(pduRemA->cause.type, pduRemB->cause.type); - _E1_EQ_CHECK_INT(pduRemA->cause.value, pduRemB->cause.value); + _EQ_CHECK_LONG(pduRemA->sessionId, pduRemB->sessionId); + _EQ_CHECK_INT(pduRemA->cause.type, pduRemB->cause.type); + _EQ_CHECK_INT(pduRemA->cause.value, pduRemB->cause.value); } return true; } @@ -2324,10 +2323,10 @@ static qos_flow_failed_t decode_qos_flow_failed_item(const E1AP_QoS_Flow_Failed_ bool decode_E1_bearer_context_mod_response(e1ap_bearer_modif_resp_t *out, const E1AP_E1AP_PDU_t *pdu) { DevAssert(pdu != NULL); - _E1_EQ_CHECK_INT(pdu->present, E1AP_E1AP_PDU_PR_successfulOutcome); + _EQ_CHECK_INT(pdu->present, E1AP_E1AP_PDU_PR_successfulOutcome); E1AP_SuccessfulOutcome_t *type = pdu->choice.successfulOutcome; - _E1_EQ_CHECK_LONG(type->procedureCode, E1AP_ProcedureCode_id_bearerContextModification); - _E1_EQ_CHECK_INT(type->value.present, E1AP_SuccessfulOutcome__value_PR_BearerContextModificationResponse); + _EQ_CHECK_LONG(type->procedureCode, E1AP_ProcedureCode_id_bearerContextModification); + _EQ_CHECK_INT(type->value.present, E1AP_SuccessfulOutcome__value_PR_BearerContextModificationResponse); const E1AP_BearerContextModificationResponse_t *in = &type->value.choice.BearerContextModificationResponse; // Check mandatory IEs first E1AP_BearerContextModificationResponseIEs_t *ie; @@ -2339,28 +2338,30 @@ bool decode_E1_bearer_context_mod_response(e1ap_bearer_modif_resp_t *out, const switch (ie->id) { case E1AP_ProtocolIE_ID_id_gNB_CU_CP_UE_E1AP_ID: // gNB-CU-CP UE E1AP ID (M) - _E1_EQ_CHECK_INT(ie->value.present, E1AP_BearerContextModificationResponseIEs__value_PR_GNB_CU_CP_UE_E1AP_ID); + _EQ_CHECK_INT(ie->value.present, E1AP_BearerContextModificationResponseIEs__value_PR_GNB_CU_CP_UE_E1AP_ID); out->gNB_cu_cp_ue_id = ie->value.choice.GNB_CU_CP_UE_E1AP_ID; break; case E1AP_ProtocolIE_ID_id_gNB_CU_UP_UE_E1AP_ID: // gNB-CU-UP UE E1AP ID (M) - _E1_EQ_CHECK_INT(ie->value.present, E1AP_BearerContextModificationResponseIEs__value_PR_GNB_CU_UP_UE_E1AP_ID); + _EQ_CHECK_INT(ie->value.present, E1AP_BearerContextModificationResponseIEs__value_PR_GNB_CU_UP_UE_E1AP_ID); out->gNB_cu_up_ue_id = ie->value.choice.GNB_CU_UP_UE_E1AP_ID; break; case E1AP_ProtocolIE_ID_id_System_BearerContextModificationResponse: // CHOICE System (O) - _E1_EQ_CHECK_INT(ie->value.present, E1AP_BearerContextModificationResponseIEs__value_PR_System_BearerContextModificationResponse); + _EQ_CHECK_INT(ie->value.present, + E1AP_BearerContextModificationResponseIEs__value_PR_System_BearerContextModificationResponse); // NG-RAN System E1AP_System_BearerContextModificationResponse_t *system = &ie->value.choice.System_BearerContextModificationResponse; - _E1_EQ_CHECK_INT(system->present, E1AP_System_BearerContextModificationResponse_PR_nG_RAN_BearerContextModificationResponse); + _EQ_CHECK_INT(system->present, E1AP_System_BearerContextModificationResponse_PR_nG_RAN_BearerContextModificationResponse); // NG-RAN List E1AP_ProtocolIE_Container_4932P29_t *msgNGRAN_list = (E1AP_ProtocolIE_Container_4932P29_t *)system->choice.nG_RAN_BearerContextModificationResponse; - _E1_EQ_CHECK_INT(msgNGRAN_list->list.count, 1); + _EQ_CHECK_INT(msgNGRAN_list->list.count, 1); E1AP_NG_RAN_BearerContextModificationResponse_t *msgNGRAN = msgNGRAN_list->list.array[0]; - _E1_EQ_CHECK_LONG(msgNGRAN->id, E1AP_ProtocolIE_ID_id_PDU_Session_Resource_Modified_List); - _E1_EQ_CHECK_INT(msgNGRAN->value.present, E1AP_NG_RAN_BearerContextModificationResponse__value_PR_PDU_Session_Resource_Modified_List); + _EQ_CHECK_LONG(msgNGRAN->id, E1AP_ProtocolIE_ID_id_PDU_Session_Resource_Modified_List); + _EQ_CHECK_INT(msgNGRAN->value.present, + E1AP_NG_RAN_BearerContextModificationResponse__value_PR_PDU_Session_Resource_Modified_List); // PDU Session Resource Modified list (O) E1AP_PDU_Session_Resource_Modified_List_t *list = &msgNGRAN->value.choice.PDU_Session_Resource_Modified_List; out->numPDUSessionsMod = list->list.count; @@ -2501,36 +2502,36 @@ bool eq_bearer_context_mod_response(const e1ap_bearer_modif_resp_t *a, const e1a if (!a || !b) return false; // Null-check both inputs // Basic members - _E1_EQ_CHECK_INT(a->gNB_cu_cp_ue_id, b->gNB_cu_cp_ue_id); - _E1_EQ_CHECK_INT(a->gNB_cu_up_ue_id, b->gNB_cu_up_ue_id); - _E1_EQ_CHECK_INT(a->numPDUSessionsMod, b->numPDUSessionsMod); + _EQ_CHECK_INT(a->gNB_cu_cp_ue_id, b->gNB_cu_cp_ue_id); + _EQ_CHECK_INT(a->gNB_cu_up_ue_id, b->gNB_cu_up_ue_id); + _EQ_CHECK_INT(a->numPDUSessionsMod, b->numPDUSessionsMod); // PDU Session Modified List for (int i = 0; i < a->numPDUSessionsMod; i++) { const pdu_session_modif_t *pduA = &a->pduSessionMod[i]; const pdu_session_modif_t *pduB = &b->pduSessionMod[i]; - _E1_EQ_CHECK_LONG(pduA->id, pduB->id); - _E1_EQ_CHECK_OPTIONAL_IE(pduA, pduB, confidentialityProtectionIndication, _E1_EQ_CHECK_INT); - _E1_EQ_CHECK_OPTIONAL_IE(pduA, pduB, integrityProtectionIndication, _E1_EQ_CHECK_INT); + _EQ_CHECK_LONG(pduA->id, pduB->id); + _EQ_CHECK_OPTIONAL_IE(pduA, pduB, confidentialityProtectionIndication, _EQ_CHECK_INT); + _EQ_CHECK_OPTIONAL_IE(pduA, pduB, integrityProtectionIndication, _EQ_CHECK_INT); - _E1_EQ_CHECK_OPTIONAL_PTR(pduA, pduB, ng_DL_UP_TL_info); + _EQ_CHECK_OPTIONAL_PTR(pduA, pduB, ng_DL_UP_TL_info); if (pduA->ng_DL_UP_TL_info && pduB->ng_DL_UP_TL_info) { if (!eq_up_tl_info(pduA->ng_DL_UP_TL_info, pduB->ng_DL_UP_TL_info)) return false; } // DRB Modified List - _E1_EQ_CHECK_INT(pduA->numDRBModified, pduB->numDRBModified); + _EQ_CHECK_INT(pduA->numDRBModified, pduB->numDRBModified); for (int j = 0; j < pduA->numDRBModified; j++) { const DRB_nGRAN_modified_t *drbModA = &pduA->DRBnGRanModList[j]; const DRB_nGRAN_modified_t *drbModB = &pduB->DRBnGRanModList[j]; - _E1_EQ_CHECK_LONG(drbModA->id, drbModB->id); - _E1_EQ_CHECK_INT(drbModA->numQosFlowSetup, drbModB->numQosFlowSetup); + _EQ_CHECK_LONG(drbModA->id, drbModB->id); + _EQ_CHECK_INT(drbModA->numQosFlowSetup, drbModB->numQosFlowSetup); for (int j = 0; j < drbModA->numQosFlowSetup; j++) { - _E1_EQ_CHECK_LONG(drbModA->qosFlows[j].qfi, drbModB->qosFlows[j].qfi); + _EQ_CHECK_LONG(drbModA->qosFlows[j].qfi, drbModB->qosFlows[j].qfi); } - _E1_EQ_CHECK_OPTIONAL_PTR(drbModA, drbModB, pdcp_status); + _EQ_CHECK_OPTIONAL_PTR(drbModA, drbModB, pdcp_status); if (drbModA->pdcp_status && drbModB->pdcp_status) { if (!eq_pdcp_info(drbModA->pdcp_status, drbModB->pdcp_status)) return false; @@ -2538,32 +2539,32 @@ bool eq_bearer_context_mod_response(const e1ap_bearer_modif_resp_t *a, const e1a } // DRB Failed to Modify List - _E1_EQ_CHECK_INT(pduA->numDRBFailedToMod, pduB->numDRBFailedToMod); + _EQ_CHECK_INT(pduA->numDRBFailedToMod, pduB->numDRBFailedToMod); for (int j = 0; j < pduA->numDRBFailedToMod; j++) { - _E1_EQ_CHECK_LONG(pduA->DRBnGRanFailedModList[j].id, pduB->DRBnGRanFailedModList[j].id); - _E1_EQ_CHECK_INT(pduA->DRBnGRanFailedModList[j].cause.value, pduB->DRBnGRanFailedModList[j].cause.value); - _E1_EQ_CHECK_INT(pduA->DRBnGRanFailedModList[j].cause.type, pduB->DRBnGRanFailedModList[j].cause.type); + _EQ_CHECK_LONG(pduA->DRBnGRanFailedModList[j].id, pduB->DRBnGRanFailedModList[j].id); + _EQ_CHECK_INT(pduA->DRBnGRanFailedModList[j].cause.value, pduB->DRBnGRanFailedModList[j].cause.value); + _EQ_CHECK_INT(pduA->DRBnGRanFailedModList[j].cause.type, pduB->DRBnGRanFailedModList[j].cause.type); } // DRB Setup List - _E1_EQ_CHECK_INT(pduA->numDRBSetup, pduB->numDRBSetup); + _EQ_CHECK_INT(pduA->numDRBSetup, pduB->numDRBSetup); for (int j = 0; j < pduA->numDRBSetup; j++) { const DRB_nGRAN_setup_t *drbSetupA = &pduA->DRBnGRanSetupList[j]; const DRB_nGRAN_setup_t *drbSetupB = &pduB->DRBnGRanSetupList[j]; - _E1_EQ_CHECK_LONG(drbSetupA->id, drbSetupB->id); - _E1_EQ_CHECK_INT(drbSetupA->numQosFlowSetup, drbSetupB->numQosFlowSetup); + _EQ_CHECK_LONG(drbSetupA->id, drbSetupB->id); + _EQ_CHECK_INT(drbSetupA->numQosFlowSetup, drbSetupB->numQosFlowSetup); for (int j = 0; j < drbSetupA->numQosFlowSetup; j++) { - _E1_EQ_CHECK_LONG(drbSetupA->qosFlows[j].qfi, drbSetupB->qosFlows[j].qfi); + _EQ_CHECK_LONG(drbSetupA->qosFlows[j].qfi, drbSetupB->qosFlows[j].qfi); } } // DRB Failed to Setup List - _E1_EQ_CHECK_INT(pduA->numDRBFailed, pduB->numDRBFailed); + _EQ_CHECK_INT(pduA->numDRBFailed, pduB->numDRBFailed); for (int j = 0; j < pduA->numDRBFailed; j++) { - _E1_EQ_CHECK_LONG(pduA->DRBnGRanFailedList[j].id, pduB->DRBnGRanFailedList[j].id); - _E1_EQ_CHECK_INT(pduA->DRBnGRanFailedList[j].cause.value, pduB->DRBnGRanFailedList[j].cause.value); - _E1_EQ_CHECK_INT(pduA->DRBnGRanFailedList[j].cause.type, pduB->DRBnGRanFailedList[j].cause.type); + _EQ_CHECK_LONG(pduA->DRBnGRanFailedList[j].id, pduB->DRBnGRanFailedList[j].id); + _EQ_CHECK_INT(pduA->DRBnGRanFailedList[j].cause.value, pduB->DRBnGRanFailedList[j].cause.value); + _EQ_CHECK_INT(pduA->DRBnGRanFailedList[j].cause.type, pduB->DRBnGRanFailedList[j].cause.type); } } @@ -2627,10 +2628,10 @@ struct E1AP_E1AP_PDU *encode_E1_bearer_context_mod_failure(const e1ap_bearer_con bool decode_E1_bearer_context_mod_failure(e1ap_bearer_context_mod_failure_t *out, const E1AP_E1AP_PDU_t *pdu) { DevAssert(pdu != NULL); - _E1_EQ_CHECK_INT(pdu->present, E1AP_E1AP_PDU_PR_unsuccessfulOutcome); + _EQ_CHECK_INT(pdu->present, E1AP_E1AP_PDU_PR_unsuccessfulOutcome); E1AP_UnsuccessfulOutcome_t *type = pdu->choice.unsuccessfulOutcome; - _E1_EQ_CHECK_LONG(type->procedureCode, E1AP_ProcedureCode_id_bearerContextModification); - _E1_EQ_CHECK_INT(type->value.present, E1AP_UnsuccessfulOutcome__value_PR_BearerContextModificationFailure); + _EQ_CHECK_LONG(type->procedureCode, E1AP_ProcedureCode_id_bearerContextModification); + _EQ_CHECK_INT(type->value.present, E1AP_UnsuccessfulOutcome__value_PR_BearerContextModificationFailure); const E1AP_BearerContextModificationFailure_t *in = &type->value.choice.BearerContextModificationFailure; // Check mandatory IEs first E1AP_BearerContextModificationFailureIEs_t *ie; @@ -2671,10 +2672,10 @@ bool eq_E1_bearer_context_mod_failure(const e1ap_bearer_context_mod_failure_t *a { if (!a || !b) return false; // Null-check both inputs - _E1_EQ_CHECK_INT(a->gNB_cu_cp_ue_id, b->gNB_cu_cp_ue_id); - _E1_EQ_CHECK_INT(a->gNB_cu_up_ue_id, b->gNB_cu_up_ue_id); - _E1_EQ_CHECK_INT(a->cause.type, b->cause.type); - _E1_EQ_CHECK_INT(a->cause.value, b->cause.value); + _EQ_CHECK_INT(a->gNB_cu_cp_ue_id, b->gNB_cu_cp_ue_id); + _EQ_CHECK_INT(a->gNB_cu_up_ue_id, b->gNB_cu_up_ue_id); + _EQ_CHECK_INT(a->cause.type, b->cause.type); + _EQ_CHECK_INT(a->cause.value, b->cause.value); return true; } diff --git a/openair2/E1AP/lib/e1ap_interface_management.c b/openair2/E1AP/lib/e1ap_interface_management.c index 681942f58b..50f77dd9de 100644 --- a/openair2/E1AP/lib/e1ap_interface_management.c +++ b/openair2/E1AP/lib/e1ap_interface_management.c @@ -179,15 +179,15 @@ bool decode_e1ap_cuup_setup_request(const E1AP_E1AP_PDU_t *pdu, e1ap_setup_req_t AssertFatal(ie != NULL, "in->protocolIEs.list.array[i] shall not be null"); switch (ie->id) { case E1AP_ProtocolIE_ID_id_TransactionID: - _E1_EQ_CHECK_INT(ie->value.present, E1AP_GNB_CU_UP_E1SetupRequestIEs__value_PR_TransactionID); + _EQ_CHECK_INT(ie->value.present, E1AP_GNB_CU_UP_E1SetupRequestIEs__value_PR_TransactionID); out->transac_id = ie->value.choice.TransactionID; break; case E1AP_ProtocolIE_ID_id_gNB_CU_UP_ID: - _E1_EQ_CHECK_INT(ie->value.present, E1AP_GNB_CU_UP_E1SetupRequestIEs__value_PR_GNB_CU_UP_ID); + _EQ_CHECK_INT(ie->value.present, E1AP_GNB_CU_UP_E1SetupRequestIEs__value_PR_GNB_CU_UP_ID); asn_INTEGER2ulong(&ie->value.choice.GNB_CU_UP_ID, &out->gNB_cu_up_id); break; case E1AP_ProtocolIE_ID_id_gNB_CU_UP_Name: - _E1_EQ_CHECK_INT(ie->value.present, E1AP_GNB_CU_UP_E1SetupRequestIEs__value_PR_GNB_CU_UP_Name); + _EQ_CHECK_INT(ie->value.present, E1AP_GNB_CU_UP_E1SetupRequestIEs__value_PR_GNB_CU_UP_Name); // gNB-CU-UP Name (O) E1AP_LIB_FIND_IE(E1AP_GNB_CU_UP_E1SetupRequestIEs_t, ie, in, E1AP_ProtocolIE_ID_id_gNB_CU_UP_Name, false); if (ie != NULL) { @@ -196,12 +196,12 @@ bool decode_e1ap_cuup_setup_request(const E1AP_E1AP_PDU_t *pdu, e1ap_setup_req_t } break; case E1AP_ProtocolIE_ID_id_CNSupport: - _E1_EQ_CHECK_INT(ie->value.present, E1AP_GNB_CU_UP_E1SetupRequestIEs__value_PR_CNSupport); - _E1_EQ_CHECK_INT(ie->value.choice.CNSupport, E1AP_CNSupport_c_5gc); // only 5GC CN Support supported + _EQ_CHECK_INT(ie->value.present, E1AP_GNB_CU_UP_E1SetupRequestIEs__value_PR_CNSupport); + _EQ_CHECK_LONG((long)ie->value.choice.CNSupport, (long)E1AP_CNSupport_c_5gc); // only 5GC CN Support supported out->cn_support = ie->value.choice.CNSupport; break; case E1AP_ProtocolIE_ID_id_SupportedPLMNs: - _E1_EQ_CHECK_INT(ie->value.present, E1AP_GNB_CU_UP_E1SetupRequestIEs__value_PR_SupportedPLMNs_List); + _EQ_CHECK_INT(ie->value.present, E1AP_GNB_CU_UP_E1SetupRequestIEs__value_PR_SupportedPLMNs_List); out->supported_plmns = ie->value.choice.SupportedPLMNs_List.list.count; for (int i = 0; i < out->supported_plmns; i++) { @@ -275,19 +275,19 @@ void free_e1ap_cuup_setup_request(e1ap_setup_req_t *msg) */ bool eq_e1ap_cuup_setup_request(const e1ap_setup_req_t *a, const e1ap_setup_req_t *b) { - _E1_EQ_CHECK_INT(a->transac_id, b->transac_id); - _E1_EQ_CHECK_INT(a->gNB_cu_up_id, b->gNB_cu_up_id); + _EQ_CHECK_UINT64(a->transac_id, b->transac_id); + _EQ_CHECK_UINT64(a->gNB_cu_up_id, b->gNB_cu_up_id); if (a->gNB_cu_up_name && b->gNB_cu_up_name) - _E1_EQ_CHECK_STR(a->gNB_cu_up_name, b->gNB_cu_up_name) - _E1_EQ_CHECK_INT(a->supported_plmns, b->supported_plmns); + _EQ_CHECK_STR(a->gNB_cu_up_name, b->gNB_cu_up_name); + _EQ_CHECK_INT(a->supported_plmns, b->supported_plmns); for (int i = 0; i < a->supported_plmns; i++) { - _E1_EQ_CHECK_INT(a->plmn[i].id.mcc, b->plmn[i].id.mcc); - _E1_EQ_CHECK_INT(a->plmn[i].id.mnc, b->plmn[i].id.mnc); - _E1_EQ_CHECK_INT(a->plmn[i].id.mnc_digit_length, b->plmn[i].id.mnc_digit_length); - _E1_EQ_CHECK_INT(a->plmn[i].supported_slices, b->plmn[i].supported_slices); + _EQ_CHECK_INT(a->plmn[i].id.mcc, b->plmn[i].id.mcc); + _EQ_CHECK_INT(a->plmn[i].id.mnc, b->plmn[i].id.mnc); + _EQ_CHECK_INT(a->plmn[i].id.mnc_digit_length, b->plmn[i].id.mnc_digit_length); + _EQ_CHECK_INT(a->plmn[i].supported_slices, b->plmn[i].supported_slices); for (int s = 0; s < a->plmn[i].supported_slices; ++s) { - _E1_EQ_CHECK_INT(a->plmn[i].slice[s].sst, b->plmn[i].slice[s].sst); - _E1_EQ_CHECK_INT(a->plmn[i].slice[s].sd, b->plmn[i].slice[s].sd); + _EQ_CHECK_INT(a->plmn[i].slice[s].sst, b->plmn[i].slice[s].sst); + _EQ_CHECK_INT(a->plmn[i].slice[s].sd, b->plmn[i].slice[s].sd); } } return true; @@ -372,9 +372,9 @@ E1AP_E1AP_PDU_t *encode_e1ap_cuup_setup_response(const e1ap_setup_resp_t *msg) */ bool decode_e1ap_cuup_setup_response(const E1AP_E1AP_PDU_t *pdu, e1ap_setup_resp_t *out) { - _E1_EQ_CHECK_INT(pdu->present, E1AP_E1AP_PDU_PR_successfulOutcome); - _E1_EQ_CHECK_INT(pdu->choice.successfulOutcome->procedureCode, E1AP_ProcedureCode_id_gNB_CU_UP_E1Setup); - _E1_EQ_CHECK_INT(pdu->choice.successfulOutcome->value.present, E1AP_SuccessfulOutcome__value_PR_GNB_CU_UP_E1SetupResponse); + _EQ_CHECK_INT(pdu->present, E1AP_E1AP_PDU_PR_successfulOutcome); + _EQ_CHECK_LONG(pdu->choice.successfulOutcome->procedureCode, E1AP_ProcedureCode_id_gNB_CU_UP_E1Setup); + _EQ_CHECK_INT(pdu->choice.successfulOutcome->value.present, E1AP_SuccessfulOutcome__value_PR_GNB_CU_UP_E1SetupResponse); const E1AP_GNB_CU_UP_E1SetupResponse_t *in = &pdu->choice.successfulOutcome->value.choice.GNB_CU_UP_E1SetupResponse; E1AP_GNB_CU_UP_E1SetupResponseIEs_t *ie; // Transaction ID (M) @@ -391,7 +391,7 @@ bool decode_e1ap_cuup_setup_response(const E1AP_E1AP_PDU_t *pdu, e1ap_setup_resp case E1AP_ProtocolIE_ID_id_gNB_CU_CP_Name: // gNB-CU-CP Name (O) E1AP_LIB_FIND_IE(E1AP_GNB_CU_UP_E1SetupResponseIEs_t, ie, in, E1AP_ProtocolIE_ID_id_gNB_CU_CP_Name, false); - _E1_EQ_CHECK_INT(ie->value.present, E1AP_GNB_CU_UP_E1SetupResponseIEs__value_PR_GNB_CU_CP_Name); + _EQ_CHECK_INT(ie->value.present, E1AP_GNB_CU_UP_E1SetupResponseIEs__value_PR_GNB_CU_CP_Name); if (ie != NULL) { out->gNB_cu_cp_name = calloc_or_fail(ie->value.choice.GNB_CU_CP_Name.size + 1, sizeof(char)); memcpy(out->gNB_cu_cp_name, ie->value.choice.GNB_CU_CP_Name.buf, ie->value.choice.GNB_CU_CP_Name.size); @@ -474,30 +474,30 @@ void free_e1ap_cuup_setup_response(e1ap_setup_resp_t *msg) */ bool eq_e1ap_cuup_setup_response(const e1ap_setup_resp_t *a, const e1ap_setup_resp_t *b) { - _E1_EQ_CHECK_LONG(a->transac_id, b->transac_id); + _EQ_CHECK_LONG(a->transac_id, b->transac_id); if ((a->gNB_cu_cp_name && !b->gNB_cu_cp_name) || (!a->gNB_cu_cp_name && b->gNB_cu_cp_name)) return false; if (a->gNB_cu_cp_name && b->gNB_cu_cp_name) - _E1_EQ_CHECK_STR(a->gNB_cu_cp_name, b->gNB_cu_cp_name); + _EQ_CHECK_STR(a->gNB_cu_cp_name, b->gNB_cu_cp_name); if ((a->tnla_info && !b->tnla_info) || (!a->tnla_info && b->tnla_info)) return false; if (a->tnla_info && b->tnla_info) { - _E1_EQ_CHECK_INT(a->tnla_info->num_addresses_to_add, b->tnla_info->num_addresses_to_add); - _E1_EQ_CHECK_INT(a->tnla_info->num_addresses_to_remove, b->tnla_info->num_addresses_to_remove); + _EQ_CHECK_INT(a->tnla_info->num_addresses_to_add, b->tnla_info->num_addresses_to_add); + _EQ_CHECK_INT(a->tnla_info->num_addresses_to_remove, b->tnla_info->num_addresses_to_remove); for (int i = 0; i < a->tnla_info->num_addresses_to_add; i++) { tnl_address_info_item_t *a_to_add = &a->tnla_info->addresses_to_add[i]; tnl_address_info_item_t *b_to_add = &b->tnla_info->addresses_to_add[i]; - _E1_EQ_CHECK_LONG(a_to_add->ipsec_tl_address, b_to_add->ipsec_tl_address); + _EQ_CHECK_UINT32(a_to_add->ipsec_tl_address, b_to_add->ipsec_tl_address); for (int j = 0; j < a_to_add->num_gtp_tl_addresses; j++) { - _E1_EQ_CHECK_LONG(a_to_add->gtp_tl_addresses[j], b_to_add->gtp_tl_addresses[j]); + _EQ_CHECK_UINT32(a_to_add->gtp_tl_addresses[j], b_to_add->gtp_tl_addresses[j]); } } for (int i = 0; i < a->tnla_info->num_addresses_to_remove; i++) { tnl_address_info_item_t *a_to_rem = &a->tnla_info->addresses_to_remove[i]; tnl_address_info_item_t *b_to_rem = &b->tnla_info->addresses_to_remove[i]; - _E1_EQ_CHECK_LONG(a_to_rem->ipsec_tl_address, b_to_rem->ipsec_tl_address); + _EQ_CHECK_UINT32(a_to_rem->ipsec_tl_address, b_to_rem->ipsec_tl_address); for (int j = 0; j < a_to_rem->num_gtp_tl_addresses; j++) { - _E1_EQ_CHECK_LONG(a_to_rem->gtp_tl_addresses[j], b_to_rem->gtp_tl_addresses[j]); + _EQ_CHECK_UINT32(a_to_rem->gtp_tl_addresses[j], b_to_rem->gtp_tl_addresses[j]); } } } @@ -558,8 +558,8 @@ E1AP_E1AP_PDU_t *encode_e1ap_cuup_setup_failure(const e1ap_setup_fail_t *msg) */ bool decode_e1ap_cuup_setup_failure(const E1AP_E1AP_PDU_t *pdu, e1ap_setup_fail_t *out) { - _E1_EQ_CHECK_INT(pdu->present, E1AP_E1AP_PDU_PR_unsuccessfulOutcome); - _E1_EQ_CHECK_INT(pdu->choice.unsuccessfulOutcome->procedureCode, E1AP_ProcedureCode_id_gNB_CU_UP_E1Setup); + _EQ_CHECK_INT(pdu->present, E1AP_E1AP_PDU_PR_unsuccessfulOutcome); + _EQ_CHECK_LONG(pdu->choice.unsuccessfulOutcome->procedureCode, E1AP_ProcedureCode_id_gNB_CU_UP_E1Setup); const E1AP_GNB_CU_UP_E1SetupFailure_t *in = &pdu->choice.unsuccessfulOutcome->value.choice.GNB_CU_UP_E1SetupFailure; E1AP_GNB_CU_UP_E1SetupFailureIEs_t *ie; // Check mandatory IEs first @@ -647,25 +647,25 @@ void free_e1ap_cuup_setup_failure(e1ap_setup_fail_t *msg) */ bool eq_e1ap_cuup_setup_failure(const e1ap_setup_fail_t *a, const e1ap_setup_fail_t *b) { - _E1_EQ_CHECK_LONG(a->transac_id, b->transac_id); - _E1_EQ_CHECK_INT(a->cause.type, b->cause.type); - _E1_EQ_CHECK_INT(a->cause.value, b->cause.value); + _EQ_CHECK_LONG(a->transac_id, b->transac_id); + _EQ_CHECK_INT(a->cause.type, b->cause.type); + _EQ_CHECK_INT(a->cause.value, b->cause.value); if (a->time_to_wait && b->time_to_wait) - _E1_EQ_CHECK_LONG(*a->time_to_wait, *b->time_to_wait); + _EQ_CHECK_LONG(*a->time_to_wait, *b->time_to_wait); if (a->crit_diag && b->crit_diag) { if (a->crit_diag->procedure_code && b->crit_diag->procedure_code) - _E1_EQ_CHECK_LONG(*(a->crit_diag->procedure_code), *(b->crit_diag->procedure_code)); + _EQ_CHECK_INT(*(a->crit_diag->procedure_code), *(b->crit_diag->procedure_code)); if (a->crit_diag->triggering_msg && b->crit_diag->triggering_msg) - _E1_EQ_CHECK_LONG(*(a->crit_diag->triggering_msg), *(b->crit_diag->triggering_msg)); + _EQ_CHECK_UINT32(*(a->crit_diag->triggering_msg), *(b->crit_diag->triggering_msg)); if (a->crit_diag->procedure_criticality && b->crit_diag->procedure_criticality) - _E1_EQ_CHECK_LONG(*(a->crit_diag->procedure_criticality), *(b->crit_diag->procedure_criticality)); - _E1_EQ_CHECK_INT(a->crit_diag->num_errors, b->crit_diag->num_errors); + _EQ_CHECK_UINT32(*(a->crit_diag->procedure_criticality), *(b->crit_diag->procedure_criticality)); + _EQ_CHECK_INT(a->crit_diag->num_errors, b->crit_diag->num_errors); for (int i = 0; i < a->crit_diag->num_errors; i++) { const criticality_diagnostics_ie_t *a_err = &a->crit_diag->errors[i]; const criticality_diagnostics_ie_t *b_err = &b->crit_diag->errors[i]; - _E1_EQ_CHECK_INT(a_err->ie_id, b_err->ie_id); - _E1_EQ_CHECK_INT(a_err->error_type, b_err->error_type); - _E1_EQ_CHECK_INT(a_err->criticality, b_err->criticality); + _EQ_CHECK_INT(a_err->ie_id, b_err->ie_id); + _EQ_CHECK_INT(a_err->error_type, b_err->error_type); + _EQ_CHECK_INT(a_err->criticality, b_err->criticality); } } return true; diff --git a/openair2/E1AP/lib/e1ap_lib_common.h b/openair2/E1AP/lib/e1ap_lib_common.h index ea6aa7f2ef..e2345a0a19 100644 --- a/openair2/E1AP/lib/e1ap_lib_common.h +++ b/openair2/E1AP/lib/e1ap_lib_common.h @@ -27,12 +27,7 @@ #include #include "openair3/UTILS/conversions.h" #include "e1ap_messages_types.h" - -#ifdef E1AP_LOG_ERRORS -#define PRINT_ERROR(fmt, ...) fprintf(stderr, "[%s] " fmt, __func__, ##__VA_ARGS__) -#else -#define PRINT_ERROR(...) // Do nothing -#endif +#include "common/utils/eq_check.h" #define CHECK_E1AP_DEC(exp) \ do { \ @@ -42,22 +37,6 @@ } \ } while (0) -#define _E1_EQ_CHECK_GENERIC(condition, fmt, ...) \ - do { \ - if (!(condition)) { \ - PRINT_ERROR("E1 Equality Check failure: %s:%d: Condition '%s' failed: " fmt " != " fmt "\n", \ - __FILE__, \ - __LINE__, \ - #condition, \ - ##__VA_ARGS__); \ - return false; \ - } \ - } while (0) - -#define _E1_EQ_CHECK_LONG(A, B) _E1_EQ_CHECK_GENERIC(A == B, "%ld", A, B); -#define _E1_EQ_CHECK_INT(A, B) _E1_EQ_CHECK_GENERIC(A == B, "%d", A, B); -#define _E1_EQ_CHECK_STR(A, B) _E1_EQ_CHECK_GENERIC(strcmp(A, B) == 0, "'%s'", A, B); - // Macro to look up IE. If mandatory and not found, macro will log an error and return false. #define E1AP_LIB_FIND_IE(IE_TYPE, ie, container, IE_ID, mandatory) \ do { \ @@ -84,29 +63,6 @@ } \ } while (0) -#define _E1_EQ_CHECK_OPTIONAL_IE(a, b, field, EQ_MACRO) \ - do { \ - if (((a)->field && !(b)->field) || (!(a)->field && (b)->field)) { \ - return false; /* One of the two is not allocated */ \ - } \ - if ((a)->field && (b)->field) { \ - EQ_MACRO(*(a)->field, *(b)->field) \ - } \ - } while (0) - -#define _E1_EQ_CHECK_OPTIONAL_PTR(a, b, field) \ - do { \ - if (((a)->field && !(b)->field) || (!(a)->field && (b)->field)) { \ - PRINT_ERROR("%s:%d: optional IE '%s' not allocated: %p, %p\n", \ - __FILE__, \ - __LINE__, \ - #field, \ - (void *)(a)->field, \ - (void *)(b)->field); \ - return false; /* One of the two is not allocated */ \ - } \ - } while (0) - struct E1AP_Cause; struct E1AP_Cause e1_encode_cause_ie(const e1ap_cause_t *cause); e1ap_cause_t e1_decode_cause_ie(const struct E1AP_Cause *ie); diff --git a/openair2/F1AP/lib/f1ap_interface_management.c b/openair2/F1AP/lib/f1ap_interface_management.c index 55b4972d4b..6710645b93 100644 --- a/openair2/F1AP/lib/f1ap_interface_management.c +++ b/openair2/F1AP/lib/f1ap_interface_management.c @@ -69,11 +69,11 @@ bool eq_f1ap_ue_to_reset(const f1ap_ue_to_reset_t *a, const f1ap_ue_to_reset_t * if ((!a->gNB_CU_ue_id) ^ (!b->gNB_CU_ue_id)) return false; if (a->gNB_CU_ue_id) - _F1_EQ_CHECK_INT(*a->gNB_CU_ue_id, *b->gNB_CU_ue_id); + _EQ_CHECK_INT(*a->gNB_CU_ue_id, *b->gNB_CU_ue_id); if ((!a->gNB_DU_ue_id) ^ (!b->gNB_DU_ue_id)) return false; if (a->gNB_DU_ue_id) - _F1_EQ_CHECK_INT(*a->gNB_DU_ue_id, *b->gNB_DU_ue_id); + _EQ_CHECK_INT(*a->gNB_DU_ue_id, *b->gNB_DU_ue_id); return true; } @@ -148,10 +148,10 @@ F1AP_F1AP_PDU_t *encode_f1ap_reset(const f1ap_reset_t *msg) /* @brief decode F1 Reset (9.2.1.1 in TS 38.473) */ bool decode_f1ap_reset(const F1AP_F1AP_PDU_t *pdu, f1ap_reset_t *out) { - _F1_EQ_CHECK_INT(pdu->present, F1AP_F1AP_PDU_PR_initiatingMessage); + _EQ_CHECK_INT(pdu->present, F1AP_F1AP_PDU_PR_initiatingMessage); AssertError(pdu->choice.initiatingMessage != NULL, return false, "pdu->choice.initiatingMessage is NULL"); - _F1_EQ_CHECK_LONG(pdu->choice.initiatingMessage->procedureCode, F1AP_ProcedureCode_id_Reset); - _F1_EQ_CHECK_INT(pdu->choice.initiatingMessage->value.present, F1AP_InitiatingMessage__value_PR_Reset); + _EQ_CHECK_LONG(pdu->choice.initiatingMessage->procedureCode, F1AP_ProcedureCode_id_Reset); + _EQ_CHECK_INT(pdu->choice.initiatingMessage->value.present, F1AP_InitiatingMessage__value_PR_Reset); /* Check presence of mandatory IEs */ F1AP_Reset_t *in = &pdu->choice.initiatingMessage->value.choice.Reset; @@ -167,12 +167,12 @@ bool decode_f1ap_reset(const F1AP_F1AP_PDU_t *pdu, f1ap_reset_t *out) switch (ie->id) { case F1AP_ProtocolIE_ID_id_TransactionID: // (M) Transaction ID - _F1_EQ_CHECK_INT(ie->value.present, F1AP_ResetIEs__value_PR_TransactionID); + _EQ_CHECK_INT(ie->value.present, F1AP_ResetIEs__value_PR_TransactionID); out->transaction_id = ie->value.choice.TransactionID; break; case F1AP_ProtocolIE_ID_id_Cause: // (M) Cause - _F1_EQ_CHECK_INT(ie->value.present, F1AP_ResetIEs__value_PR_Cause); + _EQ_CHECK_INT(ie->value.present, F1AP_ResetIEs__value_PR_Cause); if (!decode_f1ap_cause(ie->value.choice.Cause, &out->cause, &out->cause_value)) { PRINT_ERROR("could not decode F1AP Cause\n"); return false; @@ -180,7 +180,7 @@ bool decode_f1ap_reset(const F1AP_F1AP_PDU_t *pdu, f1ap_reset_t *out) break; case F1AP_ProtocolIE_ID_id_ResetType: // (M) Reset type - _F1_EQ_CHECK_INT(ie->value.present, F1AP_ResetIEs__value_PR_ResetType); + _EQ_CHECK_INT(ie->value.present, F1AP_ResetIEs__value_PR_ResetType); if (ie->value.choice.ResetType.present == F1AP_ResetType_PR_f1_Interface) { out->reset_type = F1AP_RESET_ALL; } else if (ie->value.choice.ResetType.present == F1AP_ResetType_PR_partOfF1_Interface) { @@ -192,9 +192,9 @@ bool decode_f1ap_reset(const F1AP_F1AP_PDU_t *pdu, f1ap_reset_t *out) for (int i = 0; i < out->num_ue_to_reset; ++i) { const F1AP_UE_associatedLogicalF1_ConnectionItemRes_t *it_res = (const F1AP_UE_associatedLogicalF1_ConnectionItemRes_t *)con_list->list.array[i]; - _F1_EQ_CHECK_LONG(it_res->id, F1AP_ProtocolIE_ID_id_UE_associatedLogicalF1_ConnectionItem); - _F1_EQ_CHECK_INT(it_res->value.present, - F1AP_UE_associatedLogicalF1_ConnectionItemRes__value_PR_UE_associatedLogicalF1_ConnectionItem); + _EQ_CHECK_LONG(it_res->id, F1AP_ProtocolIE_ID_id_UE_associatedLogicalF1_ConnectionItem); + _EQ_CHECK_INT(it_res->value.present, + F1AP_UE_associatedLogicalF1_ConnectionItemRes__value_PR_UE_associatedLogicalF1_ConnectionItem); out->ue_to_reset[i] = decode_f1ap_ue_to_reset(&it_res->value.choice.UE_associatedLogicalF1_ConnectionItem); } } else { @@ -220,12 +220,12 @@ void free_f1ap_reset(f1ap_reset_t *msg) bool eq_f1ap_reset(const f1ap_reset_t *a, const f1ap_reset_t *b) { - _F1_EQ_CHECK_LONG(a->transaction_id, b->transaction_id); - _F1_EQ_CHECK_INT(a->cause, b->cause); - _F1_EQ_CHECK_LONG(a->cause_value, b->cause_value); - _F1_EQ_CHECK_INT(a->reset_type, b->reset_type); + _EQ_CHECK_LONG(a->transaction_id, b->transaction_id); + _EQ_CHECK_INT(a->cause, b->cause); + _EQ_CHECK_LONG(a->cause_value, b->cause_value); + _EQ_CHECK_INT(a->reset_type, b->reset_type); if (a->reset_type == F1AP_RESET_PART_OF_F1_INTERFACE) { - _F1_EQ_CHECK_INT(a->num_ue_to_reset, b->num_ue_to_reset); + _EQ_CHECK_INT(a->num_ue_to_reset, b->num_ue_to_reset); for (int i = 0; i < a->num_ue_to_reset; ++i) if (!eq_f1ap_ue_to_reset(&a->ue_to_reset[i], &b->ue_to_reset[i])) return false; @@ -295,10 +295,10 @@ struct F1AP_F1AP_PDU *encode_f1ap_reset_ack(const f1ap_reset_ack_t *msg) /* @brief decode F1 Reset Ack (9.2.1.2 in TS 38.473) */ bool decode_f1ap_reset_ack(const struct F1AP_F1AP_PDU *pdu, f1ap_reset_ack_t *out) { - _F1_EQ_CHECK_INT(pdu->present, F1AP_F1AP_PDU_PR_successfulOutcome); + _EQ_CHECK_INT(pdu->present, F1AP_F1AP_PDU_PR_successfulOutcome); AssertError(pdu->choice.successfulOutcome != NULL, return false, "pdu->choice.initiatingMessage is NULL"); - _F1_EQ_CHECK_LONG(pdu->choice.successfulOutcome->procedureCode, F1AP_ProcedureCode_id_Reset); - _F1_EQ_CHECK_INT(pdu->choice.successfulOutcome->value.present, F1AP_SuccessfulOutcome__value_PR_ResetAcknowledge); + _EQ_CHECK_LONG(pdu->choice.successfulOutcome->procedureCode, F1AP_ProcedureCode_id_Reset); + _EQ_CHECK_INT(pdu->choice.successfulOutcome->value.present, F1AP_SuccessfulOutcome__value_PR_ResetAcknowledge); /* Check presence of mandatory IEs */ F1AP_ResetAcknowledge_t *in = &pdu->choice.successfulOutcome->value.choice.ResetAcknowledge; @@ -312,11 +312,11 @@ bool decode_f1ap_reset_ack(const struct F1AP_F1AP_PDU *pdu, f1ap_reset_ack_t *ou switch (ie->id) { case F1AP_ProtocolIE_ID_id_TransactionID: // (M) Transaction ID - _F1_EQ_CHECK_INT(ie->value.present, F1AP_ResetAcknowledgeIEs__value_PR_TransactionID); + _EQ_CHECK_INT(ie->value.present, F1AP_ResetAcknowledgeIEs__value_PR_TransactionID); out->transaction_id = ie->value.choice.TransactionID; break; case F1AP_ProtocolIE_ID_id_UE_associatedLogicalF1_ConnectionListResAck: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_ResetAcknowledgeIEs__value_PR_UE_associatedLogicalF1_ConnectionListResAck); + _EQ_CHECK_INT(ie->value.present, F1AP_ResetAcknowledgeIEs__value_PR_UE_associatedLogicalF1_ConnectionListResAck); { const F1AP_UE_associatedLogicalF1_ConnectionListResAck_t *conn_list = &ie->value.choice.UE_associatedLogicalF1_ConnectionListResAck; AssertError(conn_list->list.count > 0, return false, "no UEs for partially reset F1 interface\n"); @@ -324,8 +324,9 @@ bool decode_f1ap_reset_ack(const struct F1AP_F1AP_PDU *pdu, f1ap_reset_ack_t *ou out->ue_to_reset = calloc_or_fail(out->num_ue_to_reset, sizeof(*out->ue_to_reset)); for (int i = 0; i < out->num_ue_to_reset; ++i) { const F1AP_UE_associatedLogicalF1_ConnectionItemResAck_t *it_res = (const F1AP_UE_associatedLogicalF1_ConnectionItemResAck_t *)conn_list->list.array[i]; - _F1_EQ_CHECK_LONG(it_res->id, F1AP_ProtocolIE_ID_id_UE_associatedLogicalF1_ConnectionItem); - _F1_EQ_CHECK_INT(it_res->value.present, F1AP_UE_associatedLogicalF1_ConnectionItemResAck__value_PR_UE_associatedLogicalF1_ConnectionItem); + _EQ_CHECK_LONG(it_res->id, F1AP_ProtocolIE_ID_id_UE_associatedLogicalF1_ConnectionItem); + _EQ_CHECK_INT(it_res->value.present, + F1AP_UE_associatedLogicalF1_ConnectionItemResAck__value_PR_UE_associatedLogicalF1_ConnectionItem); out->ue_to_reset[i] = decode_f1ap_ue_to_reset(&it_res->value.choice.UE_associatedLogicalF1_ConnectionItem); } } @@ -347,8 +348,8 @@ void free_f1ap_reset_ack(f1ap_reset_ack_t *msg) bool eq_f1ap_reset_ack(const f1ap_reset_ack_t *a, const f1ap_reset_ack_t *b) { - _F1_EQ_CHECK_LONG(a->transaction_id, b->transaction_id); - _F1_EQ_CHECK_INT(a->num_ue_to_reset, b->num_ue_to_reset); + _EQ_CHECK_LONG(a->transaction_id, b->transaction_id); + _EQ_CHECK_INT(a->num_ue_to_reset, b->num_ue_to_reset); for (int i = 0; i < a->num_ue_to_reset; ++i) { if (!eq_f1ap_ue_to_reset(&a->ue_to_reset[i], &b->ue_to_reset[i])) return false; @@ -806,10 +807,10 @@ F1AP_F1AP_PDU_t *encode_f1ap_setup_request(const f1ap_setup_req_t *msg) bool decode_f1ap_setup_request(const F1AP_F1AP_PDU_t *pdu, f1ap_setup_req_t *out) { /* Check presence of message type */ - _F1_EQ_CHECK_INT(pdu->present, F1AP_F1AP_PDU_PR_initiatingMessage); + _EQ_CHECK_INT(pdu->present, F1AP_F1AP_PDU_PR_initiatingMessage); AssertError(pdu->choice.initiatingMessage != NULL, return false, "pdu->choice.initiatingMessage is NULL"); - _F1_EQ_CHECK_LONG(pdu->choice.initiatingMessage->procedureCode, F1AP_ProcedureCode_id_F1Setup); - _F1_EQ_CHECK_INT(pdu->choice.initiatingMessage->value.present, F1AP_InitiatingMessage__value_PR_F1SetupRequest); + _EQ_CHECK_LONG(pdu->choice.initiatingMessage->procedureCode, F1AP_ProcedureCode_id_F1Setup); + _EQ_CHECK_INT(pdu->choice.initiatingMessage->value.present, F1AP_InitiatingMessage__value_PR_F1SetupRequest); /* Check presence of mandatory IEs */ F1AP_F1SetupRequest_t *in = &pdu->choice.initiatingMessage->value.choice.F1SetupRequest; F1AP_F1SetupRequestIEs_t *ie; @@ -823,13 +824,13 @@ bool decode_f1ap_setup_request(const F1AP_F1AP_PDU_t *pdu, f1ap_setup_req_t *out switch (ie->id) { case F1AP_ProtocolIE_ID_id_TransactionID: // Transaction ID (M) - _F1_EQ_CHECK_INT(ie->value.present, F1AP_F1SetupRequestIEs__value_PR_TransactionID); + _EQ_CHECK_INT(ie->value.present, F1AP_F1SetupRequestIEs__value_PR_TransactionID); AssertError(ie->value.choice.TransactionID != -1, return false, "ie->value.choice.TransactionID is -1"); out->transaction_id = ie->value.choice.TransactionID; break; case F1AP_ProtocolIE_ID_id_gNB_DU_ID: // gNB-DU ID (M) - _F1_EQ_CHECK_INT(ie->value.present, F1AP_F1SetupRequestIEs__value_PR_GNB_DU_ID); + _EQ_CHECK_INT(ie->value.present, F1AP_F1SetupRequestIEs__value_PR_GNB_DU_ID); asn_INTEGER2ulong(&ie->value.choice.GNB_DU_ID, &out->gNB_DU_id); break; case F1AP_ProtocolIE_ID_id_gNB_DU_Name: { @@ -971,19 +972,19 @@ f1ap_setup_req_t cp_f1ap_setup_request(const f1ap_setup_req_t *msg) */ bool eq_f1ap_setup_request(const f1ap_setup_req_t *a, const f1ap_setup_req_t *b) { - _F1_EQ_CHECK_LONG(a->gNB_DU_id, b->gNB_DU_id); - _F1_EQ_CHECK_STR(a->gNB_DU_name, b->gNB_DU_name); - _F1_EQ_CHECK_LONG(a->transaction_id, b->transaction_id); - _F1_EQ_CHECK_INT(a->num_cells_available, b->num_cells_available); + _EQ_CHECK_LONG(a->gNB_DU_id, b->gNB_DU_id); + _EQ_CHECK_STR(a->gNB_DU_name, b->gNB_DU_name); + _EQ_CHECK_LONG(a->transaction_id, b->transaction_id); + _EQ_CHECK_INT(a->num_cells_available, b->num_cells_available); for (int i = 0; i < a->num_cells_available && i < F1AP_MAX_NB_CELLS; i++) { if (!eq_f1ap_cell_info(&a->cell[i].info, &b->cell[i].info)) return false; if (!eq_f1ap_sys_info(a->cell[i].sys_info, b->cell[i].sys_info)) return false; } - _F1_EQ_CHECK_LONG(sizeofArray(a->rrc_ver), sizeofArray(b->rrc_ver)); + _EQ_CHECK_LONG(sizeofArray(a->rrc_ver), sizeofArray(b->rrc_ver)); for (int i = 0; i < sizeofArray(a->rrc_ver); i++) { - _F1_EQ_CHECK_INT(a->rrc_ver[i], b->rrc_ver[i]); + _EQ_CHECK_INT(a->rrc_ver[i], b->rrc_ver[i]); } return true; } @@ -1087,9 +1088,9 @@ F1AP_F1AP_PDU_t *encode_f1ap_setup_response(const f1ap_setup_resp_t *msg) bool decode_f1ap_setup_response(const F1AP_F1AP_PDU_t *pdu, f1ap_setup_resp_t *out) { /* Check presence of message type */ - _F1_EQ_CHECK_INT(pdu->present, F1AP_F1AP_PDU_PR_successfulOutcome); - _F1_EQ_CHECK_LONG(pdu->choice.successfulOutcome->procedureCode, F1AP_ProcedureCode_id_F1Setup); - _F1_EQ_CHECK_INT(pdu->choice.successfulOutcome->value.present, F1AP_SuccessfulOutcome__value_PR_F1SetupResponse); + _EQ_CHECK_INT(pdu->present, F1AP_F1AP_PDU_PR_successfulOutcome); + _EQ_CHECK_LONG(pdu->choice.successfulOutcome->procedureCode, F1AP_ProcedureCode_id_F1Setup); + _EQ_CHECK_INT(pdu->choice.successfulOutcome->value.present, F1AP_SuccessfulOutcome__value_PR_F1SetupResponse); /* Check presence of mandatory IEs */ F1AP_F1SetupResponse_t *in = &pdu->choice.successfulOutcome->value.choice.F1SetupResponse; F1AP_F1SetupResponseIEs_t *ie; @@ -1101,14 +1102,14 @@ bool decode_f1ap_setup_response(const F1AP_F1AP_PDU_t *pdu, f1ap_setup_resp_t *o switch (ie->id) { case F1AP_ProtocolIE_ID_id_TransactionID: // Transaction ID (M) - _F1_EQ_CHECK_INT(ie->value.present, F1AP_F1SetupResponseIEs__value_PR_TransactionID); - AssertError(ie->value.choice.TransactionID != -1, return false, "ie->value.choice.TransactionID is -1"); - out->transaction_id = ie->value.choice.TransactionID; - break; + _EQ_CHECK_INT(ie->value.present, F1AP_F1SetupResponseIEs__value_PR_TransactionID); + AssertError(ie->value.choice.TransactionID != -1, return false, "ie->value.choice.TransactionID is -1"); + out->transaction_id = ie->value.choice.TransactionID; + break; case F1AP_ProtocolIE_ID_id_gNB_CU_Name: { // gNB-CU Name (O) - _F1_EQ_CHECK_INT(ie->value.present, F1AP_F1SetupResponseIEs__value_PR_GNB_CU_Name); + _EQ_CHECK_INT(ie->value.present, F1AP_F1SetupResponseIEs__value_PR_GNB_CU_Name); const F1AP_GNB_CU_Name_t *cu_name = &ie->value.choice.GNB_CU_Name; out->gNB_CU_name = calloc_or_fail(cu_name->size + 1, sizeof(*out->gNB_CU_name)); strncpy(out->gNB_CU_name, (char *)cu_name->buf, cu_name->size); @@ -1116,18 +1117,18 @@ bool decode_f1ap_setup_response(const F1AP_F1AP_PDU_t *pdu, f1ap_setup_resp_t *o case F1AP_ProtocolIE_ID_id_GNB_CU_RRC_Version: // gNB-CU RRC version (M) - _F1_EQ_CHECK_INT(ie->value.present, F1AP_F1SetupResponseIEs__value_PR_RRC_Version); - // RRC Version: "This IE is not used in this release." - if (ie->value.choice.RRC_Version.iE_Extensions) { - F1AP_ProtocolExtensionContainer_11023P233_t *ext = - (F1AP_ProtocolExtensionContainer_11023P233_t *)ie->value.choice.RRC_Version.iE_Extensions; - if (ext->list.count > 0) { - F1AP_RRC_Version_ExtIEs_t *rrcext = ext->list.array[0]; - OCTET_STRING_t *os = &rrcext->extensionValue.choice.OCTET_STRING_SIZE_3_; - for (int i = 0; i < sizeofArray(out->rrc_ver); i++) - out->rrc_ver[i] = os->buf[i]; - } + _EQ_CHECK_INT(ie->value.present, F1AP_F1SetupResponseIEs__value_PR_RRC_Version); + // RRC Version: "This IE is not used in this release." + if (ie->value.choice.RRC_Version.iE_Extensions) { + F1AP_ProtocolExtensionContainer_11023P233_t *ext = + (F1AP_ProtocolExtensionContainer_11023P233_t *)ie->value.choice.RRC_Version.iE_Extensions; + if (ext->list.count > 0) { + F1AP_RRC_Version_ExtIEs_t *rrcext = ext->list.array[0]; + OCTET_STRING_t *os = &rrcext->extensionValue.choice.OCTET_STRING_SIZE_3_; + for (int i = 0; i < sizeofArray(out->rrc_ver); i++) + out->rrc_ver[i] = os->buf[i]; } + } break; case F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List: { @@ -1161,17 +1162,17 @@ bool decode_f1ap_setup_response(const F1AP_F1AP_PDU_t *pdu, f1ap_setup_resp_t *o */ bool eq_f1ap_setup_response(const f1ap_setup_resp_t *a, const f1ap_setup_resp_t *b) { - _F1_EQ_CHECK_STR(a->gNB_CU_name, b->gNB_CU_name); - _F1_EQ_CHECK_INT(a->num_cells_to_activate, b->num_cells_to_activate); - _F1_EQ_CHECK_LONG(a->transaction_id, b->transaction_id); + _EQ_CHECK_STR(a->gNB_CU_name, b->gNB_CU_name); + _EQ_CHECK_INT(a->num_cells_to_activate, b->num_cells_to_activate); + _EQ_CHECK_LONG(a->transaction_id, b->transaction_id); if (a->num_cells_to_activate) { for (int i = 0; i < a->num_cells_to_activate && i < F1AP_MAX_NB_CELLS; i++) { const served_cells_to_activate_t *a_cell = &a->cells_to_activate[i]; const served_cells_to_activate_t *b_cell = &b->cells_to_activate[i]; - _F1_EQ_CHECK_LONG(a_cell->nr_cellid, b_cell->nr_cellid); - _F1_EQ_CHECK_INT(a_cell->nrpci, b_cell->nrpci); - _F1_EQ_CHECK_INT(a_cell->num_SI, b_cell->num_SI); - _F1_EQ_CHECK_LONG(a_cell->nr_cellid, b_cell->nr_cellid); + _EQ_CHECK_LONG(a_cell->nr_cellid, b_cell->nr_cellid); + _EQ_CHECK_INT(a_cell->nrpci, b_cell->nrpci); + _EQ_CHECK_INT(a_cell->num_SI, b_cell->num_SI); + _EQ_CHECK_LONG(a_cell->nr_cellid, b_cell->nr_cellid); if (!eq_f1ap_plmn(&a_cell->plmn, &b_cell->plmn)) return false; if (sizeofArray(a->cells_to_activate[i].SI_msg) != sizeofArray(b->cells_to_activate[i].SI_msg)) @@ -1179,15 +1180,15 @@ bool eq_f1ap_setup_response(const f1ap_setup_resp_t *a, const f1ap_setup_resp_t for (int j = 0; j < b->cells_to_activate[i].num_SI; j++) { const f1ap_sib_msg_t *a_SI_msg = &a->cells_to_activate[i].SI_msg[j]; const f1ap_sib_msg_t *b_SI_msg = &b->cells_to_activate[i].SI_msg[j]; - _F1_EQ_CHECK_INT(*a_SI_msg->SI_container, *b_SI_msg->SI_container); - _F1_EQ_CHECK_INT(a_SI_msg->SI_container_length, b_SI_msg->SI_container_length); - _F1_EQ_CHECK_INT(a_SI_msg->SI_type, b_SI_msg->SI_type); + _EQ_CHECK_INT(*a_SI_msg->SI_container, *b_SI_msg->SI_container); + _EQ_CHECK_INT(a_SI_msg->SI_container_length, b_SI_msg->SI_container_length); + _EQ_CHECK_INT(a_SI_msg->SI_type, b_SI_msg->SI_type); } } } - _F1_EQ_CHECK_LONG(sizeofArray(a->rrc_ver), sizeofArray(b->rrc_ver)); + _EQ_CHECK_LONG(sizeofArray(a->rrc_ver), sizeofArray(b->rrc_ver)); for (int i = 0; i < sizeofArray(a->rrc_ver); i++) { - _F1_EQ_CHECK_INT(a->rrc_ver[i], b->rrc_ver[i]); + _EQ_CHECK_INT(a->rrc_ver[i], b->rrc_ver[i]); } return true; } @@ -1340,7 +1341,7 @@ bool decode_f1ap_setup_failure(const F1AP_F1AP_PDU_t *pdu, f1ap_setup_failure_t */ bool eq_f1ap_setup_failure(const f1ap_setup_failure_t *a, const f1ap_setup_failure_t *b) { - _F1_EQ_CHECK_LONG(a->transaction_id, b->transaction_id); + _EQ_CHECK_LONG(a->transaction_id, b->transaction_id); return true; } @@ -1501,9 +1502,9 @@ F1AP_F1AP_PDU_t *encode_f1ap_du_configuration_update(const f1ap_gnb_du_configura bool decode_f1ap_du_configuration_update(const F1AP_F1AP_PDU_t *pdu, f1ap_gnb_du_configuration_update_t *out) { /* Check presence of message type */ - _F1_EQ_CHECK_INT(pdu->present, F1AP_F1AP_PDU_PR_initiatingMessage); - _F1_EQ_CHECK_LONG(pdu->choice.initiatingMessage->procedureCode, F1AP_ProcedureCode_id_gNBDUConfigurationUpdate); - _F1_EQ_CHECK_INT(pdu->choice.initiatingMessage->value.present, F1AP_InitiatingMessage__value_PR_GNBDUConfigurationUpdate); + _EQ_CHECK_INT(pdu->present, F1AP_F1AP_PDU_PR_initiatingMessage); + _EQ_CHECK_LONG(pdu->choice.initiatingMessage->procedureCode, F1AP_ProcedureCode_id_gNBDUConfigurationUpdate); + _EQ_CHECK_INT(pdu->choice.initiatingMessage->value.present, F1AP_InitiatingMessage__value_PR_GNBDUConfigurationUpdate); /* Check presence of mandatory IEs */ F1AP_GNBDUConfigurationUpdate_t *in = &pdu->choice.initiatingMessage->value.choice.GNBDUConfigurationUpdate; F1AP_GNBDUConfigurationUpdateIEs_t *ie; @@ -1638,10 +1639,10 @@ bool eq_f1ap_du_configuration_update(const f1ap_gnb_du_configuration_update_t *a if ((a->gNB_DU_ID != NULL) ^ (b->gNB_DU_ID != NULL)) return false; if (a->gNB_DU_ID != NULL && b->gNB_DU_ID != NULL) - _F1_EQ_CHECK_LONG(*a->gNB_DU_ID, *b->gNB_DU_ID); - _F1_EQ_CHECK_LONG(a->transaction_id, b->transaction_id); + _EQ_CHECK_LONG(*a->gNB_DU_ID, *b->gNB_DU_ID); + _EQ_CHECK_LONG(a->transaction_id, b->transaction_id); /* to add */ - _F1_EQ_CHECK_INT(a->num_cells_to_add, b->num_cells_to_add); + _EQ_CHECK_INT(a->num_cells_to_add, b->num_cells_to_add); for (int i = 0; i < a->num_cells_to_add && i < F1AP_MAX_NB_CELLS; i++) { if (!eq_f1ap_cell_info(&a->cell_to_add[i].info, &b->cell_to_add[i].info)) return false; @@ -1649,32 +1650,32 @@ bool eq_f1ap_du_configuration_update(const f1ap_gnb_du_configuration_update_t *a return false; } /* to delete */ - _F1_EQ_CHECK_INT(a->num_cells_to_delete, b->num_cells_to_delete); + _EQ_CHECK_INT(a->num_cells_to_delete, b->num_cells_to_delete); for (int i = 0; i < a->num_cells_to_delete && i < F1AP_MAX_NB_CELLS; i++) { - _F1_EQ_CHECK_LONG(a->cell_to_delete[i].nr_cellid, b->cell_to_delete[i].nr_cellid); + _EQ_CHECK_LONG(a->cell_to_delete[i].nr_cellid, b->cell_to_delete[i].nr_cellid); if (!eq_f1ap_plmn(&a->cell_to_delete[i].plmn, &b->cell_to_delete[i].plmn)) return false; } /* to modify */ - _F1_EQ_CHECK_INT(a->num_cells_to_modify, b->num_cells_to_modify); + _EQ_CHECK_INT(a->num_cells_to_modify, b->num_cells_to_modify); for (int i = 0; i < a->num_cells_to_modify && i < F1AP_MAX_NB_CELLS; i++) { if (!eq_f1ap_plmn(&a->cell_to_modify[i].old_plmn, &b->cell_to_modify[i].old_plmn)) return false; - _F1_EQ_CHECK_LONG(a->cell_to_modify[i].old_nr_cellid, b->cell_to_modify[i].old_nr_cellid); + _EQ_CHECK_LONG(a->cell_to_modify[i].old_nr_cellid, b->cell_to_modify[i].old_nr_cellid); if (!eq_f1ap_cell_info(&a->cell_to_modify[i].info, &b->cell_to_modify[i].info)) return false; if (!eq_f1ap_sys_info(a->cell_to_modify[i].sys_info, b->cell_to_modify[i].sys_info)) return false; } /* cell status */ - _F1_EQ_CHECK_INT(a->num_status, b->num_status); + _EQ_CHECK_INT(a->num_status, b->num_status); for (int i = 0; i < a->num_status && i < F1AP_MAX_NB_CELLS; ++i) { const f1ap_cell_status_t *astatus = &a->status[i]; const f1ap_cell_status_t *bstatus = &b->status[i]; if (!eq_f1ap_plmn(&astatus->plmn, &bstatus->plmn)) return false; - _F1_EQ_CHECK_LONG(astatus->nr_cellid, bstatus->nr_cellid); - _F1_EQ_CHECK_INT(astatus->service_state, bstatus->service_state); + _EQ_CHECK_LONG(astatus->nr_cellid, bstatus->nr_cellid); + _EQ_CHECK_INT(astatus->service_state, bstatus->service_state); } return true; } @@ -1770,10 +1771,10 @@ F1AP_F1AP_PDU_t *encode_f1ap_cu_configuration_update(const f1ap_gnb_cu_configura bool decode_f1ap_cu_configuration_update(const F1AP_F1AP_PDU_t *pdu, f1ap_gnb_cu_configuration_update_t *out) { /* Check presence of message type */ - _F1_EQ_CHECK_INT(pdu->present, F1AP_F1AP_PDU_PR_initiatingMessage); + _EQ_CHECK_INT(pdu->present, F1AP_F1AP_PDU_PR_initiatingMessage); AssertError(pdu->choice.initiatingMessage != NULL, return false, "pdu->choice.initiatingMessage is NULL"); - _F1_EQ_CHECK_LONG(pdu->choice.initiatingMessage->procedureCode, F1AP_ProcedureCode_id_gNBCUConfigurationUpdate); - _F1_EQ_CHECK_INT(pdu->choice.initiatingMessage->value.present, F1AP_InitiatingMessage__value_PR_GNBCUConfigurationUpdate); + _EQ_CHECK_LONG(pdu->choice.initiatingMessage->procedureCode, F1AP_ProcedureCode_id_gNBCUConfigurationUpdate); + _EQ_CHECK_INT(pdu->choice.initiatingMessage->value.present, F1AP_InitiatingMessage__value_PR_GNBCUConfigurationUpdate); /* Check presence of mandatory IEs */ F1AP_GNBCUConfigurationUpdate_t *in = &pdu->choice.initiatingMessage->value.choice.GNBCUConfigurationUpdate; F1AP_GNBCUConfigurationUpdateIEs_t *ie; @@ -1783,13 +1784,13 @@ bool decode_f1ap_cu_configuration_update(const F1AP_F1AP_PDU_t *pdu, f1ap_gnb_cu ie = in->protocolIEs.list.array[i]; switch (ie->id) { case F1AP_ProtocolIE_ID_id_TransactionID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_GNBCUConfigurationUpdateIEs__value_PR_TransactionID); + _EQ_CHECK_INT(ie->value.present, F1AP_GNBCUConfigurationUpdateIEs__value_PR_TransactionID); AssertError(ie->value.choice.TransactionID != -1, return false, "ie->value.choice.TransactionID is -1"); out->transaction_id = ie->value.choice.TransactionID; break; case F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List: { /* Cells to be Activated List (O) */ - _F1_EQ_CHECK_INT(ie->value.present, F1AP_GNBCUConfigurationUpdateIEs__value_PR_Cells_to_be_Activated_List); + _EQ_CHECK_INT(ie->value.present, F1AP_GNBCUConfigurationUpdateIEs__value_PR_Cells_to_be_Activated_List); /* Cells to be Activated List Item (count >= 1) */ F1AP_Cells_to_be_Activated_List_t *Cells_to_be_Activated_List = &ie->value.choice.Cells_to_be_Activated_List; out->num_cells_to_activate = Cells_to_be_Activated_List->list.count; @@ -1823,21 +1824,21 @@ void free_f1ap_cu_configuration_update(const f1ap_gnb_cu_configuration_update_t */ bool eq_f1ap_cu_configuration_update(const f1ap_gnb_cu_configuration_update_t *a, const f1ap_gnb_cu_configuration_update_t *b) { - _F1_EQ_CHECK_LONG(a->transaction_id, b->transaction_id); + _EQ_CHECK_LONG(a->transaction_id, b->transaction_id); /* to activate */ - _F1_EQ_CHECK_INT(a->num_cells_to_activate, b->num_cells_to_activate); + _EQ_CHECK_INT(a->num_cells_to_activate, b->num_cells_to_activate); for (int i = 0; i < a->num_cells_to_activate && i < F1AP_MAX_NB_CELLS; i++) { - _F1_EQ_CHECK_LONG(a->cells_to_activate[i].nr_cellid, b->cells_to_activate[i].nr_cellid); - _F1_EQ_CHECK_INT(a->cells_to_activate[i].nrpci, b->cells_to_activate[i].nrpci); + _EQ_CHECK_LONG(a->cells_to_activate[i].nr_cellid, b->cells_to_activate[i].nr_cellid); + _EQ_CHECK_INT(a->cells_to_activate[i].nrpci, b->cells_to_activate[i].nrpci); if (!eq_f1ap_plmn(&a->cells_to_activate[i].plmn, &b->cells_to_activate[i].plmn)) return false; - _F1_EQ_CHECK_INT(a->cells_to_activate[i].num_SI, b->cells_to_activate[i].num_SI); + _EQ_CHECK_INT(a->cells_to_activate[i].num_SI, b->cells_to_activate[i].num_SI); for (int s = 0; s < a->cells_to_activate[i].num_SI; s++) { f1ap_sib_msg_t *a_sib_msg = &a->cells_to_activate[i].SI_msg[s]; f1ap_sib_msg_t *b_sib_msg = &b->cells_to_activate[i].SI_msg[s]; - _F1_EQ_CHECK_INT(*a_sib_msg->SI_container, *b_sib_msg->SI_container); - _F1_EQ_CHECK_INT(a_sib_msg->SI_container_length, b_sib_msg->SI_container_length); - _F1_EQ_CHECK_INT(a_sib_msg->SI_type, b_sib_msg->SI_type); + _EQ_CHECK_INT(*a_sib_msg->SI_container, *b_sib_msg->SI_container); + _EQ_CHECK_INT(a_sib_msg->SI_container_length, b_sib_msg->SI_container_length); + _EQ_CHECK_INT(a_sib_msg->SI_type, b_sib_msg->SI_type); } } return true; @@ -1925,11 +1926,10 @@ bool decode_f1ap_cu_configuration_update_acknowledge(const F1AP_F1AP_PDU_t *pdu, f1ap_gnb_cu_configuration_update_acknowledge_t *out) { /* Message type */ - _F1_EQ_CHECK_INT(pdu->present, F1AP_F1AP_PDU_PR_successfulOutcome); + _EQ_CHECK_INT(pdu->present, F1AP_F1AP_PDU_PR_successfulOutcome); AssertError(pdu->choice.successfulOutcome != NULL, return false, "pdu->choice.successfulOutcome is NULL"); - _F1_EQ_CHECK_LONG(pdu->choice.successfulOutcome->procedureCode, F1AP_ProcedureCode_id_gNBCUConfigurationUpdate); - _F1_EQ_CHECK_INT(pdu->choice.successfulOutcome->value.present, - F1AP_SuccessfulOutcome__value_PR_GNBCUConfigurationUpdateAcknowledge); + _EQ_CHECK_LONG(pdu->choice.successfulOutcome->procedureCode, F1AP_ProcedureCode_id_gNBCUConfigurationUpdate); + _EQ_CHECK_INT(pdu->choice.successfulOutcome->value.present, F1AP_SuccessfulOutcome__value_PR_GNBCUConfigurationUpdateAcknowledge); /* payload */ F1AP_GNBCUConfigurationUpdateAcknowledge_t *in = &pdu->choice.successfulOutcome->value.choice.GNBCUConfigurationUpdateAcknowledge; F1AP_GNBCUConfigurationUpdateAcknowledgeIEs_t *ie; @@ -1940,14 +1940,13 @@ bool decode_f1ap_cu_configuration_update_acknowledge(const F1AP_F1AP_PDU_t *pdu, ie = in->protocolIEs.list.array[i]; switch (ie->id) { case F1AP_ProtocolIE_ID_id_TransactionID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_GNBCUConfigurationUpdateAcknowledgeIEs__value_PR_TransactionID); + _EQ_CHECK_INT(ie->value.present, F1AP_GNBCUConfigurationUpdateAcknowledgeIEs__value_PR_TransactionID); AssertError(ie->value.choice.TransactionID != -1, return false, "ie->value.choice.TransactionID is -1"); out->transaction_id = ie->value.choice.TransactionID; break; case F1AP_ProtocolIE_ID_id_Cells_Failed_to_be_Activated_List: { /* Decode Cells Failed to be Activated List */ - _F1_EQ_CHECK_INT(ie->value.present, - F1AP_GNBCUConfigurationUpdateAcknowledgeIEs__value_PR_Cells_Failed_to_be_Activated_List); + _EQ_CHECK_INT(ie->value.present, F1AP_GNBCUConfigurationUpdateAcknowledgeIEs__value_PR_Cells_Failed_to_be_Activated_List); F1AP_Cells_Failed_to_be_Activated_List_t *cell_fail_list = &ie->value.choice.Cells_Failed_to_be_Activated_List; out->num_cells_failed_to_be_activated = cell_fail_list->list.count; out->cells_failed_to_be_activated = @@ -1996,36 +1995,36 @@ bool eq_f1ap_cu_configuration_update_acknowledge(const f1ap_gnb_cu_configuration const f1ap_gnb_cu_configuration_update_acknowledge_t *b) { // Transaction ID - _F1_EQ_CHECK_LONG(a->transaction_id, b->transaction_id); + _EQ_CHECK_LONG(a->transaction_id, b->transaction_id); // number of cells failed to be activated - _F1_EQ_CHECK_INT(a->num_cells_failed_to_be_activated, b->num_cells_failed_to_be_activated); + _EQ_CHECK_INT(a->num_cells_failed_to_be_activated, b->num_cells_failed_to_be_activated); for (int i = 0; i < a->num_cells_failed_to_be_activated && i < F1AP_MAX_NB_CELLS; i++) { if (!eq_f1ap_plmn(&a->cells_failed_to_be_activated[i].plmn, &b->cells_failed_to_be_activated[i].plmn)) return false; - _F1_EQ_CHECK_LONG(a->cells_failed_to_be_activated[i].nr_cellid, b->cells_failed_to_be_activated[i].nr_cellid); - _F1_EQ_CHECK_INT(a->cells_failed_to_be_activated[i].cause, b->cells_failed_to_be_activated[i].cause); + _EQ_CHECK_LONG(a->cells_failed_to_be_activated[i].nr_cellid, b->cells_failed_to_be_activated[i].nr_cellid); + _EQ_CHECK_INT(a->cells_failed_to_be_activated[i].cause, b->cells_failed_to_be_activated[i].cause); } // TNL Associations to setup - _F1_EQ_CHECK_INT(a->noofTNLAssociations_to_setup, b->noofTNLAssociations_to_setup); + _EQ_CHECK_INT(a->noofTNLAssociations_to_setup, b->noofTNLAssociations_to_setup); for (int i = 0; i < a->noofTNLAssociations_to_setup && i < F1AP_MAX_NO_OF_TNL_ASSOCIATIONS; i++) { // Explicit comparison of TNL Association fields - _F1_EQ_CHECK_INT(a->tnlAssociations_to_setup[i].tl_address, b->tnlAssociations_to_setup[i].tl_address); - _F1_EQ_CHECK_INT(a->tnlAssociations_to_setup[i].port, b->tnlAssociations_to_setup[i].port); + _EQ_CHECK_INT(a->tnlAssociations_to_setup[i].tl_address, b->tnlAssociations_to_setup[i].tl_address); + _EQ_CHECK_INT(a->tnlAssociations_to_setup[i].port, b->tnlAssociations_to_setup[i].port); } // TNL Associations failed to setup - _F1_EQ_CHECK_INT(a->noofTNLAssociations_failed, b->noofTNLAssociations_failed); + _EQ_CHECK_INT(a->noofTNLAssociations_failed, b->noofTNLAssociations_failed); for (int i = 0; i < a->noofTNLAssociations_failed && i < F1AP_MAX_NO_OF_TNL_ASSOCIATIONS; i++) { // Explicit comparison of TNL Association fields - _F1_EQ_CHECK_INT(a->tnlAssociations_failed[i].tl_address, b->tnlAssociations_failed[i].tl_address); - _F1_EQ_CHECK_INT(a->tnlAssociations_failed[i].port, b->tnlAssociations_failed[i].port); + _EQ_CHECK_INT(a->tnlAssociations_failed[i].tl_address, b->tnlAssociations_failed[i].tl_address); + _EQ_CHECK_INT(a->tnlAssociations_failed[i].port, b->tnlAssociations_failed[i].port); } // Dedicated SI Delivery Needed UE List - _F1_EQ_CHECK_INT(a->noofDedicatedSIDeliveryNeededUEs, b->noofDedicatedSIDeliveryNeededUEs); + _EQ_CHECK_INT(a->noofDedicatedSIDeliveryNeededUEs, b->noofDedicatedSIDeliveryNeededUEs); for (int i = 0; i < a->noofDedicatedSIDeliveryNeededUEs && i < F1AP_MAX_NO_UE_ID; i++) { - _F1_EQ_CHECK_INT(a->dedicatedSIDeliveryNeededUEs[i].gNB_CU_ue_id, b->dedicatedSIDeliveryNeededUEs[i].gNB_CU_ue_id); + _EQ_CHECK_INT(a->dedicatedSIDeliveryNeededUEs[i].gNB_CU_ue_id, b->dedicatedSIDeliveryNeededUEs[i].gNB_CU_ue_id); if (!eq_f1ap_plmn(&a->dedicatedSIDeliveryNeededUEs[i].ue_plmn, &b->dedicatedSIDeliveryNeededUEs[i].ue_plmn)) return false; - _F1_EQ_CHECK_LONG(a->dedicatedSIDeliveryNeededUEs[i].ue_nr_cellid, b->dedicatedSIDeliveryNeededUEs[i].ue_nr_cellid); + _EQ_CHECK_LONG(a->dedicatedSIDeliveryNeededUEs[i].ue_nr_cellid, b->dedicatedSIDeliveryNeededUEs[i].ue_nr_cellid); } return true; } @@ -2115,11 +2114,10 @@ bool decode_f1ap_du_configuration_update_acknowledge(const F1AP_F1AP_PDU_t *pdu, f1ap_gnb_du_configuration_update_acknowledge_t *out) { /* message type */ - _F1_EQ_CHECK_INT(pdu->present, F1AP_F1AP_PDU_PR_successfulOutcome); + _EQ_CHECK_INT(pdu->present, F1AP_F1AP_PDU_PR_successfulOutcome); AssertError(pdu->choice.successfulOutcome != NULL, return false, "pdu->choice.successfulOutcome is NULL"); - _F1_EQ_CHECK_LONG(pdu->choice.successfulOutcome->procedureCode, F1AP_ProcedureCode_id_gNBDUConfigurationUpdate); - _F1_EQ_CHECK_INT(pdu->choice.successfulOutcome->value.present, - F1AP_SuccessfulOutcome__value_PR_GNBDUConfigurationUpdateAcknowledge); + _EQ_CHECK_LONG(pdu->choice.successfulOutcome->procedureCode, F1AP_ProcedureCode_id_gNBDUConfigurationUpdate); + _EQ_CHECK_INT(pdu->choice.successfulOutcome->value.present, F1AP_SuccessfulOutcome__value_PR_GNBDUConfigurationUpdateAcknowledge); F1AP_GNBDUConfigurationUpdateAcknowledge_t *in = &pdu->choice.successfulOutcome->value.choice.GNBDUConfigurationUpdateAcknowledge; F1AP_GNBDUConfigurationUpdateAcknowledgeIEs_t *ie; /* Check mandatory IEs */ @@ -2129,13 +2127,13 @@ bool decode_f1ap_du_configuration_update_acknowledge(const F1AP_F1AP_PDU_t *pdu, ie = in->protocolIEs.list.array[i]; switch (ie->id) { case F1AP_ProtocolIE_ID_id_TransactionID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_GNBDUConfigurationUpdateAcknowledgeIEs__value_PR_TransactionID); + _EQ_CHECK_INT(ie->value.present, F1AP_GNBDUConfigurationUpdateAcknowledgeIEs__value_PR_TransactionID); AssertError(ie->value.choice.TransactionID != -1, return false, "ie->value.choice.TransactionID is -1"); out->transaction_id = ie->value.choice.TransactionID; break; case F1AP_ProtocolIE_ID_id_Cells_to_be_Activated_List: { /* Decode Cells Failed to be Activated List */ - _F1_EQ_CHECK_INT(ie->value.present, F1AP_GNBDUConfigurationUpdateAcknowledgeIEs__value_PR_Cells_to_be_Activated_List); + _EQ_CHECK_INT(ie->value.present, F1AP_GNBDUConfigurationUpdateAcknowledgeIEs__value_PR_Cells_to_be_Activated_List); F1AP_Cells_to_be_Activated_List_t *list = &ie->value.choice.Cells_to_be_Activated_List; out->num_cells_to_activate = list->list.count; out->cells_to_activate = calloc_or_fail(out->num_cells_to_activate, sizeof(*out->cells_to_activate)); @@ -2161,21 +2159,20 @@ bool eq_f1ap_du_configuration_update_acknowledge(const f1ap_gnb_du_configuration const f1ap_gnb_du_configuration_update_acknowledge_t *b) { // Transaction ID - _F1_EQ_CHECK_LONG(a->transaction_id, b->transaction_id); + _EQ_CHECK_LONG(a->transaction_id, b->transaction_id); // number of cells to activate - _F1_EQ_CHECK_INT(a->num_cells_to_activate, b->num_cells_to_activate); + _EQ_CHECK_INT(a->num_cells_to_activate, b->num_cells_to_activate); // loop over cells to activate for (int i = 0; i < a->num_cells_to_activate && i < F1AP_MAX_NB_CELLS; i++) { - _F1_EQ_CHECK_LONG(a->cells_to_activate[i].nr_cellid, b->cells_to_activate[i].nr_cellid); - _F1_EQ_CHECK_INT(a->cells_to_activate[i].nrpci, b->cells_to_activate[i].nrpci); + _EQ_CHECK_LONG(a->cells_to_activate[i].nr_cellid, b->cells_to_activate[i].nr_cellid); + _EQ_CHECK_INT(a->cells_to_activate[i].nrpci, b->cells_to_activate[i].nrpci); if (!eq_f1ap_plmn(&a->cells_to_activate[i].plmn, &b->cells_to_activate[i].plmn)) return false; - _F1_EQ_CHECK_INT(a->cells_to_activate[i].num_SI, b->cells_to_activate[i].num_SI); + _EQ_CHECK_INT(a->cells_to_activate[i].num_SI, b->cells_to_activate[i].num_SI); for (int s = 0; s < a->cells_to_activate[i].num_SI; s++) { - _F1_EQ_CHECK_INT(*a->cells_to_activate[i].SI_msg[s].SI_container, *b->cells_to_activate[i].SI_msg[s].SI_container); - _F1_EQ_CHECK_INT(a->cells_to_activate[i].SI_msg[s].SI_container_length, - b->cells_to_activate[i].SI_msg[s].SI_container_length); - _F1_EQ_CHECK_INT(a->cells_to_activate[i].SI_msg[s].SI_type, b->cells_to_activate[i].SI_msg[s].SI_type); + _EQ_CHECK_INT(*a->cells_to_activate[i].SI_msg[s].SI_container, *b->cells_to_activate[i].SI_msg[s].SI_container); + _EQ_CHECK_INT(a->cells_to_activate[i].SI_msg[s].SI_container_length, b->cells_to_activate[i].SI_msg[s].SI_container_length); + _EQ_CHECK_INT(a->cells_to_activate[i].SI_msg[s].SI_type, b->cells_to_activate[i].SI_msg[s].SI_type); } } return true; diff --git a/openair2/F1AP/lib/f1ap_lib_common.c b/openair2/F1AP/lib/f1ap_lib_common.c index 0e1d07a71d..d6003f4280 100644 --- a/openair2/F1AP/lib/f1ap_lib_common.c +++ b/openair2/F1AP/lib/f1ap_lib_common.c @@ -29,40 +29,40 @@ bool eq_f1ap_plmn(const plmn_id_t *a, const plmn_id_t *b) { - _F1_EQ_CHECK_INT(a->mcc, b->mcc); - _F1_EQ_CHECK_INT(a->mnc, b->mnc); - _F1_EQ_CHECK_INT(a->mnc_digit_length, b->mnc_digit_length); + _EQ_CHECK_INT(a->mcc, b->mcc); + _EQ_CHECK_INT(a->mnc, b->mnc); + _EQ_CHECK_INT(a->mnc_digit_length, b->mnc_digit_length); return true; } bool eq_f1ap_freq_info(const f1ap_nr_frequency_info_t *a, const f1ap_nr_frequency_info_t *b) { - _F1_EQ_CHECK_INT(a->arfcn, b->arfcn); - _F1_EQ_CHECK_INT(a->band, b->band); + _EQ_CHECK_INT(a->arfcn, b->arfcn); + _EQ_CHECK_INT(a->band, b->band); return true; } bool eq_f1ap_tx_bandwidth(const f1ap_transmission_bandwidth_t *a, const f1ap_transmission_bandwidth_t *b) { - _F1_EQ_CHECK_INT(a->nrb, b->nrb); - _F1_EQ_CHECK_INT(a->scs, b->scs); + _EQ_CHECK_INT(a->nrb, b->nrb); + _EQ_CHECK_INT(a->scs, b->scs); return true; } bool eq_f1ap_cell_info(const f1ap_served_cell_info_t *a, const f1ap_served_cell_info_t *b) { - _F1_EQ_CHECK_LONG(a->nr_cellid, b->nr_cellid); - _F1_EQ_CHECK_INT(a->nr_pci, b->nr_pci); + _EQ_CHECK_LONG(a->nr_cellid, b->nr_cellid); + _EQ_CHECK_INT(a->nr_pci, b->nr_pci); if ((!a->tac) ^ (!b->tac)) return false; if (a->tac) - _F1_EQ_CHECK_INT(*a->tac, *b->tac); - _F1_EQ_CHECK_INT(a->num_ssi, b->num_ssi); + _EQ_CHECK_INT(*a->tac, *b->tac); + _EQ_CHECK_INT(a->num_ssi, b->num_ssi); for (int i = 0; i < a->num_ssi; ++i) { - _F1_EQ_CHECK_INT(a->nssai[i].sst, b->nssai[i].sst); - _F1_EQ_CHECK_INT(a->nssai[i].sd, b->nssai[i].sd); + _EQ_CHECK_INT(a->nssai[i].sst, b->nssai[i].sst); + _EQ_CHECK_INT(a->nssai[i].sd, b->nssai[i].sd); } - _F1_EQ_CHECK_INT(a->mode, b->mode); + _EQ_CHECK_INT(a->mode, b->mode); if (a->mode == F1AP_MODE_TDD) { /* TDD */ if (!eq_f1ap_tx_bandwidth(&a->tdd.tbw, &b->tdd.tbw)) @@ -80,8 +80,8 @@ bool eq_f1ap_cell_info(const f1ap_served_cell_info_t *a, const f1ap_served_cell_ if (!eq_f1ap_freq_info(&a->fdd.ul_freqinfo, &b->fdd.ul_freqinfo)) return false; } - _F1_EQ_CHECK_INT(a->measurement_timing_config_len, b->measurement_timing_config_len); - _F1_EQ_CHECK_INT(*a->measurement_timing_config, *b->measurement_timing_config); + _EQ_CHECK_INT(a->measurement_timing_config_len, b->measurement_timing_config_len); + _EQ_CHECK_INT(*a->measurement_timing_config, *b->measurement_timing_config); if (!eq_f1ap_plmn(&a->plmn, &b->plmn)) return false; return true; @@ -97,13 +97,13 @@ bool eq_f1ap_sys_info(const f1ap_gnb_du_system_info_t *a, const f1ap_gnb_du_syst return false; /* MIB */ - _F1_EQ_CHECK_INT(a->mib_length, b->mib_length); + _EQ_CHECK_INT(a->mib_length, b->mib_length); for (int i = 0; i < a->mib_length; i++) - _F1_EQ_CHECK_INT(a->mib[i], b->mib[i]); + _EQ_CHECK_INT(a->mib[i], b->mib[i]); /* SIB1 */ - _F1_EQ_CHECK_INT(a->sib1_length, b->sib1_length); + _EQ_CHECK_INT(a->sib1_length, b->sib1_length); for (int i = 0; i < a->sib1_length; i++) - _F1_EQ_CHECK_INT(a->sib1[i], b->sib1[i]); + _EQ_CHECK_INT(a->sib1[i], b->sib1[i]); return true; } diff --git a/openair2/F1AP/lib/f1ap_lib_common.h b/openair2/F1AP/lib/f1ap_lib_common.h index b49fad88c1..94e0ee22c3 100644 --- a/openair2/F1AP/lib/f1ap_lib_common.h +++ b/openair2/F1AP/lib/f1ap_lib_common.h @@ -32,24 +32,7 @@ #include "F1AP_Cause.h" #include "F1AP_SNSSAI.h" #include "f1ap_messages_types.h" - -#ifdef ENABLE_TESTS - #define PRINT_ERROR(fmt, ...) fprintf(stderr, "%s:%d: " fmt, __FILE__, __LINE__, ##__VA_ARGS__) -#else - #define PRINT_ERROR(...) // Do nothing -#endif - -#define _F1_EQ_CHECK_GENERIC(condition, fmt, ...) \ - do { \ - if (!(condition)) { \ - PRINT_ERROR("Equality condition '%s' failed: " fmt " != " fmt "\n", #condition, ##__VA_ARGS__); \ - return false; \ - } \ - } while (0) - -#define _F1_EQ_CHECK_LONG(A, B) _F1_EQ_CHECK_GENERIC(A == B, "%ld", A, B); -#define _F1_EQ_CHECK_INT(A, B) _F1_EQ_CHECK_GENERIC(A == B, "%d", A, B); -#define _F1_EQ_CHECK_STR(A, B) _F1_EQ_CHECK_GENERIC(strcmp(A, B) == 0, "'%s'", A, B); +#include "common/utils/eq_check.h" #define _F1_CHECK_EXP(EXP) \ do { \ @@ -59,13 +42,6 @@ } \ } while (0) -#define _F1_EQ_CHECK_OPTIONAL_IE(A, B, FIELD, EQ_MACRO) \ - do { \ - _F1_CHECK_EXP(((A)->FIELD && (B)->FIELD) || (!(A)->FIELD && !(B)->FIELD)); \ - if ((A)->FIELD && (B)->FIELD) \ - EQ_MACRO(*(A)->FIELD, *(B)->FIELD); \ - } while (0) - /* macro to look up IE. If mandatory and not found, macro will print * descriptive debug message to stderr and force exit in calling function */ #define F1AP_LIB_FIND_IE(IE_TYPE, ie, IE_LIST, IE_ID, mandatory) \ diff --git a/openair2/F1AP/lib/f1ap_positioning.c b/openair2/F1AP/lib/f1ap_positioning.c index 4fd1e6a18f..e252b0d7e1 100644 --- a/openair2/F1AP/lib/f1ap_positioning.c +++ b/openair2/F1AP/lib/f1ap_positioning.c @@ -1666,62 +1666,62 @@ static bool eq_srs_config(const f1ap_srs_config_t *f1_sRSConfig, const f1ap_srs_ f1ap_srs_resource_list_t *srs_resource_list = sRSConfig->srs_resource_list; f1ap_srs_resource_list_t *f1_srs_resource_list = f1_sRSConfig->srs_resource_list; uint32_t srs_resource_list_length = srs_resource_list->srs_resource_list_length; - _F1_EQ_CHECK_INT(f1_srs_resource_list->srs_resource_list_length, srs_resource_list_length); + _EQ_CHECK_INT(f1_srs_resource_list->srs_resource_list_length, srs_resource_list_length); for (int i = 0; i < srs_resource_list_length; i++) { f1ap_srs_resource_t *srs_resource = &srs_resource_list->srs_resource[i]; f1ap_srs_resource_t *f1_srs_resource = &f1_srs_resource_list->srs_resource[i]; - _F1_EQ_CHECK_INT(f1_srs_resource->srs_resource_id, srs_resource->srs_resource_id); - _F1_EQ_CHECK_INT(f1_srs_resource->nr_of_srs_ports, srs_resource->nr_of_srs_ports); + _EQ_CHECK_INT(f1_srs_resource->srs_resource_id, srs_resource->srs_resource_id); + _EQ_CHECK_INT(f1_srs_resource->nr_of_srs_ports, srs_resource->nr_of_srs_ports); f1ap_transmission_comb_t *f1_srs_tx_comb = &f1_srs_resource->transmission_comb; f1ap_transmission_comb_t *srs_tx_comb = &srs_resource->transmission_comb; - _F1_EQ_CHECK_INT(f1_srs_tx_comb->present, srs_tx_comb->present); + _EQ_CHECK_INT(f1_srs_tx_comb->present, srs_tx_comb->present); switch (srs_tx_comb->present) { case F1AP_TRANSMISSION_COMB_PR_NOTHING: // nothing to check break; case F1AP_TRANSMISSION_COMB_PR_N2: - _F1_EQ_CHECK_INT(f1_srs_tx_comb->choice.n2.comb_offset_n2, srs_tx_comb->choice.n2.comb_offset_n2); - _F1_EQ_CHECK_INT(f1_srs_tx_comb->choice.n2.cyclic_shift_n2, srs_tx_comb->choice.n2.cyclic_shift_n2); + _EQ_CHECK_INT(f1_srs_tx_comb->choice.n2.comb_offset_n2, srs_tx_comb->choice.n2.comb_offset_n2); + _EQ_CHECK_INT(f1_srs_tx_comb->choice.n2.cyclic_shift_n2, srs_tx_comb->choice.n2.cyclic_shift_n2); break; case F1AP_TRANSMISSION_COMB_PR_N4: - _F1_EQ_CHECK_INT(f1_srs_tx_comb->choice.n4.comb_offset_n4, srs_tx_comb->choice.n4.comb_offset_n4); - _F1_EQ_CHECK_INT(f1_srs_tx_comb->choice.n4.cyclic_shift_n4, srs_tx_comb->choice.n4.cyclic_shift_n4); + _EQ_CHECK_INT(f1_srs_tx_comb->choice.n4.comb_offset_n4, srs_tx_comb->choice.n4.comb_offset_n4); + _EQ_CHECK_INT(f1_srs_tx_comb->choice.n4.cyclic_shift_n4, srs_tx_comb->choice.n4.cyclic_shift_n4); break; default: AssertFatal(false, "illegal transmissionComb %d\n", srs_tx_comb->present); break; } - _F1_EQ_CHECK_INT(f1_srs_resource->start_position, srs_resource->start_position); - _F1_EQ_CHECK_INT(f1_srs_resource->nr_of_symbols, srs_resource->nr_of_symbols); - _F1_EQ_CHECK_INT(f1_srs_resource->repetition_factor, srs_resource->repetition_factor); - _F1_EQ_CHECK_INT(f1_srs_resource->freq_domain_position, srs_resource->freq_domain_position); - _F1_EQ_CHECK_INT(f1_srs_resource->freq_domain_shift, srs_resource->freq_domain_shift); - _F1_EQ_CHECK_INT(f1_srs_resource->c_srs, srs_resource->c_srs); - _F1_EQ_CHECK_INT(f1_srs_resource->b_srs, srs_resource->b_srs); - _F1_EQ_CHECK_INT(f1_srs_resource->b_hop, srs_resource->b_hop); - _F1_EQ_CHECK_INT(f1_srs_resource->group_or_sequence_hopping, srs_resource->group_or_sequence_hopping); + _EQ_CHECK_INT(f1_srs_resource->start_position, srs_resource->start_position); + _EQ_CHECK_INT(f1_srs_resource->nr_of_symbols, srs_resource->nr_of_symbols); + _EQ_CHECK_INT(f1_srs_resource->repetition_factor, srs_resource->repetition_factor); + _EQ_CHECK_INT(f1_srs_resource->freq_domain_position, srs_resource->freq_domain_position); + _EQ_CHECK_INT(f1_srs_resource->freq_domain_shift, srs_resource->freq_domain_shift); + _EQ_CHECK_INT(f1_srs_resource->c_srs, srs_resource->c_srs); + _EQ_CHECK_INT(f1_srs_resource->b_srs, srs_resource->b_srs); + _EQ_CHECK_INT(f1_srs_resource->b_hop, srs_resource->b_hop); + _EQ_CHECK_INT(f1_srs_resource->group_or_sequence_hopping, srs_resource->group_or_sequence_hopping); f1ap_resource_type_t *f1_res_type = &f1_srs_resource->resource_type; f1ap_resource_type_t *res_type = &srs_resource->resource_type; - _F1_EQ_CHECK_INT(f1_res_type->present, res_type->present); + _EQ_CHECK_INT(f1_res_type->present, res_type->present); if (res_type->present == F1AP_RESOURCE_TYPE_PR_NOTHING) { // nothing to check } else if (res_type->present == F1AP_RESOURCE_TYPE_PR_PERIODIC) { - _F1_EQ_CHECK_INT(f1_res_type->choice.periodic.periodicity, res_type->choice.periodic.periodicity); - _F1_EQ_CHECK_INT(f1_res_type->choice.periodic.offset, res_type->choice.periodic.offset); + _EQ_CHECK_INT(f1_res_type->choice.periodic.periodicity, res_type->choice.periodic.periodicity); + _EQ_CHECK_INT(f1_res_type->choice.periodic.offset, res_type->choice.periodic.offset); } else if (res_type->present == F1AP_RESOURCE_TYPE_PR_SEMI_PERSISTENT) { - _F1_EQ_CHECK_INT(f1_res_type->choice.semi_persistent.periodicity, res_type->choice.semi_persistent.periodicity); - _F1_EQ_CHECK_INT(f1_res_type->choice.semi_persistent.offset, res_type->choice.semi_persistent.offset); + _EQ_CHECK_INT(f1_res_type->choice.semi_persistent.periodicity, res_type->choice.semi_persistent.periodicity); + _EQ_CHECK_INT(f1_res_type->choice.semi_persistent.offset, res_type->choice.semi_persistent.offset); } else if (res_type->present == F1AP_RESOURCE_TYPE_PR_APERIODIC) { - _F1_EQ_CHECK_INT(f1_res_type->choice.aperiodic, res_type->choice.aperiodic); + _EQ_CHECK_INT(f1_res_type->choice.aperiodic, res_type->choice.aperiodic); } else { AssertFatal(false, "illegal resourceType %d\n", res_type->present); } - _F1_EQ_CHECK_INT(f1_srs_resource->sequence_id, srs_resource->sequence_id); + _EQ_CHECK_INT(f1_srs_resource->sequence_id, srs_resource->sequence_id); } } @@ -1733,12 +1733,12 @@ static bool eq_srs_config(const f1ap_srs_config_t *f1_sRSConfig, const f1ap_srs_ f1ap_pos_srs_resource_list_t *pos_srs_resource_list = sRSConfig->pos_srs_resource_list; f1ap_pos_srs_resource_list_t *f1_pos_srs_resource_list = f1_sRSConfig->pos_srs_resource_list; uint32_t pos_srs_resource_list_length = pos_srs_resource_list->pos_srs_resource_list_length; - _F1_EQ_CHECK_INT(f1_pos_srs_resource_list->pos_srs_resource_list_length, pos_srs_resource_list_length); + _EQ_CHECK_INT(f1_pos_srs_resource_list->pos_srs_resource_list_length, pos_srs_resource_list_length); for (int i = 0; i < pos_srs_resource_list_length; i++) { f1ap_pos_srs_resource_item_t *pos_srs_resource = &pos_srs_resource_list->pos_srs_resource_item[i]; f1ap_pos_srs_resource_item_t *f1_pos_srs_resource = &f1_pos_srs_resource_list->pos_srs_resource_item[i]; - _F1_EQ_CHECK_INT(f1_pos_srs_resource->srs_pos_resource_id, pos_srs_resource->srs_pos_resource_id); - _F1_EQ_CHECK_INT(f1_pos_srs_resource->transmission_comb_pos.present, pos_srs_resource->transmission_comb_pos.present); + _EQ_CHECK_INT(f1_pos_srs_resource->srs_pos_resource_id, pos_srs_resource->srs_pos_resource_id); + _EQ_CHECK_INT(f1_pos_srs_resource->transmission_comb_pos.present, pos_srs_resource->transmission_comb_pos.present); f1ap_transmission_comb_pos_t *f1_srs_tx_comb_pos = &f1_pos_srs_resource->transmission_comb_pos; f1ap_transmission_comb_pos_t *srs_tx_comb_pos = &pos_srs_resource->transmission_comb_pos; @@ -1747,46 +1747,46 @@ static bool eq_srs_config(const f1ap_srs_config_t *f1_sRSConfig, const f1ap_srs_ // nothing to check break; case F1AP_TRANSMISSION_COMB_POS_PR_N2: - _F1_EQ_CHECK_INT(f1_srs_tx_comb_pos->choice.n2.comb_offset_n2, srs_tx_comb_pos->choice.n2.comb_offset_n2); - _F1_EQ_CHECK_INT(f1_srs_tx_comb_pos->choice.n2.cyclic_shift_n2, srs_tx_comb_pos->choice.n2.cyclic_shift_n2); + _EQ_CHECK_INT(f1_srs_tx_comb_pos->choice.n2.comb_offset_n2, srs_tx_comb_pos->choice.n2.comb_offset_n2); + _EQ_CHECK_INT(f1_srs_tx_comb_pos->choice.n2.cyclic_shift_n2, srs_tx_comb_pos->choice.n2.cyclic_shift_n2); break; case F1AP_TRANSMISSION_COMB_POS_PR_N4: - _F1_EQ_CHECK_INT(f1_srs_tx_comb_pos->choice.n4.comb_offset_n4, srs_tx_comb_pos->choice.n4.comb_offset_n4); - _F1_EQ_CHECK_INT(f1_srs_tx_comb_pos->choice.n4.cyclic_shift_n4, srs_tx_comb_pos->choice.n4.cyclic_shift_n4); + _EQ_CHECK_INT(f1_srs_tx_comb_pos->choice.n4.comb_offset_n4, srs_tx_comb_pos->choice.n4.comb_offset_n4); + _EQ_CHECK_INT(f1_srs_tx_comb_pos->choice.n4.cyclic_shift_n4, srs_tx_comb_pos->choice.n4.cyclic_shift_n4); break; case F1AP_TRANSMISSION_COMB_POS_PR_N8: - _F1_EQ_CHECK_INT(f1_srs_tx_comb_pos->choice.n8.comb_offset_n8, srs_tx_comb_pos->choice.n8.comb_offset_n8); - _F1_EQ_CHECK_INT(f1_srs_tx_comb_pos->choice.n8.cyclic_shift_n8, srs_tx_comb_pos->choice.n8.cyclic_shift_n8); + _EQ_CHECK_INT(f1_srs_tx_comb_pos->choice.n8.comb_offset_n8, srs_tx_comb_pos->choice.n8.comb_offset_n8); + _EQ_CHECK_INT(f1_srs_tx_comb_pos->choice.n8.cyclic_shift_n8, srs_tx_comb_pos->choice.n8.cyclic_shift_n8); break; default: AssertFatal(false, "illegal transmissionComb %d\n", srs_tx_comb_pos->present); break; } - _F1_EQ_CHECK_INT(f1_pos_srs_resource->start_position, pos_srs_resource->start_position); - _F1_EQ_CHECK_INT(f1_pos_srs_resource->nr_of_symbols, pos_srs_resource->nr_of_symbols); - _F1_EQ_CHECK_INT(f1_pos_srs_resource->freq_domain_shift, pos_srs_resource->freq_domain_shift); - _F1_EQ_CHECK_INT(f1_pos_srs_resource->c_srs, pos_srs_resource->c_srs); - _F1_EQ_CHECK_INT(f1_pos_srs_resource->group_or_sequence_hopping, pos_srs_resource->group_or_sequence_hopping); + _EQ_CHECK_INT(f1_pos_srs_resource->start_position, pos_srs_resource->start_position); + _EQ_CHECK_INT(f1_pos_srs_resource->nr_of_symbols, pos_srs_resource->nr_of_symbols); + _EQ_CHECK_INT(f1_pos_srs_resource->freq_domain_shift, pos_srs_resource->freq_domain_shift); + _EQ_CHECK_INT(f1_pos_srs_resource->c_srs, pos_srs_resource->c_srs); + _EQ_CHECK_INT(f1_pos_srs_resource->group_or_sequence_hopping, pos_srs_resource->group_or_sequence_hopping); f1ap_resource_type_pos_t *f1_res_type_pos = &f1_pos_srs_resource->resource_type_pos; f1ap_resource_type_pos_t *res_type_pos = &pos_srs_resource->resource_type_pos; - _F1_EQ_CHECK_INT(f1_res_type_pos->present, res_type_pos->present); + _EQ_CHECK_INT(f1_res_type_pos->present, res_type_pos->present); if (res_type_pos->present == F1AP_RESOURCE_TYPE_POS_PR_NOTHING) { // nothing to check } else if (res_type_pos->present == F1AP_RESOURCE_TYPE_POS_PR_PERIODIC) { - _F1_EQ_CHECK_INT(f1_res_type_pos->choice.periodic.periodicity, res_type_pos->choice.periodic.periodicity); - _F1_EQ_CHECK_INT(f1_res_type_pos->choice.periodic.offset, res_type_pos->choice.periodic.offset); + _EQ_CHECK_INT(f1_res_type_pos->choice.periodic.periodicity, res_type_pos->choice.periodic.periodicity); + _EQ_CHECK_INT(f1_res_type_pos->choice.periodic.offset, res_type_pos->choice.periodic.offset); } else if (res_type_pos->present == F1AP_RESOURCE_TYPE_POS_PR_SEMI_PERSISTENT) { - _F1_EQ_CHECK_INT(f1_res_type_pos->choice.semi_persistent.periodicity, res_type_pos->choice.semi_persistent.periodicity); - _F1_EQ_CHECK_INT(f1_res_type_pos->choice.semi_persistent.offset, res_type_pos->choice.semi_persistent.offset); + _EQ_CHECK_INT(f1_res_type_pos->choice.semi_persistent.periodicity, res_type_pos->choice.semi_persistent.periodicity); + _EQ_CHECK_INT(f1_res_type_pos->choice.semi_persistent.offset, res_type_pos->choice.semi_persistent.offset); } else if (res_type_pos->present == F1AP_RESOURCE_TYPE_POS_PR_APERIODIC) { - _F1_EQ_CHECK_INT(f1_res_type_pos->choice.aperiodic.slot_offset, res_type_pos->choice.aperiodic.slot_offset); + _EQ_CHECK_INT(f1_res_type_pos->choice.aperiodic.slot_offset, res_type_pos->choice.aperiodic.slot_offset); } else { AssertFatal(false, "illegal resourceType %d\n", res_type_pos->present); } - _F1_EQ_CHECK_INT(f1_pos_srs_resource->sequence_id, pos_srs_resource->sequence_id); + _EQ_CHECK_INT(f1_pos_srs_resource->sequence_id, pos_srs_resource->sequence_id); } } @@ -1798,35 +1798,35 @@ static bool eq_srs_config(const f1ap_srs_config_t *f1_sRSConfig, const f1ap_srs_ f1ap_srs_resource_set_list_t *srs_resource_set_list = sRSConfig->srs_resource_set_list; f1ap_srs_resource_set_list_t *f1_srs_resource_set_list = f1_sRSConfig->srs_resource_set_list; uint32_t srs_resource_set_list_length = srs_resource_set_list->srs_resource_set_list_length; - _F1_EQ_CHECK_INT(f1_srs_resource_set_list->srs_resource_set_list_length, srs_resource_set_list_length); + _EQ_CHECK_INT(f1_srs_resource_set_list->srs_resource_set_list_length, srs_resource_set_list_length); for (int i = 0; i < srs_resource_set_list_length; i++) { f1ap_srs_resource_set_t *srs_resource_set = &srs_resource_set_list->srs_resource_set[i]; f1ap_srs_resource_set_t *f1_srs_resource_set = &f1_srs_resource_set_list->srs_resource_set[i]; - _F1_EQ_CHECK_INT(f1_srs_resource_set->srs_resource_set_id, srs_resource_set->srs_resource_set_id); + _EQ_CHECK_INT(f1_srs_resource_set->srs_resource_set_id, srs_resource_set->srs_resource_set_id); uint8_t srs_resource_id_list_length = srs_resource_set->srs_resource_id_list.srs_resource_id_list_length; - _F1_EQ_CHECK_INT(f1_srs_resource_set->srs_resource_id_list.srs_resource_id_list_length, srs_resource_id_list_length); + _EQ_CHECK_INT(f1_srs_resource_set->srs_resource_id_list.srs_resource_id_list_length, srs_resource_id_list_length); for (int j = 0; j < srs_resource_id_list_length; j++) { - _F1_EQ_CHECK_LONG(f1_srs_resource_set->srs_resource_id_list.srs_resource_id[j], - srs_resource_set->srs_resource_id_list.srs_resource_id[j]); + _EQ_CHECK_LONG(f1_srs_resource_set->srs_resource_id_list.srs_resource_id[j], + srs_resource_set->srs_resource_id_list.srs_resource_id[j]); } f1ap_resource_set_type_t *f1_res_set_type = &f1_srs_resource_set->resource_set_type; f1ap_resource_set_type_t *res_set_type = &srs_resource_set->resource_set_type; - _F1_EQ_CHECK_INT(f1_res_set_type->present, res_set_type->present); + _EQ_CHECK_INT(f1_res_set_type->present, res_set_type->present); switch (res_set_type->present) { case F1AP_RESOURCE_SET_TYPE_PR_NOTHING: // nothing to check break; case F1AP_RESOURCE_SET_TYPE_PR_PERIODIC: - _F1_EQ_CHECK_INT(f1_res_set_type->choice.periodic, res_set_type->choice.periodic); + _EQ_CHECK_INT(f1_res_set_type->choice.periodic, res_set_type->choice.periodic); break; case F1AP_RESOURCE_SET_TYPE_PR_SEMI_PERSISTENT: - _F1_EQ_CHECK_INT(f1_res_set_type->choice.semi_persistent, res_set_type->choice.semi_persistent); + _EQ_CHECK_INT(f1_res_set_type->choice.semi_persistent, res_set_type->choice.semi_persistent); break; case F1AP_RESOURCE_SET_TYPE_PR_APERIODIC: - _F1_EQ_CHECK_INT(f1_res_set_type->choice.aperiodic.srs_resource_trigger, - res_set_type->choice.aperiodic.srs_resource_trigger); - _F1_EQ_CHECK_LONG(f1_res_set_type->choice.aperiodic.slot_offset, res_set_type->choice.aperiodic.slot_offset); + _EQ_CHECK_INT(f1_res_set_type->choice.aperiodic.srs_resource_trigger, + res_set_type->choice.aperiodic.srs_resource_trigger); + _EQ_CHECK_LONG(f1_res_set_type->choice.aperiodic.slot_offset, res_set_type->choice.aperiodic.slot_offset); break; default: AssertFatal(false, "illegal resource set type %d\n", res_set_type->present); @@ -1843,34 +1843,34 @@ static bool eq_srs_config(const f1ap_srs_config_t *f1_sRSConfig, const f1ap_srs_ f1ap_pos_srs_resource_set_list_t *pos_srs_resource_set_list = sRSConfig->pos_srs_resource_set_list; f1ap_pos_srs_resource_set_list_t *f1_pos_srs_resource_set_list = f1_sRSConfig->pos_srs_resource_set_list; uint32_t pos_srs_resource_set_list_length = pos_srs_resource_set_list->pos_srs_resource_set_list_length; - _F1_EQ_CHECK_INT(f1_pos_srs_resource_set_list->pos_srs_resource_set_list_length, pos_srs_resource_set_list_length); + _EQ_CHECK_INT(f1_pos_srs_resource_set_list->pos_srs_resource_set_list_length, pos_srs_resource_set_list_length); for (int i = 0; i < pos_srs_resource_set_list_length; i++) { f1ap_pos_srs_resource_set_item_t *pos_srs_resource_set = &pos_srs_resource_set_list->pos_srs_resource_set_item[i]; f1ap_pos_srs_resource_set_item_t *f1_pos_srs_resource_set = &f1_pos_srs_resource_set_list->pos_srs_resource_set_item[i]; - _F1_EQ_CHECK_INT(f1_pos_srs_resource_set->pos_srs_resource_set_id, pos_srs_resource_set->pos_srs_resource_set_id); + _EQ_CHECK_INT(f1_pos_srs_resource_set->pos_srs_resource_set_id, pos_srs_resource_set->pos_srs_resource_set_id); uint8_t pos_srs_resource_id_list_length = pos_srs_resource_set->pos_srs_resource_id_list.pos_srs_resource_id_list_length; - _F1_EQ_CHECK_INT(f1_pos_srs_resource_set->pos_srs_resource_id_list.pos_srs_resource_id_list_length, - pos_srs_resource_id_list_length); + _EQ_CHECK_INT(f1_pos_srs_resource_set->pos_srs_resource_id_list.pos_srs_resource_id_list_length, + pos_srs_resource_id_list_length); for (int j = 0; j < pos_srs_resource_id_list_length; j++) { - _F1_EQ_CHECK_LONG(f1_pos_srs_resource_set->pos_srs_resource_id_list.srs_pos_resource_id[j], - pos_srs_resource_set->pos_srs_resource_id_list.srs_pos_resource_id[j]); + _EQ_CHECK_LONG(f1_pos_srs_resource_set->pos_srs_resource_id_list.srs_pos_resource_id[j], + pos_srs_resource_set->pos_srs_resource_id_list.srs_pos_resource_id[j]); } f1ap_pos_resource_set_type_t *f1_pos_res_set_type = &f1_pos_srs_resource_set->pos_resource_set_type; f1ap_pos_resource_set_type_t *pos_res_set_type = &pos_srs_resource_set->pos_resource_set_type; - _F1_EQ_CHECK_INT(f1_pos_res_set_type->present, pos_res_set_type->present); + _EQ_CHECK_INT(f1_pos_res_set_type->present, pos_res_set_type->present); switch (pos_res_set_type->present) { case F1AP_POS_RESOURCE_SET_TYPE_PR_NOTHING: // nothing to check break; case F1AP_POS_RESOURCE_SET_TYPE_PR_PERIODIC: - _F1_EQ_CHECK_INT(f1_pos_res_set_type->choice.periodic, pos_res_set_type->choice.periodic); + _EQ_CHECK_INT(f1_pos_res_set_type->choice.periodic, pos_res_set_type->choice.periodic); break; case F1AP_POS_RESOURCE_SET_TYPE_PR_SEMI_PERSISTENT: - _F1_EQ_CHECK_INT(f1_pos_res_set_type->choice.semi_persistent, pos_res_set_type->choice.semi_persistent); + _EQ_CHECK_INT(f1_pos_res_set_type->choice.semi_persistent, pos_res_set_type->choice.semi_persistent); break; case F1AP_POS_RESOURCE_SET_TYPE_PR_APERIODIC: - _F1_EQ_CHECK_INT(f1_pos_res_set_type->choice.srs_resource, pos_res_set_type->choice.srs_resource); + _EQ_CHECK_INT(f1_pos_res_set_type->choice.srs_resource, pos_res_set_type->choice.srs_resource); break; default: AssertFatal(false, "illegal resource set type pos %d\n", pos_res_set_type->present); @@ -1885,7 +1885,7 @@ static bool eq_srs_carrier_list_item(const f1ap_srs_carrier_list_item_t *f1_srs_ const f1ap_srs_carrier_list_item_t *srs_carrier_list_item) { // pointA - _F1_EQ_CHECK_INT(f1_srs_carrier_list_item->pointA, srs_carrier_list_item->pointA); + _EQ_CHECK_INT(f1_srs_carrier_list_item->pointA, srs_carrier_list_item->pointA); // Uplink Channel BW-PerSCS-List const f1ap_uplink_channel_bw_per_scs_list_t *uplink_channel_bw_per_scs_list = @@ -1894,16 +1894,16 @@ static bool eq_srs_carrier_list_item(const f1ap_srs_carrier_list_item_t *f1_srs_ &f1_srs_carrier_list_item->uplink_channel_bw_per_scs_list; uint32_t scs_specific_carrier_list_length = uplink_channel_bw_per_scs_list->scs_specific_carrier_list_length; - _F1_EQ_CHECK_INT(f1_uplink_channel_bw_per_scs_list->scs_specific_carrier_list_length, scs_specific_carrier_list_length); + _EQ_CHECK_INT(f1_uplink_channel_bw_per_scs_list->scs_specific_carrier_list_length, scs_specific_carrier_list_length); for (int i = 0; i < scs_specific_carrier_list_length; i++) { f1ap_scs_specific_carrier_t *scs_specific_carrier = &uplink_channel_bw_per_scs_list->scs_specific_carrier[i]; f1ap_scs_specific_carrier_t *f1_scs_specific_carrier = &f1_uplink_channel_bw_per_scs_list->scs_specific_carrier[i]; // offset to carrier - _F1_EQ_CHECK_INT(f1_scs_specific_carrier->offset_to_carrier, scs_specific_carrier->offset_to_carrier); + _EQ_CHECK_INT(f1_scs_specific_carrier->offset_to_carrier, scs_specific_carrier->offset_to_carrier); // subcarrier spacing - _F1_EQ_CHECK_INT(f1_scs_specific_carrier->subcarrier_spacing, scs_specific_carrier->subcarrier_spacing); + _EQ_CHECK_INT(f1_scs_specific_carrier->subcarrier_spacing, scs_specific_carrier->subcarrier_spacing); // carrier bandwidth - _F1_EQ_CHECK_INT(f1_scs_specific_carrier->carrier_bandwidth, scs_specific_carrier->carrier_bandwidth); + _EQ_CHECK_INT(f1_scs_specific_carrier->carrier_bandwidth, scs_specific_carrier->carrier_bandwidth); } // Active UL BWP @@ -1911,15 +1911,15 @@ static bool eq_srs_carrier_list_item(const f1ap_srs_carrier_list_item_t *f1_srs_ const f1ap_active_ul_bwp_t *active_ul_bwp = &srs_carrier_list_item->active_ul_bwp; // location and bandwidth - _F1_EQ_CHECK_INT(f1_active_ul_bwp->location_and_bandwidth, active_ul_bwp->location_and_bandwidth); + _EQ_CHECK_INT(f1_active_ul_bwp->location_and_bandwidth, active_ul_bwp->location_and_bandwidth); // subcarrier spacing - _F1_EQ_CHECK_INT(f1_active_ul_bwp->subcarrier_spacing, active_ul_bwp->subcarrier_spacing); + _EQ_CHECK_INT(f1_active_ul_bwp->subcarrier_spacing, active_ul_bwp->subcarrier_spacing); // cyclic prefix - _F1_EQ_CHECK_INT(f1_active_ul_bwp->cyclic_prefix, active_ul_bwp->cyclic_prefix); + _EQ_CHECK_INT(f1_active_ul_bwp->cyclic_prefix, active_ul_bwp->cyclic_prefix); // Tx Direct Current Location - _F1_EQ_CHECK_INT(f1_active_ul_bwp->tx_direct_current_location, active_ul_bwp->tx_direct_current_location); + _EQ_CHECK_INT(f1_active_ul_bwp->tx_direct_current_location, active_ul_bwp->tx_direct_current_location); // SRS Config const f1ap_srs_config_t *f1_sRSConfig = &f1_active_ul_bwp->srs_config; @@ -1932,7 +1932,7 @@ static bool eq_srs_carrier_list(const f1ap_srs_carrier_list_t *srs_carrier_list_ const f1ap_srs_carrier_list_t *srs_carrier_list_b) { uint32_t srs_carrier_list_len = srs_carrier_list_a->srs_carrier_list_length; - _F1_EQ_CHECK_INT(srs_carrier_list_b->srs_carrier_list_length, srs_carrier_list_len); + _EQ_CHECK_INT(srs_carrier_list_b->srs_carrier_list_length, srs_carrier_list_len); for (int i = 0; i < srs_carrier_list_len; i++) { f1ap_srs_carrier_list_item_t *srs_carrier_list_item_a = &srs_carrier_list_a->srs_carrier_list_item[i]; f1ap_srs_carrier_list_item_t *srs_carrier_list_item_b = &srs_carrier_list_b->srs_carrier_list_item[i]; @@ -2497,26 +2497,25 @@ static f1ap_geographical_coordinates_t cp_geographical_coordinates(const f1ap_ge static bool eq_reference_point_type(const f1ap_trp_reference_point_type_t *f1_referencePointType, const f1ap_trp_reference_point_type_t *referencePointType) { - _F1_EQ_CHECK_INT(f1_referencePointType->present, referencePointType->present); + _EQ_CHECK_INT(f1_referencePointType->present, referencePointType->present); switch (f1_referencePointType->present) { case F1AP_TRP_REFERENCE_POINT_TYPE_PR_TRPPOSITION_RELATIVE_GEODETIC: { const f1ap_relative_geodetic_location_t *f1_tRPPositionRelativeGeodetic = &f1_referencePointType->choice.trp_position_relative_geodetic; const f1ap_relative_geodetic_location_t *tRPPositionRelativeGeodetic = &referencePointType->choice.trp_position_relative_geodetic; - _F1_EQ_CHECK_LONG(tRPPositionRelativeGeodetic->milli_arc_second_units, - f1_tRPPositionRelativeGeodetic->milli_arc_second_units); - _F1_EQ_CHECK_LONG(tRPPositionRelativeGeodetic->height_units, f1_tRPPositionRelativeGeodetic->height_units); - _F1_EQ_CHECK_LONG(tRPPositionRelativeGeodetic->delta_latitude, f1_tRPPositionRelativeGeodetic->delta_latitude); - _F1_EQ_CHECK_LONG(tRPPositionRelativeGeodetic->delta_longitude, f1_tRPPositionRelativeGeodetic->delta_longitude); - _F1_EQ_CHECK_LONG(tRPPositionRelativeGeodetic->delta_height, f1_tRPPositionRelativeGeodetic->delta_height); + _EQ_CHECK_LONG(tRPPositionRelativeGeodetic->milli_arc_second_units, f1_tRPPositionRelativeGeodetic->milli_arc_second_units); + _EQ_CHECK_LONG(tRPPositionRelativeGeodetic->height_units, f1_tRPPositionRelativeGeodetic->height_units); + _EQ_CHECK_LONG(tRPPositionRelativeGeodetic->delta_latitude, f1_tRPPositionRelativeGeodetic->delta_latitude); + _EQ_CHECK_LONG(tRPPositionRelativeGeodetic->delta_longitude, f1_tRPPositionRelativeGeodetic->delta_longitude); + _EQ_CHECK_LONG(tRPPositionRelativeGeodetic->delta_height, f1_tRPPositionRelativeGeodetic->delta_height); const f1ap_location_uncertainty_t *f1_locationUncertainty_g = &f1_tRPPositionRelativeGeodetic->location_uncertainty; const f1ap_location_uncertainty_t *locationUncertainty_g = &tRPPositionRelativeGeodetic->location_uncertainty; - _F1_EQ_CHECK_LONG(locationUncertainty_g->horizontal_uncertainty, f1_locationUncertainty_g->horizontal_uncertainty); - _F1_EQ_CHECK_LONG(locationUncertainty_g->horizontal_confidence, f1_locationUncertainty_g->horizontal_confidence); - _F1_EQ_CHECK_LONG(locationUncertainty_g->vertical_uncertainty, f1_locationUncertainty_g->vertical_uncertainty); - _F1_EQ_CHECK_LONG(locationUncertainty_g->vertical_confidence, f1_locationUncertainty_g->vertical_confidence); + _EQ_CHECK_LONG(locationUncertainty_g->horizontal_uncertainty, f1_locationUncertainty_g->horizontal_uncertainty); + _EQ_CHECK_LONG(locationUncertainty_g->horizontal_confidence, f1_locationUncertainty_g->horizontal_confidence); + _EQ_CHECK_LONG(locationUncertainty_g->vertical_uncertainty, f1_locationUncertainty_g->vertical_uncertainty); + _EQ_CHECK_LONG(locationUncertainty_g->vertical_confidence, f1_locationUncertainty_g->vertical_confidence); break; } case F1AP_TRP_REFERENCE_POINT_TYPE_PR_TRPPOSITION_RELATIVE_CARTESIAN: { @@ -2524,17 +2523,17 @@ static bool eq_reference_point_type(const f1ap_trp_reference_point_type_t *f1_re &f1_referencePointType->choice.trp_position_relative_cartesian; const f1ap_relative_cartesian_location_t *tRPPositionRelativeCartesian = &referencePointType->choice.trp_position_relative_cartesian; - _F1_EQ_CHECK_LONG(tRPPositionRelativeCartesian->xyz_unit, f1_tRPPositionRelativeCartesian->xyz_unit); - _F1_EQ_CHECK_LONG(tRPPositionRelativeCartesian->xvalue, f1_tRPPositionRelativeCartesian->xvalue); - _F1_EQ_CHECK_LONG(tRPPositionRelativeCartesian->yvalue, f1_tRPPositionRelativeCartesian->yvalue); - _F1_EQ_CHECK_LONG(tRPPositionRelativeCartesian->zvalue, f1_tRPPositionRelativeCartesian->zvalue); + _EQ_CHECK_LONG(tRPPositionRelativeCartesian->xyz_unit, f1_tRPPositionRelativeCartesian->xyz_unit); + _EQ_CHECK_LONG(tRPPositionRelativeCartesian->xvalue, f1_tRPPositionRelativeCartesian->xvalue); + _EQ_CHECK_LONG(tRPPositionRelativeCartesian->yvalue, f1_tRPPositionRelativeCartesian->yvalue); + _EQ_CHECK_LONG(tRPPositionRelativeCartesian->zvalue, f1_tRPPositionRelativeCartesian->zvalue); const f1ap_location_uncertainty_t *f1_locationUncertainty_c = &f1_tRPPositionRelativeCartesian->location_uncertainty; const f1ap_location_uncertainty_t *locationUncertainty_c = &tRPPositionRelativeCartesian->location_uncertainty; - _F1_EQ_CHECK_LONG(locationUncertainty_c->horizontal_uncertainty, f1_locationUncertainty_c->horizontal_uncertainty); - _F1_EQ_CHECK_LONG(locationUncertainty_c->horizontal_confidence, f1_locationUncertainty_c->horizontal_confidence); - _F1_EQ_CHECK_LONG(locationUncertainty_c->vertical_uncertainty, f1_locationUncertainty_c->vertical_uncertainty); - _F1_EQ_CHECK_LONG(locationUncertainty_c->vertical_confidence, f1_locationUncertainty_c->vertical_confidence); + _EQ_CHECK_LONG(locationUncertainty_c->horizontal_uncertainty, f1_locationUncertainty_c->horizontal_uncertainty); + _EQ_CHECK_LONG(locationUncertainty_c->horizontal_confidence, f1_locationUncertainty_c->horizontal_confidence); + _EQ_CHECK_LONG(locationUncertainty_c->vertical_uncertainty, f1_locationUncertainty_c->vertical_uncertainty); + _EQ_CHECK_LONG(locationUncertainty_c->vertical_confidence, f1_locationUncertainty_c->vertical_confidence); break; } default: @@ -2547,15 +2546,15 @@ static bool eq_reference_point_type(const f1ap_trp_reference_point_type_t *f1_re static bool eq_trp_ha_pos(const f1ap_ngran_high_accuracy_access_point_position_t *trp_ha_pos, const f1ap_ngran_high_accuracy_access_point_position_t *f1_trp_ha_pos) { - _F1_EQ_CHECK_LONG(trp_ha_pos->latitude, f1_trp_ha_pos->latitude); - _F1_EQ_CHECK_LONG(trp_ha_pos->longitude, f1_trp_ha_pos->longitude); - _F1_EQ_CHECK_LONG(trp_ha_pos->altitude, f1_trp_ha_pos->altitude); - _F1_EQ_CHECK_LONG(trp_ha_pos->uncertainty_semi_major, f1_trp_ha_pos->uncertainty_semi_major); - _F1_EQ_CHECK_LONG(trp_ha_pos->uncertainty_semi_minor, f1_trp_ha_pos->uncertainty_semi_minor); - _F1_EQ_CHECK_LONG(trp_ha_pos->orientation_of_major_axis, f1_trp_ha_pos->orientation_of_major_axis); - _F1_EQ_CHECK_LONG(trp_ha_pos->horizontal_confidence, f1_trp_ha_pos->horizontal_confidence); - _F1_EQ_CHECK_LONG(trp_ha_pos->uncertainty_altitude, f1_trp_ha_pos->uncertainty_altitude); - _F1_EQ_CHECK_LONG(trp_ha_pos->vertical_confidence, f1_trp_ha_pos->vertical_confidence); + _EQ_CHECK_LONG(trp_ha_pos->latitude, f1_trp_ha_pos->latitude); + _EQ_CHECK_LONG(trp_ha_pos->longitude, f1_trp_ha_pos->longitude); + _EQ_CHECK_LONG(trp_ha_pos->altitude, f1_trp_ha_pos->altitude); + _EQ_CHECK_LONG(trp_ha_pos->uncertainty_semi_major, f1_trp_ha_pos->uncertainty_semi_major); + _EQ_CHECK_LONG(trp_ha_pos->uncertainty_semi_minor, f1_trp_ha_pos->uncertainty_semi_minor); + _EQ_CHECK_LONG(trp_ha_pos->orientation_of_major_axis, f1_trp_ha_pos->orientation_of_major_axis); + _EQ_CHECK_LONG(trp_ha_pos->horizontal_confidence, f1_trp_ha_pos->horizontal_confidence); + _EQ_CHECK_LONG(trp_ha_pos->uncertainty_altitude, f1_trp_ha_pos->uncertainty_altitude); + _EQ_CHECK_LONG(trp_ha_pos->vertical_confidence, f1_trp_ha_pos->vertical_confidence); return true; } @@ -2563,7 +2562,7 @@ static bool eq_geographical_coordinates(const f1ap_geographical_coordinates_t *i { const f1ap_trp_position_definition_type_t *f1_trp_pos_def_type = &in->trp_position_definition_type; const f1ap_trp_position_definition_type_t *trp_pos_def_type = &out->trp_position_definition_type; - _F1_EQ_CHECK_INT(f1_trp_pos_def_type->present, trp_pos_def_type->present); + _EQ_CHECK_INT(f1_trp_pos_def_type->present, trp_pos_def_type->present); switch (f1_trp_pos_def_type->present) { case F1AP_TRP_POSITION_DEFINITION_TYPE_PR_NOTHING: // nothing to check @@ -2571,21 +2570,21 @@ static bool eq_geographical_coordinates(const f1ap_geographical_coordinates_t *i case F1AP_TRP_POSITION_DEFINITION_TYPE_PR_DIRECT: { const f1ap_trp_position_direct_t *f1_direct = &f1_trp_pos_def_type->choice.direct; const f1ap_trp_position_direct_t *direct = &trp_pos_def_type->choice.direct; - _F1_EQ_CHECK_INT(f1_direct->accuracy.present, direct->accuracy.present); + _EQ_CHECK_INT(f1_direct->accuracy.present, direct->accuracy.present); if (f1_direct->accuracy.present == F1AP_TRP_POSITION_DIRECT_ACCURACY_PR_TRPPOSITION) { const f1ap_access_point_position_t *trp_pos = &direct->accuracy.choice.trp_position; const f1ap_access_point_position_t *f1_trp_pos = &f1_direct->accuracy.choice.trp_position; - _F1_EQ_CHECK_LONG(trp_pos->latitude_sign, f1_trp_pos->latitude_sign); - _F1_EQ_CHECK_LONG(trp_pos->latitude, f1_trp_pos->latitude); - _F1_EQ_CHECK_LONG(trp_pos->longitude, f1_trp_pos->longitude); - _F1_EQ_CHECK_LONG(trp_pos->direction_of_altitude, f1_trp_pos->direction_of_altitude); - _F1_EQ_CHECK_LONG(trp_pos->altitude, f1_trp_pos->altitude); - _F1_EQ_CHECK_LONG(trp_pos->uncertainty_semi_major, f1_trp_pos->uncertainty_semi_major); - _F1_EQ_CHECK_LONG(trp_pos->uncertainty_semi_minor, f1_trp_pos->uncertainty_semi_minor); - _F1_EQ_CHECK_LONG(trp_pos->orientation_of_major_axis, f1_trp_pos->orientation_of_major_axis); - _F1_EQ_CHECK_LONG(trp_pos->uncertainty_altitude, f1_trp_pos->uncertainty_altitude); - _F1_EQ_CHECK_LONG(trp_pos->confidence, f1_trp_pos->confidence); + _EQ_CHECK_LONG(trp_pos->latitude_sign, f1_trp_pos->latitude_sign); + _EQ_CHECK_LONG(trp_pos->latitude, f1_trp_pos->latitude); + _EQ_CHECK_LONG(trp_pos->longitude, f1_trp_pos->longitude); + _EQ_CHECK_LONG(trp_pos->direction_of_altitude, f1_trp_pos->direction_of_altitude); + _EQ_CHECK_LONG(trp_pos->altitude, f1_trp_pos->altitude); + _EQ_CHECK_LONG(trp_pos->uncertainty_semi_major, f1_trp_pos->uncertainty_semi_major); + _EQ_CHECK_LONG(trp_pos->uncertainty_semi_minor, f1_trp_pos->uncertainty_semi_minor); + _EQ_CHECK_LONG(trp_pos->orientation_of_major_axis, f1_trp_pos->orientation_of_major_axis); + _EQ_CHECK_LONG(trp_pos->uncertainty_altitude, f1_trp_pos->uncertainty_altitude); + _EQ_CHECK_LONG(trp_pos->confidence, f1_trp_pos->confidence); } else if (f1_direct->accuracy.present == F1AP_TRP_POSITION_DIRECT_ACCURACY_PR_TRPHAPOSITION) { const f1ap_ngran_high_accuracy_access_point_position_t *trp_ha_pos = &direct->accuracy.choice.trp_HAposition; const f1ap_ngran_high_accuracy_access_point_position_t *f1_trp_ha_pos = &f1_direct->accuracy.choice.trp_HAposition; @@ -2600,24 +2599,23 @@ static bool eq_geographical_coordinates(const f1ap_geographical_coordinates_t *i const f1ap_trp_position_referenced_t *referenced = &trp_pos_def_type->choice.referenced; const f1ap_reference_point_t *f1_referencePoint = &f1_referenced->reference_point; const f1ap_reference_point_t *referencePoint = &referenced->reference_point; - _F1_EQ_CHECK_INT(f1_referencePoint->present, referencePoint->present); + _EQ_CHECK_INT(f1_referencePoint->present, referencePoint->present); if (f1_referencePoint->present == F1AP_REFERENCE_POINT_PR_COORDINATEID) { - _F1_EQ_CHECK_LONG(referencePoint->choice.coordinate_id, f1_referencePoint->choice.coordinate_id); + _EQ_CHECK_LONG(referencePoint->choice.coordinate_id, f1_referencePoint->choice.coordinate_id); } else if (f1_referencePoint->present == F1AP_REFERENCE_POINT_PR_REFERENCEPOINTCOORDINATE) { const f1ap_access_point_position_t *referencePointCoordinate = &referencePoint->choice.reference_point_coordinate; const f1ap_access_point_position_t *f1_referencePointCoordinate = &f1_referencePoint->choice.reference_point_coordinate; - _F1_EQ_CHECK_LONG(referencePointCoordinate->latitude_sign, f1_referencePointCoordinate->latitude_sign); - _F1_EQ_CHECK_LONG(referencePointCoordinate->latitude, f1_referencePointCoordinate->latitude); - _F1_EQ_CHECK_LONG(referencePointCoordinate->longitude, f1_referencePointCoordinate->longitude); - _F1_EQ_CHECK_LONG(referencePointCoordinate->direction_of_altitude, f1_referencePointCoordinate->direction_of_altitude); - _F1_EQ_CHECK_LONG(referencePointCoordinate->altitude, f1_referencePointCoordinate->altitude); - _F1_EQ_CHECK_LONG(referencePointCoordinate->uncertainty_semi_major, f1_referencePointCoordinate->uncertainty_semi_major); - _F1_EQ_CHECK_LONG(referencePointCoordinate->uncertainty_semi_minor, f1_referencePointCoordinate->uncertainty_semi_minor); - _F1_EQ_CHECK_LONG(referencePointCoordinate->orientation_of_major_axis, - f1_referencePointCoordinate->orientation_of_major_axis); - _F1_EQ_CHECK_LONG(referencePointCoordinate->uncertainty_altitude, f1_referencePointCoordinate->uncertainty_altitude); - _F1_EQ_CHECK_LONG(referencePointCoordinate->confidence, f1_referencePointCoordinate->confidence); + _EQ_CHECK_LONG(referencePointCoordinate->latitude_sign, f1_referencePointCoordinate->latitude_sign); + _EQ_CHECK_LONG(referencePointCoordinate->latitude, f1_referencePointCoordinate->latitude); + _EQ_CHECK_LONG(referencePointCoordinate->longitude, f1_referencePointCoordinate->longitude); + _EQ_CHECK_LONG(referencePointCoordinate->direction_of_altitude, f1_referencePointCoordinate->direction_of_altitude); + _EQ_CHECK_LONG(referencePointCoordinate->altitude, f1_referencePointCoordinate->altitude); + _EQ_CHECK_LONG(referencePointCoordinate->uncertainty_semi_major, f1_referencePointCoordinate->uncertainty_semi_major); + _EQ_CHECK_LONG(referencePointCoordinate->uncertainty_semi_minor, f1_referencePointCoordinate->uncertainty_semi_minor); + _EQ_CHECK_LONG(referencePointCoordinate->orientation_of_major_axis, f1_referencePointCoordinate->orientation_of_major_axis); + _EQ_CHECK_LONG(referencePointCoordinate->uncertainty_altitude, f1_referencePointCoordinate->uncertainty_altitude); + _EQ_CHECK_LONG(referencePointCoordinate->confidence, f1_referencePointCoordinate->confidence); } else if (f1_referencePoint->present == F1AP_REFERENCE_POINT_PR_REFERENCEPOINTCOORDINATEHA) { const f1ap_ngran_high_accuracy_access_point_position_t *referencePointCoordinateHA = &referencePoint->choice.reference_point_coordinateHA; @@ -2796,22 +2794,22 @@ static f1ap_trp_information_type_response_item_t cp_trp_info_type_response_item( static bool eq_trp_info_type_response_item(const f1ap_trp_information_type_response_item_t *in, const f1ap_trp_information_type_response_item_t *out) { - _F1_EQ_CHECK_INT(in->present, out->present); + _EQ_CHECK_INT(in->present, out->present); switch (in->present) { case F1AP_TRP_INFORMATION_TYPE_RESPONSE_ITEM_PR_NOTHING: // nothing to check break; case F1AP_TRP_INFORMATION_TYPE_RESPONSE_ITEM_PR_PCI_NR: - _F1_EQ_CHECK_INT(in->choice.pci_nr, out->choice.pci_nr); + _EQ_CHECK_INT(in->choice.pci_nr, out->choice.pci_nr); break; case F1AP_TRP_INFORMATION_TYPE_RESPONSE_ITEM_PR_NG_RAN_CGI: - _F1_EQ_CHECK_INT(in->choice.ng_ran_cgi.plmn.mcc, out->choice.ng_ran_cgi.plmn.mcc); - _F1_EQ_CHECK_INT(in->choice.ng_ran_cgi.plmn.mnc, out->choice.ng_ran_cgi.plmn.mnc); - _F1_EQ_CHECK_INT(in->choice.ng_ran_cgi.plmn.mnc_digit_length, out->choice.ng_ran_cgi.plmn.mnc_digit_length); - _F1_EQ_CHECK_LONG(in->choice.ng_ran_cgi.nr_cellid, out->choice.ng_ran_cgi.nr_cellid); + _EQ_CHECK_INT(in->choice.ng_ran_cgi.plmn.mcc, out->choice.ng_ran_cgi.plmn.mcc); + _EQ_CHECK_INT(in->choice.ng_ran_cgi.plmn.mnc, out->choice.ng_ran_cgi.plmn.mnc); + _EQ_CHECK_INT(in->choice.ng_ran_cgi.plmn.mnc_digit_length, out->choice.ng_ran_cgi.plmn.mnc_digit_length); + _EQ_CHECK_LONG(in->choice.ng_ran_cgi.nr_cellid, out->choice.ng_ran_cgi.nr_cellid); break; case F1AP_TRP_INFORMATION_TYPE_RESPONSE_ITEM_PR_NRARFCN: - _F1_EQ_CHECK_INT(in->choice.nr_arfcn, out->choice.nr_arfcn); + _EQ_CHECK_INT(in->choice.nr_arfcn, out->choice.nr_arfcn); break; case F1AP_TRP_INFORMATION_TYPE_RESPONSE_ITEM_PR_PRSCONFIGURATION: PRINT_ERROR("TRP information type response item PRS configuration unsupported\n"); @@ -3321,7 +3319,7 @@ static bool eq_positioning_measurement_result(const f1ap_pos_measurement_result_ const f1ap_pos_measurement_result_t *posMeasurementResult) { uint32_t pos_meas_result_length = f1_posMeasurementResult->pos_measurement_result_item_length; - _F1_EQ_CHECK_INT(posMeasurementResult->pos_measurement_result_item_length, pos_meas_result_length); + _EQ_CHECK_INT(posMeasurementResult->pos_measurement_result_item_length, pos_meas_result_length); for (int i = 0; i < pos_meas_result_length; i++) { f1ap_pos_measurement_result_item_t *f1_pos_measurement_result_item = &f1_posMeasurementResult->pos_measurement_result_item[i]; f1ap_pos_measurement_result_item_t *pos_measurement_result_item = &posMeasurementResult->pos_measurement_result_item[i]; @@ -3330,7 +3328,7 @@ static bool eq_positioning_measurement_result(const f1ap_pos_measurement_result_ f1ap_measured_results_value_t *f1_measuredResultsValue = &f1_pos_measurement_result_item->measured_results_value; f1ap_measured_results_value_t *measuredResultsValue = &pos_measurement_result_item->measured_results_value; - _F1_EQ_CHECK_INT(measuredResultsValue->present, f1_measuredResultsValue->present); + _EQ_CHECK_INT(measuredResultsValue->present, f1_measuredResultsValue->present); switch (measuredResultsValue->present) { case F1AP_MEASURED_RESULTS_VALUE_PR_NOTHING: // nothing to check @@ -3340,23 +3338,23 @@ static bool eq_positioning_measurement_result(const f1ap_pos_measurement_result_ f1ap_ul_aoa_t *f1_uL_AngleOfArrival = &f1_measuredResultsValue->choice.ul_angle_of_arrival; f1ap_ul_aoa_t *uL_AngleOfArrival = &measuredResultsValue->choice.ul_angle_of_arrival; - _F1_EQ_CHECK_INT(uL_AngleOfArrival->azimuth_aoa, f1_uL_AngleOfArrival->azimuth_aoa); + _EQ_CHECK_INT(uL_AngleOfArrival->azimuth_aoa, f1_uL_AngleOfArrival->azimuth_aoa); if (f1_uL_AngleOfArrival->zenith_aoa) { - _F1_EQ_CHECK_INT(*uL_AngleOfArrival->zenith_aoa, *f1_uL_AngleOfArrival->zenith_aoa); + _EQ_CHECK_INT(*uL_AngleOfArrival->zenith_aoa, *f1_uL_AngleOfArrival->zenith_aoa); } if (f1_uL_AngleOfArrival->lcs_to_gcs_translation_aoa) { f1ap_lcs_to_gcs_translationaoa_t *lCS_to_GCS_TranslationAoA = uL_AngleOfArrival->lcs_to_gcs_translation_aoa; f1ap_lcs_to_gcs_translationaoa_t *f1_lCS_to_GCS_TranslationAoA = f1_uL_AngleOfArrival->lcs_to_gcs_translation_aoa; - _F1_EQ_CHECK_INT(lCS_to_GCS_TranslationAoA->alpha, f1_lCS_to_GCS_TranslationAoA->alpha); - _F1_EQ_CHECK_INT(lCS_to_GCS_TranslationAoA->beta, f1_lCS_to_GCS_TranslationAoA->beta); - _F1_EQ_CHECK_INT(lCS_to_GCS_TranslationAoA->gamma, f1_lCS_to_GCS_TranslationAoA->gamma); + _EQ_CHECK_INT(lCS_to_GCS_TranslationAoA->alpha, f1_lCS_to_GCS_TranslationAoA->alpha); + _EQ_CHECK_INT(lCS_to_GCS_TranslationAoA->beta, f1_lCS_to_GCS_TranslationAoA->beta); + _EQ_CHECK_INT(lCS_to_GCS_TranslationAoA->gamma, f1_lCS_to_GCS_TranslationAoA->gamma); } break; } // UL SRS RSRP case F1AP_MEASURED_RESULTS_VALUE_PR_UL_SRS_RSRP: - _F1_EQ_CHECK_INT(measuredResultsValue->choice.ul_srs_rsrp, f1_measuredResultsValue->choice.ul_srs_rsrp); + _EQ_CHECK_INT(measuredResultsValue->choice.ul_srs_rsrp, f1_measuredResultsValue->choice.ul_srs_rsrp); break; // UL RTOA case F1AP_MEASURED_RESULTS_VALUE_PR_UL_RTOA: { @@ -3370,22 +3368,22 @@ static bool eq_positioning_measurement_result(const f1ap_pos_measurement_result_ case F1AP_ULRTOAMEAS_PR_NOTHING: break; case F1AP_ULRTOAMEAS_PR_K0: - _F1_EQ_CHECK_INT(ul_rtoa_meas_item->choice.k0, f1_ul_rtoa_meas_item->choice.k0); + _EQ_CHECK_INT(ul_rtoa_meas_item->choice.k0, f1_ul_rtoa_meas_item->choice.k0); break; case F1AP_ULRTOAMEAS_PR_K1: - _F1_EQ_CHECK_INT(ul_rtoa_meas_item->choice.k1, f1_ul_rtoa_meas_item->choice.k1); + _EQ_CHECK_INT(ul_rtoa_meas_item->choice.k1, f1_ul_rtoa_meas_item->choice.k1); break; case F1AP_ULRTOAMEAS_PR_K2: - _F1_EQ_CHECK_INT(ul_rtoa_meas_item->choice.k2, f1_ul_rtoa_meas_item->choice.k2); + _EQ_CHECK_INT(ul_rtoa_meas_item->choice.k2, f1_ul_rtoa_meas_item->choice.k2); break; case F1AP_ULRTOAMEAS_PR_K3: - _F1_EQ_CHECK_INT(ul_rtoa_meas_item->choice.k3, f1_ul_rtoa_meas_item->choice.k3); + _EQ_CHECK_INT(ul_rtoa_meas_item->choice.k3, f1_ul_rtoa_meas_item->choice.k3); break; case F1AP_ULRTOAMEAS_PR_K4: - _F1_EQ_CHECK_INT(ul_rtoa_meas_item->choice.k4, f1_ul_rtoa_meas_item->choice.k4); + _EQ_CHECK_INT(ul_rtoa_meas_item->choice.k4, f1_ul_rtoa_meas_item->choice.k4); break; case F1AP_ULRTOAMEAS_PR_K5: - _F1_EQ_CHECK_INT(ul_rtoa_meas_item->choice.k5, f1_ul_rtoa_meas_item->choice.k5); + _EQ_CHECK_INT(ul_rtoa_meas_item->choice.k5, f1_ul_rtoa_meas_item->choice.k5); break; default: AssertError(false, return false, "Illegal uL_RTOA_MeasurementItem %d\n", f1_ul_rtoa_meas_item->present); @@ -3399,27 +3397,27 @@ static bool eq_positioning_measurement_result(const f1ap_pos_measurement_result_ f1ap_gnb_rx_tx_time_diff_t *gNB_RxTxTimeDiff = &measuredResultsValue->choice.gnb_rx_tx_time_diff; f1ap_gnb_rx_tx_time_diff_meas_t *f1_rx_tx_time_diff = &f1_gNB_RxTxTimeDiff->rx_tx_time_diff; f1ap_gnb_rx_tx_time_diff_meas_t *rx_tx_time_diff = &gNB_RxTxTimeDiff->rx_tx_time_diff; - _F1_EQ_CHECK_INT(f1_rx_tx_time_diff->present, rx_tx_time_diff->present); + _EQ_CHECK_INT(f1_rx_tx_time_diff->present, rx_tx_time_diff->present); switch (f1_rx_tx_time_diff->present) { case F1AP_GNBRXTXTIMEDIFFMEAS_PR_NOTHING: break; case F1AP_GNBRXTXTIMEDIFFMEAS_PR_K0: - _F1_EQ_CHECK_INT(rx_tx_time_diff->choice.k0, f1_rx_tx_time_diff->choice.k0); + _EQ_CHECK_INT(rx_tx_time_diff->choice.k0, f1_rx_tx_time_diff->choice.k0); break; case F1AP_GNBRXTXTIMEDIFFMEAS_PR_K1: - _F1_EQ_CHECK_INT(rx_tx_time_diff->choice.k1, f1_rx_tx_time_diff->choice.k1); + _EQ_CHECK_INT(rx_tx_time_diff->choice.k1, f1_rx_tx_time_diff->choice.k1); break; case F1AP_GNBRXTXTIMEDIFFMEAS_PR_K2: - _F1_EQ_CHECK_INT(rx_tx_time_diff->choice.k2, f1_rx_tx_time_diff->choice.k2); + _EQ_CHECK_INT(rx_tx_time_diff->choice.k2, f1_rx_tx_time_diff->choice.k2); break; case F1AP_GNBRXTXTIMEDIFFMEAS_PR_K3: - _F1_EQ_CHECK_INT(rx_tx_time_diff->choice.k3, f1_rx_tx_time_diff->choice.k3); + _EQ_CHECK_INT(rx_tx_time_diff->choice.k3, f1_rx_tx_time_diff->choice.k3); break; case F1AP_GNBRXTXTIMEDIFFMEAS_PR_K4: - _F1_EQ_CHECK_INT(rx_tx_time_diff->choice.k4, f1_rx_tx_time_diff->choice.k4); + _EQ_CHECK_INT(rx_tx_time_diff->choice.k4, f1_rx_tx_time_diff->choice.k4); break; case F1AP_GNBRXTXTIMEDIFFMEAS_PR_K5: - _F1_EQ_CHECK_INT(rx_tx_time_diff->choice.k5, f1_rx_tx_time_diff->choice.k5); + _EQ_CHECK_INT(rx_tx_time_diff->choice.k5, f1_rx_tx_time_diff->choice.k5); break; default: AssertError(false, return false, "Illegal rxTxTimeDiff value %d\n", f1_rx_tx_time_diff->present); @@ -3435,7 +3433,7 @@ static bool eq_positioning_measurement_result(const f1ap_pos_measurement_result_ // timeStamp f1ap_time_stamp_t *f1_timeStamp = &f1_pos_measurement_result_item->time_stamp; f1ap_time_stamp_t *timeStamp = &pos_measurement_result_item->time_stamp; - _F1_EQ_CHECK_INT(timeStamp->system_frame_number, f1_timeStamp->system_frame_number); + _EQ_CHECK_INT(timeStamp->system_frame_number, f1_timeStamp->system_frame_number); f1ap_time_stamp_slot_index_t *f1_slot_index = &f1_timeStamp->slot_index; f1ap_time_stamp_slot_index_t *slot_index = &timeStamp->slot_index; @@ -3443,16 +3441,16 @@ static bool eq_positioning_measurement_result(const f1ap_pos_measurement_result_ case F1AP_TIME_STAMP_SLOT_INDEX_PR_NOTHING: break; case F1AP_TIME_STAMP_SLOT_INDEX_PR_SCS_15: - _F1_EQ_CHECK_INT(slot_index->choice.scs_15, f1_slot_index->choice.scs_15); + _EQ_CHECK_INT(slot_index->choice.scs_15, f1_slot_index->choice.scs_15); break; case F1AP_TIME_STAMP_SLOT_INDEX_PR_SCS_30: - _F1_EQ_CHECK_INT(slot_index->choice.scs_30, f1_slot_index->choice.scs_30); + _EQ_CHECK_INT(slot_index->choice.scs_30, f1_slot_index->choice.scs_30); break; case F1AP_TIME_STAMP_SLOT_INDEX_PR_SCS_60: - _F1_EQ_CHECK_INT(slot_index->choice.scs_60, f1_slot_index->choice.scs_60); + _EQ_CHECK_INT(slot_index->choice.scs_60, f1_slot_index->choice.scs_60); break; case F1AP_TIME_STAMP_SLOT_INDEX_PR_SCS_120: - _F1_EQ_CHECK_INT(slot_index->choice.scs_120, f1_slot_index->choice.scs_120); + _EQ_CHECK_INT(slot_index->choice.scs_120, f1_slot_index->choice.scs_120); break; default: AssertError(false, return false, "Illegal slotIndex value %d\n", f1_slot_index->present); @@ -3521,11 +3519,11 @@ bool decode_positioning_information_req(const F1AP_F1AP_PDU_t *pdu, f1ap_positio AssertError(ie != NULL, return false, "in->protocolIEs.list.array[i] is NULL"); switch (ie->id) { case F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningInformationRequestIEs__value_PR_GNB_CU_UE_F1AP_ID); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningInformationRequestIEs__value_PR_GNB_CU_UE_F1AP_ID); out->gNB_CU_ue_id = ie->value.choice.GNB_CU_UE_F1AP_ID; break; case F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningInformationRequestIEs__value_PR_GNB_DU_UE_F1AP_ID); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningInformationRequestIEs__value_PR_GNB_DU_UE_F1AP_ID); out->gNB_DU_ue_id = ie->value.choice.GNB_DU_UE_F1AP_ID; break; case F1AP_ProtocolIE_ID_id_RequestedSRSTransmissionCharacteristics: @@ -3559,8 +3557,8 @@ f1ap_positioning_information_req_t cp_positioning_information_req(const f1ap_pos */ bool eq_positioning_information_req(const f1ap_positioning_information_req_t *a, const f1ap_positioning_information_req_t *b) { - _F1_EQ_CHECK_INT(a->gNB_CU_ue_id, b->gNB_CU_ue_id); - _F1_EQ_CHECK_INT(a->gNB_DU_ue_id, b->gNB_DU_ue_id); + _EQ_CHECK_INT(a->gNB_CU_ue_id, b->gNB_CU_ue_id); + _EQ_CHECK_INT(a->gNB_DU_ue_id, b->gNB_DU_ue_id); return true; } @@ -3647,15 +3645,15 @@ bool decode_positioning_information_resp(const F1AP_F1AP_PDU_t *pdu, f1ap_positi AssertError(ie != NULL, return false, "in->protocolIEs.list.array[i] is NULL"); switch (ie->id) { case F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningInformationResponseIEs__value_PR_GNB_CU_UE_F1AP_ID); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningInformationResponseIEs__value_PR_GNB_CU_UE_F1AP_ID); out->gNB_CU_ue_id = ie->value.choice.GNB_CU_UE_F1AP_ID; break; case F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningInformationResponseIEs__value_PR_GNB_DU_UE_F1AP_ID); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningInformationResponseIEs__value_PR_GNB_DU_UE_F1AP_ID); out->gNB_DU_ue_id = ie->value.choice.GNB_DU_UE_F1AP_ID; break; case F1AP_ProtocolIE_ID_id_SRSConfiguration: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningInformationResponseIEs__value_PR_SRSConfiguration); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningInformationResponseIEs__value_PR_SRSConfiguration); F1AP_SRSCarrier_List_t *f1_sRSCarrier_List = &ie->value.choice.SRSConfiguration.sRSCarrier_List; out->srs_configuration = calloc_or_fail(1, sizeof(*out->srs_configuration)); f1ap_srs_carrier_list_t *srs_carrier_list = &out->srs_configuration->srs_carrier_list; @@ -3703,8 +3701,8 @@ f1ap_positioning_information_resp_t cp_positioning_information_resp(const f1ap_p */ bool eq_positioning_information_resp(const f1ap_positioning_information_resp_t *a, const f1ap_positioning_information_resp_t *b) { - _F1_EQ_CHECK_INT(a->gNB_CU_ue_id, b->gNB_CU_ue_id); - _F1_EQ_CHECK_INT(a->gNB_DU_ue_id, b->gNB_DU_ue_id); + _EQ_CHECK_INT(a->gNB_CU_ue_id, b->gNB_CU_ue_id); + _EQ_CHECK_INT(a->gNB_DU_ue_id, b->gNB_DU_ue_id); /* optional: SRS Configuration (O) */ if ((a->srs_configuration == NULL) != (b->srs_configuration == NULL)) { @@ -3799,15 +3797,15 @@ bool decode_positioning_information_failure(const F1AP_F1AP_PDU_t *pdu, f1ap_pos AssertError(ie != NULL, return false, "in->protocolIEs.list.array[i] is NULL"); switch (ie->id) { case F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningInformationFailureIEs__value_PR_GNB_CU_UE_F1AP_ID); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningInformationFailureIEs__value_PR_GNB_CU_UE_F1AP_ID); out->gNB_CU_ue_id = ie->value.choice.GNB_CU_UE_F1AP_ID; break; case F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningInformationFailureIEs__value_PR_GNB_DU_UE_F1AP_ID); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningInformationFailureIEs__value_PR_GNB_DU_UE_F1AP_ID); out->gNB_DU_ue_id = ie->value.choice.GNB_DU_UE_F1AP_ID; break; case F1AP_ProtocolIE_ID_id_Cause: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningInformationFailureIEs__value_PR_Cause); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningInformationFailureIEs__value_PR_Cause); _F1_CHECK_EXP(decode_f1ap_cause(ie->value.choice.Cause, &out->cause, &out->cause_value)); break; case F1AP_ProtocolIE_ID_id_CriticalityDiagnostics: @@ -3844,10 +3842,10 @@ f1ap_positioning_information_failure_t cp_positioning_information_failure(const bool eq_positioning_information_failure(const f1ap_positioning_information_failure_t *a, const f1ap_positioning_information_failure_t *b) { - _F1_EQ_CHECK_INT(a->gNB_CU_ue_id, b->gNB_CU_ue_id); - _F1_EQ_CHECK_INT(a->gNB_DU_ue_id, b->gNB_DU_ue_id); - _F1_EQ_CHECK_INT(a->cause, b->cause); - _F1_EQ_CHECK_LONG(a->cause_value, b->cause_value); + _EQ_CHECK_INT(a->gNB_CU_ue_id, b->gNB_CU_ue_id); + _EQ_CHECK_INT(a->gNB_DU_ue_id, b->gNB_DU_ue_id); + _EQ_CHECK_INT(a->cause, b->cause); + _EQ_CHECK_LONG(a->cause_value, b->cause_value); return true; } @@ -3927,15 +3925,15 @@ bool decode_positioning_activation_req(const F1AP_F1AP_PDU_t *pdu, f1ap_position AssertError(ie != NULL, return false, "in->protocolIEs.list.array[i] is NULL"); switch (ie->id) { case F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningActivationRequestIEs__value_PR_GNB_CU_UE_F1AP_ID); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningActivationRequestIEs__value_PR_GNB_CU_UE_F1AP_ID); out->gNB_CU_ue_id = ie->value.choice.GNB_CU_UE_F1AP_ID; break; case F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningActivationRequestIEs__value_PR_GNB_DU_UE_F1AP_ID); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningActivationRequestIEs__value_PR_GNB_DU_UE_F1AP_ID); out->gNB_DU_ue_id = ie->value.choice.GNB_DU_UE_F1AP_ID; break; case F1AP_ProtocolIE_ID_id_SRSType: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningActivationRequestIEs__value_PR_SRSType); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningActivationRequestIEs__value_PR_SRSType); _F1_CHECK_EXP(decode_f1ap_srstype(&ie->value.choice.SRSType, &out->srs_type)); break; case F1AP_ProtocolIE_ID_id_ActivationTime: @@ -3987,9 +3985,9 @@ f1ap_positioning_activation_req_t cp_positioning_activation_req(const f1ap_posit */ bool eq_positioning_activation_req(const f1ap_positioning_activation_req_t *a, const f1ap_positioning_activation_req_t *b) { - _F1_EQ_CHECK_INT(a->gNB_CU_ue_id, b->gNB_CU_ue_id); - _F1_EQ_CHECK_INT(a->gNB_DU_ue_id, b->gNB_DU_ue_id); - _F1_EQ_CHECK_INT(a->srs_type.present, b->srs_type.present); + _EQ_CHECK_INT(a->gNB_CU_ue_id, b->gNB_CU_ue_id); + _EQ_CHECK_INT(a->gNB_DU_ue_id, b->gNB_DU_ue_id); + _EQ_CHECK_INT(a->srs_type.present, b->srs_type.present); const f1ap_srs_type_t *srs_type_a = &a->srs_type; const f1ap_srs_type_t *srs_type_b = &b->srs_type; @@ -3998,10 +3996,10 @@ bool eq_positioning_activation_req(const f1ap_positioning_activation_req_t *a, c // nothing to check break; case F1AP_SRS_TYPE_PR_SEMIPERSISTENTSRS: - _F1_EQ_CHECK_INT(*srs_type_a->choice.srs_resource_set_id, *srs_type_b->choice.srs_resource_set_id); + _EQ_CHECK_INT(*srs_type_a->choice.srs_resource_set_id, *srs_type_b->choice.srs_resource_set_id); break; case F1AP_SRS_TYPE_PR_APERIODICSRS: - _F1_EQ_CHECK_INT(*srs_type_a->choice.aperiodic, *srs_type_b->choice.aperiodic); + _EQ_CHECK_INT(*srs_type_a->choice.aperiodic, *srs_type_b->choice.aperiodic); break; default: PRINT_ERROR("received illegal SRS type %d\n", srs_type_a->present); @@ -4093,11 +4091,11 @@ bool decode_positioning_activation_resp(const F1AP_F1AP_PDU_t *pdu, f1ap_positio AssertError(ie != NULL, return false, "in->protocolIEs.list.array[i] is NULL"); switch (ie->id) { case F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningActivationResponseIEs__value_PR_GNB_CU_UE_F1AP_ID); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningActivationResponseIEs__value_PR_GNB_CU_UE_F1AP_ID); out->gNB_CU_ue_id = ie->value.choice.GNB_CU_UE_F1AP_ID; break; case F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningActivationResponseIEs__value_PR_GNB_DU_UE_F1AP_ID); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningActivationResponseIEs__value_PR_GNB_DU_UE_F1AP_ID); out->gNB_DU_ue_id = ie->value.choice.GNB_DU_UE_F1AP_ID; break; case F1AP_ProtocolIE_ID_id_SystemFrameNumber: @@ -4137,8 +4135,8 @@ f1ap_positioning_activation_resp_t cp_positioning_activation_resp(const f1ap_pos */ bool eq_positioning_activation_resp(const f1ap_positioning_activation_resp_t *a, const f1ap_positioning_activation_resp_t *b) { - _F1_EQ_CHECK_INT(a->gNB_CU_ue_id, b->gNB_CU_ue_id); - _F1_EQ_CHECK_INT(a->gNB_DU_ue_id, b->gNB_DU_ue_id); + _EQ_CHECK_INT(a->gNB_CU_ue_id, b->gNB_CU_ue_id); + _EQ_CHECK_INT(a->gNB_DU_ue_id, b->gNB_DU_ue_id); return true; } @@ -4218,15 +4216,15 @@ bool decode_positioning_activation_failure(const F1AP_F1AP_PDU_t *pdu, f1ap_posi AssertError(ie != NULL, return false, "in->protocolIEs.list.array[i] is NULL"); switch (ie->id) { case F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningActivationFailureIEs__value_PR_GNB_CU_UE_F1AP_ID); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningActivationFailureIEs__value_PR_GNB_CU_UE_F1AP_ID); out->gNB_CU_ue_id = ie->value.choice.GNB_CU_UE_F1AP_ID; break; case F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningActivationFailureIEs__value_PR_GNB_DU_UE_F1AP_ID); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningActivationFailureIEs__value_PR_GNB_DU_UE_F1AP_ID); out->gNB_DU_ue_id = ie->value.choice.GNB_DU_UE_F1AP_ID; break; case F1AP_ProtocolIE_ID_id_Cause: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningActivationFailureIEs__value_PR_Cause); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningActivationFailureIEs__value_PR_Cause); _F1_CHECK_EXP(decode_f1ap_cause(ie->value.choice.Cause, &out->cause, &out->cause_value)); break; case F1AP_ProtocolIE_ID_id_CriticalityDiagnostics: @@ -4263,10 +4261,10 @@ f1ap_positioning_activation_failure_t cp_positioning_activation_failure(const f1 bool eq_positioning_activation_failure(const f1ap_positioning_activation_failure_t *a, const f1ap_positioning_activation_failure_t *b) { - _F1_EQ_CHECK_INT(a->gNB_CU_ue_id, b->gNB_CU_ue_id); - _F1_EQ_CHECK_INT(a->gNB_DU_ue_id, b->gNB_DU_ue_id); - _F1_EQ_CHECK_INT(a->cause, b->cause); - _F1_EQ_CHECK_LONG(a->cause_value, b->cause_value); + _EQ_CHECK_INT(a->gNB_CU_ue_id, b->gNB_CU_ue_id); + _EQ_CHECK_INT(a->gNB_DU_ue_id, b->gNB_DU_ue_id); + _EQ_CHECK_INT(a->cause, b->cause); + _EQ_CHECK_LONG(a->cause_value, b->cause_value); return true; } @@ -4338,15 +4336,15 @@ bool decode_positioning_deactivation(const F1AP_F1AP_PDU_t *pdu, f1ap_positionin AssertError(ie != NULL, return false, "in->protocolIEs.list.array[i] is NULL"); switch (ie->id) { case F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningDeactivationIEs__value_PR_GNB_CU_UE_F1AP_ID); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningDeactivationIEs__value_PR_GNB_CU_UE_F1AP_ID); out->gNB_CU_ue_id = ie->value.choice.GNB_CU_UE_F1AP_ID; break; case F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningDeactivationIEs__value_PR_GNB_DU_UE_F1AP_ID); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningDeactivationIEs__value_PR_GNB_DU_UE_F1AP_ID); out->gNB_DU_ue_id = ie->value.choice.GNB_DU_UE_F1AP_ID; break; case F1AP_ProtocolIE_ID_id_AbortTransmission: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningDeactivationIEs__value_PR_AbortTransmission); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningDeactivationIEs__value_PR_AbortTransmission); _F1_CHECK_EXP(decode_f1ap_abort_transmission(&ie->value.choice.AbortTransmission, &out->abort_transmission)); break; default: @@ -4393,18 +4391,18 @@ f1ap_positioning_deactivation_t cp_positioning_deactivation(const f1ap_positioni */ bool eq_positioning_deactivation(const f1ap_positioning_deactivation_t *a, const f1ap_positioning_deactivation_t *b) { - _F1_EQ_CHECK_INT(a->gNB_CU_ue_id, b->gNB_CU_ue_id); - _F1_EQ_CHECK_INT(a->gNB_DU_ue_id, b->gNB_DU_ue_id); - _F1_EQ_CHECK_INT(a->abort_transmission.present, b->abort_transmission.present); + _EQ_CHECK_INT(a->gNB_CU_ue_id, b->gNB_CU_ue_id); + _EQ_CHECK_INT(a->gNB_DU_ue_id, b->gNB_DU_ue_id); + _EQ_CHECK_INT(a->abort_transmission.present, b->abort_transmission.present); switch (a->abort_transmission.present) { case F1AP_ABORT_TRANSMISSION_PR_NOTHING: // nothing to check break; case F1AP_ABORT_TRANSMISSION_PR_SRSRESOURCESETID: - _F1_EQ_CHECK_INT(a->abort_transmission.choice.srs_resource_set_id, b->abort_transmission.choice.srs_resource_set_id); + _EQ_CHECK_INT(a->abort_transmission.choice.srs_resource_set_id, b->abort_transmission.choice.srs_resource_set_id); break; case F1AP_ABORT_TRANSMISSION_PR_RELEASEALL: - _F1_EQ_CHECK_INT(a->abort_transmission.choice.release_all, b->abort_transmission.choice.release_all); + _EQ_CHECK_INT(a->abort_transmission.choice.release_all, b->abort_transmission.choice.release_all); break; default: PRINT_ERROR("received illegal Abort Transmission value %d\n", a->abort_transmission.present); @@ -4496,15 +4494,15 @@ bool decode_positioning_information_update(const F1AP_F1AP_PDU_t *pdu, f1ap_posi AssertError(ie != NULL, return false, "in->protocolIEs.list.array[i] is NULL"); switch (ie->id) { case F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningInformationUpdateIEs__value_PR_GNB_CU_UE_F1AP_ID); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningInformationUpdateIEs__value_PR_GNB_CU_UE_F1AP_ID); out->gNB_CU_ue_id = ie->value.choice.GNB_CU_UE_F1AP_ID; break; case F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningInformationUpdateIEs__value_PR_GNB_DU_UE_F1AP_ID); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningInformationUpdateIEs__value_PR_GNB_DU_UE_F1AP_ID); out->gNB_DU_ue_id = ie->value.choice.GNB_DU_UE_F1AP_ID; break; case F1AP_ProtocolIE_ID_id_SRSConfiguration: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningInformationUpdateIEs__value_PR_SRSConfiguration); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningInformationUpdateIEs__value_PR_SRSConfiguration); F1AP_SRSCarrier_List_t *f1_sRSCarrier_List = &ie->value.choice.SRSConfiguration.sRSCarrier_List; out->srs_configuration = calloc_or_fail(1, sizeof(*out->srs_configuration)); f1ap_srs_carrier_list_t *srs_carrier_list = &out->srs_configuration->srs_carrier_list; @@ -4550,8 +4548,8 @@ f1ap_positioning_information_update_t cp_positioning_information_update(const f1 bool eq_positioning_information_update(const f1ap_positioning_information_update_t *a, const f1ap_positioning_information_update_t *b) { - _F1_EQ_CHECK_INT(a->gNB_CU_ue_id, b->gNB_CU_ue_id); - _F1_EQ_CHECK_INT(a->gNB_DU_ue_id, b->gNB_DU_ue_id); + _EQ_CHECK_INT(a->gNB_CU_ue_id, b->gNB_CU_ue_id); + _EQ_CHECK_INT(a->gNB_DU_ue_id, b->gNB_DU_ue_id); /* optional: SRS Configuration */ if ((a->srs_configuration == NULL) != (b->srs_configuration == NULL)) { @@ -4655,11 +4653,11 @@ bool decode_trp_information_req(const F1AP_F1AP_PDU_t *pdu, f1ap_trp_information AssertError(ie != NULL, return false, "in->protocolIEs.list.array[i] is NULL"); switch (ie->id) { case F1AP_ProtocolIE_ID_id_TransactionID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_TRPInformationRequestIEs__value_PR_TransactionID); + _EQ_CHECK_INT(ie->value.present, F1AP_TRPInformationRequestIEs__value_PR_TransactionID); out->transaction_id = ie->value.choice.TransactionID; break; case F1AP_ProtocolIE_ID_id_TRPList: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_TRPInformationRequestIEs__value_PR_TRPList); + _EQ_CHECK_INT(ie->value.present, F1AP_TRPInformationRequestIEs__value_PR_TRPList); out->has_trp_list = true; uint32_t trp_list_length = ie->value.choice.TRPList.list.count; AssertError(trp_list_length > 0, return false, "at least 1 TRP must be present"); @@ -4671,7 +4669,7 @@ bool decode_trp_information_req(const F1AP_F1AP_PDU_t *pdu, f1ap_trp_information } break; case F1AP_ProtocolIE_ID_id_TRPInformationTypeListTRPReq: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_TRPInformationRequestIEs__value_PR_TRPInformationTypeListTRPReq); + _EQ_CHECK_INT(ie->value.present, F1AP_TRPInformationRequestIEs__value_PR_TRPInformationTypeListTRPReq); uint8_t trp_info_type_list_length = ie->value.choice.TRPInformationTypeListTRPReq.list.count; AssertError(trp_info_type_list_length > 0, return false, "at least 1 TRP Information Type must be present"); f1ap_trp_information_type_list_t *trp_information_type_list = &out->trp_information_type_list; @@ -4681,8 +4679,8 @@ bool decode_trp_information_req(const F1AP_F1AP_PDU_t *pdu, f1ap_trp_information for (int i = 0; i < trp_info_type_list_length; i++) { F1AP_TRPInformationTypeItemTRPReq_t *f1_trpinfotypeitem = (F1AP_TRPInformationTypeItemTRPReq_t *)ie->value.choice.TRPInformationTypeListTRPReq.list.array[i]; - _F1_EQ_CHECK_LONG(f1_trpinfotypeitem->id, F1AP_ProtocolIE_ID_id_TRPInformationTypeItem); - _F1_EQ_CHECK_INT(f1_trpinfotypeitem->value.present, F1AP_TRPInformationTypeItemTRPReq__value_PR_TRPInformationTypeItem); + _EQ_CHECK_LONG(f1_trpinfotypeitem->id, F1AP_ProtocolIE_ID_id_TRPInformationTypeItem); + _EQ_CHECK_INT(f1_trpinfotypeitem->value.present, F1AP_TRPInformationTypeItemTRPReq__value_PR_TRPInformationTypeItem); trp_information_type_list->trp_information_type_item[i] = f1_trpinfotypeitem->value.choice.TRPInformationTypeItem; } break; @@ -4733,22 +4731,22 @@ f1ap_trp_information_req_t cp_trp_information_req(const f1ap_trp_information_req */ bool eq_trp_information_req(const f1ap_trp_information_req_t *a, const f1ap_trp_information_req_t *b) { - _F1_EQ_CHECK_INT(a->transaction_id, b->transaction_id); - _F1_EQ_CHECK_INT(a->has_trp_list, b->has_trp_list); + _EQ_CHECK_INT(a->transaction_id, b->transaction_id); + _EQ_CHECK_INT(a->has_trp_list, b->has_trp_list); if (a->has_trp_list) { - _F1_EQ_CHECK_INT(a->trp_list.trp_list_length, b->trp_list.trp_list_length); + _EQ_CHECK_INT(a->trp_list.trp_list_length, b->trp_list.trp_list_length); for (int i = 0; i < a->trp_list.trp_list_length; i++) { - _F1_EQ_CHECK_INT(a->trp_list.trp_list_item[i].trp_id, b->trp_list.trp_list_item[i].trp_id); + _EQ_CHECK_INT(a->trp_list.trp_list_item[i].trp_id, b->trp_list.trp_list_item[i].trp_id); } } const f1ap_trp_information_type_list_t *trp_information_type_list_a = &a->trp_information_type_list; const f1ap_trp_information_type_list_t *trp_information_type_list_b = &b->trp_information_type_list; - _F1_EQ_CHECK_INT(trp_information_type_list_a->trp_information_type_list_length, - trp_information_type_list_b->trp_information_type_list_length); + _EQ_CHECK_INT(trp_information_type_list_a->trp_information_type_list_length, + trp_information_type_list_b->trp_information_type_list_length); for (int i = 0; i < trp_information_type_list_a->trp_information_type_list_length; i++) { - _F1_EQ_CHECK_INT(trp_information_type_list_a->trp_information_type_item[i], - trp_information_type_list_b->trp_information_type_item[i]); + _EQ_CHECK_INT(trp_information_type_list_a->trp_information_type_item[i], + trp_information_type_list_b->trp_information_type_item[i]); } return true; @@ -4840,11 +4838,11 @@ bool decode_trp_information_resp(const F1AP_F1AP_PDU_t *pdu, f1ap_trp_informatio AssertError(ie != NULL, return false, "in->protocolIEs.list.array[i] is NULL"); switch (ie->id) { case F1AP_ProtocolIE_ID_id_TransactionID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_TRPInformationResponseIEs__value_PR_TransactionID); + _EQ_CHECK_INT(ie->value.present, F1AP_TRPInformationResponseIEs__value_PR_TransactionID); out->transaction_id = ie->value.choice.TransactionID; break; case F1AP_ProtocolIE_ID_id_TRPInformationListTRPResp: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_TRPInformationResponseIEs__value_PR_TRPInformationListTRPResp); + _EQ_CHECK_INT(ie->value.present, F1AP_TRPInformationResponseIEs__value_PR_TRPInformationListTRPResp); uint32_t trp_info_item_length = ie->value.choice.TRPInformationListTRPResp.list.count; AssertError(trp_info_item_length > 0, return false, "at least 1 TRP Information Item must be present"); out->trp_information_list.trp_information_item_length = trp_info_item_length; @@ -4853,8 +4851,8 @@ bool decode_trp_information_resp(const F1AP_F1AP_PDU_t *pdu, f1ap_trp_informatio for (int i = 0; i < trp_info_item_length; i++) { F1AP_TRPInformationItemTRPResp_t *f1_trpinfolist = (F1AP_TRPInformationItemTRPResp_t *)ie->value.choice.TRPInformationListTRPResp.list.array[i]; - _F1_EQ_CHECK_LONG(f1_trpinfolist->id, F1AP_ProtocolIE_ID_id_TRPInformationItem); - _F1_EQ_CHECK_INT(f1_trpinfolist->value.present, F1AP_TRPInformationItemTRPResp__value_PR_TRPInformationItem); + _EQ_CHECK_LONG(f1_trpinfolist->id, F1AP_ProtocolIE_ID_id_TRPInformationItem); + _EQ_CHECK_INT(f1_trpinfolist->value.present, F1AP_TRPInformationItemTRPResp__value_PR_TRPInformationItem); F1AP_TRPInformationItem_t *f1_trp_info_item = &f1_trpinfolist->value.choice.TRPInformationItem; F1AP_TRPInformation_t *f1_trp_info = &f1_trp_info_item->tRPInformation; trp_info_item[i].trp_id = f1_trp_info->tRPID; @@ -4936,9 +4934,9 @@ f1ap_trp_information_resp_t cp_trp_information_resp(const f1ap_trp_information_r */ bool eq_trp_information_resp(const f1ap_trp_information_resp_t *a, const f1ap_trp_information_resp_t *b) { - _F1_EQ_CHECK_INT(a->transaction_id, b->transaction_id); + _EQ_CHECK_INT(a->transaction_id, b->transaction_id); - _F1_EQ_CHECK_INT(a->trp_information_list.trp_information_item_length, b->trp_information_list.trp_information_item_length); + _EQ_CHECK_INT(a->trp_information_list.trp_information_item_length, b->trp_information_list.trp_information_item_length); uint32_t trp_info_item_length = a->trp_information_list.trp_information_item_length; AssertError(trp_info_item_length > 0, return false, "at least 1 TRP Information Item must be present\n"); @@ -4950,11 +4948,11 @@ bool eq_trp_information_resp(const f1ap_trp_information_resp_t *a, const f1ap_tr &trp_information_item_a[i].trp_information_type_response_list; f1ap_trp_information_type_response_list_t *trp_info_type_resp_list_b = &trp_information_item_b[i].trp_information_type_response_list; - _F1_EQ_CHECK_INT(trp_info_type_resp_list_a->trp_information_type_response_item_length, - trp_info_type_resp_list_b->trp_information_type_response_item_length); + _EQ_CHECK_INT(trp_info_type_resp_list_a->trp_information_type_response_item_length, + trp_info_type_resp_list_b->trp_information_type_response_item_length); uint8_t trp_info_type_resp_item_len = trp_info_type_resp_list_a->trp_information_type_response_item_length; AssertError(trp_info_type_resp_item_len > 0, return false, "at least 1 TRP Information type response Item must be present\n"); - _F1_EQ_CHECK_INT(trp_information_item_a[i].trp_id, trp_information_item_b[i].trp_id); + _EQ_CHECK_INT(trp_information_item_a[i].trp_id, trp_information_item_b[i].trp_id); for (int j = 0; j < trp_info_type_resp_item_len; j++) { _F1_CHECK_EXP(eq_trp_info_type_response_item(&trp_info_type_resp_list_a->trp_information_type_response_item[j], &trp_info_type_resp_list_b->trp_information_type_response_item[j])); @@ -5030,11 +5028,11 @@ bool decode_trp_information_failure(const F1AP_F1AP_PDU_t *pdu, f1ap_trp_informa AssertError(ie != NULL, return false, "in->protocolIEs.list.array[i] is NULL"); switch (ie->id) { case F1AP_ProtocolIE_ID_id_TransactionID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_TRPInformationFailureIEs__value_PR_TransactionID); + _EQ_CHECK_INT(ie->value.present, F1AP_TRPInformationFailureIEs__value_PR_TransactionID); out->transaction_id = ie->value.choice.TransactionID; break; case F1AP_ProtocolIE_ID_id_Cause: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_TRPInformationFailureIEs__value_PR_Cause); + _EQ_CHECK_INT(ie->value.present, F1AP_TRPInformationFailureIEs__value_PR_Cause); _F1_CHECK_EXP(decode_f1ap_cause(ie->value.choice.Cause, &out->cause, &out->cause_value)); break; case F1AP_ProtocolIE_ID_id_CriticalityDiagnostics: @@ -5069,9 +5067,9 @@ f1ap_trp_information_failure_t cp_trp_information_failure(const f1ap_trp_informa */ bool eq_trp_information_failure(const f1ap_trp_information_failure_t *a, const f1ap_trp_information_failure_t *b) { - _F1_EQ_CHECK_INT(a->transaction_id, b->transaction_id); - _F1_EQ_CHECK_INT(a->cause, b->cause); - _F1_EQ_CHECK_LONG(a->cause_value, b->cause_value); + _EQ_CHECK_INT(a->transaction_id, b->transaction_id); + _EQ_CHECK_INT(a->cause, b->cause); + _EQ_CHECK_LONG(a->cause_value, b->cause_value); return true; } @@ -5231,19 +5229,19 @@ bool decode_positioning_measurement_req(const F1AP_F1AP_PDU_t *pdu, f1ap_positio AssertError(ie != NULL, return false, "in->protocolIEs.list.array[i] is NULL"); switch (ie->id) { case F1AP_ProtocolIE_ID_id_TransactionID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementRequestIEs__value_PR_TransactionID); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementRequestIEs__value_PR_TransactionID); out->transaction_id = ie->value.choice.TransactionID; break; case F1AP_ProtocolIE_ID_id_LMF_MeasurementID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementRequestIEs__value_PR_LMF_MeasurementID); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementRequestIEs__value_PR_LMF_MeasurementID); out->lmf_measurement_id = ie->value.choice.LMF_MeasurementID; break; case F1AP_ProtocolIE_ID_id_RAN_MeasurementID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementRequestIEs__value_PR_RAN_MeasurementID); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementRequestIEs__value_PR_RAN_MeasurementID); out->ran_measurement_id = ie->value.choice.RAN_MeasurementID; break; case F1AP_ProtocolIE_ID_id_TRP_MeasurementRequestList: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementRequestIEs__value_PR_TRP_MeasurementRequestList); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementRequestIEs__value_PR_TRP_MeasurementRequestList); F1AP_TRP_MeasurementRequestList_t *f1_trp_meas_req_list = &ie->value.choice.TRP_MeasurementRequestList; f1ap_trp_measurement_request_list_t *trp_meas_req_list = &out->trp_measurement_request_list; uint32_t trp_meas_req_list_len = f1_trp_meas_req_list->list.count; @@ -5256,15 +5254,15 @@ bool decode_positioning_measurement_req(const F1AP_F1AP_PDU_t *pdu, f1ap_positio } break; case F1AP_ProtocolIE_ID_id_PosReportCharacteristics: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementRequestIEs__value_PR_PosReportCharacteristics); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementRequestIEs__value_PR_PosReportCharacteristics); out->pos_report_characteristics = ie->value.choice.PosReportCharacteristics; break; case F1AP_ProtocolIE_ID_id_PosMeasurementPeriodicity: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementRequestIEs__value_PR_MeasurementPeriodicity); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementRequestIEs__value_PR_MeasurementPeriodicity); out->measurement_periodicity = ie->value.choice.MeasurementPeriodicity; break; case F1AP_ProtocolIE_ID_id_PosMeasurementQuantities: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementRequestIEs__value_PR_PosMeasurementQuantities); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementRequestIEs__value_PR_PosMeasurementQuantities); F1AP_PosMeasurementQuantities_t *f1_pos_meas_quantities = &ie->value.choice.PosMeasurementQuantities; f1ap_pos_measurement_quantities_t *pos_meas_quantities = &out->pos_measurement_quantities; uint32_t pos_meas_quantities_len = f1_pos_meas_quantities->list.count; @@ -5283,7 +5281,7 @@ bool decode_positioning_measurement_req(const F1AP_F1AP_PDU_t *pdu, f1ap_positio PRINT_ERROR("F1AP_ProtocolIE_ID_id %ld not supported, skipping\n", ie->id); break; case F1AP_ProtocolIE_ID_id_SRSConfiguration: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementRequestIEs__value_PR_SRSConfiguration); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementRequestIEs__value_PR_SRSConfiguration); F1AP_SRSCarrier_List_t *f1_sRSCarrier_List = &ie->value.choice.SRSConfiguration.sRSCarrier_List; out->srs_configuration = calloc_or_fail(1, sizeof(*out->srs_configuration)); f1ap_srs_carrier_list_t *srs_carrier_list = &out->srs_configuration->srs_carrier_list; @@ -5363,34 +5361,34 @@ f1ap_positioning_measurement_req_t cp_positioning_measurement_req(const f1ap_pos */ bool eq_positioning_measurement_req(const f1ap_positioning_measurement_req_t *a, const f1ap_positioning_measurement_req_t *b) { - _F1_EQ_CHECK_INT(a->transaction_id, b->transaction_id); - _F1_EQ_CHECK_INT(a->lmf_measurement_id, b->lmf_measurement_id); - _F1_EQ_CHECK_INT(a->ran_measurement_id, b->ran_measurement_id); + _EQ_CHECK_INT(a->transaction_id, b->transaction_id); + _EQ_CHECK_INT(a->lmf_measurement_id, b->lmf_measurement_id); + _EQ_CHECK_INT(a->ran_measurement_id, b->ran_measurement_id); const f1ap_trp_measurement_request_list_t *trp_meas_req_list_a = &a->trp_measurement_request_list; const f1ap_trp_measurement_request_list_t *trp_meas_req_list_b = &b->trp_measurement_request_list; uint32_t trp_meas_req_list_len = trp_meas_req_list_a->trp_measurement_request_list_length; AssertFatal(trp_meas_req_list_len > 0, "at least 1 TRP must be present"); - _F1_EQ_CHECK_INT(trp_meas_req_list_b->trp_measurement_request_list_length, trp_meas_req_list_len); + _EQ_CHECK_INT(trp_meas_req_list_b->trp_measurement_request_list_length, trp_meas_req_list_len); for (int i = 0; i < trp_meas_req_list_len; i++) { - _F1_EQ_CHECK_INT(trp_meas_req_list_a->trp_measurement_request_item[i].tRPID, - trp_meas_req_list_b->trp_measurement_request_item[i].tRPID); + _EQ_CHECK_INT(trp_meas_req_list_a->trp_measurement_request_item[i].tRPID, + trp_meas_req_list_b->trp_measurement_request_item[i].tRPID); } - _F1_EQ_CHECK_INT(a->pos_report_characteristics, b->pos_report_characteristics); + _EQ_CHECK_INT(a->pos_report_characteristics, b->pos_report_characteristics); if (a->pos_report_characteristics == F1AP_POSREPORTCHARACTERISTICS_PERIODIC) { - _F1_EQ_CHECK_INT(a->measurement_periodicity, b->measurement_periodicity); + _EQ_CHECK_INT(a->measurement_periodicity, b->measurement_periodicity); } const f1ap_pos_measurement_quantities_t *pos_meas_quantities_a = &a->pos_measurement_quantities; const f1ap_pos_measurement_quantities_t *pos_meas_quantities_b = &b->pos_measurement_quantities; uint32_t pos_meas_quantities_len = pos_meas_quantities_a->pos_measurement_quantities_length; AssertFatal(pos_meas_quantities_len > 0, "at least 1 position measurement must be present"); - _F1_EQ_CHECK_INT(pos_meas_quantities_b->pos_measurement_quantities_length, pos_meas_quantities_len); + _EQ_CHECK_INT(pos_meas_quantities_b->pos_measurement_quantities_length, pos_meas_quantities_len); for (int i = 0; i < pos_meas_quantities_len; i++) { f1ap_pos_measurement_quantities_item_t *a_pos_meas_quantities_item = &pos_meas_quantities_a->pos_measurement_quantities_item[i]; f1ap_pos_measurement_quantities_item_t *b_pos_meas_quantities_item = &pos_meas_quantities_b->pos_measurement_quantities_item[i]; - _F1_EQ_CHECK_INT(a_pos_meas_quantities_item->pos_measurement_type, b_pos_meas_quantities_item->pos_measurement_type); + _EQ_CHECK_INT(a_pos_meas_quantities_item->pos_measurement_type, b_pos_meas_quantities_item->pos_measurement_type); } /* optional: SRS Configuration */ @@ -5512,19 +5510,19 @@ bool decode_positioning_measurement_resp(const F1AP_F1AP_PDU_t *pdu, f1ap_positi AssertError(ie != NULL, return false, "in->protocolIEs.list.array[i] is NULL"); switch (ie->id) { case F1AP_ProtocolIE_ID_id_TransactionID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementResponseIEs__value_PR_TransactionID); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementResponseIEs__value_PR_TransactionID); out->transaction_id = ie->value.choice.TransactionID; break; case F1AP_ProtocolIE_ID_id_LMF_MeasurementID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementResponseIEs__value_PR_LMF_MeasurementID); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementResponseIEs__value_PR_LMF_MeasurementID); out->lmf_measurement_id = ie->value.choice.LMF_MeasurementID; break; case F1AP_ProtocolIE_ID_id_RAN_MeasurementID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementResponseIEs__value_PR_RAN_MeasurementID); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementResponseIEs__value_PR_RAN_MeasurementID); out->ran_measurement_id = ie->value.choice.RAN_MeasurementID; break; case F1AP_ProtocolIE_ID_id_PosMeasurementResultList: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementResponseIEs__value_PR_PosMeasurementResultList); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementResponseIEs__value_PR_PosMeasurementResultList); F1AP_PosMeasurementResultList_t *in_list = &ie->value.choice.PosMeasurementResultList; uint32_t pos_meas_result_list_len = in_list->list.count; out->pos_measurement_result_list = calloc_or_fail(1, sizeof(*out->pos_measurement_result_list)); @@ -5587,9 +5585,9 @@ f1ap_positioning_measurement_resp_t cp_positioning_measurement_resp(const f1ap_p */ bool eq_positioning_measurement_resp(const f1ap_positioning_measurement_resp_t *a, const f1ap_positioning_measurement_resp_t *b) { - _F1_EQ_CHECK_INT(a->transaction_id, b->transaction_id); - _F1_EQ_CHECK_INT(a->lmf_measurement_id, b->lmf_measurement_id); - _F1_EQ_CHECK_INT(a->ran_measurement_id, b->ran_measurement_id); + _EQ_CHECK_INT(a->transaction_id, b->transaction_id); + _EQ_CHECK_INT(a->lmf_measurement_id, b->lmf_measurement_id); + _EQ_CHECK_INT(a->ran_measurement_id, b->ran_measurement_id); if ((a->pos_measurement_result_list == NULL) != (b->pos_measurement_result_list == NULL)) { return false; @@ -5598,12 +5596,12 @@ bool eq_positioning_measurement_resp(const f1ap_positioning_measurement_resp_t * f1ap_pos_measurement_result_list_t *list_a = a->pos_measurement_result_list; f1ap_pos_measurement_result_list_t *list_b = b->pos_measurement_result_list; uint32_t pos_meas_result_list_len = list_a->pos_measurement_result_list_length; - _F1_EQ_CHECK_INT(list_b->pos_measurement_result_list_length, pos_meas_result_list_len); + _EQ_CHECK_INT(list_b->pos_measurement_result_list_length, pos_meas_result_list_len); for (int i = 0; i < pos_meas_result_list_len; i++) { f1ap_pos_measurement_result_list_item_t *item_a = &list_a->pos_measurement_result_list_item[i]; f1ap_pos_measurement_result_list_item_t *item_b = &list_b->pos_measurement_result_list_item[i]; _F1_CHECK_EXP(eq_positioning_measurement_result(&item_a->pos_measurement_result, &item_b->pos_measurement_result)); - _F1_EQ_CHECK_INT(item_a->trp_id, item_b->trp_id); + _EQ_CHECK_INT(item_a->trp_id, item_b->trp_id); } } @@ -5715,19 +5713,19 @@ bool decode_positioning_measurement_failure(const F1AP_F1AP_PDU_t *pdu, f1ap_pos AssertError(ie != NULL, return false, "in->protocolIEs.list.array[i] is NULL"); switch (ie->id) { case F1AP_ProtocolIE_ID_id_TransactionID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementFailureIEs__value_PR_TransactionID); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementFailureIEs__value_PR_TransactionID); out->transaction_id = ie->value.choice.TransactionID; break; case F1AP_ProtocolIE_ID_id_LMF_MeasurementID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementFailureIEs__value_PR_LMF_MeasurementID); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementFailureIEs__value_PR_LMF_MeasurementID); out->lmf_measurement_id = ie->value.choice.LMF_MeasurementID; break; case F1AP_ProtocolIE_ID_id_RAN_MeasurementID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementFailureIEs__value_PR_RAN_MeasurementID); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementFailureIEs__value_PR_RAN_MeasurementID); out->ran_measurement_id = ie->value.choice.RAN_MeasurementID; break; case F1AP_ProtocolIE_ID_id_Cause: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementFailureIEs__value_PR_Cause); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementFailureIEs__value_PR_Cause); _F1_CHECK_EXP(decode_f1ap_cause(ie->value.choice.Cause, &out->cause, &out->cause_value)); break; case F1AP_ProtocolIE_ID_id_CriticalityDiagnostics: @@ -5765,11 +5763,11 @@ f1ap_positioning_measurement_failure_t cp_positioning_measurement_failure(const bool eq_positioning_measurement_failure(const f1ap_positioning_measurement_failure_t *a, const f1ap_positioning_measurement_failure_t *b) { - _F1_EQ_CHECK_INT(a->transaction_id, b->transaction_id); - _F1_EQ_CHECK_INT(a->lmf_measurement_id, b->lmf_measurement_id); - _F1_EQ_CHECK_INT(a->ran_measurement_id, b->ran_measurement_id); - _F1_EQ_CHECK_INT(a->cause, b->cause); - _F1_EQ_CHECK_LONG(a->cause_value, b->cause_value); + _EQ_CHECK_INT(a->transaction_id, b->transaction_id); + _EQ_CHECK_INT(a->lmf_measurement_id, b->lmf_measurement_id); + _EQ_CHECK_INT(a->ran_measurement_id, b->ran_measurement_id); + _EQ_CHECK_INT(a->cause, b->cause); + _EQ_CHECK_LONG(a->cause_value, b->cause_value); return true; } @@ -5872,19 +5870,19 @@ bool decode_positioning_measurement_report(const F1AP_F1AP_PDU_t *pdu, f1ap_posi AssertError(ie != NULL, return false, "in->protocolIEs.list.array[i] is NULL"); switch (ie->id) { case F1AP_ProtocolIE_ID_id_TransactionID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementReportIEs__value_PR_TransactionID); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementReportIEs__value_PR_TransactionID); out->transaction_id = ie->value.choice.TransactionID; break; case F1AP_ProtocolIE_ID_id_LMF_MeasurementID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementReportIEs__value_PR_LMF_MeasurementID); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementReportIEs__value_PR_LMF_MeasurementID); out->lmf_measurement_id = ie->value.choice.LMF_MeasurementID; break; case F1AP_ProtocolIE_ID_id_RAN_MeasurementID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementReportIEs__value_PR_RAN_MeasurementID); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementReportIEs__value_PR_RAN_MeasurementID); out->ran_measurement_id = ie->value.choice.RAN_MeasurementID; break; case F1AP_ProtocolIE_ID_id_PosMeasurementResultList: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementReportIEs__value_PR_PosMeasurementResultList); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementReportIEs__value_PR_PosMeasurementResultList); F1AP_PosMeasurementResultList_t *f1_PosMeasurementResultList = &ie->value.choice.PosMeasurementResultList; uint32_t pos_meas_result_list_len = f1_PosMeasurementResultList->list.count; out->pos_measurement_result_list = calloc_or_fail(1, sizeof(*out->pos_measurement_result_list)); @@ -5945,19 +5943,19 @@ f1ap_positioning_measurement_report_t cp_positioning_measurement_report(const f1 bool eq_positioning_measurement_report(const f1ap_positioning_measurement_report_t *a, const f1ap_positioning_measurement_report_t *b) { - _F1_EQ_CHECK_INT(a->transaction_id, b->transaction_id); - _F1_EQ_CHECK_INT(a->lmf_measurement_id, b->lmf_measurement_id); - _F1_EQ_CHECK_INT(a->ran_measurement_id, b->ran_measurement_id); + _EQ_CHECK_INT(a->transaction_id, b->transaction_id); + _EQ_CHECK_INT(a->lmf_measurement_id, b->lmf_measurement_id); + _EQ_CHECK_INT(a->ran_measurement_id, b->ran_measurement_id); f1ap_pos_measurement_result_list_t *list_a = a->pos_measurement_result_list; f1ap_pos_measurement_result_list_t *list_b = b->pos_measurement_result_list; uint32_t pos_meas_result_list_len = list_a->pos_measurement_result_list_length; - _F1_EQ_CHECK_INT(list_b->pos_measurement_result_list_length, pos_meas_result_list_len); + _EQ_CHECK_INT(list_b->pos_measurement_result_list_length, pos_meas_result_list_len); for (int i = 0; i < pos_meas_result_list_len; i++) { f1ap_pos_measurement_result_list_item_t *item_a = &list_a->pos_measurement_result_list_item[i]; f1ap_pos_measurement_result_list_item_t *item_b = &list_b->pos_measurement_result_list_item[i]; _F1_CHECK_EXP(eq_positioning_measurement_result(&item_a->pos_measurement_result, &item_b->pos_measurement_result)); - _F1_EQ_CHECK_INT(item_a->trp_id, item_b->trp_id); + _EQ_CHECK_INT(item_a->trp_id, item_b->trp_id); } return true; @@ -6050,15 +6048,15 @@ bool decode_positioning_measurement_abort(const F1AP_F1AP_PDU_t *pdu, f1ap_posit AssertError(ie != NULL, return false, "in->protocolIEs.list.array[i] is NULL"); switch (ie->id) { case F1AP_ProtocolIE_ID_id_TransactionID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementAbortIEs__value_PR_TransactionID); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementAbortIEs__value_PR_TransactionID); out->transaction_id = ie->value.choice.TransactionID; break; case F1AP_ProtocolIE_ID_id_LMF_MeasurementID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementAbortIEs__value_PR_LMF_MeasurementID); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementAbortIEs__value_PR_LMF_MeasurementID); out->lmf_measurement_id = ie->value.choice.LMF_MeasurementID; break; case F1AP_ProtocolIE_ID_id_RAN_MeasurementID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementAbortIEs__value_PR_RAN_MeasurementID); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementAbortIEs__value_PR_RAN_MeasurementID); out->ran_measurement_id = ie->value.choice.RAN_MeasurementID; break; default: @@ -6090,9 +6088,9 @@ f1ap_positioning_measurement_abort_t cp_positioning_measurement_abort(const f1ap */ bool eq_positioning_measurement_abort(const f1ap_positioning_measurement_abort_t *a, const f1ap_positioning_measurement_abort_t *b) { - _F1_EQ_CHECK_INT(a->transaction_id, b->transaction_id); - _F1_EQ_CHECK_INT(a->lmf_measurement_id, b->lmf_measurement_id); - _F1_EQ_CHECK_INT(a->ran_measurement_id, b->ran_measurement_id); + _EQ_CHECK_INT(a->transaction_id, b->transaction_id); + _EQ_CHECK_INT(a->lmf_measurement_id, b->lmf_measurement_id); + _EQ_CHECK_INT(a->ran_measurement_id, b->ran_measurement_id); return true; } @@ -6186,19 +6184,19 @@ bool decode_positioning_measurement_failure_indication(const F1AP_F1AP_PDU_t *pd AssertError(ie != NULL, return false, "in->protocolIEs.list.array[i] is NULL"); switch (ie->id) { case F1AP_ProtocolIE_ID_id_TransactionID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementFailureIndicationIEs__value_PR_TransactionID); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementFailureIndicationIEs__value_PR_TransactionID); out->transaction_id = ie->value.choice.TransactionID; break; case F1AP_ProtocolIE_ID_id_LMF_MeasurementID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementFailureIndicationIEs__value_PR_LMF_MeasurementID); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementFailureIndicationIEs__value_PR_LMF_MeasurementID); out->lmf_measurement_id = ie->value.choice.LMF_MeasurementID; break; case F1AP_ProtocolIE_ID_id_RAN_MeasurementID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementFailureIndicationIEs__value_PR_RAN_MeasurementID); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementFailureIndicationIEs__value_PR_RAN_MeasurementID); out->ran_measurement_id = ie->value.choice.RAN_MeasurementID; break; case F1AP_ProtocolIE_ID_id_Cause: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementFailureIndicationIEs__value_PR_Cause); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementFailureIndicationIEs__value_PR_Cause); _F1_CHECK_EXP(decode_f1ap_cause(ie->value.choice.Cause, &out->cause, &out->cause_value)); break; default: @@ -6234,11 +6232,11 @@ f1ap_positioning_measurement_failure_indication_t cp_positioning_measurement_fai bool eq_positioning_measurement_failure_indication(const f1ap_positioning_measurement_failure_indication_t *a, const f1ap_positioning_measurement_failure_indication_t *b) { - _F1_EQ_CHECK_INT(a->transaction_id, b->transaction_id); - _F1_EQ_CHECK_INT(a->lmf_measurement_id, b->lmf_measurement_id); - _F1_EQ_CHECK_INT(a->ran_measurement_id, b->ran_measurement_id); - _F1_EQ_CHECK_INT(a->cause, b->cause); - _F1_EQ_CHECK_LONG(a->cause_value, b->cause_value); + _EQ_CHECK_INT(a->transaction_id, b->transaction_id); + _EQ_CHECK_INT(a->lmf_measurement_id, b->lmf_measurement_id); + _EQ_CHECK_INT(a->ran_measurement_id, b->ran_measurement_id); + _EQ_CHECK_INT(a->cause, b->cause); + _EQ_CHECK_LONG(a->cause_value, b->cause_value); return true; } @@ -6333,19 +6331,19 @@ bool decode_positioning_measurement_update(const F1AP_F1AP_PDU_t *pdu, f1ap_posi AssertError(ie != NULL, return false, "in->protocolIEs.list.array[i] is NULL"); switch (ie->id) { case F1AP_ProtocolIE_ID_id_TransactionID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementUpdateIEs__value_PR_TransactionID); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementUpdateIEs__value_PR_TransactionID); out->transaction_id = ie->value.choice.TransactionID; break; case F1AP_ProtocolIE_ID_id_LMF_MeasurementID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementUpdateIEs__value_PR_LMF_MeasurementID); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementUpdateIEs__value_PR_LMF_MeasurementID); out->lmf_measurement_id = ie->value.choice.LMF_MeasurementID; break; case F1AP_ProtocolIE_ID_id_RAN_MeasurementID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementUpdateIEs__value_PR_RAN_MeasurementID); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementUpdateIEs__value_PR_RAN_MeasurementID); out->ran_measurement_id = ie->value.choice.RAN_MeasurementID; break; case F1AP_ProtocolIE_ID_id_SRSConfiguration: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementUpdateIEs__value_PR_SRSConfiguration); + _EQ_CHECK_INT(ie->value.present, F1AP_PositioningMeasurementUpdateIEs__value_PR_SRSConfiguration); F1AP_SRSCarrier_List_t *f1_sRSCarrier_List = &ie->value.choice.SRSConfiguration.sRSCarrier_List; out->srs_configuration = calloc_or_fail(1, sizeof(*out->srs_configuration)); f1ap_srs_carrier_list_t *srs_carrier_list = &out->srs_configuration->srs_carrier_list; @@ -6389,9 +6387,9 @@ f1ap_positioning_measurement_update_t cp_positioning_measurement_update(const f1 bool eq_positioning_measurement_update(const f1ap_positioning_measurement_update_t *a, const f1ap_positioning_measurement_update_t *b) { - _F1_EQ_CHECK_INT(a->transaction_id, b->transaction_id); - _F1_EQ_CHECK_INT(a->lmf_measurement_id, b->lmf_measurement_id); - _F1_EQ_CHECK_INT(a->ran_measurement_id, b->ran_measurement_id); + _EQ_CHECK_INT(a->transaction_id, b->transaction_id); + _EQ_CHECK_INT(a->lmf_measurement_id, b->lmf_measurement_id); + _EQ_CHECK_INT(a->ran_measurement_id, b->ran_measurement_id); /* optional: SRS Configuration */ if ((a->srs_configuration == NULL) != (b->srs_configuration == NULL)) { diff --git a/openair2/F1AP/lib/f1ap_rrc_message_transfer.c b/openair2/F1AP/lib/f1ap_rrc_message_transfer.c index e08f2b2977..4db9b50fc1 100644 --- a/openair2/F1AP/lib/f1ap_rrc_message_transfer.c +++ b/openair2/F1AP/lib/f1ap_rrc_message_transfer.c @@ -172,19 +172,19 @@ f1ap_initial_ul_rrc_message_t cp_initial_ul_rrc_message_transfer(const f1ap_init */ bool eq_initial_ul_rrc_message_transfer(const f1ap_initial_ul_rrc_message_t *a, const f1ap_initial_ul_rrc_message_t *b) { - _F1_EQ_CHECK_INT(a->gNB_DU_ue_id, b->gNB_DU_ue_id); + _EQ_CHECK_INT(a->gNB_DU_ue_id, b->gNB_DU_ue_id); if (!eq_f1ap_plmn(&a->plmn, &b->plmn)) return false; - _F1_EQ_CHECK_LONG(a->nr_cellid, b->nr_cellid); - _F1_EQ_CHECK_INT(a->crnti, b->crnti); - _F1_EQ_CHECK_INT(a->rrc_container_length, b->rrc_container_length); - _F1_EQ_CHECK_LONG(a->nr_cellid, b->nr_cellid); + _EQ_CHECK_LONG(a->nr_cellid, b->nr_cellid); + _EQ_CHECK_INT(a->crnti, b->crnti); + _EQ_CHECK_INT(a->rrc_container_length, b->rrc_container_length); + _EQ_CHECK_LONG(a->nr_cellid, b->nr_cellid); if (memcmp(a->rrc_container, b->rrc_container, a->rrc_container_length) != 0) return false; - _F1_EQ_CHECK_INT(a->du2cu_rrc_container_length, b->du2cu_rrc_container_length); + _EQ_CHECK_INT(a->du2cu_rrc_container_length, b->du2cu_rrc_container_length); if (memcmp(a->du2cu_rrc_container, b->du2cu_rrc_container, a->du2cu_rrc_container_length) != 0) return false; - _F1_EQ_CHECK_INT(a->transaction_id, b->transaction_id); + _EQ_CHECK_INT(a->transaction_id, b->transaction_id); return true; } @@ -300,10 +300,10 @@ f1ap_ul_rrc_message_t cp_ul_rrc_message_transfer(const f1ap_ul_rrc_message_t *ms */ bool eq_ul_rrc_message_transfer(const f1ap_ul_rrc_message_t *a, const f1ap_ul_rrc_message_t *b) { - _F1_EQ_CHECK_INT(a->gNB_DU_ue_id, b->gNB_DU_ue_id); - _F1_EQ_CHECK_INT(a->gNB_CU_ue_id, b->gNB_CU_ue_id); - _F1_EQ_CHECK_INT(a->rrc_container_length, b->rrc_container_length); - _F1_EQ_CHECK_INT(a->gNB_DU_ue_id, b->gNB_DU_ue_id); + _EQ_CHECK_INT(a->gNB_DU_ue_id, b->gNB_DU_ue_id); + _EQ_CHECK_INT(a->gNB_CU_ue_id, b->gNB_CU_ue_id); + _EQ_CHECK_INT(a->rrc_container_length, b->rrc_container_length); + _EQ_CHECK_INT(a->gNB_DU_ue_id, b->gNB_DU_ue_id); if (memcmp(a->rrc_container, b->rrc_container, a->rrc_container_length) != 0) return false; return true; @@ -456,16 +456,16 @@ f1ap_dl_rrc_message_t cp_dl_rrc_message_transfer(const f1ap_dl_rrc_message_t *ms */ bool eq_dl_rrc_message_transfer(const f1ap_dl_rrc_message_t *a, const f1ap_dl_rrc_message_t *b) { - _F1_EQ_CHECK_INT(a->gNB_DU_ue_id, b->gNB_DU_ue_id); - _F1_EQ_CHECK_INT(a->gNB_CU_ue_id, b->gNB_CU_ue_id); - _F1_EQ_CHECK_INT(a->gNB_DU_ue_id, b->gNB_DU_ue_id); - _F1_EQ_CHECK_INT(a->gNB_DU_ue_id, b->gNB_DU_ue_id); - _F1_EQ_CHECK_INT(a->gNB_DU_ue_id, b->gNB_DU_ue_id); + _EQ_CHECK_INT(a->gNB_DU_ue_id, b->gNB_DU_ue_id); + _EQ_CHECK_INT(a->gNB_CU_ue_id, b->gNB_CU_ue_id); + _EQ_CHECK_INT(a->gNB_DU_ue_id, b->gNB_DU_ue_id); + _EQ_CHECK_INT(a->gNB_DU_ue_id, b->gNB_DU_ue_id); + _EQ_CHECK_INT(a->gNB_DU_ue_id, b->gNB_DU_ue_id); if (!(a->old_gNB_DU_ue_id == NULL && b->old_gNB_DU_ue_id == NULL)) - _F1_EQ_CHECK_INT(*a->old_gNB_DU_ue_id, *b->old_gNB_DU_ue_id); - _F1_EQ_CHECK_INT(a->srb_id, b->srb_id); - _F1_EQ_CHECK_INT(a->execute_duplication, b->execute_duplication); - _F1_EQ_CHECK_INT(a->rrc_container_length, b->rrc_container_length); + _EQ_CHECK_INT(*a->old_gNB_DU_ue_id, *b->old_gNB_DU_ue_id); + _EQ_CHECK_INT(a->srb_id, b->srb_id); + _EQ_CHECK_INT(a->execute_duplication, b->execute_duplication); + _EQ_CHECK_INT(a->rrc_container_length, b->rrc_container_length); if (memcmp(a->rrc_container, b->rrc_container, a->rrc_container_length) != 0) return false; return true; diff --git a/openair2/F1AP/lib/f1ap_ue_context.c b/openair2/F1AP/lib/f1ap_ue_context.c index 728849d8e5..30f7939987 100644 --- a/openair2/F1AP/lib/f1ap_ue_context.c +++ b/openair2/F1AP/lib/f1ap_ue_context.c @@ -144,11 +144,11 @@ static bool eq_ba(const byte_array_t a, const byte_array_t b) static bool eq_cu_to_du_rrc_info(const f1ap_cu_to_du_rrc_info_t *a, const f1ap_cu_to_du_rrc_info_t *b) { - _F1_EQ_CHECK_OPTIONAL_IE(a, b, cg_configinfo, eq_ba); - _F1_EQ_CHECK_OPTIONAL_IE(a, b, ue_cap, eq_ba); - _F1_EQ_CHECK_OPTIONAL_IE(a, b, meas_config, eq_ba); - _F1_EQ_CHECK_OPTIONAL_IE(a, b, meas_timing_config, eq_ba); - _F1_EQ_CHECK_OPTIONAL_IE(a, b, ho_prep_info, eq_ba); + _EQ_CHECK_OPTIONAL_IE(a, b, cg_configinfo, eq_ba); + _EQ_CHECK_OPTIONAL_IE(a, b, ue_cap, eq_ba); + _EQ_CHECK_OPTIONAL_IE(a, b, meas_config, eq_ba); + _EQ_CHECK_OPTIONAL_IE(a, b, meas_timing_config, eq_ba); + _EQ_CHECK_OPTIONAL_IE(a, b, ho_prep_info, eq_ba); return true; } @@ -203,7 +203,7 @@ static f1ap_du_to_cu_rrc_info_t cp_du_to_cu_rrc_info(const f1ap_du_to_cu_rrc_inf static bool eq_du_to_cu_rrc_info(const f1ap_du_to_cu_rrc_info_t *a, const f1ap_du_to_cu_rrc_info_t *b) { _F1_CHECK_EXP(eq_byte_array(&a->cell_group_config, &b->cell_group_config)); - _F1_EQ_CHECK_OPTIONAL_IE(a, b, meas_gap_config, eq_ba); + _EQ_CHECK_OPTIONAL_IE(a, b, meas_gap_config, eq_ba); return true; } @@ -257,8 +257,8 @@ static bool decode_srbs_to_setup(const F1AP_SRBs_ToBeSetup_List_t *f1ap, int *n, f1ap_srb_to_setup_t *srbs = *out = calloc_or_fail(count, sizeof(*srbs)); for (int i = 0; i < count; ++i) { const F1AP_SRBs_ToBeSetup_ItemIEs_t *itie = (F1AP_SRBs_ToBeSetup_ItemIEs_t *)f1ap->list.array[i]; - _F1_EQ_CHECK_LONG(itie->id, F1AP_ProtocolIE_ID_id_SRBs_ToBeSetup_Item); - _F1_EQ_CHECK_INT(itie->value.present, F1AP_SRBs_ToBeSetup_ItemIEs__value_PR_SRBs_ToBeSetup_Item); + _EQ_CHECK_LONG(itie->id, F1AP_ProtocolIE_ID_id_SRBs_ToBeSetup_Item); + _EQ_CHECK_INT(itie->value.present, F1AP_SRBs_ToBeSetup_ItemIEs__value_PR_SRBs_ToBeSetup_Item); srbs[i].id = itie->value.choice.SRBs_ToBeSetup_Item.sRBID; } @@ -279,8 +279,8 @@ static bool decode_srbs_to_setupmod(const F1AP_SRBs_ToBeSetupMod_List_t *f1ap, i f1ap_srb_to_setup_t *srbs = *out = calloc_or_fail(count, sizeof(*srbs)); for (int i = 0; i < count; ++i) { const F1AP_SRBs_ToBeSetupMod_ItemIEs_t *itie = (F1AP_SRBs_ToBeSetupMod_ItemIEs_t *)f1ap->list.array[i]; - _F1_EQ_CHECK_LONG(itie->id, F1AP_ProtocolIE_ID_id_SRBs_ToBeSetupMod_Item); - _F1_EQ_CHECK_INT(itie->value.present, F1AP_SRBs_ToBeSetupMod_ItemIEs__value_PR_SRBs_ToBeSetupMod_Item); + _EQ_CHECK_LONG(itie->id, F1AP_ProtocolIE_ID_id_SRBs_ToBeSetupMod_Item); + _EQ_CHECK_INT(itie->value.present, F1AP_SRBs_ToBeSetupMod_ItemIEs__value_PR_SRBs_ToBeSetupMod_Item); srbs[i].id = itie->value.choice.SRBs_ToBeSetupMod_Item.sRBID; } @@ -297,7 +297,7 @@ static f1ap_srb_to_setup_t cp_srb_to_setup(const f1ap_srb_to_setup_t *orig) static bool eq_srb_to_setup(const f1ap_srb_to_setup_t *a, const f1ap_srb_to_setup_t *b) { - _F1_EQ_CHECK_INT(a->id, b->id); + _EQ_CHECK_INT(a->id, b->id); return true; } @@ -347,8 +347,8 @@ static bool decode_srbs_setup(const F1AP_SRBs_Setup_List_t *f1ap, int *n, f1ap_s f1ap_srb_setup_t *srbs = *out = calloc_or_fail(count, sizeof(*srbs)); for (int i = 0; i < count; ++i) { const F1AP_SRBs_Setup_ItemIEs_t *itie = (F1AP_SRBs_Setup_ItemIEs_t *)f1ap->list.array[i]; - _F1_EQ_CHECK_LONG(itie->id, F1AP_ProtocolIE_ID_id_SRBs_Setup_Item); - _F1_EQ_CHECK_INT(itie->value.present, F1AP_SRBs_Setup_ItemIEs__value_PR_SRBs_Setup_Item); + _EQ_CHECK_LONG(itie->id, F1AP_ProtocolIE_ID_id_SRBs_Setup_Item); + _EQ_CHECK_INT(itie->value.present, F1AP_SRBs_Setup_ItemIEs__value_PR_SRBs_Setup_Item); const F1AP_SRBs_Setup_Item_t *it = &itie->value.choice.SRBs_Setup_Item; srbs[i].id = it->sRBID; srbs[i].lcid = it->lCID; @@ -367,8 +367,8 @@ static bool decode_srbs_setupmod(const F1AP_SRBs_SetupMod_List_t *f1ap, int *n, f1ap_srb_setup_t *srbs = *out = calloc_or_fail(count, sizeof(*srbs)); for (int i = 0; i < count; ++i) { const F1AP_SRBs_SetupMod_ItemIEs_t *itie = (F1AP_SRBs_SetupMod_ItemIEs_t *)f1ap->list.array[i]; - _F1_EQ_CHECK_LONG(itie->id, F1AP_ProtocolIE_ID_id_SRBs_SetupMod_Item); - _F1_EQ_CHECK_INT(itie->value.present, F1AP_SRBs_SetupMod_ItemIEs__value_PR_SRBs_SetupMod_Item); + _EQ_CHECK_LONG(itie->id, F1AP_ProtocolIE_ID_id_SRBs_SetupMod_Item); + _EQ_CHECK_INT(itie->value.present, F1AP_SRBs_SetupMod_ItemIEs__value_PR_SRBs_SetupMod_Item); const F1AP_SRBs_SetupMod_Item_t *it = &itie->value.choice.SRBs_SetupMod_Item; srbs[i].id = it->sRBID; srbs[i].lcid = it->lCID; @@ -384,8 +384,8 @@ static f1ap_srb_setup_t cp_srb_setup(const f1ap_srb_setup_t *orig) static bool eq_srb_setup(const f1ap_srb_setup_t *a, const f1ap_srb_setup_t *b) { - _F1_EQ_CHECK_INT(a->id, b->id); - _F1_EQ_CHECK_INT(a->lcid, b->lcid); + _EQ_CHECK_INT(a->id, b->id); + _EQ_CHECK_INT(a->lcid, b->lcid); return true; } @@ -437,7 +437,7 @@ static bool decode_qos_flow_param(const F1AP_QoSFlowLevelQoSParameters_t *f1ap, const F1AP_NonDynamic5QIDescriptor_t *nondyn = f1ap->qoS_Characteristics.choice.non_Dynamic_5QI; out->nondyn.fiveQI = nondyn->fiveQI; } else { - _F1_EQ_CHECK_INT(f1ap->qoS_Characteristics.present, F1AP_QoS_Characteristics_PR_dynamic_5QI); + _EQ_CHECK_INT(f1ap->qoS_Characteristics.present, F1AP_QoS_Characteristics_PR_dynamic_5QI); const F1AP_Dynamic5QIDescriptor_t *d = f1ap->qoS_Characteristics.choice.dynamic_5QI; out->qos_type = DYNAMIC; out->dyn.prio = d->qoSPriorityLevel; @@ -488,23 +488,23 @@ static f1ap_qos_flow_param_t cp_qos_flow_param(const f1ap_qos_flow_param_t *orig static bool eq_qos_flow_param(const f1ap_qos_flow_param_t *a, const f1ap_qos_flow_param_t *b) { - _F1_EQ_CHECK_INT(a->qos_type, b->qos_type); + _EQ_CHECK_INT(a->qos_type, b->qos_type); if (a->qos_type == NON_DYNAMIC) { - _F1_EQ_CHECK_INT(a->nondyn.fiveQI, b->nondyn.fiveQI); + _EQ_CHECK_INT(a->nondyn.fiveQI, b->nondyn.fiveQI); } else { DevAssert(a->qos_type == DYNAMIC); DevAssert(b->qos_type == DYNAMIC); const f1ap_dynamic_5qi_t *adyn = &a->dyn, *bdyn = &b->dyn; - _F1_EQ_CHECK_INT(adyn->prio, bdyn->prio); - _F1_EQ_CHECK_INT(adyn->pdb, bdyn->pdb); - _F1_EQ_CHECK_INT(adyn->per.scalar, bdyn->per.scalar); - _F1_EQ_CHECK_INT(adyn->per.exponent, bdyn->per.exponent); - _F1_EQ_CHECK_OPTIONAL_IE(adyn, bdyn, delay_critical, _F1_EQ_CHECK_INT); - _F1_EQ_CHECK_OPTIONAL_IE(adyn, bdyn, avg_win, _F1_EQ_CHECK_INT); + _EQ_CHECK_INT(adyn->prio, bdyn->prio); + _EQ_CHECK_INT(adyn->pdb, bdyn->pdb); + _EQ_CHECK_INT(adyn->per.scalar, bdyn->per.scalar); + _EQ_CHECK_INT(adyn->per.exponent, bdyn->per.exponent); + _EQ_CHECK_OPTIONAL_IE(adyn, bdyn, delay_critical, _EQ_CHECK_INT); + _EQ_CHECK_OPTIONAL_IE(adyn, bdyn, avg_win, _EQ_CHECK_INT); } - _F1_EQ_CHECK_INT(a->arp.prio, b->arp.prio); - _F1_EQ_CHECK_INT(a->arp.preempt_cap, b->arp.preempt_cap); - _F1_EQ_CHECK_INT(a->arp.preempt_vuln, b->arp.preempt_vuln); + _EQ_CHECK_INT(a->arp.prio, b->arp.prio); + _EQ_CHECK_INT(a->arp.preempt_cap, b->arp.preempt_cap); + _EQ_CHECK_INT(a->arp.preempt_vuln, b->arp.preempt_vuln); return true; } @@ -569,11 +569,11 @@ static f1ap_drb_info_nr_t cp_drb_info_nr(const f1ap_drb_info_nr_t *orig) static bool eq_drb_info_nr(const f1ap_drb_info_nr_t *a, const f1ap_drb_info_nr_t *b) { _F1_CHECK_EXP(eq_qos_flow_param(&a->drb_qos, &b->drb_qos)); - _F1_EQ_CHECK_INT(a->nssai.sst, b->nssai.sst); - _F1_EQ_CHECK_INT(a->nssai.sd, b->nssai.sd); - _F1_EQ_CHECK_INT(a->flows_len, b->flows_len); + _EQ_CHECK_INT(a->nssai.sst, b->nssai.sst); + _EQ_CHECK_INT(a->nssai.sd, b->nssai.sd); + _EQ_CHECK_INT(a->flows_len, b->flows_len); for (int i = 0; i < a->flows_len; ++i) { - _F1_EQ_CHECK_INT(a->flows[i].qfi, b->flows[i].qfi); + _EQ_CHECK_INT(a->flows[i].qfi, b->flows[i].qfi); _F1_CHECK_EXP(eq_qos_flow_param(&a->flows[i].param, &b->flows[i].param)); } return true; @@ -629,7 +629,7 @@ static F1AP_UPTransportLayerInformation_t encode_up_tnl(const f1ap_up_tnl_t *tnl static bool decode_up_tnl(const F1AP_UPTransportLayerInformation_t *tnl_info, f1ap_up_tnl_t *out) { - _F1_EQ_CHECK_INT(tnl_info->present, F1AP_UPTransportLayerInformation_PR_gTPTunnel); + _EQ_CHECK_INT(tnl_info->present, F1AP_UPTransportLayerInformation_PR_gTPTunnel); const F1AP_GTPTunnel_t *gtp_tnl = tnl_info->choice.gTPTunnel; BIT_STRING_TO_TRANSPORT_LAYER_ADDRESS_IPv4(>p_tnl->transportLayerAddress, out->tl_address); OCTET_STRING_TO_UINT32(>p_tnl->gTP_TEID, out->teid); @@ -649,7 +649,7 @@ static bool eq_up_tnl(const f1ap_up_tnl_t *a, const f1ap_up_tnl_t *b) PRINT_ERROR("tl_address mismatch\n"); return false; } - _F1_EQ_CHECK_INT(a->teid, b->teid); + _EQ_CHECK_INT(a->teid, b->teid); return true; } @@ -780,22 +780,22 @@ static bool decode_drbs_to_setup(const F1AP_DRBs_ToBeSetup_List_t *f1ap, int *n, f1ap_drb_to_setup_t *drbs = *out = calloc_or_fail(count, sizeof(*drbs)); for (int i = 0; i < count; ++i) { const F1AP_DRBs_ToBeSetup_ItemIEs_t *itie = (const F1AP_DRBs_ToBeSetup_ItemIEs_t *)f1ap->list.array[i]; - _F1_EQ_CHECK_LONG(itie->id, F1AP_ProtocolIE_ID_id_DRBs_ToBeSetup_Item); - _F1_EQ_CHECK_INT(itie->value.present, F1AP_DRBs_ToBeSetup_ItemIEs__value_PR_DRBs_ToBeSetup_Item); + _EQ_CHECK_LONG(itie->id, F1AP_ProtocolIE_ID_id_DRBs_ToBeSetup_Item); + _EQ_CHECK_INT(itie->value.present, F1AP_DRBs_ToBeSetup_ItemIEs__value_PR_DRBs_ToBeSetup_Item); const F1AP_DRBs_ToBeSetup_Item_t *it = &itie->value.choice.DRBs_ToBeSetup_Item; f1ap_drb_to_setup_t *drb = &drbs[i]; drb->id = it->dRBID; - _F1_EQ_CHECK_INT(it->qoSInformation.present, F1AP_QoSInformation_PR_choice_extension); + _EQ_CHECK_INT(it->qoSInformation.present, F1AP_QoSInformation_PR_choice_extension); const F1AP_QoSInformation_ExtIEs_t *qos_ext = (F1AP_QoSInformation_ExtIEs_t *)it->qoSInformation.choice.choice_extension; - _F1_EQ_CHECK_LONG(qos_ext->id, F1AP_ProtocolIE_ID_id_DRB_Information); - _F1_EQ_CHECK_INT(qos_ext->value.present, F1AP_QoSInformation_ExtIEs__value_PR_DRB_Information); + _EQ_CHECK_LONG(qos_ext->id, F1AP_ProtocolIE_ID_id_DRB_Information); + _EQ_CHECK_INT(qos_ext->value.present, F1AP_QoSInformation_ExtIEs__value_PR_DRB_Information); drb->qos_choice = F1AP_QOS_CHOICE_NR; _F1_CHECK_EXP(decode_drb_info_nr(&qos_ext->value.choice.DRB_Information, &drb->nr)); drb->up_ul_tnl_len = it->uLUPTNLInformation_ToBeSetup_List.list.count; - _F1_EQ_CHECK_GENERIC(drb->up_ul_tnl_len > 0 && drb->up_ul_tnl_len <= 2, "%d", drb->up_ul_tnl_len, 1); + EQ_CHECK_GENERIC(drb->up_ul_tnl_len > 0 && drb->up_ul_tnl_len <= 2, "%d", drb->up_ul_tnl_len, 1); for (int j = 0; j < drb->up_ul_tnl_len; ++j) { const F1AP_ULUPTNLInformation_ToBeSetup_Item_t *it_tnl = it->uLUPTNLInformation_ToBeSetup_List.list.array[j]; _F1_CHECK_EXP(decode_up_tnl(&it_tnl->uLUPTNLInformation, &drb->up_ul_tnl[j])); @@ -813,11 +813,11 @@ static bool decode_drbs_to_setup(const F1AP_DRBs_ToBeSetup_List_t *f1ap, int *n, AssertError(ie != NULL, return false, "ext->list.array[j] is NULL"); switch (ie->id) { case F1AP_ProtocolIE_ID_id_DLPDCPSNLength: - _F1_EQ_CHECK_INT(ie->extensionValue.present, F1AP_DRBs_ToBeSetup_ItemExtIEs__extensionValue_PR_PDCPSNLength); + _EQ_CHECK_INT(ie->extensionValue.present, F1AP_DRBs_ToBeSetup_ItemExtIEs__extensionValue_PR_PDCPSNLength); _F1_MALLOC(drb->dl_pdcp_sn_len, ie->extensionValue.choice.PDCPSNLength); break; case F1AP_ProtocolIE_ID_id_ULPDCPSNLength: - _F1_EQ_CHECK_INT(ie->extensionValue.present, F1AP_DRBs_ToBeSetup_ItemExtIEs__extensionValue_PR_PDCPSNLength_1); + _EQ_CHECK_INT(ie->extensionValue.present, F1AP_DRBs_ToBeSetup_ItemExtIEs__extensionValue_PR_PDCPSNLength_1); _F1_MALLOC(drb->ul_pdcp_sn_len, ie->extensionValue.choice.PDCPSNLength_1); break; default: @@ -845,22 +845,22 @@ static bool decode_drbs_to_setupmod(const F1AP_DRBs_ToBeSetupMod_List_t *f1ap, i f1ap_drb_to_setup_t *drbs = *out = calloc_or_fail(count, sizeof(*drbs)); for (int i = 0; i < count; ++i) { const F1AP_DRBs_ToBeSetupMod_ItemIEs_t *itie = (const F1AP_DRBs_ToBeSetupMod_ItemIEs_t *)f1ap->list.array[i]; - _F1_EQ_CHECK_LONG(itie->id, F1AP_ProtocolIE_ID_id_DRBs_ToBeSetupMod_Item); - _F1_EQ_CHECK_INT(itie->value.present, F1AP_DRBs_ToBeSetupMod_ItemIEs__value_PR_DRBs_ToBeSetupMod_Item); + _EQ_CHECK_LONG(itie->id, F1AP_ProtocolIE_ID_id_DRBs_ToBeSetupMod_Item); + _EQ_CHECK_INT(itie->value.present, F1AP_DRBs_ToBeSetupMod_ItemIEs__value_PR_DRBs_ToBeSetupMod_Item); const F1AP_DRBs_ToBeSetupMod_Item_t *it = &itie->value.choice.DRBs_ToBeSetupMod_Item; f1ap_drb_to_setup_t *drb = &drbs[i]; drb->id = it->dRBID; - _F1_EQ_CHECK_INT(it->qoSInformation.present, F1AP_QoSInformation_PR_choice_extension); + _EQ_CHECK_INT(it->qoSInformation.present, F1AP_QoSInformation_PR_choice_extension); const F1AP_QoSInformation_ExtIEs_t *qos_ext = (F1AP_QoSInformation_ExtIEs_t *)it->qoSInformation.choice.choice_extension; - _F1_EQ_CHECK_LONG(qos_ext->id, F1AP_ProtocolIE_ID_id_DRB_Information); - _F1_EQ_CHECK_INT(qos_ext->value.present, F1AP_QoSInformation_ExtIEs__value_PR_DRB_Information); + _EQ_CHECK_LONG(qos_ext->id, F1AP_ProtocolIE_ID_id_DRB_Information); + _EQ_CHECK_INT(qos_ext->value.present, F1AP_QoSInformation_ExtIEs__value_PR_DRB_Information); drb->qos_choice = F1AP_QOS_CHOICE_NR; _F1_CHECK_EXP(decode_drb_info_nr(&qos_ext->value.choice.DRB_Information, &drb->nr)); drb->up_ul_tnl_len = it->uLUPTNLInformation_ToBeSetup_List.list.count; - _F1_EQ_CHECK_GENERIC(drb->up_ul_tnl_len > 0 && drb->up_ul_tnl_len <= 2, "%d", drb->up_ul_tnl_len, 1); + EQ_CHECK_GENERIC(drb->up_ul_tnl_len > 0 && drb->up_ul_tnl_len <= 2, "%d", drb->up_ul_tnl_len, 1); for (int j = 0; j < drb->up_ul_tnl_len; ++j) { const F1AP_ULUPTNLInformation_ToBeSetup_Item_t *it_tnl = it->uLUPTNLInformation_ToBeSetup_List.list.array[j]; _F1_CHECK_EXP(decode_up_tnl(&it_tnl->uLUPTNLInformation, &drb->up_ul_tnl[j])); @@ -878,11 +878,11 @@ static bool decode_drbs_to_setupmod(const F1AP_DRBs_ToBeSetupMod_List_t *f1ap, i AssertError(ie != NULL, return false, "ext->list.array[j] is NULL"); switch (ie->id) { case F1AP_ProtocolIE_ID_id_DLPDCPSNLength: - _F1_EQ_CHECK_INT(ie->extensionValue.present, F1AP_DRBs_ToBeSetupMod_ItemExtIEs__extensionValue_PR_PDCPSNLength); + _EQ_CHECK_INT(ie->extensionValue.present, F1AP_DRBs_ToBeSetupMod_ItemExtIEs__extensionValue_PR_PDCPSNLength); _F1_MALLOC(drb->dl_pdcp_sn_len, ie->extensionValue.choice.PDCPSNLength); break; case F1AP_ProtocolIE_ID_id_ULPDCPSNLength: - _F1_EQ_CHECK_INT(ie->extensionValue.present, F1AP_DRBs_ToBeSetupMod_ItemExtIEs__extensionValue_PR_PDCPSNLength_1); + _EQ_CHECK_INT(ie->extensionValue.present, F1AP_DRBs_ToBeSetupMod_ItemExtIEs__extensionValue_PR_PDCPSNLength_1); _F1_MALLOC(drb->ul_pdcp_sn_len, ie->extensionValue.choice.PDCPSNLength_1); break; default: @@ -922,18 +922,18 @@ static f1ap_drb_to_setup_t cp_drb_to_setup(const f1ap_drb_to_setup_t *orig) static bool eq_drb_to_setup(const f1ap_drb_to_setup_t *a, const f1ap_drb_to_setup_t *b) { - _F1_EQ_CHECK_INT(a->id, b->id); - _F1_EQ_CHECK_INT(a->qos_choice, b->qos_choice); + _EQ_CHECK_INT(a->id, b->id); + _EQ_CHECK_INT(a->qos_choice, b->qos_choice); AssertFatal(a->qos_choice == F1AP_QOS_CHOICE_NR, "only NR QoS choice implemented\n"); if (a->qos_choice == F1AP_QOS_CHOICE_NR) eq_drb_info_nr(&a->nr, &b->nr); - _F1_EQ_CHECK_INT(a->up_ul_tnl_len, b->up_ul_tnl_len); + _EQ_CHECK_INT(a->up_ul_tnl_len, b->up_ul_tnl_len); for (int i = 0; i < a->up_ul_tnl_len; ++i) { _F1_CHECK_EXP(eq_up_tnl(&a->up_ul_tnl[i], &b->up_ul_tnl[i])); } - _F1_EQ_CHECK_INT(a->rlc_mode, b->rlc_mode); - _F1_EQ_CHECK_OPTIONAL_IE(a, b, dl_pdcp_sn_len, _F1_EQ_CHECK_INT); - _F1_EQ_CHECK_OPTIONAL_IE(a, b, ul_pdcp_sn_len, _F1_EQ_CHECK_INT); + _EQ_CHECK_INT(a->rlc_mode, b->rlc_mode); + _EQ_CHECK_OPTIONAL_IE(a, b, dl_pdcp_sn_len, _EQ_CHECK_INT); + _EQ_CHECK_OPTIONAL_IE(a, b, ul_pdcp_sn_len, _EQ_CHECK_INT); return true; } @@ -1004,8 +1004,8 @@ static bool decode_drbs_setup(const F1AP_DRBs_Setup_List_t *f1ap, int *n, f1ap_d f1ap_drb_setup_t *drbs = *out = calloc_or_fail(count, sizeof(*drbs)); for (int i = 0; i < count; ++i) { const F1AP_DRBs_Setup_ItemIEs_t *itie = (const F1AP_DRBs_Setup_ItemIEs_t *)f1ap->list.array[i]; - _F1_EQ_CHECK_LONG(itie->id, F1AP_ProtocolIE_ID_id_DRBs_Setup_Item); - _F1_EQ_CHECK_INT(itie->value.present, F1AP_DRBs_Setup_ItemIEs__value_PR_DRBs_Setup_Item); + _EQ_CHECK_LONG(itie->id, F1AP_ProtocolIE_ID_id_DRBs_Setup_Item); + _EQ_CHECK_INT(itie->value.present, F1AP_DRBs_Setup_ItemIEs__value_PR_DRBs_Setup_Item); const F1AP_DRBs_Setup_Item_t *it = &itie->value.choice.DRBs_Setup_Item; f1ap_drb_setup_t *drb = &drbs[i]; @@ -1014,7 +1014,7 @@ static bool decode_drbs_setup(const F1AP_DRBs_Setup_List_t *f1ap, int *n, f1ap_d _F1_MALLOC(drb->lcid, *it->lCID); drb->up_dl_tnl_len = it->dLUPTNLInformation_ToBeSetup_List.list.count; - _F1_EQ_CHECK_GENERIC(drb->up_dl_tnl_len > 0 && drb->up_dl_tnl_len <= 2, "%d", drb->up_dl_tnl_len, 1); + EQ_CHECK_GENERIC(drb->up_dl_tnl_len > 0 && drb->up_dl_tnl_len <= 2, "%d", drb->up_dl_tnl_len, 1); for (int j = 0; j < drb->up_dl_tnl_len; ++j) { F1AP_DLUPTNLInformation_ToBeSetup_Item_t *it_tnl = it->dLUPTNLInformation_ToBeSetup_List.list.array[j]; _F1_CHECK_EXP(decode_up_tnl(&it_tnl->dLUPTNLInformation, &drb->up_dl_tnl[j])); @@ -1035,8 +1035,8 @@ static bool decode_drbs_setupmod(const F1AP_DRBs_SetupMod_List_t *f1ap, int *n, f1ap_drb_setup_t *drbs = *out = calloc_or_fail(count, sizeof(*drbs)); for (int i = 0; i < count; ++i) { const F1AP_DRBs_SetupMod_ItemIEs_t *itie = (const F1AP_DRBs_SetupMod_ItemIEs_t *)f1ap->list.array[i]; - _F1_EQ_CHECK_LONG(itie->id, F1AP_ProtocolIE_ID_id_DRBs_SetupMod_Item); - _F1_EQ_CHECK_INT(itie->value.present, F1AP_DRBs_SetupMod_ItemIEs__value_PR_DRBs_SetupMod_Item); + _EQ_CHECK_LONG(itie->id, F1AP_ProtocolIE_ID_id_DRBs_SetupMod_Item); + _EQ_CHECK_INT(itie->value.present, F1AP_DRBs_SetupMod_ItemIEs__value_PR_DRBs_SetupMod_Item); const F1AP_DRBs_SetupMod_Item_t *it = &itie->value.choice.DRBs_SetupMod_Item; f1ap_drb_setup_t *drb = &drbs[i]; @@ -1045,7 +1045,7 @@ static bool decode_drbs_setupmod(const F1AP_DRBs_SetupMod_List_t *f1ap, int *n, _F1_MALLOC(drb->lcid, *it->lCID); drb->up_dl_tnl_len = it->dLUPTNLInformation_ToBeSetup_List.list.count; - _F1_EQ_CHECK_GENERIC(drb->up_dl_tnl_len > 0 && drb->up_dl_tnl_len <= 2, "%d", drb->up_dl_tnl_len, 1); + EQ_CHECK_GENERIC(drb->up_dl_tnl_len > 0 && drb->up_dl_tnl_len <= 2, "%d", drb->up_dl_tnl_len, 1); for (int j = 0; j < drb->up_dl_tnl_len; ++j) { F1AP_DLUPTNLInformation_ToBeSetup_Item_t *it_tnl = it->dLUPTNLInformation_ToBeSetup_List.list.array[j]; _F1_CHECK_EXP(decode_up_tnl(&it_tnl->dLUPTNLInformation, &drb->up_dl_tnl[j])); @@ -1070,9 +1070,9 @@ static f1ap_drb_setup_t cp_drb_setup(const f1ap_drb_setup_t *orig) static bool eq_drb_setup(const f1ap_drb_setup_t *a, const f1ap_drb_setup_t *b) { - _F1_EQ_CHECK_INT(a->id, b->id); - _F1_EQ_CHECK_OPTIONAL_IE(a, b, lcid, _F1_EQ_CHECK_INT); - _F1_EQ_CHECK_INT(a->up_dl_tnl_len, b->up_dl_tnl_len); + _EQ_CHECK_INT(a->id, b->id); + _EQ_CHECK_OPTIONAL_IE(a, b, lcid, _EQ_CHECK_INT); + _EQ_CHECK_INT(a->up_dl_tnl_len, b->up_dl_tnl_len); for (int i = 0; i < a->up_dl_tnl_len; ++i) _F1_CHECK_EXP(eq_up_tnl(&a->up_dl_tnl[i], &b->up_dl_tnl[i])); return true; @@ -1107,8 +1107,8 @@ static bool decode_drbs_to_release(const F1AP_DRBs_ToBeReleased_List_t *f1ap, in f1ap_drb_to_release_t *drbs = *out = calloc_or_fail(count, sizeof(*drbs)); for (int i = 0; i < count; ++i) { const F1AP_DRBs_ToBeReleased_ItemIEs_t *itie = (F1AP_DRBs_ToBeReleased_ItemIEs_t *)f1ap->list.array[i]; - _F1_EQ_CHECK_LONG(itie->id, F1AP_ProtocolIE_ID_id_DRBs_ToBeReleased_Item); - _F1_EQ_CHECK_INT(itie->value.present, F1AP_DRBs_ToBeReleased_ItemIEs__value_PR_DRBs_ToBeReleased_Item); + _EQ_CHECK_LONG(itie->id, F1AP_ProtocolIE_ID_id_DRBs_ToBeReleased_Item); + _EQ_CHECK_INT(itie->value.present, F1AP_DRBs_ToBeReleased_ItemIEs__value_PR_DRBs_ToBeReleased_Item); drbs[i].id = itie->value.choice.DRBs_ToBeReleased_Item.dRBID; } @@ -1125,7 +1125,7 @@ static f1ap_drb_to_release_t cp_drb_to_release(const f1ap_drb_to_release_t *orig static bool eq_drb_to_release(const f1ap_drb_to_release_t *a, const f1ap_drb_to_release_t *b) { - _F1_EQ_CHECK_INT(a->id, b->id); + _EQ_CHECK_INT(a->id, b->id); return true; } @@ -1249,33 +1249,33 @@ bool decode_ue_context_setup_req(const F1AP_F1AP_PDU_t *pdu, f1ap_ue_context_set AssertError(ie != NULL, return false, "in->protocolIEs.list.array[i] is NULL"); switch (ie->id) { case F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_UEContextSetupRequestIEs__value_PR_GNB_CU_UE_F1AP_ID); + _EQ_CHECK_INT(ie->value.present, F1AP_UEContextSetupRequestIEs__value_PR_GNB_CU_UE_F1AP_ID); out->gNB_CU_ue_id = ie->value.choice.GNB_CU_UE_F1AP_ID; break; case F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_UEContextSetupRequestIEs__value_PR_GNB_DU_UE_F1AP_ID); + _EQ_CHECK_INT(ie->value.present, F1AP_UEContextSetupRequestIEs__value_PR_GNB_DU_UE_F1AP_ID); _F1_MALLOC(out->gNB_DU_ue_id, ie->value.choice.GNB_DU_UE_F1AP_ID); break; case F1AP_ProtocolIE_ID_id_SpCell_ID: { - _F1_EQ_CHECK_INT(ie->value.present, F1AP_UEContextSetupRequestIEs__value_PR_NRCGI); + _EQ_CHECK_INT(ie->value.present, F1AP_UEContextSetupRequestIEs__value_PR_NRCGI); const F1AP_NRCGI_t *nrcgi = &ie->value.choice.NRCGI; PLMNID_TO_MCC_MNC(&nrcgi->pLMN_Identity, out->plmn.mcc, out->plmn.mnc, out->plmn.mnc_digit_length); BIT_STRING_TO_NR_CELL_IDENTITY(&nrcgi->nRCellIdentity, out->nr_cellid); } break; case F1AP_ProtocolIE_ID_id_ServCellIndex: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_UEContextSetupRequestIEs__value_PR_ServCellIndex); + _EQ_CHECK_INT(ie->value.present, F1AP_UEContextSetupRequestIEs__value_PR_ServCellIndex); out->servCellIndex = ie->value.choice.ServCellIndex; break; case F1AP_ProtocolIE_ID_id_CUtoDURRCInformation: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_UEContextSetupRequestIEs__value_PR_CUtoDURRCInformation); + _EQ_CHECK_INT(ie->value.present, F1AP_UEContextSetupRequestIEs__value_PR_CUtoDURRCInformation); _F1_CHECK_EXP(decode_cu_to_du_rrc_info(&out->cu_to_du_rrc_info, &ie->value.choice.CUtoDURRCInformation)); break; case F1AP_ProtocolIE_ID_id_SRBs_ToBeSetup_List: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_UEContextSetupRequestIEs__value_PR_SRBs_ToBeSetup_List); + _EQ_CHECK_INT(ie->value.present, F1AP_UEContextSetupRequestIEs__value_PR_SRBs_ToBeSetup_List); _F1_CHECK_EXP(decode_srbs_to_setup(&ie->value.choice.SRBs_ToBeSetup_List, &out->srbs_len, &out->srbs)); break; case F1AP_ProtocolIE_ID_id_DRBs_ToBeSetup_List: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_UEContextSetupRequestIEs__value_PR_DRBs_ToBeSetup_List); + _EQ_CHECK_INT(ie->value.present, F1AP_UEContextSetupRequestIEs__value_PR_DRBs_ToBeSetup_List); { // gNB-DU UE Aggregate Maximum Bit Rate Uplink is C-ifDRBSetup // below, check that gNB-DU UE AMBR UL IE is present if we have DRB @@ -1287,7 +1287,7 @@ bool decode_ue_context_setup_req(const F1AP_F1AP_PDU_t *pdu, f1ap_ue_context_set _F1_CHECK_EXP(decode_drbs_to_setup(&ie->value.choice.DRBs_ToBeSetup_List, &out->drbs_len, &out->drbs)); break; case F1AP_ProtocolIE_ID_id_RRCContainer: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_UEContextSetupRequestIEs__value_PR_RRCContainer); + _EQ_CHECK_INT(ie->value.present, F1AP_UEContextSetupRequestIEs__value_PR_RRCContainer); out->rrc_container = malloc_or_fail(sizeof(*out->rrc_container)); { OCTET_STRING_t *os = &ie->value.choice.RRCContainer; @@ -1295,7 +1295,7 @@ bool decode_ue_context_setup_req(const F1AP_F1AP_PDU_t *pdu, f1ap_ue_context_set } break; case F1AP_ProtocolIE_ID_id_GNB_DU_UE_AMBR_UL: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_UEContextSetupRequestIEs__value_PR_BitRate); + _EQ_CHECK_INT(ie->value.present, F1AP_UEContextSetupRequestIEs__value_PR_BitRate); out->gnb_du_ue_agg_mbr_ul = malloc_or_fail(sizeof(*out->gnb_du_ue_agg_mbr_ul)); asn_INTEGER2uint64(&ie->value.choice.BitRate, out->gnb_du_ue_agg_mbr_ul); break; @@ -1346,26 +1346,26 @@ f1ap_ue_context_setup_req_t cp_ue_context_setup_req(const f1ap_ue_context_setup_ */ bool eq_ue_context_setup_req(const f1ap_ue_context_setup_req_t *a, const f1ap_ue_context_setup_req_t *b) { - _F1_EQ_CHECK_INT(a->gNB_CU_ue_id, b->gNB_CU_ue_id); - _F1_EQ_CHECK_OPTIONAL_IE(a, b, gNB_DU_ue_id, _F1_EQ_CHECK_INT); + _EQ_CHECK_INT(a->gNB_CU_ue_id, b->gNB_CU_ue_id); + _EQ_CHECK_OPTIONAL_IE(a, b, gNB_DU_ue_id, _EQ_CHECK_INT); _F1_CHECK_EXP(eq_f1ap_plmn(&a->plmn, &b->plmn)); - _F1_EQ_CHECK_LONG(a->nr_cellid, b->nr_cellid); - _F1_EQ_CHECK_INT(a->servCellIndex, b->servCellIndex); + _EQ_CHECK_LONG(a->nr_cellid, b->nr_cellid); + _EQ_CHECK_INT(a->servCellIndex, b->servCellIndex); _F1_CHECK_EXP(eq_cu_to_du_rrc_info(&a->cu_to_du_rrc_info, &b->cu_to_du_rrc_info)); - _F1_EQ_CHECK_INT(a->srbs_len, b->srbs_len); + _EQ_CHECK_INT(a->srbs_len, b->srbs_len); _F1_CHECK_EXP(a->srbs_len == 0 || (a->srbs && b->srbs)); for (int i = 0; i < a->srbs_len; ++i) _F1_CHECK_EXP(eq_srb_to_setup(&a->srbs[i], &b->srbs[i])); - _F1_EQ_CHECK_INT(a->drbs_len, b->drbs_len); + _EQ_CHECK_INT(a->drbs_len, b->drbs_len); _F1_CHECK_EXP(a->drbs_len == 0 || (a->drbs && b->drbs)); for (int i = 0; i < a->drbs_len; ++i) _F1_CHECK_EXP(eq_drb_to_setup(&a->drbs[i], &b->drbs[i])); - _F1_EQ_CHECK_OPTIONAL_IE(a, b, rrc_container, eq_ba); + _EQ_CHECK_OPTIONAL_IE(a, b, rrc_container, eq_ba); - _F1_EQ_CHECK_OPTIONAL_IE(a, b, gnb_du_ue_agg_mbr_ul, _F1_EQ_CHECK_LONG); + _EQ_CHECK_OPTIONAL_IE(a, b, gnb_du_ue_agg_mbr_ul, _EQ_CHECK_LONG); return true; } @@ -1472,27 +1472,27 @@ bool decode_ue_context_setup_resp(const struct F1AP_F1AP_PDU *pdu, f1ap_ue_conte AssertError(ie != NULL, return false, "in->protocolIEs.list.array[i] is NULL"); switch (ie->id) { case F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_UEContextSetupResponseIEs__value_PR_GNB_CU_UE_F1AP_ID); + _EQ_CHECK_INT(ie->value.present, F1AP_UEContextSetupResponseIEs__value_PR_GNB_CU_UE_F1AP_ID); out->gNB_CU_ue_id = ie->value.choice.GNB_CU_UE_F1AP_ID; break; case F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_UEContextSetupResponseIEs__value_PR_GNB_DU_UE_F1AP_ID); + _EQ_CHECK_INT(ie->value.present, F1AP_UEContextSetupResponseIEs__value_PR_GNB_DU_UE_F1AP_ID); out->gNB_DU_ue_id = ie->value.choice.GNB_DU_UE_F1AP_ID; break; case F1AP_ProtocolIE_ID_id_DUtoCURRCInformation: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_UEContextSetupResponseIEs__value_PR_DUtoCURRCInformation); + _EQ_CHECK_INT(ie->value.present, F1AP_UEContextSetupResponseIEs__value_PR_DUtoCURRCInformation); _F1_CHECK_EXP(decode_du_to_cu_rrc_info(&out->du_to_cu_rrc_info, &ie->value.choice.DUtoCURRCInformation)); break; case F1AP_ProtocolIE_ID_id_C_RNTI: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_UEContextSetupResponseIEs__value_PR_C_RNTI); + _EQ_CHECK_INT(ie->value.present, F1AP_UEContextSetupResponseIEs__value_PR_C_RNTI); _F1_MALLOC(out->crnti, ie->value.choice.C_RNTI); break; case F1AP_ProtocolIE_ID_id_DRBs_Setup_List: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_UEContextSetupResponseIEs__value_PR_DRBs_Setup_List); + _EQ_CHECK_INT(ie->value.present, F1AP_UEContextSetupResponseIEs__value_PR_DRBs_Setup_List); _F1_CHECK_EXP(decode_drbs_setup(&ie->value.choice.DRBs_Setup_List, &out->drbs_len, &out->drbs)); break; case F1AP_ProtocolIE_ID_id_SRBs_Setup_List: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_UEContextSetupResponseIEs__value_PR_SRBs_Setup_List); + _EQ_CHECK_INT(ie->value.present, F1AP_UEContextSetupResponseIEs__value_PR_SRBs_Setup_List); _F1_CHECK_EXP(decode_srbs_setup(&ie->value.choice.SRBs_Setup_List, &out->srbs_len, &out->srbs)); break; default: @@ -1541,17 +1541,17 @@ f1ap_ue_context_setup_resp_t cp_ue_context_setup_resp(const f1ap_ue_context_setu */ bool eq_ue_context_setup_resp(const f1ap_ue_context_setup_resp_t *a, const f1ap_ue_context_setup_resp_t *b) { - _F1_EQ_CHECK_INT(a->gNB_CU_ue_id, b->gNB_CU_ue_id); - _F1_EQ_CHECK_INT(a->gNB_DU_ue_id, b->gNB_DU_ue_id); + _EQ_CHECK_INT(a->gNB_CU_ue_id, b->gNB_CU_ue_id); + _EQ_CHECK_INT(a->gNB_DU_ue_id, b->gNB_DU_ue_id); _F1_CHECK_EXP(eq_du_to_cu_rrc_info(&a->du_to_cu_rrc_info, &b->du_to_cu_rrc_info)); - _F1_EQ_CHECK_OPTIONAL_IE(a, b, crnti, _F1_EQ_CHECK_INT); + _EQ_CHECK_OPTIONAL_IE(a, b, crnti, _EQ_CHECK_INT); - _F1_EQ_CHECK_INT(a->drbs_len, b->drbs_len); + _EQ_CHECK_INT(a->drbs_len, b->drbs_len); _F1_CHECK_EXP(a->drbs_len == 0 || (a->drbs && b->drbs)); for (int i = 0; i < a->drbs_len; ++i) _F1_CHECK_EXP(eq_drb_setup(&a->drbs[i], &b->drbs[i])); - _F1_EQ_CHECK_INT(a->srbs_len, b->srbs_len); + _EQ_CHECK_INT(a->srbs_len, b->srbs_len); _F1_CHECK_EXP(a->srbs_len == 0 || (a->srbs && b->srbs)); for (int i = 0; i < a->srbs_len; ++i) _F1_CHECK_EXP(eq_srb_setup(&a->srbs[i], &b->srbs[i])); @@ -1735,15 +1735,15 @@ bool decode_ue_context_mod_req(const F1AP_F1AP_PDU_t *pdu, f1ap_ue_context_mod_r AssertError(ie != NULL, return false, "in->protocolIEs.list.array[i] is NULL"); switch (ie->id) { case F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_UEContextModificationRequestIEs__value_PR_GNB_CU_UE_F1AP_ID); + _EQ_CHECK_INT(ie->value.present, F1AP_UEContextModificationRequestIEs__value_PR_GNB_CU_UE_F1AP_ID); out->gNB_CU_ue_id = ie->value.choice.GNB_CU_UE_F1AP_ID; break; case F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_UEContextModificationRequestIEs__value_PR_GNB_DU_UE_F1AP_ID); + _EQ_CHECK_INT(ie->value.present, F1AP_UEContextModificationRequestIEs__value_PR_GNB_DU_UE_F1AP_ID); out->gNB_DU_ue_id = ie->value.choice.GNB_DU_UE_F1AP_ID; break; case F1AP_ProtocolIE_ID_id_SpCell_ID: { - _F1_EQ_CHECK_INT(ie->value.present, F1AP_UEContextModificationRequestIEs__value_PR_NRCGI); + _EQ_CHECK_INT(ie->value.present, F1AP_UEContextModificationRequestIEs__value_PR_NRCGI); const F1AP_NRCGI_t *nrcgi = &ie->value.choice.NRCGI; out->plmn = malloc_or_fail(sizeof(*out->plmn)); PLMNID_TO_MCC_MNC(&nrcgi->pLMN_Identity, out->plmn->mcc, out->plmn->mnc, out->plmn->mnc_digit_length); @@ -1751,16 +1751,16 @@ bool decode_ue_context_mod_req(const F1AP_F1AP_PDU_t *pdu, f1ap_ue_context_mod_r BIT_STRING_TO_NR_CELL_IDENTITY(&nrcgi->nRCellIdentity, *out->nr_cellid); } break; case F1AP_ProtocolIE_ID_id_ServCellIndex: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_UEContextModificationRequestIEs__value_PR_ServCellIndex); + _EQ_CHECK_INT(ie->value.present, F1AP_UEContextModificationRequestIEs__value_PR_ServCellIndex); _F1_MALLOC(out->servCellIndex, ie->value.choice.ServCellIndex); break; case F1AP_ProtocolIE_ID_id_CUtoDURRCInformation: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_UEContextModificationRequestIEs__value_PR_CUtoDURRCInformation); + _EQ_CHECK_INT(ie->value.present, F1AP_UEContextModificationRequestIEs__value_PR_CUtoDURRCInformation); out->cu_to_du_rrc_info = calloc(1, sizeof(*out->cu_to_du_rrc_info)); _F1_CHECK_EXP(decode_cu_to_du_rrc_info(out->cu_to_du_rrc_info, &ie->value.choice.CUtoDURRCInformation)); break; case F1AP_ProtocolIE_ID_id_TransmissionActionIndicator: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_UEContextModificationRequestIEs__value_PR_TransmissionActionIndicator); + _EQ_CHECK_INT(ie->value.present, F1AP_UEContextModificationRequestIEs__value_PR_TransmissionActionIndicator); { TransmActionInd_t v = ie->value.choice.TransmissionActionIndicator == F1AP_TransmissionActionIndicator_stop ? TransmActionInd_STOP @@ -1769,7 +1769,7 @@ bool decode_ue_context_mod_req(const F1AP_F1AP_PDU_t *pdu, f1ap_ue_context_mod_r } break; case F1AP_ProtocolIE_ID_id_RRCReconfigurationCompleteIndicator: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_UEContextModificationRequestIEs__value_PR_RRCReconfigurationCompleteIndicator); + _EQ_CHECK_INT(ie->value.present, F1AP_UEContextModificationRequestIEs__value_PR_RRCReconfigurationCompleteIndicator); { ReconfigurationCompl_t v = ie->value.choice.RRCReconfigurationCompleteIndicator == F1AP_RRCReconfigurationCompleteIndicator_true @@ -1779,7 +1779,7 @@ bool decode_ue_context_mod_req(const F1AP_F1AP_PDU_t *pdu, f1ap_ue_context_mod_r } break; case F1AP_ProtocolIE_ID_id_RRCContainer: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_UEContextModificationRequestIEs__value_PR_RRCContainer); + _EQ_CHECK_INT(ie->value.present, F1AP_UEContextModificationRequestIEs__value_PR_RRCContainer); out->rrc_container = malloc_or_fail(sizeof(*out->rrc_container)); { OCTET_STRING_t *os = &ie->value.choice.RRCContainer; @@ -1787,26 +1787,26 @@ bool decode_ue_context_mod_req(const F1AP_F1AP_PDU_t *pdu, f1ap_ue_context_mod_r } break; case F1AP_ProtocolIE_ID_id_GNB_DUConfigurationQuery: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_UEContextModificationRequestIEs__value_PR_GNB_DUConfigurationQuery); + _EQ_CHECK_INT(ie->value.present, F1AP_UEContextModificationRequestIEs__value_PR_GNB_DUConfigurationQuery); { bool v = ie->value.choice.GNB_DUConfigurationQuery == F1AP_GNB_DUConfigurationQuery_true; _F1_MALLOC(out->gNB_DU_Configuration_Query, v); } break; case F1AP_ProtocolIE_ID_id_SRBs_ToBeSetupMod_List: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_UEContextModificationRequestIEs__value_PR_SRBs_ToBeSetupMod_List); + _EQ_CHECK_INT(ie->value.present, F1AP_UEContextModificationRequestIEs__value_PR_SRBs_ToBeSetupMod_List); _F1_CHECK_EXP(decode_srbs_to_setupmod(&ie->value.choice.SRBs_ToBeSetupMod_List, &out->srbs_len, &out->srbs)); break; case F1AP_ProtocolIE_ID_id_DRBs_ToBeSetupMod_List: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_UEContextModificationRequestIEs__value_PR_DRBs_ToBeSetupMod_List); + _EQ_CHECK_INT(ie->value.present, F1AP_UEContextModificationRequestIEs__value_PR_DRBs_ToBeSetupMod_List); _F1_CHECK_EXP(decode_drbs_to_setupmod(&ie->value.choice.DRBs_ToBeSetupMod_List, &out->drbs_len, &out->drbs)); break; case F1AP_ProtocolIE_ID_id_DRBs_ToBeReleased_List: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_UEContextModificationRequestIEs__value_PR_DRBs_ToBeReleased_List); + _EQ_CHECK_INT(ie->value.present, F1AP_UEContextModificationRequestIEs__value_PR_DRBs_ToBeReleased_List); _F1_CHECK_EXP(decode_drbs_to_release(&ie->value.choice.DRBs_ToBeReleased_List, &out->drbs_rel_len, &out->drbs_rel)); break; case F1AP_ProtocolIE_ID_id_LowerLayerPresenceStatusChange: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_UEContextModificationRequestIEs__value_PR_LowerLayerPresenceStatusChange); + _EQ_CHECK_INT(ie->value.present, F1AP_UEContextModificationRequestIEs__value_PR_LowerLayerPresenceStatusChange); { lower_layer_status_t v = ie->value.choice.LowerLayerPresenceStatusChange == F1AP_LowerLayerPresenceStatusChange_suspend_lower_layers ? LOWER_LAYERS_SUSPEND : LOWER_LAYERS_RESUME; @@ -1888,35 +1888,35 @@ f1ap_ue_context_mod_req_t cp_ue_context_mod_req(const f1ap_ue_context_mod_req_t */ bool eq_ue_context_mod_req(const f1ap_ue_context_mod_req_t *a, const f1ap_ue_context_mod_req_t *b) { - _F1_EQ_CHECK_INT(a->gNB_CU_ue_id, b->gNB_CU_ue_id); - _F1_EQ_CHECK_INT(a->gNB_DU_ue_id, b->gNB_DU_ue_id); - _F1_CHECK_EXP((a->plmn && b->plmn) || (!a->plmn && !b->plmn)); + _EQ_CHECK_INT(a->gNB_CU_ue_id, b->gNB_CU_ue_id); + _EQ_CHECK_INT(a->gNB_DU_ue_id, b->gNB_DU_ue_id); + _EQ_CHECK_OPTIONAL_PTR(a, b, plmn); _F1_CHECK_EXP(!a->plmn || eq_f1ap_plmn(a->plmn, b->plmn)); - _F1_EQ_CHECK_OPTIONAL_IE(a, b, nr_cellid, _F1_EQ_CHECK_LONG); - _F1_EQ_CHECK_OPTIONAL_IE(a, b, servCellIndex, _F1_EQ_CHECK_INT); - _F1_CHECK_EXP((a->cu_to_du_rrc_info && b->cu_to_du_rrc_info) || (!a->cu_to_du_rrc_info && !b->cu_to_du_rrc_info)); + _EQ_CHECK_OPTIONAL_IE(a, b, nr_cellid, _EQ_CHECK_LONG); + _EQ_CHECK_OPTIONAL_IE(a, b, servCellIndex, _EQ_CHECK_INT); + _EQ_CHECK_OPTIONAL_PTR(a, b, cu_to_du_rrc_info); _F1_CHECK_EXP(!a->cu_to_du_rrc_info || eq_cu_to_du_rrc_info(a->cu_to_du_rrc_info, b->cu_to_du_rrc_info)); - _F1_EQ_CHECK_OPTIONAL_IE(a, b, transm_action_ind, _F1_EQ_CHECK_INT); - _F1_EQ_CHECK_OPTIONAL_IE(a, b, reconfig_compl, _F1_EQ_CHECK_INT); - _F1_EQ_CHECK_OPTIONAL_IE(a, b, rrc_container, eq_ba); + _EQ_CHECK_OPTIONAL_IE(a, b, transm_action_ind, _EQ_CHECK_INT); + _EQ_CHECK_OPTIONAL_IE(a, b, reconfig_compl, _EQ_CHECK_INT); + _EQ_CHECK_OPTIONAL_IE(a, b, rrc_container, eq_ba); - _F1_EQ_CHECK_INT(a->srbs_len, b->srbs_len); + _EQ_CHECK_INT(a->srbs_len, b->srbs_len); _F1_CHECK_EXP(a->srbs_len == 0 || (a->srbs && b->srbs)); for (int i = 0; i < a->srbs_len; ++i) _F1_CHECK_EXP(eq_srb_to_setup(&a->srbs[i], &b->srbs[i])); - _F1_EQ_CHECK_INT(a->drbs_len, b->drbs_len); + _EQ_CHECK_INT(a->drbs_len, b->drbs_len); _F1_CHECK_EXP(a->drbs_len == 0 || (a->drbs && b->drbs)); for (int i = 0; i < a->drbs_len; ++i) _F1_CHECK_EXP(eq_drb_to_setup(&a->drbs[i], &b->drbs[i])); - _F1_EQ_CHECK_INT(a->drbs_rel_len, b->drbs_rel_len); + _EQ_CHECK_INT(a->drbs_rel_len, b->drbs_rel_len); _F1_CHECK_EXP(a->drbs_rel_len == 0 || (a->drbs_rel_len && b->drbs_rel_len)); for (int i = 0; i < a->drbs_rel_len; ++i) _F1_CHECK_EXP(eq_drb_to_release(&a->drbs_rel[i], &b->drbs_rel[i])); - _F1_EQ_CHECK_OPTIONAL_IE(a, b, status, _F1_EQ_CHECK_INT); - _F1_EQ_CHECK_OPTIONAL_IE(a, b, gNB_DU_Configuration_Query, _F1_EQ_CHECK_INT); + _EQ_CHECK_OPTIONAL_IE(a, b, status, _EQ_CHECK_INT); + _EQ_CHECK_OPTIONAL_IE(a, b, gNB_DU_Configuration_Query, _EQ_CHECK_INT); return true; } @@ -2024,24 +2024,24 @@ bool decode_ue_context_mod_resp(const struct F1AP_F1AP_PDU *pdu, f1ap_ue_context AssertError(ie != NULL, return false, "in->protocolIEs.list.array[i] is NULL"); switch (ie->id) { case F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_UEContextModificationResponseIEs__value_PR_GNB_CU_UE_F1AP_ID); + _EQ_CHECK_INT(ie->value.present, F1AP_UEContextModificationResponseIEs__value_PR_GNB_CU_UE_F1AP_ID); out->gNB_CU_ue_id = ie->value.choice.GNB_CU_UE_F1AP_ID; break; case F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_UEContextModificationResponseIEs__value_PR_GNB_DU_UE_F1AP_ID); + _EQ_CHECK_INT(ie->value.present, F1AP_UEContextModificationResponseIEs__value_PR_GNB_DU_UE_F1AP_ID); out->gNB_DU_ue_id = ie->value.choice.GNB_DU_UE_F1AP_ID; break; case F1AP_ProtocolIE_ID_id_DUtoCURRCInformation: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_UEContextModificationResponseIEs__value_PR_DUtoCURRCInformation); + _EQ_CHECK_INT(ie->value.present, F1AP_UEContextModificationResponseIEs__value_PR_DUtoCURRCInformation); out->du_to_cu_rrc_info = calloc(1, sizeof(*out->du_to_cu_rrc_info)); _F1_CHECK_EXP(decode_du_to_cu_rrc_info(out->du_to_cu_rrc_info, &ie->value.choice.DUtoCURRCInformation)); break; case F1AP_ProtocolIE_ID_id_DRBs_SetupMod_List: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_UEContextModificationResponseIEs__value_PR_DRBs_SetupMod_List); + _EQ_CHECK_INT(ie->value.present, F1AP_UEContextModificationResponseIEs__value_PR_DRBs_SetupMod_List); _F1_CHECK_EXP(decode_drbs_setupmod(&ie->value.choice.DRBs_SetupMod_List, &out->drbs_len, &out->drbs)); break; case F1AP_ProtocolIE_ID_id_SRBs_SetupMod_List: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_UEContextModificationResponseIEs__value_PR_SRBs_SetupMod_List); + _EQ_CHECK_INT(ie->value.present, F1AP_UEContextModificationResponseIEs__value_PR_SRBs_SetupMod_List); _F1_CHECK_EXP(decode_srbs_setupmod(&ie->value.choice.SRBs_SetupMod_List, &out->srbs_len, &out->srbs)); break; default: @@ -2097,17 +2097,17 @@ f1ap_ue_context_mod_resp_t cp_ue_context_mod_resp(const f1ap_ue_context_mod_resp */ bool eq_ue_context_mod_resp(const f1ap_ue_context_mod_resp_t *a, const f1ap_ue_context_mod_resp_t *b) { - _F1_EQ_CHECK_INT(a->gNB_CU_ue_id, b->gNB_CU_ue_id); - _F1_EQ_CHECK_INT(a->gNB_DU_ue_id, b->gNB_DU_ue_id); - //_F1_EQ_CHECK_OPTIONAL_IE(a, b, du_to_cu_rrc_info, eq_du_to_cu_rrc_info); - _F1_CHECK_EXP((a->du_to_cu_rrc_info && b->du_to_cu_rrc_info) || (!a->du_to_cu_rrc_info && !b->du_to_cu_rrc_info)); + _EQ_CHECK_INT(a->gNB_CU_ue_id, b->gNB_CU_ue_id); + _EQ_CHECK_INT(a->gNB_DU_ue_id, b->gNB_DU_ue_id); + //_EQ_CHECK_OPTIONAL_IE(a, b, du_to_cu_rrc_info, eq_du_to_cu_rrc_info); + _EQ_CHECK_OPTIONAL_PTR(a, b, du_to_cu_rrc_info); _F1_CHECK_EXP(!a->du_to_cu_rrc_info || eq_du_to_cu_rrc_info(a->du_to_cu_rrc_info, b->du_to_cu_rrc_info)); _F1_CHECK_EXP(a->drbs_len == 0 || (a->drbs && b->drbs)); for (int i = 0; i < a->drbs_len; ++i) _F1_CHECK_EXP(eq_drb_setup(&a->drbs[i], &b->drbs[i])); - _F1_EQ_CHECK_INT(a->srbs_len, b->srbs_len); + _EQ_CHECK_INT(a->srbs_len, b->srbs_len); _F1_CHECK_EXP(a->srbs_len == 0 || (a->srbs && b->srbs)); for (int i = 0; i < a->srbs_len; ++i) _F1_CHECK_EXP(eq_srb_setup(&a->srbs[i], &b->srbs[i])); @@ -2189,15 +2189,15 @@ bool decode_ue_context_rel_req(const struct F1AP_F1AP_PDU *pdu, f1ap_ue_context_ AssertError(ie != NULL, return false, "in->protocolIEs.list.array[i] is NULL"); switch (ie->id) { case F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_UEContextReleaseRequestIEs__value_PR_GNB_CU_UE_F1AP_ID); + _EQ_CHECK_INT(ie->value.present, F1AP_UEContextReleaseRequestIEs__value_PR_GNB_CU_UE_F1AP_ID); out->gNB_CU_ue_id = ie->value.choice.GNB_CU_UE_F1AP_ID; break; case F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_UEContextReleaseRequestIEs__value_PR_GNB_DU_UE_F1AP_ID); + _EQ_CHECK_INT(ie->value.present, F1AP_UEContextReleaseRequestIEs__value_PR_GNB_DU_UE_F1AP_ID); out->gNB_DU_ue_id = ie->value.choice.GNB_DU_UE_F1AP_ID; break; case F1AP_ProtocolIE_ID_id_Cause: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_UEContextReleaseRequestIEs__value_PR_Cause); + _EQ_CHECK_INT(ie->value.present, F1AP_UEContextReleaseRequestIEs__value_PR_Cause); _F1_CHECK_EXP(decode_f1ap_cause(ie->value.choice.Cause, &out->cause, &out->cause_value)); break; default: @@ -2228,10 +2228,10 @@ f1ap_ue_context_rel_req_t cp_ue_context_rel_req(const f1ap_ue_context_rel_req_t */ bool eq_ue_context_rel_req(const f1ap_ue_context_rel_req_t *a, const f1ap_ue_context_rel_req_t *b) { - _F1_EQ_CHECK_INT(a->gNB_CU_ue_id, b->gNB_CU_ue_id); - _F1_EQ_CHECK_INT(a->gNB_DU_ue_id, b->gNB_DU_ue_id); - _F1_EQ_CHECK_INT(a->cause, b->cause); - _F1_EQ_CHECK_LONG(a->cause_value, b->cause_value); + _EQ_CHECK_INT(a->gNB_CU_ue_id, b->gNB_CU_ue_id); + _EQ_CHECK_INT(a->gNB_DU_ue_id, b->gNB_DU_ue_id); + _EQ_CHECK_INT(a->cause, b->cause); + _EQ_CHECK_LONG(a->cause_value, b->cause_value); return true; } @@ -2327,27 +2327,27 @@ bool decode_ue_context_rel_cmd(const struct F1AP_F1AP_PDU *pdu, f1ap_ue_context_ AssertError(ie != NULL, return false, "in->protocolIEs.list.array[i] is NULL"); switch (ie->id) { case F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_UEContextReleaseCommandIEs__value_PR_GNB_CU_UE_F1AP_ID); + _EQ_CHECK_INT(ie->value.present, F1AP_UEContextReleaseCommandIEs__value_PR_GNB_CU_UE_F1AP_ID); out->gNB_CU_ue_id = ie->value.choice.GNB_CU_UE_F1AP_ID; break; case F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_UEContextReleaseCommandIEs__value_PR_GNB_DU_UE_F1AP_ID); + _EQ_CHECK_INT(ie->value.present, F1AP_UEContextReleaseCommandIEs__value_PR_GNB_DU_UE_F1AP_ID); out->gNB_DU_ue_id = ie->value.choice.GNB_DU_UE_F1AP_ID; break; case F1AP_ProtocolIE_ID_id_Cause: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_UEContextReleaseCommandIEs__value_PR_Cause); + _EQ_CHECK_INT(ie->value.present, F1AP_UEContextReleaseCommandIEs__value_PR_Cause); _F1_CHECK_EXP(decode_f1ap_cause(ie->value.choice.Cause, &out->cause, &out->cause_value)); break; case F1AP_ProtocolIE_ID_id_RRCContainer: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_UEContextReleaseCommandIEs__value_PR_RRCContainer); - out->rrc_container = malloc_or_fail(sizeof(*out->rrc_container)); + _EQ_CHECK_INT(ie->value.present, F1AP_UEContextReleaseCommandIEs__value_PR_RRCContainer); + out->rrc_container = malloc_or_fail(sizeof(*out->rrc_container)); { OCTET_STRING_t *os = &ie->value.choice.RRCContainer; *out->rrc_container = create_byte_array(os->size, os->buf); } break; case F1AP_ProtocolIE_ID_id_SRBID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_UEContextReleaseCommandIEs__value_PR_SRBID); + _EQ_CHECK_INT(ie->value.present, F1AP_UEContextReleaseCommandIEs__value_PR_SRBID); { // SRB-ID F1AP_UEContextReleaseCommandIEs_t *check_ie; @@ -2356,7 +2356,7 @@ bool decode_ue_context_rel_cmd(const struct F1AP_F1AP_PDU *pdu, f1ap_ue_context_ _F1_MALLOC(out->srb_id, ie->value.choice.SRBID); break; case F1AP_ProtocolIE_ID_id_oldgNB_DU_UE_F1AP_ID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_UEContextReleaseCommandIEs__value_PR_GNB_DU_UE_F1AP_ID_1); + _EQ_CHECK_INT(ie->value.present, F1AP_UEContextReleaseCommandIEs__value_PR_GNB_DU_UE_F1AP_ID_1); _F1_MALLOC(out->old_gNB_DU_ue_id, ie->value.choice.GNB_DU_UE_F1AP_ID_1); break; default: @@ -2394,13 +2394,13 @@ f1ap_ue_context_rel_cmd_t cp_ue_context_rel_cmd(const f1ap_ue_context_rel_cmd_t */ bool eq_ue_context_rel_cmd(const f1ap_ue_context_rel_cmd_t *a, const f1ap_ue_context_rel_cmd_t *b) { - _F1_EQ_CHECK_INT(a->gNB_CU_ue_id, b->gNB_CU_ue_id); - _F1_EQ_CHECK_INT(a->gNB_DU_ue_id, b->gNB_DU_ue_id); - _F1_EQ_CHECK_INT(a->cause, b->cause); - _F1_EQ_CHECK_LONG(a->cause_value, b->cause_value); - _F1_EQ_CHECK_OPTIONAL_IE(a, b, rrc_container, eq_ba); - _F1_EQ_CHECK_OPTIONAL_IE(a, b, srb_id, _F1_EQ_CHECK_INT); - _F1_EQ_CHECK_OPTIONAL_IE(a, b, old_gNB_DU_ue_id, _F1_EQ_CHECK_INT); + _EQ_CHECK_INT(a->gNB_CU_ue_id, b->gNB_CU_ue_id); + _EQ_CHECK_INT(a->gNB_DU_ue_id, b->gNB_DU_ue_id); + _EQ_CHECK_INT(a->cause, b->cause); + _EQ_CHECK_LONG(a->cause_value, b->cause_value); + _EQ_CHECK_OPTIONAL_IE(a, b, rrc_container, eq_ba); + _EQ_CHECK_OPTIONAL_IE(a, b, srb_id, _EQ_CHECK_INT); + _EQ_CHECK_OPTIONAL_IE(a, b, old_gNB_DU_ue_id, _EQ_CHECK_INT); return true; } @@ -2464,11 +2464,11 @@ bool decode_ue_context_rel_cplt(const struct F1AP_F1AP_PDU *pdu, f1ap_ue_context AssertError(ie != NULL, return false, "in->protocolIEs.list.array[i] is NULL"); switch (ie->id) { case F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_UEContextReleaseCompleteIEs__value_PR_GNB_CU_UE_F1AP_ID); + _EQ_CHECK_INT(ie->value.present, F1AP_UEContextReleaseCompleteIEs__value_PR_GNB_CU_UE_F1AP_ID); out->gNB_CU_ue_id = ie->value.choice.GNB_CU_UE_F1AP_ID; break; case F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID: - _F1_EQ_CHECK_INT(ie->value.present, F1AP_UEContextReleaseCompleteIEs__value_PR_GNB_DU_UE_F1AP_ID); + _EQ_CHECK_INT(ie->value.present, F1AP_UEContextReleaseCompleteIEs__value_PR_GNB_DU_UE_F1AP_ID); out->gNB_DU_ue_id = ie->value.choice.GNB_DU_UE_F1AP_ID; break; default: @@ -2497,8 +2497,8 @@ f1ap_ue_context_rel_cplt_t cp_ue_context_rel_cplt(const f1ap_ue_context_rel_cplt */ bool eq_ue_context_rel_cplt(const f1ap_ue_context_rel_cplt_t *a, const f1ap_ue_context_rel_cplt_t *b) { - _F1_EQ_CHECK_INT(a->gNB_CU_ue_id, b->gNB_CU_ue_id); - _F1_EQ_CHECK_INT(a->gNB_DU_ue_id, b->gNB_DU_ue_id); + _EQ_CHECK_INT(a->gNB_CU_ue_id, b->gNB_CU_ue_id); + _EQ_CHECK_INT(a->gNB_DU_ue_id, b->gNB_DU_ue_id); return true; } diff --git a/openair3/NAS/NR_UE/5GS/5GMM/MSG/FGSNASSecurityModeReject.c b/openair3/NAS/NR_UE/5GS/5GMM/MSG/FGSNASSecurityModeReject.c index 3f61b14ad7..82b8309c87 100644 --- a/openair3/NAS/NR_UE/5GS/5GMM/MSG/FGSNASSecurityModeReject.c +++ b/openair3/NAS/NR_UE/5GS/5GMM/MSG/FGSNASSecurityModeReject.c @@ -22,6 +22,7 @@ #include #include "FGSNASSecurityModeReject.h" #include "common/utils/ds/byte_array.h" +#include "common/utils/eq_check.h" #include "fgmm_lib.h" int encode_fgs_security_mode_reject(byte_array_t *buffer, const fgs_security_mode_reject_msg *msg) @@ -45,6 +46,6 @@ int decode_fgs_security_mode_reject(fgs_security_mode_reject_msg *msg, const byt bool eq_sec_mode_reject(const fgs_security_mode_reject_msg *a, const fgs_security_mode_reject_msg *b) { - _NAS_EQ_CHECK_INT(a->cause, b->cause); + _EQ_CHECK_INT(a->cause, b->cause); return true; } diff --git a/openair3/NAS/NR_UE/5GS/5GMM/MSG/RegistrationAccept.c b/openair3/NAS/NR_UE/5GS/5GMM/MSG/RegistrationAccept.c index bc5c86f88e..70962eb0cc 100644 --- a/openair3/NAS/NR_UE/5GS/5GMM/MSG/RegistrationAccept.c +++ b/openair3/NAS/NR_UE/5GS/5GMM/MSG/RegistrationAccept.c @@ -35,6 +35,7 @@ #include "conversions.h" #include "RegistrationAccept.h" #include "fgs_nas_utils.h" +#include "common/utils/eq_check.h" #include "common/utils/utils.h" #include "ds/byte_array.h" #include "fgmm_lib.h" @@ -47,7 +48,7 @@ static int decode_fgs_registration_result(registration_accept_msg *out, const byte_array_t buffer) { if (buffer.len < FGS_REGISTRATION_RESULT_LEN) { - PRINT_NAS_ERROR("5GS registration result decoding failure: invalid buffer length\n"); + PRINT_ERROR("5GS registration result decoding failure: invalid buffer length\n"); return -1; } out->result = buffer.buf[1] & 0x7; // skip length of contents octet @@ -58,7 +59,7 @@ static int decode_fgs_registration_result(registration_accept_msg *out, const by static int encode_fgs_registration_result(byte_array_t buffer, const registration_accept_msg *out) { if (buffer.len < FGS_REGISTRATION_RESULT_LEN) { - PRINT_NAS_ERROR("5GS registration result encoding failure: invalid buffer length\n"); + PRINT_ERROR("5GS registration result encoding failure: invalid buffer length\n"); return -1; } uint8_t *buf = buffer.buf; @@ -125,7 +126,7 @@ static int decode_nssai_ie(nr_nas_msg_snssai_t *nssai, uint8_t *num_slices, uint break; default: - PRINT_NAS_ERROR("Unknown length in Allowed S-NSSAI list item\n"); + PRINT_ERROR("Unknown length in Allowed S-NSSAI list item\n"); break; } } @@ -139,7 +140,7 @@ size_t decode_registration_accept(registration_accept_msg *registration_accept, byte_array_t ba = buffer; // local copy of buffer if (ba.len < REGISTRATION_ACCEPT_MIN_LEN) { - PRINT_NAS_ERROR("Registration Accept decoding failed: invalid buffer length\n"); + PRINT_ERROR("Registration Accept decoding failed: invalid buffer length\n"); return -1; } @@ -152,7 +153,7 @@ size_t decode_registration_accept(registration_accept_msg *registration_accept, if (ba.len > 0 && ba.buf[0] == IEI_5G_GUTI) { registration_accept->guti = calloc_or_fail(1, sizeof(*registration_accept->guti)); if ((dec = decode_5gs_mobile_identity(registration_accept->guti, IEI_5G_GUTI, ba.buf, ba.len)) < 0) { - PRINT_NAS_ERROR("Failed to decode 5GS Mobile Identity in Registration Accept\n"); + PRINT_ERROR("Failed to decode 5GS Mobile Identity in Registration Accept\n"); return -1; } UPDATE_BYTE_ARRAY(ba, dec); @@ -182,7 +183,7 @@ size_t decode_registration_accept(registration_accept_msg *registration_accept, } } if(ba.len != 0) { - PRINT_NAS_ERROR("Failed to decode registration accept: ba.len = %ld\n", ba.len); + PRINT_ERROR("Failed to decode registration accept: ba.len = %ld\n", ba.len); return -1; } return buffer.len; @@ -209,22 +210,22 @@ int encode_registration_accept(const registration_accept_msg *registration_accep bool eq_snssai(const nr_nas_msg_snssai_t *a, const nr_nas_msg_snssai_t *b) { - _NAS_EQ_CHECK_INT(a->sst, b->sst); + _EQ_CHECK_INT(a->sst, b->sst); if ((a->hplmn_sst && !b->hplmn_sst) || (!a->hplmn_sst && b->hplmn_sst)) return false; if (a->hplmn_sst && b->hplmn_sst) - _NAS_EQ_CHECK_INT(*a->hplmn_sst, *b->hplmn_sst); + _EQ_CHECK_INT(*a->hplmn_sst, *b->hplmn_sst); if ((a->sd && !b->sd) || (!a->sd && b->sd)) return false; if (a->sd && b->sd) - _NAS_EQ_CHECK_INT(*a->sd, *b->sd); + _EQ_CHECK_INT(*a->sd, *b->sd); if ((a->hplmn_sd && !b->hplmn_sd) || (!a->hplmn_sd && b->hplmn_sd)) return false; if (a->hplmn_sd && b->hplmn_sd) - _NAS_EQ_CHECK_INT(*a->hplmn_sd, *b->hplmn_sd); + _EQ_CHECK_INT(*a->hplmn_sd, *b->hplmn_sd); return true; } @@ -233,48 +234,48 @@ bool eq_snssai(const nr_nas_msg_snssai_t *a, const nr_nas_msg_snssai_t *b) bool eq_fgmm_registration_accept(const registration_accept_msg *a, const registration_accept_msg *b) { if (!a || !b) { - PRINT_NAS_ERROR("Null pointer in registration_accept_msg_eq\n"); + PRINT_ERROR("Null pointer in registration_accept_msg_eq\n"); return false; } // 5GS registration result (mandatory) - _NAS_EQ_CHECK_INT(a->result, b->result); - _NAS_EQ_CHECK_INT(a->sms_allowed, b->sms_allowed); + _EQ_CHECK_INT(a->result, b->result); + _EQ_CHECK_INT(a->sms_allowed, b->sms_allowed); // GUTI (optional) if (a->guti && b->guti) { - _NAS_EQ_CHECK_INT(a->guti->guti.spare, b->guti->guti.spare); - _NAS_EQ_CHECK_INT(a->guti->guti.oddeven, b->guti->guti.oddeven); - _NAS_EQ_CHECK_INT(a->guti->guti.typeofidentity, b->guti->guti.typeofidentity); - _NAS_EQ_CHECK_INT(a->guti->guti.mccdigit2, b->guti->guti.mccdigit2); - _NAS_EQ_CHECK_INT(a->guti->guti.mccdigit1, b->guti->guti.mccdigit1); - _NAS_EQ_CHECK_INT(a->guti->guti.mncdigit3, b->guti->guti.mncdigit3); - _NAS_EQ_CHECK_INT(a->guti->guti.mccdigit3, b->guti->guti.mccdigit3); - _NAS_EQ_CHECK_INT(a->guti->guti.mncdigit2, b->guti->guti.mncdigit2); - _NAS_EQ_CHECK_INT(a->guti->guti.mncdigit1, b->guti->guti.mncdigit1); - _NAS_EQ_CHECK_INT(a->guti->guti.amfregionid, b->guti->guti.amfregionid); - _NAS_EQ_CHECK_INT(a->guti->guti.amfsetid, b->guti->guti.amfsetid); - _NAS_EQ_CHECK_INT(a->guti->guti.amfpointer, b->guti->guti.amfpointer); - _NAS_EQ_CHECK_INT(a->guti->guti.tmsi, b->guti->guti.tmsi); + _EQ_CHECK_INT(a->guti->guti.spare, b->guti->guti.spare); + _EQ_CHECK_INT(a->guti->guti.oddeven, b->guti->guti.oddeven); + _EQ_CHECK_INT(a->guti->guti.typeofidentity, b->guti->guti.typeofidentity); + _EQ_CHECK_INT(a->guti->guti.mccdigit2, b->guti->guti.mccdigit2); + _EQ_CHECK_INT(a->guti->guti.mccdigit1, b->guti->guti.mccdigit1); + _EQ_CHECK_INT(a->guti->guti.mncdigit3, b->guti->guti.mncdigit3); + _EQ_CHECK_INT(a->guti->guti.mccdigit3, b->guti->guti.mccdigit3); + _EQ_CHECK_INT(a->guti->guti.mncdigit2, b->guti->guti.mncdigit2); + _EQ_CHECK_INT(a->guti->guti.mncdigit1, b->guti->guti.mncdigit1); + _EQ_CHECK_INT(a->guti->guti.amfregionid, b->guti->guti.amfregionid); + _EQ_CHECK_INT(a->guti->guti.amfsetid, b->guti->guti.amfsetid); + _EQ_CHECK_INT(a->guti->guti.amfpointer, b->guti->guti.amfpointer); + _EQ_CHECK_INT(a->guti->guti.tmsi, b->guti->guti.tmsi); } else if ((a->guti && !b->guti) || (!a->guti && b->guti)) { - PRINT_NAS_ERROR("NAS Equality Check failure: One of the two GUTIs is NULL\n"); + PRINT_ERROR("NAS Equality Check failure: One of the two GUTIs is NULL\n"); return false; } - _NAS_EQ_CHECK_INT(a->num_allowed_slices, b->num_allowed_slices); - _NAS_EQ_CHECK_INT(a->num_configured_slices, b->num_configured_slices); + _EQ_CHECK_INT(a->num_allowed_slices, b->num_allowed_slices); + _EQ_CHECK_INT(a->num_configured_slices, b->num_configured_slices); // Configured NSSAI (optional) for (int i = 0; i < a->num_configured_slices; i++) { if (!eq_snssai(&a->config_nssai[i], &b->config_nssai[i])) { - PRINT_NAS_ERROR("NAS Equality Check failure: Configured NSSAI\n"); + PRINT_ERROR("NAS Equality Check failure: Configured NSSAI\n"); return false; } } // Allowed NSSAI (optional) for (int i = 0; i < a->num_allowed_slices; i++) { if (!eq_snssai(&a->nas_allowed_nssai[i], &b->nas_allowed_nssai[i])) { - PRINT_NAS_ERROR("NAS Equality Check failure: Allowed NSSAI\n"); + PRINT_ERROR("NAS Equality Check failure: Allowed NSSAI\n"); return false; } } diff --git a/openair3/NAS/NR_UE/5GS/5GMM/MSG/fgmm_authentication_failure.c b/openair3/NAS/NR_UE/5GS/5GMM/MSG/fgmm_authentication_failure.c index 2dc865ab4c..e0cf658f61 100644 --- a/openair3/NAS/NR_UE/5GS/5GMM/MSG/fgmm_authentication_failure.c +++ b/openair3/NAS/NR_UE/5GS/5GMM/MSG/fgmm_authentication_failure.c @@ -25,6 +25,7 @@ #include // For malloc and free #include "fgmm_lib.h" #include "common/utils/ds/byte_array.h" +#include "common/utils/eq_check.h" #include "common/utils/utils.h" #define MIN_AUTH_FAILURE_LEN 1 @@ -35,7 +36,7 @@ int encode_fgmm_auth_failure(byte_array_t *buffer, const fgmm_auth_failure_t *msg) { if (buffer->len < MIN_AUTH_FAILURE_LEN) { - PRINT_NAS_ERROR("Missing mandatory IE in Authentication Failure"); + PRINT_ERROR("Missing mandatory IE in Authentication Failure"); return -1; // missing mandatory IE } // 5GMM cause (Mandatory) @@ -44,11 +45,11 @@ int encode_fgmm_auth_failure(byte_array_t *buffer, const fgmm_auth_failure_t *ms if (msg->cause == Synch_failure) { // Authentication failure parameter shall be present with cause Synch Failure if (msg->authentication_failure_param.len == 0) { - PRINT_NAS_ERROR("Authentication Failure Cause is synch failure but Authentication Failure Parameter is not available"); + PRINT_ERROR("Authentication Failure Cause is synch failure but Authentication Failure Parameter is not available"); return -1; } if (buffer->len - encoded < msg->authentication_failure_param.len + 2) { - PRINT_NAS_ERROR("Invalid buffer for encoding of Authentication Failure Parameter"); + PRINT_ERROR("Invalid buffer for encoding of Authentication Failure Parameter"); return -1; } // Encode the IEI @@ -76,7 +77,7 @@ int decode_fgmm_auth_failure(fgmm_auth_failure_t *msg, const byte_array_t *buffe if (iei == AUTH_FAIL_PARAM_IEI) { msg->authentication_failure_param.len = ba.buf[decoded++]; if (msg->authentication_failure_param.len > AUTH_FAILURE_PARAM_LEN - 2) { // maximum length of contents is 14 octets - PRINT_NAS_ERROR("Length of Authentication Failure Parameter contents is too large"); + PRINT_ERROR("Length of Authentication Failure Parameter contents is too large"); return -1; } msg->authentication_failure_param.buf = malloc_or_fail(msg->authentication_failure_param.len); @@ -90,7 +91,7 @@ int decode_fgmm_auth_failure(fgmm_auth_failure_t *msg, const byte_array_t *buffe bool eq_fgmm_auth_failure(const fgmm_auth_failure_t *a, const fgmm_auth_failure_t *b) { - _NAS_EQ_CHECK_INT(a->cause, b->cause); + _EQ_CHECK_INT(a->cause, b->cause); eq_byte_array(&a->authentication_failure_param, &b->authentication_failure_param); return true; } diff --git a/openair3/NAS/NR_UE/5GS/5GMM/MSG/fgmm_authentication_reject.c b/openair3/NAS/NR_UE/5GS/5GMM/MSG/fgmm_authentication_reject.c index 193df8f7dd..2d315e81ed 100644 --- a/openair3/NAS/NR_UE/5GS/5GMM/MSG/fgmm_authentication_reject.c +++ b/openair3/NAS/NR_UE/5GS/5GMM/MSG/fgmm_authentication_reject.c @@ -24,6 +24,7 @@ #include // For htons and ntohs #include // For malloc and free #include "fgmm_lib.h" +#include "common/utils/eq_check.h" #define MIN_AUTH_REJECT_LEN 3 @@ -55,13 +56,13 @@ int decode_fgmm_auth_reject(fgmm_auth_reject_msg_t *msg, const byte_array_t *buf if (iei == IEI_EAPMSG) { return (decoded + decode_eap_msg_ie(&msg->eap_msg, &ba)); } - PRINT_NAS_ERROR("Expected EAP MSG but it is not present"); + PRINT_ERROR("Expected EAP MSG but it is not present"); return -1; } bool eq_auth_reject(fgmm_auth_reject_msg_t *a, fgmm_auth_reject_msg_t *b) { - _NAS_EQ_CHECK_LONG(a->eap_msg.len, b->eap_msg.len); + _EQ_CHECK_LONG(a->eap_msg.len, b->eap_msg.len); if (a->eap_msg.len > 0) { return !memcmp(a->eap_msg.buf, b->eap_msg.buf, a->eap_msg.len); } diff --git a/openair3/NAS/NR_UE/5GS/5GMM/MSG/fgmm_identity_request.c b/openair3/NAS/NR_UE/5GS/5GMM/MSG/fgmm_identity_request.c index b41035f6ea..790a7a842c 100644 --- a/openair3/NAS/NR_UE/5GS/5GMM/MSG/fgmm_identity_request.c +++ b/openair3/NAS/NR_UE/5GS/5GMM/MSG/fgmm_identity_request.c @@ -22,11 +22,12 @@ #include "fgmm_identity_request.h" #include #include "FGSMobileIdentity.h" +#include "common/utils/eq_check.h" int decode_fgs_identity_request(fgs_identity_request_msg_t *msg, const byte_array_t *buffer) { if (buffer->len < 1) { - PRINT_NAS_ERROR("Failed to decode NAS Identity Request: invalid buffer length %ld\n", buffer->len); + PRINT_ERROR("Failed to decode NAS Identity Request: invalid buffer length %ld\n", buffer->len); return -1; } diff --git a/openair3/NAS/NR_UE/5GS/5GMM/MSG/fgmm_lib.c b/openair3/NAS/NR_UE/5GS/5GMM/MSG/fgmm_lib.c index 63c6ec0d32..1d962b4c43 100644 --- a/openair3/NAS/NR_UE/5GS/5GMM/MSG/fgmm_lib.c +++ b/openair3/NAS/NR_UE/5GS/5GMM/MSG/fgmm_lib.c @@ -24,6 +24,7 @@ #include // For htons and ntohs #include // For malloc and free #include "common/utils/ds/byte_array.h" +#include "common/utils/eq_check.h" #define IEI_LEN 1 #define GPRS_TIMER_LENGTH 3 // octets @@ -41,7 +42,7 @@ int encode_pdu_session_ie(byte_array_t *buffer, nas_service_IEI_t iei, const uint8_t *psi) { if (buffer->len < MIN_PDU_SESSION_CONTENTS_LEN + 2) { - PRINT_NAS_ERROR("%s failed: buffer is too small", __func__); + PRINT_ERROR("%s failed: buffer is too small", __func__); return -1; } @@ -83,14 +84,14 @@ int decode_pdu_session_ie(uint8_t *psi, const byte_array_t *buffer) uint8_t *buf = buffer->buf; if (buffer->len < MIN_PDU_SESSION_CONTENTS_LEN + 2) { - PRINT_NAS_ERROR("%s failed: buffer length is too small", __func__); + PRINT_ERROR("%s failed: buffer length is too small", __func__); return -1; } // start decoding from length IE (IEI is decoded in the caller) uint8_t pdu_session_status_len = buf[decoded++]; if (pdu_session_status_len > MAX_PDU_SESSION_CONTENTS_LEN) { - PRINT_NAS_ERROR("decoded length is out of bound for PDU Session Status/Reactivation result\n"); + PRINT_ERROR("decoded length is out of bound for PDU Session Status/Reactivation result\n"); return -1; } @@ -116,7 +117,7 @@ int decode_pdu_session_ie(uint8_t *psi, const byte_array_t *buffer) int encode_gprs_timer_ie(byte_array_t *buffer, nas_service_IEI_t iei, const gprs_timer_t *timer) { if (buffer->len < GPRS_TIMER_LENGTH) { - PRINT_NAS_ERROR("Buffer length is too short to encode the GPRS Timer IE\n"); + PRINT_ERROR("Buffer length is too short to encode the GPRS Timer IE\n"); return -1; } @@ -150,8 +151,8 @@ int decode_gprs_timer_ie(gprs_timer_t *timer, const byte_array_t *buffer) /** @brief Equality check for GPRS Timer */ bool eq_gprs_timer(const gprs_timer_t *a, const gprs_timer_t *b) { - _NAS_EQ_CHECK_INT(a->value, b->value); - _NAS_EQ_CHECK_INT(a->unit, b->unit); + _EQ_CHECK_INT(a->value, b->value); + _EQ_CHECK_INT(a->unit, b->unit); return true; } @@ -162,13 +163,13 @@ int encode_eap_msg_ie(byte_array_t *buffer, const byte_array_t *msg) // Sanity check on buffer length if (buffer->len < MIN_EAP_MSG_LEN) { - PRINT_NAS_ERROR("Invalid buffer length %ld", buffer->len); + PRINT_ERROR("Invalid buffer length %ld", buffer->len); return -1; } // Sanity check on input length if (msg->len < MIN_EAP_CONTENTS_LEN || msg->len > MAX_EAP_CONTENTS_LEN) { - PRINT_NAS_ERROR("Invalid EAP message length %ld", msg->len); + PRINT_ERROR("Invalid EAP message length %ld", msg->len); return -1; } @@ -196,7 +197,7 @@ int decode_eap_msg_ie(byte_array_t *eap_msg, const byte_array_t *buffer) // Check buffer length validity if (buffer->len < min_len_to_decode) { - PRINT_NAS_ERROR("Invalid buffer for decoding EAP message IE"); + PRINT_ERROR("Invalid buffer for decoding EAP message IE"); return -1; } @@ -206,13 +207,13 @@ int decode_eap_msg_ie(byte_array_t *eap_msg, const byte_array_t *buffer) // Check payload length validity if (eap_msg->len < MIN_EAP_CONTENTS_LEN || eap_msg->len > MAX_EAP_CONTENTS_LEN) { - PRINT_NAS_ERROR("Invalid EAP message length %ld", eap_msg->len); + PRINT_ERROR("Invalid EAP message length %ld", eap_msg->len); return -1; } // Check for buffer overflow if (buffer->len < decoded + eap_msg->len) { - PRINT_NAS_ERROR("Buffer too short for EAP message: %ld < %ld", buffer->len, decoded + eap_msg->len); + PRINT_ERROR("Buffer too short for EAP message: %ld < %ld", buffer->len, decoded + eap_msg->len); return -1; } diff --git a/openair3/NAS/NR_UE/5GS/5GMM/MSG/fgmm_service_accept.c b/openair3/NAS/NR_UE/5GS/5GMM/MSG/fgmm_service_accept.c index 63e2901f61..793de6e106 100644 --- a/openair3/NAS/NR_UE/5GS/5GMM/MSG/fgmm_service_accept.c +++ b/openair3/NAS/NR_UE/5GS/5GMM/MSG/fgmm_service_accept.c @@ -25,6 +25,7 @@ #include // For malloc and free #include "common/utils/utils.h" // For malloc_or_fail #include "common/utils/ds/byte_array.h" // For byte_array_t +#include "common/utils/eq_check.h" #include "fgmm_lib.h" /** @brief Encode Service Accept (8.2.17 of 3GPP TS 24.501) */ @@ -53,7 +54,7 @@ int encode_fgs_service_accept(byte_array_t *buffer, const fgs_service_accept_msg // encode length of PDU session reactivation result error cause uint16_t error_len = msg->num_errors * sizeof(msg->cause[0]); if (error_len > MAX_NUM_PDU_ERRORS) { - PRINT_NAS_ERROR("encoded length is out of bound (IEI_PDU_SESSION_REACT_RESULT_ERROR_CAUSE)\n"); + PRINT_ERROR("encoded length is out of bound (IEI_PDU_SESSION_REACT_RESULT_ERROR_CAUSE)\n"); return -1; } uint16_t n_len = htons(error_len); @@ -115,7 +116,7 @@ int decode_fgs_service_accept(fgs_service_accept_msg_t *msg, const byte_array_t uint16_t error_len = ntohs(tmp); decoded += sizeof(error_len); if (error_len > MAX_NUM_PDU_ERRORS * sizeof(msg->cause[0])) { - PRINT_NAS_ERROR("IEI_PDU_SESSION_REACT_RESULT_ERROR_CAUSE: decoded length is out of bound\n"); + PRINT_ERROR("IEI_PDU_SESSION_REACT_RESULT_ERROR_CAUSE: decoded length is out of bound\n"); return -1; } // Decode each PDU Session ID and Cause @@ -137,7 +138,7 @@ int decode_fgs_service_accept(fgs_service_accept_msg_t *msg, const byte_array_t break; default: - PRINT_NAS_ERROR("Unkwown or invalid IEI %d\n", iei); + PRINT_ERROR("Unkwown or invalid IEI %d\n", iei); return -1; } } @@ -150,26 +151,26 @@ int decode_fgs_service_accept(fgs_service_accept_msg_t *msg, const byte_array_t */ bool eq_service_accept(const fgs_service_accept_msg_t *a, const fgs_service_accept_msg_t *b) { - _NAS_EQ_CHECK_INT(a->has_psi_status, b->has_psi_status); + _EQ_CHECK_INT(a->has_psi_status, b->has_psi_status); if (a->has_psi_status && b->has_psi_status) { for (int i = 0; i < MAX_NUM_PSI; i++) - _NAS_EQ_CHECK_INT(a->psi_status[i], b->psi_status[i]); + _EQ_CHECK_INT(a->psi_status[i], b->psi_status[i]); } - _NAS_EQ_CHECK_INT(a->has_psi_res, b->has_psi_res); + _EQ_CHECK_INT(a->has_psi_res, b->has_psi_res); if (a->has_psi_res && b->has_psi_res) { for (int i = 0; i < MAX_NUM_PSI; i++) - _NAS_EQ_CHECK_INT(a->psi_res[i], b->psi_res[i]); + _EQ_CHECK_INT(a->psi_res[i], b->psi_res[i]); } - _NAS_EQ_CHECK_INT(a->num_errors, b->num_errors); + _EQ_CHECK_INT(a->num_errors, b->num_errors); if (a->num_errors && b->num_errors) { for (int i = 0; i < a->num_errors; i++) { - _NAS_EQ_CHECK_INT(a->cause[i].cause, b->cause[i].cause); - _NAS_EQ_CHECK_INT(a->cause[i].pdu_session_id, b->cause[i].pdu_session_id); + _EQ_CHECK_INT(a->cause[i].cause, b->cause[i].cause); + _EQ_CHECK_INT(a->cause[i].pdu_session_id, b->cause[i].pdu_session_id); } } if (a->t3448 != NULL || b->t3448 != NULL) { if (a->t3448 == NULL || b->t3448 == NULL) { - PRINT_NAS_ERROR("t3448 equality check failed\n"); + PRINT_ERROR("t3448 equality check failed\n"); return false; } if (!eq_gprs_timer(a->t3448, b->t3448)) diff --git a/openair3/NAS/NR_UE/5GS/5GMM/MSG/fgmm_service_reject.c b/openair3/NAS/NR_UE/5GS/5GMM/MSG/fgmm_service_reject.c index 14078637a3..d7bd448407 100644 --- a/openair3/NAS/NR_UE/5GS/5GMM/MSG/fgmm_service_reject.c +++ b/openair3/NAS/NR_UE/5GS/5GMM/MSG/fgmm_service_reject.c @@ -25,6 +25,7 @@ #include // For malloc and free #include "common/utils/ds/byte_array.h" #include "common/utils/utils.h" +#include "common/utils/eq_check.h" #include "fgmm_lib.h" #define SERVICE_REJECT_MIN_LEN 1 // 1 octet @@ -33,7 +34,7 @@ int encode_fgs_service_reject(byte_array_t *buffer, const fgs_service_reject_msg_t *msg) { if (buffer->len < SERVICE_REJECT_MIN_LEN) { - PRINT_NAS_ERROR("Failed to encode Service Reject: missing Cause IE!\n"); + PRINT_ERROR("Failed to encode Service Reject: missing Cause IE!\n"); return -1; } @@ -71,7 +72,7 @@ int encode_fgs_service_reject(byte_array_t *buffer, const fgs_service_reject_msg int decode_fgs_service_reject(fgs_service_reject_msg_t *msg, const byte_array_t *buffer) { if (buffer->len < SERVICE_REJECT_MIN_LEN) { - PRINT_NAS_ERROR("Nothing to decode: missing Cause IE!\n"); + PRINT_ERROR("Nothing to decode: missing Cause IE!\n"); return -1; } @@ -112,11 +113,11 @@ int decode_fgs_service_reject(fgs_service_reject_msg_t *msg, const byte_array_t int cag_len = cag_list_len + 2; // encoded content + 2 octets for the length IE decoded += cag_len; UPDATE_BYTE_ARRAY(ba, cag_len); - PRINT_NAS_ERROR("CAG information list IE in NAS Service Reject is not handled\n"); + PRINT_ERROR("CAG information list IE in NAS Service Reject is not handled\n"); } break; default: - PRINT_NAS_ERROR("Uknown or invalid NAS Service Reject IEI %d\n", iei); + PRINT_ERROR("Uknown or invalid NAS Service Reject IEI %d\n", iei); return -1; } } @@ -127,15 +128,15 @@ int decode_fgs_service_reject(fgs_service_reject_msg_t *msg, const byte_array_t /** @brief Equality check for Service Reject (enc/dec) */ bool eq_service_reject(const fgs_service_reject_msg_t *a, const fgs_service_reject_msg_t *b) { - _NAS_EQ_CHECK_INT(a->cause, b->cause); - _NAS_EQ_CHECK_INT(a->has_psi_status, b->has_psi_status); + _EQ_CHECK_INT(a->cause, b->cause); + _EQ_CHECK_INT(a->has_psi_status, b->has_psi_status); if (a->has_psi_status && b->has_psi_status) { for (int i = 0; i < MAX_NUM_PSI; i++) - _NAS_EQ_CHECK_INT(a->psi_status[i], b->psi_status[i]); + _EQ_CHECK_INT(a->psi_status[i], b->psi_status[i]); } if (a->t3448 != NULL || b->t3448 != NULL) { if (a->t3448 == NULL || b->t3448 == NULL) { - PRINT_NAS_ERROR("t3448 equality check failed\n"); + PRINT_ERROR("t3448 equality check failed\n"); return false; } if (!eq_gprs_timer(a->t3448, b->t3448)) @@ -143,7 +144,7 @@ bool eq_service_reject(const fgs_service_reject_msg_t *a, const fgs_service_reje } if (a->t3446 != NULL || b->t3446 != NULL) { if (a->t3446 == NULL || b->t3446 == NULL) { - PRINT_NAS_ERROR("t3448 equality check failed\n"); + PRINT_ERROR("t3448 equality check failed\n"); return false; } if (!eq_gprs_timer(a->t3446, b->t3446)) diff --git a/openair3/NAS/NR_UE/5GS/5GSM/MSG/PduSessionEstablishmentAccept.c b/openair3/NAS/NR_UE/5GS/5GSM/MSG/PduSessionEstablishmentAccept.c index f59111cf43..1c0b0030ea 100644 --- a/openair3/NAS/NR_UE/5GS/5GSM/MSG/PduSessionEstablishmentAccept.c +++ b/openair3/NAS/NR_UE/5GS/5GSM/MSG/PduSessionEstablishmentAccept.c @@ -205,7 +205,7 @@ int decode_pdu_session_establishment_accept_msg(pdu_session_establishment_accept } default: - PRINT_NAS_ERROR("Unknown IEI %d\n", psea_iei); + PRINT_ERROR("Unknown IEI %d\n", psea_iei); curPtr = buffer + msg_length; // we force stop processing break; } diff --git a/openair3/NAS/NR_UE/5GS/CMakeLists.txt b/openair3/NAS/NR_UE/5GS/CMakeLists.txt index 9a7feabb72..7d554a198a 100644 --- a/openair3/NAS/NR_UE/5GS/CMakeLists.txt +++ b/openair3/NAS/NR_UE/5GS/CMakeLists.txt @@ -3,6 +3,9 @@ add_subdirectory(5GMM/IES) add_subdirectory(5GSM/MSG) if(ENABLE_TESTS) + target_compile_definitions(fgs_5gmm_lib PRIVATE ENABLE_TESTS) + target_compile_definitions(fgs_5gmm_ies_lib PRIVATE ENABLE_TESTS) + target_compile_definitions(fgs_5gsm_lib PRIVATE ENABLE_TESTS) add_subdirectory(tests) endif() add_library(fgs_lib fgs_nas_lib.c) @@ -16,3 +19,7 @@ target_link_libraries(fgs_lib PUBLIC ) target_include_directories(fgs_lib PUBLIC . 5GMM/MSG 5GMM/IES) + +if(ENABLE_TESTS) + target_compile_definitions(fgs_lib PRIVATE ENABLE_TESTS) +endif() diff --git a/openair3/NAS/NR_UE/5GS/fgs_nas_lib.c b/openair3/NAS/NR_UE/5GS/fgs_nas_lib.c index 3fcd82aa9b..62731c3960 100644 --- a/openair3/NAS/NR_UE/5GS/fgs_nas_lib.c +++ b/openair3/NAS/NR_UE/5GS/fgs_nas_lib.c @@ -22,6 +22,7 @@ #include "NR_NAS_defs.h" #include "nas_log.h" #include "TLVEncoder.h" +#include "common/utils/eq_check.h" #include "fgs_nas_utils.h" int _nas_mm_msg_encode_header(const fgmm_msg_header_t *header, uint8_t *buffer, uint32_t len) @@ -56,7 +57,7 @@ int mm_msg_encode(const fgmm_nas_message_plain_t *p, uint8_t *buffer, uint32_t l int enc_header = _nas_mm_msg_encode_header(&p->header, buffer, len); if (enc_header < 0) { - PRINT_NAS_ERROR("Failed to encode 5GMM message header\n"); + PRINT_ERROR("Failed to encode 5GMM message header\n"); return enc_header; } @@ -104,7 +105,7 @@ int mm_msg_encode(const fgmm_nas_message_plain_t *p, uint8_t *buffer, uint32_t l } if (enc_msg < 0) { - PRINT_NAS_ERROR("Failed to encode 5GMM message\n"); + PRINT_ERROR("Failed to encode 5GMM message\n"); return enc_msg; } @@ -116,7 +117,7 @@ int nas_protected_security_header_encode(uint8_t *buffer, const fgs_nas_message_ int size = 0; if (length < sizeof(fgs_nas_message_security_header_t)) { - PRINT_NAS_ERROR("Could not encode the NAS security header\n"); + PRINT_ERROR("Could not encode the NAS security header\n"); return -1; } @@ -140,7 +141,7 @@ int nas_protected_security_header_encode(uint8_t *buffer, const fgs_nas_message_ uint8_t decode_5gmm_msg_header(fgmm_msg_header_t *mm_header, const uint8_t *buffer, uint32_t len) { if (len < sizeof(fgmm_msg_header_t)) { - PRINT_NAS_ERROR("Failed to decode plain 5GMM header: buffer length too short\n"); + PRINT_ERROR("Failed to decode plain 5GMM header: buffer length too short\n"); return -1; } mm_header->ex_protocol_discriminator = *buffer++; @@ -155,7 +156,7 @@ uint8_t decode_5gmm_msg_header(fgmm_msg_header_t *mm_header, const uint8_t *buff uint8_t decode_5gsm_msg_header(fgsm_msg_header_t *sm_header, const uint8_t *buffer, uint32_t len) { if (len < sizeof(fgsm_msg_header_t)) { - PRINT_NAS_ERROR("Failed to decode plain 5GSM header: buffer length too short\n"); + PRINT_ERROR("Failed to decode plain 5GSM header: buffer length too short\n"); return -1; } sm_header->ex_protocol_discriminator = *buffer++; @@ -172,7 +173,7 @@ int decode_5gs_security_protected_header(fgs_nas_message_security_header_t *head { int decoded = 0; if (len < sizeof(fgs_nas_message_security_header_t)) { - PRINT_NAS_ERROR("Failed to decode security protected 5GS header: buffer length too short\n"); + PRINT_ERROR("Failed to decode security protected 5GS header: buffer length too short\n"); return -1; } header->protocol_discriminator = *buf++; diff --git a/openair3/NAS/NR_UE/5GS/fgs_nas_utils.h b/openair3/NAS/NR_UE/5GS/fgs_nas_utils.h index 7df312a757..e6c03cb635 100644 --- a/openair3/NAS/NR_UE/5GS/fgs_nas_utils.h +++ b/openair3/NAS/NR_UE/5GS/fgs_nas_utils.h @@ -26,24 +26,8 @@ #include #include // For memcpy #include - -#define PRINT_NAS_ERROR(...) fprintf(stderr, ##__VA_ARGS__) - -#define _NAS_EQ_CHECK_GENERIC(condition, fmt, ...) \ - do { \ - if (!(condition)) { \ - PRINT_NAS_ERROR("NAS Equality Check failure: %s:%d: Condition '%s' failed: " fmt " != " fmt "\n", \ - __FILE__, \ - __LINE__, \ - #condition, \ - ##__VA_ARGS__); \ - return false; \ - } \ - } while (0) - -#define _NAS_EQ_CHECK_LONG(A, B) _NAS_EQ_CHECK_GENERIC(A == B, "%ld", A, B); -#define _NAS_EQ_CHECK_INT(A, B) _NAS_EQ_CHECK_GENERIC(A == B, "%d", A, B); -#define _NAS_EQ_CHECK_STR(A, B) _NAS_EQ_CHECK_GENERIC(strcmp(A, B) == 0, "'%s'", A, B); +#include "utils.h" // text_info_t, TO_ENUM, TO_TEXT +#include "common/utils/eq_check.h" /* Map task id to printable name. */ typedef struct { From e062f401377d6aff90df27604a91889005862da5 Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Mon, 29 Dec 2025 19:38:23 +0100 Subject: [PATCH 23/37] Refactor (NGAP): extract PDU session management procedures to dedicated library PDU session related NGAP messages do not belong to NAS procedures lib. * Create ngap_gNB_pdu_session_management.c and .h * Move out ngap_gNB_pdusession_setup_resp, ngap_gNB_pdusession_modify_resp, ngap_gNB_pdusession_release_resp from ngap_gNB_nas_procedures.c * Move encode_ngap_pdusession_setup_response_transfer to ngap_common.c: this transfer IE is common used both in PDU Session Management and Initial Context Setup, so it's moved to the common lib * Add ngap_gNB_pdu_session_management.c to CMakeLists.txt --- CMakeLists.txt | 1 + openair3/NGAP/ngap_common.c | 40 ++ openair3/NGAP/ngap_common.h | 2 +- openair3/NGAP/ngap_gNB.c | 1 + openair3/NGAP/ngap_gNB_handlers.c | 1 + openair3/NGAP/ngap_gNB_nas_procedures.c | 409 ----------------- openair3/NGAP/ngap_gNB_nas_procedures.h | 9 - .../NGAP/ngap_gNB_pdu_session_management.c | 425 ++++++++++++++++++ .../NGAP/ngap_gNB_pdu_session_management.h | 36 ++ 9 files changed, 505 insertions(+), 419 deletions(-) create mode 100644 openair3/NGAP/ngap_gNB_pdu_session_management.c create mode 100644 openair3/NGAP/ngap_gNB_pdu_session_management.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 015e66e46d..f0b080f5c8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -435,6 +435,7 @@ add_library(ngap ${NGAP_DIR}/ngap_gNB_itti_messaging.c ${NGAP_DIR}/ngap_gNB_management_procedures.c ${NGAP_DIR}/ngap_gNB_nas_procedures.c + ${NGAP_DIR}/ngap_gNB_pdu_session_management.c ${NGAP_DIR}/ngap_gNB_nnsf.c ${NGAP_DIR}/ngap_gNB_overload.c ${NGAP_DIR}/ngap_gNB_trace.c diff --git a/openair3/NGAP/ngap_common.c b/openair3/NGAP/ngap_common.c index 8be57349ec..b5cb2c78be 100644 --- a/openair3/NGAP/ngap_common.c +++ b/openair3/NGAP/ngap_common.c @@ -271,3 +271,43 @@ bool decodePDUSessionResourceSetup(pdusession_transfer_t *out, const OCTET_STRIN return true; } + +/** @brief PDU Session Resource Setup Response Transfer encoding (9.3.4.2 3GPP TS 38.413) */ +byte_array_t encode_ngap_pdusession_setup_response_transfer(const pdusession_setup_t *pdusession) +{ + NGAP_PDUSessionResourceSetupResponseTransfer_t pdusessionTransfer = {0}; + byte_array_t out = {0}; + + // DL QoS Flow per TNL Information (Mandatory) + NGAP_QosFlowPerTNLInformation_t *dLQosFlowPerTNLInformation = &pdusessionTransfer.dLQosFlowPerTNLInformation; + + // UP Transport Layer Information (Mandatory) + dLQosFlowPerTNLInformation->uPTransportLayerInformation.present = NGAP_UPTransportLayerInformation_PR_gTPTunnel; + asn1cCalloc(dLQosFlowPerTNLInformation->uPTransportLayerInformation.choice.gTPTunnel, gtp); + GTP_TEID_TO_ASN1(pdusession->n3_outgoing.teid, >p->gTP_TEID); + tnl_to_bitstring(>p->transportLayerAddress, pdusession->n3_outgoing.addr); + char ip_str[INET_ADDRSTRLEN] = {0}; + inet_ntop(AF_INET, gtp->transportLayerAddress.buf, ip_str, sizeof(ip_str)); + NGAP_DEBUG("Encoded PDU Session Transfer (%d): TEID=0x%08x, Addr=%s\n", + pdusession->pdusession_id, + pdusession->n3_outgoing.teid, + ip_str); + + // Associated QoS Flow List (Mandatory) + for (int j = 0; j < pdusession->nb_of_qos_flow; j++) { + asn1cSequenceAdd(dLQosFlowPerTNLInformation->associatedQosFlowList.list, NGAP_AssociatedQosFlowItem_t, qos_item); + // QoS Flow Identifier (Mandatory) + qos_item->qosFlowIdentifier = pdusession->associated_qos_flows[j].qfi; + } + + // Encode + asn_encode_to_new_buffer_result_t res = asn_encode_to_new_buffer(NULL, + ATS_ALIGNED_CANONICAL_PER, + &asn_DEF_NGAP_PDUSessionResourceSetupResponseTransfer, + &pdusessionTransfer); + AssertFatal(res.buffer, "ASN1 message encoding failed (%s, %lu)!\n", res.result.failed_type->name, res.result.encoded); + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NGAP_PDUSessionResourceSetupResponseTransfer, &pdusessionTransfer); + out.buf = res.buffer; + out.len = res.result.encoded; + return out; +} diff --git a/openair3/NGAP/ngap_common.h b/openair3/NGAP/ngap_common.h index 986a7b59bf..fcd999ae33 100644 --- a/openair3/NGAP/ngap_common.h +++ b/openair3/NGAP/ngap_common.h @@ -91,7 +91,7 @@ void encode_ngap_nr_cgi(NGAP_NR_CGI_t *out, const plmn_id_t *plmn, const uint32_ pdusession_level_qos_parameter_t fill_qos(uint8_t qfi, const NGAP_QosFlowLevelQosParameters_t *params); void *decode_pdusession_transfer(const asn_TYPE_descriptor_t *td, const OCTET_STRING_t buf); bool decodePDUSessionResourceSetup(pdusession_transfer_t *out, const OCTET_STRING_t in); +byte_array_t encode_ngap_pdusession_setup_response_transfer(const pdusession_setup_t *pdusession); /** @}*/ - #endif /* NGAP_COMMON_H_ */ diff --git a/openair3/NGAP/ngap_gNB.c b/openair3/NGAP/ngap_gNB.c index b03e153486..257ca25f1a 100644 --- a/openair3/NGAP/ngap_gNB.c +++ b/openair3/NGAP/ngap_gNB.c @@ -57,6 +57,7 @@ #include "ngap_messages_types.h" #include "ngap_gNB_mobility_management.h" #include "ngap_gNB_ue_context.h" +#include "ngap_gNB_pdu_session_management.h" #include "oai_asn1.h" #include "openair3/SECU/kdf.h" #include "queue.h" diff --git a/openair3/NGAP/ngap_gNB_handlers.c b/openair3/NGAP/ngap_gNB_handlers.c index 292ab1635d..1e5b024190 100644 --- a/openair3/NGAP/ngap_gNB_handlers.c +++ b/openair3/NGAP/ngap_gNB_handlers.c @@ -47,6 +47,7 @@ #include "ngap_gNB_nnsf.h" #include "ngap_gNB_management_procedures.h" #include "ngap_gNB_mobility_management.h" +#include "ngap_gNB_pdu_session_management.h" #include "ngap_gNB_nas_procedures.h" #include "ngap_gNB_trace.h" #include "ngap_gNB_ue_context.h" diff --git a/openair3/NGAP/ngap_gNB_nas_procedures.c b/openair3/NGAP/ngap_gNB_nas_procedures.c index 8a2cfeead5..2d4bd3eefa 100644 --- a/openair3/NGAP/ngap_gNB_nas_procedures.c +++ b/openair3/NGAP/ngap_gNB_nas_procedures.c @@ -558,64 +558,6 @@ int ngap_gNB_nas_non_delivery_ind(instance_t instance, return 0; } -/** @brief PDU Session Resource Setup Response Transfer encoding (9.3.4.2 3GPP TS 38.413) */ -static byte_array_t encode_ngap_pdusession_setup_response_transfer(const pdusession_setup_t *pdusession) -{ - NGAP_PDUSessionResourceSetupResponseTransfer_t pdusessionTransfer = {0}; - byte_array_t out = {0}; - - // DL QoS Flow per TNL Information (Mandatory) - NGAP_QosFlowPerTNLInformation_t *dLQosFlowPerTNLInformation = &pdusessionTransfer.dLQosFlowPerTNLInformation; - - // UP Transport Layer Information (Mandatory) - dLQosFlowPerTNLInformation->uPTransportLayerInformation.present = NGAP_UPTransportLayerInformation_PR_gTPTunnel; - asn1cCalloc(dLQosFlowPerTNLInformation->uPTransportLayerInformation.choice.gTPTunnel, gtp); - GTP_TEID_TO_ASN1(pdusession->n3_outgoing.teid, >p->gTP_TEID); - tnl_to_bitstring(>p->transportLayerAddress, pdusession->n3_outgoing.addr); - char ip_str[INET_ADDRSTRLEN] = {0}; - inet_ntop(AF_INET, gtp->transportLayerAddress.buf, ip_str, sizeof(ip_str)); - NGAP_DEBUG("Encoded PDU Session Transfer (%d): TEID=0x%08x, Addr=%s\n", - pdusession->pdusession_id, - pdusession->n3_outgoing.teid, - ip_str); - - // Associated QoS Flow List (Mandatory) - for (int j = 0; j < pdusession->nb_of_qos_flow; j++) { - asn1cSequenceAdd(dLQosFlowPerTNLInformation->associatedQosFlowList.list, NGAP_AssociatedQosFlowItem_t, qos_item); - // QoS Flow Identifier (Mandatory) - qos_item->qosFlowIdentifier = pdusession->associated_qos_flows[j].qfi; - } - - // Encode - asn_encode_to_new_buffer_result_t res = asn_encode_to_new_buffer(NULL, - ATS_ALIGNED_CANONICAL_PER, - &asn_DEF_NGAP_PDUSessionResourceSetupResponseTransfer, - &pdusessionTransfer); - AssertFatal(res.buffer, "ASN1 message encoding failed (%s, %lu)!\n", res.result.failed_type->name, res.result.encoded); - ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NGAP_PDUSessionResourceSetupResponseTransfer, &pdusessionTransfer); - out.buf = res.buffer; - out.len = res.result.encoded; - return out; -} - -/** @brief PDU Session Resource Release Response Transfer encoding (9.3.4.21 3GPP TS 38.413) - * The transfer structure contains only an optional Secondary RAT Usage Information IE. - * Since we don't use secondary RAT (MR-DC), we encode an empty structure. */ -static byte_array_t encode_ngap_pdusession_release_response_transfer(void) -{ - NGAP_PDUSessionResourceReleaseResponseTransfer_t pdusessionTransfer = {0}; - - // Encode - asn_encode_to_new_buffer_result_t res = asn_encode_to_new_buffer(NULL, - ATS_ALIGNED_CANONICAL_PER, - &asn_DEF_NGAP_PDUSessionResourceReleaseResponseTransfer, - &pdusessionTransfer); - AssertFatal(res.buffer, "ASN1 message encoding failed (%s, %lu)!\n", res.result.failed_type->name, res.result.encoded); - ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NGAP_PDUSessionResourceReleaseResponseTransfer, &pdusessionTransfer); - byte_array_t out = {.buf = res.buffer, .len = res.result.encoded}; - return out; -} - //------------------------------------------------------------------------------ int ngap_gNB_initial_ctxt_resp(instance_t instance, ngap_initial_context_setup_resp_t *initial_ctxt_resp_p) //------------------------------------------------------------------------------ @@ -909,354 +851,3 @@ int ngap_gNB_ue_capabilities(instance_t instance, ngap_ue_cap_info_ind_t *ue_cap ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NGAP_NGAP_PDU, &pdu); return 0; } - -//------------------------------------------------------------------------------ -int ngap_gNB_pdusession_setup_resp(instance_t instance, ngap_pdusession_setup_resp_t *pdusession_setup_resp_p) -//------------------------------------------------------------------------------ -{ - ngap_gNB_instance_t *ngap_gNB_instance_p = NULL; - struct ngap_gNB_ue_context_s *ue_context_p = NULL; - NGAP_NGAP_PDU_t pdu = {0}; - uint8_t *buffer = NULL; - uint32_t length; - - /* Retrieve the NGAP gNB instance associated with Mod_id */ - ngap_gNB_instance_p = ngap_gNB_get_instance(instance); - DevAssert(pdusession_setup_resp_p != NULL); - DevAssert(ngap_gNB_instance_p != NULL); - - if ((ue_context_p = ngap_get_ue_context(pdusession_setup_resp_p->gNB_ue_ngap_id)) == NULL) { - /* The context for this gNB ue ngap id doesn't exist in the map of gNB UEs */ - NGAP_WARN("Failed to find ue context associated with gNB ue ngap id: 0x%08x\n", pdusession_setup_resp_p->gNB_ue_ngap_id); - return -1; - } - - /* Uplink NAS transport can occur either during an ngap connected state - * or during initial attach (for example: NAS authentication). - */ - if (!(ue_context_p->ue_state == NGAP_UE_CONNECTED || ue_context_p->ue_state == NGAP_UE_WAITING_CSR)) { - NGAP_WARN( - "You are attempting to send NAS data over non-connected " - "gNB ue ngap id: %08x, current state: %d\n", - pdusession_setup_resp_p->gNB_ue_ngap_id, - ue_context_p->ue_state); - return -1; - } - - /* Prepare the NGAP message to encode */ - pdu.present = NGAP_NGAP_PDU_PR_successfulOutcome; - asn1cCalloc(pdu.choice.successfulOutcome, successfulOutcome); - successfulOutcome->procedureCode = NGAP_ProcedureCode_id_PDUSessionResourceSetup; - successfulOutcome->criticality = NGAP_Criticality_reject; - successfulOutcome->value.present = NGAP_SuccessfulOutcome__value_PR_PDUSessionResourceSetupResponse; - NGAP_PDUSessionResourceSetupResponse_t *out = &successfulOutcome->value.choice.PDUSessionResourceSetupResponse; - /* mandatory */ - { - asn1cSequenceAdd(out->protocolIEs.list, NGAP_PDUSessionResourceSetupResponseIEs_t, ie); - ie->id = NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID; - ie->criticality = NGAP_Criticality_ignore; - ie->value.present = NGAP_PDUSessionResourceSetupResponseIEs__value_PR_AMF_UE_NGAP_ID; - asn_uint642INTEGER(&ie->value.choice.AMF_UE_NGAP_ID, ue_context_p->amf_ue_ngap_id); - } - /* mandatory */ - { - asn1cSequenceAdd(out->protocolIEs.list, NGAP_PDUSessionResourceSetupResponseIEs_t, ie); - ie->id = NGAP_ProtocolIE_ID_id_RAN_UE_NGAP_ID; - ie->criticality = NGAP_Criticality_ignore; - ie->value.present = NGAP_PDUSessionResourceSetupResponseIEs__value_PR_RAN_UE_NGAP_ID; - ie->value.choice.RAN_UE_NGAP_ID = pdusession_setup_resp_p->gNB_ue_ngap_id; - } - - /* optional */ - if (pdusession_setup_resp_p->nb_of_pdusessions > 0) { - asn1cSequenceAdd(out->protocolIEs.list, NGAP_PDUSessionResourceSetupResponseIEs_t, ie3); - ie3->id = NGAP_ProtocolIE_ID_id_PDUSessionResourceSetupListSURes; - ie3->criticality = NGAP_Criticality_ignore; - ie3->value.present = NGAP_PDUSessionResourceSetupResponseIEs__value_PR_PDUSessionResourceSetupListSURes; - - for (int i = 0; i < pdusession_setup_resp_p->nb_of_pdusessions; i++) { - pdusession_setup_t *pdusession = pdusession_setup_resp_p->pdusessions + i; - asn1cSequenceAdd(ie3->value.choice.PDUSessionResourceSetupListSURes.list, NGAP_PDUSessionResourceSetupItemSURes_t, item); - /* pDUSessionID */ - item->pDUSessionID = pdusession->pdusession_id; - - // PDU Session Resource Setup Response Transfer (Mandatory) - byte_array_t ba = encode_ngap_pdusession_setup_response_transfer(pdusession); - item->pDUSessionResourceSetupResponseTransfer.buf = ba.buf; - item->pDUSessionResourceSetupResponseTransfer.size = ba.len; - } - } - - /* optional */ - if (pdusession_setup_resp_p->nb_of_pdusessions_failed > 0) { - asn1cSequenceAdd(out->protocolIEs.list, NGAP_PDUSessionResourceSetupResponseIEs_t, ie); - ie->id = NGAP_ProtocolIE_ID_id_PDUSessionResourceFailedToSetupListSURes; - ie->criticality = NGAP_Criticality_ignore; - ie->value.present = NGAP_PDUSessionResourceSetupResponseIEs__value_PR_PDUSessionResourceFailedToSetupListSURes; - - for (int i = 0; i < pdusession_setup_resp_p->nb_of_pdusessions_failed; i++) { - pdusession_failed_t *pdusession_failed = pdusession_setup_resp_p->pdusessions_failed + i; - asn1cSequenceAdd(ie->value.choice.PDUSessionResourceFailedToSetupListSURes.list, NGAP_PDUSessionResourceFailedToSetupItemSURes_t, item); - NGAP_PDUSessionResourceSetupUnsuccessfulTransfer_t pdusessionUnTransfer_p = {0}; - - /* pDUSessionID */ - item->pDUSessionID = pdusession_failed->pdusession_id; - - /* cause */ - encode_ngap_cause(&pdusessionUnTransfer_p.cause, &pdusession_failed->cause); - NGAP_INFO("pdusession setup response: failed pdusession ID %ld\n", item->pDUSessionID); - - asn_encode_to_new_buffer_result_t res = asn_encode_to_new_buffer(NULL, ATS_ALIGNED_CANONICAL_PER, &asn_DEF_NGAP_PDUSessionResourceSetupUnsuccessfulTransfer, &pdusessionUnTransfer_p); - item->pDUSessionResourceSetupUnsuccessfulTransfer.buf = res.buffer; - item->pDUSessionResourceSetupUnsuccessfulTransfer.size = res.result.encoded; - - ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NGAP_PDUSessionResourceSetupUnsuccessfulTransfer, &pdusessionUnTransfer_p); - } - } - - /* optional */ - if (0) { - asn1cSequenceAdd(out->protocolIEs.list, NGAP_PDUSessionResourceSetupResponseIEs_t, ie); - ie->id = NGAP_ProtocolIE_ID_id_CriticalityDiagnostics; - ie->criticality = NGAP_Criticality_ignore; - ie->value.present = NGAP_PDUSessionResourceSetupResponseIEs__value_PR_CriticalityDiagnostics; - // ie->value.choice.CriticalityDiagnostics = ; - } - - if (ngap_gNB_encode_pdu(&pdu, &buffer, &length) < 0) { - NGAP_ERROR("Failed to encode uplink transport\n"); - /* Encode procedure has failed... */ - ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NGAP_NGAP_PDU, &pdu); - return -1; - } - - /* UE associated signalling -> use the allocated stream */ - ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance, ue_context_p->amf_ref->assoc_id, buffer, length, ue_context_p->tx_stream); - ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NGAP_NGAP_PDU, &pdu); - return 0; -} - -//------------------------------------------------------------------------------ -int ngap_gNB_pdusession_modify_resp(instance_t instance, ngap_pdusession_modify_resp_t *pdusession_modify_resp_p) -//------------------------------------------------------------------------------ -{ - ngap_gNB_instance_t *ngap_gNB_instance_p = NULL; - struct ngap_gNB_ue_context_s *ue_context_p = NULL; - NGAP_NGAP_PDU_t pdu; - uint8_t *buffer = NULL; - uint32_t length; - - /* Retrieve the NGAP gNB instance associated with Mod_id */ - ngap_gNB_instance_p = ngap_gNB_get_instance(instance); - DevAssert(pdusession_modify_resp_p != NULL); - DevAssert(ngap_gNB_instance_p != NULL); - - if ((ue_context_p = ngap_get_ue_context(pdusession_modify_resp_p->gNB_ue_ngap_id)) == NULL) { - /* The context for this gNB ue ngap id doesn't exist in the map of gNB UEs */ - NGAP_WARN("Failed to find ue context associated with gNB ue ngap id: 0x%08x\n", pdusession_modify_resp_p->gNB_ue_ngap_id); - return -1; - } - - /* Uplink NAS transport can occur either during an ngap connected state - * or during initial attach (for example: NAS authentication). - */ - if (!(ue_context_p->ue_state == NGAP_UE_CONNECTED || ue_context_p->ue_state == NGAP_UE_WAITING_CSR)) { - NGAP_WARN( - "You are attempting to send NAS data over non-connected " - "gNB ue ngap id: %08x, current state: %d\n", - pdusession_modify_resp_p->gNB_ue_ngap_id, - ue_context_p->ue_state); - return -1; - } - - /* Prepare the NGAP message to encode */ - memset(&pdu, 0, sizeof(pdu)); - pdu.present = NGAP_NGAP_PDU_PR_successfulOutcome; - asn1cCalloc(pdu.choice.successfulOutcome, head); - head->procedureCode = NGAP_ProcedureCode_id_PDUSessionResourceModify; - head->criticality = NGAP_Criticality_reject; - head->value.present = NGAP_SuccessfulOutcome__value_PR_PDUSessionResourceModifyResponse; - NGAP_PDUSessionResourceModifyResponse_t *out = &head->value.choice.PDUSessionResourceModifyResponse; - /* mandatory */ - { - asn1cSequenceAdd(out->protocolIEs.list, NGAP_PDUSessionResourceModifyResponseIEs_t, ie); - ie = (NGAP_PDUSessionResourceModifyResponseIEs_t *)calloc(1, sizeof(NGAP_PDUSessionResourceModifyResponseIEs_t)); - ie->id = NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID; - ie->criticality = NGAP_Criticality_ignore; - ie->value.present = NGAP_PDUSessionResourceModifyResponseIEs__value_PR_AMF_UE_NGAP_ID; - asn_uint642INTEGER(&ie->value.choice.AMF_UE_NGAP_ID, pdusession_modify_resp_p->amf_ue_ngap_id); - asn1cSeqAdd(&out->protocolIEs.list, ie); - } - /* mandatory */ - { - asn1cSequenceAdd(out->protocolIEs.list, NGAP_PDUSessionResourceModifyResponseIEs_t, ie); - ie->id = NGAP_ProtocolIE_ID_id_RAN_UE_NGAP_ID; - ie->criticality = NGAP_Criticality_ignore; - ie->value.present = NGAP_PDUSessionResourceModifyResponseIEs__value_PR_RAN_UE_NGAP_ID; - ie->value.choice.RAN_UE_NGAP_ID = pdusession_modify_resp_p->gNB_ue_ngap_id; - } - - /* PDUSessionResourceModifyListModRes optional */ - if (pdusession_modify_resp_p->nb_of_pdusessions > 0) { - asn1cSequenceAdd(out->protocolIEs.list, NGAP_PDUSessionResourceModifyResponseIEs_t, ie); - ie->id = NGAP_ProtocolIE_ID_id_PDUSessionResourceModifyListModRes; - ie->criticality = NGAP_Criticality_ignore; - ie->value.present = NGAP_PDUSessionResourceModifyResponseIEs__value_PR_PDUSessionResourceModifyListModRes; - - for (int i = 0; i < pdusession_modify_resp_p->nb_of_pdusessions; i++) { - asn1cSequenceAdd(ie->value.choice.PDUSessionResourceModifyListModRes.list, NGAP_PDUSessionResourceModifyItemModRes_t, item); - item->pDUSessionID = pdusession_modify_resp_p->pdusessions[i].pdusession_id; - - NGAP_PDUSessionResourceModifyResponseTransfer_t transfer = {0}; - asn1cCalloc(transfer.qosFlowAddOrModifyResponseList, tmp); - - for (int qos_flow_index = 0; qos_flow_index < pdusession_modify_resp_p->pdusessions[i].nb_of_qos_flow; qos_flow_index++) { - asn1cSequenceAdd(tmp->list, NGAP_QosFlowAddOrModifyResponseItem_t, qos); - qos->qosFlowIdentifier = pdusession_modify_resp_p->pdusessions[i].qos[qos_flow_index].qfi; - } - asn_encode_to_new_buffer_result_t res = {0}; - res = asn_encode_to_new_buffer(NULL, ATS_ALIGNED_CANONICAL_PER, &asn_DEF_NGAP_PDUSessionResourceModifyResponseTransfer, &transfer); - item->pDUSessionResourceModifyResponseTransfer.buf = res.buffer; - item->pDUSessionResourceModifyResponseTransfer.size = res.result.encoded; - - ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NGAP_PDUSessionResourceModifyResponseTransfer, &transfer); - - NGAP_DEBUG("pdusession_modify_resp: modified pdusession ID %ld\n", item->pDUSessionID); - } - } - - /* optional */ - if (pdusession_modify_resp_p->nb_of_pdusessions_failed > 0) { - asn1cSequenceAdd(out->protocolIEs.list, NGAP_PDUSessionResourceModifyResponseIEs_t, ie); - ie->id = NGAP_ProtocolIE_ID_id_PDUSessionResourceFailedToModifyListModRes; - ie->criticality = NGAP_Criticality_ignore; - ie->value.present = NGAP_PDUSessionResourceModifyResponseIEs__value_PR_PDUSessionResourceFailedToModifyListModRes; - - for (int i = 0; i < pdusession_modify_resp_p->nb_of_pdusessions_failed; i++) { - asn1cSequenceAdd(ie->value.choice.PDUSessionResourceFailedToModifyListModRes.list, NGAP_PDUSessionResourceFailedToModifyItemModRes_t, item); - item->pDUSessionID = pdusession_modify_resp_p->pdusessions_failed[i].pdusession_id; - - NGAP_PDUSessionResourceModifyUnsuccessfulTransfer_t pdusessionTransfer = {0}; - - // NGAP cause - encode_ngap_cause(&pdusessionTransfer.cause, &pdusession_modify_resp_p->pdusessions_failed[i].cause); - - asn_encode_to_new_buffer_result_t res = {0}; - res = asn_encode_to_new_buffer(NULL, ATS_ALIGNED_CANONICAL_PER, &asn_DEF_NGAP_PDUSessionResourceModifyUnsuccessfulTransfer, &pdusessionTransfer); - item->pDUSessionResourceModifyUnsuccessfulTransfer.buf = res.buffer; - item->pDUSessionResourceModifyUnsuccessfulTransfer.size = res.result.encoded; - - ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NGAP_PDUSessionResourceModifyUnsuccessfulTransfer, &pdusessionTransfer); - - NGAP_INFO("pdusession_modify_resp: failed pdusession ID %ld\n", item->pDUSessionID); - } - } - - /* optional */ - if (0) { - asn1cSequenceAdd(out->protocolIEs.list, NGAP_PDUSessionResourceModifyResponseIEs_t, ie); - ie->id = NGAP_ProtocolIE_ID_id_CriticalityDiagnostics; - ie->criticality = NGAP_Criticality_ignore; - ie->value.present = NGAP_PDUSessionResourceModifyResponseIEs__value_PR_CriticalityDiagnostics; - // ie->value.choice.CriticalityDiagnostics = ; - } - - if (ngap_gNB_encode_pdu(&pdu, &buffer, &length) < 0) { - NGAP_ERROR("Failed to encode uplink transport\n"); - /* Encode procedure has failed... */ - ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NGAP_NGAP_PDU, &pdu); - return -1; - } - - /* UE associated signalling -> use the allocated stream */ - ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance, ue_context_p->amf_ref->assoc_id, buffer, length, ue_context_p->tx_stream); - - ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NGAP_NGAP_PDU, &pdu); - return 0; -} -//------------------------------------------------------------------------------ -int ngap_gNB_pdusession_release_resp(instance_t instance, ngap_pdusession_release_resp_t *pdusession_release_resp_p) -//------------------------------------------------------------------------------ -{ - ngap_gNB_instance_t *ngap_gNB_instance_p = NULL; - struct ngap_gNB_ue_context_s *ue_context_p = NULL; - NGAP_NGAP_PDU_t pdu; - uint8_t *buffer = NULL; - uint32_t length; - int i; - /* Retrieve the NGAP gNB instance associated with Mod_id */ - ngap_gNB_instance_p = ngap_gNB_get_instance(instance); - DevAssert(pdusession_release_resp_p != NULL); - DevAssert(ngap_gNB_instance_p != NULL); - - if ((ue_context_p = ngap_get_ue_context(pdusession_release_resp_p->gNB_ue_ngap_id)) == NULL) { - /* The context for this gNB ue ngap id doesn't exist in the map of gNB UEs */ - NGAP_WARN("Failed to find ue context associated with gNB ue ngap id: 0x%08x\n", pdusession_release_resp_p->gNB_ue_ngap_id); - return -1; - } - - /* Prepare the NGAP message to encode */ - memset(&pdu, 0, sizeof(pdu)); - pdu.present = NGAP_NGAP_PDU_PR_successfulOutcome; - asn1cCalloc(pdu.choice.successfulOutcome, head); - head->procedureCode = NGAP_ProcedureCode_id_PDUSessionResourceRelease; - head->criticality = NGAP_Criticality_reject; - head->value.present = NGAP_SuccessfulOutcome__value_PR_PDUSessionResourceReleaseResponse; - NGAP_PDUSessionResourceReleaseResponse_t *out = &head->value.choice.PDUSessionResourceReleaseResponse; - /* mandatory */ - { - asn1cSequenceAdd(out->protocolIEs.list, NGAP_PDUSessionResourceReleaseResponseIEs_t, ie); - ie->id = NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID; - ie->criticality = NGAP_Criticality_ignore; - ie->value.present = NGAP_PDUSessionResourceReleaseResponseIEs__value_PR_AMF_UE_NGAP_ID; - asn_uint642INTEGER(&ie->value.choice.AMF_UE_NGAP_ID, ue_context_p->amf_ue_ngap_id); - } - /* mandatory */ - { - asn1cSequenceAdd(out->protocolIEs.list, NGAP_PDUSessionResourceReleaseResponseIEs_t, ie); - ie->id = NGAP_ProtocolIE_ID_id_RAN_UE_NGAP_ID; - ie->criticality = NGAP_Criticality_ignore; - ie->value.present = NGAP_PDUSessionResourceReleaseResponseIEs__value_PR_RAN_UE_NGAP_ID; - ie->value.choice.RAN_UE_NGAP_ID = pdusession_release_resp_p->gNB_ue_ngap_id; - } - - /* PDU Session Resource Released List (mandatory) */ - { - asn1cSequenceAdd(out->protocolIEs.list, NGAP_PDUSessionResourceReleaseResponseIEs_t, ie); - ie->id = NGAP_ProtocolIE_ID_id_PDUSessionResourceReleasedListRelRes; - ie->criticality = NGAP_Criticality_ignore; - ie->value.present = NGAP_PDUSessionResourceReleaseResponseIEs__value_PR_PDUSessionResourceReleasedListRelRes; - - for (i = 0; i < pdusession_release_resp_p->nb_of_pdusessions_released; i++) { - NGAP_PDUSessionResourceReleasedListRelRes_t *list = &ie->value.choice.PDUSessionResourceReleasedListRelRes; - asn1cSequenceAdd(list->list, NGAP_PDUSessionResourceReleasedItemRelRes_t, item); - pdusession_release_t *r = &pdusession_release_resp_p->pdusession_release[i]; - /* PDU Session ID (mandatory) */ - item->pDUSessionID = r->pdusession_id; - /* PDU Session Resource Release Response Transfer (mandatory) */ - // Empty transfer is valid since Secondary RAT Usage Information is optional and not used - byte_array_t transfer = encode_ngap_pdusession_release_response_transfer(); - OCTET_STRING_fromBuf(&item->pDUSessionResourceReleaseResponseTransfer, (const char *)transfer.buf, transfer.len); - free_byte_array(transfer); - NGAP_DEBUG("PDU Session Resource Release Response: pdusession ID %ld\n", item->pDUSessionID); - } - } - - if (ngap_gNB_encode_pdu(&pdu, &buffer, &length) < 0) { - NGAP_ERROR("Failed to encode release response\n"); - /* Encode procedure has failed... */ - ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NGAP_NGAP_PDU, &pdu); - return -1; - } - - /* UE associated signalling -> use the allocated stream */ - ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance, ue_context_p->amf_ref->assoc_id, buffer, length, ue_context_p->tx_stream); - NGAP_INFO("pdusession_release_response sended gNB_UE_NGAP_ID %u amf_ue_ngap_id %lu nb_of_pdusessions_released %d \n", - pdusession_release_resp_p->gNB_ue_ngap_id, - (uint64_t)ue_context_p->amf_ue_ngap_id, - pdusession_release_resp_p->nb_of_pdusessions_released); - - ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NGAP_NGAP_PDU, &pdu); - return 0; -} - diff --git a/openair3/NGAP/ngap_gNB_nas_procedures.h b/openair3/NGAP/ngap_gNB_nas_procedures.h index 5189e6b311..38a9648bbb 100644 --- a/openair3/NGAP/ngap_gNB_nas_procedures.h +++ b/openair3/NGAP/ngap_gNB_nas_procedures.h @@ -54,13 +54,4 @@ int ngap_gNB_initial_ctxt_fail(instance_t instance, ngap_initial_context_setup_f int ngap_gNB_ue_capabilities(instance_t instance, ngap_ue_cap_info_ind_t *ue_cap_info_ind_p); -int ngap_gNB_pdusession_setup_resp(instance_t instance, - ngap_pdusession_setup_resp_t *pdusession_setup_resp_p); - -int ngap_gNB_pdusession_modify_resp(instance_t instance, - ngap_pdusession_modify_resp_t *pdusession_modify_resp_p); - -int ngap_gNB_pdusession_release_resp(instance_t instance, - ngap_pdusession_release_resp_t *pdusession_release_resp_p); - #endif /* NGAP_GNB_NAS_PROCEDURES_H_ */ diff --git a/openair3/NGAP/ngap_gNB_pdu_session_management.c b/openair3/NGAP/ngap_gNB_pdu_session_management.c new file mode 100644 index 0000000000..7f4ec2d6da --- /dev/null +++ b/openair3/NGAP/ngap_gNB_pdu_session_management.c @@ -0,0 +1,425 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#include "ngap_gNB_pdu_session_management.h" +#include +#include +#include +#include "INTEGER.h" +#include "ngap_msg_includes.h" +#include "OCTET_STRING.h" +#include "asn_application.h" +#include "assertions.h" +#include "conversions.h" +#include "ngap_common.h" +#include "ngap_gNB_encoder.h" +#include "ngap_gNB_itti_messaging.h" +#include "ngap_gNB_ue_context.h" +#include "ngap_gNB_management_procedures.h" +#include "oai_asn1.h" +#include "ds/byte_array.h" + +int ngap_gNB_pdusession_setup_resp(instance_t instance, ngap_pdusession_setup_resp_t *pdusession_setup_resp_p) +{ + ngap_gNB_instance_t *ngap_gNB_instance_p = NULL; + struct ngap_gNB_ue_context_s *ue_context_p = NULL; + NGAP_NGAP_PDU_t pdu = {0}; + uint8_t *buffer = NULL; + uint32_t length; + + /* Retrieve the NGAP gNB instance associated with Mod_id */ + ngap_gNB_instance_p = ngap_gNB_get_instance(instance); + DevAssert(pdusession_setup_resp_p != NULL); + DevAssert(ngap_gNB_instance_p != NULL); + + if ((ue_context_p = ngap_get_ue_context(pdusession_setup_resp_p->gNB_ue_ngap_id)) == NULL) { + /* The context for this gNB ue ngap id doesn't exist in the map of gNB UEs */ + NGAP_WARN("Failed to find ue context associated with gNB ue ngap id: 0x%08x\n", pdusession_setup_resp_p->gNB_ue_ngap_id); + return -1; + } + + /* Uplink NAS transport can occur either during an ngap connected state + * or during initial attach (for example: NAS authentication). + */ + if (!(ue_context_p->ue_state == NGAP_UE_CONNECTED || ue_context_p->ue_state == NGAP_UE_WAITING_CSR)) { + NGAP_WARN( + "You are attempting to send NAS data over non-connected " + "gNB ue ngap id: %08x, current state: %d\n", + pdusession_setup_resp_p->gNB_ue_ngap_id, + ue_context_p->ue_state); + return -1; + } + + /* Prepare the NGAP message to encode */ + pdu.present = NGAP_NGAP_PDU_PR_successfulOutcome; + asn1cCalloc(pdu.choice.successfulOutcome, successfulOutcome); + successfulOutcome->procedureCode = NGAP_ProcedureCode_id_PDUSessionResourceSetup; + successfulOutcome->criticality = NGAP_Criticality_reject; + successfulOutcome->value.present = NGAP_SuccessfulOutcome__value_PR_PDUSessionResourceSetupResponse; + NGAP_PDUSessionResourceSetupResponse_t *out = &successfulOutcome->value.choice.PDUSessionResourceSetupResponse; + /* mandatory */ + { + asn1cSequenceAdd(out->protocolIEs.list, NGAP_PDUSessionResourceSetupResponseIEs_t, ie); + ie->id = NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID; + ie->criticality = NGAP_Criticality_ignore; + ie->value.present = NGAP_PDUSessionResourceSetupResponseIEs__value_PR_AMF_UE_NGAP_ID; + asn_uint642INTEGER(&ie->value.choice.AMF_UE_NGAP_ID, ue_context_p->amf_ue_ngap_id); + } + /* mandatory */ + { + asn1cSequenceAdd(out->protocolIEs.list, NGAP_PDUSessionResourceSetupResponseIEs_t, ie); + ie->id = NGAP_ProtocolIE_ID_id_RAN_UE_NGAP_ID; + ie->criticality = NGAP_Criticality_ignore; + ie->value.present = NGAP_PDUSessionResourceSetupResponseIEs__value_PR_RAN_UE_NGAP_ID; + ie->value.choice.RAN_UE_NGAP_ID = pdusession_setup_resp_p->gNB_ue_ngap_id; + } + + /* optional */ + if (pdusession_setup_resp_p->nb_of_pdusessions > 0) { + asn1cSequenceAdd(out->protocolIEs.list, NGAP_PDUSessionResourceSetupResponseIEs_t, ie3); + ie3->id = NGAP_ProtocolIE_ID_id_PDUSessionResourceSetupListSURes; + ie3->criticality = NGAP_Criticality_ignore; + ie3->value.present = NGAP_PDUSessionResourceSetupResponseIEs__value_PR_PDUSessionResourceSetupListSURes; + + for (int i = 0; i < pdusession_setup_resp_p->nb_of_pdusessions; i++) { + pdusession_setup_t *pdusession = pdusession_setup_resp_p->pdusessions + i; + asn1cSequenceAdd(ie3->value.choice.PDUSessionResourceSetupListSURes.list, NGAP_PDUSessionResourceSetupItemSURes_t, item); + /* pDUSessionID */ + item->pDUSessionID = pdusession->pdusession_id; + + // PDU Session Resource Setup Response Transfer (Mandatory) + byte_array_t ba = encode_ngap_pdusession_setup_response_transfer(pdusession); + item->pDUSessionResourceSetupResponseTransfer.buf = ba.buf; + item->pDUSessionResourceSetupResponseTransfer.size = ba.len; + } + } + + /* optional */ + if (pdusession_setup_resp_p->nb_of_pdusessions_failed > 0) { + asn1cSequenceAdd(out->protocolIEs.list, NGAP_PDUSessionResourceSetupResponseIEs_t, ie); + ie->id = NGAP_ProtocolIE_ID_id_PDUSessionResourceFailedToSetupListSURes; + ie->criticality = NGAP_Criticality_ignore; + ie->value.present = NGAP_PDUSessionResourceSetupResponseIEs__value_PR_PDUSessionResourceFailedToSetupListSURes; + + for (int i = 0; i < pdusession_setup_resp_p->nb_of_pdusessions_failed; i++) { + pdusession_failed_t *pdusession_failed = pdusession_setup_resp_p->pdusessions_failed + i; + asn1cSequenceAdd(ie->value.choice.PDUSessionResourceFailedToSetupListSURes.list, + NGAP_PDUSessionResourceFailedToSetupItemSURes_t, + item); + NGAP_PDUSessionResourceSetupUnsuccessfulTransfer_t pdusessionUnTransfer_p = {0}; + + /* pDUSessionID */ + item->pDUSessionID = pdusession_failed->pdusession_id; + + /* cause */ + encode_ngap_cause(&pdusessionUnTransfer_p.cause, &pdusession_failed->cause); + NGAP_INFO("pdusession setup response: failed pdusession ID %ld\n", item->pDUSessionID); + + asn_encode_to_new_buffer_result_t res = asn_encode_to_new_buffer(NULL, + ATS_ALIGNED_CANONICAL_PER, + &asn_DEF_NGAP_PDUSessionResourceSetupUnsuccessfulTransfer, + &pdusessionUnTransfer_p); + item->pDUSessionResourceSetupUnsuccessfulTransfer.buf = res.buffer; + item->pDUSessionResourceSetupUnsuccessfulTransfer.size = res.result.encoded; + + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NGAP_PDUSessionResourceSetupUnsuccessfulTransfer, &pdusessionUnTransfer_p); + } + } + + /* optional */ + if (0) { + asn1cSequenceAdd(out->protocolIEs.list, NGAP_PDUSessionResourceSetupResponseIEs_t, ie); + ie->id = NGAP_ProtocolIE_ID_id_CriticalityDiagnostics; + ie->criticality = NGAP_Criticality_ignore; + ie->value.present = NGAP_PDUSessionResourceSetupResponseIEs__value_PR_CriticalityDiagnostics; + } + + if (ngap_gNB_encode_pdu(&pdu, &buffer, &length) < 0) { + NGAP_ERROR("Failed to encode uplink transport\n"); + /* Encode procedure has failed... */ + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NGAP_NGAP_PDU, &pdu); + return -1; + } + + /* UE associated signalling -> use the allocated stream */ + ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance, + ue_context_p->amf_ref->assoc_id, + buffer, + length, + ue_context_p->tx_stream); + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NGAP_NGAP_PDU, &pdu); + return 0; +} + +int ngap_gNB_pdusession_modify_resp(instance_t instance, ngap_pdusession_modify_resp_t *pdusession_modify_resp_p) +{ + ngap_gNB_instance_t *ngap_gNB_instance_p = NULL; + struct ngap_gNB_ue_context_s *ue_context_p = NULL; + NGAP_NGAP_PDU_t pdu; + uint8_t *buffer = NULL; + uint32_t length; + + /* Retrieve the NGAP gNB instance associated with Mod_id */ + ngap_gNB_instance_p = ngap_gNB_get_instance(instance); + DevAssert(pdusession_modify_resp_p != NULL); + DevAssert(ngap_gNB_instance_p != NULL); + + if ((ue_context_p = ngap_get_ue_context(pdusession_modify_resp_p->gNB_ue_ngap_id)) == NULL) { + /* The context for this gNB ue ngap id doesn't exist in the map of gNB UEs */ + NGAP_WARN("Failed to find ue context associated with gNB ue ngap id: 0x%08x\n", pdusession_modify_resp_p->gNB_ue_ngap_id); + return -1; + } + + /* Uplink NAS transport can occur either during an ngap connected state + * or during initial attach (for example: NAS authentication). + */ + if (!(ue_context_p->ue_state == NGAP_UE_CONNECTED || ue_context_p->ue_state == NGAP_UE_WAITING_CSR)) { + NGAP_WARN( + "You are attempting to send NAS data over non-connected " + "gNB ue ngap id: %08x, current state: %d\n", + pdusession_modify_resp_p->gNB_ue_ngap_id, + ue_context_p->ue_state); + return -1; + } + + /* Prepare the NGAP message to encode */ + memset(&pdu, 0, sizeof(pdu)); + pdu.present = NGAP_NGAP_PDU_PR_successfulOutcome; + asn1cCalloc(pdu.choice.successfulOutcome, head); + head->procedureCode = NGAP_ProcedureCode_id_PDUSessionResourceModify; + head->criticality = NGAP_Criticality_reject; + head->value.present = NGAP_SuccessfulOutcome__value_PR_PDUSessionResourceModifyResponse; + NGAP_PDUSessionResourceModifyResponse_t *out = &head->value.choice.PDUSessionResourceModifyResponse; + /* mandatory */ + { + asn1cSequenceAdd(out->protocolIEs.list, NGAP_PDUSessionResourceModifyResponseIEs_t, ie); + ie = (NGAP_PDUSessionResourceModifyResponseIEs_t *)calloc(1, sizeof(NGAP_PDUSessionResourceModifyResponseIEs_t)); + ie->id = NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID; + ie->criticality = NGAP_Criticality_ignore; + ie->value.present = NGAP_PDUSessionResourceModifyResponseIEs__value_PR_AMF_UE_NGAP_ID; + asn_uint642INTEGER(&ie->value.choice.AMF_UE_NGAP_ID, pdusession_modify_resp_p->amf_ue_ngap_id); + asn1cSeqAdd(&out->protocolIEs.list, ie); + } + /* mandatory */ + { + asn1cSequenceAdd(out->protocolIEs.list, NGAP_PDUSessionResourceModifyResponseIEs_t, ie); + ie->id = NGAP_ProtocolIE_ID_id_RAN_UE_NGAP_ID; + ie->criticality = NGAP_Criticality_ignore; + ie->value.present = NGAP_PDUSessionResourceModifyResponseIEs__value_PR_RAN_UE_NGAP_ID; + ie->value.choice.RAN_UE_NGAP_ID = pdusession_modify_resp_p->gNB_ue_ngap_id; + } + + /* PDUSessionResourceModifyListModRes optional */ + if (pdusession_modify_resp_p->nb_of_pdusessions > 0) { + asn1cSequenceAdd(out->protocolIEs.list, NGAP_PDUSessionResourceModifyResponseIEs_t, ie); + ie->id = NGAP_ProtocolIE_ID_id_PDUSessionResourceModifyListModRes; + ie->criticality = NGAP_Criticality_ignore; + ie->value.present = NGAP_PDUSessionResourceModifyResponseIEs__value_PR_PDUSessionResourceModifyListModRes; + + for (int i = 0; i < pdusession_modify_resp_p->nb_of_pdusessions; i++) { + asn1cSequenceAdd(ie->value.choice.PDUSessionResourceModifyListModRes.list, NGAP_PDUSessionResourceModifyItemModRes_t, item); + item->pDUSessionID = pdusession_modify_resp_p->pdusessions[i].pdusession_id; + + NGAP_PDUSessionResourceModifyResponseTransfer_t transfer = {0}; + asn1cCalloc(transfer.qosFlowAddOrModifyResponseList, tmp); + + for (int qos_flow_index = 0; qos_flow_index < pdusession_modify_resp_p->pdusessions[i].nb_of_qos_flow; qos_flow_index++) { + asn1cSequenceAdd(tmp->list, NGAP_QosFlowAddOrModifyResponseItem_t, qos); + qos->qosFlowIdentifier = pdusession_modify_resp_p->pdusessions[i].qos[qos_flow_index].qfi; + } + asn_encode_to_new_buffer_result_t res = {0}; + res = asn_encode_to_new_buffer(NULL, + ATS_ALIGNED_CANONICAL_PER, + &asn_DEF_NGAP_PDUSessionResourceModifyResponseTransfer, + &transfer); + item->pDUSessionResourceModifyResponseTransfer.buf = res.buffer; + item->pDUSessionResourceModifyResponseTransfer.size = res.result.encoded; + + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NGAP_PDUSessionResourceModifyResponseTransfer, &transfer); + + NGAP_DEBUG("pdusession_modify_resp: modified pdusession ID %ld\n", item->pDUSessionID); + } + } + + /* optional */ + if (pdusession_modify_resp_p->nb_of_pdusessions_failed > 0) { + asn1cSequenceAdd(out->protocolIEs.list, NGAP_PDUSessionResourceModifyResponseIEs_t, ie); + ie->id = NGAP_ProtocolIE_ID_id_PDUSessionResourceFailedToModifyListModRes; + ie->criticality = NGAP_Criticality_ignore; + ie->value.present = NGAP_PDUSessionResourceModifyResponseIEs__value_PR_PDUSessionResourceFailedToModifyListModRes; + + for (int i = 0; i < pdusession_modify_resp_p->nb_of_pdusessions_failed; i++) { + asn1cSequenceAdd(ie->value.choice.PDUSessionResourceFailedToModifyListModRes.list, + NGAP_PDUSessionResourceFailedToModifyItemModRes_t, + item); + item->pDUSessionID = pdusession_modify_resp_p->pdusessions_failed[i].pdusession_id; + + NGAP_PDUSessionResourceModifyUnsuccessfulTransfer_t pdusessionTransfer = {0}; + + // NGAP cause + encode_ngap_cause(&pdusessionTransfer.cause, &pdusession_modify_resp_p->pdusessions_failed[i].cause); + + asn_encode_to_new_buffer_result_t res = {0}; + NGAP_PDUSessionResourceModifyUnsuccessfulTransfer_t *pdusessionTransfer_p = NULL; + res = asn_encode_to_new_buffer(NULL, + ATS_ALIGNED_CANONICAL_PER, + &asn_DEF_NGAP_PDUSessionResourceModifyUnsuccessfulTransfer, + &pdusessionTransfer); + item->pDUSessionResourceModifyUnsuccessfulTransfer.buf = res.buffer; + item->pDUSessionResourceModifyUnsuccessfulTransfer.size = res.result.encoded; + + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NGAP_PDUSessionResourceModifyUnsuccessfulTransfer, pdusessionTransfer_p); + + NGAP_INFO("pdusession_modify_resp: failed pdusession ID %ld\n", item->pDUSessionID); + } + } + + /* optional */ + if (0) { + asn1cSequenceAdd(out->protocolIEs.list, NGAP_PDUSessionResourceModifyResponseIEs_t, ie); + ie->id = NGAP_ProtocolIE_ID_id_CriticalityDiagnostics; + ie->criticality = NGAP_Criticality_ignore; + ie->value.present = NGAP_PDUSessionResourceModifyResponseIEs__value_PR_CriticalityDiagnostics; + } + + if (ngap_gNB_encode_pdu(&pdu, &buffer, &length) < 0) { + NGAP_ERROR("Failed to encode uplink transport\n"); + /* Encode procedure has failed... */ + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NGAP_NGAP_PDU, &pdu); + return -1; + } + + /* UE associated signalling -> use the allocated stream */ + ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance, + ue_context_p->amf_ref->assoc_id, + buffer, + length, + ue_context_p->tx_stream); + + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NGAP_NGAP_PDU, &pdu); + return 0; +} + +/** @brief PDU Session Resource Release Response Transfer encoding (9.3.4.21 3GPP TS 38.413) + * The transfer structure contains only an optional Secondary RAT Usage Information IE. + * Since we don't use secondary RAT (MR-DC), we encode an empty structure. */ +static byte_array_t encode_ngap_pdusession_release_response_transfer(void) +{ + NGAP_PDUSessionResourceReleaseResponseTransfer_t pdusessionTransfer = {0}; + + // Encode + asn_encode_to_new_buffer_result_t res = asn_encode_to_new_buffer(NULL, + ATS_ALIGNED_CANONICAL_PER, + &asn_DEF_NGAP_PDUSessionResourceReleaseResponseTransfer, + &pdusessionTransfer); + AssertFatal(res.buffer, "ASN1 message encoding failed (%s, %lu)!\n", res.result.failed_type->name, res.result.encoded); + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NGAP_PDUSessionResourceReleaseResponseTransfer, &pdusessionTransfer); + byte_array_t out = {.buf = res.buffer, .len = res.result.encoded}; + return out; +} + +int ngap_gNB_pdusession_release_resp(instance_t instance, ngap_pdusession_release_resp_t *pdusession_release_resp_p) +{ + ngap_gNB_instance_t *ngap_gNB_instance_p = NULL; + struct ngap_gNB_ue_context_s *ue_context_p = NULL; + NGAP_NGAP_PDU_t pdu; + uint8_t *buffer = NULL; + uint32_t length; + int i; + /* Retrieve the NGAP gNB instance associated with Mod_id */ + ngap_gNB_instance_p = ngap_gNB_get_instance(instance); + DevAssert(pdusession_release_resp_p != NULL); + DevAssert(ngap_gNB_instance_p != NULL); + + if ((ue_context_p = ngap_get_ue_context(pdusession_release_resp_p->gNB_ue_ngap_id)) == NULL) { + /* The context for this gNB ue ngap id doesn't exist in the map of gNB UEs */ + NGAP_WARN("Failed to find ue context associated with gNB ue ngap id: 0x%08x\n", pdusession_release_resp_p->gNB_ue_ngap_id); + return -1; + } + + /* Prepare the NGAP message to encode */ + memset(&pdu, 0, sizeof(pdu)); + pdu.present = NGAP_NGAP_PDU_PR_successfulOutcome; + asn1cCalloc(pdu.choice.successfulOutcome, head); + head->procedureCode = NGAP_ProcedureCode_id_PDUSessionResourceRelease; + head->criticality = NGAP_Criticality_reject; + head->value.present = NGAP_SuccessfulOutcome__value_PR_PDUSessionResourceReleaseResponse; + NGAP_PDUSessionResourceReleaseResponse_t *out = &head->value.choice.PDUSessionResourceReleaseResponse; + /* mandatory */ + { + asn1cSequenceAdd(out->protocolIEs.list, NGAP_PDUSessionResourceReleaseResponseIEs_t, ie); + ie->id = NGAP_ProtocolIE_ID_id_AMF_UE_NGAP_ID; + ie->criticality = NGAP_Criticality_ignore; + ie->value.present = NGAP_PDUSessionResourceReleaseResponseIEs__value_PR_AMF_UE_NGAP_ID; + asn_uint642INTEGER(&ie->value.choice.AMF_UE_NGAP_ID, ue_context_p->amf_ue_ngap_id); + } + /* mandatory */ + { + asn1cSequenceAdd(out->protocolIEs.list, NGAP_PDUSessionResourceReleaseResponseIEs_t, ie); + ie->id = NGAP_ProtocolIE_ID_id_RAN_UE_NGAP_ID; + ie->criticality = NGAP_Criticality_ignore; + ie->value.present = NGAP_PDUSessionResourceReleaseResponseIEs__value_PR_RAN_UE_NGAP_ID; + ie->value.choice.RAN_UE_NGAP_ID = pdusession_release_resp_p->gNB_ue_ngap_id; + } + + /* PDU Session Resource Released List (mandatory) */ + { + asn1cSequenceAdd(out->protocolIEs.list, NGAP_PDUSessionResourceReleaseResponseIEs_t, ie); + ie->id = NGAP_ProtocolIE_ID_id_PDUSessionResourceReleasedListRelRes; + ie->criticality = NGAP_Criticality_ignore; + ie->value.present = NGAP_PDUSessionResourceReleaseResponseIEs__value_PR_PDUSessionResourceReleasedListRelRes; + + for (i = 0; i < pdusession_release_resp_p->nb_of_pdusessions_released; i++) { + NGAP_PDUSessionResourceReleasedListRelRes_t *list = &ie->value.choice.PDUSessionResourceReleasedListRelRes; + asn1cSequenceAdd(list->list, NGAP_PDUSessionResourceReleasedItemRelRes_t, item); + pdusession_release_t *r = &pdusession_release_resp_p->pdusession_release[i]; + /* PDU Session ID (mandatory) */ + item->pDUSessionID = r->pdusession_id; + /* PDU Session Resource Release Response Transfer (mandatory) */ + // Empty transfer is valid since Secondary RAT Usage Information is optional and not used + byte_array_t transfer = encode_ngap_pdusession_release_response_transfer(); + OCTET_STRING_fromBuf(&item->pDUSessionResourceReleaseResponseTransfer, (const char *)transfer.buf, transfer.len); + free_byte_array(transfer); + NGAP_DEBUG("PDU Session Resource Release Response: pdusession ID %ld\n", item->pDUSessionID); + } + } + + if (ngap_gNB_encode_pdu(&pdu, &buffer, &length) < 0) { + NGAP_ERROR("Failed to encode release response\n"); + /* Encode procedure has failed... */ + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NGAP_NGAP_PDU, &pdu); + return -1; + } + + /* UE associated signalling -> use the allocated stream */ + ngap_gNB_itti_send_sctp_data_req(ngap_gNB_instance_p->instance, + ue_context_p->amf_ref->assoc_id, + buffer, + length, + ue_context_p->tx_stream); + NGAP_INFO("pdusession_release_response sended gNB_UE_NGAP_ID %u amf_ue_ngap_id %lu nb_of_pdusessions_released %d \n", + pdusession_release_resp_p->gNB_ue_ngap_id, + (uint64_t)ue_context_p->amf_ue_ngap_id, + pdusession_release_resp_p->nb_of_pdusessions_released); + + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_NGAP_NGAP_PDU, &pdu); + return 0; +} diff --git a/openair3/NGAP/ngap_gNB_pdu_session_management.h b/openair3/NGAP/ngap_gNB_pdu_session_management.h new file mode 100644 index 0000000000..3e50d1bec1 --- /dev/null +++ b/openair3/NGAP/ngap_gNB_pdu_session_management.h @@ -0,0 +1,36 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#ifndef NGAP_GNB_PDU_SESSION_MANAGEMENT_H_ +#define NGAP_GNB_PDU_SESSION_MANAGEMENT_H_ + +#include +#include "assertions.h" +#include "ngap_messages_types.h" +#include "ngap_msg_includes.h" + +int ngap_gNB_pdusession_setup_resp(instance_t instance, ngap_pdusession_setup_resp_t *pdusession_setup_resp_p); + +int ngap_gNB_pdusession_modify_resp(instance_t instance, ngap_pdusession_modify_resp_t *pdusession_modify_resp_p); + +int ngap_gNB_pdusession_release_resp(instance_t instance, ngap_pdusession_release_resp_t *pdusession_release_resp_p); + +#endif /* NGAP_GNB_PDU_SESSION_MANAGEMENT_H_ */ From 3dc8647a588a94a2c9d3e9b5935129f70ab58713 Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Mon, 29 Dec 2025 20:06:18 +0100 Subject: [PATCH 24/37] Refactor (NGAP): add conversion functions to ngap_common.c These conversion functions will be needed across different NGAP libraries upon refactoring: tnl_to_bitstring, bitstring_to_tnl Therefore, they are moved to the common lib. --- openair3/NGAP/ngap_common.c | 20 +++++++++++++++++++ openair3/NGAP/ngap_common.h | 2 ++ .../NGAP/ngap_gNB_management_procedures.c | 17 ---------------- .../NGAP/ngap_gNB_management_procedures.h | 4 ---- 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/openair3/NGAP/ngap_common.c b/openair3/NGAP/ngap_common.c index b5cb2c78be..3923586989 100644 --- a/openair3/NGAP/ngap_common.c +++ b/openair3/NGAP/ngap_common.c @@ -28,8 +28,28 @@ */ #include +#include #include "conversions.h" #include "ngap_common.h" +#include "ngap_msg_includes.h" + +void tnl_to_bitstring(BIT_STRING_t *out, const transport_layer_addr_t in) +{ + if (in.length) { + out->buf = malloc_or_fail(in.length); + memcpy(out->buf, in.buffer, in.length); + out->size = in.length; + out->bits_unused = 0; + } +} + +void bitstring_to_tnl(transport_layer_addr_t *out, const BIT_STRING_t in) +{ + if (in.size) { + memcpy(out->buffer, in.buf, in.size); + out->length = in.size; + } +} void encode_ngap_cause(NGAP_Cause_t *out, const ngap_cause_t *in) { diff --git a/openair3/NGAP/ngap_common.h b/openair3/NGAP/ngap_common.h index fcd999ae33..0ae5417d01 100644 --- a/openair3/NGAP/ngap_common.h +++ b/openair3/NGAP/ngap_common.h @@ -79,6 +79,8 @@ **/ typedef int (*ngap_message_decoded_callback)(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu); +void tnl_to_bitstring(BIT_STRING_t *out, const transport_layer_addr_t in); +void bitstring_to_tnl(transport_layer_addr_t *out, const BIT_STRING_t in); void encode_ngap_cause(NGAP_Cause_t *out, const ngap_cause_t *in); nr_guami_t decode_ngap_guami(const NGAP_GUAMI_t *in); ngap_cause_t decode_ngap_cause(const NGAP_Cause_t *in); diff --git a/openair3/NGAP/ngap_gNB_management_procedures.c b/openair3/NGAP/ngap_gNB_management_procedures.c index 9d8748a88b..9456a4d986 100644 --- a/openair3/NGAP/ngap_gNB_management_procedures.c +++ b/openair3/NGAP/ngap_gNB_management_procedures.c @@ -191,20 +191,3 @@ void ngap_gNB_remove_amf_desc(ngap_gNB_instance_t * instance) } } -void tnl_to_bitstring(BIT_STRING_t *out, const transport_layer_addr_t in) -{ - if (in.length) { - out->buf = malloc_or_fail(in.length); - memcpy(out->buf, in.buffer, in.length); - out->size = in.length; - out->bits_unused = 0; - } -} - -void bitstring_to_tnl(transport_layer_addr_t *out, const BIT_STRING_t in) -{ - if (in.size) { - memcpy(out->buffer, in.buf, in.size); - out->length = in.size; - } -} diff --git a/openair3/NGAP/ngap_gNB_management_procedures.h b/openair3/NGAP/ngap_gNB_management_procedures.h index 28f4b24e7e..203b9e2c0b 100644 --- a/openair3/NGAP/ngap_gNB_management_procedures.h +++ b/openair3/NGAP/ngap_gNB_management_procedures.h @@ -48,8 +48,4 @@ uint16_t ngap_gNB_fetch_add_global_cnx_id(void); void ngap_gNB_prepare_internal_data(void); -void tnl_to_bitstring(BIT_STRING_t *out, const transport_layer_addr_t in); - -void bitstring_to_tnl(transport_layer_addr_t *out, const BIT_STRING_t in); - #endif /* NGAP_GNB_MANAGEMENT_PROCEDURES_H_ */ From c436f05ea9d941c5f40fc4e7e8cb0fcb9b444383 Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Mon, 22 Dec 2025 12:44:32 +0100 Subject: [PATCH 25/37] Refactor (NGAP): adopt TO_ENUM/TO_TEXT pattern for NGAP enums TO_ENUM/TO_TEXT are already used in NAS, and can be adopted in NGAP. To avoid duplication, the following changes are introduced: * Move text_info_t, TO_ENUM, TO_TEXT to common/utils/utils.h * Include utils.h include to ngap_messages_types.h, fgs_nas_utils.h, and fgmm_lib.h * RRC establishment cause: refactor to FOREACH_RRC_ESTABLISHMENT_CAUSE macro * Cause Group: refactor to FOREACH_CAUSE_GROUP macro * Radio Network Cause: refactor to FOREACH_CAUSE_RADIO_NETWORK macro * Protocol Cause: refactor to FOREACH_CAUSE_PROTOCOL macro This change is preparatory to the introduction the paging lib with unit tests, with the goal of reducing the inter-dependency between concurrent NGAP libs. --- common/utils/utils.h | 9 + openair2/COMMON/ngap_messages_types.h | 192 +++++++++--------- .../NR_UE/5GS/5GMM/IES/FGSMobileIdentity.h | 1 + openair3/NAS/NR_UE/5GS/5GMM/MSG/fgmm_lib.h | 1 + .../5GSM/MSG/PduSessionEstablishmentAccept.c | 1 + .../5GSM/MSG/PduSessionEstablishmentAccept.h | 1 + openair3/NAS/NR_UE/5GS/fgs_nas_utils.h | 9 - 7 files changed, 111 insertions(+), 103 deletions(-) diff --git a/common/utils/utils.h b/common/utils/utils.h index fecf0eb3ad..432e754875 100644 --- a/common/utils/utils.h +++ b/common/utils/utils.h @@ -109,6 +109,15 @@ int hex_char_to_hex_value (char c); // Converts an hexadecimal ASCII coded string into its value.** int hex_string_to_hex_value (uint8_t *hex_value, const char *hex_string, int size); +/* Map task id to printable name. */ +typedef struct { + int id; + char text[256]; +} text_info_t; + +#define TO_TEXT(LabEl, nUmID) {nUmID, #LabEl}, +#define TO_ENUM(LabEl, nUmID) LabEl = nUmID, + char *itoa(int i); #define STRINGIFY(S) #S diff --git a/openair2/COMMON/ngap_messages_types.h b/openair2/COMMON/ngap_messages_types.h index a8f787812c..08d93c6b10 100644 --- a/openair2/COMMON/ngap_messages_types.h +++ b/openair2/COMMON/ngap_messages_types.h @@ -35,6 +35,7 @@ #include "common/5g_platform_types.h" #include "s1ap_messages_types.h" #include "ds/byte_array.h" +#include "utils.h" // Defines to access message fields. #define NGAP_REGISTER_GNB_REQ(mSGpTR) (mSGpTR)->ittiMsg.ngap_register_gnb_req @@ -143,25 +144,26 @@ typedef struct ngap_security_capabilities_s { uint16_t eUTRAintegrity_algorithms; } ngap_security_capabilities_t; -/* Provides the establishment cause for the RRC connection request as provided - * by the upper layers. W.r.t. the cause value names: highPriorityAccess - * concerns AC11..AC15, ‘mt Estands for ‘Mobile Terminating Eand ‘mo Efor - * 'Mobile Originating'. Defined in TS 36.331. - */ -typedef enum ngap_rrc_establishment_cause_e { - NGAP_RRC_CAUSE_EMERGENCY = 0x0, - NGAP_RRC_CAUSE_HIGH_PRIO_ACCESS = 0x1, - NGAP_RRC_CAUSE_MT_ACCESS = 0x2, - NGAP_RRC_CAUSE_MO_SIGNALLING = 0x3, - NGAP_RRC_CAUSE_MO_DATA = 0x4, - NGAP_RRC_CAUSE_MO_VOICECALL = 0x5, - NGAP_RRC_CAUSE_MO_VIDEOCALL = 0x6, - NGAP_RRC_CAUSE_MO_SMS = 0x7, - NGAP_RRC_CAUSE_MPS_PRIORITY_ACCESS = 0x8, - NGAP_RRC_CAUSE_MCS_PRIORITY_ACCESS = 0x9, - NGAP_RRC_CAUSE_NOTAVAILABLE = 0x10, - NGAP_RRC_CAUSE_LAST -} ngap_rrc_establishment_cause_t; +/** @brief RRC Establishment Cause (9.3.1.111 of 3GPP TS 38.413) + * Indicates the reason for RRC Connection Establishment/Resume as received from the UE. + * The notAvailable value is used when re-establishing/resuming an RRC connection and the + * cause value from the UE does not map to any other value. */ +#define FOREACH_RRC_ESTABLISHMENT_CAUSE(CAUSE_DEF) \ + CAUSE_DEF(NGAP_RRC_CAUSE_EMERGENCY, 0) \ + CAUSE_DEF(NGAP_RRC_CAUSE_HIGH_PRIO_ACCESS, 1) \ + CAUSE_DEF(NGAP_RRC_CAUSE_MT_ACCESS, 2) \ + CAUSE_DEF(NGAP_RRC_CAUSE_MO_SIGNALLING, 3) \ + CAUSE_DEF(NGAP_RRC_CAUSE_MO_DATA, 4) \ + CAUSE_DEF(NGAP_RRC_CAUSE_MO_VOICECALL, 5) \ + CAUSE_DEF(NGAP_RRC_CAUSE_MO_VIDEOCALL, 6) \ + CAUSE_DEF(NGAP_RRC_CAUSE_MO_SMS, 7) \ + CAUSE_DEF(NGAP_RRC_CAUSE_MPS_PRIORITY_ACCESS, 8) \ + CAUSE_DEF(NGAP_RRC_CAUSE_MCS_PRIORITY_ACCESS, 9) \ + CAUSE_DEF(NGAP_RRC_CAUSE_NOTAVAILABLE, 10) \ + CAUSE_DEF(NGAP_RRC_CAUSE_MO_EXCEPTION_DATA, 11) \ + CAUSE_DEF(NGAP_RRC_CAUSE_LAST, 12) + +typedef enum { FOREACH_RRC_ESTABLISHMENT_CAUSE(TO_ENUM) } ngap_rrc_establishment_cause_t; typedef struct fiveg_s_tmsi_s { uint16_t amf_set_id; @@ -242,15 +244,16 @@ typedef struct pdusession_modify_s { qos_flow_addmod_response_item_t qos[MAX_QOS_FLOWS]; } pdusession_modify_t; -/* Cause (9.3.1.2 of 3GPP TS 38.413) */ -typedef enum ngap_cause_group_e { - NGAP_CAUSE_NOTHING, /* No components present */ - NGAP_CAUSE_RADIO_NETWORK, - NGAP_CAUSE_TRANSPORT, - NGAP_CAUSE_NAS, - NGAP_CAUSE_PROTOCOL, - NGAP_CAUSE_MISC, -} ngap_cause_group_t; +/* Cause Group (9.3.1.2 of 3GPP TS 38.413) */ +#define FOREACH_CAUSE_GROUP(CAUSE_DEF) \ + CAUSE_DEF(NGAP_CAUSE_NOTHING, 0) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK, 1) \ + CAUSE_DEF(NGAP_CAUSE_TRANSPORT, 2) \ + CAUSE_DEF(NGAP_CAUSE_NAS, 3) \ + CAUSE_DEF(NGAP_CAUSE_PROTOCOL, 4) \ + CAUSE_DEF(NGAP_CAUSE_MISC, 5) + +typedef enum { FOREACH_CAUSE_GROUP(TO_ENUM) } ngap_cause_group_t; /* Cause (9.3.1.2 of 3GPP TS 38.413) */ typedef struct ngap_cause_s { @@ -258,73 +261,74 @@ typedef struct ngap_cause_s { uint8_t value; } ngap_cause_t; -typedef enum ngap_Cause_radio_network_e { - NGAP_CAUSE_RADIO_NETWORK_UNSPECIFIED, - NGAP_CAUSE_RADIO_NETWORK_TXNRELOCOVERALL_EXPIRY, - NGAP_CAUSE_RADIO_NETWORK_SUCCESSFUL_HANDOVER, - NGAP_CAUSE_RADIO_NETWORK_RELEASE_DUE_TO_NGRAN_GENERATED_REASON, - NGAP_CAUSE_RADIO_NETWORK_RELEASE_DUE_TO_5GC_GENERATED_REASON, - NGAP_CAUSE_RADIO_NETWORK_HANDOVER_CANCELLED, - NGAP_CAUSE_RADIO_NETWORK_PARTIAL_HANDOVER, - NGAP_CAUSE_RADIO_NETWORK_HO_FAILURE_IN_TARGET_5GC_NGRAN_NODE_OR_TARGET_SYSTEM, - NGAP_CAUSE_RADIO_NETWORK_HO_TARGET_NOT_ALLOWED, - NGAP_CAUSE_RADIO_NETWORK_TNGRELOCOVERALL_EXPIRY, - NGAP_CAUSE_RADIO_NETWORK_TNGRELOCPREP_EXPIRY, - NGAP_CAUSE_RADIO_NETWORK_CELL_NOT_AVAILABLE, - NGAP_CAUSE_RADIO_NETWORK_UNKNOWN_TARGETID, - NGAP_CAUSE_RADIO_NETWORK_NO_RADIO_RESOURCES_AVAILABLE_IN_TARGET_CELL, - NGAP_CAUSE_RADIO_NETWORK_UNKNOWN_LOCAL_UE_NGAP_ID, - NGAP_CAUSE_RADIO_NETWORK_INCONSISTENT_REMOTE_UE_NGAP_ID, - NGAP_CAUSE_RADIO_NETWORK_HANDOVER_DESIRABLE_FOR_RADIO_REASON, - NGAP_CAUSE_RADIO_NETWORK_TIME_CRITICAL_HANDOVER, - NGAP_CAUSE_RADIO_NETWORK_RESOURCE_OPTIMISATION_HANDOVER, - NGAP_CAUSE_RADIO_NETWORK_REDUCE_LOAD_IN_SERVING_CELL, - NGAP_CAUSE_RADIO_NETWORK_USER_INACTIVITY, - NGAP_CAUSE_RADIO_NETWORK_RADIO_CONNECTION_WITH_UE_LOST, - NGAP_CAUSE_RADIO_NETWORK_RADIO_RESOURCES_NOT_AVAILABLE, - NGAP_CAUSE_RADIO_NETWORK_INVALID_QOS_COMBINATION, - NGAP_CAUSE_RADIO_NETWORK_FAILURE_IN_RADIO_INTERFACE_PROCEDURE, - NGAP_CAUSE_RADIO_NETWORK_INTERACTION_WITH_OTHER_PROCEDURE, - NGAP_CAUSE_RADIO_NETWORK_UNKNOWN_PDU_SESSION_ID, - NGAP_CAUSE_RADIO_NETWORK_UNKNOWN_QOS_FLOW_ID, - NGAP_CAUSE_RADIO_NETWORK_MULTIPLE_PDU_SESSION_ID_INSTANCES, - NGAP_CAUSE_RADIO_NETWORK_MULTIPLE_QOS_FLOW_ID_INSTANCES, - NGAP_CAUSE_RADIO_NETWORK_ENCRYPTION_AND_OR_INTEGRITY_PROTECTION_ALGORITHMS_NOT_SUPPORTED, - NGAP_CAUSE_RADIO_NETWORK_NG_INTRA_SYSTEM_HANDOVER_TRIGGERED, - NGAP_CAUSE_RADIO_NETWORK_NG_INTER_SYSTEM_HANDOVER_TRIGGERED, - NGAP_CAUSE_RADIO_NETWORK_XN_HANDOVER_TRIGGERED, - NGAP_CAUSE_RADIO_NETWORK_NOT_SUPPORTED_5QI_VALUE, - NGAP_CAUSE_RADIO_NETWORK_UE_CONTEXT_TRANSFER, - NGAP_CAUSE_RADIO_NETWORK_IMS_VOICE_EPS_FALLBACK_OR_RAT_FALLBACK_TRIGGERED, - NGAP_CAUSE_RADIO_NETWORK_UP_INTEGRITY_PROTECTION_NOT_POSSIBLE, - NGAP_CAUSE_RADIO_NETWORK_UP_CONFIDENTIALITY_PROTECTION_NOT_POSSIBLE, - NGAP_CAUSE_RADIO_NETWORK_SLICE_NOT_SUPPORTED, - NGAP_CAUSE_RADIO_NETWORK_UE_IN_RRC_INACTIVE_STATE_NOT_REACHABLE, - NGAP_CAUSE_RADIO_NETWORK_REDIRECTION, - NGAP_CAUSE_RADIO_NETWORK_RESOURCES_NOT_AVAILABLE_FOR_THE_SLICE, - NGAP_CAUSE_RADIO_NETWORK_UE_MAX_INTEGRITY_PROTECTED_DATA_RATE_REASON, - NGAP_CAUSE_RADIO_NETWORK_RELEASE_DUE_TO_CN_DETECTED_MOBILITY, - NGAP_CAUSE_RADIO_NETWORK_N26_INTERFACE_NOT_AVAILABLE, - NGAP_CAUSE_RADIO_NETWORK_RELEASE_DUE_TO_PRE_EMPTION, - NGAP_CAUSE_RADIO_NETWORK_MULTIPLE_LOCATION_REPORTING_REFERENCE_ID_INSTANCES, - NGAP_CAUSE_RADIO_NETWORK_RSN_NOT_AVAILABLE_FOR_THE_UP, - NGAP_CAUSE_RADIO_NETWORK_NPN_ACCESS_DENIED, - NGAP_CAUSE_RADIO_NETWORK_CAG_ONLY_ACCESS_DENIED, - NGAP_CAUSE_RADIO_NETWORK_INSUFFICIENT_UE_CAPABILITIES -} ngap_cause_radio_network_t; +/* Radio Network Cause (9.3.1.2 of 3GPP TS 38.413) */ +#define FOREACH_CAUSE_RADIO_NETWORK(CAUSE_DEF) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_UNSPECIFIED, 0) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_TXNRELOCOVERALL_EXPIRY, 1) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_SUCCESSFUL_HANDOVER, 2) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_RELEASE_DUE_TO_NGRAN_GENERATED_REASON, 3) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_RELEASE_DUE_TO_5GC_GENERATED_REASON, 4) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_HANDOVER_CANCELLED, 5) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_PARTIAL_HANDOVER, 6) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_HO_FAILURE_IN_TARGET_5GC_NGRAN_NODE_OR_TARGET_SYSTEM, 7) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_HO_TARGET_NOT_ALLOWED, 8) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_TNGRELOCOVERALL_EXPIRY, 9) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_TNGRELOCPREP_EXPIRY, 10) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_CELL_NOT_AVAILABLE, 11) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_UNKNOWN_TARGETID, 12) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_NO_RADIO_RESOURCES_AVAILABLE_IN_TARGET_CELL, 13) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_UNKNOWN_LOCAL_UE_NGAP_ID, 14) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_INCONSISTENT_REMOTE_UE_NGAP_ID, 15) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_HANDOVER_DESIRABLE_FOR_RADIO_REASON, 16) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_TIME_CRITICAL_HANDOVER, 17) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_RESOURCE_OPTIMISATION_HANDOVER, 18) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_REDUCE_LOAD_IN_SERVING_CELL, 19) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_USER_INACTIVITY, 20) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_RADIO_CONNECTION_WITH_UE_LOST, 21) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_RADIO_RESOURCES_NOT_AVAILABLE, 22) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_INVALID_QOS_COMBINATION, 23) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_FAILURE_IN_RADIO_INTERFACE_PROCEDURE, 24) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_INTERACTION_WITH_OTHER_PROCEDURE, 25) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_UNKNOWN_PDU_SESSION_ID, 26) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_UNKNOWN_QOS_FLOW_ID, 27) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_MULTIPLE_PDU_SESSION_ID_INSTANCES, 28) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_MULTIPLE_QOS_FLOW_ID_INSTANCES, 29) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_ENCRYPTION_AND_OR_INTEGRITY_PROTECTION_ALGORITHMS_NOT_SUPPORTED, 30) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_NG_INTRA_SYSTEM_HANDOVER_TRIGGERED, 31) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_NG_INTER_SYSTEM_HANDOVER_TRIGGERED, 32) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_XN_HANDOVER_TRIGGERED, 33) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_NOT_SUPPORTED_5QI_VALUE, 34) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_UE_CONTEXT_TRANSFER, 35) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_IMS_VOICE_EPS_FALLBACK_OR_RAT_FALLBACK_TRIGGERED, 36) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_UP_INTEGRITY_PROTECTION_NOT_POSSIBLE, 37) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_UP_CONFIDENTIALITY_PROTECTION_NOT_POSSIBLE, 38) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_SLICE_NOT_SUPPORTED, 39) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_UE_IN_RRC_INACTIVE_STATE_NOT_REACHABLE, 40) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_REDIRECTION, 41) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_RESOURCES_NOT_AVAILABLE_FOR_THE_SLICE, 42) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_UE_MAX_INTEGRITY_PROTECTED_DATA_RATE_REASON, 43) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_RELEASE_DUE_TO_CN_DETECTED_MOBILITY, 44) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_N26_INTERFACE_NOT_AVAILABLE, 45) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_RELEASE_DUE_TO_PRE_EMPTION, 46) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_MULTIPLE_LOCATION_REPORTING_REFERENCE_ID_INSTANCES, 47) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_RSN_NOT_AVAILABLE_FOR_THE_UP, 48) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_NPN_ACCESS_DENIED, 49) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_CAG_ONLY_ACCESS_DENIED, 50) \ + CAUSE_DEF(NGAP_CAUSE_RADIO_NETWORK_INSUFFICIENT_UE_CAPABILITIES, 51) -/** - * NGAP protocol cause values as per 9.3.1.2 `Cause` section in 3GPP TS 38.413. - */ -typedef enum ngap_cause_protocol_e { - NGAP_CAUSE_PROTOCOL_TRANSFER_SYNTAX_ERROR, - NGAP_CAUSE_PROTOCOL_ABSTRACT_SYNTAX_ERROR_REJECT, - NGAP_CAUSE_PROTOCOL_ABSTRACT_SYNTAX_ERROR_IGNORE, - NGAP_CAUSE_PROTOCOL_MSG_NOT_COMPATIBLE_WITH_RECEIVER_STATE, - NGAP_CAUSE_PROTOCOL_SEMANTIC_ERROR, - NGAP_CAUSE_PROTOCOL_ABSTRACT_SYNTAX_ERROR_FCM, - NGAP_CAUSE_PROTOCOL_UNSPECIFIED -} ngap_cause_protocol_t; +typedef enum { FOREACH_CAUSE_RADIO_NETWORK(TO_ENUM) } ngap_cause_radio_network_t; + +/** NGAP protocol cause values (9.3.1.2 of 3GPP TS 38.413) */ +#define FOREACH_CAUSE_PROTOCOL(CAUSE_DEF) \ + CAUSE_DEF(NGAP_CAUSE_PROTOCOL_TRANSFER_SYNTAX_ERROR, 0) \ + CAUSE_DEF(NGAP_CAUSE_PROTOCOL_ABSTRACT_SYNTAX_ERROR_REJECT, 1) \ + CAUSE_DEF(NGAP_CAUSE_PROTOCOL_ABSTRACT_SYNTAX_ERROR_IGNORE, 2) \ + CAUSE_DEF(NGAP_CAUSE_PROTOCOL_MSG_NOT_COMPATIBLE_WITH_RECEIVER_STATE, 3) \ + CAUSE_DEF(NGAP_CAUSE_PROTOCOL_SEMANTIC_ERROR, 4) \ + CAUSE_DEF(NGAP_CAUSE_PROTOCOL_ABSTRACT_SYNTAX_ERROR_FCM, 5) \ + CAUSE_DEF(NGAP_CAUSE_PROTOCOL_UNSPECIFIED, 6) + +typedef enum { FOREACH_CAUSE_PROTOCOL(TO_ENUM) } ngap_cause_protocol_t; typedef struct pdusession_failed_s { /* Unique pdusession_id for the UE. */ diff --git a/openair3/NAS/NR_UE/5GS/5GMM/IES/FGSMobileIdentity.h b/openair3/NAS/NR_UE/5GS/5GMM/IES/FGSMobileIdentity.h index 4d6d4d7eed..f8dffa41c0 100644 --- a/openair3/NAS/NR_UE/5GS/5GMM/IES/FGSMobileIdentity.h +++ b/openair3/NAS/NR_UE/5GS/5GMM/IES/FGSMobileIdentity.h @@ -32,6 +32,7 @@ #include #include "OctetString.h" #include "fgs_nas_utils.h" +#include "common/utils/utils.h" // text_info_t, TO_ENUM, TO_TEXT #ifndef FGS_MOBILE_IDENTITY_H_ #define FGS_MOBILE_IDENTITY_H_ diff --git a/openair3/NAS/NR_UE/5GS/5GMM/MSG/fgmm_lib.h b/openair3/NAS/NR_UE/5GS/5GMM/MSG/fgmm_lib.h index 8d833e74aa..ff3447dc2c 100644 --- a/openair3/NAS/NR_UE/5GS/5GMM/MSG/fgmm_lib.h +++ b/openair3/NAS/NR_UE/5GS/5GMM/MSG/fgmm_lib.h @@ -32,6 +32,7 @@ #include #include "fgs_nas_utils.h" #include "common/utils/ds/byte_array.h" +#include "common/utils/utils.h" /* The following defines are valide for both PDU Session Status and PDU session Reactivation Result IEs */ diff --git a/openair3/NAS/NR_UE/5GS/5GSM/MSG/PduSessionEstablishmentAccept.c b/openair3/NAS/NR_UE/5GS/5GSM/MSG/PduSessionEstablishmentAccept.c index 1c0b0030ea..4fb7133e47 100644 --- a/openair3/NAS/NR_UE/5GS/5GSM/MSG/PduSessionEstablishmentAccept.c +++ b/openair3/NAS/NR_UE/5GS/5GSM/MSG/PduSessionEstablishmentAccept.c @@ -23,6 +23,7 @@ #include #include "PduSessionEstablishmentAccept.h" #include "common/utils/LOG/log.h" +#include "common/utils/utils.h" // text_info_t, TO_ENUM, TO_TEXT #include "fgs_nas_utils.h" /** diff --git a/openair3/NAS/NR_UE/5GS/5GSM/MSG/PduSessionEstablishmentAccept.h b/openair3/NAS/NR_UE/5GS/5GSM/MSG/PduSessionEstablishmentAccept.h index eb8738295b..190c34b004 100644 --- a/openair3/NAS/NR_UE/5GS/5GSM/MSG/PduSessionEstablishmentAccept.h +++ b/openair3/NAS/NR_UE/5GS/5GSM/MSG/PduSessionEstablishmentAccept.h @@ -25,6 +25,7 @@ #include #include #include "fgs_nas_utils.h" +#include "common/utils/utils.h" // text_info_t, TO_ENUM, TO_TEXT /* PDU Session Establish Accept Optional IE Identifiers - TS 24.501 Table 8.3.2.1.1 */ diff --git a/openair3/NAS/NR_UE/5GS/fgs_nas_utils.h b/openair3/NAS/NR_UE/5GS/fgs_nas_utils.h index e6c03cb635..f5fa69f8f2 100644 --- a/openair3/NAS/NR_UE/5GS/fgs_nas_utils.h +++ b/openair3/NAS/NR_UE/5GS/fgs_nas_utils.h @@ -29,15 +29,6 @@ #include "utils.h" // text_info_t, TO_ENUM, TO_TEXT #include "common/utils/eq_check.h" -/* Map task id to printable name. */ -typedef struct { - int id; - char text[256]; -} text_info_t; - -#define TO_TEXT(LabEl, nUmID) {nUmID, #LabEl}, -#define TO_ENUM(LabEl, nUmID ) LabEl = nUmID, - #define GET_SHORT(input, size) ({ \ uint16_t tmp16; \ memcpy(&tmp16, (input), sizeof(tmp16)); \ From 41942c96d2337a7e6b388cf083ee721d2fec1ae9 Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Mon, 29 Dec 2025 16:36:12 +0100 Subject: [PATCH 26/37] Refactor (NGAP): split out NGAP utilities from common lib ngap_common.h is for common IEs enc/dec functions, utilities should go into a separate file. Changes in this commit: * Add ngap_utils.h (utilities) * Move helper macros (NGAP_ERROR, NGAP_DEBUG, NGAP_FIND_PROTOCOLIE_BY_ID, etc.) to ngap_utils.h * Move equality check macros (_NGAP_EQ_CHECK_*) to ngap_utils.h * Clean up includes This change is preparatory to the introduction the paging lib with unit tests, with the goal of reducing the inter-dependency between concurrent NGAP libs. --- openair3/NGAP/ngap_common.h | 38 ++----------------- openair3/NGAP/ngap_gNB_handlers.c | 2 + openair3/NGAP/ngap_utils.h | 61 +++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+), 35 deletions(-) create mode 100644 openair3/NGAP/ngap_utils.h diff --git a/openair3/NGAP/ngap_common.h b/openair3/NGAP/ngap_common.h index 0ae5417d01..c2426a7b8a 100644 --- a/openair3/NGAP/ngap_common.h +++ b/openair3/NGAP/ngap_common.h @@ -36,49 +36,17 @@ #ifndef NGAP_COMMON_H_ #define NGAP_COMMON_H_ -#include "common/utils/LOG/log.h" +#include #include "oai_asn1.h" +#include "ngap_utils.h" #include "ngap_msg_includes.h" -#include "openair2/COMMON/ngap_messages_types.h" +#include "ngap_messages_types.h" /* Checking version of ASN1C compiler */ #if (ASN1C_ENVIRONMENT_VERSION < ASN1C_MINIMUM_VERSION) # error "You are compiling ngap with the wrong version of ASN1C" #endif -# include "common/utils/LOG/log.h" -# include "ngap_gNB_default_values.h" -# define NGAP_ERROR(x, args...) LOG_E(NGAP, x, ##args) -# define NGAP_WARN(x, args...) LOG_W(NGAP, x, ##args) -# define NGAP_TRAF(x, args...) LOG_I(NGAP, x, ##args) -# define NGAP_INFO(x, args...) LOG_I(NGAP, x, ##args) -# define NGAP_DEBUG(x, args...) LOG_D(NGAP, x, ##args) - -#define NGAP_FIND_PROTOCOLIE_BY_ID(IE_TYPE, ie, container, IE_ID, mandatory) \ - do { \ - IE_TYPE **ptr; \ - ie = NULL; \ - for (ptr = container->protocolIEs.list.array; ptr < &container->protocolIEs.list.array[container->protocolIEs.list.count]; ptr++) { \ - if ((*ptr)->id == IE_ID) { \ - ie = *ptr; \ - break; \ - } \ - } \ - if (ie == NULL) { \ - if (mandatory) { \ - AssertFatal(NGAP, "NGAP_FIND_PROTOCOLIE_BY_ID ie is NULL (searching for ie: %ld)\n", IE_ID); \ - } else { \ - NGAP_DEBUG("NGAP_FIND_PROTOCOLIE_BY_ID ie is NULL (searching for ie: %ld)\n", IE_ID); \ - } \ - } \ - } while (0); \ - if (mandatory && !ie) \ - return -1 - -/** \brief Function callback prototype. - **/ -typedef int (*ngap_message_decoded_callback)(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu); - void tnl_to_bitstring(BIT_STRING_t *out, const transport_layer_addr_t in); void bitstring_to_tnl(transport_layer_addr_t *out, const BIT_STRING_t in); void encode_ngap_cause(NGAP_Cause_t *out, const ngap_cause_t *in); diff --git a/openair3/NGAP/ngap_gNB_handlers.c b/openair3/NGAP/ngap_gNB_handlers.c index 1e5b024190..6e48505ff4 100644 --- a/openair3/NGAP/ngap_gNB_handlers.c +++ b/openair3/NGAP/ngap_gNB_handlers.c @@ -1529,6 +1529,8 @@ static int ngap_gNB_handle_dl_ran_status_transfer(sctp_assoc_t assoc_id, uint32_ return 0; } +typedef int (*ngap_message_decoded_callback)(sctp_assoc_t assoc_id, uint32_t stream, NGAP_NGAP_PDU_t *pdu); + /* Handlers matrix. Only gNB related procedure present here */ const ngap_message_decoded_callback ngap_messages_callback[][3] = { {0, 0, 0}, /* AMFConfigurationUpdate */ diff --git a/openair3/NGAP/ngap_utils.h b/openair3/NGAP/ngap_utils.h new file mode 100644 index 0000000000..34d288fb27 --- /dev/null +++ b/openair3/NGAP/ngap_utils.h @@ -0,0 +1,61 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface Software Alliance: + * contact@openairinterface.org + */ + +#ifndef NGAP_UTILS_H_ +#define NGAP_UTILS_H_ + +#include +#include +#include +#include "common/utils/LOG/log.h" +#include "assertions.h" + +#define NGAP_UE_ID_FMT "0x%06" PRIX32 + +#define NGAP_ERROR(x, args...) LOG_E(NGAP, x, ##args) +#define NGAP_WARN(x, args...) LOG_W(NGAP, x, ##args) +#define NGAP_TRAF(x, args...) LOG_I(NGAP, x, ##args) +#define NGAP_INFO(x, args...) LOG_I(NGAP, x, ##args) +#define NGAP_DEBUG(x, args...) LOG_D(NGAP, x, ##args) + +#define NGAP_FIND_PROTOCOLIE_BY_ID(IE_TYPE, ie, container, IE_ID, mandatory) \ + do { \ + IE_TYPE **ptr; \ + ie = NULL; \ + for (ptr = container->protocolIEs.list.array; ptr < &container->protocolIEs.list.array[container->protocolIEs.list.count]; \ + ptr++) { \ + if ((*ptr)->id == IE_ID) { \ + ie = *ptr; \ + break; \ + } \ + } \ + if (ie == NULL) { \ + if (mandatory) { \ + AssertFatal(NGAP, "NGAP_FIND_PROTOCOLIE_BY_ID ie is NULL (searching for ie: %ld)\n", IE_ID); \ + } else { \ + NGAP_DEBUG("NGAP_FIND_PROTOCOLIE_BY_ID ie is NULL (searching for ie: %ld)\n", IE_ID); \ + } \ + } \ + } while (0); \ + if (mandatory && !ie) \ + return -1 + +#endif /* NGAP_UTILS_H_ */ From b026e6b4ee19d6d5c4d487fb938f454d4b353684 Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Thu, 13 Nov 2025 15:24:57 +0100 Subject: [PATCH 27/37] Paging (NGAP): add paging encode/decode library and unit tests (3GPP TS 38.413) - Refactor ngap_paging_ind_t (openair2/COMMON/ngap_messages_types.h): - optional paging_drx and paging_priority as pointers - TAI list as tai_list[] and n_tai - add optional IEs: Paging Origin, Paging Attempt Information, UE Radio Capability for Paging. - Introduce nr_tai_t, ngap_paging_attempt_info_t, ngap_paging_origin_t; - generate paging enums via FOREACH macros. - Add NGAP Paging encode/decode/eq/free in openair3/NGAP/ngap_gNB_paging.c (encode_ng_paging, decode_ng_paging, eq_ng_paging, free_ng_paging). - Replace inline Paging decode in ngap_gNB_handle_paging() with decode_ng_paging() and add error handling; add eq_ngap_plmn() in ngap_common. - Update rrc_gNB_NGAP.c to use tai_list/n_tai and optional paging_drx when forwarding paging to F1AP. - Add ASN.1 includes for Paging in ngap_msg_includes.h; register ngap_gNB_paging.c in root CMakeLists.txt. - Add NGAP unit test (openair3/NGAP/tests/ngap_lib_test.c): encode/decode roundtrip for Paging; tests subdirectory and executable under ENABLE_TESTS in openair3/NGAP/CMakeLists.txt. --- CMakeLists.txt | 4 + openair2/COMMON/ngap_messages_types.h | 124 +++++----- openair2/RRC/NR/rrc_gNB_NGAP.c | 11 +- openair3/NGAP/CMakeLists.txt | 4 + openair3/NGAP/ngap_common.c | 12 + openair3/NGAP/ngap_common.h | 2 + openair3/NGAP/ngap_gNB_handlers.c | 71 +----- openair3/NGAP/ngap_gNB_paging.c | 330 ++++++++++++++++++++++++++ openair3/NGAP/ngap_gNB_paging.h | 50 ++++ openair3/NGAP/ngap_msg_includes.h | 6 + openair3/NGAP/ngap_utils.h | 1 + openair3/NGAP/tests/CMakeLists.txt | 6 + openair3/NGAP/tests/ngap_lib_test.c | 133 +++++++++++ 13 files changed, 636 insertions(+), 118 deletions(-) create mode 100644 openair3/NGAP/ngap_gNB_paging.c create mode 100644 openair3/NGAP/ngap_gNB_paging.h create mode 100644 openair3/NGAP/tests/CMakeLists.txt create mode 100644 openair3/NGAP/tests/ngap_lib_test.c diff --git a/CMakeLists.txt b/CMakeLists.txt index f0b080f5c8..70404701a4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -434,6 +434,7 @@ add_library(ngap ${NGAP_DIR}/ngap_gNB_handlers.c ${NGAP_DIR}/ngap_gNB_itti_messaging.c ${NGAP_DIR}/ngap_gNB_management_procedures.c + ${NGAP_DIR}/ngap_gNB_paging.c ${NGAP_DIR}/ngap_gNB_nas_procedures.c ${NGAP_DIR}/ngap_gNB_pdu_session_management.c ${NGAP_DIR}/ngap_gNB_nnsf.c @@ -443,6 +444,9 @@ add_library(ngap ) target_link_libraries(ngap PUBLIC asn1_ngap) target_link_libraries(ngap PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs) +if(ENABLE_TESTS) + target_compile_definitions(ngap PRIVATE ENABLE_TESTS) +endif() #M2AP ############## diff --git a/openair2/COMMON/ngap_messages_types.h b/openair2/COMMON/ngap_messages_types.h index 08d93c6b10..02069d056e 100644 --- a/openair2/COMMON/ngap_messages_types.h +++ b/openair2/COMMON/ngap_messages_types.h @@ -32,7 +32,6 @@ #include "common/5g_platform_types.h" #include "common/platform_constants.h" #include "common/platform_types.h" -#include "common/5g_platform_types.h" #include "s1ap_messages_types.h" #include "ds/byte_array.h" #include "utils.h" @@ -89,39 +88,46 @@ #define NGAP_MAX_NB_AMF_IP_ADDRESS 10 -#define NGAP_MAX_NO_TAI_PAGING 16 // 9.2.4.1 3GPP TS 38.413 - /* Security key length used within gNB * Even if only 16 bytes will be effectively used, * the key length is 32 bytes (256 bits) */ #define SECURITY_KEY_LENGTH 32 -typedef enum ngap_paging_drx_e { - NGAP_PAGING_DRX_32 = 0x0, - NGAP_PAGING_DRX_64 = 0x1, - NGAP_PAGING_DRX_128 = 0x2, - NGAP_PAGING_DRX_256 = 0x3 -} ngap_paging_drx_t; +#define NGAP_MAX_NO_TAI_PAGING 16 // 9.2.4.1 3GPP TS 38.413 -/* Lower value codepoint - * indicates higher priority. - */ -typedef enum ngap_paging_priority_s { - NGAP_PAGING_PRIO_LEVEL1 = 0, - NGAP_PAGING_PRIO_LEVEL2 = 1, - NGAP_PAGING_PRIO_LEVEL3 = 2, - NGAP_PAGING_PRIO_LEVEL4 = 3, - NGAP_PAGING_PRIO_LEVEL5 = 4, - NGAP_PAGING_PRIO_LEVEL6 = 5, - NGAP_PAGING_PRIO_LEVEL7 = 6, - NGAP_PAGING_PRIO_LEVEL8 = 7 -} ngap_paging_priority_t; +/* Paging DRX values (3GPP TS 38.413) */ +#define FOREACH_PAGING_DRX(DRX_DEF) \ + DRX_DEF(NGAP_PAGING_DRX_32, 0x0) \ + DRX_DEF(NGAP_PAGING_DRX_64, 0x1) \ + DRX_DEF(NGAP_PAGING_DRX_128, 0x2) \ + DRX_DEF(NGAP_PAGING_DRX_256, 0x3) -typedef enum ngap_cn_domain_s { - NGAP_CN_DOMAIN_PS = 1, - NGAP_CN_DOMAIN_CS = 2 -} ngap_cn_domain_t; +/* Lower value codepoint indicates higher priority (3GPP TS 38.413) */ +#define FOREACH_PAGING_PRIORITY(PRIO_DEF) \ + PRIO_DEF(NGAP_PAGING_PRIO_LEVEL1, 0) \ + PRIO_DEF(NGAP_PAGING_PRIO_LEVEL2, 1) \ + PRIO_DEF(NGAP_PAGING_PRIO_LEVEL3, 2) \ + PRIO_DEF(NGAP_PAGING_PRIO_LEVEL4, 3) \ + PRIO_DEF(NGAP_PAGING_PRIO_LEVEL5, 4) \ + PRIO_DEF(NGAP_PAGING_PRIO_LEVEL6, 5) \ + PRIO_DEF(NGAP_PAGING_PRIO_LEVEL7, 6) \ + PRIO_DEF(NGAP_PAGING_PRIO_LEVEL8, 7) + +/* Paging Origin (9.3.3.22 of 3GPP TS 38.413) */ +#define FOREACH_PAGING_ORIGIN(ORIGIN_DEF) ORIGIN_DEF(NGAP_PAGING_ORIGIN_NON_3GPP, 0) + +static const text_info_t paging_drx_text[] = {FOREACH_PAGING_DRX(TO_TEXT)}; + +static const text_info_t paging_prio_text[] = {FOREACH_PAGING_PRIORITY(TO_TEXT)}; + +static const text_info_t paging_origin_text[] = {FOREACH_PAGING_ORIGIN(TO_TEXT)}; + +typedef enum { FOREACH_PAGING_DRX(TO_ENUM) } ngap_paging_drx_t; + +typedef enum { FOREACH_PAGING_PRIORITY(TO_ENUM) } ngap_paging_priority_t; + +typedef enum { FOREACH_PAGING_ORIGIN(TO_ENUM) } ngap_paging_origin_t; typedef struct ngap_net_ip_address_s { unsigned ipv4:1; @@ -171,10 +177,6 @@ typedef struct fiveg_s_tmsi_s { uint32_t m_tmsi; } fiveg_s_tmsi_t; -typedef struct ngap_ue_paging_identity_s { - fiveg_s_tmsi_t s_tmsi; -} ngap_ue_paging_identity_t; - typedef enum ngap_ue_identities_presenceMask_e { NGAP_UE_IDENTITIES_FiveG_s_tmsi = 1 << 1, NGAP_UE_IDENTITIES_guami = 1 << 2, @@ -797,29 +799,6 @@ typedef struct ngap_initial_context_setup_req_s { byte_array_t nas_pdu; } ngap_initial_context_setup_req_t; - -typedef struct ngap_paging_ind_s { - /* UE paging identity */ - ngap_ue_paging_identity_t ue_paging_identity; - - /* Indicates origin of paging */ - ngap_cn_domain_t cn_domain; - - /* PLMN_identity in TAI of Paging*/ - plmn_id_t plmn_identity[NGAP_MAX_NO_TAI_PAGING]; - - /* TAC in TAIList of Paging*/ - int16_t tac[NGAP_MAX_NO_TAI_PAGING]; - - /* size of TAIList*/ - int16_t tai_size; - - /* Optional fields */ - ngap_paging_drx_t paging_drx; - - ngap_paging_priority_t paging_priority; -} ngap_paging_ind_t; - typedef struct ngap_pdusession_setup_req_s { /* UE id for initial connection to NGAP */ uint32_t gNB_ue_ngap_id; @@ -946,6 +925,45 @@ typedef struct ngap_pdusession_release_resp_s { pdusession_release_t pdusession_release[NGAP_MAX_PDU_SESSION]; } ngap_pdusession_release_resp_t; +/** NG PAGING PROCEDURES (9.2.4. of 3GPP TS 38.413) */ + +typedef struct { + plmn_id_t plmn; + uint16_t tac; +} nr_tai_t; + +typedef struct ngap_ue_paging_identity_s { + fiveg_s_tmsi_t s_tmsi; +} ngap_ue_paging_identity_t; + +/** 9.3.1.72 Paging Attempt Information (3GPP TS 38.413) */ +typedef struct { + /* Paging Attempt Count */ + uint8_t paging_attempt_count; + /* Intended Number of Paging Attempts */ + uint8_t intended_paging_attempts; +} ngap_paging_attempt_info_t; + +/** 9.2.4.1 3GPP TS 38.413 */ +typedef struct { + /* UE paging identity */ + ngap_ue_paging_identity_t ue_paging_identity; + + /* TAI List for Paging */ + nr_tai_t tai_list[NGAP_MAX_NO_TAI_PAGING]; + int16_t n_tai; + + /* Optional fields */ + ngap_paging_drx_t *paging_drx; + ngap_paging_priority_t *paging_priority; + /* UE Radio Capability for Paging (optional) */ + byte_array_t *ue_radio_capability; + /* Paging Origin (optional) */ + ngap_paging_origin_t *origin; + /* Assistance Data for Paging (optional) */ + ngap_paging_attempt_info_t *paging_attempt_info; +} ngap_paging_ind_t; + /** 9.2.3.14 Uplink RAN Status Transfer (3GPP TS 38.413) * COUNT value used for both UL and DL PDCP SN + HFN (12-bit or 18-bit SN) */ diff --git a/openair2/RRC/NR/rrc_gNB_NGAP.c b/openair2/RRC/NR/rrc_gNB_NGAP.c index 8ebd0b0a37..d86b77a188 100644 --- a/openair2/RRC/NR/rrc_gNB_NGAP.c +++ b/openair2/RRC/NR/rrc_gNB_NGAP.c @@ -1632,19 +1632,20 @@ int rrc_gNB_process_NGAP_PDUSESSION_RELEASE_COMMAND(ngap_pdusession_release_comm int rrc_gNB_process_PAGING_IND(MessageDef *msg_p, instance_t instance) { ngap_paging_ind_t *msg = &NGAP_PAGING_IND(msg_p); - for (uint16_t tai_size = 0; tai_size < msg->tai_size; tai_size++) { - plmn_id_t *p = &msg->plmn_identity[tai_size]; + for (uint16_t tai_idx = 0; tai_idx < msg->n_tai; tai_idx++) { + nr_tai_t *tai = &msg->tai_list[tai_idx]; + plmn_id_t *p = &tai->plmn; LOG_I(NR_RRC, "[gNB %ld] TAI List for Paging: MCC=%03d, MNC=%0*d, TAC=%d\n", instance, p->mcc, p->mnc_digit_length, p->mnc, - msg->tac[tai_size]); + tai->tac); nr_rrc_config_t *req = &RC.nrrrc[instance]->configuration; for (uint8_t j = 0; j < req->num_plmn; j++) { plmn_id_t *req_plmn = &req->plmn[j]; - if (req_plmn->mcc == p->mcc && req_plmn->mnc == p->mnc && req->tac == msg->tac[tai_size]) { + if (req_plmn->mcc == p->mcc && req_plmn->mnc == p->mnc && req->tac == tai->tac) { for (uint8_t CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { AssertFatal(false, "to be implemented properly\n"); if (NODE_IS_CU(RC.nrrrc[instance]->node_type)) { @@ -1669,7 +1670,7 @@ int rrc_gNB_process_PAGING_IND(MessageDef *msg_p, instance_t instance) F1AP_PAGING_IND(m).nr_cellid = cell->info.cell_id; F1AP_PAGING_IND(m).ueidentityindexvalue = (uint16_t)(msg->ue_paging_identity.s_tmsi.m_tmsi % 1024); F1AP_PAGING_IND(m).fiveg_s_tmsi = msg->ue_paging_identity.s_tmsi.m_tmsi; - F1AP_PAGING_IND(m).paging_drx = msg->paging_drx; + F1AP_PAGING_IND(m).paging_drx = msg->paging_drx ? (uint8_t)*msg->paging_drx : 0; LOG_E(F1AP, "ueidentityindexvalue %u fiveg_s_tmsi %ld paging_drx %u\n", F1AP_PAGING_IND (m).ueidentityindexvalue, F1AP_PAGING_IND (m).fiveg_s_tmsi, F1AP_PAGING_IND (m).paging_drx); itti_send_msg_to_task(TASK_CU_F1, instance, m); } else { diff --git a/openair3/NGAP/CMakeLists.txt b/openair3/NGAP/CMakeLists.txt index 7537bd661d..658bfeee5a 100644 --- a/openair3/NGAP/CMakeLists.txt +++ b/openair3/NGAP/CMakeLists.txt @@ -1 +1,5 @@ add_subdirectory(MESSAGES) + +if(ENABLE_TESTS) + add_subdirectory(tests) +endif() diff --git a/openair3/NGAP/ngap_common.c b/openair3/NGAP/ngap_common.c index 3923586989..c14b6c80d8 100644 --- a/openair3/NGAP/ngap_common.c +++ b/openair3/NGAP/ngap_common.c @@ -27,6 +27,7 @@ * \version 0.1 */ +#include #include #include #include "conversions.h" @@ -331,3 +332,14 @@ byte_array_t encode_ngap_pdusession_setup_response_transfer(const pdusession_set out.len = res.result.encoded; return out; } + +bool eq_ngap_plmn(const plmn_id_t *a, const plmn_id_t *b) +{ + if (a == NULL || b == NULL) { + return false; + } + _EQ_CHECK_INT(a->mcc, b->mcc); + _EQ_CHECK_INT(a->mnc, b->mnc); + _EQ_CHECK_INT(a->mnc_digit_length, b->mnc_digit_length); + return true; +} diff --git a/openair3/NGAP/ngap_common.h b/openair3/NGAP/ngap_common.h index c2426a7b8a..64b073720e 100644 --- a/openair3/NGAP/ngap_common.h +++ b/openair3/NGAP/ngap_common.h @@ -63,5 +63,7 @@ void *decode_pdusession_transfer(const asn_TYPE_descriptor_t *td, const OCTET_ST bool decodePDUSessionResourceSetup(pdusession_transfer_t *out, const OCTET_STRING_t in); byte_array_t encode_ngap_pdusession_setup_response_transfer(const pdusession_setup_t *pdusession); +bool eq_ngap_plmn(const plmn_id_t *a, const plmn_id_t *b); + /** @}*/ #endif /* NGAP_COMMON_H_ */ diff --git a/openair3/NGAP/ngap_gNB_handlers.c b/openair3/NGAP/ngap_gNB_handlers.c index 6e48505ff4..fc87bd2d45 100644 --- a/openair3/NGAP/ngap_gNB_handlers.c +++ b/openair3/NGAP/ngap_gNB_handlers.c @@ -49,6 +49,7 @@ #include "ngap_gNB_mobility_management.h" #include "ngap_gNB_pdu_session_management.h" #include "ngap_gNB_nas_procedures.h" +#include "ngap_gNB_paging.h" #include "ngap_gNB_trace.h" #include "ngap_gNB_ue_context.h" #include "ngap_messages_types.h" @@ -1101,10 +1102,7 @@ static int ngap_gNB_handle_paging(sctp_assoc_t assoc_id, uint32_t stream, NGAP_N { ngap_gNB_amf_data_t *amf_desc_p = NULL; ngap_gNB_instance_t *ngap_gNB_instance = NULL; - NGAP_Paging_t *container; - NGAP_PagingIEs_t *ie; DevAssert(pdu != NULL); - container = &pdu->choice.initiatingMessage->value.choice.Paging; // received Paging Message from AMF NGAP_DEBUG("[SCTP %u] Received Paging Message From AMF\n",assoc_id); @@ -1130,67 +1128,20 @@ static int ngap_gNB_handle_paging(sctp_assoc_t assoc_id, uint32_t stream, NGAP_N } MessageDef *message_p = itti_alloc_new_message(TASK_NGAP, 0, NGAP_PAGING_IND); - ngap_paging_ind_t * msg=&NGAP_PAGING_IND(message_p); - memset(msg, 0, sizeof(*msg)); + ngap_paging_ind_t *msg = &NGAP_PAGING_IND(message_p); - /* convert NGAP_PagingIEs_t to ngap_paging_ind_t */ - /* id-UEIdentityIndexValue : convert UE Identity Index value */ - NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PagingIEs_t, ie, container, NGAP_ProtocolIE_ID_id_UEPagingIdentity, true); - - struct NGAP_FiveG_S_TMSI *fiveG_S_TMSI = ie->value.choice.UEPagingIdentity.choice.fiveG_S_TMSI; - OCTET_STRING_TO_INT16(&fiveG_S_TMSI->aMFSetID, msg->ue_paging_identity.s_tmsi.amf_set_id); - OCTET_STRING_TO_INT8(&fiveG_S_TMSI->aMFPointer, msg->ue_paging_identity.s_tmsi.amf_pointer); - OCTET_STRING_TO_INT32(&fiveG_S_TMSI->fiveG_TMSI, msg->ue_paging_identity.s_tmsi.m_tmsi); - - NGAP_DEBUG("[SCTP %u] Received Paging Identity amf_set_id %d, amf_pointer %d, m_tmsi %d\n", - assoc_id, - msg->ue_paging_identity.s_tmsi.amf_set_id, - msg->ue_paging_identity.s_tmsi.amf_pointer, - msg->ue_paging_identity.s_tmsi.m_tmsi); - - msg->paging_drx = NGAP_PAGING_DRX_256; - /* id-pagingDRX */ - NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PagingIEs_t, ie, container, NGAP_ProtocolIE_ID_id_PagingDRX, false); - - /* optional */ - if (ie) { - msg->paging_drx = ie->value.choice.PagingDRX; - } else { - msg->paging_drx = NGAP_PAGING_DRX_256; + /* Decode NGAP Paging message */ + if (!decode_ng_paging(msg, pdu)) { + NGAP_ERROR("[SCTP %u] Failed to decode NGAP Paging message\n", assoc_id); + free_ng_paging(msg); + itti_free(TASK_NGAP, message_p); + return -1; } - /* id-TAIList */ - NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PagingIEs_t, ie, container, - NGAP_ProtocolIE_ID_id_TAIListForPaging, true); + /* send message to RRC */ + itti_send_msg_to_task(TASK_RRC_GNB, ngap_gNB_instance->instance, message_p); - NGAP_INFO("[SCTP %u] Received Paging taiList For Paging: count %d\n", assoc_id, ie->value.choice.TAIListForPaging.list.count); - - for (int i = 0; i < ie->value.choice.TAIListForPaging.list.count; i++) { - NGAP_TAIListForPagingItem_t *item_p; - item_p = (NGAP_TAIListForPagingItem_t *)ie->value.choice.TAIListForPaging.list.array[i]; - TBCD_TO_MCC_MNC(&(item_p->tAI.pLMNIdentity), msg->plmn_identity[i].mcc, msg->plmn_identity[i].mnc, msg->plmn_identity[i].mnc_digit_length); - OCTET_STRING_TO_INT16(&(item_p->tAI.tAC), msg->tac[i]); - msg->tai_size++; - plmn_id_t *p = &msg->plmn_identity[i]; - LOG_D(NGAP, - "[SCTP %u] PLMN in TAI list for Paging: MCC=%03d, MNC=%0*d, TAC=%d\n", - assoc_id, - p->mcc, - p->mnc_digit_length, - p->mnc, - msg->tac[i]); - } - - //paging parameter values - NGAP_DEBUG("[SCTP %u] Received Paging parameters: Paging Identity amf_set_id %d amf_pointer %d m_tmsi %d paging_drx %d paging_priority %d\n",assoc_id, - msg->ue_paging_identity.s_tmsi.amf_set_id, - msg->ue_paging_identity.s_tmsi.amf_pointer, - msg->ue_paging_identity.s_tmsi.m_tmsi, - msg->paging_drx, msg->paging_priority); - /* send message to RRC */ - itti_send_msg_to_task(TASK_RRC_GNB, ngap_gNB_instance->instance, message_p); - - return 0; + return 0; } static bool decodePDUSessionResourceModify(pdusession_transfer_t *out, const OCTET_STRING_t in) diff --git a/openair3/NGAP/ngap_gNB_paging.c b/openair3/NGAP/ngap_gNB_paging.c new file mode 100644 index 0000000000..5a94c56fb8 --- /dev/null +++ b/openair3/NGAP/ngap_gNB_paging.c @@ -0,0 +1,330 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface Software Alliance: + * contact@openairinterface.org + */ + +#include +#include "assertions.h" +#include "common/utils/utils.h" +#include "common/utils/ds/byte_array.h" +#include "conversions.h" +#include "ngap_common.h" +#include "ngap_gNB_paging.h" +#include "ngap_msg_includes.h" +#include "oai_asn1.h" + +/* Paging Attempt range (TS 38.413 §9.3.1.72) */ +#define NGAP_PAGING_ATTEMPT_MIN 1 +#define NGAP_PAGING_ATTEMPT_MAX 16 + +/** @brief Return text label at index in text_info array */ +static const char *text_info_at(int index, const text_info_t *info_array, size_t array_size) +{ + DevAssert(index >= 0 && index < array_size); + return info_array[index].text; +} + +/** @brief Encode NGAP Paging message (9.2.4.1 of 3GPP TS 38.413) + * @param msg Pointer to paging indication structure to encode + * @return Pointer to allocated NGAP_NGAP_PDU_t */ +NGAP_NGAP_PDU_t *encode_ng_paging(const ngap_paging_ind_t *msg) +{ + DevAssert(msg != NULL); + + NGAP_NGAP_PDU_t *pdu = calloc_or_fail(1, sizeof(NGAP_NGAP_PDU_t)); + + pdu->present = NGAP_NGAP_PDU_PR_initiatingMessage; + asn1cCalloc(pdu->choice.initiatingMessage, head); + head->procedureCode = NGAP_ProcedureCode_id_Paging; + head->criticality = NGAP_Criticality_ignore; + head->value.present = NGAP_InitiatingMessage__value_PR_Paging; + NGAP_Paging_t *container = &head->value.choice.Paging; + + // UE Paging Identity (M) + asn1cSequenceAdd(container->protocolIEs.list, NGAP_PagingIEs_t, ie); + ie->id = NGAP_ProtocolIE_ID_id_UEPagingIdentity; + ie->criticality = NGAP_Criticality_reject; + ie->value.present = NGAP_PagingIEs__value_PR_UEPagingIdentity; + ie->value.choice.UEPagingIdentity.present = NGAP_UEPagingIdentity_PR_fiveG_S_TMSI; + asn1cCalloc(ie->value.choice.UEPagingIdentity.choice.fiveG_S_TMSI, fiveg_s_tmsi); + const fiveg_s_tmsi_t *s_tmsi = &msg->ue_paging_identity.s_tmsi; + AMF_SETID_TO_BIT_STRING(s_tmsi->amf_set_id, &fiveg_s_tmsi->aMFSetID); + AMF_POINTER_TO_BIT_STRING(s_tmsi->amf_pointer, &fiveg_s_tmsi->aMFPointer); + M_TMSI_TO_OCTET_STRING(s_tmsi->m_tmsi, &fiveg_s_tmsi->fiveG_TMSI); + + // TAI List for Paging (M) + asn1cSequenceAdd(container->protocolIEs.list, NGAP_PagingIEs_t, ie1); + ie1->id = NGAP_ProtocolIE_ID_id_TAIListForPaging; + ie1->criticality = NGAP_Criticality_reject; + ie1->value.present = NGAP_PagingIEs__value_PR_TAIListForPaging; + + for (int i = 0; i < msg->n_tai; i++) { + asn1cSequenceAdd(ie1->value.choice.TAIListForPaging.list, NGAP_TAIListForPagingItem_t, item); + NGAP_TAI_t *tai = &item->tAI; + const plmn_id_t *plmn = &msg->tai_list[i].plmn; + MCC_MNC_TO_TBCD(plmn->mcc, plmn->mnc, plmn->mnc_digit_length, &tai->pLMNIdentity); + INT24_TO_OCTET_STRING(msg->tai_list[i].tac, &tai->tAC); + } + + // Paging DRX (O) + if (msg->paging_drx != NULL) { + asn1cSequenceAdd(container->protocolIEs.list, NGAP_PagingIEs_t, ie2); + ie2->id = NGAP_ProtocolIE_ID_id_PagingDRX; + ie2->criticality = NGAP_Criticality_ignore; + ie2->value.present = NGAP_PagingIEs__value_PR_PagingDRX; + ie2->value.choice.PagingDRX = *msg->paging_drx; + } + + // Paging Priority (O) + if (msg->paging_priority != NULL) { + asn1cSequenceAdd(container->protocolIEs.list, NGAP_PagingIEs_t, ie3); + ie3->id = NGAP_ProtocolIE_ID_id_PagingPriority; + ie3->criticality = NGAP_Criticality_ignore; + ie3->value.present = NGAP_PagingIEs__value_PR_PagingPriority; + ie3->value.choice.PagingPriority = *msg->paging_priority; + } + + // UERadioCapabilityForPaging (O) + if (msg->ue_radio_capability != NULL && msg->ue_radio_capability->buf != NULL) { + const byte_array_t *ue_radio_cap_ba = msg->ue_radio_capability; + asn1cSequenceAdd(container->protocolIEs.list, NGAP_PagingIEs_t, ie4); + ie4->id = NGAP_ProtocolIE_ID_id_UERadioCapabilityForPaging; + ie4->criticality = NGAP_Criticality_ignore; + ie4->value.present = NGAP_PagingIEs__value_PR_UERadioCapabilityForPaging; + NGAP_UERadioCapabilityForPaging_t *ue_radio_cap = &ie4->value.choice.UERadioCapabilityForPaging; + // UERadioCapabilityForPaging is a SEQUENCE with optional OCTET_STRING fields (Encode as NR) + asn1cCalloc(ue_radio_cap->uERadioCapabilityForPagingOfNR, nr_field); + OCTET_STRING_fromBuf(nr_field, (const char *)ue_radio_cap_ba->buf, ue_radio_cap_ba->len); + } + + // PagingOrigin (O) + if (msg->origin != NULL) { + asn1cSequenceAdd(container->protocolIEs.list, NGAP_PagingIEs_t, ie5); + ie5->id = NGAP_ProtocolIE_ID_id_PagingOrigin; + ie5->criticality = NGAP_Criticality_ignore; + ie5->value.present = NGAP_PagingIEs__value_PR_PagingOrigin; + ie5->value.choice.PagingOrigin = *msg->origin; + } + + return pdu; +} + +/** @brief Free memory allocated for NGAP paging indication + * @param msg Pointer to paging indication structure to free */ +void free_ng_paging(ngap_paging_ind_t *msg) +{ + DevAssert(msg != NULL); + free(msg->paging_drx); + free(msg->paging_priority); + if (msg->ue_radio_capability != NULL) { + free_byte_array(*msg->ue_radio_capability); + free(msg->ue_radio_capability); + } + free(msg->origin); + free(msg->paging_attempt_info); +} + +/** @brief Decode NGAP Paging message (9.2.4.1 of 3GPP TS 38.413) + * @param out Pointer to output structure to fill + * @param pdu Pointer to NGAP PDU containing the Paging message + * @return true on success, false on failure */ +bool decode_ng_paging(ngap_paging_ind_t *out, const NGAP_NGAP_PDU_t *pdu) +{ + DevAssert(pdu != NULL); + DevAssert(out != NULL); + + if (pdu->present != NGAP_NGAP_PDU_PR_initiatingMessage) { + NGAP_ERROR("Invalid PDU present value for Paging message\n"); + return false; + } + + const NGAP_Paging_t *container = &pdu->choice.initiatingMessage->value.choice.Paging; + NGAP_PagingIEs_t *ie; + fiveg_s_tmsi_t *s_tmsi = &out->ue_paging_identity.s_tmsi; + + // Reset output structure + memset(out, 0, sizeof(*out)); + + // UE Paging Identity (M) + NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PagingIEs_t, ie, container, NGAP_ProtocolIE_ID_id_UEPagingIdentity, true); + + if (ie->value.choice.UEPagingIdentity.present == NGAP_UEPagingIdentity_PR_fiveG_S_TMSI) { + const struct NGAP_FiveG_S_TMSI *fiveG_S_TMSI = ie->value.choice.UEPagingIdentity.choice.fiveG_S_TMSI; + s_tmsi->amf_set_id = BIT_STRING_to_uint16(&fiveG_S_TMSI->aMFSetID); + s_tmsi->amf_pointer = BIT_STRING_to_uint8(&fiveG_S_TMSI->aMFPointer); + OCTET_STRING_TO_INT32(&fiveG_S_TMSI->fiveG_TMSI, s_tmsi->m_tmsi); + } else { + NGAP_ERROR("Unsupported UE Paging Identity type\n"); + return false; + } + + // TAI List for Paging (M) + NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PagingIEs_t, ie, container, NGAP_ProtocolIE_ID_id_TAIListForPaging, true); + + // Validate TAI list count + int tai_count = ie->value.choice.TAIListForPaging.list.count; + if (tai_count > NGAP_MAX_NO_TAI_PAGING) { + NGAP_ERROR("Invalid TAI list count: %d (must be <= %d)\n", tai_count, NGAP_MAX_NO_TAI_PAGING); + return false; + } + + out->n_tai = 0; + for (int i = 0; i < tai_count; i++) { + const NGAP_TAIListForPagingItem_t *item_p = ie->value.choice.TAIListForPaging.list.array[i]; + DevAssert(item_p != NULL); + const NGAP_TAI_t *tai = &item_p->tAI; + nr_tai_t *tai_out = &out->tai_list[i]; + TBCD_TO_MCC_MNC(&tai->pLMNIdentity, tai_out->plmn.mcc, tai_out->plmn.mnc, tai_out->plmn.mnc_digit_length); + OCTET_STRING_TO_INT24(&tai->tAC, tai_out->tac); + NGAP_DEBUG("TAI[%d] for paging: MCC=%03d, MNC=%0*d, TAC=%d\n", + i, + tai_out->plmn.mcc, + tai_out->plmn.mnc_digit_length, + tai_out->plmn.mnc, + tai_out->tac); + out->n_tai++; + } + + // Paging DRX (O) + NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PagingIEs_t, ie, container, NGAP_ProtocolIE_ID_id_PagingDRX, false); + if (ie != NULL) { + out->paging_drx = malloc_or_fail(sizeof(ngap_paging_drx_t)); + *out->paging_drx = ie->value.choice.PagingDRX; + const char *s = text_info_at(*out->paging_drx, paging_drx_text, sizeofArray(paging_drx_text)); + NGAP_DEBUG("Decoded Paging DRX: %s", s); + } + + // Paging Priority (O) + NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PagingIEs_t, ie, container, NGAP_ProtocolIE_ID_id_PagingPriority, false); + if (ie != NULL) { + out->paging_priority = malloc_or_fail(sizeof(ngap_paging_priority_t)); + *out->paging_priority = ie->value.choice.PagingPriority; + const char *s = text_info_at(*out->paging_priority, paging_prio_text, sizeofArray(paging_prio_text)); + NGAP_DEBUG("Decoded Paging Priority: %s", s); + } + + // UERadioCapabilityForPaging (O) + NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PagingIEs_t, ie, container, NGAP_ProtocolIE_ID_id_UERadioCapabilityForPaging, false); + if (ie != NULL) { + const NGAP_UERadioCapabilityForPaging_t *ue_radio_cap = &ie->value.choice.UERadioCapabilityForPaging; + const OCTET_STRING_t *nr_field = ue_radio_cap->uERadioCapabilityForPagingOfNR; + const OCTET_STRING_t *eutra_field = ue_radio_cap->uERadioCapabilityForPagingOfEUTRA; + if (nr_field != NULL) { + out->ue_radio_capability = malloc_or_fail(sizeof(byte_array_t)); + *out->ue_radio_capability = create_byte_array(nr_field->size, nr_field->buf); + NGAP_DEBUG("Decoded UERadioCapabilityForPaging (NR): %zu bytes\n", nr_field->size); + } else if (eutra_field != NULL) { + out->ue_radio_capability = malloc_or_fail(sizeof(byte_array_t)); + *out->ue_radio_capability = create_byte_array(eutra_field->size, eutra_field->buf); + NGAP_DEBUG("Decoded UERadioCapabilityForPaging (EUTRA): %zu bytes\n", eutra_field->size); + } else { + NGAP_WARN("UERadioCapabilityForPaging present but both NR and EUTRA fields are NULL\n"); + } + } + + // PagingOrigin (O) + NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PagingIEs_t, ie, container, NGAP_ProtocolIE_ID_id_PagingOrigin, false); + if (ie != NULL) { + // PagingOrigin shall be transferred to UE according to TS 38.331 and TS 36.331 + out->origin = calloc_or_fail(1, sizeof(*out->origin)); + *out->origin = ie->value.choice.PagingOrigin; + } + + // AssistanceDataForPaging (O) - contains PagingAttemptInformation + NGAP_FIND_PROTOCOLIE_BY_ID(NGAP_PagingIEs_t, ie, container, NGAP_ProtocolIE_ID_id_AssistanceDataForPaging, false); + if (ie != NULL) { + const NGAP_AssistanceDataForPaging_t *assistance_data = &ie->value.choice.AssistanceDataForPaging; + + // Extract PagingAttemptInformation if present (TS 38.413 §9.3.1.72) + if (assistance_data->pagingAttemptInformation != NULL) { + const NGAP_PagingAttemptInformation_t *paging_attempt_info = assistance_data->pagingAttemptInformation; + out->paging_attempt_info = calloc_or_fail(1, sizeof(ngap_paging_attempt_info_t)); + + // Paging Attempt Count (mandatory) + uint8_t attempt_count = paging_attempt_info->pagingAttemptCount; + DevAssert(attempt_count >= NGAP_PAGING_ATTEMPT_MIN && attempt_count <= NGAP_PAGING_ATTEMPT_MAX); + out->paging_attempt_info->paging_attempt_count = attempt_count; + NGAP_DEBUG("Decoded Paging Attempt Count: %u\n", out->paging_attempt_info->paging_attempt_count); + + // Intended Number of Paging Attempts (mandatory) + uint8_t intended_attempts = paging_attempt_info->intendedNumberOfPagingAttempts; + DevAssert(intended_attempts >= NGAP_PAGING_ATTEMPT_MIN && intended_attempts <= NGAP_PAGING_ATTEMPT_MAX); + out->paging_attempt_info->intended_paging_attempts = intended_attempts; + NGAP_DEBUG("Decoded Intended Number of Paging Attempts: %u\n", out->paging_attempt_info->intended_paging_attempts); + } + } + + NGAP_DEBUG("Decoded Paging: m_tmsi=0x%08x, TAI=%d", s_tmsi->m_tmsi, out->n_tai); + + return true; +} + +/** @brief Check equality of two NGAP paging indication structures + * @param a First structure + * @param b Second structure + * @return true if equal, false otherwise */ +bool eq_ng_paging(const ngap_paging_ind_t *a, const ngap_paging_ind_t *b) +{ + if (a == NULL || b == NULL) { + return a == b; + } + + // UE Paging Identity + const fiveg_s_tmsi_t *a_tmsi = &a->ue_paging_identity.s_tmsi; + const fiveg_s_tmsi_t *b_tmsi = &b->ue_paging_identity.s_tmsi; + _EQ_CHECK_INT(a_tmsi->amf_set_id, b_tmsi->amf_set_id); + _EQ_CHECK_INT(a_tmsi->amf_pointer, b_tmsi->amf_pointer); + _EQ_CHECK_UINT32(a_tmsi->m_tmsi, b_tmsi->m_tmsi); + + // TAI List + _EQ_CHECK_INT(a->n_tai, b->n_tai); + for (int i = 0; i < a->n_tai; i++) { + if (!eq_ngap_plmn(&a->tai_list[i].plmn, &b->tai_list[i].plmn)) { + return false; + } + _EQ_CHECK_INT(a->tai_list[i].tac, b->tai_list[i].tac); + } + + // Paging DRX (optional) + _EQ_CHECK_OPTIONAL_IE(a, b, paging_drx, _EQ_CHECK_INT); + + // Paging Priority (optional) + _EQ_CHECK_OPTIONAL_IE(a, b, paging_priority, _EQ_CHECK_INT); + + // UERadioCapabilityForPaging (optional) + _EQ_CHECK_OPTIONAL_PTR(a, b, ue_radio_capability); + if (a->ue_radio_capability != NULL && b->ue_radio_capability != NULL) { + if (!eq_byte_array(a->ue_radio_capability, b->ue_radio_capability)) { + NGAP_ERROR("Equality condition 'eq_byte_array' failed: byte array contents differ\n"); + return false; + } + } + + // PagingOrigin (optional) + _EQ_CHECK_OPTIONAL_IE(a, b, origin, _EQ_CHECK_INT); + + // Assistance Data for Paging (optional) + _EQ_CHECK_OPTIONAL_PTR(a, b, paging_attempt_info); + if (a->paging_attempt_info != NULL && b->paging_attempt_info != NULL) { + _EQ_CHECK_INT(a->paging_attempt_info->paging_attempt_count, b->paging_attempt_info->paging_attempt_count); + _EQ_CHECK_INT(a->paging_attempt_info->intended_paging_attempts, b->paging_attempt_info->intended_paging_attempts); + } + + return true; +} diff --git a/openair3/NGAP/ngap_gNB_paging.h b/openair3/NGAP/ngap_gNB_paging.h new file mode 100644 index 0000000000..3a07ce4c03 --- /dev/null +++ b/openair3/NGAP/ngap_gNB_paging.h @@ -0,0 +1,50 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface Software Alliance: + * contact@openairinterface.org + */ + +#ifndef NGAP_GNB_PAGING_H_ +#define NGAP_GNB_PAGING_H_ + +#include +#include +#include "ngap_messages_types.h" + +/** @brief Encode NGAP Paging message (9.2.4.1 of 3GPP TS 38.413) + * @param msg Pointer to paging indication structure to encode + * @return Pointer to allocated NGAP_NGAP_PDU_t, or NULL on failure */ +NGAP_NGAP_PDU_t *encode_ng_paging(const ngap_paging_ind_t *msg); + +/** @brief Decode NGAP Paging message (9.2.4.1 of 3GPP TS 38.413) + * @param out Pointer to output structure to fill + * @param pdu Pointer to NGAP PDU containing the Paging message + * @return true on success, false on failure */ +bool decode_ng_paging(ngap_paging_ind_t *out, const NGAP_NGAP_PDU_t *pdu); + +/** @brief Free memory allocated for NGAP paging indication + * @param msg Pointer to paging indication structure to free */ +void free_ng_paging(ngap_paging_ind_t *msg); + +/** @brief Check equality of two NGAP paging indication structures + * @param a First structure + * @param b Second structure + * @return true if equal, false otherwise */ +bool eq_ng_paging(const ngap_paging_ind_t *a, const ngap_paging_ind_t *b); + +#endif /* NGAP_GNB_PAGING_H_ */ diff --git a/openair3/NGAP/ngap_msg_includes.h b/openair3/NGAP/ngap_msg_includes.h index 485c9f26ac..911461e47d 100644 --- a/openair3/NGAP/ngap_msg_includes.h +++ b/openair3/NGAP/ngap_msg_includes.h @@ -41,6 +41,12 @@ #include "NGAP_GTPTunnel.h" #include "NGAP_InitiatingMessage.h" #include "NGAP_NGAP-PDU.h" +#include "NGAP_Paging.h" +#include "NGAP_AssistanceDataForPaging.h" +#include "NGAP_PagingAttemptInformation.h" +#include "NGAP_FiveG-S-TMSI.h" +#include "NGAP_TAI.h" +#include "NGAP_UEPagingIdentity.h" #include "NGAP_PDUSessionResourceFailedToModifyItemModRes.h" #include "NGAP_PDUSessionResourceFailedToSetupItemCxtRes.h" #include "NGAP_PDUSessionResourceFailedToSetupItemSURes.h" diff --git a/openair3/NGAP/ngap_utils.h b/openair3/NGAP/ngap_utils.h index 34d288fb27..60ee9fbdfd 100644 --- a/openair3/NGAP/ngap_utils.h +++ b/openair3/NGAP/ngap_utils.h @@ -27,6 +27,7 @@ #include #include "common/utils/LOG/log.h" #include "assertions.h" +#include "common/utils/eq_check.h" #define NGAP_UE_ID_FMT "0x%06" PRIX32 diff --git a/openair3/NGAP/tests/CMakeLists.txt b/openair3/NGAP/tests/CMakeLists.txt new file mode 100644 index 0000000000..65cee63f8c --- /dev/null +++ b/openair3/NGAP/tests/CMakeLists.txt @@ -0,0 +1,6 @@ +add_executable(ngap_lib_test ngap_lib_test.c) +add_dependencies(tests ngap_lib_test) +add_test(NAME ngap_lib_test COMMAND ngap_lib_test) +target_link_libraries(ngap_lib_test PRIVATE ngap asn1_ngap asn1_lte_rrc_hdrs UTIL ds) +target_include_directories(ngap_lib_test PRIVATE ${CMAKE_SOURCE_DIR}) + diff --git a/openair3/NGAP/tests/ngap_lib_test.c b/openair3/NGAP/tests/ngap_lib_test.c new file mode 100644 index 0000000000..72a8667d94 --- /dev/null +++ b/openair3/NGAP/tests/ngap_lib_test.c @@ -0,0 +1,133 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface Software Alliance: + * contact@openairinterface.org + */ + +#include // abort +#include // uint*_t +#include // printf +#include // bool + +#include "common/utils/assertions.h" // AssertFatal, DevAssert +#include "common/utils/utils.h" // malloc_or_fail, calloc_or_fail +#include "common/utils/ds/byte_array.h" // create_byte_array +#include "conversions.h" // TBCD_TO_MCC_MNC, OCTET_STRING_TO_INT* +#include "ngap_common.h" // NGAP_ERROR, NGAP_DEBUG, ngap_messages_types.h +#include "ngap_gNB_paging.h" // encode_ng_paging, decode_ng_paging, free_ng_paging +#include "ngap_msg_includes.h" // NGAP_NGAP_PDU_t, NGAP_Paging_t, etc. +#include "oai_asn1.h" // ASN_STRUCT_FREE, asn_DEF_NGAP_NGAP_PDU +#include "config/config_load_configmodule.h" // configmodule_interface_t +#include "common/utils/LOG/log.h" // log_init + +void exit_function(const char *file, const char *function, const int line, const char *s, const int assert) +{ + printf("detected error at %s:%d:%s: %s\n", file, line, function, s); + abort(); +} + +static NGAP_NGAP_PDU_t *ngap_encode_decode(const NGAP_NGAP_PDU_t *enc_pdu) +{ + DevAssert(enc_pdu != NULL); + char errbuf[1024]; + size_t errlen = sizeof(errbuf); + int ret = asn_check_constraints(&asn_DEF_NGAP_NGAP_PDU, enc_pdu, errbuf, &errlen); + AssertFatal(ret == 0, "asn_check_constraints() failed: %s\n", errbuf); + + uint8_t msgbuf[16384]; + asn_enc_rval_t enc = aper_encode_to_buffer(&asn_DEF_NGAP_NGAP_PDU, NULL, enc_pdu, msgbuf, sizeof(msgbuf)); + AssertFatal(enc.encoded > 0, "aper_encode_to_buffer() failed\n"); + + NGAP_NGAP_PDU_t *dec_pdu = NULL; + asn_codec_ctx_t st = {.max_stack_size = 100 * 1000}; + asn_dec_rval_t dec = aper_decode(&st, &asn_DEF_NGAP_NGAP_PDU, (void **)&dec_pdu, msgbuf, enc.encoded, 0, 0); + AssertFatal(dec.code == RC_OK, "aper_decode() failed\n"); + + return dec_pdu; +} + +static void ngap_msg_free(NGAP_NGAP_PDU_t *pdu) +{ + ASN_STRUCT_FREE(asn_DEF_NGAP_NGAP_PDU, pdu); +} + +/** @brief Test NGAP Paging encoding/decoding roundtrip */ +static void test_ngap_paging_encode_decode(void) +{ + // Create test paging indication + ngap_paging_ind_t orig = {0}; + orig.ue_paging_identity.s_tmsi.amf_set_id = 123; // Valid range: 0-1023 (10 bits) + orig.ue_paging_identity.s_tmsi.amf_pointer = 45; // Valid range: 0-63 (6 bits) + orig.ue_paging_identity.s_tmsi.m_tmsi = 0x12345678; + orig.n_tai = 2; + orig.tai_list[0].plmn.mcc = 208; + orig.tai_list[0].plmn.mnc = 95; + orig.tai_list[0].plmn.mnc_digit_length = 2; + orig.tai_list[0].tac = 12345; + orig.tai_list[1].plmn.mcc = 001; + orig.tai_list[1].plmn.mnc = 01; + orig.tai_list[1].plmn.mnc_digit_length = 2; + orig.tai_list[1].tac = 23456; + orig.paging_drx = malloc_or_fail(sizeof(ngap_paging_drx_t)); + *orig.paging_drx = NGAP_PAGING_DRX_128; + orig.paging_priority = malloc_or_fail(sizeof(ngap_paging_priority_t)); + *orig.paging_priority = NGAP_PAGING_PRIO_LEVEL2; + uint8_t ue_cap_data[] = {0x01, 0x02, 0x03, 0x04}; + orig.ue_radio_capability = malloc_or_fail(sizeof(byte_array_t)); + *orig.ue_radio_capability = create_byte_array(sizeof(ue_cap_data), ue_cap_data); + orig.origin = calloc_or_fail(1, sizeof(*orig.origin)); + *orig.origin = NGAP_PAGING_ORIGIN_NON_3GPP; + + // Encode + NGAP_NGAP_PDU_t *enc_pdu = encode_ng_paging(&orig); + AssertFatal(enc_pdu != NULL, "encode_ng_paging(): failed to encode message\n"); + LOG_A(NGAP, "encoded: m_tmsi=0x%x, n_tai=%d\n", orig.ue_paging_identity.s_tmsi.m_tmsi, orig.n_tai); + + // Encode/decode roundtrip + NGAP_NGAP_PDU_t *dec_pdu = ngap_encode_decode(enc_pdu); + ngap_msg_free(enc_pdu); + + // Decode + ngap_paging_ind_t decoded = {0}; + bool decode_ret = decode_ng_paging(&decoded, dec_pdu); + AssertFatal(decode_ret, "decode_ng_paging(): could not decode message\n"); + ngap_msg_free(dec_pdu); + LOG_A(NGAP, "decoded: m_tmsi=0x%x, n_tai=%d\n", decoded.ue_paging_identity.s_tmsi.m_tmsi, decoded.n_tai); + + // Verify decoded values using equality function + bool eq_ret = eq_ng_paging(&orig, &decoded); + AssertFatal(eq_ret, "eq_ng_paging(): decoded message doesn't match original\n"); + LOG_A(NGAP, "eq_ng_paging(): decoded message matches original\n"); + + free_ng_paging(&decoded); + free_ng_paging(&orig); +} + +// Stub for uniqCfg required by logging/config system +configmodule_interface_t *uniqCfg = NULL; + +int main(void) +{ + // Initialize logging system + logInit(); + set_log(NGAP, OAILOG_INFO); + + test_ngap_paging_encode_decode(); + LOG_A(NGAP, "All NGAP paging tests passed!\n"); + return 0; +} From 08f0f9369c4bc9c05ad02d9fe83aa481cd3452bc Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Mon, 29 Dec 2025 13:55:27 +0100 Subject: [PATCH 28/37] Paging (F1AP): add F1 paging library (9.2.6.1 3GPP TS 38.473) Add F1AP Paging library and new message type to follow the existing F1AP library pattern and to support multi-cell paging and both RAN UE (I-RNTI) and CN UE (5G-S-TMSI) paging identities at the library level per TS 38.473. * New library (f1ap_paging.c/h, f1ap_lib_includes.h, CMakeLists.txt) - Implement encode/decode/copy/eq/free for F1AP Paging (procedure 9.2.6). - Add ASN.1 includes for Paging, PagingIdentity, CN/RAN UE identities. - Enables unit testing of Paging enc/dec in f1ap_lib_test.c. * New types in f1ap_messages_types.h (existing f1ap_paging_ind_t unchanged) - f1ap_paging_t: UE Identity Index, paging identity (union + type enum), optional paging_drx, paging_priority, paging_origin, and paging_cells[]. - f1ap_paging_cell_item_t, f1ap_paging_identity_type_t, f1ap_paging_identity_t for multi-cell list and RAN/CN identity discrimination. - Paging Origin IE is optional per F1AP 8.7.1.2. Tests: test_f1ap_paging() roundtrip and copy for CN UE (5G-S-TMSI) and RAN UE (I-RNTI) cases, with optional IEs. --- openair2/COMMON/f1ap_messages_types.h | 63 +++++ openair2/F1AP/lib/CMakeLists.txt | 1 + openair2/F1AP/lib/f1ap_lib_includes.h | 4 + openair2/F1AP/lib/f1ap_paging.c | 349 ++++++++++++++++++++++++++ openair2/F1AP/lib/f1ap_paging.h | 37 +++ openair2/F1AP/tests/f1ap_lib_test.c | 75 ++++++ openair3/UTILS/conversions.h | 12 + 7 files changed, 541 insertions(+) create mode 100644 openair2/F1AP/lib/f1ap_paging.c create mode 100644 openair2/F1AP/lib/f1ap_paging.h diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index c891a44adc..79cc178029 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -24,6 +24,7 @@ #include #include +#include #include "common/5g_platform_types.h" #include "common/platform_constants.h" #include "common/utils/ds/byte_array.h" @@ -640,6 +641,68 @@ typedef struct f1ap_paging_ind_s { uint8_t paging_drx; } f1ap_paging_ind_t; +typedef struct f1ap_paging_cell_item_s { + plmn_id_t plmn; + uint64_t nr_cellid; +} f1ap_paging_cell_item_t; + +typedef enum f1ap_paging_identity_type_e { + F1AP_PAGING_IDENTITY_RAN_UE, // RAN UE Paging Identity (I-RNTI) + F1AP_PAGING_IDENTITY_CN_UE // CN UE Paging Identity (5G-S-TMSI) +} f1ap_paging_identity_type_t; + +typedef union f1ap_paging_identity_u { + // RAN UE Paging Identity (I-RNTI) + uint64_t ran_ue_paging_identity; + // CN UE Paging Identity (5G-S-TMSI) + uint64_t cn_ue_paging_identity; +} f1ap_paging_identity_t; + +/** @brief Paging DRX (9.3.1.40 TS 38.473) + * This IE indicates the Paging DRX as defined in + * TS 38.304. Unit in radio frames.*/ +typedef enum f1ap_paging_drx_e { + F1AP_PAGING_DRX_32 = 0, + F1AP_PAGING_DRX_64 = 1, + F1AP_PAGING_DRX_128 = 2, + F1AP_PAGING_DRX_256 = 3 +} f1ap_paging_drx_t; + +/** @brief Paging Priority (9.3.1.41 TS 38.473) + * Lower value codepoint indicates higher priority. + * codepoint indicates higher priority.*/ +typedef enum f1ap_paging_priority_e { + F1AP_PAGING_PRIO_LEVEL1 = 0, + F1AP_PAGING_PRIO_LEVEL2 = 1, + F1AP_PAGING_PRIO_LEVEL3 = 2, + F1AP_PAGING_PRIO_LEVEL4 = 3, + F1AP_PAGING_PRIO_LEVEL5 = 4, + F1AP_PAGING_PRIO_LEVEL6 = 5, + F1AP_PAGING_PRIO_LEVEL7 = 6, + F1AP_PAGING_PRIO_LEVEL8 = 7 +} f1ap_paging_priority_t; + +typedef bool f1ap_paging_origin_t; +#define F1AP_PAGING_ORIGIN_NON_3GPP true + +/* 9.2.6.1 Paging (3GPP TS 38.473) */ +typedef struct { + // UE Identity Index value (mandatory) + uint16_t ue_identity_index_value; + // Paging Identity (mandatory) + f1ap_paging_identity_type_t identity_type; + f1ap_paging_identity_t identity; + // Paging DRX: 0 (32), 1 (64), 2 (128), 3 (256) (optional) + f1ap_paging_drx_t *drx; + // Paging priority (optional) + f1ap_paging_priority_t *priority; + // Paging origin (optional) + f1ap_paging_origin_t *origin; + // Paging Cell List (mandatory); max 512 cells + uint16_t n_cells; + f1ap_paging_cell_item_t *cells; +} f1ap_paging_t; + typedef struct f1ap_lost_connection_t { int dummy; } f1ap_lost_connection_t; diff --git a/openair2/F1AP/lib/CMakeLists.txt b/openair2/F1AP/lib/CMakeLists.txt index 0a46fa2bf0..847484c5a2 100644 --- a/openair2/F1AP/lib/CMakeLists.txt +++ b/openair2/F1AP/lib/CMakeLists.txt @@ -4,6 +4,7 @@ add_library(f1ap_lib OBJECT f1ap_interface_management.c f1ap_ue_context.c f1ap_positioning.c + f1ap_paging.c ) target_link_libraries(f1ap_lib PRIVATE asn1_f1ap ds) target_include_directories(f1ap_lib PUBLIC diff --git a/openair2/F1AP/lib/f1ap_lib_includes.h b/openair2/F1AP/lib/f1ap_lib_includes.h index a50bd5efe5..d8aa45d89c 100644 --- a/openair2/F1AP/lib/f1ap_lib_includes.h +++ b/openair2/F1AP/lib/f1ap_lib_includes.h @@ -90,5 +90,9 @@ #include "F1AP_UL-RTOA-Measurement.h" #include "F1AP_GNB-RxTxTimeDiff.h" #include "F1AP_LCS-to-GCS-TranslationAoA.h" +#include "F1AP_CNUEPagingIdentity.h" +#include "F1AP_RANUEPagingIdentity.h" +#include "F1AP_PagingIdentity.h" +#include "F1AP_Paging.h" #endif /* F1AP_LIB_INCLUDES_H_ */ diff --git a/openair2/F1AP/lib/f1ap_paging.c b/openair2/F1AP/lib/f1ap_paging.c new file mode 100644 index 0000000000..bfb1fc0a55 --- /dev/null +++ b/openair2/F1AP/lib/f1ap_paging.c @@ -0,0 +1,349 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#include + +#include "common/utils/assertions.h" +#include "openair3/UTILS/conversions.h" +#include "common/utils/oai_asn1.h" +#include "common/utils/utils.h" + +#include "f1ap_paging.h" +#include "f1ap_lib_common.h" +#include "f1ap_lib_includes.h" +#include "f1ap_messages_types.h" + +/** @brief encode to F1AP_PagingDRX_t */ +static F1AP_PagingDRX_t encode_f1_paging_drx(const f1ap_paging_drx_t drx) +{ + switch (drx) { + case F1AP_PAGING_DRX_32: + return F1AP_PagingDRX_v32; + case F1AP_PAGING_DRX_64: + return F1AP_PagingDRX_v64; + case F1AP_PAGING_DRX_128: + return F1AP_PagingDRX_v128; + case F1AP_PAGING_DRX_256: + return F1AP_PagingDRX_v256; + default: + AssertFatal(1 == 0, "Unknown Paging DRX: %u\n", drx); + } + return 0; +} + +/** @brief decode from F1AP_PagingDRX_t */ +static f1ap_paging_drx_t decode_f1_paging_drx(const F1AP_PagingDRX_t drx) +{ + switch (drx) { + case F1AP_PagingDRX_v32: + return F1AP_PAGING_DRX_32; + case F1AP_PagingDRX_v64: + return F1AP_PAGING_DRX_64; + case F1AP_PagingDRX_v128: + return F1AP_PAGING_DRX_128; + case F1AP_PagingDRX_v256: + return F1AP_PAGING_DRX_256; + default: + AssertFatal(1 == 0, "Unknown Paging DRX: %ld\n", drx); + } + return 0; +} + +/** @brief encode F1 Paging (9.2.6 Paging 3GPP TS 38.473) */ +F1AP_F1AP_PDU_t *encode_f1ap_paging(const f1ap_paging_t *msg) +{ + DevAssert(msg); + F1AP_F1AP_PDU_t *pdu = calloc_or_fail(1, sizeof(*pdu)); + + pdu->present = F1AP_F1AP_PDU_PR_initiatingMessage; + asn1cCalloc(pdu->choice.initiatingMessage, initMsg); + initMsg->procedureCode = F1AP_ProcedureCode_id_Paging; + initMsg->criticality = F1AP_Criticality_reject; + initMsg->value.present = F1AP_InitiatingMessage__value_PR_Paging; + F1AP_Paging_t *paging = &initMsg->value.choice.Paging; + + /* UEIdentityIndexValue (Mandatory) 10 bits */ + { + AssertFatal(msg->ue_identity_index_value <= 1023, + "UE Identity Index Value exceeds 10 bits: %d\n", + msg->ue_identity_index_value); + asn1cSequenceAdd(paging->protocolIEs.list, F1AP_PagingIEs_t, ie); + ie->id = F1AP_ProtocolIE_ID_id_UEIdentityIndexValue; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_PagingIEs__value_PR_UEIdentityIndexValue; + F1AP_UEIdentityIndexValue_t *ue_identity_index = &ie->value.choice.UEIdentityIndexValue; + ue_identity_index->present = F1AP_UEIdentityIndexValue_PR_indexLength10; + UEIDENTITYINDEX_TO_BIT_STRING(msg->ue_identity_index_value, &ue_identity_index->choice.indexLength10); + } + + /* PagingIdentity (Mandatory) */ + { + asn1cSequenceAdd(paging->protocolIEs.list, F1AP_PagingIEs_t, ie); + ie->id = F1AP_ProtocolIE_ID_id_PagingIdentity; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_PagingIEs__value_PR_PagingIdentity; + + F1AP_PagingIdentity_t *paging_identity = &ie->value.choice.PagingIdentity; + const f1ap_paging_identity_t *paging_id = &msg->identity; + + if (msg->identity_type == F1AP_PAGING_IDENTITY_CN_UE) { + // CN UE Paging Identity (5G-S-TMSI) + paging_identity->present = F1AP_PagingIdentity_PR_cNUEPagingIdentity; + asn1cCalloc(paging_identity->choice.cNUEPagingIdentity, id); + id->present = F1AP_CNUEPagingIdentity_PR_fiveG_S_TMSI; + FIVEG_S_TMSI_TO_BIT_STRING(paging_id->cn_ue_paging_identity, &id->choice.fiveG_S_TMSI); + } else { + // RAN UE Paging Identity (I-RNTI) + paging_identity->present = F1AP_PagingIdentity_PR_rANUEPagingIdentity; + asn1cCalloc(paging_identity->choice.rANUEPagingIdentity, ran_id); + // I-RNTI is 40 bits, stored in 5 bytes + IRNTI_TO_BIT_STRING(paging_id->ran_ue_paging_identity, &ran_id->iRNTI); + } + } + + /* Paging Priority (Optional) */ + if (msg->priority != NULL) { + AssertFatal(*msg->priority >= F1AP_PAGING_PRIO_LEVEL1 && *msg->priority <= F1AP_PAGING_PRIO_LEVEL8, + "Unknown Paging Priority: %d\n", + *msg->priority); + asn1cSequenceAdd(paging->protocolIEs.list, F1AP_PagingIEs_t, ie); + ie->id = F1AP_ProtocolIE_ID_id_PagingPriority; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_PagingIEs__value_PR_PagingPriority; + ie->value.choice.PagingPriority = (F1AP_PagingPriority_t)*msg->priority; + } + + /* Paging Origin (Optional) */ + if (msg->origin != NULL) { + AssertFatal(*msg->origin == F1AP_PAGING_ORIGIN_NON_3GPP, "Unknown Paging Origin: %d\n", *msg->origin); + asn1cSequenceAdd(paging->protocolIEs.list, F1AP_PagingIEs_t, ie); + ie->id = F1AP_ProtocolIE_ID_id_PagingOrigin; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_PagingIEs__value_PR_PagingOrigin; + ie->value.choice.PagingOrigin = F1AP_PagingOrigin_non_3gpp; + } + + /* PagingDRX (Optional) */ + if (msg->drx != NULL) { + asn1cSequenceAdd(paging->protocolIEs.list, F1AP_PagingIEs_t, ie); + ie->id = F1AP_ProtocolIE_ID_id_PagingDRX; + ie->criticality = F1AP_Criticality_ignore; + ie->value.present = F1AP_PagingIEs__value_PR_PagingDRX; + ie->value.choice.PagingDRX = encode_f1_paging_drx(*msg->drx); + } + + /* PagingCell_list (Mandatory) */ + { + AssertFatal(msg->n_cells > 0 && msg->n_cells <= F1AP_MAX_NB_CELLS, + "invalid n_cells %u (must be 1..%d)\n", + msg->n_cells, + F1AP_MAX_NB_CELLS); + DevAssert(msg->cells != NULL); + asn1cSequenceAdd(paging->protocolIEs.list, F1AP_PagingIEs_t, ie); + ie->id = F1AP_ProtocolIE_ID_id_PagingCell_List; + ie->criticality = F1AP_Criticality_reject; + ie->value.present = F1AP_PagingIEs__value_PR_PagingCell_list; + + // Add all cells in the paging cell list + for (uint16_t cell_idx = 0; cell_idx < msg->n_cells; cell_idx++) { + asn1cSequenceAdd(ie->value.choice.PagingCell_list, F1AP_PagingCell_ItemIEs_t, item); + item->id = F1AP_ProtocolIE_ID_id_PagingCell_Item; + item->criticality = F1AP_Criticality_reject; + item->value.present = F1AP_PagingCell_ItemIEs__value_PR_PagingCell_Item; + // NRCGI (Mandatory) + F1AP_NRCGI_t *nRCGI = &item->value.choice.PagingCell_Item.nRCGI; + const f1ap_paging_cell_item_t *cell = &msg->cells[cell_idx]; + MCC_MNC_TO_PLMNID(cell->plmn.mcc, cell->plmn.mnc, cell->plmn.mnc_digit_length, &nRCGI->pLMN_Identity); + NR_CELL_ID_TO_BIT_STRING(cell->nr_cellid, &nRCGI->nRCellIdentity); + } + } + + return pdu; +} + +/** @brief decode F1 Paging (9.2.6 Paging 3GPP TS 38.473) */ +bool decode_f1ap_paging(f1ap_paging_t *out, const F1AP_F1AP_PDU_t *pdu) +{ + DevAssert(out); + DevAssert(pdu); + DevAssert(pdu->choice.initiatingMessage); + memset(out, 0, sizeof(*out)); + + _EQ_CHECK_INT(pdu->present, F1AP_F1AP_PDU_PR_initiatingMessage); + _EQ_CHECK_LONG(pdu->choice.initiatingMessage->procedureCode, F1AP_ProcedureCode_id_Paging); + _EQ_CHECK_INT(pdu->choice.initiatingMessage->value.present, F1AP_InitiatingMessage__value_PR_Paging); + + /* Check presence of mandatory IEs */ + const F1AP_Paging_t *in = &pdu->choice.initiatingMessage->value.choice.Paging; + F1AP_PagingIEs_t *ie; + F1AP_LIB_FIND_IE(F1AP_PagingIEs_t, ie, &in->protocolIEs.list, F1AP_ProtocolIE_ID_id_UEIdentityIndexValue, true); + F1AP_LIB_FIND_IE(F1AP_PagingIEs_t, ie, &in->protocolIEs.list, F1AP_ProtocolIE_ID_id_PagingIdentity, true); + F1AP_LIB_FIND_IE(F1AP_PagingIEs_t, ie, &in->protocolIEs.list, F1AP_ProtocolIE_ID_id_PagingCell_List, true); + + /* Loop over all IEs */ + for (int i = 0; i < in->protocolIEs.list.count; i++) { + DevAssert(in->protocolIEs.list.array[i] != NULL); + ie = in->protocolIEs.list.array[i]; + switch (ie->id) { + case F1AP_ProtocolIE_ID_id_UEIdentityIndexValue: + // (M) UE Identity Index Value + _EQ_CHECK_INT(ie->value.present, F1AP_PagingIEs__value_PR_UEIdentityIndexValue); + out->ue_identity_index_value = BIT_STRING_to_uint32(&ie->value.choice.UEIdentityIndexValue.choice.indexLength10); + break; + + case F1AP_ProtocolIE_ID_id_PagingIdentity: + // (M) Paging Identity + _EQ_CHECK_INT(ie->value.present, F1AP_PagingIEs__value_PR_PagingIdentity); + if (ie->value.choice.PagingIdentity.present == F1AP_PagingIdentity_PR_cNUEPagingIdentity) { + // CN UE Paging Identity (5G-S-TMSI) + out->identity_type = F1AP_PAGING_IDENTITY_CN_UE; + BIT_STRING_t *fiveg_tmsi = &ie->value.choice.PagingIdentity.choice.cNUEPagingIdentity->choice.fiveG_S_TMSI; + out->identity.cn_ue_paging_identity = BIT_STRING_to_uint64(fiveg_tmsi); + } else if (ie->value.choice.PagingIdentity.present == F1AP_PagingIdentity_PR_rANUEPagingIdentity) { + // RAN UE Paging Identity (I-RNTI) + out->identity_type = F1AP_PAGING_IDENTITY_RAN_UE; + BIT_STRING_t *irnti = &ie->value.choice.PagingIdentity.choice.rANUEPagingIdentity->iRNTI; + out->identity.ran_ue_paging_identity = BIT_STRING_to_uint64(irnti); + } else { + PRINT_ERROR("Unknown PagingIdentity type: %d\n", ie->value.choice.PagingIdentity.present); + return false; + } + break; + + case F1AP_ProtocolIE_ID_id_PagingDRX: + // (O) Paging DRX + _EQ_CHECK_INT(ie->value.present, F1AP_PagingIEs__value_PR_PagingDRX); + out->drx = malloc_or_fail(sizeof(*out->drx)); + *out->drx = decode_f1_paging_drx(ie->value.choice.PagingDRX); + break; + + case F1AP_ProtocolIE_ID_id_PagingPriority: + // (O) Paging Priority + _EQ_CHECK_INT(ie->value.present, F1AP_PagingIEs__value_PR_PagingPriority); + AssertFatal(ie->value.choice.PagingPriority >= F1AP_PagingPriority_priolevel1 + && ie->value.choice.PagingPriority <= F1AP_PagingPriority_priolevel8, + "Unknown Paging Priority: %ld\n", + ie->value.choice.PagingPriority); + out->priority = malloc_or_fail(sizeof(*out->priority)); + *out->priority = (f1ap_paging_priority_t)ie->value.choice.PagingPriority; + break; + + case F1AP_ProtocolIE_ID_id_PagingOrigin: + // (O) Paging Origin + _EQ_CHECK_INT(ie->value.present, F1AP_PagingIEs__value_PR_PagingOrigin); + AssertFatal(ie->value.choice.PagingOrigin == F1AP_PagingOrigin_non_3gpp, + "Unknown Paging Origin: %ld\n", + ie->value.choice.PagingOrigin); + out->origin = malloc_or_fail(sizeof(*out->origin)); + *out->origin = F1AP_PAGING_ORIGIN_NON_3GPP; + break; + + case F1AP_ProtocolIE_ID_id_PagingCell_List: + // (M) Paging Cell List (max 512 cells) + _EQ_CHECK_INT(ie->value.present, F1AP_PagingIEs__value_PR_PagingCell_list); + out->n_cells = ie->value.choice.PagingCell_list.list.count; + AssertError(out->n_cells > 0, return false, "at least 1 cell must be present"); + AssertError(out->n_cells <= F1AP_MAX_NB_CELLS, return false, "too many cells"); + out->cells = calloc_or_fail(out->n_cells, sizeof(*out->cells)); + for (int j = 0; j < out->n_cells; j++) { + F1AP_PagingCell_ItemIEs_t *cell_item = (F1AP_PagingCell_ItemIEs_t *)ie->value.choice.PagingCell_list.list.array[j]; + DevAssert(cell_item); + F1AP_NRCGI_t *nRCGI = &cell_item->value.choice.PagingCell_Item.nRCGI; + f1ap_paging_cell_item_t *cell = &out->cells[j]; + PLMNID_TO_MCC_MNC(&nRCGI->pLMN_Identity, cell->plmn.mcc, cell->plmn.mnc, cell->plmn.mnc_digit_length); + BIT_STRING_TO_NR_CELL_IDENTITY(&nRCGI->nRCellIdentity, cell->nr_cellid); + } + break; + + default: + AssertError(1 == 0, return false, "F1AP_ProtocolIE_ID_id %ld unknown\n", ie->id); + break; + } + } + return true; +} + +/** @brief free F1 Paging */ +void free_f1ap_paging(f1ap_paging_t *msg) +{ + DevAssert(msg); + free(msg->drx); + free(msg->priority); + free(msg->origin); + free(msg->cells); +} + +/** @brief Equality check for two F1 Paging */ +bool eq_f1ap_paging(const f1ap_paging_t *a, const f1ap_paging_t *b) +{ + DevAssert(a); + DevAssert(b); + _EQ_CHECK_INT(a->ue_identity_index_value, b->ue_identity_index_value); + _EQ_CHECK_INT(a->identity_type, b->identity_type); + if (a->identity_type == F1AP_PAGING_IDENTITY_CN_UE) { + _EQ_CHECK_LONG(a->identity.cn_ue_paging_identity, b->identity.cn_ue_paging_identity); + } else { + _EQ_CHECK_LONG(a->identity.ran_ue_paging_identity, b->identity.ran_ue_paging_identity); + } + _EQ_CHECK_OPTIONAL_IE(a, b, drx, _EQ_CHECK_INT); + _EQ_CHECK_OPTIONAL_IE(a, b, priority, _EQ_CHECK_INT); + _EQ_CHECK_OPTIONAL_IE(a, b, origin, _EQ_CHECK_INT); + _EQ_CHECK_INT(a->n_cells, b->n_cells); + if ((a->n_cells > 0 && (a->cells == NULL || b->cells == NULL))) + return false; + for (int i = 0; i < a->n_cells; i++) { + if (!eq_f1ap_plmn(&a->cells[i].plmn, &b->cells[i].plmn)) + return false; + _EQ_CHECK_LONG(a->cells[i].nr_cellid, b->cells[i].nr_cellid); + } + return true; +} + +/** @brief deep copy F1 Paging */ +f1ap_paging_t cp_f1ap_paging(const f1ap_paging_t *orig) +{ + DevAssert(orig); + f1ap_paging_t cp = {0}; + cp.ue_identity_index_value = orig->ue_identity_index_value; + cp.identity_type = orig->identity_type; + cp.identity = orig->identity; + if (orig->drx != NULL) { + cp.drx = malloc_or_fail(sizeof(*cp.drx)); + *cp.drx = *orig->drx; + } + if (orig->priority != NULL) { + cp.priority = malloc_or_fail(sizeof(*cp.priority)); + *cp.priority = *orig->priority; + } + if (orig->origin != NULL) { + cp.origin = malloc_or_fail(sizeof(*cp.origin)); + *cp.origin = *orig->origin; + } + cp.n_cells = orig->n_cells; + if (cp.n_cells > 0) { + DevAssert(orig->cells != NULL); + cp.cells = calloc_or_fail(cp.n_cells, sizeof(*cp.cells)); + for (int i = 0; i < cp.n_cells; i++) { + cp.cells[i] = orig->cells[i]; + } + } + return cp; +} diff --git a/openair2/F1AP/lib/f1ap_paging.h b/openair2/F1AP/lib/f1ap_paging.h new file mode 100644 index 0000000000..6ecdb3daa2 --- /dev/null +++ b/openair2/F1AP/lib/f1ap_paging.h @@ -0,0 +1,37 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#ifndef F1AP_PAGING_H_ +#define F1AP_PAGING_H_ + +#include +#include "f1ap_messages_types.h" + +struct F1AP_F1AP_PDU; + +/* F1 Paging */ +struct F1AP_F1AP_PDU *encode_f1ap_paging(const f1ap_paging_t *msg); +bool decode_f1ap_paging(f1ap_paging_t *out, const struct F1AP_F1AP_PDU *pdu); +void free_f1ap_paging(f1ap_paging_t *msg); +bool eq_f1ap_paging(const f1ap_paging_t *a, const f1ap_paging_t *b); +f1ap_paging_t cp_f1ap_paging(const f1ap_paging_t *orig); + +#endif /* F1AP_PAGING_H_ */ diff --git a/openair2/F1AP/tests/f1ap_lib_test.c b/openair2/F1AP/tests/f1ap_lib_test.c index e60d768b94..552db0e355 100644 --- a/openair2/F1AP/tests/f1ap_lib_test.c +++ b/openair2/F1AP/tests/f1ap_lib_test.c @@ -44,6 +44,7 @@ #include "lib/f1ap_interface_management.h" #include "lib/f1ap_ue_context.h" #include "lib/f1ap_positioning.h" +#include "lib/f1ap_paging.h" void exit_function(const char *file, const char *function, const int line, const char *s, const int assert) { @@ -2383,6 +2384,79 @@ static void test_f1ap_positioning_measurement_update() printf("%s() successful\n", __func__); } +/** @brief Test F1 Paging encode/decode roundtrip and copy operations */ +static void test_f1ap_paging_rt(f1ap_paging_t *orig) +{ + F1AP_F1AP_PDU_t *f1enc = encode_f1ap_paging(orig); + F1AP_F1AP_PDU_t *f1dec = f1ap_encode_decode(f1enc); + f1ap_msg_free(f1enc); + + f1ap_paging_t decoded = {0}; + bool ret = decode_f1ap_paging(&decoded, f1dec); + AssertFatal(ret, "decode_f1ap_paging(): could not decode message\n"); + f1ap_msg_free(f1dec); + + ret = eq_f1ap_paging(orig, &decoded); + AssertFatal(ret, "eq_f1ap_paging(): decoded message doesn't match\n"); + free_f1ap_paging(&decoded); + + f1ap_paging_t cp = cp_f1ap_paging(orig); + ret = eq_f1ap_paging(orig, &cp); + AssertFatal(ret, "eq_f1ap_paging(): copied message doesn't match\n"); + free_f1ap_paging(&cp); +} + +/** @brief Test F1 Paging encoding/decoding */ +static void test_f1ap_paging(void) +{ + // Test with CN UE Paging Identity (5G-S-TMSI) + { + f1ap_paging_t orig = {0}; + orig.ue_identity_index_value = 123; + orig.identity_type = F1AP_PAGING_IDENTITY_CN_UE; + orig.identity.cn_ue_paging_identity = 0x1234567890AB; + orig.drx = malloc_or_fail(sizeof(*orig.drx)); + *orig.drx = F1AP_PAGING_DRX_32; + orig.n_cells = 2; + orig.cells = calloc_or_fail(orig.n_cells, sizeof(*orig.cells)); + orig.cells[0].plmn.mcc = 208; + orig.cells[0].plmn.mnc = 95; + orig.cells[0].plmn.mnc_digit_length = 2; + orig.cells[0].nr_cellid = 123456; + orig.cells[1].plmn.mcc = 208; + orig.cells[1].plmn.mnc = 93; + orig.cells[1].plmn.mnc_digit_length = 2; + orig.cells[1].nr_cellid = 789012; + + test_f1ap_paging_rt(&orig); + free_f1ap_paging(&orig); + } + + // Test with RAN UE Paging Identity (I-RNTI) + { + f1ap_paging_t orig = {0}; + orig.ue_identity_index_value = 456; + orig.identity_type = F1AP_PAGING_IDENTITY_RAN_UE; + orig.identity.ran_ue_paging_identity = 0x1234567890; + orig.drx = NULL; + orig.priority = malloc_or_fail(sizeof(*orig.priority)); + *orig.priority = F1AP_PAGING_PRIO_LEVEL3; + orig.origin = malloc_or_fail(sizeof(*orig.origin)); + *orig.origin = F1AP_PAGING_ORIGIN_NON_3GPP; + orig.n_cells = 1; + orig.cells = calloc_or_fail(orig.n_cells, sizeof(*orig.cells)); + orig.cells[0].plmn.mcc = 1; + orig.cells[0].plmn.mnc = 1; + orig.cells[0].plmn.mnc_digit_length = 2; + orig.cells[0].nr_cellid = 987654; + + test_f1ap_paging_rt(&orig); + free_f1ap_paging(&orig); + } + + printf("%s() successful\n", __func__); +} + int main() { test_initial_ul_rrc_message_transfer(); @@ -2427,5 +2501,6 @@ int main() test_f1ap_positioning_measurement_abort(); test_f1ap_positioning_measurement_failure_indication(); test_f1ap_positioning_measurement_update(); + test_f1ap_paging(); return 0; } diff --git a/openair3/UTILS/conversions.h b/openair3/UTILS/conversions.h index ec65f1727a..b545d8eb8d 100644 --- a/openair3/UTILS/conversions.h +++ b/openair3/UTILS/conversions.h @@ -548,6 +548,18 @@ do { \ (bITsTRING)->bits_unused = 0; \ } while(0) +#define IRNTI_TO_BIT_STRING(mACRO, bITsTRING) \ +do { \ + (bITsTRING)->buf = calloc(5, sizeof(uint8_t)); \ + (bITsTRING)->buf[0] = ((mACRO) >> 32) & 0xff; \ + (bITsTRING)->buf[1] = ((mACRO) >> 24) & 0xff; \ + (bITsTRING)->buf[2] = ((mACRO) >> 16) & 0xff; \ + (bITsTRING)->buf[3] = ((mACRO) >> 8) & 0xff; \ + (bITsTRING)->buf[4] = ((mACRO) & 0xff); \ + (bITsTRING)->size = 5; \ + (bITsTRING)->bits_unused = 0; \ +} while (0) + /* Used to format an uint32_t containing an ipv4 address */ #define IPV4_ADDR "%u.%u.%u.%u" #define IPV4_ADDR_FORMAT(aDDRESS) \ From cf7879f03882a589459edc3b9040cb6f686960d8 Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Wed, 7 Jan 2026 09:34:26 +0100 Subject: [PATCH 29/37] Paging (F1AP): refactor CU_send_Paging() to use PAGING message - Add F1AP_PAGING message type and macro; F1AP defines Paging, not Paging Indication. CU task now handles F1AP_PAGING instead of F1AP_PAGING_IND. - In CU_send_Paging(): take const f1ap_paging_t *; replace inline ASN.1 encoding with encode_f1ap_paging(); refine memory management; clean up in the process Note: F1AP_PAGING_IND definitions left in place and still used in the RRC callback - to be removed in a follow-up commit. --- openair2/COMMON/f1ap_messages_def.h | 1 + openair2/COMMON/f1ap_messages_types.h | 1 + openair2/F1AP/f1ap_cu_paging.c | 95 +++++---------------------- openair2/F1AP/f1ap_cu_paging.h | 2 +- openair2/F1AP/f1ap_cu_task.c | 5 +- 5 files changed, 22 insertions(+), 82 deletions(-) diff --git a/openair2/COMMON/f1ap_messages_def.h b/openair2/COMMON/f1ap_messages_def.h index 18b16563d8..7c18378b2b 100644 --- a/openair2/COMMON/f1ap_messages_def.h +++ b/openair2/COMMON/f1ap_messages_def.h @@ -64,4 +64,5 @@ MESSAGE_DEF(F1AP_UE_CONTEXT_MODIFICATION_CONFIRM, MESSAGE_PRIORITY_MED, f1ap_ue_ MESSAGE_DEF(F1AP_UE_CONTEXT_MODIFICATION_REFUSE, MESSAGE_PRIORITY_MED, f1ap_ue_context_modif_refuse_t, f1ap_ue_context_modification_refuse) /* CU -> DU*/ +MESSAGE_DEF(F1AP_PAGING, MESSAGE_PRIORITY_MED, f1ap_paging_t, f1ap_paging) MESSAGE_DEF(F1AP_PAGING_IND, MESSAGE_PRIORITY_MED, f1ap_paging_ind_t, f1ap_paging_ind) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index 79cc178029..d2153f93be 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -69,6 +69,7 @@ #define F1AP_UE_CONTEXT_RELEASE_COMPLETE(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ue_context_release_complete #define F1AP_PAGING_IND(mSGpTR) (mSGpTR)->ittiMsg.f1ap_paging_ind +#define F1AP_PAGING(mSGpTR) (mSGpTR)->ittiMsg.f1ap_paging /* Length of the transport layer address string * 160 bits / 8 bits by char. diff --git a/openair2/F1AP/f1ap_cu_paging.c b/openair2/F1AP/f1ap_cu_paging.c index 330264ffd2..840e205f53 100644 --- a/openair2/F1AP/f1ap_cu_paging.c +++ b/openair2/F1AP/f1ap_cu_paging.c @@ -34,87 +34,26 @@ #include "f1ap_encoder.h" #include "f1ap_itti_messaging.h" #include "f1ap_cu_paging.h" +#include "lib/f1ap_paging.h" +#include "common/utils/ds/byte_array.h" -extern f1ap_setup_req_t *f1ap_du_data_from_du; - -int CU_send_Paging(sctp_assoc_t assoc_id, f1ap_paging_ind_t *paging) +int CU_send_Paging(sctp_assoc_t assoc_id, const f1ap_paging_t *paging) { - F1AP_F1AP_PDU_t pdu = {0}; - - pdu.present = F1AP_F1AP_PDU_PR_initiatingMessage; - asn1cCalloc(pdu.choice.initiatingMessage, msg); - msg->procedureCode = F1AP_ProcedureCode_id_Paging; - msg->criticality = F1AP_Criticality_reject; - msg->value.present = F1AP_InitiatingMessage__value_PR_Paging; - - /* mandatory */ - /* UEIdentityIndexValue */ - { - asn1cSequenceAdd(msg->value.choice.Paging.protocolIEs.list, - F1AP_PagingIEs_t, ie); - ie->id = F1AP_ProtocolIE_ID_id_UEIdentityIndexValue; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_PagingIEs__value_PR_UEIdentityIndexValue; - ie->value.choice.UEIdentityIndexValue.present = - F1AP_UEIdentityIndexValue_PR_indexLength10; - UEIDENTITYINDEX_TO_BIT_STRING( - paging->ueidentityindexvalue, - &ie->value.choice.UEIdentityIndexValue.choice.indexLength10); - } - - /* mandatory */ - /* PagingIdentity */ - { - asn1cSequenceAdd(msg->value.choice.Paging.protocolIEs.list, - F1AP_PagingIEs_t, ie); - ie->id = F1AP_ProtocolIE_ID_id_PagingIdentity; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_PagingIEs__value_PR_PagingIdentity; - ie->value.choice.PagingIdentity.present = - F1AP_PagingIdentity_PR_cNUEPagingIdentity; - asn1cCalloc(ie->value.choice.PagingIdentity.choice.cNUEPagingIdentity, id); - id->present = F1AP_CNUEPagingIdentity_PR_fiveG_S_TMSI; - FIVEG_S_TMSI_TO_BIT_STRING(paging->fiveg_s_tmsi, &id->choice.fiveG_S_TMSI); - } - - /* optional */ - /* PagingDRX */ - { - asn1cSequenceAdd(msg->value.choice.Paging.protocolIEs.list, - F1AP_PagingIEs_t, ie); - ie->id = F1AP_ProtocolIE_ID_id_PagingDRX; - ie->criticality = F1AP_Criticality_ignore; - ie->value.present = F1AP_PagingIEs__value_PR_PagingDRX; - ie->value.choice.PagingDRX = paging->paging_drx; - } - - /* mandatory */ - /* PagingCell_list */ - { - asn1cSequenceAdd(msg->value.choice.Paging.protocolIEs.list, - F1AP_PagingIEs_t, ie); - ie->id = F1AP_ProtocolIE_ID_id_PagingCell_List; - ie->criticality = F1AP_Criticality_reject; - ie->value.present = F1AP_PagingIEs__value_PR_PagingCell_list; - asn1cSequenceAdd(ie->value.choice.PagingCell_list, - F1AP_PagingCell_ItemIEs_t, itemies); - itemies->id = F1AP_ProtocolIE_ID_id_PagingCell_Item; - 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->plmn.mcc, paging->plmn.mnc, paging->plmn.mnc_digit_length, &nRCGI->pLMN_Identity); - NR_CELL_ID_TO_BIT_STRING(paging->nr_cellid, &nRCGI->nRCellIdentity); - } - - uint8_t *buffer; - uint32_t len; - /* encode */ - if (f1ap_encode_pdu(&pdu, &buffer, &len) < 0) { - LOG_E(F1AP, "Failed to encode F1 Paging failure\n"); - ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, &pdu); + F1AP_F1AP_PDU_t *pdu = encode_f1ap_paging(paging); + if (pdu == NULL) { + LOG_E(F1AP, "Failed to encode F1 Paging\n"); return -1; } - ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_F1AP_F1AP_PDU, &pdu); - f1ap_itti_send_sctp_data_req(assoc_id, buffer, len); + + byte_array_t ba = {0}; + /* encode */ + if (f1ap_encode_pdu(pdu, &ba.buf, (uint32_t *)&ba.len) < 0) { + LOG_E(F1AP, "Failed to encode F1 Paging PDU\n"); + ASN_STRUCT_FREE(asn_DEF_F1AP_F1AP_PDU, pdu); + return -1; + } + ASN_STRUCT_FREE(asn_DEF_F1AP_F1AP_PDU, pdu); + /* Ownership of ba.buf is transferred to SCTP task; do not free here. */ + f1ap_itti_send_sctp_data_req(assoc_id, ba.buf, ba.len); return 0; } diff --git a/openair2/F1AP/f1ap_cu_paging.h b/openair2/F1AP/f1ap_cu_paging.h index 4029d27312..ff2f6863c9 100644 --- a/openair2/F1AP/f1ap_cu_paging.h +++ b/openair2/F1AP/f1ap_cu_paging.h @@ -32,5 +32,5 @@ #ifndef F1AP_CU_PAGING_H_ #define F1AP_CU_PAGING_H_ -int CU_send_Paging(sctp_assoc_t assoc_id, f1ap_paging_ind_t *paging); +int CU_send_Paging(sctp_assoc_t assoc_id, const f1ap_paging_t *paging); #endif /* F1AP_DU_PAGING_H_ */ diff --git a/openair2/F1AP/f1ap_cu_task.c b/openair2/F1AP/f1ap_cu_task.c index b7d19b7a6a..ff7264d1a4 100644 --- a/openair2/F1AP/f1ap_cu_task.c +++ b/openair2/F1AP/f1ap_cu_task.c @@ -202,9 +202,8 @@ void *F1AP_CU_task(void *arg) { free_ue_context_rel_cmd(&F1AP_UE_CONTEXT_RELEASE_CMD(received_msg)); break; - case F1AP_PAGING_IND: - CU_send_Paging(assoc_id, - &F1AP_PAGING_IND(received_msg)); + case F1AP_PAGING: + CU_send_Paging(assoc_id, &F1AP_PAGING(received_msg)); break; case F1AP_UE_CONTEXT_MODIFICATION_CONFIRM: From 6022ac8bf18b4ce16cd140068fca77599d0d0c8e Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Tue, 3 Feb 2026 16:32:09 +0100 Subject: [PATCH 30/37] Paging (F1AP): wire paging through mac_rrc_dl and use F1AP free/decoding lib on CU/DU Introduce paging_transfer in the mac_rrc_dl interface so the CU can pass paging to the DU (F1 or direct). Use the F1AP paging lib on both CU and DU for decode/free and to avoid leaking the message after send. - Add f1_paging_transfer_func_t and paging_transfer to nr_mac_rrc_dl_if_s (mac_rrc_dl.h, nr_rrc_defs.h). - F1AP path: paging_f1ap() allocates F1AP_PAGING, copies with cp_f1ap_paging(), sends via ITTI to TASK_CU_F1. Direct path: f1_paging_transfer_direct() stub - CU task: call free_f1ap_paging() after CU_send_Paging() to release the message. - DU: DU_handle_Paging() uses decode_f1ap_paging()/free_f1ap_paging() from lib, returns on decode failure; remove inline ASN.1 IE parsing. - cleanup outdated header comments in header files - Left a TODO not in DU code to build PCCH (in F1 and direct paths) --- openair2/F1AP/f1ap_cu_task.c | 2 + openair2/F1AP/f1ap_du_paging.c | 68 +++++++---------------------- openair2/F1AP/f1ap_du_paging.h | 12 +---- openair2/RRC/NR/mac_rrc_dl.h | 1 + openair2/RRC/NR/mac_rrc_dl_direct.c | 11 +++++ openair2/RRC/NR/mac_rrc_dl_f1ap.c | 11 +++++ openair2/RRC/NR/nr_rrc_defs.h | 1 + 7 files changed, 42 insertions(+), 64 deletions(-) diff --git a/openair2/F1AP/f1ap_cu_task.c b/openair2/F1AP/f1ap_cu_task.c index ff7264d1a4..d58e4ec270 100644 --- a/openair2/F1AP/f1ap_cu_task.c +++ b/openair2/F1AP/f1ap_cu_task.c @@ -38,6 +38,7 @@ #include "lib/f1ap_interface_management.h" #include "lib/f1ap_ue_context.h" #include "f1ap_cu_paging.h" +#include "lib/f1ap_paging.h" #include "f1ap_cu_task.h" #include "openair2/RRC/NR/nr_rrc_defs.h" #include @@ -204,6 +205,7 @@ void *F1AP_CU_task(void *arg) { case F1AP_PAGING: CU_send_Paging(assoc_id, &F1AP_PAGING(received_msg)); + free_f1ap_paging(&F1AP_PAGING(received_msg)); break; case F1AP_UE_CONTEXT_MODIFICATION_CONFIRM: diff --git a/openair2/F1AP/f1ap_du_paging.c b/openair2/F1AP/f1ap_du_paging.c index 5351b6bf26..43afc3aeb1 100644 --- a/openair2/F1AP/f1ap_du_paging.c +++ b/openair2/F1AP/f1ap_du_paging.c @@ -19,75 +19,37 @@ * contact@openairinterface.org */ -/*! \file f1ap_du_interface_management.h - * \brief f1ap interface management for DU - * \author EURECOM/NTUST - * \date 2018 - * \version 0.1 - * \company Eurecom - * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr - * \note - * \warning - */ #include "f1ap_common.h" #include "f1ap_du_paging.h" +#include "lib/f1ap_paging.h" #include "conversions.h" #include "oai_asn1.h" #include "openair2/RRC/LTE/rrc_proto.h" +/* @brief Handle F1AP Paging message at DU */ 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; - uint8_t pagingdrx; - uint8_t *fiveg_tmsi_buf = NULL; + f1ap_paging_t decoded = {0}; DevAssert(pdu); + (void)instance; + (void)assoc_id; + (void)stream; - if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { + if (LOG_DEBUGFLAG(DEBUG_ASN1)) { xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, pdu); } - paging = &pdu->choice.initiatingMessage->value.choice.Paging; - // get UEIdentityIndexValue - F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_PagingIEs_t, ie, paging, - F1AP_ProtocolIE_ID_id_UEIdentityIndexValue, true); - - LOG_D(F1AP, "indexLength10 %d\n", BIT_STRING_to_uint32(&ie->value.choice.UEIdentityIndexValue.choice.indexLength10)); - - // get PagingIdentity - F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_PagingIEs_t, ie, paging, - F1AP_ProtocolIE_ID_id_PagingIdentity, true); - - if(ie != NULL){ - fiveg_tmsi_buf = ie->value.choice.PagingIdentity.choice.cNUEPagingIdentity->choice.fiveG_S_TMSI.buf; - - tmsi = ((long)fiveg_tmsi_buf[0] << 40) + - ((long)fiveg_tmsi_buf[1] << 32) + - (fiveg_tmsi_buf[2] << 24) + - (fiveg_tmsi_buf[3] << 16) + - (fiveg_tmsi_buf[4] << 8) + - fiveg_tmsi_buf[5]; - - LOG_D(F1AP, "tmsi %ld\n", tmsi); + if (!decode_f1ap_paging(&decoded, pdu)) { + LOG_E(F1AP, "Failed to decode F1AP Paging\n"); + return -1; } - // get PagingDRX - F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_PagingIEs_t, ie, paging, - F1AP_ProtocolIE_ID_id_PagingDRX, true); - - if(ie != NULL) { - pagingdrx = (uint8_t)ie->value.choice.PagingDRX; - } - - LOG_D(F1AP, "pagingdrx %u\n", pagingdrx); - - // get PagingCell_List - F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_PagingIEs_t, ie, paging, - F1AP_ProtocolIE_ID_id_PagingCell_List, true); - - AssertFatal(false, "not implemented\n"); + /** @todo Build PCCH-Message (Paging) at DU per TS 38.331 §5.3.2; apply + * RRC padding per §8.5; deliver as RLC SDU per §8.2. For each + * cell in Paging Cell List that belongs to this DU, queue for MAC; MAC schedules + * at PF/PO per TS 38.304 §7. */ + free_f1ap_paging(&decoded); return 0; } diff --git a/openair2/F1AP/f1ap_du_paging.h b/openair2/F1AP/f1ap_du_paging.h index 5ec21bcbae..760fb8639a 100644 --- a/openair2/F1AP/f1ap_du_paging.h +++ b/openair2/F1AP/f1ap_du_paging.h @@ -19,20 +19,10 @@ * contact@openairinterface.org */ -/*! \file f1ap_du_interface_management.h - * \brief f1ap interface management for DU - * \author EURECOM/NTUST - * \date 2018 - * \version 0.1 - * \company Eurecom - * \email: navid.nikaein@eurecom.fr, bing-kai.hong@eurecom.fr - * \note - * \warning - */ - #ifndef F1AP_DU_PAGING_H_ #define F1AP_DU_PAGING_H_ +/* Paging (gNB-CU initiated) */ 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/RRC/NR/mac_rrc_dl.h b/openair2/RRC/NR/mac_rrc_dl.h index 4bd106d679..a23e3057d6 100644 --- a/openair2/RRC/NR/mac_rrc_dl.h +++ b/openair2/RRC/NR/mac_rrc_dl.h @@ -40,6 +40,7 @@ typedef void (*ue_context_modification_refuse_func_t)(sctp_assoc_t assoc_id, con typedef void (*ue_context_release_command_func_t)(sctp_assoc_t assoc_id, const f1ap_ue_context_rel_cmd_t *cmd); typedef void (*dl_rrc_message_transfer_func_t)(sctp_assoc_t assoc_id, const f1ap_dl_rrc_message_t *dl_rrc); +typedef void (*f1_paging_transfer_func_t)(sctp_assoc_t assoc_id, const f1ap_paging_t *paging); struct nr_mac_rrc_dl_if_s; void mac_rrc_dl_direct_init(struct nr_mac_rrc_dl_if_s *mac_rrc); diff --git a/openair2/RRC/NR/mac_rrc_dl_direct.c b/openair2/RRC/NR/mac_rrc_dl_direct.c index 83c1130fcb..8029a5e9bf 100644 --- a/openair2/RRC/NR/mac_rrc_dl_direct.c +++ b/openair2/RRC/NR/mac_rrc_dl_direct.c @@ -94,6 +94,16 @@ static void dl_rrc_message_transfer_direct(sctp_assoc_t assoc_id, const f1ap_dl_ dl_rrc_message_transfer(dl_rrc); } +static void f1_paging_transfer_direct(sctp_assoc_t assoc_id, const f1ap_paging_t *paging) +{ + AssertFatal(assoc_id == -1, "illegal assoc_id %d\n", assoc_id); + /** @todo Build PCCH-Message (Paging) at DU per TS 38.331 §5.3.2; apply + * RRC padding per §8.5; deliver as RLC SDU per §8.2. For each + * cell in Paging Cell List that belongs to this DU, queue for MAC; + * MAC schedules at PF/PO per TS 38.304 §7. */ + (void)paging; +} + void mac_rrc_dl_direct_init(nr_mac_rrc_dl_if_t *mac_rrc) { mac_rrc->f1_reset = f1_reset_cu_initiated_direct; @@ -107,4 +117,5 @@ void mac_rrc_dl_direct_init(nr_mac_rrc_dl_if_t *mac_rrc) mac_rrc->ue_context_modification_refuse = ue_context_modification_refuse_direct; mac_rrc->ue_context_release_command = ue_context_release_command_direct; mac_rrc->dl_rrc_message_transfer = dl_rrc_message_transfer_direct; + mac_rrc->paging_transfer = f1_paging_transfer_direct; } diff --git a/openair2/RRC/NR/mac_rrc_dl_f1ap.c b/openair2/RRC/NR/mac_rrc_dl_f1ap.c index 37cb6d70f9..8d2ccc2d74 100644 --- a/openair2/RRC/NR/mac_rrc_dl_f1ap.c +++ b/openair2/RRC/NR/mac_rrc_dl_f1ap.c @@ -30,6 +30,7 @@ #include "intertask_interface.h" #include "mac_rrc_dl.h" #include "nr_rrc_defs.h" +#include "lib/f1ap_paging.h" #include "lib/f1ap_rrc_message_transfer.h" #include "lib/f1ap_interface_management.h" #include "lib/f1ap_ue_context.h" @@ -138,6 +139,15 @@ static void dl_rrc_message_transfer_f1ap(sctp_assoc_t assoc_id, const f1ap_dl_rr itti_send_msg_to_task (TASK_CU_F1, 0, message_p); } +static void paging_f1ap(sctp_assoc_t assoc_id, const f1ap_paging_t *paging) +{ + MessageDef *message_p = itti_alloc_new_message(TASK_RRC_GNB, 0, F1AP_PAGING); + message_p->ittiMsgHeader.originInstance = assoc_id; + f1ap_paging_t *msg = &F1AP_PAGING(message_p); + *msg = cp_f1ap_paging(paging); + itti_send_msg_to_task(TASK_CU_F1, 0, message_p); +} + void mac_rrc_dl_f1ap_init(nr_mac_rrc_dl_if_t *mac_rrc) { mac_rrc->f1_reset = f1_reset_cu_initiated_f1ap; @@ -151,4 +161,5 @@ void mac_rrc_dl_f1ap_init(nr_mac_rrc_dl_if_t *mac_rrc) mac_rrc->ue_context_modification_refuse = ue_context_modification_refuse_f1ap; mac_rrc->ue_context_release_command = ue_context_release_command_f1ap; mac_rrc->dl_rrc_message_transfer = dl_rrc_message_transfer_f1ap; + mac_rrc->paging_transfer = paging_f1ap; } diff --git a/openair2/RRC/NR/nr_rrc_defs.h b/openair2/RRC/NR/nr_rrc_defs.h index b992af3e07..e9d016ab42 100644 --- a/openair2/RRC/NR/nr_rrc_defs.h +++ b/openair2/RRC/NR/nr_rrc_defs.h @@ -362,6 +362,7 @@ typedef struct nr_mac_rrc_dl_if_s { ue_context_modification_refuse_func_t ue_context_modification_refuse; ue_context_release_command_func_t ue_context_release_command; dl_rrc_message_transfer_func_t dl_rrc_message_transfer; + f1_paging_transfer_func_t paging_transfer; } nr_mac_rrc_dl_if_t; typedef struct cucp_cuup_if_s { From 8209dcb5d9b1c41aa26df4b120f38c30b8546f32 Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Thu, 23 Oct 2025 12:32:26 +0200 Subject: [PATCH 31/37] Paging (RRC): refactor NGAP Paging handler in CUCP RRC now builds F1AP paging messages directly by calling F1AP/direct callbacks and aligning the CU/DU intergace with the F1AP design in the CU. Messages are forwarded based on TAI-based cell matching across DUs. - Remove F1AP_PAGING_IND message def and f1ap_paging_ind_t. RRC no longer sends ITTI F1AP_PAGING_IND; it builds f1ap_paging_t and passes it to the DU path. - rrc_gNB_process_PAGING_IND: new signature (rrc, instance, msg) with const where appropriate; call in rrc_gnb_task() updated. - NGAP handler logic: For each TAI, match (PLMN + TAC) to rrc->configuration; collect matching TAIs. Build one f1ap_paging_t (5G-S-TMSI via nr_construct_5g_s_tmsi(), identity type F1AP_PAGING_IDENTITY_CN_UE, optional drx/priority/origin copied from ngap_paging_ind_t), call rrc_send_paging_to_dus(), then free_f1ap_paging(). Remove the previous AssertFatal stub, CC loop, NODE_IS_CU branch, and UE lookup logic: it is now handled by F1AP/direct CU callbacks. - rrc_gNB_du: Add rrc_send_paging_to_dus(rrc, tais, n_tai, msg). Iterate DUs with RB_FOREACH; for each DU, fill msg->cells from du->cells whose (PLMN + TAC) matches any requested TAI, set n_cells, then call rrc->mac_rrc.paging_transfer(du->assoc_id, msg). Skip DUs with no matching cells. Prevents duplicate paging when multiple TAIs map to the same PLMN. --- openair2/COMMON/f1ap_messages_def.h | 1 - openair2/COMMON/f1ap_messages_types.h | 10 --- openair2/RRC/NR/rrc_gNB.c | 2 +- openair2/RRC/NR/rrc_gNB_NGAP.c | 109 ++++++++++++++------------ openair2/RRC/NR/rrc_gNB_NGAP.h | 2 +- openair2/RRC/NR/rrc_gNB_du.c | 68 ++++++++++++++++ openair2/RRC/NR/rrc_gNB_du.h | 5 ++ 7 files changed, 135 insertions(+), 62 deletions(-) diff --git a/openair2/COMMON/f1ap_messages_def.h b/openair2/COMMON/f1ap_messages_def.h index 7c18378b2b..14a7faa843 100644 --- a/openair2/COMMON/f1ap_messages_def.h +++ b/openair2/COMMON/f1ap_messages_def.h @@ -65,4 +65,3 @@ MESSAGE_DEF(F1AP_UE_CONTEXT_MODIFICATION_REFUSE, MESSAGE_PRIORITY_MED, f1ap_ue_c /* CU -> DU*/ MESSAGE_DEF(F1AP_PAGING, MESSAGE_PRIORITY_MED, f1ap_paging_t, f1ap_paging) -MESSAGE_DEF(F1AP_PAGING_IND, MESSAGE_PRIORITY_MED, f1ap_paging_ind_t, f1ap_paging_ind) diff --git a/openair2/COMMON/f1ap_messages_types.h b/openair2/COMMON/f1ap_messages_types.h index d2153f93be..5f430d0e39 100644 --- a/openair2/COMMON/f1ap_messages_types.h +++ b/openair2/COMMON/f1ap_messages_types.h @@ -68,7 +68,6 @@ #define F1AP_UE_CONTEXT_RELEASE_CMD(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ue_context_release_cmd #define F1AP_UE_CONTEXT_RELEASE_COMPLETE(mSGpTR) (mSGpTR)->ittiMsg.f1ap_ue_context_release_complete -#define F1AP_PAGING_IND(mSGpTR) (mSGpTR)->ittiMsg.f1ap_paging_ind #define F1AP_PAGING(mSGpTR) (mSGpTR)->ittiMsg.f1ap_paging /* Length of the transport layer address string @@ -633,15 +632,6 @@ typedef struct f1ap_ue_context_rel_cplt_t { uint32_t gNB_DU_ue_id; } f1ap_ue_context_rel_cplt_t; -typedef struct f1ap_paging_ind_s { - uint16_t ueidentityindexvalue; - uint64_t fiveg_s_tmsi; - uint8_t fiveg_s_tmsi_length; - plmn_id_t plmn; - uint64_t nr_cellid; - uint8_t paging_drx; -} f1ap_paging_ind_t; - typedef struct f1ap_paging_cell_item_s { plmn_id_t plmn; uint64_t nr_cellid; diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 4b0acd44d4..47c9102468 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -3523,7 +3523,7 @@ void *rrc_gnb_task(void *args_p) { break; case NGAP_PAGING_IND: - rrc_gNB_process_PAGING_IND(msg_p, instance); + rrc_gNB_process_PAGING_IND(RC.nrrrc[instance], instance, &NGAP_PAGING_IND(msg_p)); break; case NGAP_HANDOVER_REQUEST: diff --git a/openair2/RRC/NR/rrc_gNB_NGAP.c b/openair2/RRC/NR/rrc_gNB_NGAP.c index d86b77a188..dc9ec9c19a 100644 --- a/openair2/RRC/NR/rrc_gNB_NGAP.c +++ b/openair2/RRC/NR/rrc_gNB_NGAP.c @@ -84,6 +84,7 @@ #include "nr_pdcp/nr_pdcp_oai_api.h" #include "oai_asn1.h" #include "openair2/F1AP/f1ap_ids.h" +#include "openair2/F1AP/lib/f1ap_paging.h" #include "openair3/SECU/key_nas_deriver.h" #include "rrc_messages_types.h" #include "s1ap_messages_types.h" @@ -1629,57 +1630,67 @@ int rrc_gNB_process_NGAP_PDUSESSION_RELEASE_COMMAND(ngap_pdusession_release_comm return 0; } -int rrc_gNB_process_PAGING_IND(MessageDef *msg_p, instance_t instance) +/** @brief Handle NGAP Paging Indication from the AMF. + * For each TAI in the message, matches (PLMN + TAC) against the gNB configuration; on match, + * builds an F1AP Paging message and distributes it to all DUs that serve cells in that PLMN. */ +int rrc_gNB_process_PAGING_IND(gNB_RRC_INST *rrc, const instance_t instance, const ngap_paging_ind_t *msg) { - ngap_paging_ind_t *msg = &NGAP_PAGING_IND(msg_p); - for (uint16_t tai_idx = 0; tai_idx < msg->n_tai; tai_idx++) { - nr_tai_t *tai = &msg->tai_list[tai_idx]; - plmn_id_t *p = &tai->plmn; - LOG_I(NR_RRC, - "[gNB %ld] TAI List for Paging: MCC=%03d, MNC=%0*d, TAC=%d\n", + DevAssert(rrc); + DevAssert(msg); + + // Construct 5G-S-TMSI from paging identity components + const fiveg_s_tmsi_t *s_tmsi = &msg->ue_paging_identity.s_tmsi; + const uint64_t fiveg_s_tmsi = nr_construct_5g_s_tmsi(s_tmsi->amf_set_id, s_tmsi->amf_pointer, s_tmsi->m_tmsi); + const nr_rrc_config_t *req = &rrc->configuration; + DevAssert(req->num_plmn > 0); + + LOG_D(NR_RRC, "[gNB %ld] Processing NGAP Paging Indication for %d TAIs\n", instance, msg->n_tai); + + // Paging Attempt Information (TS 38.413 §9.3.1.72, TS 38.300 §9.2.5) + // AMF provides attempt count and intended attempts for paging optimization (area expansion, retransmission logic). + if (msg->paging_attempt_info != NULL) { + LOG_D(NR_RRC, + "[gNB %ld] Paging Attempt Count: %u, Intended Number of Attempts: %u\n", instance, - p->mcc, - p->mnc_digit_length, - p->mnc, - tai->tac); - nr_rrc_config_t *req = &RC.nrrrc[instance]->configuration; - for (uint8_t j = 0; j < req->num_plmn; j++) { - plmn_id_t *req_plmn = &req->plmn[j]; - if (req_plmn->mcc == p->mcc && req_plmn->mnc == p->mnc && req->tac == tai->tac) { - for (uint8_t CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { - AssertFatal(false, "to be implemented properly\n"); - 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).plmn = *req_plmn; - // Construct 5G-S-TMSI-Part1 from paging identity to find UE - const fiveg_s_tmsi_t *s_tmsi = &msg->ue_paging_identity.s_tmsi; - uint64_t s_tmsi_part1 = nr_construct_5g_s_tmsi_part1(s_tmsi->amf_set_id, s_tmsi->amf_pointer, s_tmsi->m_tmsi); - // Try to find UE by 5G-S-TMSI-Part1 - rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_ue_context_5g_s_tmsi_exist(RC.nrrrc[instance], s_tmsi_part1); - if (ue_context_p == NULL) { - LOG_W(NR_RRC, "UE not found by paging identity\n"); - return -1; - } - // UE found: use its associated cell - gNB_RRC_UE_t *UE = &ue_context_p->ue_context; - nr_rrc_cell_container_t *cell = rrc_get_pcell_for_ue(RC.nrrrc[instance], UE); - if (cell == NULL) { - LOG_W(NR_RRC, "UE %d (rnti %04x) found by paging identity but has no valid cell\n", UE->rrc_ue_id, UE->rnti); - return -1; - } - F1AP_PAGING_IND(m).nr_cellid = cell->info.cell_id; - F1AP_PAGING_IND(m).ueidentityindexvalue = (uint16_t)(msg->ue_paging_identity.s_tmsi.m_tmsi % 1024); - F1AP_PAGING_IND(m).fiveg_s_tmsi = msg->ue_paging_identity.s_tmsi.m_tmsi; - F1AP_PAGING_IND(m).paging_drx = msg->paging_drx ? (uint8_t)*msg->paging_drx : 0; - LOG_E(F1AP, "ueidentityindexvalue %u fiveg_s_tmsi %ld paging_drx %u\n", F1AP_PAGING_IND (m).ueidentityindexvalue, F1AP_PAGING_IND (m).fiveg_s_tmsi, F1AP_PAGING_IND (m).paging_drx); - itti_send_msg_to_task(TASK_CU_F1, instance, m); - } else { - //rrc_gNB_generate_pcch_msg(NGAP_PAGING_IND(msg_p).ue_paging_identity.s_tmsi.m_tmsi,(uint8_t)NGAP_PAGING_IND(msg_p).paging_drx, instance, CC_id); - } // end of nodetype check - } // end of cc loop - } // end of mcc mnc check - } // end of num_plmn - } // end of tai size + msg->paging_attempt_info->paging_attempt_count, + msg->paging_attempt_info->intended_paging_attempts); + } + + if (msg->n_tai > NGAP_MAX_NO_TAI_PAGING) { + LOG_E(NR_RRC, + "[gNB %ld] Paging message error: n_tai (%d) exceeds NGAP_MAX_NO_TAI_PAGING (%d)\n", + instance, + msg->n_tai, + NGAP_MAX_NO_TAI_PAGING); + return -1; + } + + // Build F1AP paging message once for all TAIs + f1ap_paging_t f1ap_msg = {0}; + f1ap_msg.ue_identity_index_value = s_tmsi->m_tmsi % 1024; + f1ap_msg.identity_type = F1AP_PAGING_IDENTITY_CN_UE; + f1ap_msg.identity.cn_ue_paging_identity = fiveg_s_tmsi; + if (msg->paging_drx != NULL) { + /* Mapping 1:1 between NGAP and F1AP Paging DRX */ + f1ap_msg.drx = malloc_or_fail(sizeof(*f1ap_msg.drx)); + *f1ap_msg.drx = (f1ap_paging_drx_t)*msg->paging_drx; + } + if (msg->paging_priority != NULL) { + /* Mapping 1:1 between NGAP and F1AP Paging Priority */ + f1ap_msg.priority = malloc_or_fail(sizeof(*f1ap_msg.priority)); + *f1ap_msg.priority = (f1ap_paging_priority_t)*msg->paging_priority; + } + if (msg->origin != NULL) { + /* Mapping 1:1 between NGAP and F1AP Paging Origin */ + f1ap_msg.origin = malloc_or_fail(sizeof(*f1ap_msg.origin)); + *f1ap_msg.origin = (f1ap_paging_origin_t)*msg->origin; + } + + // For each DU, collect cells matching any AMF TAI (PLMN+TAC) and send + // one Paging with that cell list. + rrc_send_paging_to_dus(rrc, msg->tai_list, msg->n_tai, &f1ap_msg); + + free_f1ap_paging(&f1ap_msg); return 0; } diff --git a/openair2/RRC/NR/rrc_gNB_NGAP.h b/openair2/RRC/NR/rrc_gNB_NGAP.h index 2530b3a803..6ad438c990 100644 --- a/openair2/RRC/NR/rrc_gNB_NGAP.h +++ b/openair2/RRC/NR/rrc_gNB_NGAP.h @@ -84,7 +84,7 @@ void rrc_gNB_send_NGAP_PDUSESSION_RELEASE_RESPONSE(gNB_RRC_INST *rrc, gNB_RRC_UE void nr_rrc_pdcp_config_security(gNB_RRC_UE_t *UE, bool enable_ciphering); -int rrc_gNB_process_PAGING_IND(MessageDef *msg_p, instance_t instance); +int rrc_gNB_process_PAGING_IND(gNB_RRC_INST *rrc, const instance_t instance, const ngap_paging_ind_t *msg); void rrc_gNB_send_NGAP_HANDOVER_REQUIRED(gNB_RRC_INST *rrc, gNB_RRC_UE_t *UE, diff --git a/openair2/RRC/NR/rrc_gNB_du.c b/openair2/RRC/NR/rrc_gNB_du.c index 3381d60ce5..76f1ab1741 100644 --- a/openair2/RRC/NR/rrc_gNB_du.c +++ b/openair2/RRC/NR/rrc_gNB_du.c @@ -820,3 +820,71 @@ void trigger_f1_reset(gNB_RRC_INST *rrc, sctp_assoc_t du_assoc_id) }; rrc->mac_rrc.f1_reset(du_assoc_id, &reset); } + +/** @brief Distribute paging to DUs serving cells matching any of the requested TAIs. + * Loops DUs once, collects matching cells per DU, sends one message per DU. + * Each cell is added at most once per DU (cells are unique by cell_id within a DU). + * Per 3GPP TS 23.003, TAI is uniquely identified by (PLMN, TAC) combination. + * @param rrc RRC instance + * @param tais Array of TAIs (PLMN + TAC) to match against + * @param n_tai Number of TAIs in the array (must be > 0) + * @param msg Pre-filled F1AP paging message */ +void rrc_send_paging_to_dus(gNB_RRC_INST *rrc, const nr_tai_t tais[], uint8_t n_tai, f1ap_paging_t *msg) +{ + DevAssert(msg && !msg->cells); + DevAssert(n_tai > 0); + + nr_rrc_du_container_t *du = NULL; + // Loop over DUs once, for each DU, collects matching cells + RB_FOREACH (du, rrc_du_tree, &rrc->dus) { + RETURN_IF_INVALID_ASSOC_ID(du->assoc_id); + + // Stack-allocated cell list for this DU iteration + f1ap_paging_cell_item_t cells[F1AP_MAX_NB_CELLS] = {0}; + msg->cells = cells; + msg->n_cells = 0; + + // For each cell in this DU, check if it matches any of the matching TAIs + FOR_EACH_SEQ_ARR (nr_rrc_cell_container_t **, cell, &du->cells) { + if (msg->n_cells >= F1AP_MAX_NB_CELLS) { + LOG_W(F1AP, + "[gNB] Paging: DU assoc_id %d has more than %d matching cells, skipping next cells\n", + du->assoc_id, + F1AP_MAX_NB_CELLS); + break; + } + + const nr_rrc_cell_info_t *info = &(*cell)->info; + const plmn_id_t *cell_plmn = &info->plmn; + const uint16_t cell_tac = info->tac; + // Check if this cell's TAI (PLMN + TAC) matches any of the matching TAIs + for (uint8_t j = 0; j < n_tai; j++) { + const nr_tai_t *req_tai = &tais[j]; + const plmn_id_t *req_plmn = &req_tai->plmn; + const uint16_t req_tac = req_tai->tac; + if (cell_plmn->mcc == req_plmn->mcc && cell_plmn->mnc == req_plmn->mnc + && cell_plmn->mnc_digit_length == req_plmn->mnc_digit_length && cell_tac == req_tac) { + f1ap_paging_cell_item_t *paging_cell = &msg->cells[msg->n_cells++]; + paging_cell->plmn = *cell_plmn; + paging_cell->nr_cellid = info->cell_id; + break; // Found match, no need to check other TAIs + } + } + } + + // Skip DUs with no matching cells + if (msg->n_cells == 0) + continue; + DevAssert(msg->n_cells <= F1AP_MAX_NB_CELLS); + LOG_I(F1AP, + "[gNB] Paging transfer to DU assoc_id %d: ue_identity_index_value=%u, paging_identity=%lu, n_cells=%u\n", + du->assoc_id, + msg->ue_identity_index_value, + msg->identity.cn_ue_paging_identity, + msg->n_cells); + // Send one message to the DU with all matching cells + rrc->mac_rrc.paging_transfer(du->assoc_id, msg); + } + + msg->cells = NULL; // Stack allocation, no need to free +} diff --git a/openair2/RRC/NR/rrc_gNB_du.h b/openair2/RRC/NR/rrc_gNB_du.h index 8942af9af5..343ab5d189 100644 --- a/openair2/RRC/NR/rrc_gNB_du.h +++ b/openair2/RRC/NR/rrc_gNB_du.h @@ -34,6 +34,9 @@ struct nr_rrc_cell_container_t; struct f1ap_gnb_du_configuration_update_s; struct f1ap_served_cell_info_t; +#include "f1ap_messages_types.h" +#include "ngap_messages_types.h" + void rrc_gNB_process_f1_setup_req(struct f1ap_setup_req_s *req, sctp_assoc_t assoc_id); void rrc_CU_process_f1_lost_connection(struct gNB_RRC_INST_s *rrc, struct f1ap_lost_connection_t *lc, sctp_assoc_t assoc_id); void rrc_gNB_process_f1_du_configuration_update(struct f1ap_gnb_du_configuration_update_s *conf_up, sctp_assoc_t assoc_id); @@ -58,4 +61,6 @@ struct nr_rrc_du_container_t *find_target_du(struct gNB_RRC_INST_s *rrc, sctp_as void trigger_f1_reset(struct gNB_RRC_INST_s *rrc, sctp_assoc_t du_assoc_id); +void rrc_send_paging_to_dus(struct gNB_RRC_INST_s *rrc, const nr_tai_t tais[], uint8_t n_tai, f1ap_paging_t *f1ap_msg); + #endif /* RRC_GNB_DU_H_ */ From df11c946f91a6547c4e7bfc66a9fb49a91aaf426 Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Tue, 20 Jan 2026 16:54:08 +0100 Subject: [PATCH 32/37] Paging (NGAP): fix stream handling to comply with TS 38.412 Paging messages are classified as non-UE-associated signalling per 3GPP TS 38.412 clause 7 (TL), which requires them to be sent on stream 0 (or a reserved stream pair). Paging message is received when UE is in RRC_IDLE or RRC_INACTIVE state, as the RAN has no active UE context and paging targets the UE by 5G-S-TMSI rather than RAN-UE-NGAP-ID. The previous implementation incorrectly rejected paging messages received on stream 0, causing paging failures when using Open5GS AMF. Changes: - Accept paging on stream 0 (non-UE-associated signalling) - Reject paging on non-zero streams (UE-associated streams) - Add documentation --- openair3/NGAP/ngap_gNB_handlers.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/openair3/NGAP/ngap_gNB_handlers.c b/openair3/NGAP/ngap_gNB_handlers.c index fc87bd2d45..9113f850ca 100644 --- a/openair3/NGAP/ngap_gNB_handlers.c +++ b/openair3/NGAP/ngap_gNB_handlers.c @@ -1098,6 +1098,12 @@ static int ngap_gNB_handle_handover_cancel_ack(sctp_assoc_t assoc_id, uint32_t s return 0; } +/** + * @brief Handle NGAP Paging message from AMF + * @param assoc_id SCTP association ID + * @param stream SCTP stream ID (must be 0 for paging per TS 38.412 Clause 7) + * @param pdu NGAP PDU containing Paging message + * @return 0 on success, -1 on failure */ 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; @@ -1106,10 +1112,14 @@ static int ngap_gNB_handle_paging(sctp_assoc_t assoc_id, uint32_t stream, NGAP_N // received Paging Message from AMF NGAP_DEBUG("[SCTP %u] Received Paging Message From AMF\n",assoc_id); - /* Paging procedure -> stream != 0 */ - if (stream == 0) { - LOG_W(NGAP,"[SCTP %d] Received Paging procedure on stream (%d)\n", - assoc_id, stream); + /* Per 3GPP TS 38.412 Clause 7 (Transport layer): + * Paging is classified as "non-UE-associated signalling" because: + * - UE is in RRC_IDLE or RRC_INACTIVE state + * - No active UE context exists in the RAN + * - Paging targets UE by 5G-S-TMSI, not by RAN-UE-NGAP-ID + * Non-UE-associated signalling MUST use stream 0 (or a reserved stream pair) */ + if (stream != 0) { + LOG_W(NGAP,"[SCTP %d] Received Paging procedure on stream != 0 (expected stream 0 per TS 38.412)\n", assoc_id); return -1; } From d290850e5987744b5aa438eeb0dabee6e354b8ca Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 12 Feb 2026 08:27:12 +0100 Subject: [PATCH 33/37] Add basic GTP unit test Add a simple unit test that tests sending unidirectional traffic. So far, it merely replicates what is already in nr-cuup-load-test, but it's a single executable (so easier to handle), and could be more easily extended to further tests (e.g., IPv6). A couple of ideas for refactoring/improvements have been added in comments in the test. --- openair3/ocp-gtpu/CMakeLists.txt | 4 + openair3/ocp-gtpu/tests/CMakeLists.txt | 6 + openair3/ocp-gtpu/tests/test_gtp.cpp | 199 +++++++++++++++++++++++++ 3 files changed, 209 insertions(+) create mode 100644 openair3/ocp-gtpu/tests/CMakeLists.txt create mode 100644 openair3/ocp-gtpu/tests/test_gtp.cpp diff --git a/openair3/ocp-gtpu/CMakeLists.txt b/openair3/ocp-gtpu/CMakeLists.txt index bcb76e98c9..37e583aa5d 100644 --- a/openair3/ocp-gtpu/CMakeLists.txt +++ b/openair3/ocp-gtpu/CMakeLists.txt @@ -2,3 +2,7 @@ add_library (GTPV1U gtp_itf.cpp gtpu_extensions.c) target_link_libraries(GTPV1U PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs) # for ITTI target_link_libraries(GTPV1U PRIVATE SIMU ds) target_include_directories(GTPV1U PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) + +if(ENABLE_TESTS) + add_subdirectory(tests) +endif() diff --git a/openair3/ocp-gtpu/tests/CMakeLists.txt b/openair3/ocp-gtpu/tests/CMakeLists.txt new file mode 100644 index 0000000000..2b6b4d6189 --- /dev/null +++ b/openair3/ocp-gtpu/tests/CMakeLists.txt @@ -0,0 +1,6 @@ +add_executable(test_gtp test_gtp.cpp) +target_link_libraries(test_gtp PRIVATE GTPV1U GTest::gtest minimal_lib) +# the following dependencies should ideally not exist, but GTP requires them +target_link_libraries(test_gtp PRIVATE ITTI asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs) +add_dependencies(tests test_gtp) +add_test(NAME test_gtp COMMAND ./test_gtp) diff --git a/openair3/ocp-gtpu/tests/test_gtp.cpp b/openair3/ocp-gtpu/tests/test_gtp.cpp new file mode 100644 index 0000000000..6df27a07f2 --- /dev/null +++ b/openair3/ocp-gtpu/tests/test_gtp.cpp @@ -0,0 +1,199 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +#include +#include + +#include + +#include "common/platform_types.h" +#include "common/utils/LOG/log.h" +#include "common/config/config_userapi.h" + +#include "gtp_itf.h" + +extern "C" { +configmodule_interface_t *uniqCfg; + +void exit_function(const char *file, const char *function, const int line, const char *s, const int assert) +{ + LOG_E(GNB_APP, "error at %s:%d:%s: %s\n", file, line, function, s); + abort(); +} + +int nr_rlc_get_available_tx_space(const rnti_t rntiP, const logical_chan_id_t channel_idP) +{ + abort(); + return 0; +} +void *get_softmodem_params(void) +{ + abort(); + return NULL; +}; +} + +/* @brief initialize GTP interface for IP:port */ +static instance_t init_gtp(const char *ip, uint16_t port) +{ + openAddr_t iface = {0}; + DevAssert(strlen(ip) <= sizeof(iface.originHost)); + strcpy(iface.originHost, ip); + snprintf(iface.originService, sizeof(iface.originService), "%d", port); + snprintf(iface.destinationService, sizeof(iface.destinationService), "%d", port); + return gtpv1Init(iface); +} + +static in_addr_t get_addr(int ai_family, const char *ip) +{ + AssertFatal(ai_family == AF_INET, "only IPv4 supported\n"); + in_addr_t addr = {0}; + inet_pton(ai_family, ip, &addr); + return addr; +} + +static transport_layer_addr_t get_tl_addr(int ai_family, const char *ip) +{ + in_addr_t addr = get_addr(ai_family, ip); + transport_layer_addr_t tl_addr = {.length = 32}; + memcpy(tl_addr.buffer, &addr, 4); + return tl_addr; +} + +static void run_basic_test(uint32_t ue_id, + long pdu_id, + long qfi, + int num_send, + int *rcv_count, + gtpCallback callBack, + gtpCallbackSDAP callBackSDAP) +{ + /* set up two instances on different IPs */ + const char *ip1 = "127.0.0.1"; + const char *ip2 = "127.0.0.2"; + uint16_t port = 4567; + instance_t ep1 = init_gtp(ip1, port); + EXPECT_GE(ep1, 1); + instance_t ep2 = init_gtp(ip2, port); + EXPECT_GE(ep2, 1); + EXPECT_NE(ep1, ep2); // different IPs => different interfaces + + /* Create receiving end on ep1. Since we don't know the ep2's TEID, we also + * don't provide an address yet, hence "null_addr". Install the callback + * specific to this test. */ + transport_layer_addr_t null_addr = {.length = 32}; + teid_t t1 = newGtpuCreateTunnel(ep1, ue_id, pdu_id, pdu_id, -1, qfi, null_addr, callBack, callBackSDAP); + + /* Create the sending end on ep2. We have ep1's address/TEID, so create the + * remote endpoint. Don't provide a callback, as this is supposed to be + * unidirectional. */ + transport_layer_addr_t tl_addr1 = get_tl_addr(AF_INET, ip1); + teid_t t2 = newGtpuCreateTunnel(ep2, ue_id, pdu_id, pdu_id, t1, qfi, tl_addr1, NULL, NULL); + + EXPECT_NE(t1, t2); // cannot be the same TEIDs + + /* With the TEID at ep2, update ep1 endpoint. */ + in_addr_t addr2 = get_addr(AF_INET, ip2); + GtpuUpdateTunnelOutgoingAddressAndTeid(ep1, ue_id, pdu_id, addr2, t2); + + /* Send num_send messages, with each message three bytes with a specfic + * payload structure (each byte increasing within the buffer and across + * message) checked by the callback recv_basic_conn_qfi(). */ + uint8_t buf[3]; + uint8_t payload_counter = 0; + for (int i = 0; i < num_send; ++i) { + for (size_t p = 0; p < sizeof(buf); p++) + buf[p] = payload_counter++; + gtpv1uSendDirect(ep2, ue_id, pdu_id, buf, sizeof(buf), false, false); + } + + usleep(100 * 1000); // wait 100ms to give time to receive packets + + /* check that three messages have been received. The callback checked that + * the messages had the expected format. */ + EXPECT_EQ(*rcv_count, num_send); + + int ret; + ret = newGtpuDeleteAllTunnels(ep1, ue_id); + EXPECT_EQ(ret, 0); + ret = newGtpuDeleteAllTunnels(ep2, ue_id); + EXPECT_EQ(ret, 0); +} + +static int recv_count_qfi = 0; +static bool recv_basic_conn_qfi(protocol_ctxt_t *ctxt, + const ue_id_t ue_id, + const srb_flag_t flag, + const mui_t mui, + const confirm_t confirm, + const sdu_size_t size, + unsigned char *const buf, + const pdcp_transmission_mode_t modeP, + const uint32_t *sourceL2Id, + const uint32_t *destinationL2Id, + const uint8_t qfi, + const bool rqi, + const int pdusession_id) +{ + EXPECT_EQ(ue_id, 1); // as defined in basic_conn_qfi + EXPECT_EQ(qfi, 1); + EXPECT_EQ(size, 3); + for (int i = 0; i < size; ++i) + EXPECT_EQ(buf[i], recv_count_qfi * size + i); + recv_count_qfi++; + LOG_I(GTPU, "received message %d with size 3, content %d.%d.%d\n", recv_count_qfi, buf[0], buf[1], buf[2]); + return true; +} + +/* Test unidirectional GTP message forwarding for a single UE with QFI. */ +TEST(gtp, basic_conn_qfi) +{ + /* we consider only a single UE on a specfic bearer (ID=3) */ + uint32_t ue_id = 1; + long pdu_id = 3; + long qfi = 1; + int num_send = 3; + run_basic_test(ue_id, pdu_id, qfi, num_send, &recv_count_qfi, NULL, recv_basic_conn_qfi); +} + +/* ideas for tests: + * - share IP addresses among two instances (e.g., F1-U/NG-U on same IP/port) + * - support of IPv6 + * - test extension headers + * + * ideas for cleanup: + * - simplify callback, harmonize "normal" and "SDAP" callbacks + * - consistently use either transport_layer_addr_t or in_addr + */ + +int main(int argc, char **argv) +{ + //if ((uniqCfg = load_configmodule(argc, argv, CONFIG_ENABLECMDLINEONLY)) == NULL) { + // exit_fun("[SOFTMODEM] Error, configuration module init failed\n"); + //} + // TODO logInit() without config? + logInit(); + g_log->log_component[GTPU].level = OAILOG_DEBUG; + + testing::InitGoogleTest(&argc, argv); + + return RUN_ALL_TESTS(); +} From d6c732107714369fca08bfad1cb00decfe668fd4 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 16 Feb 2026 18:40:10 +0100 Subject: [PATCH 34/37] Implement removal of endpoint For unit testing, allow to remove endpoints such that we could reuse a port/IP combination. The function does not take care of endpoints that are still "dangling", it is the user's responsibility to remove all existing TEIDs. --- openair3/ocp-gtpu/gtp_itf.cpp | 14 ++++++++++++++ openair3/ocp-gtpu/gtp_itf.h | 1 + openair3/ocp-gtpu/tests/test_gtp.cpp | 5 +++++ 3 files changed, 20 insertions(+) diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index 9509c5a8a4..2327d24c2f 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -613,6 +613,20 @@ instance_t gtpv1Init(openAddr_t context) return id; } +/* \brief remove the GTP instance from the list of instances. Does not make an + * attempt to free corresponding TEIDs, as we have many and will simply not + * reuse it later. */ +int gtpv1Term(instance_t instance) +{ + pthread_mutex_lock(&globGtp.gtp_lock); + getInstRetInt(compatInst(instance)); + gtpv1uReceiverCancel(inst->thrData.t); + close(instance); + globGtp.instances.erase(instance); + pthread_mutex_unlock(&globGtp.gtp_lock); + return 0; +} + void GtpuUpdateTunnelOutgoingAddressAndTeid(instance_t instance, ue_id_t ue_id, ebi_t bearer_id, diff --git a/openair3/ocp-gtpu/gtp_itf.h b/openair3/ocp-gtpu/gtp_itf.h index 8139eb3667..0ecddd6f19 100644 --- a/openair3/ocp-gtpu/gtp_itf.h +++ b/openair3/ocp-gtpu/gtp_itf.h @@ -130,6 +130,7 @@ typedef struct gtpv1u_gnb_delete_tunnel_req_s gtpv1u_gnb_delete_tunnel_req_t; size_t len); instance_t gtpv1Init(openAddr_t context); + int gtpv1Term(instance_t inst); void *gtpv1uTask(void *args); #ifdef __cplusplus diff --git a/openair3/ocp-gtpu/tests/test_gtp.cpp b/openair3/ocp-gtpu/tests/test_gtp.cpp index 6df27a07f2..ba2d3d622c 100644 --- a/openair3/ocp-gtpu/tests/test_gtp.cpp +++ b/openair3/ocp-gtpu/tests/test_gtp.cpp @@ -136,6 +136,11 @@ static void run_basic_test(uint32_t ue_id, EXPECT_EQ(ret, 0); ret = newGtpuDeleteAllTunnels(ep2, ue_id); EXPECT_EQ(ret, 0); + + ret = gtpv1Term(ep1); + EXPECT_EQ(ret, 0); + ret = gtpv1Term(ep2); + EXPECT_EQ(ret, 0); } static int recv_count_qfi = 0; From 2a925d6cd40728b8664ee8ce10ece0b7d07128f2 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 16 Feb 2026 18:50:11 +0100 Subject: [PATCH 35/37] GTP: add second test for tunnels without QFI --- openair3/ocp-gtpu/tests/test_gtp.cpp | 32 ++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/openair3/ocp-gtpu/tests/test_gtp.cpp b/openair3/ocp-gtpu/tests/test_gtp.cpp index ba2d3d622c..cd307df7e9 100644 --- a/openair3/ocp-gtpu/tests/test_gtp.cpp +++ b/openair3/ocp-gtpu/tests/test_gtp.cpp @@ -179,6 +179,38 @@ TEST(gtp, basic_conn_qfi) run_basic_test(ue_id, pdu_id, qfi, num_send, &recv_count_qfi, NULL, recv_basic_conn_qfi); } +static int recv_count = 0; +static bool recv_basic_conn(protocol_ctxt_t *ctxt, + const srb_flag_t srb_flagP, + const rb_id_t rb_idP, + const mui_t muiP, + const confirm_t confirmP, + const sdu_size_t size, + unsigned char *const buf, + const pdcp_transmission_mode_t modeP, + const uint32_t *sourceL2Id, + const uint32_t *destinationL2Id) +{ + EXPECT_EQ(ctxt->rntiMaybeUEid, 12); // as defined in basic_conn + EXPECT_EQ(size, 3); + for (int i = 0; i < size; ++i) + EXPECT_EQ(buf[i], recv_count * size + i); + recv_count++; + LOG_I(GTPU, "received message %d with size 3, content %d.%d.%d\n", recv_count, buf[0], buf[1], buf[2]); + return true; +} + +/* Test unidirectional GTP message forwarding for a single UE (without QFI). */ +TEST(gtp, basic_conn) +{ + /* we consider only a single UE on a specfic bearer (ID=3) */ + uint32_t ue_id = 12; + long pdu_id = 5; + long noqfi = -1; + int num_send = 12; + run_basic_test(ue_id, pdu_id, noqfi, num_send, &recv_count, recv_basic_conn, NULL); +} + /* ideas for tests: * - share IP addresses among two instances (e.g., F1-U/NG-U on same IP/port) * - support of IPv6 From c68068f1441666d14521dce09831d55c656468ef Mon Sep 17 00:00:00 2001 From: Teodora Date: Tue, 17 Feb 2026 10:03:44 +0100 Subject: [PATCH 36/37] Remove support for xran E release All the use cases we tested so far, are supported with xran F release. Therefore, we can proceed with removing the support with E release. In addition, our plan is to bring the support for K release which is ongoing activity in the MR https://gitlab.eurecom.fr/oai/openairinterface5g/-/merge_requests/3444. --- .../E/oaioran_E.patch | 1336 ----------------- doc/ORAN_FHI7.2_Tutorial.md | 14 +- radio/fhi_72/CMakeLists.txt | 7 +- radio/fhi_72/mplane/CMakeLists.txt | 4 +- radio/fhi_72/oaioran.c | 30 +- radio/fhi_72/oran-config.c | 3 - radio/fhi_72/oran-init.c | 52 +- 7 files changed, 14 insertions(+), 1432 deletions(-) delete mode 100644 cmake_targets/tools/oran_fhi_integration_patches/E/oaioran_E.patch diff --git a/cmake_targets/tools/oran_fhi_integration_patches/E/oaioran_E.patch b/cmake_targets/tools/oran_fhi_integration_patches/E/oaioran_E.patch deleted file mode 100644 index 8d0610892a..0000000000 --- a/cmake_targets/tools/oran_fhi_integration_patches/E/oaioran_E.patch +++ /dev/null @@ -1,1336 +0,0 @@ -diff --git a/fhi_lib/app/src/common.h b/fhi_lib/app/src/common.h -index 7508117..318508b 100644 ---- a/fhi_lib/app/src/common.h -+++ b/fhi_lib/app/src/common.h -@@ -28,7 +28,7 @@ - #include - #include - --#define VERSIONX "oran_e_maintenance_release_v1.0" -+#define VERSIONX "oran_e_maintenance_release_v1.6" - - #define APP_O_DU 0 - #define APP_O_RU 1 -diff --git a/fhi_lib/lib/Makefile b/fhi_lib/lib/Makefile -index de141bf..c2a448d 100644 ---- a/fhi_lib/lib/Makefile -+++ b/fhi_lib/lib/Makefile -@@ -23,12 +23,25 @@ MYCUSTOMSPACE1='------------------------------------------------------------' - ############################################################## - # Tools configuration - ############################################################## --CC := icc --CPP := icpc -+# Default target architecture and compiler -+TARGET ?= x86 -+# Architecture and compiler-specific tools and flags -+ifeq ($(TARGET), x86) -+CC := gcc -+CPP := g++ - AS := as - AR := ar --LD := icc -+LD := gcc - OBJDUMP := objdump -+else ifeq ($(TARGET), armv8) # aarch64 -+CC := gcc -+CPP := g++ -+LD := gcc -+CFLAGS += -march=armv8-a -+LDFLAGS += -+else -+ $(error Unsupported target architecture: $(TARGET)) -+endif - - ifeq ($(SHELL),cmd.exe) - MD := mkdir.exe -p -@@ -57,7 +70,11 @@ endif - - RTE_TARGET ?= x86_64-native-linux-icc - --RTE_INC := $(shell PKG_CONFIG_PATH=/usr/lib64/pkgconfig:$(RTE_SDK)/build/meson-uninstalled pkgconf --cflags-only-I libdpdk) -+ifeq ($(TARGET), x86) -+RTE_INC := $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH):/usr/lib64/pkgconfig:$(RTE_SDK)/build/meson-uninstalled pkg-config --cflags-only-I libdpdk) -+else ifeq ($(TARGET), armv8) -+RTE_INC := $(shell pkg-config --cflags-only-I libdpdk) -+endif - API_DIR := $(PROJECT_DIR)/api - SRC_DIR := $(PROJECT_DIR)/src - ETH_DIR := $(PROJECT_DIR)/ethernet -@@ -88,6 +105,7 @@ CC_SRC = $(ETH_DIR)/ethdi.c \ - $(SRC_DIR)/xran_main.c \ - $(SRC_DIR)/xran_delay_measurement.c - -+ifeq ($(TARGET), x86) - CPP_SRC = $(SRC_DIR)/xran_compression.cpp \ - $(SRC_DIR)/xran_bfp_ref.cpp \ - $(SRC_DIR)/xran_bfp_cplane8.cpp \ -@@ -95,15 +113,17 @@ CPP_SRC = $(SRC_DIR)/xran_compression.cpp \ - $(SRC_DIR)/xran_bfp_cplane32.cpp \ - $(SRC_DIR)/xran_bfp_cplane64.cpp \ - $(SRC_DIR)/xran_bfp_uplane_9b16rb.cpp \ -- $(SRC_DIR)/xran_bfp_uplane.cpp \ -- $(SRC_DIR)/xran_mod_compression.cpp -+ $(SRC_DIR)/xran_bfp_uplane.cpp -+endif - -+ifeq ($(TARGET), x86) - CPP_SRC_SNC = $(SRC_DIR)/xran_compression_snc.cpp \ - $(SRC_DIR)/xran_bfp_cplane8_snc.cpp \ - $(SRC_DIR)/xran_bfp_cplane16_snc.cpp \ - $(SRC_DIR)/xran_bfp_cplane32_snc.cpp \ - $(SRC_DIR)/xran_bfp_cplane64_snc.cpp \ - $(SRC_DIR)/xran_bfp_uplane_snc.cpp -+endif - - CC_FLAGS += -std=gnu11 -Wall -Wno-deprecated-declarations \ - -fdata-sections \ -@@ -112,14 +132,23 @@ CC_FLAGS += -std=gnu11 -Wall -Wno-deprecated-declarations \ - -fPIC \ - -Wall \ - -Wimplicit-function-declaration \ -- -g -O3 -wd1786 -mcmodel=large -+ -g -O - --CPP_FLAGS := -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D_GNU_SOURCE -D_REENTRANT -pipe -no-prec-div \ -- -no-prec-div -fp-model fast=2 -fPIC \ -- -no-prec-sqrt -falign-functions=16 -fast-transcendentals \ -- -Werror -Wno-unused-variable -std=c++14 -mcmodel=large -+ifeq ($(TARGET), x86) -+CC_FLAGS += -mavx512bw -march=skylake-avx512 -mtune=skylake-avx512#--wd1786 -mcmodel=large -+endif -+ -+ifeq ($(TARGET), x86) -+CPP_FLAGS := -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D_GNU_SOURCE -D_REENTRANT -pipe \ -+ -fPIC \ -+ -falign-functions=16 \ -+ -Werror -Wno-unused-variable -std=c++14 -mcmodel=large -mavx512bw -march=skylake-avx512 -mtune=skylake-avx512 -+else ifeq ($(TARGET), armv8) -+CPP_FLAGS := -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D_GNU_SOURCE -D_REENTRANT -pipe \ -+ -Werror -Wno-unused-variable -std=c++14 -+endif - --INC := -I$(API_DIR) -I$(ETH_DIR) -I$(SRC_DIR) -I$(RTE_INC) -+INC := -I$(API_DIR) -I$(ETH_DIR) -I$(SRC_DIR) $(RTE_INC) - DEF := - ifeq ($(MLOG),1) - INC += -I$(MLOG_DIR)/source -@@ -150,8 +179,13 @@ CPP_SNC_OBJTARGETS := $(addprefix $(PROJECT_OBJ_DIR)/,$(CPP_OBJS_SNC)) - - AS_OBJTARGETS := $(addprefix $(PROJECT_OBJ_DIR)/,$(AS_OBJS)) - #-qopt-report=5 -qopt-matmul -qopt-report-phase=all --CPP_COMP := -O3 -DNDEBUG -xcore-avx512 -fPIE -restrict -fasm-blocks --CPP_COMP_SNC := -O3 -DNDEBUG -march=icelake-server -fPIE -restrict -fasm-blocks -+ifeq ($(TARGET), x86) -+CPP_COMP := -O3 -DNDEBUG -fPIE -+CPP_COMP_SNC := -O3 -DNDEBUG -march=icelake-server -fPIE -+else ifeq ($(TARGET), armv8) -+CPP_COMP := -O3 -DNDEBUG -fPIE -Wrestrict -+CPP_COMP_SNC := -O3 -DNDEBUG -march=icelake-server -fPIE -Wrestrict -+endif - CC_FLAGS_FULL := $(CC_FLAGS) $(INC) $(DEF) - CPP_FLAGS_FULL := $(CPP_FLAGS) $(CPP_COMP) $(INC) $(DEF) - CPP_FLAGS_FULL_SNC := $(CPP_FLAGS) $(CPP_COMP_SNC) $(INC) $(DEF) -diff --git a/fhi_lib/lib/api/xran_fh_o_du.h b/fhi_lib/lib/api/xran_fh_o_du.h -index 7419ae1..a85f973 100644 ---- a/fhi_lib/lib/api/xran_fh_o_du.h -+++ b/fhi_lib/lib/api/xran_fh_o_du.h -@@ -1104,6 +1104,30 @@ int32_t xran_reg_physide_cb(void *pHandle, xran_fh_tti_callback_fn Cb, void *cbP - */ - int32_t xran_get_slot_idx (uint32_t PortId, uint32_t *nFrameIdx, uint32_t *nSubframeIdx, uint32_t *nSlotIdx, uint64_t *nSecond); - -+/** -+ * @ingroup xran -+ * -+ * Function returns Frame, Subframe, Slot Number based on rx_tti -+ * -+ * @param tti -+ * tti for which to compute Frame, Subframe, Slot -+ * -+ * @param nFrameIdx -+ * Pointer to Frame number [0-99] -+ * -+ * @param nSubframeIdx -+ * Pointer to Subframe number [0-10] -+ * -+ * @param nSlotIdx -+ * Pointer to Slot number [0-7] -+ * -+ * @param nSecond -+ * Pointer to current UTC second -+ * -+ * @return -+ * current TTI number [0-7999] -+ */ -+int32_t xran_get_slot_idx_from_tti (uint32_t tti, uint32_t *nFrameIdx, uint32_t *nSubframeIdx, uint32_t * nSlotIdx, uint64_t *nSecond); - /** - * @ingroup xran - * -diff --git a/fhi_lib/lib/api/xran_pkt_cp.h b/fhi_lib/lib/api/xran_pkt_cp.h -index 531c51f..bcb6541 100644 ---- a/fhi_lib/lib/api/xran_pkt_cp.h -+++ b/fhi_lib/lib/api/xran_pkt_cp.h -@@ -33,6 +33,14 @@ - extern "C" { - #endif - -+#include -+#if defined(__arm__) || defined(__aarch64__) -+#include -+typedef int32x4_t simd_data_t; -+#else -+#include -+typedef __m128i simd_data_t; -+#endif - - /********************************************************************** - * Common structures for C/U-plane -@@ -255,8 +263,8 @@ union xran_cp_radioapp_section_ext3_first { - uint64_t reserved2:16; - }all_bits; - -- struct{ -- __m128i data_field1; -+ struct { -+ simd_data_t data_field1; - }data_field; - } __attribute__((__packed__)); - -diff --git a/fhi_lib/lib/api/xran_up_api.h b/fhi_lib/lib/api/xran_up_api.h -index 7d3afc5..e2f1f21 100644 ---- a/fhi_lib/lib/api/xran_up_api.h -+++ b/fhi_lib/lib/api/xran_up_api.h -@@ -80,6 +80,7 @@ int32_t xran_extract_iq_samples(struct rte_mbuf *mbuf, - uint8_t *subframe_id, - uint8_t *slot_id, - uint8_t *symb_id, -+ uint8_t *filter_id, - union ecpri_seq_id *seq_id, - uint16_t *num_prbu, - uint16_t *start_prbu, -@@ -89,7 +90,8 @@ int32_t xran_extract_iq_samples(struct rte_mbuf *mbuf, - int8_t expect_comp, - enum xran_comp_hdr_type staticComp, - uint8_t *compMeth, -- uint8_t *iqWidth); -+ uint8_t *iqWidth, -+ uint8_t *is_prach); - - inline int xran_prepare_iq_symbol_portion( - struct rte_mbuf *mbuf, -diff --git a/fhi_lib/lib/ethernet/ethdi.c b/fhi_lib/lib/ethernet/ethdi.c -index b6ba257..07b7a38 100644 ---- a/fhi_lib/lib/ethernet/ethdi.c -+++ b/fhi_lib/lib/ethernet/ethdi.c -@@ -37,7 +37,10 @@ - #include - #include - #include -+#if defined(__arm__) || defined(__aarch64__) -+#else - #include -+#endif - #include - #include - #include -@@ -326,8 +329,8 @@ xran_ethdi_init_dpdk_io(char *name, const struct xran_io_cfg *io_cfg, - char bbdev_wdev[32] = ""; - char bbdev_vdev[32] = ""; - char iova_mode[32] = "--iova-mode=pa"; -- char socket_mem[32] = "--socket-mem=8192"; -- char socket_limit[32] = "--socket-limit=8192"; -+ char socket_mem[32] = "--socket-mem=0"; -+ char socket_limit[32] = "--socket-limit=0"; - char ring_name[32] = ""; - int32_t xran_port = -1; - portid_t port_id; -@@ -335,6 +338,7 @@ xran_ethdi_init_dpdk_io(char *name, const struct xran_io_cfg *io_cfg, - uint16_t count; - - char *argv[] = { name, core_mask, "-n2", iova_mode, socket_mem, socket_limit, "--proc-type=auto", -+ "--no-telemetry", - "--file-prefix", name, "-a0000:00:00.0", bbdev_wdev, bbdev_vdev}; - - -@@ -479,11 +483,13 @@ xran_ethdi_init_dpdk_io(char *name, const struct xran_io_cfg *io_cfg, - ctx->tx_ring[i] = rte_ring_create(ring_name, NUM_MBUFS_RING_TRX, - rte_lcore_to_socket_id(*lcore_id), RING_F_SC_DEQ); - PANIC_ON(ctx->tx_ring[i] == NULL, "failed to allocate rx ring"); -+ printf("Created ring %s on core %d\n",ring_name,*lcore_id); - for(qi = 0; qi < io_cfg->num_rxq; qi++) { - snprintf(ring_name, RTE_DIM(ring_name), "%s_%d_%d", "rx_ring_cp", i, qi); - ctx->rx_ring[i][qi] = rte_ring_create(ring_name, NUM_MBUFS_RING_TRX, - rte_lcore_to_socket_id(*lcore_id), RING_F_SP_ENQ); - PANIC_ON(ctx->rx_ring[i][qi] == NULL, "failed to allocate rx ring"); -+ printf("Created ring %s on core %d\n",ring_name,*lcore_id); - } - } - } else { -@@ -553,7 +559,7 @@ xran_ethdi_init_dpdk_io(char *name, const struct xran_io_cfg *io_cfg, - ctx->up_dl_pkt_gen_ring[i] = rte_ring_create(ring_name, NUM_MBUFS_RING, - rte_lcore_to_socket_id(*lcore_id), /*RING_F_SC_DEQ*/0); - PANIC_ON(ctx->up_dl_pkt_gen_ring[i] == NULL, "failed to allocate dl gen ring"); -- printf("created %s\n", ring_name); -+ printf("created %s on core %d\n", ring_name, *lcore_id); - } - - return 1; -diff --git a/fhi_lib/lib/ethernet/ethernet.c b/fhi_lib/lib/ethernet/ethernet.c -index 0930665..80e2e10 100644 ---- a/fhi_lib/lib/ethernet/ethernet.c -+++ b/fhi_lib/lib/ethernet/ethernet.c -@@ -37,7 +37,10 @@ - #include - #include - #include -+#if defined(__arm__) || defined(__aarch64__) -+#else - #include -+#endif - #include - #include - #include -diff --git a/fhi_lib/lib/src/xran_app_frag.c b/fhi_lib/lib/src/xran_app_frag.c -index cb526ee..90b2860 100644 ---- a/fhi_lib/lib/src/xran_app_frag.c -+++ b/fhi_lib/lib/src/xran_app_frag.c -@@ -27,7 +27,10 @@ - #include - #include - #include -+#if defined(__arm__) || defined(__aarch64__) -+#else - #include -+#endif - #include - #include - #include -diff --git a/fhi_lib/lib/src/xran_bfp_ref.cpp b/fhi_lib/lib/src/xran_bfp_ref.cpp -index e6d3067..8e0abee 100644 ---- a/fhi_lib/lib/src/xran_bfp_ref.cpp -+++ b/fhi_lib/lib/src/xran_bfp_ref.cpp -@@ -29,6 +29,7 @@ - #include - #include - #include -+#include - - static int16_t saturateAbs(int16_t inVal) - { -diff --git a/fhi_lib/lib/src/xran_bfp_uplane.cpp b/fhi_lib/lib/src/xran_bfp_uplane.cpp -index a345df4..2a94e01 100644 ---- a/fhi_lib/lib/src/xran_bfp_uplane.cpp -+++ b/fhi_lib/lib/src/xran_bfp_uplane.cpp -@@ -90,7 +90,7 @@ namespace BFP_UPlane - { - const __m512i* rawData = reinterpret_cast(dataIn.dataExpanded); - /// Abs -- const auto rawDataAbs = _mm512_abs_epi16(rawData[0]); -+ const auto rawDataAbs = _mm512_abs_epi16(_mm512_loadu_epi16(rawData)); - /// No need to do a full horizontal max operation here, just do a max IQ step, - /// compute the exponents and then use a reduce max over all exponent values. This - /// is the fastest way to handle a single RB. -@@ -116,7 +116,7 @@ namespace BFP_UPlane - /// Get AVX512 pointer aligned to desired RB - const __m512i* rawDataIn = reinterpret_cast(dataIn.dataExpanded + numREOffset); - /// Apply the exponent shift -- const auto compData = _mm512_srai_epi16(*rawDataIn, thisExp); -+ const auto compData = _mm512_srai_epi16(_mm512_loadu_epi16(rawDataIn), thisExp); - /// Pack compressed data network byte order - const auto compDataBytePacked = networkBytePack(compData); - /// Store exponent first -@@ -201,7 +201,7 @@ namespace BFP_UPlane - /// Get AVX512 pointer aligned to desired RB - const __m512i* rawDataIn = reinterpret_cast(dataIn.dataExpanded + numREOffset); - /// Apply the exponent shift -- const auto compData = _mm512_srai_epi16(*rawDataIn, thisExp); -+ const auto compData = _mm512_srai_epi16(_mm512_loadu_epi16(rawDataIn), thisExp); - /// Store exponent first - dataOut->dataCompressed[thisRBExpAddr] = thisExp; - /// Now have 1 RB worth of bytes separated into 3 chunks (1 per lane) -diff --git a/fhi_lib/lib/src/xran_cb_proc.c b/fhi_lib/lib/src/xran_cb_proc.c -index b35d55c..2e7ec05 100644 ---- a/fhi_lib/lib/src/xran_cb_proc.c -+++ b/fhi_lib/lib/src/xran_cb_proc.c -@@ -25,7 +25,10 @@ - - #include - #include -+#if defined(__arm__) || defined(__aarch64__) -+#else - #include -+#endif - #include - #include - #include -diff --git a/fhi_lib/lib/src/xran_common.c b/fhi_lib/lib/src/xran_common.c -index baa673f..7bdc475 100644 ---- a/fhi_lib/lib/src/xran_common.c -+++ b/fhi_lib/lib/src/xran_common.c -@@ -31,7 +31,10 @@ - #include - #include - #include -+#if defined(__arm__) || defined(__aarch64__) -+#else - #include -+#endif - #include - - #include "xran_common.h" -@@ -650,12 +653,15 @@ process_mbuf(struct rte_mbuf *pkt, void* handle, struct xran_eaxc_info *p_cid) - uint8_t compMeth = 0; - uint8_t iqWidth = 0; - -+ uint8_t is_prach = 0; -+ - void *pHandle = NULL; - int ret = MBUF_FREE; - uint32_t mb_free = 0; - int32_t valid_res = 0; - int expect_comp = (p_dev_ctx->fh_cfg.ru_conf.compMeth != XRAN_COMPMETHOD_NONE); - enum xran_comp_hdr_type staticComp = p_dev_ctx->fh_cfg.ru_conf.xranCompHdrType; -+ uint8_t filter_id; - - if (staticComp == XRAN_COMP_HDR_TYPE_STATIC) - { -@@ -674,6 +680,7 @@ process_mbuf(struct rte_mbuf *pkt, void* handle, struct xran_eaxc_info *p_cid) - &subframe_id, - &slot_id, - &symb_id, -+ &filter_id, - &seq, - &num_prbu, - &start_prbu, -@@ -683,28 +690,15 @@ process_mbuf(struct rte_mbuf *pkt, void* handle, struct xran_eaxc_info *p_cid) - expect_comp, - staticComp, - &compMeth, -- &iqWidth); -+ &iqWidth, -+ &is_prach); - if (num_bytes <= 0){ - print_err("num_bytes is wrong [%d]\n", num_bytes); - return MBUF_FREE; - } -- -- valid_res = xran_pkt_validate(p_dev_ctx, -- pkt, -- iq_samp_buf, -- num_bytes, -- CC_ID, -- Ant_ID, -- frame_id, -- subframe_id, -- slot_id, -- symb_id, -- &seq, -- num_prbu, -- start_prbu, -- sym_inc, -- rb, -- sect_id); -+ pCnt->rx_counter++; -+ pCnt->Rx_on_time++; -+ pCnt->Total_msgs_rcvd++; - #ifndef FCN_ADAPT - if(valid_res != 0) { - print_dbg("valid_res is wrong [%d] ant %u (%u : %u : %u : %u) seq %u num_bytes %d\n", valid_res, Ant_ID, frame_id, subframe_id, slot_id, symb_id, seq.seq_id, num_bytes); -@@ -756,7 +750,7 @@ process_mbuf(struct rte_mbuf *pkt, void* handle, struct xran_eaxc_info *p_cid) - print_dbg("Transport layer fragmentation (eCPRI) is not supported\n"); - } - -- } else if (Ant_ID >= p_dev_ctx->PrachCPConfig.eAxC_offset && p_dev_ctx->fh_cfg.prachEnable) { -+ } else if (/*Ant_ID >= p_dev_ctx->PrachCPConfig.eAxC_offset && */p_dev_ctx->fh_cfg.prachEnable && is_prach) { - /* PRACH packet has ruportid = num_eAxc + ant_id */ - Ant_ID -= p_dev_ctx->PrachCPConfig.eAxC_offset; - symbol_total_bytes[p_dev_ctx->xran_port_id][CC_ID][Ant_ID] += num_bytes; -@@ -1189,7 +1183,7 @@ int generate_cpmsg_prach(void *pHandle, struct xran_cp_gen_params *params, struc - timeOffset += startSymId * (2048 + 144); - } - timeOffset = timeOffset >> nNumerology; //original number is Tc, convert to Ts based on mu -- if ((slot_id == 0) || (slot_id == (SLOTNUM_PER_SUBFRAME(pxran_lib_ctx->interval_us_local) >> 1))) -+ if (startSymId > 0 && ((slot_id == 0) || (slot_id == (SLOTNUM_PER_SUBFRAME(pxran_lib_ctx->interval_us_local) >> 1)))) - timeOffset += 16; - - params->dir = XRAN_DIR_UL; -@@ -1295,8 +1289,7 @@ int32_t ring_processing_func(void* args) - - for (i = 0; i < ctx->io_cfg.num_vfs && i < XRAN_VF_MAX; i++){ - for(qi = 0; qi < ctx->rxq_per_port[i]; qi++) { -- if (process_ring(ctx->rx_ring[i][qi], i, qi)) -- return 0; -+ process_ring(ctx->rx_ring[i][qi],i,qi); - } - } - -diff --git a/fhi_lib/lib/src/xran_common.h b/fhi_lib/lib/src/xran_common.h -index 3ed75cd..d61fe7f 100644 ---- a/fhi_lib/lib/src/xran_common.h -+++ b/fhi_lib/lib/src/xran_common.h -@@ -221,7 +221,7 @@ int generate_cpmsg_prach(void *pHandle, struct xran_cp_gen_params *params, struc - struct xran_eaxcid_config *xran_get_conf_eAxC(void *pHandle); - int xran_register_cb_mbuf2ring(xran_ethdi_mbuf_send_fn mbuf_send_cp, xran_ethdi_mbuf_send_fn mbuf_send_up); - --uint16_t xran_alloc_sectionid(void *pHandle, uint8_t dir, uint8_t cc_id, uint8_t ant_id, uint8_t slot_id); -+//uint16_t xran_alloc_sectionid(void *pHandle, uint8_t dir, uint8_t cc_id, uint8_t ant_id, uint8_t slot_id); - uint8_t xran_get_seqid(void *pHandle, uint8_t dir, uint8_t cc_id, uint8_t ant_id, uint8_t slot_id); - int32_t ring_processing_func(void* arg); - int xran_init_prach(struct xran_fh_config* pConf, struct xran_device_ctx * p_xran_dev_ctx); -diff --git a/fhi_lib/lib/src/xran_compression.cpp b/fhi_lib/lib/src/xran_compression.cpp -index 112caae..7c74342 100644 ---- a/fhi_lib/lib/src/xran_compression.cpp -+++ b/fhi_lib/lib/src/xran_compression.cpp -@@ -62,7 +62,7 @@ xranlib_compress(const struct xranlib_compress_request *request, - return xranlib_5gnr_mod_compression(&mod_request, &mod_response); - } - else{ -- if(_may_i_use_cpu_feature(_FEATURE_AVX512IFMA52)) { -+ if(false) { - return xranlib_compress_avxsnc(request,response); - } else { - return xranlib_compress_avx512(request,response); -@@ -89,7 +89,7 @@ xranlib_decompress(const struct xranlib_decompress_request *request, - return xranlib_5gnr_mod_decompression(&mod_request, &mod_response); - } - else{ -- if(_may_i_use_cpu_feature(_FEATURE_AVX512IFMA52)) { -+ if(false) { - return xranlib_decompress_avxsnc(request,response); - } else { - return xranlib_decompress_avx512(request,response); -@@ -101,7 +101,7 @@ int32_t - xranlib_compress_bfw(const struct xranlib_compress_request *request, - struct xranlib_compress_response *response) - { -- if(_may_i_use_cpu_feature(_FEATURE_AVX512IFMA52)) { -+ if(false) { - return xranlib_compress_avxsnc_bfw(request,response); - } else { - return xranlib_compress_avx512_bfw(request,response); -@@ -112,7 +112,7 @@ int32_t - xranlib_decompress_bfw(const struct xranlib_decompress_request *request, - struct xranlib_decompress_response *response) - { -- if(_may_i_use_cpu_feature(_FEATURE_AVX512IFMA52)) { -+ if(false) { - return xranlib_decompress_avxsnc_bfw(request,response); - } else { - return xranlib_decompress_avx512_bfw(request,response); -diff --git a/fhi_lib/lib/src/xran_cp_api.c b/fhi_lib/lib/src/xran_cp_api.c -index 02ba81c..74ef600 100644 ---- a/fhi_lib/lib/src/xran_cp_api.c -+++ b/fhi_lib/lib/src/xran_cp_api.c -@@ -25,7 +25,11 @@ - * @author Intel Corporation - * - **/ -+#if defined(__arm__) || defined(__aarch64__) -+#include -+#else - #include -+#endif - #include - #include - -@@ -821,7 +825,11 @@ xran_prepare_sectionext_3(struct rte_mbuf *mbuf, struct xran_sectionext3_info *p - | (params->layerId << xran_cp_radioapp_sec_ext3_LayerId) - | (params->numLayers << xran_cp_radioapp_sec_ext3_NumLayers); - data_fourth_byte = params->beamIdAP1; -+#if defined(__arm__) || defined(__aarch64__) -+ ext3_f->data_field.data_field1 = (int32x4_t){data_first_byte, data_second_byte, data_third_byte, data_fourth_byte}; -+#else - ext3_f->data_field.data_field1 = _mm_set_epi32(data_fourth_byte, data_third_byte, data_second_byte, data_first_byte); -+#endif - - /* convert byte order */ - tmp = (uint64_t *)ext3_f; -diff --git a/fhi_lib/lib/src/xran_cp_proc.c b/fhi_lib/lib/src/xran_cp_proc.c -index e40ce72..b2c6ea6 100644 ---- a/fhi_lib/lib/src/xran_cp_proc.c -+++ b/fhi_lib/lib/src/xran_cp_proc.c -@@ -35,7 +35,10 @@ - #include - #include - #include -+#if defined(__arm__) || defined(__aarch64__) -+#else - #include -+#endif - - #include - #include -diff --git a/fhi_lib/lib/src/xran_delay_measurement.c b/fhi_lib/lib/src/xran_delay_measurement.c -index 931aceb..a3b53fc 100644 ---- a/fhi_lib/lib/src/xran_delay_measurement.c -+++ b/fhi_lib/lib/src/xran_delay_measurement.c -@@ -23,7 +23,10 @@ - * @author Intel Corporation - **/ - #define _GNU_SOURCE -+#if defined(__arm__) || defined(__aarch64__) -+#else - #include -+#endif - #include - #include - #include -diff --git a/fhi_lib/lib/src/xran_dev.c b/fhi_lib/lib/src/xran_dev.c -index fef64c8..612445d 100644 ---- a/fhi_lib/lib/src/xran_dev.c -+++ b/fhi_lib/lib/src/xran_dev.c -@@ -35,7 +35,10 @@ - #include - #include - #include -+#if defined(__arm__) || defined(__aarch64__) -+#else - #include -+#endif - #include - #include - #include -@@ -55,6 +58,27 @@ - - static struct xran_device_ctx *g_xran_dev_ctx[XRAN_PORTS_NUM] = {NULL, NULL, NULL, NULL}; - -+struct xran_device_ctx *allocate_device_ctx(size_t xran_ports_num, size_t alignment) { -+ void *ptr = NULL; -+ -+#if defined(__arm__) || defined(__aarch64__) -+ // ARM-specific memory allocation -+ if (posix_memalign(&ptr, alignment, sizeof(struct xran_device_ctx) * xran_ports_num) != 0) { -+ print_err("posix_memalign: pCtx allocation error\n"); -+ return NULL; -+ } -+#else -+ // Intel-specific memory allocation -+ ptr = _mm_malloc(sizeof(struct xran_device_ctx) * xran_ports_num, alignment); -+ if (ptr == NULL) { -+ print_err("_mm_malloc: pCtx allocation error\n"); -+ return NULL; -+ } -+#endif -+ -+ return (struct xran_device_ctx *)ptr; -+} -+ - int32_t - xran_dev_create_ctx(uint32_t xran_ports_num) - { -@@ -64,7 +88,7 @@ xran_dev_create_ctx(uint32_t xran_ports_num) - if (xran_ports_num > XRAN_PORTS_NUM) - return -1; - -- pCtx = (struct xran_device_ctx *) _mm_malloc(sizeof(struct xran_device_ctx)*xran_ports_num, 64); -+ pCtx = allocate_device_ctx(xran_ports_num, 64); - if(pCtx){ - for(i = 0; i < xran_ports_num; i++){ - g_xran_dev_ctx[i] = pCtx; -diff --git a/fhi_lib/lib/src/xran_main.c b/fhi_lib/lib/src/xran_main.c -index 89dcc1f..ded4116 100644 ---- a/fhi_lib/lib/src/xran_main.c -+++ b/fhi_lib/lib/src/xran_main.c -@@ -35,7 +35,11 @@ - #include - #include - #include -+#if defined(__arm__) || defined(__aarch64__) -+#include -+#else - #include -+#endif - - #include - #include -@@ -102,6 +106,25 @@ void tti_to_phy_cb(struct rte_timer *tim, void *arg); - - int32_t xran_pkt_gen_process_ring(struct rte_ring *r); - -+void *mm_allocate_handle(size_t size, size_t alignment) { -+ void *ptr = NULL; -+#if defined(__arm__) || defined(__aarch64__) -+ // ARM-specific memory allocation -+ if (posix_memalign(&ptr, alignment, size) != 0) { -+ fprintf(stderr, "posix_memalign: allocation error\n"); -+ return NULL; -+ } -+#else -+ // Intel-specific memory allocation -+ ptr = _mm_malloc(size, alignment); -+ if (ptr == NULL) { -+ fprintf(stderr, "_mm_malloc: allocation error\n"); -+ return NULL; -+ } -+#endif -+ return ptr; -+} -+ - void - xran_updateSfnSecStart(void) - { -@@ -272,7 +295,7 @@ xran_init_prach(struct xran_fh_config* pConf, struct xran_device_ctx * p_xran_de - printf("PRACH start symbol %u lastsymbol %u\n", p_xran_dev_ctx->prach_start_symbol[0], p_xran_dev_ctx->prach_last_symbol[0]); - } - -- pPrachCPConfig->eAxC_offset = xran_get_num_eAxc(p_xran_dev_ctx); -+ pPrachCPConfig->eAxC_offset = pPRACHConfig->eAxC_offset; - print_dbg("PRACH eAxC_offset %d\n", pPrachCPConfig->eAxC_offset); - - /* Save some configs for app */ -@@ -844,7 +867,7 @@ tx_cp_ul_cb(struct rte_timer *tim, void *arg) - struct xran_cp_gen_params params; - struct xran_section_gen_info sect_geninfo[8]; - struct rte_mbuf *mbuf = xran_ethdi_mbuf_alloc(); -- prach_port_id = ant_id + num_eAxc; -+ prach_port_id = ant_id + pPrachCPConfig->eAxC_offset; - /* start new section information list */ - xran_cp_reset_section_info(pHandle, XRAN_DIR_UL, cc_id, prach_port_id, ctx_id); - -@@ -1059,6 +1082,7 @@ int32_t handle_ecpri_ethertype(struct rte_mbuf* pkt_q[], uint16_t xport_id, stru - { - case ECPRI_IQ_DATA: - pkt_data[num_data++] = pkt; -+ uint8_t *pkt_bytes=rte_pktmbuf_mtod(pkt,uint8_t*); - break; - // For RU emulation - case ECPRI_RT_CONTROL_DATA: -@@ -1076,7 +1100,7 @@ int32_t handle_ecpri_ethertype(struct rte_mbuf* pkt_q[], uint16_t xport_id, stru - break; - default: - if (p_dev_ctx->fh_init.io_cfg.id == O_DU) { -- print_err("Invalid eCPRI message type - %d", ecpri_hdr->cmnhdr.bits.ecpri_mesg_type); -+ rte_pktmbuf_free(pkt); - } - break; - } -@@ -1366,8 +1390,7 @@ xran_sector_get_instances (uint32_t xran_port, void * pDevHandle, uint16_t nNumI - for (i = 0; i < nNumInstances; i++) { - - /* Allocate Memory for CC handles */ -- pCcHandle = (XranSectorHandleInfo *) _mm_malloc( /*"xran_cc_handles",*/ sizeof (XranSectorHandleInfo), 64); -- -+ pCcHandle = (XranSectorHandleInfo *)mm_allocate_handle(/*"xran_cc_handles",*/ sizeof(XranSectorHandleInfo), 64); - if(pCcHandle == NULL) - return XRAN_STATUS_RESOURCE; - -@@ -1771,8 +1794,7 @@ ring_processing_func_per_port(void* args) - for (i = 0; i < ctx->io_cfg.num_vfs && i < XRAN_VF_MAX; i = i+1) { - if (ctx->vf2xran_port[i] == port_id) { - for(qi = 0; qi < ctx->rxq_per_port[port_id]; qi++){ -- if (process_ring(ctx->rx_ring[i][qi], i, qi)) -- return 0; -+ process_ring(ctx->rx_ring[i][qi],i,qi); - } - } - } -@@ -1837,8 +1859,6 @@ xran_spawn_workers(void) - nWorkerCore = nWorkerCore << 1; - } - -- extern int _may_i_use_cpu_feature(unsigned __int64); -- icx_cpu = _may_i_use_cpu_feature(_FEATURE_AVX512IFMA52); - - printf("O-XU %d\n", eth_ctx->io_cfg.id); - printf("HW %d\n", icx_cpu); -@@ -1876,7 +1896,7 @@ xran_spawn_workers(void) - eth_ctx->time_wrk_cfg.arg = NULL; - eth_ctx->time_wrk_cfg.state = 1; - -- pThCtx = (struct xran_worker_th_ctx*) _mm_malloc(sizeof(struct xran_worker_th_ctx), 64); -+ pThCtx = (struct xran_worker_th_ctx *)mm_allocate_handle(sizeof(struct xran_worker_th_ctx), 64); - if(pThCtx == NULL){ - print_err("pThCtx allocation error\n"); - return XRAN_STATUS_FAIL; -@@ -1898,7 +1918,7 @@ xran_spawn_workers(void) - - /* workers */ - /** 0 **/ -- pThCtx = (struct xran_worker_th_ctx*) _mm_malloc(sizeof(struct xran_worker_th_ctx), 64); -+ pThCtx = (struct xran_worker_th_ctx *)mm_allocate_handle(sizeof(struct xran_worker_th_ctx), 64); - if(pThCtx == NULL){ - print_err("pThCtx allocation error\n"); - return XRAN_STATUS_FAIL; -@@ -1925,7 +1945,7 @@ xran_spawn_workers(void) - } - - /** 1 - CP GEN **/ -- pThCtx = (struct xran_worker_th_ctx*) _mm_malloc(sizeof(struct xran_worker_th_ctx), 64); -+ pThCtx = (struct xran_worker_th_ctx *)mm_allocate_handle(sizeof(struct xran_worker_th_ctx), 64); - if(pThCtx == NULL){ - print_err("pThCtx allocation error\n"); - return XRAN_STATUS_FAIL; -@@ -1956,7 +1976,7 @@ xran_spawn_workers(void) - - p_dev->tx_sym_gen_func = xran_process_tx_sym_cp_on_opt; - -- pThCtx = (struct xran_worker_th_ctx*) _mm_malloc(sizeof(struct xran_worker_th_ctx), 64); -+ pThCtx = (struct xran_worker_th_ctx *)mm_allocate_handle(sizeof(struct xran_worker_th_ctx), 64); - if(pThCtx == NULL){ - print_err("pThCtx allocation error\n"); - return XRAN_STATUS_FAIL; -@@ -1979,7 +1999,7 @@ xran_spawn_workers(void) - - /* workers */ - /** 0 **/ -- pThCtx = (struct xran_worker_th_ctx*) _mm_malloc(sizeof(struct xran_worker_th_ctx), 64); -+ pThCtx = (struct xran_worker_th_ctx *)mm_allocate_handle(sizeof(struct xran_worker_th_ctx), 64); - if(pThCtx == NULL){ - print_err("pThCtx allocation error\n"); - return XRAN_STATUS_FAIL; -@@ -2006,7 +2026,7 @@ xran_spawn_workers(void) - } - - /** 1 - CP GEN **/ -- pThCtx = (struct xran_worker_th_ctx*) _mm_malloc(sizeof(struct xran_worker_th_ctx), 64); -+ pThCtx = (struct xran_worker_th_ctx *)mm_allocate_handle(sizeof(struct xran_worker_th_ctx), 64); - if(pThCtx == NULL){ - print_err("pThCtx allocation error\n"); - return XRAN_STATUS_FAIL; -@@ -2033,7 +2053,7 @@ xran_spawn_workers(void) - - /* workers */ - /** 0 **/ -- pThCtx = (struct xran_worker_th_ctx*) _mm_malloc(sizeof(struct xran_worker_th_ctx), 64); -+ pThCtx = (struct xran_worker_th_ctx *)mm_allocate_handle(sizeof(struct xran_worker_th_ctx), 64); - if(pThCtx == NULL){ - print_err("pThCtx allocation error\n"); - return XRAN_STATUS_FAIL; -@@ -2048,7 +2068,7 @@ xran_spawn_workers(void) - eth_ctx->pkt_wrk_cfg[pThCtx->worker_id].arg = pThCtx; - - /** 1 - CP GEN **/ -- pThCtx = (struct xran_worker_th_ctx*) _mm_malloc(sizeof(struct xran_worker_th_ctx), 64); -+ pThCtx = (struct xran_worker_th_ctx *)mm_allocate_handle(sizeof(struct xran_worker_th_ctx), 64); - if(pThCtx == NULL){ - print_err("pThCtx allocation error\n"); - return XRAN_STATUS_FAIL; -@@ -2063,7 +2083,7 @@ xran_spawn_workers(void) - eth_ctx->pkt_wrk_cfg[pThCtx->worker_id].arg = pThCtx; - - /** 2 UP GEN **/ -- pThCtx = (struct xran_worker_th_ctx*) _mm_malloc(sizeof(struct xran_worker_th_ctx), 64); -+ pThCtx = (struct xran_worker_th_ctx *)mm_allocate_handle(sizeof(struct xran_worker_th_ctx), 64); - if(pThCtx == NULL){ - print_err("pThCtx allocation error\n"); - return XRAN_STATUS_FAIL; -@@ -2102,7 +2122,7 @@ xran_spawn_workers(void) - - /* workers */ - /** 0 **/ -- pThCtx = (struct xran_worker_th_ctx*) _mm_malloc(sizeof(struct xran_worker_th_ctx), 64); -+ pThCtx = (struct xran_worker_th_ctx *)mm_allocate_handle(sizeof(struct xran_worker_th_ctx), 64); - if(pThCtx == NULL){ - print_err("pThCtx allocation error\n"); - return XRAN_STATUS_FAIL; -@@ -2117,7 +2137,7 @@ xran_spawn_workers(void) - eth_ctx->pkt_wrk_cfg[pThCtx->worker_id].arg = pThCtx; - - /** 1 - CP GEN **/ -- pThCtx = (struct xran_worker_th_ctx*) _mm_malloc(sizeof(struct xran_worker_th_ctx), 64); -+ pThCtx = (struct xran_worker_th_ctx *)mm_allocate_handle(sizeof(struct xran_worker_th_ctx), 64); - if(pThCtx == NULL){ - print_err("pThCtx allocation error\n"); - return XRAN_STATUS_FAIL; -@@ -2132,7 +2152,7 @@ xran_spawn_workers(void) - eth_ctx->pkt_wrk_cfg[pThCtx->worker_id].arg = pThCtx; - - /** 2 UP GEN **/ -- pThCtx = (struct xran_worker_th_ctx*) _mm_malloc(sizeof(struct xran_worker_th_ctx), 64); -+ pThCtx = (struct xran_worker_th_ctx *)mm_allocate_handle(sizeof(struct xran_worker_th_ctx), 64); - if(pThCtx == NULL){ - print_err("pThCtx allocation error\n"); - return XRAN_STATUS_FAIL; -@@ -2147,7 +2167,7 @@ xran_spawn_workers(void) - eth_ctx->pkt_wrk_cfg[pThCtx->worker_id].arg = pThCtx; - - /** 3 UP GEN **/ -- pThCtx = (struct xran_worker_th_ctx*) _mm_malloc(sizeof(struct xran_worker_th_ctx), 64); -+ pThCtx = (struct xran_worker_th_ctx *)mm_allocate_handle(sizeof(struct xran_worker_th_ctx), 64); - if(pThCtx == NULL){ - print_err("pThCtx allocation error\n"); - return XRAN_STATUS_FAIL; -@@ -2186,7 +2206,7 @@ xran_spawn_workers(void) - - /* workers */ - /** 0 **/ -- pThCtx = (struct xran_worker_th_ctx*) _mm_malloc(sizeof(struct xran_worker_th_ctx), 64); -+ pThCtx = (struct xran_worker_th_ctx *)mm_allocate_handle(sizeof(struct xran_worker_th_ctx), 64); - if(pThCtx == NULL){ - print_err("pThCtx allocation error\n"); - return XRAN_STATUS_FAIL; -@@ -2201,7 +2221,7 @@ xran_spawn_workers(void) - eth_ctx->pkt_wrk_cfg[pThCtx->worker_id].arg = pThCtx; - - /** 1 Eth Tx **/ -- pThCtx = (struct xran_worker_th_ctx*) _mm_malloc(sizeof(struct xran_worker_th_ctx), 64); -+ pThCtx = (struct xran_worker_th_ctx *)mm_allocate_handle(sizeof(struct xran_worker_th_ctx), 64); - - if(pThCtx == NULL){ - print_err("pThCtx allocation error\n"); -@@ -2217,7 +2237,7 @@ xran_spawn_workers(void) - eth_ctx->pkt_wrk_cfg[pThCtx->worker_id].arg = pThCtx; - - /** 2 - CP GEN **/ -- pThCtx = (struct xran_worker_th_ctx*) _mm_malloc(sizeof(struct xran_worker_th_ctx), 64); -+ pThCtx = (struct xran_worker_th_ctx *)mm_allocate_handle(sizeof(struct xran_worker_th_ctx), 64); - if(pThCtx == NULL){ - print_err("pThCtx allocation error\n"); - return XRAN_STATUS_FAIL; -@@ -2232,7 +2252,7 @@ xran_spawn_workers(void) - eth_ctx->pkt_wrk_cfg[pThCtx->worker_id].arg = pThCtx; - - /** 3 UP GEN **/ -- pThCtx = (struct xran_worker_th_ctx*) _mm_malloc(sizeof(struct xran_worker_th_ctx), 64); -+ pThCtx = (struct xran_worker_th_ctx *)mm_allocate_handle(sizeof(struct xran_worker_th_ctx), 64); - if(pThCtx == NULL){ - print_err("pThCtx allocation error\n"); - return XRAN_STATUS_FAIL; -@@ -2247,7 +2267,7 @@ xran_spawn_workers(void) - eth_ctx->pkt_wrk_cfg[pThCtx->worker_id].arg = pThCtx; - - /** 4 UP GEN **/ -- pThCtx = (struct xran_worker_th_ctx*) _mm_malloc(sizeof(struct xran_worker_th_ctx), 64); -+ pThCtx = (struct xran_worker_th_ctx *)mm_allocate_handle(sizeof(struct xran_worker_th_ctx), 64); - if(pThCtx == NULL){ - print_err("pThCtx allocation error\n"); - return XRAN_STATUS_FAIL; -@@ -2281,7 +2301,7 @@ xran_spawn_workers(void) - - /* workers */ - /** 0 Eth RX */ -- pThCtx = (struct xran_worker_th_ctx*) _mm_malloc(sizeof(struct xran_worker_th_ctx), 64); -+ pThCtx = (struct xran_worker_th_ctx *)mm_allocate_handle(sizeof(struct xran_worker_th_ctx), 64); - if(pThCtx == NULL){ - print_err("pThCtx allocation error\n"); - return XRAN_STATUS_FAIL; -@@ -2296,7 +2316,7 @@ xran_spawn_workers(void) - eth_ctx->pkt_wrk_cfg[pThCtx->worker_id].arg = pThCtx; - - /** 1 FH RX and BBDEV */ -- pThCtx = (struct xran_worker_th_ctx*) _mm_malloc(sizeof(struct xran_worker_th_ctx), 64); -+ pThCtx = (struct xran_worker_th_ctx *)mm_allocate_handle(sizeof(struct xran_worker_th_ctx), 64); - if(pThCtx == NULL){ - print_err("pThCtx allocation error\n"); - return XRAN_STATUS_FAIL; -@@ -2311,7 +2331,7 @@ xran_spawn_workers(void) - eth_ctx->pkt_wrk_cfg[pThCtx->worker_id].arg = pThCtx; - - /** 2 FH RX and BBDEV */ -- pThCtx = (struct xran_worker_th_ctx*) _mm_malloc(sizeof(struct xran_worker_th_ctx), 64); -+ pThCtx = (struct xran_worker_th_ctx *)mm_allocate_handle(sizeof(struct xran_worker_th_ctx), 64); - if(pThCtx == NULL){ - print_err("pThCtx allocation error\n"); - return XRAN_STATUS_FAIL; -@@ -2326,7 +2346,7 @@ xran_spawn_workers(void) - eth_ctx->pkt_wrk_cfg[pThCtx->worker_id].arg = pThCtx; - - /** 3 FH RX and BBDEV */ -- pThCtx = (struct xran_worker_th_ctx*) _mm_malloc(sizeof(struct xran_worker_th_ctx), 64); -+ pThCtx = (struct xran_worker_th_ctx *)mm_allocate_handle(sizeof(struct xran_worker_th_ctx), 64); - if(pThCtx == NULL){ - print_err("pThCtx allocation error\n"); - return XRAN_STATUS_FAIL; -@@ -2341,7 +2361,7 @@ xran_spawn_workers(void) - eth_ctx->pkt_wrk_cfg[pThCtx->worker_id].arg = pThCtx; - - /** FH TX and BBDEV */ -- pThCtx = (struct xran_worker_th_ctx*) _mm_malloc(sizeof(struct xran_worker_th_ctx), 64); -+ pThCtx = (struct xran_worker_th_ctx *)mm_allocate_handle(sizeof(struct xran_worker_th_ctx), 64); - if(pThCtx == NULL){ - print_err("pThCtx allocation error\n"); - return XRAN_STATUS_FAIL; -@@ -2379,7 +2399,7 @@ xran_spawn_workers(void) - - /* workers */ - /** 0 **/ -- pThCtx = (struct xran_worker_th_ctx*) _mm_malloc(sizeof(struct xran_worker_th_ctx), 64); -+ pThCtx = (struct xran_worker_th_ctx *)mm_allocate_handle(sizeof(struct xran_worker_th_ctx), 64); - if(pThCtx == NULL){ - print_err("pThCtx allocation error\n"); - return XRAN_STATUS_FAIL; -@@ -2406,7 +2426,7 @@ xran_spawn_workers(void) - } - - /** 1 - CP GEN **/ -- pThCtx = (struct xran_worker_th_ctx*) _mm_malloc(sizeof(struct xran_worker_th_ctx), 64); -+ pThCtx = (struct xran_worker_th_ctx *)mm_allocate_handle(sizeof(struct xran_worker_th_ctx), 64); - if(pThCtx == NULL){ - print_err("pThCtx allocation error\n"); - return XRAN_STATUS_FAIL; -@@ -2433,7 +2453,7 @@ xran_spawn_workers(void) - - /* workers */ - /** 0 **/ -- pThCtx = (struct xran_worker_th_ctx*) _mm_malloc(sizeof(struct xran_worker_th_ctx), 64); -+ pThCtx = (struct xran_worker_th_ctx *)mm_allocate_handle(sizeof(struct xran_worker_th_ctx), 64); - if(pThCtx == NULL){ - print_err("pThCtx allocation error\n"); - return XRAN_STATUS_FAIL; -@@ -2448,7 +2468,7 @@ xran_spawn_workers(void) - eth_ctx->pkt_wrk_cfg[pThCtx->worker_id].arg = pThCtx; - - /** 1 - CP GEN **/ -- pThCtx = (struct xran_worker_th_ctx*) _mm_malloc(sizeof(struct xran_worker_th_ctx), 64); -+ pThCtx = (struct xran_worker_th_ctx *)mm_allocate_handle(sizeof(struct xran_worker_th_ctx), 64); - if(pThCtx == NULL){ - print_err("pThCtx allocation error\n"); - return XRAN_STATUS_FAIL; -@@ -2463,7 +2483,7 @@ xran_spawn_workers(void) - eth_ctx->pkt_wrk_cfg[pThCtx->worker_id].arg = pThCtx; - - /** 2 UP GEN **/ -- pThCtx = (struct xran_worker_th_ctx*) _mm_malloc(sizeof(struct xran_worker_th_ctx), 64); -+ pThCtx = (struct xran_worker_th_ctx *)mm_allocate_handle(sizeof(struct xran_worker_th_ctx), 64); - if(pThCtx == NULL){ - print_err("pThCtx allocation error\n"); - return XRAN_STATUS_FAIL; -@@ -2501,7 +2521,7 @@ xran_spawn_workers(void) - - /* workers */ - /** 0 FH RX and BBDEV */ -- pThCtx = (struct xran_worker_th_ctx*) _mm_malloc(sizeof(struct xran_worker_th_ctx), 64); -+ pThCtx = (struct xran_worker_th_ctx *)mm_allocate_handle(sizeof(struct xran_worker_th_ctx), 64); - if(pThCtx == NULL){ - print_err("pThCtx allocation error\n"); - return XRAN_STATUS_FAIL; -@@ -2516,7 +2536,7 @@ xran_spawn_workers(void) - eth_ctx->pkt_wrk_cfg[pThCtx->worker_id].arg = pThCtx; - - /** 1 - CP GEN **/ -- pThCtx = (struct xran_worker_th_ctx*) _mm_malloc(sizeof(struct xran_worker_th_ctx), 64); -+ pThCtx = (struct xran_worker_th_ctx *)mm_allocate_handle(sizeof(struct xran_worker_th_ctx), 64); - if(pThCtx == NULL){ - print_err("pThCtx allocation error\n"); - return XRAN_STATUS_FAIL; -@@ -2531,7 +2551,7 @@ xran_spawn_workers(void) - eth_ctx->pkt_wrk_cfg[pThCtx->worker_id].arg = pThCtx; - - /** 2 UP GEN **/ -- pThCtx = (struct xran_worker_th_ctx*) _mm_malloc(sizeof(struct xran_worker_th_ctx), 64); -+ pThCtx = (struct xran_worker_th_ctx *)mm_allocate_handle(sizeof(struct xran_worker_th_ctx), 64); - if(pThCtx == NULL){ - print_err("pThCtx allocation error\n"); - return XRAN_STATUS_FAIL; -@@ -2546,7 +2566,7 @@ xran_spawn_workers(void) - eth_ctx->pkt_wrk_cfg[pThCtx->worker_id].arg = pThCtx; - - /** 3 UP GEN **/ -- pThCtx = (struct xran_worker_th_ctx*) _mm_malloc(sizeof(struct xran_worker_th_ctx), 64); -+ pThCtx = (struct xran_worker_th_ctx *)mm_allocate_handle(sizeof(struct xran_worker_th_ctx), 64); - if(pThCtx == NULL){ - print_err("pThCtx allocation error\n"); - return XRAN_STATUS_FAIL; -@@ -2569,7 +2589,7 @@ xran_spawn_workers(void) - - /* workers */ - /** 0 **/ -- pThCtx = (struct xran_worker_th_ctx*) _mm_malloc(sizeof(struct xran_worker_th_ctx), 64); -+ pThCtx = (struct xran_worker_th_ctx *)mm_allocate_handle(sizeof(struct xran_worker_th_ctx), 64); - if(pThCtx == NULL){ - print_err("pThCtx allocation error\n"); - return XRAN_STATUS_FAIL; -@@ -2584,7 +2604,7 @@ xran_spawn_workers(void) - eth_ctx->pkt_wrk_cfg[pThCtx->worker_id].arg = pThCtx; - - /** 1 - CP GEN **/ -- pThCtx = (struct xran_worker_th_ctx*) _mm_malloc(sizeof(struct xran_worker_th_ctx), 64); -+ pThCtx = (struct xran_worker_th_ctx *)mm_allocate_handle(sizeof(struct xran_worker_th_ctx), 64); - if(pThCtx == NULL){ - print_err("pThCtx allocation error\n"); - return XRAN_STATUS_FAIL; -@@ -2599,7 +2619,7 @@ xran_spawn_workers(void) - eth_ctx->pkt_wrk_cfg[pThCtx->worker_id].arg = pThCtx; - - /** 2 UP GEN **/ -- pThCtx = (struct xran_worker_th_ctx*) _mm_malloc(sizeof(struct xran_worker_th_ctx), 64); -+ pThCtx = (struct xran_worker_th_ctx *)mm_allocate_handle(sizeof(struct xran_worker_th_ctx), 64); - if(pThCtx == NULL){ - print_err("pThCtx allocation error\n"); - return XRAN_STATUS_FAIL; -@@ -2614,7 +2634,7 @@ xran_spawn_workers(void) - eth_ctx->pkt_wrk_cfg[pThCtx->worker_id].arg = pThCtx; - - /** 3 UP GEN **/ -- pThCtx = (struct xran_worker_th_ctx*) _mm_malloc(sizeof(struct xran_worker_th_ctx), 64); -+ pThCtx = (struct xran_worker_th_ctx *)mm_allocate_handle(sizeof(struct xran_worker_th_ctx), 64); - if(pThCtx == NULL){ - print_err("pThCtx allocation error\n"); - return XRAN_STATUS_FAIL; -@@ -2629,7 +2649,7 @@ xran_spawn_workers(void) - eth_ctx->pkt_wrk_cfg[pThCtx->worker_id].arg = pThCtx; - - /** 4 UP GEN **/ -- pThCtx = (struct xran_worker_th_ctx*) _mm_malloc(sizeof(struct xran_worker_th_ctx), 64); -+ pThCtx = (struct xran_worker_th_ctx *)mm_allocate_handle(sizeof(struct xran_worker_th_ctx), 64); - if(pThCtx == NULL){ - print_err("pThCtx allocation error\n"); - return XRAN_STATUS_FAIL; -@@ -2651,7 +2671,7 @@ xran_spawn_workers(void) - - /* workers */ - /** 0 Eth RX */ -- pThCtx = (struct xran_worker_th_ctx*) _mm_malloc(sizeof(struct xran_worker_th_ctx), 64); -+ pThCtx = (struct xran_worker_th_ctx *)mm_allocate_handle(sizeof(struct xran_worker_th_ctx), 64); - if(pThCtx == NULL){ - print_err("pThCtx allocation error\n"); - return XRAN_STATUS_FAIL; -@@ -2666,7 +2686,7 @@ xran_spawn_workers(void) - eth_ctx->pkt_wrk_cfg[pThCtx->worker_id].arg = pThCtx; - - /** 1 FH RX and BBDEV */ -- pThCtx = (struct xran_worker_th_ctx*) _mm_malloc(sizeof(struct xran_worker_th_ctx), 64); -+ pThCtx = (struct xran_worker_th_ctx *)mm_allocate_handle(sizeof(struct xran_worker_th_ctx), 64); - if(pThCtx == NULL){ - print_err("pThCtx allocation error\n"); - return XRAN_STATUS_FAIL; -@@ -2681,7 +2701,7 @@ xran_spawn_workers(void) - eth_ctx->pkt_wrk_cfg[pThCtx->worker_id].arg = pThCtx; - - /** 2 FH RX and BBDEV */ -- pThCtx = (struct xran_worker_th_ctx*) _mm_malloc(sizeof(struct xran_worker_th_ctx), 64); -+ pThCtx = (struct xran_worker_th_ctx *)mm_allocate_handle(sizeof(struct xran_worker_th_ctx), 64); - if(pThCtx == NULL){ - print_err("pThCtx allocation error\n"); - return XRAN_STATUS_FAIL; -@@ -2696,7 +2716,7 @@ xran_spawn_workers(void) - eth_ctx->pkt_wrk_cfg[pThCtx->worker_id].arg = pThCtx; - - /** 3 FH RX and BBDEV */ -- pThCtx = (struct xran_worker_th_ctx*) _mm_malloc(sizeof(struct xran_worker_th_ctx), 64); -+ pThCtx = (struct xran_worker_th_ctx *)mm_allocate_handle(sizeof(struct xran_worker_th_ctx), 64); - if(pThCtx == NULL){ - print_err("pThCtx allocation error\n"); - return XRAN_STATUS_FAIL; -@@ -2711,7 +2731,7 @@ xran_spawn_workers(void) - eth_ctx->pkt_wrk_cfg[pThCtx->worker_id].arg = pThCtx; - - /** FH TX and BBDEV */ -- pThCtx = (struct xran_worker_th_ctx*) _mm_malloc(sizeof(struct xran_worker_th_ctx), 64); -+ pThCtx = (struct xran_worker_th_ctx *)mm_allocate_handle(sizeof(struct xran_worker_th_ctx), 64); - if(pThCtx == NULL){ - print_err("pThCtx allocation error\n"); - return XRAN_STATUS_FAIL; -@@ -3074,6 +3094,24 @@ xran_get_slot_idx (uint32_t PortId, uint32_t *nFrameIdx, uint32_t *nSubframeIdx, - return tti; - } - -+int32_t -+xran_get_slot_idx_from_tti (uint32_t tti, uint32_t *nFrameIdx, uint32_t *nSubframeIdx, uint32_t *nSlotIdx, uint64_t *nSecond) -+{ -+ struct xran_device_ctx * p_xran_dev_ctx = xran_dev_get_ctx_by_id(0); -+ if (!p_xran_dev_ctx) -+ { -+ print_err("Null xRAN context on port id %u!!\n", 0); -+ return 0; -+ } -+ -+ *nSlotIdx = (uint32_t)XranGetSlotNum(tti, SLOTNUM_PER_SUBFRAME(p_xran_dev_ctx->interval_us_local)); -+ *nSubframeIdx = (uint32_t)XranGetSubFrameNum(tti,SLOTNUM_PER_SUBFRAME(p_xran_dev_ctx->interval_us_local), SUBFRAMES_PER_SYSTEMFRAME); -+ *nFrameIdx = (uint32_t)XranGetFrameNum(tti,0/*xran_getSfnSecStart()*/,SUBFRAMES_PER_SYSTEMFRAME, SLOTNUM_PER_SUBFRAME(p_xran_dev_ctx->interval_us_local)); -+ *nSecond = timing_get_current_second(); -+ -+ return tti; -+} -+ - int32_t - xran_set_debug_stop(int32_t value, int32_t count) - { -diff --git a/fhi_lib/lib/src/xran_mem_mgr.c b/fhi_lib/lib/src/xran_mem_mgr.c -index 3e401e6..566490d 100644 ---- a/fhi_lib/lib/src/xran_mem_mgr.c -+++ b/fhi_lib/lib/src/xran_mem_mgr.c -@@ -35,7 +35,11 @@ - #include - #include - #include -+#if defined(__arm__) || defined(__aarch64__) -+#include -+#else - #include -+#endif - - #include - #include -diff --git a/fhi_lib/lib/src/xran_mod_compression.cpp b/fhi_lib/lib/src/xran_mod_compression.cpp -index 7d4a5d0..87bdbd5 100644 ---- a/fhi_lib/lib/src/xran_mod_compression.cpp -+++ b/fhi_lib/lib/src/xran_mod_compression.cpp -@@ -747,10 +747,11 @@ int xranlib_5gnr_mod_compression(const struct xranlib_5gnr_mod_compression_reque - #ifdef C_Module_Used - return (xranlib_5gnr_mod_compression_c(request, response)); - #else -- if(_may_i_use_cpu_feature(_FEATURE_AVX512IFMA52)) -+ if (false) { - return (xranlib_5gnr_mod_compression_snc(request, response)); -- else -+ } else { - return (xranlib_5gnr_mod_compression_avx512(request, response)); -+ } - #endif - } - -diff --git a/fhi_lib/lib/src/xran_rx_proc.c b/fhi_lib/lib/src/xran_rx_proc.c -index 36bd72c..4d57898 100644 ---- a/fhi_lib/lib/src/xran_rx_proc.c -+++ b/fhi_lib/lib/src/xran_rx_proc.c -@@ -35,7 +35,11 @@ - #include - #include - #include -+#if defined(__arm__) || defined(__aarch64__) -+#include -+#else - #include -+#endif - - #include - #include -@@ -107,6 +111,10 @@ int xran_process_prach_sym(void *arg, - if(mb) - rte_pktmbuf_free(mb); - -+ mb = p_xran_dev_ctx->sFHPrachRxBbuIoBufCtrlDecomp[tti % XRAN_N_FE_BUF_LEN][CC_ID][Ant_ID].sBufferList.pBuffers[symb_id_offset].pCtrl; -+ if(mb) -+ rte_pktmbuf_free(mb); -+ - if(p_xran_dev_ctx->fh_cfg.ru_conf.byteOrder == XRAN_CPU_LE_BYTE_ORDER) { - int idx = 0; - uint16_t *psrc = (uint16_t *)iq_data_start; -diff --git a/fhi_lib/lib/src/xran_timer.c b/fhi_lib/lib/src/xran_timer.c -index b13101a..6d46298 100644 ---- a/fhi_lib/lib/src/xran_timer.c -+++ b/fhi_lib/lib/src/xran_timer.c -@@ -29,7 +29,11 @@ - #include - #include - #include -+#if defined(__arm__) || defined(__aarch64__) -+#include -+#else - #include -+#endif - #include "xran_timer.h" - #include "xran_printf.h" - #include "xran_mlog_lnx.h" -@@ -141,12 +145,30 @@ void timing_adjust_gps_second(struct timespec* p_time) - - return; - } -+#if defined(__x86_64__) - uint64_t xran_tick(void) - { - uint32_t hi, lo; - __asm volatile ("rdtsc" : "=a"(lo), "=d"(hi)); - return ( (uint64_t)lo)|( ((uint64_t)hi)<<32 ); - } -+#elif defined(__aarch64__) -+#include -+uint64_t xran_tick(void) { -+ struct timeval tv; -+ gettimeofday(&tv, NULL); -+ return (uint64_t)tv.tv_sec * 1000000 + tv.tv_usec; -+} -+#elif defined(__arm__) -+#include -+uint64_t xran_tick(void) { -+ struct timespec ts; -+ clock_gettime(CLOCK_MONOTONIC, &ts); -+ return (uint64_t)ts.tv_sec * 1000000000LL + ts.tv_nsec; -+} -+#else -+#error "Unsupported architecture" -+#endif - - unsigned long get_ticks_diff(unsigned long curr_tick, unsigned long last_tick) - { -diff --git a/fhi_lib/lib/src/xran_transport.c b/fhi_lib/lib/src/xran_transport.c -index 881f6f6..dbea6a8 100644 ---- a/fhi_lib/lib/src/xran_transport.c -+++ b/fhi_lib/lib/src/xran_transport.c -@@ -27,7 +27,10 @@ - - #include - #include -+#if defined(__arm__) || defined(__aarch64__) -+#else - #include -+#endif - #include - #include - -diff --git a/fhi_lib/lib/src/xran_tx_proc.c b/fhi_lib/lib/src/xran_tx_proc.c -index 3cfb2be..eb02195 100644 ---- a/fhi_lib/lib/src/xran_tx_proc.c -+++ b/fhi_lib/lib/src/xran_tx_proc.c -@@ -35,7 +35,11 @@ - #include - #include - #include -+#if defined(__arm__) || defined(__aarch64__) -+#include -+#else - #include -+#endif - - #include - #include -diff --git a/fhi_lib/lib/src/xran_up_api.c b/fhi_lib/lib/src/xran_up_api.c -index 397853a..14266de 100644 ---- a/fhi_lib/lib/src/xran_up_api.c -+++ b/fhi_lib/lib/src/xran_up_api.c -@@ -25,7 +25,10 @@ - * - **/ - #include -+#if defined(__arm__) || defined(__aarch64__) -+#else - #include -+#endif - #include - - #include "xran_fh_o_du.h" -@@ -329,6 +332,7 @@ int32_t xran_extract_iq_samples(struct rte_mbuf *mbuf, - uint8_t *subframe_id, - uint8_t *slot_id, - uint8_t *symb_id, -+ uint8_t *filter_id, - union ecpri_seq_id *seq_id, - uint16_t *num_prbu, - uint16_t *start_prbu, -@@ -338,7 +342,8 @@ int32_t xran_extract_iq_samples(struct rte_mbuf *mbuf, - int8_t expect_comp, - enum xran_comp_hdr_type staticComp, - uint8_t *compMeth, -- uint8_t *iqWidth) -+ uint8_t *iqWidth, -+ uint8_t *is_prach) - { - #if XRAN_MLOG_VAR - uint32_t mlogVar[10]; -@@ -374,6 +379,8 @@ int32_t xran_extract_iq_samples(struct rte_mbuf *mbuf, - return 0; /* packet too short */ - - radio_hdr->sf_slot_sym.value = rte_be_to_cpu_16(radio_hdr->sf_slot_sym.value); -+ if (radio_hdr->data_feature.filter_id > 0) *is_prach = 1; -+ else *is_prach = 0; - - if (frame_id) - *frame_id = radio_hdr->frame_id; -@@ -387,6 +394,8 @@ int32_t xran_extract_iq_samples(struct rte_mbuf *mbuf, - if (symb_id) - *symb_id = radio_hdr->sf_slot_sym.symb_id; - -+ if (filter_id) -+ *filter_id = radio_hdr->data_feature.filter_id; - /* Process data section hdr */ - struct data_section_hdr *data_hdr = - (void *)rte_pktmbuf_adj(mbuf, sizeof(*radio_hdr)); -@@ -401,6 +410,7 @@ int32_t xran_extract_iq_samples(struct rte_mbuf *mbuf, - *sym_inc = data_hdr->fields.sym_inc; - *rb = data_hdr->fields.rb; - *sect_id = data_hdr->fields.sect_id; -+ if (*num_prbu == 0) *num_prbu=273; - - if(expect_comp) { - const struct data_section_compression_hdr *data_compr_hdr; diff --git a/doc/ORAN_FHI7.2_Tutorial.md b/doc/ORAN_FHI7.2_Tutorial.md index b02f2973a6..c90f9c72a5 100644 --- a/doc/ORAN_FHI7.2_Tutorial.md +++ b/doc/ORAN_FHI7.2_Tutorial.md @@ -69,11 +69,10 @@ Tested libxran releases: | Vendor | |-----------------------------------------| -| `oran_e_maintenance_release_v1.0` | | `oran_f_release_v1.0` | -**Note**: The libxran driver of OAI identifies the above E release version as "5.1.0" (E is fifth letter, then 1.0), and the above F release as "6.1.0". +**Note**: The libxran driver of OAI identifies the above F release version as "6.1.0" (F is the sixth letter, then 1.0). ### Configure your server @@ -375,14 +374,6 @@ cd ~/openairinterface5g/ Download ORAN FHI DU library, checkout the correct version, and apply the correct patch (available in `oai_folder/cmake_targets/tools/oran_fhi_integration_patches`). -#### E release -```bash -git clone https://gerrit.o-ran-sc.org/r/o-du/phy.git ~/phy -cd ~/phy -git checkout oran_e_maintenance_release_v1.0 -git apply ~/openairinterface5g/cmake_targets/tools/oran_fhi_integration_patches/E/oaioran_E.patch -``` - #### F release ```bash git clone https://gerrit.o-ran-sc.org/r/o-du/phy.git ~/phy @@ -404,7 +395,6 @@ This feature is intended to enable experiments and future improvements on Arm sy ```bash cd ~/phy/fhi_lib/lib make clean -RTE_SDK=~/dpdk-stable-20.11.9/ XRAN_DIR=~/phy/fhi_lib make XRAN_LIB_SO=1 # E release WIRELESS_SDK_TOOLCHAIN=gcc RTE_SDK=~/dpdk-stable-20.11.9/ XRAN_DIR=~/phy/fhi_lib make XRAN_LIB_SO=1 # F release ... [AR] build/libxran.so @@ -967,7 +957,7 @@ Sample configuration files for OAI gNB, specific to the manufacturer of the radi 4. Benetel 550 RU: [`gnb.sa.band78.273prb.fhi72.4x4-benetel550.conf`](../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.273prb.fhi72.4x4-benetel550.conf) [`gnb.sa.band78.273prb.fhi72.4x2-benetel550.conf`](../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.273prb.fhi72.4x2-benetel550.conf) -[`gnb.sa.band78.273prb.fhi72.2x2-benetel550-16b.conf`](../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.273prb.fhi72.2x2-benetel550-16b.conf) - only with E release; with F, UL U-plane fragmentation is not correct +[`gnb.sa.band78.273prb.fhi72.2x2-benetel550-16b.conf`](../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.273prb.fhi72.2x2-benetel550-16b.conf) - tested successfully with E release; with F, UL U-plane fragmentation is not correct 5. Metanoia RU: [`gnb.sa.band78.273prb.fhi72.4x4-metanoia.conf`](../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.273prb.fhi72.4x4-metanoia.conf) diff --git a/radio/fhi_72/CMakeLists.txt b/radio/fhi_72/CMakeLists.txt index e7e87560f9..0fb5605662 100644 --- a/radio/fhi_72/CMakeLists.txt +++ b/radio/fhi_72/CMakeLists.txt @@ -16,16 +16,15 @@ add_library(oran_fhlib_5g MODULE oran-init.c ) -set(E_VERSION 5.1.6) set(F_VERSION 6.1.8) find_package(xran REQUIRED) -if(xran_VERSION VERSION_EQUAL E_VERSION) - target_compile_definitions(oran_fhlib_5g PRIVATE E_RELEASE) +if(xran_VERSION MATCHES "5.*") + message(FATAL_ERROR "xran E release not supported starting from tag 2026.w08.\nPlease switch to F version ${F_VERSION}") elseif(xran_VERSION VERSION_EQUAL F_VERSION) target_compile_definitions(oran_fhlib_5g PRIVATE F_RELEASE) else() - message(FATAL_ERROR "Found xran version ${xran_VERSION} but needed ${E_VERSION} (E release) or ${F_VERSION} (F release)") + message(FATAL_ERROR "Found xran version ${xran_VERSION} but needed ${F_VERSION} (F release)") endif() # Ignore xran-specific warning: we don't care/can't change the following warning, so suppress diff --git a/radio/fhi_72/mplane/CMakeLists.txt b/radio/fhi_72/mplane/CMakeLists.txt index 26bbb7939e..3a4af9afae 100644 --- a/radio/fhi_72/mplane/CMakeLists.txt +++ b/radio/fhi_72/mplane/CMakeLists.txt @@ -6,8 +6,8 @@ add_library(oran_fhlib_5g_mplane MODULE ) add_dependencies(oran_fhlib_5g_mplane oran_fhlib_5g) -if(xran_VERSION VERSION_EQUAL E_VERSION) - target_compile_definitions(oran_fhlib_5g_mplane PRIVATE E_RELEASE) +if(xran_VERSION MATCHES "5.*") + message(FATAL_ERROR "xran E release not supported starting from tag 2026.w08.\nPlease switch to F version ${F_VERSION}") elseif(xran_VERSION VERSION_EQUAL F_VERSION) target_compile_definitions(oran_fhlib_5g_mplane PRIVATE F_RELEASE) endif() diff --git a/radio/fhi_72/oaioran.c b/radio/fhi_72/oaioran.c index 0b5eb0e3a2..de14b775e2 100644 --- a/radio/fhi_72/oaioran.c +++ b/radio/fhi_72/oaioran.c @@ -415,22 +415,7 @@ int xran_fh_rx_read_slot(ru_info_t *ru, int *frame, int *slot) uint8_t *pData; struct xran_section_desc *p_sec_desc = NULL; struct xran_prb_elm *pRbElm = &pRbMap->prbMap[idxElm]; -#ifdef E_RELEASE - uint32_t one_rb_size = - (((pRbElm->iqWidth == 0) || (pRbElm->iqWidth == 16)) ? (N_SC_PER_PRB * 2 * 2) : (3 * pRbElm->iqWidth + 1)); - if (fh_init->mtu < num_totalRB * one_rb_size) - pData = bufs->dst[ant_id % nb_rx_per_ru][tti % XRAN_N_FE_BUF_LEN] - .pBuffers[sym_idx % XRAN_NUM_OF_SYMBOL_PER_SLOT] - .pData; - else { - p_sec_desc = pRbElm->p_sec_desc[sym_idx][0]; - pData = p_sec_desc->pData; - } - numRB = num_totalRB; - startRB = start_totalRB; - { - { -#elif defined F_RELEASE +#if defined F_RELEASE // UP_nRBSize & UP_nRBStart are for DL U-plane only LOG_D(HW, "[%d.%d] idxElm[%d] startSym[%d]:numSym[%d] UP_startRB[%d]:UP_numRB[%d] sym_idx[%d] ant_id[%d] pRbElm->nRBStart[%d]:pRbElm->nRBSize[%d]\n", *frame, *slot, idxElm, pRbElm->nStartSymb, pRbElm->numSymb, pRbElm->UP_nRBStart, pRbElm->UP_nRBSize, sym_idx, ant_id, pRbElm->nRBStart, pRbElm->nRBSize); for (int idxDesc = 0; idxDesc < XRAN_MAX_FRAGMENT; idxDesc++) { @@ -578,10 +563,7 @@ int xran_fh_tx_send_slot(ru_info_t *ru, int frame, int slot, uint64_t timestamp) for (uint32_t idxElm = 0; idxElm < pPrbMap->nPrbElm; idxElm++) { struct xran_prb_elm *pRbElm = &pPrbMap->prbMap[idxElm]; int numRB, startRB; -#ifdef E_RELEASE - numRB = pRbElm->nRBSize; - startRB = pRbElm->nRBStart; -#elif F_RELEASE +#if defined F_RELEASE numRB = pRbElm->UP_nRBSize; startRB = pRbElm->UP_nRBStart; #endif @@ -662,15 +644,11 @@ int xran_fh_tx_send_slot(ru_info_t *ru, int frame, int slot, uint64_t timestamp) p_prbMapElm->nBeamIndex = 0; } - // radio-transport fragmentation is not supported in both E and F releases; + // radio-transport fragmentation is not supported in xran F release; // E-bit = 1 => each ethernet frame is considered as the last fragment; // a group of PRBs per each symbol is encapsulated in one ethernet frame. // => seems that the RUs don't check for E-bit -#ifdef E_RELEASE - p_sec_desc = p_prbMapElm->p_sec_desc[sym_idx][0]; - int16_t startRB = p_prbMapElm->nRBStart; - int16_t numRB = p_prbMapElm->nRBSize; -#elif F_RELEASE +#if defined F_RELEASE p_sec_desc = &p_prbMapElm->sec_desc[sym_idx][0]; int16_t startRB = p_prbMapElm->UP_nRBStart; int16_t numRB = p_prbMapElm->UP_nRBSize; diff --git a/radio/fhi_72/oran-config.c b/radio/fhi_72/oran-config.c index 89fd2e56db..356d57c916 100644 --- a/radio/fhi_72/oran-config.c +++ b/radio/fhi_72/oran-config.c @@ -512,9 +512,6 @@ static bool set_fh_io_cfg(struct xran_io_cfg *io_cfg, const paramdef_t *fhip, in } else { io_cfg->bbdev_mode = XRAN_BBDEV_NOT_USED; // DPDK for BBDev } -#elif defined(E_RELEASE) - io_cfg->bbdev_dev[0] = NULL; // BBDev dev name; max devices = 1 - io_cfg->bbdev_mode = XRAN_BBDEV_NOT_USED; // DPDK for BBDev #endif int dpdk_iova_mode_idx = config_paramidx_fromname((paramdef_t *)fhip, nump, ORAN_CONFIG_DPDK_IOVA_MODE); AssertFatal(dpdk_iova_mode_idx >= 0,"Index for dpdk_iova_mode config option not found!"); diff --git a/radio/fhi_72/oran-init.c b/radio/fhi_72/oran-init.c index 4de6d00f20..3f05672bda 100644 --- a/radio/fhi_72/oran-init.c +++ b/radio/fhi_72/oran-init.c @@ -208,17 +208,6 @@ static void oran_allocate_cplane_buffers(void *instHandle, { xran_status_t status; uint32_t count1 = 0; - -#ifdef E_RELEASE - uint32_t count2 = 0; - uint32_t poolSec; - uint32_t numBufsSec = next_power_2(XRAN_N_FE_BUF_LEN * ant * XRAN_NUM_OF_SYMBOL_PER_SLOT * sect * XRAN_MAX_FRAGMENT); - uint32_t bufSizeSec = sizeof(struct xran_section_desc); - status = xran_bm_init(instHandle, &poolSec, numBufsSec, bufSizeSec); - AssertFatal(XRAN_STATUS_SUCCESS == status, "Failed at xran_bm_init(), status %d\n", status); - printf("xran_bm_init() hInstance %p poolIdx %u elements %u size %u\n", instHandle, poolSec, numBufsSec, bufSizeSec); -#endif - uint32_t poolPrb; uint32_t numBufsPrb = next_power_2(XRAN_N_FE_BUF_LEN * ant * XRAN_NUM_OF_SYMBOL_PER_SLOT) - 1; uint32_t bufSizePrb = size_of_prb_map; @@ -247,34 +236,7 @@ static void oran_allocate_cplane_buffers(void *instHandle, // get mixed slot map if in TDD and in mixed slot if (prb_conf->nTddPeriod != 0 && (j % prb_conf->nTddPeriod) == prb_conf->mixed_slot_index) src = &prb_conf->mixedSlotMap; -#ifdef E_RELEASE - /* as per E release sample app, the memory is copied up to size_of_prb_map - which translates to >= sizeof(struct xran_prb_map) + sizeof(struct xran_prb_elm)*5, - but we assume that RB allocation is done as 1 RE/UE so the total memory size is sizeof(struct xran_prb_map); - this is improved in F release */ - struct xran_prb_map *p_rb_map = (struct xran_prb_map *)ptr; - memcpy(p_rb_map, src, sizeof(*src)); - - for (uint32_t elm_id = 0; elm_id < p_rb_map->nPrbElm; ++elm_id) { - struct xran_prb_elm *pPrbElem = &p_rb_map->prbMap[elm_id]; - for (uint32_t k = 0; k < XRAN_NUM_OF_SYMBOL_PER_SLOT; ++k) { - for (uint32_t m = 0; m < XRAN_MAX_FRAGMENT; ++m) { - void *sd_ptr; - void *sd_mb; - status = xran_bm_allocate_buffer(instHandle, poolSec, &sd_ptr, &sd_mb); - AssertFatal(XRAN_STATUS_SUCCESS == status, - "Failed at xran_bm_allocate_buffer(), status %d m %d k %d elm_id %d\n", - status, - m, - k, - elm_id); - count2++; - pPrbElem->p_sec_desc[k][m] = sd_ptr; - memset(sd_ptr, 0, sizeof(struct xran_section_desc)); - } - } - } -#elif defined F_RELEASE +#if defined F_RELEASE if (fh_config->RunSlotPrbMapBySymbolEnable) { xran_init_PrbMap_by_symbol_from_cfg(src, ptr, mtu, fh_config->nDLRBs); } else { @@ -284,9 +246,6 @@ static void oran_allocate_cplane_buffers(void *instHandle, } } printf("xran_bm_allocate_buffer() hInstance %p poolIdx %u count %u\n", instHandle, poolPrb, count1); -#ifdef E_RELEASE - printf("xran_bm_allocate_buffer() hInstance %p poolIdx %u count %u\n", instHandle, poolSec, count2); -#endif } /* callback not actively used */ @@ -355,9 +314,7 @@ static void oran_allocate_buffers(void *handle, .mixedSlotMap = ulPmMixed, }; -#ifdef E_RELEASE - uint32_t size_of_prb_map = sizeof(struct xran_prb_map) + sizeof(struct xran_prb_elm) * (xran_max_sections_per_slot - 1); -#elif defined F_RELEASE +#if defined F_RELEASE uint32_t size_of_prb_map; if (fh_config->RunSlotPrbMapBySymbolEnable) { // For Liteon FR2 with RunSlotPrbMapBySymbolEnable, xran_prb_map will have xran_prb_elm prbMap[14] @@ -462,10 +419,7 @@ int *oai_oran_initialize(struct xran_fh_init *xran_fh_init, struct xran_fh_confi struct xran_cb_tag tag = {.cellId = sector, .oXuId = o_xu_id}; pi->prach_tag = tag; pi->pusch_tag = tag; -#ifdef E_RELEASE - LOG_W(HW, "Please be aware that E release support will be removed in the future. Consider switching to F release.\n"); - oran_allocate_buffers(gxran_handle, o_xu_id, 1, pi, &xran_fh_config[o_xu_id]); -#elif defined F_RELEASE +#if defined F_RELEASE oran_allocate_buffers(gxran_handle, o_xu_id, 1, pi, xran_fh_init->mtu, &xran_fh_config[o_xu_id]); #endif From 5a339d66f28bb3985664cb9893bf9b48d0414791 Mon Sep 17 00:00:00 2001 From: Teodora Date: Tue, 17 Feb 2026 10:09:23 +0100 Subject: [PATCH 37/37] Use the same pattern for checking the existance of F_RELEASE definition In general, `#ifdef` and `#if defined` are the same. Note: `#elif` is not the same as `#elif defined`. --- radio/fhi_72/oaioran.c | 4 ++-- radio/fhi_72/oran-config.c | 24 ++++++++++++------------ radio/fhi_72/oran-init.c | 8 ++++---- radio/fhi_72/oran_isolate.c | 4 ++-- radio/fhi_72/oran_isolate.h | 4 ++-- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/radio/fhi_72/oaioran.c b/radio/fhi_72/oaioran.c index de14b775e2..047c216898 100644 --- a/radio/fhi_72/oaioran.c +++ b/radio/fhi_72/oaioran.c @@ -94,7 +94,7 @@ void oai_xran_fh_rx_callback(void *pCallbackTag, xran_status_t status) LOG_D(HW, "rx_callback at %4d.%3d (subframe %d), rx_sym %d ru_id %d\n", frame, slot, subframe, rx_sym, ru_id); if (rx_sym == 7) { // in F release this value is defined as XRAN_FULL_CB_SYM (full slot (offset + 7)) -#ifdef F_RELEASE +#if defined F_RELEASE for (int ru_idx = 0; ru_idx < num_ports; ru_idx++) { struct xran_fh_config *fh_config = get_xran_fh_config(ru_idx); oran_buf_list_t *bufs = get_xran_buffers(ru_idx); @@ -722,7 +722,7 @@ int xran_fh_tx_send_slot(ru_info_t *ru, int frame, int slot, uint64_t timestamp) return (0); } -#ifdef F_RELEASE +#if defined F_RELEASE /** @details Read PRACH and PUSCH data from xran buffers. If * I/Q compression (bitwidth < 16 bits) is configured, deccompresses the data * before writing. Prints ON TIME counters every 128 frames. diff --git a/radio/fhi_72/oran-config.c b/radio/fhi_72/oran-config.c index 356d57c916..6f8afc092f 100644 --- a/radio/fhi_72/oran-config.c +++ b/radio/fhi_72/oran-config.c @@ -124,7 +124,7 @@ static void print_fh_init_io_cfg(const struct xran_io_cfg *io_cfg) io_cfg->one_vf_cu_plane); print_fh_eowd_cmn(io_cfg->id, &io_cfg->eowd_cmn[io_cfg->id]); printf("eowd_port (filled within xran library)\n"); -#ifdef F_RELEASE +#if defined F_RELEASE printf("\ bbu_offload %d\n", io_cfg->bbu_offload); @@ -189,7 +189,7 @@ void print_fh_init(const struct xran_fh_init *fh_init) printf("\ totalBfWeights %d\n", fh_init->totalBfWeights); -#ifdef F_RELEASE +#if defined F_RELEASE printf("\ mlogxranenable %d\n\ dlCpProcBurst %d\n", @@ -232,7 +232,7 @@ static void print_prach_config(const struct xran_prach_config *prach_conf) prach_conf->timeOffset, prach_conf->freqOffset, prach_conf->eAxC_offset); -#ifdef F_RELEASE +#if defined F_RELEASE printf("\ nPrachConfIdxLTE %d\n", prach_conf->nPrachConfIdxLTE); @@ -396,7 +396,7 @@ void print_fh_config(const struct xran_fh_config *fh_config) fh_config->GPS_Alpha, fh_config->GPS_Beta); -#ifdef F_RELEASE +#if defined F_RELEASE printf("\ srsEnableCp %d\n\ SrsDelaySym %d\n", @@ -429,7 +429,7 @@ void print_fh_config(const struct xran_fh_config *fh_config) fh_config->max_sections_per_slot, fh_config->max_sections_per_symbol); -#ifdef F_RELEASE +#if defined F_RELEASE printf("\ RunSlotPrbMapBySymbolEnable %d\n\ LiteOnIgnoreUPSectionIdEnable %d\n\ @@ -456,7 +456,7 @@ static uint64_t get_u64_mask(const paramdef_t *pd) return mask; } -#ifdef F_RELEASE +#if defined F_RELEASE char bbdev_dev[32] = ""; char bbdev_vfio_vf_token[64] = ""; #endif @@ -478,7 +478,7 @@ static bool set_fh_io_cfg(struct xran_io_cfg *io_cfg, const paramdef_t *fhip, in for (int i = 0; i < num_dev; ++i) { io_cfg->dpdk_dev[i] = strdup(gpd(fhip, nump, ORAN_CONFIG_DPDK_DEVICES)->strlistptr[i]); // VFs devices } -#ifdef F_RELEASE +#if defined F_RELEASE io_cfg->bbdev_dev[0] = NULL; // BBDev dev name; max devices = 1 io_cfg->bbdev_vfio_vf_token[0] = NULL; // BBDev dev token; max devices = 1 char *shlibversion = NULL; // version of the LDPC coding library @@ -556,7 +556,7 @@ static bool set_fh_io_cfg(struct xran_io_cfg *io_cfg, const paramdef_t *fhip, in /* eCPRI OWDM per port variables for O-DU; this parameter is filled within xran library */ // eowd_port[0][XRAN_VF_MAX] -#ifdef F_RELEASE +#if defined F_RELEASE io_cfg->bbu_offload = 0; // enable packet handling on BBU cores #endif @@ -756,7 +756,7 @@ static bool set_fh_init(void *mplane_api, struct xran_fh_init *fh_init, enum xra fh_init->filePrefix = strdup(*gpd(fhip, nump, ORAN_CONFIG_FILE_PREFIX)->strptr); fh_init->totalBfWeights = 0; // only used if id = O_RU (for emulation); C-plane extension types; section 5.4.6 of CUS spec -#ifdef F_RELEASE +#if defined F_RELEASE fh_init->mlogxranenable = 0; // enable mlog; 0 -> disabled fh_init->dlCpProcBurst = 0; /* 1 -> DL CP processing will be done on single symbol, 0 -> DL CP processing will be spread across all allowed symbols and multiple cores to reduce burstiness */ @@ -801,7 +801,7 @@ static bool set_fh_prach_config(void *mplane_api, prach_config->numPrbc = 0; prach_config->timeOffset = 0; prach_config->freqOffset = 0; -#ifdef F_RELEASE +#if defined F_RELEASE prach_config->nPrachConfIdxLTE = 0; // used only if DSS enabled and technology is XRAN_RAN_LTE #endif @@ -966,7 +966,7 @@ static bool set_fh_config(void *mplane_api, int ru_idx, int num_rus, enum xran_c fh_config->srsEnable = 0; // enable SRS; used only if XRAN_CATEGORY_B // For LiteOn E release, no need to take care of prach eAxC_offset. xran lib is hacked to handle it. bool liteon_prach_eAxC_offset = false; -#ifdef F_RELEASE +#if defined F_RELEASE fh_config->srsEnableCp = 0; // enable SRS CP; used only if XRAN_CATEGORY_B fh_config->SrsDelaySym = 0; // number of SRS delay symbols; used only if XRAN_CATEGORY_B fh_config->RunSlotPrbMapBySymbolEnable = *gpd(fhp, nfh, ORAN_CONFIG_RunSlotPrbMapBySymbol)->uptr; // enable RunSlotPrbMapBySymbol @@ -1014,7 +1014,7 @@ static bool set_fh_config(void *mplane_api, int ru_idx, int num_rus, enum xran_c fh_config->max_sections_per_slot = 0; // not used in xran fh_config->max_sections_per_symbol = 0; // not used in xran -#ifdef F_RELEASE +#if defined F_RELEASE fh_config->dssEnable = 0; // enable DSS (extension-9) fh_config->dssPeriod = 0; // DSS pattern period for LTE/NR // fh_config->technology[XRAN_MAX_DSS_PERIODICITY] // technology array represents slot is LTE(0)/NR(1); used only if DSS enabled diff --git a/radio/fhi_72/oran-init.c b/radio/fhi_72/oran-init.c index 3f05672bda..00c0e30746 100644 --- a/radio/fhi_72/oran-init.c +++ b/radio/fhi_72/oran-init.c @@ -199,7 +199,7 @@ static void oran_allocate_cplane_buffers(void *instHandle, struct xran_flat_buffer buf[XRAN_MAX_ANTENNA_NR][XRAN_N_FE_BUF_LEN], uint32_t ant, uint32_t sect, - #ifdef F_RELEASE + #if defined F_RELEASE uint32_t mtu, const struct xran_fh_config *fh_config, #endif @@ -258,7 +258,7 @@ static void oran_allocate_buffers(void *handle, int xran_inst, int num_sectors, oran_port_instance_t *portInstances, - #ifdef F_RELEASE + #if defined F_RELEASE uint32_t mtu, #endif const struct xran_fh_config *fh_config) @@ -335,7 +335,7 @@ static void oran_allocate_buffers(void *handle, bl->bufs.tx_prbmap, xran_max_antenna_nr, xran_max_sections_per_slot, - #ifdef F_RELEASE + #if defined F_RELEASE mtu, fh_config, #endif @@ -350,7 +350,7 @@ static void oran_allocate_buffers(void *handle, bl->bufs.rx_prbmap, xran_max_antenna_nr, xran_max_sections_per_slot, - #ifdef F_RELEASE + #if defined F_RELEASE mtu, fh_config, #endif diff --git a/radio/fhi_72/oran_isolate.c b/radio/fhi_72/oran_isolate.c index c9991549b1..0ec4867299 100644 --- a/radio/fhi_72/oran_isolate.c +++ b/radio/fhi_72/oran_isolate.c @@ -229,7 +229,7 @@ void oran_fh_if4p5_south_in(RU_t *ru, int *frame, int *slot) start_meas(&ru->rx_fhaul); struct xran_fh_config *fh_cfg = get_xran_fh_config(0); int ret = 0; -#ifdef F_RELEASE +#if defined F_RELEASE if (fh_cfg->RunSlotPrbMapBySymbolEnable) ret = xran_fh_rx_read_slot_BySymbol(&ru_info, &f, &sl); else @@ -291,7 +291,7 @@ void oran_fh_if4p5_south_out(RU_t *ru, int frame, int slot, uint64_t timestamp) struct xran_fh_config *fh_cfg = get_xran_fh_config(0); int ret = 0; -#ifdef F_RELEASE +#if defined F_RELEASE if (fh_cfg->RunSlotPrbMapBySymbolEnable) ret = xran_fh_tx_send_slot_BySymbol(&ru_info, frame, slot, timestamp); else diff --git a/radio/fhi_72/oran_isolate.h b/radio/fhi_72/oran_isolate.h index dfd315dd29..4f62ff5340 100644 --- a/radio/fhi_72/oran_isolate.h +++ b/radio/fhi_72/oran_isolate.h @@ -60,12 +60,12 @@ typedef struct ru_info_s { * @param frame output of the frame which has been read. * @param slot output of the slot which has been read. */ int xran_fh_rx_read_slot(ru_info_t *ru, int *frame, int *slot); -#ifdef F_RELEASE +#if defined F_RELEASE int xran_fh_rx_read_slot_BySymbol(ru_info_t *ru, int *frame, int *slot); #endif /** @brief Writes TX data (PDSCH) of given slot. */ int xran_fh_tx_send_slot(ru_info_t *ru, int frame, int slot, uint64_t timestamp); -#ifdef F_RELEASE +#if defined F_RELEASE int xran_fh_tx_send_slot_BySymbol(ru_info_t *ru, int frame, int slot, uint64_t timestamp); #endif