diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 53364b0768..5a65dcd71d 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -2285,6 +2285,26 @@ void handle_RRCRelease(NR_UE_RRC_INST_t *rrc) asn1cFreeStruc(asn_DEF_NR_RRCRelease, rrc->RRCRelease); } +void handle_rlf_detection(NR_UE_RRC_INST_t *rrc) +{ + // 5.3.10.3 in 38.331 + bool srb2 = rrc->Srb[2] != RB_NOT_PRESENT; + bool any_drb = false; + for (int i = 0; i < MAX_DRBS_PER_UE; i++) { + if (rrc->status_DRBs[i] != RB_NOT_PRESENT) { + any_drb = true; + break; + } + } + + if (rrc->as_security_activated && srb2 && any_drb) // initiate the connection re-establishment procedure + nr_rrc_initiate_rrcReestablishment(rrc, NR_ReestablishmentCause_otherFailure, 0); + else { + NR_Release_Cause_t cause = rrc->as_security_activated ? RRC_CONNECTION_FAILURE : OTHER; + nr_rrc_going_to_IDLE(rrc, cause, NULL); + } +} + void nr_rrc_going_to_IDLE(NR_UE_RRC_INST_t *rrc, NR_Release_Cause_t release_cause, NR_RRCRelease_t *RRCRelease) diff --git a/openair2/RRC/NR_UE/rrc_proto.h b/openair2/RRC/NR_UE/rrc_proto.h index 95685c8e2f..28b51d5320 100644 --- a/openair2/RRC/NR_UE/rrc_proto.h +++ b/openair2/RRC/NR_UE/rrc_proto.h @@ -63,6 +63,7 @@ void *rrc_nrue_task(void *args_p); void *rrc_nrue(void *args_p); void nr_rrc_handle_timers(NR_UE_RRC_INST_t *rrc); +void handle_rlf_detection(NR_UE_RRC_INST_t *rrc); /**\brief RRC NSA UE task. \param void *args_p Pointer on arguments to start the task. */ diff --git a/openair2/RRC/NR_UE/rrc_timers_and_constants.c b/openair2/RRC/NR_UE/rrc_timers_and_constants.c index f0635b16b2..7e0c040731 100644 --- a/openair2/RRC/NR_UE/rrc_timers_and_constants.c +++ b/openair2/RRC/NR_UE/rrc_timers_and_constants.c @@ -157,10 +157,9 @@ void nr_rrc_handle_timers(NR_UE_RRC_INST_t *rrc) bool t310_expired = nr_timer_tick(&timers->T310); if(t310_expired) { LOG_W(NR_RRC, "Timer T310 expired\n"); - // TODO // handle detection of radio link failure // as described in 5.3.10.3 of 38.331 - AssertFatal(false, "Radio link failure! Not handled yet!\n"); + handle_rlf_detection(rrc); } bool t311_expired = nr_timer_tick(&timers->T311);