From d45a1e209ba99978be8059f3e5e3b98826b85213 Mon Sep 17 00:00:00 2001 From: francescomani Date: Wed, 8 Apr 2026 09:36:16 +0200 Subject: [PATCH 1/2] verify consistency of CSI report in L2 instead of RRC at RRC we don't store CSI-MeasConfig information so in some scenarios (see #1063) we may not have the full pictures to understand if what RRC received is a valid configuration we verify at L2 instead after updating CSI-MeasConfig and if it fails we send a message to RRC --- openair2/COMMON/mac_messages_def.h | 1 + openair2/COMMON/mac_messages_types.h | 5 +++++ openair2/LAYER2/NR_MAC_UE/config_ue.c | 10 ++++++++-- openair2/RRC/NR_UE/L2_interface_ue.c | 7 +++++++ openair2/RRC/NR_UE/L2_interface_ue.h | 1 + openair2/RRC/NR_UE/rrc_UE.c | 6 ++++++ openair2/RRC/NR_UE/rrc_proto.h | 1 - openair2/RRC/NR_UE/verify_RRC.c | 4 +--- openair2/RRC/NR_UE/verify_RRC.h | 16 ++++++++++++++++ 9 files changed, 45 insertions(+), 6 deletions(-) create mode 100644 openair2/RRC/NR_UE/verify_RRC.h diff --git a/openair2/COMMON/mac_messages_def.h b/openair2/COMMON/mac_messages_def.h index cca53d38e6..bed2ad4243 100644 --- a/openair2/COMMON/mac_messages_def.h +++ b/openair2/COMMON/mac_messages_def.h @@ -31,6 +31,7 @@ MESSAGE_DEF(RRC_MAC_PCCH_DATA_REQ, MESSAGE_PRIORITY_MED_PLUS, RrcMacPcchDat MESSAGE_DEF(NR_RRC_MAC_RA_IND, MESSAGE_PRIORITY_MED_PLUS, NRRrcMacRaInd, nr_rrc_mac_ra_ind) MESSAGE_DEF(NR_RRC_MAC_MSG3_IND, MESSAGE_PRIORITY_MED_PLUS, NRRrcMacMsg3Ind, nr_rrc_mac_msg3_ind) MESSAGE_DEF(NR_RRC_MAC_INAC_IND, MESSAGE_PRIORITY_MED_PLUS, NRRrcMacInacInd, nr_rrc_mac_inac_ind) +MESSAGE_DEF(NR_RRC_MAC_VERIFY, MESSAGE_PRIORITY_MED_PLUS, NRRrcMacVerify, nr_rrc_mac_verify) /* RRC configures DRX context (MAC timers) of a UE */ MESSAGE_DEF(RRC_MAC_DRX_CONFIG_REQ, MESSAGE_PRIORITY_MED, rrc_mac_drx_config_req_t, rrc_mac_drx_config_req) diff --git a/openair2/COMMON/mac_messages_types.h b/openair2/COMMON/mac_messages_types.h index c447379640..dc6770948f 100644 --- a/openair2/COMMON/mac_messages_types.h +++ b/openair2/COMMON/mac_messages_types.h @@ -41,6 +41,7 @@ #define NR_RRC_MAC_RA_IND(mSGpTR) (mSGpTR)->ittiMsg.nr_rrc_mac_ra_ind #define NR_RRC_MAC_MSG3_IND(mSGpTR) (mSGpTR)->ittiMsg.nr_rrc_mac_msg3_ind #define NR_RRC_MAC_INAC_IND(mSGpTR) (mSGpTR)->ittiMsg.nr_rrc_mac_inac_ind +#define NR_RRC_MAC_VERIFY(mSGpTR) (mSGpTR)->ittiMsg.nr_rrc_mac_verify #define RRC_MAC_DRX_CONFIG_REQ(mSGpTR) (mSGpTR)->ittiMsg.rrc_mac_drx_config_req @@ -67,6 +68,10 @@ typedef struct NRRrcMacMsg3Ind_s { bool prepare_payload; } NRRrcMacMsg3Ind; +typedef struct NRRrcMacVerify_s { + bool L2_RRC_verification_failed; // not to leave the struct empty +} NRRrcMacVerify; + typedef struct NRRrcMacInacInd_s { bool inactivity_timer_expired; // not to leave the struct empty } NRRrcMacInacInd; diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index 6ecba2e923..d56b921b48 100644 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -15,6 +15,8 @@ #include "common/utils/nr/nr_common.h" #include "executables/softmodem-common.h" #include "SCHED_NR/phy_frame_config_nr.h" +#include "RRC/NR_UE/verify_RRC.h" +#include "RRC/NR_UE/L2_interface_ue.h" #include "oai_asn1.h" #define ASIGN_P_VAL(dst, src) \ @@ -2552,7 +2554,9 @@ static void modify_csi_measconfig(NR_CSI_MeasConfig_t *source, NR_CSI_MeasConfig } } -static void configure_csiconfig(NR_UE_ServingCell_Info_t *sc_info, struct NR_SetupRelease_CSI_MeasConfig *csi_MeasConfig_sr) +static void configure_csiconfig(NR_UE_ServingCell_Info_t *sc_info, + struct NR_SetupRelease_CSI_MeasConfig *csi_MeasConfig_sr, + module_id_t ue_id) { switch (csi_MeasConfig_sr->present) { case NR_SetupRelease_CSI_MeasConfig_PR_NOTHING: @@ -2574,6 +2578,8 @@ static void configure_csiconfig(NR_UE_ServingCell_Info_t *sc_info, struct NR_Set } else { // modification modify_csi_measconfig(csi_MeasConfig_sr->choice.setup, sc_info->csi_MeasConfig); } + if (!check_csi_report_consistency(sc_info->csi_MeasConfig)) + nr_mac_rrc_verification_failed(ue_id); break; } default: @@ -2585,7 +2591,7 @@ static void configure_servingcell_info(NR_UE_MAC_INST_t *mac, NR_ServingCellConf { NR_UE_ServingCell_Info_t *sc_info = &mac->sc_info; if (scd->csi_MeasConfig) { - configure_csiconfig(sc_info, scd->csi_MeasConfig); + configure_csiconfig(sc_info, scd->csi_MeasConfig, mac->ue_id); compute_csi_bitlen(sc_info->csi_MeasConfig, mac->csi_report_template); } diff --git a/openair2/RRC/NR_UE/L2_interface_ue.c b/openair2/RRC/NR_UE/L2_interface_ue.c index b0b3b501cd..0133f81e03 100644 --- a/openair2/RRC/NR_UE/L2_interface_ue.c +++ b/openair2/RRC/NR_UE/L2_interface_ue.c @@ -155,6 +155,13 @@ void process_msg_rcc_to_mac(nr_mac_rrc_message_t *msg, int instance_id) } } +void nr_mac_rrc_verification_failed(const module_id_t mod_id) +{ + MessageDef *message_p = itti_alloc_new_message(TASK_MAC_UE, 0, NR_RRC_MAC_VERIFY); + NR_RRC_MAC_VERIFY (message_p).L2_RRC_verification_failed = true; + itti_send_msg_to_task(TASK_RRC_NRUE, GNB_MODULE_ID_TO_INSTANCE(mod_id), message_p); +} + void nr_mac_rrc_inactivity_timer_ind(const module_id_t mod_id) { MessageDef *message_p = itti_alloc_new_message(TASK_MAC_UE, 0, NR_RRC_MAC_INAC_IND); diff --git a/openair2/RRC/NR_UE/L2_interface_ue.h b/openair2/RRC/NR_UE/L2_interface_ue.h index 09c7b7daae..5121f0859e 100644 --- a/openair2/RRC/NR_UE/L2_interface_ue.h +++ b/openair2/RRC/NR_UE/L2_interface_ue.h @@ -30,5 +30,6 @@ void nr_mac_rrc_msg3_ind(const module_id_t mod_id, const int rnti, bool prepare_ void nr_ue_rrc_timer_trigger(int instance, int hfn, int frame, int gnb_id); void nr_mac_rrc_ra_ind(const module_id_t mod_id, bool success); void process_msg_rcc_to_mac(nr_mac_rrc_message_t *msg, int instance_id); +void nr_mac_rrc_verification_failed(const module_id_t mod_id); #endif diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 37bca1d45a..5f0fefdcff 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -24,6 +24,7 @@ #include "rrc_defs.h" #include "rrc_proto.h" +#include "verify_RRC.h" #include "L2_interface_ue.h" #include "LAYER2/NR_MAC_UE/mac_proto.h" @@ -3115,6 +3116,11 @@ void *rrc_nrue(void *notUsed) } break; + case NR_RRC_MAC_VERIFY: + LOG_W(NR_RRC, "L2 verification of RRC consistency failed\n"); + handle_rlf_detection(rrc); + break; + case NR_RRC_MAC_INAC_IND: LOG_D(NR_RRC, "Received data inactivity indication from lower layers\n"); NR_Release_Cause_t release_cause = RRC_CONNECTION_FAILURE; diff --git a/openair2/RRC/NR_UE/rrc_proto.h b/openair2/RRC/NR_UE/rrc_proto.h index 5efd15306a..f4bf1b4e1e 100644 --- a/openair2/RRC/NR_UE/rrc_proto.h +++ b/openair2/RRC/NR_UE/rrc_proto.h @@ -72,7 +72,6 @@ void nr_rrc_ue_decode_NR_SBCCH_SL_BCH_Message(NR_UE_RRC_INST_t *rrc, const uint16_t rx_slss_id); void nr_rrc_set_mac_queue(instance_t instance, notifiedFIFO_t *mac_input_nf); -bool check_cellgroup_config(const NR_CellGroupConfig_t *cgConfig); /** @}*/ #endif diff --git a/openair2/RRC/NR_UE/verify_RRC.c b/openair2/RRC/NR_UE/verify_RRC.c index 9d5cd5d726..42d3204d27 100644 --- a/openair2/RRC/NR_UE/verify_RRC.c +++ b/openair2/RRC/NR_UE/verify_RRC.c @@ -188,7 +188,7 @@ static bool check_csi_resourceMapping_consistency(NR_CSI_RS_ResourceMapping_t re return true; } -static bool check_csi_report_consistency(const NR_CSI_MeasConfig_t *meas) +bool check_csi_report_consistency(const NR_CSI_MeasConfig_t *meas) { if (!meas || !meas->csi_ReportConfigToAddModList) return true; @@ -223,8 +223,6 @@ static bool check_csi_resource_consistency(const NR_CSI_MeasConfig_t *meas) static bool check_csi_MeasConfig(struct NR_SetupRelease_CSI_MeasConfig *csi_MeasConfig) { const NR_CSI_MeasConfig_t *meas = csi_MeasConfig->choice.setup; - if (!check_csi_report_consistency(meas)) - return false; if (!check_csi_resource_consistency(meas)) return false; return true; diff --git a/openair2/RRC/NR_UE/verify_RRC.h b/openair2/RRC/NR_UE/verify_RRC.h new file mode 100644 index 0000000000..e4de684402 --- /dev/null +++ b/openair2/RRC/NR_UE/verify_RRC.h @@ -0,0 +1,16 @@ +/* + * SPDX-License-Identifier: LicenseRef-CSSL-1.0 + */ + +/* + * \brief RRC functions prototypes for eNB and UE + */ + +#ifndef _VERIFY_RRC_H_ +#define _VERIFY_RRC_H_ + +#include "NR_MeasConfig.h" + +bool check_csi_report_consistency(const NR_CSI_MeasConfig_t *meas); +bool check_cellgroup_config(const NR_CellGroupConfig_t *cgConfig); +#endif From 82f9501424ae2c371fb249e960f8360ee33a5cde Mon Sep 17 00:00:00 2001 From: francescomani Date: Sat, 11 Apr 2026 18:07:15 +0200 Subject: [PATCH 2/2] include NR_L2_UE in dlsim and ulsim and get rid of indication functions from nr_unitary_common --- CMakeLists.txt | 4 +- .../SIMULATION/NR_PHY/nr_unitary_common.c | 80 ------------------- .../tests/test_nr_ue_ra_procedures.cpp | 8 +- 3 files changed, 9 insertions(+), 83 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6e8758cea3..bc429cacb6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2020,7 +2020,7 @@ add_executable(nr_dlsim ) target_link_libraries(nr_dlsim PRIVATE -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_UE_NR MAC_NR_COMMON CONFIG_LIB L2_NR -Wl,--end-group - m pthread ${T_LIB} ITTI dl nr_ue_phy_meas physim_common + m pthread ${T_LIB} ITTI dl nr_ue_phy_meas physim_common NR_L2_UE softmodem_common ) target_link_libraries(nr_dlsim PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs) @@ -2049,7 +2049,7 @@ add_executable(nr_ulsim target_link_libraries(nr_ulsim PRIVATE -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_UE_NR MAC_NR_COMMON CONFIG_LIB L2_NR -Wl,--end-group - m pthread ${T_LIB} ITTI dl nr_ue_phy_meas physim_common softmodem_common + m pthread ${T_LIB} ITTI dl nr_ue_phy_meas physim_common softmodem_common NR_L2_UE ) target_link_libraries(nr_ulsim PRIVATE asn1_nr_rrc_hdrs asn1_lte_rrc_hdrs) diff --git a/openair1/SIMULATION/NR_PHY/nr_unitary_common.c b/openair1/SIMULATION/NR_PHY/nr_unitary_common.c index 9a595a9295..3c0e2ee87c 100644 --- a/openair1/SIMULATION/NR_PHY/nr_unitary_common.c +++ b/openair1/SIMULATION/NR_PHY/nr_unitary_common.c @@ -136,83 +136,3 @@ int nfapi_p7_message_header_unpack(void *pMessageBuf, UNUSED(config); return 0; } - -void nr_mac_rrc_sync_ind(const module_id_t module_id, const frame_t frame, const bool in_sync) -{ - UNUSED(module_id); - UNUSED(frame); - UNUSED(in_sync); -} - -void nr_mac_rrc_msg3_ind(const module_id_t mod_id, int rnti, int gnb_id) -{ - UNUSED(mod_id); - UNUSED(gnb_id); - UNUSED(rnti); -} - -void nr_mac_rrc_ra_ind(const module_id_t mod_id, bool success) -{ - UNUSED(mod_id); - UNUSED(success); -} - -void nr_mac_rrc_inactivity_timer_ind(const module_id_t mod_id) -{ - UNUSED(mod_id); -} - -void rrc_data_ind(const protocol_ctxt_t *const ctxt_pP, - const rb_id_t Srb_id, - const sdu_size_t sdu_sizeP, - const uint8_t *const buffer_pP) -{ - UNUSED(ctxt_pP); - UNUSED(Srb_id); - UNUSED(sdu_sizeP); - UNUSED(buffer_pP); -} - -typedef uint32_t channel_t; -int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, - const int CC_id, - const uint8_t gNB_index, - const int hfn, - const frame_t frame, - const int slot, - const rnti_t rnti, - const uint32_t cellid, - const long arfcn, - const channel_t channel, - const uint8_t *pduP, - const sdu_size_t pdu_len) -{ - UNUSED(module_id); - UNUSED(CC_id); - UNUSED(gNB_index); - UNUSED(hfn); - UNUSED(frame); - UNUSED(slot); - UNUSED(rnti); - UNUSED(arfcn); - UNUSED(channel); - UNUSED(pduP); - UNUSED(pdu_len); - UNUSED(cellid); - return 0; -} - -void nr_mac_rrc_meas_ind_ue(module_id_t module_id, - uint32_t gNB_index, - uint16_t Nid_cell, - bool csi_meas, - bool is_neighboring_cell, - int rsrp_dBm) -{ - UNUSED(module_id); - UNUSED(Nid_cell); - UNUSED(gNB_index); - UNUSED(csi_meas); - UNUSED(is_neighboring_cell); - UNUSED(rsrp_dBm); -} 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 ae79c87aee..0fb34a9a37 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 @@ -42,7 +42,9 @@ void nr_mac_rlc_data_ind(const module_id_t module_idP, int num_data) { } - +void nr_mac_rrc_verification_failed(const module_id_t mod_id) +{ +} bool nr_rlc_activate_srb0(int ue_id, void *data, void (*send_initial_ul_rrc_message)(int ue_id, const uint8_t *sdu, sdu_size_t sdu_len, void *data)) @@ -77,6 +79,10 @@ int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, { return 0; } +bool check_csi_report_consistency(const NR_CSI_MeasConfig_t *meas) +{ + return true; +} void nr_mac_rrc_meas_ind_ue(module_id_t module_id, uint32_t gNB_index, uint16_t Nid_cell,