Commit 12b585a1 authored by cig's avatar cig

Fixes to RA procedure

parent 58dbf7d4
...@@ -221,8 +221,6 @@ typedef struct { ...@@ -221,8 +221,6 @@ typedef struct {
uint16_t ra_RNTI; uint16_t ra_RNTI;
/// Pointer to Msg3 payload for UL-grant /// Pointer to Msg3 payload for UL-grant
uint8_t *Msg3; uint8_t *Msg3;
/// Flag for the Msg1 generation: it is enabled every time it is nr prach slot
uint8_t generate_nr_prach;
/// Frame of last completed synch /// Frame of last completed synch
uint8_t sync_frame; uint8_t sync_frame;
/// Flag to indicate that prach is ready to start: it is enabled with an initial delay after the sync /// Flag to indicate that prach is ready to start: it is enabled with an initial delay after the sync
......
...@@ -2269,9 +2269,6 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue, ...@@ -2269,9 +2269,6 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue,
if ((ue->UE_mode[gNB_id] == PRACH) && (ue->prach_vars[gNB_id]->prach_Config_enabled == 1)) { if ((ue->UE_mode[gNB_id] == PRACH) && (ue->prach_vars[gNB_id]->prach_Config_enabled == 1)) {
nr_ue_prach_procedures(ue, proc, gNB_id, mode); nr_ue_prach_procedures(ue, proc, gNB_id, mode);
} }
else {
ue->prach_resources[gNB_id]->generate_nr_prach = 0;
}
} }
LOG_I(PHY,"****** end TX-Chain for AbsSubframe %d.%d ******\n", frame_tx, slot_tx); LOG_I(PHY,"****** end TX-Chain for AbsSubframe %d.%d ******\n", frame_tx, slot_tx);
...@@ -4497,6 +4494,7 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t ...@@ -4497,6 +4494,7 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t
uint8_t mod_id = ue->Mod_id; uint8_t mod_id = ue->Mod_id;
UE_MODE_t UE_mode = get_nrUE_mode(mod_id, ue->CC_id, gNB_id); UE_MODE_t UE_mode = get_nrUE_mode(mod_id, ue->CC_id, gNB_id);
NR_PRACH_RESOURCES_t * prach_resources = ue->prach_resources[gNB_id]; NR_PRACH_RESOURCES_t * prach_resources = ue->prach_resources[gNB_id];
uint8_t nr_prach;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PRACH, VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PRACH, VCD_FUNCTION_IN);
...@@ -4505,7 +4503,7 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t ...@@ -4505,7 +4503,7 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t
prach_resources->ra_TDD_map_index = 0; prach_resources->ra_TDD_map_index = 0;
prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER = 10; prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER = 10;
prach_resources->ra_RNTI = 0x1234; prach_resources->ra_RNTI = 0x1234;
prach_resources->generate_nr_prach = 1; nr_prach = 1;
} else { } else {
// ask L2 for RACH transport // ask L2 for RACH transport
if ((runmode != rx_calib_ue) && (runmode != rx_calib_ue_med) && (runmode != rx_calib_ue_byp) && (runmode != no_L2_connect) ) { if ((runmode != rx_calib_ue) && (runmode != rx_calib_ue_med) && (runmode != rx_calib_ue_byp) && (runmode != no_L2_connect) ) {
...@@ -4516,16 +4514,17 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t ...@@ -4516,16 +4514,17 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t
ue->ulsch_Msg3_active[i] = 0; ue->ulsch_Msg3_active[i] = 0;
} }
} }
nr_ue_get_rach(ue->prach_resources[gNB_id], mod_id, ue->CC_id, UE_mode, frame_tx, gNB_id, nr_tti_tx); nr_prach = nr_ue_get_rach(ue->prach_resources[gNB_id], mod_id, ue->CC_id, UE_mode, frame_tx, gNB_id, nr_tti_tx);
} }
} }
if (!prach_resources->init_msg1 && (frame_tx > ue->prach_resources[gNB_id]->sync_frame + 150)) if (!prach_resources->init_msg1 && (frame_tx > ue->prach_resources[gNB_id]->sync_frame + 150)){
ue->prach_cnt = 0;
prach_resources->init_msg1 = 1; prach_resources->init_msg1 = 1;
}
if (ue->prach_resources[gNB_id] != NULL && prach_resources->generate_nr_prach == 1 && prach_resources->init_msg1) { if (ue->prach_resources[gNB_id] != NULL && nr_prach == 1 && prach_resources->init_msg1) {
ue->prach_cnt = 0;
pathloss = get_nr_PL(mod_id, ue->CC_id, gNB_id); pathloss = get_nr_PL(mod_id, ue->CC_id, gNB_id);
LOG_D(PHY,"runmode %d\n",runmode); LOG_D(PHY,"runmode %d\n",runmode);
...@@ -4585,18 +4584,18 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t ...@@ -4585,18 +4584,18 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t
prach_resources->ra_PreambleIndex, prach_resources->ra_PreambleIndex,
ue->tx_power_dBm[nr_tti_tx], ue->tx_power_dBm[nr_tti_tx],
pathloss); pathloss);
}
// if we're calibrating the PRACH kill the pointer to its resources so that the RA protocol doesn't continue
if (runmode == calib_prach_tx)
ue->prach_resources[gNB_id] = NULL;
LOG_D(PHY,"[UE %d] frame %d nr_tti_tx %d : generate_nr_prach %d, prach_cnt %d\n", ue->Mod_id, frame_tx, nr_tti_tx, ue->prach_resources[gNB_id]->generate_nr_prach, ue->prach_cnt); LOG_D(PHY,"[UE %d] frame %d nr_tti_tx %d : prach_cnt %d\n", ue->Mod_id, frame_tx, nr_tti_tx, ue->prach_cnt);
ue->prach_cnt++; ue->prach_cnt++;
if (ue->prach_cnt == 3) if (ue->prach_cnt == 3)
prach_resources->generate_nr_prach = 0; ue->prach_cnt = 0;
}
// if we're calibrating the PRACH kill the pointer to its resources so that the RA protocol doesn't continue
if (runmode == calib_prach_tx)
ue->prach_resources[gNB_id] = NULL;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PRACH, VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PRACH, VCD_FUNCTION_OUT);
} }
...@@ -239,6 +239,8 @@ typedef struct { ...@@ -239,6 +239,8 @@ typedef struct {
uint8_t RA_RAPID_found; uint8_t RA_RAPID_found;
/// Flag to monitor if BI was received in RAR /// Flag to monitor if BI was received in RAR
uint8_t RA_BI_found; uint8_t RA_BI_found;
/// Flag for the Msg1 generation: enabled at every occurrence of nr prach slot
uint8_t generate_nr_prach;
//// FAPI-like interface message //// FAPI-like interface message
fapi_nr_tx_request_t tx_request; fapi_nr_tx_request_t tx_request;
......
...@@ -235,8 +235,8 @@ andom-access to transmit a BSR along with the C-RNTI control element (see 5.1.4 ...@@ -235,8 +235,8 @@ andom-access to transmit a BSR along with the C-RNTI control element (see 5.1.4
@param frame @param frame
@param gNB_id gNB index @param gNB_id gNB index
@param nr_tti_tx slot for PRACH transmission @param nr_tti_tx slot for PRACH transmission
@returns void */ @returns indication to generate PRACH to phy */
void nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
module_id_t mod_id, module_id_t mod_id,
int CC_id, int CC_id,
UE_MODE_t UE_mode, UE_MODE_t UE_mode,
......
...@@ -331,7 +331,7 @@ void nr_Msg3_transmitted(module_id_t mod_id, uint8_t CC_id, frame_t frameP, uint ...@@ -331,7 +331,7 @@ void nr_Msg3_transmitted(module_id_t mod_id, uint8_t CC_id, frame_t frameP, uint
// - retrieve TBS // - retrieve TBS
// - add mac_rrc_nr_data_req_ue, etc ... // - add mac_rrc_nr_data_req_ue, etc ...
// - add the backoff condition here if we have it from a previous RA reponse which failed (i.e. backoff indicator) // - add the backoff condition here if we have it from a previous RA reponse which failed (i.e. backoff indicator)
void nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
module_id_t mod_id, module_id_t mod_id,
int CC_id, int CC_id,
UE_MODE_t UE_mode, UE_MODE_t UE_mode,
...@@ -342,8 +342,6 @@ void nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, ...@@ -342,8 +342,6 @@ void nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id); NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id);
uint8_t mac_sdus[MAX_NR_ULSCH_PAYLOAD_BYTES]; uint8_t mac_sdus[MAX_NR_ULSCH_PAYLOAD_BYTES];
uint8_t lcid = UL_SCH_LCID_CCCH_MSG3, *payload, ra_ResponseWindow; uint8_t lcid = UL_SCH_LCID_CCCH_MSG3, *payload, ra_ResponseWindow;
uint8_t config_index, mu;
int is_nr_prach_slot;
uint16_t size_sdu = 0; uint16_t size_sdu = 0;
unsigned short post_padding; unsigned short post_padding;
fapi_nr_config_request_t *cfg = &mac->phy_config.config_req; fapi_nr_config_request_t *cfg = &mac->phy_config.config_req;
...@@ -365,27 +363,6 @@ void nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, ...@@ -365,27 +363,6 @@ void nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
LOG_D(MAC, "nr_ue_get_rach, RA_active value: %d", mac->RA_active); LOG_D(MAC, "nr_ue_get_rach, RA_active value: %d", mac->RA_active);
config_index = rach_ConfigGeneric->prach_ConfigurationIndex;
if (setup->msg1_SubcarrierSpacing)
mu = *setup->msg1_SubcarrierSpacing;
else
mu = frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->subcarrierSpacing;
is_nr_prach_slot = get_nr_prach_info_from_index(config_index,
(int)frame,
(int)nr_tti_tx,
frequencyInfoDL->absoluteFrequencyPointA,
mu,
cfg->cell_config.frame_duplex_type,
NULL,
NULL,
NULL,
NULL);
if (is_nr_prach_slot)
prach_resources->generate_nr_prach = 1;
else
prach_resources->generate_nr_prach = 0;
AssertFatal(setup != NULL, "[UE %d] FATAL nr_rach_ConfigCommon is NULL !!!\n", mod_id); AssertFatal(setup != NULL, "[UE %d] FATAL nr_rach_ConfigCommon is NULL !!!\n", mod_id);
if (mac->RA_active == 0) { if (mac->RA_active == 0) {
...@@ -393,6 +370,7 @@ void nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, ...@@ -393,6 +370,7 @@ void nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
LOG_I(MAC, "RA not active. Starting RA preamble initialization.\n"); LOG_I(MAC, "RA not active. Starting RA preamble initialization.\n");
mac->ra_state = RA_UE_IDLE;
mac->RA_RAPID_found = 0; mac->RA_RAPID_found = 0;
/* Set RA_PREAMBLE_POWER_RAMPING_STEP */ /* Set RA_PREAMBLE_POWER_RAMPING_STEP */
...@@ -446,10 +424,10 @@ void nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, ...@@ -446,10 +424,10 @@ void nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
size_sdu += sdu_lengths[0]; size_sdu += sdu_lengths[0];
} }
mac->RA_tx_frame = frame; //mac->RA_tx_frame = frame;
mac->RA_tx_subframe = nr_tti_tx; //mac->RA_tx_subframe = nr_tti_tx;
mac->RA_backoff_frame = frame; //mac->RA_backoff_frame = frame;
mac->RA_backoff_subframe = nr_tti_tx; //mac->RA_backoff_subframe = nr_tti_tx;
if (size_sdu > 0) { if (size_sdu > 0) {
...@@ -493,7 +471,7 @@ void nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, ...@@ -493,7 +471,7 @@ void nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
} }
// Fill in preamble and PRACH resources // Fill in preamble and PRACH resources
if (is_nr_prach_slot) if (mac->generate_nr_prach)
nr_get_prach_resources(mod_id, CC_id, gNB_id, nr_tti_tx, 1, prach_resources, rach_ConfigDedicated); nr_get_prach_resources(mod_id, CC_id, gNB_id, nr_tti_tx, 1, prach_resources, rach_ConfigDedicated);
offset = nr_generate_ulsch_pdu((uint8_t *) mac_sdus, // sdus buffer offset = nr_generate_ulsch_pdu((uint8_t *) mac_sdus, // sdus buffer
...@@ -528,8 +506,8 @@ void nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, ...@@ -528,8 +506,8 @@ void nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
// - handle backoff and raResponseWindow params // - handle backoff and raResponseWindow params
// - disabled contention resolution as OAI NSA is contention-free based // - disabled contention resolution as OAI NSA is contention-free based
LOG_D(MAC, "[MAC][UE %d][RAPROC] frame %d, subframe %d: RA Active, window cnt %d (RA_tx_frame %d, RA_tx_subframe %d)\n", // LOG_D(MAC, "[MAC][UE %d][RAPROC] frame %d, subframe %d: RA Active, window cnt %d (RA_tx_frame %d, RA_tx_subframe %d)\n",
mod_id, frame, nr_tti_tx, mac->RA_window_cnt, mac->RA_tx_frame, mac->RA_tx_subframe); // mod_id, frame, nr_tti_tx, mac->RA_window_cnt, mac->RA_tx_frame, mac->RA_tx_subframe);
if (mac->RA_BI_found){ if (mac->RA_BI_found){
prach_resources->RA_PREAMBLE_BACKOFF = prach_resources->RA_SCALING_FACTOR_BI * mac->RA_backoff_indicator; prach_resources->RA_PREAMBLE_BACKOFF = prach_resources->RA_SCALING_FACTOR_BI * mac->RA_backoff_indicator;
...@@ -539,7 +517,9 @@ void nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, ...@@ -539,7 +517,9 @@ void nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
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; // 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 { } 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", LOG_I(MAC, "[MAC][UE %d][RAPROC] Frame %d: subframe %d: RAR reception not successful, (RA window count %d) \n",
mod_id, mod_id,
frame, frame,
...@@ -608,11 +588,11 @@ void nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, ...@@ -608,11 +588,11 @@ void nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
// LOG_D(MAC, "[MAC][UE %d][RAPROC] Frame %d, subframe %d: RA Active, adjusted window cnt %d\n", mod_id, frame, nr_tti_tx, mac->RA_window_cnt); // LOG_D(MAC, "[MAC][UE %d][RAPROC] Frame %d, subframe %d: RA Active, adjusted window cnt %d\n", mod_id, frame, nr_tti_tx, mac->RA_window_cnt);
// } // }
mac->RA_tx_frame = frame; // mac->RA_tx_frame = frame;
mac->RA_tx_subframe = nr_tti_tx; // mac->RA_tx_subframe = nr_tti_tx;
// Fill in preamble and PRACH resources // Fill in preamble and PRACH resources
if (is_nr_prach_slot) if (mac->generate_nr_prach)
nr_get_prach_resources(mod_id, CC_id, gNB_id, nr_tti_tx, 0, prach_resources, rach_ConfigDedicated); nr_get_prach_resources(mod_id, CC_id, gNB_id, nr_tti_tx, 0, prach_resources, rach_ConfigDedicated);
} }
...@@ -621,5 +601,5 @@ void nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, ...@@ -621,5 +601,5 @@ void nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources,
LOG_D(MAC, "[UE %d] FATAL: Should not have checked for RACH in PUSCH yet ...", mod_id); LOG_D(MAC, "[UE %d] FATAL: Should not have checked for RACH in PUSCH yet ...", mod_id);
AssertFatal(1 == 0, ""); AssertFatal(1 == 0, "");
} }
return; return mac->generate_nr_prach;
} }
...@@ -813,6 +813,8 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s ...@@ -813,6 +813,8 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s
&N_dur); &N_dur);
if (is_nr_prach_slot) { if (is_nr_prach_slot) {
mac->generate_nr_prach = 1;
fdm = rach_ConfigGeneric->msg1_FDM; fdm = rach_ConfigGeneric->msg1_FDM;
switch (fdm){ switch (fdm){
...@@ -911,6 +913,8 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s ...@@ -911,6 +913,8 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s
} }
} }
} }
} else {
mac->generate_nr_prach = 0;
} }
mac->scheduled_response.ul_config = ul_config; mac->scheduled_response.ul_config = ul_config;
} }
......
...@@ -115,7 +115,7 @@ int nr_ue_ul_indication(nr_uplink_indication_t *ul_info){ ...@@ -115,7 +115,7 @@ int nr_ue_ul_indication(nr_uplink_indication_t *ul_info){
ret = nr_ue_scheduler(NULL, ul_info); ret = nr_ue_scheduler(NULL, ul_info);
if (is_nr_UL_slot(mac->scc, ul_info->slot_tx) && get_softmodem_params()->do_ra) if (is_nr_UL_slot(mac->scc, ul_info->slot_tx) && mac->ra_state <= WAIT_RAR && get_softmodem_params()->do_ra)
nr_ue_prach_scheduler(module_id, ul_info->frame_tx, ul_info->slot_tx); nr_ue_prach_scheduler(module_id, ul_info->frame_tx, ul_info->slot_tx);
switch(ret){ switch(ret){
......
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