Commit dcc17a9d authored by francescomani's avatar francescomani

signaling RRC RA problems (leading to possible radio link failure)

parent e958822a
......@@ -36,7 +36,7 @@ void nr_mac_rrc_sync_ind(const module_id_t module_id,
void nr_mac_rrc_msg3_ind(const module_id_t mod_id, int rnti, int gnb_id) {}
void nr_mac_rrc_ra_ind(const module_id_t mod_id, int frame, bool success) {}
void nr_mac_rrc_ra_ind(const module_id_t mod_id, bool success) {}
void nr_mac_rrc_inactivity_timer_ind(const module_id_t mod_id) {}
......
......@@ -72,7 +72,6 @@
// Messages between RRC and MAC layers
typedef struct NRRrcMacRaInd_s {
uint32_t frame;
bool RA_succeeded;
} NRRrcMacRaInd;
......
......@@ -292,15 +292,8 @@ void configure_csi_resource_mapping(fapi_nr_dl_config_csirs_pdu_rel15_t *csirs_c
uint32_t bwp_size,
uint32_t bwp_start);
/* \brief This function schedules the Msg3 transmission
@param
@param
@param
@returns void
*/
void nr_ue_msg3_scheduler(NR_UE_MAC_INST_t *mac, frame_t current_frame, slot_t current_slot, uint8_t Msg3_tda_id);
void nr_ra_contention_resolution_failed(RA_config_t *ra);
void nr_ra_contention_resolution_failed(NR_UE_MAC_INST_t *mac);
void nr_ra_succeeded(NR_UE_MAC_INST_t *mac, const uint8_t gNB_index, const frame_t frame, const int slot);
void nr_ra_backoff_setting(RA_config_t *ra);
void nr_get_RA_window(NR_UE_MAC_INST_t *mac);
......
......@@ -180,9 +180,11 @@ void reset_mac_inst(NR_UE_MAC_INST_t *nr_mac)
if (nr_mac->data_inactivity_timer)
nr_timer_stop(nr_mac->data_inactivity_timer);
nr_timer_stop(&nr_mac->time_alignment_timer);
nr_timer_stop(&nr_mac->ra.contention_resolution_timer);
nr_timer_stop(&nr_mac->scheduling_info.sr_DelayTimer);
nr_timer_stop(&nr_mac->scheduling_info.retxBSR_Timer);
nr_timer_stop(&nr_mac->ra.response_window_timer);
nr_timer_stop(&nr_mac->ra.RA_backoff_timer);
nr_timer_stop(&nr_mac->ra.contention_resolution_timer);
for (int i = 0; i < NR_MAX_SR_ID; i++)
nr_timer_stop(&nr_mac->scheduling_info.sr_info[i].prohibitTimer);
......@@ -194,8 +196,10 @@ void reset_mac_inst(NR_UE_MAC_INST_t *nr_mac)
nr_mac->ul_harq_info[k].last_ndi = -1; // initialize to invalid value
// stop any ongoing RACH procedure
if (nr_mac->ra.ra_state < nrRA_SUCCEEDED)
if (nr_mac->ra.RA_active) {
nr_mac->ra.ra_state = nrRA_UE_IDLE;
nr_mac->ra.RA_active = false;
}
// discard explicitly signalled contention-free Random Access Resources
// TODO not sure what needs to be done here
......
......@@ -879,6 +879,7 @@ bool init_RA(NR_UE_MAC_INST_t *mac, int frame)
// Random acces procedure initialization
mac->state = UE_PERFORMING_RA;
ra->RA_active = true;
ra->msg3_C_RNTI = false;
NR_PRACH_RESOURCES_t *prach_resources = &ra->prach_resources;
fapi_nr_config_request_t *cfg = &mac->phy_config.config_req;
// flush MSG3 buffer
......@@ -1234,7 +1235,7 @@ void nr_ra_succeeded(NR_UE_MAC_INST_t *mac, const uint8_t gNB_index, const frame
ra->ra_state = nrRA_SUCCEEDED;
mac->state = UE_CONNECTED;
free_and_zero(ra->Msg3_buffer);
nr_mac_rrc_ra_ind(mac->ue_id, frame, true);
nr_mac_rrc_ra_ind(mac->ue_id, true);
}
void nr_ra_backoff_setting(RA_config_t *ra)
......@@ -1247,8 +1248,10 @@ void nr_ra_backoff_setting(RA_config_t *ra)
nr_timer_start(&ra->RA_backoff_timer);
}
void nr_ra_contention_resolution_failed(RA_config_t *ra)
void nr_ra_contention_resolution_failed(NR_UE_MAC_INST_t *mac)
{
LOG_W(MAC, "[UE %d] Contention resolution failed\n", mac->ue_id);
RA_config_t *ra = &mac->ra;
// discard the TEMPORARY_C-RNTI
ra->t_crnti = 0;
// flush MSG3 buffer
......@@ -1256,7 +1259,8 @@ void nr_ra_contention_resolution_failed(RA_config_t *ra)
NR_PRACH_RESOURCES_t *prach_resources = &ra->prach_resources;
prach_resources->preamble_tx_counter++;
if (prach_resources->preamble_tx_counter == ra->preambleTransMax + 1) {
// TODO indicate a Random Access problem to upper layers
// indicate a Random Access problem to upper layers
nr_mac_rrc_ra_ind(mac->ue_id, false);
} else {
// TODO handle msgA-TransMax (go back to 4-step if the threshold is reached)
// starting backoff time
......@@ -1275,7 +1279,8 @@ void nr_rar_not_successful(NR_UE_MAC_INST_t *mac)
// if the Random Access Preamble is transmitted on the SpCell
// TODO to be verified, this means SA if I'm not mistaken
if (IS_SA_MODE(get_softmodem_params())) {
// TODO indicate a Random Access problem to upper layers
// indicate a Random Access problem to upper layers
nr_mac_rrc_ra_ind(mac->ue_id, false);
} else {
// if the Random Access Preamble is transmitted on an SCell:
// consider the Random Access procedure unsuccessfully completed.
......
......@@ -3722,7 +3722,7 @@ void nr_ue_process_mac_pdu(NR_UE_MAC_INST_t *mac, nr_downlink_indication_t *dl_i
nr_ra_succeeded(mac, gNB_index, frameP, slot);
} else if (!ra_success) {
// consider this Contention Resolution not successful and discard the successfully decoded MAC PDU
nr_ra_contention_resolution_failed(ra);
nr_ra_contention_resolution_failed(mac);
return;
}
}
......
......@@ -194,7 +194,7 @@ void update_mac_timers(NR_UE_MAC_INST_t *mac)
handle_time_alignment_timer_expired(mac);
bool contention_resolution_expired = nr_timer_tick(&mac->ra.contention_resolution_timer);
if (contention_resolution_expired)
nr_ra_contention_resolution_failed(&mac->ra);
nr_ra_contention_resolution_failed(mac);
for (int j = 0; j < NR_MAX_SR_ID; j++)
nr_timer_tick(&mac->scheduling_info.sr_info[j].prohibitTimer);
nr_timer_tick(&mac->scheduling_info.sr_DelayTimer);
......
......@@ -29,7 +29,7 @@ softmodem_params_t *get_softmodem_params(void)
{
return &softmodem_params;
}
void nr_mac_rrc_ra_ind(const module_id_t mod_id, int frame, bool success)
void nr_mac_rrc_ra_ind(const module_id_t mod_id, bool success)
{
}
tbs_size_t mac_rlc_data_req(const module_id_t module_idP,
......
......@@ -177,10 +177,9 @@ void nr_ue_rrc_timer_trigger(int instance, int frame, int gnb_id)
itti_send_msg_to_task(TASK_RRC_NRUE, instance, message_p);
}
void nr_mac_rrc_ra_ind(const module_id_t mod_id, int frame, bool success)
void nr_mac_rrc_ra_ind(const module_id_t mod_id, bool success)
{
MessageDef *message_p = itti_alloc_new_message(TASK_MAC_UE, 0, NR_RRC_MAC_RA_IND);
NR_RRC_MAC_RA_IND (message_p).frame = frame;
NR_RRC_MAC_RA_IND (message_p).RA_succeeded = success;
itti_send_msg_to_task(TASK_RRC_NRUE, GNB_MODULE_ID_TO_INSTANCE(mod_id), message_p);
}
......@@ -39,7 +39,7 @@ void nr_mac_rrc_data_ind_ue(const module_id_t module_id,
void nr_mac_rrc_inactivity_timer_ind(const module_id_t mod_id);
void nr_mac_rrc_msg3_ind(const module_id_t mod_id, const int rnti, int gnb_id);
void nr_ue_rrc_timer_trigger(int instance, int frame, int gnb_id);
void nr_mac_rrc_ra_ind(const module_id_t mod_id, int frame, bool success);
void nr_mac_rrc_ra_ind(const module_id_t mod_id, bool success);
void nsa_sendmsg_to_lte_ue(const void *message, size_t msg_len, Rrc_Msg_Type_t msg_type);
void process_msg_rcc_to_mac(MessageDef *msg);
#endif
......
......@@ -1975,6 +1975,16 @@ void nr_rrc_handle_ra_indication(NR_UE_RRC_INST_t *rrc, bool ra_succeeded)
nr_timer_stop(&timers->T304);
// TODO handle the rest of procedures as described in 5.3.5.3 for when
// reconfigurationWithSync is included in spCellConfig
} else if (!ra_succeeded) {
// upon random access problem indication from MCG MAC
// while neither T300, T301, T304, T311 nor T319 are running
// consider radio link failure to be detected
if (!nr_timer_is_active(&timers->T300)
&& !nr_timer_is_active(&timers->T301)
&& !nr_timer_is_active(&timers->T304)
&& !nr_timer_is_active(&timers->T311)
&& !nr_timer_is_active(&timers->T319))
handle_rlf_detection(rrc);
}
}
......@@ -2040,11 +2050,10 @@ void *rrc_nrue(void *notUsed)
case NR_RRC_MAC_RA_IND:
LOG_D(NR_RRC,
"[UE %ld] Received %s: frame %d RA %s\n",
rrc->ue_id,
ITTI_MSG_NAME(msg_p),
NR_RRC_MAC_RA_IND(msg_p).frame,
NR_RRC_MAC_RA_IND(msg_p).RA_succeeded ? "successful" : "failed");
"[UE %ld] Received %s: RA %s\n",
rrc->ue_id,
ITTI_MSG_NAME(msg_p),
NR_RRC_MAC_RA_IND(msg_p).RA_succeeded ? "successful" : "failed");
nr_rrc_handle_ra_indication(rrc, NR_RRC_MAC_RA_IND(msg_p).RA_succeeded);
break;
......
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