Commit 6f0ac498 authored by Cedric Roux's avatar Cedric Roux

- Add eNB deregistration between S1AP and NAS layer

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4647 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent fa331d5b
//WARNING: Do not include this header directly. Use intertask_interface.h instead.
MESSAGE_DEF(S1AP_UE_CAPABILITIES_IND, MESSAGE_PRIORITY_MED, s1ap_ue_cap_ind_t, s1ap_ue_cap_ind)
MESSAGE_DEF(S1AP_UE_CAPABILITIES_IND, MESSAGE_PRIORITY_MED, s1ap_ue_cap_ind_t, s1ap_ue_cap_ind)
MESSAGE_DEF(S1AP_ENB_DEREGISTERED_IND, MESSAGE_PRIORITY_MED, s1ap_eNB_deregistered_ind_t, s1ap_eNB_deregistered_ind)
MESSAGE_DEF(S1AP_DEREGISTER_UE_REQ, MESSAGE_PRIORITY_MED, s1ap_deregister_ue_req_t, s1ap_deregister_ue_req)
#ifndef S1AP_MESSAGES_TYPES_H_
#define S1AP_MESSAGES_TYPES_H_
#define S1AP_ENB_DEREGISTERED_IND(mSGpTR) (mSGpTR)->ittiMsg.s1ap_eNB_deregistered_ind
#define S1AP_DEREGISTER_UE_REQ(mSGpTR) (mSGpTR)->ittiMsg.s1ap_deregister_ue_req
typedef struct s1ap_initial_ue_message_s {
unsigned eNB_ue_s1ap_id:24;
uint32_t mme_ue_s1ap_id;
......@@ -39,4 +42,14 @@ typedef struct s1ap_ue_cap_ind_s {
uint32_t radio_capabilities_length;
} s1ap_ue_cap_ind_t;
#define S1AP_ITTI_UE_PER_DEREGISTER_MESSAGE 20
typedef struct s1ap_eNB_deregistered_ind_s {
uint8_t nb_ue_to_deregister;
uint32_t mme_ue_s1ap_id[S1AP_ITTI_UE_PER_DEREGISTER_MESSAGE];
} s1ap_eNB_deregistered_ind_t;
typedef struct s1ap_deregister_ue_req_s {
uint32_t mme_ue_s1ap_id;
} s1ap_deregister_ue_req_t;
#endif /* S1AP_MESSAGES_TYPES_H_ */
......@@ -34,8 +34,9 @@ Description
* String representation of EMMCN-SAP primitives
*/
static const char *_emm_cn_primitive_str[] = {
"EMMCN_AUTHENTICATION_PARAM_RES",
"EMMCN_AUTHENTICATION_PARAM_FAIL",
"EMM_CN_AUTHENTICATION_PARAM_RES",
"EMM_CN_AUTHENTICATION_PARAM_FAIL",
"EMM_CN_DEREGISTER_UE",
};
static int _emm_cn_authentication_res(const emm_cn_auth_res_t *msg)
......@@ -101,6 +102,15 @@ static int _emm_cn_authentication_fail(const emm_cn_auth_fail_t *msg)
LOG_FUNC_RETURN (rc);
}
static int _emm_cn_deregister_ue(const UInt32_t ue_id)
{
int rc = RETURNok;
LOG_FUNC_IN;
LOG_FUNC_RETURN (rc);
}
int emm_cn_send(const emm_cn_t *msg)
{
int rc = RETURNerror;
......@@ -120,6 +130,10 @@ int emm_cn_send(const emm_cn_t *msg)
rc = _emm_cn_authentication_fail(msg->u.auth_fail);
break;
case EMMCN_DEREGISTER_UE:
rc = _emm_cn_deregister_ue(msg->u.deregister.UEid);
break;
default:
/* Other primitives are forwarded to the Access Stratum */
rc = RETURNerror;
......
......@@ -30,6 +30,7 @@ typedef enum emmcn_primitive_s {
#if defined(EPC_BUILD)
_EMMCN_AUTHENTICATION_PARAM_RES,
_EMMCN_AUTHENTICATION_PARAM_FAIL,
_EMMCN_DEREGISTER_UE,
#endif
_EMMCN_END
} emm_cn_primitive_t;
......@@ -38,11 +39,16 @@ typedef enum emmcn_primitive_s {
typedef nas_auth_param_rsp_t emm_cn_auth_res_t;
typedef nas_auth_param_fail_t emm_cn_auth_fail_t;
typedef struct emm_cn_deregister_ue_s {
UInt32_t UEid;
} emm_cn_deregister_ue_t;
typedef struct emm_mme_ul_s {
emm_cn_primitive_t primitive;
union {
emm_cn_auth_res_t *auth_res;
emm_cn_auth_fail_t *auth_fail;
emm_cn_auth_res_t *auth_res;
emm_cn_auth_fail_t *auth_fail;
emm_cn_deregister_ue_t deregister;
} u;
} emm_cn_t;
#endif
......
......@@ -109,6 +109,7 @@ typedef enum {
#ifdef EPC_BUILD
EMMCN_AUTHENTICATION_PARAM_RES = _EMMCN_AUTHENTICATION_PARAM_RES,
EMMCN_AUTHENTICATION_PARAM_FAIL = _EMMCN_AUTHENTICATION_PARAM_FAIL,
EMMCN_DEREGISTER_UE = _EMMCN_DEREGISTER_UE
#endif
} emm_primitive_t;
......
......@@ -1474,6 +1474,21 @@ int nas_proc_auth_param_fail(emm_cn_auth_fail_t *emm_cn_auth_fail)
LOG_FUNC_RETURN (rc);
}
int nas_proc_deregister_ue(UInt32_t ue_id)
{
int rc = RETURNerror;
emm_sap_t emm_sap;
LOG_FUNC_IN;
emm_sap.primitive = EMMCN_DEREGISTER_UE;
emm_sap.u.emm_cn.u.deregister.UEid = ue_id;
rc = emm_sap_send(&emm_sap);
LOG_FUNC_RETURN (rc);
}
# endif
#endif // NAS_MME
......
......@@ -136,8 +136,8 @@ int nas_proc_ul_transfer_ind(UInt32_t ueid, const Byte_t *data, UInt32_t len);
*/
#if defined(NAS_MME) && defined(EPC_BUILD)
int nas_proc_auth_param_res(emm_cn_auth_res_t *emm_cn_auth_res);
int nas_proc_auth_param_fail(emm_cn_auth_fail_t *emm_cn_auth_fail);
int nas_proc_deregister_ue(UInt32_t ue_id);
#endif
#endif /* __NAS_PROC_H__*/
......@@ -60,6 +60,7 @@ static void *nas_intertask_interface(void *args_p)
next_message:
itti_receive_msg(TASK_NAS, &received_message_p);
switch (ITTI_MSG_ID(received_message_p))
{
case NAS_CONNECTION_ESTABLISHMENT_IND: {
......@@ -142,6 +143,21 @@ next_message:
#endif
} break;
case S1AP_ENB_DEREGISTERED_IND: {
#if !defined(DISABLE_USE_NAS)
int i;
for (i = 0; i < S1AP_ENB_DEREGISTERED_IND(received_message_p).nb_ue_to_deregister; i ++) {
nas_proc_deregister_ue(S1AP_ENB_DEREGISTERED_IND(received_message_p).mme_ue_s1ap_id[i]);
}
#endif
} break;
case S1AP_DEREGISTER_UE_REQ: {
#if !defined(DISABLE_USE_NAS)
nas_proc_deregister_ue(S1AP_DEREGISTER_UE_REQ(received_message_p).mme_ue_s1ap_id);
#endif
} break;
case TERMINATE_MESSAGE: {
itti_exit_task();
} break;
......
......@@ -697,20 +697,51 @@ int s1ap_mme_handle_path_switch_request(uint32_t assoc_id, uint32_t stream,
return 0;
}
////////////////////////////////////////////////////////////////////////////////
//************************* E-RAB management *********************************//
////////////////////////////////////////////////////////////////////////////////
int s1ap_handle_sctp_deconnection(uint32_t assoc_id)
{
int current_ue_index = 0;
int handled_ues = 0;
int i;
MessageDef *message_p = NULL;
ue_description_t *ue_ref = NULL;
eNB_description_t *eNB_association;
/* Checking that the assoc id has a valid eNB attached to. */
if ((eNB_association = s1ap_is_eNB_assoc_id_in_list(assoc_id)) == NULL) {
S1AP_DEBUG("No eNB attached to this assoc_id: %d\n",
eNB_association = s1ap_is_eNB_assoc_id_in_list(assoc_id);
if (eNB_association == NULL) {
S1AP_ERROR("No eNB attached to this assoc_id: %d\n",
assoc_id);
return -1;
}
STAILQ_FOREACH(ue_ref, &eNB_association->ue_list_head, ue_entries)
{
/* Ask for a release of each UE context associated to the eNB */
if (current_ue_index == 0) {
message_p = itti_alloc_new_message(TASK_S1AP, S1AP_ENB_DEREGISTERED_IND);
}
S1AP_ENB_DEREGISTERED_IND(message_p).mme_ue_s1ap_id[current_ue_index] = ue_ref->mme_ue_s1ap_id;
if (current_ue_index == 0 && handled_ues > 0) {
S1AP_ENB_DEREGISTERED_IND(message_p).nb_ue_to_deregister = S1AP_ITTI_UE_PER_DEREGISTER_MESSAGE;
itti_send_msg_to_task(TASK_NAS, INSTANCE_DEFAULT, message_p);
}
handled_ues++;
current_ue_index = handled_ues % S1AP_ITTI_UE_PER_DEREGISTER_MESSAGE;
}
if ((handled_ues % S1AP_ITTI_UE_PER_DEREGISTER_MESSAGE) != 0) {
S1AP_ENB_DEREGISTERED_IND(message_p).nb_ue_to_deregister = current_ue_index;
for (i = current_ue_index; i < S1AP_ITTI_UE_PER_DEREGISTER_MESSAGE; i++) {
S1AP_ENB_DEREGISTERED_IND(message_p).mme_ue_s1ap_id[current_ue_index] = 0;
}
itti_send_msg_to_task(TASK_NAS, INSTANCE_DEFAULT, message_p);
}
s1ap_remove_eNB(eNB_association);
s1ap_dump_eNB_list();
......@@ -756,6 +787,10 @@ int s1ap_handle_new_association(sctp_new_peer_t *sctp_new_peer_p)
return 0;
}
////////////////////////////////////////////////////////////////////////////////
//************************* E-RAB management *********************************//
////////////////////////////////////////////////////////////////////////////////
int s1ap_handle_create_session_response(SgwCreateSessionResponse
*session_response_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