diff --git a/openair2/COMMON/s1ap_messages_types.h b/openair2/COMMON/s1ap_messages_types.h index 680668f49999443611c267c49651d55df633e7c7..c932706f4a7261b4758a142ed662ab1b94a7a007 100644 --- a/openair2/COMMON/s1ap_messages_types.h +++ b/openair2/COMMON/s1ap_messages_types.h @@ -8,6 +8,7 @@ #define S1AP_UPLINK_NAS(mSGpTR) (mSGpTR)->msg.s1ap_uplink_nas #define S1AP_UE_CAPABILITIES_IND(mSGpTR) (mSGpTR)->msg.s1ap_ue_cap_info_ind #define S1AP_INITIAL_CONTEXT_SETUP_RESP(mSGpTR) (mSGpTR)->msg.s1ap_initial_context_setup_resp +#define S1AP_INITIAL_CONTEXT_SETUP_FAIL(mSGpTR) (mSGpTR)->msg.s1ap_initial_context_setup_fail #define S1AP_DOWNLINK_NAS(mSGpTR) (mSGpTR)->msg.s1ap_downlink_nas #define S1AP_INITIAL_CONTEXT_SETUP_REQ(mSGpTR) (mSGpTR)->msg.s1ap_initial_context_setup_req diff --git a/openair2/RRC/LITE/defs.h b/openair2/RRC/LITE/defs.h index f670a9e25cbc963e276ef763370c878f2ea4abb4..58ab44784f05489b38e296c57c6031192bd7bbde 100644 --- a/openair2/RRC/LITE/defs.h +++ b/openair2/RRC/LITE/defs.h @@ -159,7 +159,14 @@ typedef struct UE_S_TMSI_s { uint32_t m_tmsi; }__attribute__ ((__packed__)) UE_S_TMSI; -typedef struct{ +#if defined(ENABLE_ITTI) +typedef struct e_rab_param_s { + e_rab_t param; + uint8_t status; +} e_rab_param_t; +#endif + +typedef struct eNB_RRC_UE_INFO_s{ u8 Status; #if defined(ENABLE_ITTI) @@ -177,11 +184,11 @@ typedef struct{ /* Index of e_rab to be setup in the list */ uint8_t index_of_e_rabs; /* list of e_rab to be setup by RRC layers */ - e_rab_t e_rab_param[S1AP_MAX_E_RAB]; + e_rab_param_t e_rab[S1AP_MAX_E_RAB]; #endif }__attribute__ ((__packed__)) eNB_RRC_UE_INFO; -typedef struct{ +typedef struct eNB_RRC_INFO_s{ /* Number of UE handle by the eNB */ uint8_t Nb_ue; diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LITE/rrc_eNB.c index a3b525e9b63b922262f0b0c0735f5ec3da2bf947..19178a4548c8a4b54aa138b3d02d328694962e41 100644 --- a/openair2/RRC/LITE/rrc_eNB.c +++ b/openair2/RRC/LITE/rrc_eNB.c @@ -444,6 +444,7 @@ init_MBMS (u8 Mod_id, u32 frame) { } #endif +/*------------------------------------------------------------------------------*/ static uint8_t get_next_rrc_transaction_identifier(uint8_t Mod_id) { static uint8_t rrc_transaction_identifier[NUMBER_OF_eNB_MAX]; @@ -501,7 +502,13 @@ static uint16_t get_next_ue_initial_id(uint8_t Mod_id) { static uint16_t ue_initial_id[NUMBER_OF_eNB_MAX]; - ue_initial_id[Mod_id] = ue_initial_id[Mod_id] + 1; + ue_initial_id[Mod_id] ++; + + /* Never use 0 this is the not use value! */ + if(ue_initial_id[Mod_id] == 0) + { + ue_initial_id[Mod_id] ++; + } return ue_initial_id[Mod_id]; } @@ -753,7 +760,16 @@ int rrc_eNB_decode_dcch (u8 Mod_id, u32 frame, u8 Srb_id, u8 UE_index, eNB_rrc_inst[Mod_id].Info.UE[UE_index].Status = RRC_RECONFIGURED; LOG_I (RRC, "[eNB %d] UE %d State = RRC_RECONFIGURED \n", Mod_id, UE_index); + +#if defined(ENABLE_USE_MME) + if (oai_emulation.info.mme_enabled == 1) + { +# if defined(ENABLE_ITTI) + eNB_rrc_inst[Mod_id].Info.UE[UE_index].e_rab[eNB_rrc_inst[Mod_id].Info.UE[UE_index].index_of_e_rabs - 1].status = TRUE; } +# endif +#endif + } #if defined(ENABLE_USE_MME) if (oai_emulation.info.mme_enabled == 1) @@ -767,18 +783,47 @@ int rrc_eNB_decode_dcch (u8 Mod_id, u32 frame, u8 Srb_id, u8 UE_index, /* Process e RAB configuration from S1AP initial_context_setup_req */ rrc_eNB_generate_defaultRRCConnectionReconfiguration (Mod_id, frame, UE_index, - UE_info->e_rab_param[UE_info->index_of_e_rabs].nas_pdu.buffer, - UE_info->e_rab_param[UE_info->index_of_e_rabs].nas_pdu.length, + UE_info->e_rab[UE_info->index_of_e_rabs].param.nas_pdu.buffer, + UE_info->e_rab[UE_info->index_of_e_rabs].param.nas_pdu.length, eNB_rrc_inst[Mod_id].HO_flag); /* Free the NAS PDU buffer and invalidate it */ - if (UE_info->e_rab_param[UE_info->index_of_e_rabs].nas_pdu.buffer != NULL) + if (UE_info->e_rab[UE_info->index_of_e_rabs].param.nas_pdu.buffer != NULL) { - free (UE_info->e_rab_param[UE_info->index_of_e_rabs].nas_pdu.buffer); + free (UE_info->e_rab[UE_info->index_of_e_rabs].param.nas_pdu.buffer); } - UE_info->e_rab_param[UE_info->index_of_e_rabs].nas_pdu.buffer = NULL; + UE_info->e_rab[UE_info->index_of_e_rabs].param.nas_pdu.buffer = NULL; UE_info->nb_of_e_rabs --; UE_info->index_of_e_rabs ++; } + else + { + MessageDef *msg_p; + int e_rab; + int e_rabs_done = 0; + int e_rabs_failed = 0; + + msg_p = itti_alloc_new_message(TASK_RRC_ENB, S1AP_INITIAL_CONTEXT_SETUP_RESP); + S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).eNB_ue_s1ap_id = UE_info->eNB_ue_s1ap_id; + for (e_rab = 0; e_rab < UE_info->index_of_e_rabs; e_rab++) + { + if (UE_info->e_rab[e_rab].status == TRUE) + { + e_rabs_done ++; + S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).e_rabs[e_rab].e_rab_id = UE_info->e_rab[e_rab].param.e_rab_id; + // TODO add other information from S1-U when it will be integrated + } + else + { + e_rabs_failed ++; + S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).e_rabs_failed[e_rab].e_rab_id = UE_info->e_rab[e_rab].param.e_rab_id; + // TODO add cause when it will be integrated + } + } + S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).nb_of_e_rabs = e_rabs_done; + S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).nb_of_e_rabs_failed = e_rabs_failed; + + itti_send_msg_to_task(TASK_S1AP, Mod_id, msg_p); + } # endif } #endif @@ -900,15 +945,15 @@ int rrc_eNB_decode_dcch (u8 Mod_id, u32 frame, u8 Srb_id, u8 UE_index, /* Process the first e RAB configuration from S1AP initial_context_setup_req */ rrc_eNB_generate_defaultRRCConnectionReconfiguration (Mod_id, frame, UE_index, - UE_info->e_rab_param[UE_info->index_of_e_rabs].nas_pdu.buffer, - UE_info->e_rab_param[UE_info->index_of_e_rabs].nas_pdu.length, + UE_info->e_rab[UE_info->index_of_e_rabs].param.nas_pdu.buffer, + UE_info->e_rab[UE_info->index_of_e_rabs].param.nas_pdu.length, eNB_rrc_inst[Mod_id].HO_flag); /* Free the NAS PDU buffer and invalidate it */ - if (UE_info->e_rab_param[UE_info->index_of_e_rabs].nas_pdu.buffer != NULL) + if (UE_info->e_rab[UE_info->index_of_e_rabs].param.nas_pdu.buffer != NULL) { - free (UE_info->e_rab_param[UE_info->index_of_e_rabs].nas_pdu.buffer); + free (UE_info->e_rab[UE_info->index_of_e_rabs].param.nas_pdu.buffer); } - UE_info->e_rab_param[UE_info->index_of_e_rabs].nas_pdu.buffer = NULL; + UE_info->e_rab[UE_info->index_of_e_rabs].param.nas_pdu.buffer = NULL; UE_info->nb_of_e_rabs --; UE_info->index_of_e_rabs ++; } @@ -956,7 +1001,7 @@ int rrc_eNB_decode_dcch (u8 Mod_id, u32 frame, u8 Srb_id, u8 UE_index, S1AP_UPLINK_NAS (msg_p).nas_pdu.length = pdu_length; S1AP_UPLINK_NAS (msg_p).nas_pdu.buffer = pdu_buffer; - itti_send_msg_to_task(TASK_S1AP, 0, msg_p); + itti_send_msg_to_task(TASK_S1AP, Mod_id, msg_p); } } # else @@ -3215,9 +3260,14 @@ void *rrc_enb_task(void *args_p) { if (ue_index == UE_INDEX_INVALID) { /* Can not associate this message to an UE index, send a failure to S1AP and discard it! */ + MessageDef *msg_fail_p; + LOG_W(RRC, "In S1AP_INITIAL_CONTEXT_SETUP_REQ: unknown UE initial id %d for eNB %d\n"); - // TODO + msg_fail_p = itti_alloc_new_message(TASK_RRC_ENB, S1AP_INITIAL_CONTEXT_SETUP_FAIL); + S1AP_INITIAL_CONTEXT_SETUP_FAIL (msg_fail_p).eNB_ue_s1ap_id = S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).eNB_ue_s1ap_id; + + itti_send_msg_to_task(TASK_S1AP, instance, msg_fail_p); } else { @@ -3231,7 +3281,7 @@ void *rrc_enb_task(void *args_p) { eNB_rrc_inst[instance].Info.UE[ue_index].nb_of_e_rabs = S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).nb_of_e_rabs; eNB_rrc_inst[instance].Info.UE[ue_index].index_of_e_rabs = 0; for (i = 0; i < eNB_rrc_inst[instance].Info.UE[ue_index].nb_of_e_rabs; i++) { - eNB_rrc_inst[instance].Info.UE[ue_index].e_rab_param[i] = + eNB_rrc_inst[instance].Info.UE[ue_index].e_rab[i].param = S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).e_rab_param[i]; } }