Add S1down auto recovery.
(cherry picked from commit 2339972ceaeb75fe18c0b2ae9ea69216dd919668)
This commit is contained in:
committed by
masayuki.harada
parent
7631a1dc1d
commit
46407ca42b
+362
-36
@@ -58,6 +58,8 @@
|
||||
#include "s1ap_eNB_ue_context.h" // test, to be removed
|
||||
#include "msc.h"
|
||||
|
||||
#include "s1ap_eNB_timer.h"
|
||||
|
||||
#include "assertions.h"
|
||||
#include "conversions.h"
|
||||
#if defined(TEST_S1C_MME)
|
||||
@@ -73,6 +75,11 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *
|
||||
|
||||
void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp);
|
||||
|
||||
static int s1ap_sctp_req(s1ap_eNB_instance_t *instance_p,
|
||||
s1ap_eNB_mme_data_t *s1ap_mme_data_p);
|
||||
void s1ap_eNB_timer_expired(instance_t instance,
|
||||
s1ap_timer_has_expired_t *msg_p);
|
||||
|
||||
uint32_t s1ap_generate_eNB_id(void) {
|
||||
char *out;
|
||||
char hostname[50];
|
||||
@@ -114,9 +121,9 @@ static void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p,
|
||||
local_ip_addr,
|
||||
sizeof(*local_ip_addr));
|
||||
S1AP_INFO("[eNB %d] check the mme registration state\n",instance_p->instance);
|
||||
mme = NULL;
|
||||
|
||||
if ( mme == NULL ) {
|
||||
// mme = 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);
|
||||
@@ -136,28 +143,33 @@ static void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p,
|
||||
* 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 ++;
|
||||
// s1ap_mme_data_p->state = S1AP_ENB_STATE_WAITING;
|
||||
s1ap_mme_data_p->state = S1AP_ENB_STATE_DISCONNECTED;
|
||||
memcpy( &(s1ap_mme_data_p->mme_ip_address), mme_ip_address, sizeof(net_ip_address_t) );
|
||||
s1ap_mme_data_p->overload_state = S1AP_NO_OVERLOAD;
|
||||
s1ap_mme_data_p->sctp_req_cnt++;
|
||||
s1ap_mme_data_p->timer_id = S1AP_TIMERID_INIT;
|
||||
// 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_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);
|
||||
}
|
||||
// } 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_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);
|
||||
}
|
||||
@@ -168,6 +180,7 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *
|
||||
uint8_t index;
|
||||
DevAssert(s1ap_register_eNB != NULL);
|
||||
/* Look if the provided instance already exists */
|
||||
s1ap_timer_init();
|
||||
new_instance = s1ap_eNB_get_instance(instance);
|
||||
|
||||
if (new_instance != NULL) {
|
||||
@@ -195,7 +208,7 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *
|
||||
new_instance->eNB_id = s1ap_register_eNB->eNB_id;
|
||||
new_instance->cell_type = s1ap_register_eNB->cell_type;
|
||||
new_instance->tac = s1ap_register_eNB->tac;
|
||||
|
||||
|
||||
memcpy(&new_instance->eNB_s1_ip,
|
||||
&s1ap_register_eNB->enb_ip_address,
|
||||
sizeof(s1ap_register_eNB->enb_ip_address));
|
||||
@@ -206,6 +219,15 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *
|
||||
new_instance->mnc_digit_length[i] = s1ap_register_eNB->mnc_digit_length[i];
|
||||
}
|
||||
|
||||
memcpy( &(new_instance->enb_ip_address), &(s1ap_register_eNB->enb_ip_address), sizeof(net_ip_address_t) );
|
||||
new_instance->s1_setuprsp_wait_timer = s1ap_register_eNB->s1_setuprsp_wait_timer;
|
||||
new_instance->s1_setupreq_wait_timer = s1ap_register_eNB->s1_setupreq_wait_timer;
|
||||
new_instance->s1_setupreq_count = s1ap_register_eNB->s1_setupreq_count;
|
||||
new_instance->sctp_req_timer = s1ap_register_eNB->sctp_req_timer;
|
||||
new_instance->sctp_req_count = s1ap_register_eNB->sctp_req_count;
|
||||
new_instance->sctp_in_streams = s1ap_register_eNB->sctp_in_streams;
|
||||
new_instance->sctp_out_streams = s1ap_register_eNB->sctp_out_streams;
|
||||
|
||||
new_instance->num_plmn = s1ap_register_eNB->num_plmn;
|
||||
new_instance->default_drx = s1ap_register_eNB->default_drx;
|
||||
/* Add the new instance to the list of eNB (meaningfull in virtual mode) */
|
||||
@@ -216,8 +238,14 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *
|
||||
s1ap_register_eNB->eNB_id);
|
||||
}
|
||||
|
||||
DevCheck(s1ap_register_eNB->nb_mme <= S1AP_MAX_NB_MME_IP_ADDRESS,
|
||||
S1AP_MAX_NB_MME_IP_ADDRESS, s1ap_register_eNB->nb_mme, 0);
|
||||
// DevCheck(s1ap_register_eNB->nb_mme <= S1AP_MAX_NB_MME_IP_ADDRESS,
|
||||
// S1AP_MAX_NB_MME_IP_ADDRESS, s1ap_register_eNB->nb_mme, 0);
|
||||
if( s1ap_register_eNB->nb_mme > S1AP_MAX_NB_MME_IP_ADDRESS )
|
||||
{
|
||||
S1AP_ERROR("Invalid MME number = %d\n ", s1ap_register_eNB->nb_mme);
|
||||
s1ap_register_eNB->nb_mme = S1AP_MAX_NB_MME_IP_ADDRESS;
|
||||
}
|
||||
new_instance->s1ap_mme_nb = s1ap_register_eNB->nb_mme;
|
||||
|
||||
/* Trying to connect to provided list of MME ip address */
|
||||
for (index = 0; index < s1ap_register_eNB->nb_mme; index++) {
|
||||
@@ -249,28 +277,153 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *
|
||||
void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp) {
|
||||
s1ap_eNB_instance_t *instance_p;
|
||||
s1ap_eNB_mme_data_t *s1ap_mme_data_p;
|
||||
s1ap_eNB_ue_context_t *ue_p = NULL;
|
||||
MessageDef *message_p = NULL;
|
||||
uint32_t timer_kind = 0;
|
||||
struct plmn_identity_s* plmnInfo;
|
||||
struct served_group_id_s* groupInfo;
|
||||
struct served_gummei_s* gummeiInfo;
|
||||
struct mme_code_s* mmeCode;
|
||||
int8_t cnt = 0;
|
||||
unsigned enb_s1ap_id[20];
|
||||
DevAssert(sctp_new_association_resp != NULL);
|
||||
instance_p = s1ap_eNB_get_instance(instance);
|
||||
DevAssert(instance_p != NULL);
|
||||
s1ap_mme_data_p = s1ap_eNB_get_MME(instance_p, -1,
|
||||
sctp_new_association_resp->ulp_cnx_id);
|
||||
DevAssert(s1ap_mme_data_p != NULL);
|
||||
|
||||
if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) {
|
||||
S1AP_WARN("Received unsuccessful result for SCTP association (%u), instance %d, cnx_id %u\n",
|
||||
sctp_new_association_resp->sctp_state,
|
||||
instance,
|
||||
sctp_new_association_resp->ulp_cnx_id);
|
||||
s1ap_handle_s1_setup_message(s1ap_mme_data_p, sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN);
|
||||
return;
|
||||
memset(enb_s1ap_id, 0, sizeof(enb_s1ap_id) );
|
||||
if( s1ap_mme_data_p->timer_id != S1AP_TIMERID_INIT )
|
||||
{
|
||||
s1ap_timer_remove( s1ap_mme_data_p->timer_id );
|
||||
s1ap_mme_data_p->timer_id = S1AP_TIMERID_INIT;
|
||||
}
|
||||
|
||||
if( sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED )
|
||||
{
|
||||
RB_FOREACH(ue_p, s1ap_ue_map, &instance_p->s1ap_ue_head)
|
||||
{
|
||||
if( ue_p->mme_ref == s1ap_mme_data_p )
|
||||
{
|
||||
enb_s1ap_id[cnt] = ue_p->eNB_ue_s1ap_id;
|
||||
cnt++;
|
||||
|
||||
message_p = NULL;
|
||||
message_p = itti_alloc_new_message(TASK_S1AP, S1AP_UE_CONTEXT_RELEASE_COMMAND);
|
||||
|
||||
if( message_p != NULL )
|
||||
{
|
||||
S1AP_UE_CONTEXT_RELEASE_COMMAND(message_p).eNB_ue_s1ap_id = ue_p->eNB_ue_s1ap_id;
|
||||
|
||||
if( itti_send_msg_to_task(TASK_RRC_ENB, ue_p->eNB_instance->instance, message_p) < 0 )
|
||||
{
|
||||
S1AP_ERROR("UE Context Release Command Transmission Failure: eNB_ue_s1ap_id=%d\n", ue_p->eNB_ue_s1ap_id);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
S1AP_ERROR("Invalid message_p : eNB_ue_s1ap_id=%d\n", ue_p->eNB_ue_s1ap_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
for( ; cnt > 0 ; )
|
||||
{
|
||||
cnt--;
|
||||
s1ap_ue_context_release( instance, (uint32_t)enb_s1ap_id[cnt] );
|
||||
}
|
||||
s1ap_mme_data_p->mme_name = 0;
|
||||
s1ap_mme_data_p->overload_state = S1AP_NO_OVERLOAD;
|
||||
s1ap_mme_data_p->nextstream = 0;
|
||||
s1ap_mme_data_p->in_streams = 0;
|
||||
s1ap_mme_data_p->out_streams = 0;
|
||||
s1ap_mme_data_p->assoc_id = -1;
|
||||
|
||||
while (!STAILQ_EMPTY(&s1ap_mme_data_p->served_gummei))
|
||||
{
|
||||
gummeiInfo = STAILQ_FIRST(&s1ap_mme_data_p->served_gummei);
|
||||
STAILQ_REMOVE_HEAD(&s1ap_mme_data_p->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);
|
||||
}
|
||||
|
||||
STAILQ_INIT(&s1ap_mme_data_p->served_gummei);
|
||||
|
||||
if( s1ap_mme_data_p->state == S1AP_ENB_STATE_DISCONNECTED )
|
||||
{
|
||||
if( (s1ap_mme_data_p->sctp_req_cnt <= instance_p->sctp_req_count) ||
|
||||
(instance_p->sctp_req_count == 0xffff) )
|
||||
{
|
||||
timer_kind = s1ap_mme_data_p->cnx_id;
|
||||
timer_kind = timer_kind | S1AP_MMEIND;
|
||||
timer_kind = timer_kind | SCTP_REQ_WAIT;
|
||||
|
||||
if( s1ap_timer_setup( instance_p->sctp_req_timer, 0, TASK_S1AP, instance_p->instance,
|
||||
timer_kind, S1AP_TIMER_ONE_SHOT, NULL, &s1ap_mme_data_p->timer_id) < 0 )
|
||||
{
|
||||
S1AP_ERROR("Timer Start NG(SCTP retransmission wait timer) : MME=%d\n",s1ap_mme_data_p->cnx_id);
|
||||
s1ap_sctp_req( instance_p, s1ap_mme_data_p );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
S1AP_ERROR("Retransmission count exceeded of SCTP : MME=%d\n",s1ap_mme_data_p->cnx_id);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
S1AP_ERROR("SCTP disconnection reception : MME = %d\n",s1ap_mme_data_p->cnx_id);
|
||||
|
||||
if( (s1ap_mme_data_p->sctp_req_cnt <= instance_p->sctp_req_count) ||
|
||||
(instance_p->sctp_req_count == 0xffff) )
|
||||
{
|
||||
s1ap_sctp_req( instance_p, s1ap_mme_data_p );
|
||||
}
|
||||
else
|
||||
{
|
||||
S1AP_ERROR("Retransmission count exceeded of SCTP : MME=%d\n",s1ap_mme_data_p->cnx_id);
|
||||
}
|
||||
s1ap_mme_data_p->state = S1AP_ENB_STATE_DISCONNECTED;
|
||||
}
|
||||
}
|
||||
// if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) {
|
||||
// S1AP_WARN("Received unsuccessful result for SCTP association (%u), instance %d, cnx_id %u\n",
|
||||
// sctp_new_association_resp->sctp_state,
|
||||
// instance,
|
||||
// sctp_new_association_resp->ulp_cnx_id);
|
||||
// s1ap_handle_s1_setup_message(s1ap_mme_data_p, sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN);
|
||||
// return;
|
||||
// }
|
||||
else
|
||||
{
|
||||
/* Update parameters */
|
||||
s1ap_mme_data_p->assoc_id = sctp_new_association_resp->assoc_id;
|
||||
s1ap_mme_data_p->in_streams = sctp_new_association_resp->in_streams;
|
||||
s1ap_mme_data_p->out_streams = sctp_new_association_resp->out_streams;
|
||||
/* Prepare new S1 Setup Request */
|
||||
s1ap_eNB_generate_s1_setup_request(instance_p, s1ap_mme_data_p);
|
||||
s1ap_mme_data_p->s1_setupreq_cnt = 0;
|
||||
s1ap_mme_data_p->sctp_req_cnt = 0;
|
||||
if (s1ap_eNB_generate_s1_setup_request(instance_p, s1ap_mme_data_p) == -1) {
|
||||
S1AP_ERROR("s1ap eNB generate s1 setup request failed\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
@@ -288,9 +441,102 @@ void s1ap_eNB_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind) {
|
||||
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
|
||||
}
|
||||
|
||||
void s1ap_eNB_timer_expired(
|
||||
instance_t instance,
|
||||
s1ap_timer_has_expired_t *msg_p)
|
||||
{
|
||||
uint32_t timer_kind = 0;
|
||||
int16_t line_ind = 0;
|
||||
s1ap_eNB_mme_data_t *mme_desc_p = NULL;
|
||||
uint32_t timer_ind = 0;
|
||||
s1ap_eNB_instance_t *instance_p = NULL;
|
||||
long timer_id = S1AP_TIMERID_INIT;
|
||||
|
||||
instance_p = s1ap_eNB_get_instance(instance);
|
||||
timer_kind = msg_p->timer_kind;
|
||||
line_ind = (int16_t)(timer_kind & S1AP_LINEIND);
|
||||
timer_id = msg_p->timer_id;
|
||||
|
||||
if( (timer_kind & S1AP_MMEIND) == S1AP_MMEIND )
|
||||
{
|
||||
mme_desc_p = s1ap_eNB_get_MME(instance_p, -1, line_ind);
|
||||
if(mme_desc_p != NULL)
|
||||
{
|
||||
if( timer_id == mme_desc_p->timer_id )
|
||||
{
|
||||
mme_desc_p->timer_id = S1AP_TIMERID_INIT;
|
||||
timer_ind = timer_kind & S1AP_TIMERIND;
|
||||
|
||||
switch(timer_ind)
|
||||
{
|
||||
case S1_SETRSP_WAIT:
|
||||
{
|
||||
if( (instance_p->s1_setupreq_count >= mme_desc_p->s1_setupreq_cnt) ||
|
||||
(instance_p->s1_setupreq_count == 0xffff) )
|
||||
{
|
||||
s1ap_eNB_generate_s1_setup_request( instance_p, mme_desc_p );
|
||||
}
|
||||
else
|
||||
{
|
||||
S1AP_ERROR("Retransmission count exceeded of S1 SETUP REQUEST : MME=%d\n",line_ind);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case S1_SETREQ_WAIT:
|
||||
{
|
||||
if( (instance_p->s1_setupreq_count >= mme_desc_p->s1_setupreq_cnt) ||
|
||||
(instance_p->s1_setupreq_count == 0xffff) )
|
||||
{
|
||||
s1ap_eNB_generate_s1_setup_request( instance_p, mme_desc_p );
|
||||
}
|
||||
else
|
||||
{
|
||||
S1AP_ERROR("Retransmission count exceeded of S1 SETUP REQUEST : MME=%d\n",line_ind);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SCTP_REQ_WAIT:
|
||||
{
|
||||
if( (instance_p->sctp_req_count >= mme_desc_p->sctp_req_cnt) ||
|
||||
(instance_p->sctp_req_count == 0xffff) )
|
||||
{
|
||||
s1ap_sctp_req( instance_p, mme_desc_p );
|
||||
}
|
||||
else
|
||||
{
|
||||
S1AP_ERROR("Retransmission count exceeded of SCTP : MME=%d\n",line_ind);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
S1AP_WARN("Invalid Timer indication\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
S1AP_DEBUG("Unmatch timer id\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
S1AP_WARN("Not applicable MME detected : connection id = %d\n", line_ind);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void s1ap_eNB_init(void) {
|
||||
S1AP_DEBUG("Starting S1AP layer\n");
|
||||
s1ap_eNB_prepare_internal_data();
|
||||
s1ap_timer_init();
|
||||
itti_mark_task_ready(TASK_S1AP);
|
||||
MSC_START_USE();
|
||||
}
|
||||
@@ -411,6 +657,13 @@ void *s1ap_eNB_process_itti_msg(void *notUsed) {
|
||||
}
|
||||
break;
|
||||
|
||||
case TIMER_HAS_EXPIRED:
|
||||
{
|
||||
s1ap_eNB_timer_expired(ITTI_MESSAGE_GET_INSTANCE(received_msg),
|
||||
&TIMER_HAS_EXPIRED(received_msg));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
S1AP_ERROR("Received unhandled message: %d:%s\n",
|
||||
ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg));
|
||||
@@ -451,6 +704,7 @@ static int s1ap_eNB_generate_s1_setup_request(
|
||||
uint8_t *buffer = NULL;
|
||||
uint32_t len = 0;
|
||||
int ret = 0;
|
||||
uint32_t timer_kind = 0;
|
||||
DevAssert(instance_p != NULL);
|
||||
DevAssert(s1ap_mme_data_p != NULL);
|
||||
s1ap_mme_data_p->state = S1AP_ENB_STATE_WAITING;
|
||||
@@ -525,6 +779,17 @@ static int s1ap_eNB_generate_s1_setup_request(
|
||||
return -1;
|
||||
}
|
||||
|
||||
timer_kind = s1ap_mme_data_p->cnx_id;
|
||||
timer_kind = timer_kind | S1AP_MMEIND;
|
||||
timer_kind = timer_kind | S1_SETRSP_WAIT;
|
||||
|
||||
if( s1ap_timer_setup(instance_p->s1_setuprsp_wait_timer, 0, TASK_S1AP, instance_p->instance, timer_kind, S1AP_TIMER_ONE_SHOT,
|
||||
NULL, &s1ap_mme_data_p->timer_id) < 0 )
|
||||
{
|
||||
S1AP_ERROR("Timer Start NG(S1 Setup Response) : MME=%d\n",s1ap_mme_data_p->cnx_id);
|
||||
}
|
||||
s1ap_mme_data_p->s1_setupreq_cnt++;
|
||||
|
||||
/* Non UE-Associated signalling -> stream = 0 */
|
||||
s1ap_eNB_itti_send_sctp_data_req(instance_p->instance, s1ap_mme_data_p->assoc_id, buffer, len, 0);
|
||||
return ret;
|
||||
@@ -533,3 +798,64 @@ static int s1ap_eNB_generate_s1_setup_request(
|
||||
|
||||
|
||||
|
||||
static int s1ap_sctp_req(s1ap_eNB_instance_t *instance_p,
|
||||
s1ap_eNB_mme_data_t *s1ap_mme_data_p)
|
||||
{
|
||||
MessageDef *message_p = NULL;
|
||||
sctp_new_association_req_t *sctp_new_association_req_p = NULL;
|
||||
|
||||
if( instance_p == NULL )
|
||||
{
|
||||
S1AP_ERROR("Invalid instance_p\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
message_p = itti_alloc_new_message(TASK_S1AP, SCTP_NEW_ASSOCIATION_REQ);
|
||||
sctp_new_association_req_p = &message_p->ittiMsg.sctp_new_association_req;
|
||||
sctp_new_association_req_p->port = S1AP_PORT_NUMBER;
|
||||
sctp_new_association_req_p->ppid = S1AP_SCTP_PPID;
|
||||
sctp_new_association_req_p->in_streams = instance_p->sctp_in_streams;
|
||||
sctp_new_association_req_p->out_streams = instance_p->sctp_out_streams;
|
||||
sctp_new_association_req_p->ulp_cnx_id = s1ap_mme_data_p->cnx_id;
|
||||
|
||||
if( s1ap_mme_data_p->mme_ip_address.ipv4 != 0 )
|
||||
{
|
||||
memcpy(&sctp_new_association_req_p->remote_address,
|
||||
&s1ap_mme_data_p->mme_ip_address,
|
||||
sizeof(net_ip_address_t));
|
||||
if( instance_p->enb_ip_address.ipv4 != 0 )
|
||||
{
|
||||
memcpy(&sctp_new_association_req_p->local_address,
|
||||
&instance_p->enb_ip_address,
|
||||
sizeof(net_ip_address_t));
|
||||
}
|
||||
else
|
||||
{
|
||||
S1AP_ERROR("Invalid IP Address Format V4(MME):V6\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(&sctp_new_association_req_p->remote_address,
|
||||
&s1ap_mme_data_p->mme_ip_address,
|
||||
sizeof(net_ip_address_t));
|
||||
if( instance_p->enb_ip_address.ipv6 != 0 )
|
||||
{
|
||||
memcpy(&sctp_new_association_req_p->local_address,
|
||||
&instance_p->enb_ip_address,
|
||||
sizeof(net_ip_address_t));
|
||||
}
|
||||
else
|
||||
{
|
||||
S1AP_ERROR("Invalid IP Address Format V6(MME):V4\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
itti_send_msg_to_task(TASK_SCTP, instance_p->instance, message_p);
|
||||
|
||||
s1ap_mme_data_p->sctp_req_cnt++;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user