From 30b4c553106ee4b891a901aafa68dbb48619bf86 Mon Sep 17 00:00:00 2001 From: nguyennd <nguyennd@eurecom.fr> Date: Wed, 5 Mar 2014 14:50:38 +0000 Subject: [PATCH] LGAUTHIER, Duy, OK for e-MBMS, may be one remaining problem with stats git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5121 818b1a75-f10b-46b9-bf7c-635c3b92a50f --- openair2/COMMON/mac_rrc_primitives.h | 38 ++-- openair2/COMMON/platform_constants.h | 21 +- openair2/LAYER2/MAC/eNB_scheduler.c | 63 +++--- openair2/LAYER2/MAC/ue_procedures.c | 81 ++++---- openair2/LAYER2/PDCP_v10.1.0/pdcp.c | 115 +++++++---- openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c | 14 +- openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c | 18 +- .../RLC/UM_v9.3.0/rlc_um_control_primitives.c | 46 +++-- .../LAYER2/RLC/UM_v9.3.0/rlc_um_segment.c | 9 +- openair2/LAYER2/RLC/rlc.c | 187 +++++++++++------- openair2/LAYER2/RLC/rlc.h | 24 ++- openair2/LAYER2/RLC/rlc_mac.c | 30 +-- openair2/LAYER2/RLC/rlc_rrc.c | 38 ++-- openair2/RRC/LITE/MESSAGES/asn1_msg.c | 2 +- openair2/UTIL/MEM/mem_block.h | 2 +- openair2/UTIL/OTG/otg_rx.c | 160 +++++++-------- targets/PROJECTS/E-MBMS/start_enb.bash | 36 ++-- targets/SIMU/USER/oaisim_config.c | 12 +- 18 files changed, 546 insertions(+), 350 deletions(-) diff --git a/openair2/COMMON/mac_rrc_primitives.h b/openair2/COMMON/mac_rrc_primitives.h index 9fbff010ad8..f78cf2cd083 100644 --- a/openair2/COMMON/mac_rrc_primitives.h +++ b/openair2/COMMON/mac_rrc_primitives.h @@ -26,10 +26,10 @@ ________________________________________________________________*/ #endif //#include "rrm_config_structs.h" //#include "platform_types.h" -/** @defgroup _mac_rrc_primitives_ MAC Layer Primitives for Communications with RRC +/** @defgroup _mac_rrc_primitives_ MAC Layer Primitives for Communications with RRC * @ingroup _openair_mac_layer_specs_ * @{ -This subclause describes the primitives for communications between the RRC and MAC sub-layers. +This subclause describes the primitives for communications between the RRC and MAC sub-layers. This subclause describes the primitives for communications between the RRC and MAC sub-layers. @@ -39,7 +39,7 @@ The primitives responsible for relaying of radio and traffic measurements to the RRC signaling are : -# MAC_MEAS_REQ: enables RRC to request a measurement process in the MAC (one-shot, periodic or event-driven). This configures a measurement process in the MAC. --# MAC_MEAS_IND: indicates to RRC that a (periodic) measurement request is available. +-# MAC_MEAS_IND: indicates to RRC that a (periodic) measurement request is available. -# MAC_MEAS_CONFIRM: enables RRC to acknowledge a MAC-MEAS-Ind. These associate a set of measurements (described by the MAC_MEAS_t structure) to a particular logical channel. Each measurement has @@ -48,30 +48,30 @@ instantaneous measurement reports. The latter is typically used to signal events negotiated QoS values. These consequently trigger reconfiguration of services by the network. The averaging parameters used by the MAC measurement process is described by the structure MAC_AVG_t. Note that it is the responsibility of the MAC-layer to relay PHY measurements which are directly available to the scheduling entity in the MAC-layer. -RRC does not directly act on the PHY measurement sub-system. +RRC does not directly act on the PHY measurement sub-system. The primitives responsible for logical channel MAC configuration by the radio resource manager via RRC signaling are -# MAC_CONFIG_REQ: enables RRC to configure a new logical channel description at the MAC layer. The associated QoS -descriptor (MAC_LCHAN_DESC contains the parameters defining the logical channel resource scheduling. +descriptor (MAC_LCHAN_DESC contains the parameters defining the logical channel resource scheduling. -# MAC_CONFIG_CONFIRM: indicates to RRC that a given logical channel has or has not been configured. The primitives responsible for indicating data synchronization (or loss of) to RRC are -# MAC_SYNC : indicates to RRC that a physical link for a newly established logical channel has been used (reception) with success. The parameter passed indicates the logical channel id. This represents the event of successfully decoding a particular logical -channel for the first time. In the event that several logical channels share the same physical resources (e.g. BCCH and CCCH), it +channel for the first time. In the event that several logical channels share the same physical resources (e.g. BCCH and CCCH), it shall only be sent for the logical channel with the lowest id. -# MAC_OUT_OF_SYNC : UE primitive indicating to RRC that a physical link for a particular Node-B has been lossed. The parameter passed indicates the id of the Node-B. This represents the event of detecting an unacceptable error rate on the CHBCH of the Node-B in question. -and can be used in the case of handover between Node-B's. Note that this message is redundant since an equivalent way of obtaining the same +and can be used in the case of handover between Node-B's. Note that this message is redundant since an equivalent way of obtaining the same result could be based on an event-driven measurement report. */ # define NB_SIG_CNX_CH 1 -# define NB_CNX_CH MAX_MOBILES_PER_RG +# define NB_CNX_CH MAX_MOBILES_PER_ENB # define NB_SIG_CNX_UE 2 //MAX_MANAGED_RG_PER_MOBILE -# define NB_CNX_UE 2//MAX_MANAGED_RG_PER_MOBILE +# define NB_CNX_UE 2//MAX_MANAGED_RG_PER_MOBILE #define NUMBER_OF_MEASUREMENT_SUBBANDS 16 @@ -151,7 +151,7 @@ typedef struct { typedef struct { //LCHAN_ID Lchan_id; /*!< \brief Logical Channel ID*/ //unsigned short Process_id; /*!< \brief Id of new MAC measurement process*/ - char Meas_status; /*!< \brief Status (0-positive, 1-negative)*/ + char Meas_status; /*!< \brief Status (0-positive, 1-negative)*/ }__attribute__ ((__packed__)) MAC_MEAS_CONFIRM; /*!\brief This primitive parametrizes a MAC measurement process @@ -221,7 +221,7 @@ typedef struct { uint8_t Lchan_t; /*!< \brief Logical Channel Type (BCCH,CCCH,DCCH,DTCH_B,DTCH,MRBCH)*/ }__attribute__ ((__packed__)) LCHAN_DESC; -#define LCHAN_DESC_SIZE sizeof(LCHAN_DESC) +#define LCHAN_DESC_SIZE sizeof(LCHAN_DESC) /*!\brief This primitive indicates to RRC that a particular logical channel has been established and that successful transmission has been received. The parameter passed is the logical channel id. @@ -240,7 +240,7 @@ typedef struct MAC_OUT_OF_SYNC { /*!\brief This primitive enables RRC to configure a new logical channel description at the MAC layer. */ -typedef struct{ +typedef struct{ LCHAN_ID Lchan_id; /*!< \brief Logical Channel ID*/ // unsigned short UE_eNB_index; //ID of CH who configued the LC (Need this to identify LC in the UE side) uint8_t Lchan_type; // DCCH_LCHAN, DTCH_LCHAN @@ -250,7 +250,7 @@ typedef struct{ //#ifndef CELLULAR unsigned short UE_eNB_index; //#endif -}__attribute__ ((__packed__)) MAC_CONFIG_REQ; +}__attribute__ ((__packed__)) MAC_CONFIG_REQ; #define MAC_CONFIG_REQ_SIZE sizeof(MAC_CONFIG_REQ) @@ -279,7 +279,7 @@ typedef struct { uint8_t Forg_fact; unsigned short Rep_interval; uint8_t Status; - unsigned int Last_report_frame; + unsigned int Last_report_frame; unsigned int Next_check_frame; uint8_t Active; }__attribute__ ((__packed__)) DEFAULT_UE_MEAS; @@ -307,7 +307,7 @@ typedef struct { uint8_t Forg_fact; unsigned short Rep_interval; unsigned int Last_report_frame; - unsigned int Next_check_frame; + unsigned int Next_check_frame; uint8_t Status; //IDLE,NEED_rADIO_CONFIG, RADIO_CONFIG_TX, RADIO_CONFIG_ok uint8_t Active; }__attribute__ ((__packed__)) DEFAULT_CH_MEAS; @@ -329,7 +329,7 @@ typedef struct{ //RRC_INTERFACE_FUNCTIONS // L2_ID UE_id[NB_MODULES_MAX][NB_CNX_CH]; uint8_t UE_id[NB_MODULES_MAX][NB_CNX_CH][5]; #endif - void (*openair_rrc_top_init)(void); + void (*openair_rrc_top_init)(void); char (*openair_rrc_eNB_init)(uint8_t ); char (*openair_rrc_UE_init)(uint8_t, uint8_t); RRC_status_t (*rrc_rx_tx)(uint8_t,uint32_t,uint8_t,uint8_t); @@ -354,7 +354,7 @@ typedef struct{ void (*mac_out_of_sync_ind)(uint8_t,uint32_t,unsigned short); //RLC_INTERFACE_FUNCTIONS void (*pdcp_run)(void); - void (*pdcp_data_req)(module_id_t, rb_id_t, sdu_size_t, char*); + void (*pdcp_data_req)(module_id_t, rb_id_t, sdu_size_t, char*); signed int (*rrc_rlc_config_req)(unsigned int, unsigned int, unsigned int, unsigned int, rlc_info_t ); int (*rrc_mac_config_req)(uint8_t Mod_id,uint8_t eNB_flag,uint8_t UE_id,uint8_t eNB_index, RadioResourceConfigCommonSIB_t *radioResourceConfigCommon, @@ -362,7 +362,7 @@ typedef struct{ MAC_MainConfig_t *mac_MainConfig, long logicalChannelIdentity, LogicalChannelConfig_t *logicalChannelConfig, - MeasGapConfig_t *measGapConfig, + MeasGapConfig_t *measGapConfig, TDD_Config_t *tdd_Config, uint8_t *SIwindowsize, uint16_t *SIperiod @@ -398,7 +398,7 @@ typedef struct{ #define MEAS_OK 5 #define MEAS_TRIGGER 6 #define RRC_MEAS_REPORT_REQ 7 -#define MEAS_REPORT 8 +#define MEAS_REPORT 8 #define RAB_MEAS_IND 0 #define DEF_MEAS_IND 1 diff --git a/openair2/COMMON/platform_constants.h b/openair2/COMMON/platform_constants.h index 88b758e625d..b1051c30de8 100755 --- a/openair2/COMMON/platform_constants.h +++ b/openair2/COMMON/platform_constants.h @@ -33,9 +33,9 @@ #else # if defined(OAI_NW_DRIVER_TYPE_ETHERNET) /* SR: When using ethernet network driver the packet size is 1512 : - * 1500 bytes IP packet + 12 bytes ethernet header + * 1500 bytes IP packet + 14 bytes ethernet header */ -# define MAX_IP_PACKET_SIZE 1512 +# define MAX_IP_PACKET_SIZE 1514 # else # define MAX_IP_PACKET_SIZE 1500 // 3000 # endif @@ -45,17 +45,24 @@ # define MAX_MODULES NB_MODULES_MAX #ifdef LARGE_SCALE -# define MAX_MOBILES_PER_RG 128 -# define MAX_RG 2 +# define MAX_MOBILES_PER_ENB 128 +//# define MAX_RG 2 #else -# define MAX_MOBILES_PER_RG 16 -# define MAX_RG 2 +# define MAX_MOBILES_PER_ENB 16 +//# define MAX_RG 2 #endif -#define MAX_MANAGED_RG_PER_MOBILE 2 +#define MAX_MANAGED_ENB_PER_MOBILE 2 #define DEFAULT_RAB_ID 3 + #define NB_RB_MAX (maxDRB + 3) /* was 11, now 14, maxDRB comes from asn1_constants.h, + 3 because of 3 SRB, one invisible id 0, then id 1 and 2 */ +#if defined(Rel10) +#define NB_RB_MBMS_MAX (maxSessionPerPMCH*maxServiceCount) +#else +// Do not allocate unused memory +#define NB_RB_MBMS_MAX 1 +#endif #define NB_RAB_MAX maxDRB /* was 8, now 11 */ #define RAB_SHIFT1 9 #define RAB_SHIFT2 3 diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index 5075cbb0d67..934bc528079 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -382,7 +382,7 @@ uint8_t find_num_active_UEs_in_cbagroup(module_id_t module_idP, unsigned char gr } return(nb_ue_in_pusch); } -#endif +#endif int8_t add_new_ue(module_id_t enb_mod_idP, rnti_t rntiP) { module_id_t ue_mod_id; int j; @@ -530,7 +530,7 @@ void rx_sdu(module_id_t enb_mod_idP,frame_t frameP,rnti_t rntiP,uint8_t *sdu, ui module_id_t ue_mod_id = find_UE_id(enb_mod_idP,rntiP); int ii,j; start_meas(&eNB_mac_inst[enb_mod_idP].rx_ulsch_sdu); - + for(ii=0; ii<NB_RB_MAX; ii++) rx_lengths[ii] = 0; vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_RX_SDU,1); @@ -989,7 +989,7 @@ void add_ue_spec_dci(DCI_PDU *DCI_pdu,void *pdu,rnti_t rnti,unsigned char dci_si void schedule_SI(module_id_t module_idP,frame_t frameP, unsigned char *nprb,unsigned int *nCCE) { start_meas(&eNB_mac_inst[module_idP].schedule_si); - + unsigned char bcch_sdu_length; int mcs = -1; void *BCCH_alloc_pdu=(void*)&eNB_mac_inst[module_idP].BCCH_alloc_pdu; @@ -1451,6 +1451,19 @@ int schedule_MBMS(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) else { // only MTCH in this subframeP TBS = mac_xface->get_TBS(eNB_mac_inst[module_idP].pmch_Config[0]->dataMCS_r9, mac_xface->lte_frame_parms->N_RB_DL); } + + // get MTCH data from RLC (like for DTCH) + LOG_D(MAC,"[eNB %d] Frame %d subframe %d: Schedule MTCH (area %d, sfAlloc %d)\n",Mod_id,frame,subframe,i,j); + + header_len_mtch = 3; + LOG_D(MAC,"[eNB %d], Frame %d, MTCH->MCH, Checking RLC status (rab %d, tbs %d, len %d)\n", + Mod_id,frame,MTCH,TBS, + TBS-header_len_mcch-header_len_msi-sdu_length_total-header_len_mtch); + + rlc_status = mac_rlc_status_ind(Mod_id,frame,1,RLC_MBMS_YES,MTCH+ (maxDRB + 3) * MAX_MOBILES_PER_RG, + TBS-header_len_mcch-header_len_msi-sdu_length_total-header_len_mtch); + printf("frame %d, subframe %d, rlc_status.bytes_in_buffer is %d\n",frame,subframe, rlc_status.bytes_in_buffer); + */ // get MTCH data from RLC (like for DTCH) @@ -1461,16 +1474,22 @@ int schedule_MBMS(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP) module_idP,frameP,MTCH,TBS, TBS-header_len_mcch-header_len_msi-sdu_length_total-header_len_mtch); - rlc_status = mac_rlc_status_ind(module_idP,0,frameP,ENB_FLAG_YES,MBMS_FLAG_YES,MTCH+ (maxDRB + 3) * MAX_MOBILES_PER_RG, + rlc_status = mac_rlc_status_ind(module_idP,0,frameP,ENB_FLAG_YES,MBMS_FLAG_YES,MTCH, TBS-header_len_mcch-header_len_msi-sdu_length_total-header_len_mtch); - //printf("frameP %d, subframeP %d, rlc_status.bytes_in_buffer is %d\n",frameP,subframeP, rlc_status.bytes_in_buffer); + LOG_D(MAC,"e-MBMS log channel %u frameP %d, subframeP %d, rlc_status.bytes_in_buffer is %d\n", + MTCH,frameP,subframeP, rlc_status.bytes_in_buffer); if (rlc_status.bytes_in_buffer >0) { LOG_I(MAC,"[eNB %d][MBMS USER-PLANE], Frame %d, MTCH->MCH, Requesting %d bytes from RLC (header len mtch %d)\n", module_idP,frameP,TBS-header_len_mcch-header_len_msi-sdu_length_total-header_len_mtch,header_len_mtch); - sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP, 0, frameP, ENB_FLAG_YES, MBMS_FLAG_YES, - MTCH + (maxDRB + 3) * MAX_MOBILES_PER_RG, + sdu_lengths[num_sdus] = mac_rlc_data_req( + module_idP, + 0, + frameP, + ENB_FLAG_YES, + MBMS_FLAG_YES, + MTCH, (char*)&mch_buffer[sdu_length_total]); //sdu_lengths[num_sdus] = mac_rlc_data_req(module_idP,frameP, MBMS_FLAG_NO, MTCH+(MAX_NUM_RB*(NUMBER_OF_UE_MAX+1)), (char*)&mch_buffer[sdu_length_total]); LOG_I(MAC,"[eNB %d][MBMS USER-PLANE] Got %d bytes for MTCH %d\n",module_idP,sdu_lengths[num_sdus],MTCH); @@ -2024,7 +2043,7 @@ void schedule_ulsch(module_id_t module_idP, frame_t frameP,unsigned char coopera #ifdef CBA if ((eNB_mac_inst[module_idP].num_active_cba_groups > 0) && (*nCCE == 0)) schedule_ulsch_cba_rnti(module_idP, cooperation_flag, frameP, subframeP, sched_subframe, granted_UEs, nCCE, &nCCE_available, &first_rb); -#endif +#endif stop_meas(&eNB_mac_inst[module_idP].schedule_ulsch); } @@ -2224,7 +2243,7 @@ void schedule_ulsch_rnti(module_id_t module_idP, // if there is information on bsr of DCCH, DTCH or if there is UL_SR, or if there is a packet to retransmit, or we want to schedule a periodic feedback every 10 frames #else if (round==0) -#endif +#endif { LOG_D(MAC,"[eNB %d][PUSCH %x] Frame %d subframeP %d Scheduling UE %d (SR %d)\n", module_idP,rnti,frameP,subframeP,ue_mod_id, @@ -2238,7 +2257,7 @@ void schedule_ulsch_rnti(module_id_t module_idP, status = mac_get_rrc_status(module_idP,1,next_ue); -#ifndef EXMIMO_IOT +#ifndef EXMIMO_IOT if (status < RRC_CONNECTED) cqi_req = 0; else @@ -2669,7 +2688,7 @@ uint32_t allocate_prbs_sub(int nb_rb, uint8_t *rballoc) { void fill_DLSCH_dci(module_id_t module_idP,frame_t frameP, sub_frame_t subframeP,uint32_t RBalloc,uint8_t RA_scheduled,int mbsfn_flag) { - + // loop over all allocated UEs and compute frequency allocations for PDSCH module_id_t ue_mod_id = -1; uint8_t first_rb,nb_rb=3; @@ -2689,9 +2708,9 @@ void fill_DLSCH_dci(module_id_t module_idP,frame_t frameP, sub_frame_t subframeP if (mbsfn_flag>0) return; - + start_meas(&eNB_mac_inst[module_idP].fill_DLSCH_dci); - + // clear vrb_map memset(vrb_map,0,100); @@ -3454,10 +3473,10 @@ void schedule_ue_spec(module_id_t module_idP, int mcs; uint16_t min_rb_unit; short ta_update = 0; - + if (mbsfn_flag>0) return; - + reset_meas(&eNB_mac_inst[module_idP].schedule_dlsch); switch (mac_xface->lte_frame_parms->N_RB_DL) { @@ -3519,7 +3538,7 @@ void schedule_ue_spec(module_id_t module_idP, /// CALLING Pre_Processor for downlink scheduling (Returns estimation of RBs required by each UE and the allocation on sub-band) - start_meas(&eNB_mac_inst[module_idP].schedule_dlsch_preprocessor); + start_meas(&eNB_mac_inst[module_idP].schedule_dlsch_preprocessor); dlsch_scheduler_pre_processor(module_idP, frameP, subframeP, @@ -3527,7 +3546,7 @@ void schedule_ue_spec(module_id_t module_idP, pre_nb_available_rbs, mac_xface->lte_frame_parms->N_RBGS, rballoc_sub_UE); - stop_meas(&eNB_mac_inst[module_idP].schedule_dlsch_preprocessor); + stop_meas(&eNB_mac_inst[module_idP].schedule_dlsch_preprocessor); for (ue_mod_id=0;ue_mod_id<granted_UEs;ue_mod_id++) { @@ -3615,9 +3634,9 @@ void schedule_ue_spec(module_id_t module_idP, eNB_UE_stats->dlsch_mcs1 = cqi_to_mcs[eNB_UE_stats->DL_cqi[0]]; LOG_T(MAC,"CQI %d\n",eNB_UE_stats->DL_cqi[0]); } - else + else eNB_UE_stats->dlsch_mcs1 = openair_daq_vars.target_ue_dl_mcs; - + if(eNB_UE_stats->dlsch_mcs1>22) eNB_UE_stats->dlsch_mcs1=22; @@ -4306,7 +4325,7 @@ void schedule_ue_spec(module_id_t module_idP, } void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, frame_t frameP, sub_frame_t subframeP) {//, int calibration_flag) { - + start_meas(&eNB_mac_inst[module_idP].eNB_scheduler); unsigned char nprb=0; unsigned int nCCE=0; @@ -4391,7 +4410,7 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, eNB_mac_inst[module_idP].subframe = subframeP; //if (subframeP%5 == 0) -#ifdef EXMIMO +#ifdef EXMIMO pdcp_run(frameP, 1, 0, module_idP); /* ret = pthread_mutex_trylock (&pdcp_mutex); @@ -4709,5 +4728,5 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP,uint8_t cooperation_flag, vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER,0); stop_meas(&eNB_mac_inst[module_idP].eNB_scheduler); - + } diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index d878c9a3175..e52adee9e28 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -297,7 +297,7 @@ void ue_send_sdu(module_id_t module_idP,frame_t frameP,uint8_t *sdu,uint16_t sdu LOG_T(MAC,"[eNB %d] First 32 bytes of DLSCH : \n"); for (i=0;i<32;i++) LOG_T(MAC,"%x.",sdu[i]); - LOG_T(MAC,"\n"); + LOG_T(MAC,"\n"); #endif for (i=0;i<num_ce;i++) { @@ -356,7 +356,7 @@ void ue_send_sdu(module_id_t module_idP,frame_t frameP,uint8_t *sdu,uint16_t sdu for (j=0;j<rx_lengths[i];j++) LOG_T(MAC,"%x.",(uint8_t)payload_ptr[j]); LOG_T(MAC,"\n"); -#endif +#endif mac_rrc_data_ind(module_idP, frameP, CCCH, @@ -485,12 +485,12 @@ unsigned char *parse_mch_header(unsigned char *mac_header, void ue_send_mch_sdu(module_id_t module_idP, frame_t frameP, uint8_t *sdu, uint16_t sdu_len, uint8_t eNB_index, uint8_t sync_area) { unsigned char num_sdu, i, *payload_ptr; - unsigned char rx_lcids[NB_RB_MAX]; + unsigned char rx_lcids[NB_RB_MAX]; unsigned short rx_lengths[NB_RB_MAX]; - start_meas(&UE_mac_inst[module_idP].rx_mch_sdu); + start_meas(&UE_mac_inst[module_idP].rx_mch_sdu); vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SEND_MCH_SDU, VCD_FUNCTION_IN); - + LOG_D(MAC,"[UE %d] Frame %d : process the mch PDU for sync area %d \n",module_idP,frameP, sync_area); LOG_D(MAC,"[UE %d] sdu: %x.%x\n", module_idP,sdu[0], sdu[1]); LOG_D(MAC,"[UE %d] parse_mch_header, demultiplex\n",module_idP); @@ -525,7 +525,7 @@ void ue_send_mch_sdu(module_id_t module_idP, frame_t frameP, uint8_t *sdu, uint1 frameP, ENB_FLAG_NO, MBMS_FLAG_YES, - MTCH + (maxDRB + 3), + MTCH, /*+ (maxDRB + 3),*/ (char *)payload_ptr, rx_lengths[i], 1, @@ -533,7 +533,12 @@ void ue_send_mch_sdu(module_id_t module_idP, frame_t frameP, uint8_t *sdu, uint1 } } else { - LOG_W(MAC,"[UE %d] Frame %d : unknown sdu %d mcch status %d eNB %d \n",module_idP,frameP,rx_lengths[i], + LOG_W(MAC,"[UE %d] Frame %d : unknown sdu %d rx_lcids[%d]=%d mcch status %d eNB %d \n", + module_idP, + frameP, + rx_lengths[i], + i, + rx_lcids[i], UE_mac_inst[module_idP].mcch_status, eNB_index); } @@ -541,7 +546,7 @@ void ue_send_mch_sdu(module_id_t module_idP, frame_t frameP, uint8_t *sdu, uint1 } vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SEND_MCH_SDU, VCD_FUNCTION_OUT); - stop_meas(&UE_mac_inst[module_idP].rx_mch_sdu); + stop_meas(&UE_mac_inst[module_idP].rx_mch_sdu); } int8_t ue_get_mbsfn_sf_alloction (module_id_t module_idP, uint8_t mbsfn_sync_area, unsigned char eNB_index){ @@ -551,7 +556,7 @@ int8_t ue_get_mbsfn_sf_alloction (module_id_t module_idP, uint8_t mbsfn_sync_are return -1; } else if (UE_mac_inst[module_idP].mbsfn_SubframeConfig[mbsfn_sync_area] != NULL) - return mbsfn_sync_area; + return mbsfn_sync_area; else { LOG_W(MAC,"[UE %d] MBSFN Subframe Config pattern %d not found \n ", module_idP, mbsfn_sync_area); return -1; @@ -565,13 +570,13 @@ int ue_query_mch(module_id_t module_idP, uint32_t frameP, uint32_t subframe, uin int mbsfn_period = 0;// 1<<(UE_mac_inst[module_idP].mbsfn_SubframeConfig[0]->radioframeAllocationPeriod); int mcch_period = 0;// 32<<(UE_mac_inst[module_idP].mbsfn_AreaInfo[0]->mcch_Config_r9.mcch_RepetitionPeriod_r9); int mch_scheduling_period = -1; - - start_meas(&UE_mac_inst[module_idP].ue_query_mch); - + + start_meas(&UE_mac_inst[module_idP].ue_query_mch); + if (UE_mac_inst[module_idP].pmch_Config[0]) mch_scheduling_period = 8<<(UE_mac_inst[module_idP].pmch_Config[0]->mch_SchedulingPeriod_r9); - for (i=0; + for (i=0; i< UE_mac_inst[module_idP].num_active_mbsfn_area; i++ ){ // assume, that there is always a mapping @@ -766,7 +771,7 @@ int ue_query_mch(module_id_t module_idP, uint32_t frameP, uint32_t subframe, uin } } // end of for - stop_meas(&UE_mac_inst[module_idP].ue_query_mch); + stop_meas(&UE_mac_inst[module_idP].ue_query_mch); if ( (mcch_flag==1))// || (msi_flag==1)) *mcch_active=1; @@ -775,7 +780,7 @@ int ue_query_mch(module_id_t module_idP, uint32_t frameP, uint32_t subframe, uin return mcch_mcs; } else if ((mtch_flag==1) && (UE_mac_inst[module_idP].msi_status==1)) return UE_mac_inst[module_idP].pmch_Config[0]->dataMCS_r9; - else + else return -1; } @@ -1028,7 +1033,7 @@ void ue_get_sdu(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, uint mac_rlc_status_resp_t rlc_status; uint8_t dcch_header_len=0,dcch1_header_len=0,dtch_header_len=0; uint8_t dcch_header_len_tmp=0, dtch_header_len_tmp=0; - uint8_t bsr_header_len=0, bsr_ce_len=0, bsr_len=0; + uint8_t bsr_header_len=0, bsr_ce_len=0, bsr_len=0; uint8_t phr_header_len=0, phr_ce_len=0,phr_len=0; uint16_t sdu_lengths[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; uint8_t sdu_lcids[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; @@ -1149,7 +1154,7 @@ void ue_get_sdu(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, uint ((UE_mac_inst[module_idP].scheduling_info.BSR_bytes[DTCH]+bsr_len+phr_len+dcch_header_len+dcch1_header_len+dtch_header_len) > buflen)&& buflen >=128 )) dtch_header_len = 3;//sizeof(SCH_SUBHEADER_LONG); - else + else dtch_header_len = 2;//sizeof(SCH_SUBHEADER_SHORT); */ rlc_status = mac_rlc_status_ind(0, module_idP,frameP,ENB_FLAG_NO,MBMS_FLAG_NO, @@ -1215,13 +1220,13 @@ void ue_get_sdu(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, uint LOG_T(MAC,"[UE %d] Frame %d: bsr s %p bsr_l %p, phr_p %p\n", module_idP,frameP,bsr_s, bsr_l, phr_p); - // adjust the header length + // adjust the header length dcch_header_len_tmp = dcch_header_len; dtch_header_len_tmp = dtch_header_len; if (dtch_header_len==0) - dcch_header_len = (dcch_header_len>0)? 1: dcch_header_len; - else - dtch_header_len= (dtch_header_len >0)? 1: dtch_header_len; // for short and long, cut the length+F fields + dcch_header_len = (dcch_header_len>0)? 1: dcch_header_len; + else + dtch_header_len= (dtch_header_len >0)? 1: dtch_header_len; // for short and long, cut the length+F fields if ((buflen-bsr_len-phr_len-dcch_header_len-dcch1_header_len-dtch_header_len-sdu_length_total) <= 2) { short_padding = buflen-bsr_len-phr_len-dcch_header_len-dcch1_header_len-dtch_header_len-sdu_length_total; @@ -1266,7 +1271,7 @@ void ue_get_sdu(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, uint #if defined(USER_MODE) && defined(OAI_EMU) if (oai_emulation.info.opt_enabled) trace_pdu(0, ulsch_buffer, buflen, module_idP, 3, UE_mac_inst[module_idP].crnti, subframe, 0, 0); - LOG_D(OPT,"[UE %d][ULSCH] Frame %d trace pdu for rnti %x with size %d\n", + LOG_D(OPT,"[UE %d][ULSCH] Frame %d trace pdu for rnti %x with size %d\n", module_idP, frameP, UE_mac_inst[module_idP].crnti, buflen); #endif @@ -1295,7 +1300,7 @@ UE_L2_STATE_t ue_scheduler(module_id_t module_idP,frame_t frameP, sub_frame_t su // int8_t lcg_id; struct RACH_ConfigCommon *rach_ConfigCommon = (struct RACH_ConfigCommon *)NULL; #ifdef EXMIMO - int ret; + int ret; #endif #if defined(ENABLE_ITTI) MessageDef *msg_p; @@ -1303,7 +1308,7 @@ UE_L2_STATE_t ue_scheduler(module_id_t module_idP,frame_t frameP, sub_frame_t su instance_t instance; int result; #endif - start_meas(&UE_mac_inst[module_idP].ue_scheduler); + start_meas(&UE_mac_inst[module_idP].ue_scheduler); vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SCHEDULER, VCD_FUNCTION_IN); #if defined(ENABLE_ITTI) @@ -1341,7 +1346,7 @@ UE_L2_STATE_t ue_scheduler(module_id_t module_idP,frame_t frameP, sub_frame_t su //if (subframe%5 == 0) #ifdef EXMIMO pdcp_run(frameP, 0, module_idP, eNB_indexP); -#endif +#endif UE_mac_inst[module_idP].frame = frameP; UE_mac_inst[module_idP].subframe = subframeP; @@ -1357,13 +1362,13 @@ UE_L2_STATE_t ue_scheduler(module_id_t module_idP,frame_t frameP, sub_frame_t su case RRC_ConnSetup_failed: LOG_E(MAC,"RRCConnectionSetup failed, returning to IDLE state\n"); vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SCHEDULER, VCD_FUNCTION_OUT); - stop_meas(&UE_mac_inst[module_idP].ue_scheduler); + stop_meas(&UE_mac_inst[module_idP].ue_scheduler); return(CONNECTION_LOST); break; case RRC_PHY_RESYNCH: LOG_E(MAC,"RRC Loss of synch, returning PHY_RESYNCH\n"); vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SCHEDULER, VCD_FUNCTION_OUT); - stop_meas(&UE_mac_inst[module_idP].ue_scheduler); + stop_meas(&UE_mac_inst[module_idP].ue_scheduler); return(PHY_RESYNCH); case RRC_Handover_failed: LOG_N(MAC,"Handover failure for UE %d eNB_index %d\n",module_idP,eNB_indexP); @@ -1374,12 +1379,12 @@ UE_L2_STATE_t ue_scheduler(module_id_t module_idP,frame_t frameP, sub_frame_t su case RRC_HO_STARTED: LOG_I(MAC,"RRC handover, Instruct PHY to start the contention-free PRACH and synchronization\n"); vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SCHEDULER, VCD_FUNCTION_OUT); - stop_meas(&UE_mac_inst[module_idP].ue_scheduler); + stop_meas(&UE_mac_inst[module_idP].ue_scheduler); return(PHY_HO_PRACH); default: break; } -#endif +#endif // Check Contention resolution timer (put in a function later) if (UE_mac_inst[module_idP].RA_contention_resolution_timer_active == 1) { @@ -1389,7 +1394,7 @@ UE_L2_STATE_t ue_scheduler(module_id_t module_idP,frame_t frameP, sub_frame_t su else { LOG_E(MAC,"FATAL: radioResourceConfigCommon is NULL!!!\n"); vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SCHEDULER, VCD_FUNCTION_OUT); - stop_meas(&UE_mac_inst[module_idP].ue_scheduler); + stop_meas(&UE_mac_inst[module_idP].ue_scheduler); mac_xface->macphy_exit(""); //return(RRC_OK); } @@ -1446,7 +1451,7 @@ UE_L2_STATE_t ue_scheduler(module_id_t module_idP,frame_t frameP, sub_frame_t su UE_mac_inst[module_idP].ul_active=0; LOG_T(MAC,"[UE %d] Release all SRs \n", module_idP); vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SCHEDULER, VCD_FUNCTION_OUT); - stop_meas(&UE_mac_inst[module_idP].ue_scheduler); + stop_meas(&UE_mac_inst[module_idP].ue_scheduler); return(CONNECTION_OK); } @@ -1462,7 +1467,7 @@ UE_L2_STATE_t ue_scheduler(module_id_t module_idP,frame_t frameP, sub_frame_t su } // Put this in a function - // Call PHR procedure as described in Section 5.4.6 in 36.321 + // Call PHR procedure as described in Section 5.4.6 in 36.321 if (UE_mac_inst[module_idP].PHR_state == MAC_MainConfig__phr_Config_PR_setup){ // normal operation if (UE_mac_inst[module_idP].PHR_reconfigured == 1) { // upon (re)configuration of the power headroom reporting functionality by upper layers UE_mac_inst[module_idP].PHR_reporting_active = 1; @@ -1487,13 +1492,13 @@ UE_L2_STATE_t ue_scheduler(module_id_t module_idP,frame_t frameP, sub_frame_t su } //If the UE has UL resources allocated for new transmission for this TTI here: vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SCHEDULER, VCD_FUNCTION_OUT); - stop_meas(&UE_mac_inst[module_idP].ue_scheduler); + stop_meas(&UE_mac_inst[module_idP].ue_scheduler); return(CONNECTION_OK); } // to be improved #ifdef CBA -double uniform_rngen(int min, int max) { +double uniform_rngen(int min, int max) { double random = (double)taus()/((double)0xffffffff); return (max - min) * random + min; } @@ -1550,7 +1555,7 @@ int get_bsr_lcgid (module_id_t module_idP){ return -1; else if (num_active_lcgid == 1) return lcgid_tmp; - else + else return MAX_NUM_LCGID; } @@ -1560,7 +1565,7 @@ uint8_t get_bsr_len (module_id_t module_idP, uint16_t buflen) { uint8_t bsr_len=0, num_lcgid=0; int pdu = 0; - for (lcgid=0; lcgid < MAX_NUM_LCGID; lcgid++ ) { + for (lcgid=0; lcgid < MAX_NUM_LCGID; lcgid++ ) { if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid] > 0 ) pdu += (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid] + bsr_len + 2); //2 = sizeof(SCH_SUBHEADER_SHORT) if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid] > 128 ) // long header size: adjust the header size @@ -1574,7 +1579,7 @@ uint8_t get_bsr_len (module_id_t module_idP, uint16_t buflen) { LOG_D(MAC,"BSR Bytes %d for lcgid %d bsr len %d num lcgid %d\n", UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcgid], lcgid, bsr_len, num_lcgid); } if ( bsr_len > 0 ) - LOG_D(MAC,"[UE %d] Prepare a %s (Transport Block Size %d, MAC pdu Size %d) \n", + LOG_D(MAC,"[UE %d] Prepare a %s (Transport Block Size %d, MAC pdu Size %d) \n", module_idP, map_int_to_str(BSR_names, bsr_len), buflen, pdu); return bsr_len; } @@ -1586,7 +1591,7 @@ boolean_t update_bsr(module_id_t module_idP, frame_t frameP, uint8_t lcid, uint boolean_t sr_pending = FALSE; if ((lcg_id < 0) || (lcg_id > MAX_NUM_LCGID) ) return sr_pending; - // fixme: need a better way to reset + // fixme: need a better way to reset if ((lcid == DCCH) || (lcid == DTCH)){ UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id]=0; UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcg_id]=0; diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index 40a282336d7..9b924c88aad 100755 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -76,8 +76,17 @@ extern int otg_rx_pkt( int src, int dst, int ctime, char *buffer_tx, unsigned in * this mem_block_t to be dissected for testing purposes. For further details see test * code at targets/TEST/PDCP/test_pdcp.c:test_pdcp_data_req() */ -boolean_t pdcp_data_req(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t enb_flagP, rb_id_t rb_idP, mui_t muiP, confirm_t confirmP, - sdu_size_t sdu_buffer_sizeP, unsigned char* sdu_buffer_pP, pdcp_transmission_mode_t modeP) +boolean_t pdcp_data_req( + module_id_t enb_mod_idP, + module_id_t ue_mod_idP, + frame_t frameP, + eNB_flag_t enb_flagP, + rb_id_t rb_idP, + mui_t muiP, + confirm_t confirmP, + sdu_size_t sdu_buffer_sizeP, + unsigned char *sdu_buffer_pP, + pdcp_transmission_mode_t modeP) { //----------------------------------------------------------------------------- pdcp_t *pdcp_p = NULL; @@ -92,7 +101,11 @@ boolean_t pdcp_data_req(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t AssertError (enb_mod_idP < NUMBER_OF_eNB_MAX, return FALSE, "eNB id is too high (%u/%d) %u %u!\n", enb_mod_idP, NUMBER_OF_eNB_MAX, ue_mod_idP, rb_idP); AssertError (ue_mod_idP < NUMBER_OF_UE_MAX, return FALSE, "UE id is too high (%u/%d) %u %u!\n", ue_mod_idP, NUMBER_OF_UE_MAX, enb_mod_idP, rb_idP); - AssertError (rb_idP < NB_RB_MAX, return FALSE, "RB id is too high (%u/%d) %u %u!\n", rb_idP, NB_RB_MAX, ue_mod_idP, enb_mod_idP); + if (modeP == PDCP_TRANSMISSION_MODE_TRANSPARENT) { + AssertError (rb_idP < NB_RB_MBMS_MAX, return FALSE, "RB id is too high (%u/%d) %u %u!\n", rb_idP, NB_RB_MBMS_MAX, ue_mod_idP, enb_mod_idP); + } else { + AssertError (rb_idP < NB_RB_MAX, return FALSE, "RB id is too high (%u/%d) %u %u!\n", rb_idP, NB_RB_MAX, ue_mod_idP, enb_mod_idP); + } if (enb_flagP == ENB_FLAG_NO) { pdcp_p = &pdcp_array_ue[ue_mod_idP][rb_idP]; @@ -124,19 +137,23 @@ boolean_t pdcp_data_req(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t // XXX What does following call do? mac_xface->macphy_exit("PDCP sdu buffer size > MAX_IP_PACKET_SIZE"); } - + if (enb_flagP == ENB_FLAG_NO) start_meas(&eNB_pdcp_stats[enb_mod_idP].data_req); - else + else start_meas(&UE_pdcp_stats[ue_mod_idP].data_req); - - // PDCP transparent mode for MBMS traffic + + // PDCP transparent mode for MBMS traffic if (modeP == PDCP_TRANSMISSION_MODE_TRANSPARENT) { LOG_D(PDCP, " [TM] Asking for a new mem_block of size %d\n",sdu_buffer_sizeP); pdcp_pdu_p = get_free_mem_block(sdu_buffer_sizeP); if (pdcp_pdu_p != NULL) { memcpy(&pdcp_pdu_p->data[0], sdu_buffer_pP, sdu_buffer_sizeP); + rlc_util_print_hex_octets(PDCP, + (unsigned char*)&pdcp_pdu_p->data[0], + sdu_buffer_sizeP); + rlc_status = rlc_data_req(enb_mod_idP, ue_mod_idP, frameP, enb_flagP, MBMS_FLAG_YES, rb_idP, muiP, confirmP, sdu_buffer_sizeP, pdcp_pdu_p); } else { rlc_status = RLC_OP_STATUS_OUT_OF_RESSOURCES; @@ -191,7 +208,7 @@ boolean_t pdcp_data_req(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t LOG_E(PDCP, "Cannot fill PDU buffer with relevant header fields!\n"); if (enb_flagP == ENB_FLAG_NO) stop_meas(&eNB_pdcp_stats[enb_mod_idP].data_req); - else + else stop_meas(&UE_pdcp_stats[ue_mod_idP].data_req); return FALSE; } @@ -204,7 +221,7 @@ boolean_t pdcp_data_req(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t LOG_E(PDCP, "Cannot fill PDU buffer with relevant header fields!\n"); if (enb_flagP == ENB_FLAG_NO) stop_meas(&eNB_pdcp_stats[enb_mod_idP].data_req); - else + else stop_meas(&UE_pdcp_stats[ue_mod_idP].data_req); return FALSE; } @@ -219,7 +236,7 @@ boolean_t pdcp_data_req(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t free_mem_block(pdcp_pdu_p); if (enb_flagP == ENB_FLAG_NO) stop_meas(&eNB_pdcp_stats[enb_mod_idP].data_req); - else + else stop_meas(&UE_pdcp_stats[ue_mod_idP].data_req); return FALSE; } @@ -252,10 +269,10 @@ boolean_t pdcp_data_req(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t //util_flush_hex_octets(PDCP, (unsigned char*)pdcp_pdu->data, pdcp_pdu_size); } else { LOG_E(PDCP, "Cannot create a mem_block for a PDU!\n"); - if (enb_flagP == ENB_FLAG_NO) - stop_meas(&eNB_pdcp_stats[enb_mod_idP].data_req); - else - stop_meas(&UE_pdcp_stats[ue_mod_idP].data_req); + if (enb_flagP == ENB_FLAG_NO) + stop_meas(&eNB_pdcp_stats[enb_mod_idP].data_req); + else + stop_meas(&UE_pdcp_stats[ue_mod_idP].data_req); #if defined(STOP_ON_IP_TRAFFIC_OVERLOAD) AssertFatal(0, "[FRAME %5u][%s][PDCP][MOD %u/%u][RB %u] PDCP_DATA_REQ SDU DROPPED, OUT OF MEMORY \n", frameP, @@ -299,13 +316,13 @@ boolean_t pdcp_data_req(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t } if (enb_flagP == ENB_FLAG_NO) stop_meas(&eNB_pdcp_stats[enb_mod_idP].data_req); - else + else stop_meas(&UE_pdcp_stats[ue_mod_idP].data_req); /* * Control arrives here only if rlc_data_req() returns RLC_OP_STATUS_OK * so we return TRUE afterwards */ - /* + /* if (rb_id>=DTCH) { if (enb_flagP == 1) { Pdcp_stats_tx[module_id][(rb_id & RAB_OFFSET2 )>> RAB_SHIFT2][(rb_id & RAB_OFFSET)-DTCH]++; @@ -334,7 +351,7 @@ boolean_t pdcp_data_ind(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t if (enb_flagP) start_meas(&eNB_pdcp_stats[enb_mod_idP].data_ind); - else + else start_meas(&UE_pdcp_stats[ue_mod_idP].data_ind); #ifdef OAI_EMU @@ -362,21 +379,35 @@ boolean_t pdcp_data_ind(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t oai_emulation.info.first_ue_local); } #endif - DevCheck4(rb_idP < NB_RB_MAX, rb_idP, NB_RB_MAX, enb_mod_idP, ue_mod_idP); - - if (enb_flagP == ENB_FLAG_NO) { - pdcp_p = &pdcp_array_ue[ue_mod_idP][rb_idP]; - - LOG_I(PDCP, "Data indication notification for PDCP entity from eNB %u to UE %u " - "and radio bearer ID %d rlc sdu size %d enb_flagP %d\n", - enb_mod_idP, ue_mod_idP, rb_idP, sdu_buffer_sizeP, enb_flagP); + if (MBMS_flagP) { + AssertError (rb_idP < NB_RB_MBMS_MAX, return FALSE, "RB id is too high (%u/%d) %u %u!\n", rb_idP, NB_RB_MBMS_MAX, ue_mod_idP, enb_mod_idP); + if (enb_flagP == ENB_FLAG_NO) { + LOG_I(PDCP, "e-MBMS Data indication notification for PDCP entity from eNB %u to UE %u " + "and radio bearer ID %d rlc sdu size %d enb_flagP %d\n", + enb_mod_idP, ue_mod_idP, rb_idP, sdu_buffer_sizeP, enb_flagP); + } else { + LOG_I(PDCP, "Data indication notification for PDCP entity from UE %u to eNB %u " + "and radio bearer ID %d rlc sdu size %d enb_flagP %d eNB_id %d\n", + ue_mod_idP, enb_mod_idP , rb_idP, sdu_buffer_sizeP, enb_flagP, enb_mod_idP); + } } else { - pdcp_p = &pdcp_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP]; + rb_idP = rb_idP % NB_RB_MAX; + AssertError (rb_idP < NB_RB_MAX, return FALSE, "RB id is too high (%u/%d) %u %u!\n", rb_idP, NB_RB_MAX, ue_mod_idP, enb_mod_idP); + if (enb_flagP == ENB_FLAG_NO) { + pdcp_p = &pdcp_array_ue[ue_mod_idP][rb_idP]; - LOG_I(PDCP, "Data indication notification for PDCP entity from UE %u to eNB %u " + LOG_I(PDCP, "Data indication notification for PDCP entity from eNB %u to UE %u " + "and radio bearer ID %d rlc sdu size %d enb_flagP %d\n", + enb_mod_idP, ue_mod_idP, rb_idP, sdu_buffer_sizeP, enb_flagP); + } else { + pdcp_p = &pdcp_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP]; + + LOG_I(PDCP, "Data indication notification for PDCP entity from UE %u to eNB %u " "and radio bearer ID %d rlc sdu size %d enb_flagP %d eNB_id %d\n", ue_mod_idP, enb_mod_idP , rb_idP, sdu_buffer_sizeP, enb_flagP, enb_mod_idP); + } } + sdu_list_p = &pdcp_sdu_list; @@ -384,7 +415,7 @@ boolean_t pdcp_data_ind(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t LOG_W(PDCP, "SDU buffer size is zero! Ignoring this chunk!\n"); if (enb_flagP) stop_meas(&eNB_pdcp_stats[enb_mod_idP].data_ind); - else + else stop_meas(&UE_pdcp_stats[ue_mod_idP].data_ind); return FALSE; } @@ -406,7 +437,7 @@ boolean_t pdcp_data_ind(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t free_mem_block(sdu_buffer_pP); if (enb_flagP) stop_meas(&eNB_pdcp_stats[enb_mod_idP].data_ind); - else + else stop_meas(&UE_pdcp_stats[ue_mod_idP].data_ind); return FALSE; } @@ -463,7 +494,7 @@ boolean_t pdcp_data_ind(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t // free_mem_block(new_sdu); if (enb_flagP) stop_meas(&eNB_pdcp_stats[enb_mod_idP].data_ind); - else + else stop_meas(&UE_pdcp_stats[ue_mod_idP].data_ind); return TRUE; } @@ -482,6 +513,9 @@ boolean_t pdcp_data_ind(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t if (oai_emulation.info.otg_enabled == 1) { module_id_t src_id, dst_id; int ctime; + rlc_util_print_hex_octets(PDCP, + &sdu_buffer_pP->data[payload_offset], + sdu_buffer_sizeP - payload_offset); src_id = (enb_flagP != 0) ? ue_mod_idP : enb_mod_idP; dst_id = (enb_flagP == ENB_FLAG_NO) ? ue_mod_idP : enb_mod_idP; @@ -494,7 +528,7 @@ boolean_t pdcp_data_ind(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t free_mem_block(sdu_buffer_pP); if (enb_flagP) stop_meas(&eNB_pdcp_stats[enb_mod_idP].data_ind); - else + else stop_meas(&UE_pdcp_stats[ue_mod_idP].data_ind); return TRUE; } @@ -505,7 +539,7 @@ boolean_t pdcp_data_ind(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t free_mem_block(sdu_buffer_pP); if (enb_flagP) stop_meas(&eNB_pdcp_stats[enb_mod_idP].data_ind); - else + else stop_meas(&UE_pdcp_stats[ue_mod_idP].data_ind); return TRUE; } @@ -581,7 +615,7 @@ boolean_t pdcp_data_ind(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t free_mem_block(sdu_buffer_pP); if (enb_flagP) stop_meas(&eNB_pdcp_stats[enb_mod_idP].data_ind); - else + else stop_meas(&UE_pdcp_stats[ue_mod_idP].data_ind); return TRUE; } @@ -597,7 +631,7 @@ void pdcp_run (frame_t frameP, eNB_flag_t enb_flagP, module_id_t ue_mod_idP, mo #endif if (enb_flagP) start_meas(&eNB_pdcp_stats[enb_mod_idP].pdcp_run); - else + else start_meas(&UE_pdcp_stats[ue_mod_idP].pdcp_run); vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_RUN, VCD_FUNCTION_IN); @@ -672,10 +706,10 @@ void pdcp_run (frame_t frameP, eNB_flag_t enb_flagP, module_id_t ue_mod_idP, mo // PDCP -> NAS/IP traffic: RX pdcp_fifo_flush_sdus(frameP, enb_flagP, enb_mod_idP, ue_mod_idP); - vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_RUN, VCD_FUNCTION_OUT); + vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PDCP_RUN, VCD_FUNCTION_OUT); if (enb_flagP) stop_meas(&eNB_pdcp_stats[enb_mod_idP].pdcp_run); - else + else stop_meas(&UE_pdcp_stats[ue_mod_idP].pdcp_run); } @@ -924,7 +958,7 @@ boolean_t rrc_pdcp_config_asn1_req (module_id_t enb_mod_idP, // can set the mch_id = i if (enb_flagP) { - rb_id = (mch_id * maxSessionPerPMCH ) + lc_id; // 1 + rb_id = (mch_id * maxSessionPerPMCH ) + lc_id + (maxDRB + 3)*MAX_MOBILES_PER_ENB; // 1 if (pdcp_mbms_array_eNB[enb_mod_idP][mch_id][lc_id].instanciated_instance == TRUE) action = CONFIG_ACTION_MBMS_MODIFY; else @@ -939,7 +973,8 @@ boolean_t rrc_pdcp_config_asn1_req (module_id_t enb_mod_idP, - pdcp_config_req_asn1 (NULL, // unused for MBMS + pdcp_config_req_asn1 ( + NULL, // unused for MBMS enb_mod_idP, ue_mod_idP, frameP, @@ -1110,8 +1145,8 @@ boolean_t pdcp_config_req_asn1 (pdcp_t *pdcp_pP, pdcp_mbms_array_eNB[enb_mod_idP][mch_idP][lc_idP].instanciated_instance = TRUE ; pdcp_mbms_array_eNB[enb_mod_idP][mch_idP][lc_idP].rb_id = rb_idP; } else { - pdcp_mbms_array_eNB[ue_mod_idP][mch_idP][lc_idP].instanciated_instance = TRUE ; - pdcp_mbms_array_eNB[ue_mod_idP][mch_idP][lc_idP].rb_id = rb_idP; + pdcp_mbms_array_ue[ue_mod_idP][mch_idP][lc_idP].instanciated_instance = TRUE ; + pdcp_mbms_array_ue[ue_mod_idP][mch_idP][lc_idP].rb_id = rb_idP; } break; #endif diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c index 1ffab2394ba..8364d100a5f 100755 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp_fifo.c @@ -372,7 +372,7 @@ int pdcp_fifo_read_input_sdus_remaining_bytes (frame_t frameP, eNB_flag_t enb_fl RLC_SDU_CONFIRM_NO, pdcp_input_header.data_size, pdcp_input_sdu_buffer, - PDCP_TRANSMISSION_MODE_DATA); //PDCP_TRANSMISSION_MODE_TRANSPARENT); + PDCP_TRANSMISSION_MODE_TRANSPARENT); AssertFatal (result == TRUE, "PDCP data request failed!\n"); } @@ -504,7 +504,7 @@ int pdcp_fifo_read_input_sdus (frame_t frameP, eNB_flag_t enb_flagP, module_id_t (data->pdcp_read_header.traffic_type == TRAFFIC_IPV4_TYPE_MULTICAST) /*TRAFFIC_IPV4_TYPE_MULTICAST */ || (data->pdcp_read_header.traffic_type == TRAFFIC_IPV4_TYPE_BROADCAST) /*TRAFFIC_IPV4_TYPE_BROADCAST */ ) { #if defined (Rel10) - pdcp_mode = PDCP_TRANSMISSION_MODE_DATA; //PDCP_TRANSMISSION_MODE_TRANSPARENT; + PDCP_TRANSMISSION_MODE_TRANSPARENT; #else pdcp_mode= PDCP_TRANSMISSION_MODE_DATA; #endif @@ -515,9 +515,9 @@ int pdcp_fifo_read_input_sdus (frame_t frameP, eNB_flag_t enb_flagP, module_id_t pdcp_mode= PDCP_TRANSMISSION_MODE_DATA; LOG_W(PDCP,"unknown IP traffic type \n"); } -#else // NASMESH driver does not curreenlty support multicast traffic +#else // NASMESH driver does not curreenlty support multicast traffic pdcp_mode = PDCP_TRANSMISSION_MODE_DATA; -#endif +#endif pdcp_data_req(enb_mod_idP, ue_mod_idP, frameP, @@ -829,6 +829,10 @@ void pdcp_fifo_read_input_sdus_from_otg (frame_t frameP, eNB_flag_t enb_flagP, m pkt_size = (otg_pkt_info->otg_pkt).sdu_buffer_size; if (otg_pkt != NULL) { if (is_ue == 0 ) { + rlc_util_print_hex_octets(PDCP, + (unsigned char*)otg_pkt, + pkt_size); + //rb_id = (/*NB_eNB_INST +*/ dst_id -1 ) * MAX_NUM_RB + DTCH; LOG_D(OTG,"[eNB %d] Frame %d sending packet %d from module %d on rab id %d (src %d, dst %d) pkt size %d for pdcp mode %d\n", enb_mod_idP, frameP, pkt_cnt++, module_id, rb_id, module_id, dst_id, pkt_size, pdcp_mode); @@ -837,6 +841,8 @@ void pdcp_fifo_read_input_sdus_from_otg (frame_t frameP, eNB_flag_t enb_flagP, m } else { //rb_id= eNB_index * MAX_NUM_RB + DTCH; + + LOG_D(OTG,"[UE %d] sending packet from module %d on rab id %d (src %d, dst %d) pkt size %d\n", ue_mod_idP, src_id, rb_id, src_id, dst_id, pkt_size); result = pdcp_data_req( enb_mod_idP, diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c index fca9369c71e..85f48aa50dc 100755 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um.c @@ -406,7 +406,7 @@ rlc_um_mac_status_indication (void *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP uint16_t sdu_remaining_size = 0; int32_t diff_time=0; rlc_um_entity_t *rlc_p = NULL; - + status_resp.buffer_occupancy_in_pdus = 0; status_resp.buffer_occupancy_in_bytes = 0; status_resp.head_sdu_remaining_size_to_send = 0; @@ -422,25 +422,25 @@ rlc_um_mac_status_indication (void *rlc_pP, frame_t frameP, eNB_flag_t eNB_flagP status_resp.buffer_occupancy_in_bytes = rlc_um_get_buffer_occupancy (rlc_p); if (status_resp.buffer_occupancy_in_bytes > 0) { - + status_resp.buffer_occupancy_in_bytes += rlc_p->tx_header_min_length_in_bytes; status_resp.buffer_occupancy_in_pdus = rlc_p->nb_sdu; - + diff_time = frameP - ((struct rlc_um_tx_sdu_management *) (rlc_p->input_sdus[rlc_p->current_sdu_index])->data)->sdu_creation_time; status_resp.head_sdu_creation_time = (diff_time > 0 ) ? (uint32_t) diff_time : (uint32_t)(0xffffffff - diff_time + frameP) ; //msg("rlc_p status for frameP %d diff time %d resp %d\n", frameP, diff_time,status_resp.head_sdu_creation_time) ; - + sdu_size = ((struct rlc_um_tx_sdu_management *) (rlc_p->input_sdus[rlc_p->current_sdu_index])->data)->sdu_size; sdu_remaining_size = ((struct rlc_um_tx_sdu_management *) (rlc_p->input_sdus[rlc_p->current_sdu_index])->data)->sdu_remaining_size; - - status_resp.head_sdu_remaining_size_to_send = sdu_remaining_size; + + status_resp.head_sdu_remaining_size_to_send = sdu_remaining_size; if (sdu_size == sdu_remaining_size) { status_resp.head_sdu_is_segmented = 0; } else { status_resp.head_sdu_is_segmented = 1; } - + } else { } //msg("[FRAME %05d][%s][RLC_UM][MOD %02u/%02u][RB %02d] MAC_STATUS_INDICATION BO = %d\n", ((rlc_um_entity_t *) rlc_pP)->module_id, ((rlc_um_entity_t *) rlc_pP)->rb_id, status_resp.buffer_occupancy_in_bytes); @@ -627,6 +627,10 @@ rlc_um_data_req (void *rlc_pP, frame_t frameP, mem_block_t *sdu_pP) rlc_p->nb_sdu, rlc_p->current_sdu_index, rlc_p->next_sdu_index); + rlc_util_print_hex_octets( + RLC, + (uint8_t*)&sdu_pP->data[sizeof (struct rlc_um_data_req_alloc)], + ((struct rlc_um_data_req *) (sdu_pP->data))->data_size); /*#ifndef USER_MODE rlc_um_time_us = (unsigned long int)(rt_get_time_ns ()/(RTIME)1000); diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c index af2ce9000e2..468555dc0bf 100755 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_control_primitives.c @@ -100,12 +100,24 @@ void config_req_rlc_um_asn1 (frame_t frameP, uint32_t dl_sn_FieldLength = 0; uint32_t t_Reordering; rlc_um_entity_t *rlc_p = NULL; -#if defined(rel10) +#if defined(Rel10) if (mbms_flagP) { if (eNB_flagP) { rlc_p = &rlc_mbms_array_eNB[enb_module_idP][mbms_service_idP][mbms_session_idP].um; + LOG_D(RLC,"eNB config_req_rlc_um_asn1 rlc_um_p : %p RB %u service %u session %u", + rlc_p, + rb_idP, + mbms_service_idP, + mbms_session_idP + ); } else { rlc_p = &rlc_mbms_array_ue[ue_module_idP][mbms_service_idP][mbms_session_idP].um; + LOG_D(RLC,"UE config_req_rlc_um_asn1 rlc_um_p : %p RB %u service %u session %u", + rlc_p, + rb_idP, + mbms_service_idP, + mbms_session_idP + ); } } else @@ -122,12 +134,12 @@ void config_req_rlc_um_asn1 (frame_t frameP, LOG_D(RLC, "[FRAME %05d][%s][RRC][MOD %u/%u][][--- CONFIG_REQ timer_reordering=%dms sn_field_length= --->][RLC_UM][MOD %u/%u][RB %u] \n", frameP, (eNB_flagP) ? "eNB" : "UE", - enb_module_idP, - ue_module_idP, - (dl_rlc_pP->t_Reordering<31)?t_Reordering_tab[dl_rlc_pP->t_Reordering]:-1, - enb_module_idP, - ue_module_idP, - rb_idP); + enb_module_idP, + ue_module_idP, + (dl_rlc_pP->t_Reordering<31)?t_Reordering_tab[dl_rlc_pP->t_Reordering]:-1, + enb_module_idP, + ue_module_idP, + rb_idP); rlc_um_init(rlc_p); if (rlc_um_fsm_notify_event (rlc_p, RLC_UM_RECEIVE_CRLC_CONFIG_REQ_ENTER_DATA_TRANSFER_READY_STATE_EVENT)) { @@ -150,7 +162,7 @@ void config_req_rlc_um_asn1 (frame_t frameP, ul_rlc_pP->sn_FieldLength); return; } - } + } if (dl_rlc_pP != NULL) { switch (dl_rlc_pP->sn_FieldLength) { @@ -198,6 +210,9 @@ void config_req_rlc_um_asn1 (frame_t frameP, ul_sn_FieldLength, mbms_flagP); } + if (mbms_flagP == MBMS_FLAG_YES) { + rlc_p->allocation = TRUE; + } } } //----------------------------------------------------------------------------- @@ -379,17 +394,16 @@ void rlc_um_set_debug_infos(rlc_um_entity_t *rlc_pP, { LOG_D(RLC, "[FRAME %05d][%s][RLC_UM][SET DEBUG INFOS] enb_module_id %u ue_module_id %u rb_id %d rb_type %d\n", frameP, - (rlc_pP->is_enb) ? "eNB" : "UE", - eNB_flagP, - enb_module_idP, - ue_module_idP, - rb_idP, - rb_typeP); + (eNB_flagP) ? "eNB" : "UE", + enb_module_idP, + ue_module_idP, + rb_idP, + rb_typeP); rlc_pP->enb_module_id = enb_module_idP; rlc_pP->ue_module_id = ue_module_idP; - rlc_pP->rb_id = rb_idP; - if (rb_typeP != SIGNALLING_RADIO_BEARER) { + rlc_pP->rb_id = rb_idP; + if (rb_typeP == RADIO_ACCESS_BEARER) { rlc_pP->is_data_plane = 1; } else { rlc_pP->is_data_plane = 0; diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.c index 487c605d4d7..8ce1441ff8b 100755 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.c +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_segment.c @@ -89,7 +89,12 @@ rlc_um_segment_10 (rlc_um_entity_t *rlc_pP,frame_t frameP) return; } #if defined(TRACE_RLC_UM_SEGMENT) - LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][RB %u] SEGMENT10\n", rlc_pP->module_id, rlc_pP->rb_id, frameP); + LOG_D(RLC, "[FRAME %05u][%s][RLC_UM][MOD %u/%u][RB %u] SEGMENT10\n", + frameP, + (rlc_pP->is_enb) ? "eNB" : "UE", + rlc_pP->enb_module_id, + rlc_pP->ue_module_id, + rlc_pP->rb_id); #endif list_init (&pdus, NULL); // param string identifying the list is NULL pdu_mem_p = NULL; @@ -766,8 +771,8 @@ rlc_um_segment_5 (rlc_um_entity_t *rlc_pP,frame_t frameP) rlc_pP->ue_module_id, rlc_pP->rb_id, pdu_remaining_size); - memcpy(data, data_sdu_p, pdu_remaining_size); #endif + memcpy(data, data_sdu_p, pdu_remaining_size); // free SDU rlc_pP->buffer_occupancy -= sdu_mngt_p->sdu_remaining_size; free_mem_block (rlc_pP->input_sdus[rlc_pP->current_sdu_index]); diff --git a/openair2/LAYER2/RLC/rlc.c b/openair2/LAYER2/RLC/rlc.c index d39545f209f..4b88750677f 100644 --- a/openair2/LAYER2/RLC/rlc.c +++ b/openair2/LAYER2/RLC/rlc.c @@ -53,8 +53,11 @@ void rlc_util_print_hex_octets(comp_name_t componentP, unsigned char* dataP, uns } - LOG_T(componentP, " | 0 1 2 3 4 5 6 7 8 9 a b c d e f |\n"); - LOG_T(componentP, "------+-------------------------------------------------|\n"); + + + LOG_T(componentP, "+-----+-------------------------------------------------+\n"); + LOG_T(componentP, "| | 0 1 2 3 4 5 6 7 8 9 a b c d e f |\n"); + LOG_T(componentP, "+-----+-------------------------------------------------+\n"); for (octet_index = 0; octet_index < sizeP; octet_index++) { if ((octet_index % 16) == 0){ if (octet_index != 0) { @@ -359,6 +362,8 @@ rlc_op_status_t rlc_data_req (module_id_t enb_mod_idP, #ifdef Rel10 rb_id_t mbms_rb_id = 0; rlc_um_entity_t *rlc_um_p = NULL; + rlc_mbms_id_t *mbms_id_p = NULL; + logical_chan_id_t log_ch_id = 0; #endif #ifdef DEBUG_RLC_DATA_REQ LOG_D(RLC,"rlc_data_req: %s enb id %u ue id %u, rb_id %u (MAX %d), muip %d, confirmP %d, sud_sizeP %d, sdu_pP %p\n", @@ -401,7 +406,11 @@ rlc_op_status_t rlc_data_req (module_id_t enb_mod_idP, oai_emulation.info.first_ue_local); } #endif - AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX); + if (MBMS_flagP) { + AssertFatal (rb_idP < NB_RB_MBMS_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MBMS_MAX); + } else { + AssertFatal (rb_idP < NB_RB_MAX, "RB id is too high (%u/%d)!\n", rb_idP, NB_RB_MAX); + } DevAssert(sdu_pP != NULL); DevCheck(sdu_sizeP > 0, sdu_sizeP, 0, 0); @@ -409,45 +418,72 @@ rlc_op_status_t rlc_data_req (module_id_t enb_mod_idP, DevCheck(MBMS_flagP == 0, MBMS_flagP, 0, 0); #endif - if (enb_flagP) { - rlc_mode = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].mode; - switch (rlc_mode) { - case RLC_MODE_NONE: - AssertFatal (0 , "enB RLC not configured rb id %u module %u!\n", rb_idP, enb_mod_idP); - break; - case RLC_MODE_AM: - rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.am; - break; - case RLC_MODE_UM: - rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.um; - break; - case RLC_MODE_TM: - rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.tm; - break; - default: - AssertFatal (0 , "enB RLC internal memory error rb id %u module %u!\n", rb_idP, enb_mod_idP); +#ifdef Rel10 + if (MBMS_flagP == TRUE) { + if (enb_flagP) { + log_ch_id = rlc_mbms_enb_get_lcid_by_rb_id(enb_mod_idP,rb_idP); + mbms_id_p = &rlc_mbms_lcid2service_session_id_eNB[enb_mod_idP][log_ch_id]; + rlc_um_p = &rlc_mbms_array_eNB[enb_mod_idP][mbms_id_p->service_id][mbms_id_p->session_id].um; + LOG_D(RLC,"eNB rlc_um_p : %p RB %u service %u session %u\n", + rlc_um_p, + rb_idP, + mbms_id_p->service_id, + mbms_id_p->session_id + ); + + } else { + log_ch_id = rlc_mbms_ue_get_lcid_by_rb_id(ue_mod_idP,rb_idP); + mbms_id_p = &rlc_mbms_lcid2service_session_id_ue[ue_mod_idP][log_ch_id]; + rlc_um_p = &rlc_mbms_array_ue[ue_mod_idP][mbms_id_p->service_id][mbms_id_p->session_id].um; + LOG_D(RLC,"UE rlc_um_p : %p RB %u service %u session %u\n", + rlc_um_p, + rb_idP, + mbms_id_p->service_id, + mbms_id_p->session_id + ); } - } else { - rlc_mode = rlc_array_ue[ue_mod_idP][rb_idP].mode; - switch (rlc_mode) { - case RLC_MODE_NONE: - AssertFatal (0 , "UE RLC not configured rb id %u module %u!\n", rb_idP, ue_mod_idP); - break; - case RLC_MODE_AM: - rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_idP].rlc.am; - break; - case RLC_MODE_UM: - rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_idP].rlc.um; - break; - case RLC_MODE_TM: - rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_idP].rlc.tm; - break; - default: - AssertFatal (0 , "UE RLC internal memory error rb id %u module %u!\n", rb_idP, ue_mod_idP); + } else +#endif + { + if (enb_flagP) { + rlc_mode = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].mode; + switch (rlc_mode) { + case RLC_MODE_NONE: + AssertFatal (0 , "enB RLC not configured rb id %u module %u!\n", rb_idP, enb_mod_idP); + break; + case RLC_MODE_AM: + rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.am; + break; + case RLC_MODE_UM: + rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.um; + break; + case RLC_MODE_TM: + rlc_p = (void*)&rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].rlc.tm; + break; + default: + AssertFatal (0 , "enB RLC internal memory error rb id %u module %u!\n", rb_idP, enb_mod_idP); + } + } else { + rlc_mode = rlc_array_ue[ue_mod_idP][rb_idP].mode; + switch (rlc_mode) { + case RLC_MODE_NONE: + AssertFatal (0 , "UE RLC not configured rb id %u module %u!\n", rb_idP, ue_mod_idP); + break; + case RLC_MODE_AM: + rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_idP].rlc.am; + break; + case RLC_MODE_UM: + rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_idP].rlc.um; + break; + case RLC_MODE_TM: + rlc_p = (void*)&rlc_array_ue[ue_mod_idP][rb_idP].rlc.tm; + break; + default: + AssertFatal (0 , "UE RLC internal memory error rb id %u module %u!\n", rb_idP, ue_mod_idP); + } } } - if (MBMS_flagP == 0) { LOG_D(RLC, "[FRAME %5u][%s][RLC][INST %u/%u][RB %u] Display of rlc_data_req:\n", frameP, @@ -617,14 +653,6 @@ rlc_op_status_t rlc_data_req (module_id_t enb_mod_idP, #ifdef Rel10 } else { /* MBMS_flag != 0 */ - if (rb_idP < (maxSessionPerPMCH * maxServiceCount)) { - if (enb_flagP) { - mbms_rb_id = rb_idP + (maxDRB + 3) * MAX_MOBILES_PER_RG; - //rlc_um_p = rlc_mbms_array_eNB[enb_mod_idP][mbms_rb_id].; - } else { - mbms_rb_id = rb_idP + (maxDRB + 3); - //rlc_um_p = rlc_mbms_array_ue[ue_mod_idP][mbms_rb_id]; - } // LOG_I(RLC,"DUY rlc_data_req: mbms_rb_id in RLC instant is: %d\n", mbms_rb_id); if (sdu_pP != NULL) { if (sdu_sizeP > 0) { @@ -644,15 +672,13 @@ rlc_op_status_t rlc_data_req (module_id_t enb_mod_idP, enb_mod_idP, ue_mod_idP, rb_idP, - mbms_rb_id, sdu_sizeP, enb_mod_idP, ue_mod_idP, - rb_idP, - mbms_rb_id); + rb_idP); } else { if (enb_flagP) { - LOG_D(RLC, "[FRAME %5u][RRC_eNB][INST %u/%u][][--- RLC_UM_DATA_REQ/%d Bytes (MBMS) --->][RLC_UM][INST %u/%u][RB %u]\n", + LOG_D(RLC, "[FRAME %5u][RRC_eNB][INST %u/%u][%u][--- RLC_UM_DATA_REQ/%d Bytes (MBMS) --->][RLC_UM][INST %u/%u][RB %u]\n", frameP, enb_mod_idP, ue_mod_idP, @@ -660,10 +686,9 @@ rlc_op_status_t rlc_data_req (module_id_t enb_mod_idP, sdu_sizeP, enb_mod_idP, ue_mod_idP, - rb_idP, - mbms_rb_id); + rb_idP); } else { - LOG_D(RLC, "[FRAME %5u][RRC_UE][INST %u/%u][][--- RLC_UM_DATA_REQ/%d Bytes (MBMS) --->][RLC_UM][INST %u/%u][RB %u]\n", + LOG_D(RLC, "[FRAME %5u][RRC_UE][INST %u/%u][%u][--- RLC_UM_DATA_REQ/%d Bytes (MBMS) --->][RLC_UM][INST %u/%u][RB %u]\n", frameP, enb_mod_idP, ue_mod_idP, @@ -671,8 +696,7 @@ rlc_op_status_t rlc_data_req (module_id_t enb_mod_idP, sdu_sizeP, enb_mod_idP, ue_mod_idP, - rb_idP, - mbms_rb_id); + rb_idP); } } LOG_D(RLC, "%s\n",RLC_FG_COLOR_DEFAULT); @@ -689,9 +713,6 @@ rlc_op_status_t rlc_data_req (module_id_t enb_mod_idP, } else { return RLC_OP_STATUS_BAD_PARAMETER; } - } else { - return RLC_OP_STATUS_BAD_PARAMETER; - } } #else } else {/* MBMS_flag != 0 */ @@ -708,10 +729,17 @@ void rlc_data_ind (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t //----------------------------------------------------------------------------- rlc_mode_t rlc_mode = RLC_MODE_NONE; - if (enb_flagP) { - rlc_mode = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].mode; - } else { - rlc_mode = rlc_array_ue[ue_mod_idP][rb_idP].mode; +#ifdef Rel10 + if (MBMS_flagP == TRUE) { + rlc_mode = RLC_MODE_UM; + } else +#endif + { + if (enb_flagP) { + rlc_mode = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].mode; + } else { + rlc_mode = rlc_array_ue[ue_mod_idP][rb_idP].mode; + } } LOG_D(RLC, "[FRAME %5u][%s][RLC][INST %u/%u][RB %u] Display of rlc_data_ind: size %u\n", @@ -743,12 +771,13 @@ void rlc_data_ind (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t rb_idP); break; case RLC_MODE_UM: - LOG_D(RLC, "[FRAME %5u][%s][RLC_UM][INST %u/%u][RB %u][--- RLC_DATA_IND/%d Bytes --->][PDCP][INST %u/%u][RB %u]\n", + LOG_D(RLC, "[FRAME %5u][%s][RLC_UM][INST %u/%u][RB %u][--- RLC_DATA_IND %s/%d Bytes --->][PDCP][INST %u/%u][RB %u]\n", frameP, (enb_flagP) ? "eNB" : "UE", enb_mod_idP, ue_mod_idP, rb_idP, + (MBMS_flagP) ? "(e-MBMS)" : "", sdu_sizeP, enb_mod_idP, ue_mod_idP, @@ -767,7 +796,7 @@ void rlc_data_ind (module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t rb_idP); break; } - pdcp_data_ind (enb_mod_idP, ue_mod_idP, frameP, enb_flagP, MBMS_flagP, rb_idP % NB_RB_MAX, sdu_sizeP, sdu_pP, is_data_planeP); + pdcp_data_ind (enb_mod_idP, ue_mod_idP, frameP, enb_flagP, MBMS_flagP, rb_idP, sdu_sizeP, sdu_pP, is_data_planeP); } //----------------------------------------------------------------------------- void rlc_data_conf (module_id_t enb_mod_idP, @@ -781,13 +810,23 @@ void rlc_data_conf (module_id_t enb_mod_idP, //----------------------------------------------------------------------------- rlc_mode_t rlc_mode = RLC_MODE_NONE; - if (enb_flagP) { - rlc_mode = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].mode; - } else { - rlc_mode = rlc_array_ue[ue_mod_idP][rb_idP].mode; - } +//TO DO (check if we can add MBMS flag in prototype)#ifdef Rel10 +// if (MBMS_flagP == TRUE) { +// rlc_mode = RLC_MODE_UM; +// } else +//#endif +#if !defined(Rel10) + { + if (enb_flagP) { + rlc_mode = rlc_array_eNB[enb_mod_idP][ue_mod_idP][rb_idP].mode; + } else { + rlc_mode = rlc_array_ue[ue_mod_idP][rb_idP].mode; + } + } +#endif if (!(is_data_planeP)) { if (rlc_rrc_data_conf != NULL) { +#if !defined(Rel10) LOG_D(RLC, "%s\n",RLC_FG_BRIGHT_COLOR_RED); switch (rlc_mode) { case RLC_MODE_NONE: @@ -798,6 +837,7 @@ void rlc_data_conf (module_id_t enb_mod_idP, (enb_flagP) ? "eNB" : "UE", enb_mod_idP, ue_mod_idP, + rb_idP, muiP, enb_mod_idP, ue_mod_idP, @@ -809,6 +849,7 @@ void rlc_data_conf (module_id_t enb_mod_idP, (enb_flagP) ? "eNB" : "UE", enb_mod_idP, ue_mod_idP, + rb_idP, muiP, enb_mod_idP, ue_mod_idP, @@ -820,6 +861,7 @@ void rlc_data_conf (module_id_t enb_mod_idP, (enb_flagP) ? "eNB" : "UE", enb_mod_idP, ue_mod_idP, + rb_idP, muiP, enb_mod_idP, ue_mod_idP, @@ -827,6 +869,7 @@ void rlc_data_conf (module_id_t enb_mod_idP, break; } LOG_D(RLC, "%s\n",RLC_FG_COLOR_DEFAULT); +#endif rlc_rrc_data_conf (enb_mod_idP , ue_mod_idP, enb_flagP, rb_idP , muiP, statusP); } } @@ -864,6 +907,9 @@ rlc_module_init (void) rlc_mbms_lcid2service_session_id_ue[module_id1][k].service_id = 0; rlc_mbms_lcid2service_session_id_ue[module_id1][k].session_id = 0; } + for (k=0; k < NB_RB_MBMS_MAX; k++) { + rlc_mbms_rbid2lcid_eNB[module_id1][k] = RLC_LC_UNALLOCATED; + } #endif for (rb_id=0; rb_id < NB_RB_MAX; rb_id++) { memset(&rlc_array_ue[module_id1][rb_id], 0, sizeof(rlc_t)); @@ -881,6 +927,9 @@ rlc_module_init (void) rlc_mbms_lcid2service_session_id_eNB[module_id1][k].service_id = 0; rlc_mbms_lcid2service_session_id_eNB[module_id1][k].session_id = 0; } + for (k=0; k < NB_RB_MBMS_MAX; k++) { + rlc_mbms_rbid2lcid_ue[module_id1][k] = RLC_LC_UNALLOCATED; + } #endif for (module_id2=0; module_id2 < NUMBER_OF_UE_MAX; module_id2++) { for (rb_id=0; rb_id < NB_RB_MAX; rb_id++) { diff --git a/openair2/LAYER2/RLC/rlc.h b/openair2/LAYER2/RLC/rlc.h index da057eb1747..d27b0119948 100755 --- a/openair2/LAYER2/RLC/rlc.h +++ b/openair2/LAYER2/RLC/rlc.h @@ -102,6 +102,7 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis # define public_rlc(x) extern x # endif + //----------------------------------------------------------------------------- #define RLC_OP_STATUS_OK 1 #define RLC_OP_STATUS_BAD_PARAMETER 22 @@ -111,6 +112,7 @@ Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis #define RLC_MUI_UNDEFINED (mui_t)0 #define RLC_RB_UNALLOCATED (rb_id_t)0 +#define RLC_LC_UNALLOCATED (logical_chan_id_t)0 //----------------------------------------------------------------------------- // PUBLIC RLC CONSTANTS @@ -216,8 +218,26 @@ public_rlc(rlc_mbms_t rlc_mbms_array_eNB[NUMBER_OF_eNB_MAX][maxService public_rlc(rlc_mbms_id_t rlc_mbms_lcid2service_session_id_ue[NUMBER_OF_UE_MAX][RLC_MAX_MBMS_LC];) // some constants from openair2/RRC/LITE/MESSAGES/asn1_constants.h public_rlc(rlc_mbms_id_t rlc_mbms_lcid2service_session_id_eNB[NUMBER_OF_eNB_MAX][RLC_MAX_MBMS_LC];) // some constants from openair2/RRC/LITE/MESSAGES/asn1_constants.h -public_rlc(rb_id_t lcid2rbid_ue[NUMBER_OF_UE_MAX][RLC_MAX_LC];) /*!< \brief Pairing logical channel identifier with radio bearer identifer. */ -public_rlc(rb_id_t lcid2rbid_eNB[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][RLC_MAX_LC];) /*!< \brief Pairing logical channel identifier with radio bearer identifer. */ +#define rlc_mbms_enb_get_lcid_by_rb_id(Enb_mOD,rB_iD) rlc_mbms_rbid2lcid_eNB[Enb_mOD][rB_iD - (NB_RB_MAX*MAX_MOBILES_PER_ENB)] + +#define rlc_mbms_enb_set_lcid_by_rb_id(Enb_mOD,rB_iD,lOG_cH_iD) do { \ + AssertFatal(rB_iD>=(NB_RB_MAX*MAX_MOBILES_PER_ENB), "INVALID RB ID %u", rB_iD); \ + rlc_mbms_rbid2lcid_eNB[Enb_mOD][rB_iD - (NB_RB_MAX*MAX_MOBILES_PER_ENB)] = lOG_cH_iD; \ + } while (0); + +#define rlc_mbms_ue_get_lcid_by_rb_id(uE_mOD,rB_iD) rlc_mbms_rbid2lcid_ue[uE_mOD][rB_iD - NB_RB_MAX] + +#define rlc_mbms_ue_set_lcid_by_rb_id(uE_mOD,rB_iD,lOG_cH_iD) do { \ + AssertFatal(rB_iD>=NB_RB_MAX, "INVALID RB ID %u", rB_iD); \ + rlc_mbms_rbid2lcid_ue[uE_mOD][rB_iD - NB_RB_MAX] = lOG_cH_iD; \ + } while (0); + +public_rlc(logical_chan_id_t rlc_mbms_rbid2lcid_ue [NUMBER_OF_UE_MAX][NB_RB_MBMS_MAX];) /*!< \brief Pairing logical channel identifier with radio bearer identifer. */ +public_rlc(logical_chan_id_t rlc_mbms_rbid2lcid_eNB[NUMBER_OF_eNB_MAX][NB_RB_MBMS_MAX];) /*!< \brief Pairing logical channel identifier with radio bearer identifer. */ + + +public_rlc(rb_id_t lcid2rbid_ue [NUMBER_OF_UE_MAX][RLC_MAX_LC];) /*!< \brief Pairing logical channel identifier with radio bearer identifer. */ +public_rlc(rb_id_t lcid2rbid_eNB[NUMBER_OF_eNB_MAX][NUMBER_OF_UE_MAX][RLC_MAX_LC];) /*!< \brief Pairing logical channel identifier with radio bearer identifer. */ /*! \var rlc_t rlc_array_ue[NUMBER_OF_UE_MAX][NB_RB_MAX] \brief Global var for RLC layer, allocate memory for RLC UE protocol instances. */ diff --git a/openair2/LAYER2/RLC/rlc_mac.c b/openair2/LAYER2/RLC/rlc_mac.c index 1d0ce52e393..8938e159f97 100644 --- a/openair2/LAYER2/RLC/rlc_mac.c +++ b/openair2/LAYER2/RLC/rlc_mac.c @@ -139,8 +139,9 @@ tbs_size_t mac_rlc_data_req( if (enb_flagP) { if (MBMS_flagP) { mbms_id_p = &rlc_mbms_lcid2service_session_id_eNB[enb_mod_idP][channel_idP]; - rb_id = rlc_mbms_array_eNB[enb_mod_idP][mbms_id_p->service_id][mbms_id_p->session_id].rb_id; - rlc_p = (void*)&rlc_mbms_array_eNB[enb_mod_idP][mbms_id_p->service_id][mbms_id_p->session_id].um; + rb_id = rlc_mbms_array_eNB[enb_mod_idP][mbms_id_p->service_id][mbms_id_p->session_id].rb_id; + rlc_p = (void*)&rlc_mbms_array_eNB[enb_mod_idP][mbms_id_p->service_id][mbms_id_p->session_id].um; + rlc_mode = RLC_MODE_UM; AssertFatal (rlc_mbms_array_eNB[enb_mod_idP][mbms_id_p->service_id][mbms_id_p->session_id].um.allocation == TRUE , "enB MBMS RLC UM not configured rb id %u lcid %u module %u!\n", rb_id, channel_idP, enb_mod_idP); } else { @@ -295,10 +296,12 @@ void mac_rlc_data_ind ( } else { if (MBMS_flagP) { mbms_id_p = &rlc_mbms_lcid2service_session_id_ue[ue_mod_idP][channel_idP]; - rb_id = rlc_mbms_array_ue[ue_mod_idP][mbms_id_p->service_id][mbms_id_p->session_id].rb_id; - rlc_p = (void*)&rlc_mbms_array_ue[ue_mod_idP][mbms_id_p->service_id][mbms_id_p->session_id].um; + rb_id = rlc_mbms_array_ue[ue_mod_idP][mbms_id_p->service_id][mbms_id_p->session_id].rb_id; + rlc_p = (void*)&rlc_mbms_array_ue[ue_mod_idP][mbms_id_p->service_id][mbms_id_p->session_id].um; + rlc_mode = RLC_MODE_UM; AssertFatal (rlc_mbms_array_ue[ue_mod_idP][mbms_id_p->service_id][mbms_id_p->session_id].um.allocation == TRUE , - "UE MBMS RLC UM not configured rb id %u lcid %u module %u!\n", rb_id, channel_idP, ue_mod_idP); + "UE MBMS RLC UM not configured rb id %u lcid %u service_id %u session_id %u module %u!\n", + rb_id, channel_idP,mbms_id_p->service_id, mbms_id_p->session_id, ue_mod_idP); } else { rb_id = lcid2rbid_ue[ue_mod_idP][channel_idP]; AssertFatal (rb_id < NB_RB_MAX, "UE RB id is too high (%u/%d) lcid %u enb module %u ue module id %u!\n", rb_id, NB_RB_MAX, channel_idP, enb_mod_idP, ue_mod_idP); @@ -417,10 +420,14 @@ mac_rlc_status_resp_t mac_rlc_status_ind( if (enb_flagP) { if (MBMS_flagP) { mbms_id_p = &rlc_mbms_lcid2service_session_id_eNB[enb_mod_idP][channel_idP]; - rb_id = rlc_mbms_array_eNB[enb_mod_idP][mbms_id_p->service_id][mbms_id_p->session_id].rb_id; - rlc_p = (void*)&rlc_mbms_array_eNB[enb_mod_idP][mbms_id_p->service_id][mbms_id_p->session_id].um; - AssertFatal (rlc_mbms_array_eNB[enb_mod_idP][mbms_id_p->service_id][mbms_id_p->session_id].um.allocation == TRUE , - "enB MBMS RLC UM not configured rb id %u lcid %u module %u!\n", rb_id, channel_idP, enb_mod_idP); + rb_id = rlc_mbms_array_eNB[enb_mod_idP][mbms_id_p->service_id][mbms_id_p->session_id].rb_id; + rlc_p = (void*)&rlc_mbms_array_eNB[enb_mod_idP][mbms_id_p->service_id][mbms_id_p->session_id].um; + rlc_mode = RLC_MODE_UM; + if (rlc_mbms_array_eNB[enb_mod_idP][mbms_id_p->service_id][mbms_id_p->session_id].um.allocation == FALSE) { + return mac_rlc_status_resp; + } + //AssertFatal (rlc_mbms_array_eNB[enb_mod_idP][mbms_id_p->service_id][mbms_id_p->session_id].um.allocation == TRUE , + // "enB MBMS RLC UM not configured rb id %u lcid %u module %u!\n", rb_id, channel_idP, enb_mod_idP); } else { rb_id = lcid2rbid_eNB[enb_mod_idP][ue_mod_idP][channel_idP]; if (rb_id >= NB_RB_MAX) { @@ -454,8 +461,9 @@ mac_rlc_status_resp_t mac_rlc_status_ind( } else { if (MBMS_flagP) { mbms_id_p = &rlc_mbms_lcid2service_session_id_ue[ue_mod_idP][channel_idP]; - rb_id = rlc_mbms_array_ue[ue_mod_idP][mbms_id_p->service_id][mbms_id_p->session_id].rb_id; - rlc_p = (void*)&rlc_mbms_array_ue[ue_mod_idP][mbms_id_p->service_id][mbms_id_p->session_id].um; + rb_id = rlc_mbms_array_ue[ue_mod_idP][mbms_id_p->service_id][mbms_id_p->session_id].rb_id; + rlc_p = (void*)&rlc_mbms_array_ue[ue_mod_idP][mbms_id_p->service_id][mbms_id_p->session_id].um; + rlc_mode = RLC_MODE_UM; AssertFatal (rlc_mbms_array_ue[ue_mod_idP][mbms_id_p->service_id][mbms_id_p->session_id].um.allocation == TRUE , "UE MBMS RLC UM not configured rb id %u lcid %u module %u!\n", rb_id, channel_idP, ue_mod_idP); } else { diff --git a/openair2/LAYER2/RLC/rlc_rrc.c b/openair2/LAYER2/RLC/rlc_rrc.c index 6224e6aa0d4..b3b49636a54 100644 --- a/openair2/LAYER2/RLC/rlc_rrc.c +++ b/openair2/LAYER2/RLC/rlc_rrc.c @@ -56,7 +56,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP, mbms_service_id_t mch_id, mbms_service_id; DL_UM_RLC_t dl_um_rlc; #endif - + LOG_D(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] CONFIG REQ ASN1 \n", frameP, (enb_flagP) ? "eNB" : "UE", @@ -112,12 +112,12 @@ rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP, if (rlc_mode == RLC_MODE_NONE) { if (rrc_rlc_add_rlc (enb_mod_idP, ue_mod_idP, frameP, enb_flagP, rb_id, rb_id, RLC_MODE_AM) == RLC_OP_STATUS_OK) { config_req_rlc_am_asn1 ( - frameP, + frameP, enb_flagP, enb_mod_idP, ue_mod_idP, &srb_toaddmod_p->rlc_Config->choice.explicitValue.choice.am, - rb_id, + rb_id, SIGNALLING_RADIO_BEARER); } else { LOG_E(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] ERROR IN ALLOCATING SRB %d \n", @@ -281,7 +281,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP, rlc_mode = rlc_array_ue[ue_mod_idP][drb_id].mode; } LOG_D(RLC, "Adding DRB %d, rb_id %d\n",*drb_toaddmod_p->logicalChannelIdentity,drb_id); - + if (drb_toaddmod_p->rlc_Config) { @@ -414,14 +414,30 @@ rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP, // can set the mch_id = i if (enb_flagP) { - rb_id = (mbms_service_id * maxSessionPerPMCH ) + mbms_session_id; // 1 - rlc_mbms_lcid2service_session_id_eNB[enb_mod_idP][lc_id].service_id = mbms_service_id; - rlc_mbms_lcid2service_session_id_eNB[enb_mod_idP][lc_id].session_id = mbms_session_id; + rb_id = (mbms_service_id * maxSessionPerPMCH ) + mbms_session_id + (maxDRB + 3) * MAX_MOBILES_PER_ENB; // 1 + rlc_mbms_lcid2service_session_id_eNB[enb_mod_idP][lc_id].service_id = mbms_service_id; + rlc_mbms_lcid2service_session_id_eNB[enb_mod_idP][lc_id].session_id = mbms_session_id; + rlc_mbms_array_eNB[enb_mod_idP][mbms_service_id][mbms_session_id].rb_id = rb_id; + rlc_mbms_array_eNB[enb_mod_idP][mbms_service_id][mbms_session_id].instanciated_instance = TRUE; + rlc_mbms_enb_set_lcid_by_rb_id(enb_mod_idP,rb_id,lc_id); } else { rb_id = (mbms_service_id * maxSessionPerPMCH ) + mbms_session_id + (maxDRB + 3); // 15 - rlc_mbms_lcid2service_session_id_eNB[ue_mod_idP][lc_id].service_id = mbms_service_id; - rlc_mbms_lcid2service_session_id_eNB[ue_mod_idP][lc_id].session_id = mbms_session_id; + rlc_mbms_lcid2service_session_id_ue[ue_mod_idP][lc_id].service_id = mbms_service_id; + rlc_mbms_lcid2service_session_id_ue[ue_mod_idP][lc_id].session_id = mbms_session_id; + rlc_mbms_array_ue[ue_mod_idP][mbms_service_id][mbms_session_id].rb_id = rb_id; + rlc_mbms_array_ue[ue_mod_idP][mbms_service_id][mbms_session_id].instanciated_instance = TRUE; + rlc_mbms_ue_set_lcid_by_rb_id(ue_mod_idP,rb_id,lc_id); } + LOG_D(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] CONFIG REQ MBMS ASN1 LC ID %u RB ID %u SESSION ID %u SERVICE ID %u\n", + frameP, + (enb_flagP) ? "eNB" : "UE", + enb_mod_idP, + ue_mod_idP, + lc_id, + rb_id, + mbms_session_id, + mbms_service_id + ); dl_um_rlc.sn_FieldLength = SN_FieldLength_size5; dl_um_rlc.t_Reordering = T_Reordering_ms0; @@ -441,7 +457,7 @@ rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t enb_mod_idP, } } #endif - + LOG_D(RLC, "[FRAME %5u][%s][RLC_RRC][MOD %u/%u] CONFIG REQ ASN1 END \n", frameP, (enb_flagP) ? "eNB" : "UE", @@ -621,7 +637,7 @@ rlc_op_status_t rrc_rlc_add_rlc (module_id_t enb_mod_idP, module_id_t ue_mod_i //----------------------------------------------------------------------------- rlc_mode_t rlc_mode = RLC_MODE_NONE; unsigned int allocation; - + #ifdef OAI_EMU if (enb_flagP) { AssertFatal ((enb_mod_idP >= oai_emulation.info.first_enb_local) && (oai_emulation.info.nb_enb_local > 0), diff --git a/openair2/RRC/LITE/MESSAGES/asn1_msg.c b/openair2/RRC/LITE/MESSAGES/asn1_msg.c index 4deec64ef47..73e3608eaba 100644 --- a/openair2/RRC/LITE/MESSAGES/asn1_msg.c +++ b/openair2/RRC/LITE/MESSAGES/asn1_msg.c @@ -2034,7 +2034,7 @@ uint8_t do_MBSFNAreaConfig(uint8_t Mod_id, memset((void*)pmch_Info_1,0,sizeof(PMCH_Info_r9_t)); pmch_Info_1->pmch_Config_r9.sf_AllocEnd_r9= 3;//take the value of last mbsfn subframe in this CSA period because there is only one PMCH in this mbsfn area - pmch_Info_1->pmch_Config_r9.dataMCS_r9= 17; + pmch_Info_1->pmch_Config_r9.dataMCS_r9= 7; pmch_Info_1->pmch_Config_r9.mch_SchedulingPeriod_r9= PMCH_Config_r9__mch_SchedulingPeriod_r9_rf16; // MBMSs-SessionInfoList-r9 diff --git a/openair2/UTIL/MEM/mem_block.h b/openair2/UTIL/MEM/mem_block.h index 39fa07e0c8d..759928e0cec 100755 --- a/openair2/UTIL/MEM/mem_block.h +++ b/openair2/UTIL/MEM/mem_block.h @@ -43,7 +43,7 @@ public_mem_block(void check_mem_area (void);) private_mem_block(void check_free_mem_block (mem_block_t * leP);) # endif #ifdef USER_MODE -# define MEM_SCALE /*MAX_RG */ MAX_MOBILES_PER_RG +# define MEM_SCALE /*MAX_RG */ MAX_MOBILES_PER_ENB #else # ifdef NODE_RG # define MEM_SCALE 2 diff --git a/openair2/UTIL/OTG/otg_rx.c b/openair2/UTIL/OTG/otg_rx.c index 8426e01594e..f586144fb44 100644 --- a/openair2/UTIL/OTG/otg_rx.c +++ b/openair2/UTIL/OTG/otg_rx.c @@ -28,12 +28,12 @@ *******************************************************************************/ /*! \file otg_rx.c -* \brief function containing the OTG traffic generation functions +* \brief function containing the OTG traffic generation functions * \author A. Hafsaoui and Navid Nikaein * \date 2011 * \version 0.1 * \company Eurecom -* \email: +* \email: * \note * \warning */ @@ -49,7 +49,7 @@ #include <mysql.h> #include <m_ctype.h> #include <sql_common.h> -#endif +#endif extern unsigned char NB_eNB_INST; extern unsigned char NB_UE_INST; @@ -62,7 +62,7 @@ extern unsigned char NB_UE_INST; // Check if the packet is well received or not and extract data int otg_rx_pkt( int src, int dst, int ctime, char *buffer_tx, unsigned int size){ - + int bytes_read=0; otg_hdr_info_t * otg_hdr_info_rx; otg_hdr_t * otg_hdr_rx; @@ -72,29 +72,31 @@ int otg_rx_pkt( int src, int dst, int ctime, char *buffer_tx, unsigned int size) unsigned int lost_packet=0; //int header_size; - if (buffer_tx!=NULL) { + if (buffer_tx!=NULL) { otg_hdr_info_rx = (otg_hdr_info_t *) (&buffer_tx[bytes_read]); bytes_read += sizeof (otg_hdr_info_t); + LOG_D(OTG,"otg_rx_pkt functions: source %d, destination %d, size %d, otg_hdr_info_rx->flag %.4x, otg_hdr_info_rx->size %d \n", + src,dst,size,otg_hdr_info_rx->flag,otg_hdr_info_rx->size); + - - if (((otg_hdr_info_rx->flag == 0xffff)||(otg_hdr_info_rx->flag == 0xbbbb) || (otg_hdr_info_rx->flag == 0x1000)) && + if (((otg_hdr_info_rx->flag == 0xffff)||(otg_hdr_info_rx->flag == 0xbbbb) || (otg_hdr_info_rx->flag == 0x1000)) && (otg_hdr_info_rx->size ==size )){ //data traffic - + LOG_I(OTG,"MAX_RX_INFO %d %d \n",NB_eNB_INST, NB_UE_INST); - + /*is_size_ok= 0; if (( otg_hdr_info_rx->size ) == size ) {*/ is_size_ok= 1; otg_hdr_rx = (otg_hdr_t *) (&buffer_tx[bytes_read]); LOG_I(OTG,"[SRC %d][DST %d] [FLOW_idx %d][APP TYPE %d] RX INFO pkt at time %d: flag 0x %x, seq number %d, tx time %d, size (hdr %d, pdcp %d) \n", src, dst,otg_hdr_rx->flow_id, otg_hdr_rx->traffic_type, ctime, otg_hdr_info_rx->flag, otg_hdr_rx->seq_num, otg_hdr_rx->time, otg_hdr_info_rx->size, size); bytes_read += sizeof (otg_hdr_t); - + if(otg_hdr_rx->traffic_type > MAX_NUM_APPLICATION){ - LOG_W(OTG,"RX packet: application type out of range %d for the pair of (src %d, dst %d) \n", + LOG_W(OTG,"RX packet: application type out of range %d for the pair of (src %d, dst %d) \n", otg_hdr_rx->traffic_type, src, dst); otg_hdr_rx->traffic_type=0; } - + if (otg_hdr_info_rx->flag == 0xffff){ seq_num_rx=otg_info->seq_num_rx[src][dst][otg_hdr_rx->traffic_type]; if (src<NB_eNB_INST) @@ -109,10 +111,10 @@ int otg_rx_pkt( int src, int dst, int ctime, char *buffer_tx, unsigned int size) // rx_check_loss(src, dst, otg_hdr_info_rx->flag, otg_hdr_rx->seq_num, &seq_num_rx, &nb_loss_pkts); // otg_multicast_info->loss_rate[src][dst][otg_hdr_rx->traffic_type]=nb_loss_pkts; //otg_multicast_info->rx_sn[src][dst][otg_hdr_rx->traffic_type]=seq_num_rx; - // LOG_I(OTG,"received a multicast packet with size %d sn %d ran owd %d loss rate %d\n", - // otg_hdr_info_rx->size, seq_num_rx, ctime- otg_hdr_rx->time, nb_loss_pkts); + LOG_I(OTG,"received a multicast packet with size %d sn %d ran owd %d loss rate %d\n", + otg_hdr_info_rx->size, seq_num_rx, ctime- otg_hdr_rx->time, nb_loss_pkts); //return 0; - + } else{ seq_num_rx=otg_info->seq_num_rx_background[src][dst]; @@ -122,18 +124,18 @@ int otg_rx_pkt( int src, int dst, int ctime, char *buffer_tx, unsigned int size) nb_loss_pkts=otg_info->nb_loss_pkts_background_ul[src][dst]; } - + LOG_D(OTG,"[%d][%d] AGGREGATION LEVEL (RX) %d \n", src, dst, otg_hdr_rx->aggregation_level); otg_info->aggregation_level[src][dst]=otg_hdr_rx->aggregation_level; - + /* Loss and out of sequence data management */ lost_packet= rx_check_loss(src, dst, otg_hdr_info_rx->flag, otg_hdr_rx->seq_num, &seq_num_rx, &nb_loss_pkts); - - + + if (otg_info->owd_const[src][dst][otg_hdr_rx->flow_id]==0) owd_const_gen(src,dst,otg_hdr_rx->flow_id, otg_hdr_rx->traffic_type); - - + + /******/ /* float owd_const_capillary_v=owd_const_capillary()/2; @@ -148,13 +150,13 @@ float owd_const_application_v=owd_const_application()/2; */ /******/ // } - + if (otg_hdr_rx->time<=ctime){ otg_info->radio_access_delay[src][dst]=ctime- otg_hdr_rx->time; otg_multicast_info->radio_access_delay[src][dst]=ctime- otg_hdr_rx->time; - } else + } else LOG_N(OTG,"received packet has tx time %d greater than the current time %d\n",otg_hdr_rx->time,ctime ); - + otg_info->rx_pkt_owd[src][dst]=otg_info->owd_const[src][dst][otg_hdr_rx->flow_id]+ otg_info->radio_access_delay[src][dst]; otg_multicast_info->rx_pkt_owd[src][dst]=otg_multicast_info->radio_access_delay[src][dst]; // compute the jitter by ignoring the packet loss @@ -165,7 +167,7 @@ float owd_const_application_v=owd_const_application()/2; otg_info->rx_pkt_jitter[src][dst]=0; else // for the consecutive packets otg_info->rx_pkt_jitter[src][dst]= abs(otg_info->rx_pkt_owd_history[src][dst][0] - otg_info->rx_pkt_owd_history[src][dst][1]); - + LOG_D(OTG,"The packet jitter for the pair (src %d, dst %d)) at %d is %lf (current %lf, previous %lf) \n", src, dst, ctime, otg_info->rx_pkt_jitter[src][dst], otg_info->rx_pkt_owd_history[src][dst][0], otg_info->rx_pkt_owd_history[src][dst][1]); @@ -174,37 +176,37 @@ float owd_const_application_v=owd_const_application()/2; if (otg_hdr_info_rx->flag == 0x1000){ LOG_I(OTG,"[SRC%d -> DST %d] Received a multicast packet at time %d with size %d, seq num %d, ran owd %d number loss packet %d\n", dst, src, ctime,otg_hdr_info_rx->size, otg_hdr_rx->seq_num, ctime - otg_hdr_rx->time, nb_loss_pkts); - - LOG_I(OTG,"INFO LATENCY :: [SRC %d][DST %d] radio access %.2f (tx time %d, ctime %d), OWD:%.2f (ms):\n", + + LOG_I(OTG,"INFO LATENCY :: [SRC %d][DST %d] radio access %.2f (tx time %d, ctime %d), OWD:%.2f (ms):\n", src, dst, otg_multicast_info->radio_access_delay[src][dst], otg_hdr_rx->time, ctime , otg_multicast_info->rx_pkt_owd[src][dst]); if (otg_multicast_info->rx_owd_max[src][dst][otg_hdr_rx->traffic_type]==0){ otg_multicast_info->rx_owd_max[src][dst][otg_hdr_rx->traffic_type]=otg_multicast_info->rx_pkt_owd[src][dst]; otg_multicast_info->rx_owd_min[src][dst][otg_hdr_rx->traffic_type]=otg_multicast_info->rx_pkt_owd[src][dst]; - } + } else { otg_multicast_info->rx_owd_max[src][dst][otg_hdr_rx->traffic_type]=MAX(otg_multicast_info->rx_owd_max[src][dst][otg_hdr_rx->traffic_type],otg_multicast_info->rx_pkt_owd[src][dst] ); otg_multicast_info->rx_owd_min[src][dst][otg_hdr_rx->traffic_type]=MIN(otg_multicast_info->rx_owd_min[src][dst][otg_hdr_rx->traffic_type],otg_multicast_info->rx_pkt_owd[src][dst] ); } - if (g_otg->curve==1){ + if (g_otg->curve==1){ if (g_otg->owd_radio_access==0) add_tab_metric(src, dst, otg_multicast_info->rx_pkt_owd[src][dst], ((otg_hdr_info_rx->size*1000*8)/(otg_multicast_info->rx_pkt_owd[src][dst]*1024 )), otg_hdr_rx->time); else - add_tab_metric(src, dst, otg_multicast_info->radio_access_delay[src][dst], ((otg_hdr_info_rx->size*1000*8)/(otg_multicast_info->rx_pkt_owd[src][dst]*1024 )), otg_hdr_rx->time); + add_tab_metric(src, dst, otg_multicast_info->radio_access_delay[src][dst], ((otg_hdr_info_rx->size*1000*8)/(otg_multicast_info->rx_pkt_owd[src][dst]*1024 )), otg_hdr_rx->time); } otg_multicast_info->rx_total_bytes_dl+=otg_hdr_info_rx->size; } else { - - LOG_I(OTG,"INFO LATENCY :: [SRC %d][DST %d] radio access %.2f (tx time %d, ctime %d), OWD:%.2f (ms):\n", + + LOG_I(OTG,"INFO LATENCY :: [SRC %d][DST %d] radio access %.2f (tx time %d, ctime %d), OWD:%.2f (ms):\n", src, dst, otg_info->radio_access_delay[src][dst], otg_hdr_rx->time, ctime , otg_info->rx_pkt_owd[src][dst]); if (otg_hdr_info_rx->flag == 0xffff){ - + if (otg_info->rx_owd_max[src][dst][otg_hdr_rx->traffic_type]==0){ otg_info->rx_owd_max[src][dst][otg_hdr_rx->traffic_type]=otg_info->rx_pkt_owd[src][dst]; otg_info->rx_owd_min[src][dst][otg_hdr_rx->traffic_type]=otg_info->rx_pkt_owd[src][dst]; - } + } else { otg_info->rx_owd_max[src][dst][otg_hdr_rx->traffic_type]=MAX(otg_info->rx_owd_max[src][dst][otg_hdr_rx->traffic_type],otg_info->rx_pkt_owd[src][dst] ); otg_info->rx_owd_min[src][dst][otg_hdr_rx->traffic_type]=MIN(otg_info->rx_owd_min[src][dst][otg_hdr_rx->traffic_type],otg_info->rx_pkt_owd[src][dst] ); @@ -212,66 +214,66 @@ float owd_const_application_v=owd_const_application()/2; if (otg_info->rx_jitter_max[src][dst][otg_hdr_rx->traffic_type]==0){ otg_info->rx_jitter_max[src][dst][otg_hdr_rx->traffic_type]=otg_info->rx_pkt_jitter[src][dst]; otg_info->rx_jitter_min[src][dst][otg_hdr_rx->traffic_type]=otg_info->rx_pkt_jitter[src][dst]; - } + } else if (lost_packet==0){ otg_info->rx_jitter_max[src][dst][otg_hdr_rx->traffic_type]=MAX(otg_info->rx_jitter_max[src][dst][otg_hdr_rx->traffic_type],otg_info->rx_pkt_jitter[src][dst] ); otg_info->rx_jitter_min[src][dst][otg_hdr_rx->traffic_type]=MIN(otg_info->rx_jitter_min[src][dst][otg_hdr_rx->traffic_type],otg_info->rx_pkt_jitter[src][dst] ); // avg jitter - otg_info->rx_jitter_avg[src][dst][otg_hdr_rx->traffic_type] += otg_info->rx_pkt_jitter[src][dst]; + otg_info->rx_jitter_avg[src][dst][otg_hdr_rx->traffic_type] += otg_info->rx_pkt_jitter[src][dst]; otg_info->rx_jitter_sample[src][dst][otg_hdr_rx->traffic_type] +=1; } - + } - - if (g_otg->curve==1){ + + if (g_otg->curve==1){ if (g_otg->owd_radio_access==0) add_tab_metric(src, dst, otg_info->rx_pkt_owd[src][dst], ((otg_hdr_info_rx->size*1000*8)/(otg_info->rx_pkt_owd[src][dst]*1024 )), otg_hdr_rx->time); else - add_tab_metric(src, dst, otg_info->radio_access_delay[src][dst], ((otg_hdr_info_rx->size*1000*8)/(otg_info->rx_pkt_owd[src][dst]*1024 )), otg_hdr_rx->time); + add_tab_metric(src, dst, otg_info->radio_access_delay[src][dst], ((otg_hdr_info_rx->size*1000*8)/(otg_info->rx_pkt_owd[src][dst]*1024 )), otg_hdr_rx->time); } - + if (src<NB_eNB_INST) otg_info->rx_total_bytes_dl+=otg_hdr_info_rx->size; else otg_info->rx_total_bytes_ul+=otg_hdr_info_rx->size; - + } - + //LOG_I(OTG,"RX INFO :: RTT MIN(one way) ms: %.2f, RTT MAX(one way) ms: %.2f \n", otg_info->rx_owd_min[src][dst], otg_info->rx_owd_max[src][dst]); - - /* xforms part: add metrics */ - + + /* xforms part: add metrics */ + //printf("payload_size %d, header_size %d \n", otg_hdr_rx->pkts_size, otg_hdr_rx->hdr_type); LOG_I(OTG,"[RX] OTG packet, PACKET SIZE [SRC %d][DST %d]: Flag (0x%x), time(%d), Seq num (%d), Total size (%d)\n", src, dst, otg_hdr_info_rx->flag, ctime, otg_hdr_rx->seq_num, size); /*LOG_I(OTG,"details::RX [SRC %d][DST %d]: Flag (0x%x), time(%d), Seq num (%d), Total size (%d), header(%d), payload (%d) \n", src, dst, otg_hdr_info_rx->flag, ctime, otg_hdr_rx->seq_num, size, strlen(packet_rx->header), strlen(packet_rx->payload));*/ - - + + if (otg_hdr_info_rx->flag == 0xffff){ otg_info->rx_num_pkt[src][dst][otg_hdr_rx->traffic_type]+=1; otg_info->rx_num_bytes[src][dst][otg_hdr_rx->traffic_type]+=otg_hdr_info_rx->size; otg_info->seq_num_rx[src][dst][otg_hdr_rx->traffic_type]=seq_num_rx; - + if (src<NB_eNB_INST) otg_info->nb_loss_pkts_dl[src][dst][otg_hdr_rx->traffic_type]=nb_loss_pkts; else - otg_info->nb_loss_pkts_ul[src][dst][otg_hdr_rx->traffic_type]=nb_loss_pkts; - + otg_info->nb_loss_pkts_ul[src][dst][otg_hdr_rx->traffic_type]=nb_loss_pkts; + /*Plots of latency and goodput are only plotted for the data traffic*/ /*measurements are done for the data and background traffic */ - + if (g_otg->latency_metric) { if (g_otg->owd_radio_access==0) - add_log_metric(src, dst, otg_hdr_rx->time, otg_info->rx_pkt_owd[src][dst], OTG_LATENCY); + add_log_metric(src, dst, otg_hdr_rx->time, otg_info->rx_pkt_owd[src][dst], OTG_LATENCY); else { - add_log_metric(src, dst, otg_hdr_rx->time, otg_info->radio_access_delay[src][dst], OTG_LATENCY); - add_log_metric(src, dst, otg_hdr_rx->time, otg_info->rx_pkt_jitter[src][dst], OTG_JITTER); + add_log_metric(src, dst, otg_hdr_rx->time, otg_info->radio_access_delay[src][dst], OTG_LATENCY); + add_log_metric(src, dst, otg_hdr_rx->time, otg_info->rx_pkt_jitter[src][dst], OTG_JITTER); } } - + if (g_otg->throughput_metric) add_log_metric(src, dst, otg_hdr_rx->time, ((otg_hdr_info_rx->size*1000*8)/(otg_info->rx_pkt_owd[src][dst]*1024 )), OTG_GP); /* compute the throughput in Kbit/s */ - - } + + } else if (otg_hdr_info_rx->flag == 0x1000){ otg_multicast_info->rx_num_pkt[src][dst][otg_hdr_rx->traffic_type]+=1; otg_multicast_info->rx_num_bytes[src][dst][otg_hdr_rx->traffic_type]+=otg_hdr_info_rx->size; @@ -281,16 +283,16 @@ float owd_const_application_v=owd_const_application()/2; /*Plots of latency and goodput are only plotted for the data traffic*/ /*measurements are done for the data and background traffic */ - + if (g_otg->latency_metric) { if (g_otg->owd_radio_access==0) - add_log_metric(src, dst, otg_hdr_rx->time, otg_multicast_info->rx_pkt_owd[src][dst], OTG_LATENCY); + add_log_metric(src, dst, otg_hdr_rx->time, otg_multicast_info->rx_pkt_owd[src][dst], OTG_LATENCY); else - add_log_metric(src, dst, otg_hdr_rx->time, otg_multicast_info->radio_access_delay[src][dst], OTG_LATENCY); + add_log_metric(src, dst, otg_hdr_rx->time, otg_multicast_info->radio_access_delay[src][dst], OTG_LATENCY); } if (g_otg->throughput_metric) add_log_metric(src, dst, otg_hdr_rx->time, ((otg_hdr_info_rx->size*1000*8)/(otg_multicast_info->rx_pkt_owd[src][dst]*1024 )), OTG_GP); /* compute the throughput in Kbit/s */ - } + } else{ otg_info->rx_num_pkt_background[src][dst]+=1; otg_info->rx_num_bytes_background[src][dst]+=otg_hdr_info_rx->size; @@ -299,17 +301,17 @@ float owd_const_application_v=owd_const_application()/2; otg_info->nb_loss_pkts_background_dl[src][dst]=nb_loss_pkts; else otg_info->nb_loss_pkts_background_ul[src][dst]=nb_loss_pkts; - + if (g_otg->latency_metric) { if (g_otg->owd_radio_access==0) - add_log_metric(src, dst, otg_hdr_rx->time, otg_info->rx_pkt_owd[src][dst], OTG_LATENCY_BG); + add_log_metric(src, dst, otg_hdr_rx->time, otg_info->rx_pkt_owd[src][dst], OTG_LATENCY_BG); else - add_log_metric(src, dst, otg_hdr_rx->time, otg_info->radio_access_delay[src][dst], OTG_LATENCY_BG); + add_log_metric(src, dst, otg_hdr_rx->time, otg_info->radio_access_delay[src][dst], OTG_LATENCY_BG); } if (g_otg->throughput_metric) add_log_metric(src, dst, otg_hdr_rx->time, ((otg_hdr_info_rx->size*1000*8)/(otg_info->rx_pkt_owd[src][dst]*1024 )), OTG_GP_BG); } - + if (is_size_ok == 0) { otg_hdr_rx = (otg_hdr_t *) (&buffer_tx[bytes_read]); LOG_W(OTG,"[SRC %d][DST %d] RX pkt: seq number %d size mis-matche (hdr %d, pdcp %d) \n", src, dst, otg_hdr_rx->seq_num, otg_hdr_info_rx->size, size); @@ -317,10 +319,10 @@ float owd_const_application_v=owd_const_application()/2; } return(0); } else{ - LOG_W(OTG,"RX: Not an OTG pkt, forward to upper layer (flag %x, size %d, pdcp_size %d) FIX ME \n", otg_hdr_info_rx->flag, otg_hdr_info_rx->size, size); - return(0); //to be fixed on the real case to one + LOG_W(OTG,"RX: Not an OTG pkt, forward to upper layer (flag %x, size %d, pdcp_size %d) FIX ME \n", otg_hdr_info_rx->flag, otg_hdr_info_rx->size, size); + return(0); //to be fixed on the real case to one } - + } return(0); @@ -339,14 +341,14 @@ int rx_check_loss(int src, int dst, unsigned int flag, int seq_num, unsigned int *seq_num_rx+=1; } /* (2) Receieved packet with a sequence number higher than the expected sequence number (there is a gap): packet loss */ - else if (seq_num>*seq_num_rx){ // out of sequence packet: previous packet lost + else if (seq_num>*seq_num_rx){ // out of sequence packet: previous packet lost LOG_D(OTG,"check_packet :: (src=%d,dst=%d, flag=0x%x) :: out of sequence :: packet seq_num TX=%d > seq_num RX=%d \n",src,dst,flag, seq_num, *seq_num_rx); *nb_loss_pkts+=seq_num-(*seq_num_rx); *seq_num_rx=seq_num+1; lost_packet=1; - } + } /* (3) Receieved packet with a sequence number less than the expected sequence number: recovery after loss/out of sequence */ - else if (seq_num< *seq_num_rx){ //the received packet arrived late + else if (seq_num< *seq_num_rx){ //the received packet arrived late *nb_loss_pkts-=1; LOG_D(OTG,"check_packet :: (src=%d,dst=%d, flag=0x%x) :: recovery after loss or out of sequence :: packet seq_num TX=%d < seq_num RX=%d \n",src,dst,flag, seq_num, *seq_num_rx); } @@ -367,16 +369,16 @@ void owd_const_gen(int src, int dst, int flow_id, unsigned int flag){ otg_info->owd_const[src][dst][flow_id]+=(owd_const_capillary()/2); LOG_D(OTG,"(RX) [src %d] [dst %d] [ID %d] TRAFFIC_TYPE IS M2M [Add Capillary const]\n", src, dst, flow_id); } - else + else LOG_D(OTG,"(RX) [src %d] [dst %d] [ID %d] TRAFFIC_TYPE WITHOUT M2M [Capillary const]\n", src, dst, flow_id); } float owd_const_capillary(){ - /*return (uniform_dist(MIN_APPLICATION_PROCESSING_GATEWAY_DELAY, MAX_APPLICATION_PROCESSING_GATEWAY_DELAY) + - uniform_dist(MIN_FORMATING_TRANSFERRING_DELAY, MAX_FORMATING_TRANSFERRING_DELAY) + - uniform_dist(MIN_ACCESS_DELAY, MAX_ACCESS_DELAY) + + /*return (uniform_dist(MIN_APPLICATION_PROCESSING_GATEWAY_DELAY, MAX_APPLICATION_PROCESSING_GATEWAY_DELAY) + + uniform_dist(MIN_FORMATING_TRANSFERRING_DELAY, MAX_FORMATING_TRANSFERRING_DELAY) + + uniform_dist(MIN_ACCESS_DELAY, MAX_ACCESS_DELAY) + TERMINAL_ACCESS_DELAY);*/ return ((double)MIN_APPLICATION_PROCESSING_GATEWAY_DELAY+ (double)MAX_APPLICATION_PROCESSING_GATEWAY_DELAY + (double)MIN_FORMATING_TRANSFERRING_DELAY+ (double)MAX_FORMATING_TRANSFERRING_DELAY+ (double)MIN_ACCESS_DELAY+(double)MAX_ACCESS_DELAY) /2 + (double)TERMINAL_ACCESS_DELAY; } @@ -384,15 +386,15 @@ float owd_const_capillary(){ float owd_const_mobile_core(){ /*double delay; - // this is a delay model for a loaded GGSN according to + // this is a delay model for a loaded GGSN according to //"M. Laner, P. Svoboda and M. Rupp, Latency Analysis of 3G Network Components, EW'12, Poznan, Poland, 2012", table 2, page 6. if(uniform_rng ()<0.3){ delay=uniform_dist (0.4,1.2); }else{ // in this case, according to the fit in the paper, // the delay is generalized pareto: GP(k=0.75,s=0.55,t=1.2) - // using inverse cdf method we have CDF(x)=1-(k(x-t)/s+1)^(-1/k), - // x=CDF^(-1)(u)=t+s/k*((1-u)^(-k)-1) , hence when u~uniform, than x~GP(k,s,t) + // using inverse cdf method we have CDF(x)=1-(k(x-t)/s+1)^(-1/k), + // x=CDF^(-1)(u)=t+s/k*((1-u)^(-k)-1) , hence when u~uniform, than x~GP(k,s,t) double k,s,t,u; k=0.75; diff --git a/targets/PROJECTS/E-MBMS/start_enb.bash b/targets/PROJECTS/E-MBMS/start_enb.bash index 48015f71fce..c1aabccc6fc 100755 --- a/targets/PROJECTS/E-MBMS/start_enb.bash +++ b/targets/PROJECTS/E-MBMS/start_enb.bash @@ -6,10 +6,14 @@ declare -x EMULATION_DEV_INTERFACE="eth0" declare -x IP_DRIVER_NAME="oai_nw_drv" declare -x LTEIF="oai0" declare -x ENB_IPv4="10.0.1.1" +declare -x UE_IPv4="10.0.1.11" declare -x ENB_IPv6="9998::1" +declare -x UE_IPv6="9998::11" declare -x ENB_IPv6_CIDR=$ENB_IPv6"/64" declare -x ENB_IPv4_CIDR=$ENB_IPv4"/24" declare -a NAS_IMEI=( 3 9 1 8 3 6 6 2 0 0 0 0 0 0 ) +declare -x DEFAULT_RB_ID=3 +declare -x MBMS_RB_ID=225 #------------------------------------------------ LOG_FILE="/tmp/oai_sim_enb.log" @@ -72,33 +76,35 @@ fgrep lte /etc/iproute2/rt_tables > /dev/null 2>&1 if [ $? -ne 0 ]; then echo "200 lte " >> /etc/iproute2/rt_tables fi -ip rule add fwmark 3 table lte -ip route add default dev $LTEIF table lte +ip rule add fwmark $DEFAULT_RB_ID table lte +ip rule add fwmark $MBMS_RB_ID table lte +ip route add default dev $LTEIF table lte ip route add 239.0.0.160/28 dev $EMULATION_DEV_INTERFACE -/sbin/ebtables -t nat -A POSTROUTING -p arp -j mark --mark-set 3 +/sbin/ebtables -t nat -A POSTROUTING -p arp -j mark --mark-set $DEFAULT_RB_ID -/sbin/ip6tables -A OUTPUT -t mangle -o oai0 -m pkttype --pkt-type multicast -j MARK --set-mark 3 -/sbin/iptables -A OUTPUT -t mangle -o oai0 -m pkttype --pkt-type broadcast -j MARK --set-mark 3 -/sbin/iptables -A OUTPUT -t mangle -o oai0 -m pkttype --pkt-type multicast -j MARK --set-mark 3 +#/sbin/ip6tables -A OUTPUT -t mangle -o oai0 -m pkttype --pkt-type multicast -j MARK --set-mark $DEFAULT_RB_ID +#/sbin/iptables -A OUTPUT -t mangle -o oai0 -m pkttype --pkt-type broadcast -j MARK --set-mark $DEFAULT_RB_ID +#/sbin/iptables -A OUTPUT -t mangle -o oai0 -m pkttype --pkt-type multicast -j MARK --set-mark $DEFAULT_RB_ID -/sbin/ip6tables -A POSTROUTING -t mangle -o oai0 -m pkttype --pkt-type multicast -j MARK --set-mark 3 -/sbin/iptables -A POSTROUTING -t mangle -o oai0 -m pkttype --pkt-type broadcast -j MARK --set-mark 3 -/sbin/iptables -A POSTROUTING -t mangle -o oai0 -m pkttype --pkt-type multicast -j MARK --set-mark 3 +#/sbin/ip6tables -A POSTROUTING -t mangle -o oai0 -m pkttype --pkt-type multicast -j MARK --set-mark $DEFAULT_RB_ID +#/sbin/iptables -A POSTROUTING -t mangle -o oai0 -m pkttype --pkt-type broadcast -j MARK --set-mark $DEFAULT_RB_ID +#/sbin/iptables -A POSTROUTING -t mangle -o oai0 -m pkttype --pkt-type multicast -j MARK --set-mark $DEFAULT_RB_ID #All other traffic is sent on the RAB you want (mark = RAB ID) -/sbin/ip6tables -A POSTROUTING -t mangle -o oai0 -m pkttype --pkt-type unicast -j MARK --set-mark 3 -/sbin/ip6tables -A OUTPUT -t mangle -o oai0 -m pkttype --pkt-type unicast -j MARK --set-mark 3 -/sbin/iptables -A POSTROUTING -t mangle -o oai0 -m pkttype --pkt-type unicast -j MARK --set-mark 3 -/sbin/iptables -A OUTPUT -t mangle -o oai0 -m pkttype --pkt-type unicast -j MARK --set-mark 3 +/sbin/ip6tables -A POSTROUTING -t mangle -o oai0 -j MARK --set-mark $MBMS_RB_ID + +#/sbin/ip6tables -A POSTROUTING -t mangle -o oai0 -m pkttype --pkt-type unicast -j MARK --set-mark $DEFAULT_RB_ID +#/sbin/ip6tables -A OUTPUT -t mangle -o oai0 -m pkttype --pkt-type unicast -j MARK --set-mark $DEFAULT_RB_ID +#/sbin/iptables -A POSTROUTING -t mangle -o oai0 -m pkttype --pkt-type unicast -j MARK --set-mark $DEFAULT_RB_ID +#/sbin/iptables -A OUTPUT -t mangle -o oai0 -m pkttype --pkt-type unicast -j MARK --set-mark $DEFAULT_RB_ID -NOW=$(date +"%Y-%m-%d.%Hh_%Mm_%Ss") rotate_log_file $LOG_FILE #xterm -hold -e gdb --args #$OPENAIR_TARGETS/SIMU/USER/oaisim -a -Q3 -s15 -K $LOG_FILE -l9 -u0 -b1 -M0 -p2 -g1 -D $EMULATION_DEV_INTERFACE -O $THIS_SCRIPT_PATH/enb.conf & #$OPENAIR_TARGETS/SIMU/USER/oaisim -a -l3 -u0 -b1 -M0 -p2 -g1 -D $EMULATION_DEV_INTERFACE -O $THIS_SCRIPT_PATH/enb.conf & -$OPENAIR_TARGETS/SIMU/USER/oaisim -a -l3 -u0 -b1 -M0 -p2 -g1 -D 192.168.55.51 -O $THIS_SCRIPT_PATH/enb.conf & +$OPENAIR_TARGETS/SIMU/USER/oaisim -a -Q3 -l7 -u0 -b1 -M0 -p2 -g1 -D 192.168.55.51 -O $THIS_SCRIPT_PATH/enb.conf | grep "PDCP\|RLC\|RRC" & wait_process_started oaisim diff --git a/targets/SIMU/USER/oaisim_config.c b/targets/SIMU/USER/oaisim_config.c index 8ef289f6eb2..de2dce38ff4 100644 --- a/targets/SIMU/USER/oaisim_config.c +++ b/targets/SIMU/USER/oaisim_config.c @@ -460,26 +460,26 @@ int olg_config() { oai_emulation.info.g_log_verbosity, oai_emulation.emulation_config.log_emu.interval ); - /* + // if perf eval then reset the otg log level set_comp_log(PHY, LOG_EMERG, 0x15,1); set_comp_log(EMU, LOG_EMERG, 0x15,1); set_comp_log(OCG, LOG_EMERG, 0x15,1); set_comp_log(OCM, LOG_EMERG, 0x15,1); set_comp_log(OTG, LOG_EMERG, 0x15,1); - set_comp_log(MAC, LOG_DEBUG, 0x15,1); + set_comp_log(MAC, LOG_EMERG, 0x15,1); set_comp_log(OMG, LOG_EMERG, 0x15,1); set_comp_log(OPT, LOG_EMERG, 0x15,1); - set_comp_log(PDCP, LOG_TRACE, LOG_MED,1); - set_comp_log(RLC, LOG_TRACE, LOG_MED,1); - set_comp_log(RRC, LOG_TRACE, LOG_MED,1); + set_comp_log(PDCP, LOG_DEBUG, LOG_MED,1); + set_comp_log(RLC, LOG_DEBUG, LOG_MED,1); + set_comp_log(RRC, LOG_DEBUG, LOG_MED,1); #if defined(ENABLE_RAL) set_comp_log(RAL_ENB, LOG_TRACE, LOG_MED,1); set_comp_log(RAL_UE, LOG_TRACE, LOG_MED,1); set_log(RAL_ENB, LOG_DEBUG, 1); set_log(RAL_UE, LOG_DEBUG, 1); #endif - + /* //set_log(OCG, LOG_DEBUG, 1); //set_log(EMU, LOG_INFO, 20); set_log(MAC, LOG_DEBUG, 1); -- GitLab