From 159f06cbf594b45a90d818f893b5d927b1568924 Mon Sep 17 00:00:00 2001 From: francescomani Date: Wed, 26 Mar 2025 10:39:32 +0100 Subject: [PATCH 1/6] remove unnecessary gNB include in config_ue --- openair2/LAYER2/NR_MAC_UE/config_ue.c | 1 - 1 file changed, 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index 1f0e552ba0..efe6a536e9 100644 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -34,7 +34,6 @@ #define SPEED_OF_LIGHT 299792458 #include "mac_defs.h" -#include #include "NR_MAC_UE/mac_proto.h" #include "NR_MAC-CellGroupConfig.h" #include "LAYER2/NR_MAC_COMMON/nr_mac_common.h" From 2269f1e49324ee21c5af9606a0fc93aaee175da0 Mon Sep 17 00:00:00 2001 From: francescomani Date: Wed, 26 Mar 2025 10:45:15 +0100 Subject: [PATCH 2/6] remove unnecessary gNB include in nr_mac_common --- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c | 31 +++++++++---------- openair2/LAYER2/NR_MAC_gNB/mac_proto.h | 2 -- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index d30c51ecc1..4332d18b90 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -30,7 +30,8 @@ */ -#include "LAYER2/NR_MAC_gNB/mac_proto.h" +#include "nr_mac.h" +#include "nr_mac_common.h" #include "common/utils/nr/nr_common.h" #include #include @@ -2431,6 +2432,19 @@ uint8_t get_pusch_nb_antenna_ports(NR_PUSCH_Config_t *pusch_Config, return n_antenna_port; } +static int binomial(int n, int k) +{ + if (k > n - k) + k = n - k; + int c = 1; + for (int i = 1; i <= k; i++, n--) { + if (c / i > UINT_MAX/n) // return 0 on overflow + return 0; + c = c / i * n + c % i * n / i; + } + return c; +} + // #define DEBUG_SRS_RESOURCE_IND uint8_t compute_srs_resource_indicator(long *maxMIMO_Layers, NR_PUSCH_Config_t *pusch_Config, @@ -3422,21 +3436,6 @@ uint8_t get_pusch_mcs_table(long *mcs_Table, } -int binomial(int n, int k) { - int c = 1, i; - - if (k > n-k) - k = n-k; - - for (i = 1; i <= k; i++, n--) { - if (c/i > UINT_MAX/n) // return 0 on overflow - return 0; - - c = c / i * n + c % i * n / i; - } - return c; -} - /* extract PTRS values from RC and validate it based upon 38.214 5.1.6.3 */ bool set_dl_ptrs_values(NR_PTRS_DownlinkConfig_t *ptrs_config, uint16_t rbSize,uint8_t mcsIndex, uint8_t mcsTable, diff --git a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h index 4ce1f1126c..65c5aba9f1 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_gNB/mac_proto.h @@ -337,8 +337,6 @@ int nr_write_ce_dlsch_pdu(module_id_t module_idP, unsigned char drx_cmd, unsigned char *ue_cont_res_id); -int binomial(int n, int k); - /* \brief Function to indicate a received SDU on ULSCH. @param Mod_id Instance ID of gNB @param CC_id Component carrier index From 38fe30baabe18aa6f453b74be7ed0f053d79335e Mon Sep 17 00:00:00 2001 From: francescomani Date: Wed, 26 Mar 2025 11:30:53 +0100 Subject: [PATCH 3/6] improvements for NFAPI compilation for the UE --- CMakeLists.txt | 4 ++-- nfapi/oai_integration/nfapi_pnf.c | 1 - nfapi/open-nFAPI/pnf/src/pnf.c | 1 - 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8cdc796a5b..842f94b7d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1885,14 +1885,14 @@ add_executable(nr-uesoftmodem ${OPENAIR2_DIR}/LAYER2/NR_MAC_COMMON/nr_mac_common.c ${OPENAIR2_DIR}/LAYER2/NR_MAC_COMMON/nr_mac_common_tdd.c ${OPENAIR1_DIR}/PHY/TOOLS/phy_scope_interface.c + ${NFAPI_USER_DIR}/nfapi.c ${PHY_INTERFACE_DIR}/queue_t.c ) target_link_libraries(nr-uesoftmodem PRIVATE -Wl,--start-group nr_rrc SECURITY UTIL HASHTABLE SCHED_RU_LIB SCHED_NR_UE_LIB - PHY_COMMON PHY_NR_COMMON PHY_NR_UE NR_L2_UE MAC_NR_COMMON NFAPI_LIB NFAPI_PNF_LIB - NFAPI_USER_LIB MISC_NFAPI_NR_LIB + PHY_COMMON PHY_NR_COMMON PHY_NR_UE NR_L2_UE MAC_NR_COMMON NFAPI_LIB ITTI SIMU shlib_loader -Wl,--end-group z dl) diff --git a/nfapi/oai_integration/nfapi_pnf.c b/nfapi/oai_integration/nfapi_pnf.c index 10d635562f..21b3e1e90e 100644 --- a/nfapi/oai_integration/nfapi_pnf.c +++ b/nfapi/oai_integration/nfapi_pnf.c @@ -54,7 +54,6 @@ #include "PHY/INIT/phy_init.h" #include "PHY/INIT/nr_phy_init.h" #include "PHY/LTE_TRANSPORT/transport_proto.h" -#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h" #include "openair1/SCHED_NR/fapi_nr_l1.h" #include "openair1/PHY/NR_TRANSPORT/nr_dlsch.h" #include "openair1/PHY/defs_gNB.h" diff --git a/nfapi/open-nFAPI/pnf/src/pnf.c b/nfapi/open-nFAPI/pnf/src/pnf.c index 3880e53c6c..4cef8e6412 100644 --- a/nfapi/open-nFAPI/pnf/src/pnf.c +++ b/nfapi/open-nFAPI/pnf/src/pnf.c @@ -41,7 +41,6 @@ #include "NR_BCCH-BCH-Message.h" #include "NR_ServingCellConfigCommon.h" -#include "LAYER2/NR_MAC_gNB/mac_proto.h" #include "SCHED_NR/phy_frame_config_nr.h" #include "NR_MIB.h" From 45fffcff7126f8b8de44c811f057edcec14c8b61 Mon Sep 17 00:00:00 2001 From: francescomani Date: Wed, 26 Mar 2025 11:49:03 +0100 Subject: [PATCH 4/6] remove include mac_proto in f1ap file --- openair2/F1AP/f1ap_du_rrc_message_transfer.c | 1 - 1 file changed, 1 deletion(-) diff --git a/openair2/F1AP/f1ap_du_rrc_message_transfer.c b/openair2/F1AP/f1ap_du_rrc_message_transfer.c index 7fd83ecd78..4b9b9e1947 100644 --- a/openair2/F1AP/f1ap_du_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_du_rrc_message_transfer.c @@ -49,7 +49,6 @@ #include "openair2/RRC/NR/rrc_gNB_UE_context.h" #include "asn1_msg.h" #include "intertask_interface.h" -#include "LAYER2/NR_MAC_gNB/mac_proto.h" #include "openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.h" From c1d02c13b732767bb33dd35731e29c7a4246e720 Mon Sep 17 00:00:00 2001 From: francescomani Date: Wed, 26 Mar 2025 15:44:24 +0100 Subject: [PATCH 5/6] remove f1ap from NR_L2_UE --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 842f94b7d3..defe4c6c3b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1351,7 +1351,7 @@ target_link_libraries(L2_UE PRIVATE GTPV1U) target_link_libraries(L2_UE PRIVATE asn1_lte_rrc_hdrs) add_library( NR_L2_UE ${NR_L2_SRC_UE} ${MAC_NR_SRC_UE} ) -target_link_libraries(NR_L2_UE PRIVATE f1ap nr_rlc) +target_link_libraries(NR_L2_UE PRIVATE nr_rlc) target_link_libraries(NR_L2_UE PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs nr_common nr_ue_power_procedures nr_ue_ra_procedures) target_link_libraries(NR_L2_UE PRIVATE nr_nas) From 391998667774546a4e51e041444e4e620623bc0e Mon Sep 17 00:00:00 2001 From: francescomani Date: Wed, 26 Mar 2025 16:10:08 +0100 Subject: [PATCH 6/6] replace L2_NR dependency in f1ap with GTPV1U The above is necessary to not compile as many gNB dependencies into the UE. RLC only uses GTP, which was satisfied by L2_NR, but that's not necessary. However, only that change results in /usr/bin/ld: openair2/E2AP/RAN_FUNCTION/libe2_ran_func_cuup.a(ran_func_rc.c.o): in function `get_list_for_report_style': openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.c:596:(.text+0xbe7): undefined reference to `cp_e2sm_rc_event_trigger' /usr/bin/ld: openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.c:596:(.text+0xc5b): undefined reference to `cp_e2sm_rc_event_trigger' /usr/bin/ld: openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.c:596:(.text+0xd3b): undefined reference to `cp_e2sm_rc_event_trigger' /usr/bin/ld: openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.c:596:(.text+0xd9d): undefined reference to `cp_e2sm_rc_event_trigger' /usr/bin/ld: openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.c:596:(.text+0xded): undefined reference to `cp_e2sm_rc_event_trigger' /usr/bin/ld: openair2/E2AP/RAN_FUNCTION/libe2_ran_func_cuup.a(ran_func_rc.c.o):openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.c:596: more undefined references to `cp_e2sm_rc_event_trigger' follow /usr/bin/ld: openair2/E2AP/RAN_FUNCTION/libe2_ran_func_cuup.a(ran_func_rc_subs.c.o): in function `remove_rc_subs_data': openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc_subs.c:60:(.text+0xbe): undefined reference to `find_if' /usr/bin/ld: openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc_subs.c:62:(.text+0xca): undefined reference to `free_e2sm_rc_event_trigger' nr-cuup previously satisfied these dependencies by depending on L2_NR which links in e2_ran_func_du_cucp_cuup. However, the nr-cuup E2 RAN functions are in e2_ran_func_cuup. In the latter, the file rc_data_ie.c was missing (for cp_e2sm_rc_event_trigger), which in turn needs e2sm_rc_ir_obj. Finally, find_if comes through alg. Co-authored-by: Robert Schmidt --- CMakeLists.txt | 2 +- openair2/E2AP/RAN_FUNCTION/CMakeLists.txt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index defe4c6c3b..5d37670c34 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -450,7 +450,7 @@ add_library(f1ap ${F1AP_DIR}/f1ap_handlers.c ${F1AP_DIR}/f1ap_itti_messaging.c) target_include_directories(f1ap PUBLIC F1AP_DIR) -target_link_libraries(f1ap PUBLIC asn1_f1ap L2_NR) +target_link_libraries(f1ap PUBLIC asn1_f1ap GTPV1U) target_link_libraries(f1ap PRIVATE ngap nr_rrc HASHTABLE f1ap_lib) target_include_directories(f1ap PRIVATE ${F1AP_DIR}/lib) diff --git a/openair2/E2AP/RAN_FUNCTION/CMakeLists.txt b/openair2/E2AP/RAN_FUNCTION/CMakeLists.txt index 578bf489df..27497ae873 100644 --- a/openair2/E2AP/RAN_FUNCTION/CMakeLists.txt +++ b/openair2/E2AP/RAN_FUNCTION/CMakeLists.txt @@ -6,13 +6,14 @@ add_library(e2_ran_func_cuup STATIC O-RAN/ran_func_kpm_subs.c O-RAN/ran_func_rc.c O-RAN/ran_func_rc_subs.c + ../flexric/src/sm/rc_sm/ie/rc_data_ie.c CUSTOMIZED/ran_func_gtp.c # GTP SM not yet implemented in CU-UP CUSTOMIZED/ran_func_pdcp.c CUSTOMIZED/ran_func_tc.c # currently, not implemented; therefore, filling rnd data ../flexric/test/rnd/fill_rnd_data_tc.c ) -target_link_libraries(e2_ran_func_cuup PUBLIC asn1_nr_rrc nr_rrc asn1_nr_rrc_hdrs e2_time_obj kpm_ric_info_common_obj 3gpp_derived_ie_obj sm_common_ie_obj ds) +target_link_libraries(e2_ran_func_cuup PUBLIC asn1_nr_rrc nr_rrc asn1_nr_rrc_hdrs e2_time_obj kpm_ric_info_common_obj 3gpp_derived_ie_obj e2sm_rc_ir_obj sm_common_ie_obj ds alg) target_compile_definitions(e2_ran_func_cuup PUBLIC ${E2AP_VERSION} ${KPM_VERSION} NGRAN_GNB_CUUP)