From ed61d774f631357327c049d3a7b99fb1c5f5e469 Mon Sep 17 00:00:00 2001 From: Louis Adrien Dufrene Date: Wed, 21 Nov 2018 17:03:52 +0100 Subject: [PATCH] add test on ue_context --- openair2/ENB_APP/enb_config.c | 4 +-- openair2/LAYER2/MAC/eNB_scheduler_dlsch.c | 9 +++++- openair2/LAYER2/MAC/eNB_scheduler_ulsch.c | 11 +++++-- openair2/RRC/LTE/rrc_eNB_S1AP.c | 37 +++++++++++++++++------ 4 files changed, 46 insertions(+), 15 deletions(-) diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index c0bbf42808..8ad536c5f9 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -60,7 +60,7 @@ #include "RRC_config_tools.h" #include "enb_paramdef.h" -// #define RRC_INACTIVITY_THRESH 0 +#define RRC_INACTIVITY_THRESH 0 extern uint16_t sf_ahead; extern void set_parallel_conf(char *parallel_conf); @@ -581,7 +581,7 @@ int RCconfig_RRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc) { for (int I = 0; I < sizeof(PLMNParams) / sizeof(paramdef_t); ++I) PLMNParams[I].chkPptr = &(config_check_PLMNParams[I]); - RRC_CONFIGURATION_REQ (msg_p).rrc_inactivity_timer_thres = 0; //RRC_INACTIVITY_THRESH; // set to 0 to deactivate + RRC_CONFIGURATION_REQ (msg_p).rrc_inactivity_timer_thres = RRC_INACTIVITY_THRESH; // set to 0 to deactivate RRC_CONFIGURATION_REQ (msg_p).cell_identity = enb_id; RRC_CONFIGURATION_REQ (msg_p).tac = *ENBParamList.paramarray[i][ENB_TRACKING_AREA_CODE_IDX].uptr; AssertFatal(!ENBParamList.paramarray[i][ENB_MOBILE_COUNTRY_CODE_IDX_OLD].strptr diff --git a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c index 4073c54846..9a26460fa3 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_dlsch.c @@ -1084,7 +1084,14 @@ schedule_ue_spec(module_id_t module_idP, int slice_idxP, UE_list->UE_sched_ctrl[UE_id].uplane_inactivity_timer = 0; // reset RRC inactivity timer after uplane activity ue_contextP = rrc_eNB_get_ue_context(RC.rrc[module_idP], rnti); - ue_contextP->ue_context.ue_rrc_inactivity_timer = 1; + if (ue_contextP != NULL) { + ue_contextP->ue_context.ue_rrc_inactivity_timer = 1; + } else { + LOG_E(MAC, "[eNB %d] CC_id %d Couldn't find the context associated to UE (RNTI %d) and reset RRC inactivity timer\n", + module_idP, + CC_id, + rnti); + } } // end if (rlc_status.bytes_in_buffer > 0) } else { // no TBS left break; // break for (lcid = NB_RB_MAX - 1; lcid >= DTCH; lcid--) diff --git a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c index e67ddb6aae..9a6340a72b 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_ulsch.c @@ -716,8 +716,15 @@ rx_sdu(const module_id_t enb_mod_idP, //clear uplane_inactivity_timer UE_list->UE_sched_ctrl[UE_id].uplane_inactivity_timer = 0; // reset RRC inactivity timer after uplane activity - ue_contextP = rrc_eNB_get_ue_context(RC.rrc[enb_mod_idP], rntiP); - ue_contextP->ue_context.ue_rrc_inactivity_timer = 1; + ue_contextP = rrc_eNB_get_ue_context(RC.rrc[enb_mod_idP], current_rnti); + if (ue_contextP != NULL) { + ue_contextP->ue_context.ue_rrc_inactivity_timer = 1; + } else { + LOG_E(MAC, "[eNB %d] CC_id %d Couldn't find the context associated to UE (RNTI %d) and reset RRC inactivity timer\n", + enb_mod_idP, + CC_idP, + current_rnti); + } } else { /* rx_length[i] */ UE_list->eNB_UE_stats[CC_idP][UE_id].num_errors_rx += 1; LOG_E(MAC, "[eNB %d] CC_id %d Frame %d : Max size of transport block reached LCID %d from UE %d ", diff --git a/openair2/RRC/LTE/rrc_eNB_S1AP.c b/openair2/RRC/LTE/rrc_eNB_S1AP.c index 2c2ab0ec49..56219d9ebd 100644 --- a/openair2/RRC/LTE/rrc_eNB_S1AP.c +++ b/openair2/RRC/LTE/rrc_eNB_S1AP.c @@ -216,6 +216,8 @@ rrc_eNB_S1AP_get_ue_ids( result2->ue_initial_id, result->eNB_ue_s1ap_id, result2->eNB_ue_s1ap_id); + + // Still return *result } } } // end if if (eNB_ue_s1ap_id > 0) @@ -223,6 +225,8 @@ rrc_eNB_S1AP_get_ue_ids( LOG_E(S1AP, "[eNB %ld] In hashtable_get, couldn't find in initial_id2_s1ap_ids ue_initial_id %"PRIu16"\n", rrc_instance_pP - RC.rrc[0], ue_initial_id); + + return NULL; /* * At the moment this is written, this case shouldn't (cannot) happen and is equivalent to an error. * One could try to find the struct instance based on s1ap_id2_s1ap_ids and eNB_ue_s1ap_id (if > 0), @@ -245,25 +249,38 @@ rrc_eNB_S1AP_get_ue_ids( eNB_ue_s1ap_id); instance = ENB_MODULE_ID_TO_INSTANCE(rrc_instance_pP - RC.rrc[0]); // get eNB instance s1ap_eNB_instance_p = s1ap_eNB_get_instance(instance); // get s1ap_eNB_instance - ue_desc_p = s1ap_eNB_get_ue_context(s1ap_eNB_instance_p, eNB_ue_s1ap_id); // get s1ap_eNB_ue_context + + if (s1ap_eNB_instance_p != NULL) { + ue_desc_p = s1ap_eNB_get_ue_context(s1ap_eNB_instance_p, eNB_ue_s1ap_id); // get s1ap_eNB_ue_context + } else { + LOG_E(S1AP, "[eNB instance %d] Couldn't find the eNB S1AP context\n", + instance); + + return NULL; + } if (ue_desc_p != NULL) { result = rrc_eNB_S1AP_get_ue_ids(rrc_instance_pP, ue_desc_p->ue_initial_id, eNB_ue_s1ap_id); - ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ENB_INSTANCE_TO_MODULE_ID(instance)], result->ue_rnti); - if ((ue_context_p != NULL) && (ue_context_p->ue_context.eNB_ue_s1ap_id == 0)) { - ue_context_p->ue_context.eNB_ue_s1ap_id = eNB_ue_s1ap_id; - } else { - LOG_E(RRC, "[eNB %ld] Incoherence between RRC context and S1AP context (%d != %d) for UE RNTI %d or UE RRC context doesn't exist\n", - rrc_instance_pP - RC.rrc[0], - ue_context_p->ue_context.eNB_ue_s1ap_id, - eNB_ue_s1ap_id, - result->ue_rnti); + if (result != NULL) { + ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ENB_INSTANCE_TO_MODULE_ID(instance)], result->ue_rnti); + + if ((ue_context_p != NULL) && (ue_context_p->ue_context.eNB_ue_s1ap_id == 0)) { + ue_context_p->ue_context.eNB_ue_s1ap_id = eNB_ue_s1ap_id; + } else { + LOG_E(RRC, "[eNB %ld] Incoherence between RRC context and S1AP context (%d != %d) for UE RNTI %d or UE RRC context doesn't exist\n", + rrc_instance_pP - RC.rrc[0], + ue_context_p->ue_context.eNB_ue_s1ap_id, + eNB_ue_s1ap_id, + result->ue_rnti); + } } } else { LOG_E(S1AP, "[eNB %ld] In hashtable_get, couldn't find in s1ap_id2_s1ap_ids eNB_ue_s1ap_id %"PRIu32", even when looking at S1AP context\n", rrc_instance_pP - RC.rrc[0], eNB_ue_s1ap_id); + + return NULL; } } // end if (h_rc != HASH_TABLE_OK) } // end if (eNB_ue_s1ap_id > 0)