diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index 732b4738b5..57792ac2ee 100644 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -937,6 +937,8 @@ void nr_rrc_mac_config_req_mib(module_id_t module_id, mac->get_sib1 = true; else if (sched_sib == 2) mac->get_otherSI = true; + else if (sched_sib == 0 && mac->state == UE_RECEIVING_SIB) + mac->state = UE_PERFORMING_RA; nr_ue_decode_mib(mac, cc_idP); ret = pthread_mutex_unlock(&mac->if_mutex); AssertFatal(!ret, "mutex failed %d\n", ret); @@ -1690,7 +1692,7 @@ void nr_rrc_mac_config_req_reset(module_id_t module_id, NR_UE_MAC_reset_cause_t case T300_EXPIRY: reset_ra(mac, false); reset_mac_inst(mac); - mac->state = UE_SYNC; // still in sync but need to restart RA + mac->state = UE_PERFORMING_RA; // still in sync but need to restart RA break; case RE_ESTABLISHMENT: reset_mac_inst(mac); diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs.h b/openair2/LAYER2/NR_MAC_UE/mac_defs.h index 55120dca96..24fefe47af 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h @@ -165,7 +165,7 @@ // Define the UE L2 states with X-Macro #define NR_UE_L2_STATES \ UE_STATE(UE_NOT_SYNC) \ - UE_STATE(UE_SYNC) \ + UE_STATE(UE_RECEIVING_SIB) \ UE_STATE(UE_PERFORMING_RA) \ UE_STATE(UE_CONNECTED) \ UE_STATE(UE_DETACHING) diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c index 70e3019701..4108ebb6e4 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c @@ -1041,7 +1041,7 @@ void nr_ra_failed(NR_UE_MAC_INST_t *mac, uint8_t CC_id, NR_PRACH_RESOURCES_t *pr void trigger_MAC_UE_RA(NR_UE_MAC_INST_t *mac) { LOG_W(NR_MAC, "Triggering new RA procedure for UE with RNTI %x\n", mac->crnti); - mac->state = UE_SYNC; + mac->state = UE_PERFORMING_RA; reset_ra(mac, false); mac->ra.msg3_C_RNTI = true; } diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index c7ceeeab8e..eedc18971b 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -223,10 +223,14 @@ void nr_ue_decode_mib(NR_UE_MAC_INST_t *mac, int cc_id) if (mac->first_sync_frame == -1) mac->first_sync_frame = frame; - if(get_softmodem_params()->phy_test) + if (get_softmodem_params()->phy_test) mac->state = UE_CONNECTED; - else if(mac->state == UE_NOT_SYNC) - mac->state = UE_SYNC; + else if (mac->state == UE_NOT_SYNC) { + if (IS_SA_MODE(get_softmodem_params())) + mac->state = UE_RECEIVING_SIB; + else + mac->state = UE_PERFORMING_RA; + } } static void configure_ratematching_csi(fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_pdu, diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index 6a65adafa7..8f6dc4cc8c 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -1565,7 +1565,7 @@ void nr_ue_ul_scheduler(NR_UE_MAC_INST_t *mac, nr_uplink_indication_t *ul_info) uint32_t gNB_index = ul_info->gNB_index; RA_config_t *ra = &mac->ra; - if(mac->state > UE_NOT_SYNC && mac->state < UE_CONNECTED) { + if (mac->state == UE_PERFORMING_RA) { nr_ue_get_rach(mac, cc_id, frame_tx, gNB_index, slot_tx); nr_ue_prach_scheduler(mac, frame_tx, slot_tx); }