Commit a321e160 authored by Louis Adrien Dufrene's avatar Louis Adrien Dufrene

rrc inactivity timer created, S1 ue context release request sent on timeout,...

rrc inactivity timer created, S1 ue context release request sent on timeout, timer set at RRC connection complete reception
parent 2966cdf1
...@@ -279,6 +279,9 @@ mac_rrc_data_ind( ...@@ -279,6 +279,9 @@ mac_rrc_data_ind(
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
/*
* Get RRC status (Connected, Idle...) of UE from RNTI
*/
int int
mac_eNB_get_rrc_status( mac_eNB_get_rrc_status(
const module_id_t Mod_idP, const module_id_t Mod_idP,
...@@ -287,9 +290,7 @@ mac_eNB_get_rrc_status( ...@@ -287,9 +290,7 @@ mac_eNB_get_rrc_status(
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
{ {
struct rrc_eNB_ue_context_s* ue_context_p = NULL; struct rrc_eNB_ue_context_s* ue_context_p = NULL;
ue_context_p = rrc_eNB_get_ue_context( ue_context_p = rrc_eNB_get_ue_context(RC.rrc[Mod_idP], rntiP);
RC.rrc[Mod_idP],
rntiP);
if (ue_context_p != NULL) { if (ue_context_p != NULL) {
return(ue_context_p->ue_context.Status); return(ue_context_p->ue_context.Status);
......
...@@ -552,7 +552,7 @@ typedef struct eNB_RRC_UE_s { ...@@ -552,7 +552,7 @@ typedef struct eNB_RRC_UE_s {
CipheringAlgorithm_r12_t ciphering_algorithm; CipheringAlgorithm_r12_t ciphering_algorithm;
e_SecurityAlgorithmConfig__integrityProtAlgorithm integrity_algorithm; e_SecurityAlgorithmConfig__integrityProtAlgorithm integrity_algorithm;
uint8_t Status; uint8_t Status; // RRC status, type enum UE_STATE_t
rnti_t rnti; rnti_t rnti;
uint64_t random_ue_identity; uint64_t random_ue_identity;
...@@ -599,6 +599,9 @@ typedef struct eNB_RRC_UE_s { ...@@ -599,6 +599,9 @@ typedef struct eNB_RRC_UE_s {
uint32_t ue_release_timer_thres_rrc; uint32_t ue_release_timer_thres_rrc;
uint32_t ue_reestablishment_timer; uint32_t ue_reestablishment_timer;
uint32_t ue_reestablishment_timer_thres; uint32_t ue_reestablishment_timer_thres;
/* RRC inactivity timer: on timeout, should release RRC connection for inactivity on all E-RABs */
uint32_t ue_rrc_inactivity_timer;
uint32_t ue_rrc_inactivity_timer_thres;
uint8_t e_rab_release_command_flag; uint8_t e_rab_release_command_flag;
int8_t reestablishment_xid; int8_t reestablishment_xid;
} eNB_RRC_UE_t; } eNB_RRC_UE_t;
......
...@@ -862,13 +862,13 @@ rrc_eNB_free_UE( ...@@ -862,13 +862,13 @@ rrc_eNB_free_UE(
rnti); rnti);
if (EPC_MODE_ENABLED) { if (EPC_MODE_ENABLED) {
if((ue_context_pP->ue_context.ul_failure_timer >= 20000) && (mac_eNB_get_rrc_status(enb_mod_idP,rnti) >= RRC_CONNECTED)) { if((ue_context_pP->ue_context.ul_failure_timer >= 20000) && (mac_eNB_get_rrc_status(enb_mod_idP, rnti) >= RRC_CONNECTED)) {
LOG_I(RRC, "[eNB %d] S1AP_UE_CONTEXT_RELEASE_REQ sent for RNTI %x\n", LOG_I(RRC, "[eNB %d] S1AP_UE_CONTEXT_RELEASE_REQ sent for RNTI %x, cause 21, radio connection with ue lost\n",
enb_mod_idP, enb_mod_idP,
rnti); rnti);
rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_REQ(enb_mod_idP, ue_context_pP, S1AP_CAUSE_RADIO_NETWORK, 21); rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_REQ(enb_mod_idP, ue_context_pP, S1AP_CAUSE_RADIO_NETWORK, 21);
// send cause 21: connection with ue lost // send cause 21: radio connection with ue lost
/* From 3GPP 36300v10 p129 : 19.2.2.2.2 S1 UE Context Release Request (eNB triggered) /* From 3GPP 36300v10 p129 : 19.2.2.2.2 S1 UE Context Release Request (eNB triggered)
* If the E-UTRAN internal reason is a radio link failure detected in the eNB, the eNB shall wait a sufficient time before * If the E-UTRAN internal reason is a radio link failure detected in the eNB, the eNB shall wait a sufficient time before
* triggering the S1 UE Context Release Request procedure in order to allow the UE to perform the NAS recovery * triggering the S1 UE Context Release Request procedure in order to allow the UE to perform the NAS recovery
...@@ -877,7 +877,18 @@ rrc_eNB_free_UE( ...@@ -877,7 +877,18 @@ rrc_eNB_free_UE(
return; return;
} }
// TODO : add here cause ul inactivity
if((ue_context_pP->ue_context.ue_rrc_inactivity_timer >= ue_context_pP->ue_context.ue_rrc_inactivity_timer_thres) &&
(mac_eNB_get_rrc_status(enb_mod_idP, rnti) >= RRC_CONNECTED)) {
LOG_I(RRC, "[eNB %d] S1AP_UE_CONTEXT_RELEASE_REQ sent for RNTI %x, cause 20, user inactivity\n",
enb_mod_idP,
rnti);
rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_REQ(enb_mod_idP, ue_context_pP, S1AP_CAUSE_RADIO_NETWORK, 20);
// send cause 20: user inactivity
return;
}
} }
// add UE info to freeList // add UE info to freeList
...@@ -1012,11 +1023,14 @@ void release_UE_in_freeList(module_id_t mod_id) ...@@ -1012,11 +1023,14 @@ void release_UE_in_freeList(module_id_t mod_id)
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
/*
* Process the rrc connection setup complete message from UE (SRB1 Active)
*/
void void
rrc_eNB_process_RRCConnectionSetupComplete( rrc_eNB_process_RRCConnectionSetupComplete(
const protocol_ctxt_t* const ctxt_pP, const protocol_ctxt_t *const ctxt_pP,
rrc_eNB_ue_context_t* ue_context_pP, rrc_eNB_ue_context_t *ue_context_pP,
RRCConnectionSetupComplete_r8_IEs_t * rrcConnectionSetupComplete RRCConnectionSetupComplete_r8_IEs_t *rrcConnectionSetupComplete
) )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
{ {
...@@ -1024,22 +1038,19 @@ rrc_eNB_process_RRCConnectionSetupComplete( ...@@ -1024,22 +1038,19 @@ rrc_eNB_process_RRCConnectionSetupComplete(
PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel UL-DCCH, " "processing RRCConnectionSetupComplete from UE (SRB1 Active)\n", PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel UL-DCCH, " "processing RRCConnectionSetupComplete from UE (SRB1 Active)\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
ue_context_pP->ue_context.Srb1.Active=1; ue_context_pP->ue_context.Srb1.Active = 1;
ue_context_pP->ue_context.Status = RRC_CONNECTED;
ue_context_pP->ue_context.ue_rrc_inactivity_timer = 1; // set rrc inactivity when UE goes into RRC_CONNECTED
T(T_ENB_RRC_CONNECTION_SETUP_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T(T_ENB_RRC_CONNECTION_SETUP_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
if (EPC_MODE_ENABLED == 1) { if (EPC_MODE_ENABLED == 1) {
// Forward message to S1AP layer // Forward message to S1AP layer
rrc_eNB_send_S1AP_NAS_FIRST_REQ( rrc_eNB_send_S1AP_NAS_FIRST_REQ(ctxt_pP, ue_context_pP, rrcConnectionSetupComplete);
ctxt_pP,
ue_context_pP,
rrcConnectionSetupComplete);
} else { } else {
// RRC loop back (no S1AP), send SecurityModeCommand to UE // RRC loop back (no S1AP), send SecurityModeCommand to UE
rrc_eNB_generate_SecurityModeCommand( rrc_eNB_generate_SecurityModeCommand(ctxt_pP, ue_context_pP);
ctxt_pP,
ue_context_pP);
// rrc_eNB_generate_UECapabilityEnquiry(enb_mod_idP,frameP,ue_mod_idP);
} }
} }
...@@ -5364,6 +5375,11 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( ...@@ -5364,6 +5375,11 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover(
*/ */
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
/*
* TODO: * add function description
* * add ue_rrc_inactivity_timer set
* * format the function correctly
*/
void void
rrc_eNB_process_RRCConnectionReconfigurationComplete( rrc_eNB_process_RRCConnectionReconfigurationComplete(
const protocol_ctxt_t* const ctxt_pP, const protocol_ctxt_t* const ctxt_pP,
...@@ -6868,7 +6884,6 @@ if (ue_context_p->ue_context.nb_of_modify_e_rabs > 0) { ...@@ -6868,7 +6884,6 @@ if (ue_context_p->ue_context.nb_of_modify_e_rabs > 0) {
ctxt_pP, ctxt_pP,
ue_context_p, ue_context_p,
&ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8); &ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8);
ue_context_p->ue_context.Status = RRC_CONNECTED;
LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_CONNECTED \n", LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_CONNECTED \n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
...@@ -7901,6 +7916,18 @@ rrc_rx_tx( ...@@ -7901,6 +7916,18 @@ rrc_rx_tx(
} // end if (rrc_release_info.num_UEs > 0) } // end if (rrc_release_info.num_UEs > 0)
pthread_mutex_unlock(&rrc_release_freelist); pthread_mutex_unlock(&rrc_release_freelist);
if (ue_context_p->ue_context.ue_rrc_inactivity_timer > 0) {
ue_context_p->ue_context.ue_rrc_inactivity_timer++;
if (ue_context_p->ue_context.ue_rrc_inactivity_timer >= ue_context_p->ue_context.ue_rrc_inactivity_timer_thres) {
LOG_I(RRC, "Removing UE %x instance because of rrc_inactivity_timer timeout\n",
ue_context_p->ue_context.rnti);
ue_to_be_removed = ue_context_p;
break; // break RB_FOREACH
}
}
if (ue_context_p->ue_context.ue_reestablishment_timer > 0) { if (ue_context_p->ue_context.ue_reestablishment_timer > 0) {
ue_context_p->ue_context.ue_reestablishment_timer++; ue_context_p->ue_context.ue_reestablishment_timer++;
...@@ -7935,7 +7962,8 @@ rrc_rx_tx( ...@@ -7935,7 +7962,8 @@ rrc_rx_tx(
} // end RB_FOREACH } // end RB_FOREACH
if (ue_to_be_removed) { if (ue_to_be_removed) {
if (ue_to_be_removed->ue_context.ul_failure_timer >= 20000) { if ((ue_to_be_removed->ue_context.ul_failure_timer >= 20000) ||
(ue_to_be_removed->ue_context.ue_rrc_inactivity_timer >= ue_to_be_removed->ue_context.ue_rrc_inactivity_timer_thres)) {
ue_to_be_removed->ue_context.ue_release_timer_s1 = 1; ue_to_be_removed->ue_context.ue_release_timer_s1 = 1;
ue_to_be_removed->ue_context.ue_release_timer_thres_s1 = 100; ue_to_be_removed->ue_context.ue_release_timer_thres_s1 = 100;
ue_to_be_removed->ue_context.ue_release_timer = 0; ue_to_be_removed->ue_context.ue_release_timer = 0;
...@@ -7947,6 +7975,10 @@ rrc_rx_tx( ...@@ -7947,6 +7975,10 @@ rrc_rx_tx(
if (ue_to_be_removed->ue_context.ul_failure_timer >= 20000) { if (ue_to_be_removed->ue_context.ul_failure_timer >= 20000) {
ue_to_be_removed->ue_context.ul_failure_timer = 0; ue_to_be_removed->ue_context.ul_failure_timer = 0;
} }
if (ue_to_be_removed->ue_context.ue_rrc_inactivity_timer >= ue_to_be_removed->ue_context.ue_rrc_inactivity_timer_thres) {
ue_to_be_removed->ue_context.ue_rrc_inactivity_timer = 0; //reset timer after S1 command UE context release request is sent
}
} }
#ifdef RRC_LOCALIZATION #ifdef RRC_LOCALIZATION
......
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