From 66f044d2d800a4b5d94f0d49485a0cb46997bb01 Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 24 Mar 2025 14:27:56 +0100 Subject: [PATCH 01/57] rlc.h cleanup --- openair2/LAYER2/RLC/rlc.h | 53 --------------------------------------- 1 file changed, 53 deletions(-) diff --git a/openair2/LAYER2/RLC/rlc.h b/openair2/LAYER2/RLC/rlc.h index 39471ebbee..9afad74714 100644 --- a/openair2/LAYER2/RLC/rlc.h +++ b/openair2/LAYER2/RLC/rlc.h @@ -71,38 +71,6 @@ typedef enum rlc_confirm_e { RLC_SDU_CONFIRM_YES = 1, } rlc_confirm_t; -//----------------------------------------------------------------------------- -// PRIVATE INTERNALS OF RLC -//----------------------------------------------------------------------------- - -#define RLC_MAX_MBMS_LC (LTE_maxSessionPerPMCH * LTE_maxServiceCount) -#define RLC_MAX_LC ((max_val_LTE_DRB_Identity+1)* MAX_MOBILES_PER_ENB) - -extern void (*rlc_rrc_data_ind)( - const protocol_ctxt_t *const ctxtP, - const rb_id_t rb_idP, - const sdu_size_t sdu_sizeP, - const uint8_t *const sduP) __attribute__ ((aligned(32))); - -extern void (*rlc_rrc_data_conf)( - const protocol_ctxt_t *const ctxtP, - const rb_id_t rb_idP, - const mui_t muiP, - const rlc_tx_status_t statusP) __attribute__ ((aligned(32))); - -typedef void (rrc_data_ind_cb_t)( - const protocol_ctxt_t *const ctxtP, - const rb_id_t rb_idP, - const sdu_size_t sdu_sizeP, - const uint8_t *const sduP); - -typedef void (rrc_data_conf_cb_t)( - const protocol_ctxt_t *const ctxtP, - const rb_id_t rb_idP, - const mui_t muiP, - const rlc_tx_status_t statusP); - - //----------------------------------------------------------------------------- // PUBLIC INTERFACE WITH RRC //----------------------------------------------------------------------------- @@ -416,25 +384,4 @@ rlc_op_status_t rlc_stat_req ( int rlc_module_init(int enb_flag); /** @} */ -#define RLC_FG_COLOR_BLACK "\e[0;30m" -#define RLC_FG_COLOR_RED "\e[0;31m" -#define RLC_FG_COLOR_GREEN "\e[0;32m" -#define RLC_FG_COLOR_ORANGE "\e[0;33m" -#define RLC_FG_COLOR_BLUE "\e[0;34m" -#define RLC_FG_COLOR_MAGENTA "\e[0;35m" -#define RLC_FG_COLOR_CYAN "\e[0;36m" -#define RLC_FG_COLOR_GRAY_BLACK "\e[0;37m" -#define RLC_FG_COLOR_DEFAULT "\e[0;39m" -#define RLC_FG_BRIGHT_COLOR_DARK_GRAY "\e[1;30m" -#define RLC_FG_BRIGHT_COLOR_RED "\e[1;31m" -#define RLC_FG_BRIGHT_COLOR_GREEN "\e[1;32m" -#define RLC_FG_BRIGHT_COLOR_YELLOW "\e[1;33m" -#define RLC_FG_BRIGHT_COLOR_BLUE "\e[1;34m" -#define RLC_FG_BRIGHT_COLOR_MAGENTA "\e[1;35m" -#define RLC_FG_BRIGHT_COLOR_CYAN "\e[1;36m" -#define RLC_FG_BRIGHT_COLOR_WHITE "\e[1;37m" -#define RLC_FG_BRIGHT_COLOR_DEFAULT "\e[0;39m" -#define RLC_REVERSE_VIDEO "\e[7m" -#define RLC_NORMAL_VIDEO "\e[27m" - #endif From f2d02398fb6a7dd95cb937a8d1320975a49355d1 Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 24 Mar 2025 17:23:15 +0100 Subject: [PATCH 02/57] removing unnecessary dummy rrc_rlc_config_asn1_req --- openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index bffb064159..811aa92aba 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -944,18 +944,6 @@ void nr_rlc_add_drb(int ue_id, int drb_id, const NR_RLC_BearerConfig_t *rlc_Bear LOG_I(RLC, "Added DRB to UE %d\n", ue_id); } -/* Dummy function due to dependency from LTE libraries */ -rlc_op_status_t rrc_rlc_config_asn1_req (const protocol_ctxt_t * const ctxt_pP, - const LTE_SRB_ToAddModList_t * const srb2add_listP, - const LTE_DRB_ToAddModList_t * const drb2add_listP, - const LTE_DRB_ToReleaseList_t * const drb2release_listP, - const LTE_PMCH_InfoList_r9_t * const pmch_InfoList_r9_pP, - const uint32_t sourceL2Id, - const uint32_t destinationL2Id) -{ - return 0; -} - struct srb0_data { int ue_id; void *data; From 4321a2710a9be8486bc35895d9e3be347868ddc6 Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 24 Mar 2025 11:42:12 +0100 Subject: [PATCH 03/57] NR specific mac_rlc_data_ind function --- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 27 ++------------ .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 37 ++----------------- openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c | 27 ++++---------- openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h | 7 ++++ 4 files changed, 21 insertions(+), 77 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index c0cda918d1..8b651d25bd 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -54,7 +54,7 @@ #include "oai_asn1.h" #include "common/utils/LOG/log.h" #include "common/utils/LOG/vcd_signal_dumper.h" -#include "openair2/LAYER2/RLC/rlc.h" +#include "LAYER2/nr_rlc/nr_rlc_oai_api.h" // #define DEBUG_MIB // #define ENABLE_MAC_PAYLOAD_DEBUG 1 @@ -3609,17 +3609,7 @@ void nr_ue_process_mac_pdu(NR_UE_MAC_INST_t *mac, nr_downlink_indication_t *dl_i if (mac_len > 0) { LOG_DDUMP(NR_MAC, (void *)pduP, mac_subheader_len + mac_len, LOG_DUMP_CHAR, "DL_SCH_LCID_CCCH (e.g. RRCSetup) payload: "); - mac_rlc_data_ind(mac->ue_id, - mac->ue_id, - gNB_index, - frameP, - ENB_FLAG_NO, - MBMS_FLAG_NO, - 0, - (char *)(pduP + mac_subheader_len), - mac_len, - 1, - NULL); + nr_mac_rlc_data_ind(mac->ue_id, mac->ue_id, false, rx_lcid, (char *)(pduP + mac_subheader_len), mac_len); } break; case DL_SCH_LCID_TCI_STATE_ACT_UE_SPEC_PDSCH: @@ -3734,18 +3724,7 @@ void nr_ue_process_mac_pdu(NR_UE_MAC_INST_t *mac, nr_downlink_indication_t *dl_i if (!get_mac_len(pduP, pdu_len, &mac_len, &mac_subheader_len)) return; LOG_D(NR_MAC, "%4d.%2d : DLSCH -> LCID %d %d bytes\n", frameP, slot, rx_lcid, mac_len); - - mac_rlc_data_ind(mac->ue_id, - mac->ue_id, - gNB_index, - frameP, - ENB_FLAG_NO, - MBMS_FLAG_NO, - rx_lcid, - (char *)(pduP + mac_subheader_len), - mac_len, - 1, - NULL); + nr_mac_rlc_data_ind(mac->ue_id, mac->ue_id, false, rx_lcid, (char *)(pduP + mac_subheader_len), mac_len); break; default: LOG_W(MAC, "unknown lcid %02x\n", rx_lcid); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index e1a48d6002..b6e86fa6b7 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -35,7 +35,6 @@ #include "utils.h" #include #include "LAYER2/nr_rlc/nr_rlc_oai_api.h" -#include "LAYER2/RLC/rlc.h" //#define SRS_IND_DEBUG @@ -354,17 +353,7 @@ static int nr_process_mac_pdu(instance_t module_idP, } if (prepare_initial_ul_rrc_message(RC.nrmac[module_idP], UE)) { - mac_rlc_data_ind(module_idP, - UE->rnti, - module_idP, - frameP, - ENB_FLAG_YES, - MBMS_FLAG_NO, - 0, - (char *)(pduP + mac_subheader_len), - mac_len, - 1, - NULL); + nr_mac_rlc_data_ind(module_idP, UE->rnti, true, 0, (char *)(pduP + mac_subheader_len), mac_len); } else { LOG_E(NR_MAC, "prepare_initial_ul_rrc_message() returned false, cannot forward CCCH message\n"); } @@ -379,17 +368,7 @@ static int nr_process_mac_pdu(instance_t module_idP, slot, lcid); - mac_rlc_data_ind(module_idP, - UE->rnti, - module_idP, - frameP, - ENB_FLAG_YES, - MBMS_FLAG_NO, - lcid, - (char *)(pduP + mac_subheader_len), - mac_len, - 1, - NULL); + nr_mac_rlc_data_ind(module_idP, UE->rnti, true, lcid, (char *)(pduP + mac_subheader_len), mac_len); UE->mac_stats.ul.total_sdu_bytes += mac_len; UE->mac_stats.ul.lc_bytes[lcid] += mac_len; @@ -407,17 +386,7 @@ static int nr_process_mac_pdu(instance_t module_idP, mac_len); UE->mac_stats.ul.lc_bytes[lcid] += mac_len; - mac_rlc_data_ind(module_idP, - UE->rnti, - module_idP, - frameP, - ENB_FLAG_YES, - MBMS_FLAG_NO, - lcid, - (char *)(pduP + mac_subheader_len), - mac_len, - 1, - NULL); + nr_mac_rlc_data_ind(module_idP, UE->rnti, true, lcid, (char *)(pduP + mac_subheader_len), mac_len); sdus += 1; /* Updated estimated buffer when receiving data */ diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index 811aa92aba..1937646bdf 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -162,26 +162,15 @@ void nr_rlc_release_entity(int ue_id, logical_chan_id_t channel_id) nr_rlc_manager_unlock(nr_rlc_ue_manager); } -void mac_rlc_data_ind(const module_id_t module_idP, - const uint16_t ue_id, - const eNB_index_t eNB_index, - const frame_t frameP, - const eNB_flag_t enb_flagP, - const MBMS_flag_t MBMS_flagP, - const logical_chan_id_t channel_idP, - char *buffer_pP, - const tb_size_t tb_sizeP, - num_tb_t num_tbP, - crc_t *crcs_pP) +void nr_mac_rlc_data_ind(const module_id_t module_idP, + const uint16_t ue_id, + const bool gnb_flagP, + const logical_chan_id_t channel_idP, + char *buffer_pP, + const tb_size_t tb_sizeP) { - if (eNB_index != 0 || /*enb_flagP != 1 ||*/ MBMS_flagP != 0) { - LOG_E(RLC, "%s:%d:%s: fatal\n", __FILE__, __LINE__, __FUNCTION__); - exit(1); - } - - if (enb_flagP) - T(T_ENB_RLC_MAC_UL, T_INT(module_idP), T_INT(ue_id), - T_INT(channel_idP), T_INT(tb_sizeP)); + if (gnb_flagP) + T(T_ENB_RLC_MAC_UL, T_INT(module_idP), T_INT(ue_id), T_INT(channel_idP), T_INT(tb_sizeP)); nr_rlc_manager_lock(nr_rlc_ue_manager); nr_rlc_ue_t *ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, ue_id); diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h index 10182f3793..010852661a 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h @@ -41,6 +41,13 @@ struct NR_RLC_Config; struct NR_LogicalChannelConfig; +void nr_mac_rlc_data_ind(const module_id_t module_idP, + const uint16_t ue_id, + const bool gnb_flagP, + const logical_chan_id_t channel_idP, + char *buffer_pP, + const tb_size_t tb_sizeP); + void nr_rlc_add_srb(int ue_id, int srb_id, const NR_RLC_BearerConfig_t *rlc_BearerConfig); void nr_rlc_add_drb(int ue_id, int drb_id, const NR_RLC_BearerConfig_t *rlc_BearerConfig); From 5a1d7a75dcd33a137f1716d7780d41c291d2b07a Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 24 Mar 2025 17:55:58 +0100 Subject: [PATCH 04/57] NR specific mac_rlc_data_req function --- openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c | 19 +++++++------------ openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c | 18 +++++++----------- .../tests/test_nr_ue_ra_procedures.cpp | 17 ++++++----------- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 12 +----------- .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 18 +++++++----------- openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c | 19 +++++++------------ openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h | 6 ++++++ 7 files changed, 41 insertions(+), 68 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c index c945408319..b7dc9cf7a9 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c @@ -37,7 +37,7 @@ #include "NR_MAC_COMMON/nr_mac.h" #include "LAYER2/NR_MAC_UE/mac_proto.h" #include -#include "openair2/LAYER2/RLC/rlc.h" +#include "openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h" int16_t get_prach_tx_power(NR_UE_MAC_INST_t *mac) { @@ -1105,17 +1105,12 @@ static uint8_t *fill_msg3_pdu_from_rlc(NR_UE_MAC_INST_t *mac, uint8_t *pdu, int // regular Msg3/MsgA_PUSCH with PDU coming from higher layers *(NR_MAC_SUBHEADER_FIXED *)pdu = (NR_MAC_SUBHEADER_FIXED){.LCID = UL_SCH_LCID_CCCH_48_BITS}; pdu += sizeof(NR_MAC_SUBHEADER_FIXED); - tbs_size_t len = mac_rlc_data_req(mac->ue_id, - mac->ue_id, - 0, - 0, - ENB_FLAG_NO, - MBMS_FLAG_NO, - 0, // SRB0 for messages sent in MSG3 - TBS_max - sizeof(NR_MAC_SUBHEADER_FIXED), /* size of mac_ce above */ - (char *)pdu, - 0, - 0); + tbs_size_t len = nr_mac_rlc_data_req(mac->ue_id, + mac->ue_id, + false, + 0, // SRB0 for messages sent in MSG3 + TBS_max - sizeof(NR_MAC_SUBHEADER_FIXED), /* size of mac_ce above */ + (char *)pdu); AssertFatal(len > 0, "no data for Msg3/MsgA_PUSCH\n"); // UE Contention Resolution Identity // Store the first 48 bits belonging to the uplink CCCH SDU within Msg3 to determine whether or not the diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index 3c18360d21..290c367687 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -48,6 +48,7 @@ #include #include "LAYER2/RLC/rlc.h" +#include "openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h" #include "RRC/NR_UE/L2_interface_ue.h" //#define SRS_DEBUG @@ -2589,17 +2590,12 @@ static bool fill_mac_sdu(NR_UE_MAC_INST_t *mac, &target); header_sz = bytes_requested < 256 ? sizeof(NR_MAC_SUBHEADER_SHORT) : sizeof(NR_MAC_SUBHEADER_LONG); - uint16_t sdu_length = mac_rlc_data_req(mac->ue_id, - mac->ue_id, - gNB_index, - frame, - ENB_FLAG_NO, - MBMS_FLAG_NO, - lcid, - bytes_requested, - (char *)mac_ce_p->cur_ptr + header_sz, - 0, - 0); + uint16_t sdu_length = nr_mac_rlc_data_req(mac->ue_id, + mac->ue_id, + false, + lcid, + bytes_requested, + (char *)mac_ce_p->cur_ptr + header_sz); AssertFatal(bytes_requested >= sdu_length, "LCID = 0x%02x RLC has segmented %d bytes but MAC has max %li remaining bytes\n", diff --git a/openair2/LAYER2/NR_MAC_UE/tests/test_nr_ue_ra_procedures.cpp b/openair2/LAYER2/NR_MAC_UE/tests/test_nr_ue_ra_procedures.cpp index 25ea5edcd0..f7fc520d06 100644 --- a/openair2/LAYER2/NR_MAC_UE/tests/test_nr_ue_ra_procedures.cpp +++ b/openair2/LAYER2/NR_MAC_UE/tests/test_nr_ue_ra_procedures.cpp @@ -35,17 +35,12 @@ void nr_mac_rrc_ra_ind(const module_id_t mod_id, bool success) void nr_mac_rrc_msg3_ind(const module_id_t mod_id, const int rnti, bool prepare_payload) { } -tbs_size_t mac_rlc_data_req(const module_id_t module_idP, - const rnti_t rntiP, - const eNB_index_t eNB_index, - const frame_t frameP, - const eNB_flag_t enb_flagP, - const MBMS_flag_t MBMS_flagP, - const logical_chan_id_t channel_idP, - const tb_size_t tb_sizeP, - char *buffer_pP, - const uint32_t sourceL2Id, - const uint32_t destinationL2Id) +tbs_size_t nr_mac_rlc_data_req(const module_id_t module_idP, + const uint16_t ue_id, + const bool gnb_flagP, + const logical_chan_id_t channel_idP, + const tb_size_t tb_sizeP, + char *buffer_pP) { return 0; } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 3a64ac16c9..14a70ebc41 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -2051,17 +2051,7 @@ static void nr_generate_Msg4_MsgB(module_id_t module_idP, uint8_t buffer[CCCH_SDU_SIZE]; uint8_t mac_subheader_len = sizeof(NR_MAC_SUBHEADER_SHORT); // Get RLC data on the SRB (RRCSetup, RRCReestablishment) - mac_sdu_length = mac_rlc_data_req(module_idP, - ra->rnti, - module_idP, - frameP, - ENB_FLAG_YES, - MBMS_FLAG_NO, - lcid, - CCCH_SDU_SIZE, - (char *)buffer, - 0, - 0); + mac_sdu_length = nr_mac_rlc_data_req(module_idP, ra->rnti, true, lcid, CCCH_SDU_SIZE, (char *)buffer); if (mac_sdu_length < 256) { ((NR_MAC_SUBHEADER_SHORT *)&buf[mac_pdu_length])->R = 0; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 39aae6db49..25c196ee3f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -34,6 +34,7 @@ #include "NR_MAC_COMMON/nr_mac.h" #include "NR_MAC_gNB/nr_mac_gNB.h" #include "LAYER2/NR_MAC_gNB/mac_proto.h" +#include "openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h" #include "LAYER2/RLC/rlc.h" /*TAG*/ @@ -1300,17 +1301,12 @@ void nr_schedule_ue_spec(module_id_t module_id, * such that TBS is full */ const rlc_buffer_occupancy_t ndata = min(sched_ctrl->rlc_status[lcid].bytes_in_buffer, bufEnd-buf-sizeof(NR_MAC_SUBHEADER_LONG)); - tbs_size_t len = mac_rlc_data_req(module_id, - rnti, - module_id, - frame, - ENB_FLAG_YES, - MBMS_FLAG_NO, - lcid, - ndata, - (char *)buf+sizeof(NR_MAC_SUBHEADER_LONG), - 0, - 0); + tbs_size_t len = nr_mac_rlc_data_req(module_id, + rnti, + true, + lcid, + ndata, + (char *)buf+sizeof(NR_MAC_SUBHEADER_LONG)); LOG_D(NR_MAC, "%4d.%2d RNTI %04x: %d bytes from %s %d (ndata %d, remaining size %ld)\n", frame, diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index 1937646bdf..2c04004de2 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -192,17 +192,12 @@ void nr_mac_rlc_data_ind(const module_id_t module_idP, nr_rlc_manager_unlock(nr_rlc_ue_manager); } -tbs_size_t mac_rlc_data_req(const module_id_t module_idP, - const uint16_t ue_id, - const eNB_index_t eNB_index, - const frame_t frameP, - const eNB_flag_t enb_flagP, - const MBMS_flag_t MBMS_flagP, - const logical_chan_id_t channel_idP, - const tb_size_t tb_sizeP, - char *buffer_pP, - const uint32_t sourceL2Id, - const uint32_t destinationL2Id) +tbs_size_t nr_mac_rlc_data_req(const module_id_t module_idP, + const uint16_t ue_id, + const bool gnb_flagP, + const logical_chan_id_t channel_idP, + const tb_size_t tb_sizeP, + char *buffer_pP) { int ret; int maxsize; @@ -223,7 +218,7 @@ tbs_size_t mac_rlc_data_req(const module_id_t module_idP, nr_rlc_manager_unlock(nr_rlc_ue_manager); - if (enb_flagP) + if (gnb_flagP) T(T_ENB_RLC_MAC_DL, T_INT(module_idP), T_INT(ue_id), T_INT(channel_idP), T_INT(ret)); diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h index 010852661a..19746209f2 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h @@ -47,6 +47,12 @@ void nr_mac_rlc_data_ind(const module_id_t module_idP, const logical_chan_id_t channel_idP, char *buffer_pP, const tb_size_t tb_sizeP); +tbs_size_t nr_mac_rlc_data_req(const module_id_t module_idP, + const uint16_t ue_id, + const bool gnb_flagP, + const logical_chan_id_t channel_idP, + const tb_size_t tb_sizeP, + char *buffer_pP); void nr_rlc_add_srb(int ue_id, int srb_id, const NR_RLC_BearerConfig_t *rlc_BearerConfig); void nr_rlc_add_drb(int ue_id, int drb_id, const NR_RLC_BearerConfig_t *rlc_BearerConfig); From bdb3555825a98d75a113da5202d4d3377f273dec Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 24 Mar 2025 18:09:05 +0100 Subject: [PATCH 05/57] NR specific mac_rlc_status_ind function --- openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c | 4 +--- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 5 ++--- .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 12 +----------- .../LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c | 13 ++----------- openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c | 19 ++++--------------- openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h | 1 + 6 files changed, 11 insertions(+), 43 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index 290c367687..638e79e3c9 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -47,7 +47,6 @@ #include "utils.h" #include -#include "LAYER2/RLC/rlc.h" #include "openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h" #include "RRC/NR_UE/L2_interface_ue.h" @@ -1269,8 +1268,7 @@ static void nr_update_rlc_buffers_status(NR_UE_MAC_INST_t *mac, frame_t frameP, nr_lcordered_info_t *lc_info = mac->lc_ordered_list.array[i]; int lcid = lc_info->lcid; NR_LC_SCHEDULING_INFO *lc_sched_info = get_scheduling_info_from_lcid(mac, lcid); - mac_rlc_status_resp_t rlc_status = - mac_rlc_status_ind(mac->ue_id, mac->ue_id, gNB_index, frameP, slotP, ENB_FLAG_NO, MBMS_FLAG_NO, lcid, 0, 0); + mac_rlc_status_resp_t rlc_status = nr_mac_rlc_status_ind(mac->ue_id, frameP, lcid); if (rlc_status.bytes_in_buffer > 0) { LOG_D(NR_MAC, diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 14a70ebc41..147b8abc6c 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -42,7 +42,6 @@ /* rlc */ #include "openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h" -#include "openair2/LAYER2/RLC/rlc.h" #include @@ -1880,12 +1879,12 @@ static void nr_generate_Msg4_MsgB(module_id_t module_idP, logical_chan_id_t lcid = DL_SCH_LCID_CCCH; if (current_harq_pid < 0) { // Check for data on SRB0 (RRCSetup) - mac_rlc_status_resp_t srb_status = mac_rlc_status_ind(module_idP, ra->rnti, module_idP, frameP, slotP, ENB_FLAG_YES, MBMS_FLAG_NO, lcid, 0, 0); + mac_rlc_status_resp_t srb_status = nr_mac_rlc_status_ind(ra->rnti, frameP, lcid); if (srb_status.bytes_in_buffer == 0) { lcid = DL_SCH_LCID_DCCH; // Check for data on SRB1 (RRCReestablishment, RRCReconfiguration) - srb_status = mac_rlc_status_ind(module_idP, ra->rnti, module_idP, frameP, slotP, ENB_FLAG_YES, MBMS_FLAG_NO, lcid, 0, 0); + srb_status = nr_mac_rlc_status_ind(ra->rnti, frameP, lcid); } // Need to wait until data for Msg4 is ready diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index 25c196ee3f..2a5b979f5a 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -35,7 +35,6 @@ #include "NR_MAC_gNB/nr_mac_gNB.h" #include "LAYER2/NR_MAC_gNB/mac_proto.h" #include "openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h" -#include "LAYER2/RLC/rlc.h" /*TAG*/ #include "NR_TAG-Id.h" @@ -339,16 +338,7 @@ static void nr_store_dlsch_buffer(module_id_t module_id, frame_t frame, slot_t s if (lcid == DL_SCH_LCID_DTCH && nr_timer_is_active(&sched_ctrl->transm_interrupt)) continue; start_meas(&RC.nrmac[module_id]->rlc_status_ind); - sched_ctrl->rlc_status[lcid] = mac_rlc_status_ind(module_id, - rnti, - module_id, - frame, - slot, - ENB_FLAG_YES, - MBMS_FLAG_NO, - lcid, - 0, - 0); + sched_ctrl->rlc_status[lcid] = nr_mac_rlc_status_ind(rnti, frame, lcid); stop_meas(&RC.nrmac[module_id]->rlc_status_ind); if (sched_ctrl->rlc_status[lcid].bytes_in_buffer == 0) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c index 36b9a5fd39..55d9738938 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_phytest.c @@ -33,7 +33,7 @@ #include "LAYER2/NR_MAC_COMMON/nr_mac_common.h" #include "executables/nr-softmodem.h" #include "LAYER2/NR_MAC_COMMON/nr_mac.h" -#include "LAYER2/RLC/rlc.h" +#include "openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h" #include "executables/softmodem-common.h" #include "common/utils/nr/nr_common.h" @@ -129,16 +129,7 @@ void nr_preprocessor_phytest(module_id_t module_id, frame_t frame, slot_t slot) const uint16_t rnti = UE->rnti; /* update sched_ctrl->num_total_bytes so that postprocessor schedules data, * if available */ - sched_ctrl->rlc_status[lcid] = mac_rlc_status_ind(module_id, - rnti, - module_id, - frame, - slot, - ENB_FLAG_YES, - MBMS_FLAG_NO, - lcid, - 0, - 0); + sched_ctrl->rlc_status[lcid] = nr_mac_rlc_status_ind(rnti, frame, lcid); sched_ctrl->num_total_bytes += sched_ctrl->rlc_status[lcid].bytes_in_buffer; int CCEIndex = get_cce_index(mac, diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index 2c04004de2..932175e03a 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -225,16 +225,7 @@ tbs_size_t nr_mac_rlc_data_req(const module_id_t module_idP, return ret; } -mac_rlc_status_resp_t mac_rlc_status_ind(const module_id_t module_idP, - const uint16_t ue_id, - const eNB_index_t eNB_index, - const frame_t frameP, - const sub_frame_t subframeP, - const eNB_flag_t enb_flagP, - const MBMS_flag_t MBMS_flagP, - const logical_chan_id_t channel_idP, - const uint32_t sourceL2Id, - const uint32_t destinationL2Id) +mac_rlc_status_resp_t nr_mac_rlc_status_ind(const uint16_t ue_id, const frame_t frame, const logical_chan_id_t channel_idP) { mac_rlc_status_resp_t ret; @@ -250,12 +241,10 @@ mac_rlc_status_resp_t mac_rlc_status_ind(const module_id_t module_idP, * more than enough. */ // Fix me: temproary reduction meanwhile cpu cost of this computation is optimized - buf_stat = rb->buffer_status(rb, 1000*1000); - ret.bytes_in_buffer = buf_stat.status_size - + buf_stat.retx_size - + buf_stat.tx_size; + buf_stat = rb->buffer_status(rb, 1000 * 1000); + ret.bytes_in_buffer = buf_stat.status_size + buf_stat.retx_size + buf_stat.tx_size; } else { - if (!(frameP%128) || channel_idP == 0) //to suppress this warning message + if (!(frame % 128) || channel_idP == 0) //to suppress this warning message LOG_W(RLC, "Radio Bearer (channel ID %d) is NULL for UE %d\n", channel_idP, ue_id); ret.bytes_in_buffer = 0; } diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h index 19746209f2..bebea37c22 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h @@ -53,6 +53,7 @@ tbs_size_t nr_mac_rlc_data_req(const module_id_t module_idP, const logical_chan_id_t channel_idP, const tb_size_t tb_sizeP, char *buffer_pP); +mac_rlc_status_resp_t nr_mac_rlc_status_ind(const uint16_t ue_id, const frame_t frame, const logical_chan_id_t channel_idP); void nr_rlc_add_srb(int ue_id, int srb_id, const NR_RLC_BearerConfig_t *rlc_BearerConfig); void nr_rlc_add_drb(int ue_id, int drb_id, const NR_RLC_BearerConfig_t *rlc_BearerConfig); From d4631845ec3c96c5132c68ab2e02cbb1e5cbeb75 Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 24 Mar 2025 18:12:55 +0100 Subject: [PATCH 06/57] remove other RLC functions not used in NR --- openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c | 122 ------------------------ 1 file changed, 122 deletions(-) diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index 932175e03a..ad6193155d 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -259,59 +259,6 @@ mac_rlc_status_resp_t nr_mac_rlc_status_ind(const uint16_t ue_id, const frame_t return ret; } -rlc_buffer_occupancy_t mac_rlc_get_buffer_occupancy_ind(const module_id_t module_idP, - const uint16_t ue_id, - const eNB_index_t eNB_index, - const frame_t frameP, - const sub_frame_t subframeP, - const eNB_flag_t enb_flagP, - const logical_chan_id_t channel_idP) -{ - rlc_buffer_occupancy_t ret; - - if (enb_flagP) { - LOG_E(RLC, "Tx mac_rlc_get_buffer_occupancy_ind function is not implemented for eNB LcId=%u\n", channel_idP); - exit(1); - } - - /* TODO: handle time a bit more properly */ - lock_nr_rlc_current_time(); - if (nr_rlc_current_time_last_frame != frameP || - nr_rlc_current_time_last_subframe != subframeP) { - nr_rlc_current_time++; - nr_rlc_current_time_last_frame = frameP; - nr_rlc_current_time_last_subframe = subframeP; - } - unlock_nr_rlc_current_time(); - - nr_rlc_manager_lock(nr_rlc_ue_manager); - nr_rlc_ue_t *ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, ue_id); - nr_rlc_entity_t *rb = get_rlc_entity_from_lcid(ue, channel_idP); - - if (rb != NULL) { - nr_rlc_entity_buffer_status_t buf_stat; - rb->set_time(rb, get_nr_rlc_current_time()); - /* 38.321 deals with BSR values up to 81338368 bytes, after what it - * reports '> 81338368' (table 6.1.3.1-2). Passing 100000000 is thus - * more than enough. - */ - // Fixme : Laurent reduced size for CPU saving - // Fix me: temproary reduction meanwhile cpu cost of this computation is optimized - buf_stat = rb->buffer_status(rb, 1000*1000); - ret = buf_stat.status_size - + buf_stat.retx_size - + buf_stat.tx_size; - } else { - if (!(frameP%128)) //to suppress this warning message - LOG_W(RLC, "Radio Bearer (channel ID %d) is NULL for UE %d\n", channel_idP, ue_id); - ret = 0; - } - - nr_rlc_manager_unlock(nr_rlc_ue_manager); - - return ret; -} - rlc_op_status_t rlc_data_req(const protocol_ctxt_t *const ctxt_pP, const srb_flag_t srb_flagP, const MBMS_flag_t MBMS_flagP, @@ -408,10 +355,6 @@ int rlc_module_init(int enb_flag) return 0; } -void rlc_util_print_hex_octets(comp_name_t componentP, unsigned char *dataP, const signed long sizeP) -{ -} - static void deliver_sdu(void *_ue, nr_rlc_entity_t *entity, char *buf, int size) { nr_rlc_ue_t *ue = _ue; @@ -957,61 +900,6 @@ bool nr_rlc_activate_srb0(int ue_id, return true; } -rlc_op_status_t rrc_rlc_config_req(const protocol_ctxt_t* const ctxt_pP, - const srb_flag_t srb_flagP, - const MBMS_flag_t mbms_flagP, - const config_action_t actionP, - const rb_id_t rb_idP) -{ - if (mbms_flagP) { - LOG_E(RLC, "%s:%d:%s: todo (MBMS NOT supported)\n", __FILE__, __LINE__, __FUNCTION__); - exit(1); - } - if (actionP != CONFIG_ACTION_REMOVE) { - LOG_E(RLC, "%s:%d:%s: todo (only CONFIG_ACTION_REMOVE supported)\n", __FILE__, __LINE__, __FUNCTION__); - exit(1); - } - if (ctxt_pP->module_id) { - LOG_E(RLC, "%s:%d:%s: todo (only module_id 0 supported)\n", __FILE__, __LINE__, __FUNCTION__); - exit(1); - } - if ((srb_flagP && !(rb_idP >= 1 && rb_idP <= 2)) || - (!srb_flagP && !(rb_idP >= 1 && rb_idP <= MAX_DRBS_PER_UE))) { - LOG_E(RLC, "%s:%d:%s: bad rb_id (%ld) (is_srb %d)\n", __FILE__, __LINE__, __FUNCTION__, rb_idP, srb_flagP); - exit(1); - } - nr_rlc_manager_lock(nr_rlc_ue_manager); - LOG_D(RLC, "%s:%d:%s: remove rb %ld (is_srb %d) for UE %lx\n", __FILE__, __LINE__, __FUNCTION__, rb_idP, srb_flagP, ctxt_pP->rntiMaybeUEid); - nr_rlc_ue_t *ue = nr_rlc_manager_get_ue(nr_rlc_ue_manager, ctxt_pP->rntiMaybeUEid); - if (srb_flagP) { - if (ue->srb[rb_idP-1] != NULL) { - ue->srb[rb_idP-1]->delete_entity(ue->srb[rb_idP-1]); - ue->srb[rb_idP-1] = NULL; - } else - LOG_W(RLC, "removing non allocated SRB %ld, do nothing\n", rb_idP); - } else { - if (ue->drb[rb_idP-1] != NULL) { - ue->drb[rb_idP-1]->delete_entity(ue->drb[rb_idP-1]); - ue->drb[rb_idP-1] = NULL; - } else - LOG_W(RLC, "removing non allocated DRB %ld, do nothing\n", rb_idP); - } - /* remove UE if it has no more RB configured */ - int i; - for (i = 0; i < 2; i++) - if (ue->srb[i] != NULL) - break; - if (i == 2) { - for (i = 0; i < MAX_DRBS_PER_UE; i++) - if (ue->drb[i] != NULL) - break; - if (i == MAX_DRBS_PER_UE) - nr_rlc_manager_remove_ue(nr_rlc_ue_manager, ctxt_pP->rntiMaybeUEid); - } - nr_rlc_manager_unlock(nr_rlc_ue_manager); - return RLC_OP_STATUS_OK; -} - void nr_rlc_remove_ue(int ue_id) { LOG_W(RLC, "Remove UE %d\n", ue_id); @@ -1085,16 +973,6 @@ void nr_rlc_tick(int frame, int subframe) unlock_nr_rlc_current_time(); } -/* This is a hack, to compile the gNB. - * TODO: remove it. The solution is to cleanup CMakeLists.txt - */ -void rlc_tick(int a, int b) -{ - LOG_E(RLC, "%s:%d:%s: this code should not be reached\n", - __FILE__, __LINE__, __FUNCTION__); - exit(1); -} - void nr_rlc_activate_avg_time_to_tx(const int ue_id, const logical_chan_id_t channel_id, const bool is_on) From 70fba0e73c24b18a7e74ac3c74b4f1814ecb28bb Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 24 Mar 2025 18:35:12 +0100 Subject: [PATCH 07/57] NR specific enqueue_rlc_data_req function and some cleanup in NR PDCP --- openair2/F1AP/f1ap_cu_rrc_message_transfer.c | 5 +- .../LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c | 2 +- openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c | 48 +++++-------------- openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h | 6 +-- openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c | 21 ++++---- openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h | 6 +++ 6 files changed, 30 insertions(+), 58 deletions(-) diff --git a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c index cf85961ff5..bfdeecf4e5 100644 --- a/openair2/F1AP/f1ap_cu_rrc_message_transfer.c +++ b/openair2/F1AP/f1ap_cu_rrc_message_transfer.c @@ -150,12 +150,9 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance, sctp_assoc_t assoc_id nr_pdcp_data_ind(&ctxt, 1, // srb_flag - 0, // embms_flag msg.srb_id, msg.rrc_container_length, - mb, - NULL, - NULL); + mb); /* Free UL RRC Message Transfer */ free_ul_rrc_message_transfer(&msg); return 0; 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 f92559c4ee..25a182dddb 100644 --- a/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c +++ b/openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.c @@ -90,7 +90,7 @@ bool DURecvCb(protocol_ctxt_t *ctxt_pP, // The buffer comes from the stack in gtp-u thread, we have a make a separate buffer to enqueue in a inter-thread message queue uint8_t *sdu = malloc16(sdu_buffer_sizeP); memcpy(sdu, sdu_buffer_pP, sdu_buffer_sizeP); - du_rlc_data_req(ctxt_pP, srb_flagP, false, rb_idP, muiP, confirmP, sdu_buffer_sizeP, sdu); + du_rlc_data_req(ctxt_pP, srb_flagP, rb_idP, muiP, confirmP, sdu_buffer_sizeP, sdu); return true; } diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index 54880e828a..8dc37f3083 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -64,7 +64,7 @@ #include "openair2/SDAP/nr_sdap/nr_sdap.h" #include "pdcp.h" #include "pdcp_messages_types.h" -#include "rlc.h" +#include "openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h" #include "utils.h" #define TODO do { \ @@ -127,7 +127,6 @@ nr_pdcp_entity_t *nr_pdcp_get_rb(nr_pdcp_ue_t *ue, int rb_id, bool srb_flag) typedef struct { protocol_ctxt_t ctxt_pP; srb_flag_t srb_flagP; - MBMS_flag_t MBMS_flagP; rb_id_t rb_idP; mui_t muiP; confirm_t confirmP; @@ -159,16 +158,12 @@ static void *rlc_data_req_thread(void *_) i = q.start; if (pthread_mutex_unlock(&q.m) != 0) abort(); - rlc_data_req(&q.q[i].ctxt_pP, - q.q[i].srb_flagP, - q.q[i].MBMS_flagP, - q.q[i].rb_idP, - q.q[i].muiP, - q.q[i].confirmP, - q.q[i].sdu_sizeP, - q.q[i].sdu_pP, - NULL, - NULL); + nr_rlc_data_req(&q.q[i].ctxt_pP, + q.q[i].srb_flagP, + q.q[i].rb_idP, + q.q[i].muiP, + q.q[i].sdu_sizeP, + q.q[i].sdu_pP); if (pthread_mutex_lock(&q.m) != 0) abort(); @@ -195,7 +190,6 @@ static void init_nr_rlc_data_req_queue(void) static void enqueue_rlc_data_req(const protocol_ctxt_t *const ctxt_pP, const srb_flag_t srb_flagP, - const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP, const mui_t muiP, confirm_t confirmP, @@ -219,7 +213,6 @@ static void enqueue_rlc_data_req(const protocol_ctxt_t *const ctxt_pP, q.q[i].ctxt_pP = *ctxt_pP; q.q[i].srb_flagP = srb_flagP; - q.q[i].MBMS_flagP = MBMS_flagP; q.q[i].rb_idP = rb_idP; q.q[i].muiP = muiP; q.q[i].confirmP = confirmP; @@ -232,7 +225,6 @@ static void enqueue_rlc_data_req(const protocol_ctxt_t *const ctxt_pP, void du_rlc_data_req(const protocol_ctxt_t *const ctxt_pP, const srb_flag_t srb_flagP, - const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP, const mui_t muiP, confirm_t confirmP, @@ -241,7 +233,6 @@ void du_rlc_data_req(const protocol_ctxt_t *const ctxt_pP, { enqueue_rlc_data_req(ctxt_pP, srb_flagP, - MBMS_flagP, rb_idP, muiP, confirmP, sdu_sizeP, @@ -259,7 +250,6 @@ void du_rlc_data_req(const protocol_ctxt_t *const ctxt_pP, typedef struct { protocol_ctxt_t ctxt_pP; srb_flag_t srb_flagP; - MBMS_flag_t MBMS_flagP; rb_id_t rb_id; sdu_size_t sdu_buffer_size; uint8_t *sdu_buffer; @@ -279,7 +269,6 @@ static pdcp_data_ind_queue pq; static void do_pdcp_data_ind(const protocol_ctxt_t *const ctxt_pP, const srb_flag_t srb_flagP, - const MBMS_flag_t MBMS_flagP, const rb_id_t rb_id, const sdu_size_t sdu_buffer_size, uint8_t *const sdu_buffer) @@ -329,7 +318,6 @@ static void *pdcp_data_ind_thread(void *_) do_pdcp_data_ind(&pq.q[i].ctxt_pP, pq.q[i].srb_flagP, - pq.q[i].MBMS_flagP, pq.q[i].rb_id, pq.q[i].sdu_buffer_size, pq.q[i].sdu_buffer); @@ -359,7 +347,6 @@ static void init_nr_pdcp_data_ind_queue(void) static void enqueue_pdcp_data_ind(const protocol_ctxt_t *const ctxt_pP, const srb_flag_t srb_flagP, - const MBMS_flag_t MBMS_flagP, const rb_id_t rb_id, const sdu_size_t sdu_buffer_size, uint8_t *const sdu_buffer) @@ -381,7 +368,6 @@ static void enqueue_pdcp_data_ind(const protocol_ctxt_t *const ctxt_pP, pq.q[i].ctxt_pP = *ctxt_pP; pq.q[i].srb_flagP = srb_flagP; - pq.q[i].MBMS_flagP = MBMS_flagP; pq.q[i].rb_id = rb_id; pq.q[i].sdu_buffer_size = sdu_buffer_size; pq.q[i].sdu_buffer = sdu_buffer; @@ -392,19 +378,11 @@ static void enqueue_pdcp_data_ind(const protocol_ctxt_t *const ctxt_pP, bool nr_pdcp_data_ind(const protocol_ctxt_t *const ctxt_pP, const srb_flag_t srb_flagP, - const MBMS_flag_t MBMS_flagP, const rb_id_t rb_id, const sdu_size_t sdu_buffer_size, - uint8_t *const sdu_buffer, - const uint32_t *const srcID, - const uint32_t *const dstID) + uint8_t *const sdu_buffer) { - enqueue_pdcp_data_ind(ctxt_pP, - srb_flagP, - MBMS_flagP, - rb_id, - sdu_buffer_size, - sdu_buffer); + enqueue_pdcp_data_ind(ctxt_pP, srb_flagP, rb_id, sdu_buffer_size, sdu_buffer); return true; } @@ -717,7 +695,7 @@ static void deliver_pdu_drb_ue(void *deliver_pdu_data, ue_id_t ue_id, int rb_id, uint8_t *memblock = malloc16(size); memcpy(memblock, buf, size); LOG_D(PDCP, "%s(): (drb %d) calling rlc_data_req size %d UE %ld/%04lx\n", __func__, rb_id, size, ctxt.rntiMaybeUEid, ctxt.rntiMaybeUEid); - enqueue_rlc_data_req(&ctxt, 0, MBMS_FLAG_NO, rb_id, sdu_id, 0, size, memblock); + enqueue_rlc_data_req(&ctxt, 0, rb_id, sdu_id, 0, size, memblock); } static void deliver_pdu_drb_gnb(void *deliver_pdu_data, ue_id_t ue_id, int rb_id, @@ -735,7 +713,7 @@ static void deliver_pdu_drb_gnb(void *deliver_pdu_data, ue_id_t ue_id, int rb_id uint8_t *memblock = malloc16(size); memcpy(memblock, buf, size); LOG_D(PDCP, "%s(): (drb %d) calling rlc_data_req size %d\n", __func__, rb_id, size); - enqueue_rlc_data_req(&ctxt, 0, MBMS_FLAG_NO, rb_id, sdu_id, 0, size, memblock); + enqueue_rlc_data_req(&ctxt, 0, rb_id, sdu_id, 0, size, memblock); } } @@ -794,7 +772,7 @@ void deliver_pdu_srb_rlc(void *deliver_pdu_data, ue_id_t ue_id, int srb_id, protocol_ctxt_t ctxt = { .enb_flag = 1, .rntiMaybeUEid = ue_id }; uint8_t *memblock = malloc16(size); memcpy(memblock, buf, size); - enqueue_rlc_data_req(&ctxt, 1, MBMS_FLAG_NO, srb_id, sdu_id, 0, size, memblock); + enqueue_rlc_data_req(&ctxt, 1, srb_id, sdu_id, 0, size, memblock); } void add_srb(int is_gnb, @@ -1315,7 +1293,7 @@ bool cu_f1u_data_req(protocol_ctxt_t *ctxt_pP, exit(1); } memcpy(memblock, sdu_buffer, sdu_buffer_size); - int ret = nr_pdcp_data_ind(ctxt_pP, srb_flagP, false, rb_id, sdu_buffer_size, memblock, NULL, NULL); + int ret = nr_pdcp_data_ind(ctxt_pP, srb_flagP, rb_id, sdu_buffer_size, memblock); if (!ret) { LOG_E(RLC, "%s:%d:%s: ERROR: pdcp_data_ind failed\n", __FILE__, __LINE__, __FUNCTION__); /* what to do in case of failure? for the moment: nothing */ diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h index bdeb01fff1..a60cd869af 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h @@ -39,7 +39,6 @@ uint64_t nr_pdcp_module_init(uint64_t _pdcp_optmask, int id); void du_rlc_data_req(const protocol_ctxt_t *const ctxt_pP, const srb_flag_t srb_flagP, - const MBMS_flag_t MBMS_flagP, const rb_id_t rb_idP, const mui_t muiP, confirm_t confirmP, @@ -48,12 +47,9 @@ void du_rlc_data_req(const protocol_ctxt_t *const ctxt_pP, bool nr_pdcp_data_ind(const protocol_ctxt_t *const ctxt_pP, const srb_flag_t srb_flagP, - const MBMS_flag_t MBMS_flagP, const rb_id_t rb_id, const sdu_size_t sdu_buffer_size, - uint8_t *const sdu_buffer, - const uint32_t *const srcID, - const uint32_t *const dstID); + uint8_t *const sdu_buffer); void nr_pdcp_add_drbs(eNB_flag_t enb_flag, ue_id_t UEid, diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index ad6193155d..faf15f38f3 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -259,23 +259,18 @@ mac_rlc_status_resp_t nr_mac_rlc_status_ind(const uint16_t ue_id, const frame_t return ret; } -rlc_op_status_t rlc_data_req(const protocol_ctxt_t *const ctxt_pP, - const srb_flag_t srb_flagP, - const MBMS_flag_t MBMS_flagP, - const rb_id_t rb_idP, - const mui_t muiP, - confirm_t confirmP, - sdu_size_t sdu_sizeP, - uint8_t *sdu_pP, - const uint32_t *const sourceL2Id, - const uint32_t *const destinationL2Id) +rlc_op_status_t nr_rlc_data_req(const protocol_ctxt_t *const ctxt_pP, + const srb_flag_t srb_flagP, + const rb_id_t rb_idP, + const mui_t muiP, + sdu_size_t sdu_sizeP, + uint8_t *sdu_pP) { int ue_id = ctxt_pP->rntiMaybeUEid; nr_rlc_ue_t *ue; nr_rlc_entity_t *rb; - LOG_D(RLC, "UE %d srb_flag %d rb_id %ld mui %d confirm %d sdu_size %d MBMS_flag %d\n", - ue_id, srb_flagP, rb_idP, muiP, confirmP, sdu_sizeP, MBMS_flagP); + LOG_D(RLC, "UE %d srb_flag %d rb_id %ld mui %d sdu_size %d\n", ue_id, srb_flagP, rb_idP, muiP, sdu_sizeP); if (ctxt_pP->enb_flag) T(T_ENB_RLC_DL, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->rntiMaybeUEid), T_INT(rb_idP), T_INT(sdu_sizeP)); @@ -455,7 +450,7 @@ rb_found: } memcpy(memblock, buf, size); LOG_D(PDCP, "Calling PDCP layer from RLC in %s\n", __FUNCTION__); - if (!nr_pdcp_data_ind(&ctx, is_srb, 0, rb_id, size, memblock, NULL, NULL)) { + if (!nr_pdcp_data_ind(&ctx, is_srb, rb_id, size, memblock)) { LOG_E(RLC, "%s:%d:%s: ERROR: pdcp_data_ind failed\n", __FILE__, __LINE__, __FUNCTION__); /* what to do in case of failure? for the moment: nothing */ } diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h index bebea37c22..7f8c7c9ee2 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h @@ -53,6 +53,12 @@ tbs_size_t nr_mac_rlc_data_req(const module_id_t module_idP, const logical_chan_id_t channel_idP, const tb_size_t tb_sizeP, char *buffer_pP); +rlc_op_status_t nr_rlc_data_req(const protocol_ctxt_t *const ctxt_pP, + const srb_flag_t srb_flagP, + const rb_id_t rb_idP, + const mui_t muiP, + sdu_size_t sdu_sizeP, + uint8_t *sdu_pP); mac_rlc_status_resp_t nr_mac_rlc_status_ind(const uint16_t ue_id, const frame_t frame, const logical_chan_id_t channel_idP); void nr_rlc_add_srb(int ue_id, int srb_id, const NR_RLC_BearerConfig_t *rlc_BearerConfig); From 87b8d112f7f82a28099c80a92912178e086b1200 Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 24 Mar 2025 18:37:59 +0100 Subject: [PATCH 08/57] remove NR PDCP dummy functions (LTE dependencies not there anymore) --- openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c | 62 ----------------------- 1 file changed, 62 deletions(-) diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c index 8dc37f3083..d8b706520e 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.c @@ -561,12 +561,6 @@ static void set_node_type() { node_type = get_node_type(); } -/* hack: dummy function needed due to LTE dependencies */ -void pdcp_layer_init(void) -{ - abort(); -} - void nr_pdcp_layer_init(void) { /* hack: be sure to initialize only once */ @@ -944,32 +938,11 @@ void nr_pdcp_add_drbs(eNB_flag_t enb_flag, LOG_W(PDCP, "nr_pdcp_add_drbs() with void list\n"); } -/* Dummy function due to dependency from LTE libraries */ -bool rrc_pdcp_config_asn1_req(const protocol_ctxt_t *const ctxt_pP, - LTE_SRB_ToAddModList_t *const srb2add_list, - LTE_DRB_ToAddModList_t *const drb2add_list, - LTE_DRB_ToReleaseList_t *const drb2release_list, - const uint8_t security_modeP, - uint8_t *const kRRCenc, - uint8_t *const kRRCint, - uint8_t *const kUPenc, - LTE_PMCH_InfoList_r9_t *pmch_InfoList_r9, - rb_id_t *const defaultDRB) -{ - return 0; -} - uint64_t get_pdcp_optmask(void) { return pdcp_optmask; } -/* hack: dummy function needed due to LTE dependencies */ -bool pdcp_remove_UE(const protocol_ctxt_t *const ctxt_pP) -{ - abort(); -} - void nr_pdcp_remove_UE(ue_id_t ue_id) { nr_pdcp_manager_lock(nr_pdcp_ue_manager); @@ -977,19 +950,6 @@ void nr_pdcp_remove_UE(ue_id_t ue_id) nr_pdcp_manager_unlock(nr_pdcp_ue_manager); } -/* hack: dummy function needed due to LTE dependencies */ -void pdcp_config_set_security(const protocol_ctxt_t *const ctxt_pP, - pdcp_t *const pdcp_pP, - const rb_id_t rb_id, - const uint16_t lc_idP, - const uint8_t security_modeP, - uint8_t *const kRRCenc_pP, - uint8_t *const kRRCint_pP, - uint8_t *const kUPenc_pP) -{ - abort(); -} - void nr_pdcp_config_set_security(ue_id_t ue_id, rb_id_t rb_id, bool is_srb, @@ -1301,28 +1261,6 @@ bool cu_f1u_data_req(protocol_ctxt_t *ctxt_pP, return ret; } -/* hack: dummy function needed due to LTE dependencies */ -bool pdcp_data_req(protocol_ctxt_t *ctxt_pP, - const srb_flag_t srb_flagP, - const rb_id_t rb_idP, - const mui_t muiP, - const confirm_t confirmP, - const sdu_size_t sdu_buffer_sizeP, - unsigned char *const sdu_buffer_pP, - const pdcp_transmission_mode_t modeP, - const uint32_t *const sourceL2Id, - const uint32_t *const destinationL2Id) -{ - abort(); - return false; -} - -//Dummy function needed due to LTE dependencies -void -pdcp_mbms_run ( const protocol_ctxt_t *const ctxt_pP){ - /* nothing to do */ -} - void nr_pdcp_tick(int frame, int subframe) { if (frame != nr_pdcp_current_time_last_frame || From 83ab5831c568a8434bfc215f5d5058c9c1a3c813 Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 24 Mar 2025 18:51:59 +0100 Subject: [PATCH 09/57] NR specific rlc_module_init function --- executables/nr-uesoftmodem.c | 4 ++-- openair2/LAYER2/NR_MAC_UE/main_ue_nr.c | 3 +-- openair2/LAYER2/NR_MAC_gNB/main.c | 3 +-- openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c | 28 +++++++++++----------- openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h | 1 + openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.c | 10 ++++---- openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.h | 4 ++-- 7 files changed, 26 insertions(+), 27 deletions(-) diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 2ba05ae200..c0142ce896 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -75,7 +75,7 @@ unsigned short config_frames[4] = {2,9,11,13}; #include #include #include - +#include "nr_rlc/nr_rlc_oai_api.h" /* Callbacks, globals and object handlers */ //#include "stats.h" @@ -313,7 +313,7 @@ static void init_pdcp(int ue_id) // was always set. further refactoring could take it out pdcp_initmask = pdcp_initmask | UE_NAS_USE_TUN_BIT; - if (get_softmodem_params()->nsa && rlc_module_init(0) != 0) { + if (get_softmodem_params()->nsa && nr_rlc_module_init(0) != 0) { LOG_I(RLC, "Problem at RLC initiation \n"); } nr_pdcp_layer_init(); diff --git a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c index 8df19c7139..6c744e8275 100644 --- a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c +++ b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c @@ -38,7 +38,6 @@ #include "nr_rlc/nr_rlc_oai_api.h" #include "RRC/NR_UE/rrc_proto.h" #include -#include "openair2/LAYER2/RLC/rlc.h" static NR_UE_MAC_INST_t *nr_ue_mac_inst; void send_srb0_rrc(int ue_id, const uint8_t *sdu, sdu_size_t sdu_len, void *data) @@ -141,7 +140,7 @@ NR_UE_MAC_INST_t *nr_l2_init_ue(int nb_inst) ue_init_config_request(mac, get_slots_per_frame_from_scs(get_softmodem_params()->numerology)); } - int rc = rlc_module_init(0); + int rc = nr_rlc_module_init(0); AssertFatal(rc == 0, "Could not initialize RLC layer\n"); for (int j = 0; j < nb_inst; j++) { diff --git a/openair2/LAYER2/NR_MAC_gNB/main.c b/openair2/LAYER2/NR_MAC_gNB/main.c index a8fe8de79c..d99ba55ff0 100644 --- a/openair2/LAYER2/NR_MAC_gNB/main.c +++ b/openair2/LAYER2/NR_MAC_gNB/main.c @@ -66,7 +66,6 @@ #include "nr_pdcp/nr_pdcp_oai_api.h" #include "nr_rlc/nr_rlc_oai_api.h" #include "openair2/F1AP/f1ap_ids.h" -#include "rlc.h" #include "seq_arr.h" #include "system.h" #include "time_meas.h" @@ -304,7 +303,7 @@ void mac_top_init_gNB(ngran_node_t node_type, mac_rrc_init(RC.nrmac[i], node_type); }//END for (i = 0; i < RC.nb_nr_macrlc_inst; i++) - AssertFatal(rlc_module_init(1) == 0,"Could not initialize RLC layer\n"); + AssertFatal(nr_rlc_module_init(1) == 0,"Could not initialize RLC layer\n"); // These should be out of here later if (get_softmodem_params()->usim_test == 0 ) nr_pdcp_layer_init(); diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index faf15f38f3..eefa0f9e37 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -322,7 +322,7 @@ int nr_rlc_get_available_tx_space(const int ue_id, const logical_chan_id_t chann return ret; } -int rlc_module_init(int enb_flag) +int nr_rlc_module_init(int gnb_flag) { static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; static int inited = 0; @@ -330,20 +330,22 @@ int rlc_module_init(int enb_flag) if (pthread_mutex_lock(&lock)) abort(); - if (enb_flag == 1 && inited) { + if (gnb_flag == 1 && inited) { LOG_E(RLC, "%s:%d:%s: fatal, inited already 1\n", __FILE__, __LINE__, __FUNCTION__); exit(1); } - if (enb_flag == 0 && inited_ue) { + if (gnb_flag == 0 && inited_ue) { LOG_E(RLC, "%s:%d:%s: fatal, inited_ue already 1\n", __FILE__, __LINE__, __FUNCTION__); exit(1); } - if (enb_flag == 1) inited = 1; - if (enb_flag == 0) inited_ue = 1; + if (gnb_flag == 1) + inited = 1; + if (gnb_flag == 0) + inited_ue = 1; - nr_rlc_ue_manager = new_nr_rlc_ue_manager(enb_flag); + nr_rlc_ue_manager = new_nr_rlc_ue_manager(gnb_flag); if (pthread_mutex_unlock(&lock)) abort(); @@ -358,7 +360,6 @@ static void deliver_sdu(void *_ue, nr_rlc_entity_t *entity, char *buf, int size) protocol_ctxt_t ctx; uint8_t *memblock; int i; - int is_enb; /* is it SRB? */ for (i = 0; i < sizeofArray(ue->srb); i++) { @@ -391,21 +392,21 @@ rb_found: ctx.eNB_index = 0; ctx.brOption = 0; - is_enb = nr_rlc_manager_get_enb_flag(nr_rlc_ue_manager); + int is_gnb = nr_rlc_manager_get_gnb_flag(nr_rlc_ue_manager); /* used fields? */ ctx.module_id = 0; /* CU (PDCP, RRC, SDAP) use a different ID than RNTI, so below set the CU UE * ID if in gNB, else use RNTI normally */ ctx.rntiMaybeUEid = ue->ue_id; - if (is_enb) { + if (is_gnb) { f1_ue_data_t ue_data = du_get_f1_ue_data(ue->ue_id); ctx.rntiMaybeUEid = ue_data.secondary_ue; } - ctx.enb_flag = is_enb; + ctx.enb_flag = is_gnb; - if (is_enb) { + if (is_gnb) { T(T_ENB_RLC_UL, T_INT(0 /*ctxt_pP->module_id*/), T_INT(ue->ue_id), T_INT(rb_id), T_INT(size)); @@ -465,7 +466,6 @@ static void successful_delivery(void *_ue, nr_rlc_entity_t *entity, int sdu_id) #if 0 MessageDef *msg; #endif - int is_enb; /* is it SRB? */ for (i = 0; i < 2; i++) { @@ -498,8 +498,8 @@ rb_found: if (is_srb == 0) return; - is_enb = nr_rlc_manager_get_enb_flag(nr_rlc_ue_manager); - if (!is_enb) + int is_gnb = nr_rlc_manager_get_gnb_flag(nr_rlc_ue_manager); + if (!is_gnb) return; #if 0 diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h index 7f8c7c9ee2..700a29d702 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.h @@ -41,6 +41,7 @@ struct NR_RLC_Config; struct NR_LogicalChannelConfig; +int nr_rlc_module_init(int gnb_flag); void nr_mac_rlc_data_ind(const module_id_t module_idP, const uint16_t ue_id, const bool gnb_flagP, diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.c b/openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.c index 0ae270ae0f..52e0f6a6b8 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.c @@ -31,10 +31,10 @@ typedef struct { pthread_mutex_t lock; nr_rlc_ue_t **ue_list; int ue_count; - int enb_flag; + int gnb_flag; } nr_rlc_ue_manager_internal_t; -nr_rlc_ue_manager_t *new_nr_rlc_ue_manager(int enb_flag) +nr_rlc_ue_manager_t *new_nr_rlc_ue_manager(int gnb_flag) { nr_rlc_ue_manager_internal_t *ret; @@ -45,15 +45,15 @@ nr_rlc_ue_manager_t *new_nr_rlc_ue_manager(int enb_flag) } if (pthread_mutex_init(&ret->lock, NULL)) abort(); - ret->enb_flag = enb_flag; + ret->gnb_flag = gnb_flag; return ret; } -int nr_rlc_manager_get_enb_flag(nr_rlc_ue_manager_t *_m) +int nr_rlc_manager_get_gnb_flag(nr_rlc_ue_manager_t *_m) { nr_rlc_ue_manager_internal_t *m = _m; - return m->enb_flag; + return m->gnb_flag; } void nr_rlc_manager_lock(nr_rlc_ue_manager_t *_m) diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.h b/openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.h index 13f5c55a2f..799d7afca8 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.h +++ b/openair2/LAYER2/nr_rlc/nr_rlc_ue_manager.h @@ -52,9 +52,9 @@ typedef struct nr_rlc_ue_t { /* manager functions */ /***********************************************************************/ -nr_rlc_ue_manager_t *new_nr_rlc_ue_manager(int enb_flag); +nr_rlc_ue_manager_t *new_nr_rlc_ue_manager(int gnb_flag); -int nr_rlc_manager_get_enb_flag(nr_rlc_ue_manager_t *m); +int nr_rlc_manager_get_gnb_flag(nr_rlc_ue_manager_t *m); void nr_rlc_manager_lock(nr_rlc_ue_manager_t *m); void nr_rlc_manager_unlock(nr_rlc_ue_manager_t *m); From c8e5fcc58530b232ba81e762afb319084bf5c0c2 Mon Sep 17 00:00:00 2001 From: francescomani Date: Tue, 25 Mar 2025 10:23:12 +0100 Subject: [PATCH 10/57] minor formatting --- openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c | 26 ++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c index eefa0f9e37..4b7202f6fd 100644 --- a/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c +++ b/openair2/LAYER2/nr_rlc/nr_rlc_oai_api.c @@ -423,22 +423,22 @@ rb_found: if (NODE_IS_DU(type)) { if(is_srb) { - MessageDef *msg; - msg = itti_alloc_new_message(TASK_RLC_ENB, 0, F1AP_UL_RRC_MESSAGE); - uint8_t *message_buffer = itti_malloc (TASK_RLC_ENB, TASK_DU_F1, size); - memcpy (message_buffer, buf, size); + MessageDef *msg; + msg = itti_alloc_new_message(TASK_RLC_ENB, 0, F1AP_UL_RRC_MESSAGE); + uint8_t *message_buffer = itti_malloc (TASK_RLC_ENB, TASK_DU_F1, size); + memcpy (message_buffer, buf, size); F1AP_UL_RRC_MESSAGE(msg).gNB_CU_ue_id = ctx.rntiMaybeUEid; - F1AP_UL_RRC_MESSAGE(msg).gNB_DU_ue_id = ue->ue_id; - F1AP_UL_RRC_MESSAGE(msg).srb_id = rb_id; - F1AP_UL_RRC_MESSAGE(msg).rrc_container = message_buffer; - F1AP_UL_RRC_MESSAGE(msg).rrc_container_length = size; - itti_send_msg_to_task(TASK_DU_F1, ENB_MODULE_ID_TO_INSTANCE(0 /*ctxt_pP->module_id*/), msg); - return; + F1AP_UL_RRC_MESSAGE(msg).gNB_DU_ue_id = ue->ue_id; + F1AP_UL_RRC_MESSAGE(msg).srb_id = rb_id; + F1AP_UL_RRC_MESSAGE(msg).rrc_container = message_buffer; + F1AP_UL_RRC_MESSAGE(msg).rrc_container_length = size; + itti_send_msg_to_task(TASK_DU_F1, ENB_MODULE_ID_TO_INSTANCE(0 /*ctxt_pP->module_id*/), msg); + return; } else { - LOG_D(RLC, "Received uplink user-plane traffic at RLC-DU to be sent to the CU, size %d \n", size); - extern instance_t DUuniqInstance; + LOG_D(RLC, "Received uplink user-plane traffic at RLC-DU to be sent to the CU, size %d \n", size); + extern instance_t DUuniqInstance; gtpv1uSendDirect(DUuniqInstance, ue->ue_id, rb_id, (uint8_t*) buf, size, false, false); - return; + return; } } } From 4fef7e9cca12f53ac21b9786ce60f81c05829b7f Mon Sep 17 00:00:00 2001 From: rmagueta Date: Tue, 25 Mar 2025 19:01:44 +0000 Subject: [PATCH 11/57] Configure sched_ctrlCommon earlier, in nr_mac_config_scc --- openair2/LAYER2/NR_MAC_gNB/config.c | 49 +++++++++++++++++++ .../LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 22 +-------- 2 files changed, 50 insertions(+), 21 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index 2d6ae1ba75..971288df1b 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -769,6 +769,52 @@ static void initialize_beam_information(NR_beam_info_t *beam_info, int mu, int s } } +static void config_sched_ctrlCommon(gNB_MAC_INST *nr_mac) +{ + const NR_MIB_t *mib = nr_mac->common_channels[0].mib->message.choice.mib; + NR_ServingCellConfigCommon_t *scc = nr_mac->common_channels[0].ServingCellConfigCommon; + + NR_UE_sched_ctrl_t *sched_ctrlCommon = calloc_or_fail(1, sizeof(*sched_ctrlCommon)); + nr_mac->sched_ctrlCommon = sched_ctrlCommon; + sched_ctrlCommon->search_space = calloc_or_fail(1, sizeof(*sched_ctrlCommon->search_space)); + sched_ctrlCommon->coreset = calloc_or_fail(1, sizeof(*sched_ctrlCommon->coreset)); + + NR_SubcarrierSpacing_t scs = *scc->ssbSubcarrierSpacing; + const long band = *scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]; + uint16_t ssb_start_symbol = get_ssb_start_symbol(band, scs, 0); + + int8_t ssb_period = *scc->ssb_periodicityServingCell; + uint8_t ssb_frame_periodicity = 1; + if (ssb_period > 1) + ssb_frame_periodicity = 1 << (ssb_period - 1); + + const int8_t numb_slots_frame = nr_mac->frame_structure.numb_slots_frame; + frequency_range_t frequency_range = scc->ssb_PositionsInBurst->present == 3 ? FR2 : FR1; + const int prb_offset = frequency_range == FR1 ? nr_mac->ssb_OffsetPointA >> scs : nr_mac->ssb_OffsetPointA >> (scs - 2); + + NR_Type0_PDCCH_CSS_config_t type0_PDCCH_CSS_config = {0}; + get_type0_PDCCH_CSS_config_parameters(&type0_PDCCH_CSS_config, + 0, + mib, + numb_slots_frame, + nr_mac->ssb_SubcarrierOffset, + ssb_start_symbol, + scs, + frequency_range, + band, + 0, + ssb_frame_periodicity, + prb_offset); + + fill_searchSpaceZero(sched_ctrlCommon->search_space, numb_slots_frame, &type0_PDCCH_CSS_config); + + fill_coresetZero(sched_ctrlCommon->coreset, &type0_PDCCH_CSS_config); + nr_mac->cset0_bwp_start = type0_PDCCH_CSS_config.cset_start_rb; + nr_mac->cset0_bwp_size = type0_PDCCH_CSS_config.num_rbs; + sched_ctrlCommon->sched_pdcch = + set_pdcch_structure(NULL, sched_ctrlCommon->search_space, sched_ctrlCommon->coreset, scc, NULL, &type0_PDCCH_CSS_config); +} + void nr_mac_config_scc(gNB_MAC_INST *nrmac, NR_ServingCellConfigCommon_t *scc, const nr_mac_config_t *config) { DevAssert(nrmac != NULL); @@ -822,6 +868,9 @@ void nr_mac_config_scc(gNB_MAC_INST *nrmac, NR_ServingCellConfigCommon_t *scc, c nr_fill_sched_osi(nrmac, scc->downlinkConfigCommon->initialDownlinkBWP->pdcch_ConfigCommon); NR_SCHED_UNLOCK(&nrmac->sched_lock); + + if (IS_SA_MODE(get_softmodem_params())) + config_sched_ctrlCommon(nrmac); } void nr_fill_sched_osi(gNB_MAC_INST *nrmac, const struct NR_SetupRelease_PDCCH_ConfigCommon *pdcch_ConfigCommon) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index 9e1df9bb1d..32647cbe65 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -354,29 +354,9 @@ static uint32_t schedule_control_sib1(module_id_t module_id, uint16_t num_total_bytes) { gNB_MAC_INST *gNB_mac = RC.nrmac[module_id]; + AssertFatal(gNB_mac->sched_ctrlCommon, "sched_ctrlCommon is NULL\n"); NR_COMMON_channels_t *cc = &gNB_mac->common_channels[CC_id]; - NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon; uint16_t *vrb_map = cc->vrb_map[beam]; - - if (gNB_mac->sched_ctrlCommon == NULL){ - LOG_D(NR_MAC,"schedule_control_common: Filling nr_mac->sched_ctrlCommon\n"); - gNB_mac->sched_ctrlCommon = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon)); - gNB_mac->sched_ctrlCommon->search_space = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->search_space)); - gNB_mac->sched_ctrlCommon->coreset = calloc(1,sizeof(*gNB_mac->sched_ctrlCommon->coreset)); - fill_searchSpaceZero(gNB_mac->sched_ctrlCommon->search_space, - gNB_mac->frame_structure.numb_slots_frame, - type0_PDCCH_CSS_config); - fill_coresetZero(gNB_mac->sched_ctrlCommon->coreset, type0_PDCCH_CSS_config); - gNB_mac->cset0_bwp_start = type0_PDCCH_CSS_config->cset_start_rb; - gNB_mac->cset0_bwp_size = type0_PDCCH_CSS_config->num_rbs; - gNB_mac->sched_ctrlCommon->sched_pdcch = set_pdcch_structure(NULL, - gNB_mac->sched_ctrlCommon->search_space, - gNB_mac->sched_ctrlCommon->coreset, - scc, - NULL, - type0_PDCCH_CSS_config); - } - NR_sched_pdsch_t *pdsch = &gNB_mac->sched_ctrlCommon->sched_pdsch; pdsch->time_domain_allocation = time_domain_allocation; pdsch->dmrs_parms = *dmrs_parms; From ebde2f369810b61288ca5c115f2c38f074300661 Mon Sep 17 00:00:00 2001 From: robert Date: Thu, 11 Jul 2024 16:06:33 +0200 Subject: [PATCH 12/57] fix(oran_fhlib_5g): Build error due to SIMDE header for Neon MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove include of SIMDE Neon header sse_intrinsic.h to compile on ARM. Otherwise the error below is issued. ``` /usr/include/simde/arm/neon/get_lane.h:279:5: error: incompatible type for argument 1 of ‘vget_lane_f16’ 279 | SIMDE_CONSTIFY_8_(vget_lane_f16, r, (HEDLEY_UNREACHABLE(), SIMDE_FLOAT16_VALUE(0.0)), lane, v); removed the inclusion of neon.h ``` --- openair1/PHY/sse_intrin.h | 1 - 1 file changed, 1 deletion(-) diff --git a/openair1/PHY/sse_intrin.h b/openair1/PHY/sse_intrin.h index d6c3157ce8..25337d557a 100644 --- a/openair1/PHY/sse_intrin.h +++ b/openair1/PHY/sse_intrin.h @@ -65,7 +65,6 @@ // /usr/lib/gcc/x86_64-redhat-linux/8/include/gfniintrin.h:57:1: error: inlining failed in call to always_inline ‘_mm_gf2p8affine_epi64_epi8’: target specific option mismatch #include -#include #endif // x86_64 || i386 #include #include "assertions.h" From a0f16e7e83f8d3cf3928ad118b4999ad22cd5b08 Mon Sep 17 00:00:00 2001 From: brobert Date: Sat, 27 Jul 2024 11:53:03 +0200 Subject: [PATCH 13/57] fix(oran_fhlib_5g): Do not include immintrin.h for Arm targets Remove include of immintrin.h in radio/fhi_72/oaioran.c when compiling for a Arm target. --- radio/fhi_72/oaioran.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/radio/fhi_72/oaioran.c b/radio/fhi_72/oaioran.c index cbc530a785..afa6384741 100644 --- a/radio/fhi_72/oaioran.c +++ b/radio/fhi_72/oaioran.c @@ -25,8 +25,11 @@ #include "xran_fh_o_du.h" #include "xran_compression.h" +#if defined(__arm__) || defined(__aarch64__) +#else // xran_cp_api.h uses SIMD, but does not include it #include +#endif #include "xran_cp_api.h" #include "xran_sync_api.h" #include "oran_isolate.h" From db27b09b7cfb2bc1b3da88c4d6ebbf6eeb5a5388 Mon Sep 17 00:00:00 2001 From: brobert Date: Mon, 29 Jul 2024 10:00:34 +0200 Subject: [PATCH 14/57] enabling ARM and INTEL memory alignment --- radio/fhi_72/oran-init.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/radio/fhi_72/oran-init.c b/radio/fhi_72/oran-init.c index fd3fdaa5bf..38e766805a 100644 --- a/radio/fhi_72/oran-init.c +++ b/radio/fhi_72/oran-init.c @@ -306,7 +306,14 @@ static void oran_allocate_buffers(void *handle, uint32_t xran_max_antenna_nr = RTE_MAX(fh_config->neAxc, fh_config->neAxcUl); uint32_t xran_max_sections_per_slot = RTE_MAX(fh_config->max_sections_per_slot, XRAN_MIN_SECTIONS_PER_SLOT); - pi->buf_list = _mm_malloc(sizeof(*pi->buf_list), 256); +#if defined(__arm__) || defined(__aarch64__) + // ARM-specific memory allocation + int ret = posix_memalign((void**)&pi->buf_list, 256, sizeof(*pi->buf_list)); + AssertFatal(ret == 0, "out of memory\n"); +#else + // Intel-specific memory allocation + pi->buf_list = _mm_malloc(sizeof(*pi->buf_list), 256); +#endif AssertFatal(pi->buf_list != NULL, "out of memory\n"); oran_buf_list_t *bl = pi->buf_list; From 047e80f070e567674d233831cdc3e8b0d69def5d Mon Sep 17 00:00:00 2001 From: Romain Beurdouche Date: Thu, 27 Mar 2025 15:09:59 +0000 Subject: [PATCH 15/57] feat(oran_fhlib_5g): Make E release patch dual Update the xran E release patch to work for Arm targets in addition to x86 targets. Co-authored-by: Yi-Hung Chang Co-authored-by: brobert --- .../E/oaioran_E.patch | 872 +++++++++++++++++- radio/fhi_72/CMakeLists.txt | 4 +- 2 files changed, 838 insertions(+), 38 deletions(-) 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 index e1915cd996..baa5378673 100644 --- a/cmake_targets/tools/oran_fhi_integration_patches/E/oaioran_E.patch +++ b/cmake_targets/tools/oran_fhi_integration_patches/E/oaioran_E.patch @@ -7,20 +7,24 @@ index 7508117..ce17ebd 100644 #include -#define VERSIONX "oran_e_maintenance_release_v1.0" -+#define VERSIONX "oran_e_maintenance_release_v1.4" ++#define VERSIONX "oran_e_maintenance_release_v1.5" #define APP_O_DU 0 #define APP_O_RU 1 diff --git a/fhi_lib/lib/Makefile b/fhi_lib/lib/Makefile -index de141bf..c12b912 100644 +index de141bf..fa2923f 100644 --- a/fhi_lib/lib/Makefile +++ b/fhi_lib/lib/Makefile -@@ -23,11 +23,11 @@ MYCUSTOMSPACE1='------------------------------------------------------------' +@@ -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 @@ -28,53 +32,99 @@ index de141bf..c12b912 100644 -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) -@@ -57,7 +57,7 @@ endif + 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 pkgconf --cflags-only-I libdpdk) ++else ifeq ($(TARGET), armv8) ++RTE_INC := $(pkgconf --cflags-only-I libdpdk) ++endif API_DIR := $(PROJECT_DIR)/api SRC_DIR := $(PROJECT_DIR)/src ETH_DIR := $(PROJECT_DIR)/ethernet -@@ -95,8 +95,7 @@ CPP_SRC = $(SRC_DIR)/xran_compression.cpp \ +@@ -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 \ -@@ -112,12 +111,12 @@ CC_FLAGS += -std=gnu11 -Wall -Wno-deprecated-declarations \ + $(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,12 +132,21 @@ CC_FLAGS += -std=gnu11 -Wall -Wno-deprecated-declarations \ -fPIC \ -Wall \ -Wimplicit-function-declaration \ - -g -O3 -wd1786 -mcmodel=large -+ -g -O -mavx512bw -march=skylake-avx512 -mtune=skylake-avx512#--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) DEF := -@@ -150,8 +149,8 @@ CPP_SNC_OBJTARGETS := $(addprefix $(PROJECT_OBJ_DIR)/,$(CPP_OBJS_SNC)) +@@ -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) @@ -113,6 +163,36 @@ index 7419ae1..a85f973 100644 /** * @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 @@ -136,10 +216,21 @@ index 7d3afc5..e2f1f21 100644 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..1618f65 100644 +index b6ba257..07b7a38 100644 --- a/fhi_lib/lib/ethernet/ethdi.c +++ b/fhi_lib/lib/ethernet/ethdi.c -@@ -326,8 +326,8 @@ xran_ethdi_init_dpdk_io(char *name, const struct xran_io_cfg *io_cfg, +@@ -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"; @@ -150,7 +241,7 @@ index b6ba257..1618f65 100644 char ring_name[32] = ""; int32_t xran_port = -1; portid_t port_id; -@@ -335,6 +335,7 @@ xran_ethdi_init_dpdk_io(char *name, const struct xran_io_cfg *io_cfg, +@@ -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", @@ -158,7 +249,7 @@ index b6ba257..1618f65 100644 "--file-prefix", name, "-a0000:00:00.0", bbdev_wdev, bbdev_vdev}; -@@ -479,11 +480,13 @@ xran_ethdi_init_dpdk_io(char *name, const struct xran_io_cfg *io_cfg, +@@ -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"); @@ -172,7 +263,7 @@ index b6ba257..1618f65 100644 } } } else { -@@ -553,7 +556,7 @@ xran_ethdi_init_dpdk_io(char *name, const struct xran_io_cfg *io_cfg, +@@ -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"); @@ -181,6 +272,36 @@ index b6ba257..1618f65 100644 } 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 @@ -224,11 +345,37 @@ index a345df4..2a94e01 100644 /// 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..00bfdf2 100644 +index baa673f..7bdc475 100644 --- a/fhi_lib/lib/src/xran_common.c +++ b/fhi_lib/lib/src/xran_common.c -@@ -650,12 +650,15 @@ process_mbuf(struct rte_mbuf *pkt, void* handle, struct xran_eaxc_info *p_cid) +@@ -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; @@ -244,7 +391,7 @@ index baa673f..00bfdf2 100644 if (staticComp == XRAN_COMP_HDR_TYPE_STATIC) { -@@ -674,6 +677,7 @@ process_mbuf(struct rte_mbuf *pkt, void* handle, struct xran_eaxc_info *p_cid) +@@ -674,6 +680,7 @@ process_mbuf(struct rte_mbuf *pkt, void* handle, struct xran_eaxc_info *p_cid) &subframe_id, &slot_id, &symb_id, @@ -252,7 +399,7 @@ index baa673f..00bfdf2 100644 &seq, &num_prbu, &start_prbu, -@@ -683,28 +687,15 @@ process_mbuf(struct rte_mbuf *pkt, void* handle, struct xran_eaxc_info *p_cid) +@@ -683,28 +690,15 @@ process_mbuf(struct rte_mbuf *pkt, void* handle, struct xran_eaxc_info *p_cid) expect_comp, staticComp, &compMeth, @@ -286,7 +433,7 @@ index baa673f..00bfdf2 100644 #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 +747,7 @@ process_mbuf(struct rte_mbuf *pkt, void* handle, struct xran_eaxc_info *p_cid) +@@ -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"); } @@ -295,7 +442,7 @@ index baa673f..00bfdf2 100644 /* 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 +1180,7 @@ int generate_cpmsg_prach(void *pHandle, struct xran_cp_gen_params *params, struc +@@ -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 @@ -304,7 +451,7 @@ index baa673f..00bfdf2 100644 timeOffset += 16; params->dir = XRAN_DIR_UL; -@@ -1295,8 +1286,7 @@ int32_t ring_processing_func(void* args) +@@ -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++) { @@ -367,11 +514,159 @@ index 112caae..7c74342 100644 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..640f6b6 100644 +index 89dcc1f..ded4116 100644 --- a/fhi_lib/lib/src/xran_main.c +++ b/fhi_lib/lib/src/xran_main.c -@@ -272,7 +272,7 @@ xran_init_prach(struct xran_fh_config* pConf, struct xran_device_ctx * p_xran_de +@@ -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]); } @@ -380,7 +675,7 @@ index 89dcc1f..640f6b6 100644 print_dbg("PRACH eAxC_offset %d\n", pPrachCPConfig->eAxC_offset); /* Save some configs for app */ -@@ -844,7 +844,7 @@ tx_cp_ul_cb(struct rte_timer *tim, void *arg) +@@ -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(); @@ -389,7 +684,7 @@ index 89dcc1f..640f6b6 100644 /* start new section information list */ xran_cp_reset_section_info(pHandle, XRAN_DIR_UL, cc_id, prach_port_id, ctx_id); -@@ -1059,6 +1059,7 @@ int32_t handle_ecpri_ethertype(struct rte_mbuf* pkt_q[], uint16_t xport_id, stru +@@ -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; @@ -397,7 +692,7 @@ index 89dcc1f..640f6b6 100644 break; // For RU emulation case ECPRI_RT_CONTROL_DATA: -@@ -1076,7 +1077,7 @@ int32_t handle_ecpri_ethertype(struct rte_mbuf* pkt_q[], uint16_t xport_id, stru +@@ -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) { @@ -406,7 +701,17 @@ index 89dcc1f..640f6b6 100644 } break; } -@@ -1771,8 +1772,7 @@ ring_processing_func_per_port(void* args) +@@ -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++){ @@ -416,7 +721,7 @@ index 89dcc1f..640f6b6 100644 } } } -@@ -1837,8 +1837,6 @@ xran_spawn_workers(void) +@@ -1837,8 +1859,6 @@ xran_spawn_workers(void) nWorkerCore = nWorkerCore << 1; } @@ -425,7 +730,385 @@ index 89dcc1f..640f6b6 100644 printf("O-XU %d\n", eth_ctx->io_cfg.id); printf("HW %d\n", icx_cpu); -@@ -3074,6 +3072,24 @@ xran_get_slot_idx (uint32_t PortId, uint32_t *nFrameIdx, uint32_t *nSubframeIdx, +@@ -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; } @@ -450,6 +1133,22 @@ index 89dcc1f..640f6b6 100644 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 @@ -469,10 +1168,22 @@ index 7d4a5d0..87bdbd5 100644 } diff --git a/fhi_lib/lib/src/xran_rx_proc.c b/fhi_lib/lib/src/xran_rx_proc.c -index 36bd72c..f7f5678 100644 +index 36bd72c..4d57898 100644 --- a/fhi_lib/lib/src/xran_rx_proc.c +++ b/fhi_lib/lib/src/xran_rx_proc.c -@@ -107,6 +107,10 @@ int xran_process_prach_sym(void *arg, +@@ -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); @@ -483,11 +1194,100 @@ index 36bd72c..f7f5678 100644 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..8977e3d 100644 +index 397853a..14266de 100644 --- a/fhi_lib/lib/src/xran_up_api.c +++ b/fhi_lib/lib/src/xran_up_api.c -@@ -329,6 +329,7 @@ int32_t xran_extract_iq_samples(struct rte_mbuf *mbuf, +@@ -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, @@ -495,7 +1295,7 @@ index 397853a..8977e3d 100644 union ecpri_seq_id *seq_id, uint16_t *num_prbu, uint16_t *start_prbu, -@@ -338,7 +339,8 @@ int32_t xran_extract_iq_samples(struct rte_mbuf *mbuf, +@@ -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, @@ -505,7 +1305,7 @@ index 397853a..8977e3d 100644 { #if XRAN_MLOG_VAR uint32_t mlogVar[10]; -@@ -374,6 +376,8 @@ int32_t xran_extract_iq_samples(struct rte_mbuf *mbuf, +@@ -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); @@ -514,7 +1314,7 @@ index 397853a..8977e3d 100644 if (frame_id) *frame_id = radio_hdr->frame_id; -@@ -387,6 +391,8 @@ int32_t xran_extract_iq_samples(struct rte_mbuf *mbuf, +@@ -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; @@ -523,7 +1323,7 @@ index 397853a..8977e3d 100644 /* Process data section hdr */ struct data_section_hdr *data_hdr = (void *)rte_pktmbuf_adj(mbuf, sizeof(*radio_hdr)); -@@ -401,6 +407,7 @@ int32_t xran_extract_iq_samples(struct rte_mbuf *mbuf, +@@ -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; diff --git a/radio/fhi_72/CMakeLists.txt b/radio/fhi_72/CMakeLists.txt index 8b047a9316..4a9064e661 100644 --- a/radio/fhi_72/CMakeLists.txt +++ b/radio/fhi_72/CMakeLists.txt @@ -17,12 +17,12 @@ add_library(oran_fhlib_5g MODULE ) find_package(xran REQUIRED) -if(xran_VERSION VERSION_EQUAL 5.1.4) +if(xran_VERSION VERSION_EQUAL 5.1.5) target_compile_definitions(oran_fhlib_5g PRIVATE E_RELEASE) elseif(xran_VERSION VERSION_EQUAL 6.1.1) target_compile_definitions(oran_fhlib_5g PRIVATE F_RELEASE) else() - message(FATAL_ERROR "Found xran version ${xran_VERSION} but needed 5.1.4 (E release) or 6.1.1 (F release)") + message(FATAL_ERROR "Found xran version ${xran_VERSION} but needed 5.1.5 (E release) or 6.1.1 (F release)") endif() # Ignore xran-specific warning: we don't care/can't change the following warning, so suppress From e9be8bc233af34d5a5d70bf3d59c212b9db9b0df Mon Sep 17 00:00:00 2001 From: Teodora Date: Fri, 14 Mar 2025 15:42:19 +0100 Subject: [PATCH 16/57] Use the enum struct for RRC State defined in FlexRIC --- openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.c | 10 +++++----- openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc_extern.h | 4 ++-- openair2/RRC/NR/rrc_gNB_NGAP.c | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.c b/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.c index 908107c891..271eeda3a4 100644 --- a/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.c +++ b/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.c @@ -476,7 +476,7 @@ void read_rc_setup_sm(void* data) DevAssert(ret == 0); } -static seq_ran_param_t fill_rrc_state_change_seq_ran(const rc_sm_rrc_state_e rrc_state) +static seq_ran_param_t fill_rrc_state_change_seq_ran(const rrc_state_e2sm_rc_e rrc_state) { seq_ran_param_t seq_ran_param = {0}; @@ -490,7 +490,7 @@ static seq_ran_param_t fill_rrc_state_change_seq_ran(const rc_sm_rrc_state_e rrc return seq_ran_param; } -static rc_ind_data_t* fill_ue_rrc_state_change(const gNB_RRC_UE_t *rrc_ue_context, const rc_sm_rrc_state_e rrc_state) +static rc_ind_data_t* fill_ue_rrc_state_change(const gNB_RRC_UE_t *rrc_ue_context, const rrc_state_e2sm_rc_e rrc_state) { rc_ind_data_t* rc_ind = calloc(1, sizeof(rc_ind_data_t)); assert(rc_ind != NULL && "Memory exhausted"); @@ -531,13 +531,13 @@ static void send_aper_ric_ind(const uint32_t ric_req_id, rc_ind_data_t* rc_ind_d printf("[E2 AGENT] Event for RIC request ID %d generated\n", ric_req_id); } -static void check_rrc_state(const gNB_RRC_UE_t *rrc_ue_context, const rc_sm_rrc_state_e rrc_state, const uint32_t ric_req_id, const e2sm_rc_ev_trg_frmt_4_t *frmt_4) +static void check_rrc_state(const gNB_RRC_UE_t *rrc_ue_context, const rrc_state_e2sm_rc_e rrc_state, const uint32_t ric_req_id, const e2sm_rc_ev_trg_frmt_4_t *frmt_4) { for (size_t i = 0; i < frmt_4->sz_ue_info_chng; i++) { const rrc_state_lst_t *rrc_elem = &frmt_4->ue_info_chng[i].rrc_state; for (size_t j = 0; j < rrc_elem->sz_rrc_state; j++) { const rrc_state_e2sm_rc_e ev_tr_rrc_state = rrc_elem->state_chng_to[j].state_chngd_to; - if (ev_tr_rrc_state == (rrc_state_e2sm_rc_e)rrc_state || ev_tr_rrc_state == ANY_RRC_STATE_E2SM_RC) { + if (ev_tr_rrc_state == rrc_state || ev_tr_rrc_state == ANY_RRC_STATE_E2SM_RC) { rc_ind_data_t* rc_ind_data = fill_ue_rrc_state_change(rrc_ue_context, rrc_state); send_aper_ric_ind(ric_req_id, rc_ind_data); } @@ -545,7 +545,7 @@ static void check_rrc_state(const gNB_RRC_UE_t *rrc_ue_context, const rc_sm_rrc_ } } -void signal_rrc_state_changed_to(const gNB_RRC_UE_t *rrc_ue_context, const rc_sm_rrc_state_e rrc_state) +void signal_rrc_state_changed_to(const gNB_RRC_UE_t *rrc_ue_context, const rrc_state_e2sm_rc_e rrc_state) { pthread_mutex_lock(&rc_mutex); if (rc_subs_data.rs4_param202.data == NULL) { diff --git a/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc_extern.h b/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc_extern.h index bd7f6e8bda..5f9633453b 100644 --- a/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc_extern.h +++ b/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc_extern.h @@ -23,8 +23,8 @@ #define RAN_FUNC_SM_RAN_CTRL_EXTERN_AGENT_H #include "openair2/RRC/NR/nr_rrc_defs.h" +#include "openair2/E2AP/flexric/src/sm/rc_sm/ie/ir/rrc_state.h" -typedef enum { RC_SM_RRC_CONNECTED, RC_SM_RRC_INACTIVE, RC_SM_RRC_IDLE, RC_SM_RRC_ANY } rc_sm_rrc_state_e; -void signal_rrc_state_changed_to(const gNB_RRC_UE_t *rrc_ue_context, const rc_sm_rrc_state_e rrc_state); +void signal_rrc_state_changed_to(const gNB_RRC_UE_t *rrc_ue_context, const rrc_state_e2sm_rc_e rrc_state); #endif diff --git a/openair2/RRC/NR/rrc_gNB_NGAP.c b/openair2/RRC/NR/rrc_gNB_NGAP.c index c1715c438c..999c716c8c 100644 --- a/openair2/RRC/NR/rrc_gNB_NGAP.c +++ b/openair2/RRC/NR/rrc_gNB_NGAP.c @@ -551,7 +551,7 @@ int rrc_gNB_process_NGAP_INITIAL_CONTEXT_SETUP_REQ(MessageDef *msg_p, instance_t } #ifdef E2_AGENT - signal_rrc_state_changed_to(UE, RC_SM_RRC_CONNECTED); + signal_rrc_state_changed_to(UE, RRC_CONNECTED_RRC_STATE_E2SM_RC); #endif return 0; @@ -1210,7 +1210,7 @@ int rrc_gNB_process_NGAP_UE_CONTEXT_RELEASE_COMMAND(MessageDef *msg_p, instance_ gNB_RRC_UE_t *UE = &ue_context_p->ue_context; UE->an_release = true; #ifdef E2_AGENT - signal_rrc_state_changed_to(UE, RC_SM_RRC_IDLE); + signal_rrc_state_changed_to(UE, RRC_IDLE_RRC_STATE_E2SM_RC); #endif /* a UE might not be associated to a CU-UP if it never requested a PDU From bf6012084cf554885b2e2beb0a43235a896d5cbf Mon Sep 17 00:00:00 2001 From: Teodora Date: Tue, 11 Mar 2025 14:04:14 +0100 Subject: [PATCH 17/57] Fill Event Trigger Condition ID in the Indication Header - it is optional, but xApp must somehow know for which trigger event an E2 node sent the Indication Message --- openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.c b/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.c index 271eeda3a4..90421197d1 100644 --- a/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.c +++ b/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.c @@ -490,14 +490,15 @@ static seq_ran_param_t fill_rrc_state_change_seq_ran(const rrc_state_e2sm_rc_e r return seq_ran_param; } -static rc_ind_data_t* fill_ue_rrc_state_change(const gNB_RRC_UE_t *rrc_ue_context, const rrc_state_e2sm_rc_e rrc_state) +static rc_ind_data_t* fill_ue_rrc_state_change(const gNB_RRC_UE_t *rrc_ue_context, const rrc_state_e2sm_rc_e rrc_state, const uint16_t cond_id) { rc_ind_data_t* rc_ind = calloc(1, sizeof(rc_ind_data_t)); assert(rc_ind != NULL && "Memory exhausted"); // Generate Indication Header rc_ind->hdr.format = FORMAT_1_E2SM_RC_IND_HDR; - rc_ind->hdr.frmt_1.ev_trigger_id = NULL; + rc_ind->hdr.frmt_1.ev_trigger_id = malloc_or_fail(sizeof(uint32_t)); + *rc_ind->hdr.frmt_1.ev_trigger_id = cond_id; // Generate Indication Message rc_ind->msg.format = FORMAT_2_E2SM_RC_IND_MSG; @@ -534,11 +535,12 @@ static void send_aper_ric_ind(const uint32_t ric_req_id, rc_ind_data_t* rc_ind_d static void check_rrc_state(const gNB_RRC_UE_t *rrc_ue_context, const rrc_state_e2sm_rc_e rrc_state, const uint32_t ric_req_id, const e2sm_rc_ev_trg_frmt_4_t *frmt_4) { for (size_t i = 0; i < frmt_4->sz_ue_info_chng; i++) { + const uint16_t cond_id = frmt_4->ue_info_chng[i].ev_trig_cond_id; const rrc_state_lst_t *rrc_elem = &frmt_4->ue_info_chng[i].rrc_state; for (size_t j = 0; j < rrc_elem->sz_rrc_state; j++) { const rrc_state_e2sm_rc_e ev_tr_rrc_state = rrc_elem->state_chng_to[j].state_chngd_to; if (ev_tr_rrc_state == rrc_state || ev_tr_rrc_state == ANY_RRC_STATE_E2SM_RC) { - rc_ind_data_t* rc_ind_data = fill_ue_rrc_state_change(rrc_ue_context, rrc_state); + rc_ind_data_t* rc_ind_data = fill_ue_rrc_state_change(rrc_ue_context, rrc_state, cond_id); send_aper_ric_ind(ric_req_id, rc_ind_data); } } From e6797a0b0e80eba13d51e738e4fa90df9f763b32 Mon Sep 17 00:00:00 2001 From: Theodoros Tsourdinis Date: Fri, 14 Mar 2025 19:20:41 +0100 Subject: [PATCH 18/57] Prepare RAN Control to support multiple REPORT Styles The REPORT service was hardcoded to only style 4, and therefore not easily extendable. This commit moves the support for style 4 in a separate function. Delete duplicated enum structs for RAN Parameter IDs for all the REPORT styles. They are already defined in "openair2/E2AP/flexric/src/sm/rc_sm/ie/rc_data_ie.h". Co-authored-by: Tano Bischoff Co-authored-by: Khanh Toan Pham Co-authored-by: Shrinish Donde Co-authored-by: Miguel Fuentes Co-authored-by: Teodora Vladic --- .../E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.c | 176 +++++++++--------- .../RAN_FUNCTION/O-RAN/ran_func_rc_subs.h | 54 ------ 2 files changed, 85 insertions(+), 145 deletions(-) diff --git a/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.c b/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.c index 90421197d1..99b03f2583 100644 --- a/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.c +++ b/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.c @@ -53,6 +53,28 @@ static void init_once_rc(void) init_rc_subs_data(&rc_subs_data); } +static seq_ev_trg_style_t fill_ev_tr_format_4(const char *ev_style_name) +{ + seq_ev_trg_style_t ev_trig_style = {0}; + + // RIC Event Trigger Style Type + // Mandatory + // 9.3.3 + ev_trig_style.style = 4; + + // RIC Event Trigger Style Name + // Mandatory + // 9.3.4 + ev_trig_style.name = cp_str_to_ba(ev_style_name); + + // RIC Event Trigger Format Type + // Mandatory + // 9.3.5 + ev_trig_style.format = FORMAT_4_E2SM_RC_EV_TRIGGER_FORMAT; + + return ev_trig_style; +} + static void fill_rc_ev_trig(ran_func_def_ev_trig_t* ev_trig) { // Sequence of EVENT TRIGGER styles @@ -61,29 +83,7 @@ static void fill_rc_ev_trig(ran_func_def_ev_trig_t* ev_trig) ev_trig->seq_ev_trg_style = calloc(ev_trig->sz_seq_ev_trg_style, sizeof(seq_ev_trg_style_t)); assert(ev_trig->seq_ev_trg_style != NULL && "Memory exhausted"); - seq_ev_trg_style_t* ev_trig_style = &ev_trig->seq_ev_trg_style[0]; - - // RIC Event Trigger Style Type - // Mandatory - // 9.3.3 - // 6.2.2.2. - // INTEGER - ev_trig_style->style = 4; - - // RIC Event Trigger Style Name - // Mandatory - // 9.3.4 - // 6.2.2.3 - //PrintableString(SIZE(1..150,...)) - const char ev_style_name[] = "UE Information Change"; - ev_trig_style->name = cp_str_to_ba(ev_style_name); - - // RIC Event Trigger Format Type - // Mandatory - // 9.3.5 - // 6.2.2.4. - // INTEGER - ev_trig_style->format = FORMAT_4_E2SM_RC_EV_TRIGGER_FORMAT; + ev_trig->seq_ev_trg_style[0] = fill_ev_tr_format_4("UE Information Change"); // Sequence of RAN Parameters for L2 Variables // [0 - 65535] @@ -106,6 +106,67 @@ static void fill_rc_ev_trig(ran_func_def_ev_trig_t* ev_trig) ev_trig->seq_ran_param_id_cell = NULL; } +static seq_report_sty_t fill_report_style_4(const char *report_name) +{ + seq_report_sty_t report_style = {0}; + + // RIC Report Style Type + // Mandatory + // 9.3.3 + report_style.report_type = 4; + + // RIC Report Style Name + // Mandatory + // 9.3.4 + report_style.name = cp_str_to_ba(report_name); + + // Supported RIC Event Trigger Style Type + // Mandatory + // 9.3.3 + report_style.ev_trig_type = FORMAT_4_E2SM_RC_EV_TRIGGER_FORMAT; + + // RIC Report Action Format Type + // Mandatory + // 9.3.5 + report_style.act_frmt_type = FORMAT_1_E2SM_RC_ACT_DEF; + + // RIC Indication Header Format Type + // Mandatory + // 9.3.5 + report_style.ind_hdr_type = FORMAT_1_E2SM_RC_IND_HDR; + + // RIC Indication Message Format Type + // Mandatory + // 9.3.5 + report_style.ind_msg_type = FORMAT_2_E2SM_RC_IND_MSG; + + // Sequence of RAN Parameters Supported + // [0 - 65535] + report_style.sz_seq_ran_param = 1; + report_style.ran_param = calloc(report_style.sz_seq_ran_param, sizeof(seq_ran_param_3_t)); + assert(report_style.ran_param != NULL && "Memory exhausted"); + + // RAN Parameter ID + // Mandatory + // 9.3.8 + // [1- 4294967295] + report_style.ran_param[0].id = E2SM_RC_RS4_RRC_STATE_CHANGED_TO; + + // RAN Parameter Name + // Mandatory + // 9.3.9 + // [1-150] + const char ran_param_name[] = "RRC State Changed To"; + report_style.ran_param[0].name = cp_str_to_ba(ran_param_name); + + // RAN Parameter Definition + // Optional + // 9.3.51 + report_style.ran_param[0].def = NULL; + + return report_style; +} + static void fill_rc_report(ran_func_def_report_t* report) { // Sequence of REPORT styles @@ -114,74 +175,7 @@ static void fill_rc_report(ran_func_def_report_t* report) report->seq_report_sty = calloc(report->sz_seq_report_sty, sizeof(seq_report_sty_t)); assert(report->seq_report_sty != NULL && "Memory exhausted"); - seq_report_sty_t* report_style = &report->seq_report_sty[0]; - - // RIC Report Style Type - // Mandatory - // 9.3.3 - // 6.2.2.2. - // INTEGER - report_style->report_type = 4; - - // RIC Report Style Name - // Mandatory - // 9.3.4 - // 6.2.2.3. - // PrintableString(SIZE(1..150,...)) - const char report_name[] = "UE Information"; - report_style->name = cp_str_to_ba(report_name); - - // Supported RIC Event Trigger Style Type - // Mandatory - // 9.3.3 - // 6.2.2.2. - // INTEGER - report_style->ev_trig_type = FORMAT_4_E2SM_RC_EV_TRIGGER_FORMAT; - - // RIC Report Action Format Type - // Mandatory - // 9.3.5 - // 6.2.2.4. - // INTEGER - report_style->act_frmt_type = FORMAT_1_E2SM_RC_ACT_DEF; - - // RIC Indication Header Format Type - // Mandatory - // 9.3.5 - // 6.2.2.4. - // INTEGER - report_style->ind_hdr_type = FORMAT_1_E2SM_RC_IND_HDR; - - // RIC Indication Message Format Type - // Mandatory - // 9.3.5 - // 6.2.2.4. - // INTEGER - report_style->ind_msg_type = FORMAT_2_E2SM_RC_IND_MSG; - - // Sequence of RAN Parameters Supported - // [0 - 65535] - report_style->sz_seq_ran_param = 1; - report_style->ran_param = calloc(report_style->sz_seq_ran_param, sizeof(seq_ran_param_3_t)); - assert(report_style->ran_param != NULL && "Memory exhausted"); - - // RAN Parameter ID - // Mandatory - // 9.3.8 - // [1- 4294967295] - report_style->ran_param[0].id = E2SM_RC_RS4_RRC_STATE_CHANGED_TO; - - // RAN Parameter Name - // Mandatory - // 9.3.9 - // [1-150] - const char ran_param_name[] = "RRC State"; - report_style->ran_param[0].name = cp_str_to_ba(ran_param_name); - - // RAN Parameter Definition - // Optional - // 9.3.51 - report_style->ran_param[0].def = NULL; + report->seq_report_sty[0] = fill_report_style_4("UE Information"); } static void fill_rc_control(ran_func_def_ctrl_t* ctrl) diff --git a/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc_subs.h b/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc_subs.h index 80fc7e5706..702e08511e 100644 --- a/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc_subs.h +++ b/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc_subs.h @@ -25,60 +25,6 @@ #include "openair2/E2AP/flexric/src/sm/rc_sm/ie/rc_data_ie.h" #include "common/utils/ds/seq_arr.h" -typedef enum { // 8.2.1 RAN Parameters for Report Service Style 1 - E2SM_RC_RS1_UE_EVENT_ID = 1, - E2SM_RC_RS1_NI_MESSAGE = 2, - E2SM_RC_RS1_RRC_MESSAGE = 3, - E2SM_RC_RS1_UE_ID = 4, - E2SM_RC_RS1_OLD_AMF_UE_NGAP_ID = 5, - E2SM_RC_RS1_CELL_GLOBAL_ID = 6, - - END_E2SM_RC_RS1_RAN_PARAM_ID -} report_style_1_ran_param_id_e; - -typedef enum { // 8.2.2 RAN Parameters for Report Service Style 2 - E2SM_RC_RS2_CURRENT_UE_ID = 1, - E2SM_RC_RS2_OLD_UE_ID = 2, - E2SM_RC_RS2_CURRENT_RRC_STATE = 3, - E2SM_RC_RS2_OLD_RRC_STATE = 4, - E2SM_RC_RS2_UE_CONTEXT_INFORMATION_CONTAINER = 5, - E2SM_RC_RS2_CELL_GLOBAL_ID = 6, - E2SM_RC_RS2_UE_INFORMATION = 7, - - END_E2SM_RC_RS2_RAN_PARAM_ID -} report_style_2_ran_param_id_e; - -typedef enum { // 8.2.3 RAN Parameters for Report Service Style 3 - E2SM_RC_RS3_CELL_CONTEXT_INFORMATION = 1, - E2SM_RC_RS3_CELL_DELETED = 2, - E2SM_RC_RS3_NEIGHBOUR_RELATION_TABLE = 3, - - END_E2SM_RC_RS3_RAN_PARAM_ID -} report_style_3_ran_param_id_e; - -typedef enum { // 8.2.4 RAN Parameters for Report Service Style 4 - E2SM_RC_RS4_UL_MAC_CE = 100, - E2SM_RC_RS4_DL_MAC_CE = 101, - E2SM_RC_RS4_DL_BUFFER_OCCUPANCY = 102, - E2SM_RC_RS4_CURRENT_RRC_STATE = 201, - E2SM_RC_RS4_RRC_STATE_CHANGED_TO = 202, - E2SM_RC_RS4_RRC_MESSAGE = 203, - E2SM_RC_RS4_OLD_UE_ID = 300, - E2SM_RC_RS4_CURRENT_UE_ID = 301, - E2SM_RC_RS4_NI_MESSAGE = 302, - E2SM_RC_RS4_CELL_GLOBAL_ID = 400, - - END_E2SM_RC_RS4_RAN_PARAM_ID -} report_style_4_ran_param_id_e; - -typedef enum { // 8.2.5 RAN Parameters for Report Service Style 5 - E2SM_RC_RS5_UE_CONTEXT_INFORMATION = 1, - E2SM_RC_RS5_CELL_CONTEXT_INFORMATION = 2, - E2SM_RC_RS5_NEIGHBOUR_RELATION_TABLE = 3, - - END_E2SM_RC_RS5_RAN_PARAM_ID -} report_style_5_ran_param_id_e; - typedef struct ran_param_data { uint32_t ric_req_id; e2sm_rc_event_trigger_t ev_tr; From 7e1c3e4213078ee24cd1c73187990f9dde81ca47 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 11 Feb 2025 18:26:22 +0100 Subject: [PATCH 19/57] Fix double-E1 bearer context setup req in E1 handler If two PDU sessions are to be setup, the CU-CP sends two bearer context setup requests. When running only the CU-UP, we inconditionally tried to set up the CU-UP UE ID identifiers upon reception of the bearer context setup request, leading to an assert. Check if the IDs are not already set up, to avoid assertions in that case. --- openair2/LAYER2/nr_pdcp/cucp_cuup_handler.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/LAYER2/nr_pdcp/cucp_cuup_handler.c b/openair2/LAYER2/nr_pdcp/cucp_cuup_handler.c index 96701dbb83..b96d38030c 100644 --- a/openair2/LAYER2/nr_pdcp/cucp_cuup_handler.c +++ b/openair2/LAYER2/nr_pdcp/cucp_cuup_handler.c @@ -149,7 +149,7 @@ void e1_bearer_context_setup(const e1ap_bearer_setup_req_t *req) /* mirror the CU-CP UE ID for CU-UP */ uint32_t cu_up_ue_id = req->gNB_cu_cp_ue_id; f1_ue_data_t ued = {.secondary_ue = req->gNB_cu_cp_ue_id}; - if (need_ue_id_mgmt) { + if (need_ue_id_mgmt && !cu_exists_f1_ue_data(cu_up_ue_id)) { bool success = cu_add_f1_ue_data(cu_up_ue_id, &ued); DevAssert(success); LOG_I(E1AP, "adding UE with CU-CP UE ID %d and CU-UP UE ID %d\n", req->gNB_cu_cp_ue_id, cu_up_ue_id); From 5625bc63d11c0cc8f8395f4bfa4d5b689873ea94 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 11 Feb 2025 18:31:10 +0100 Subject: [PATCH 20/57] Add PDU session add log in E1 handler bearer context modification and release print a message, so do the same here as well. --- openair2/LAYER2/nr_pdcp/cucp_cuup_handler.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openair2/LAYER2/nr_pdcp/cucp_cuup_handler.c b/openair2/LAYER2/nr_pdcp/cucp_cuup_handler.c index b96d38030c..2fc2159fe1 100644 --- a/openair2/LAYER2/nr_pdcp/cucp_cuup_handler.c +++ b/openair2/LAYER2/nr_pdcp/cucp_cuup_handler.c @@ -164,8 +164,10 @@ void e1_bearer_context_setup(const e1ap_bearer_setup_req_t *req) }; resp.numPDUSessions = req->numPDUSessions; for (int i = 0; i < resp.numPDUSessions; ++i) { - pdu_session_setup_t *resp_pdu = resp.pduSession + i; const pdu_session_to_setup_t *req_pdu = req->pduSession + i; + LOG_I(E1AP, "UE %d: add PDU session ID %ld (%d bearers)\n", cu_up_ue_id, req_pdu->sessionId, req_pdu->numDRB2Setup); + + pdu_session_setup_t *resp_pdu = resp.pduSession + i; resp_pdu->id = req_pdu->sessionId; AssertFatal(req_pdu->numDRB2Setup == 1, "can only handle one DRB per PDU session\n"); From 59575b9cde026169d5520955e14599a82a607bb0 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 11 Feb 2025 18:54:02 +0100 Subject: [PATCH 21/57] Handle PDU session resource setup for existing PDU session 38.413 section 8.2.1.4 says that if PDU session resource setup req contains an existing PDU session, that one should be reported as failed. That is rather complicated for us to do; simply reject all PDU sessions and let the core deal with that. --- openair2/RRC/NR/rrc_gNB_NGAP.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/openair2/RRC/NR/rrc_gNB_NGAP.c b/openair2/RRC/NR/rrc_gNB_NGAP.c index c1715c438c..a7dc0a4c5f 100644 --- a/openair2/RRC/NR/rrc_gNB_NGAP.c +++ b/openair2/RRC/NR/rrc_gNB_NGAP.c @@ -872,6 +872,21 @@ void rrc_gNB_process_NGAP_PDUSESSION_SETUP_REQ(MessageDef *msg_p, instance_t ins return; } + // Reject PDU session if at least one exists already with that ID. + // At least one because marking one as existing, and setting up another, that + // might be more work than is worth it. See 8.2.1.4 in 38.413 + for (int i = 0; i < msg->nb_pdusessions_tosetup; ++i) { + const pdusession_t *p = &msg->pdusession_setup_params[i]; + rrc_pdu_session_param_t *exist = find_pduSession(UE, p->pdusession_id, false /* don't create */); + if (exist) { + LOG_E(NR_RRC, "UE %d: already has existing PDU session %d rejecting PDU Session Resource Setup Request\n", UE->rrc_ue_id, p->pdusession_id); + ngap_cause_t cause = {.type = NGAP_CAUSE_RADIO_NETWORK, .value = NGAP_CAUSE_RADIO_NETWORK_MULTIPLE_PDU_SESSION_ID_INSTANCES}; + send_ngap_pdu_session_setup_resp_fail(instance, msg, cause); + rrc_forward_ue_nas_message(rrc, UE); + return; + } + } + UE->amf_ue_ngap_id = msg->amf_ue_ngap_id; if (!trigger_bearer_setup(rrc, UE, msg->nb_pdusessions_tosetup, msg->pdusession_setup_params, msg->ueAggMaxBitRateDownlink)) { From 277f8da010e56020627d2db8884c84789223bdf6 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Tue, 11 Feb 2025 18:45:14 +0100 Subject: [PATCH 22/57] Workaround to delay multiple concurrent PDU session This is a hack. With some UEs/CN combinations, PDU session requests might come in quick succession. Since 38.331 asks us to only have one reconfiguration at once, we need to delay a second, third, ... PDU session request until the first has passed, to make one reconfiguration at a time. --- openair2/RRC/NR/nr_rrc_defs.h | 4 +++ openair2/RRC/NR/rrc_gNB.c | 11 +++++-- openair2/RRC/NR/rrc_gNB_NGAP.c | 47 ++++++++++++++++++++++++++-- openair2/RRC/NR/rrc_gNB_UE_context.c | 2 ++ 4 files changed, 59 insertions(+), 5 deletions(-) diff --git a/openair2/RRC/NR/nr_rrc_defs.h b/openair2/RRC/NR/nr_rrc_defs.h index 7c02ad4f9f..c30f8856bc 100644 --- a/openair2/RRC/NR/nr_rrc_defs.h +++ b/openair2/RRC/NR/nr_rrc_defs.h @@ -255,6 +255,10 @@ typedef struct gNB_RRC_UE_s { /* Nas Pdu */ ngap_pdu_t nas_pdu; + /* hack, see rrc_gNB_process_NGAP_PDUSESSION_SETUP_REQ() for more info */ + int max_delays_pdu_session; + bool ongoing_pdusession_setup_request; + } gNB_RRC_UE_t; typedef struct rrc_gNB_ue_context_s { diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 22bf766716..3d57dc0960 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -1667,6 +1667,10 @@ static void handle_rrcReconfigurationComplete(gNB_RRC_INST *rrc, gNB_RRC_UE_t *U LOG_E(RRC, "UE %d: Received unexpected transaction type %d for xid %d\n", UE->rrc_ue_id, UE->xids[xid], xid); break; } + + if (UE->xids[xid] == RRC_PDUSESSION_ESTABLISH) + UE->ongoing_pdusession_setup_request = false; + UE->xids[xid] = RRC_ACTION_NONE; for (int i = 0; i < NR_RRC_TRANSACTION_IDENTIFIER_NUMBER; ++i) { if (UE->xids[i] != RRC_ACTION_NONE) { @@ -2555,9 +2559,10 @@ void *rrc_gnb_task(void *args_p) { break; case TIMER_HAS_EXPIRED: - /* only this one handled for now */ - DevAssert(TIMER_HAS_EXPIRED(msg_p).timer_id == stats_timer_id); - write_rrc_stats(RC.nrrrc[0]); + if (TIMER_HAS_EXPIRED(msg_p).timer_id == stats_timer_id) + write_rrc_stats(RC.nrrrc[0]); + else + itti_send_msg_to_task(TASK_RRC_GNB, 0, TIMER_HAS_EXPIRED(msg_p).arg); /* see rrc_gNB_process_NGAP_PDUSESSION_SETUP_REQ() */ break; case F1AP_INITIAL_UL_RRC_MESSAGE: diff --git a/openair2/RRC/NR/rrc_gNB_NGAP.c b/openair2/RRC/NR/rrc_gNB_NGAP.c index a7dc0a4c5f..e01d5ab9dc 100644 --- a/openair2/RRC/NR/rrc_gNB_NGAP.c +++ b/openair2/RRC/NR/rrc_gNB_NGAP.c @@ -816,6 +816,29 @@ void rrc_gNB_send_NGAP_PDUSESSION_SETUP_RESP(gNB_RRC_INST *rrc, gNB_RRC_UE_t *UE return; } +/* \brief checks if any transaction is ongoing for any xid of this UE */ +static bool transaction_ongoing(const gNB_RRC_UE_t *UE) +{ + for (int xid = 0; xid < NR_RRC_TRANSACTION_IDENTIFIER_NUMBER; ++xid) { + if (UE->xids[xid] != RRC_ACTION_NONE) + return true; + } + return false; +} + +/* \brief delays the ongoing transaction (in msg_p) by setting a timer to wait + * 10ms; upon expiry, delivers to RRC, which sends the message to itself */ +static void delay_transaction(MessageDef *msg_p, int wait_us) +{ + MessageDef *new = itti_alloc_new_message(TASK_RRC_GNB, 0, NGAP_PDUSESSION_SETUP_REQ); + ngap_pdusession_setup_req_t *n = &NGAP_PDUSESSION_SETUP_REQ(new); + *n = NGAP_PDUSESSION_SETUP_REQ(msg_p); + + int instance = msg_p->ittiMsgHeader.originInstance; + long timer_id; + timer_setup(0, wait_us, TASK_RRC_GNB, instance, TIMER_ONE_SHOT, new, &timer_id); +} + /** * @brief Fill PDU Session Resource Setup Response with a list of PDU Session Resources Failed to Setup * and send ITTI message to TASK_NGAP @@ -889,15 +912,35 @@ void rrc_gNB_process_NGAP_PDUSESSION_SETUP_REQ(MessageDef *msg_p, instance_t ins UE->amf_ue_ngap_id = msg->amf_ue_ngap_id; + /* This is a hack. We observed that with some UEs, PDU session requests might + * come in quick succession, faster than the RRC reconfiguration for the PDU + * session requests can be carried out (UE is doing reconfig, and second PDU + * session request arrives). We don't have currently the means to "queue up" + * these transactions, which would probably involve some rework of the RRC. + * To still allow these requests to come in and succeed, we below check and delay transactions + * for 10ms. However, to not accidentally end up in infinite loops, the + * maximum number is capped on a per-UE basis as indicated in variable + * max_delays_pdu_session. */ + if (!UE->ongoing_pdusession_setup_request) + UE->max_delays_pdu_session = 100; + + if (UE->max_delays_pdu_session > 0 && (transaction_ongoing(UE) || UE->ongoing_pdusession_setup_request)) { + int wait_us = 10000; + LOG_I(RRC, "UE %d: delay PDU session setup by %d us, pending %d retries\n", UE->rrc_ue_id, wait_us, UE->max_delays_pdu_session); + delay_transaction(msg_p, wait_us); + UE->max_delays_pdu_session--; + return; + } + if (!trigger_bearer_setup(rrc, UE, msg->nb_pdusessions_tosetup, msg->pdusession_setup_params, msg->ueAggMaxBitRateDownlink)) { // Reject PDU Session Resource setup if there's no CU-UP associated LOG_W(NR_RRC, "UE %d: reject PDU Session Setup in PDU Session Resource Setup Response\n", UE->rrc_ue_id); ngap_cause_t cause = {.type = NGAP_CAUSE_RADIO_NETWORK, .value = NGAP_CAUSE_RADIO_NETWORK_RESOURCES_NOT_AVAILABLE_FOR_THE_SLICE}; send_ngap_pdu_session_setup_resp_fail(instance, msg, cause); rrc_forward_ue_nas_message(rrc, UE); + } else { + UE->ongoing_pdusession_setup_request = true; } - - return; } static void fill_qos2(NGAP_QosFlowAddOrModifyRequestList_t *qos, pdusession_t *session) diff --git a/openair2/RRC/NR/rrc_gNB_UE_context.c b/openair2/RRC/NR/rrc_gNB_UE_context.c index 9b02eaa1f4..b39abd9a30 100644 --- a/openair2/RRC/NR/rrc_gNB_UE_context.c +++ b/openair2/RRC/NR/rrc_gNB_UE_context.c @@ -206,6 +206,8 @@ rrc_gNB_ue_context_t *rrc_gNB_create_ue_context(sctp_assoc_t assoc_id, ue->rrc_ue_id); bool success = cu_add_f1_ue_data(ue->rrc_ue_id, &ue_data); DevAssert(success); + ue->max_delays_pdu_session = 20; /* see rrc_gNB_process_NGAP_PDUSESSION_SETUP_REQ() */ + ue->ongoing_pdusession_setup_request = false; RB_INSERT(rrc_nr_ue_tree_s, &rrc_instance_pP->rrc_ue_head, ue_context_p); LOG_UE_EVENT(ue, From d446543ffbf7720f005ee3c7ee9932b63995002c Mon Sep 17 00:00:00 2001 From: Bartosz Podrygajlo Date: Thu, 3 Apr 2025 10:47:12 +0200 Subject: [PATCH 23/57] Avoid accessing current_DL_BWP structure when scheduling DCI for other SIBs Avoid access to mac->current_DL_BWP structure when scheduling DCI for SIBs other than 1. This is not needed and can cause NULL pointer access which can happen if the UE has released MAC configuration or has not started RA yet. --- openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c index 9ebf2dbeb4..8457cad135 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c @@ -436,8 +436,7 @@ bool search_space_monitoring_ocasion_other_si(NR_UE_MAC_INST_t *mac, const int abs_slot, const int frame, const int slot, - const int slots_per_frame, - const int bwp_id) + const int slots_per_frame) { const int duration = ss->duration ? *ss->duration : 1; int period, offset; @@ -478,7 +477,6 @@ bool monitor_dci_for_other_SI(NR_UE_MAC_INST_t *mac, { // according to 5.2.2.3.2 in 331 const int abs_slot = frame * slots_per_frame + slot; - const int bwp_id = mac->current_DL_BWP->bwp_id; for (int i = 0; i < mac->si_SchedInfo.si_SchedInfo_list.count; i++) { si_schedinfo_config_t *config = mac->si_SchedInfo.si_SchedInfo_list.array[i]; @@ -493,7 +491,7 @@ bool monitor_dci_for_other_SI(NR_UE_MAC_INST_t *mac, mac->si_SchedInfo.si_window_start = abs_slot; // in terms of absolute slot number } check_valid = is_window_valid(mac, window_slots, abs_slot); - if (check_valid && search_space_monitoring_ocasion_other_si(mac, ss, abs_slot, frame, slot, slots_per_frame, bwp_id)) + if (check_valid && search_space_monitoring_ocasion_other_si(mac, ss, abs_slot, frame, slot, slots_per_frame)) return true; break; case NR_SI_INFO_v1700 : @@ -504,7 +502,7 @@ bool monitor_dci_for_other_SI(NR_UE_MAC_INST_t *mac, window_slots = 10; // TODO window length hardcoded to 10 at gNB for NTN check_valid = is_window_valid(mac, window_slots, abs_slot); if (check_valid && (config->si_WindowPosition - 1) == slot) - return search_space_monitoring_ocasion_other_si(mac, ss, abs_slot, frame, slot, slots_per_frame, bwp_id); + return search_space_monitoring_ocasion_other_si(mac, ss, abs_slot, frame, slot, slots_per_frame); break; default : AssertFatal(false, "Invalid SI-SchedulingInfo case\n"); From 5969ecc212c8af95ea91d9f43d91cb3a05999e1f Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Thu, 3 Apr 2025 15:40:14 +0200 Subject: [PATCH 24/57] Use platform_constants.h definition NGAP_MAX_PDU_SESSION and remove NGAP lib definition There are 2 different definition of maxnoofPDUSessions (as per 3GPP TS 38.413), one in NGAP lib (set to 16) and one in platform_constants.h (256 as per specs). The NGAP lib definition is removed in this commit and replaced by the one compliant with the specs. This is fixing the warning: In function 'fill_pdu_session_resource_failed_to_setup_item', inlined from 'rrc_gNB_send_NGAP_INITIAL_CONTEXT_SETUP_RESP' at /openair2/RRC/NR/rrc_gNB_NGAP.c:588:7: /openair2/RRC/NR/rrc_gNB_NGAP.c:451:12: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=] 451 | f->cause = cause; | ~~~~~~~~~^~~~~~~ In file included from /common/utils/ocp_itti/intertask_interface.h:235, from /openair2/RRC/NR/rrc_gNB_NGAP.h:39, from /openair2/RRC/NR/rrc_gNB_NGAP.c:31: /openair2/COMMON/ngap_messages_types.h: In function 'rrc_gNB_send_NGAP_INITIAL_CONTEXT_SETUP_RESP': /openair2/COMMON/ngap_messages_types.h:546:13: note: at offset [8724, 25769812488] into destination object 'gNB_ue_ngap_id' of size 4 546 | uint32_t gNB_ue_ngap_id; | ^~~~~~~~~~~~~~ --- openair2/COMMON/ngap_messages_types.h | 39 +++++++++++++-------------- openair2/RRC/NR/rrc_gNB_NGAP.c | 2 +- 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/openair2/COMMON/ngap_messages_types.h b/openair2/COMMON/ngap_messages_types.h index 31b7abd3f8..9df2dfaeaa 100644 --- a/openair2/COMMON/ngap_messages_types.h +++ b/openair2/COMMON/ngap_messages_types.h @@ -71,9 +71,6 @@ //-------------------------------------------------------------------------------------------// -// maxnoofPDUSessions in 3GPP TS 38.413 -#define NGAP_MAX_PDUSESSION 16 // 256 according to specs - /* Length of the transport layer address string * 160 bits / 8 bits by char. */ @@ -548,12 +545,12 @@ typedef struct ngap_initial_context_setup_resp_s { /* Number of pdusession setup-ed in the list */ uint8_t nb_of_pdusessions; /* list of pdusession setup-ed by RRC layers */ - pdusession_setup_t pdusessions[NGAP_MAX_PDUSESSION]; + pdusession_setup_t pdusessions[NGAP_MAX_PDU_SESSION]; /* Number of pdusession failed to be setup in list */ uint8_t nb_of_pdusessions_failed; /* list of pdusessions that failed to be setup */ - pdusession_failed_t pdusessions_failed[NGAP_MAX_PDUSESSION]; + pdusession_failed_t pdusessions_failed[NGAP_MAX_PDU_SESSION]; } ngap_initial_context_setup_resp_t; typedef struct ngap_initial_context_setup_fail_s { @@ -633,7 +630,7 @@ typedef struct ngap_initial_context_setup_req_s { /* Number of pdusession to be setup in the list */ uint8_t nb_of_pdusessions; /* list of pdusession to be setup by RRC layers */ - pdusession_t pdusession_param[NGAP_MAX_PDUSESSION]; + pdusession_t pdusession_param[NGAP_MAX_PDU_SESSION]; /* Mobility Restriction List */ uint8_t mobility_restriction_flag; @@ -689,7 +686,7 @@ typedef struct ngap_pdusession_setup_req_s { uint8_t nb_pdusessions_tosetup; /* E RAB setup request */ - pdusession_t pdusession_setup_params[NGAP_MAX_PDUSESSION]; + pdusession_t pdusession_setup_params[NGAP_MAX_PDU_SESSION]; /* UE Uplink Aggregated Max Bitrates */ uint64_t ueAggMaxBitRateUplink; @@ -704,12 +701,12 @@ typedef struct ngap_pdusession_setup_resp_s { /* Number of pdusession setup-ed in the list */ uint8_t nb_of_pdusessions; /* list of pdusession setup-ed by RRC layers */ - pdusession_setup_t pdusessions[NGAP_MAX_PDUSESSION]; + pdusession_setup_t pdusessions[NGAP_MAX_PDU_SESSION]; /* Number of pdusession failed to be setup in list */ uint8_t nb_of_pdusessions_failed; /* list of pdusessions that failed to be setup */ - pdusession_failed_t pdusessions_failed[NGAP_MAX_PDUSESSION]; + pdusession_failed_t pdusessions_failed[NGAP_MAX_PDU_SESSION]; } ngap_pdusession_setup_resp_t; typedef struct ngap_path_switch_req_s { @@ -719,7 +716,7 @@ typedef struct ngap_path_switch_req_s { uint8_t nb_of_pdusessions; /* list of pdusession setup-ed by RRC layers */ - pdusession_setup_t pdusessions_tobeswitched[NGAP_MAX_PDUSESSION]; + pdusession_setup_t pdusessions_tobeswitched[NGAP_MAX_PDU_SESSION]; /* AMF UE id */ uint64_t amf_ue_ngap_id; @@ -749,13 +746,13 @@ typedef struct ngap_path_switch_req_ack_s { uint8_t nb_pdusessions_tobeswitched; /* list of pdusession to be switched by RRC layers */ - pdusession_tobeswitched_t pdusessions_tobeswitched[NGAP_MAX_PDUSESSION]; + pdusession_tobeswitched_t pdusessions_tobeswitched[NGAP_MAX_PDU_SESSION]; /* Number of pdusessions to be released by RRC */ uint8_t nb_pdusessions_tobereleased; /* list of pdusessions to be released */ - pdusession_failed_t pdusessions_tobereleased[NGAP_MAX_PDUSESSION]; + pdusession_failed_t pdusessions_tobereleased[NGAP_MAX_PDU_SESSION]; /* Security key */ int next_hop_chain_count; @@ -776,9 +773,9 @@ typedef struct ngap_pdusession_modification_ind_s { uint8_t nb_of_pdusessions_nottobemodified; /* list of pdusession setup-ed by RRC layers */ - pdusession_setup_t pdusessions_tobemodified[NGAP_MAX_PDUSESSION]; + pdusession_setup_t pdusessions_tobemodified[NGAP_MAX_PDU_SESSION]; - pdusession_setup_t pdusessions_nottobemodified[NGAP_MAX_PDUSESSION]; + pdusession_setup_t pdusessions_nottobemodified[NGAP_MAX_PDU_SESSION]; uint16_t ue_initial_id; @@ -805,7 +802,7 @@ typedef struct ngap_ue_release_req_s { /* Number of pdusession resource in the list */ uint8_t nb_of_pdusessions; /* list of pdusession resource by RRC layers */ - pdusession_release_t pdusessions[NGAP_MAX_PDUSESSION]; + pdusession_release_t pdusessions[NGAP_MAX_PDU_SESSION]; ngap_cause_t cause; } ngap_ue_release_req_t, ngap_ue_release_resp_t; @@ -820,7 +817,7 @@ typedef struct ngap_pdusession_modify_req_s { uint8_t nb_pdusessions_tomodify; /* pdu session modify request */ - pdusession_t pdusession_modify_params[NGAP_MAX_PDUSESSION]; + pdusession_t pdusession_modify_params[NGAP_MAX_PDU_SESSION]; } ngap_pdusession_modify_req_t; typedef struct ngap_pdusession_modify_resp_s { @@ -829,12 +826,12 @@ typedef struct ngap_pdusession_modify_resp_s { /* Number of pdusession modify-ed in the list */ uint8_t nb_of_pdusessions; /* list of pdusession modify-ed by RRC layers */ - pdusession_modify_t pdusessions[NGAP_MAX_PDUSESSION]; + pdusession_modify_t pdusessions[NGAP_MAX_PDU_SESSION]; /* Number of pdusession failed to be modify in list */ uint8_t nb_of_pdusessions_failed; /* list of pdusessions that failed to be modify */ - pdusession_failed_t pdusessions_failed[NGAP_MAX_PDUSESSION]; + pdusession_failed_t pdusessions_failed[NGAP_MAX_PDU_SESSION]; } ngap_pdusession_modify_resp_t; typedef struct ngap_pdusession_release_command_s { @@ -851,7 +848,7 @@ typedef struct ngap_pdusession_release_command_s { uint8_t nb_pdusessions_torelease; /* PDUSession release command */ - pdusession_release_t pdusession_release_params[NGAP_MAX_PDUSESSION]; + pdusession_release_t pdusession_release_params[NGAP_MAX_PDU_SESSION]; } ngap_pdusession_release_command_t; @@ -866,12 +863,12 @@ typedef struct ngap_pdusession_release_resp_s { uint8_t nb_of_pdusessions_released; /* list of pdusessions released */ - pdusession_release_t pdusession_release[NGAP_MAX_PDUSESSION]; + pdusession_release_t pdusession_release[NGAP_MAX_PDU_SESSION]; /* Number of pdusession failed to be released in list */ uint8_t nb_of_pdusessions_failed; /* list of pdusessions that failed to be released */ - pdusession_failed_t pdusessions_failed[NGAP_MAX_PDUSESSION]; + pdusession_failed_t pdusessions_failed[NGAP_MAX_PDU_SESSION]; } ngap_pdusession_release_resp_t; diff --git a/openair2/RRC/NR/rrc_gNB_NGAP.c b/openair2/RRC/NR/rrc_gNB_NGAP.c index c1715c438c..d7d7b8f360 100644 --- a/openair2/RRC/NR/rrc_gNB_NGAP.c +++ b/openair2/RRC/NR/rrc_gNB_NGAP.c @@ -1327,7 +1327,7 @@ int rrc_gNB_process_NGAP_PDUSESSION_RELEASE_COMMAND(MessageDef *msg_p, instance_ uint32_t gNB_ue_ngap_id; ngap_pdusession_release_command_t *cmd = &NGAP_PDUSESSION_RELEASE_COMMAND(msg_p); gNB_ue_ngap_id = cmd->gNB_ue_ngap_id; - if (cmd->nb_pdusessions_torelease > NGAP_MAX_PDUSESSION) { + if (cmd->nb_pdusessions_torelease > NGAP_MAX_PDU_SESSION) { LOG_E(NR_RRC, "incorrect number of pdu session do release %d\n", cmd->nb_pdusessions_torelease); return -1; } From e45f429c35a712ede69964f27570a87ffe67a3e4 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Thu, 3 Apr 2025 09:41:27 +0200 Subject: [PATCH 25/57] Dummy nr_rlc_data_req() into nr-cuup.c --- executables/nr-cuup.c | 28 ++++++---------------------- 1 file changed, 6 insertions(+), 22 deletions(-) diff --git a/executables/nr-cuup.c b/executables/nr-cuup.c index 856dcd6152..238ee77275 100644 --- a/executables/nr-cuup.c +++ b/executables/nr-cuup.c @@ -102,16 +102,12 @@ ngran_node_t get_node_type() return ngran_gNB_CUUP; } -rlc_op_status_t rlc_data_req(const protocol_ctxt_t *const pc, - const srb_flag_t sf, - const MBMS_flag_t mf, - const rb_id_t rb_id, - const mui_t mui, - const confirm_t c, - const sdu_size_t size, - uint8_t *const buf, - const uint32_t *const a, - const uint32_t *const b) +rlc_op_status_t nr_rlc_data_req(const protocol_ctxt_t *const ctxt_pP, + const srb_flag_t srb_flagP, + const rb_id_t rb_idP, + const mui_t muiP, + sdu_size_t sdu_sizeP, + uint8_t *sdu_pP) { abort(); return 0; @@ -123,16 +119,6 @@ int nr_rlc_get_available_tx_space(const rnti_t rntiP, const logical_chan_id_t ch return 0; } -void nr_rlc_add_drb(int rnti, int drb_id, const NR_RLC_BearerConfig_t *rlc_BearerConfig) -{ - abort(); -} - -void prepare_and_send_ue_context_modification_f1(rrc_gNB_ue_context_t *ue_context_p, e1ap_bearer_setup_resp_t *e1ap_resp) -{ - abort(); -} - f1ap_cudu_inst_t *getCxt(instance_t instanceP) { // the E1 module uses F1's getCxt() to decide whether there is F1-U and if @@ -146,8 +132,6 @@ f1ap_cudu_inst_t *getCxt(instance_t instanceP) } configmodule_interface_t *uniqCfg = NULL; -void rrc_gNB_send_NGAP_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, uint32_t gNB_ue_ngap_id) { }; - int main(int argc, char **argv) { /// static configuration for NR at the moment From 0065c6023a617249e810d593dab42a8428f689a9 Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Thu, 3 Apr 2025 22:30:29 +0200 Subject: [PATCH 26/57] Remove unconsistent check in rrc_gNB_process_NGAP_PDUSESSION_RELEASE_COMMAND Leading to clang error: /oai-ran/openair2/RRC/NR/rrc_gNB_NGAP.c:1329:37: error: result of comparison of constant 256 with expression of type 'uint8_t' (aka 'unsigned char') is always false [-Werror,-Wtautological-constant-out-of-range-compare] The value comes from the decoding of: ie->value.choice.PDUSessionResourceToReleaseListRelCmd.list.count --- openair2/RRC/NR/rrc_gNB_NGAP.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/openair2/RRC/NR/rrc_gNB_NGAP.c b/openair2/RRC/NR/rrc_gNB_NGAP.c index d7d7b8f360..99e657aa4d 100644 --- a/openair2/RRC/NR/rrc_gNB_NGAP.c +++ b/openair2/RRC/NR/rrc_gNB_NGAP.c @@ -1327,10 +1327,6 @@ int rrc_gNB_process_NGAP_PDUSESSION_RELEASE_COMMAND(MessageDef *msg_p, instance_ uint32_t gNB_ue_ngap_id; ngap_pdusession_release_command_t *cmd = &NGAP_PDUSESSION_RELEASE_COMMAND(msg_p); gNB_ue_ngap_id = cmd->gNB_ue_ngap_id; - if (cmd->nb_pdusessions_torelease > NGAP_MAX_PDU_SESSION) { - LOG_E(NR_RRC, "incorrect number of pdu session do release %d\n", cmd->nb_pdusessions_torelease); - return -1; - } gNB_RRC_INST *rrc = RC.nrrrc[instance]; rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_get_ue_context(rrc, gNB_ue_ngap_id); From 8412b94b8c0843fd5fe872713edda2b7ed1054c1 Mon Sep 17 00:00:00 2001 From: Jaroslava Fiedlerova Date: Thu, 3 Apr 2025 11:07:49 +0200 Subject: [PATCH 27/57] CI: update VVDN configuration file - change frequency - use MAC address of new VVDN RU --- .../gnb.sa.band77.273prb.fhi72.4x4-vvdn.conf | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ci-scripts/conf_files/gnb.sa.band77.273prb.fhi72.4x4-vvdn.conf b/ci-scripts/conf_files/gnb.sa.band77.273prb.fhi72.4x4-vvdn.conf index 4641cf8742..1ae1655fec 100644 --- a/ci-scripts/conf_files/gnb.sa.band77.273prb.fhi72.4x4-vvdn.conf +++ b/ci-scripts/conf_files/gnb.sa.band77.273prb.fhi72.4x4-vvdn.conf @@ -30,12 +30,12 @@ gNBs = physCellId = 0; # downlinkConfigCommon #frequencyInfoDL - # center frequency = 3999.36 MHz - # selected SSB frequency = 3999.36 MHz - absoluteFrequencySSB = 666624; + # center frequency = 4049.76 MHz + # selected SSB frequency = 4049.76 MHz + absoluteFrequencySSB = 669984; dl_frequencyBand = 77; - # frequency point A = 3950.22 MHz - dl_absoluteFrequencyPointA = 663348; + # frequency point A = 4000.62 MHz + dl_absoluteFrequencyPointA = 666708; #scs-SpecificCarrierList dl_offstToCarrier = 0; # subcarrierSpacing @@ -253,7 +253,7 @@ fhi_72 = { system_core = 0; io_core = 1; worker_cores = (2); - ru_addr = ("98:ae:71:01:c5:eb", "98:ae:71:01:c5:eb"); + ru_addr = ("98:ae:71:04:83:e3", "98:ae:71:04:83:e3"); mtu = 9600; fh_config = ({ T1a_cp_dl = (285, 470); From 683e982137d8156c7ece60653a295d936bcaef49 Mon Sep 17 00:00:00 2001 From: Jaroslava Fiedlerova Date: Thu, 3 Apr 2025 19:02:44 +0200 Subject: [PATCH 28/57] CI: more modifications for FHI72 VVDN test - use Ubuntu image, instead of RHEL image - gNB fails with "Illegal instruction" during RA, when running with RHEL image - init DPDK in VA mode - increase number of cores Tpool --- .../conf_files/gnb.sa.band77.273prb.fhi72.4x4-vvdn.conf | 1 + ci-scripts/xml_files/container_sa_fhi72_vvdn_up2.xml | 7 +++---- .../yaml_files/sa_fhi_7.2_vvdn_gnb/docker-compose.yml | 5 ++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/ci-scripts/conf_files/gnb.sa.band77.273prb.fhi72.4x4-vvdn.conf b/ci-scripts/conf_files/gnb.sa.band77.273prb.fhi72.4x4-vvdn.conf index 1ae1655fec..d81dd38694 100644 --- a/ci-scripts/conf_files/gnb.sa.band77.273prb.fhi72.4x4-vvdn.conf +++ b/ci-scripts/conf_files/gnb.sa.band77.273prb.fhi72.4x4-vvdn.conf @@ -250,6 +250,7 @@ log_config : fhi_72 = { dpdk_devices = ("0000:c3:11.0", "0000:c3:11.1"); + dpdk_iova_mode = "VA"; system_core = 0; io_core = 1; worker_cores = (2); diff --git a/ci-scripts/xml_files/container_sa_fhi72_vvdn_up2.xml b/ci-scripts/xml_files/container_sa_fhi72_vvdn_up2.xml index 927fe1a3e7..df48634240 100644 --- a/ci-scripts/xml_files/container_sa_fhi72_vvdn_up2.xml +++ b/ci-scripts/xml_files/container_sa_fhi72_vvdn_up2.xml @@ -53,11 +53,10 @@ - Pull_Cluster_Image - Pull Images from Cluster - oaicicd-ran + Pull_Local_Registry + Pull Images from Local Registry + 0 oai-gnb-fhi72 - cacofonix Create_Workspace diff --git a/ci-scripts/yaml_files/sa_fhi_7.2_vvdn_gnb/docker-compose.yml b/ci-scripts/yaml_files/sa_fhi_7.2_vvdn_gnb/docker-compose.yml index 7ea8b576d4..a74b583e2b 100644 --- a/ci-scripts/yaml_files/sa_fhi_7.2_vvdn_gnb/docker-compose.yml +++ b/ci-scripts/yaml_files/sa_fhi_7.2_vvdn_gnb/docker-compose.yml @@ -2,7 +2,6 @@ services: oai-gnb: image: ${REGISTRY:-oaisoftwarealliance}/oai-gnb-fhi72:${TAG:-develop} cap_add: - - SYS_ADMIN - IPC_LOCK - SYS_NICE cap_drop: @@ -10,14 +9,14 @@ services: container_name: oai-gnb environment: TZ: Europe/Paris - USE_ADDITIONAL_OPTIONS: --thread-pool 6,7,8,9 + USE_ADDITIONAL_OPTIONS: --thread-pool 7,8,9,10,11,12 devices: - /dev/vfio:/dev/vfio/ volumes: - ../../conf_files/gnb.sa.band77.273prb.fhi72.4x4-vvdn.conf:/opt/oai-gnb/etc/gnb.conf - /dev/hugepages:/dev/hugepages # Please change these values based on your system - cpuset: "0,1,2,3,4,5,6,7,8,9" + cpuset: "0,1,2,3,4,5,6,7,8,9,10,11,12" networks: oai-net: ipv4_address: 172.21.18.20 From 85b50925a44c4ef58cc465918e7e6673f33c3b8e Mon Sep 17 00:00:00 2001 From: Jaroslava Fiedlerova Date: Fri, 4 Apr 2025 09:44:33 +0200 Subject: [PATCH 29/57] doc: Update VVDN sample configuration files --- .../CONF/gnb.sa.band77.106prb.fhi72.4x4-vvdn.conf | 12 ++++++------ .../CONF/gnb.sa.band77.273prb.fhi72.2x2-vvdn.conf | 12 ++++++------ .../CONF/gnb.sa.band77.273prb.fhi72.4x4-vvdn.conf | 12 ++++++------ 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band77.106prb.fhi72.4x4-vvdn.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band77.106prb.fhi72.4x4-vvdn.conf index a5b059bcfa..7622e508bc 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band77.106prb.fhi72.4x4-vvdn.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band77.106prb.fhi72.4x4-vvdn.conf @@ -33,12 +33,12 @@ gNBs = # n_TimingAdvanceOffset = 0; # downlinkConfigCommon #frequencyInfoDL - # center frequency = 3999.36 MHz - # selected SSB frequency = 3999.36 MHz - absoluteFrequencySSB = 666624; + # center frequency = 4049.76 MHz + # selected SSB frequency = 4049.76 MHz + absoluteFrequencySSB = 669984; dl_frequencyBand = 77; - # frequency point A = 3980.28 MHz - dl_absoluteFrequencyPointA = 665352; + # frequency point A = 4030.68 MHz + dl_absoluteFrequencyPointA = 668712; #scs-SpecificCarrierList dl_offstToCarrier = 0; # subcarrierSpacing @@ -259,7 +259,7 @@ fhi_72 = { system_core = 0; io_core = 1; worker_cores = (2); - ru_addr = ("98:ae:71:01:c5:eb", "98:ae:71:01:c5:eb"); + ru_addr = ("98:ae:71:04:83:e3", "98:ae:71:04:83:e3"); mtu = 9600; fh_config = ({ T1a_cp_dl = (285, 470); diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band77.273prb.fhi72.2x2-vvdn.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band77.273prb.fhi72.2x2-vvdn.conf index a1cc7a9685..ce2a75d529 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band77.273prb.fhi72.2x2-vvdn.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band77.273prb.fhi72.2x2-vvdn.conf @@ -31,12 +31,12 @@ gNBs = # n_TimingAdvanceOffset = 0; # downlinkConfigCommon #frequencyInfoDL - # center frequency = 3999.36 MHz - # selected SSB frequency = 3999.36 MHz - absoluteFrequencySSB = 666624; + # center frequency = 4049.76 MHz + # selected SSB frequency = 4049.76 MHz + absoluteFrequencySSB = 669984; dl_frequencyBand = 77; - # frequency point A = 3950.22 MHz - dl_absoluteFrequencyPointA = 663348; + # frequency point A = 4000.62 MHz + dl_absoluteFrequencyPointA = 666708; #scs-SpecificCarrierList dl_offstToCarrier = 0; # subcarrierSpacing @@ -256,7 +256,7 @@ fhi_72 = { system_core = 0; io_core = 1; worker_cores = (2); - ru_addr = ("98:ae:71:01:c5:eb", "98:ae:71:01:c5:eb"); + ru_addr = ("98:ae:71:04:83:e3", "98:ae:71:04:83:e3"); mtu = 9600; fh_config = ({ T1a_cp_dl = (285, 470); diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band77.273prb.fhi72.4x4-vvdn.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band77.273prb.fhi72.4x4-vvdn.conf index 50fedbb5c2..55a78fd901 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band77.273prb.fhi72.4x4-vvdn.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band77.273prb.fhi72.4x4-vvdn.conf @@ -33,12 +33,12 @@ gNBs = # n_TimingAdvanceOffset = 0; # downlinkConfigCommon #frequencyInfoDL - # center frequency = 3999.36 MHz - # selected SSB frequency = 3999.36 MHz - absoluteFrequencySSB = 666624; + # center frequency = 4049.76 MHz + # selected SSB frequency = 4049.76 MHz + absoluteFrequencySSB = 669984; dl_frequencyBand = 77; - # frequency point A = 3950.22 MHz - dl_absoluteFrequencyPointA = 663348; + # frequency point A = 4000.62 MHz + dl_absoluteFrequencyPointA = 666708; #scs-SpecificCarrierList dl_offstToCarrier = 0; # subcarrierSpacing @@ -258,7 +258,7 @@ fhi_72 = { system_core = 0; io_core = 1; worker_cores = (2); - ru_addr = ("98:ae:71:01:c5:eb", "98:ae:71:01:c5:eb"); + ru_addr = ("98:ae:71:04:83:e3", "98:ae:71:04:83:e3"); mtu = 9600; fh_config = ({ T1a_cp_dl = (285, 470); From 9207c74cbaa172baf9bdbae6eb2a092fd4d39b0d Mon Sep 17 00:00:00 2001 From: Jaroslava Fiedlerova Date: Thu, 3 Apr 2025 23:28:05 +0200 Subject: [PATCH 30/57] CI: enable 4 DL layers in VVDN FHI72 test - increase tested throughput - modify gNB config file to enable 4 DL layers --- .../gnb.sa.band77.273prb.fhi72.4x4-vvdn.conf | 13 ++++++------- .../xml_files/container_sa_fhi72_vvdn_up2.xml | 10 +++++----- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/ci-scripts/conf_files/gnb.sa.band77.273prb.fhi72.4x4-vvdn.conf b/ci-scripts/conf_files/gnb.sa.band77.273prb.fhi72.4x4-vvdn.conf index d81dd38694..4837e4f775 100644 --- a/ci-scripts/conf_files/gnb.sa.band77.273prb.fhi72.4x4-vvdn.conf +++ b/ci-scripts/conf_files/gnb.sa.band77.273prb.fhi72.4x4-vvdn.conf @@ -18,11 +18,12 @@ gNBs = ////////// Physical parameters: pdsch_AntennaPorts_XP = 2; - pdsch_AntennaPorts_N1 = 1; - maxMIMO_layers = 2; + pdsch_AntennaPorts_N1 = 2; + maxMIMO_layers = 4; pusch_AntennaPorts = 4; do_CSIRS = 1; do_SRS = 0; + force_UL256qam_off = 1; servingCellConfigCommon = ( { @@ -177,10 +178,8 @@ MACRLCs = ( num_cc = 1; tr_s_preference = "local_L1"; tr_n_preference = "local_RRC"; - pusch_TargetSNRx10 = 180; - pucch_TargetSNRx10 = 230; - ul_bler_target_upper = .35; - ul_bler_target_lower = .15; + pusch_TargetSNRx10 = 200; + pucch_TargetSNRx10 = 250; pusch_FailureThres = 100; } ); @@ -212,7 +211,7 @@ RUs = ( sf_extension = 0; eNB_instances = [0]; ru_thread_core = 5; - sl_ahead = 5; + sl_ahead = 10; tr_preference = "raw_if4p5"; # important: activate FHI7.2 do_precoding = 0; # needs to match O-RU configuration } diff --git a/ci-scripts/xml_files/container_sa_fhi72_vvdn_up2.xml b/ci-scripts/xml_files/container_sa_fhi72_vvdn_up2.xml index df48634240..3f57f91934 100644 --- a/ci-scripts/xml_files/container_sa_fhi72_vvdn_up2.xml +++ b/ci-scripts/xml_files/container_sa_fhi72_vvdn_up2.xml @@ -89,8 +89,8 @@ Iperf - iperf (DL/300Mbps/UDP)(30 sec)(multi-ue profile) - -u -b 300M -t 30 -R + iperf (DL/600Mbps/UDP)(30 sec)(multi-ue profile) + -u -b 600M -t 30 -R up2-fhi72 20 80 @@ -109,8 +109,8 @@ Iperf - iperf (UL/70Mbps/UDP)(30 sec)(multi-ue profile) - -u -b 70M -t 30 + iperf (UL/80Mbps/UDP)(30 sec)(multi-ue profile) + -u -b 80M -t 30 up2-fhi72 20 80 @@ -123,7 +123,7 @@ iperf (UL/TCP)(30 sec)(multi-ue profile) -t 30 up2-fhi72 - 40 + 10 oc-cn5g-20897 From 0161a1c4fd39b41d9fb2de01187cecf1028ed500 Mon Sep 17 00:00:00 2001 From: Bartosz Podrygajlo Date: Fri, 20 Dec 2024 20:15:05 +0100 Subject: [PATCH 31/57] Optimization for unused symbols in NR UE After processing TX frequency domain data skip IFFT call for symbols that aren't used, the time domain buffer is memset instead. --- common/utils/nr/nr_common.h | 1 + openair1/PHY/MODULATION/modulation_common.h | 7 ++- openair1/PHY/MODULATION/ofdm_mod.c | 62 +++++++++++++------ .../NR_UE_TRANSPORT/nr_transport_proto_ue.h | 6 +- openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c | 53 ++++++++++------ .../PHY/NR_UE_TRANSPORT/srs_modulation_nr.c | 13 +++- .../PHY/NR_UE_TRANSPORT/srs_modulation_nr.h | 2 +- openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 10 +-- .../SCHED_NR_UE/phy_procedures_nr_ue_sl.c | 5 +- openair1/SCHED_NR_UE/pucch_uci_ue_nr.c | 11 +++- openair1/SCHED_NR_UE/pucch_uci_ue_nr.h | 2 +- openair1/SIMULATION/NR_PHY/dlsim.c | 7 ++- openair1/SIMULATION/NR_PHY/ulsim.c | 2 +- 13 files changed, 129 insertions(+), 52 deletions(-) diff --git a/common/utils/nr/nr_common.h b/common/utils/nr/nr_common.h index 4c1dfb619d..fdb3cc7ffc 100644 --- a/common/utils/nr/nr_common.h +++ b/common/utils/nr/nr_common.h @@ -84,6 +84,7 @@ static inline const char *rnti_types(nr_rnti_type_t rr) #define MU_SCS(m) (15 << m) #define MAX_GSCN_BAND 620 // n78 has the highest GSCN range of 619 #define NR_NUMBER_OF_SYMBOLS_PER_SLOT 14 +#define NR_NUMBER_OF_SYMBOLS_PER_SLOT_EXTENDED_CP 12 #define NR_MAX_NB_LAYERS 4 // 8 // Since the IQ samples are represented by SQ15 R+I (see https://en.wikipedia.org/wiki/Q_(number_format)) we need to compensate when diff --git a/openair1/PHY/MODULATION/modulation_common.h b/openair1/PHY/MODULATION/modulation_common.h index df521b10da..2973c36257 100644 --- a/openair1/PHY/MODULATION/modulation_common.h +++ b/openair1/PHY/MODULATION/modulation_common.h @@ -48,7 +48,12 @@ void PHY_ofdm_mod(const int *input, void normal_prefix_mod(int32_t *txdataF,int32_t *txdata,uint8_t nsymb,LTE_DL_FRAME_PARMS *frame_parms); -void nr_normal_prefix_mod(c16_t *txdataF, c16_t *txdata, uint8_t nsymb, const NR_DL_FRAME_PARMS *frame_parms, uint32_t slot); +void nr_normal_prefix_mod(c16_t *txdataF, + c16_t *txdata, + uint8_t nsymb, + const NR_DL_FRAME_PARMS *frame_parms, + uint32_t slot, + bool was_symbol_used[NR_NUMBER_OF_SYMBOLS_PER_SLOT]); void do_OFDM_mod(c16_t **txdataF, c16_t **txdata, uint32_t frame,uint16_t next_slot, LTE_DL_FRAME_PARMS *frame_parms); diff --git a/openair1/PHY/MODULATION/ofdm_mod.c b/openair1/PHY/MODULATION/ofdm_mod.c index e25f7cd7f2..6cc8cbe7c5 100644 --- a/openair1/PHY/MODULATION/ofdm_mod.c +++ b/openair1/PHY/MODULATION/ofdm_mod.c @@ -67,31 +67,55 @@ void normal_prefix_mod(int32_t *txdataF,int32_t *txdata,uint8_t nsymb,LTE_DL_FRA } -void nr_normal_prefix_mod(c16_t *txdataF, c16_t *txdata, uint8_t nsymb, const NR_DL_FRAME_PARMS *frame_parms, uint32_t slot) +void nr_normal_prefix_mod(c16_t *txdataF, + c16_t *txdata, + uint8_t nsymb, + const NR_DL_FRAME_PARMS *frame_parms, + uint32_t slot, + bool was_symbol_used[NR_NUMBER_OF_SYMBOLS_PER_SLOT]) { // This function works only slot wise. For more generic symbol generation refer nr_feptx0() if (frame_parms->numerology_index != 0) { // case where numerology != 0 if (!(slot%(frame_parms->slots_per_subframe/2))) { - PHY_ofdm_mod((int *)txdataF, - (int *)txdata, - frame_parms->ofdm_symbol_size, - 1, - frame_parms->nb_prefix_samples0, - CYCLIC_PREFIX); - PHY_ofdm_mod((int *)txdataF + frame_parms->ofdm_symbol_size, - (int *)txdata + frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples0, - frame_parms->ofdm_symbol_size, - nsymb - 1, - frame_parms->nb_prefix_samples, - CYCLIC_PREFIX); + if (was_symbol_used[0]) { + PHY_ofdm_mod((int *)txdataF, + (int *)txdata, + frame_parms->ofdm_symbol_size, + 1, + frame_parms->nb_prefix_samples0, + CYCLIC_PREFIX); + } else { + memset(txdata, 0, (frame_parms->nb_prefix_samples0 + frame_parms->ofdm_symbol_size) * sizeof(c16_t)); + } + for (int i = 1; i < nsymb; i++) { + c16_t* tx_data_ptr = txdata + (i - 1) * (frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples) + + frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples0; + if (was_symbol_used[i]) { + PHY_ofdm_mod((int *)txdataF + frame_parms->ofdm_symbol_size * i, + (int *)tx_data_ptr, + frame_parms->ofdm_symbol_size, + 1, + frame_parms->nb_prefix_samples, + CYCLIC_PREFIX); + } else { + memset(tx_data_ptr, 0, (frame_parms->nb_prefix_samples + frame_parms->ofdm_symbol_size) * sizeof(c16_t)); + } + } } else { - PHY_ofdm_mod((int *)txdataF, - (int *)txdata, - frame_parms->ofdm_symbol_size, - nsymb, - frame_parms->nb_prefix_samples, - CYCLIC_PREFIX); + for (int i = 0; i < nsymb; i++) { + c16_t* tx_data_ptr = txdata + i * (frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples); + if (was_symbol_used[i]) { + PHY_ofdm_mod((int *)txdataF + frame_parms->ofdm_symbol_size * i, + (int *)tx_data_ptr, + frame_parms->ofdm_symbol_size, + 1, + frame_parms->nb_prefix_samples, + CYCLIC_PREFIX); + } else { + memset(tx_data_ptr, 0, (frame_parms->nb_prefix_samples + frame_parms->ofdm_symbol_size) * sizeof(c16_t)); + } + } } } else { // numerology = 0, longer CP for every 7th symbol diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h index bb1a6c03df..dc075753ef 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h @@ -144,7 +144,8 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, const uint32_t frame, const uint8_t slot, nr_phy_data_tx_t *phy_data, - c16_t **txdataF); + c16_t **txdataF, + bool was_symbol_used[NR_NUMBER_OF_SYMBOLS_PER_SLOT]); /** \brief This function does IFFT for PUSCH */ @@ -154,7 +155,8 @@ uint8_t nr_ue_pusch_common_procedures(PHY_VARS_NR_UE *UE, const NR_DL_FRAME_PARMS *frame_parms, const uint8_t n_antenna_ports, c16_t **txdataF, - uint32_t linktype); + uint32_t linktype, + bool was_symbol_used[NR_NUMBER_OF_SYMBOLS_PER_SLOT]); void clean_UE_harq(PHY_VARS_NR_UE *UE); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c index 646ac2dd94..bd4ea90df8 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_ulsch_ue.c @@ -465,7 +465,8 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, const uint32_t frame, const uint8_t slot, nr_phy_data_tx_t *phy_data, - c16_t **txdataF) + c16_t **txdataF, + bool was_symbol_used[NR_NUMBER_OF_SYMBOLS_PER_SLOT]) { int harq_pid = phy_data->ulsch.pusch_pdu.pusch_data.harq_process_id; @@ -500,6 +501,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE, uint16_t rnti = pusch_pdu->rnti; for (int i = start_symbol; i < start_symbol + number_of_symbols; i++) { + was_symbol_used[i] = true; if ((ul_dmrs_symb_pos >> i) & 0x01) number_dmrs_symbols += 1; } @@ -831,37 +833,52 @@ uint8_t nr_ue_pusch_common_procedures(PHY_VARS_NR_UE *UE, const NR_DL_FRAME_PARMS *frame_parms, const uint8_t n_antenna_ports, c16_t **txdataF, - uint32_t linktype) + uint32_t linktype, + bool was_symbol_used[NR_NUMBER_OF_SYMBOLS_PER_SLOT]) { const int tx_offset = frame_parms->get_samples_slot_timestamp(slot, frame_parms, 0); int N_RB = (linktype == link_type_sl) ? frame_parms->N_RB_SL : frame_parms->N_RB_UL; c16_t **txdata = UE->common_vars.txData; - for(int ap = 0; ap < n_antenna_ports; ap++) { - apply_nr_rotation_TX(frame_parms, - txdataF[ap], - frame_parms->symbol_rotation[linktype], - slot, - N_RB, - 0, - NR_NUMBER_OF_SYMBOLS_PER_SLOT); + for (int i = 0; i < NR_NUMBER_OF_SYMBOLS_PER_SLOT; i++) { + if (was_symbol_used[i] == false) + continue; + for(int ap = 0; ap < n_antenna_ports; ap++) { + apply_nr_rotation_TX(frame_parms, + txdataF[ap], + frame_parms->symbol_rotation[linktype], + slot, + N_RB, + i, + 1); + } } + for (int ap = 0; ap < n_antenna_ports; ap++) { if (frame_parms->Ncp == 1) { // extended cyclic prefix - PHY_ofdm_mod((int *)txdataF[ap], - (int *)&txdata[ap][tx_offset], - frame_parms->ofdm_symbol_size, - 12, - frame_parms->nb_prefix_samples, - CYCLIC_PREFIX); + for (int i = 0; i < NR_NUMBER_OF_SYMBOLS_PER_SLOT_EXTENDED_CP; i++) { + if (was_symbol_used[i] == false) { + memset(&txdata[ap][tx_offset + (frame_parms->ofdm_symbol_size + frame_parms->nb_prefix_samples) * i], + 0, + (frame_parms->nb_prefix_samples + frame_parms->ofdm_symbol_size) * sizeof(int32_t)); + continue; + } + PHY_ofdm_mod((int *)&txdataF[ap][frame_parms->ofdm_symbol_size * i], + (int *)&txdata[ap][tx_offset + frame_parms->ofdm_symbol_size * i], + frame_parms->ofdm_symbol_size, + 1, + frame_parms->nb_prefix_samples, + CYCLIC_PREFIX); + } } else { // normal cyclic prefix nr_normal_prefix_mod(txdataF[ap], &txdata[ap][tx_offset], - 14, + NR_NUMBER_OF_SYMBOLS_PER_SLOT, frame_parms, - slot); + slot, + was_symbol_used); } } diff --git a/openair1/PHY/NR_UE_TRANSPORT/srs_modulation_nr.c b/openair1/PHY/NR_UE_TRANSPORT/srs_modulation_nr.c index f362e3f218..17dc69cd4f 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/srs_modulation_nr.c +++ b/openair1/PHY/NR_UE_TRANSPORT/srs_modulation_nr.c @@ -423,7 +423,10 @@ int generate_srs_nr(nfapi_nr_srs_pdu_t *srs_config_pdu, * send srs according to current configuration * *********************************************************************/ -int ue_srs_procedures_nr(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, c16_t **txdataF) +int ue_srs_procedures_nr(PHY_VARS_NR_UE *ue, + const UE_nr_rxtx_proc_t *proc, + c16_t **txdataF, + bool was_symbol_used[NR_NUMBER_OF_SYMBOLS_PER_SLOT]) { if(!ue->srs_vars[0]->active) { return -1; @@ -432,6 +435,14 @@ int ue_srs_procedures_nr(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, c16_ nfapi_nr_srs_pdu_t *srs_config_pdu = (nfapi_nr_srs_pdu_t*)&ue->srs_vars[0]->srs_config_pdu; + int first_srs_symbol = ue->frame_parms.symbols_per_slot - 1 - srs_config_pdu->time_start_position; + // Num consecutive SRS symbols according to 38.211 6.4.1.4.1 + int num_srs_symbols[] = {1, 2, 4, 8, 12}; + int last_srs_symbol = first_srs_symbol + num_srs_symbols[srs_config_pdu->num_symbols] - 1; + for (int i = first_srs_symbol; i <= last_srs_symbol; i++) { + was_symbol_used[i] = true; + } + #ifdef SRS_DEBUG LOG_I(NR_PHY,"Frame = %i, slot = %i\n", proc->frame_tx, proc->nr_slot_tx); LOG_I(NR_PHY,"srs_config_pdu->rnti = 0x%04x\n", srs_config_pdu->rnti); diff --git a/openair1/PHY/NR_UE_TRANSPORT/srs_modulation_nr.h b/openair1/PHY/NR_UE_TRANSPORT/srs_modulation_nr.h index dba339d14b..fc785c7aec 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/srs_modulation_nr.h +++ b/openair1/PHY/NR_UE_TRANSPORT/srs_modulation_nr.h @@ -79,6 +79,6 @@ int is_srs_period_nr(SRS_Resource_t *p_SRS_Resource, @param current gNB_id identifier @returns 0 if srs is transmitted -1 otherwise */ -int ue_srs_procedures_nr(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, c16_t **txdataF); +int ue_srs_procedures_nr(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, c16_t **txdataF, bool was_symbol_used[14]); #endif /* SRS_MODULATION_NR_H */ diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index 283673a6df..37593bb9a7 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -284,14 +284,15 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, n txdataF[i] = &txdataF_buf[i * samplesF_per_slot]; LOG_D(PHY,"****** start TX-Chain for AbsSubframe %d.%d ******\n", frame_tx, slot_tx); + bool was_symbol_used[NR_NUMBER_OF_SYMBOLS_PER_SLOT] = {0}; start_meas_nr_ue_phy(ue, PHY_PROC_TX); - nr_ue_ulsch_procedures(ue, frame_tx, slot_tx, phy_data, (c16_t **)&txdataF); + nr_ue_ulsch_procedures(ue, frame_tx, slot_tx, phy_data, (c16_t **)&txdataF, was_symbol_used); - ue_srs_procedures_nr(ue, proc, (c16_t **)&txdataF); + ue_srs_procedures_nr(ue, proc, (c16_t **)&txdataF, was_symbol_used); - pucch_procedures_ue_nr(ue, proc, phy_data, (c16_t **)&txdataF); + pucch_procedures_ue_nr(ue, proc, phy_data, (c16_t **)&txdataF, was_symbol_used); LOG_D(PHY, "Sending Uplink data \n"); @@ -304,7 +305,8 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, n &ue->frame_parms, ue->frame_parms.nb_antennas_tx, (c16_t **)txdataF, - link_type_ul); + link_type_ul, + was_symbol_used); stop_meas_nr_ue_phy(ue, OFDM_MOD_STATS); } diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue_sl.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue_sl.c index 5a7e9dddac..19a4449c11 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue_sl.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue_sl.c @@ -308,9 +308,12 @@ void phy_procedures_nrUE_SL_TX(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc tx_action = 1; } + bool was_symbol_used[NR_NUMBER_OF_SYMBOLS_PER_SLOT]; + for (int i = 0; i < 14; i++) + was_symbol_used[i] = true; if (tx_action) { LOG_D(NR_PHY, "Sending Uplink data \n"); - nr_ue_pusch_common_procedures(ue, proc->nr_slot_tx, fp, fp->nb_antennas_tx, txdataF, link_type_sl); + nr_ue_pusch_common_procedures(ue, proc->nr_slot_tx, fp, fp->nb_antennas_tx, txdataF, link_type_sl, was_symbol_used); } LOG_D(NR_PHY, "****** end Sidelink TX-Chain for AbsSubframe %d.%d ******\n", frame_tx, slot_tx); diff --git a/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c b/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c index ef83d8013b..03c14af9b9 100644 --- a/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c +++ b/openair1/SCHED_NR_UE/pucch_uci_ue_nr.c @@ -132,8 +132,11 @@ binary_search_float_nr( * TS 38.213 9 UE procedure for reporting control information * *********************************************************************/ - -void pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_phy_data_tx_t *phy_data, c16_t **txdataF) +void pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, + const UE_nr_rxtx_proc_t *proc, + nr_phy_data_tx_t *phy_data, + c16_t **txdataF, + bool was_symbol_used[NR_NUMBER_OF_SYMBOLS_PER_SLOT]) { const int nr_slot_tx = proc->nr_slot_tx; NR_UE_PUCCH *pucch_vars = &phy_data->pucch_vars; @@ -141,6 +144,10 @@ void pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, n for (int i=0; i<2; i++) { if(pucch_vars->active[i]) { const fapi_nr_ul_config_pucch_pdu *pucch_pdu = &pucch_vars->pucch_pdu[i]; + for (int symb_idx = 0; symb_idx < pucch_pdu->nr_of_symbols; symb_idx++) { + int symb = pucch_pdu->start_symbol_index + symb_idx; + was_symbol_used[symb] = true; + } uint16_t nb_of_prbs = pucch_pdu->prb_size; /* Generate PUCCH signal according to its format and parameters */ diff --git a/openair1/SCHED_NR_UE/pucch_uci_ue_nr.h b/openair1/SCHED_NR_UE/pucch_uci_ue_nr.h index 6c3cc3abd6..8b6ae46e3e 100644 --- a/openair1/SCHED_NR_UE/pucch_uci_ue_nr.h +++ b/openair1/SCHED_NR_UE/pucch_uci_ue_nr.h @@ -50,6 +50,6 @@ /*************** FUNCTIONS ****************************************/ -void pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_phy_data_tx_t *phy_data, c16_t **txdataF); +void pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, const UE_nr_rxtx_proc_t *proc, nr_phy_data_tx_t *phy_data, c16_t **txdataF, bool was_symbol_used[14]); #endif /* PUCCH_UCI_UE_NR_H */ diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 398923b655..7b1b34c93f 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -1091,11 +1091,16 @@ printf("%d\n", slot); frame_parms->nb_prefix_samples, CYCLIC_PREFIX); } else { + bool was_symbol_used[NR_NUMBER_OF_SYMBOLS_PER_SLOT]; + for (int i = 0; i < 14; i++) { + was_symbol_used[i] = true; + } nr_normal_prefix_mod(&gNB->common_vars.txdataF[0][aa][txdataF_offset], &txdata[aa][slot_offset], 14, frame_parms, - slot); + slot, + was_symbol_used); } } if (n_trials==1) { diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index 1b26869568..599efbbd6b 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -1525,7 +1525,7 @@ int main(int argc, char *argv[]) printStatIndent(&gNB->ulsch_decoding_stats,"ULSCH total decoding time"); printf("\nUE TX\n"); - for (int i = PHY_PROC_TX; i <= ULSCH_ENCODING_STATS; i++) { + for (int i = PHY_PROC_TX; i <= OFDM_MOD_STATS; i++) { printStatIndent(&UE->phy_cpu_stats.cpu_time_stats[i], UE->phy_cpu_stats.cpu_time_stats[i].meas_name); } printStatIndent(&gNB->rx_srs_stats,"RX SRS time"); From 3b174f685e732e45d93d651a656e0a1007f37b0d Mon Sep 17 00:00:00 2001 From: Bartosz Podrygajlo Date: Wed, 2 Apr 2025 14:32:34 +0200 Subject: [PATCH 32/57] Remove unnecessary memset of UE TX time domain samples array Remove memset of the UE TX time domain samples array after trx_write in RU_write() This memset is unnecessary and can break openair0 libraries. Some functionalities, e.g. usrp_lib write_thread expect the samples to be present in the array after trx_write returns. The array is always set before being sent either in idft or using memset so there is no risk of sending the same data twice. --- executables/nr-ue.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index b8888708aa..d34e710cec 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -553,9 +553,6 @@ static void RU_write(nr_rxtx_thread_data_t *rxtxD, bool sl_tx_action) int tmp = openair0_write_reorder(&UE->rfdevice, writeTimestamp, txp, writeBlockSize, fp->nb_antennas_tx, flags); AssertFatal(tmp == writeBlockSize, ""); - - for (int i = 0; i < fp->nb_antennas_tx; i++) - memset(txp[i], 0, writeBlockSize); } void processSlotTX(void *arg) From a4f9a7a6d4048a888fd39ccb49e249c8fc48322e Mon Sep 17 00:00:00 2001 From: Jaroslava Fiedlerova Date: Thu, 30 Jan 2025 18:12:13 +0100 Subject: [PATCH 33/57] CI: tuning gNB parameters of SABOX-B200 --- .../conf_files/gnb-du.sa.band1.52prb.usrpb210.conf | 4 ++-- .../conf_files/gnb-du.sa.band78.106prb.usrpb200.conf | 6 +++--- .../gnb.sa.band78.106prb.usrpb200.sc-fdma.conf | 11 ++++++----- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/ci-scripts/conf_files/gnb-du.sa.band1.52prb.usrpb210.conf b/ci-scripts/conf_files/gnb-du.sa.band1.52prb.usrpb210.conf index e3ba0b881e..2af3185ffc 100644 --- a/ci-scripts/conf_files/gnb-du.sa.band1.52prb.usrpb210.conf +++ b/ci-scripts/conf_files/gnb-du.sa.band1.52prb.usrpb210.conf @@ -189,11 +189,11 @@ RUs = ( nb_rx = 1 # The higher att for TX than RX is because we use a circulator (as for TDD), # while we should use a duplexer in the FDD case. However, it uses the same setup. - att_tx = 18 + att_tx = 16 att_rx = 0; bands = [1]; max_pdschReferenceSignalPower = -27; - max_rxgain = 108; + max_rxgain = 110; eNB_instances = [0]; clock_src = "internal"; } diff --git a/ci-scripts/conf_files/gnb-du.sa.band78.106prb.usrpb200.conf b/ci-scripts/conf_files/gnb-du.sa.band78.106prb.usrpb200.conf index abce64a0c6..3626cec227 100644 --- a/ci-scripts/conf_files/gnb-du.sa.band78.106prb.usrpb200.conf +++ b/ci-scripts/conf_files/gnb-du.sa.band78.106prb.usrpb200.conf @@ -194,11 +194,11 @@ RUs = ( local_rf = "yes" nb_tx = 1 nb_rx = 1 - att_tx = 10; - att_rx = 10; + att_tx = 4; + att_rx = 4; bands = [78]; max_pdschReferenceSignalPower = -27; - max_rxgain = 114; + max_rxgain = 106; eNB_instances = [0]; clock_src = "internal"; } diff --git a/ci-scripts/conf_files/gnb.sa.band78.106prb.usrpb200.sc-fdma.conf b/ci-scripts/conf_files/gnb.sa.band78.106prb.usrpb200.sc-fdma.conf index c2960b3aa7..92b0ad794c 100644 --- a/ci-scripts/conf_files/gnb.sa.band78.106prb.usrpb200.sc-fdma.conf +++ b/ci-scripts/conf_files/gnb.sa.band78.106prb.usrpb200.sc-fdma.conf @@ -83,7 +83,7 @@ gNBs = ra_ResponseWindow = 4; #ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR #1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen - ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4; + ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 2; #one (0..15) 4,8,12,16,...60,64 ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 14; #ra_ContentionResolutionTimer @@ -192,8 +192,9 @@ L1s = ( { num_cc = 1; tr_n_preference = "local_mac"; - prach_dtx_threshold = 120; + prach_dtx_threshold = 150; pucch0_dtx_threshold = 30; + max_ldpc_iterations = 15; ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 } ); @@ -203,11 +204,11 @@ RUs = ( local_rf = "yes" nb_tx = 1 nb_rx = 1 - att_tx = 10; - att_rx = 10; + att_tx = 6; + att_rx = 6; bands = [78]; max_pdschReferenceSignalPower = -27; - max_rxgain = 114; + max_rxgain = 110; eNB_instances = [0]; clock_src = "internal"; } From b3328e96a41e08b9f9b88f4d2b71d6a2c04f0167 Mon Sep 17 00:00:00 2001 From: Jaroslava Fiedlerova Date: Thu, 30 Jan 2025 21:44:19 +0100 Subject: [PATCH 34/57] CI: increase healthcheck interval for VNF-PNF deployment The healthcheck interval sets when the first health check occurs after the container starts. Increasing the healthcheck interval helps avoid marking the container as "healthy" during the initialization phase of PNF. In particular, USRP initialization of PNF service may take longer, and deployment failures can occur even after the 10 seconds interval. Extending the healtcheck interval provides more time for the service before assessing container health. --- ci-scripts/yaml_files/5g_sa_n310_4x4_60MHz/docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci-scripts/yaml_files/5g_sa_n310_4x4_60MHz/docker-compose.yml b/ci-scripts/yaml_files/5g_sa_n310_4x4_60MHz/docker-compose.yml index c349ac0406..0ecba5f39e 100644 --- a/ci-scripts/yaml_files/5g_sa_n310_4x4_60MHz/docker-compose.yml +++ b/ci-scripts/yaml_files/5g_sa_n310_4x4_60MHz/docker-compose.yml @@ -16,7 +16,7 @@ services: - ../../conf_files/gnb-vnf.sa.band77.162prb.nfapi.4x4.conf:/opt/oai-gnb/etc/gnb.conf healthcheck: test: /bin/bash -c "pgrep nr-softmodem" - interval: 10s + interval: 15s timeout: 5s retries: 5 oai-pnf: @@ -36,6 +36,6 @@ services: - ../../conf_files/gnb-pnf.band77.usrpn310.4x4.conf:/opt/oai-gnb/etc/gnb.conf healthcheck: test: /bin/bash -c "pgrep nr-softmodem" - interval: 10s + interval: 15s timeout: 5s retries: 5 From 955cad5741ae5d1acf211ee8ac6d258e2420ddce Mon Sep 17 00:00:00 2001 From: Jaroslava Fiedlerova Date: Thu, 30 Jan 2025 22:34:09 +0100 Subject: [PATCH 35/57] CI: add warning log to HTML when service is restarted --- ci-scripts/cls_containerize.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index dc461dfe7e..6562c15f28 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -889,7 +889,10 @@ class Containerize(): if deployed: break elif (attempt < num_attempts - 1): - logging.warning(f'Failed to deploy on attempt {attempt}, restart services {services}') + warning_msg = f'Restart services {services}' + logging.warning(warning_msg) + imagesInfo.append(warning_msg) + HTML.CreateHtmlTestRowQueue('N/A', 'NOK', ['\n'.join(imagesInfo)]) for svc in services.split(): CopyinServiceLog(ssh, lSourcePath, yaml_dir, svc, wd_yaml, f'{svc}-{HTML.testCase_id}-attempt{attempt}.log') ssh.run(f'docker compose -f {wd_yaml} down -- {services}') From 7417687f50495f63eb32aaee407a009bb7f364e4 Mon Sep 17 00:00:00 2001 From: Jaroslava Fiedlerova Date: Mon, 24 Mar 2025 13:34:13 +0100 Subject: [PATCH 36/57] CI: update TESTBenches doc - Cleanup and update of "Machines" table: - remove asterix - not used in CI - remove nokiabox - not used in CI - remove orion - not used in CI - update of "Lockable Resource" for individual machines - synch with https://jenkins-oai.eurecom.fr/lockable-resources/ - remove column of "IP Address" - Update information about build pipelines --- doc/TESTBenches.md | 50 ++++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/doc/TESTBenches.md b/doc/TESTBenches.md index 2ab379c88c..3a7a1f8f67 100644 --- a/doc/TESTBenches.md +++ b/doc/TESTBenches.md @@ -4,28 +4,25 @@ ## Machines -| Machine | IP address | Lockable Resource | Function | Connected devices | -| ------------- | --------------- | --------------------- | ------------------ | ----------------------------------------------------- | -| asterix | 172.21.16.127 | CI-Asterix-Usage | *unused* | 172.21.19.14 | -| obelix | 172.21.16.128 | CI-Obelix-Usage | eNB (n40, n78), nrUE | 172.21.19.13, X300 (192.168.60.2) | -| porcepix | 172.21.16.136 | CI-Porcepix | Executor, EPC, 5GC | -- | -| up2 | 172.21.19.68 | CI-UP2-Usage | COTS UE | Quectel RM520N | -| nepes | 172.21.16.137 | CI-Nepes | gNB (n78), EPC/5GC | B200mini (30C51EB) | -| ofqot | 172.21.16.109 | CI-Ofqot | gNB (n78) | B200mini (30C51D4) | -| idefix | 172.21.16.135 | CI-Idefix | COTS UE | Quectel RM500Q | -| caracal | 172.21.16.132 | CI-Caracal | gNB/phytest | N300 (192.168.10.2) | -| amariue | 172.21.16.144 | CI-Amarisoft-UE-Usage | nrUE | Amarisoft UE simulator | -| nano | 172.21.18.48 | CI-Nano-Legacy-EPC | Executor, EPC, adb | 2x COTS (adb) | -| hutch | 172.21.18.46 | CI-Hutch-Legacy-FDD-eNB | eNB (B7) | B200mini (30C5239) | -| starsky | 172.21.18.45 | CI-Starsky-Legacy-TDD-eNB | eNB (B40) | b200mini (30A3E3C) | -| carabe | 172.21.18.47 | CI-Carabe-Legacy-FDD-OAI-LTE-UE | UE (B7UE) | B200mini (30AE8C9) | -| nokiabox | 172.21.19.39 | _None_ | gNB (Nokia), 5GC | _Nokia RF integrated_ | -| avra | 172.21.16.124 | CI-Avra-Usage | gNB (n78) | AW2S Jaguar (192.168.80.239) | -| orion | 172.21.16.134 | CI-Orion-Build-Sanity-Check-Deploy-Test, CI-Orion-DsTester-Deploy-Test | Build | | -| aerial2 | 172.21.16.131 | CI-Aerial2-Usage | gNB (PNF/Nvidia CUBB + VNF) | Foxconn RU, _Nvidia Aerial SDK integrated_ | -| cacofonix | 172.21.16.150 | CI-Cacofonix-Usage | gNB (n78, FHI7.2) | | -| matix | 172.21.19.58 | CI-Matix-Usage | gNB (n77) | N310 | -| gracehopper1-oai | -- | Gracehopper1 | build, gNB/Aerial | _Nvidia Aerial SDK integrated_ | +| Machine | Lockable Resource | Function | Connected devices | +| ------------- | --------------------- | -------------------- | ----------------------------------------------------- | +| obelix | Obelix | eNB (n40, n78), nrUE | 172.21.19.13, X300 (192.168.60.2) | +| porcepix | Porcepix | Executor, EPC, 5GC | -- | +| up2 | UP2 | COTS UE | Quectel RM520N | +| nepes | Nepes | gNB (n78), EPC/5GC | B200mini (30C51EB) | +| ofqot | Ofqot | gNB (n78) | B200mini (30C51D4) | +| idefix | Idefix | COTS UE | Quectel RM500Q | +| caracal | Caracal | gNB/phytest, OAI UE | N300 (192.168.10.2), _AMD T2 card_ | +| amariue | Amarisoft-UE | nrUE | Amarisoft UE simulator | +| nano | Nano_EPC/Nano_5G_COTS_UE | Executor, EPC, adb | 2x COTS (adb) | +| hutch | Hutch | eNB (B7) | B200mini (30C5239) | +| starsky | Starsky | eNB (B40) | b200mini (30A3E3C) | +| carabe | Carabe | UE (B7UE) | B200mini (30AE8C9) | +| avra | Avra | gNB (n78) | AW2S Jaguar (192.168.80.239) | +| aerial2 | Aerial2 | gNB (PNF/Nvidia CUBB + VNF) | Foxconn RU, _Nvidia Aerial SDK integrated_ | +| cacofonix | Cacofonix | gNB (n78, FHI7.2) | -- | +| matix | Matix | gNB (n77) | N310 | +| gracehopper1-oai | Gracehopper1 | build, gNB/Aerial | _Nvidia Aerial SDK integrated_ | Note: The available resources, and their current usage, is indicated here: - [Lockable resources of jenkins-oai](https://jenkins-oai.eurecom.fr/lockable-resources/): @@ -107,6 +104,8 @@ information on how the images are built. - target image from `Dockerfile.nr-cuup.rhel9` - target image from `Dockerfile.lteUE.rhel9` - target image from `Dockerfile.nrUE.rhel9` + - build image from `Dockerfile.build.fhi72.rhel9`, followed by + - target image from `Dockerfile.gNB.fhi72.rhel9` - build image from `Dockerfile.phySim.rhel9` (creates as direct target physical simulator image) - build image from `Dockerfile.clang.rhel9` (compilation only, artifacts not used currently) @@ -122,6 +121,9 @@ information on how the images are built. - target image from `Dockerfile.nrUE.ubuntu22` - target image from `Dockerfile.lteUE.ubuntu22` - target image from `Dockerfile.lteRU.ubuntu22` + - target image from `Dockerfile.gNB.aerial.ubuntu22` + - build image from `Dockerfile.build.fhi72.ubuntu22`, followed by + - target image from `Dockerfile.gNB.fhi72.ubuntu22` - build unit tests from `ci-scripts/docker/Dockerfile.unittest.ubuntu22`, and run them - [RAN-Ubuntu-ARM-Image-Builder](https://jenkins-oai.eurecom.fr/job/RAN-Ubuntu-ARM-Image-Builder/) ~BUILD-ONLY ~4G-LTE ~5G-NR @@ -137,7 +139,7 @@ information on how the images are built. - [OAI-CN5G-COTS-UE-Test](https://jenkins-oai.eurecom.fr/job/OAI-CN5G-COTS-UE-Test/) ~5G-NR - - using 5GC bench (resources `CI-Cetautomatix-OC-oaicicd-session`, `CI-Dogmatix-CN5G-gNB`): Attach/Detach of UE with multiple PDU sessions + - using 5GC bench (resources `Cetautomatix`, `Dogmatix`): Attach/Detach of UE with multiple PDU sessions - [OAI-FLEXRIC-RAN-Integration-Test](https://jenkins-oai.eurecom.fr/job/OAI-FLEXRIC-RAN-Integration-Test/) ~5G-NR ~nrUE - selfix (gNB, nrUE, OAI 5GC, FlexRIC) - uses RFsimulator, tests FlexRIC/E2 interface and xApps @@ -171,7 +173,7 @@ information on how the images are built. - basic NSA test - [RAN-PhySim-Cluster](https://jenkins-oai.eurecom.fr/job/RAN-PhySim-Cluster/) ~4G-LTE ~5G-NR ~nrUE - - cluster (`Asterix-OC-oaicicd-session` resource), tests in OpenShift Cluster + - cluster (`RAN_OC` resource), tests in OpenShift Cluster - unitary simulators (`nr_dlsim`, etc.) - see [`./physical-simulators.md`](./physical-simulators.md) for an overview - [RAN-RF-Sim-Test-4G](https://jenkins-oai.eurecom.fr/job/RAN-RF-Sim-Test-4G/) From 1e9e0b6dc78e907309065f3d8864aa3dda9f804f Mon Sep 17 00:00:00 2001 From: Jaroslava Fiedlerova Date: Tue, 25 Mar 2025 10:46:21 +0100 Subject: [PATCH 37/57] CI: temporarily disable DRB integrity protection in B200 pipeline Temporarily deactivate DRB integrity protection in SABOX-B200 E1 testcase to avoid CI failure due to low measured throughput. Our investigation suggests that the low throughput is likely due to limitation of the UE (Quectel RM500Q), which appears to restrict the maximum data rate when integrity protection is enabled. This limitation is not observed with Quectel RM520N. --- ci-scripts/yaml_files/sa_e1_b200_gnb/docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci-scripts/yaml_files/sa_e1_b200_gnb/docker-compose.yml b/ci-scripts/yaml_files/sa_e1_b200_gnb/docker-compose.yml index 5a55ade3c8..c20a43c0e1 100644 --- a/ci-scripts/yaml_files/sa_e1_b200_gnb/docker-compose.yml +++ b/ci-scripts/yaml_files/sa_e1_b200_gnb/docker-compose.yml @@ -9,7 +9,7 @@ services: environment: USE_ADDITIONAL_OPTIONS: --telnetsrv --telnetsrv.listenport 9090 --telnetsrv.shrmod ci --log_config.global_log_options level,nocolor,time,line_num,function - --security.drb_integrity yes + --security.drb_integrity no volumes: - ../../conf_files/gnb-cucp.sa.f1.quectel.conf:/opt/oai-gnb/etc/gnb.conf # for performance reasons, we use host mode: in bridge mode, we have From a88f540081124b7a813bdeddcd938ced48b51bde Mon Sep 17 00:00:00 2001 From: Jaroslava Fiedlerova Date: Wed, 26 Mar 2025 23:17:33 +0100 Subject: [PATCH 38/57] CI: ping after reestablishment in sabox-b200 --- ci-scripts/xml_files/container_sa_b200_quectel.xml | 9 ++++++--- ci-scripts/xml_files/container_sa_e1_b200_quectel.xml | 9 ++++++--- ci-scripts/xml_files/container_sa_f1_b200_quectel.xml | 9 ++++++--- ci-scripts/xml_files/container_sa_sc_b200_quectel.xml | 9 ++++++--- 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/ci-scripts/xml_files/container_sa_b200_quectel.xml b/ci-scripts/xml_files/container_sa_b200_quectel.xml index f4f415acdf..9f3559aff1 100644 --- a/ci-scripts/xml_files/container_sa_b200_quectel.xml +++ b/ci-scripts/xml_files/container_sa_b200_quectel.xml @@ -120,9 +120,12 @@ - IdleSleep - Sleep - 10 + Ping + Ping: 20pings + idefix + sabox-nepes + -c 20 -i0.5 -w25 + 80 diff --git a/ci-scripts/xml_files/container_sa_e1_b200_quectel.xml b/ci-scripts/xml_files/container_sa_e1_b200_quectel.xml index 1718eb3152..dcbcb9a45f 100644 --- a/ci-scripts/xml_files/container_sa_e1_b200_quectel.xml +++ b/ci-scripts/xml_files/container_sa_e1_b200_quectel.xml @@ -199,9 +199,12 @@ - IdleSleep - Sleep - 10 + Ping + Ping: 20pings + idefix + sabox-nepes + -c 20 -i0.5 -w25 + 80 diff --git a/ci-scripts/xml_files/container_sa_f1_b200_quectel.xml b/ci-scripts/xml_files/container_sa_f1_b200_quectel.xml index 614b9ac57e..9622b2cf13 100644 --- a/ci-scripts/xml_files/container_sa_f1_b200_quectel.xml +++ b/ci-scripts/xml_files/container_sa_f1_b200_quectel.xml @@ -134,9 +134,12 @@ - IdleSleep - Sleep - 10 + Ping + Ping: 20pings + idefix + sabox-nepes + -c 20 -i0.5 -w25 + 80 diff --git a/ci-scripts/xml_files/container_sa_sc_b200_quectel.xml b/ci-scripts/xml_files/container_sa_sc_b200_quectel.xml index f72dafee06..69201ebcc8 100644 --- a/ci-scripts/xml_files/container_sa_sc_b200_quectel.xml +++ b/ci-scripts/xml_files/container_sa_sc_b200_quectel.xml @@ -114,9 +114,12 @@ - IdleSleep - Sleep - 10 + Ping + Ping: 20pings + idefix + sabox-nepes + -c 20 -i0.5 -w25 + 80 From dfaf9dd6301ad70d871d6c68154c94004fa11951 Mon Sep 17 00:00:00 2001 From: Shrinish Donde Date: Fri, 14 Mar 2025 19:27:06 +0100 Subject: [PATCH 39/57] RAN Control REPORT Style 1: "RRC Message" support Send the copy of the following RRC messages to a xApp, if subscribed beforehand: - DL-DCCH -> any - UL-DCCH -> any Co-authored-by: Tano Bischoff Co-authored-by: Khanh Toan Pham Co-authored-by: Theodoros Tsourdinis Co-authored-by: Miguel Fuentes Co-authored-by: Teodora Vladic Co-authored-by: Robert Schmidt --- .../E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.c | 159 +++++++++++++++++- .../RAN_FUNCTION/O-RAN/ran_func_rc_extern.h | 3 + .../RAN_FUNCTION/O-RAN/ran_func_rc_subs.c | 19 ++- .../RAN_FUNCTION/O-RAN/ran_func_rc_subs.h | 1 + openair2/RRC/NR/rrc_gNB.c | 50 +++++- openair2/RRC/NR/rrc_gNB_mobility.c | 10 ++ 6 files changed, 226 insertions(+), 16 deletions(-) diff --git a/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.c b/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.c index 99b03f2583..903a3c56b3 100644 --- a/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.c +++ b/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.c @@ -75,15 +75,38 @@ static seq_ev_trg_style_t fill_ev_tr_format_4(const char *ev_style_name) return ev_trig_style; } +static seq_ev_trg_style_t fill_ev_tr_format_1(const char *ev_style_name) +{ + seq_ev_trg_style_t ev_trig_style = {0}; + + // RIC Event Trigger Style Type + // Mandatory + // 9.3.3 + ev_trig_style.style = 1; + + // RIC Event Trigger Style Name + // Mandatory + // 9.3.4 + ev_trig_style.name = cp_str_to_ba(ev_style_name); + + // RIC Event Trigger Format Type + // Mandatory + // 9.3.5 + ev_trig_style.format = FORMAT_1_E2SM_RC_EV_TRIGGER_FORMAT; + + return ev_trig_style; +} + static void fill_rc_ev_trig(ran_func_def_ev_trig_t* ev_trig) { // Sequence of EVENT TRIGGER styles // [1 - 63] - ev_trig->sz_seq_ev_trg_style = 1; + ev_trig->sz_seq_ev_trg_style = 2; ev_trig->seq_ev_trg_style = calloc(ev_trig->sz_seq_ev_trg_style, sizeof(seq_ev_trg_style_t)); assert(ev_trig->seq_ev_trg_style != NULL && "Memory exhausted"); - ev_trig->seq_ev_trg_style[0] = fill_ev_tr_format_4("UE Information Change"); + ev_trig->seq_ev_trg_style[0] = fill_ev_tr_format_1("Message Event"); + ev_trig->seq_ev_trg_style[1] = fill_ev_tr_format_4("UE Information Change"); // Sequence of RAN Parameters for L2 Variables // [0 - 65535] @@ -167,15 +190,76 @@ static seq_report_sty_t fill_report_style_4(const char *report_name) return report_style; } +static seq_report_sty_t fill_report_style_1(const char *report_name) +{ + seq_report_sty_t report_style = {0}; + + // RIC Report Style Type + // Mandatory + // 9.3.3 + report_style.report_type = 1; + + // RIC Report Style Name + // Mandatory + // 9.3.4 + report_style.name = cp_str_to_ba(report_name); + + // Supported RIC Event Trigger Style Type + // Mandatory + // 9.3.3 + report_style.ev_trig_type = FORMAT_1_E2SM_RC_EV_TRIGGER_FORMAT; + + // RIC Report Action Format Type + // Mandatory + // 9.3.5 + report_style.act_frmt_type = FORMAT_1_E2SM_RC_ACT_DEF; + + // RIC Indication Header Format Type + // Mandatory + // 9.3.5 + report_style.ind_hdr_type = FORMAT_1_E2SM_RC_IND_HDR; + + // RIC Indication Message Format Type + // Mandatory + // 9.3.5 + report_style.ind_msg_type = FORMAT_1_E2SM_RC_IND_MSG; + + // Sequence of RAN Parameters Supported + // [0 - 65535] + report_style.sz_seq_ran_param = 1; + report_style.ran_param = calloc_or_fail(report_style.sz_seq_ran_param, sizeof(seq_ran_param_3_t)); + + // RAN Parameter ID + // Mandatory + // 9.3.8 + // [1- 4294967295] + report_style.ran_param[0].id = E2SM_RC_RS1_RRC_MESSAGE; + + // RAN Parameter Name + // Mandatory + // 9.3.9 + // [1-150] + const char ran_param_name_0[] = "RRC Message"; + report_style.ran_param[0].name = cp_str_to_ba(ran_param_name_0); + + // RAN Parameter Definition + // Optional + // 9.3.51 + report_style.ran_param[0].def = NULL; + + return report_style; +} + static void fill_rc_report(ran_func_def_report_t* report) { // Sequence of REPORT styles // [1 - 63] - report->sz_seq_report_sty = 1; + report->sz_seq_report_sty = 2; report->seq_report_sty = calloc(report->sz_seq_report_sty, sizeof(seq_report_sty_t)); assert(report->seq_report_sty != NULL && "Memory exhausted"); - report->seq_report_sty[0] = fill_report_style_4("UE Information"); + report->seq_report_sty[0] = fill_report_style_1("Message Copy"); + report->seq_report_sty[1] = fill_report_style_4("UE Information"); } static void fill_rc_control(ran_func_def_ctrl_t* ctrl) @@ -558,6 +642,67 @@ void signal_rrc_state_changed_to(const gNB_RRC_UE_t *rrc_ue_context, const rrc_s pthread_mutex_unlock(&rc_mutex); } +static rc_ind_data_t* fill_rrc_msg_copy(const byte_array_t rrc_ba, const uint16_t cond_id) +{ + rc_ind_data_t* rc_ind = malloc_or_fail(sizeof(rc_ind_data_t)); + + // Generate Indication Header + rc_ind->hdr.format = FORMAT_1_E2SM_RC_IND_HDR; + rc_ind->hdr.frmt_1.ev_trigger_id = malloc_or_fail(sizeof(uint32_t)); + *rc_ind->hdr.frmt_1.ev_trigger_id = cond_id; + + // Generate Indication Message + rc_ind->msg.format = FORMAT_1_E2SM_RC_IND_MSG; + + // Sequence of + // RAN Parameter + rc_ind->msg.frmt_1.sz_seq_ran_param = 1; + rc_ind->msg.frmt_1.seq_ran_param = calloc_or_fail(rc_ind->msg.frmt_1.sz_seq_ran_param, sizeof(seq_ran_param_t)); + + rc_ind->msg.frmt_1.seq_ran_param[0].ran_param_id = E2SM_RC_RS1_RRC_MESSAGE; + rc_ind->msg.frmt_1.seq_ran_param[0].ran_param_val.type = ELEMENT_KEY_FLAG_FALSE_RAN_PARAMETER_VAL_TYPE; + rc_ind->msg.frmt_1.seq_ran_param[0].ran_param_val.flag_false = malloc_or_fail(sizeof(ran_parameter_value_t)); + rc_ind->msg.frmt_1.seq_ran_param[0].ran_param_val.flag_false->type = OCTET_STRING_RAN_PARAMETER_VALUE; + + rc_ind->msg.frmt_1.seq_ran_param[0].ran_param_val.flag_false->octet_str_ran = copy_byte_array(rrc_ba); + + // Call Process ID + rc_ind->proc_id = NULL; + + return rc_ind; +} + +static void check_rrc_msg_copy(const nr_rrc_class_e nr_channel, const uint32_t rrc_msg_id, const byte_array_t rrc_ba, const uint32_t ric_req_id, const e2sm_rc_ev_trg_frmt_1_t *frmt_1) +{ + for (size_t i = 0; i < frmt_1->sz_msg_ev_trg; i++) { + if (frmt_1->msg_ev_trg[i].msg_type != RRC_MSG_MSG_TYPE_EV_TRG) + continue; + if (frmt_1->msg_ev_trg[i].rrc_msg.type != NR_RRC_MESSAGE_ID) + continue; + if (frmt_1->msg_ev_trg[i].rrc_msg.nr == nr_channel && frmt_1->msg_ev_trg[i].rrc_msg.rrc_msg_id == rrc_msg_id) { + rc_ind_data_t* rc_ind_data = fill_rrc_msg_copy(rrc_ba, frmt_1->msg_ev_trg[i].ev_trigger_cond_id); + send_aper_ric_ind(ric_req_id, rc_ind_data); + } + } +} + +void signal_rrc_msg(const nr_rrc_class_e nr_channel, const uint32_t rrc_msg_id, const byte_array_t rrc_ba) +{ + pthread_mutex_lock(&rc_mutex); + if (rc_subs_data.rs1_param3.data == NULL) { + pthread_mutex_unlock(&rc_mutex); + return; + } + + const size_t num_subs = seq_arr_size(&rc_subs_data.rs1_param3); + for (size_t sub_idx = 0; sub_idx < num_subs; sub_idx++) { + const ran_param_data_t data = *(const ran_param_data_t *)seq_arr_at(&rc_subs_data.rs1_param3, sub_idx); + check_rrc_msg_copy(nr_channel, rrc_msg_id, rrc_ba, data.ric_req_id, &data.ev_tr.frmt_1); + } + + pthread_mutex_unlock(&rc_mutex); +} + static void free_aperiodic_subscription(uint32_t ric_req_id) { remove_rc_subs_data(&rc_subs_data, ric_req_id); @@ -568,6 +713,12 @@ static seq_arr_t *get_sa(const e2sm_rc_event_trigger_t *ev_tr, const uint32_t ra seq_arr_t *sa = NULL; switch (ev_tr->format) { + case FORMAT_1_E2SM_RC_EV_TRIGGER_FORMAT: + if (ran_param_id == E2SM_RC_RS1_RRC_MESSAGE) { + sa = &rc_subs_data.rs1_param3; + } + break; + case FORMAT_4_E2SM_RC_EV_TRIGGER_FORMAT: if (ran_param_id == E2SM_RC_RS4_RRC_STATE_CHANGED_TO) { sa = &rc_subs_data.rs4_param202; diff --git a/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc_extern.h b/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc_extern.h index 5f9633453b..83b933639e 100644 --- a/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc_extern.h +++ b/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc_extern.h @@ -23,8 +23,11 @@ #define RAN_FUNC_SM_RAN_CTRL_EXTERN_AGENT_H #include "openair2/RRC/NR/nr_rrc_defs.h" +#include "openair2/E2AP/flexric/src/lib/3gpp/ie/rrc_msg_id.h" #include "openair2/E2AP/flexric/src/sm/rc_sm/ie/ir/rrc_state.h" +void signal_rrc_msg(const nr_rrc_class_e nr_channel, const uint32_t rrc_msg_id, const byte_array_t rrc_ba); + void signal_rrc_state_changed_to(const gNB_RRC_UE_t *rrc_ue_context, const rrc_state_e2sm_rc_e rrc_state); #endif diff --git a/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc_subs.c b/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc_subs.c index 9d37a89fd8..9e993a8c2e 100644 --- a/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc_subs.c +++ b/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc_subs.c @@ -41,6 +41,7 @@ void init_rc_subs_data(rc_subs_data_t *rc_subs_data) { pthread_mutex_lock(&rc_mutex); // Initialize sequence array + seq_arr_init(&rc_subs_data->rs1_param3, sizeof(ran_param_data_t)); seq_arr_init(&rc_subs_data->rs4_param202, sizeof(ran_param_data_t)); pthread_mutex_unlock(&rc_mutex); } @@ -57,9 +58,19 @@ void remove_rc_subs_data(rc_subs_data_t *rc_subs_data, uint32_t ric_req_id) { pthread_mutex_lock(&rc_mutex); /* find the sequence element that matches RIC request ID */ - elm_arr_t elm = find_if(&rc_subs_data->rs4_param202, (void *)&ric_req_id, eq_int); - ran_param_data_t *data = elm.it; - free_e2sm_rc_event_trigger(&data->ev_tr); - seq_arr_erase(&rc_subs_data->rs4_param202, elm.it); + elm_arr_t elm_rs1_param3 = find_if(&rc_subs_data->rs1_param3, (void *)&ric_req_id, eq_int); + ran_param_data_t *data_rs1_param3 = elm_rs1_param3.it; + if (data_rs1_param3 != NULL) { + free_e2sm_rc_event_trigger(&data_rs1_param3->ev_tr); + seq_arr_erase(&rc_subs_data->rs1_param3, elm_rs1_param3.it); + } + + /* find the sequence element that matches RIC request ID */ + elm_arr_t elm_rs4_param202 = find_if(&rc_subs_data->rs4_param202, (void *)&ric_req_id, eq_int); + ran_param_data_t *data_rs4_param202 = elm_rs4_param202.it; + if (data_rs4_param202 != NULL) { + free_e2sm_rc_event_trigger(&data_rs4_param202->ev_tr); + seq_arr_erase(&rc_subs_data->rs4_param202, elm_rs4_param202.it); + } pthread_mutex_unlock(&rc_mutex); } diff --git a/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc_subs.h b/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc_subs.h index 702e08511e..dff9224db2 100644 --- a/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc_subs.h +++ b/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc_subs.h @@ -31,6 +31,7 @@ typedef struct ran_param_data { } ran_param_data_t; typedef struct { + seq_arr_t rs1_param3; // E2SM_RC_RS1_RRC_MESSAGE seq_arr_t rs4_param202; // E2SM_RC_RS4_RRC_STATE_CHANGED_TO } rc_subs_data_t; diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 22bf766716..cfb6c499a3 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -98,6 +98,12 @@ #ifdef E2_AGENT #include "openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc_extern.h" +#define E2_AGENT_SIGNAL_DL_DCCH_RRC_MSG(BUF, LEN, ID) \ + do { \ + byte_array_t buffer_ba = {.len = LEN}; \ + buffer_ba.buf = (uint8_t *)BUF; \ + signal_rrc_msg(DL_DCCH_NR_RRC_CLASS, ID, buffer_ba); \ + } while (0) #endif mui_t rrc_gNB_mui = 0; @@ -188,6 +194,7 @@ static void rrc_deliver_dl_rrc_message(void *deliver_pdu_data, ue_id_t ue_id, in void nr_rrc_transfer_protected_rrc_message(const gNB_RRC_INST *rrc, const gNB_RRC_UE_t *ue_p, uint8_t srb_id, + const uint32_t message_id, const uint8_t *buffer, int size) { @@ -203,6 +210,10 @@ void nr_rrc_transfer_protected_rrc_message(const gNB_RRC_INST *rrc, (unsigned char *const)buffer, rrc_deliver_dl_rrc_message, &data); + +#ifdef E2_AGENT + E2_AGENT_SIGNAL_DL_DCCH_RRC_MSG(buffer, size, message_id); +#endif } ///---------------------------------------------------------------------------------------------------------------/// @@ -572,7 +583,8 @@ static void rrc_gNB_generate_dedicatedRRCReconfiguration(gNB_RRC_INST *rrc, gNB_ DevAssert(size > 0 && size <= sizeof(buffer)); LOG_UE_DL_EVENT(ue_p, "Generate RRCReconfiguration (bytes %d, xid %d)\n", size, xid); - nr_rrc_transfer_protected_rrc_message(rrc, ue_p, DL_SCH_LCID_DCCH, buffer, size); + const uint32_t msg_id = NR_DL_DCCH_MessageType__c1_PR_rrcReconfiguration; + nr_rrc_transfer_protected_rrc_message(rrc, ue_p, DL_SCH_LCID_DCCH, msg_id, buffer, size); } void rrc_gNB_modify_dedicatedRRCReconfiguration(gNB_RRC_INST *rrc, gNB_RRC_UE_t *ue_p) @@ -681,7 +693,8 @@ void rrc_gNB_modify_dedicatedRRCReconfiguration(gNB_RRC_INST *rrc, gNB_RRC_UE_t clear_nas_pdu(&ue_p->pduSession[i].param.nas_pdu); LOG_I(NR_RRC, "UE %d: Generate RRCReconfiguration (bytes %d)\n", ue_p->rrc_ue_id, size); - nr_rrc_transfer_protected_rrc_message(rrc, ue_p, DL_SCH_LCID_DCCH, buffer, size); + const uint32_t msg_id = NR_DL_DCCH_MessageType__c1_PR_rrcReconfiguration; + nr_rrc_transfer_protected_rrc_message(rrc, ue_p, DL_SCH_LCID_DCCH, msg_id, buffer, size); } //----------------------------------------------------------------------------- @@ -733,7 +746,8 @@ void rrc_gNB_generate_dedicatedRRCReconfiguration_release(gNB_RRC_INST *rrc, } LOG_I(NR_RRC, "UE %d: Generate NR_RRCReconfiguration (bytes %d)\n", ue_p->rrc_ue_id, size); - nr_rrc_transfer_protected_rrc_message(rrc, ue_p, DL_SCH_LCID_DCCH, buffer, size); + const uint32_t msg_id = NR_DL_DCCH_MessageType__c1_PR_rrcReconfiguration; + nr_rrc_transfer_protected_rrc_message(rrc, ue_p, DL_SCH_LCID_DCCH, msg_id, buffer, size); } static void fill_security_info(gNB_RRC_INST *rrc, gNB_RRC_UE_t *UE, security_information_t *secInfo) @@ -888,6 +902,10 @@ static void rrc_gNB_generate_RRCReestablishment(rrc_gNB_ue_context_t *ue_context deliver_dl_rrc_message_data_t data = {.rrc = rrc, .dl_rrc = &dl_rrc, .assoc_id = ue_data.du_assoc_id}; nr_pdcp_data_req_srb(ue_p->rrc_ue_id, DL_SCH_LCID_DCCH, rrc_gNB_mui++, size, (unsigned char *const)buffer, rrc_deliver_dl_rrc_message, &data); +#ifdef E2_AGENT + E2_AGENT_SIGNAL_DL_DCCH_RRC_MSG(buffer, size, NR_DL_DCCH_MessageType__c1_PR_rrcReestablishment); +#endif + /* RRCReestablishment has been generated, let's enable ciphering now. */ security_parameters.ciphering_algorithm = ue_p->ciphering_algorithm; /* SRBs */ @@ -988,7 +1006,8 @@ static void rrc_gNB_process_RRCReestablishmentComplete(gNB_RRC_INST *rrc, gNB_RR ue_p->rrc_ue_id, ue_p->rnti, size); - nr_rrc_transfer_protected_rrc_message(rrc, ue_p, DL_SCH_LCID_DCCH, buffer, size); + const uint32_t msg_id = NR_DL_DCCH_MessageType__c1_PR_rrcReconfiguration; + nr_rrc_transfer_protected_rrc_message(rrc, ue_p, DL_SCH_LCID_DCCH, msg_id, buffer, size); } //----------------------------------------------------------------------------- @@ -1009,7 +1028,8 @@ int nr_rrc_reconfiguration_req(gNB_RRC_INST *rrc, gNB_RRC_UE_t *ue_p, const int uint8_t buffer[NR_RRC_BUF_SIZE]; int size = do_RRCReconfiguration(ue_p, buffer, NR_RRC_BUF_SIZE, xid, NULL, NULL, NULL, NULL, NULL, NULL, masterCellGroup); - nr_rrc_transfer_protected_rrc_message(rrc, ue_p, DL_SCH_LCID_DCCH, buffer, size); + const uint32_t msg_id = NR_DL_DCCH_MessageType__c1_PR_rrcReconfiguration; + nr_rrc_transfer_protected_rrc_message(rrc, ue_p, DL_SCH_LCID_DCCH, msg_id, buffer, size); return 0; } @@ -1443,7 +1463,8 @@ void rrc_forward_ue_nas_message(gNB_RRC_INST *rrc, gNB_RRC_UE_t *UE) uint32_t length = do_NR_DLInformationTransfer(buffer, sizeof(buffer), xid, UE->nas_pdu.length, UE->nas_pdu.buffer); LOG_DUMPMSG(NR_RRC, DEBUG_RRC, buffer, length, "[MSG] RRC DL Information Transfer\n"); rb_id_t srb_id = UE->Srb[2].Active ? DL_SCH_LCID_DCCH1 : DL_SCH_LCID_DCCH; - nr_rrc_transfer_protected_rrc_message(rrc, UE, srb_id, buffer, length); + const uint32_t msg_id = NR_DL_DCCH_MessageType__c1_PR_dlInformationTransfer; + nr_rrc_transfer_protected_rrc_message(rrc, UE, srb_id, msg_id, buffer, length); // no need to free UE->nas_pdu.buffer, do_NR_DLInformationTransfer() did that UE->nas_pdu.buffer = NULL; UE->nas_pdu.length = 0; @@ -1695,7 +1716,8 @@ static void rrc_gNB_generate_UECapabilityEnquiry(gNB_RRC_INST *rrc, gNB_RRC_UE_t AssertFatal(!NODE_IS_DU(rrc->node_type), "illegal node type DU!\n"); - nr_rrc_transfer_protected_rrc_message(rrc, ue, DL_SCH_LCID_DCCH, buffer, size); + const uint32_t msg_id = NR_DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry; + nr_rrc_transfer_protected_rrc_message(rrc, ue, DL_SCH_LCID_DCCH, msg_id, buffer, size); } static int rrc_gNB_decode_dcch(gNB_RRC_INST *rrc, const f1ap_ul_rrc_message_t *msg) @@ -1729,6 +1751,13 @@ static int rrc_gNB_decode_dcch(gNB_RRC_INST *rrc, const f1ap_ul_rrc_message_t *m } if (ul_dcch_msg->message.present == NR_UL_DCCH_MessageType_PR_c1) { +#ifdef E2_AGENT + // 38.331 Sec 6.2.1: message index of UL-DCCH-Message + const uint32_t rrc_msg_id = ul_dcch_msg->message.choice.c1->present; + byte_array_t buffer_ba = {.len = msg->rrc_container_length}; + buffer_ba.buf = msg->rrc_container; + signal_rrc_msg(UL_DCCH_NR_RRC_CLASS, rrc_msg_id, buffer_ba); +#endif switch (ul_dcch_msg->message.choice.c1->present) { case NR_UL_DCCH_MessageType__c1_PR_NOTHING: LOG_I(NR_RRC, "Received PR_NOTHING on UL-DCCH-Message\n"); @@ -2722,7 +2751,8 @@ void rrc_gNB_generate_SecurityModeCommand(gNB_RRC_INST *rrc, gNB_RRC_UE_t *ue_p) LOG_DUMPMSG(NR_RRC, DEBUG_RRC, (char *)buffer, size, "[MSG] RRC Security Mode Command\n"); LOG_I(NR_RRC, "UE %u Logical Channel DL-DCCH, Generate SecurityModeCommand (bytes %d)\n", ue_p->rrc_ue_id, size); - nr_rrc_transfer_protected_rrc_message(rrc, ue_p, DL_SCH_LCID_DCCH, buffer, size); + const uint32_t msg_id = NR_DL_DCCH_MessageType__c1_PR_securityModeCommand; + nr_rrc_transfer_protected_rrc_message(rrc, ue_p, DL_SCH_LCID_DCCH, msg_id, buffer, size); } //----------------------------------------------------------------------------- @@ -2747,6 +2777,10 @@ void rrc_gNB_generate_RRCRelease(gNB_RRC_INST *rrc, gNB_RRC_UE_t *UE) }; deliver_ue_ctxt_release_data_t data = {.rrc = rrc, .release_cmd = &ue_context_release_cmd, .assoc_id = ue_data.du_assoc_id}; nr_pdcp_data_req_srb(UE->rrc_ue_id, DL_SCH_LCID_DCCH, rrc_gNB_mui++, size, buffer, rrc_deliver_ue_ctxt_release_cmd, &data); + +#ifdef E2_AGENT + E2_AGENT_SIGNAL_DL_DCCH_RRC_MSG(buffer, size, NR_DL_DCCH_MessageType__c1_PR_rrcRelease); +#endif } int rrc_gNB_generate_pcch_msg(sctp_assoc_t assoc_id, const NR_SIB1_t *sib1, uint32_t tmsi, uint8_t paging_drx) diff --git a/openair2/RRC/NR/rrc_gNB_mobility.c b/openair2/RRC/NR/rrc_gNB_mobility.c index a6f4acb953..db1c4bb904 100644 --- a/openair2/RRC/NR/rrc_gNB_mobility.c +++ b/openair2/RRC/NR/rrc_gNB_mobility.c @@ -36,6 +36,10 @@ #include "openair3/SECU/key_nas_deriver.h" #include "openair2/RRC/NR/rrc_gNB_NGAP.h" +#ifdef E2_AGENT +#include "openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc_extern.h" +#endif + typedef enum { HO_CTX_BOTH, HO_CTX_SOURCE, HO_CTX_TARGET } ho_ctx_type_t; static nr_handover_context_t *alloc_ho_ctx(ho_ctx_type_t type) { @@ -242,6 +246,12 @@ static void rrc_gNB_trigger_reconfiguration_for_handover(gNB_RRC_INST *rrc, gNB_ (unsigned char *const)rrc_reconf, rrc_deliver_ue_ctxt_modif_req, &data); +#ifdef E2_AGENT + uint32_t message_id = NR_DL_DCCH_MessageType__c1_PR_rrcReconfiguration; + byte_array_t buffer_ba = {.len = rrc_reconf_len}; + buffer_ba.buf = rrc_reconf; + signal_rrc_msg(DL_DCCH_NR_RRC_CLASS, message_id, buffer_ba); +#endif } static void nr_rrc_f1_ho_acknowledge(gNB_RRC_INST *rrc, gNB_RRC_UE_t *UE, uint8_t *rrc_reconf_buf, uint32_t rrc_reconf_len) From 54fd8ed9df804712ad1ab989290914456d94e7ba Mon Sep 17 00:00:00 2001 From: Romain Beurdouche Date: Tue, 18 Mar 2025 10:05:09 +0000 Subject: [PATCH 40/57] feat(oran_fhlib_5g): BFP compression and decompression for Arm targets The fronthaul library ships with BFP compression for AVX512 enabled targets. This commit adds BFP compression for Arm targets by using the ArmRAL library. --- cmake_targets/tools/MODULES/Findarmral.cmake | 123 +++++++++++++++++++ radio/fhi_72/CMakeLists.txt | 5 + radio/fhi_72/armral_bfp_compression.c | 116 +++++++++++++++++ radio/fhi_72/armral_bfp_compression.h | 59 +++++++++ radio/fhi_72/oaioran.c | 33 ++++- 5 files changed, 330 insertions(+), 6 deletions(-) create mode 100644 cmake_targets/tools/MODULES/Findarmral.cmake create mode 100644 radio/fhi_72/armral_bfp_compression.c create mode 100644 radio/fhi_72/armral_bfp_compression.h diff --git a/cmake_targets/tools/MODULES/Findarmral.cmake b/cmake_targets/tools/MODULES/Findarmral.cmake new file mode 100644 index 0000000000..79407ffc91 --- /dev/null +++ b/cmake_targets/tools/MODULES/Findarmral.cmake @@ -0,0 +1,123 @@ +# +# 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 +# + +# FindArmral +# ------- +# +# Finds the armral library. +# the version is currently hardcoded to 25.01 +# +# Optional options +# ^^^^^^^^^^^^^^^^ +# +# ``armral_LOCATION`` +# The location of the library. +# +# Imported Targets +# ^^^^^^^^^^^^^^^^ +# +# This module provides the following imported targets, if found: +# +# ``armral`` +# The armral library +# +# Result Variables +# ^^^^^^^^^^^^^^^^ +# +# This will define the following variables: +# +# ``armral_FOUND`` +# True if the system has the armral library. +# ``armral_VERSION`` +# The version of the armral library which was found. +# ``armral_INCLUDE_DIRS`` +# Include directories needed to use armral. +# ``armral_LIBRARIES`` +# Libraries needed to link to armral. +# +# Cache Variables +# ^^^^^^^^^^^^^^^ +# +# The following cache variables may also be set: +# +# ``armral_INCLUDE_DIR`` +# The directory containing ``armral.h``. +# ``armral_LIBRARY`` +# The path to the armral library. + +option(armral_LOCATION "directory of ArmRAL library" "") +if (NOT armral_LOCATION) + set(armral_LOCATION "/usr/local") +endif() +if (NOT EXISTS ${armral_LOCATION}) + message(FATAL_ERROR "no such directory: ${armral_LOCATION}") +endif() + +find_path(armral_INCLUDE_DIR + NAMES + armral.h + HINTS ${armral_LOCATION} + PATH_SUFFIXES include + NO_DEFAULT_PATH +) +if (NOT armral_INCLUDE_DIR) + message(FATAL_ERROR "could not detect armral header at ${armral_LOCATION}/include") +endif() + +find_library(armral_LIBRARY + NAMES armral + HINTS ${armral_LOCATION} + PATH_SUFFIXES lib build + NO_DEFAULT_PATH +) +if (NOT armral_LIBRARY) + message(FATAL_ERROR "could not detect armral build artifacts at neither ${armral_LOCATION}/lib nor ${armral_LOCATION}/build") +endif() + +# No way to retrieve the version from header or library +set(armral_VERSION 25.01) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(armral + FOUND_VAR armral_FOUND + REQUIRED_VARS + armral_LIBRARY + armral_INCLUDE_DIR + VERSION_VAR armral_VERSION +) + +if(armral_FOUND) + set(armral_LIBRARIES ${armral_LIBRARY}) + set(armral_INCLUDE_DIRS ${armral_INCLUDE_DIR}) +endif() + +if(armral_FOUND AND NOT TARGET armral) + add_library(armral UNKNOWN IMPORTED) + set_target_properties(armral PROPERTIES + IMPORTED_LOCATION "${armral_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES "${armral_INCLUDE_DIRS}" + ) +endif() + +mark_as_advanced( + armral_INCLUDE_DIR + armral_LIBRARY +) diff --git a/radio/fhi_72/CMakeLists.txt b/radio/fhi_72/CMakeLists.txt index 4a9064e661..cec59d38ad 100644 --- a/radio/fhi_72/CMakeLists.txt +++ b/radio/fhi_72/CMakeLists.txt @@ -32,6 +32,11 @@ add_compile_options(-Wno-packed-not-aligned) set_target_properties(oran_fhlib_5g PROPERTIES COMPILE_FLAGS "-fvisibility=hidden -march=native") target_link_libraries(oran_fhlib_5g PRIVATE xran::xran ${dpdk_LINK_LIBRARIES} ${T_LIB} pthread dl rt m numa) target_include_directories(oran_fhlib_5g PRIVATE ${dpdk_INCLUDE_DIRS}) +if (CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64") + find_package(armral REQUIRED) + target_sources(oran_fhlib_5g PRIVATE armral_bfp_compression.c) + target_link_libraries(oran_fhlib_5g PRIVATE armral) +endif() add_boolean_option(OAI_FHI72_USE_POLLING OFF "Enable polling in FHI72 driver" ON) diff --git a/radio/fhi_72/armral_bfp_compression.c b/radio/fhi_72/armral_bfp_compression.c new file mode 100644 index 0000000000..a02d4a4106 --- /dev/null +++ b/radio/fhi_72/armral_bfp_compression.c @@ -0,0 +1,116 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +/*! \file radio/fhi_72/armral_bfp_compression.c + * \brief BFP compression for the O-RAN 7.2 FrontHaul Interface for Arm systems using the Arm RAN Acceleration Library + * \author Romain Beurdouche + * \date 2025 + * \company EURECOM + * \email romain.beurdouche@eurecom.fr + * \note ArmRAL available at https://git.gitlab.arm.com/networking/ral.git + * \warning + */ + +#include "armral.h" +#include + +#include "armral_bfp_compression.h" +#include "common/utils/LOG/log.h" + +/** + * The function operates on a fixed block size of one Physical Resource Block + * (PRB). Each block consists of 12 16-bit complex resource elements. Each block + * taken as input is compressed into 24 samples with a common unsigned scaling factor. + * + * @param[in] iq_width Width in bits of compressed samples. + * @param[in] n_prb The number of input resource blocks. + * @param[in] src Points to the input complex samples sequence. + * @param[out] dst Points to the output compressed data. + */ +void armral_bfp_compression(uint32_t iq_width, uint32_t n_prb, int16_t *src, int8_t *dst) +{ + armral_status ret = ARMRAL_ARGUMENT_ERROR; + switch (iq_width) { + case 8: + ret = armral_block_float_compr_8bit(n_prb, (armral_cmplx_int16_t *)src, (armral_compressed_data_8bit *)dst, NULL); + if (unlikely(ret != ARMRAL_SUCCESS)) { + LOG_E(HW, "armral_block_scaling_compr_8bit returned an error: %d\n", (int)ret); + } + break; + + case 9: + ret = armral_block_float_compr_9bit(n_prb, (armral_cmplx_int16_t *)src, (armral_compressed_data_9bit *)dst, NULL); + if (unlikely(ret != ARMRAL_SUCCESS)) { + LOG_E(HW, "armral_block_scaling_compr_9bit returned an error: %d\n", (int)ret); + } + break; + + case 14: + ret = armral_block_float_compr_14bit(n_prb, (armral_cmplx_int16_t *)src, (armral_compressed_data_14bit *)dst, NULL); + if (unlikely(ret != ARMRAL_SUCCESS)) { + LOG_E(HW, "armral_block_scaling_compr_14bit returned an error: %d\n", (int)ret); + } + break; + + default: + LOG_E(HW, "Unsupported IQ width in BFP compression: %d\n", iq_width); + } +} + +/** + * The function operates on a fixed block size of one Physical Resource Block + * (PRB). Each block consists of 12 compressed complex resource elements. + * Each block taken as input is expanded into 12 16-bit complex samples. + * + * @param[in] iq_width Width in bits of compressed samples. + * @param[in] n_prb The number of input resource blocks. + * @param[in] src Points to the input compressed data. + * @param[out] dst Points to the output complex samples sequence. + */ +void armral_bfp_decompression(uint32_t iq_width, uint32_t n_prb, int8_t *src, int16_t *dst) +{ + armral_status ret = ARMRAL_ARGUMENT_ERROR; + switch (iq_width) { + case 8: + ret = armral_block_float_decompr_8bit(n_prb, (armral_compressed_data_8bit *)src, (armral_cmplx_int16_t *)dst, NULL); + if (unlikely(ret != ARMRAL_SUCCESS)) { + LOG_E(HW, "armral_block_scaling_decompr_8bit returned an error: %d\n", (int)ret); + } + break; + + case 9: + ret = armral_block_float_decompr_9bit(n_prb, (armral_compressed_data_9bit *)src, (armral_cmplx_int16_t *)dst, NULL); + if (unlikely(ret != ARMRAL_SUCCESS)) { + LOG_E(HW, "armral_block_scaling_decompr_9bit returned an error: %d\n", (int)ret); + } + break; + + case 14: + ret = armral_block_float_decompr_14bit(n_prb, (armral_compressed_data_14bit *)src, (armral_cmplx_int16_t *)dst, NULL); + if (unlikely(ret != ARMRAL_SUCCESS)) { + LOG_E(HW, "armral_block_scaling_decompr_14bit returned an error: %d\n", (int)ret); + } + break; + + default: + LOG_E(HW, "Unsupported IQ width in BFP decompression: %d\n", iq_width); + } +} diff --git a/radio/fhi_72/armral_bfp_compression.h b/radio/fhi_72/armral_bfp_compression.h new file mode 100644 index 0000000000..22cee0aa8b --- /dev/null +++ b/radio/fhi_72/armral_bfp_compression.h @@ -0,0 +1,59 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.openairinterface.org/?page_id=698 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + *------------------------------------------------------------------------------- + * For more information about the OpenAirInterface (OAI) Software Alliance: + * contact@openairinterface.org + */ + +/*! \file radio/fhi_72/armral_bfp_compression.h + * \brief BFP compression for the O-RAN 7.2 FrontHaul Interface for Arm systems using the Arm RAN Acceleration Library + * \author Romain Beurdouche + * \date 2025 + * \company EURECOM + * \email romain.beurdouche@eurecom.fr + * \note ArmRAL available at https://git.gitlab.arm.com/networking/ral.git + * \warning + */ + +#ifndef __ARMRAL_BFP_COMPRESSION_H__ +#define __ARMRAL_BFP_COMPRESSION_H__ + +/** + * The function operates on a fixed block size of one Physical Resource Block + * (PRB). Each block consists of 12 16-bit complex resource elements. Each block + * taken as input is compressed into 24 samples with a common unsigned scaling factor. + * + * @param[in] iq_width Width in bits of compressed samples. + * @param[in] n_prb The number of input resource blocks. + * @param[in] src Points to the input complex samples sequence. + * @param[out] dst Points to the output compressed data. + */ +void armral_bfp_compression(uint32_t iq_width, uint32_t n_prb, int16_t *src, int8_t *dst); + +/** + * The function operates on a fixed block size of one Physical Resource Block + * (PRB). Each block consists of 12 compressed complex resource elements. + * Each block taken as input is expanded into 12 16-bit complex samples. + * + * @param[in] iq_width Width in bits of compressed samples. + * @param[in] n_prb The number of input resource blocks. + * @param[in] src Points to the input compressed data. + * @param[out] dst Points to the output complex samples sequence. + */ +void armral_bfp_decompression(uint32_t iq_width, uint32_t n_prb, int8_t *src, int16_t *dst); + +#endif diff --git a/radio/fhi_72/oaioran.c b/radio/fhi_72/oaioran.c index afa6384741..7ac4998e40 100644 --- a/radio/fhi_72/oaioran.c +++ b/radio/fhi_72/oaioran.c @@ -24,6 +24,7 @@ #include #include "xran_fh_o_du.h" #include "xran_compression.h" +#include "armral_bfp_compression.h" #if defined(__arm__) || defined(__aarch64__) #else @@ -215,12 +216,14 @@ static int read_prach_data(ru_info_t *ru, int frame, int slot) } } } else if (ru_conf->compMeth_PRACH == XRAN_COMPMETHOD_BLKFLOAT) { - struct xranlib_decompress_request bfp_decom_req = {}; - struct xranlib_decompress_response bfp_decom_rsp = {}; int16_t local_dst[12 * 2 * N_SC_PER_PRB] __attribute__((aligned(64))); +#if defined(__i386__) || defined(__x86_64__) + struct xranlib_decompress_request bfp_decom_req = {}; + struct xranlib_decompress_response bfp_decom_rsp = {}; int payload_len = (3 * ru_conf->iqWidth_PRACH + 1) * 12; // 12 = closest number of PRBs to 139 REs + bfp_decom_req.data_in = (int8_t *)src; bfp_decom_req.numRBs = 12; // closest number of PRBs to 139 REs bfp_decom_req.len = payload_len; @@ -230,6 +233,11 @@ static int read_prach_data(ru_info_t *ru, int frame, int slot) bfp_decom_rsp.data_out = (int16_t *)local_dst; bfp_decom_rsp.len = 0; xranlib_decompress_avx512(&bfp_decom_req, &bfp_decom_rsp); +#elif defined(__arm__) || defined(__aarch64__) + armral_bfp_decompression(ru_conf->iqWidth_PRACH, 12, (int8_t *)src, (int16_t *)local_dst); +#else + AssertFatal(1 == 0, "BFP decompression not supported on this architecture"); +#endif // note: this is hardwired for 139 point PRACH sequence, kbar=2 if (sym_idx == 0) // for (idx = 0; idx < (139 * 2); idx++) @@ -380,8 +388,6 @@ int xran_fh_rx_read_slot(ru_info_t *ru, int *frame, int *slot) uint32_t idxElm = 0; uint8_t *src = (uint8_t *)ptr; - int16_t payload_len = 0; - LOG_D(HW, "pRbMap->nPrbElm %d\n", pRbMap->nPrbElm); for (idxElm = 0; idxElm < pRbMap->nPrbElm; idxElm++) { @@ -412,10 +418,12 @@ int xran_fh_rx_read_slot(ru_info_t *ru, int *frame, int *slot) memcpy((void *)dst2, (void *)local_dst, neg_len * 4); memcpy((void *)dst1, (void *)&local_dst[neg_len], pos_len * 4); } else if (pRbElm->compMethod == XRAN_COMPMETHOD_BLKFLOAT) { +#if defined(__i386__) || defined(__x86_64__) struct xranlib_decompress_request bfp_decom_req = {}; struct xranlib_decompress_response bfp_decom_rsp = {}; - payload_len = (3 * pRbElm->iqWidth + 1) * pRbElm->nRBSize; + int16_t payload_len = (3 * pRbElm->iqWidth + 1) * pRbElm->nRBSize; + bfp_decom_req.data_in = (int8_t *)src; bfp_decom_req.numRBs = pRbElm->nRBSize; bfp_decom_req.len = payload_len; @@ -426,6 +434,11 @@ int xran_fh_rx_read_slot(ru_info_t *ru, int *frame, int *slot) bfp_decom_rsp.len = 0; xranlib_decompress_avx512(&bfp_decom_req, &bfp_decom_rsp); +#elif defined(__arm__) || defined(__aarch64__) + armral_bfp_decompression(pRbElm->iqWidth, pRbElm->nRBSize, (int8_t *)src, (int16_t *)local_dst); +#else + AssertFatal(1 == 0, "BFP compression not supported on this architecture"); +#endif memcpy((void *)dst2, (void *)local_dst, neg_len * 4); memcpy((void *)dst1, (void *)&local_dst[neg_len], pos_len * 4); outcnt++; @@ -552,9 +565,12 @@ int xran_fh_tx_send_slot(ru_info_t *ru, int frame, int slot, uint64_t timestamp) for (idx = 0; idx < (pos_len + neg_len) * 2; idx++) ((uint16_t *)dst16)[idx] = htons(((uint16_t *)local_src)[idx]); } else if (p_prbMapElm->compMethod == XRAN_COMPMETHOD_BLKFLOAT) { + payload_len = (3 * p_prbMapElm->iqWidth + 1) * p_prbMapElm->nRBSize; + +#if defined(__i386__) || defined(__x86_64__) struct xranlib_compress_request bfp_com_req = {}; struct xranlib_compress_response bfp_com_rsp = {}; - payload_len = (3 * p_prbMapElm->iqWidth + 1) * p_prbMapElm->nRBSize; + bfp_com_req.data_in = (int16_t *)local_src; bfp_com_req.numRBs = p_prbMapElm->nRBSize; bfp_com_req.len = payload_len; @@ -565,6 +581,11 @@ int xran_fh_tx_send_slot(ru_info_t *ru, int frame, int slot, uint64_t timestamp) bfp_com_rsp.len = 0; xranlib_compress_avx512(&bfp_com_req, &bfp_com_rsp); +#elif defined(__arm__) || defined(__aarch64__) + armral_bfp_compression(p_prbMapElm->iqWidth, p_prbMapElm->nRBSize, (int16_t *)local_src, (int8_t *)dst); +#else + AssertFatal(1 == 0, "BFP compression not supported on this architecture"); +#endif } else { printf("p_prbMapElm->compMethod == %d is not supported\n", p_prbMapElm->compMethod); From e12bcc964dca21f634d5b785498f1255a192f3de Mon Sep 17 00:00:00 2001 From: Romain Beurdouche Date: Thu, 27 Mar 2025 13:17:18 +0000 Subject: [PATCH 41/57] feat(oran_fhlib_5g): Make F release patch dual Update the xran F release patch to work for Arm targets in addition to x86 targets. --- .../F/oaioran_F.patch | 1042 ++++++++++++++++- radio/fhi_72/CMakeLists.txt | 4 +- 2 files changed, 995 insertions(+), 51 deletions(-) diff --git a/cmake_targets/tools/oran_fhi_integration_patches/F/oaioran_F.patch b/cmake_targets/tools/oran_fhi_integration_patches/F/oaioran_F.patch index 8ab8da6aad..5f55996d76 100644 --- a/cmake_targets/tools/oran_fhi_integration_patches/F/oaioran_F.patch +++ b/cmake_targets/tools/oran_fhi_integration_patches/F/oaioran_F.patch @@ -7,15 +7,15 @@ index ac5f471..bbd39fe 100644 #include -#define VERSIONX "oran_f_release_v1.0" -+#define VERSIONX "oran_f_release_v1.1" ++#define VERSIONX "oran_f_release_v1.2" #define APP_O_DU 0 #define APP_O_RU 1 diff --git a/fhi_lib/lib/Makefile b/fhi_lib/lib/Makefile -index eccc4ae..8ddb22e 100644 +index eccc4ae..b1b8f4b 100644 --- a/fhi_lib/lib/Makefile +++ b/fhi_lib/lib/Makefile -@@ -23,12 +23,18 @@ MYCUSTOMSPACE1='------------------------------------------------------------' +@@ -23,24 +23,46 @@ MYCUSTOMSPACE1='------------------------------------------------------------' ############################################################## # Tools configuration ############################################################## @@ -25,31 +25,80 @@ index eccc4ae..8ddb22e 100644 -AS := as -AR := ar -LD := icc -+ifeq ($(WIRELESS_SDK_TOOLCHAIN),gcc) -+ CC := gcc +-else ifeq ($(WIRELESS_SDK_TOOLCHAIN),icx) +- CC := icx +- CPP := icpx +- AS := as +- AR := llvm-ar +- LD := icx ++ ++# Default target architecture and compiler ++TARGET ?= x86 ++ ++# Architecture and compiler-specific tools and flags ++ifeq ($(TARGET), x86) ++ ifeq ($(WIRELESS_SDK_TOOLCHAIN),gcc) ++ CC := gcc ++ CPP := g++ ++ AS := as ++ AR := ar ++ LD := gcc ++ else ifeq ($(WIRELESS_SDK_TOOLCHAIN),icc) ++ CC := icc ++ CPP := icpc ++ AS := as ++ AR := ar ++ LD := icc ++ else ifeq ($(WIRELESS_SDK_TOOLCHAIN),icx) ++ CC := icx ++ CPP := icpx ++ AS := as ++ AR := llvm-ar ++ LD := icx ++ else ++ $(error "Please define WIRELESS_SDK_TOOLCHAIN environment variable") ++ endif ++ ++ OBJDUMP := objdump ++ ++else ifeq ($(TARGET), armv8) # aarch64 ++ CC := gcc + CPP := g++ -+ AS := as -+ AR := ar + LD := gcc -+else ifeq ($(WIRELESS_SDK_TOOLCHAIN),icc) -+ CC := icc -+ CPP := icpc -+ AS := as -+ AR := ar -+ LD := icc - else ifeq ($(WIRELESS_SDK_TOOLCHAIN),icx) - CC := icx - CPP := icpx -@@ -72,7 +78,7 @@ ifeq ($(RTE_SDK),) ++ CFLAGS += -march=armv8-a ++ LDFLAGS += + else +- $(error "Please define WIRELESS_SDK_TOOLCHAIN environment variable") ++ $(error Unsupported target architecture: $(TARGET)) + endif + +-OBJDUMP := objdump +- + ifeq ($(SHELL),cmd.exe) + MD := mkdir.exe -p + CP := cp.exe -f +@@ -72,7 +94,11 @@ ifeq ($(RTE_SDK),) 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 pkgconf --cflags-only-I libdpdk) ++else ifeq ($(TARGET), armv8) ++RTE_INC := $(pkgconf --cflags-only-I libdpdk) ++endif API_DIR := $(PROJECT_DIR)/api SRC_DIR := $(PROJECT_DIR)/src -@@ -110,8 +116,7 @@ CPP_SRC = $(SRC_DIR)/xran_compression.cpp \ +@@ -103,6 +129,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 \ +@@ -110,8 +137,7 @@ 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 \ @@ -59,35 +108,58 @@ index eccc4ae..8ddb22e 100644 CPP_SRC_SNC = $(SRC_DIR)/xran_compression_snc.cpp \ $(SRC_DIR)/xran_bfp_cplane8_snc.cpp \ -@@ -127,7 +132,7 @@ CC_FLAGS += -std=gnu11 -Wall -Wno-deprecated-declarations \ +@@ -119,6 +145,7 @@ CPP_SRC_SNC = $(SRC_DIR)/xran_compression_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 \ +@@ -127,7 +154,11 @@ CC_FLAGS += -std=gnu11 -Wall -Wno-deprecated-declarations \ -fPIC \ -Wall \ -Wimplicit-function-declaration \ - -g -O3 -mcmodel=large -+ -g -O -mavx512bw -march=skylake-avx512 -mtune=skylake-avx512#--wd1786 -mcmodel=large ++ -g -O ++ ++ifeq ($(TARGET), x86) ++CC_FLAGS += -mavx512bw -march=skylake-avx512 -mtune=skylake-avx512#--wd1786 -mcmodel=large ++endif ifeq ($(WIRELESS_SDK_TOOLCHAIN),icc) CC_FLAGS += -wd1786 -restrict -@@ -138,8 +143,9 @@ CC_FLAGS += -march=icelake-server -mintrinsic-promote -Wno-unused-function -Wno- +@@ -137,9 +168,15 @@ ifeq ($(WIRELESS_SDK_TOOLCHAIN),icx) + CC_FLAGS += -march=icelake-server -mintrinsic-promote -Wno-unused-function -Wno-intrinsic-promote -Wno-error endif - CPP_FLAGS := -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -D_GNU_SOURCE -D_REENTRANT -pipe \ -- -falign-functions=16 \ -- -Werror -Wno-unused-variable -std=c++14 -mcmodel=large -fPIC ++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 \ +- -falign-functions=16 \ +- -Werror -Wno-unused-variable -std=c++14 -mcmodel=large -fPIC ++ -Werror -Wno-unused-variable -std=c++14 ++endif ifeq ($(WIRELESS_SDK_TOOLCHAIN),icc) CPP_FLAGS += -fp-model fast=2 -no-prec-div -no-prec-sqrt -fast-transcendentals -restrict -@@ -186,8 +192,8 @@ CPP_SNC_OBJTARGETS := $(addprefix $(PROJECT_OBJ_DIR)/,$(CPP_OBJS_SNC)) +@@ -186,8 +223,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 -fasm-blocks -CPP_COMP_SNC := -O3 -DNDEBUG -march=icelake-server -fPIE -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) @@ -127,6 +199,34 @@ index bacf597..90a42a2 100644 /** * @ingroup xran * +diff --git a/fhi_lib/lib/api/xran_pkt_cp.h b/fhi_lib/lib/api/xran_pkt_cp.h +index 33e96b3..a2f8ad0 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 +@@ -256,7 +264,7 @@ union xran_cp_radioapp_section_ext3_first { + }all_bits; + + struct{ +- __m128i data_field1; ++ 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 46e0e1d..409ef4b 100644 --- a/fhi_lib/lib/api/xran_up_api.h @@ -150,10 +250,21 @@ index 46e0e1d..409ef4b 100644 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 f5b2fd6..e949fe7 100644 +index f5b2fd6..144a65e 100644 --- a/fhi_lib/lib/ethernet/ethdi.c +++ b/fhi_lib/lib/ethernet/ethdi.c -@@ -325,8 +325,8 @@ xran_ethdi_init_dpdk_io(char *name, const struct xran_io_cfg *io_cfg, +@@ -37,7 +37,10 @@ + #include + #include + #include ++#if defined(__arm__) || defined(__aarch64__) ++#else + #include ++#endif + #include + #include + #include +@@ -325,8 +328,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"; @@ -164,7 +275,7 @@ index f5b2fd6..e949fe7 100644 char ring_name[32] = ""; int32_t xran_port = -1; queueid_t qi = 0; -@@ -336,7 +336,7 @@ xran_ethdi_init_dpdk_io(char *name, const struct xran_io_cfg *io_cfg, +@@ -336,7 +339,7 @@ xran_ethdi_init_dpdk_io(char *name, const struct xran_io_cfg *io_cfg, cpu = sched_getcpu(); node = numa_node_of_cpu(cpu); @@ -173,7 +284,7 @@ index f5b2fd6..e949fe7 100644 "--file-prefix", name, "-a0000:00:00.0", bbdev_wdev, bbdev_vdev}; if (io_cfg == NULL) -@@ -481,11 +481,13 @@ xran_ethdi_init_dpdk_io(char *name, const struct xran_io_cfg *io_cfg, +@@ -481,11 +484,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"); @@ -187,7 +298,7 @@ index f5b2fd6..e949fe7 100644 } } } else { -@@ -555,7 +557,7 @@ xran_ethdi_init_dpdk_io(char *name, const struct xran_io_cfg *io_cfg, +@@ -555,7 +560,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"); @@ -196,6 +307,21 @@ index f5b2fd6..e949fe7 100644 } return 1; +diff --git a/fhi_lib/lib/ethernet/ethernet.c b/fhi_lib/lib/ethernet/ethernet.c +index edda598..791256c 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_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 @@ -246,11 +372,37 @@ index 59b6850..322d238 100644 -} \ No newline at end of file +} +diff --git a/fhi_lib/lib/src/xran_cb_proc.c b/fhi_lib/lib/src/xran_cb_proc.c +index 08660f3..2bb5187 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 dc40ad9..4ac1fbf 100644 +index dc40ad9..5968d01 100644 --- a/fhi_lib/lib/src/xran_common.c +++ b/fhi_lib/lib/src/xran_common.c -@@ -714,11 +714,14 @@ process_mbuf(struct rte_mbuf *pkt, void* handle, struct xran_eaxc_info *p_cid) +@@ -31,7 +31,10 @@ + #include + #include + #include ++#if defined(__arm__) || defined(__aarch64__) ++#else + #include ++#endif + #include + #include + #include +@@ -714,11 +717,14 @@ process_mbuf(struct rte_mbuf *pkt, void* handle, struct xran_eaxc_info *p_cid) uint8_t compMeth = 0; uint8_t iqWidth = 0; @@ -265,7 +417,7 @@ index dc40ad9..4ac1fbf 100644 if(first_call == 0) return ret; -@@ -733,9 +736,9 @@ process_mbuf(struct rte_mbuf *pkt, void* handle, struct xran_eaxc_info *p_cid) +@@ -733,9 +739,9 @@ process_mbuf(struct rte_mbuf *pkt, void* handle, struct xran_eaxc_info *p_cid) return MBUF_FREE; num_bytes = xran_extract_iq_samples(pkt, &iq_samp_buf, @@ -277,7 +429,7 @@ index dc40ad9..4ac1fbf 100644 if (num_bytes <= 0) { print_err("num_bytes is wrong [%d]\n", num_bytes); -@@ -781,10 +784,9 @@ process_mbuf(struct rte_mbuf *pkt, void* handle, struct xran_eaxc_info *p_cid) +@@ -781,10 +787,9 @@ process_mbuf(struct rte_mbuf *pkt, void* handle, struct xran_eaxc_info *p_cid) else { @@ -291,7 +443,7 @@ index dc40ad9..4ac1fbf 100644 #ifndef FCN_ADAPT if(valid_res != 0) { -@@ -807,8 +809,7 @@ process_mbuf(struct rte_mbuf *pkt, void* handle, struct xran_eaxc_info *p_cid) +@@ -807,8 +812,7 @@ process_mbuf(struct rte_mbuf *pkt, void* handle, struct xran_eaxc_info *p_cid) PrachCfg = &(p_dev_ctx->PrachCPConfig); } @@ -301,7 +453,7 @@ index dc40ad9..4ac1fbf 100644 /* PRACH packet has ruportid = num_eAxc + ant_id */ Ant_ID -= PrachCfg->eAxC_offset; symbol_total_bytes[p_dev_ctx->xran_port_id][CC_ID][Ant_ID] += num_bytes; -@@ -1412,7 +1413,7 @@ int generate_cpmsg_prach(void *pHandle, struct xran_cp_gen_params *params, struc +@@ -1412,7 +1416,7 @@ int generate_cpmsg_prach(void *pHandle, struct xran_cp_gen_params *params, struc if(XRAN_FILTERINDEX_PRACH_ABC == pPrachCPConfig->filterIdx) { timeOffset = timeOffset >> nNumerology; //original number is Tc, convert to Ts based on mu @@ -310,7 +462,7 @@ index dc40ad9..4ac1fbf 100644 timeOffset += 16; } else -@@ -1547,8 +1548,7 @@ int32_t ring_processing_func(void* args) +@@ -1547,8 +1551,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++) { @@ -360,11 +512,159 @@ index 112caae..7c74342 100644 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 4498b33..8a2984f 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 + +@@ -853,7 +857,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 789c6fd..a768efb 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 4c943c8..d9e7983 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 4acade1..c939edc 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, 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 7c472d7..7bab6a8 100644 +index 7c472d7..216c7f5 100644 --- a/fhi_lib/lib/src/xran_main.c +++ b/fhi_lib/lib/src/xran_main.c -@@ -306,7 +306,7 @@ xran_init_prach(struct xran_fh_config* pConf, struct xran_device_ctx * p_xran_de +@@ -35,7 +35,11 @@ + #include + #include + #include ++#if defined(__arm__) || defined(__aarch64__) ++#include ++#else + #include ++#endif + #include + #include + #include +@@ -103,6 +107,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) + { +@@ -306,7 +329,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]); } @@ -373,7 +673,7 @@ index 7c472d7..7bab6a8 100644 print_dbg("PRACH eAxC_offset %d\n", pPrachCPConfig->eAxC_offset); /* Save some configs for app */ -@@ -1570,6 +1570,7 @@ int32_t handle_ecpri_ethertype(struct rte_mbuf* pkt_q[], uint16_t xport_id, stru +@@ -1570,6 +1593,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; @@ -381,7 +681,7 @@ index 7c472d7..7bab6a8 100644 break; // For RU emulation case ECPRI_RT_CONTROL_DATA: -@@ -1587,7 +1588,7 @@ int32_t handle_ecpri_ethertype(struct rte_mbuf* pkt_q[], uint16_t xport_id, stru +@@ -1587,7 +1611,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) { @@ -390,7 +690,16 @@ index 7c472d7..7bab6a8 100644 } break; } -@@ -2347,8 +2348,7 @@ ring_processing_func_per_port(void* args) +@@ -1876,7 +1900,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; +@@ -2347,8 +2371,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++){ @@ -400,7 +709,7 @@ index 7c472d7..7bab6a8 100644 } } } -@@ -2414,9 +2414,6 @@ xran_spawn_workers(void) +@@ -2414,9 +2437,6 @@ xran_spawn_workers(void) nWorkerCore = nWorkerCore << 1; } @@ -410,7 +719,520 @@ index 7c472d7..7bab6a8 100644 printf("O-XU %d\n", eth_ctx->io_cfg.id); printf("HW %d\n", icx_cpu); printf("Num cores %d\n", total_num_cores); -@@ -4034,6 +4031,24 @@ xran_get_slot_idx (uint32_t PortId, uint32_t *nFrameIdx, uint32_t *nSubframeIdx, +@@ -2453,7 +2473,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; +@@ -2475,7 +2495,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; +@@ -2502,7 +2522,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; +@@ -2536,7 +2556,7 @@ xran_spawn_workers(void) + else + 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; +@@ -2559,7 +2579,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; +@@ -2586,7 +2606,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; +@@ -2613,7 +2633,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; +@@ -2628,7 +2648,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; +@@ -2643,7 +2663,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; +@@ -2682,7 +2702,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; +@@ -2697,7 +2717,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; +@@ -2712,7 +2732,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; +@@ -2727,7 +2747,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; +@@ -2766,7 +2786,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; +@@ -2781,7 +2801,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"); +@@ -2797,7 +2817,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; +@@ -2812,7 +2832,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; +@@ -2827,7 +2847,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; +@@ -2861,7 +2881,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; +@@ -2876,7 +2896,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; +@@ -2891,7 +2911,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; +@@ -2906,7 +2926,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; +@@ -2921,7 +2941,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; +@@ -2969,7 +2989,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; +@@ -3004,7 +3024,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; +@@ -3031,7 +3051,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; +@@ -3062,7 +3082,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; +@@ -3089,7 +3109,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; +@@ -3115,7 +3135,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; +@@ -3130,7 +3150,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; +@@ -3145,7 +3165,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; +@@ -3184,7 +3204,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; +@@ -3199,7 +3219,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; +@@ -3214,7 +3234,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; +@@ -3229,7 +3249,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; +@@ -3266,7 +3286,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; +@@ -3281,7 +3301,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; +@@ -3296,7 +3316,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; +@@ -3311,7 +3331,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; +@@ -3326,7 +3346,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; +@@ -3348,7 +3368,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; +@@ -3363,7 +3383,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; +@@ -3378,7 +3398,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; +@@ -3393,7 +3413,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; +@@ -3408,7 +3428,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; +@@ -3435,7 +3455,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; +@@ -3450,7 +3470,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; +@@ -3465,7 +3485,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; +@@ -3480,7 +3500,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; +@@ -3495,7 +3515,7 @@ xran_spawn_workers(void) + eth_ctx->pkt_wrk_cfg[pThCtx->worker_id].arg = pThCtx; + + /** 4 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; +@@ -3510,7 +3530,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; +@@ -3537,7 +3557,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; +@@ -3562,7 +3582,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; +@@ -3577,7 +3597,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; +@@ -3602,7 +3622,7 @@ xran_spawn_workers(void) + } + + /** 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; +@@ -3627,7 +3647,7 @@ xran_spawn_workers(void) + } + + /** 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; +@@ -3642,7 +3662,7 @@ xran_spawn_workers(void) + eth_ctx->pkt_wrk_cfg[pThCtx->worker_id].arg = pThCtx; + + /** 5 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; +@@ -4034,6 +4054,24 @@ xran_get_slot_idx (uint32_t PortId, uint32_t *nFrameIdx, uint32_t *nSubframeIdx, return tti; } @@ -435,6 +1257,22 @@ index 7c472d7..7bab6a8 100644 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 e1dcb6c..b3c3fae 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..b9b44ac 100644 --- a/fhi_lib/lib/src/xran_mod_compression.cpp @@ -451,11 +1289,117 @@ index 7d4a5d0..b9b44ac 100644 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 e7056f4..0d3d8ac 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 +diff --git a/fhi_lib/lib/src/xran_timer.c b/fhi_lib/lib/src/xran_timer.c +index 14a6a41..55182d8 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 72249bc..6b30084 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 45a17a8..28c5568 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 fe22a1f..f6c4830 100644 +index fe22a1f..3fd369b 100644 --- a/fhi_lib/lib/src/xran_up_api.c +++ b/fhi_lib/lib/src/xran_up_api.c -@@ -336,6 +336,7 @@ int32_t xran_extract_iq_samples(struct rte_mbuf *mbuf, +@@ -25,7 +25,11 @@ + * + **/ + #include ++#if defined(__arm__) || defined(__aarch64__) ++#else + #include ++#endif ++#include + #include + + #include "xran_fh_o_du.h" +@@ -336,6 +340,7 @@ int32_t xran_extract_iq_samples(struct rte_mbuf *mbuf, uint8_t *subframe_id, uint8_t *slot_id, uint8_t *symb_id, @@ -463,7 +1407,7 @@ index fe22a1f..f6c4830 100644 union ecpri_seq_id *seq_id, uint16_t *num_prbu, uint16_t *start_prbu, -@@ -345,7 +346,8 @@ int32_t xran_extract_iq_samples(struct rte_mbuf *mbuf, +@@ -345,7 +350,8 @@ int32_t xran_extract_iq_samples(struct rte_mbuf *mbuf, int8_t expect_comp, enum xran_comp_hdr_type staticComp, uint8_t *compMeth, @@ -473,7 +1417,7 @@ index fe22a1f..f6c4830 100644 { #if XRAN_MLOG_VAR uint32_t mlogVar[10]; -@@ -381,6 +383,7 @@ int32_t xran_extract_iq_samples(struct rte_mbuf *mbuf, +@@ -381,6 +387,7 @@ 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); @@ -481,7 +1425,7 @@ index fe22a1f..f6c4830 100644 if (frame_id) *frame_id = radio_hdr->frame_id; -@@ -394,6 +397,9 @@ int32_t xran_extract_iq_samples(struct rte_mbuf *mbuf, +@@ -394,6 +401,9 @@ int32_t xran_extract_iq_samples(struct rte_mbuf *mbuf, if (symb_id) *symb_id = radio_hdr->sf_slot_sym.symb_id; diff --git a/radio/fhi_72/CMakeLists.txt b/radio/fhi_72/CMakeLists.txt index cec59d38ad..0b78bf055b 100644 --- a/radio/fhi_72/CMakeLists.txt +++ b/radio/fhi_72/CMakeLists.txt @@ -19,10 +19,10 @@ add_library(oran_fhlib_5g MODULE find_package(xran REQUIRED) if(xran_VERSION VERSION_EQUAL 5.1.5) target_compile_definitions(oran_fhlib_5g PRIVATE E_RELEASE) -elseif(xran_VERSION VERSION_EQUAL 6.1.1) +elseif(xran_VERSION VERSION_EQUAL 6.1.2) target_compile_definitions(oran_fhlib_5g PRIVATE F_RELEASE) else() - message(FATAL_ERROR "Found xran version ${xran_VERSION} but needed 5.1.5 (E release) or 6.1.1 (F release)") + message(FATAL_ERROR "Found xran version ${xran_VERSION} but needed 5.1.5 (E release) or 6.1.2 (F release)") endif() # Ignore xran-specific warning: we don't care/can't change the following warning, so suppress From 09aec7f1d8b9a73fa5ae355db9ec193f63ed052e Mon Sep 17 00:00:00 2001 From: Romain Beurdouche Date: Thu, 27 Mar 2025 10:56:19 +0000 Subject: [PATCH 42/57] feat(oran_fhlib_5g): Documentation for Arm targets --- doc/ORAN_FHI7.2_Tutorial.md | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/doc/ORAN_FHI7.2_Tutorial.md b/doc/ORAN_FHI7.2_Tutorial.md index b3bd8ce146..07612062f5 100644 --- a/doc/ORAN_FHI7.2_Tutorial.md +++ b/doc/ORAN_FHI7.2_Tutorial.md @@ -403,7 +403,8 @@ git apply ~/openairinterface5g/cmake_targets/tools/oran_fhi_integration_patches/ Compile the fronthaul interface library by calling `make` and the option `XRAN_LIB_SO=1` to have it build a shared object. Note that we provide two environment variables `RTE_SDK` for the path to the source tree of DPDK, and -`XRAN_DIR` to set the path to the fronthaul library. +`XRAN_DIR` to set the path to the fronthaul library. +For building for a Arm target, set as well the environment variable `TARGET=armv8`. **Note**: you need at least gcc-11 and g++-11. @@ -420,6 +421,28 @@ WIRELESS_SDK_TOOLCHAIN=gcc RTE_SDK=~/dpdk-stable-20.11.9/ XRAN_DIR=~/phy/fhi_lib The shared library object `~/phy/fhi_lib/lib/build/libxran.so` must be present before proceeding. +## For Arm targets only: Install the Arm RAN Acceleration library + +Clone, configure and build ArmRAL: + +Note: Use option `-DCMAKE_INSTALL_PREFIX=` of cmake to set the installation directory of ArmRAL to ``. +If you omit this option, ArmRAL is installed into `/usr/local`. + +``` +git clone https://git.gitlab.arm.com/networking/ral.git ~/ral +cd ~/ral +git checkout armral-25.01 +mkdir build +cd build +cmake -GNinja -DBUILD_SHARED_LIBS=On ../ +ninja +``` + +Once ArmRAL is configured at your convenience and built, you can install it: +``` +ninja install +``` + ## Build OAI gNB You can now proceed building OAI. You build it the same way as for other From 96a47821dec265d82da2f098b35d02456dc45adc Mon Sep 17 00:00:00 2001 From: Romain Beurdouche Date: Fri, 28 Mar 2025 13:41:01 +0000 Subject: [PATCH 43/57] feat(CI): Add FHI 7.2 build on native Arm build pipeline --- ci-scripts/cls_containerize.py | 1 + ...Dockerfile.build.fhi72.native_arm.ubuntu22 | 101 ++++++++++++++++++ 2 files changed, 102 insertions(+) create mode 100644 docker/Dockerfile.build.fhi72.native_arm.ubuntu22 diff --git a/ci-scripts/cls_containerize.py b/ci-scripts/cls_containerize.py index dc461dfe7e..b697069da2 100644 --- a/ci-scripts/cls_containerize.py +++ b/ci-scripts/cls_containerize.py @@ -410,6 +410,7 @@ class Containerize(): result = re.search('native_arm', self.imageKind) if result is not None: imageNames.append(('oai-gnb', 'gNB', 'oai-gnb', '')) + imageNames.append(('ran-build-fhi72', 'build.fhi72.native_arm', 'ran-build-fhi72', '')) imageNames.append(('oai-nr-cuup', 'nr-cuup', 'oai-nr-cuup', '')) imageNames.append(('oai-nr-ue', 'nrUE', 'oai-nr-ue', '')) imageNames.append(('oai-gnb-aerial', 'gNB.aerial', 'oai-gnb-aerial', '')) diff --git a/docker/Dockerfile.build.fhi72.native_arm.ubuntu22 b/docker/Dockerfile.build.fhi72.native_arm.ubuntu22 new file mode 100644 index 0000000000..4ea1bcd7bb --- /dev/null +++ b/docker/Dockerfile.build.fhi72.native_arm.ubuntu22 @@ -0,0 +1,101 @@ +#/* +# * 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 +# */ +#--------------------------------------------------------------------- +# +# Dockerfile for the Open-Air-Interface RAN Build for FHI 7.2 +# Valid for UBUNTU 22.04 +# +#--------------------------------------------------------------------- + +FROM ran-base:latest AS ran-base + +ARG E2AP_VERSION=E2AP_V3 +ARG KPM_VERSION=KPM_V3_00 +ENV DEBIAN_FRONTEND=noninteractive +ENV TZ=Europe +RUN apt-get update && \ + DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && \ + DEBIAN_FRONTEND=noninteractive apt-get install --yes \ + meson \ + wget \ + xz-utils \ + pkg-config \ + libnuma-dev && \ + rm -rf /var/lib/apt/lists/* + +RUN rm -Rf /oai-ran +WORKDIR /oai-ran +COPY . . + +## Download and build DPDK +RUN wget http://fast.dpdk.org/rel/dpdk-20.11.9.tar.xz && \ + tar -xvf dpdk-20.11.9.tar.xz && \ + cd dpdk-stable-20.11.9 && \ + meson build && \ + ninja -C build && \ + ninja install -C build + +## Build Fronthaul library +RUN git clone https://gerrit.o-ran-sc.org/r/o-du/phy.git /opt/phy && \ + cd /opt/phy && \ + git checkout oran_f_release_v1.0 &&\ + git apply /oai-ran/cmake_targets/tools/oran_fhi_integration_patches/F/oaioran_F.patch && \ + cd /opt/phy/fhi_lib/lib && \ + TARGET=armv8 WIRELESS_SDK_TOOLCHAIN=gcc RTE_SDK=/oai-ran/dpdk-stable-20.11.9/ XRAN_DIR=/opt/phy/fhi_lib make XRAN_LIB_SO=1 + +## Build Arm RAN Acceleration Library +RUN git clone https://git.gitlab.arm.com/networking/ral.git /opt/ral && \ + cd /opt/ral && \ + git checkout armral-25.01 &&\ + mkdir build && \ + cd build && \ + cmake -GNinja -DBUILD_SHARED_LIBS=On /opt/ral/ && \ + ninja && \ + ninja install + +FROM ran-base AS ran-build-fhi72 +## Build and install OAI +#run build_oai to build the target image +RUN /bin/sh oaienv && \ + cd cmake_targets && \ + mkdir -p log && \ + ./build_oai \ + --gNB \ + --build-lib "telnetsrv enbscope uescope nrscope" \ + -t oran_fhlib_5g --cmake-opt -Dxran_LOCATION=/opt/phy/fhi_lib/lib \ + --build-e2 --cmake-opt -DXAPP_MULTILANGUAGE=OFF --cmake-opt -DKPM_VERSION=$KPM_VERSION --cmake-opt -DE2AP_VERSION=$E2AP_VERSION \ + $BUILD_OPTION && \ + # Mainly to see if the sanitize option was perfectly executed + ldd ran_build/build/nr-softmodem && \ + ldd ran_build/build/liboran_fhlib_5g.so && \ + ldd /opt/phy/fhi_lib/lib/build/libxran.so + +## Build FlexRIC for SM Models +RUN mkdir -p openair2/E2AP/flexric/build && \ + cd openair2/E2AP/flexric/build && \ + cmake -GNinja -DCMAKE_BUILD_TYPE=Release \ + -DXAPP_MULTILANGUAGE=OFF \ + -DKPM_VERSION=$KPM_VERSION \ + -DE2AP_VERSION=$E2AP_VERSION \ + -DCMAKE_C_COMPILER=gcc-12 \ + -DCMAKE_CXX_COMPILER=g++-12 .. && \ + ninja && \ + ninja install From fb3678bea45bc8096b56cbb939e2077d1b183c5d Mon Sep 17 00:00:00 2001 From: Romain Beurdouche Date: Thu, 3 Apr 2025 11:59:19 +0000 Subject: [PATCH 44/57] feat(oran_fhlib_5g): Arm support information in documentation Inform in O-RAN 7.2 documentation that DU execution on Arm is yet not fully supported and that 7.2 on Arm is only intended to enable experiments. --- doc/ORAN_FHI7.2_Tutorial.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/ORAN_FHI7.2_Tutorial.md b/doc/ORAN_FHI7.2_Tutorial.md index 07612062f5..df72be82c6 100644 --- a/doc/ORAN_FHI7.2_Tutorial.md +++ b/doc/ORAN_FHI7.2_Tutorial.md @@ -32,6 +32,8 @@ The hardware on which we have tried this tutorial: - The NIC card should support hardware PTP time stamping. - If you are using Intel servers then use only Ice Lake or newer generations. In case of AMD use only 4th generation, Genoa or newer. - If you try on any other server apart from the above listed, then choose a desktop/server with clock speed higher than 3.0 GHz and `avx512` capabilities. +- This tutorial gives few instructions for Arm targets, but DU execution on Arm systems is yet not functional. +This feature is intended to enable experiments and future improvements on Arm systems. NICs we have tested so far: @@ -405,6 +407,8 @@ Compile the fronthaul interface library by calling `make` and the option environment variables `RTE_SDK` for the path to the source tree of DPDK, and `XRAN_DIR` to set the path to the fronthaul library. For building for a Arm target, set as well the environment variable `TARGET=armv8`. +DU execution on Arm systems is yet not functional. +This feature is intended to enable experiments and future improvements on Arm systems. **Note**: you need at least gcc-11 and g++-11. @@ -423,6 +427,9 @@ before proceeding. ## For Arm targets only: Install the Arm RAN Acceleration library +DU execution on Arm systems is yet not functional. +This feature is intended to enable experiments and future improvements on Arm systems. + Clone, configure and build ArmRAL: Note: Use option `-DCMAKE_INSTALL_PREFIX=` of cmake to set the installation directory of ArmRAL to ``. From 8477de357105995b6b1a82d6a885c4a47b93e922 Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 4 Apr 2025 11:11:15 +0200 Subject: [PATCH 45/57] Make function static: only used in rrc_gNB.c --- openair2/RRC/NR/nr_rrc_proto.h | 1 - openair2/RRC/NR/rrc_gNB.c | 12 ++++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/openair2/RRC/NR/nr_rrc_proto.h b/openair2/RRC/NR/nr_rrc_proto.h index 7dd2fff8a3..f20a5e12a2 100644 --- a/openair2/RRC/NR/nr_rrc_proto.h +++ b/openair2/RRC/NR/nr_rrc_proto.h @@ -110,7 +110,6 @@ bool trigger_bearer_setup(gNB_RRC_INST *rrc, gNB_RRC_UE_t *UE, int n, pdusession int rrc_gNB_generate_pcch_msg(sctp_assoc_t assoc_id, const NR_SIB1_t *sib, uint32_t tmsi, uint8_t paging_drx); -void nr_rrc_transfer_protected_rrc_message(const gNB_RRC_INST *rrc, const gNB_RRC_UE_t *ue_p, uint8_t srb_id, const uint8_t* buffer, int size); /** @}*/ /* UE Management Procedures */ diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index cfb6c499a3..cbf5ea2c1d 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -191,12 +191,12 @@ static void rrc_deliver_dl_rrc_message(void *deliver_pdu_data, ue_id_t ue_id, in data->rrc->mac_rrc.dl_rrc_message_transfer(data->assoc_id, data->dl_rrc); } -void nr_rrc_transfer_protected_rrc_message(const gNB_RRC_INST *rrc, - const gNB_RRC_UE_t *ue_p, - uint8_t srb_id, - const uint32_t message_id, - const uint8_t *buffer, - int size) +static void nr_rrc_transfer_protected_rrc_message(const gNB_RRC_INST *rrc, + const gNB_RRC_UE_t *ue_p, + uint8_t srb_id, + const uint32_t message_id, + const uint8_t *buffer, + int size) { DevAssert(size > 0); f1_ue_data_t ue_data = cu_get_f1_ue_data(ue_p->rrc_ue_id); From c612005d2809516ec75b3d6273ba4cd29bba3c0c Mon Sep 17 00:00:00 2001 From: Tano Bischoff Date: Fri, 14 Mar 2025 15:48:20 +0100 Subject: [PATCH 46/57] RAN Control REPORT Style 1: "UE ID" support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As per spec, UE ID shall be reported when the message event configured by the Event Trigger Style 1 is set to “RRC Setup Complete" message (UE attach), or “Xn/NG Handover Request” or “F1 UE Context Setup Request” (Intra gNB Handover). In OAI RAN, Xn/NG Handover is not yet supported, and therefore not added as the trigger event in this commit. Additionally, as the Event Trigger Definition Format 1 is common for both "RRC Message" and "UE ID", E2 node will report the “RRC Setup Complete" message which the xApp will decode and print. Co-authored-by: Khanh Toan Pham Co-authored-by: Shrinish Donde Co-authored-by: Theodoros Tsourdinis Co-authored-by: Miguel Fuentes Co-authored-by: Teodora Vladic --- CMakeLists.txt | 3 + openair2/E2AP/RAN_FUNCTION/CMakeLists.txt | 45 +++++++++- .../E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.c | 82 ++++++++++++++++++- .../RAN_FUNCTION/O-RAN/ran_func_rc_extern.h | 3 + .../RAN_FUNCTION/O-RAN/ran_func_rc_subs.c | 9 ++ .../RAN_FUNCTION/O-RAN/ran_func_rc_subs.h | 1 + openair2/F1AP/f1ap_cu_ue_context_management.c | 10 +++ openair2/RRC/NR/rrc_gNB.c | 5 ++ 8 files changed, 155 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5d37670c34..b00ca296cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -453,6 +453,9 @@ target_include_directories(f1ap PUBLIC F1AP_DIR) 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) +if(E2_AGENT) + target_compile_definitions(f1ap PRIVATE E2_AGENT) +endif() # LPP ############## diff --git a/openair2/E2AP/RAN_FUNCTION/CMakeLists.txt b/openair2/E2AP/RAN_FUNCTION/CMakeLists.txt index 27497ae873..35699bc15a 100644 --- a/openair2/E2AP/RAN_FUNCTION/CMakeLists.txt +++ b/openair2/E2AP/RAN_FUNCTION/CMakeLists.txt @@ -1,4 +1,44 @@ +set(UE_ID_COMMON_E2SM_SRCS + ../flexric/src/sm/rc_sm/ie/asn/AMFPointer.c + ../flexric/src/sm/rc_sm/ie/asn/AMFRegionID.c + ../flexric/src/sm/rc_sm/ie/asn/AMFSetID.c + ../flexric/src/sm/rc_sm/ie/asn/AMF-UE-NGAP-ID.c + ../flexric/src/sm/rc_sm/ie/asn/ENB-ID.c + ../flexric/src/sm/rc_sm/ie/asn/ENB-UE-X2AP-ID-Extension.c + ../flexric/src/sm/rc_sm/ie/asn/ENB-UE-X2AP-ID.c + ../flexric/src/sm/rc_sm/ie/asn/GlobalENB-ID.c + ../flexric/src/sm/rc_sm/ie/asn/GlobalGNB-ID.c + ../flexric/src/sm/rc_sm/ie/asn/GlobalNgENB-ID.c + ../flexric/src/sm/rc_sm/ie/asn/GlobalNGRANNodeID.c + ../flexric/src/sm/rc_sm/ie/asn/GNB-CU-CP-UE-E1AP-ID.c + ../flexric/src/sm/rc_sm/ie/asn/GNB-CU-UE-F1AP-ID.c + ../flexric/src/sm/rc_sm/ie/asn/GNB-ID.c + ../flexric/src/sm/rc_sm/ie/asn/GUAMI.c + ../flexric/src/sm/rc_sm/ie/asn/GUMMEI.c + ../flexric/src/sm/rc_sm/ie/asn/MME-Code.c + ../flexric/src/sm/rc_sm/ie/asn/MME-Group-ID.c + ../flexric/src/sm/rc_sm/ie/asn/MME-UE-S1AP-ID.c + ../flexric/src/sm/rc_sm/ie/asn/NGENB-CU-UE-W1AP-ID.c + ../flexric/src/sm/rc_sm/ie/asn/NgENB-ID.c + ../flexric/src/sm/rc_sm/ie/asn/NG-RANnodeUEXnAPID.c + ../flexric/src/sm/rc_sm/ie/asn/PLMNIdentity.c + ../flexric/src/sm/rc_sm/ie/asn/RANUEID.c + ../flexric/src/sm/rc_sm/ie/asn/UEID-ENB.c + ../flexric/src/sm/rc_sm/ie/asn/UEID-EN-GNB.c + ../flexric/src/sm/rc_sm/ie/asn/UEID-GNB-CU-CP-E1AP-ID-Item.c + ../flexric/src/sm/rc_sm/ie/asn/UEID-GNB-CU-CP-E1AP-ID-List.c + ../flexric/src/sm/rc_sm/ie/asn/UEID-GNB-CU-CP-F1AP-ID-Item.c + ../flexric/src/sm/rc_sm/ie/asn/UEID-GNB-CU-F1AP-ID-List.c + ../flexric/src/sm/rc_sm/ie/asn/UEID-GNB-CU-UP.c + ../flexric/src/sm/rc_sm/ie/asn/UEID-GNB-DU.c + ../flexric/src/sm/rc_sm/ie/asn/UEID-GNB.c + ../flexric/src/sm/rc_sm/ie/asn/UEID.c + ../flexric/src/sm/rc_sm/ie/asn/UEID-NG-ENB-DU.c + ../flexric/src/sm/rc_sm/ie/asn/UEID-NG-ENB.c +) + add_library(e2_ran_func_cuup STATIC + ${UE_ID_COMMON_E2SM_SRCS} init_ran_func.c read_setup_ran.c O-RAN/ran_e2sm_ue_id.c @@ -13,11 +53,12 @@ add_library(e2_ran_func_cuup STATIC ../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 e2sm_rc_ir_obj sm_common_ie_obj ds alg) +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 sm_common_enc_asn_obj_rc 3gpp_derived_ie_enc_asn_obj_rc) target_compile_definitions(e2_ran_func_cuup PUBLIC ${E2AP_VERSION} ${KPM_VERSION} NGRAN_GNB_CUUP) add_library(e2_ran_func_du_cucp_cuup STATIC + ${UE_ID_COMMON_E2SM_SRCS} init_ran_func.c read_setup_ran.c O-RAN/ran_e2sm_ue_id.c @@ -36,7 +77,7 @@ add_library(e2_ran_func_du_cucp_cuup STATIC ../flexric/test/rnd/fill_rnd_data_tc.c ) -target_link_libraries(e2_ran_func_du_cucp_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) +target_link_libraries(e2_ran_func_du_cucp_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 sm_common_enc_asn_obj_rc 3gpp_derived_ie_enc_asn_obj_rc) target_compile_definitions(e2_ran_func_du_cucp_cuup PUBLIC ${E2AP_VERSION} ${KPM_VERSION} NGRAN_GNB_DU NGRAN_GNB_CUCP NGRAN_GNB_CUUP) # Current implementation: diff --git a/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.c b/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.c index 903a3c56b3..4dfddf6253 100644 --- a/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.c +++ b/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc.c @@ -26,6 +26,7 @@ #include "../../flexric/src/sm/rc_sm/ie/ir/lst_ran_param.h" #include "../../flexric/src/sm/rc_sm/ie/ir/ran_param_list.h" #include "../../flexric/src/agent/e2_agent_api.h" +#include "openair2/E2AP/flexric/src/lib/sm/enc/enc_ue_id.h" #include #include @@ -226,7 +227,7 @@ static seq_report_sty_t fill_report_style_1(const char *report_name) // Sequence of RAN Parameters Supported // [0 - 65535] - report_style.sz_seq_ran_param = 1; + report_style.sz_seq_ran_param = 2; report_style.ran_param = calloc_or_fail(report_style.sz_seq_ran_param, sizeof(seq_ran_param_3_t)); // RAN Parameter ID @@ -234,6 +235,7 @@ static seq_report_sty_t fill_report_style_1(const char *report_name) // 9.3.8 // [1- 4294967295] report_style.ran_param[0].id = E2SM_RC_RS1_RRC_MESSAGE; + report_style.ran_param[1].id = E2SM_RC_RS1_UE_ID; // RAN Parameter Name // Mandatory @@ -241,11 +243,14 @@ static seq_report_sty_t fill_report_style_1(const char *report_name) // [1-150] const char ran_param_name_0[] = "RRC Message"; report_style.ran_param[0].name = cp_str_to_ba(ran_param_name_0); + const char ran_param_name_1[] = "UE ID"; + report_style.ran_param[1].name = cp_str_to_ba(ran_param_name_1); // RAN Parameter Definition // Optional // 9.3.51 report_style.ran_param[0].def = NULL; + report_style.ran_param[1].def = NULL; return report_style; } @@ -610,6 +615,79 @@ static void send_aper_ric_ind(const uint32_t ric_req_id, rc_ind_data_t* rc_ind_d printf("[E2 AGENT] Event for RIC request ID %d generated\n", ric_req_id); } +static rc_ind_data_t* fill_ue_id(const gNB_RRC_UE_t *rrc_ue_context, const uint16_t cond_id) +{ + rc_ind_data_t* rc_ind = malloc_or_fail(sizeof(rc_ind_data_t)); + + // Generate Indication Header + rc_ind->hdr.format = FORMAT_1_E2SM_RC_IND_HDR; + rc_ind->hdr.frmt_1.ev_trigger_id = malloc_or_fail(sizeof(uint32_t)); + *rc_ind->hdr.frmt_1.ev_trigger_id = cond_id; + + // Generate Indication Message + rc_ind->msg.format = FORMAT_1_E2SM_RC_IND_MSG; + + // Initialize RAN Parameter + rc_ind->msg.frmt_1.sz_seq_ran_param = 1; + rc_ind->msg.frmt_1.seq_ran_param = calloc_or_fail(rc_ind->msg.frmt_1.sz_seq_ran_param, sizeof(seq_ran_param_t)); + + // Fill the RAN Parameter details for UE ID + rc_ind->msg.frmt_1.seq_ran_param[0].ran_param_id = E2SM_RC_RS1_UE_ID; + rc_ind->msg.frmt_1.seq_ran_param[0].ran_param_val.type = ELEMENT_KEY_FLAG_FALSE_RAN_PARAMETER_VAL_TYPE; + rc_ind->msg.frmt_1.seq_ran_param[0].ran_param_val.flag_false = malloc_or_fail(sizeof(ran_parameter_value_t)); + rc_ind->msg.frmt_1.seq_ran_param[0].ran_param_val.flag_false->type = OCTET_STRING_RAN_PARAMETER_VALUE; + + const ngran_node_t node_type = get_e2_node_type(); + ue_id_e2sm_t ue_id_data = fill_ue_id_data[node_type](rrc_ue_context, 0, 0); + + UEID_t enc_ue_id_data = enc_ue_id_asn(&ue_id_data); + + const enum asn_transfer_syntax syntax = ATS_ALIGNED_BASIC_PER; + asn_encode_to_new_buffer_result_t res = asn_encode_to_new_buffer(NULL, syntax, &asn_DEF_UEID, &enc_ue_id_data); + assert(res.buffer != NULL && res.result.encoded > 0 && "[E2 agent] Failed to encode UE ID."); + byte_array_t ba = {.buf = res.buffer, .len = res.result.encoded}; + + rc_ind->msg.frmt_1.seq_ran_param[0].ran_param_val.flag_false->octet_str_ran = copy_byte_array(ba); + + // Call Process ID + rc_ind->proc_id = NULL; + + free_ue_id_e2sm(&ue_id_data); + ASN_STRUCT_RESET(asn_DEF_UEID, &enc_ue_id_data); + free(res.buffer); + + return rc_ind; +} + +static void check_ue_id_cond(const gNB_RRC_UE_t *rrc_ue_context, const uint16_t class, const uint32_t msg_id, const uint32_t ric_req_id, const e2sm_rc_ev_trg_frmt_1_t *frmt_1) +{ + for (size_t i = 0; i < frmt_1->sz_msg_ev_trg; i++) { + msg_ev_trg_t *ev_item = &frmt_1->msg_ev_trg[i]; + if ((ev_item->msg_type == RRC_MSG_MSG_TYPE_EV_TRG && ev_item->rrc_msg.type == NR_RRC_MESSAGE_ID && ev_item->rrc_msg.nr == class && ev_item->rrc_msg.rrc_msg_id == msg_id) // rrcSetupComplete + || (ev_item->msg_type == NETWORK_INTERFACE_MSG_TYPE_EV_TRG && ev_item->net.ni_type == class)) { // "F1 UE Context Setup Request", but in the subscription the class (F1) can only be specified which translates to any F1 msg + rc_ind_data_t* rc_ind_data = fill_ue_id(rrc_ue_context, ev_item->ev_trigger_cond_id); + send_aper_ric_ind(ric_req_id, rc_ind_data); + } + } +} + +void signal_ue_id(const gNB_RRC_UE_t *rrc_ue_context, const uint16_t class, const uint32_t msg_id) +{ + pthread_mutex_lock(&rc_mutex); + if (rc_subs_data.rs1_param4.data == NULL) { + pthread_mutex_unlock(&rc_mutex); + return; + } + + const size_t num_subs = seq_arr_size(&rc_subs_data.rs1_param4); + for (size_t sub_idx = 0; sub_idx < num_subs; sub_idx++) { + const ran_param_data_t data = *(const ran_param_data_t *)seq_arr_at(&rc_subs_data.rs1_param4, sub_idx); + check_ue_id_cond(rrc_ue_context, class, msg_id, data.ric_req_id, &data.ev_tr.frmt_1); + } + + pthread_mutex_unlock(&rc_mutex); +} + static void check_rrc_state(const gNB_RRC_UE_t *rrc_ue_context, const rrc_state_e2sm_rc_e rrc_state, const uint32_t ric_req_id, const e2sm_rc_ev_trg_frmt_4_t *frmt_4) { for (size_t i = 0; i < frmt_4->sz_ue_info_chng; i++) { @@ -716,6 +794,8 @@ static seq_arr_t *get_sa(const e2sm_rc_event_trigger_t *ev_tr, const uint32_t ra case FORMAT_1_E2SM_RC_EV_TRIGGER_FORMAT: if (ran_param_id == E2SM_RC_RS1_RRC_MESSAGE) { sa = &rc_subs_data.rs1_param3; + } else if (ran_param_id == E2SM_RC_RS1_UE_ID) { + sa = &rc_subs_data.rs1_param4; } break; diff --git a/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc_extern.h b/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc_extern.h index 83b933639e..a56d82f7d2 100644 --- a/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc_extern.h +++ b/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc_extern.h @@ -24,10 +24,13 @@ #include "openair2/RRC/NR/nr_rrc_defs.h" #include "openair2/E2AP/flexric/src/lib/3gpp/ie/rrc_msg_id.h" +#include "openair2/E2AP/flexric/src/lib/3gpp/ie/network_interface_type.h" #include "openair2/E2AP/flexric/src/sm/rc_sm/ie/ir/rrc_state.h" void signal_rrc_msg(const nr_rrc_class_e nr_channel, const uint32_t rrc_msg_id, const byte_array_t rrc_ba); +void signal_ue_id(const gNB_RRC_UE_t *rrc_ue_context, const uint16_t class, const uint32_t msg_id); + void signal_rrc_state_changed_to(const gNB_RRC_UE_t *rrc_ue_context, const rrc_state_e2sm_rc_e rrc_state); #endif diff --git a/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc_subs.c b/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc_subs.c index 9e993a8c2e..1a134d24da 100644 --- a/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc_subs.c +++ b/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc_subs.c @@ -42,6 +42,7 @@ void init_rc_subs_data(rc_subs_data_t *rc_subs_data) pthread_mutex_lock(&rc_mutex); // Initialize sequence array seq_arr_init(&rc_subs_data->rs1_param3, sizeof(ran_param_data_t)); + seq_arr_init(&rc_subs_data->rs1_param4, sizeof(ran_param_data_t)); seq_arr_init(&rc_subs_data->rs4_param202, sizeof(ran_param_data_t)); pthread_mutex_unlock(&rc_mutex); } @@ -65,6 +66,14 @@ void remove_rc_subs_data(rc_subs_data_t *rc_subs_data, uint32_t ric_req_id) seq_arr_erase(&rc_subs_data->rs1_param3, elm_rs1_param3.it); } + /* find the sequence element that matches RIC request ID */ + elm_arr_t elm_rs1_param4 = find_if(&rc_subs_data->rs1_param4, (void *)&ric_req_id, eq_int); + ran_param_data_t *data_rs1_param4 = elm_rs1_param4.it; + if (data_rs1_param4 != NULL) { + free_e2sm_rc_event_trigger(&data_rs1_param4->ev_tr); + seq_arr_erase(&rc_subs_data->rs1_param4, elm_rs1_param4.it); + } + /* find the sequence element that matches RIC request ID */ elm_arr_t elm_rs4_param202 = find_if(&rc_subs_data->rs4_param202, (void *)&ric_req_id, eq_int); ran_param_data_t *data_rs4_param202 = elm_rs4_param202.it; diff --git a/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc_subs.h b/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc_subs.h index dff9224db2..6caad6c3f3 100644 --- a/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc_subs.h +++ b/openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc_subs.h @@ -32,6 +32,7 @@ typedef struct ran_param_data { typedef struct { seq_arr_t rs1_param3; // E2SM_RC_RS1_RRC_MESSAGE + seq_arr_t rs1_param4; // E2SM_RC_RS1_UE_ID seq_arr_t rs4_param202; // E2SM_RC_RS4_RRC_STATE_CHANGED_TO } rc_subs_data_t; diff --git a/openair2/F1AP/f1ap_cu_ue_context_management.c b/openair2/F1AP/f1ap_cu_ue_context_management.c index f72ac3c588..d171afaacb 100644 --- a/openair2/F1AP/f1ap_cu_ue_context_management.c +++ b/openair2/F1AP/f1ap_cu_ue_context_management.c @@ -39,6 +39,11 @@ #include "rrc_extern.h" #include "openair2/RRC/NR/rrc_gNB_NGAP.h" +#ifdef E2_AGENT +#include "openair2/RRC/NR/rrc_gNB_UE_context.h" +#include "openair2/E2AP/RAN_FUNCTION/O-RAN/ran_func_rc_extern.h" +#endif + static void f1ap_write_drb_qos_param(const f1ap_qos_flow_level_qos_parameters_t *drb_qos_in, F1AP_QoSFlowLevelQoSParameters_t *asn1_qosparam) { int type = drb_qos_in->qos_characteristics.qos_type; @@ -587,6 +592,11 @@ int CU_send_UE_CONTEXT_SETUP_REQUEST(sctp_assoc_t assoc_id, f1ap_ue_context_setu return -1; } +#ifdef E2_AGENT + rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_get_ue_context(RC.nrrrc[0], f1ap_ue_context_setup_req->gNB_CU_ue_id); + signal_ue_id(&ue_context_p->ue_context, F1_NETWORK_INTERFACE_TYPE, 0); +#endif + // xer_fprint(stdout, &asn_DEF_F1AP_F1AP_PDU, (void *)pdu); // asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} }; // res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_F1AP_F1AP_PDU, pdu); diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index cbf5ea2c1d..03a7276ab0 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -1648,6 +1648,11 @@ static void handle_rrcSetupComplete(gNB_RRC_INST *rrc, gNB_RRC_UE_t *UE, const N } } +#ifdef E2_AGENT + const uint32_t msg_id = NR_UL_DCCH_MessageType__c1_PR_rrcSetupComplete; + signal_ue_id(UE, UL_DCCH_NR_RRC_CLASS, msg_id); +#endif + rrc_gNB_process_RRCSetupComplete(rrc, UE, setup_complete->criticalExtensions.choice.rrcSetupComplete); return; } From 12dfdb866c7353241cadff1fe8856e1f36618f7e Mon Sep 17 00:00:00 2001 From: Khanh Toan Pham Date: Tue, 11 Mar 2025 14:41:21 +0100 Subject: [PATCH 47/57] Add "RRC Message" and "UE ID" support in E2AP README Co-authored-by: Tano Bischoff Co-authored-by: Shrinish Donde Co-authored-by: Theodoros Tsourdinis Co-authored-by: Miguel Fuentes Co-authored-by: Teodora Vladic --- openair2/E2AP/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openair2/E2AP/README.md b/openair2/E2AP/README.md index abcfaa1ac0..9b2b2716fb 100644 --- a/openair2/E2AP/README.md +++ b/openair2/E2AP/README.md @@ -144,6 +144,7 @@ From O-RAN.WG3.E2SM-KPM-version specification, we implemented: We support RC v1.03. Uses ASN.1 encoding. From ORAN.WG3.E2SM-RC-v01.03 specification, we implemented: + * REPORT Service Style 1 ("Message copy" - section 7.4.2) - aperiodic subscription for "RRC Message" and "UE ID" * REPORT Service Style 4 ("UE Information" - section 7.4.5) - aperiodic subscription for "UE RRC State Change" * CONTROL Service Style 1 ("Radio Bearer Control" - section 7.6.2) - "QoS flow mapping configuration" (e.g creating a new DRB) @@ -216,7 +217,7 @@ e2_agent = { ``` Note: we assume that each UE has only 1 DRB; CU-UP does not store the slices, therefore "coarse filtering" is used - * start the RC monitor xApp - aperiodic subscription for "UE RRC State Change" + * start the RC monitor xApp - aperiodic subscriptions for "UE RRC State Change", "RRC Message" copy (`RRC Reconfiguration`, `Measurement Report`, `Security Mode Complete`, `RRC Setup Complete`), and "UE ID" when `RRC Setup Complete` and/or `F1 UE Context Setup Request` detected ```bash cd flexric ./build/examples/xApp/c/monitor/xapp_rc_moni From 681da82228da204d5de9bb2e784cf90169dae04a Mon Sep 17 00:00:00 2001 From: Miguel Fuentes Date: Fri, 14 Mar 2025 19:57:27 +0100 Subject: [PATCH 48/57] Change FlexRIC submodule commit ID Co-authored-by: Tano Bischoff Co-authored-by: Khanh Toan Pham Co-authored-by: Shrinish Donde Co-authored-by: Theodoros Tsourdinis Co-authored-by: Teodora Vladic --- openair2/E2AP/flexric | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/E2AP/flexric b/openair2/E2AP/flexric index beabdd072c..2638b58e20 160000 --- a/openair2/E2AP/flexric +++ b/openair2/E2AP/flexric @@ -1 +1 @@ -Subproject commit beabdd072ca9e381d4d27c9fbc6bb19382817489 +Subproject commit 2638b58e201ab15200d0e02c6225e9aac35ab51b From 5cabc74527c30ee967b9fe00850c3e81484f20e3 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Thu, 27 Mar 2025 16:38:07 +0100 Subject: [PATCH 49/57] get_nr_prach_occasion_info_from_index() uses a uninitialzed value to make += operator --- openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c | 140 ++++++++---------- 1 file changed, 65 insertions(+), 75 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c index 49709543e6..30f0a83b4b 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.c @@ -637,7 +637,20 @@ unsigned int get_delta_f_RA_long(const unsigned int format) // the column 5, (SFN_nbr is a bitmap where we set bit to '1' in the position of the subframe where the RACH can be sent. // E.g. in row 4, and column 5 we have set value 512 ('1000000000') which means RACH can be sent at subframe 9. // E.g. in row 20 and column 5 we have set value 66 ('0001000010') which means RACH can be sent at subframe 1 or 6 -static const int64_t table_6_3_3_2_2_prachConfig_Index[256][9] = { + +typedef struct { + uint8_t format; + uint8_t format2; + int x; + int y; + uint64_t s_map; + uint32_t start_symbol; + uint32_t N_RA_slot; + uint32_t N_t_slot; + uint32_t N_dur; +} nr_prach_info_3gpp_fr1_t; + +static const nr_prach_info_3gpp_fr1_t table_6_3_3_2_2_prachConfig_Index[256] = { // format, format, x, y, SFN_nbr, star_symb, slots_sfn, occ_slot, duration {0, -1, 16, 1, 2, 0, 1, 1, 0}, // (subframe number) 1 {0, -1, 16, 1, 16, 0, 1, 1, 0}, // (subframe number) 4 @@ -897,7 +910,7 @@ static const int64_t table_6_3_3_2_2_prachConfig_Index[256][9] = { {0xc2, -1, 1, 0, 682, 0, 2, 2, 6} // (subframe number) 1,3,5,7,9 }; // Table 6.3.3.2-3: Random access configurations for FR1 and unpaired spectrum -static const int64_t table_6_3_3_2_3_prachConfig_Index[256][9] = { +static const nr_prach_info_3gpp_fr1_t table_6_3_3_2_3_prachConfig_Index[256] = { // format, format, x, y, SFN_nbr, star_symb, slots_sfn, occ_slot, duration {0, -1, 16, 1, 512, 0, 1, 1, 0}, // (subrame number 9) {0, -1, 8, 1, 512, 0, 1, 1, 0}, // (subrame number 9) @@ -1156,8 +1169,22 @@ static const int64_t table_6_3_3_2_3_prachConfig_Index[256][9] = { {0xa3, 0xb3, 1, 0, 682, 0, 1, 2, 6}, // (subrame number 1,3,5,7,9) {0xa3, 0xb3, 1, 0, 1023, 2, 1, 2, 6} // (subrame number 0,1,2,3,4,5,6,7,8,9) }; + +typedef struct { + uint8_t format; + uint8_t format2; + int x; + int y; + int y2; + uint64_t s_map; + uint32_t start_symbol; + uint32_t N_RA_slot; + uint32_t N_t_slot; + uint32_t N_dur; +} nr_prach_info_3gpp_fr2_t; + // Table 6.3.3.2-4: Random access configurations for FR2 and unpaired spectrum -static const int64_t table_6_3_3_2_4_prachConfig_Index[256][10] = { +static const nr_prach_info_3gpp_fr2_t table_6_3_3_2_4_prachConfig_Index[256] = { // format, format, x, y, y, SFN_nbr, star_symb, slots_sfn, occ_slot, // duration {0xa1, -1, 16, 1, -1, 567489872400, 0, 2, 6, 2}, // (subframe number :4,9,14,19,24,29,34,39) @@ -1423,13 +1450,13 @@ int get_format0(uint8_t index, uint8_t unpaired, frequency_range_t frequency_ran int format = 0; if (unpaired) { if (frequency_range==FR1) - format = table_6_3_3_2_3_prachConfig_Index[index][0]; + format = table_6_3_3_2_3_prachConfig_Index[index].format; else - format = table_6_3_3_2_4_prachConfig_Index[index][0]; + format = table_6_3_3_2_4_prachConfig_Index[index].format; } else { if (frequency_range==FR1) - format = table_6_3_3_2_2_prachConfig_Index[index][0]; + format = table_6_3_3_2_2_prachConfig_Index[index].format; else AssertFatal(0==1,"no paired spectrum for FR2\n"); } @@ -1550,22 +1577,20 @@ void set_monitoring_periodicity_offset(NR_SearchSpace_t *ss, nr_prach_info_t get_nr_prach_occasion_info_from_index(uint8_t index, frequency_range_t freq_range, uint8_t unpaired) { - uint8_t format2 = 0xff; - nr_prach_info_t info; + nr_prach_info_t info = {}; if (freq_range == FR2) { - info.x = table_6_3_3_2_4_prachConfig_Index[index][2]; - info.y = table_6_3_3_2_4_prachConfig_Index[index][3]; - info.y2 = table_6_3_3_2_4_prachConfig_Index[index][4]; - info.s_map = table_6_3_3_2_4_prachConfig_Index[index][5]; - info.N_RA_sfn += count_bits64(info.s_map); - info.N_RA_slot = table_6_3_3_2_4_prachConfig_Index[index][7]; + const nr_prach_info_3gpp_fr2_t *tmp = table_6_3_3_2_4_prachConfig_Index + index; + info.x = tmp->x; + info.y = tmp->y; + info.y2 = tmp->y2; + info.s_map = tmp->s_map; + info.N_RA_sfn = count_bits64(info.s_map); + info.N_RA_slot = tmp->N_RA_slot; info.max_association_period = 160 / (info.x * 10); - info.start_symbol = table_6_3_3_2_4_prachConfig_Index[index][6]; - info.N_t_slot = table_6_3_3_2_4_prachConfig_Index[index][8]; - info.N_dur = table_6_3_3_2_4_prachConfig_Index[index][9]; - if (table_6_3_3_2_4_prachConfig_Index[index][1] != -1) - format2 = (uint8_t)table_6_3_3_2_4_prachConfig_Index[index][1]; - info.format = ((uint8_t)table_6_3_3_2_4_prachConfig_Index[index][0]) | (format2 << 8); + info.start_symbol = tmp->start_symbol; + info.N_t_slot = tmp->N_t_slot; + info.N_dur = tmp->N_dur; + info.format = tmp->format | (tmp->format2 << 8); LOG_D(NR_MAC, "PRACH info from index %d frame_type %u start_symbol %u N_t_slot %u N_dur %u N_RA_sfn = %u\n", index, @@ -1576,77 +1601,42 @@ nr_prach_info_t get_nr_prach_occasion_info_from_index(uint8_t index, frequency_r info.N_RA_sfn); return info; } + const nr_prach_info_3gpp_fr1_t *tmp = + unpaired ? /* FR1 TDD*/ table_6_3_3_2_3_prachConfig_Index + index : /* FR1 FDD */ table_6_3_3_2_2_prachConfig_Index + index; - if (unpaired) { // FR1 TDD - info.x = table_6_3_3_2_3_prachConfig_Index[index][2]; - info.y = table_6_3_3_2_3_prachConfig_Index[index][3]; - info.y2 = -1; - info.s_map = table_6_3_3_2_3_prachConfig_Index[index][4]; - info.N_RA_sfn += count_bits64(info.s_map); - info.N_RA_slot = table_6_3_3_2_3_prachConfig_Index[index][6]; - info.max_association_period = 160 / (info.x * 10); - info.start_symbol = table_6_3_3_2_3_prachConfig_Index[index][5]; - info.N_t_slot = table_6_3_3_2_3_prachConfig_Index[index][7]; - info.N_dur = table_6_3_3_2_3_prachConfig_Index[index][8]; - if (table_6_3_3_2_3_prachConfig_Index[index][1] != -1) - format2 = (uint8_t)table_6_3_3_2_3_prachConfig_Index[index][1]; - info.format = ((uint8_t)table_6_3_3_2_3_prachConfig_Index[index][0]) | (format2 << 8); - LOG_D(NR_MAC, - "PRACH info from index %d (col %lu) frame_type %u start_symbol %u N_t_slot %u N_dur %u N_RA_sfn = %u\n", - index, - table_6_3_3_2_3_prachConfig_Index[index][6], - unpaired, - info.start_symbol, - info.N_t_slot, - info.N_dur, - info.N_RA_sfn); - return info; - } - - // FR1 FDD - info.x = table_6_3_3_2_2_prachConfig_Index[index][2]; - info.y = table_6_3_3_2_2_prachConfig_Index[index][3]; + info.x = tmp->x; + info.y = tmp->y; info.y2 = -1; - info.s_map = table_6_3_3_2_2_prachConfig_Index[index][4]; - info.N_RA_sfn += count_bits64(info.s_map); - info.N_RA_slot = table_6_3_3_2_2_prachConfig_Index[index][6]; + info.s_map = tmp->s_map; + info.N_RA_sfn = count_bits64(info.s_map); + info.N_RA_slot = tmp->N_RA_slot; info.max_association_period = 160 / (info.x * 10); - info.start_symbol = table_6_3_3_2_2_prachConfig_Index[index][5]; - info.N_t_slot = table_6_3_3_2_2_prachConfig_Index[index][7]; - info.N_dur = table_6_3_3_2_2_prachConfig_Index[index][8]; - if (table_6_3_3_2_2_prachConfig_Index[index][1] != -1) - format2 = (uint8_t)table_6_3_3_2_2_prachConfig_Index[index][1]; - info.format = ((uint8_t)table_6_3_3_2_2_prachConfig_Index[index][0]) | (format2 << 8); + info.start_symbol = tmp->start_symbol; + info.N_t_slot = tmp->N_t_slot; + info.N_dur = tmp->N_dur; + info.format = tmp->format | (tmp->format2 << 8); LOG_D(NR_MAC, - "PRACH info from index %d frame_type %u start_symbol %u N_t_slot %u N_dur %u \n", + "PRACH info from index %d (col %u) frame_type %u start_symbol %u N_t_slot %u N_dur %u N_RA_sfn = %u\n", index, + tmp->start_symbol, unpaired, info.start_symbol, info.N_t_slot, - info.N_dur); + info.N_dur, + info.N_RA_sfn); return info; } uint16_t get_nr_prach_format_from_index(uint8_t index, uint32_t pointa, uint8_t unpaired) { - uint8_t format2 = 0xff; - uint16_t format; if (get_freq_range_from_arfcn(pointa) == FR2) { - if (table_6_3_3_2_4_prachConfig_Index[index][1] != -1) - format2 = (uint8_t)table_6_3_3_2_4_prachConfig_Index[index][1]; - format = ((uint8_t)table_6_3_3_2_4_prachConfig_Index[index][0]) | (format2 << 8); + const nr_prach_info_3gpp_fr2_t *tmp = table_6_3_3_2_4_prachConfig_Index + index; + return tmp->format | (tmp->format2 << 8); } else { - if (unpaired) { - if (table_6_3_3_2_3_prachConfig_Index[index][1] != -1) - format2 = (uint8_t)table_6_3_3_2_3_prachConfig_Index[index][1]; - format = ((uint8_t)table_6_3_3_2_3_prachConfig_Index[index][0]) | (format2 << 8); - } else { - if (table_6_3_3_2_2_prachConfig_Index[index][1] != -1) - format2 = (uint8_t)table_6_3_3_2_2_prachConfig_Index[index][1]; - format = ((uint8_t)table_6_3_3_2_2_prachConfig_Index[index][0]) | (format2 << 8); - } + const nr_prach_info_3gpp_fr1_t *tmp = + unpaired ? /* FR1 TDD*/ table_6_3_3_2_3_prachConfig_Index + index : /* FR1 FDD */ table_6_3_3_2_2_prachConfig_Index + index; + return tmp->format | (tmp->format2 << 8); } - return format; } bool get_nr_prach_sched_from_info(nr_prach_info_t info, From 990414572afcf6d4c78b764abb55c3b3fa66e6d1 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Thu, 27 Mar 2025 17:05:16 +0100 Subject: [PATCH 50/57] error uint/int mixed in loops --- .../PHY/CODING/nrPolar_tools/nr_polar_defs.h | 41 ++++++++----------- 1 file changed, 16 insertions(+), 25 deletions(-) diff --git a/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h b/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h index 485f50f7b1..803854c23b 100644 --- a/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h +++ b/openair1/PHY/CODING/nrPolar_tools/nr_polar_defs.h @@ -292,42 +292,33 @@ static inline void nr_polar_deinterleaver(uint8_t *input, uint8_t *output, uint1 * De-interleaving of coded bits implementation * TS 138.212: Section 5.4.1.3 - Interleaving of coded bits */ -static inline void nr_polar_rm_deinterleaving_lut(uint16_t *out, const int E) +static inline void nr_polar_rm_deinterleaving_lut(uint16_t *out, const uint E) { - int16_t in[E]; - for (uint i = 0; i < E; i++) - in[i] = i; - int T = ceil((sqrt(8 * E + 1) - 1) / 2); - int v_tab[T][T]; - memset(v_tab, 0, sizeof(v_tab)); - uint k = 0; - for (int i = 0; i < T; i++) { - for (int j = 0; j < T - i; j++) { - if (k < E) { - v_tab[i][j] = k + 1; - } - k++; + uint T = ceil((sqrt(8 * E + 1) - 1) / 2); + + bool v_tab[T][T]; + memset(v_tab, false, sizeof(v_tab)); + for (uint i = 0, k = 0; i < T; i++) { + for (uint j = 0; j < T - i; j++, k++) { + v_tab[i][j] = k < E; } } int v[T][T]; - k = 0; - for (int j = 0; j < T; j++) { - for (int i = 0; i < T - j; i++) { - if (k < E && v_tab[i][j] != 0) { - v[i][j] = in[k]; + memset(v, -1, sizeof(v)); + for (uint j = 0, k = 0; j < T; j++) { + for (uint i = 0; i < T - j; i++) { + if (k < E && v_tab[i][j]) { + v[i][j] = k; k++; - } else { - v[i][j] = INT_MAX; } } } - k = 0; memset(out, 0, E * sizeof(*out)); - for (int i = 0; i < T; i++) { - for (int j = 0; j < T - i; j++) { - if (v[i][j] != INT_MAX) { + for (uint i = 0, k = 0; i < T; i++) { + for (uint j = 0; j < T - i; j++) { + if (v[i][j] != -1) { out[k] = v[i][j]; k++; } From f9835e996ae7747f32e6c77bcd94debbc1beb8d3 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Thu, 27 Mar 2025 17:13:35 +0100 Subject: [PATCH 51/57] websrv useless if(), then string copy --- common/utils/websrv/websrv.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/common/utils/websrv/websrv.c b/common/utils/websrv/websrv.c index 4c8bea0c31..3c05c2f987 100644 --- a/common/utils/websrv/websrv.c +++ b/common/utils/websrv/websrv.c @@ -621,26 +621,21 @@ int websrv_callback_get_softmodemcmd(const struct _u_request *request, struct _u snprintf(confstr, sizeof(confstr), "Confirm %s ?", modulestruct->cmd[j].cmdname); acmd = json_pack("{s:s,s:s}", "name", modulestruct->cmd[j].cmdname, "confirm", confstr); } else if (modulestruct->cmd[j].cmdflags & TELNETSRV_CMDFLAG_NEEDPARAM) { - char *question[] = {NULL,NULL}; - char *helpcp = NULL; + char *question[] = {NULL, NULL}; json_t *jQ1=NULL, *jQ2=NULL; json_t *jQs = json_array(); - if (modulestruct->cmd[j].helpstr != NULL) { - helpcp = strdup(modulestruct->cmd[j].helpstr); - int ns=sscanf(helpcp,"<%m[^<>]> <%m[^<>]>",&question[0],&question[1]); - if (ns == 0) { - LOG_W(UTIL, "[websrv] Cannot find parameters for command %s %s\n", modulestruct->module, modulestruct->cmd[j].cmdname); - continue; - } - jQ1=json_pack("{s:s,s:s,s:s}", "display",question[0], "pname", "P0", "type", "string"); - json_array_append_new(jQs, jQ1); - if (ns >1) { - jQ2=json_pack("{s:s,s:s,s:s}","display", (question[1] == NULL) ? "" : question[1], "pname", "P1" , "type", "string"); - json_array_append_new(jQs, jQ2); - } + int ns = sscanf(modulestruct->cmd[j].helpstr, "<%m[^<>]> <%m[^<>]>", &question[0], &question[1]); + if (ns == 0) { + LOG_W(UTIL, "[websrv] Cannot find parameters for command %s %s\n", modulestruct->module, modulestruct->cmd[j].cmdname); + continue; + } + jQ1 = json_pack("{s:s,s:s,s:s}", "display", question[0], "pname", "P0", "type", "string"); + json_array_append_new(jQs, jQ1); + if (ns > 1) { + jQ2 = json_pack("{s:s,s:s,s:s}", "display", (question[1] == NULL) ? "" : question[1], "pname", "P1", "type", "string"); + json_array_append_new(jQs, jQ2); } acmd = json_pack("{s:s,s:o}", "name", modulestruct->cmd[j].cmdname, "question", jQs); - free(helpcp); free(question[0]); free(question[1]); } else { From 54828f10d0beb1e13e97e612ab0e490a3bdec941 Mon Sep 17 00:00:00 2001 From: Laurent THOMAS Date: Thu, 27 Mar 2025 17:18:26 +0100 Subject: [PATCH 52/57] defined and not used variable --- openair1/PHY/TOOLS/nr_phy_scope.c | 1 - 1 file changed, 1 deletion(-) diff --git a/openair1/PHY/TOOLS/nr_phy_scope.c b/openair1/PHY/TOOLS/nr_phy_scope.c index abf3db9451..ac754eb432 100644 --- a/openair1/PHY/TOOLS/nr_phy_scope.c +++ b/openair1/PHY/TOOLS/nr_phy_scope.c @@ -474,7 +474,6 @@ static void timeResponse (OAIgraph_t *graph, scopeData_t *p, int nb_UEs) { values[i] = SquaredNorm(samples[i]); } #ifdef WEBSRVSCOPE - int uestart = nb_UEs - 1; // web scope shows one UE signal, that can be selected from GUI msg->header.msgtype = SCOPEMSG_TYPE_DATA; msg->header.chartid = graph->chartid; msg->header.datasetid = graph->datasetid; From a12e3a6e56840b8d62aa3f37f0dc7bdf9aa345a2 Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Wed, 12 Mar 2025 11:25:03 +0100 Subject: [PATCH 53/57] Extend F1 Handover test with 1 more handover * the handover is followed by a sleep and an ping test This MR keeps a simple ping after the second handover since there are still issues due to scheduling starting too early, that is as soon as the UE context is added. This leads to retransmissions that could eventually lead to a test failure. The issue will be fixed in a future MR. --- ci-scripts/xml_files/container_5g_f1_rfsim.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ci-scripts/xml_files/container_5g_f1_rfsim.xml b/ci-scripts/xml_files/container_5g_f1_rfsim.xml index f45265db43..d28a378232 100644 --- a/ci-scripts/xml_files/container_5g_f1_rfsim.xml +++ b/ci-scripts/xml_files/container_5g_f1_rfsim.xml @@ -49,6 +49,9 @@ 040025 000031 030021 + 040025 + 000031 + 020022 100021 222222 From 9b3255f3cd4528124dbd9b12a85c899223c2409d Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Tue, 18 Mar 2025 18:18:34 +0100 Subject: [PATCH 54/57] Add check on UE connected to DU to verify successful handover in F1 CI test * add CI function to fetch DU connected to input UE ID * add to CI test --- .../xml_files/container_5g_f1_rfsim.xml | 18 ++++++++++++++ common/utils/telnetsrv/telnetsrv_ci.c | 24 +++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/ci-scripts/xml_files/container_5g_f1_rfsim.xml b/ci-scripts/xml_files/container_5g_f1_rfsim.xml index d28a378232..8f3ac28c7a 100644 --- a/ci-scripts/xml_files/container_5g_f1_rfsim.xml +++ b/ci-scripts/xml_files/container_5g_f1_rfsim.xml @@ -49,9 +49,11 @@ 040025 000031 030021 + 040027 040025 000031 020022 + 040026 100021 222222 @@ -225,6 +227,22 @@ yes + + Custom_Command + UE (1) connected to DU-PCI 0? + cacofonix + echo ci fetch_du_by_ue_id 1 | nc 192.168.71.150 9090 | grep "3584" + yes + + + + Custom_Command + UE (1) connected to DU-PCI 1? + cacofonix + echo ci fetch_du_by_ue_id 1 | nc 192.168.71.150 9090 | grep "3585" + yes + + Undeploy_Object true diff --git a/common/utils/telnetsrv/telnetsrv_ci.c b/common/utils/telnetsrv/telnetsrv_ci.c index ba3062178f..bea421a995 100644 --- a/common/utils/telnetsrv/telnetsrv_ci.c +++ b/common/utils/telnetsrv/telnetsrv_ci.c @@ -141,6 +141,29 @@ int trigger_reestab(char *buf, int debug, telnet_printfunc_t prnt) return 0; } +extern nr_rrc_du_container_t *get_du_for_ue(gNB_RRC_INST *rrc, uint32_t ue_id); + +/** @brief Get connected DU by the UE ID */ +int fetch_du_by_ue_id(char *buf, int debug, telnet_printfunc_t prnt) +{ + if (!RC.nrrrc) + ERROR_MSG_RET("no RRC present, cannot list counts\n"); + + ue_id_t ue_id = 1; + if (buf) { + ue_id = strtol(buf, NULL, 10); + } + nr_rrc_du_container_t *du = get_du_for_ue(RC.nrrrc[0], ue_id); + + if (du) { + prnt("gNB_DU_id %d is connected to ue_id %ld\n", du->setup_req->gNB_DU_id, ue_id); + return 0; + } else { + ERROR_MSG_RET("No DU connected\n"); + return -1; + } +} + extern void nr_HO_F1_trigger_telnet(gNB_RRC_INST *rrc, uint32_t rrc_ue_id); /** * @brief Trigger F1 handover for UE @@ -199,6 +222,7 @@ static telnetshell_cmddef_t cicmds[] = { {"force_ue_release", "[rnti(hex,opt)]", force_ue_release}, {"force_ul_failure", "[rnti(hex,opt)]", force_ul_failure}, {"trigger_f1_ho", "[rrc_ue_id(int,opt)]", rrc_gNB_trigger_f1_ho}, + {"fetch_du_by_ue_id", "[rrc_ue_id(int,opt)]", fetch_du_by_ue_id}, {"", "", NULL}, }; From 67fd15b054c17c1ca571d459b967c5d54f4df790 Mon Sep 17 00:00:00 2001 From: Guido Casati Date: Tue, 1 Apr 2025 22:57:25 +0200 Subject: [PATCH 55/57] Add sleep after deploy of target DU in F1 handover CI test Wait before triggering a handover. First, we send it very quickly after deployment, which can make the DU crash (should be fixed in !3332). Second, a UE would typically first measure neighbors. While we don't do this with OAI UE, mimic this somewhat by giving more time. See also !3332. --- ci-scripts/xml_files/container_5g_f1_rfsim.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/ci-scripts/xml_files/container_5g_f1_rfsim.xml b/ci-scripts/xml_files/container_5g_f1_rfsim.xml index 8f3ac28c7a..b27b0b5701 100644 --- a/ci-scripts/xml_files/container_5g_f1_rfsim.xml +++ b/ci-scripts/xml_files/container_5g_f1_rfsim.xml @@ -46,6 +46,7 @@ 020022 040024 000024 + 000030 040025 000031 030021 From ec9b2bf7c9a0e6b8169ce73c53c32809040c593b Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Fri, 4 Apr 2025 17:19:10 +0200 Subject: [PATCH 56/57] Tune nFAPI 4x4 test case --- ci-scripts/conf_files/gnb-vnf.sa.band77.162prb.nfapi.4x4.conf | 2 +- ci-scripts/xml_files/container_sa_n310_4X4_60MHz_quectel.xml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ci-scripts/conf_files/gnb-vnf.sa.band77.162prb.nfapi.4x4.conf b/ci-scripts/conf_files/gnb-vnf.sa.band77.162prb.nfapi.4x4.conf index d9f09dca3d..ba156df849 100644 --- a/ci-scripts/conf_files/gnb-vnf.sa.band77.162prb.nfapi.4x4.conf +++ b/ci-scripts/conf_files/gnb-vnf.sa.band77.162prb.nfapi.4x4.conf @@ -186,7 +186,7 @@ MACRLCs = ( remote_s_portd = 50010; // pnf p7 port [!] tr_n_preference = "local_RRC"; - pusch_TargetSNRx10 = 250; + pusch_TargetSNRx10 = 300; pucch_TargetSNRx10 = 250; pusch_FailureThres = 100; ul_max_mcs = 28; diff --git a/ci-scripts/xml_files/container_sa_n310_4X4_60MHz_quectel.xml b/ci-scripts/xml_files/container_sa_n310_4X4_60MHz_quectel.xml index 7f5a926948..75087fb4a0 100644 --- a/ci-scripts/xml_files/container_sa_n310_4X4_60MHz_quectel.xml +++ b/ci-scripts/xml_files/container_sa_n310_4X4_60MHz_quectel.xml @@ -116,8 +116,8 @@ Iperf - iperf (DL/480Mbps/UDP)(30 sec)(single-ue profile) - -u -b 480M -t 30 -R + iperf (DL/450Mbps/UDP)(30 sec)(single-ue profile) + -u -b 450M -t 30 -R matix-cn5g up2 25 From 3bd2404eec4c2c9f05ce828f5c4b7f9879fecc7b Mon Sep 17 00:00:00 2001 From: Robert Schmidt Date: Mon, 7 Apr 2025 16:20:22 +0200 Subject: [PATCH 57/57] Iperf_analyzeV2UDP(): variable is local --- ci-scripts/cls_oaicitest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci-scripts/cls_oaicitest.py b/ci-scripts/cls_oaicitest.py index 038449870d..51a7108875 100644 --- a/ci-scripts/cls_oaicitest.py +++ b/ci-scripts/cls_oaicitest.py @@ -210,7 +210,7 @@ def Iperf_analyzeV2UDP(server_filename, iperf_bitrate_threshold, iperf_packetlos jit_msg = f'Jitter : {jitter}' pal_msg = f'Packet Loss : {packetloss}' if float(packetloss) > float(iperf_packetloss_threshold): - pal_msg += f' (too high! >{self.iperf_packetloss_threshold}%)' + pal_msg += f' (too high! >{iperf_packetloss_threshold}%)' return (result, f'{req_msg}\n{bir_msg}\n{brl_msg}\n{jit_msg}\n{pal_msg}') def Custom_Command(HTML, node, command, command_fail):