diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs.h b/openair2/LAYER2/NR_MAC_UE/mac_defs.h index e284c29f9f..8a8d9e4ebb 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h @@ -683,10 +683,5 @@ static inline long GET_DURATION_RX_TO_TX(const ntn_timing_advance_componets_t *n return NR_UE_CAPABILITY_SLOT_RX_TO_TX + (ntn_ta->cell_specific_k_offset << scs); } -static inline double get_total_TA_ms(const ntn_timing_advance_componets_t *ntn_ta) -{ - return ntn_ta->N_common_ta_adj; -} - /*@}*/ #endif /*__LAYER2_MAC_DEFS_H__ */ diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c index 0dae34eda7..b5eeedca3f 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c @@ -777,13 +777,12 @@ static int nr_get_RA_window_4Step(long ra_ResponseWindow) return 0; } -static void setup_ra_response_window(RA_config_t *ra, - int slots_per_frame, - NR_NTN_Config_r17_t *ntn_Config_r17, +static void setup_ra_response_window(NR_UE_MAC_INST_t *mac, + RA_config_t *ra, NR_RACH_ConfigGeneric_t *configGeneric, - NR_RACH_ConfigGenericTwoStepRA_r16_t *twostep, - ntn_timing_advance_componets_t *ntn_ta) + NR_RACH_ConfigGenericTwoStepRA_r16_t *twostep) { + const int slots_per_frame = mac->frame_structure.numb_slots_frame; int respwind_value = 0; if (ra->ra_type == RA_2_STEP) { long *msgB_ResponseWindow = twostep->msgB_ResponseWindow_r16; @@ -816,13 +815,8 @@ static void setup_ra_response_window(RA_config_t *ra, LOG_E(NR_MAC, "RA-ResponseWindow need to be configured to a value lower than or equal to 10 ms\n"); } - int ta_Common_slots = 0; - if (ntn_Config_r17) { - const double ta_Common_ms = get_total_TA_ms(ntn_ta); - ta_Common_slots = (int)ceil(ta_Common_ms * slots_per_frame / 10); - } - - ra->response_window_setup_time = respwind_value + ta_Common_slots; + const int ntn_ue_koffset = GET_NTN_UE_K_OFFSET(&mac->ntn_ta, mac->current_UL_BWP->scs); + ra->response_window_setup_time = respwind_value + ntn_ue_koffset; } // Random Access procedure initialization as per 5.1.1 and initialization of variables specific @@ -1026,12 +1020,8 @@ bool init_RA(NR_UE_MAC_INST_t *mac, int frame) else ra->num_fd_occasions = 1 << rach_ConfigGeneric->msg1_FDM; - setup_ra_response_window(ra, - mac->frame_structure.numb_slots_frame, - mac->sc_info.ntn_Config_r17, - rach_ConfigGeneric, - twostep_generic, - &mac->ntn_ta); + setup_ra_response_window(mac, ra, rach_ConfigGeneric, twostep_generic); + return true; } @@ -1039,16 +1029,15 @@ void nr_Msg3_transmitted(NR_UE_MAC_INST_t *mac, uint8_t CC_id, frame_t frameP, s { RA_config_t *ra = &mac->ra; NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = mac->current_UL_BWP->rach_ConfigCommon; - const double ta_Common_ms = get_total_TA_ms(&mac->ntn_ta); + const int ntn_ue_koffset = GET_NTN_UE_K_OFFSET(&mac->ntn_ta, mac->current_UL_BWP->scs); const int slots_per_ms = mac->frame_structure.numb_slots_frame / 10; // start contention resolution timer const int RA_contention_resolution_timer_ms = (nr_rach_ConfigCommon->ra_ContentionResolutionTimer + 1) << 3; const int RA_contention_resolution_timer_slots = RA_contention_resolution_timer_ms * slots_per_ms; - const int ta_Common_slots = (int)ceil(ta_Common_ms * slots_per_ms); // timer step 1 slot and timer target given by ra_ContentionResolutionTimer + ta-Common-r17 - nr_timer_setup(&ra->contention_resolution_timer, RA_contention_resolution_timer_slots + ta_Common_slots, 1); + nr_timer_setup(&ra->contention_resolution_timer, RA_contention_resolution_timer_slots + ntn_ue_koffset, 1); nr_timer_start(&ra->contention_resolution_timer); ra->ra_state = nrRA_WAIT_CONTENTION_RESOLUTION;