NR UE: use GET_NTN_UE_K_OFFSET() instead of get_total_TA_ms() in nr_ra_procedures.c

This commit is contained in:
Thomas Schlichter
2025-11-19 10:05:45 +01:00
committed by francescomani
parent 62fe88d6f4
commit 842b16092d
2 changed files with 10 additions and 26 deletions
-5
View File
@@ -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); 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__ */ #endif /*__LAYER2_MAC_DEFS_H__ */
+10 -21
View File
@@ -777,13 +777,12 @@ static int nr_get_RA_window_4Step(long ra_ResponseWindow)
return 0; return 0;
} }
static void setup_ra_response_window(RA_config_t *ra, static void setup_ra_response_window(NR_UE_MAC_INST_t *mac,
int slots_per_frame, RA_config_t *ra,
NR_NTN_Config_r17_t *ntn_Config_r17,
NR_RACH_ConfigGeneric_t *configGeneric, NR_RACH_ConfigGeneric_t *configGeneric,
NR_RACH_ConfigGenericTwoStepRA_r16_t *twostep, NR_RACH_ConfigGenericTwoStepRA_r16_t *twostep)
ntn_timing_advance_componets_t *ntn_ta)
{ {
const int slots_per_frame = mac->frame_structure.numb_slots_frame;
int respwind_value = 0; int respwind_value = 0;
if (ra->ra_type == RA_2_STEP) { if (ra->ra_type == RA_2_STEP) {
long *msgB_ResponseWindow = twostep->msgB_ResponseWindow_r16; 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"); 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; const int ntn_ue_koffset = GET_NTN_UE_K_OFFSET(&mac->ntn_ta, mac->current_UL_BWP->scs);
if (ntn_Config_r17) { ra->response_window_setup_time = respwind_value + ntn_ue_koffset;
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;
} }
// Random Access procedure initialization as per 5.1.1 and initialization of variables specific // 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 else
ra->num_fd_occasions = 1 << rach_ConfigGeneric->msg1_FDM; ra->num_fd_occasions = 1 << rach_ConfigGeneric->msg1_FDM;
setup_ra_response_window(ra, setup_ra_response_window(mac, ra, rach_ConfigGeneric, twostep_generic);
mac->frame_structure.numb_slots_frame,
mac->sc_info.ntn_Config_r17,
rach_ConfigGeneric,
twostep_generic,
&mac->ntn_ta);
return true; 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; RA_config_t *ra = &mac->ra;
NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = mac->current_UL_BWP->rach_ConfigCommon; 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; const int slots_per_ms = mac->frame_structure.numb_slots_frame / 10;
// start contention resolution timer // start contention resolution timer
const int RA_contention_resolution_timer_ms = (nr_rach_ConfigCommon->ra_ContentionResolutionTimer + 1) << 3; 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 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 // 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); nr_timer_start(&ra->contention_resolution_timer);
ra->ra_state = nrRA_WAIT_CONTENTION_RESOLUTION; ra->ra_state = nrRA_WAIT_CONTENTION_RESOLUTION;