diff --git a/openair2/LAYER2/RLC/rlc.h b/openair2/LAYER2/RLC/rlc.h index aa35be6d794f20c820386e0d07c7d1f1df4c01ac..d373d576b1c7031659c1b5022311abd7a55b05eb 100755 --- a/openair2/LAYER2/RLC/rlc.h +++ b/openair2/LAYER2/RLC/rlc.h @@ -309,8 +309,8 @@ public_rlc_rrc( rlc_op_status_t rrc_rlc_data_req (module_id_t, u32_t, u8_t, * \param[in] rrc_data_indP Pointer on RRC data indicate function. * \param[in] rrc_data_confP Pointer on RRC data confirm callback function. */ -public_rlc_rrc( void rrc_rlc_register_rrc ( void (*rrc_data_indP) (module_id_t , u32_t, u8_t, rb_id_t , sdu_size_t , char*), - void (*rrc_data_conf) (module_id_t , rb_id_t , mui_t, rlc_tx_status_t) );) +public_rlc_rrc( void rrc_rlc_register_rrc ( void (*rrc_data_indP) (module_id_t , u32_t, u8_t, rb_id_t , sdu_size_t , u8_t*), + void (*rrc_data_conf) (module_id_t , rb_id_t , mui_t, rlc_tx_status_t) );) //----------------------------------------------------------------------------- // PUBLIC INTERFACE WITH MAC diff --git a/openair2/LAYER2/RLC/rlc_rrc.c b/openair2/LAYER2/RLC/rlc_rrc.c index 71024c111f8c26a5ce2f5f1eab7748e9e33e30df..8c3dd898fc61c3301b54cf7294eb80623647ba1c 100644 --- a/openair2/LAYER2/RLC/rlc_rrc.c +++ b/openair2/LAYER2/RLC/rlc_rrc.c @@ -571,8 +571,8 @@ rlc_op_status_t rrc_rlc_data_req (module_id_t module_idP, u32_t frame, u8_t } //----------------------------------------------------------------------------- -void rrc_rlc_register_rrc ( void (*rrc_data_indP) (module_id_t module_idP, u32_t frame, u8_t eNB_id, rb_id_t rb_idP, sdu_size_t sdu_sizeP, char* sduP), - void (*rrc_data_confP) (module_id_t module_idP, rb_id_t rb_idP, mui_t muiP, rlc_tx_status_t statusP) ) { +void rrc_rlc_register_rrc ( void (*rrc_data_indP) (module_id_t module_idP, u32_t frame, u8_t eNB_id, rb_id_t rb_idP, sdu_size_t sdu_sizeP, u8_t* sduP), + void (*rrc_data_confP) (module_id_t module_idP, rb_id_t rb_idP, mui_t muiP, rlc_tx_status_t statusP) ) { //----------------------------------------------------------------------------- rlc_rrc_data_ind = rrc_data_indP; rlc_rrc_data_conf = rrc_data_confP; diff --git a/openair2/RRC/LITE/L2_interface.c b/openair2/RRC/LITE/L2_interface.c index 2654710704882e5915a9a2e0ef9e65629b70561e..db7de315b024470b5ad2c8b75b267825d1c2f0c7 100644 --- a/openair2/RRC/LITE/L2_interface.c +++ b/openair2/RRC/LITE/L2_interface.c @@ -63,7 +63,7 @@ extern UE_MAC_INST *UE_mac_inst; u32 mui=0; //-------------------------------------------------------------------------------------------// -s8 mac_rrc_lite_data_req(u8 Mod_id, u32 frame, u16 Srb_id, u8 Nb_tb, char *Buffer, u8 eNB_flag, u8 eNB_index, +s8 mac_rrc_lite_data_req(u8 Mod_id, u32 frame, u16 Srb_id, u8 Nb_tb, u8 *Buffer, u8 eNB_flag, u8 eNB_index, u8 mbsfn_sync_area) { //-------------------------------------------------------------------------------------------// SRB_INFO *Srb_info; @@ -320,10 +320,28 @@ s8 mac_rrc_lite_data_ind(u8 Mod_id, u32 frame, u16 Srb_id, u8 *Sdu, u16 sdu_size Srb_info = &eNB_rrc_inst[Mod_id].Srb0; LOG_T(RRC,"[eNB %d] Received SDU for CCCH on SRB %d\n",Mod_id,Srb_info->Srb_id); +#if defined(ENABLE_ITTI) + { + MessageDef *message_p; + // Uses a new buffer to avoid issue with MAC buffer content that could be changed by MAC (asynchronous message handling). + u8 *message_buffer; + + message_buffer = malloc (sdu_size); + memcpy (message_buffer, Sdu, sdu_size); + + message_p = itti_alloc_new_message (TASK_MAC, RRC_MAC_CCCH_DATA_IND); + RRC_MAC_CCCH_DATA_IND (message_p).frame = frame; + RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = sdu_size; + RRC_MAC_CCCH_DATA_IND (message_p).sdu_p = message_buffer; + + itti_send_msg_to_task (TASK_RRC_ENB, Mod_id, message_p); + } +#else // msg("\n******INST %d Srb_info %p, Srb_id=%d****\n\n",Mod_id,Srb_info,Srb_info->Srb_id); memcpy(Srb_info->Rx_buffer.Payload,Sdu,6); rrc_eNB_decode_ccch(Mod_id,frame,Srb_info); - } +#endif + } return(0); @@ -348,7 +366,7 @@ u8 rrc_lite_data_req(u8 Mod_id, u32 frame, u8 eNB_flag, unsigned int rb_id, u32 message_buffer = malloc (sdu_size); memcpy (message_buffer, Buffer, sdu_size); - message_p = itti_alloc_new_message (TASK_RRC_UE, RRC_DCCH_DATA_REQ); + message_p = itti_alloc_new_message (eNB_flag ? TASK_RRC_ENB : TASK_RRC_UE, RRC_DCCH_DATA_REQ); RRC_DCCH_DATA_REQ (message_p).frame = frame; RRC_DCCH_DATA_REQ (message_p).enb_flag = eNB_flag; RRC_DCCH_DATA_REQ (message_p).rb_id = rb_id; @@ -358,7 +376,6 @@ u8 rrc_lite_data_req(u8 Mod_id, u32 frame, u8 eNB_flag, unsigned int rb_id, u32 RRC_DCCH_DATA_REQ (message_p).sdu_p = message_buffer; RRC_DCCH_DATA_REQ (message_p).mode = mode; - itti_send_msg_to_task (TASK_PDCP, Mod_id, message_p); return TRUE; // TODO should be changed to a CNF message later, currently RRC lite does not used the returned value anyway. @@ -375,37 +392,41 @@ void rrc_lite_data_ind( u8 Mod_id, u32 frame, u8 eNB_flag,u32 Srb_id, u32 sdu_si u8 DCCH_index = Srb_id % NB_RB_MAX; LOG_N(RRC,"[%s %d] Frame %d: received a DCCH %d message on SRB %d with Size %d\n", - (eNB_flag == 1)? "eNB": "UE", - (eNB_flag == 1)? Mod_id : UE_index, - frame, DCCH_index,Srb_id-1,sdu_size); + (eNB_flag == 1)? "eNB": "UE", + (eNB_flag == 1)? Mod_id : UE_index, + frame, DCCH_index,Srb_id-1,sdu_size); - if (eNB_flag ==1) { - rrc_eNB_decode_dcch(Mod_id,frame,DCCH_index,UE_index,Buffer,sdu_size); - } - else { #if defined(ENABLE_ITTI) - { - MessageDef *message_p; - // Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling). - u8 *message_buffer; + { + MessageDef *message_p; + // Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling). + u8 *message_buffer; - message_buffer = malloc (sdu_size); - memcpy (message_buffer, Buffer, sdu_size); + message_buffer = malloc (sdu_size); + memcpy (message_buffer, Buffer, sdu_size); - message_p = itti_alloc_new_message (TASK_PDCP, RRC_DCCH_DATA_IND); - RRC_DCCH_DATA_IND (message_p).frame = frame; - RRC_DCCH_DATA_IND (message_p).dcch_index = DCCH_index; - RRC_DCCH_DATA_IND (message_p).sdu_size = sdu_size; - RRC_DCCH_DATA_IND (message_p).sdu_p = message_buffer; - RRC_DCCH_DATA_IND (message_p).ue_index = UE_index; + message_p = itti_alloc_new_message (TASK_PDCP, RRC_DCCH_DATA_IND); + RRC_DCCH_DATA_IND (message_p).frame = frame; + RRC_DCCH_DATA_IND (message_p).dcch_index = DCCH_index; + RRC_DCCH_DATA_IND (message_p).sdu_size = sdu_size; + RRC_DCCH_DATA_IND (message_p).sdu_p = message_buffer; + RRC_DCCH_DATA_IND (message_p).ue_index = UE_index; + if (eNB_flag == 1) { + itti_send_msg_to_task (TASK_RRC_ENB, Mod_id, message_p); + } + else { itti_send_msg_to_task (TASK_RRC_UE, Mod_id - NB_eNB_INST, message_p); } + } #else + if (eNB_flag ==1) { + rrc_eNB_decode_dcch(Mod_id,frame,DCCH_index,UE_index,Buffer,sdu_size); + } + else { rrc_ue_decode_dcch(Mod_id-NB_eNB_INST,frame,DCCH_index,Buffer,UE_index); -#endif } - +#endif } //-------------------------------------------------------------------------------------------// @@ -435,10 +456,10 @@ void rrc_lite_out_of_sync_ind(u8 Mod_id, u32 frame, u16 eNB_index){ // rlc_infoP.rlc_mode=RLC_UM; LOG_I(RRC,"[UE %d] Frame %d: OUT OF SYNC FROM eNB %d (T310 %d, N310 %d, N311 %d)\n ", - Mod_id,frame,eNB_index, - UE_rrc_inst[Mod_id].Info[eNB_index].T310_cnt, - UE_rrc_inst[Mod_id].Info[eNB_index].N310_cnt, - UE_rrc_inst[Mod_id].Info[eNB_index].N311_cnt); + Mod_id,frame,eNB_index, + UE_rrc_inst[Mod_id].Info[eNB_index].T310_cnt, + UE_rrc_inst[Mod_id].Info[eNB_index].N310_cnt, + UE_rrc_inst[Mod_id].Info[eNB_index].N311_cnt); #if defined(ENABLE_ITTI) { @@ -453,7 +474,6 @@ void rrc_lite_out_of_sync_ind(u8 Mod_id, u32 frame, u16 eNB_index){ #else UE_rrc_inst[Mod_id].Info[eNB_index].N310_cnt++; #endif - } //-------------------------------------------------------------------------------------------// diff --git a/openair2/RRC/LITE/MESSAGES/asn1_msg.h b/openair2/RRC/LITE/MESSAGES/asn1_msg.h index 3e417215d5e2993813f65df40954250865762da3..6cca670c97d81e2030ee6135ea1bfd1f18bac468 100644 --- a/openair2/RRC/LITE/MESSAGES/asn1_msg.h +++ b/openair2/RRC/LITE/MESSAGES/asn1_msg.h @@ -15,6 +15,8 @@ #include "RRC/LITE/defs.h" +uint16_t get_adjacent_cell_id(uint8_t Mod_id,uint8_t index); + /** \brief Generate a default configuration for SIB1 (eNB). @param frame_parms Used to store some basic parameters from PHY configuration diff --git a/openair2/RRC/LITE/defs.h b/openair2/RRC/LITE/defs.h index c15f7621249857450485f255e0d42fdd2434c46b..c95527af61a667125bcf38fee8f8f57b9a04553f 100644 --- a/openair2/RRC/LITE/defs.h +++ b/openair2/RRC/LITE/defs.h @@ -460,18 +460,23 @@ void rrc_eNB_process_RRCConnectionReconfigurationComplete(u8 Mod_id,u32 frame,u8 void rrc_eNB_generate_defaultRRCConnectionReconfiguration(u8 Mod_id, u32 frame, u16 UE_index, u8 *nas_pdu, u32 nas_length); #if defined(ENABLE_ITTI) +/**\brief RRC eNB task. + \param void *args_p Pointer on arguments to start the task. */ +void *rrc_enb_task(void *args_p); + /**\brief RRC UE task. \param void *args_p Pointer on arguments to start the task. */ void *rrc_ue_task(void *args_p); #endif //L2_interface.c -s8 mac_rrc_lite_data_req( u8 Mod_id, u32 frame, unsigned short Srb_id, u8 Nb_tb,char *Buffer,u8 eNB_flag, u8 eNB_index, u8 mbsfn_sync_area); +s8 mac_rrc_lite_data_req( u8 Mod_id, u32 frame, unsigned short Srb_id, u8 Nb_tb, u8 *Buffer,u8 eNB_flag, u8 eNB_index, u8 mbsfn_sync_area); s8 mac_rrc_lite_data_ind( u8 Mod_id, u32 frame, unsigned short Srb_id, u8 *Sdu, unsigned short Sdu_len,u8 eNB_flag,u8 eNB_index, u8 mbsfn_sync_area); void mac_sync_ind( u8 Mod_id, u8 status); u8 rrc_lite_data_req(u8 Mod_id, u32 frame, u8 eNB_flag, unsigned int rb_id, u32 muiP, u32 confirmP, unsigned int sdu_size, u8* Buffer, u8 mode); void rrc_lite_data_ind( u8 Mod_id, u32 frame, u8 eNB_flag, u32 Rb_id, u32 sdu_size,u8 *Buffer); +void rrc_lite_in_sync_ind(u8 Mod_id, u32 frame, u16 eNB_index); void rrc_lite_out_of_sync_ind(u8 Mod_id, u32 frame, unsigned short eNB_index); int decode_MCCH_Message(u8 Mod_id, u32 frame, u8 eNB_index, u8 *Sdu, u8 Sdu_len,u8 mbsfn_sync_area); diff --git a/openair2/RRC/LITE/rrc_UE.c b/openair2/RRC/LITE/rrc_UE.c index f9b2796bcbaeab5d200d28a55b04940c05d25649..ebd28e8f22582488232e64416ab300c85acfb3cf 100644 --- a/openair2/RRC/LITE/rrc_UE.c +++ b/openair2/RRC/LITE/rrc_UE.c @@ -77,6 +77,10 @@ #include "pdcp.h" +#if defined(ENABLE_ITTI) +# include "intertask_interface.h" +#endif + #ifdef PHY_EMUL extern EMULATION_VARS *Emul_vars; #endif @@ -231,7 +235,6 @@ void rrc_ue_generate_RRCConnectionRequest(u8 Mod_id, u32 frame, u8 eNB_index){ mui_t rrc_mui=0; - /*------------------------------------------------------------------------------*/ void rrc_ue_generate_RRCConnectionSetupComplete(u8 Mod_id, u32 frame, u8 eNB_index){ /*------------------------------------------------------------------------------*/ @@ -1751,3 +1754,116 @@ void decode_MBSFNAreaConfiguration(u8 Mod_id, u8 eNB_index, u32 frame,u8 mbsfn_s #ifndef USER_MODE EXPORT_SYMBOL(Rlc_info_am_config); #endif + +#if defined(ENABLE_ITTI) +void *rrc_ue_task(void *args_p) { + MessageDef *msg_p; + char *msg_name; + instance_t instance; + SRB_INFO *srb_info_p; + + itti_mark_task_ready (TASK_RRC_UE); + + while(1) { + // Wait for a message + itti_receive_msg (TASK_RRC_UE, &msg_p); + + msg_name = ITTI_MSG_NAME (msg_p); + instance = ITTI_MSG_INSTANCE (msg_p); + + switch (msg_p->header.messageId) { + case TERMINATE_MESSAGE: + itti_exit_task (); + break; + + case MESSAGE_TEST: + LOG_D(RRC, "Received %s\n", msg_name); + break; + + case RRC_MAC_IN_SYNC_IND: + LOG_D(RRC, "Received %s: instance %d, frame %d, eNB %d\n", msg_name, instance, + RRC_MAC_IN_SYNC_IND (msg_p).frame, RRC_MAC_IN_SYNC_IND (msg_p).enb_index); + + UE_rrc_inst[instance].Info[RRC_MAC_IN_SYNC_IND (msg_p).enb_index].N310_cnt = 0; + if (UE_rrc_inst[instance].Info[RRC_MAC_IN_SYNC_IND (msg_p).enb_index].T310_active == 1) + UE_rrc_inst[instance].Info[RRC_MAC_IN_SYNC_IND (msg_p).enb_index].N311_cnt++; + break; + + case RRC_MAC_OUT_OF_SYNC_IND: + LOG_D(RRC, "Received %s: instance %d, frame %d, eNB %d\n", msg_name, instance, + RRC_MAC_OUT_OF_SYNC_IND (msg_p).frame, RRC_MAC_OUT_OF_SYNC_IND (msg_p).enb_index); + + UE_rrc_inst[instance].Info[RRC_MAC_OUT_OF_SYNC_IND (msg_p).enb_index].N310_cnt ++; + break; + + case RRC_MAC_BCCH_DATA_IND: + LOG_D(RRC, "Received %s: instance %d, frame %d, eNB %d\n", msg_name, instance, + RRC_MAC_BCCH_DATA_IND (msg_p).frame, RRC_MAC_BCCH_DATA_IND (msg_p).enb_index); + + decode_BCCH_DLSCH_Message (instance, RRC_MAC_BCCH_DATA_IND (msg_p).frame, + RRC_MAC_BCCH_DATA_IND (msg_p).enb_index, RRC_MAC_BCCH_DATA_IND (msg_p).sdu_p, + RRC_MAC_BCCH_DATA_IND (msg_p).sdu_size); + + // Message buffer has been processed, free it now. + free (RRC_MAC_BCCH_DATA_IND (msg_p).sdu_p); + break; + + case RRC_MAC_CCCH_DATA_IND: + LOG_D(RRC, "Received %s: instance %d, frame %d, eNB %d\n", msg_name, instance, + RRC_MAC_CCCH_DATA_IND (msg_p).frame, RRC_MAC_CCCH_DATA_IND (msg_p).enb_index); + + srb_info_p = &UE_rrc_inst[instance].Srb0[RRC_MAC_CCCH_DATA_IND (msg_p).enb_index]; + + memcpy (srb_info_p->Rx_buffer.Payload, RRC_MAC_CCCH_DATA_IND (msg_p).sdu_p, + RRC_MAC_CCCH_DATA_IND (msg_p).sdu_size); + srb_info_p->Rx_buffer.payload_size = RRC_MAC_CCCH_DATA_IND (msg_p).sdu_size; + rrc_ue_decode_ccch (instance, RRC_MAC_CCCH_DATA_IND (msg_p).frame, srb_info_p, + RRC_MAC_CCCH_DATA_IND (msg_p).enb_index); + + // Message buffer has been processed, free it now. + free (RRC_MAC_CCCH_DATA_IND (msg_p).sdu_p); + break; + + case RRC_MAC_CCCH_SUCCESS_IND: + LOG_D(RRC, "Received %s: instance %d, eNB %d\n", msg_name, instance, + RRC_MAC_CCCH_SUCCESS_IND (msg_p).enb_index); + + // reset the tx buffer to indicate RRC that ccch was successfully transmitted (for example if contention resolution succeeds) + UE_rrc_inst[instance].Srb0[RRC_MAC_CCCH_SUCCESS_IND (msg_p).enb_index].Tx_buffer.payload_size = 0; + break; + +#ifdef Rel10 + case RRC_MAC_MCCH_DATA_IND: + LOG_D(RRC, "Received %s: instance %d, frame %d, eNB %d, mbsfn SA %d\n", msg_name, instance, + RRC_MAC_MCCH_DATA_IND (msg_p).frame, RRC_MAC_MCCH_DATA_IND (msg_p).eNB_index, RRC_MAC_MCCH_DATA_IND (msg_p).mbsfn_sync_area); + + decode_MCCH_Message (instance, RRC_MAC_MCCH_DATA_IND (msg_p).frame, RRC_MAC_MCCH_DATA_IND (msg_p).eNB_index, + RRC_MAC_MCCH_DATA_IND (msg_p).sdu_p, RRC_MAC_MCCH_DATA_IND (msg_p).sdu_size, + RRC_MAC_MCCH_DATA_IND (msg_p).mbsfn_sync_area); + + // Message buffer has been processed, free it now. + free (RRC_MAC_MCCH_DATA_IND (msg_p).sdu_p); + break; +#endif + + case RRC_DCCH_DATA_IND: + LOG_D(RRC, "Received %s: instance %d, frame %d, DCCH %d, UE %d\n", msg_name, instance, + RRC_DCCH_DATA_IND (msg_p).frame, RRC_DCCH_DATA_IND (msg_p).dcch_index, RRC_DCCH_DATA_IND (msg_p).ue_index); + + rrc_ue_decode_dcch (instance, RRC_DCCH_DATA_IND (msg_p).frame, + RRC_DCCH_DATA_IND (msg_p).dcch_index, RRC_DCCH_DATA_IND (msg_p).sdu_p, + RRC_DCCH_DATA_IND (msg_p).ue_index); + + // Message buffer has been processed, free it now. + free (RRC_DCCH_DATA_IND (msg_p).sdu_p); + break; + + default: + LOG_E(RRC, "Received unexpected message %s\n", msg_name); + break; + } + + free (msg_p); + } +} +#endif diff --git a/openair2/RRC/LITE/rrc_common.c b/openair2/RRC/LITE/rrc_common.c index fc7a26224dc874c614c73286a9f3a5ecc0bf29fa..b22103ad4752782a0daaa171a31888681813cc63 100644 --- a/openair2/RRC/LITE/rrc_common.c +++ b/openair2/RRC/LITE/rrc_common.c @@ -45,10 +45,7 @@ #include "COMMON/mac_rrc_primitives.h" #include "UTIL/LOG/log.h" #include "asn1_msg.h" - -#if defined(ENABLE_ITTI) -# include "intertask_interface.h" -#endif +#include "pdcp.h" #define DEBUG_RRC 1 extern eNB_MAC_INST *eNB_mac_inst; @@ -309,7 +306,7 @@ void rrc_t310_expiration(u32 frame, u8 Mod_id, u8 eNB_index) { msg ("[RRC Inst %d] eNB_index %d, Remove RB %d\n ", Mod_id, eNB_index, UE_rrc_inst[Mod_id].Srb2[eNB_index].Srb_info.Srb_id); rrc_pdcp_config_req (Mod_id + NB_eNB_INST, frame, 0, ACTION_REMOVE, - UE_rrc_inst[Mod_id].Srb2[eNB_index].Srb_info.Srb_id); + UE_rrc_inst[Mod_id].Srb2[eNB_index].Srb_info.Srb_id, 0); rrc_rlc_config_req (Mod_id + NB_eNB_INST, frame, 0, ACTION_REMOVE, UE_rrc_inst[Mod_id].Srb2[eNB_index].Srb_info.Srb_id, SIGNALLING_RADIO_BEARER, Rlc_info_um); UE_rrc_inst[Mod_id].Srb2[eNB_index].Active = 0; @@ -374,116 +371,3 @@ RRC_status_t rrc_rx_tx(u8 Mod_id, u32 frame, u8 eNB_flag, u8 index) { return (RRC_OK); } - -#if defined(ENABLE_ITTI) -void *rrc_ue_task(void *args_p) { - MessageDef *msg_p; - char *msg_name; - instance_t instance; - SRB_INFO *srb_info_p; - - itti_mark_task_ready (TASK_RRC_UE); - - while(1) { - // Wait for a message - itti_receive_msg (TASK_RRC_UE, &msg_p); - - msg_name = ITTI_MSG_NAME (msg_p); - instance = ITTI_MSG_INSTANCE (msg_p); - - switch (msg_p->header.messageId) { - case TERMINATE_MESSAGE: - itti_exit_task (); - break; - - case MESSAGE_TEST: - LOG_D(RRC, "Received %s\n", msg_name); - break; - - case RRC_MAC_IN_SYNC_IND: - LOG_D(RRC, "Received %s: instance %d, frame %d, eNB %d\n", msg_name, instance, - RRC_MAC_IN_SYNC_IND (msg_p).frame, RRC_MAC_IN_SYNC_IND (msg_p).enb_index); - - UE_rrc_inst[instance].Info[RRC_MAC_IN_SYNC_IND (msg_p).enb_index].N310_cnt = 0; - if (UE_rrc_inst[instance].Info[RRC_MAC_IN_SYNC_IND (msg_p).enb_index].T310_active == 1) - UE_rrc_inst[instance].Info[RRC_MAC_IN_SYNC_IND (msg_p).enb_index].N311_cnt++; - break; - - case RRC_MAC_OUT_OF_SYNC_IND: - LOG_D(RRC, "Received %s: instance %d, frame %d, eNB %d\n", msg_name, instance, - RRC_MAC_OUT_OF_SYNC_IND (msg_p).frame, RRC_MAC_OUT_OF_SYNC_IND (msg_p).enb_index); - - UE_rrc_inst[instance].Info[RRC_MAC_OUT_OF_SYNC_IND (msg_p).enb_index].N310_cnt ++; - break; - - case RRC_MAC_BCCH_DATA_IND: - LOG_D(RRC, "Received %s: instance %d, frame %d, eNB %d\n", msg_name, instance, - RRC_MAC_BCCH_DATA_IND (msg_p).frame, RRC_MAC_BCCH_DATA_IND (msg_p).enb_index); - - decode_BCCH_DLSCH_Message (instance, RRC_MAC_BCCH_DATA_IND (msg_p).frame, - RRC_MAC_BCCH_DATA_IND (msg_p).enb_index, RRC_MAC_BCCH_DATA_IND (msg_p).sdu_p, - RRC_MAC_BCCH_DATA_IND (msg_p).sdu_size); - - // Message buffer has been processed, free it now. - free (RRC_MAC_BCCH_DATA_IND (msg_p).sdu_p); - break; - - case RRC_MAC_CCCH_DATA_IND: - LOG_D(RRC, "Received %s: instance %d, frame %d, eNB %d\n", msg_name, instance, - RRC_MAC_CCCH_DATA_IND (msg_p).frame, RRC_MAC_CCCH_DATA_IND (msg_p).enb_index); - - srb_info_p = &UE_rrc_inst[instance].Srb0[RRC_MAC_CCCH_DATA_IND (msg_p).enb_index]; - - memcpy (srb_info_p->Rx_buffer.Payload, RRC_MAC_CCCH_DATA_IND (msg_p).sdu_p, - RRC_MAC_CCCH_DATA_IND (msg_p).sdu_size); - srb_info_p->Rx_buffer.payload_size = RRC_MAC_CCCH_DATA_IND (msg_p).sdu_size; - rrc_ue_decode_ccch (instance, RRC_MAC_CCCH_DATA_IND (msg_p).frame, srb_info_p, - RRC_MAC_CCCH_DATA_IND (msg_p).enb_index); - - // Message buffer has been processed, free it now. - free (RRC_MAC_CCCH_DATA_IND (msg_p).sdu_p); - break; - - case RRC_MAC_CCCH_SUCCESS_IND: - LOG_D(RRC, "Received %s: instance %d, eNB %d\n", msg_name, instance, - RRC_MAC_CCCH_SUCCESS_IND (msg_p).enb_index); - - // reset the tx buffer to indicate RRC that ccch was successfully transmitted (for example if contention resolution succeeds) - UE_rrc_inst[instance].Srb0[RRC_MAC_CCCH_SUCCESS_IND (msg_p).enb_index].Tx_buffer.payload_size = 0; - break; - -#ifdef Rel10 - case RRC_MAC_MCCH_DATA_IND: - LOG_D(RRC, "Received %s: instance %d, frame %d, eNB %d, mbsfn SA %d\n", msg_name, instance, - RRC_MAC_MCCH_DATA_IND (msg_p).frame, RRC_MAC_MCCH_DATA_IND (msg_p).eNB_index, RRC_MAC_MCCH_DATA_IND (msg_p).mbsfn_sync_area); - - decode_MCCH_Message (instance, RRC_MAC_MCCH_DATA_IND (msg_p).frame, RRC_MAC_MCCH_DATA_IND (msg_p).eNB_index, - RRC_MAC_MCCH_DATA_IND (msg_p).sdu_p, RRC_MAC_MCCH_DATA_IND (msg_p).sdu_size, - RRC_MAC_MCCH_DATA_IND (msg_p).mbsfn_sync_area); - - // Message buffer has been processed, free it now. - free (RRC_MAC_MCCH_DATA_IND (msg_p).sdu_p); - break; -#endif - - case RRC_DCCH_DATA_IND: - LOG_D(RRC, "Received %s: instance %d, frame %d, DCCH %d, UE %d\n", msg_name, instance, - RRC_DCCH_DATA_IND (msg_p).frame, RRC_DCCH_DATA_IND (msg_p).dcch_index, RRC_DCCH_DATA_IND (msg_p).ue_index); - - rrc_ue_decode_dcch (instance, RRC_DCCH_DATA_IND (msg_p).frame, - RRC_DCCH_DATA_IND (msg_p).dcch_index, RRC_DCCH_DATA_IND (msg_p).sdu_p, - RRC_DCCH_DATA_IND (msg_p).ue_index); - - // Message buffer has been processed, free it now. - free (RRC_DCCH_DATA_IND (msg_p).sdu_p); - break; - - default: - LOG_E(RRC, "Received unexpected message %s\n", msg_name); - break; - } - - free (msg_p); - } -} -#endif diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LITE/rrc_eNB.c index 45457e19878e1b54d7e1436561033aa99b65d009..de397213d8f20f3d739692d9a617de2d5fbcbefa 100644 --- a/openair2/RRC/LITE/rrc_eNB.c +++ b/openair2/RRC/LITE/rrc_eNB.c @@ -72,6 +72,12 @@ #include "../../S1AP/s1ap_eNB.h" #endif +#include "pdcp.h" + +#if defined(ENABLE_ITTI) +# include "intertask_interface.h" +#endif + //#define XER_PRINT #ifdef PHY_EMUL @@ -89,7 +95,9 @@ init_SI (u8 Mod_id) { u8 SIwindowsize = 1; u16 SIperiod = 8; +#ifdef Rel10 int i; +#endif /* uint32_t mib=0; int i; @@ -1085,8 +1093,8 @@ rrc_eNB_generate_SecurityModeCommand (u8 Mod_id, u32 frame, u16 UE_index) frame, Mod_id, size, UE_index, rrc_eNB_mui, Mod_id, (UE_index * NB_RB_MAX) + DCCH); //rrc_rlc_data_req(Mod_id,frame, 1,(UE_index*NB_RB_MAX)+DCCH,rrc_eNB_mui++,0,size,(char*)buffer); - pdcp_data_req (Mod_id, frame, 1, (UE_index * NB_RB_MAX) + DCCH, - rrc_eNB_mui++, 0, size, (char *) buffer, 1); + pdcp_rrc_data_req (Mod_id, frame, 1, (UE_index * NB_RB_MAX) + DCCH, + rrc_eNB_mui++, 0, size, buffer, 1); } @@ -1110,8 +1118,8 @@ rrc_eNB_generate_UECapabilityEnquiry (u8 Mod_id, u32 frame, u16 UE_index) frame, Mod_id, size, UE_index, rrc_eNB_mui, Mod_id, (UE_index * NB_RB_MAX) + DCCH); //rrc_rlc_data_req(Mod_id,frame, 1,(UE_index*NB_RB_MAX)+DCCH,rrc_eNB_mui++,0,size,(char*)buffer); - pdcp_data_req (Mod_id, frame, 1, (UE_index * NB_RB_MAX) + DCCH, - rrc_eNB_mui++, 0, size, (char *) buffer, 1); + pdcp_rrc_data_req (Mod_id, frame, 1, (UE_index * NB_RB_MAX) + DCCH, + rrc_eNB_mui++, 0, size, buffer, 1); } @@ -1167,8 +1175,8 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration (u8 Mod_id, u32 frame, long *logicalchannelgroup, *logicalchannelgroup_drb; long *maxHARQ_Tx, *periodicBSR_Timer; - RSRP_Range_t *rsrp; - struct MeasConfig__speedStatePars *Sparams; + // RSRP_Range_t *rsrp; + // struct MeasConfig__speedStatePars *Sparams; CellsToAddMod_t *CellToAdd; CellsToAddModList_t *CellsToAddModList; @@ -1600,8 +1608,8 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration (u8 Mod_id, u32 frame, frame, Mod_id, size, UE_index, rrc_eNB_mui, Mod_id, (UE_index * NB_RB_MAX) + DCCH); //rrc_rlc_data_req(Mod_id,frame, 1,(UE_index*NB_RB_MAX)+DCCH,rrc_eNB_mui++,0,size,(char*)buffer); - pdcp_data_req (Mod_id, frame, 1, (UE_index * NB_RB_MAX) + DCCH, - rrc_eNB_mui++, 0, size, (char *) buffer, 1); + pdcp_rrc_data_req (Mod_id, frame, 1, (UE_index * NB_RB_MAX) + DCCH, + rrc_eNB_mui++, 0, size, buffer, 1); } @@ -1980,3 +1988,65 @@ rrc_eNB_generate_RRCConnectionSetup (u8 Mod_id, u32 frame, u16 UE_index) #ifndef USER_MODE EXPORT_SYMBOL (Rlc_info_am_config); #endif + +#if defined(ENABLE_ITTI) +void *rrc_enb_task(void *args_p) { + MessageDef *msg_p; + char *msg_name; + instance_t instance; + SRB_INFO *srb_info_p; + + itti_mark_task_ready (TASK_RRC_ENB); + + while(1) { + // Wait for a message + itti_receive_msg (TASK_RRC_ENB, &msg_p); + + msg_name = ITTI_MSG_NAME (msg_p); + instance = ITTI_MSG_INSTANCE (msg_p); + + switch (msg_p->header.messageId) { + case TERMINATE_MESSAGE: + itti_exit_task (); + break; + + case MESSAGE_TEST: + LOG_D(RRC, "Received %s\n", msg_name); + break; + + case RRC_MAC_CCCH_DATA_IND: + LOG_D(RRC, "Received %s: instance %d, frame %d,\n", msg_name, instance, + RRC_MAC_CCCH_DATA_IND (msg_p).frame); + + srb_info_p = &eNB_rrc_inst[instance].Srb0; + + memcpy (srb_info_p->Rx_buffer.Payload, RRC_MAC_CCCH_DATA_IND (msg_p).sdu_p, + RRC_MAC_CCCH_DATA_IND (msg_p).sdu_size); + srb_info_p->Rx_buffer.payload_size = RRC_MAC_CCCH_DATA_IND (msg_p).sdu_size; + rrc_eNB_decode_ccch (instance, RRC_MAC_CCCH_DATA_IND (msg_p).frame, srb_info_p); + + // Message buffer has been processed, free it now. + free (RRC_MAC_CCCH_DATA_IND (msg_p).sdu_p); + break; + + case RRC_DCCH_DATA_IND: + LOG_D(RRC, "Received %s: instance %d, frame %d, DCCH %d, UE %d\n", msg_name, instance, + RRC_DCCH_DATA_IND (msg_p).frame, RRC_DCCH_DATA_IND (msg_p).dcch_index, RRC_DCCH_DATA_IND (msg_p).ue_index); + + rrc_eNB_decode_dcch (instance, RRC_DCCH_DATA_IND (msg_p).frame, RRC_DCCH_DATA_IND (msg_p).dcch_index, + RRC_DCCH_DATA_IND (msg_p).ue_index, RRC_DCCH_DATA_IND (msg_p).sdu_p, + RRC_DCCH_DATA_IND (msg_p).sdu_size); + + // Message buffer has been processed, free it now. + free (RRC_DCCH_DATA_IND (msg_p).sdu_p); + break; + + default: + LOG_E(RRC, "Received unexpected message %s\n", msg_name); + break; + } + + free (msg_p); + } +} +#endif diff --git a/targets/SIMU/USER/oaisim_functions.c b/targets/SIMU/USER/oaisim_functions.c index cb65a9222455e4040ca2f1ae08ecadd3f6516dbd..60b5ed9984457c1def01f7789c2207e559180d51 100644 --- a/targets/SIMU/USER/oaisim_functions.c +++ b/targets/SIMU/USER/oaisim_functions.c @@ -574,10 +574,20 @@ void init_openair2() { s32 UE_id; #if defined(ENABLE_ITTI) - if (itti_create_task(TASK_RRC_UE, rrc_ue_task, NULL) < 0) { - LOG_E(EMU, "Create task failed"); - LOG_D(EMU, "Initializing RRC UE task interface: FAILED\n"); - exit (-1);; + if (NB_eNB_INST > 0) { + if (itti_create_task (TASK_RRC_ENB, rrc_enb_task, NULL) < 0) { + LOG_E(EMU, "Create task failed"); + LOG_D(EMU, "Initializing RRC eNB task interface: FAILED\n"); + exit (-1); + } + } + + if (NB_UE_INST > 0) { + if (itti_create_task (TASK_RRC_UE, rrc_ue_task, NULL) < 0) { + LOG_E(EMU, "Create task failed"); + LOG_D(EMU, "Initializing RRC UE task interface: FAILED\n"); + exit (-1); + } } #endif