Merge branch 'feature-44-dedicated-drb' of gitlab.eurecom.fr:oai/openairinterface5g into feature-44-dedicated-drb
This commit is contained in:
+55
-24
@@ -113,7 +113,8 @@ static void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p,
|
||||
MessageDef *message_p = NULL;
|
||||
sctp_new_association_req_t *sctp_new_association_req_p = NULL;
|
||||
s1ap_eNB_mme_data_t *s1ap_mme_data_p = NULL;
|
||||
|
||||
struct s1ap_eNB_mme_data_s *mme = NULL;
|
||||
|
||||
DevAssert(instance_p != NULL);
|
||||
DevAssert(mme_ip_address != NULL);
|
||||
|
||||
@@ -134,27 +135,56 @@ static void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p,
|
||||
memcpy(&sctp_new_association_req_p->local_address,
|
||||
local_ip_addr,
|
||||
sizeof(*local_ip_addr));
|
||||
|
||||
S1AP_INFO("[eNB %d] check the mme registration state\n",instance_p->instance);
|
||||
|
||||
mme = s1ap_eNB_get_MME_from_instance(instance_p);
|
||||
|
||||
/* Create new MME descriptor */
|
||||
s1ap_mme_data_p = calloc(1, sizeof(*s1ap_mme_data_p));
|
||||
DevAssert(s1ap_mme_data_p != NULL);
|
||||
if ( mme == NULL ) {
|
||||
|
||||
/* Create new MME descriptor */
|
||||
s1ap_mme_data_p = calloc(1, sizeof(*s1ap_mme_data_p));
|
||||
DevAssert(s1ap_mme_data_p != NULL);
|
||||
|
||||
s1ap_mme_data_p->cnx_id = s1ap_eNB_fetch_add_global_cnx_id();
|
||||
sctp_new_association_req_p->ulp_cnx_id = s1ap_mme_data_p->cnx_id;
|
||||
|
||||
s1ap_mme_data_p->assoc_id = -1;
|
||||
s1ap_mme_data_p->s1ap_eNB_instance = instance_p;
|
||||
|
||||
STAILQ_INIT(&s1ap_mme_data_p->served_gummei);
|
||||
|
||||
/* Insert the new descriptor in list of known MME
|
||||
* but not yet associated.
|
||||
*/
|
||||
RB_INSERT(s1ap_mme_map, &instance_p->s1ap_mme_head, s1ap_mme_data_p);
|
||||
s1ap_mme_data_p->state = S1AP_ENB_STATE_WAITING;
|
||||
instance_p->s1ap_mme_nb ++;
|
||||
instance_p->s1ap_mme_pending_nb ++;
|
||||
} else if (mme->state == S1AP_ENB_STATE_WAITING) {
|
||||
instance_p->s1ap_mme_pending_nb ++;
|
||||
sctp_new_association_req_p->ulp_cnx_id = mme->cnx_id;
|
||||
|
||||
s1ap_mme_data_p->cnx_id = s1ap_eNB_fetch_add_global_cnx_id();
|
||||
sctp_new_association_req_p->ulp_cnx_id = s1ap_mme_data_p->cnx_id;
|
||||
|
||||
s1ap_mme_data_p->assoc_id = -1;
|
||||
s1ap_mme_data_p->s1ap_eNB_instance = instance_p;
|
||||
|
||||
STAILQ_INIT(&s1ap_mme_data_p->served_gummei);
|
||||
|
||||
/* Insert the new descriptor in list of known MME
|
||||
* but not yet associated.
|
||||
*/
|
||||
RB_INSERT(s1ap_mme_map, &instance_p->s1ap_mme_head, s1ap_mme_data_p);
|
||||
s1ap_mme_data_p->state = S1AP_ENB_STATE_WAITING;
|
||||
instance_p->s1ap_mme_nb ++;
|
||||
instance_p->s1ap_mme_pending_nb ++;
|
||||
S1AP_INFO("[eNB %d] MME already registered, retrive the data (state %d, cnx %d, mme_nb %d, mme_pending_nb %d)\n",
|
||||
instance_p->instance,
|
||||
mme->state, mme->cnx_id,
|
||||
instance_p->s1ap_mme_nb, instance_p->s1ap_mme_pending_nb);
|
||||
|
||||
/*s1ap_mme_data_p->cnx_id = mme->cnx_id;
|
||||
sctp_new_association_req_p->ulp_cnx_id = mme->cnx_id;
|
||||
|
||||
s1ap_mme_data_p->assoc_id = -1;
|
||||
s1ap_mme_data_p->s1ap_eNB_instance = instance_p;
|
||||
*/
|
||||
} else {
|
||||
|
||||
S1AP_WARN("[eNB %d] MME already registered but not in the waiting state, retrive the data (state %d, cnx %d, mme_nb %d, mme_pending_nb %d)\n",
|
||||
instance_p->instance,
|
||||
mme->state, mme->cnx_id,
|
||||
instance_p->s1ap_mme_nb, instance_p->s1ap_mme_pending_nb);
|
||||
|
||||
}
|
||||
|
||||
itti_send_msg_to_task(TASK_SCTP, instance_p->instance, message_p);
|
||||
}
|
||||
|
||||
@@ -163,13 +193,14 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *
|
||||
{
|
||||
s1ap_eNB_instance_t *new_instance;
|
||||
uint8_t index;
|
||||
|
||||
|
||||
DevAssert(s1ap_register_eNB != NULL);
|
||||
|
||||
/* Look if the provided instance already exists */
|
||||
new_instance = s1ap_eNB_get_instance(instance);
|
||||
|
||||
if (new_instance != NULL) {
|
||||
|
||||
|
||||
if (new_instance != NULL) {
|
||||
/* Checks if it is a retry on the same eNB */
|
||||
DevCheck(new_instance->eNB_id == s1ap_register_eNB->eNB_id, new_instance->eNB_id, s1ap_register_eNB->eNB_id, 0);
|
||||
DevCheck(new_instance->cell_type == s1ap_register_eNB->cell_type, new_instance->cell_type, s1ap_register_eNB->cell_type, 0);
|
||||
@@ -199,7 +230,7 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *
|
||||
/* Add the new instance to the list of eNB (meaningfull in virtual mode) */
|
||||
s1ap_eNB_insert_new_instance(new_instance);
|
||||
|
||||
S1AP_DEBUG("Registered new eNB[%d] and %s eNB id %u\n",
|
||||
S1AP_INFO("Registered new eNB[%d] and %s eNB id %u\n",
|
||||
instance,
|
||||
s1ap_register_eNB->cell_type == CELL_MACRO_ENB ? "macro" : "home",
|
||||
s1ap_register_eNB->eNB_id);
|
||||
@@ -211,7 +242,7 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *
|
||||
/* Trying to connect to provided list of MME ip address */
|
||||
for (index = 0; index < s1ap_register_eNB->nb_mme; index++) {
|
||||
s1ap_eNB_register_mme(new_instance,
|
||||
&s1ap_register_eNB->mme_ip_address[index],
|
||||
&s1ap_register_eNB->mme_ip_address[index],
|
||||
&s1ap_register_eNB->enb_ip_address,
|
||||
s1ap_register_eNB->sctp_in_streams,
|
||||
s1ap_register_eNB->sctp_out_streams);
|
||||
|
||||
@@ -27,6 +27,15 @@
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
/*! \file s1ap_eNB_management_procedures.c
|
||||
* \brief S1AP eNB task
|
||||
* \author S. Roux and Navid Nikaein
|
||||
* \date 2010 - 2016
|
||||
* \email: navid.nikaein@eurecom.fr
|
||||
* \version 1.0
|
||||
* @ingroup _s1ap
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
@@ -116,6 +125,23 @@ struct s1ap_eNB_mme_data_s *s1ap_eNB_get_MME(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct s1ap_eNB_mme_data_s *s1ap_eNB_get_MME_from_instance(
|
||||
s1ap_eNB_instance_t *instance_p)
|
||||
{
|
||||
|
||||
struct s1ap_eNB_mme_data_s *mme = NULL;
|
||||
struct s1ap_eNB_mme_data_s *mme_next = NULL;
|
||||
|
||||
for (mme = RB_MIN(s1ap_mme_map, &instance_p->s1ap_mme_head); mme!=NULL ; mme = mme_next) {
|
||||
mme_next = RB_NEXT(s1ap_mme_map, &instance_p->s1ap_mme_head, mme);
|
||||
if (mme->s1ap_eNB_instance == instance_p) {
|
||||
return mme;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
s1ap_eNB_instance_t *s1ap_eNB_get_instance(instance_t instance)
|
||||
{
|
||||
s1ap_eNB_instance_t *temp = NULL;
|
||||
@@ -130,3 +156,41 @@ s1ap_eNB_instance_t *s1ap_eNB_get_instance(instance_t instance)
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void s1ap_eNB_remove_mme_desc(s1ap_eNB_instance_t * instance)
|
||||
{
|
||||
|
||||
struct s1ap_eNB_mme_data_s *mme = NULL;
|
||||
struct s1ap_eNB_mme_data_s *mmeNext = NULL;
|
||||
struct plmn_identity_s* plmnInfo;
|
||||
struct served_group_id_s* groupInfo;
|
||||
struct served_gummei_s* gummeiInfo;
|
||||
struct mme_code_s* mmeCode;
|
||||
|
||||
for (mme = RB_MIN(s1ap_mme_map, &instance->s1ap_mme_head); mme; mme = mmeNext) {
|
||||
mmeNext = RB_NEXT(s1ap_mme_map, &instance->s1ap_mme_head, mme);
|
||||
RB_REMOVE(s1ap_mme_map, &instance->s1ap_mme_head, mme);
|
||||
while (!STAILQ_EMPTY(&mme->served_gummei)) {
|
||||
gummeiInfo = STAILQ_FIRST(&mme->served_gummei);
|
||||
STAILQ_REMOVE_HEAD(&mme->served_gummei, next);
|
||||
|
||||
while (!STAILQ_EMPTY(&gummeiInfo->served_plmns)) {
|
||||
plmnInfo = STAILQ_FIRST(&gummeiInfo->served_plmns);
|
||||
STAILQ_REMOVE_HEAD(&gummeiInfo->served_plmns, next);
|
||||
free(plmnInfo);
|
||||
}
|
||||
while (!STAILQ_EMPTY(&gummeiInfo->served_group_ids)) {
|
||||
groupInfo = STAILQ_FIRST(&gummeiInfo->served_group_ids);
|
||||
STAILQ_REMOVE_HEAD(&gummeiInfo->served_group_ids, next);
|
||||
free(groupInfo);
|
||||
}
|
||||
while (!STAILQ_EMPTY(&gummeiInfo->mme_codes)) {
|
||||
mmeCode = STAILQ_FIRST(&gummeiInfo->mme_codes);
|
||||
STAILQ_REMOVE_HEAD(&gummeiInfo->mme_codes, next);
|
||||
free(mmeCode);
|
||||
}
|
||||
free(gummeiInfo);
|
||||
}
|
||||
free(mme);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,10 @@ struct s1ap_eNB_mme_data_s *s1ap_eNB_get_MME(
|
||||
s1ap_eNB_instance_t *instance_p,
|
||||
int32_t assoc_id, uint16_t cnx_id);
|
||||
|
||||
struct s1ap_eNB_mme_data_s *s1ap_eNB_get_MME_from_instance(s1ap_eNB_instance_t *instance_p);
|
||||
|
||||
void s1ap_eNB_remove_mme_desc(s1ap_eNB_instance_t * instance);
|
||||
|
||||
void s1ap_eNB_insert_new_instance(s1ap_eNB_instance_t *new_instance_p);
|
||||
|
||||
s1ap_eNB_instance_t *s1ap_eNB_get_instance(uint8_t mod_id);
|
||||
|
||||
Reference in New Issue
Block a user