From b8c1129dfe279fa22e6d41e96e10366721905b3a Mon Sep 17 00:00:00 2001 From: francescomani Date: Tue, 22 Aug 2023 18:51:49 +0200 Subject: [PATCH] Init RA at the right time at UE --- openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c | 5 ++++- openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c index 54d91e9971..9328d75b37 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c @@ -71,6 +71,7 @@ void init_RA(module_id_t mod_id, ra->first_Msg3 = 1; ra->starting_preamble_nb = 0; ra->RA_backoff_cnt = 0; + ra->RA_window_cnt = -1; fapi_nr_config_request_t *cfg = &mac->phy_config.config_req; @@ -653,7 +654,9 @@ uint8_t nr_ue_get_rach(module_id_t mod_id, if (ra->ra_state > RA_UE_IDLE && ra->ra_state < RA_SUCCEEDED) { if (ra->RA_active == 0) { - /* RA not active - checking if RRC is ready to initiate the RA procedure */ + NR_RACH_ConfigCommon_t *setup = mac->current_UL_BWP.rach_ConfigCommon; + NR_RACH_ConfigGeneric_t *rach_ConfigGeneric = &setup->rach_ConfigGeneric; + init_RA(mod_id, &ra->prach_resources, setup, rach_ConfigGeneric, ra->rach_ConfigDedicated); LOG_D(NR_MAC, "In %s: RA not active. Checking for data to transmit from upper layers...\n", __FUNCTION__); diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index 94aff89a56..e2c7833535 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -2474,7 +2474,6 @@ static void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_fr if (is_nr_prach_slot) { AssertFatal(NULL != prach_occasion_info_p,"PRACH Occasion Info not returned in a valid NR Prach Slot\n"); - init_RA(module_idP, &ra->prach_resources, setup, rach_ConfigGeneric, ra->rach_ConfigDedicated); nr_get_RA_window(mac); uint16_t format = prach_occasion_info_p->format;