Commit d81438cd authored by Xu Bo's avatar Xu Bo

merge the implemention of Paging, RRCConnectionRelease,...

merge the implemention of Paging, RRCConnectionRelease, RRCConnectionReestablishment, E-RAB Modify, E-RAB Release
parent d915c208
......@@ -178,9 +178,26 @@ void clean_eNb_ulsch(LTE_eNB_ULSCH_t *ulsch)
//ulsch->harq_processes[i]->phich_active = 0; //this will be done later after transmission of PHICH
ulsch->harq_processes[i]->phich_ACK = 0;
ulsch->harq_processes[i]->round = 0;
}
}
ulsch->harq_processes[i]->rar_alloc = 0;
ulsch->harq_processes[i]->first_rb = 0;
ulsch->harq_processes[i]->nb_rb = 0;
ulsch->harq_processes[i]->TBS = 0;
ulsch->harq_processes[i]->Or1 = 0;
ulsch->harq_processes[i]->Or2 = 0;
for ( int j = 0; j < 2; j++ ) {
ulsch->harq_processes[i]->o_RI[j] = 0;
}
ulsch->harq_processes[i]->O_ACK = 0;
ulsch->harq_processes[i]->srs_active = 0;
ulsch->harq_processes[i]->rvidx = 0;
ulsch->harq_processes[i]->Msc_initial = 0;
ulsch->harq_processes[i]->Nsymb_initial = 0;
}
}
ulsch->beta_offset_cqi_times8 = 0;
ulsch->beta_offset_ri_times8 = 0;
ulsch->beta_offset_harqack_times8 = 0;
ulsch->Msg3_active = 0;
}
}
......@@ -2038,3 +2055,4 @@ uint32_t ulsch_decoding_emul(PHY_VARS_eNB *eNB, eNB_rxtx_proc_t *proc,
}
#endif
......@@ -985,6 +985,7 @@ typedef struct PHY_VARS_eNB_s {
LTE_eNB_ULSCH_t *ulsch[NUMBER_OF_UE_MAX+1]; // Nusers + number of RA
LTE_eNB_DLSCH_t *dlsch_SI,*dlsch_ra,*dlsch_p;
LTE_eNB_DLSCH_t *dlsch_MCH;
LTE_eNB_DLSCH_t *dlsch_PCH;
LTE_eNB_UE_stats UE_stats[NUMBER_OF_UE_MAX];
LTE_eNB_UE_stats *UE_stats_ptr[NUMBER_OF_UE_MAX];
......
......@@ -213,6 +213,13 @@ void prach_procedures(PHY_VARS_eNB *eNB,
int br_flag
#endif
);
/*! \brief Function to compute subframe Number(DL and S) as a function of Frame type and TDD Configuration
@param frame_parms Pointer to DL frame parameter descriptor
@returns Subframe Number (DL,S)
*/
int subframe_num(LTE_DL_FRAME_PARMS *frame_parms);
/*! \brief Function to compute subframe type as a function of Frame type and TDD Configuration (implements Table 4.2.2 from 36.211, p.11 from version 8.6) and subframe index.
@param frame_parms Pointer to DL frame parameter descriptor
@param subframe Subframe index
......
......@@ -709,6 +709,26 @@ uint16_t get_Np(uint8_t N_RB_DL,uint8_t nCCE,uint8_t plus1)
return(Np[0+plus1]);
}
int subframe_num(LTE_DL_FRAME_PARMS *frame_parms){
if (frame_parms->frame_type == FDD)
return 10;
switch (frame_parms->tdd_config) {
case 1:
return 6;
case 3:
return 7;
case 4:
return 8;
case 5:
return 9;
default:
LOG_E(PHY,"Unsupported TDD configuration %d\n",frame_parms->tdd_config);
AssertFatal(frame_parms->tdd_config==1 || frame_parms->tdd_config==3 || frame_parms->tdd_config==4 || frame_parms->tdd_config==5,"subframe x Unsupported TDD configuration");
return(255);
}
}
lte_subframe_t subframe_select(LTE_DL_FRAME_PARMS *frame_parms,unsigned char subframe)
{
......
......@@ -40,3 +40,5 @@ MESSAGE_DEF(RRC_MAC_CCCH_DATA_IND, MESSAGE_PRIORITY_MED_PLUS, RrcMacCcchDat
MESSAGE_DEF(RRC_MAC_MCCH_DATA_REQ, MESSAGE_PRIORITY_MED_PLUS, RrcMacMcchDataReq, rrc_mac_mcch_data_req)
MESSAGE_DEF(RRC_MAC_MCCH_DATA_IND, MESSAGE_PRIORITY_MED_PLUS, RrcMacMcchDataInd, rrc_mac_mcch_data_ind)
MESSAGE_DEF(RRC_MAC_PCCH_DATA_REQ, MESSAGE_PRIORITY_MED_PLUS, RrcMacPcchDataReq, rrc_mac_pcch_data_req)
......@@ -43,11 +43,13 @@
#define RRC_MAC_MCCH_DATA_REQ(mSGpTR) (mSGpTR)->ittiMsg.rrc_mac_mcch_data_req
#define RRC_MAC_MCCH_DATA_IND(mSGpTR) (mSGpTR)->ittiMsg.rrc_mac_mcch_data_ind
#define RRC_MAC_PCCH_DATA_REQ(mSGpTR) (mSGpTR)->ittiMsg.rrc_mac_pcch_data_req
// Some constants from "LAYER2/MAC/defs.h"
#define BCCH_SDU_SIZE (512)
#define CCCH_SDU_SIZE (512)
#define MCCH_SDU_SIZE (512)
#define PCCH_SDU_SIZE (512)
//-------------------------------------------------------------------------------------------//
// Messages between RRC and MAC layers
......@@ -114,4 +116,10 @@ typedef struct RrcMacMcchDataInd_s {
uint8_t mbsfn_sync_area;
} RrcMacMcchDataInd;
typedef struct RrcMacPcchDataReq_s {
uint32_t frame;
uint32_t sdu_size;
uint8_t sdu[PCCH_SDU_SIZE];
uint8_t enb_index;
} RrcMacPcchDataReq;
#endif /* MAC_MESSAGES_TYPES_H_ */
......@@ -30,3 +30,4 @@
// Messages between RRC and PDCP layers
MESSAGE_DEF(RRC_DCCH_DATA_REQ, MESSAGE_PRIORITY_MED_PLUS, RrcDcchDataReq, rrc_dcch_data_req)
MESSAGE_DEF(RRC_DCCH_DATA_IND, MESSAGE_PRIORITY_MED_PLUS, RrcDcchDataInd, rrc_dcch_data_ind)
MESSAGE_DEF(RRC_PCCH_DATA_REQ, MESSAGE_PRIORITY_MED_PLUS, RrcPcchDataReq, rrc_pcch_data_req)
......@@ -33,6 +33,7 @@
// Defines to access message fields.
#define RRC_DCCH_DATA_REQ(mSGpTR) (mSGpTR)->ittiMsg.rrc_dcch_data_req
#define RRC_DCCH_DATA_IND(mSGpTR) (mSGpTR)->ittiMsg.rrc_dcch_data_ind
#define RRC_PCCH_DATA_REQ(mSGpTR) (mSGpTR)->ittiMsg.rrc_pcch_data_req
//-------------------------------------------------------------------------------------------//
// Messages between RRC and PDCP layers
......@@ -60,4 +61,13 @@ typedef struct RrcDcchDataInd_s {
uint8_t eNB_index; // LG: needed in UE
} RrcDcchDataInd;
typedef struct RrcPcchDataReq_s {
uint32_t sdu_size;
uint8_t *sdu_p;
uint8_t mode;
uint16_t rnti;
uint8_t ue_index;
uint8_t CC_id;
} RrcPcchDataReq;
#endif /* PDCP_MESSAGES_TYPES_H_ */
......@@ -33,6 +33,11 @@ MESSAGE_DEF(S1AP_UE_CONTEXT_RELEASE_COMPLETE_LOG, MESSAGE_PRIORITY_MED, IttiMsgT
MESSAGE_DEF(S1AP_UE_CONTEXT_RELEASE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_ue_context_release_log)
MESSAGE_DEF(S1AP_E_RAB_SETUP_REQUEST_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_e_rab_setup_request_log)
MESSAGE_DEF(S1AP_E_RAB_SETUP_RESPONSE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_e_rab_setup_response_log)
MESSAGE_DEF(S1AP_E_RAB_MODIFY_REQUEST_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_e_rab_modify_request_log)
MESSAGE_DEF(S1AP_E_RAB_MODIFY_RESPONSE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_e_rab_modify_response_log)
MESSAGE_DEF(S1AP_PAGING_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_paging_log)
MESSAGE_DEF(S1AP_E_RAB_RELEASE_REQUEST_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_e_rab_release_request_log)
MESSAGE_DEF(S1AP_E_RAB_RELEASE_RESPONSE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , s1ap_e_rab_release_response_log)
/* eNB application layer -> S1AP messages */
MESSAGE_DEF(S1AP_REGISTER_ENB_REQ , MESSAGE_PRIORITY_MED, s1ap_register_enb_req_t , s1ap_register_enb_req)
......@@ -54,6 +59,8 @@ MESSAGE_DEF(S1AP_UE_CTXT_MODIFICATION_RESP , MESSAGE_PRIORITY_MED, s1ap_ue_ctxt_
MESSAGE_DEF(S1AP_UE_CTXT_MODIFICATION_FAIL , MESSAGE_PRIORITY_MED, s1ap_ue_ctxt_modification_fail_t , s1ap_ue_ctxt_modification_fail)
MESSAGE_DEF(S1AP_E_RAB_SETUP_RESP , MESSAGE_PRIORITY_MED, s1ap_e_rab_setup_resp_t , s1ap_e_rab_setup_resp)
MESSAGE_DEF(S1AP_E_RAB_SETUP_REQUEST_FAIL , MESSAGE_PRIORITY_MED, s1ap_e_rab_setup_req_fail_t , s1ap_e_rab_setup_request_fail)
MESSAGE_DEF(S1AP_E_RAB_MODIFY_RESP , MESSAGE_PRIORITY_MED, s1ap_e_rab_modify_resp_t , s1ap_e_rab_modify_resp)
MESSAGE_DEF(S1AP_E_RAB_RELEASE_RESPONSE , MESSAGE_PRIORITY_MED, s1ap_e_rab_release_resp_t , s1ap_e_rab_release_resp)
/* S1AP -> RRC messages */
MESSAGE_DEF(S1AP_DOWNLINK_NAS , MESSAGE_PRIORITY_MED, s1ap_downlink_nas_t , s1ap_downlink_nas )
......@@ -61,6 +68,8 @@ MESSAGE_DEF(S1AP_INITIAL_CONTEXT_SETUP_REQ , MESSAGE_PRIORITY_MED, s1ap_initial_
MESSAGE_DEF(S1AP_UE_CTXT_MODIFICATION_REQ , MESSAGE_PRIORITY_MED, s1ap_ue_ctxt_modification_req_t , s1ap_ue_ctxt_modification_req)
MESSAGE_DEF(S1AP_PAGING_IND , MESSAGE_PRIORITY_MED, s1ap_paging_ind_t , s1ap_paging_ind )
MESSAGE_DEF(S1AP_E_RAB_SETUP_REQ , MESSAGE_PRIORITY_MED, s1ap_e_rab_setup_req_t , s1ap_e_rab_setup_req )
MESSAGE_DEF(S1AP_E_RAB_MODIFY_REQ , MESSAGE_PRIORITY_MED, s1ap_e_rab_modify_req_t , s1ap_e_rab_modify_req )
MESSAGE_DEF(S1AP_E_RAB_RELEASE_COMMAND , MESSAGE_PRIORITY_MED, s1ap_e_rab_release_command_t , s1ap_e_rab_release_command)
MESSAGE_DEF(S1AP_UE_CONTEXT_RELEASE_COMMAND, MESSAGE_PRIORITY_MED, s1ap_ue_release_command_t , s1ap_ue_release_command)
/* S1AP <-> RRC messages (can be initiated either by MME or eNB) */
......
......@@ -41,6 +41,7 @@
#define S1AP_UE_CTXT_MODIFICATION_FAIL(mSGpTR) (mSGpTR)->ittiMsg.s1ap_ue_ctxt_modification_fail
#define S1AP_E_RAB_SETUP_RESP(mSGpTR) (mSGpTR)->ittiMsg.s1ap_e_rab_setup_resp
#define S1AP_E_RAB_SETUP_FAIL(mSGpTR) (mSGpTR)->ittiMsg.s1ap_e_rab_setup_req_fail
#define S1AP_E_RAB_MODIFY_RESP(mSGpTR) (mSGpTR)->ittiMsg.s1ap_e_rab_modify_resp
#define S1AP_DOWNLINK_NAS(mSGpTR) (mSGpTR)->ittiMsg.s1ap_downlink_nas
#define S1AP_INITIAL_CONTEXT_SETUP_REQ(mSGpTR) (mSGpTR)->ittiMsg.s1ap_initial_context_setup_req
......@@ -48,9 +49,12 @@
#define S1AP_UE_CONTEXT_RELEASE_COMMAND(mSGpTR) (mSGpTR)->ittiMsg.s1ap_ue_release_command
#define S1AP_UE_CONTEXT_RELEASE_COMPLETE(mSGpTR) (mSGpTR)->ittiMsg.s1ap_ue_release_complete
#define S1AP_E_RAB_SETUP_REQ(mSGpTR) (mSGpTR)->ittiMsg.s1ap_e_rab_setup_req
#define S1AP_PAGIND_IND(mSGpTR) (mSGpTR)->ittiMsg.s1ap_paging_ind
#define S1AP_E_RAB_MODIFY_REQ(mSGpTR) (mSGpTR)->ittiMsg.s1ap_e_rab_modify_req
#define S1AP_PAGING_IND(mSGpTR) (mSGpTR)->ittiMsg.s1ap_paging_ind
#define S1AP_UE_CONTEXT_RELEASE_REQ(mSGpTR) (mSGpTR)->ittiMsg.s1ap_ue_release_req
#define S1AP_E_RAB_RELEASE_COMMAND(mSGpTR) (mSGpTR)->ittiMsg.s1ap_e_rab_release_command
#define S1AP_E_RAB_RELEASE_RESPONSE(mSGpTR) (mSGpTR)->ittiMsg.s1ap_e_rab_release_resp
//-------------------------------------------------------------------------------------------//
/* Maximum number of e-rabs to be setup/deleted in a single message.
......@@ -175,6 +179,11 @@ typedef struct s1ap_gummei_s {
uint16_t mme_group_id;
} s1ap_gummei_t;
typedef struct s1ap_imsi_s {
uint8_t buffer[S1AP_IMSI_LENGTH];
uint8_t length;
} s1ap_imsi_t;
typedef struct s_tmsi_s {
uint8_t mme_code;
uint32_t m_tmsi;
......@@ -189,7 +198,7 @@ typedef enum ue_paging_identity_presenceMask_e {
typedef struct ue_paging_identity_s {
ue_paging_identity_presenceMask_t presenceMask;
union {
char imsi[S1AP_IMSI_LENGTH];
s1ap_imsi_t imsi;
s_tmsi_t s_tmsi;
} choice;
} ue_paging_identity_t;
......@@ -260,11 +269,29 @@ typedef struct e_rab_setup_s {
uint32_t gtp_teid;
} e_rab_setup_t;
typedef struct e_rab_modify_s {
/* Unique e_rab_id for the UE. */
uint8_t e_rab_id;
} e_rab_modify_t;
typedef enum S1ap_Cause_e {
S1AP_CAUSE_NOTHING, /* No components present */
S1AP_CAUSE_RADIO_NETWORK,
S1AP_CAUSE_TRANSPORT,
S1AP_CAUSE_NAS,
S1AP_CAUSE_PROTOCOL,
S1AP_CAUSE_MISC,
/* Extensions may appear below */
} s1ap_Cause_t;
typedef struct e_rab_failed_s {
/* Unique e_rab_id for the UE. */
uint8_t e_rab_id;
/* Cause of the failure */
// cause_t cause;
s1ap_Cause_t cause;
uint8_t cause_value;
} e_rab_failed_t;
typedef enum s1ap_ue_ctxt_modification_present_s {
......@@ -460,6 +487,12 @@ typedef struct s1ap_initial_context_setup_req_s {
e_rab_t e_rab_param[S1AP_MAX_E_RAB];
} s1ap_initial_context_setup_req_t;
typedef struct tai_plmn_identity_s {
uint16_t mcc;
uint16_t mnc;
uint8_t mnc_digit_length;
} plmn_identity_t;
typedef struct s1ap_paging_ind_s {
/* UE identity index value.
* Specified in 3GPP TS 36.304
......@@ -472,6 +505,15 @@ typedef struct s1ap_paging_ind_s {
/* Indicates origin of paging */
cn_domain_t cn_domain;
/* PLMN_identity in TAI of Paging*/
plmn_identity_t plmn_identity[256];
/* TAC in TAIList of Paging*/
int16_t tac[256];
/* size of TAIList*/
int16_t tai_size;
/* Optional fields */
paging_drx_t paging_drx;
......@@ -520,16 +562,6 @@ typedef struct s1ap_ue_release_command_s {
//-------------------------------------------------------------------------------------------//
typedef enum S1ap_Cause_e {
S1AP_CAUSE_NOTHING, /* No components present */
S1AP_CAUSE_RADIO_NETWORK,
S1AP_CAUSE_TRANSPORT,
S1AP_CAUSE_NAS,
S1AP_CAUSE_PROTOCOL,
S1AP_CAUSE_MISC,
/* Extensions may appear below */
} s1ap_Cause_t;
// S1AP <-- RRC messages
typedef struct s1ap_ue_release_req_s {
unsigned eNB_ue_s1ap_id:24;
......@@ -537,4 +569,78 @@ typedef struct s1ap_ue_release_req_s {
long cause_value;
} s1ap_ue_release_req_t, s1ap_ue_release_resp_t;
typedef struct s1ap_e_rab_modify_req_s {
/* UE id for initial connection to S1AP */
uint16_t ue_initial_id;
/* MME UE id */
uint16_t mme_ue_s1ap_id;
/* eNB ue s1ap id as initialized by S1AP layer */
unsigned eNB_ue_s1ap_id:24;
/* Number of e_rab to be modify in the list */
uint8_t nb_e_rabs_tomodify;
/* E RAB modify request */
e_rab_t e_rab_modify_params[S1AP_MAX_E_RAB];
} s1ap_e_rab_modify_req_t;
typedef struct s1ap_e_rab_modify_resp_s {
unsigned eNB_ue_s1ap_id:24;
/* Number of e_rab modify-ed in the list */
uint8_t nb_of_e_rabs;
/* list of e_rab modify-ed by RRC layers */
e_rab_modify_t e_rabs[S1AP_MAX_E_RAB];
/* Number of e_rab failed to be modify in list */
uint8_t nb_of_e_rabs_failed;
/* list of e_rabs that failed to be modify */
e_rab_failed_t e_rabs_failed[S1AP_MAX_E_RAB];
} s1ap_e_rab_modify_resp_t;
typedef struct e_rab_release_s {
/* Unique e_rab_id for the UE. */
uint8_t e_rab_id;
} e_rab_release_t;
typedef struct s1ap_e_rab_release_command_s {
/* MME UE id */
uint16_t mme_ue_s1ap_id;
/* eNB ue s1ap id as initialized by S1AP layer */
unsigned eNB_ue_s1ap_id:24;
/* The NAS PDU should be forwarded by the RRC layer to the NAS layer */
nas_pdu_t nas_pdu;
/* Number of e_rab to be released in the list */
uint8_t nb_e_rabs_torelease;
/* E RAB release command */
e_rab_release_t e_rab_release_params[S1AP_MAX_E_RAB];
} s1ap_e_rab_release_command_t;
typedef struct s1ap_e_rab_release_resp_s {
/* MME UE id */
uint16_t mme_ue_s1ap_id;
/* eNB ue s1ap id as initialized by S1AP layer */
unsigned eNB_ue_s1ap_id:24;
/* Number of e_rab released in the list */
uint8_t nb_of_e_rabs_released;
/* list of e_rabs released */
e_rab_release_t e_rab_release[S1AP_MAX_E_RAB];
/* Number of e_rab failed to be released in list */
uint8_t nb_of_e_rabs_failed;
/* list of e_rabs that failed to be released */
e_rab_failed_t e_rabs_failed[S1AP_MAX_E_RAB];
} s1ap_e_rab_release_resp_t;
#endif /* S1AP_MESSAGES_TYPES_H_ */
......@@ -159,6 +159,8 @@
/*!\brief maximum number of slices / groups */
#define MAX_NUM_SLICES 4
#define U_PLANE_INACTIVITY_VALUE 6000
/*
* eNB part
*/
......@@ -459,6 +461,15 @@ typedef struct {
/// BCCH MCS
uint32_t ccch_mcs;
/// num PCCH PDU per CC
uint32_t total_num_pcch_pdu;
/// PCCH buffer size
uint32_t pcch_buffer;
/// total PCCH buffer size
uint32_t total_pcch_buffer;
/// BCCH MCS
uint32_t pcch_mcs;
/// num active users
uint16_t num_dlactive_UEs;
/// available number of PRBs for a give SF
......@@ -842,6 +853,7 @@ typedef struct {
uint8_t aperiodic_wideband_cqi1[NFAPI_CC_MAX];
uint8_t aperiodic_wideband_pmi1[NFAPI_CC_MAX];
uint8_t dl_cqi[NFAPI_CC_MAX];
int32_t uplane_inactivity_timer;
} UE_sched_ctrl;
/*! \brief eNB template for the Random access information */
typedef struct {
......@@ -990,6 +1002,10 @@ typedef struct {
uint32_t BCCH_alloc_pdu;
/// Outgoing CCCH pdu for PHY
CCCH_PDU CCCH_pdu;
/// Outgoing PCCH DCI allocation
uint32_t PCCH_alloc_pdu;
/// Outgoing PCCH pdu for PHY
PCCH_PDU PCCH_pdu;
/// Outgoing RAR pdu for PHY
RAR_PDU RAR_pdu;
/// Template for RA computations
......@@ -1105,6 +1121,8 @@ typedef struct eNB_MAC_INST_s {
time_stats_t schedule_mch;
/// processing time of eNB ULSCH reception
time_stats_t rx_ulsch_sdu; // include rlc_data_ind
/// processing time of eNB PCH scheduler
time_stats_t schedule_pch;
} eNB_MAC_INST;
/*
......
......@@ -375,6 +375,12 @@ void check_ul_failure(module_id_t module_idP,int CC_id,int UE_id,
}
} // ul_failure_timer>0
UE_list->UE_sched_ctrl[UE_id].uplane_inactivity_timer++;
if(UE_list->UE_sched_ctrl[UE_id].uplane_inactivity_timer > (U_PLANE_INACTIVITY_VALUE*subframe_num(&RC.eNB[module_idP][CC_id]->frame_parms))){
LOG_D(MAC,"UE %d rnti %x: U-Plane Failure after repeated PDCCH orders: Triggering RRC \n",UE_id,rnti);
mac_eNB_rrc_uplane_failure(module_idP,CC_id,frameP,subframeP,rnti);
UE_list->UE_sched_ctrl[UE_id].uplane_inactivity_timer = 0;
}// time > 60s
}
void clear_nfapi_information(eNB_MAC_INST *eNB,int CC_idP,frame_t frameP,sub_frame_t subframeP)
......@@ -521,6 +527,8 @@ void eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP, sub_frame
if ((subframeP==0) && (frameP&3) == 0) schedule_mib(module_idP,frameP,subframeP);
// This schedules SI for legacy LTE and eMTC starting in subframeP
schedule_SI(module_idP,frameP,subframeP);
// This schedules Paging in subframeP
schedule_PCH(module_idP,frameP,subframeP);
// This schedules Random-Access for legacy LTE and eMTC starting in subframeP
schedule_RA(module_idP,frameP,subframeP);
// copy previously scheduled UL resources (ULSCH + HARQ)
......
This diff is collapsed.
......@@ -1752,6 +1752,7 @@ int rrc_mac_remove_ue(module_id_t mod_idP,rnti_t rntiP)
//------------------------------------------------------------------------------
{
int i;
int j;
UE_list_t *UE_list = &RC.mac[mod_idP]->UE_list;
int UE_id = find_UE_id(mod_idP,rntiP);
int pCC_id;
......@@ -1775,7 +1776,7 @@ int rrc_mac_remove_ue(module_id_t mod_idP,rnti_t rntiP)
else UE_list->next_ul[prev(UE_list,UE_id,0)]=UE_list->next_ul[UE_id];
// clear all remaining pending transmissions
UE_list->UE_template[pCC_id][UE_id].bsr_info[LCGID0] = 0;
/* UE_list->UE_template[pCC_id][UE_id].bsr_info[LCGID0] = 0;
UE_list->UE_template[pCC_id][UE_id].bsr_info[LCGID1] = 0;
UE_list->UE_template[pCC_id][UE_id].bsr_info[LCGID2] = 0;
UE_list->UE_template[pCC_id][UE_id].bsr_info[LCGID3] = 0;
......@@ -1783,11 +1784,37 @@ int rrc_mac_remove_ue(module_id_t mod_idP,rnti_t rntiP)
UE_list->UE_template[pCC_id][UE_id].ul_SR = 0;
UE_list->UE_template[pCC_id][UE_id].rnti = NOT_A_RNTI;
UE_list->UE_template[pCC_id][UE_id].ul_active = FALSE;
*/
memset (&UE_list->UE_template[pCC_id][UE_id],0,sizeof(UE_TEMPLATE));
UE_list->eNB_UE_stats[pCC_id][UE_id].total_rbs_used = 0;
UE_list->eNB_UE_stats[pCC_id][UE_id].total_rbs_used_retx = 0;
for ( j = 0; j < NB_RB_MAX; j++ ) {
UE_list->eNB_UE_stats[pCC_id][UE_id].num_pdu_tx[j] = 0;
UE_list->eNB_UE_stats[pCC_id][UE_id].num_bytes_tx[j] = 0;
}
UE_list->eNB_UE_stats[pCC_id][UE_id].num_retransmission = 0;
UE_list->eNB_UE_stats[pCC_id][UE_id].total_sdu_bytes = 0;
UE_list->eNB_UE_stats[pCC_id][UE_id].total_pdu_bytes = 0;
UE_list->eNB_UE_stats[pCC_id][UE_id].total_num_pdus = 0;
UE_list->eNB_UE_stats[pCC_id][UE_id].total_rbs_used_rx = 0;
for ( j = 0; j < NB_RB_MAX; j++ ) {
UE_list->eNB_UE_stats[pCC_id][UE_id].num_pdu_rx[j] = 0;
UE_list->eNB_UE_stats[pCC_id][UE_id].num_bytes_rx[j] = 0;
}
UE_list->eNB_UE_stats[pCC_id][UE_id].num_errors_rx = 0;
UE_list->eNB_UE_stats[pCC_id][UE_id].total_pdu_bytes_rx = 0;
UE_list->eNB_UE_stats[pCC_id][UE_id].total_num_pdus_rx = 0;
UE_list->eNB_UE_stats[pCC_id][UE_id].total_num_errors_rx = 0;
eNB_ulsch_info[mod_idP][pCC_id][UE_id].rnti = NOT_A_RNTI;
eNB_ulsch_info[mod_idP][pCC_id][UE_id].status = S_UL_NONE;
eNB_dlsch_info[mod_idP][pCC_id][UE_id].rnti = NOT_A_RNTI;
eNB_dlsch_info[mod_idP][pCC_id][UE_id].status = S_DL_NONE;
eNB_ulsch_info[mod_idP][pCC_id][UE_id].serving_num = 0;
eNB_dlsch_info[mod_idP][pCC_id][UE_id].serving_num = 0;
// check if this has an RA process active
RA_TEMPLATE *RA_template;
for (i=0;i<NB_RA_PROC_MAX;i++) {
......@@ -1800,6 +1827,7 @@ int rrc_mac_remove_ue(module_id_t mod_idP,rnti_t rntiP)
RA_template->timing_offset=0;
RA_template->RRC_timer=20;
RA_template->rnti = 0;
RA_template->Msg3_subframe=0;
//break;
}
}
......
......@@ -552,6 +552,8 @@ void rx_sdu(const module_id_t enb_mod_idP,
UE_list->eNB_UE_stats[CC_idP][UE_id].num_pdu_rx[rx_lcids[i]]+=1;
UE_list->eNB_UE_stats[CC_idP][UE_id].num_bytes_rx[rx_lcids[i]]+=rx_lengths[i];
//clear uplane_inactivity_timer
UE_list->UE_sched_ctrl[UE_id].uplane_inactivity_timer = 0;
}
else { /* rx_length[i] */
UE_list->eNB_UE_stats[CC_idP][UE_id].num_errors_rx+=1;
......
......@@ -101,6 +101,8 @@ extern DCI2_5MHz_2A_TDD_t DLSCH_alloc_pdu1;
extern DCI2_5MHz_2A_TDD_t DLSCH_alloc_pdu2;
extern DCI1E_5MHz_2A_M10PRB_TDD_t DLSCH_alloc_pdu1E;
extern uint16_t reestablish_rnti_map[NUMBER_OF_UE_MAX][2];
#endif //DEF_H
......@@ -581,6 +581,9 @@ void dlsch_scheduler_pre_processor (module_id_t Mod_id,
if (UE_list->UE_sched_ctrl[i].ul_out_of_sync == 1)
continue;
UE_id = i;
/* harada */
int harq_pid_ul = (((frameP<<1)+subframeP)&7);//subframe2harqpid(&RC.mac[Mod_id]->common_channels[CC_id],frameP,subframeP);
if( (UE_list->UE_sched_ctrl[UE_id].ul_scheduled & (1<<harq_pid_ul)) != 0 ) continue;
for (ii=0; ii<UE_num_active_CC(UE_list,UE_id); ii++) {
CC_id = UE_list->ordered_CCids[ii][UE_id];
......
......@@ -393,6 +393,14 @@ void set_ue_dai(sub_frame_t subframeP,
uint8_t tdd_config,
UE_list_t *UE_list);
/** \brief First stage of PCH Scheduling. Gets a PCH SDU from RRC if available and computes the MCS required to transport it as a function of the SDU length. It assumes a length less than or equal to 64 bytes (MCS 6, 3 PRBs).
@param Mod_id Instance ID of eNB
@param frame Frame index
@param subframe Subframe number on which to act
@param paging_ue_index
*/
void schedule_PCH(module_id_t module_idP,frame_t frameP,sub_frame_t subframeP);
uint8_t find_num_active_UEs_in_cbagroup(module_id_t module_idP, unsigned char group_id);
uint8_t UE_is_to_be_scheduled(module_id_t module_idP,int CC_id,uint8_t UE_id);
/** \brief Round-robin scheduler for ULSCH traffic.
......
......@@ -68,6 +68,8 @@
extern int otg_enabled;
#endif
#include "common/ran_context.h"
extern RAN_CONTEXT_t RC;
//-----------------------------------------------------------------------------
/*
......@@ -948,6 +950,21 @@ pdcp_run (
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
break;
case RRC_PCCH_DATA_REQ:
{
sdu_size_t sdu_buffer_sizeP;
sdu_buffer_sizeP = RRC_PCCH_DATA_REQ(msg_p).sdu_size;
uint8_t CC_id = RRC_PCCH_DATA_REQ(msg_p).CC_id;
uint8_t ue_index = RRC_PCCH_DATA_REQ(msg_p).ue_index;
RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_paging[ue_index] = sdu_buffer_sizeP;
if (sdu_buffer_sizeP > 0) {
memcpy(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].paging[ue_index], RRC_PCCH_DATA_REQ(msg_p).sdu_p, sdu_buffer_sizeP);
}
//paging pdcp log
LOG_D(PDCP, "PDCP Received RRC_PCCH_DATA_REQ CC_id %d length %d \n", CC_id, sdu_buffer_sizeP);
}
break;
default:
LOG_E(PDCP, "Received unexpected message %s\n", msg_name);
break;
......@@ -1037,6 +1054,13 @@ pdcp_remove_UE(
// check and remove SRBs first
for(int i = 0;i<NUMBER_OF_UE_MAX;i++){
if(pdcp_eNB_UE_instance_to_rnti[i] == ctxt_pP->rnti){
pdcp_eNB_UE_instance_to_rnti[i] = NOT_A_RNTI;
break;
}
}
for (srb_id=0; srb_id<2; srb_id++) {
key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, srb_id, SRB_FLAG_YES);
h_rc = hashtable_remove(pdcp_coll_p, key);
......@@ -1344,7 +1368,7 @@ rrc_pdcp_config_asn1_req (
for (cnt=0; cnt<drb2release_list_pP->list.count; cnt++) {
pdrb_id_p = drb2release_list_pP->list.array[cnt];
drb_id = *pdrb_id_p;
key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, srb_id, SRB_FLAG_NO);
key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, drb_id, SRB_FLAG_NO);
h_rc = hashtable_get(pdcp_coll_p, key, (void**)&pdcp_p);
if (h_rc != HASH_TABLE_OK) {
......@@ -1472,7 +1496,17 @@ pdcp_config_req_asn1 (
if (ctxt_pP->enb_flag == ENB_FLAG_YES) {
pdcp_pP->is_ue = FALSE;
//pdcp_eNB_UE_instance_to_rnti[ctxtP->module_id] = ctxt_pP->rnti;
// pdcp_eNB_UE_instance_to_rnti[pdcp_eNB_UE_instance_to_rnti_index] = ctxt_pP->rnti;
if( srb_flagP == SRB_FLAG_NO ) {
for(int i = 0;i<NUMBER_OF_UE_MAX;i++){
if(pdcp_eNB_UE_instance_to_rnti[pdcp_eNB_UE_instance_to_rnti_index] == NOT_A_RNTI){
break;
}
pdcp_eNB_UE_instance_to_rnti_index = (pdcp_eNB_UE_instance_to_rnti_index + 1) % NUMBER_OF_UE_MAX;
}
pdcp_eNB_UE_instance_to_rnti[pdcp_eNB_UE_instance_to_rnti_index] = ctxt_pP->rnti;
pdcp_eNB_UE_instance_to_rnti_index = (pdcp_eNB_UE_instance_to_rnti_index + 1) % NUMBER_OF_UE_MAX;
}
//pdcp_eNB_UE_instance_to_rnti_index = (pdcp_eNB_UE_instance_to_rnti_index + 1) % NUMBER_OF_UE_MAX;
} else {
pdcp_pP->is_ue = TRUE;
......
......@@ -587,7 +587,7 @@ int pdcp_fifo_read_input_sdus (const protocol_ctxt_t* const ctxt_pP)
if (ctxt_cpy.enb_flag) {
ctxt.module_id = 0;
rab_id = pdcp_read_header_g.rb_id % maxDRB;
ctxt.rnti = pdcp_eNB_UE_instance_to_rnti[pdcp_eNB_UE_instance_to_rnti_index];
ctxt.rnti = pdcp_eNB_UE_instance_to_rnti[pdcp_read_header_g.rb_id / maxDRB];
} else {
ctxt.module_id = 0;
rab_id = pdcp_read_header_g.rb_id % maxDRB;
......
......@@ -125,6 +125,7 @@ rlc_tm_cleanup (
// RX SIDE
if ((rlcP->output_sdu_in_construction)) {
free_mem_block (rlcP->output_sdu_in_construction, __func__);
rlcP->output_sdu_in_construction = NULL;
}
memset(rlcP, 0, sizeof(rlc_tm_entity_t));
......
......@@ -343,6 +343,7 @@ rlc_um_cleanup (
if ((rlc_pP->output_sdu_in_construction)) {
free_mem_block (rlc_pP->output_sdu_in_construction, __func__);
rlc_pP->output_sdu_in_construction = NULL;
}
if (rlc_pP->dar_buffer) {
......
......@@ -132,6 +132,12 @@ int dump_eNB_l2_stats(char *buffer, int length)
eNB->eNB_stats[CC_id].total_bcch_buffer,
eNB->eNB_stats[CC_id].bcch_mcs);
len += sprintf(&buffer[len],"PCCH , NB_TX_MAC = %d, transmitted bytes (TTI %d, total %d) MCS (TTI %d)\n",
eNB->eNB_stats[CC_id].total_num_pcch_pdu,
eNB->eNB_stats[CC_id].pcch_buffer,
eNB->eNB_stats[CC_id].total_pcch_buffer,
eNB->eNB_stats[CC_id].pcch_mcs);
eNB->eNB_stats[CC_id].dlsch_bitrate=((eNB->eNB_stats[CC_id].dlsch_bytes_tx*8)/((eNB->frame + 1)*10));
eNB->eNB_stats[CC_id].total_dlsch_pdus_tx+=eNB->eNB_stats[CC_id].dlsch_pdus_tx;
eNB->eNB_stats[CC_id].total_dlsch_bytes_tx+=eNB->eNB_stats[CC_id].dlsch_bytes_tx;
......
......@@ -250,6 +250,44 @@ mac_rrc_data_req(
return (Sdu_size);
}
if( (Srb_id & RAB_OFFSET ) == PCCH) {
LOG_T(RRC,"[eNB %d] Frame %d PCCH request (Srb_id %d)\n",Mod_idP,frameP, Srb_id);
// check if data is there for MAC
if(RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area] > 0) { //Fill buffer
LOG_D(RRC,"[eNB %d] PCCH (%p) has %d bytes\n",Mod_idP,&RC.rrc[Mod_idP]->carrier[CC_id].paging[mbsfn_sync_area],
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area]);
#if 0 //defined(ENABLE_ITTI)
{
MessageDef *message_p;
int pcch_size = RC.rrc[Mod_idP]->arrier[CC_id].sizeof_paging[mbsfn_sync_area];
int sdu_size = sizeof(RRC_MAC_PCCH_DATA_REQ (message_p).sdu);
if (pcch_size > sdu_size) {
LOG_E(RRC, "SDU larger than PCCH SDU buffer size (%d, %d)", pcch_size, sdu_size);
pcch_size = sdu_size;
}
message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_PCCH_DATA_REQ);
RRC_MAC_PCCH_DATA_REQ (message_p).frame = frameP;
RRC_MAC_PCCH_DATA_REQ (message_p).sdu_size = pcch_size;
memset (RRC_MAC_PCCH_DATA_REQ (message_p).sdu, 0, PCCH_SDU_SIZE);
memcpy (RRC_MAC_PCCH_DATA_REQ (message_p).sdu, RC.rrc[Mod_idP]->carrier[CC_id].paging[mbsfn_sync_area], pcch_size);
RRC_MAC_PCCH_DATA_REQ (message_p).enb_index = eNB_index;
itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p);
}
#endif
memcpy(buffer_pP, RC.rrc[Mod_idP]->carrier[CC_id].paging[mbsfn_sync_area], RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area]);
Sdu_size = RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area];
RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area] = 0;
}
return (Sdu_size);