Commit 12866c07 authored by Robert Schmidt's avatar Robert Schmidt

Remove all timers from RRC

There are a number of timers in RRC. Those are not or only partially
implemented, and certainly don't work in F1. Hence, remove them to
replace with a better implementation later.
parent d6fb5c2e
......@@ -313,17 +313,6 @@ typedef struct gNB_RRC_UE_s {
int nb_of_pdusessions;
rrc_pdu_session_param_t pduSession[NGAP_MAX_PDU_SESSION];
rrc_action_t xids[NR_RRC_TRANSACTION_IDENTIFIER_NUMBER];
uint32_t ul_failure_timer;
uint32_t ue_release_timer;
uint32_t ue_release_timer_thres;
uint32_t ue_release_timer_s1;
uint32_t ue_release_timer_thres_s1;
uint32_t ue_release_timer_ng;
uint32_t ue_release_timer_thres_ng;
uint32_t ue_release_timer_rrc;
uint32_t ue_release_timer_thres_rrc;
uint32_t ue_reestablishment_timer;
uint32_t ue_reestablishment_timer_thres;
uint8_t e_rab_release_command_flag;
uint32_t ue_rrc_inactivity_timer;
uint32_t ue_reestablishment_counter;
......
......@@ -359,11 +359,6 @@ static void rrc_gNB_generate_RRCSetup(instance_t instance,
size,
"[MSG] RRC Setup\n");
// activate release timer, if RRCSetupComplete not received after 100 frames, remove UE
ue_context_pP->ue_context.ue_release_timer = 1;
// remove UE after 10 frames after RRCConnectionRelease is triggered
ue_context_pP->ue_context.ue_release_timer_thres = 1000;
nr_pdcp_add_srbs(true, rnti, ue_context_pP->ue_context.SRB_configList, 0, NULL, NULL);
f1ap_dl_rrc_message_t dl_rrc = {
......@@ -414,20 +409,11 @@ static int rrc_gNB_generate_RRCSetup_for_RRCReestablishmentRequest(module_id_t m
nr_mac_config_sib1(RC.nrmac[rrc_instance_p->module_id], rrc_instance_p->carrier.siblock1);
LOG_I(NR_RRC, " [RAPROC] rnti: %04x Logical Channel DL-CCCH, Generating RRCSetup (bytes %d)\n", rnti, size);
// activate release timer, if RRCSetupComplete not received after 100 frames, remove UE
ue_context_pP->ue_context.ue_release_timer = 1;
// remove UE after 10 frames after RRCConnectionRelease is triggered
ue_context_pP->ue_context.ue_release_timer_thres = 1000;
// configure MAC
protocol_ctxt_t ctxt = {0};
PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, 0, GNB_FLAG_YES, rnti, 0, 0);
apply_macrlc_config(rrc_instance_p, ue_context_pP, &ctxt);
//nr_pdcp_add_srbs(ctxt_pP->enb_flag, ctxt_pP->rntiMaybeUEid, ue_context_pP->ue_context.SRB_configList, 0, NULL, NULL);
//apply_pdcp_config(ue_context_pP,ctxt_pP);
/* init timers */
// ue_context_pP->ue_context.ue_rrc_inactivity_timer = 0;
f1ap_dl_rrc_message_t dl_rrc = {
.old_gNB_DU_ue_id = 0xFFFFFF,
.rrc_container = buf,
......@@ -1046,8 +1032,6 @@ static void rrc_gNB_process_RRCReconfigurationComplete(const protocol_ctxt_t *co
NR_DRB_Identity_t *drb_id_p = NULL;
// uint8_t nr_DRB2LCHAN[8];
ue_p->ue_reestablishment_timer = 0;
/* Derive the keys from kgnb */
if (DRB_configList != NULL) {
nr_derive_key_up_enc(ue_p->ciphering_algorithm, ue_p->kgnb, &kUPenc);
......@@ -1406,12 +1390,7 @@ void RRCReestablishmentComplete_update_ngu_tunnel(const protocol_ctxt_t *const c
if (ret != 0) {
LOG_E(NR_RRC, "RRC Reestablishment - gtpv1u_update_ngu_tunnel failed,start to release UE %x\n", reestablish_rnti);
ue_p->ue_release_timer_s1 = 1;
ue_p->ue_release_timer_thres_s1 = 100;
ue_p->ue_release_timer = 0;
ue_p->ue_reestablishment_timer = 0;
ue_p->ul_failure_timer = 20000; // set ul_failure to 20000 for triggering rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_REQ
ue_p->ul_failure_timer = 0;
AssertFatal(false, "not implemented\n");
return;
}
}
......@@ -1470,7 +1449,6 @@ void rrc_gNB_process_RRCReestablishmentComplete(const protocol_ctxt_t *const ctx
uint8_t new_xid = rrc_gNB_get_next_transaction_identifier(ctxt_pP->module_id);
ue_p->xids[new_xid] = RRC_REESTABLISH_COMPLETE;
ue_p->StatusRrc = NR_RRC_CONNECTED;
ue_p->ue_rrc_inactivity_timer = 1; // set rrc inactivity when UE goes into RRC_CONNECTED
RRCReestablishmentComplete_fill_SRB2_configList(ctxt_pP, ue_context_pP, xid, new_xid);
RRCReestablishmentComplete_fill_DRB_configList(ctxt_pP, ue_context_pP, new_xid);
RRCReestablishmentComplete_update_ngu_tunnel(ctxt_pP, ue_context_pP, reestablish_rnti);
......@@ -1665,9 +1643,8 @@ static int nr_rrc_gNB_decode_ccch(module_id_t module_id, rnti_t rnti, const uint
* the current one must be removed from MAC/PHY (zombie UE)
*/
if ((ue_context_p = rrc_gNB_ue_context_random_exist(gnb_rrc_inst, random_value))) {
gNB_RRC_UE_t *UE = &ue_context_p->ue_context;
LOG_W(NR_RRC, "new UE rnti (coming with random value) is already there, removing UE %x from MAC/PHY\n", rnti);
UE->ul_failure_timer = 20000;
AssertFatal(false, "not implemented\n");
}
ue_context_p = rrc_gNB_create_ue_context(rnti, gnb_rrc_inst, random_value);
......@@ -1699,12 +1676,6 @@ static int nr_rrc_gNB_decode_ccch(module_id_t module_id, rnti_t rnti, const uint
/* replace rnti in the context */
UE->rnti = rnti;
/* reset timers */
UE->ul_failure_timer = 0;
UE->ue_release_timer = 0;
UE->ue_reestablishment_timer = 0;
UE->ue_release_timer_s1 = 0;
UE->ue_release_timer_rrc = 0;
} else {
LOG_I(NR_RRC, "UE %04x 5G-S-TMSI-Part1 doesn't exist, setting ng_5G_S_TMSI_Part1 => %ld\n", rnti, s_tmsi_part1);
......@@ -1795,28 +1766,9 @@ static int nr_rrc_gNB_decode_ccch(module_id_t module_id, rnti_t rnti, const uint
break;
}
if (UE->ue_reestablishment_timer > 0) {
LOG_E(NR_RRC, "RRRCReconfigurationComplete(Previous) don't receive, delete the Previous UE,\nprevious Status %d, new Status NR_RRC_RECONFIGURED\n", UE->StatusRrc);
UE->StatusRrc = NR_RRC_RECONFIGURED;
protocol_ctxt_t ctxt_old_p;
PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt_old_p, module_id, GNB_FLAG_YES, c_rnti, 0, 0);
rrc_gNB_process_RRCReconfigurationComplete(&ctxt_old_p, ue_context_p, xid);
for (uint8_t pdusessionid = 0; pdusessionid < UE->nb_of_pdusessions; pdusessionid++) {
if (UE->pduSession[pdusessionid].status == PDU_SESSION_STATUS_DONE) {
UE->pduSession[pdusessionid].status = PDU_SESSION_STATUS_ESTABLISHED;
} else {
UE->pduSession[pdusessionid].status = PDU_SESSION_STATUS_FAILED;
}
}
}
/* TODO: start timer in ITTI and drop UE if it does not come back */
(void) xid; /* xid currently not used */
/* reset timers */
UE->ul_failure_timer = 0;
UE->ue_release_timer = 0;
UE->ue_reestablishment_timer = 0;
// UE->ue_release_timer_s1 = 0;
UE->ue_release_timer_rrc = 0;
// Insert C-RNTI to map
for (int i = 0; i < MAX_MOBILES_PER_GNB; i++) {
nr_reestablish_rnti_map_t *nr_reestablish_rnti_map = &gnb_rrc_inst->nr_reestablish_rnti_map[i];
......@@ -1944,11 +1896,6 @@ static int handle_rrcReestablishmentComplete(const protocol_ctxt_t *const ctxt_p
nr_rrc_mac_remove_ue(reestablish_rnti);
UE->ue_reestablishment_counter++;
// UE->ue_release_timer = 0;
UE->ue_reestablishment_timer = 1;
// remove UE after 100 frames after NR_RRCReestablishmentRelease is triggered
UE->ue_reestablishment_timer_thres = 1000;
return 0;
}
......@@ -2106,8 +2053,6 @@ static int handle_rrcSetupComplete(const protocol_ctxt_t *const ctxt_pP,
rrc_gNB_process_RRCSetupComplete(ctxt_pP, ue_context_p, setup_complete->criticalExtensions.choice.rrcSetupComplete);
LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_UE_FMT " UE State = NR_RRC_CONNECTED \n", PROTOCOL_NR_RRC_CTXT_UE_ARGS(ctxt_pP));
UE->ue_release_timer = 0;
return 0;
}
......@@ -2852,79 +2797,6 @@ static int get_dl_mimo_layers(const gNB_RRC_INST *rrc, const NR_UE_NR_Capability
void nr_rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id) {
MessageDef *msg;
gNB_RRC_INST *rrc = RC.nrrrc[ctxt_pP->module_id];
rrc_gNB_ue_context_t *ue_context_p = NULL;
RB_FOREACH(ue_context_p, rrc_nr_ue_tree_s, &rrc->rrc_ue_head)
{
gNB_RRC_UE_t *UE = &ue_context_p->ue_context;
ctxt_pP->rntiMaybeUEid = UE->rnti;
if (UE->ul_failure_timer > 0) {
UE->ul_failure_timer++;
if (UE->ul_failure_timer >= 20000) {
// remove UE after 20 seconds after MAC (or else) has indicated UL failure
LOG_I(RRC, "Removing UE %x instance, because of uplink failure timer timeout\n", UE->rnti);
if (UE->StatusRrc >= NR_RRC_CONNECTED) {
rrc_gNB_send_NGAP_UE_CONTEXT_RELEASE_REQ(
ctxt_pP->module_id,
ue_context_p,
NGAP_CAUSE_RADIO_NETWORK,
NGAP_CAUSE_RADIO_NETWORK_RADIO_CONNECTION_WITH_UE_LOST);
}
// Remove here the MAC and RRC context when RRC is not connected
if (UE->StatusRrc < NR_RRC_CONNECTED) {
if (!NODE_IS_CU(rrc->node_type)) {
nr_rrc_mac_remove_ue(ctxt_pP->rntiMaybeUEid);
rrc_rlc_remove_ue(ctxt_pP);
nr_pdcp_remove_UE(ctxt_pP->rntiMaybeUEid);
/* remove RRC UE Context */
ue_context_p = rrc_gNB_get_ue_context_by_rnti(rrc, UE->rnti);
if (ue_context_p) {
LOG_I(NR_RRC, "remove UE %04x \n", UE->rnti);
rrc_gNB_remove_ue_context(rrc, ue_context_p);
break; // We must not access this UE context
}
}
// In case of CU trigger UE context release command towards the DU
else {
MessageDef *message_p;
message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_UE_CONTEXT_RELEASE_CMD);
f1ap_ue_context_release_cmd_t *rel_cmd=&F1AP_UE_CONTEXT_RELEASE_CMD (message_p);
rel_cmd->rnti = UE->rnti;
rel_cmd->cause = F1AP_CAUSE_RADIO_NETWORK;
rel_cmd->cause_value = 10; // 10 = F1AP_CauseRadioNetwork_normal_release
itti_send_msg_to_task(TASK_CU_F1, ctxt_pP->module_id, message_p);
}
}
break; // break RB_FOREACH
}
}
if (UE->ue_release_timer_rrc > 0) {
UE->ue_release_timer_rrc++;
if (UE->ue_release_timer_rrc >= UE->ue_release_timer_thres_rrc) {
LOG_I(NR_RRC, "Removing UE %x instance after UE_CONTEXT_RELEASE_Complete (ue_release_timer_rrc timeout)\n", UE->rnti);
UE->ue_release_timer_rrc = 0;
if (!NODE_IS_CU(RC.nrrrc[0]->node_type)) {
nr_rrc_mac_remove_ue(ctxt_pP->rntiMaybeUEid);
}
rrc_rlc_remove_ue(ctxt_pP);
nr_pdcp_remove_UE(ctxt_pP->rntiMaybeUEid);
newGtpuDeleteAllTunnels(ctxt_pP->instance, UE->rnti);
/* remove RRC UE Context */
LOG_I(NR_RRC, "remove UE %04x \n", UE->rnti);
rrc_gNB_remove_ue_context(rrc, ue_context_p);
break; // break RB_FOREACH
}
}
}
/* send a tick to x2ap */
if (is_x2ap_enabled()){
......@@ -3063,9 +2935,9 @@ static void write_rrc_stats(const gNB_RRC_INST *rrc)
fprintf(f, "NR RRC UE rnti %04x:", rnti);
if (ue_ctxt->Initialue_identity_5g_s_TMSI.presence)
fprintf(f, " S-TMSI %x\n", ue_ctxt->Initialue_identity_5g_s_TMSI.fiveg_tmsi);
fprintf(f, " S-TMSI %x", ue_ctxt->Initialue_identity_5g_s_TMSI.fiveg_tmsi);
fprintf(f, " failure timer %d/8\n", ue_ctxt->ul_failure_timer);
fprintf(f, "\n");
if (ue_ctxt->UE_Capability_nr) {
fprintf(f,
......
......@@ -396,12 +396,7 @@ int rrc_gNB_process_NGAP_INITIAL_CONTEXT_SETUP_REQ(MessageDef *msg_p, instance_t
int ret = gtpv1u_create_ngu_tunnel(instance, &create_tunnel_req, &create_tunnel_resp, nr_pdcp_data_req_drb, sdap_data_req);
if (ret != 0) {
LOG_E(NR_RRC, "rrc_gNB_process_NGAP_INITIAL_CONTEXT_SETUP_REQ : gtpv1u_create_ngu_tunnel failed,start to release UE %x\n", UE->rnti);
UE->ue_release_timer_ng = 1;
UE->ue_release_timer_thres_ng = 100;
UE->ue_release_timer = 0;
UE->ue_reestablishment_timer = 0;
UE->ul_failure_timer = 20000;
UE->ul_failure_timer = 0;
AssertFatal(false, "release timer not implemented\n");
return (0);
}
......@@ -1157,8 +1152,6 @@ int rrc_gNB_process_NGAP_UE_CONTEXT_RELEASE_COMMAND(MessageDef *msg_p, instance_
}
gNB_RRC_UE_t *UE = &ue_context_p->ue_context;
UE->ue_release_timer_ng = 0;
UE->ue_release_timer_thres_rrc = 1000;
PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, GNB_FLAG_YES, UE->rnti, 0, 0);
ctxt.eNB_index = 0;
rrc_gNB_generate_RRCRelease(&ctxt, ue_context_p);
......
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