Changed with Cedric the collection initial ue id/enb s1ap id that did not work in rb tree -> 2 hashtables + misc types name change in openaircn (gtp types )

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7661 818b1a75-f10b-46b9-bf7c-635c3b92a50f
This commit is contained in:
gauthier
2015-06-25 15:23:01 +00:00
parent 2d6270a71a
commit d3741e8b0e
70 changed files with 1084 additions and 1039 deletions
+18 -18
View File
@@ -168,18 +168,18 @@ typedef enum core_network_s {
/* SAE Temporary Mobile Subscriber Identity */
typedef struct as_stmsi_s {
UInt8_t MMEcode; /* MME code that allocated the GUTI */
UInt32_t m_tmsi; /* M-Temporary Mobile Subscriber Identity */
uint8_t MMEcode; /* MME code that allocated the GUTI */
uint32_t m_tmsi; /* M-Temporary Mobile Subscriber Identity */
} as_stmsi_t;
/* Dedicated NAS information */
typedef struct as_nas_info_s {
UInt32_t length; /* Length of the NAS information data */
uint32_t length; /* Length of the NAS information data */
Byte_t* data; /* Dedicated NAS information data container */
} as_nas_info_t;
/* Radio Access Bearer identity */
typedef UInt8_t as_rab_id_t;
typedef uint8_t as_rab_id_t;
/****************************************************************************/
/************************ G L O B A L T Y P E S ************************/
@@ -235,12 +235,12 @@ typedef struct cell_info_req_s {
* is selected to camp on.
*/
typedef struct cell_info_cnf_s {
UInt8_t errCode; /* Error code */
uint8_t errCode; /* Error code */
ci_t cellID; /* Identity of the cell serving the selected PLMN */
tac_t tac; /* Code of the tracking area the cell belongs to */
AcT_t rat; /* Radio access technology supported by the cell */
UInt8_t rsrq; /* Reference signal received quality */
UInt8_t rsrp; /* Reference signal received power */
uint8_t rsrq; /* Reference signal received quality */
uint8_t rsrp; /* Reference signal received power */
} cell_info_cnf_t;
/*
@@ -273,7 +273,7 @@ typedef enum paging_cause_s {
*/
typedef struct paging_req_s {
as_stmsi_t s_tmsi; /* UE identity */
UInt8_t CN_domain; /* Core network domain */
uint8_t CN_domain; /* Core network domain */
} paging_req_t;
/*
@@ -328,7 +328,7 @@ typedef struct nas_establish_req_s {
* AS transfers the initial NAS message to the NAS.
*/
typedef struct nas_establish_ind_s {
UInt32_t UEid; /* UE lower layer identifier */
uint32_t UEid; /* UE lower layer identifier */
tac_t tac; /* Code of the tracking area the initiating
* UE belongs to */
as_cause_t asCause; /* Establishment cause */
@@ -341,11 +341,11 @@ typedef struct nas_establish_ind_s {
* the UE.
*/
typedef struct nas_establish_rsp_s {
UInt32_t UEid; /* UE lower layer identifier */
uint32_t UEid; /* UE lower layer identifier */
as_stmsi_t s_tmsi; /* UE identity */
nas_error_code_t errCode; /* Transaction status */
as_nas_info_t nasMsg; /* NAS message to transfer */
UInt32_t nas_ul_count; /* UL NAS COUNT */
uint32_t nas_ul_count; /* UL NAS COUNT */
uint16_t selected_encryption_algorithm;
uint16_t selected_integrity_algorithm;
} nas_establish_rsp_t;
@@ -355,10 +355,10 @@ typedef struct nas_establish_rsp_s {
* AS transfers the initial answer message to the NAS.
*/
typedef struct nas_establish_cnf_s {
UInt32_t UEid; /* UE lower layer identifier */
uint32_t UEid; /* UE lower layer identifier */
nas_error_code_t errCode; /* Transaction status */
as_nas_info_t nasMsg; /* NAS message to transfer */
UInt32_t ul_nas_count;
uint32_t ul_nas_count;
uint16_t selected_encryption_algorithm;
uint16_t selected_integrity_algorithm;
} nas_establish_cnf_t;
@@ -380,7 +380,7 @@ typedef enum release_cause_s {
* NAS requests the termination of the connection with the UE.
*/
typedef struct nas_release_req_s {
UInt32_t UEid; /* UE lower layer identifier */
uint32_t UEid; /* UE lower layer identifier */
as_stmsi_t s_tmsi; /* UE identity */
release_cause_t cause; /* Release cause */
} nas_release_req_t;
@@ -405,7 +405,7 @@ typedef struct nas_release_ind_s {
* operates at the network side.
*/
typedef struct ul_info_transfer_req_s {
UInt32_t UEid; /* UE lower layer identifier */
uint32_t UEid; /* UE lower layer identifier */
as_stmsi_t s_tmsi; /* UE identity */
as_nas_info_t nasMsg; /* Uplink NAS message */
} ul_info_transfer_req_t;
@@ -416,7 +416,7 @@ typedef struct ul_info_transfer_req_s {
* successfully sent to the network or not.
*/
typedef struct ul_info_transfer_cnf_s {
UInt32_t UEid; /* UE lower layer identifier */
uint32_t UEid; /* UE lower layer identifier */
nas_error_code_t errCode; /* Transaction status */
} ul_info_transfer_cnf_t;
@@ -426,7 +426,7 @@ typedef struct ul_info_transfer_cnf_s {
* at the network side.
*/
typedef struct ul_info_transfer_ind_s {
UInt32_t UEid; /* UE lower layer identifier */
uint32_t UEid; /* UE lower layer identifier */
as_nas_info_t nasMsg; /* Uplink NAS message */
} ul_info_transfer_ind_t;
@@ -530,7 +530,7 @@ typedef struct rab_release_ind_s {
* --------------------------------------------------------------------------
*/
typedef struct as_message_s {
UInt16_t msgID;
uint16_t msgID;
union {
broadcast_info_ind_t broadcast_info_ind;
cell_info_req_t cell_info_req;
+3 -1
View File
@@ -412,12 +412,14 @@ typedef struct eNB_RRC_INST_s {
rcc_eNB_carrier_data_t carrier[MAX_NUM_CCs];
uid_allocator_t uid_allocator; // for rrc_ue_head
RB_HEAD(rrc_ue_tree_s, rrc_eNB_ue_context_s) rrc_ue_head; // ue_context tree key search by rnti
RB_HEAD(rrc_rnti_tree_s, rrc_ue_s1ap_ids_s) rrc_rnti_head; // ue-rnti tree key search by S1AP ids
uint8_t HO_flag;
uint8_t Nb_ue;
#if defined(ENABLE_RAL)
obj_hash_table_t *ral_meas_thresholds;
#endif
hash_table_t *initial_id2_s1ap_ids; // key is content is rrc_ue_s1ap_ids_t
hash_table_t *s1ap_id2_s1ap_ids ; // key is content is rrc_ue_s1ap_ids_t
#ifdef LOCALIZATION
/// localization type, 0: power based, 1: time based
uint8_t loc_type;
+5 -1
View File
@@ -3303,11 +3303,15 @@ openair_rrc_lite_eNB_init(
uid_linear_allocator_init(&eNB_rrc_inst[ctxt.module_id].uid_allocator);
RB_INIT(&eNB_rrc_inst[ctxt.module_id].rrc_ue_head);
RB_INIT(&eNB_rrc_inst[ctxt.module_id].rrc_rnti_head);
// for (j = 0; j < (NUMBER_OF_UE_MAX + 1); j++) {
// eNB_rrc_inst[enb_mod_idP].Srb2[j].Active = 0;
// }
eNB_rrc_inst[ctxt.module_id].initial_id2_s1ap_ids = hashtable_create (NUMBER_OF_UE_MAX * 2, NULL, NULL);
eNB_rrc_inst[ctxt.module_id].s1ap_id2_s1ap_ids = hashtable_create (NUMBER_OF_UE_MAX * 2, NULL, NULL);
/// System Information INIT
LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Checking release \n",
+61 -55
View File
@@ -80,49 +80,10 @@ static const uint16_t S1AP_INTEGRITY_EIA2_MASK = 0x4000;
#endif
#endif
# if defined(ENABLE_ITTI)
//------------------------------------------------------------------------------
int
rrc_eNB_S1AP_compare_ue_ids(
struct rrc_ue_s1ap_ids_s* c1_pP,
struct rrc_ue_s1ap_ids_s* c2_pP
)
//------------------------------------------------------------------------------
{
LOG_T(RRC, "rrc_eNB_S1AP_compare_ue_ids() c1.ue_initial_id %x c2.ue_initial_id %x c1.eNB_ue_s1ap_id %x c2.eNB_ue_s1ap_id %x\n",
c1_pP->ue_initial_id,
c2_pP->ue_initial_id,
c1_pP->eNB_ue_s1ap_id,
c2_pP->eNB_ue_s1ap_id);
if ((c1_pP->eNB_ue_s1ap_id == 0) || (c2_pP->eNB_ue_s1ap_id == 0)) {
if (c1_pP->ue_initial_id > c2_pP->ue_initial_id) {
return 1;
}
if (c1_pP->ue_initial_id < c2_pP->ue_initial_id) {
return -1;
}
return 0;
}
if (c1_pP->eNB_ue_s1ap_id > c2_pP->eNB_ue_s1ap_id) {
return 1;
}
if (c1_pP->eNB_ue_s1ap_id < c2_pP->eNB_ue_s1ap_id) {
return -1;
}
return 0;
}
//------------------------------------------------------------------------------
/* Generate the tree management functions */
RB_GENERATE(rrc_rnti_tree_s, rrc_ue_s1ap_ids_s, entries, rrc_eNB_S1AP_compare_ue_ids);
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
struct rrc_ue_s1ap_ids_s*
rrc_eNB_S1AP_get_ue_ids(
@@ -132,12 +93,41 @@ rrc_eNB_S1AP_get_ue_ids(
)
//------------------------------------------------------------------------------
{
rrc_ue_s1ap_ids_t temp;
memset(&temp, 0, sizeof(struct rrc_ue_s1ap_ids_s));
/* eNB ue rrc id = 24 bits wide */
temp.ue_initial_id = ue_initial_id;
temp.eNB_ue_s1ap_id = eNB_ue_s1ap_id;
return RB_FIND(rrc_rnti_tree_s, &rrc_instance_pP->rrc_rnti_head, &temp);
rrc_ue_s1ap_ids_t *result = NULL;
rrc_ue_s1ap_ids_t *result2 = NULL;
hashtable_rc_t h_rc;
// we assume that a rrc_ue_s1ap_ids_s is initially inserted in initial_id2_s1ap_ids
if (eNB_ue_s1ap_id > 0) {
h_rc = hashtable_get(rrc_instance_pP->s1ap_id2_s1ap_ids, (hash_key_t)eNB_ue_s1ap_id, (void**)&result);
if (h_rc == HASH_TABLE_OK) {
return result;
}
}
if (ue_initial_id != UE_INITIAL_ID_INVALID) {
h_rc = hashtable_get(rrc_instance_pP->initial_id2_s1ap_ids, (hash_key_t)ue_initial_id, (void**)&result);
if (h_rc == HASH_TABLE_OK) {
if (eNB_ue_s1ap_id != 0) {
h_rc = hashtable_get(rrc_instance_pP->s1ap_id2_s1ap_ids, (hash_key_t)eNB_ue_s1ap_id, (void**)&result2);
if (h_rc != HASH_TABLE_OK) {
result2 = malloc(sizeof(*result2));
if (NULL != result2) {
*result2 = *result;
result2->eNB_ue_s1ap_id = eNB_ue_s1ap_id;
result->eNB_ue_s1ap_id = eNB_ue_s1ap_id;
h_rc = hashtable_insert(rrc_instance_pP->s1ap_id2_s1ap_ids,
(hash_key_t)eNB_ue_s1ap_id,
result2);
LOG_E(S1AP, "[eNB %u] Error while hashtable_insert in s1ap_id2_s1ap_ids eNB_ue_s1ap_id %u\n",
rrc_instance_pP - eNB_rrc_inst, eNB_ue_s1ap_id);
}
}
}
return result;
}
}
return NULL;
}
//------------------------------------------------------------------------------
void
@@ -147,6 +137,9 @@ rrc_eNB_S1AP_remove_ue_ids(
)
//------------------------------------------------------------------------------
{
const uint16_t ue_initial_id = ue_ids_pP->ue_initial_id;
const uint32_t eNB_ue_s1ap_id = ue_ids_pP->eNB_ue_s1ap_id;
hashtable_rc_t h_rc;
if (rrc_instance_pP == NULL) {
LOG_E(RRC, "Bad RRC instance\n");
return;
@@ -157,8 +150,19 @@ rrc_eNB_S1AP_remove_ue_ids(
return;
}
RB_REMOVE(rrc_rnti_tree_s, &rrc_instance_pP->rrc_rnti_head, ue_ids_pP);
free(ue_ids_pP);
if (eNB_ue_s1ap_id > 0) {
h_rc = hashtable_remove(rrc_instance_pP->s1ap_id2_s1ap_ids, (hash_key_t)eNB_ue_s1ap_id);
if (h_rc != HASH_TABLE_OK) {
LOG_W(RRC, "S1AP Did not find entry in hashtable s1ap_id2_s1ap_ids for eNB_ue_s1ap_id %u\n", eNB_ue_s1ap_id);
}
}
if (ue_initial_id != UE_INITIAL_ID_INVALID) {
h_rc = hashtable_remove(rrc_instance_pP->initial_id2_s1ap_ids, (hash_key_t)ue_initial_id);
if (h_rc != HASH_TABLE_OK) {
LOG_W(RRC, "S1AP Did not find entry in hashtable initial_id2_s1ap_ids for ue_initial_id %u\n", ue_initial_id);
}
}
}
/*! \fn uint16_t get_next_ue_initial_id(uint8_t mod_id)
@@ -210,10 +214,6 @@ rrc_eNB_get_ue_context_from_s1ap_ids(
eNB_ue_s1ap_idP);
if (temp) {
// found by ue_initial_id, fill now eNB_ue_s1ap_idP
if (temp->eNB_ue_s1ap_id != eNB_ue_s1ap_idP) {
temp->eNB_ue_s1ap_id = eNB_ue_s1ap_idP;
}
return rrc_eNB_get_ue_context(
&eNB_rrc_inst[ENB_INSTANCE_TO_MODULE_ID(instanceP)],
@@ -616,6 +616,7 @@ rrc_eNB_send_S1AP_NAS_FIRST_REQ(
{
MessageDef* message_p = NULL;
rrc_ue_s1ap_ids_t* rrc_ue_s1ap_ids_p = NULL;
hashtable_rc_t h_rc;
message_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_NAS_FIRST_REQ);
memset(&message_p->ittiMsg.s1ap_nas_first_req, 0, sizeof(s1ap_nas_first_req_t));
@@ -628,7 +629,12 @@ rrc_eNB_send_S1AP_NAS_FIRST_REQ(
rrc_ue_s1ap_ids_p->eNB_ue_s1ap_id = UE_INITIAL_ID_INVALID;
rrc_ue_s1ap_ids_p->ue_rnti = ctxt_pP->rnti;
RB_INSERT(rrc_rnti_tree_s, &eNB_rrc_inst[ctxt_pP->module_id].rrc_rnti_head, rrc_ue_s1ap_ids_p);
h_rc = hashtable_insert(eNB_rrc_inst[ctxt_pP->module_id].initial_id2_s1ap_ids,
(hash_key_t)ue_context_pP->ue_context.ue_initial_id,
rrc_ue_s1ap_ids_p);
LOG_E(S1AP, "[eNB %d] Error while hashtable_insert in initial_id2_s1ap_ids ue_initial_id %u\n",
ctxt_pP->module_id, ue_context_pP->ue_context.ue_initial_id);
/* Assume that cause is coded in the same way in RRC and S1ap, just check that the value is in S1ap range */
AssertFatal(ue_context_pP->ue_context.establishment_cause < RRC_CAUSE_LAST,