Commit 4522cd4e authored by cig's avatar cig

Changes to RA procedures:

- monitoring RA window
- taking RA_offset into account
- workaround to generate PRACH only when the RAR has not been received yet (RA is idle)
parent 66395ff7
......@@ -64,6 +64,7 @@
extern int64_t table_6_3_3_2_2_prachConfig_Index [256][9];
extern int64_t table_6_3_3_2_3_prachConfig_Index [256][9];
extern const uint16_t nr_slots_per_frame[5];
//extern uint8_t nfapi_mode;
......@@ -370,7 +371,6 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
LOG_I(MAC, "RA not active. Starting RA preamble initialization.\n");
mac->ra_state = RA_UE_IDLE;
mac->RA_RAPID_found = 0;
/* Set RA_PREAMBLE_POWER_RAMPING_STEP */
......@@ -442,33 +442,7 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
mac->RA_active = 1;
prach_resources->Msg3 = payload;
ra_ResponseWindow = rach_ConfigGeneric->ra_ResponseWindow;
switch (ra_ResponseWindow) {
case 0:
mac->RA_window_cnt = 1;
break;
case 1:
mac->RA_window_cnt = 2;
break;
case 2:
mac->RA_window_cnt = 4;
break;
case 3:
mac->RA_window_cnt = 8;
break;
case 4:
mac->RA_window_cnt = 10;
break;
case 5:
mac->RA_window_cnt = 20;
break;
case 6:
mac->RA_window_cnt = 40;
break;
case 7:
mac->RA_window_cnt = 80;
break;
}
nr_get_RA_window(mac);
// Fill in preamble and PRACH resources
if (mac->generate_nr_prach)
......@@ -515,17 +489,16 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
prach_resources->RA_PREAMBLE_BACKOFF = 0;
}
if (mac->RA_window_cnt > 0 && mac->RA_RAPID_found == 1) {
if (mac->RA_window_cnt >= 0 && mac->RA_RAPID_found == 1) {
// mac->ra_state = WAIT_CONTENTION_RESOLUTION;
LOG_I(MAC, "[MAC][UE %d][RAPROC] Frame %d: subframe %d: RAR successfully received \n", mod_id, frame, nr_tti_tx);
} else {
mac->ra_state = RA_UE_IDLE;
LOG_I(MAC, "[MAC][UE %d][RAPROC] Frame %d: subframe %d: RAR reception not successful, (RA window count %d) \n",
mod_id,
frame,
nr_tti_tx,
mac->RA_window_cnt);
} else if (mac->RA_window_cnt == 0 && !mac->RA_RAPID_found) {
LOG_I(MAC, "[MAC][UE %d][RAPROC] Frame %d: subframe %d: RAR reception failed \n", mod_id, frame, nr_tti_tx);
mac->ra_state = RA_UE_IDLE;
mac->RA_PREAMBLE_TRANSMISSION_COUNTER++;
preambleTransMax = -1;
......@@ -565,6 +538,9 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
break;
}
// Resetting RA window
nr_get_RA_window(mac);
if (mac->RA_PREAMBLE_TRANSMISSION_COUNTER == preambleTransMax + 1){
LOG_D(MAC, "[UE %d] Frame %d: Maximum number of RACH attempts (%d)\n", mod_id, frame, preambleTransMax);
mac->RA_backoff_cnt = rand() % (prach_resources->RA_PREAMBLE_BACKOFF + 1);
......@@ -595,6 +571,20 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
if (mac->generate_nr_prach)
nr_get_prach_resources(mod_id, CC_id, gNB_id, nr_tti_tx, 0, prach_resources, rach_ConfigDedicated);
} else {
mac->RA_window_cnt--;
LOG_I(MAC, "[MAC][UE %d][RAPROC] Frame %d: subframe %d: RAR reception not successful, (RA window count %d) \n",
mod_id,
frame,
nr_tti_tx,
mac->RA_window_cnt);
// Fill in preamble and PRACH resources
if (mac->generate_nr_prach)
nr_get_prach_resources(mod_id, CC_id, gNB_id, nr_tti_tx, 0, prach_resources, rach_ConfigDedicated);
}
}
} else if (UE_mode == PUSCH) {
......@@ -603,3 +593,48 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
}
return mac->generate_nr_prach;
}
void nr_get_RA_window(NR_UE_MAC_INST_t *mac){
uint8_t mu, ra_ResponseWindow;
NR_ServingCellConfigCommon_t *scc = mac->scc;
NR_RACH_ConfigCommon_t *setup = scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup;
NR_RACH_ConfigGeneric_t *rach_ConfigGeneric = &setup->rach_ConfigGeneric;
NR_FrequencyInfoDL_t *frequencyInfoDL = scc->downlinkConfigCommon->frequencyInfoDL;
ra_ResponseWindow = rach_ConfigGeneric->ra_ResponseWindow;
if (setup->msg1_SubcarrierSpacing)
mu = *setup->msg1_SubcarrierSpacing;
else
mu = frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing;
mac->RA_window_cnt = mac->RA_offset*nr_slots_per_frame[mu]; // taking into account the 2 frames gap introduced by OAI gNB
switch (ra_ResponseWindow) {
case 0:
mac->RA_window_cnt += 1;
break;
case 1:
mac->RA_window_cnt += 2;
break;
case 2:
mac->RA_window_cnt += 4;
break;
case 3:
mac->RA_window_cnt += 8;
break;
case 4:
mac->RA_window_cnt += 10;
break;
case 5:
mac->RA_window_cnt += 20;
break;
case 6:
mac->RA_window_cnt += 40;
break;
case 7:
mac->RA_window_cnt += 80;
break;
}
}
\ No newline at end of file
......@@ -906,7 +906,8 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s
&start_symbol,
&N_t_slot,
&N_dur);
if (is_nr_prach_slot) {
if (is_nr_prach_slot && mac->ra_state == RA_UE_IDLE) {
mac->generate_nr_prach = 1;
......
......@@ -115,7 +115,7 @@ int nr_ue_ul_indication(nr_uplink_indication_t *ul_info){
ret = nr_ue_scheduler(NULL, ul_info);
if (is_nr_UL_slot(mac->scc, ul_info->slot_tx) && mac->ra_state == RA_UE_IDLE && get_softmodem_params()->do_ra){
if (is_nr_UL_slot(mac->scc, ul_info->slot_tx) && get_softmodem_params()->do_ra){
nr_ue_prach_scheduler(module_id, ul_info->frame_tx, ul_info->slot_tx);
if (mac->generate_nr_prach){
uint16_t monitoring_slot_period, monitoring_offset;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment