Merge branch 'develop-nos1-fixes' of https://gitlab.eurecom.fr/oai/openairinterface5g into develop-nos1-fixes
Conflicts: cmake_targets/CMakeLists.txt openair1/SCHED/phy_procedures_lte_eNb.c openair2/RRC/LITE/rrc_UE.c openair2/RRC/LITE/rrc_common.c targets/SIMU/USER/oaisim_functions.c
This commit is contained in:
@@ -98,138 +98,6 @@ static int enb_check_band_frequencies(char* lib_config_file_name_pP,
|
||||
return errors;
|
||||
}
|
||||
|
||||
|
||||
/* --------------------------------------------------------*/
|
||||
/* from here function to use configuration module */
|
||||
void RCconfig_RU(void) {
|
||||
|
||||
int j = 0;
|
||||
int i = 0;
|
||||
|
||||
|
||||
paramdef_t RUParams[] = RUPARAMS_DESC;
|
||||
paramlist_def_t RUParamList = {CONFIG_STRING_RU_LIST,NULL,0};
|
||||
|
||||
|
||||
config_getlist( &RUParamList,RUParams,sizeof(RUParams)/sizeof(paramdef_t), NULL);
|
||||
|
||||
|
||||
if ( RUParamList.numelt > 0) {
|
||||
|
||||
RC.ru = (RU_t**)malloc(RC.nb_RU*sizeof(RU_t*));
|
||||
|
||||
|
||||
|
||||
|
||||
RC.ru_mask=(1<<NB_RU) - 1;
|
||||
printf("Set RU mask to %lx\n",RC.ru_mask);
|
||||
|
||||
for (j = 0; j < RC.nb_RU; j++) {
|
||||
|
||||
RC.ru[j] = (RU_t*)malloc(sizeof(RU_t));
|
||||
memset((void*)RC.ru[j],0,sizeof(RU_t));
|
||||
RC.ru[j]->idx = j;
|
||||
|
||||
printf("Creating RC.ru[%d]:%p\n", j, RC.ru[j]);
|
||||
|
||||
RC.ru[j]->if_timing = synch_to_ext_device;
|
||||
if (RC.nb_L1_inst >0)
|
||||
RC.ru[j]->num_eNB = RUParamList.paramarray[j][RU_ENB_LIST_IDX].numelt;
|
||||
else
|
||||
RC.ru[j]->num_eNB = 0;
|
||||
for (i=0;i<RC.ru[j]->num_eNB;i++) RC.ru[j]->eNB_list[i] = RC.eNB[RUParamList.paramarray[j][RU_ENB_LIST_IDX].iptr[i]][0];
|
||||
|
||||
|
||||
if (strcmp(*(RUParamList.paramarray[j][RU_LOCAL_RF_IDX].strptr), "yes") == 0) {
|
||||
if ( !(config_isparamset(RUParamList.paramarray[j],RU_LOCAL_IF_NAME_IDX)) ) {
|
||||
RC.ru[j]->if_south = LOCAL_RF;
|
||||
RC.ru[j]->function = eNodeB_3GPP;
|
||||
printf("Setting function for RU %d to eNodeB_3GPP\n",j);
|
||||
}
|
||||
else {
|
||||
RC.ru[j]->eth_params.local_if_name = strdup(*(RUParamList.paramarray[j][RU_LOCAL_IF_NAME_IDX].strptr));
|
||||
RC.ru[j]->eth_params.my_addr = strdup(*(RUParamList.paramarray[j][RU_LOCAL_ADDRESS_IDX].strptr));
|
||||
RC.ru[j]->eth_params.remote_addr = strdup(*(RUParamList.paramarray[j][RU_REMOTE_ADDRESS_IDX].strptr));
|
||||
RC.ru[j]->eth_params.my_portc = *(RUParamList.paramarray[j][RU_LOCAL_PORTC_IDX].uptr);
|
||||
RC.ru[j]->eth_params.remote_portc = *(RUParamList.paramarray[j][RU_REMOTE_PORTC_IDX].uptr);
|
||||
RC.ru[j]->eth_params.my_portd = *(RUParamList.paramarray[j][RU_LOCAL_PORTD_IDX].uptr);
|
||||
RC.ru[j]->eth_params.remote_portd = *(RUParamList.paramarray[j][RU_REMOTE_PORTD_IDX].uptr);
|
||||
|
||||
if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "udp") == 0) {
|
||||
RC.ru[j]->if_south = LOCAL_RF;
|
||||
RC.ru[j]->function = NGFI_RRU_IF5;
|
||||
RC.ru[j]->eth_params.transp_preference = ETH_UDP_MODE;
|
||||
printf("Setting function for RU %d to NGFI_RRU_IF5 (udp)\n",j);
|
||||
} else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw") == 0) {
|
||||
RC.ru[j]->if_south = LOCAL_RF;
|
||||
RC.ru[j]->function = NGFI_RRU_IF5;
|
||||
RC.ru[j]->eth_params.transp_preference = ETH_RAW_MODE;
|
||||
printf("Setting function for RU %d to NGFI_RRU_IF5 (raw)\n",j);
|
||||
} else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "udp_if4p5") == 0) {
|
||||
RC.ru[j]->if_south = LOCAL_RF;
|
||||
RC.ru[j]->function = NGFI_RRU_IF4p5;
|
||||
RC.ru[j]->eth_params.transp_preference = ETH_UDP_IF4p5_MODE;
|
||||
printf("Setting function for RU %d to NGFI_RRU_IF4p5 (udp)\n",j);
|
||||
} else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw_if4p5") == 0) {
|
||||
RC.ru[j]->if_south = LOCAL_RF;
|
||||
RC.ru[j]->function = NGFI_RRU_IF4p5;
|
||||
RC.ru[j]->eth_params.transp_preference = ETH_RAW_IF4p5_MODE;
|
||||
printf("Setting function for RU %d to NGFI_RRU_IF4p5 (raw)\n",j);
|
||||
}
|
||||
}
|
||||
RC.ru[j]->max_pdschReferenceSignalPower = *(RUParamList.paramarray[j][RU_MAX_RS_EPRE_IDX].uptr);;
|
||||
RC.ru[j]->max_rxgain = *(RUParamList.paramarray[j][RU_MAX_RXGAIN_IDX].uptr);
|
||||
RC.ru[j]->num_bands = RUParamList.paramarray[j][RU_BAND_LIST_IDX].numelt;
|
||||
for (i=0;i<RC.ru[j]->num_bands;i++) RC.ru[j]->band[i] = RUParamList.paramarray[j][RU_BAND_LIST_IDX].iptr[i];
|
||||
} //strcmp(local_rf, "yes") == 0
|
||||
else {
|
||||
printf("RU %d: Transport %s\n",j,*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr));
|
||||
|
||||
RC.ru[j]->eth_params.local_if_name = strdup(*(RUParamList.paramarray[j][RU_LOCAL_IF_NAME_IDX].strptr));
|
||||
RC.ru[j]->eth_params.my_addr = strdup(*(RUParamList.paramarray[j][RU_LOCAL_ADDRESS_IDX].strptr));
|
||||
RC.ru[j]->eth_params.remote_addr = strdup(*(RUParamList.paramarray[j][RU_REMOTE_ADDRESS_IDX].strptr));
|
||||
RC.ru[j]->eth_params.my_portc = *(RUParamList.paramarray[j][RU_LOCAL_PORTC_IDX].uptr);
|
||||
RC.ru[j]->eth_params.remote_portc = *(RUParamList.paramarray[j][RU_REMOTE_PORTC_IDX].uptr);
|
||||
RC.ru[j]->eth_params.my_portd = *(RUParamList.paramarray[j][RU_LOCAL_PORTD_IDX].uptr);
|
||||
RC.ru[j]->eth_params.remote_portd = *(RUParamList.paramarray[j][RU_REMOTE_PORTD_IDX].uptr);
|
||||
if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "udp") == 0) {
|
||||
RC.ru[j]->if_south = REMOTE_IF5;
|
||||
RC.ru[j]->function = NGFI_RAU_IF5;
|
||||
RC.ru[j]->eth_params.transp_preference = ETH_UDP_MODE;
|
||||
} else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw") == 0) {
|
||||
RC.ru[j]->if_south = REMOTE_IF5;
|
||||
RC.ru[j]->function = NGFI_RAU_IF5;
|
||||
RC.ru[j]->eth_params.transp_preference = ETH_RAW_MODE;
|
||||
} else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "udp_if4p5") == 0) {
|
||||
RC.ru[j]->if_south = REMOTE_IF4p5;
|
||||
RC.ru[j]->function = NGFI_RAU_IF4p5;
|
||||
RC.ru[j]->eth_params.transp_preference = ETH_UDP_IF4p5_MODE;
|
||||
} else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw_if4p5") == 0) {
|
||||
RC.ru[j]->if_south = REMOTE_IF4p5;
|
||||
RC.ru[j]->function = NGFI_RAU_IF4p5;
|
||||
RC.ru[j]->eth_params.transp_preference = ETH_RAW_IF4p5_MODE;
|
||||
} else if (strcmp(*(RUParamList.paramarray[j][RU_TRANSPORT_PREFERENCE_IDX].strptr), "raw_if5_mobipass") == 0) {
|
||||
RC.ru[j]->if_south = REMOTE_IF5;
|
||||
RC.ru[j]->function = NGFI_RAU_IF5;
|
||||
RC.ru[j]->if_timing = synch_to_other;
|
||||
RC.ru[j]->eth_params.transp_preference = ETH_RAW_IF5_MOBIPASS;
|
||||
}
|
||||
RC.ru[j]->att_tx = *(RUParamList.paramarray[j][RU_ATT_TX_IDX].uptr);
|
||||
RC.ru[j]->att_rx = *(RUParamList.paramarray[j][RU_ATT_TX_IDX].uptr);
|
||||
} /* strcmp(local_rf, "yes") != 0 */
|
||||
|
||||
RC.ru[j]->nb_tx = *(RUParamList.paramarray[j][RU_NB_TX_IDX].uptr);
|
||||
RC.ru[j]->nb_rx = *(RUParamList.paramarray[j][RU_NB_RX_IDX].uptr);
|
||||
|
||||
}// j=0..num_rus
|
||||
} else {
|
||||
RC.nb_RU = 0;
|
||||
} // setting != NULL
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
void RCconfig_L1(void) {
|
||||
int i,j;
|
||||
paramdef_t L1_Params[] = L1PARAMS_DESC;
|
||||
|
||||
@@ -61,45 +61,9 @@ extern RAN_CONTEXT_t RC;
|
||||
extern int l2_init_eNB(void);
|
||||
extern void mac_top_init_eNB(void);
|
||||
extern void mac_init_cell_params(int Mod_idP,int CC_idP);
|
||||
extern void phy_reset_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
|
||||
|
||||
extern uint8_t nfapi_mode;
|
||||
|
||||
/* sec 5.9, 36.321: MAC Reset Procedure */
|
||||
void ue_mac_reset(module_id_t module_idP, uint8_t eNB_index)
|
||||
{
|
||||
|
||||
//Resetting Bj
|
||||
UE_mac_inst[module_idP].scheduling_info.Bj[0] = 0;
|
||||
UE_mac_inst[module_idP].scheduling_info.Bj[1] = 0;
|
||||
UE_mac_inst[module_idP].scheduling_info.Bj[2] = 0;
|
||||
|
||||
//Stopping all timers
|
||||
|
||||
//timeAlignmentTimer expires
|
||||
|
||||
// PHY changes for UE MAC reset
|
||||
phy_reset_ue(module_idP, 0, eNB_index);
|
||||
|
||||
// notify RRC to relase PUCCH/SRS
|
||||
// cancel all pending SRs
|
||||
UE_mac_inst[module_idP].scheduling_info.SR_pending = 0;
|
||||
UE_mac_inst[module_idP].scheduling_info.SR_COUNTER = 0;
|
||||
|
||||
//Set BSR Trigger Bmp and remove timer flags
|
||||
UE_mac_inst[module_idP].BSR_reporting_active = BSR_TRIGGER_NONE;
|
||||
|
||||
// stop ongoing RACH procedure
|
||||
|
||||
// discard explicitly signaled ra_PreambleIndex and ra_RACH_MaskIndex, if any
|
||||
UE_mac_inst[module_idP].RA_prach_resources.ra_PreambleIndex = 0; // check!
|
||||
UE_mac_inst[module_idP].RA_prach_resources.ra_RACH_MaskIndex = 0;
|
||||
|
||||
|
||||
ue_init_mac(module_idP); //This will hopefully do the rest of the MAC reset procedure
|
||||
|
||||
}
|
||||
|
||||
int32_t **rxdata;
|
||||
int32_t **txdata;
|
||||
|
||||
@@ -962,487 +926,3 @@ rrc_mac_config_req_eNB(module_id_t Mod_idP,
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
rrc_mac_config_req_ue(module_id_t Mod_idP,
|
||||
int CC_idP,
|
||||
uint8_t eNB_index,
|
||||
RadioResourceConfigCommonSIB_t *
|
||||
radioResourceConfigCommon,
|
||||
struct PhysicalConfigDedicated
|
||||
*physicalConfigDedicated,
|
||||
#if defined(Rel10) || defined(Rel14)
|
||||
SCellToAddMod_r10_t * sCellToAddMod_r10,
|
||||
//struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10,
|
||||
#endif
|
||||
MeasObjectToAddMod_t ** measObj,
|
||||
MAC_MainConfig_t * mac_MainConfig,
|
||||
long logicalChannelIdentity,
|
||||
LogicalChannelConfig_t * logicalChannelConfig,
|
||||
MeasGapConfig_t * measGapConfig,
|
||||
TDD_Config_t * tdd_Config,
|
||||
MobilityControlInfo_t * mobilityControlInfo,
|
||||
uint8_t * SIwindowsize,
|
||||
uint16_t * SIperiod,
|
||||
ARFCN_ValueEUTRA_t * ul_CarrierFreq,
|
||||
long *ul_Bandwidth,
|
||||
AdditionalSpectrumEmission_t *
|
||||
additionalSpectrumEmission,
|
||||
struct MBSFN_SubframeConfigList
|
||||
*mbsfn_SubframeConfigList
|
||||
#if defined(Rel10) || defined(Rel14)
|
||||
, uint8_t MBMS_Flag,
|
||||
MBSFN_AreaInfoList_r9_t * mbsfn_AreaInfoList,
|
||||
PMCH_InfoList_r9_t * pmch_InfoList
|
||||
#endif
|
||||
#ifdef CBA
|
||||
, uint8_t num_active_cba_groups, uint16_t cba_rnti
|
||||
#endif
|
||||
)
|
||||
{
|
||||
|
||||
int i;
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
|
||||
(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_IN);
|
||||
|
||||
LOG_I(MAC, "[CONFIG][UE %d] Configuring MAC/PHY from eNB %d\n",
|
||||
Mod_idP, eNB_index);
|
||||
|
||||
if (tdd_Config != NULL) {
|
||||
UE_mac_inst[Mod_idP].tdd_Config = tdd_Config;
|
||||
}
|
||||
|
||||
|
||||
if (tdd_Config && SIwindowsize && SIperiod) {
|
||||
phy_config_sib1_ue(Mod_idP, 0, eNB_index, tdd_Config,
|
||||
*SIwindowsize, *SIperiod);
|
||||
}
|
||||
|
||||
if (radioResourceConfigCommon != NULL) {
|
||||
UE_mac_inst[Mod_idP].radioResourceConfigCommon =
|
||||
radioResourceConfigCommon;
|
||||
phy_config_sib2_ue(Mod_idP, 0, eNB_index,
|
||||
radioResourceConfigCommon, ul_CarrierFreq,
|
||||
ul_Bandwidth, additionalSpectrumEmission,
|
||||
mbsfn_SubframeConfigList);
|
||||
}
|
||||
// SRB2_lchan_config->choice.explicitValue.ul_SpecificParameters->logicalChannelGroup
|
||||
if (logicalChannelConfig != NULL) {
|
||||
LOG_I(MAC,
|
||||
"[CONFIG][UE %d] Applying RRC logicalChannelConfig from eNB%d\n",
|
||||
Mod_idP, eNB_index);
|
||||
UE_mac_inst[Mod_idP].logicalChannelConfig[logicalChannelIdentity] =
|
||||
logicalChannelConfig;
|
||||
UE_mac_inst[Mod_idP].scheduling_info.Bj[logicalChannelIdentity] = 0; // initilize the bucket for this lcid
|
||||
|
||||
AssertFatal(logicalChannelConfig->ul_SpecificParameters != NULL,
|
||||
"[UE %d] LCID %ld NULL ul_SpecificParameters\n",
|
||||
Mod_idP, logicalChannelIdentity);
|
||||
UE_mac_inst[Mod_idP].scheduling_info.bucket_size[logicalChannelIdentity] = logicalChannelConfig->ul_SpecificParameters->prioritisedBitRate * logicalChannelConfig->ul_SpecificParameters->bucketSizeDuration; // set the max bucket size
|
||||
if (logicalChannelConfig->ul_SpecificParameters->
|
||||
logicalChannelGroup != NULL) {
|
||||
UE_mac_inst[Mod_idP].scheduling_info.
|
||||
LCGID[logicalChannelIdentity] =
|
||||
*logicalChannelConfig->ul_SpecificParameters->
|
||||
logicalChannelGroup;
|
||||
LOG_D(MAC,
|
||||
"[CONFIG][UE %d] LCID %ld is attached to the LCGID %ld\n",
|
||||
Mod_idP, logicalChannelIdentity,
|
||||
*logicalChannelConfig->
|
||||
ul_SpecificParameters->logicalChannelGroup);
|
||||
} else {
|
||||
UE_mac_inst[Mod_idP].scheduling_info.
|
||||
LCGID[logicalChannelIdentity] = MAX_NUM_LCGID;
|
||||
}
|
||||
UE_mac_inst[Mod_idP].
|
||||
scheduling_info.LCID_buffer_remain[logicalChannelIdentity] = 0;
|
||||
}
|
||||
|
||||
if (mac_MainConfig != NULL) {
|
||||
LOG_I(MAC,
|
||||
"[CONFIG][UE%d] Applying RRC macMainConfig from eNB%d\n",
|
||||
Mod_idP, eNB_index);
|
||||
UE_mac_inst[Mod_idP].macConfig = mac_MainConfig;
|
||||
UE_mac_inst[Mod_idP].measGapConfig = measGapConfig;
|
||||
|
||||
if (mac_MainConfig->ul_SCH_Config) {
|
||||
|
||||
if (mac_MainConfig->ul_SCH_Config->periodicBSR_Timer) {
|
||||
UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_Timer =
|
||||
(uint16_t) *
|
||||
mac_MainConfig->ul_SCH_Config->periodicBSR_Timer;
|
||||
} else {
|
||||
UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_Timer =
|
||||
#ifndef Rel14
|
||||
(uint16_t)
|
||||
MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_infinity
|
||||
#else
|
||||
(uint16_t) PeriodicBSR_Timer_r12_infinity;
|
||||
#endif
|
||||
;
|
||||
}
|
||||
|
||||
if (mac_MainConfig->ul_SCH_Config->maxHARQ_Tx) {
|
||||
UE_mac_inst[Mod_idP].scheduling_info.maxHARQ_Tx =
|
||||
(uint16_t) * mac_MainConfig->ul_SCH_Config->maxHARQ_Tx;
|
||||
} else {
|
||||
UE_mac_inst[Mod_idP].scheduling_info.maxHARQ_Tx =
|
||||
(uint16_t)
|
||||
MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5;
|
||||
}
|
||||
phy_config_harq_ue(Mod_idP, 0, eNB_index,
|
||||
UE_mac_inst[Mod_idP].
|
||||
scheduling_info.maxHARQ_Tx);
|
||||
|
||||
if (mac_MainConfig->ul_SCH_Config->retxBSR_Timer) {
|
||||
UE_mac_inst[Mod_idP].scheduling_info.retxBSR_Timer =
|
||||
(uint16_t) mac_MainConfig->ul_SCH_Config->
|
||||
retxBSR_Timer;
|
||||
} else {
|
||||
#ifndef Rel14
|
||||
UE_mac_inst[Mod_idP].scheduling_info.retxBSR_Timer =
|
||||
(uint16_t)
|
||||
MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf2560;
|
||||
#else
|
||||
UE_mac_inst[Mod_idP].scheduling_info.retxBSR_Timer =
|
||||
(uint16_t) RetxBSR_Timer_r12_sf2560;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#if defined(Rel10) || defined(Rel14)
|
||||
|
||||
if (mac_MainConfig->ext1
|
||||
&& mac_MainConfig->ext1->sr_ProhibitTimer_r9) {
|
||||
UE_mac_inst[Mod_idP].scheduling_info.sr_ProhibitTimer =
|
||||
(uint16_t) * mac_MainConfig->ext1->sr_ProhibitTimer_r9;
|
||||
} else {
|
||||
UE_mac_inst[Mod_idP].scheduling_info.sr_ProhibitTimer = 0;
|
||||
}
|
||||
|
||||
if (mac_MainConfig->ext2
|
||||
&& mac_MainConfig->ext2->mac_MainConfig_v1020) {
|
||||
if (mac_MainConfig->ext2->
|
||||
mac_MainConfig_v1020->extendedBSR_Sizes_r10) {
|
||||
UE_mac_inst[Mod_idP].scheduling_info.
|
||||
extendedBSR_Sizes_r10 =
|
||||
(uint16_t) *
|
||||
mac_MainConfig->ext2->
|
||||
mac_MainConfig_v1020->extendedBSR_Sizes_r10;
|
||||
} else {
|
||||
UE_mac_inst[Mod_idP].scheduling_info.
|
||||
extendedBSR_Sizes_r10 = (uint16_t) 0;
|
||||
}
|
||||
if (mac_MainConfig->ext2->mac_MainConfig_v1020->
|
||||
extendedPHR_r10) {
|
||||
UE_mac_inst[Mod_idP].scheduling_info.extendedPHR_r10 =
|
||||
(uint16_t) *
|
||||
mac_MainConfig->ext2->mac_MainConfig_v1020->
|
||||
extendedPHR_r10;
|
||||
} else {
|
||||
UE_mac_inst[Mod_idP].scheduling_info.extendedPHR_r10 =
|
||||
(uint16_t) 0;
|
||||
}
|
||||
} else {
|
||||
UE_mac_inst[Mod_idP].scheduling_info.extendedBSR_Sizes_r10 =
|
||||
(uint16_t) 0;
|
||||
UE_mac_inst[Mod_idP].scheduling_info.extendedPHR_r10 =
|
||||
(uint16_t) 0;
|
||||
}
|
||||
#endif
|
||||
UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_SF =
|
||||
MAC_UE_BSR_TIMER_NOT_RUNNING;
|
||||
UE_mac_inst[Mod_idP].scheduling_info.retxBSR_SF =
|
||||
MAC_UE_BSR_TIMER_NOT_RUNNING;
|
||||
|
||||
UE_mac_inst[Mod_idP].BSR_reporting_active = BSR_TRIGGER_NONE;
|
||||
|
||||
LOG_D(MAC, "[UE %d]: periodic BSR %d (SF), retx BSR %d (SF)\n",
|
||||
Mod_idP,
|
||||
UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_SF,
|
||||
UE_mac_inst[Mod_idP].scheduling_info.retxBSR_SF);
|
||||
|
||||
UE_mac_inst[Mod_idP].scheduling_info.drx_config =
|
||||
mac_MainConfig->drx_Config;
|
||||
UE_mac_inst[Mod_idP].scheduling_info.phr_config =
|
||||
mac_MainConfig->phr_Config;
|
||||
|
||||
if (mac_MainConfig->phr_Config) {
|
||||
UE_mac_inst[Mod_idP].PHR_state =
|
||||
mac_MainConfig->phr_Config->present;
|
||||
UE_mac_inst[Mod_idP].PHR_reconfigured = 1;
|
||||
UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_Timer =
|
||||
mac_MainConfig->phr_Config->choice.setup.periodicPHR_Timer;
|
||||
UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_Timer =
|
||||
mac_MainConfig->phr_Config->choice.setup.prohibitPHR_Timer;
|
||||
UE_mac_inst[Mod_idP].scheduling_info.PathlossChange =
|
||||
mac_MainConfig->phr_Config->choice.setup.dl_PathlossChange;
|
||||
} else {
|
||||
UE_mac_inst[Mod_idP].PHR_reconfigured = 0;
|
||||
UE_mac_inst[Mod_idP].PHR_state =
|
||||
MAC_MainConfig__phr_Config_PR_setup;
|
||||
UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_Timer =
|
||||
MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20;
|
||||
UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_Timer =
|
||||
MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20;
|
||||
UE_mac_inst[Mod_idP].scheduling_info.PathlossChange =
|
||||
MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1;
|
||||
}
|
||||
|
||||
UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_SF =
|
||||
get_sf_perioidicPHR_Timer(UE_mac_inst[Mod_idP].
|
||||
scheduling_info.periodicPHR_Timer);
|
||||
UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_SF =
|
||||
get_sf_prohibitPHR_Timer(UE_mac_inst[Mod_idP].
|
||||
scheduling_info.prohibitPHR_Timer);
|
||||
UE_mac_inst[Mod_idP].scheduling_info.PathlossChange_db =
|
||||
get_db_dl_PathlossChange(UE_mac_inst[Mod_idP].
|
||||
scheduling_info.PathlossChange);
|
||||
UE_mac_inst[Mod_idP].PHR_reporting_active = 0;
|
||||
LOG_D(MAC,
|
||||
"[UE %d] config PHR (%d): periodic %d (SF) prohibit %d (SF) pathlosschange %d (db) \n",
|
||||
Mod_idP,
|
||||
(mac_MainConfig->phr_Config) ? mac_MainConfig->
|
||||
phr_Config->present : -1,
|
||||
UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_SF,
|
||||
UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_SF,
|
||||
UE_mac_inst[Mod_idP].scheduling_info.PathlossChange_db);
|
||||
}
|
||||
|
||||
|
||||
if (physicalConfigDedicated != NULL) {
|
||||
phy_config_dedicated_ue(Mod_idP, 0, eNB_index,
|
||||
physicalConfigDedicated);
|
||||
UE_mac_inst[Mod_idP].physicalConfigDedicated = physicalConfigDedicated; // for SR proc
|
||||
}
|
||||
#if defined(Rel10) || defined(Rel14)
|
||||
|
||||
if (sCellToAddMod_r10 != NULL) {
|
||||
|
||||
|
||||
phy_config_dedicated_scell_ue(Mod_idP, eNB_index,
|
||||
sCellToAddMod_r10, 1);
|
||||
UE_mac_inst[Mod_idP].physicalConfigDedicatedSCell_r10 = sCellToAddMod_r10->radioResourceConfigDedicatedSCell_r10->physicalConfigDedicatedSCell_r10; // using SCell index 0
|
||||
}
|
||||
#endif
|
||||
|
||||
if (measObj != NULL) {
|
||||
if (measObj[0] != NULL) {
|
||||
UE_mac_inst[Mod_idP].n_adj_cells =
|
||||
measObj[0]->measObject.choice.
|
||||
measObjectEUTRA.cellsToAddModList->list.count;
|
||||
LOG_I(MAC, "Number of adjacent cells %d\n",
|
||||
UE_mac_inst[Mod_idP].n_adj_cells);
|
||||
|
||||
for (i = 0; i < UE_mac_inst[Mod_idP].n_adj_cells; i++) {
|
||||
UE_mac_inst[Mod_idP].adj_cell_id[i] =
|
||||
measObj[0]->measObject.choice.
|
||||
measObjectEUTRA.cellsToAddModList->list.array[i]->
|
||||
physCellId;
|
||||
LOG_I(MAC, "Cell %d : Nid_cell %d\n", i,
|
||||
UE_mac_inst[Mod_idP].adj_cell_id[i]);
|
||||
}
|
||||
|
||||
phy_config_meas_ue(Mod_idP, 0, eNB_index,
|
||||
UE_mac_inst[Mod_idP].n_adj_cells,
|
||||
UE_mac_inst[Mod_idP].adj_cell_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (mobilityControlInfo != NULL) {
|
||||
|
||||
LOG_D(MAC, "[UE%d] MAC Reset procedure triggered by RRC eNB %d \n",
|
||||
Mod_idP, eNB_index);
|
||||
ue_mac_reset(Mod_idP, eNB_index);
|
||||
|
||||
if (mobilityControlInfo->radioResourceConfigCommon.
|
||||
rach_ConfigCommon) {
|
||||
memcpy((void *)
|
||||
&UE_mac_inst[Mod_idP].radioResourceConfigCommon->
|
||||
rach_ConfigCommon,
|
||||
(void *) mobilityControlInfo->
|
||||
radioResourceConfigCommon.rach_ConfigCommon,
|
||||
sizeof(RACH_ConfigCommon_t));
|
||||
}
|
||||
|
||||
memcpy((void *) &UE_mac_inst[Mod_idP].
|
||||
radioResourceConfigCommon->prach_Config.prach_ConfigInfo,
|
||||
(void *) mobilityControlInfo->
|
||||
radioResourceConfigCommon.prach_Config.prach_ConfigInfo,
|
||||
sizeof(PRACH_ConfigInfo_t));
|
||||
UE_mac_inst[Mod_idP].radioResourceConfigCommon->
|
||||
prach_Config.rootSequenceIndex =
|
||||
mobilityControlInfo->radioResourceConfigCommon.
|
||||
prach_Config.rootSequenceIndex;
|
||||
|
||||
if (mobilityControlInfo->radioResourceConfigCommon.
|
||||
pdsch_ConfigCommon) {
|
||||
memcpy((void *)
|
||||
&UE_mac_inst[Mod_idP].radioResourceConfigCommon->
|
||||
pdsch_ConfigCommon,
|
||||
(void *) mobilityControlInfo->
|
||||
radioResourceConfigCommon.pdsch_ConfigCommon,
|
||||
sizeof(PDSCH_ConfigCommon_t));
|
||||
}
|
||||
// not a pointer: mobilityControlInfo->radioResourceConfigCommon.pusch_ConfigCommon
|
||||
memcpy((void *) &UE_mac_inst[Mod_idP].
|
||||
radioResourceConfigCommon->pusch_ConfigCommon,
|
||||
(void *) &mobilityControlInfo->
|
||||
radioResourceConfigCommon.pusch_ConfigCommon,
|
||||
sizeof(PUSCH_ConfigCommon_t));
|
||||
|
||||
if (mobilityControlInfo->radioResourceConfigCommon.phich_Config) {
|
||||
/* memcpy((void *)&UE_mac_inst[Mod_idP].radioResourceConfigCommon->phich_Config,
|
||||
(void *)mobilityControlInfo->radioResourceConfigCommon.phich_Config,
|
||||
sizeof(PHICH_Config_t)); */
|
||||
}
|
||||
|
||||
if (mobilityControlInfo->radioResourceConfigCommon.
|
||||
pucch_ConfigCommon) {
|
||||
memcpy((void *)
|
||||
&UE_mac_inst[Mod_idP].radioResourceConfigCommon->
|
||||
pucch_ConfigCommon,
|
||||
(void *) mobilityControlInfo->
|
||||
radioResourceConfigCommon.pucch_ConfigCommon,
|
||||
sizeof(PUCCH_ConfigCommon_t));
|
||||
}
|
||||
|
||||
if (mobilityControlInfo->
|
||||
radioResourceConfigCommon.soundingRS_UL_ConfigCommon) {
|
||||
memcpy((void *)
|
||||
&UE_mac_inst[Mod_idP].radioResourceConfigCommon->
|
||||
soundingRS_UL_ConfigCommon,
|
||||
(void *) mobilityControlInfo->
|
||||
radioResourceConfigCommon.soundingRS_UL_ConfigCommon,
|
||||
sizeof(SoundingRS_UL_ConfigCommon_t));
|
||||
}
|
||||
|
||||
if (mobilityControlInfo->
|
||||
radioResourceConfigCommon.uplinkPowerControlCommon) {
|
||||
memcpy((void *)
|
||||
&UE_mac_inst[Mod_idP].radioResourceConfigCommon->
|
||||
uplinkPowerControlCommon,
|
||||
(void *) mobilityControlInfo->
|
||||
radioResourceConfigCommon.uplinkPowerControlCommon,
|
||||
sizeof(UplinkPowerControlCommon_t));
|
||||
}
|
||||
//configure antennaInfoCommon somewhere here..
|
||||
if (mobilityControlInfo->radioResourceConfigCommon.p_Max) {
|
||||
//to be configured
|
||||
}
|
||||
|
||||
if (mobilityControlInfo->radioResourceConfigCommon.tdd_Config) {
|
||||
UE_mac_inst[Mod_idP].tdd_Config =
|
||||
mobilityControlInfo->radioResourceConfigCommon.tdd_Config;
|
||||
}
|
||||
|
||||
if (mobilityControlInfo->
|
||||
radioResourceConfigCommon.ul_CyclicPrefixLength) {
|
||||
memcpy((void *)
|
||||
&UE_mac_inst[Mod_idP].radioResourceConfigCommon->
|
||||
ul_CyclicPrefixLength,
|
||||
(void *) mobilityControlInfo->
|
||||
radioResourceConfigCommon.ul_CyclicPrefixLength,
|
||||
sizeof(UL_CyclicPrefixLength_t));
|
||||
}
|
||||
// store the previous rnti in case of failure, and set thenew rnti
|
||||
UE_mac_inst[Mod_idP].crnti_before_ho = UE_mac_inst[Mod_idP].crnti;
|
||||
UE_mac_inst[Mod_idP].crnti =
|
||||
((mobilityControlInfo->
|
||||
newUE_Identity.buf[0]) | (mobilityControlInfo->
|
||||
newUE_Identity.buf[1] << 8));
|
||||
LOG_I(MAC, "[UE %d] Received new identity %x from %d\n", Mod_idP,
|
||||
UE_mac_inst[Mod_idP].crnti, eNB_index);
|
||||
UE_mac_inst[Mod_idP].rach_ConfigDedicated =
|
||||
malloc(sizeof(*mobilityControlInfo->rach_ConfigDedicated));
|
||||
|
||||
if (mobilityControlInfo->rach_ConfigDedicated) {
|
||||
memcpy((void *) UE_mac_inst[Mod_idP].rach_ConfigDedicated,
|
||||
(void *) mobilityControlInfo->rach_ConfigDedicated,
|
||||
sizeof(*mobilityControlInfo->rach_ConfigDedicated));
|
||||
}
|
||||
|
||||
phy_config_afterHO_ue(Mod_idP, 0, eNB_index, mobilityControlInfo,
|
||||
0);
|
||||
}
|
||||
|
||||
|
||||
if (mbsfn_SubframeConfigList != NULL) {
|
||||
LOG_I(MAC,
|
||||
"[UE %d][CONFIG] Received %d subframe allocation pattern for MBSFN\n",
|
||||
Mod_idP, mbsfn_SubframeConfigList->list.count);
|
||||
UE_mac_inst[Mod_idP].num_sf_allocation_pattern =
|
||||
mbsfn_SubframeConfigList->list.count;
|
||||
|
||||
for (i = 0; i < mbsfn_SubframeConfigList->list.count; i++) {
|
||||
LOG_I(MAC,
|
||||
"[UE %d] Configuring MBSFN_SubframeConfig %d from received SIB2 \n",
|
||||
Mod_idP, i);
|
||||
UE_mac_inst[Mod_idP].mbsfn_SubframeConfig[i] =
|
||||
mbsfn_SubframeConfigList->list.array[i];
|
||||
// LOG_I("[UE %d] MBSFN_SubframeConfig[%d] pattern is %ld\n", Mod_idP,
|
||||
// UE_mac_inst[Mod_idP].mbsfn_SubframeConfig[i]->subframeAllocation.choice.oneFrame.buf[0]);
|
||||
}
|
||||
}
|
||||
#if defined(Rel10) || defined(Rel14)
|
||||
|
||||
if (mbsfn_AreaInfoList != NULL) {
|
||||
LOG_I(MAC, "[UE %d][CONFIG] Received %d MBSFN Area Info\n",
|
||||
Mod_idP, mbsfn_AreaInfoList->list.count);
|
||||
UE_mac_inst[Mod_idP].num_active_mbsfn_area =
|
||||
mbsfn_AreaInfoList->list.count;
|
||||
|
||||
for (i = 0; i < mbsfn_AreaInfoList->list.count; i++) {
|
||||
UE_mac_inst[Mod_idP].mbsfn_AreaInfo[i] =
|
||||
mbsfn_AreaInfoList->list.array[i];
|
||||
LOG_I(MAC,
|
||||
"[UE %d] MBSFN_AreaInfo[%d]: MCCH Repetition Period = %ld\n",
|
||||
Mod_idP, i,
|
||||
UE_mac_inst[Mod_idP].mbsfn_AreaInfo[i]->
|
||||
mcch_Config_r9.mcch_RepetitionPeriod_r9);
|
||||
phy_config_sib13_ue(Mod_idP, 0, eNB_index, i,
|
||||
UE_mac_inst[Mod_idP].
|
||||
mbsfn_AreaInfo[i]->mbsfn_AreaId_r9);
|
||||
}
|
||||
}
|
||||
|
||||
if (pmch_InfoList != NULL) {
|
||||
|
||||
// LOG_I(MAC,"DUY: lcid when entering rrc_mac config_req is %02d\n",(pmch_InfoList->list.array[0]->mbms_SessionInfoList_r9.list.array[0]->logicalChannelIdentity_r9));
|
||||
|
||||
LOG_I(MAC, "[UE %d] Configuring PMCH_config from MCCH MESSAGE \n",
|
||||
Mod_idP);
|
||||
|
||||
for (i = 0; i < pmch_InfoList->list.count; i++) {
|
||||
UE_mac_inst[Mod_idP].pmch_Config[i] =
|
||||
&pmch_InfoList->list.array[i]->pmch_Config_r9;
|
||||
LOG_I(MAC, "[UE %d] PMCH[%d]: MCH_Scheduling_Period = %ld\n",
|
||||
Mod_idP, i,
|
||||
UE_mac_inst[Mod_idP].
|
||||
pmch_Config[i]->mch_SchedulingPeriod_r9);
|
||||
}
|
||||
|
||||
UE_mac_inst[Mod_idP].mcch_status = 1;
|
||||
}
|
||||
#endif
|
||||
#ifdef CBA
|
||||
|
||||
if (cba_rnti) {
|
||||
UE_mac_inst[Mod_idP].cba_rnti[num_active_cba_groups - 1] =
|
||||
cba_rnti;
|
||||
LOG_D(MAC,
|
||||
"[UE %d] configure CBA group %d RNTI %x for eNB %d (total active cba group %d)\n",
|
||||
Mod_idP, Mod_idP % num_active_cba_groups, cba_rnti,
|
||||
eNB_index, num_active_cba_groups);
|
||||
phy_config_cba_rnti(Mod_idP, CC_idP, eNB_flagP, eNB_index,
|
||||
cba_rnti, num_active_cba_groups - 1,
|
||||
num_active_cba_groups);
|
||||
}
|
||||
#endif
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
|
||||
(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_OUT);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,584 @@
|
||||
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
/*! \file config.c
|
||||
* \brief UE and eNB configuration performed by RRC or as a consequence of RRC procedures
|
||||
* \author Navid Nikaein and Raymond Knopp
|
||||
* \date 2010 - 2014
|
||||
* \version 0.1
|
||||
* \email: navid.nikaein@eurecom.fr
|
||||
* @ingroup _mac
|
||||
|
||||
*/
|
||||
|
||||
#include "COMMON/platform_types.h"
|
||||
#include "COMMON/platform_constants.h"
|
||||
#include "SCHED/defs.h"
|
||||
#include "SystemInformationBlockType2.h"
|
||||
//#include "RadioResourceConfigCommonSIB.h"
|
||||
#include "RadioResourceConfigDedicated.h"
|
||||
#ifdef Rel14
|
||||
#include "PRACH-ConfigSIB-v1310.h"
|
||||
#endif
|
||||
#include "MeasGapConfig.h"
|
||||
#include "MeasObjectToAddModList.h"
|
||||
#include "TDD-Config.h"
|
||||
#include "MAC-MainConfig.h"
|
||||
#include "defs.h"
|
||||
#include "proto.h"
|
||||
#include "extern.h"
|
||||
#include "UTIL/LOG/log.h"
|
||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
||||
|
||||
#include "common/ran_context.h"
|
||||
#if defined(Rel10) || defined(Rel14)
|
||||
#include "MBSFN-AreaInfoList-r9.h"
|
||||
#include "MBSFN-AreaInfo-r9.h"
|
||||
#include "MBSFN-SubframeConfigList.h"
|
||||
#include "PMCH-InfoList-r9.h"
|
||||
#endif
|
||||
|
||||
extern void mac_init_cell_params(int Mod_idP,int CC_idP);
|
||||
extern void phy_reset_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
|
||||
|
||||
|
||||
/* sec 5.9, 36.321: MAC Reset Procedure */
|
||||
void ue_mac_reset(module_id_t module_idP, uint8_t eNB_index)
|
||||
{
|
||||
|
||||
//Resetting Bj
|
||||
UE_mac_inst[module_idP].scheduling_info.Bj[0] = 0;
|
||||
UE_mac_inst[module_idP].scheduling_info.Bj[1] = 0;
|
||||
UE_mac_inst[module_idP].scheduling_info.Bj[2] = 0;
|
||||
|
||||
//Stopping all timers
|
||||
|
||||
//timeAlignmentTimer expires
|
||||
|
||||
// PHY changes for UE MAC reset
|
||||
phy_reset_ue(module_idP, 0, eNB_index);
|
||||
|
||||
// notify RRC to relase PUCCH/SRS
|
||||
// cancel all pending SRs
|
||||
UE_mac_inst[module_idP].scheduling_info.SR_pending = 0;
|
||||
UE_mac_inst[module_idP].scheduling_info.SR_COUNTER = 0;
|
||||
|
||||
//Set BSR Trigger Bmp and remove timer flags
|
||||
UE_mac_inst[module_idP].BSR_reporting_active = BSR_TRIGGER_NONE;
|
||||
|
||||
// stop ongoing RACH procedure
|
||||
|
||||
// discard explicitly signaled ra_PreambleIndex and ra_RACH_MaskIndex, if any
|
||||
UE_mac_inst[module_idP].RA_prach_resources.ra_PreambleIndex = 0; // check!
|
||||
UE_mac_inst[module_idP].RA_prach_resources.ra_RACH_MaskIndex = 0;
|
||||
|
||||
|
||||
ue_init_mac(module_idP); //This will hopefully do the rest of the MAC reset procedure
|
||||
|
||||
}
|
||||
|
||||
int32_t **rxdata;
|
||||
int32_t **txdata;
|
||||
|
||||
|
||||
int
|
||||
rrc_mac_config_req_ue(module_id_t Mod_idP,
|
||||
int CC_idP,
|
||||
uint8_t eNB_index,
|
||||
RadioResourceConfigCommonSIB_t *
|
||||
radioResourceConfigCommon,
|
||||
struct PhysicalConfigDedicated
|
||||
*physicalConfigDedicated,
|
||||
#if defined(Rel10) || defined(Rel14)
|
||||
SCellToAddMod_r10_t * sCellToAddMod_r10,
|
||||
//struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10,
|
||||
#endif
|
||||
MeasObjectToAddMod_t ** measObj,
|
||||
MAC_MainConfig_t * mac_MainConfig,
|
||||
long logicalChannelIdentity,
|
||||
LogicalChannelConfig_t * logicalChannelConfig,
|
||||
MeasGapConfig_t * measGapConfig,
|
||||
TDD_Config_t * tdd_Config,
|
||||
MobilityControlInfo_t * mobilityControlInfo,
|
||||
uint8_t * SIwindowsize,
|
||||
uint16_t * SIperiod,
|
||||
ARFCN_ValueEUTRA_t * ul_CarrierFreq,
|
||||
long *ul_Bandwidth,
|
||||
AdditionalSpectrumEmission_t *
|
||||
additionalSpectrumEmission,
|
||||
struct MBSFN_SubframeConfigList
|
||||
*mbsfn_SubframeConfigList
|
||||
#if defined(Rel10) || defined(Rel14)
|
||||
, uint8_t MBMS_Flag,
|
||||
MBSFN_AreaInfoList_r9_t * mbsfn_AreaInfoList,
|
||||
PMCH_InfoList_r9_t * pmch_InfoList
|
||||
#endif
|
||||
#ifdef CBA
|
||||
, uint8_t num_active_cba_groups, uint16_t cba_rnti
|
||||
#endif
|
||||
)
|
||||
{
|
||||
|
||||
int i;
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
|
||||
(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_IN);
|
||||
|
||||
LOG_I(MAC, "[CONFIG][UE %d] Configuring MAC/PHY from eNB %d\n",
|
||||
Mod_idP, eNB_index);
|
||||
|
||||
if (tdd_Config != NULL) {
|
||||
UE_mac_inst[Mod_idP].tdd_Config = tdd_Config;
|
||||
}
|
||||
|
||||
|
||||
if (tdd_Config && SIwindowsize && SIperiod) {
|
||||
phy_config_sib1_ue(Mod_idP, 0, eNB_index, tdd_Config,
|
||||
*SIwindowsize, *SIperiod);
|
||||
}
|
||||
|
||||
if (radioResourceConfigCommon != NULL) {
|
||||
UE_mac_inst[Mod_idP].radioResourceConfigCommon =
|
||||
radioResourceConfigCommon;
|
||||
phy_config_sib2_ue(Mod_idP, 0, eNB_index,
|
||||
radioResourceConfigCommon, ul_CarrierFreq,
|
||||
ul_Bandwidth, additionalSpectrumEmission,
|
||||
mbsfn_SubframeConfigList);
|
||||
}
|
||||
// SRB2_lchan_config->choice.explicitValue.ul_SpecificParameters->logicalChannelGroup
|
||||
if (logicalChannelConfig != NULL) {
|
||||
LOG_I(MAC,
|
||||
"[CONFIG][UE %d] Applying RRC logicalChannelConfig from eNB%d\n",
|
||||
Mod_idP, eNB_index);
|
||||
UE_mac_inst[Mod_idP].logicalChannelConfig[logicalChannelIdentity] =
|
||||
logicalChannelConfig;
|
||||
UE_mac_inst[Mod_idP].scheduling_info.Bj[logicalChannelIdentity] = 0; // initilize the bucket for this lcid
|
||||
|
||||
AssertFatal(logicalChannelConfig->ul_SpecificParameters != NULL,
|
||||
"[UE %d] LCID %ld NULL ul_SpecificParameters\n",
|
||||
Mod_idP, logicalChannelIdentity);
|
||||
UE_mac_inst[Mod_idP].scheduling_info.bucket_size[logicalChannelIdentity] = logicalChannelConfig->ul_SpecificParameters->prioritisedBitRate * logicalChannelConfig->ul_SpecificParameters->bucketSizeDuration; // set the max bucket size
|
||||
if (logicalChannelConfig->ul_SpecificParameters->
|
||||
logicalChannelGroup != NULL) {
|
||||
UE_mac_inst[Mod_idP].scheduling_info.
|
||||
LCGID[logicalChannelIdentity] =
|
||||
*logicalChannelConfig->ul_SpecificParameters->
|
||||
logicalChannelGroup;
|
||||
LOG_D(MAC,
|
||||
"[CONFIG][UE %d] LCID %ld is attached to the LCGID %ld\n",
|
||||
Mod_idP, logicalChannelIdentity,
|
||||
*logicalChannelConfig->
|
||||
ul_SpecificParameters->logicalChannelGroup);
|
||||
} else {
|
||||
UE_mac_inst[Mod_idP].scheduling_info.
|
||||
LCGID[logicalChannelIdentity] = MAX_NUM_LCGID;
|
||||
}
|
||||
UE_mac_inst[Mod_idP].
|
||||
scheduling_info.LCID_buffer_remain[logicalChannelIdentity] = 0;
|
||||
}
|
||||
|
||||
if (mac_MainConfig != NULL) {
|
||||
LOG_I(MAC,
|
||||
"[CONFIG][UE%d] Applying RRC macMainConfig from eNB%d\n",
|
||||
Mod_idP, eNB_index);
|
||||
UE_mac_inst[Mod_idP].macConfig = mac_MainConfig;
|
||||
UE_mac_inst[Mod_idP].measGapConfig = measGapConfig;
|
||||
|
||||
if (mac_MainConfig->ul_SCH_Config) {
|
||||
|
||||
if (mac_MainConfig->ul_SCH_Config->periodicBSR_Timer) {
|
||||
UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_Timer =
|
||||
(uint16_t) *
|
||||
mac_MainConfig->ul_SCH_Config->periodicBSR_Timer;
|
||||
} else {
|
||||
UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_Timer =
|
||||
#ifndef Rel14
|
||||
(uint16_t)
|
||||
MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_infinity
|
||||
#else
|
||||
(uint16_t) PeriodicBSR_Timer_r12_infinity;
|
||||
#endif
|
||||
;
|
||||
}
|
||||
|
||||
if (mac_MainConfig->ul_SCH_Config->maxHARQ_Tx) {
|
||||
UE_mac_inst[Mod_idP].scheduling_info.maxHARQ_Tx =
|
||||
(uint16_t) * mac_MainConfig->ul_SCH_Config->maxHARQ_Tx;
|
||||
} else {
|
||||
UE_mac_inst[Mod_idP].scheduling_info.maxHARQ_Tx =
|
||||
(uint16_t)
|
||||
MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5;
|
||||
}
|
||||
phy_config_harq_ue(Mod_idP, 0, eNB_index,
|
||||
UE_mac_inst[Mod_idP].
|
||||
scheduling_info.maxHARQ_Tx);
|
||||
|
||||
if (mac_MainConfig->ul_SCH_Config->retxBSR_Timer) {
|
||||
UE_mac_inst[Mod_idP].scheduling_info.retxBSR_Timer =
|
||||
(uint16_t) mac_MainConfig->ul_SCH_Config->
|
||||
retxBSR_Timer;
|
||||
} else {
|
||||
#ifndef Rel14
|
||||
UE_mac_inst[Mod_idP].scheduling_info.retxBSR_Timer =
|
||||
(uint16_t)
|
||||
MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf2560;
|
||||
#else
|
||||
UE_mac_inst[Mod_idP].scheduling_info.retxBSR_Timer =
|
||||
(uint16_t) RetxBSR_Timer_r12_sf2560;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#if defined(Rel10) || defined(Rel14)
|
||||
|
||||
if (mac_MainConfig->ext1
|
||||
&& mac_MainConfig->ext1->sr_ProhibitTimer_r9) {
|
||||
UE_mac_inst[Mod_idP].scheduling_info.sr_ProhibitTimer =
|
||||
(uint16_t) * mac_MainConfig->ext1->sr_ProhibitTimer_r9;
|
||||
} else {
|
||||
UE_mac_inst[Mod_idP].scheduling_info.sr_ProhibitTimer = 0;
|
||||
}
|
||||
|
||||
if (mac_MainConfig->ext2
|
||||
&& mac_MainConfig->ext2->mac_MainConfig_v1020) {
|
||||
if (mac_MainConfig->ext2->
|
||||
mac_MainConfig_v1020->extendedBSR_Sizes_r10) {
|
||||
UE_mac_inst[Mod_idP].scheduling_info.
|
||||
extendedBSR_Sizes_r10 =
|
||||
(uint16_t) *
|
||||
mac_MainConfig->ext2->
|
||||
mac_MainConfig_v1020->extendedBSR_Sizes_r10;
|
||||
} else {
|
||||
UE_mac_inst[Mod_idP].scheduling_info.
|
||||
extendedBSR_Sizes_r10 = (uint16_t) 0;
|
||||
}
|
||||
if (mac_MainConfig->ext2->mac_MainConfig_v1020->
|
||||
extendedPHR_r10) {
|
||||
UE_mac_inst[Mod_idP].scheduling_info.extendedPHR_r10 =
|
||||
(uint16_t) *
|
||||
mac_MainConfig->ext2->mac_MainConfig_v1020->
|
||||
extendedPHR_r10;
|
||||
} else {
|
||||
UE_mac_inst[Mod_idP].scheduling_info.extendedPHR_r10 =
|
||||
(uint16_t) 0;
|
||||
}
|
||||
} else {
|
||||
UE_mac_inst[Mod_idP].scheduling_info.extendedBSR_Sizes_r10 =
|
||||
(uint16_t) 0;
|
||||
UE_mac_inst[Mod_idP].scheduling_info.extendedPHR_r10 =
|
||||
(uint16_t) 0;
|
||||
}
|
||||
#endif
|
||||
UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_SF =
|
||||
MAC_UE_BSR_TIMER_NOT_RUNNING;
|
||||
UE_mac_inst[Mod_idP].scheduling_info.retxBSR_SF =
|
||||
MAC_UE_BSR_TIMER_NOT_RUNNING;
|
||||
|
||||
UE_mac_inst[Mod_idP].BSR_reporting_active = BSR_TRIGGER_NONE;
|
||||
|
||||
LOG_D(MAC, "[UE %d]: periodic BSR %d (SF), retx BSR %d (SF)\n",
|
||||
Mod_idP,
|
||||
UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_SF,
|
||||
UE_mac_inst[Mod_idP].scheduling_info.retxBSR_SF);
|
||||
|
||||
UE_mac_inst[Mod_idP].scheduling_info.drx_config =
|
||||
mac_MainConfig->drx_Config;
|
||||
UE_mac_inst[Mod_idP].scheduling_info.phr_config =
|
||||
mac_MainConfig->phr_Config;
|
||||
|
||||
if (mac_MainConfig->phr_Config) {
|
||||
UE_mac_inst[Mod_idP].PHR_state =
|
||||
mac_MainConfig->phr_Config->present;
|
||||
UE_mac_inst[Mod_idP].PHR_reconfigured = 1;
|
||||
UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_Timer =
|
||||
mac_MainConfig->phr_Config->choice.setup.periodicPHR_Timer;
|
||||
UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_Timer =
|
||||
mac_MainConfig->phr_Config->choice.setup.prohibitPHR_Timer;
|
||||
UE_mac_inst[Mod_idP].scheduling_info.PathlossChange =
|
||||
mac_MainConfig->phr_Config->choice.setup.dl_PathlossChange;
|
||||
} else {
|
||||
UE_mac_inst[Mod_idP].PHR_reconfigured = 0;
|
||||
UE_mac_inst[Mod_idP].PHR_state =
|
||||
MAC_MainConfig__phr_Config_PR_setup;
|
||||
UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_Timer =
|
||||
MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20;
|
||||
UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_Timer =
|
||||
MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20;
|
||||
UE_mac_inst[Mod_idP].scheduling_info.PathlossChange =
|
||||
MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1;
|
||||
}
|
||||
|
||||
UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_SF =
|
||||
get_sf_perioidicPHR_Timer(UE_mac_inst[Mod_idP].
|
||||
scheduling_info.periodicPHR_Timer);
|
||||
UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_SF =
|
||||
get_sf_prohibitPHR_Timer(UE_mac_inst[Mod_idP].
|
||||
scheduling_info.prohibitPHR_Timer);
|
||||
UE_mac_inst[Mod_idP].scheduling_info.PathlossChange_db =
|
||||
get_db_dl_PathlossChange(UE_mac_inst[Mod_idP].
|
||||
scheduling_info.PathlossChange);
|
||||
UE_mac_inst[Mod_idP].PHR_reporting_active = 0;
|
||||
LOG_D(MAC,
|
||||
"[UE %d] config PHR (%d): periodic %d (SF) prohibit %d (SF) pathlosschange %d (db) \n",
|
||||
Mod_idP,
|
||||
(mac_MainConfig->phr_Config) ? mac_MainConfig->
|
||||
phr_Config->present : -1,
|
||||
UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_SF,
|
||||
UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_SF,
|
||||
UE_mac_inst[Mod_idP].scheduling_info.PathlossChange_db);
|
||||
}
|
||||
|
||||
|
||||
if (physicalConfigDedicated != NULL) {
|
||||
phy_config_dedicated_ue(Mod_idP, 0, eNB_index,
|
||||
physicalConfigDedicated);
|
||||
UE_mac_inst[Mod_idP].physicalConfigDedicated = physicalConfigDedicated; // for SR proc
|
||||
}
|
||||
#if defined(Rel10) || defined(Rel14)
|
||||
|
||||
if (sCellToAddMod_r10 != NULL) {
|
||||
|
||||
|
||||
phy_config_dedicated_scell_ue(Mod_idP, eNB_index,
|
||||
sCellToAddMod_r10, 1);
|
||||
UE_mac_inst[Mod_idP].physicalConfigDedicatedSCell_r10 = sCellToAddMod_r10->radioResourceConfigDedicatedSCell_r10->physicalConfigDedicatedSCell_r10; // using SCell index 0
|
||||
}
|
||||
#endif
|
||||
|
||||
if (measObj != NULL) {
|
||||
if (measObj[0] != NULL) {
|
||||
UE_mac_inst[Mod_idP].n_adj_cells =
|
||||
measObj[0]->measObject.choice.
|
||||
measObjectEUTRA.cellsToAddModList->list.count;
|
||||
LOG_I(MAC, "Number of adjacent cells %d\n",
|
||||
UE_mac_inst[Mod_idP].n_adj_cells);
|
||||
|
||||
for (i = 0; i < UE_mac_inst[Mod_idP].n_adj_cells; i++) {
|
||||
UE_mac_inst[Mod_idP].adj_cell_id[i] =
|
||||
measObj[0]->measObject.choice.
|
||||
measObjectEUTRA.cellsToAddModList->list.array[i]->
|
||||
physCellId;
|
||||
LOG_I(MAC, "Cell %d : Nid_cell %d\n", i,
|
||||
UE_mac_inst[Mod_idP].adj_cell_id[i]);
|
||||
}
|
||||
|
||||
phy_config_meas_ue(Mod_idP, 0, eNB_index,
|
||||
UE_mac_inst[Mod_idP].n_adj_cells,
|
||||
UE_mac_inst[Mod_idP].adj_cell_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (mobilityControlInfo != NULL) {
|
||||
|
||||
LOG_D(MAC, "[UE%d] MAC Reset procedure triggered by RRC eNB %d \n",
|
||||
Mod_idP, eNB_index);
|
||||
ue_mac_reset(Mod_idP, eNB_index);
|
||||
|
||||
if (mobilityControlInfo->radioResourceConfigCommon.
|
||||
rach_ConfigCommon) {
|
||||
memcpy((void *)
|
||||
&UE_mac_inst[Mod_idP].radioResourceConfigCommon->
|
||||
rach_ConfigCommon,
|
||||
(void *) mobilityControlInfo->
|
||||
radioResourceConfigCommon.rach_ConfigCommon,
|
||||
sizeof(RACH_ConfigCommon_t));
|
||||
}
|
||||
|
||||
memcpy((void *) &UE_mac_inst[Mod_idP].
|
||||
radioResourceConfigCommon->prach_Config.prach_ConfigInfo,
|
||||
(void *) mobilityControlInfo->
|
||||
radioResourceConfigCommon.prach_Config.prach_ConfigInfo,
|
||||
sizeof(PRACH_ConfigInfo_t));
|
||||
UE_mac_inst[Mod_idP].radioResourceConfigCommon->
|
||||
prach_Config.rootSequenceIndex =
|
||||
mobilityControlInfo->radioResourceConfigCommon.
|
||||
prach_Config.rootSequenceIndex;
|
||||
|
||||
if (mobilityControlInfo->radioResourceConfigCommon.
|
||||
pdsch_ConfigCommon) {
|
||||
memcpy((void *)
|
||||
&UE_mac_inst[Mod_idP].radioResourceConfigCommon->
|
||||
pdsch_ConfigCommon,
|
||||
(void *) mobilityControlInfo->
|
||||
radioResourceConfigCommon.pdsch_ConfigCommon,
|
||||
sizeof(PDSCH_ConfigCommon_t));
|
||||
}
|
||||
// not a pointer: mobilityControlInfo->radioResourceConfigCommon.pusch_ConfigCommon
|
||||
memcpy((void *) &UE_mac_inst[Mod_idP].
|
||||
radioResourceConfigCommon->pusch_ConfigCommon,
|
||||
(void *) &mobilityControlInfo->
|
||||
radioResourceConfigCommon.pusch_ConfigCommon,
|
||||
sizeof(PUSCH_ConfigCommon_t));
|
||||
|
||||
if (mobilityControlInfo->radioResourceConfigCommon.phich_Config) {
|
||||
/* memcpy((void *)&UE_mac_inst[Mod_idP].radioResourceConfigCommon->phich_Config,
|
||||
(void *)mobilityControlInfo->radioResourceConfigCommon.phich_Config,
|
||||
sizeof(PHICH_Config_t)); */
|
||||
}
|
||||
|
||||
if (mobilityControlInfo->radioResourceConfigCommon.
|
||||
pucch_ConfigCommon) {
|
||||
memcpy((void *)
|
||||
&UE_mac_inst[Mod_idP].radioResourceConfigCommon->
|
||||
pucch_ConfigCommon,
|
||||
(void *) mobilityControlInfo->
|
||||
radioResourceConfigCommon.pucch_ConfigCommon,
|
||||
sizeof(PUCCH_ConfigCommon_t));
|
||||
}
|
||||
|
||||
if (mobilityControlInfo->
|
||||
radioResourceConfigCommon.soundingRS_UL_ConfigCommon) {
|
||||
memcpy((void *)
|
||||
&UE_mac_inst[Mod_idP].radioResourceConfigCommon->
|
||||
soundingRS_UL_ConfigCommon,
|
||||
(void *) mobilityControlInfo->
|
||||
radioResourceConfigCommon.soundingRS_UL_ConfigCommon,
|
||||
sizeof(SoundingRS_UL_ConfigCommon_t));
|
||||
}
|
||||
|
||||
if (mobilityControlInfo->
|
||||
radioResourceConfigCommon.uplinkPowerControlCommon) {
|
||||
memcpy((void *)
|
||||
&UE_mac_inst[Mod_idP].radioResourceConfigCommon->
|
||||
uplinkPowerControlCommon,
|
||||
(void *) mobilityControlInfo->
|
||||
radioResourceConfigCommon.uplinkPowerControlCommon,
|
||||
sizeof(UplinkPowerControlCommon_t));
|
||||
}
|
||||
//configure antennaInfoCommon somewhere here..
|
||||
if (mobilityControlInfo->radioResourceConfigCommon.p_Max) {
|
||||
//to be configured
|
||||
}
|
||||
|
||||
if (mobilityControlInfo->radioResourceConfigCommon.tdd_Config) {
|
||||
UE_mac_inst[Mod_idP].tdd_Config =
|
||||
mobilityControlInfo->radioResourceConfigCommon.tdd_Config;
|
||||
}
|
||||
|
||||
if (mobilityControlInfo->
|
||||
radioResourceConfigCommon.ul_CyclicPrefixLength) {
|
||||
memcpy((void *)
|
||||
&UE_mac_inst[Mod_idP].radioResourceConfigCommon->
|
||||
ul_CyclicPrefixLength,
|
||||
(void *) mobilityControlInfo->
|
||||
radioResourceConfigCommon.ul_CyclicPrefixLength,
|
||||
sizeof(UL_CyclicPrefixLength_t));
|
||||
}
|
||||
// store the previous rnti in case of failure, and set thenew rnti
|
||||
UE_mac_inst[Mod_idP].crnti_before_ho = UE_mac_inst[Mod_idP].crnti;
|
||||
UE_mac_inst[Mod_idP].crnti =
|
||||
((mobilityControlInfo->
|
||||
newUE_Identity.buf[0]) | (mobilityControlInfo->
|
||||
newUE_Identity.buf[1] << 8));
|
||||
LOG_I(MAC, "[UE %d] Received new identity %x from %d\n", Mod_idP,
|
||||
UE_mac_inst[Mod_idP].crnti, eNB_index);
|
||||
UE_mac_inst[Mod_idP].rach_ConfigDedicated =
|
||||
malloc(sizeof(*mobilityControlInfo->rach_ConfigDedicated));
|
||||
|
||||
if (mobilityControlInfo->rach_ConfigDedicated) {
|
||||
memcpy((void *) UE_mac_inst[Mod_idP].rach_ConfigDedicated,
|
||||
(void *) mobilityControlInfo->rach_ConfigDedicated,
|
||||
sizeof(*mobilityControlInfo->rach_ConfigDedicated));
|
||||
}
|
||||
|
||||
phy_config_afterHO_ue(Mod_idP, 0, eNB_index, mobilityControlInfo,
|
||||
0);
|
||||
}
|
||||
|
||||
|
||||
if (mbsfn_SubframeConfigList != NULL) {
|
||||
LOG_I(MAC,
|
||||
"[UE %d][CONFIG] Received %d subframe allocation pattern for MBSFN\n",
|
||||
Mod_idP, mbsfn_SubframeConfigList->list.count);
|
||||
UE_mac_inst[Mod_idP].num_sf_allocation_pattern =
|
||||
mbsfn_SubframeConfigList->list.count;
|
||||
|
||||
for (i = 0; i < mbsfn_SubframeConfigList->list.count; i++) {
|
||||
LOG_I(MAC,
|
||||
"[UE %d] Configuring MBSFN_SubframeConfig %d from received SIB2 \n",
|
||||
Mod_idP, i);
|
||||
UE_mac_inst[Mod_idP].mbsfn_SubframeConfig[i] =
|
||||
mbsfn_SubframeConfigList->list.array[i];
|
||||
// LOG_I("[UE %d] MBSFN_SubframeConfig[%d] pattern is %ld\n", Mod_idP,
|
||||
// UE_mac_inst[Mod_idP].mbsfn_SubframeConfig[i]->subframeAllocation.choice.oneFrame.buf[0]);
|
||||
}
|
||||
}
|
||||
#if defined(Rel10) || defined(Rel14)
|
||||
|
||||
if (mbsfn_AreaInfoList != NULL) {
|
||||
LOG_I(MAC, "[UE %d][CONFIG] Received %d MBSFN Area Info\n",
|
||||
Mod_idP, mbsfn_AreaInfoList->list.count);
|
||||
UE_mac_inst[Mod_idP].num_active_mbsfn_area =
|
||||
mbsfn_AreaInfoList->list.count;
|
||||
|
||||
for (i = 0; i < mbsfn_AreaInfoList->list.count; i++) {
|
||||
UE_mac_inst[Mod_idP].mbsfn_AreaInfo[i] =
|
||||
mbsfn_AreaInfoList->list.array[i];
|
||||
LOG_I(MAC,
|
||||
"[UE %d] MBSFN_AreaInfo[%d]: MCCH Repetition Period = %ld\n",
|
||||
Mod_idP, i,
|
||||
UE_mac_inst[Mod_idP].mbsfn_AreaInfo[i]->
|
||||
mcch_Config_r9.mcch_RepetitionPeriod_r9);
|
||||
phy_config_sib13_ue(Mod_idP, 0, eNB_index, i,
|
||||
UE_mac_inst[Mod_idP].
|
||||
mbsfn_AreaInfo[i]->mbsfn_AreaId_r9);
|
||||
}
|
||||
}
|
||||
|
||||
if (pmch_InfoList != NULL) {
|
||||
|
||||
// LOG_I(MAC,"DUY: lcid when entering rrc_mac config_req is %02d\n",(pmch_InfoList->list.array[0]->mbms_SessionInfoList_r9.list.array[0]->logicalChannelIdentity_r9));
|
||||
|
||||
LOG_I(MAC, "[UE %d] Configuring PMCH_config from MCCH MESSAGE \n",
|
||||
Mod_idP);
|
||||
|
||||
for (i = 0; i < pmch_InfoList->list.count; i++) {
|
||||
UE_mac_inst[Mod_idP].pmch_Config[i] =
|
||||
&pmch_InfoList->list.array[i]->pmch_Config_r9;
|
||||
LOG_I(MAC, "[UE %d] PMCH[%d]: MCH_Scheduling_Period = %ld\n",
|
||||
Mod_idP, i,
|
||||
UE_mac_inst[Mod_idP].
|
||||
pmch_Config[i]->mch_SchedulingPeriod_r9);
|
||||
}
|
||||
|
||||
UE_mac_inst[Mod_idP].mcch_status = 1;
|
||||
}
|
||||
#endif
|
||||
#ifdef CBA
|
||||
|
||||
if (cba_rnti) {
|
||||
UE_mac_inst[Mod_idP].cba_rnti[num_active_cba_groups - 1] =
|
||||
cba_rnti;
|
||||
LOG_D(MAC,
|
||||
"[UE %d] configure CBA group %d RNTI %x for eNB %d (total active cba group %d)\n",
|
||||
Mod_idP, Mod_idP % num_active_cba_groups, cba_rnti,
|
||||
eNB_index, num_active_cba_groups);
|
||||
phy_config_cba_rnti(Mod_idP, CC_idP, eNB_flagP, eNB_index,
|
||||
cba_rnti, num_active_cba_groups - 1,
|
||||
num_active_cba_groups);
|
||||
}
|
||||
#endif
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
|
||||
(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_OUT);
|
||||
|
||||
return (0);
|
||||
}
|
||||
@@ -764,8 +764,7 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP,
|
||||
module_idP);
|
||||
pdcp_run(&ctxt);
|
||||
|
||||
rrc_rx_tx(&ctxt, 0, // eNB index, unused in eNB
|
||||
CC_id);
|
||||
rrc_rx_tx(&ctxt, CC_id);
|
||||
|
||||
#if defined(Rel10) || defined(Rel14)
|
||||
|
||||
|
||||
@@ -843,7 +843,7 @@ generate_Msg4(module_id_t module_idP, int CC_idP, frame_t frameP,
|
||||
|
||||
// Get RRCConnectionSetup for Piggyback
|
||||
rrc_sdu_length = mac_rrc_data_req(module_idP, CC_idP, frameP, CCCH, 1, // 1 transport block
|
||||
&cc[CC_idP].CCCH_pdu.payload[0], ENB_FLAG_YES, module_idP, 0); // not used in this case
|
||||
&cc[CC_idP].CCCH_pdu.payload[0], 0); // not used in this case
|
||||
|
||||
AssertFatal(rrc_sdu_length > 0,
|
||||
"[MAC][eNB Scheduler] CCCH not allocated\n");
|
||||
|
||||
@@ -197,7 +197,7 @@ schedule_SIB1_BR(module_id_t module_idP,
|
||||
n_NB = Sj[((cc->physCellId % N_S_NB) + (i * N_S_NB / m)) % N_S_NB];
|
||||
|
||||
|
||||
bcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, BCCH_SIB1_BR, 1, &cc->BCCH_BR_pdu[0].payload[0], 1, module_idP, 0); // not used in this case
|
||||
bcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, BCCH_SIB1_BR, 1, &cc->BCCH_BR_pdu[0].payload[0], 0); // not used in this case
|
||||
|
||||
AssertFatal(cc->mib->message.schedulingInfoSIB1_BR_r13 < 19,
|
||||
"schedulingInfoSIB1_BR_r13 %d > 18\n",
|
||||
@@ -424,7 +424,7 @@ schedule_SI_BR(module_id_t module_idP, frame_t frameP,
|
||||
if ((sf_mod_period < si_WindowLength_BR_r13)
|
||||
&& ((frameP & (((1 << si_RepetitionPattern_r13) - 1))) == 0)) { // this SIB is to be scheduled
|
||||
|
||||
bcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, BCCH_SI_BR + i, 1, &cc->BCCH_BR_pdu[i + 1].payload[0], 1, module_idP, 0); // not used in this case
|
||||
bcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, BCCH_SI_BR + i, 1, &cc->BCCH_BR_pdu[i + 1].payload[0], 0); // not used in this case
|
||||
|
||||
AssertFatal(bcch_sdu_length > 0,
|
||||
"RRC returned 0 bytes for SI-BR %d\n", i);
|
||||
@@ -606,7 +606,7 @@ schedule_mib(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
|
||||
dl_req = &dl_config_request->dl_config_request_body;
|
||||
cc = &eNB->common_channels[CC_id];
|
||||
|
||||
mib_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, MIBCH, 1, &cc->MIB_pdu.payload[0], 1, module_idP, 0); // not used in this case
|
||||
mib_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, MIBCH, 1, &cc->MIB_pdu.payload[0], 0); // not used in this case
|
||||
|
||||
LOG_D(MAC, "Frame %d, subframe %d: BCH PDU length %d\n", frameP, subframeP, mib_sdu_length);
|
||||
|
||||
@@ -692,7 +692,7 @@ schedule_SI(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP)
|
||||
dl_req = &eNB->DL_req[CC_id].dl_config_request_body;
|
||||
|
||||
|
||||
bcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, BCCH, 1, &cc->BCCH_pdu.payload[0], 1, module_idP, 0); // not used in this case
|
||||
bcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, BCCH, 1, &cc->BCCH_pdu.payload[0], 0); // not used in this case
|
||||
|
||||
if (bcch_sdu_length > 0) {
|
||||
LOG_D(MAC, "[eNB %d] Frame %d : BCCH->DLSCH CC_id %d, Received %d bytes \n", module_idP, frameP, CC_id, bcch_sdu_length);
|
||||
|
||||
@@ -545,8 +545,7 @@ schedule_MBMS(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
|
||||
"[eNB %d] CC_id %d Frame %d Subframe %d: Schedule MCCH MESSAGE (area %d, sfAlloc %d)\n",
|
||||
module_idP, CC_id, frameP, subframeP, i, j);
|
||||
|
||||
mcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, MCCH, 1, &cc->MCCH_pdu.payload[0], 1, // this is eNB
|
||||
module_idP, // index
|
||||
mcch_sdu_length = mac_rrc_data_req(module_idP, CC_id, frameP, MCCH, 1, &cc->MCCH_pdu.payload[0],
|
||||
i); // this is the mbsfn sync area index
|
||||
|
||||
if (mcch_sdu_length > 0) {
|
||||
|
||||
@@ -614,7 +614,7 @@ rx_sdu(const module_id_t enb_mod_idP,
|
||||
CCCH,
|
||||
(uint8_t *) payload_ptr,
|
||||
rx_lengths[i],
|
||||
ENB_FLAG_YES, enb_mod_idP, 0);
|
||||
0);
|
||||
|
||||
|
||||
if (num_ce > 0) { // handle msg3 which is not RRCConnectionRequest
|
||||
|
||||
@@ -47,76 +47,6 @@
|
||||
#include "common/ran_context.h"
|
||||
|
||||
extern RAN_CONTEXT_t RC;
|
||||
extern void openair_rrc_top_init_ue( int eMBMS_active, char* uecap_xer, uint8_t cba_group_active, uint8_t HO_active);
|
||||
|
||||
void dl_phy_sync_success(module_id_t module_idP, frame_t frameP, unsigned char eNB_index, uint8_t first_sync) //init as MR
|
||||
{
|
||||
LOG_D(MAC, "[UE %d] Frame %d: PHY Sync to eNB_index %d successful \n",
|
||||
module_idP, frameP, eNB_index);
|
||||
#if defined(ENABLE_USE_MME)
|
||||
int mme_enabled = 1;
|
||||
#else
|
||||
int mme_enabled = 0;
|
||||
#endif
|
||||
|
||||
if (first_sync == 1 && !(mme_enabled == 1)) {
|
||||
//layer2_init_UE(module_idP);
|
||||
openair_rrc_ue_init(module_idP, eNB_index);
|
||||
} else {
|
||||
rrc_in_sync_ind(module_idP, frameP, eNB_index);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
mac_UE_out_of_sync_ind(module_id_t module_idP, frame_t frameP,
|
||||
uint16_t eNB_index)
|
||||
{
|
||||
|
||||
// Mac_rlc_xface->mac_out_of_sync_ind(Mod_id, frameP, eNB_index);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
mac_top_init_ue(int eMBMS_active, char *uecap_xer,
|
||||
uint8_t cba_group_active, uint8_t HO_active)
|
||||
{
|
||||
|
||||
int i;
|
||||
|
||||
LOG_I(MAC, "[MAIN] Init function start:Nb_UE_INST=%d\n", NB_UE_INST);
|
||||
|
||||
if (NB_UE_INST > 0) {
|
||||
UE_mac_inst =
|
||||
(UE_MAC_INST *) malloc16(NB_UE_INST * sizeof(UE_MAC_INST));
|
||||
|
||||
AssertFatal(UE_mac_inst != NULL,
|
||||
"[MAIN] Can't ALLOCATE %zu Bytes for %d UE_MAC_INST with size %zu \n",
|
||||
NB_UE_INST * sizeof(UE_MAC_INST), NB_UE_INST,
|
||||
sizeof(UE_MAC_INST));
|
||||
|
||||
LOG_D(MAC, "[MAIN] ALLOCATE %zu Bytes for %d UE_MAC_INST @ %p\n",
|
||||
NB_UE_INST * sizeof(UE_MAC_INST), NB_UE_INST, UE_mac_inst);
|
||||
|
||||
bzero(UE_mac_inst, NB_UE_INST * sizeof(UE_MAC_INST));
|
||||
|
||||
for (i = 0; i < NB_UE_INST; i++) {
|
||||
ue_init_mac(i);
|
||||
}
|
||||
} else {
|
||||
UE_mac_inst = NULL;
|
||||
}
|
||||
|
||||
|
||||
LOG_I(MAC, "[MAIN] calling RRC\n");
|
||||
openair_rrc_top_init_ue(eMBMS_active, uecap_xer, cba_group_active,
|
||||
HO_active);
|
||||
|
||||
|
||||
LOG_I(MAC, "[MAIN][INIT] Init function finished\n");
|
||||
|
||||
return (0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void mac_top_init_eNB(void)
|
||||
@@ -258,20 +188,6 @@ void mac_top_cleanup(void)
|
||||
|
||||
}
|
||||
|
||||
int
|
||||
l2_init_ue(int eMBMS_active, char *uecap_xer, uint8_t cba_group_active,
|
||||
uint8_t HO_active)
|
||||
{
|
||||
LOG_I(MAC, "[MAIN] MAC_INIT_GLOBAL_PARAM IN...\n");
|
||||
// NB_NODE=2;
|
||||
// NB_INST=2;
|
||||
|
||||
rlcmac_init_global_param();
|
||||
LOG_I(MAC, "[MAIN] init UE MAC functions \n");
|
||||
mac_top_init_ue(eMBMS_active, uecap_xer, cba_group_active, HO_active);
|
||||
return (1);
|
||||
}
|
||||
|
||||
int l2_init_eNB(void)
|
||||
{
|
||||
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
/*! \file main.c
|
||||
* \brief top init of Layer 2
|
||||
* \author Navid Nikaein and Raymond Knopp
|
||||
* \date 2010 - 2014
|
||||
* \version 1.0
|
||||
* \email: navid.nikaein@eurecom.fr
|
||||
* @ingroup _mac
|
||||
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
#include "proto.h"
|
||||
#include "extern.h"
|
||||
#include "assertions.h"
|
||||
#include "PHY_INTERFACE/extern.h"
|
||||
#include "PHY/defs.h"
|
||||
#include "SCHED/defs.h"
|
||||
#include "LAYER2/PDCP_v10.1.0/pdcp.h"
|
||||
#include "RRC/LITE/defs.h"
|
||||
#include "UTIL/LOG/log.h"
|
||||
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
|
||||
|
||||
#include "SCHED/defs.h"
|
||||
|
||||
|
||||
#include "common/ran_context.h"
|
||||
|
||||
extern void openair_rrc_top_init_ue( int eMBMS_active, char* uecap_xer, uint8_t cba_group_active, uint8_t HO_active);
|
||||
|
||||
void dl_phy_sync_success(module_id_t module_idP, frame_t frameP, unsigned char eNB_index, uint8_t first_sync) //init as MR
|
||||
{
|
||||
LOG_D(MAC, "[UE %d] Frame %d: PHY Sync to eNB_index %d successful \n",
|
||||
module_idP, frameP, eNB_index);
|
||||
#if defined(ENABLE_USE_MME)
|
||||
int mme_enabled = 1;
|
||||
#else
|
||||
int mme_enabled = 0;
|
||||
#endif
|
||||
|
||||
if (first_sync == 1 && !(mme_enabled == 1)) {
|
||||
//layer2_init_UE(module_idP);
|
||||
openair_rrc_ue_init(module_idP, eNB_index);
|
||||
} else {
|
||||
rrc_in_sync_ind(module_idP, frameP, eNB_index);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
mac_UE_out_of_sync_ind(module_id_t module_idP, frame_t frameP,
|
||||
uint16_t eNB_index)
|
||||
{
|
||||
|
||||
// Mac_rlc_xface->mac_out_of_sync_ind(Mod_id, frameP, eNB_index);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
mac_top_init_ue(int eMBMS_active, char *uecap_xer,
|
||||
uint8_t cba_group_active, uint8_t HO_active)
|
||||
{
|
||||
|
||||
int i;
|
||||
|
||||
LOG_I(MAC, "[MAIN] Init function start:Nb_UE_INST=%d\n", NB_UE_INST);
|
||||
|
||||
if (NB_UE_INST > 0) {
|
||||
UE_mac_inst =
|
||||
(UE_MAC_INST *) malloc16(NB_UE_INST * sizeof(UE_MAC_INST));
|
||||
|
||||
AssertFatal(UE_mac_inst != NULL,
|
||||
"[MAIN] Can't ALLOCATE %zu Bytes for %d UE_MAC_INST with size %zu \n",
|
||||
NB_UE_INST * sizeof(UE_MAC_INST), NB_UE_INST,
|
||||
sizeof(UE_MAC_INST));
|
||||
|
||||
LOG_D(MAC, "[MAIN] ALLOCATE %zu Bytes for %d UE_MAC_INST @ %p\n",
|
||||
NB_UE_INST * sizeof(UE_MAC_INST), NB_UE_INST, UE_mac_inst);
|
||||
|
||||
bzero(UE_mac_inst, NB_UE_INST * sizeof(UE_MAC_INST));
|
||||
|
||||
for (i = 0; i < NB_UE_INST; i++) {
|
||||
ue_init_mac(i);
|
||||
}
|
||||
} else {
|
||||
UE_mac_inst = NULL;
|
||||
}
|
||||
|
||||
|
||||
LOG_I(MAC, "[MAIN] calling RRC\n");
|
||||
openair_rrc_top_init_ue(eMBMS_active, uecap_xer, cba_group_active,
|
||||
HO_active);
|
||||
|
||||
|
||||
LOG_I(MAC, "[MAIN][INIT] Init function finished\n");
|
||||
|
||||
return (0);
|
||||
|
||||
}
|
||||
|
||||
int rlcmac_init_global_param_ue(void)
|
||||
{
|
||||
|
||||
|
||||
LOG_I(MAC, "[MAIN] CALLING RLC_MODULE_INIT...\n");
|
||||
|
||||
if (rlc_module_init() != 0) {
|
||||
return (-1);
|
||||
}
|
||||
|
||||
pdcp_layer_init();
|
||||
|
||||
LOG_I(MAC, "[MAIN] Init Global Param Done\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
l2_init_ue(int eMBMS_active, char *uecap_xer, uint8_t cba_group_active,
|
||||
uint8_t HO_active)
|
||||
{
|
||||
LOG_I(MAC, "[MAIN] MAC_INIT_GLOBAL_PARAM IN...\n");
|
||||
// NB_NODE=2;
|
||||
// NB_INST=2;
|
||||
|
||||
rlcmac_init_global_param_ue();
|
||||
LOG_I(MAC, "[MAIN] init UE MAC functions \n");
|
||||
mac_top_init_ue(eMBMS_active, uecap_xer, cba_group_active, HO_active);
|
||||
return (1);
|
||||
}
|
||||
|
||||
@@ -372,14 +372,14 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP, int CC_id,
|
||||
if (UE_mac_inst[module_idP].RA_active == 0) {
|
||||
LOG_I(MAC, "RA not active\n");
|
||||
// check if RRC is ready to initiate the RA procedure
|
||||
Size = mac_rrc_data_req(module_idP,
|
||||
Size = mac_rrc_data_req_ue(module_idP,
|
||||
CC_id,
|
||||
frameP,
|
||||
CCCH, 1,
|
||||
&UE_mac_inst[module_idP].
|
||||
CCCH_pdu.payload[sizeof
|
||||
(SCH_SUBHEADER_SHORT)
|
||||
+ 1], 0, eNB_indexP,
|
||||
+ 1], eNB_indexP,
|
||||
0);
|
||||
Size16 = (uint16_t) Size;
|
||||
|
||||
|
||||
@@ -182,104 +182,3 @@ fill_rar_br(eNB_MAC_INST * eNB,
|
||||
}
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
uint16_t ue_process_rar(const module_id_t module_idP, const int CC_id, const frame_t frameP, const rnti_t ra_rnti, uint8_t * const dlsch_buffer, rnti_t * const t_crnti, const uint8_t preamble_index, uint8_t * selected_rar_buffer // output argument for storing the selected RAR header and RAR payload
|
||||
)
|
||||
//------------------------------------------------------------------------------
|
||||
{
|
||||
uint16_t ret = 0; // return value
|
||||
|
||||
RA_HEADER_RAPID *rarh = (RA_HEADER_RAPID *) dlsch_buffer;
|
||||
// RAR_PDU *rar = (RAR_PDU *)(dlsch_buffer+1);
|
||||
uint8_t *rar = (uint8_t *) (dlsch_buffer + 1);
|
||||
|
||||
// get the last RAR payload for working with CMW500
|
||||
uint8_t n_rarpy = 0; // number of RAR payloads
|
||||
uint8_t n_rarh = 0; // number of MAC RAR subheaders
|
||||
uint8_t best_rx_rapid = -1; // the closest RAPID receive from all RARs
|
||||
while (1) {
|
||||
n_rarh++;
|
||||
if (rarh->T == 1) {
|
||||
n_rarpy++;
|
||||
LOG_D(MAC, "RAPID %d\n", rarh->RAPID);
|
||||
}
|
||||
|
||||
if (rarh->RAPID == preamble_index) {
|
||||
LOG_D(PHY, "Found RAR with the intended RAPID %d\n",
|
||||
rarh->RAPID);
|
||||
rar = (uint8_t *) (dlsch_buffer + n_rarh + (n_rarpy - 1) * 6);
|
||||
break;
|
||||
}
|
||||
|
||||
if (abs((int) rarh->RAPID - (int) preamble_index) <
|
||||
abs((int) best_rx_rapid - (int) preamble_index)) {
|
||||
best_rx_rapid = rarh->RAPID;
|
||||
rar = (uint8_t *) (dlsch_buffer + n_rarh + (n_rarpy - 1) * 6);
|
||||
}
|
||||
|
||||
if (rarh->E == 0) {
|
||||
LOG_I(PHY,
|
||||
"No RAR found with the intended RAPID. The closest RAPID in all RARs is %d\n",
|
||||
best_rx_rapid);
|
||||
break;
|
||||
} else {
|
||||
rarh++;
|
||||
}
|
||||
};
|
||||
LOG_D(MAC, "number of RAR subheader %d; number of RAR pyloads %d\n",
|
||||
n_rarh, n_rarpy);
|
||||
|
||||
if (CC_id > 0) {
|
||||
LOG_W(MAC, "Should not have received RAR on secondary CCs! \n");
|
||||
return (0xffff);
|
||||
}
|
||||
|
||||
LOG_I(MAC,
|
||||
"[eNB %d][RAPROC] Frame %d Received RAR (%02x|%02x.%02x.%02x.%02x.%02x.%02x) for preamble %d/%d\n",
|
||||
module_idP, frameP, *(uint8_t *) rarh, rar[0], rar[1], rar[2],
|
||||
rar[3], rar[4], rar[5], rarh->RAPID, preamble_index);
|
||||
#ifdef DEBUG_RAR
|
||||
LOG_D(MAC, "[UE %d][RAPROC] rarh->E %d\n", module_idP, rarh->E);
|
||||
LOG_D(MAC, "[UE %d][RAPROC] rarh->T %d\n", module_idP, rarh->T);
|
||||
LOG_D(MAC, "[UE %d][RAPROC] rarh->RAPID %d\n", module_idP,
|
||||
rarh->RAPID);
|
||||
|
||||
// LOG_I(MAC,"[UE %d][RAPROC] rar->R %d\n",module_idP,rar->R);
|
||||
LOG_D(MAC, "[UE %d][RAPROC] rar->Timing_Advance_Command %d\n",
|
||||
module_idP, (((uint16_t) (rar[0] & 0x7f)) << 4) + (rar[1] >> 4));
|
||||
// LOG_I(MAC,"[UE %d][RAPROC] rar->hopping_flag %d\n",module_idP,rar->hopping_flag);
|
||||
// LOG_I(MAC,"[UE %d][RAPROC] rar->rb_alloc %d\n",module_idP,rar->rb_alloc);
|
||||
// LOG_I(MAC,"[UE %d][RAPROC] rar->mcs %d\n",module_idP,rar->mcs);
|
||||
// LOG_I(MAC,"[UE %d][RAPROC] rar->TPC %d\n",module_idP,rar->TPC);
|
||||
// LOG_I(MAC,"[UE %d][RAPROC] rar->UL_delay %d\n",module_idP,rar->UL_delay);
|
||||
// LOG_I(MAC,"[UE %d][RAPROC] rar->cqi_req %d\n",module_idP,rar->cqi_req);
|
||||
LOG_D(MAC, "[UE %d][RAPROC] rar->t_crnti %x\n", module_idP,
|
||||
(uint16_t) rar[5] + (rar[4] << 8));
|
||||
#endif
|
||||
|
||||
if (opt_enabled) {
|
||||
LOG_D(OPT,
|
||||
"[UE %d][RAPROC] CC_id %d RAR Frame %d trace pdu for ra-RNTI %x\n",
|
||||
module_idP, CC_id, frameP, ra_rnti);
|
||||
trace_pdu(1, (uint8_t *) dlsch_buffer, n_rarh + n_rarpy * 6,
|
||||
module_idP, 2, ra_rnti, UE_mac_inst[module_idP].rxFrame,
|
||||
UE_mac_inst[module_idP].rxSubframe, 0, 0);
|
||||
}
|
||||
|
||||
if (preamble_index == rarh->RAPID) {
|
||||
*t_crnti = (uint16_t) rar[5] + (rar[4] << 8); //rar->t_crnti;
|
||||
UE_mac_inst[module_idP].crnti = *t_crnti; //rar->t_crnti;
|
||||
//return(rar->Timing_Advance_Command);
|
||||
ret = ((((uint16_t) (rar[0] & 0x7f)) << 4) + (rar[1] >> 4));
|
||||
} else {
|
||||
UE_mac_inst[module_idP].crnti = 0;
|
||||
ret = (0xffff);
|
||||
}
|
||||
|
||||
// move the selected RAR to the front of the RA_PDSCH buffer
|
||||
memcpy(selected_rar_buffer + 0, (uint8_t *) rarh, 1);
|
||||
memcpy(selected_rar_buffer + 1, (uint8_t *) rar, 6);
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,143 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
/*! \file rar_tools.c
|
||||
* \brief random access tools
|
||||
* \author Raymond Knopp and navid nikaein
|
||||
* \date 2011 - 2014
|
||||
* \version 1.0
|
||||
* @ingroup _mac
|
||||
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
#include "proto.h"
|
||||
#include "extern.h"
|
||||
#include "SIMULATION/TOOLS/defs.h"
|
||||
#include "UTIL/LOG/log.h"
|
||||
#include "OCG.h"
|
||||
#include "OCG_extern.h"
|
||||
#include "UTIL/OPT/opt.h"
|
||||
#include "common/ran_context.h"
|
||||
|
||||
#define DEBUG_RAR
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
uint16_t ue_process_rar(const module_id_t module_idP, const int CC_id, const frame_t frameP, const rnti_t ra_rnti, uint8_t * const dlsch_buffer, rnti_t * const t_crnti, const uint8_t preamble_index, uint8_t * selected_rar_buffer // output argument for storing the selected RAR header and RAR payload
|
||||
)
|
||||
//------------------------------------------------------------------------------
|
||||
{
|
||||
uint16_t ret = 0; // return value
|
||||
|
||||
RA_HEADER_RAPID *rarh = (RA_HEADER_RAPID *) dlsch_buffer;
|
||||
// RAR_PDU *rar = (RAR_PDU *)(dlsch_buffer+1);
|
||||
uint8_t *rar = (uint8_t *) (dlsch_buffer + 1);
|
||||
|
||||
// get the last RAR payload for working with CMW500
|
||||
uint8_t n_rarpy = 0; // number of RAR payloads
|
||||
uint8_t n_rarh = 0; // number of MAC RAR subheaders
|
||||
uint8_t best_rx_rapid = -1; // the closest RAPID receive from all RARs
|
||||
while (1) {
|
||||
n_rarh++;
|
||||
if (rarh->T == 1) {
|
||||
n_rarpy++;
|
||||
LOG_D(MAC, "RAPID %d\n", rarh->RAPID);
|
||||
}
|
||||
|
||||
if (rarh->RAPID == preamble_index) {
|
||||
LOG_D(PHY, "Found RAR with the intended RAPID %d\n",
|
||||
rarh->RAPID);
|
||||
rar = (uint8_t *) (dlsch_buffer + n_rarh + (n_rarpy - 1) * 6);
|
||||
break;
|
||||
}
|
||||
|
||||
if (abs((int) rarh->RAPID - (int) preamble_index) <
|
||||
abs((int) best_rx_rapid - (int) preamble_index)) {
|
||||
best_rx_rapid = rarh->RAPID;
|
||||
rar = (uint8_t *) (dlsch_buffer + n_rarh + (n_rarpy - 1) * 6);
|
||||
}
|
||||
|
||||
if (rarh->E == 0) {
|
||||
LOG_I(PHY,
|
||||
"No RAR found with the intended RAPID. The closest RAPID in all RARs is %d\n",
|
||||
best_rx_rapid);
|
||||
break;
|
||||
} else {
|
||||
rarh++;
|
||||
}
|
||||
};
|
||||
LOG_D(MAC, "number of RAR subheader %d; number of RAR pyloads %d\n",
|
||||
n_rarh, n_rarpy);
|
||||
|
||||
if (CC_id > 0) {
|
||||
LOG_W(MAC, "Should not have received RAR on secondary CCs! \n");
|
||||
return (0xffff);
|
||||
}
|
||||
|
||||
LOG_I(MAC,
|
||||
"[eNB %d][RAPROC] Frame %d Received RAR (%02x|%02x.%02x.%02x.%02x.%02x.%02x) for preamble %d/%d\n",
|
||||
module_idP, frameP, *(uint8_t *) rarh, rar[0], rar[1], rar[2],
|
||||
rar[3], rar[4], rar[5], rarh->RAPID, preamble_index);
|
||||
#ifdef DEBUG_RAR
|
||||
LOG_D(MAC, "[UE %d][RAPROC] rarh->E %d\n", module_idP, rarh->E);
|
||||
LOG_D(MAC, "[UE %d][RAPROC] rarh->T %d\n", module_idP, rarh->T);
|
||||
LOG_D(MAC, "[UE %d][RAPROC] rarh->RAPID %d\n", module_idP,
|
||||
rarh->RAPID);
|
||||
|
||||
// LOG_I(MAC,"[UE %d][RAPROC] rar->R %d\n",module_idP,rar->R);
|
||||
LOG_D(MAC, "[UE %d][RAPROC] rar->Timing_Advance_Command %d\n",
|
||||
module_idP, (((uint16_t) (rar[0] & 0x7f)) << 4) + (rar[1] >> 4));
|
||||
// LOG_I(MAC,"[UE %d][RAPROC] rar->hopping_flag %d\n",module_idP,rar->hopping_flag);
|
||||
// LOG_I(MAC,"[UE %d][RAPROC] rar->rb_alloc %d\n",module_idP,rar->rb_alloc);
|
||||
// LOG_I(MAC,"[UE %d][RAPROC] rar->mcs %d\n",module_idP,rar->mcs);
|
||||
// LOG_I(MAC,"[UE %d][RAPROC] rar->TPC %d\n",module_idP,rar->TPC);
|
||||
// LOG_I(MAC,"[UE %d][RAPROC] rar->UL_delay %d\n",module_idP,rar->UL_delay);
|
||||
// LOG_I(MAC,"[UE %d][RAPROC] rar->cqi_req %d\n",module_idP,rar->cqi_req);
|
||||
LOG_D(MAC, "[UE %d][RAPROC] rar->t_crnti %x\n", module_idP,
|
||||
(uint16_t) rar[5] + (rar[4] << 8));
|
||||
#endif
|
||||
|
||||
if (opt_enabled) {
|
||||
LOG_D(OPT,
|
||||
"[UE %d][RAPROC] CC_id %d RAR Frame %d trace pdu for ra-RNTI %x\n",
|
||||
module_idP, CC_id, frameP, ra_rnti);
|
||||
trace_pdu(1, (uint8_t *) dlsch_buffer, n_rarh + n_rarpy * 6,
|
||||
module_idP, 2, ra_rnti, UE_mac_inst[module_idP].rxFrame,
|
||||
UE_mac_inst[module_idP].rxSubframe, 0, 0);
|
||||
}
|
||||
|
||||
if (preamble_index == rarh->RAPID) {
|
||||
*t_crnti = (uint16_t) rar[5] + (rar[4] << 8); //rar->t_crnti;
|
||||
UE_mac_inst[module_idP].crnti = *t_crnti; //rar->t_crnti;
|
||||
//return(rar->Timing_Advance_Command);
|
||||
ret = ((((uint16_t) (rar[0] & 0x7f)) << 4) + (rar[1] >> 4));
|
||||
} else {
|
||||
UE_mac_inst[module_idP].crnti = 0;
|
||||
ret = (0xffff);
|
||||
}
|
||||
|
||||
// move the selected RAR to the front of the RA_PDSCH buffer
|
||||
memcpy(selected_rar_buffer + 0, (uint8_t *) rarh, 1);
|
||||
memcpy(selected_rar_buffer + 1, (uint8_t *) rar, 6);
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
@@ -515,13 +515,13 @@ ue_send_sdu(module_id_t module_idP,
|
||||
|
||||
LOG_T(MAC, "\n");
|
||||
#endif
|
||||
mac_rrc_data_ind(module_idP,
|
||||
mac_rrc_data_ind_ue(module_idP,
|
||||
CC_id,
|
||||
frameP, subframeP,
|
||||
UE_mac_inst[module_idP].crnti,
|
||||
CCCH,
|
||||
(uint8_t *) payload_ptr,
|
||||
rx_lengths[i], ENB_FLAG_NO, eNB_index, 0);
|
||||
rx_lengths[i], eNB_index, 0);
|
||||
|
||||
} else if ((rx_lcids[i] == DCCH) || (rx_lcids[i] == DCCH1)) {
|
||||
LOG_D(MAC,
|
||||
@@ -584,9 +584,9 @@ ue_decode_si(module_id_t module_idP, int CC_id, frame_t frameP,
|
||||
LOG_D(MAC, "[UE %d] Frame %d Sending SI to RRC (LCID Id %d,len %d)\n",
|
||||
module_idP, frameP, BCCH, len);
|
||||
|
||||
mac_rrc_data_ind(module_idP, CC_id, frameP, 0, // unknown subframe
|
||||
mac_rrc_data_ind_ue(module_idP, CC_id, frameP, 0, // unknown subframe
|
||||
SI_RNTI,
|
||||
BCCH, (uint8_t *) pdu, len, ENB_FLAG_NO, eNB_index,
|
||||
BCCH, (uint8_t *) pdu, len, eNB_index,
|
||||
0);
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
|
||||
(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_SI, VCD_FUNCTION_OUT);
|
||||
@@ -622,9 +622,9 @@ ue_decode_p(module_id_t module_idP, int CC_id, frame_t frameP,
|
||||
"[UE %d] Frame %d Sending Paging message to RRC (LCID Id %d,len %d)\n",
|
||||
module_idP, frameP, PCCH, len);
|
||||
|
||||
mac_rrc_data_ind(module_idP, CC_id, frameP, 0, // unknown subframe
|
||||
mac_rrc_data_ind_ue(module_idP, CC_id, frameP, 0, // unknown subframe
|
||||
P_RNTI,
|
||||
PCCH, (uint8_t *) pdu, len, ENB_FLAG_NO, eNB_index,
|
||||
PCCH, (uint8_t *) pdu, len, eNB_index,
|
||||
0);
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
|
||||
(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_PCCH, VCD_FUNCTION_OUT);
|
||||
@@ -744,10 +744,10 @@ ue_send_mch_sdu(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
|
||||
"[UE %d] Frame %d : SDU %d MCH->MCCH for sync area %d (eNB %d, %d bytes)\n",
|
||||
module_idP, frameP, i, sync_area, eNB_index,
|
||||
rx_lengths[i]);
|
||||
mac_rrc_data_ind(module_idP, CC_id, frameP, 0, // unknown subframe
|
||||
mac_rrc_data_ind_ue(module_idP, CC_id, frameP, 0, // unknown subframe
|
||||
M_RNTI,
|
||||
MCCH,
|
||||
payload_ptr, rx_lengths[i], 0, eNB_index,
|
||||
payload_ptr, rx_lengths[i], eNB_index,
|
||||
sync_area);
|
||||
} else if (rx_lcids[i] == MTCH) {
|
||||
if (UE_mac_inst[module_idP].msi_status == 1) {
|
||||
@@ -2230,10 +2230,10 @@ ue_scheduler(const module_id_t module_idP,
|
||||
UE_mac_inst[module_idP].rxSubframe = rxSubframeP;
|
||||
|
||||
#ifdef CELLULAR
|
||||
rrc_rx_tx(module_idP, txFrameP, 0, eNB_indexP);
|
||||
rrc_rx_tx_ue(module_idP, txFrameP, 0, eNB_indexP);
|
||||
#else
|
||||
|
||||
switch (rrc_rx_tx(&ctxt, eNB_indexP, CC_id)) {
|
||||
switch (rrc_rx_tx_ue(&ctxt, eNB_indexP, CC_id)) {
|
||||
case RRC_OK:
|
||||
break;
|
||||
|
||||
|
||||
@@ -630,11 +630,11 @@ pdcp_data_ind(
|
||||
PROTOCOL_PDCP_CTXT_FMT" DATA-IND len %u",
|
||||
PROTOCOL_PDCP_CTXT_ARGS(ctxt_pP, pdcp_p),
|
||||
sdu_buffer_sizeP - pdcp_header_len - pdcp_tailer_len);
|
||||
rrc_data_ind(ctxt_pP,
|
||||
rrc_data_ind(ctxt_pP,
|
||||
rb_id,
|
||||
sdu_buffer_sizeP - pdcp_header_len - pdcp_tailer_len,
|
||||
(uint8_t*)&sdu_buffer_pP->data[pdcp_header_len]);
|
||||
free_mem_block(sdu_buffer_pP, __func__);
|
||||
|
||||
|
||||
// free_mem_block(new_sdu, __func__);
|
||||
if (ctxt_pP->enb_flag) {
|
||||
|
||||
@@ -228,7 +228,7 @@ int dump_eNB_l2_stats(char *buffer, int length)
|
||||
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt,
|
||||
eNB_id,
|
||||
ENB_FLAG_YES,
|
||||
UE_list->eNB_UE_stats[UE_PCCID(eNB_id,UE_id)][UE_id].crnti,
|
||||
UE_list->eNB_UE_stats[0][UE_id].crnti,//UE_PCCID(eNB_id,UE_id)][UE_id].crnti,
|
||||
eNB->frame,
|
||||
eNB->subframe,
|
||||
eNB_id);
|
||||
|
||||
@@ -41,8 +41,6 @@ mac_rrc_data_req(
|
||||
const rb_id_t srb_idP,
|
||||
const uint8_t nb_tbP,
|
||||
uint8_t* const buffer_pP,
|
||||
const eNB_flag_t eNB_flagP,
|
||||
const mac_enb_index_t eNB_indexP,
|
||||
const uint8_t mbsfn_sync_areaP
|
||||
);
|
||||
|
||||
@@ -56,7 +54,31 @@ mac_rrc_data_ind(
|
||||
const rb_id_t srb_idP,
|
||||
const uint8_t *sduP,
|
||||
const sdu_size_t sdu_lenP,
|
||||
const eNB_flag_t eNB_flagP,
|
||||
const uint8_t mbsfn_sync_area
|
||||
);
|
||||
|
||||
int8_t
|
||||
mac_rrc_data_req_ue(
|
||||
const module_id_t module_idP,
|
||||
const int CC_idP,
|
||||
const frame_t frameP,
|
||||
const rb_id_t srb_idP,
|
||||
const uint8_t nb_tbP,
|
||||
uint8_t* const buffer_pP,
|
||||
const mac_enb_index_t eNB_indexP,
|
||||
const uint8_t mbsfn_sync_areaP
|
||||
);
|
||||
|
||||
int8_t
|
||||
mac_rrc_data_ind_ue(
|
||||
const module_id_t module_idP,
|
||||
const int CC_idP,
|
||||
const frame_t frameP,
|
||||
const sub_frame_t sub_frameP,
|
||||
const rnti_t rntiP,
|
||||
const rb_id_t srb_idP,
|
||||
const uint8_t *sduP,
|
||||
const sdu_size_t sdu_lenP,
|
||||
const mac_enb_index_t eNB_indexP,
|
||||
const uint8_t mbsfn_sync_area
|
||||
);
|
||||
|
||||
@@ -56,7 +56,6 @@ extern UE_MAC_INST *UE_mac_inst;
|
||||
//#define RRC_DATA_REQ_DEBUG
|
||||
//#define DEBUG_RRC 1
|
||||
|
||||
mui_t mui=0;
|
||||
|
||||
extern RAN_CONTEXT_t RC;
|
||||
|
||||
@@ -69,8 +68,6 @@ mac_rrc_data_req(
|
||||
const rb_id_t Srb_id,
|
||||
const uint8_t Nb_tb,
|
||||
uint8_t* const buffer_pP,
|
||||
const eNB_flag_t enb_flagP,
|
||||
const uint8_t eNB_index,
|
||||
const uint8_t mbsfn_sync_area
|
||||
)
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -90,7 +87,6 @@ mac_rrc_data_req(
|
||||
rrc_eNB_carrier_data_t *carrier;
|
||||
BCCH_BCH_Message_t *mib;
|
||||
|
||||
if( enb_flagP == ENB_FLAG_YES) {
|
||||
|
||||
rrc = RC.rrc[Mod_idP];
|
||||
carrier = &rrc->carrier[0];
|
||||
@@ -359,48 +355,6 @@ mac_rrc_data_req(
|
||||
|
||||
#endif
|
||||
|
||||
} else { //This is an UE
|
||||
|
||||
|
||||
LOG_D(RRC,"[UE %d] Frame %d Filling CCCH SRB_ID %d\n",Mod_idP,frameP,Srb_id);
|
||||
LOG_D(RRC,"[UE %d] Frame %d buffer_pP status %d,\n",Mod_idP,frameP, UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size);
|
||||
|
||||
|
||||
if( (UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size > 0) ) {
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
{
|
||||
MessageDef *message_p;
|
||||
int ccch_size = UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size;
|
||||
int sdu_size = sizeof(RRC_MAC_CCCH_DATA_REQ (message_p).sdu);
|
||||
|
||||
if (ccch_size > sdu_size) {
|
||||
LOG_E(RRC, "SDU larger than CCCH SDU buffer size (%d, %d)", ccch_size, sdu_size);
|
||||
ccch_size = sdu_size;
|
||||
}
|
||||
|
||||
message_p = itti_alloc_new_message (TASK_RRC_UE, RRC_MAC_CCCH_DATA_REQ);
|
||||
RRC_MAC_CCCH_DATA_REQ (message_p).frame = frameP;
|
||||
RRC_MAC_CCCH_DATA_REQ (message_p).sdu_size = ccch_size;
|
||||
memset (RRC_MAC_CCCH_DATA_REQ (message_p).sdu, 0, CCCH_SDU_SIZE);
|
||||
memcpy (RRC_MAC_CCCH_DATA_REQ (message_p).sdu, UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.Payload, ccch_size);
|
||||
RRC_MAC_CCCH_DATA_REQ (message_p).enb_index = eNB_index;
|
||||
|
||||
itti_send_msg_to_task (TASK_MAC_UE, UE_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
|
||||
}
|
||||
#endif
|
||||
|
||||
memcpy(&buffer_pP[0],&UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.Payload[0],UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size);
|
||||
uint8_t Ret_size=UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size;
|
||||
// UE_rrc_inst[Mod_id].Srb0[eNB_index].Tx_buffer.payload_size=0;
|
||||
UE_rrc_inst[Mod_idP].Info[eNB_index].T300_active = 1;
|
||||
UE_rrc_inst[Mod_idP].Info[eNB_index].T300_cnt = 0;
|
||||
// msg("[RRC][UE %d] Sending rach\n",Mod_id);
|
||||
return(Ret_size);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
@@ -416,8 +370,6 @@ mac_rrc_data_ind(
|
||||
const rb_id_t srb_idP,
|
||||
const uint8_t* sduP,
|
||||
const sdu_size_t sdu_lenP,
|
||||
const eNB_flag_t eNB_flagP,
|
||||
const mac_enb_index_t eNB_indexP,
|
||||
const uint8_t mbsfn_sync_areaP
|
||||
)
|
||||
//--------------------------------------------------------------------------
|
||||
@@ -432,114 +384,8 @@ mac_rrc_data_ind(
|
||||
/*
|
||||
int si_window;
|
||||
*/
|
||||
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, eNB_flagP, rntiP, frameP, sub_frameP,eNB_indexP);
|
||||
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES, rntiP, frameP, sub_frameP,0);
|
||||
|
||||
if(eNB_flagP == ENB_FLAG_NO) {
|
||||
if(srb_idP == BCCH) {
|
||||
LOG_D(RRC,"[UE %d] Received SDU for BCCH on SRB %d from eNB %d\n",module_idP,srb_idP,eNB_indexP);
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
{
|
||||
MessageDef *message_p;
|
||||
int msg_sdu_size = sizeof(RRC_MAC_BCCH_DATA_IND (message_p).sdu);
|
||||
|
||||
if (sdu_lenP > msg_sdu_size) {
|
||||
LOG_E(RRC, "SDU larger than BCCH SDU buffer size (%d, %d)", sdu_lenP, msg_sdu_size);
|
||||
sdu_size = msg_sdu_size;
|
||||
} else {
|
||||
sdu_size = sdu_lenP;
|
||||
}
|
||||
|
||||
message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_BCCH_DATA_IND);
|
||||
memset (RRC_MAC_BCCH_DATA_IND (message_p).sdu, 0, BCCH_SDU_SIZE);
|
||||
RRC_MAC_BCCH_DATA_IND (message_p).frame = frameP;
|
||||
RRC_MAC_BCCH_DATA_IND (message_p).sub_frame = sub_frameP;
|
||||
RRC_MAC_BCCH_DATA_IND (message_p).sdu_size = sdu_size;
|
||||
memcpy (RRC_MAC_BCCH_DATA_IND (message_p).sdu, sduP, sdu_size);
|
||||
RRC_MAC_BCCH_DATA_IND (message_p).enb_index = eNB_indexP;
|
||||
RRC_MAC_BCCH_DATA_IND (message_p).rsrq = 30 /* TODO change phy to report rspq */;
|
||||
RRC_MAC_BCCH_DATA_IND (message_p).rsrp = 45 /* TODO change phy to report rspp */;
|
||||
|
||||
itti_send_msg_to_task (TASK_RRC_UE, ctxt.instance, message_p);
|
||||
}
|
||||
#else
|
||||
decode_BCCH_DLSCH_Message(&ctxt,eNB_indexP,(uint8_t*)sduP,sdu_lenP, 0, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
if(srb_idP == PCCH) {
|
||||
LOG_D(RRC,"[UE %d] Received SDU for PCCH on SRB %d from eNB %d\n",module_idP,srb_idP,eNB_indexP);
|
||||
decode_PCCH_DLSCH_Message(&ctxt,eNB_indexP,(uint8_t*)sduP,sdu_lenP);
|
||||
}
|
||||
if((srb_idP & RAB_OFFSET) == CCCH) {
|
||||
if (sdu_lenP>0) {
|
||||
LOG_T(RRC,"[UE %d] Received SDU for CCCH on SRB %d from eNB %d\n",module_idP,srb_idP & RAB_OFFSET,eNB_indexP);
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
{
|
||||
MessageDef *message_p;
|
||||
int msg_sdu_size = CCCH_SDU_SIZE;
|
||||
|
||||
if (sdu_lenP > msg_sdu_size) {
|
||||
LOG_E(RRC, "SDU larger than CCCH SDU buffer size (%d, %d)", sdu_size, msg_sdu_size);
|
||||
sdu_size = msg_sdu_size;
|
||||
} else {
|
||||
sdu_size = sdu_lenP;
|
||||
}
|
||||
|
||||
message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_CCCH_DATA_IND);
|
||||
memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE);
|
||||
memcpy (RRC_MAC_CCCH_DATA_IND (message_p).sdu, sduP, sdu_size);
|
||||
RRC_MAC_CCCH_DATA_IND (message_p).frame = frameP;
|
||||
RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = sub_frameP;
|
||||
RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = sdu_size;
|
||||
RRC_MAC_CCCH_DATA_IND (message_p).enb_index = eNB_indexP;
|
||||
RRC_MAC_CCCH_DATA_IND (message_p).rnti = rntiP;
|
||||
itti_send_msg_to_task (TASK_RRC_UE, ctxt.instance, message_p);
|
||||
}
|
||||
#else
|
||||
Srb_info = &UE_rrc_inst[module_idP].Srb0[eNB_indexP];
|
||||
memcpy(Srb_info->Rx_buffer.Payload,sduP,sdu_lenP);
|
||||
Srb_info->Rx_buffer.payload_size = sdu_lenP;
|
||||
rrc_ue_decode_ccch(&ctxt, Srb_info, eNB_indexP);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(Rel10) || defined(Rel14)
|
||||
|
||||
if ((srb_idP & RAB_OFFSET) == MCCH) {
|
||||
LOG_T(RRC,"[UE %d] Frame %d: Received SDU on MBSFN sync area %d for MCCH on SRB %d from eNB %d\n",
|
||||
module_idP,frameP, mbsfn_sync_areaP, srb_idP & RAB_OFFSET,eNB_indexP);
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
{
|
||||
MessageDef *message_p;
|
||||
int msg_sdu_size = sizeof(RRC_MAC_MCCH_DATA_IND (message_p).sdu);
|
||||
|
||||
if (sdu_size > msg_sdu_size) {
|
||||
LOG_E(RRC, "SDU larger than MCCH SDU buffer size (%d, %d)", sdu_size, msg_sdu_size);
|
||||
sdu_size = msg_sdu_size;
|
||||
}
|
||||
|
||||
message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_MCCH_DATA_IND);
|
||||
RRC_MAC_MCCH_DATA_IND (message_p).frame = frameP;
|
||||
RRC_MAC_MCCH_DATA_IND (message_p).sub_frame = sub_frameP;
|
||||
RRC_MAC_MCCH_DATA_IND (message_p).sdu_size = sdu_lenP;
|
||||
memset (RRC_MAC_MCCH_DATA_IND (message_p).sdu, 0, MCCH_SDU_SIZE);
|
||||
memcpy (RRC_MAC_MCCH_DATA_IND (message_p).sdu, sduP, sdu_lenP);
|
||||
RRC_MAC_MCCH_DATA_IND (message_p).enb_index = eNB_indexP;
|
||||
RRC_MAC_MCCH_DATA_IND (message_p).mbsfn_sync_area = mbsfn_sync_areaP;
|
||||
itti_send_msg_to_task (TASK_RRC_UE, ctxt.instance, message_p);
|
||||
}
|
||||
#else
|
||||
decode_MCCH_Message(&ctxt, eNB_indexP, sduP, sdu_lenP, mbsfn_sync_areaP);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // Rel10 || Rel14
|
||||
|
||||
} else { // This is an eNB
|
||||
Srb_info = &RC.rrc[module_idP]->carrier[CC_id].Srb0;
|
||||
LOG_D(RRC,"[eNB %d] Received SDU for CCCH on SRB %d\n",module_idP,Srb_info->Srb_id);
|
||||
|
||||
@@ -576,205 +422,11 @@ mac_rrc_data_ind(
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
return(0);
|
||||
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
// this function is Not USED anymore
|
||||
void mac_sync_ind(module_id_t Mod_idP,uint8_t Status)
|
||||
{
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
uint8_t
|
||||
rrc_data_req(
|
||||
const protocol_ctxt_t* const ctxt_pP,
|
||||
const rb_id_t rb_idP,
|
||||
const mui_t muiP,
|
||||
const confirm_t confirmP,
|
||||
const sdu_size_t sdu_sizeP,
|
||||
uint8_t* const buffer_pP,
|
||||
const pdcp_transmission_mode_t modeP
|
||||
)
|
||||
//------------------------------------------------------------------------------
|
||||
{
|
||||
MSC_LOG_TX_MESSAGE(
|
||||
ctxt_pP->enb_flag ? MSC_RRC_ENB : MSC_RRC_UE,
|
||||
ctxt_pP->enb_flag ? MSC_PDCP_ENB : MSC_PDCP_UE,
|
||||
buffer_pP,
|
||||
sdu_sizeP,
|
||||
MSC_AS_TIME_FMT"RRC_DCCH_DATA_REQ UE %x MUI %d size %u",
|
||||
MSC_AS_TIME_ARGS(ctxt_pP),
|
||||
ctxt_pP->rnti,
|
||||
muiP,
|
||||
sdu_sizeP);
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
{
|
||||
MessageDef *message_p;
|
||||
// Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling).
|
||||
uint8_t *message_buffer;
|
||||
|
||||
message_buffer = itti_malloc (
|
||||
ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE,
|
||||
ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE,
|
||||
sdu_sizeP);
|
||||
|
||||
memcpy (message_buffer, buffer_pP, sdu_sizeP);
|
||||
|
||||
message_p = itti_alloc_new_message (ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE, RRC_DCCH_DATA_REQ);
|
||||
RRC_DCCH_DATA_REQ (message_p).frame = ctxt_pP->frame;
|
||||
RRC_DCCH_DATA_REQ (message_p).enb_flag = ctxt_pP->enb_flag;
|
||||
RRC_DCCH_DATA_REQ (message_p).rb_id = rb_idP;
|
||||
RRC_DCCH_DATA_REQ (message_p).muip = muiP;
|
||||
RRC_DCCH_DATA_REQ (message_p).confirmp = confirmP;
|
||||
RRC_DCCH_DATA_REQ (message_p).sdu_size = sdu_sizeP;
|
||||
RRC_DCCH_DATA_REQ (message_p).sdu_p = message_buffer;
|
||||
RRC_DCCH_DATA_REQ (message_p).mode = modeP;
|
||||
RRC_DCCH_DATA_REQ (message_p).module_id = ctxt_pP->module_id;
|
||||
RRC_DCCH_DATA_REQ (message_p).rnti = ctxt_pP->rnti;
|
||||
RRC_DCCH_DATA_REQ (message_p).eNB_index = ctxt_pP->eNB_index;
|
||||
|
||||
itti_send_msg_to_task (
|
||||
ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE,
|
||||
ctxt_pP->instance,
|
||||
message_p);
|
||||
return TRUE; // TODO should be changed to a CNF message later, currently RRC lite does not used the returned value anyway.
|
||||
|
||||
}
|
||||
#else
|
||||
return pdcp_data_req (
|
||||
ctxt_pP,
|
||||
SRB_FLAG_YES,
|
||||
rb_idP,
|
||||
muiP,
|
||||
confirmP,
|
||||
sdu_sizeP,
|
||||
buffer_pP,
|
||||
modeP);
|
||||
#endif
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
rrc_data_ind(
|
||||
const protocol_ctxt_t* const ctxt_pP,
|
||||
const rb_id_t Srb_id,
|
||||
const sdu_size_t sdu_sizeP,
|
||||
const uint8_t* const buffer_pP
|
||||
)
|
||||
//------------------------------------------------------------------------------
|
||||
{
|
||||
rb_id_t DCCH_index = Srb_id;
|
||||
|
||||
if (ctxt_pP->enb_flag == ENB_FLAG_NO) {
|
||||
LOG_N(RRC, "[UE %x] Frame %d: received a DCCH %d message on SRB %d with Size %d from eNB %d\n",
|
||||
ctxt_pP->module_id, ctxt_pP->frame, DCCH_index,Srb_id,sdu_sizeP, ctxt_pP->eNB_index);
|
||||
} else {
|
||||
LOG_N(RRC, "[eNB %d] Frame %d: received a DCCH %d message on SRB %d with Size %d from UE %x\n",
|
||||
ctxt_pP->module_id,
|
||||
ctxt_pP->frame,
|
||||
DCCH_index,
|
||||
Srb_id,
|
||||
sdu_sizeP,
|
||||
ctxt_pP->rnti);
|
||||
}
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
{
|
||||
MessageDef *message_p;
|
||||
// Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling).
|
||||
uint8_t *message_buffer;
|
||||
|
||||
message_buffer = itti_malloc (ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE, sdu_sizeP);
|
||||
memcpy (message_buffer, buffer_pP, sdu_sizeP);
|
||||
|
||||
message_p = itti_alloc_new_message (ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, RRC_DCCH_DATA_IND);
|
||||
RRC_DCCH_DATA_IND (message_p).frame = ctxt_pP->frame;
|
||||
RRC_DCCH_DATA_IND (message_p).dcch_index = DCCH_index;
|
||||
RRC_DCCH_DATA_IND (message_p).sdu_size = sdu_sizeP;
|
||||
RRC_DCCH_DATA_IND (message_p).sdu_p = message_buffer;
|
||||
RRC_DCCH_DATA_IND (message_p).rnti = ctxt_pP->rnti;
|
||||
RRC_DCCH_DATA_IND (message_p).module_id = ctxt_pP->module_id;
|
||||
RRC_DCCH_DATA_IND (message_p).eNB_index = ctxt_pP->eNB_index;
|
||||
|
||||
itti_send_msg_to_task (ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE, ctxt_pP->instance, message_p);
|
||||
}
|
||||
#else
|
||||
|
||||
if (ctxt_pP->enb_flag == ENB_FLAG_YES) {
|
||||
rrc_eNB_decode_dcch(
|
||||
ctxt_pP,
|
||||
DCCH_index,
|
||||
buffer_pP,
|
||||
sdu_sizeP);
|
||||
} else {
|
||||
//#warning "LG put 0 to arg4 that is eNB index"
|
||||
rrc_ue_decode_dcch(
|
||||
ctxt_pP,
|
||||
DCCH_index,
|
||||
buffer_pP,
|
||||
0);
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
void rrc_in_sync_ind(module_id_t Mod_idP, frame_t frameP, uint16_t eNB_index)
|
||||
{
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
#if defined(ENABLE_ITTI)
|
||||
{
|
||||
MessageDef *message_p;
|
||||
//LOG_I(RRC,"sending a message to task_mac_ue\n");
|
||||
message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_IN_SYNC_IND);
|
||||
RRC_MAC_IN_SYNC_IND (message_p).frame = frameP;
|
||||
RRC_MAC_IN_SYNC_IND (message_p).enb_index = eNB_index;
|
||||
|
||||
itti_send_msg_to_task (TASK_RRC_UE, UE_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
|
||||
}
|
||||
#else
|
||||
UE_rrc_inst[Mod_idP].Info[eNB_index].N310_cnt=0;
|
||||
|
||||
if (UE_rrc_inst[Mod_idP].Info[eNB_index].T310_active==1) {
|
||||
UE_rrc_inst[Mod_idP].Info[eNB_index].N311_cnt++;
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
void rrc_out_of_sync_ind(module_id_t Mod_idP, frame_t frameP, uint16_t eNB_index)
|
||||
{
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
if (UE_rrc_inst[Mod_idP].Info[eNB_index].N310_cnt>10)
|
||||
LOG_I(RRC,"[UE %d] Frame %d: OUT OF SYNC FROM eNB %d (T310 active %d : T310 %d, N310 %d, N311 %d)\n ",
|
||||
Mod_idP,frameP,eNB_index,
|
||||
UE_rrc_inst[Mod_idP].Info[eNB_index].T300_active,
|
||||
UE_rrc_inst[Mod_idP].Info[eNB_index].T310_cnt,
|
||||
UE_rrc_inst[Mod_idP].Info[eNB_index].N310_cnt,
|
||||
UE_rrc_inst[Mod_idP].Info[eNB_index].N311_cnt);
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
{
|
||||
MessageDef *message_p;
|
||||
|
||||
message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_OUT_OF_SYNC_IND);
|
||||
RRC_MAC_OUT_OF_SYNC_IND (message_p).frame = frameP;
|
||||
RRC_MAC_OUT_OF_SYNC_IND (message_p).enb_index = eNB_index;
|
||||
|
||||
itti_send_msg_to_task (TASK_RRC_UE, UE_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
|
||||
}
|
||||
#else
|
||||
UE_rrc_inst[Mod_idP].Info[eNB_index].N310_cnt++;
|
||||
#endif
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
int
|
||||
mac_eNB_get_rrc_status(
|
||||
@@ -858,36 +510,3 @@ void mac_eNB_rrc_ul_in_sync(const module_id_t Mod_instP,
|
||||
frameP, subframeP, rntiP);
|
||||
}
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
int
|
||||
mac_UE_get_rrc_status(
|
||||
const module_id_t Mod_idP,
|
||||
const uint8_t indexP
|
||||
)
|
||||
//------------------------------------------------------------------------------
|
||||
{
|
||||
if (UE_rrc_inst)
|
||||
return(UE_rrc_inst[Mod_idP].Info[indexP].State);
|
||||
else
|
||||
return(-1);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
int mac_ue_ccch_success_ind(module_id_t Mod_idP, uint8_t eNB_index)
|
||||
{
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
#if defined(ENABLE_ITTI)
|
||||
{
|
||||
MessageDef *message_p;
|
||||
|
||||
message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_CCCH_DATA_CNF);
|
||||
RRC_MAC_CCCH_DATA_CNF (message_p).enb_index = eNB_index;
|
||||
|
||||
itti_send_msg_to_task (TASK_RRC_UE, UE_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
|
||||
}
|
||||
#else
|
||||
// reset the tx buffer to indicate RRC that ccch was successfully transmitted (for example if contention resolution succeeds)
|
||||
UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size=0;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,183 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
/*! \file l2_interface.c
|
||||
* \brief layer 2 interface, used to support different RRC sublayer
|
||||
* \author Raymond Knopp and Navid Nikaein
|
||||
* \date 2010-2014
|
||||
* \version 1.0
|
||||
* \company Eurecom
|
||||
* \email: raymond.knopp@eurecom.fr
|
||||
*/
|
||||
|
||||
#include "platform_types.h"
|
||||
//#include "openair_defs.h"
|
||||
//#include "openair_proto.h"
|
||||
#include "defs.h"
|
||||
#include "extern.h"
|
||||
//#include "mac_lchan_interface.h"
|
||||
//#include "openair_rrc_utils.h"
|
||||
//#include "openair_rrc_main.h"
|
||||
#include "UTIL/LOG/log.h"
|
||||
#include "rrc_eNB_UE_context.h"
|
||||
#include "pdcp.h"
|
||||
#include "msc.h"
|
||||
#include "common/ran_context.h"
|
||||
|
||||
#ifdef PHY_EMUL
|
||||
#include "SIMULATION/simulation_defs.h"
|
||||
extern EMULATION_VARS *Emul_vars;
|
||||
extern eNB_MAC_INST *eNB_mac_inst;
|
||||
extern UE_MAC_INST *UE_mac_inst;
|
||||
#endif
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
# include "intertask_interface.h"
|
||||
#endif
|
||||
|
||||
//#define RRC_DATA_REQ_DEBUG
|
||||
//#define DEBUG_RRC 1
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
uint8_t
|
||||
rrc_data_req(
|
||||
const protocol_ctxt_t* const ctxt_pP,
|
||||
const rb_id_t rb_idP,
|
||||
const mui_t muiP,
|
||||
const confirm_t confirmP,
|
||||
const sdu_size_t sdu_sizeP,
|
||||
uint8_t* const buffer_pP,
|
||||
const pdcp_transmission_mode_t modeP
|
||||
)
|
||||
//------------------------------------------------------------------------------
|
||||
{
|
||||
MSC_LOG_TX_MESSAGE(
|
||||
ctxt_pP->enb_flag ? MSC_RRC_ENB : MSC_RRC_UE,
|
||||
ctxt_pP->enb_flag ? MSC_PDCP_ENB : MSC_PDCP_UE,
|
||||
buffer_pP,
|
||||
sdu_sizeP,
|
||||
MSC_AS_TIME_FMT"RRC_DCCH_DATA_REQ UE %x MUI %d size %u",
|
||||
MSC_AS_TIME_ARGS(ctxt_pP),
|
||||
ctxt_pP->rnti,
|
||||
muiP,
|
||||
sdu_sizeP);
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
{
|
||||
MessageDef *message_p;
|
||||
// Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling).
|
||||
uint8_t *message_buffer;
|
||||
|
||||
message_buffer = itti_malloc (
|
||||
ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE,
|
||||
ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE,
|
||||
sdu_sizeP);
|
||||
|
||||
memcpy (message_buffer, buffer_pP, sdu_sizeP);
|
||||
|
||||
message_p = itti_alloc_new_message (ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE, RRC_DCCH_DATA_REQ);
|
||||
RRC_DCCH_DATA_REQ (message_p).frame = ctxt_pP->frame;
|
||||
RRC_DCCH_DATA_REQ (message_p).enb_flag = ctxt_pP->enb_flag;
|
||||
RRC_DCCH_DATA_REQ (message_p).rb_id = rb_idP;
|
||||
RRC_DCCH_DATA_REQ (message_p).muip = muiP;
|
||||
RRC_DCCH_DATA_REQ (message_p).confirmp = confirmP;
|
||||
RRC_DCCH_DATA_REQ (message_p).sdu_size = sdu_sizeP;
|
||||
RRC_DCCH_DATA_REQ (message_p).sdu_p = message_buffer;
|
||||
RRC_DCCH_DATA_REQ (message_p).mode = modeP;
|
||||
RRC_DCCH_DATA_REQ (message_p).module_id = ctxt_pP->module_id;
|
||||
RRC_DCCH_DATA_REQ (message_p).rnti = ctxt_pP->rnti;
|
||||
RRC_DCCH_DATA_REQ (message_p).eNB_index = ctxt_pP->eNB_index;
|
||||
|
||||
itti_send_msg_to_task (
|
||||
ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE,
|
||||
ctxt_pP->instance,
|
||||
message_p);
|
||||
return TRUE; // TODO should be changed to a CNF message later, currently RRC lite does not used the returned value anyway.
|
||||
|
||||
}
|
||||
#else
|
||||
return pdcp_data_req (
|
||||
ctxt_pP,
|
||||
SRB_FLAG_YES,
|
||||
rb_idP,
|
||||
muiP,
|
||||
confirmP,
|
||||
sdu_sizeP,
|
||||
buffer_pP,
|
||||
modeP);
|
||||
#endif
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
rrc_data_ind(
|
||||
const protocol_ctxt_t* const ctxt_pP,
|
||||
const rb_id_t Srb_id,
|
||||
const sdu_size_t sdu_sizeP,
|
||||
const uint8_t* const buffer_pP
|
||||
)
|
||||
//------------------------------------------------------------------------------
|
||||
{
|
||||
rb_id_t DCCH_index = Srb_id;
|
||||
|
||||
if (ctxt_pP->enb_flag == ENB_FLAG_NO) {
|
||||
LOG_N(RRC, "[UE %x] Frame %d: received a DCCH %d message on SRB %d with Size %d from eNB %d\n",
|
||||
ctxt_pP->module_id, ctxt_pP->frame, DCCH_index,Srb_id,sdu_sizeP, ctxt_pP->eNB_index);
|
||||
} else {
|
||||
LOG_N(RRC, "[eNB %d] Frame %d: received a DCCH %d message on SRB %d with Size %d from UE %x\n",
|
||||
ctxt_pP->module_id,
|
||||
ctxt_pP->frame,
|
||||
DCCH_index,
|
||||
Srb_id,
|
||||
sdu_sizeP,
|
||||
ctxt_pP->rnti);
|
||||
}
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
{
|
||||
MessageDef *message_p;
|
||||
// Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling).
|
||||
uint8_t *message_buffer;
|
||||
|
||||
message_buffer = itti_malloc (ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE, sdu_sizeP);
|
||||
memcpy (message_buffer, buffer_pP, sdu_sizeP);
|
||||
|
||||
message_p = itti_alloc_new_message (ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, RRC_DCCH_DATA_IND);
|
||||
RRC_DCCH_DATA_IND (message_p).frame = ctxt_pP->frame;
|
||||
RRC_DCCH_DATA_IND (message_p).dcch_index = DCCH_index;
|
||||
RRC_DCCH_DATA_IND (message_p).sdu_size = sdu_sizeP;
|
||||
RRC_DCCH_DATA_IND (message_p).sdu_p = message_buffer;
|
||||
RRC_DCCH_DATA_IND (message_p).rnti = ctxt_pP->rnti;
|
||||
RRC_DCCH_DATA_IND (message_p).module_id = ctxt_pP->module_id;
|
||||
RRC_DCCH_DATA_IND (message_p).eNB_index = ctxt_pP->eNB_index;
|
||||
|
||||
itti_send_msg_to_task (ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE, ctxt_pP->instance, message_p);
|
||||
}
|
||||
#else
|
||||
|
||||
rrc_eNB_decode_dcch(
|
||||
ctxt_pP,
|
||||
DCCH_index,
|
||||
buffer_pP,
|
||||
sdu_sizeP);
|
||||
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,463 @@
|
||||
/*
|
||||
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The OpenAirInterface Software Alliance licenses this file to You under
|
||||
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.openairinterface.org/?page_id=698
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*-------------------------------------------------------------------------------
|
||||
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
||||
* contact@openairinterface.org
|
||||
*/
|
||||
|
||||
/*! \file l2_interface.c
|
||||
* \brief layer 2 interface, used to support different RRC sublayer
|
||||
* \author Raymond Knopp and Navid Nikaein
|
||||
* \date 2010-2014
|
||||
* \version 1.0
|
||||
* \company Eurecom
|
||||
* \email: raymond.knopp@eurecom.fr
|
||||
*/
|
||||
|
||||
#include "platform_types.h"
|
||||
//#include "openair_defs.h"
|
||||
//#include "openair_proto.h"
|
||||
#include "defs.h"
|
||||
#include "extern.h"
|
||||
//#include "mac_lchan_interface.h"
|
||||
//#include "openair_rrc_utils.h"
|
||||
//#include "openair_rrc_main.h"
|
||||
#include "UTIL/LOG/log.h"
|
||||
#include "rrc_eNB_UE_context.h"
|
||||
#include "pdcp.h"
|
||||
#include "msc.h"
|
||||
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
# include "intertask_interface.h"
|
||||
#endif
|
||||
|
||||
//#define RRC_DATA_REQ_DEBUG
|
||||
//#define DEBUG_RRC 1
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
int8_t
|
||||
mac_rrc_data_req_ue(
|
||||
const module_id_t Mod_idP,
|
||||
const int CC_id,
|
||||
const frame_t frameP,
|
||||
const rb_id_t Srb_id,
|
||||
const uint8_t Nb_tb,
|
||||
uint8_t* const buffer_pP,
|
||||
const uint8_t eNB_index,
|
||||
const uint8_t mbsfn_sync_area
|
||||
)
|
||||
//--------------------------------------------------------------------------
|
||||
{
|
||||
asn_enc_rval_t enc_rval;
|
||||
SRB_INFO *Srb_info;
|
||||
uint8_t Sdu_size = 0;
|
||||
uint8_t sfn = (uint8_t)((frameP>>2)&0xff);
|
||||
|
||||
|
||||
#ifdef DEBUG_RRC
|
||||
int i;
|
||||
LOG_I(RRC,"[eNB %d] mac_rrc_data_req to SRB ID=%d\n",Mod_idP,Srb_id);
|
||||
#endif
|
||||
|
||||
eNB_RRC_INST *rrc;
|
||||
rrc_eNB_carrier_data_t *carrier;
|
||||
BCCH_BCH_Message_t *mib;
|
||||
|
||||
|
||||
LOG_D(RRC,"[UE %d] Frame %d Filling CCCH SRB_ID %d\n",Mod_idP,frameP,Srb_id);
|
||||
LOG_D(RRC,"[UE %d] Frame %d buffer_pP status %d,\n",Mod_idP,frameP, UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size);
|
||||
|
||||
|
||||
if( (UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size > 0) ) {
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
{
|
||||
MessageDef *message_p;
|
||||
int ccch_size = UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size;
|
||||
int sdu_size = sizeof(RRC_MAC_CCCH_DATA_REQ (message_p).sdu);
|
||||
|
||||
if (ccch_size > sdu_size) {
|
||||
LOG_E(RRC, "SDU larger than CCCH SDU buffer size (%d, %d)", ccch_size, sdu_size);
|
||||
ccch_size = sdu_size;
|
||||
}
|
||||
|
||||
message_p = itti_alloc_new_message (TASK_RRC_UE, RRC_MAC_CCCH_DATA_REQ);
|
||||
RRC_MAC_CCCH_DATA_REQ (message_p).frame = frameP;
|
||||
RRC_MAC_CCCH_DATA_REQ (message_p).sdu_size = ccch_size;
|
||||
memset (RRC_MAC_CCCH_DATA_REQ (message_p).sdu, 0, CCCH_SDU_SIZE);
|
||||
memcpy (RRC_MAC_CCCH_DATA_REQ (message_p).sdu, UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.Payload, ccch_size);
|
||||
RRC_MAC_CCCH_DATA_REQ (message_p).enb_index = eNB_index;
|
||||
|
||||
itti_send_msg_to_task (TASK_MAC_UE, UE_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
|
||||
}
|
||||
#endif
|
||||
|
||||
memcpy(&buffer_pP[0],&UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.Payload[0],UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size);
|
||||
uint8_t Ret_size=UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size;
|
||||
// UE_rrc_inst[Mod_id].Srb0[eNB_index].Tx_buffer.payload_size=0;
|
||||
UE_rrc_inst[Mod_idP].Info[eNB_index].T300_active = 1;
|
||||
UE_rrc_inst[Mod_idP].Info[eNB_index].T300_cnt = 0;
|
||||
// msg("[RRC][UE %d] Sending rach\n",Mod_id);
|
||||
return(Ret_size);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
int8_t
|
||||
mac_rrc_data_ind_ue(
|
||||
const module_id_t module_idP,
|
||||
const int CC_id,
|
||||
const frame_t frameP,
|
||||
const sub_frame_t sub_frameP,
|
||||
const rnti_t rntiP,
|
||||
const rb_id_t srb_idP,
|
||||
const uint8_t* sduP,
|
||||
const sdu_size_t sdu_lenP,
|
||||
const mac_enb_index_t eNB_indexP,
|
||||
const uint8_t mbsfn_sync_areaP
|
||||
)
|
||||
//--------------------------------------------------------------------------
|
||||
{
|
||||
SRB_INFO *Srb_info;
|
||||
protocol_ctxt_t ctxt;
|
||||
sdu_size_t sdu_size = 0;
|
||||
|
||||
/* for no gcc warnings */
|
||||
(void)sdu_size;
|
||||
|
||||
/*
|
||||
int si_window;
|
||||
*/
|
||||
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, 0, rntiP, frameP, sub_frameP,eNB_indexP);
|
||||
|
||||
if(srb_idP == BCCH) {
|
||||
LOG_D(RRC,"[UE %d] Received SDU for BCCH on SRB %d from eNB %d\n",module_idP,srb_idP,eNB_indexP);
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
{
|
||||
MessageDef *message_p;
|
||||
int msg_sdu_size = sizeof(RRC_MAC_BCCH_DATA_IND (message_p).sdu);
|
||||
|
||||
if (sdu_lenP > msg_sdu_size) {
|
||||
LOG_E(RRC, "SDU larger than BCCH SDU buffer size (%d, %d)", sdu_lenP, msg_sdu_size);
|
||||
sdu_size = msg_sdu_size;
|
||||
} else {
|
||||
sdu_size = sdu_lenP;
|
||||
}
|
||||
|
||||
message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_BCCH_DATA_IND);
|
||||
memset (RRC_MAC_BCCH_DATA_IND (message_p).sdu, 0, BCCH_SDU_SIZE);
|
||||
RRC_MAC_BCCH_DATA_IND (message_p).frame = frameP;
|
||||
RRC_MAC_BCCH_DATA_IND (message_p).sub_frame = sub_frameP;
|
||||
RRC_MAC_BCCH_DATA_IND (message_p).sdu_size = sdu_size;
|
||||
memcpy (RRC_MAC_BCCH_DATA_IND (message_p).sdu, sduP, sdu_size);
|
||||
RRC_MAC_BCCH_DATA_IND (message_p).enb_index = eNB_indexP;
|
||||
RRC_MAC_BCCH_DATA_IND (message_p).rsrq = 30 /* TODO change phy to report rspq */;
|
||||
RRC_MAC_BCCH_DATA_IND (message_p).rsrp = 45 /* TODO change phy to report rspp */;
|
||||
|
||||
itti_send_msg_to_task (TASK_RRC_UE, ctxt.instance, message_p);
|
||||
}
|
||||
#else
|
||||
decode_BCCH_DLSCH_Message(&ctxt,eNB_indexP,(uint8_t*)sduP,sdu_lenP, 0, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
if(srb_idP == PCCH) {
|
||||
LOG_D(RRC,"[UE %d] Received SDU for PCCH on SRB %d from eNB %d\n",module_idP,srb_idP,eNB_indexP);
|
||||
decode_PCCH_DLSCH_Message(&ctxt,eNB_indexP,(uint8_t*)sduP,sdu_lenP);
|
||||
}
|
||||
if((srb_idP & RAB_OFFSET) == CCCH) {
|
||||
if (sdu_lenP>0) {
|
||||
LOG_T(RRC,"[UE %d] Received SDU for CCCH on SRB %d from eNB %d\n",module_idP,srb_idP & RAB_OFFSET,eNB_indexP);
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
{
|
||||
MessageDef *message_p;
|
||||
int msg_sdu_size = CCCH_SDU_SIZE;
|
||||
|
||||
if (sdu_lenP > msg_sdu_size) {
|
||||
LOG_E(RRC, "SDU larger than CCCH SDU buffer size (%d, %d)", sdu_size, msg_sdu_size);
|
||||
sdu_size = msg_sdu_size;
|
||||
} else {
|
||||
sdu_size = sdu_lenP;
|
||||
}
|
||||
|
||||
message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_CCCH_DATA_IND);
|
||||
memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE);
|
||||
memcpy (RRC_MAC_CCCH_DATA_IND (message_p).sdu, sduP, sdu_size);
|
||||
RRC_MAC_CCCH_DATA_IND (message_p).frame = frameP;
|
||||
RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = sub_frameP;
|
||||
RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = sdu_size;
|
||||
RRC_MAC_CCCH_DATA_IND (message_p).enb_index = eNB_indexP;
|
||||
RRC_MAC_CCCH_DATA_IND (message_p).rnti = rntiP;
|
||||
itti_send_msg_to_task (TASK_RRC_UE, ctxt.instance, message_p);
|
||||
}
|
||||
#else
|
||||
Srb_info = &UE_rrc_inst[module_idP].Srb0[eNB_indexP];
|
||||
memcpy(Srb_info->Rx_buffer.Payload,sduP,sdu_lenP);
|
||||
Srb_info->Rx_buffer.payload_size = sdu_lenP;
|
||||
rrc_ue_decode_ccch(&ctxt, Srb_info, eNB_indexP);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(Rel10) || defined(Rel14)
|
||||
|
||||
if ((srb_idP & RAB_OFFSET) == MCCH) {
|
||||
LOG_T(RRC,"[UE %d] Frame %d: Received SDU on MBSFN sync area %d for MCCH on SRB %d from eNB %d\n",
|
||||
module_idP,frameP, mbsfn_sync_areaP, srb_idP & RAB_OFFSET,eNB_indexP);
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
{
|
||||
MessageDef *message_p;
|
||||
int msg_sdu_size = sizeof(RRC_MAC_MCCH_DATA_IND (message_p).sdu);
|
||||
|
||||
if (sdu_size > msg_sdu_size) {
|
||||
LOG_E(RRC, "SDU larger than MCCH SDU buffer size (%d, %d)", sdu_size, msg_sdu_size);
|
||||
sdu_size = msg_sdu_size;
|
||||
}
|
||||
|
||||
message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_MCCH_DATA_IND);
|
||||
RRC_MAC_MCCH_DATA_IND (message_p).frame = frameP;
|
||||
RRC_MAC_MCCH_DATA_IND (message_p).sub_frame = sub_frameP;
|
||||
RRC_MAC_MCCH_DATA_IND (message_p).sdu_size = sdu_lenP;
|
||||
memset (RRC_MAC_MCCH_DATA_IND (message_p).sdu, 0, MCCH_SDU_SIZE);
|
||||
memcpy (RRC_MAC_MCCH_DATA_IND (message_p).sdu, sduP, sdu_lenP);
|
||||
RRC_MAC_MCCH_DATA_IND (message_p).enb_index = eNB_indexP;
|
||||
RRC_MAC_MCCH_DATA_IND (message_p).mbsfn_sync_area = mbsfn_sync_areaP;
|
||||
itti_send_msg_to_task (TASK_RRC_UE, ctxt.instance, message_p);
|
||||
}
|
||||
#else
|
||||
decode_MCCH_Message(&ctxt, eNB_indexP, sduP, sdu_lenP, mbsfn_sync_areaP);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // Rel10 || Rel14
|
||||
|
||||
return(0);
|
||||
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
uint8_t
|
||||
rrc_data_req_ue(
|
||||
const protocol_ctxt_t* const ctxt_pP,
|
||||
const rb_id_t rb_idP,
|
||||
const mui_t muiP,
|
||||
const confirm_t confirmP,
|
||||
const sdu_size_t sdu_sizeP,
|
||||
uint8_t* const buffer_pP,
|
||||
const pdcp_transmission_mode_t modeP
|
||||
)
|
||||
//------------------------------------------------------------------------------
|
||||
{
|
||||
MSC_LOG_TX_MESSAGE(
|
||||
ctxt_pP->enb_flag ? MSC_RRC_ENB : MSC_RRC_UE,
|
||||
ctxt_pP->enb_flag ? MSC_PDCP_ENB : MSC_PDCP_UE,
|
||||
buffer_pP,
|
||||
sdu_sizeP,
|
||||
MSC_AS_TIME_FMT"RRC_DCCH_DATA_REQ UE %x MUI %d size %u",
|
||||
MSC_AS_TIME_ARGS(ctxt_pP),
|
||||
ctxt_pP->rnti,
|
||||
muiP,
|
||||
sdu_sizeP);
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
{
|
||||
MessageDef *message_p;
|
||||
// Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling).
|
||||
uint8_t *message_buffer;
|
||||
|
||||
message_buffer = itti_malloc (
|
||||
ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE,
|
||||
ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE,
|
||||
sdu_sizeP);
|
||||
|
||||
memcpy (message_buffer, buffer_pP, sdu_sizeP);
|
||||
|
||||
message_p = itti_alloc_new_message (ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE, RRC_DCCH_DATA_REQ);
|
||||
RRC_DCCH_DATA_REQ (message_p).frame = ctxt_pP->frame;
|
||||
RRC_DCCH_DATA_REQ (message_p).enb_flag = ctxt_pP->enb_flag;
|
||||
RRC_DCCH_DATA_REQ (message_p).rb_id = rb_idP;
|
||||
RRC_DCCH_DATA_REQ (message_p).muip = muiP;
|
||||
RRC_DCCH_DATA_REQ (message_p).confirmp = confirmP;
|
||||
RRC_DCCH_DATA_REQ (message_p).sdu_size = sdu_sizeP;
|
||||
RRC_DCCH_DATA_REQ (message_p).sdu_p = message_buffer;
|
||||
RRC_DCCH_DATA_REQ (message_p).mode = modeP;
|
||||
RRC_DCCH_DATA_REQ (message_p).module_id = ctxt_pP->module_id;
|
||||
RRC_DCCH_DATA_REQ (message_p).rnti = ctxt_pP->rnti;
|
||||
RRC_DCCH_DATA_REQ (message_p).eNB_index = ctxt_pP->eNB_index;
|
||||
|
||||
itti_send_msg_to_task (
|
||||
TASK_PDCP_UE,
|
||||
ctxt_pP->instance,
|
||||
message_p);
|
||||
return TRUE; // TODO should be changed to a CNF message later, currently RRC lite does not used the returned value anyway.
|
||||
|
||||
}
|
||||
#else
|
||||
return pdcp_data_req (
|
||||
ctxt_pP,
|
||||
SRB_FLAG_YES,
|
||||
rb_idP,
|
||||
muiP,
|
||||
confirmP,
|
||||
sdu_sizeP,
|
||||
buffer_pP,
|
||||
modeP);
|
||||
#endif
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void
|
||||
rrc_data_ind_ue(
|
||||
const protocol_ctxt_t* const ctxt_pP,
|
||||
const rb_id_t Srb_id,
|
||||
const sdu_size_t sdu_sizeP,
|
||||
const uint8_t* const buffer_pP
|
||||
)
|
||||
//------------------------------------------------------------------------------
|
||||
{
|
||||
rb_id_t DCCH_index = Srb_id;
|
||||
|
||||
LOG_N(RRC, "[UE %x] Frame %d: received a DCCH %d message on SRB %d with Size %d from eNB %d\n",
|
||||
ctxt_pP->module_id, ctxt_pP->frame, DCCH_index,Srb_id,sdu_sizeP, ctxt_pP->eNB_index);
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
{
|
||||
MessageDef *message_p;
|
||||
// Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling).
|
||||
uint8_t *message_buffer;
|
||||
|
||||
message_buffer = itti_malloc (ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, ctxt_pP->enb_flag ? TASK_RRC_ENB : TASK_RRC_UE, sdu_sizeP);
|
||||
memcpy (message_buffer, buffer_pP, sdu_sizeP);
|
||||
|
||||
message_p = itti_alloc_new_message (ctxt_pP->enb_flag ? TASK_PDCP_ENB : TASK_PDCP_UE, RRC_DCCH_DATA_IND);
|
||||
RRC_DCCH_DATA_IND (message_p).frame = ctxt_pP->frame;
|
||||
RRC_DCCH_DATA_IND (message_p).dcch_index = DCCH_index;
|
||||
RRC_DCCH_DATA_IND (message_p).sdu_size = sdu_sizeP;
|
||||
RRC_DCCH_DATA_IND (message_p).sdu_p = message_buffer;
|
||||
RRC_DCCH_DATA_IND (message_p).rnti = ctxt_pP->rnti;
|
||||
RRC_DCCH_DATA_IND (message_p).module_id = ctxt_pP->module_id;
|
||||
RRC_DCCH_DATA_IND (message_p).eNB_index = ctxt_pP->eNB_index;
|
||||
|
||||
itti_send_msg_to_task (TASK_RRC_UE, ctxt_pP->instance, message_p);
|
||||
}
|
||||
#else
|
||||
|
||||
//#warning "LG put 0 to arg4 that is eNB index"
|
||||
rrc_ue_decode_dcch(
|
||||
ctxt_pP,
|
||||
DCCH_index,
|
||||
buffer_pP,
|
||||
0);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
void rrc_in_sync_ind(module_id_t Mod_idP, frame_t frameP, uint16_t eNB_index)
|
||||
{
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
#if defined(ENABLE_ITTI)
|
||||
{
|
||||
MessageDef *message_p;
|
||||
//LOG_I(RRC,"sending a message to task_mac_ue\n");
|
||||
message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_IN_SYNC_IND);
|
||||
RRC_MAC_IN_SYNC_IND (message_p).frame = frameP;
|
||||
RRC_MAC_IN_SYNC_IND (message_p).enb_index = eNB_index;
|
||||
|
||||
itti_send_msg_to_task (TASK_RRC_UE, UE_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
|
||||
}
|
||||
#else
|
||||
UE_rrc_inst[Mod_idP].Info[eNB_index].N310_cnt=0;
|
||||
|
||||
if (UE_rrc_inst[Mod_idP].Info[eNB_index].T310_active==1) {
|
||||
UE_rrc_inst[Mod_idP].Info[eNB_index].N311_cnt++;
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
void rrc_out_of_sync_ind(module_id_t Mod_idP, frame_t frameP, uint16_t eNB_index)
|
||||
{
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
if (UE_rrc_inst[Mod_idP].Info[eNB_index].N310_cnt>10)
|
||||
LOG_I(RRC,"[UE %d] Frame %d: OUT OF SYNC FROM eNB %d (T310 active %d : T310 %d, N310 %d, N311 %d)\n ",
|
||||
Mod_idP,frameP,eNB_index,
|
||||
UE_rrc_inst[Mod_idP].Info[eNB_index].T300_active,
|
||||
UE_rrc_inst[Mod_idP].Info[eNB_index].T310_cnt,
|
||||
UE_rrc_inst[Mod_idP].Info[eNB_index].N310_cnt,
|
||||
UE_rrc_inst[Mod_idP].Info[eNB_index].N311_cnt);
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
{
|
||||
MessageDef *message_p;
|
||||
|
||||
message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_OUT_OF_SYNC_IND);
|
||||
RRC_MAC_OUT_OF_SYNC_IND (message_p).frame = frameP;
|
||||
RRC_MAC_OUT_OF_SYNC_IND (message_p).enb_index = eNB_index;
|
||||
|
||||
itti_send_msg_to_task (TASK_RRC_UE, UE_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
|
||||
}
|
||||
#else
|
||||
UE_rrc_inst[Mod_idP].Info[eNB_index].N310_cnt++;
|
||||
#endif
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
int
|
||||
mac_UE_get_rrc_status(
|
||||
const module_id_t Mod_idP,
|
||||
const uint8_t indexP
|
||||
)
|
||||
//------------------------------------------------------------------------------
|
||||
{
|
||||
if (UE_rrc_inst)
|
||||
return(UE_rrc_inst[Mod_idP].Info[indexP].State);
|
||||
else
|
||||
return(-1);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
int mac_ue_ccch_success_ind(module_id_t Mod_idP, uint8_t eNB_index)
|
||||
{
|
||||
//-------------------------------------------------------------------------------------------//
|
||||
#if defined(ENABLE_ITTI)
|
||||
{
|
||||
MessageDef *message_p;
|
||||
|
||||
message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_CCCH_DATA_CNF);
|
||||
RRC_MAC_CCCH_DATA_CNF (message_p).enb_index = eNB_index;
|
||||
|
||||
itti_send_msg_to_task (TASK_RRC_UE, UE_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
|
||||
}
|
||||
#else
|
||||
// reset the tx buffer to indicate RRC that ccch was successfully transmitted (for example if contention resolution succeeds)
|
||||
UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size=0;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
@@ -54,15 +54,30 @@ void rrc_config_buffer(SRB_INFO *srb_info, uint8_t Lchan_type, uint8_t Role);
|
||||
void
|
||||
openair_rrc_on(
|
||||
const protocol_ctxt_t* const ctxt_pP);
|
||||
void
|
||||
openair_rrc_on_ue(
|
||||
const protocol_ctxt_t* const ctxt_pP);
|
||||
|
||||
void rrc_top_cleanup(void);
|
||||
|
||||
/** \brief Function to update eNB timers every subframe.
|
||||
@param ctxt_pP running context
|
||||
@param enb_index
|
||||
@param CC_id
|
||||
*/
|
||||
RRC_status_t
|
||||
rrc_rx_tx(
|
||||
protocol_ctxt_t* const ctxt_pP,
|
||||
const int CC_id
|
||||
);
|
||||
|
||||
/** \brief Function to update timers every subframe. For UE it updates T300,T304 and T310.
|
||||
@param ctxt_pP running context
|
||||
@param enb_index
|
||||
@param CC_id
|
||||
*/
|
||||
RRC_status_t
|
||||
rrc_rx_tx(
|
||||
rrc_rx_tx_ue(
|
||||
protocol_ctxt_t* const ctxt_pP,
|
||||
const uint8_t enb_index,
|
||||
const int CC_id
|
||||
@@ -310,8 +325,6 @@ mac_rrc_data_req(
|
||||
const rb_id_t Srb_id,
|
||||
const uint8_t Nb_tb,
|
||||
uint8_t* const buffer_pP,
|
||||
const eNB_flag_t enb_flagP,
|
||||
const uint8_t eNB_index,
|
||||
const uint8_t mbsfn_sync_area
|
||||
);
|
||||
|
||||
@@ -325,7 +338,31 @@ mac_rrc_data_ind(
|
||||
const rb_id_t srb_idP,
|
||||
const uint8_t* sduP,
|
||||
const sdu_size_t sdu_lenP,
|
||||
const eNB_flag_t eNB_flagP,
|
||||
const uint8_t mbsfn_sync_areaP
|
||||
);
|
||||
|
||||
int8_t
|
||||
mac_rrc_data_req_ue(
|
||||
const module_id_t Mod_idP,
|
||||
const int CC_id,
|
||||
const frame_t frameP,
|
||||
const rb_id_t Srb_id,
|
||||
const uint8_t Nb_tb,
|
||||
uint8_t* const buffer_pP,
|
||||
const mac_enb_index_t eNB_indexP,
|
||||
const uint8_t mbsfn_sync_area
|
||||
);
|
||||
|
||||
int8_t
|
||||
mac_rrc_data_ind_ue(
|
||||
const module_id_t module_idP,
|
||||
const int CC_id,
|
||||
const frame_t frameP,
|
||||
const sub_frame_t sub_frameP,
|
||||
const rnti_t rntiP,
|
||||
const rb_id_t srb_idP,
|
||||
const uint8_t* sduP,
|
||||
const sdu_size_t sdu_lenP,
|
||||
const mac_enb_index_t eNB_indexP,
|
||||
const uint8_t mbsfn_sync_areaP
|
||||
);
|
||||
|
||||
+189
-6
@@ -233,6 +233,30 @@ static int rrc_set_sub_state( module_id_t ue_mod_idP, Rrc_Sub_State_t subState )
|
||||
return (0);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
openair_rrc_on_ue(
|
||||
const protocol_ctxt_t* const ctxt_pP
|
||||
)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
unsigned short i;
|
||||
int CC_id;
|
||||
|
||||
LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" UE?:OPENAIR RRC IN....\n",
|
||||
PROTOCOL_RRC_CTXT_ARGS(ctxt_pP));
|
||||
|
||||
for (i = 0; i < NB_eNB_INST; i++) {
|
||||
LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" Activating CCCH (eNB %d)\n",
|
||||
PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), i);
|
||||
UE_rrc_inst[ctxt_pP->module_id].Srb0[i].Srb_id = CCCH;
|
||||
memcpy (&UE_rrc_inst[ctxt_pP->module_id].Srb0[i].Lchan_desc[0], &CCCH_LCHAN_DESC, LCHAN_DESC_SIZE);
|
||||
memcpy (&UE_rrc_inst[ctxt_pP->module_id].Srb0[i].Lchan_desc[1], &CCCH_LCHAN_DESC, LCHAN_DESC_SIZE);
|
||||
rrc_config_buffer (&UE_rrc_inst[ctxt_pP->module_id].Srb0[i], CCCH, 1);
|
||||
UE_rrc_inst[ctxt_pP->module_id].Srb0[i].Active = 1;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
static void init_SI_UE( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index )
|
||||
{
|
||||
@@ -339,7 +363,7 @@ char openair_rrc_ue_init( const module_id_t ue_mod_idP, const unsigned char eNB_
|
||||
#endif
|
||||
|
||||
#ifdef NO_RRM //init ch SRB0, SRB1 & BDTCH
|
||||
openair_rrc_on(&ctxt);
|
||||
openair_rrc_on_ue(&ctxt);
|
||||
#endif
|
||||
#ifdef CBA
|
||||
int j;
|
||||
@@ -430,6 +454,47 @@ static const char const nas_attach_req_guti[] = {
|
||||
};
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
rrc_t310_expiration(
|
||||
const protocol_ctxt_t* const ctxt_pP,
|
||||
const uint8_t eNB_index
|
||||
)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
|
||||
if (UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State != RRC_CONNECTED) {
|
||||
LOG_D(RRC, "Timer 310 expired, going to RRC_IDLE\n");
|
||||
UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State = RRC_IDLE;
|
||||
UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].UE_index = 0xffff;
|
||||
UE_rrc_inst[ctxt_pP->module_id].Srb0[eNB_index].Rx_buffer.payload_size = 0;
|
||||
UE_rrc_inst[ctxt_pP->module_id].Srb0[eNB_index].Tx_buffer.payload_size = 0;
|
||||
UE_rrc_inst[ctxt_pP->module_id].Srb1[eNB_index].Srb_info.Rx_buffer.payload_size = 0;
|
||||
UE_rrc_inst[ctxt_pP->module_id].Srb1[eNB_index].Srb_info.Tx_buffer.payload_size = 0;
|
||||
|
||||
if (UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Active == 1) {
|
||||
LOG_D (RRC,"[Inst %d] eNB_index %d, Remove RB %d\n ", ctxt_pP->module_id, eNB_index,
|
||||
UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Srb_info.Srb_id);
|
||||
rrc_pdcp_config_req (ctxt_pP,
|
||||
SRB_FLAG_YES,
|
||||
CONFIG_ACTION_REMOVE,
|
||||
UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Srb_info.Srb_id,
|
||||
0);
|
||||
rrc_rlc_config_req (ctxt_pP,
|
||||
SRB_FLAG_YES,
|
||||
MBMS_FLAG_NO,
|
||||
CONFIG_ACTION_REMOVE,
|
||||
UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Srb_info.Srb_id,
|
||||
Rlc_info_um);
|
||||
UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Active = 0;
|
||||
UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Status = IDLE;
|
||||
UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Next_check_frame = 0;
|
||||
}
|
||||
} else { // Restablishment procedure
|
||||
LOG_D(RRC, "Timer 310 expired, trying RRCRestablishment ...\n");
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
static void rrc_ue_generate_RRCConnectionSetupComplete( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, const uint8_t Transaction_id )
|
||||
{
|
||||
@@ -454,7 +519,7 @@ static void rrc_ue_generate_RRCConnectionSetupComplete( const protocol_ctxt_t* c
|
||||
LOG_D(RLC,
|
||||
"[FRAME %05d][RRC_UE][MOD %02d][][--- PDCP_DATA_REQ/%d Bytes (RRCConnectionSetupComplete to eNB %d MUI %d) --->][PDCP][MOD %02d][RB %02d]\n",
|
||||
ctxt_pP->frame, ctxt_pP->module_id+NB_eNB_INST, size, eNB_index, rrc_mui, ctxt_pP->module_id+NB_eNB_INST, DCCH);
|
||||
rrc_data_req (
|
||||
rrc_data_req_ue (
|
||||
ctxt_pP,
|
||||
DCCH,
|
||||
rrc_mui++,
|
||||
@@ -481,7 +546,7 @@ static void rrc_ue_generate_RRCConnectionReconfigurationComplete( const protocol
|
||||
rrc_mui,
|
||||
UE_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id),
|
||||
DCCH);
|
||||
rrc_data_req (
|
||||
rrc_data_req_ue (
|
||||
ctxt_pP,
|
||||
DCCH,
|
||||
rrc_mui++,
|
||||
@@ -1823,7 +1888,7 @@ rrc_ue_process_ueCapabilityEnquiry(
|
||||
}
|
||||
|
||||
LOG_T(RRC, "\n");
|
||||
rrc_data_req (
|
||||
rrc_data_req_ue (
|
||||
ctxt_pP,
|
||||
DCCH,
|
||||
rrc_mui++,
|
||||
@@ -4513,7 +4578,7 @@ void *rrc_ue_task( void *args_p )
|
||||
// check if SRB2 is created, if yes request data_req on DCCH1 (SRB2)
|
||||
if(UE_rrc_inst[ue_mod_id].SRB2_config[0] == NULL)
|
||||
{
|
||||
rrc_data_req (&ctxt,
|
||||
rrc_data_req_ue (&ctxt,
|
||||
DCCH,
|
||||
rrc_mui++,
|
||||
SDU_CONFIRM_NO,
|
||||
@@ -4522,7 +4587,7 @@ void *rrc_ue_task( void *args_p )
|
||||
}
|
||||
else
|
||||
{
|
||||
rrc_data_req (&ctxt,
|
||||
rrc_data_req_ue (&ctxt,
|
||||
DCCH1,
|
||||
rrc_mui++,
|
||||
SDU_CONFIRM_NO,
|
||||
@@ -4765,3 +4830,121 @@ rrc_top_cleanup_ue(
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
RRC_status_t
|
||||
rrc_rx_tx_ue(
|
||||
protocol_ctxt_t* const ctxt_pP,
|
||||
const uint8_t enb_indexP,
|
||||
const int CC_id
|
||||
)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
//uint8_t UE_id;
|
||||
int32_t current_timestamp_ms, ref_timestamp_ms;
|
||||
struct timeval ts;
|
||||
struct rrc_eNB_ue_context_s *ue_context_p = NULL,*ue_to_be_removed = NULL;
|
||||
|
||||
#ifdef LOCALIZATION
|
||||
double estimated_distance;
|
||||
protocol_ctxt_t ctxt;
|
||||
#endif
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_IN);
|
||||
|
||||
// check timers
|
||||
|
||||
if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_active == 1) {
|
||||
if ((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_cnt % 10) == 0)
|
||||
LOG_D(RRC,
|
||||
"[UE %d][RAPROC] Frame %d T300 Count %d ms\n", ctxt_pP->module_id, ctxt_pP->frame, UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_cnt);
|
||||
|
||||
if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_cnt
|
||||
== T300[UE_rrc_inst[ctxt_pP->module_id].sib2[enb_indexP]->ue_TimersAndConstants.t300]) {
|
||||
UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_active = 0;
|
||||
// ALLOW CCCH to be used
|
||||
UE_rrc_inst[ctxt_pP->module_id].Srb0[enb_indexP].Tx_buffer.payload_size = 0;
|
||||
rrc_ue_generate_RRCConnectionRequest (ctxt_pP, enb_indexP);
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
|
||||
return (RRC_ConnSetup_failed);
|
||||
}
|
||||
|
||||
UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_cnt++;
|
||||
}
|
||||
|
||||
if ((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].SIStatus&2)>0) {
|
||||
if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N310_cnt
|
||||
== N310[UE_rrc_inst[ctxt_pP->module_id].sib2[enb_indexP]->ue_TimersAndConstants.n310]) {
|
||||
LOG_I(RRC,"Activating T310\n");
|
||||
UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_active = 1;
|
||||
}
|
||||
} else { // in case we have not received SIB2 yet
|
||||
/* if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N310_cnt == 100) {
|
||||
UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N310_cnt = 0;
|
||||
|
||||
}*/
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
|
||||
return RRC_OK;
|
||||
}
|
||||
|
||||
if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_active == 1) {
|
||||
if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N311_cnt
|
||||
== N311[UE_rrc_inst[ctxt_pP->module_id].sib2[enb_indexP]->ue_TimersAndConstants.n311]) {
|
||||
UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_active = 0;
|
||||
UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N311_cnt = 0;
|
||||
}
|
||||
|
||||
if ((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_cnt % 10) == 0) {
|
||||
LOG_D(RRC, "[UE %d] Frame %d T310 Count %d ms\n", ctxt_pP->module_id, ctxt_pP->frame, UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_cnt);
|
||||
}
|
||||
|
||||
if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_cnt == T310[UE_rrc_inst[ctxt_pP->module_id].sib2[enb_indexP]->ue_TimersAndConstants.t310]) {
|
||||
UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_active = 0;
|
||||
rrc_t310_expiration (ctxt_pP, enb_indexP);
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
|
||||
LOG_I(RRC,"Returning RRC_PHY_RESYNCH: T310 expired\n");
|
||||
return RRC_PHY_RESYNCH;
|
||||
}
|
||||
|
||||
UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_cnt++;
|
||||
}
|
||||
|
||||
if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_active==1) {
|
||||
if ((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_cnt % 10) == 0)
|
||||
LOG_D(RRC,"[UE %d][RAPROC] Frame %d T304 Count %d ms\n",ctxt_pP->module_id,ctxt_pP->frame,
|
||||
UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_cnt);
|
||||
|
||||
if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_cnt == 0) {
|
||||
UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_active = 0;
|
||||
UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.measFlag = 1;
|
||||
LOG_E(RRC,"[UE %d] Handover failure..initiating connection re-establishment procedure... \n",
|
||||
ctxt_pP->module_id);
|
||||
//Implement 36.331, section 5.3.5.6 here
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
|
||||
return(RRC_Handover_failed);
|
||||
}
|
||||
|
||||
UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_cnt--;
|
||||
}
|
||||
|
||||
// Layer 3 filtering of RRC measurements
|
||||
if (UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[0] != NULL) {
|
||||
ue_meas_filtering(ctxt_pP,enb_indexP);
|
||||
}
|
||||
|
||||
ue_measurement_report_triggering(ctxt_pP,enb_indexP);
|
||||
|
||||
if (UE_rrc_inst[ctxt_pP->module_id].Info[0].handoverTarget > 0) {
|
||||
LOG_I(RRC,"[UE %d] Frame %d : RRC handover initiated\n", ctxt_pP->module_id, ctxt_pP->frame);
|
||||
}
|
||||
|
||||
if((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].State == RRC_HO_EXECUTION) &&
|
||||
(UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.targetCellId != 0xFF)) {
|
||||
UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].State= RRC_IDLE;
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
|
||||
return(RRC_HO_STARTED);
|
||||
}
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
|
||||
return (RRC_OK);
|
||||
}
|
||||
|
||||
@@ -53,42 +53,6 @@ extern UE_MAC_INST *UE_mac_inst;
|
||||
|
||||
extern mui_t rrc_eNB_mui;
|
||||
|
||||
//configure BCCH & CCCH Logical Channels and associated rrc_buffers, configure associated SRBs
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
openair_rrc_on(
|
||||
const protocol_ctxt_t* const ctxt_pP
|
||||
)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
unsigned short i;
|
||||
int CC_id;
|
||||
|
||||
if (ctxt_pP->enb_flag == ENB_FLAG_YES) {
|
||||
LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" ENB:OPENAIR RRC IN....\n",
|
||||
PROTOCOL_RRC_CTXT_ARGS(ctxt_pP));
|
||||
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
|
||||
rrc_config_buffer (&RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SI, BCCH, 1);
|
||||
RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SI.Active = 1;
|
||||
rrc_config_buffer (&RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0, CCCH, 1);
|
||||
RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Active = 1;
|
||||
}
|
||||
} else {
|
||||
LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" UE?:OPENAIR RRC IN....\n",
|
||||
PROTOCOL_RRC_CTXT_ARGS(ctxt_pP));
|
||||
|
||||
for (i = 0; i < NB_eNB_INST; i++) {
|
||||
LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" Activating CCCH (eNB %d)\n",
|
||||
PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), i);
|
||||
UE_rrc_inst[ctxt_pP->module_id].Srb0[i].Srb_id = CCCH;
|
||||
memcpy (&UE_rrc_inst[ctxt_pP->module_id].Srb0[i].Lchan_desc[0], &CCCH_LCHAN_DESC, LCHAN_DESC_SIZE);
|
||||
memcpy (&UE_rrc_inst[ctxt_pP->module_id].Srb0[i].Lchan_desc[1], &CCCH_LCHAN_DESC, LCHAN_DESC_SIZE);
|
||||
rrc_config_buffer (&UE_rrc_inst[ctxt_pP->module_id].Srb0[i], CCCH, 1);
|
||||
UE_rrc_inst[ctxt_pP->module_id].Srb0[i].Active = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
int
|
||||
rrc_init_global_param(
|
||||
@@ -168,282 +132,6 @@ rrc_config_buffer(
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void
|
||||
rrc_t310_expiration(
|
||||
const protocol_ctxt_t* const ctxt_pP,
|
||||
const uint8_t eNB_index
|
||||
)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
|
||||
if (UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State != RRC_CONNECTED) {
|
||||
LOG_D(RRC, "Timer 310 expired, going to RRC_IDLE\n");
|
||||
UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State = RRC_IDLE;
|
||||
UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].UE_index = 0xffff;
|
||||
UE_rrc_inst[ctxt_pP->module_id].Srb0[eNB_index].Rx_buffer.payload_size = 0;
|
||||
UE_rrc_inst[ctxt_pP->module_id].Srb0[eNB_index].Tx_buffer.payload_size = 0;
|
||||
UE_rrc_inst[ctxt_pP->module_id].Srb1[eNB_index].Srb_info.Rx_buffer.payload_size = 0;
|
||||
UE_rrc_inst[ctxt_pP->module_id].Srb1[eNB_index].Srb_info.Tx_buffer.payload_size = 0;
|
||||
|
||||
if (UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Active == 1) {
|
||||
msg ("[RRC Inst %d] eNB_index %d, Remove RB %d\n ", ctxt_pP->module_id, eNB_index,
|
||||
UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Srb_info.Srb_id);
|
||||
rrc_pdcp_config_req (ctxt_pP,
|
||||
SRB_FLAG_YES,
|
||||
CONFIG_ACTION_REMOVE,
|
||||
UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Srb_info.Srb_id,
|
||||
0);
|
||||
rrc_rlc_config_req (ctxt_pP,
|
||||
SRB_FLAG_YES,
|
||||
MBMS_FLAG_NO,
|
||||
CONFIG_ACTION_REMOVE,
|
||||
UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Srb_info.Srb_id,
|
||||
Rlc_info_um);
|
||||
UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Active = 0;
|
||||
UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Status = IDLE;
|
||||
UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Next_check_frame = 0;
|
||||
}
|
||||
} else { // Restablishment procedure
|
||||
LOG_D(RRC, "Timer 310 expired, trying RRCRestablishment ...\n");
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
RRC_status_t
|
||||
rrc_rx_tx(
|
||||
protocol_ctxt_t* const ctxt_pP,
|
||||
const uint8_t enb_indexP,
|
||||
const int CC_id
|
||||
)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
//uint8_t UE_id;
|
||||
int32_t current_timestamp_ms, ref_timestamp_ms;
|
||||
struct timeval ts;
|
||||
struct rrc_eNB_ue_context_s *ue_context_p = NULL,*ue_to_be_removed = NULL;
|
||||
|
||||
#ifdef LOCALIZATION
|
||||
double estimated_distance;
|
||||
protocol_ctxt_t ctxt;
|
||||
#endif
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_IN);
|
||||
|
||||
if(ctxt_pP->enb_flag == ENB_FLAG_NO) {
|
||||
// check timers
|
||||
|
||||
if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_active == 1) {
|
||||
if ((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_cnt % 10) == 0)
|
||||
LOG_D(RRC,
|
||||
"[UE %d][RAPROC] Frame %d T300 Count %d ms\n", ctxt_pP->module_id, ctxt_pP->frame, UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_cnt);
|
||||
|
||||
if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_cnt
|
||||
== T300[UE_rrc_inst[ctxt_pP->module_id].sib2[enb_indexP]->ue_TimersAndConstants.t300]) {
|
||||
UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_active = 0;
|
||||
// ALLOW CCCH to be used
|
||||
UE_rrc_inst[ctxt_pP->module_id].Srb0[enb_indexP].Tx_buffer.payload_size = 0;
|
||||
rrc_ue_generate_RRCConnectionRequest (ctxt_pP, enb_indexP);
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
|
||||
return (RRC_ConnSetup_failed);
|
||||
}
|
||||
|
||||
UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_cnt++;
|
||||
}
|
||||
|
||||
if ((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].SIStatus&2)>0) {
|
||||
if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N310_cnt
|
||||
== N310[UE_rrc_inst[ctxt_pP->module_id].sib2[enb_indexP]->ue_TimersAndConstants.n310]) {
|
||||
LOG_I(RRC,"Activating T310\n");
|
||||
UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_active = 1;
|
||||
}
|
||||
} else { // in case we have not received SIB2 yet
|
||||
/* if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N310_cnt == 100) {
|
||||
UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N310_cnt = 0;
|
||||
|
||||
}*/
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
|
||||
return RRC_OK;
|
||||
}
|
||||
|
||||
if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_active == 1) {
|
||||
if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N311_cnt
|
||||
== N311[UE_rrc_inst[ctxt_pP->module_id].sib2[enb_indexP]->ue_TimersAndConstants.n311]) {
|
||||
UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_active = 0;
|
||||
UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N311_cnt = 0;
|
||||
}
|
||||
|
||||
if ((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_cnt % 10) == 0) {
|
||||
LOG_D(RRC, "[UE %d] Frame %d T310 Count %d ms\n", ctxt_pP->module_id, ctxt_pP->frame, UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_cnt);
|
||||
}
|
||||
|
||||
if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_cnt == T310[UE_rrc_inst[ctxt_pP->module_id].sib2[enb_indexP]->ue_TimersAndConstants.t310]) {
|
||||
UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_active = 0;
|
||||
rrc_t310_expiration (ctxt_pP, enb_indexP);
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
|
||||
LOG_I(RRC,"Returning RRC_PHY_RESYNCH: T310 expired\n");
|
||||
return RRC_PHY_RESYNCH;
|
||||
}
|
||||
|
||||
UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_cnt++;
|
||||
}
|
||||
|
||||
if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_active==1) {
|
||||
if ((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_cnt % 10) == 0)
|
||||
LOG_D(RRC,"[UE %d][RAPROC] Frame %d T304 Count %d ms\n",ctxt_pP->module_id,ctxt_pP->frame,
|
||||
UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_cnt);
|
||||
|
||||
if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_cnt == 0) {
|
||||
UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_active = 0;
|
||||
UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.measFlag = 1;
|
||||
LOG_E(RRC,"[UE %d] Handover failure..initiating connection re-establishment procedure... \n",
|
||||
ctxt_pP->module_id);
|
||||
//Implement 36.331, section 5.3.5.6 here
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
|
||||
return(RRC_Handover_failed);
|
||||
}
|
||||
|
||||
UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_cnt--;
|
||||
}
|
||||
|
||||
// Layer 3 filtering of RRC measurements
|
||||
if (UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[0] != NULL) {
|
||||
ue_meas_filtering(ctxt_pP,enb_indexP);
|
||||
}
|
||||
|
||||
ue_measurement_report_triggering(ctxt_pP,enb_indexP);
|
||||
|
||||
if (UE_rrc_inst[ctxt_pP->module_id].Info[0].handoverTarget > 0) {
|
||||
LOG_I(RRC,"[UE %d] Frame %d : RRC handover initiated\n", ctxt_pP->module_id, ctxt_pP->frame);
|
||||
}
|
||||
|
||||
if((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].State == RRC_HO_EXECUTION) &&
|
||||
(UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.targetCellId != 0xFF)) {
|
||||
UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].State= RRC_IDLE;
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
|
||||
return(RRC_HO_STARTED);
|
||||
}
|
||||
|
||||
} else { // eNB
|
||||
check_handovers(ctxt_pP);
|
||||
// counetr, and get the value and aggregate
|
||||
|
||||
// check for UL failure
|
||||
RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) {
|
||||
if ((ctxt_pP->frame == 0) && (ctxt_pP->subframe==0)) {
|
||||
if (ue_context_p->ue_context.Initialue_identity_s_TMSI.presence == TRUE) {
|
||||
LOG_I(RRC,"UE rnti %x:S-TMSI %x failure timer %d/8\n",
|
||||
ue_context_p->ue_context.rnti,
|
||||
ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi,
|
||||
ue_context_p->ue_context.ul_failure_timer);
|
||||
}
|
||||
else {
|
||||
LOG_I(RRC,"UE rnti %x failure timer %d/8\n",
|
||||
ue_context_p->ue_context.rnti,
|
||||
ue_context_p->ue_context.ul_failure_timer);
|
||||
}
|
||||
}
|
||||
if (ue_context_p->ue_context.ul_failure_timer>0) {
|
||||
ue_context_p->ue_context.ul_failure_timer++;
|
||||
if (ue_context_p->ue_context.ul_failure_timer >= 8) {
|
||||
// remove UE after 20 seconds after MAC has indicated UL failure
|
||||
LOG_I(RRC,"Removing UE %x instance\n",ue_context_p->ue_context.rnti);
|
||||
ue_to_be_removed = ue_context_p;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ue_context_p->ue_context.ue_release_timer_s1>0) {
|
||||
ue_context_p->ue_context.ue_release_timer_s1++;
|
||||
if (ue_context_p->ue_context.ue_release_timer_s1 >=
|
||||
ue_context_p->ue_context.ue_release_timer_thres_s1) {
|
||||
LOG_I(RRC,"Removing UE %x instance Because of UE_CONTEXT_RELEASE_COMMAND not received after %d ms from sending request\n",
|
||||
ue_context_p->ue_context.rnti, ue_context_p->ue_context.ue_release_timer_thres_s1);
|
||||
ue_to_be_removed = ue_context_p;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ue_context_p->ue_context.ue_release_timer_rrc>0) {
|
||||
ue_context_p->ue_context.ue_release_timer_rrc++;
|
||||
if (ue_context_p->ue_context.ue_release_timer_rrc >=
|
||||
ue_context_p->ue_context.ue_release_timer_thres_rrc) {
|
||||
LOG_I(RRC,"Removing UE %x instance After UE_CONTEXT_RELEASE_Complete\n", ue_context_p->ue_context.rnti);
|
||||
ue_to_be_removed = ue_context_p;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ue_context_p->ue_context.ue_reestablishment_timer>0) {
|
||||
ue_context_p->ue_context.ue_reestablishment_timer++;
|
||||
if (ue_context_p->ue_context.ue_reestablishment_timer >=
|
||||
ue_context_p->ue_context.ue_reestablishment_timer_thres) {
|
||||
LOG_I(RRC,"UE %d reestablishment_timer max\n",ue_context_p->ue_context.rnti);
|
||||
ue_context_p->ue_context.ul_failure_timer = 20000;
|
||||
ue_to_be_removed = ue_context_p;
|
||||
ue_context_p->ue_context.ue_reestablishment_timer = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ue_context_p->ue_context.ue_release_timer>0) {
|
||||
ue_context_p->ue_context.ue_release_timer++;
|
||||
if (ue_context_p->ue_context.ue_release_timer >=
|
||||
ue_context_p->ue_context.ue_release_timer_thres) {
|
||||
LOG_I(RRC,"Removing UE %x instance\n",ue_context_p->ue_context.rnti);
|
||||
ue_to_be_removed = ue_context_p;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ue_to_be_removed) {
|
||||
if(ue_to_be_removed->ue_context.ul_failure_timer >= 8) {
|
||||
ue_to_be_removed->ue_context.ue_release_timer_s1 = 1;
|
||||
ue_to_be_removed->ue_context.ue_release_timer_thres_s1 = 100;
|
||||
ue_to_be_removed->ue_context.ue_release_timer = 0;
|
||||
ue_to_be_removed->ue_context.ue_reestablishment_timer = 0;
|
||||
}
|
||||
rrc_eNB_free_UE(ctxt_pP->module_id,ue_to_be_removed);
|
||||
if(ue_to_be_removed->ue_context.ul_failure_timer >= 8){
|
||||
ue_to_be_removed->ue_context.ul_failure_timer = 0;
|
||||
}
|
||||
}
|
||||
#ifdef RRC_LOCALIZATION
|
||||
|
||||
/* for the localization, only primary CC_id might be relevant*/
|
||||
gettimeofday(&ts, NULL);
|
||||
current_timestamp_ms = ts.tv_sec * 1000 + ts.tv_usec / 1000;
|
||||
ref_timestamp_ms = RC.rrc[ctxt_pP->module_id]->reference_timestamp_ms;
|
||||
RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) {
|
||||
ctxt = *ctxt_pP;
|
||||
ctxt.rnti = ue_context_p->ue_context.rnti;
|
||||
estimated_distance = rrc_get_estimated_ue_distance(
|
||||
&ctxt,
|
||||
CC_id,
|
||||
RC.rrc[ctxt_pP->module_id]->loc_type);
|
||||
|
||||
if ((current_timestamp_ms - ref_timestamp_ms > RC.rrc[ctxt_pP->module_id]->aggregation_period_ms) &&
|
||||
estimated_distance != -1) {
|
||||
LOG_D(LOCALIZE, " RRC [UE/id %d -> eNB/id %d] timestamp %d frame %d estimated r = %f\n",
|
||||
ctxt.rnti,
|
||||
ctxt_pP->module_id,
|
||||
current_timestamp_ms,
|
||||
ctxt_pP->frame,
|
||||
estimated_distance);
|
||||
LOG_D(LOCALIZE, " RRC status %d\n", ue_context_p->ue_context.Status);
|
||||
push_front(&RC.rrc[ctxt_pP->module_id]->loc_list,
|
||||
estimated_distance);
|
||||
RC.rrc[ctxt_pP->module_id]->reference_timestamp_ms = current_timestamp_ms;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
(void)ts; /* remove gcc warning "unused variable" */
|
||||
(void)ref_timestamp_ms; /* remove gcc warning "unused variable" */
|
||||
(void)current_timestamp_ms; /* remove gcc warning "unused variable" */
|
||||
}
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
|
||||
return (RRC_OK);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
long
|
||||
binary_search_int(
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
#include "rrc_eNB_UE_context.h"
|
||||
#include "platform_types.h"
|
||||
#include "msc.h"
|
||||
#include "UTIL/LOG/vcd_signal_dumper.h"
|
||||
|
||||
#include "T.h"
|
||||
|
||||
@@ -114,6 +115,25 @@ extern uint16_t two_tier_hexagonal_cellIds[7];
|
||||
|
||||
mui_t rrc_eNB_mui = 0;
|
||||
|
||||
void
|
||||
openair_rrc_on(
|
||||
const protocol_ctxt_t* const ctxt_pP
|
||||
)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
unsigned short i;
|
||||
int CC_id;
|
||||
|
||||
LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" ENB:OPENAIR RRC IN....\n",
|
||||
PROTOCOL_RRC_CTXT_ARGS(ctxt_pP));
|
||||
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
|
||||
rrc_config_buffer (&RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SI, BCCH, 1);
|
||||
RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SI.Active = 1;
|
||||
rrc_config_buffer (&RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0, CCCH, 1);
|
||||
RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Active = 1;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
static void
|
||||
init_SI(
|
||||
@@ -6727,3 +6747,101 @@ rrc_top_cleanup_eNB(
|
||||
free(RC.rrc);
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
RRC_status_t
|
||||
rrc_rx_tx(
|
||||
protocol_ctxt_t* const ctxt_pP,
|
||||
const int CC_id
|
||||
)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
//uint8_t UE_id;
|
||||
int32_t current_timestamp_ms, ref_timestamp_ms;
|
||||
struct timeval ts;
|
||||
struct rrc_eNB_ue_context_s *ue_context_p = NULL,*ue_to_be_removed = NULL;
|
||||
|
||||
#ifdef LOCALIZATION
|
||||
double estimated_distance;
|
||||
protocol_ctxt_t ctxt;
|
||||
#endif
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_IN);
|
||||
|
||||
check_handovers(ctxt_pP);
|
||||
// counetr, and get the value and aggregate
|
||||
|
||||
// check for UL failure
|
||||
RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) {
|
||||
if ((ctxt_pP->frame == 0) && (ctxt_pP->subframe==0)) {
|
||||
if (ue_context_p->ue_context.Initialue_identity_s_TMSI.presence == TRUE) {
|
||||
LOG_I(RRC,"UE rnti %x:S-TMSI %x failure timer %d/20000\n",
|
||||
ue_context_p->ue_context.rnti,
|
||||
ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi,
|
||||
ue_context_p->ue_context.ul_failure_timer);
|
||||
}
|
||||
else {
|
||||
LOG_I(RRC,"UE rnti %x failure timer %d/20000\n",
|
||||
ue_context_p->ue_context.rnti,
|
||||
ue_context_p->ue_context.ul_failure_timer);
|
||||
}
|
||||
}
|
||||
if (ue_context_p->ue_context.ul_failure_timer>0) {
|
||||
ue_context_p->ue_context.ul_failure_timer++;
|
||||
if (ue_context_p->ue_context.ul_failure_timer >= 20000) {
|
||||
// remove UE after 20 seconds after MAC has indicated UL failure
|
||||
LOG_I(RRC,"Removing UE %x instance\n",ue_context_p->ue_context.rnti);
|
||||
ue_to_be_removed = ue_context_p;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ue_context_p->ue_context.ue_release_timer>0) {
|
||||
ue_context_p->ue_context.ue_release_timer++;
|
||||
if (ue_context_p->ue_context.ue_release_timer >=
|
||||
ue_context_p->ue_context.ue_release_timer_thres) {
|
||||
LOG_I(RRC,"Removing UE %x instance\n",ue_context_p->ue_context.rnti);
|
||||
ue_to_be_removed = ue_context_p;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ue_to_be_removed)
|
||||
rrc_eNB_free_UE(ctxt_pP->module_id,ue_to_be_removed);
|
||||
|
||||
#ifdef RRC_LOCALIZATION
|
||||
|
||||
/* for the localization, only primary CC_id might be relevant*/
|
||||
gettimeofday(&ts, NULL);
|
||||
current_timestamp_ms = ts.tv_sec * 1000 + ts.tv_usec / 1000;
|
||||
ref_timestamp_ms = RC.rrc[ctxt_pP->module_id]->reference_timestamp_ms;
|
||||
RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) {
|
||||
ctxt = *ctxt_pP;
|
||||
ctxt.rnti = ue_context_p->ue_context.rnti;
|
||||
estimated_distance = rrc_get_estimated_ue_distance(
|
||||
&ctxt,
|
||||
CC_id,
|
||||
RC.rrc[ctxt_pP->module_id]->loc_type);
|
||||
|
||||
if ((current_timestamp_ms - ref_timestamp_ms > RC.rrc[ctxt_pP->module_id]->aggregation_period_ms) &&
|
||||
estimated_distance != -1) {
|
||||
LOG_D(LOCALIZE, " RRC [UE/id %d -> eNB/id %d] timestamp %d frame %d estimated r = %f\n",
|
||||
ctxt.rnti,
|
||||
ctxt_pP->module_id,
|
||||
current_timestamp_ms,
|
||||
ctxt_pP->frame,
|
||||
estimated_distance);
|
||||
LOG_D(LOCALIZE, " RRC status %d\n", ue_context_p->ue_context.Status);
|
||||
push_front(&RC.rrc[ctxt_pP->module_id]->loc_list,
|
||||
estimated_distance);
|
||||
RC.rrc[ctxt_pP->module_id]->reference_timestamp_ms = current_timestamp_ms;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
(void)ts; /* remove gcc warning "unused variable" */
|
||||
(void)ref_timestamp_ms; /* remove gcc warning "unused variable" */
|
||||
(void)current_timestamp_ms; /* remove gcc warning "unused variable" */
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
|
||||
return (RRC_OK);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user