From 7da7dda71b19f8b059f8040cc0fe639b0796dbda Mon Sep 17 00:00:00 2001 From: francescomani Date: Mon, 15 Sep 2025 15:46:18 +0200 Subject: [PATCH] new UE state to trigger RA after reconfiguration with sync --- openair2/LAYER2/NR_MAC_UE/config_ue.c | 12 +++++------- openair2/LAYER2/NR_MAC_UE/mac_proto.h | 2 +- openair2/LAYER2/NR_MAC_UE/main_ue_nr.c | 6 +++--- openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c | 2 +- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index 05d2f87eb8..8f36c6cf43 100644 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -1060,7 +1060,7 @@ void nr_rrc_mac_config_req_mib(module_id_t module_id, int cc_idP, NR_MIB_t *mib, nr_ue_decode_mib(mac, cc_idP); if (get_softmodem_params()->phy_test) mac->state = UE_CONNECTED; - else if (mac->state == UE_NOT_SYNC && !IS_SA_MODE(get_softmodem_params())) + else if (mac->state == UE_NOT_SYNC_RECONF) mac->state = UE_PERFORMING_RA; ret = pthread_mutex_unlock(&mac->if_mutex); @@ -1811,7 +1811,7 @@ void nr_rrc_mac_config_req_reset(module_id_t module_id, NR_UE_MAC_reset_cause_t LOG_A(NR_MAC, "Received detach indication\n"); reset_ra(mac, true); reset_mac_inst(mac); - nr_ue_reset_sync_state(mac); + nr_ue_reset_sync_state(mac, false); release_mac_configuration(mac, cause); mac->state = UE_DETACHING; break; @@ -1828,7 +1828,7 @@ void nr_rrc_mac_config_req_reset(module_id_t module_id, NR_UE_MAC_reset_cause_t case RE_ESTABLISHMENT: reset_mac_inst(mac); nr_ue_mac_default_configs(mac); - nr_ue_reset_sync_state(mac); + nr_ue_reset_sync_state(mac, true); release_mac_configuration(mac, cause); // suspend all RBs except SRB0 for (int j = 0; j < mac->lc_ordered_list.count; j++) { @@ -1971,9 +1971,7 @@ void nr_rrc_mac_config_other_sib(module_id_t module_id, NR_SIB19_r17_t *sib19, b AssertFatal(!ret, "mutex failed %d\n", ret); } -static void handle_reconfiguration_with_sync(NR_UE_MAC_INST_t *mac, - int cc_idP, - const NR_ReconfigurationWithSync_t *reconfWithSync) +static void handle_reconfiguration_with_sync(NR_UE_MAC_INST_t *mac, int cc_idP, const NR_ReconfigurationWithSync_t *reconfWithSync) { reset_mac_inst(mac); mac->crnti = reconfWithSync->newUE_Identity; @@ -2015,7 +2013,7 @@ static void handle_reconfiguration_with_sync(NR_UE_MAC_INST_t *mac, configure_common_BWP_ul(mac, bwp_id, scc->uplinkConfigCommon->initialUplinkBWP); } - mac->state = UE_NOT_SYNC; + mac->state = UE_NOT_SYNC_RECONF; ra->ra_state = nrRA_UE_IDLE; nr_ue_mac_default_configs(mac); diff --git a/openair2/LAYER2/NR_MAC_UE/mac_proto.h b/openair2/LAYER2/NR_MAC_UE/mac_proto.h index 981048f7b0..7bb3861e48 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_proto.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_proto.h @@ -252,7 +252,7 @@ void nr_get_RA_window(NR_UE_MAC_INST_t *mac); void prepare_msg4_msgb_feedback(NR_UE_MAC_INST_t *mac, int pid, int ack_nack); void configure_initial_pucch(PUCCH_sched_t *pucch, int res_ind); void release_PUCCH_SRS(NR_UE_MAC_INST_t *mac); -void nr_ue_reset_sync_state(NR_UE_MAC_INST_t *mac); +void nr_ue_reset_sync_state(NR_UE_MAC_INST_t *mac, bool reconf); void nr_ue_send_synch_request(NR_UE_MAC_INST_t *mac, module_id_t module_id, int cc_id, const fapi_nr_synch_request_t *sync_req); bool is_ss_monitor_occasion(const int frame, const int slot, const int slots_per_frame, const NR_SearchSpace_t *ss); diff --git a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c index c78d2217b4..4cf96b46bc 100644 --- a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c +++ b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c @@ -54,7 +54,7 @@ void send_srb0_rrc(int ue_id, const uint8_t *sdu, sdu_size_t sdu_len, void *data void nr_ue_init_mac(NR_UE_MAC_INST_t *mac) { LOG_I(NR_MAC, "[UE%d] Initializing MAC\n", mac->ue_id); - nr_ue_reset_sync_state(mac); + nr_ue_reset_sync_state(mac, false); mac->get_sib1 = false; for (int i = 0; i < MAX_SI_GROUPS; i++) mac->get_otherSI[i] = false; @@ -117,10 +117,10 @@ void nr_ue_send_synch_request(NR_UE_MAC_INST_t *mac, module_id_t module_id, int mac->if_module->synch_request(&mac->synch_request); } -void nr_ue_reset_sync_state(NR_UE_MAC_INST_t *mac) +void nr_ue_reset_sync_state(NR_UE_MAC_INST_t *mac, bool reconf) { // reset synchornization status - mac->state = UE_NOT_SYNC; + mac->state = reconf ? UE_NOT_SYNC_RECONF : UE_NOT_SYNC; mac->ra.ra_state = nrRA_UE_IDLE; } diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index bd9ea09041..419663d568 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -1146,7 +1146,7 @@ void nr_ue_dl_scheduler(NR_UE_MAC_INST_t *mac, nr_downlink_indication_t *dl_info dl_config->slot = rx_slot; dl_config->number_pdus = 0; - if (mac->state == UE_NOT_SYNC || mac->state == UE_DETACHING) + if (mac->state == UE_NOT_SYNC || mac->state == UE_NOT_SYNC_RECONF || mac->state == UE_DETACHING) return; if (mac->state == UE_CONNECTED) {