From d45a1e209ba99978be8059f3e5e3b98826b85213 Mon Sep 17 00:00:00 2001 From: francescomani Date: Wed, 8 Apr 2026 09:36:16 +0200 Subject: [PATCH] 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