Commit 30b4c553 authored by nguyennd's avatar nguyennd
Browse files

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
parent 42f7ca06
......@@ -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
......
......@@ -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
......
......@@ -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);
}
......@@ -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