Commit 8b714302 authored by nikaeinn's avatar nikaeinn
Browse files

* manage control elements in CCCH PDU through rx_sdu function

* add event handler for remote (online) configuration and status monitoring
* update openair config generator (OCG) and scneario descriptor (OSD) with new features contributed by A. Gomes (one source)
* fix the issue with netlink when benchmarking oaisim preformance 
* pre-ci passed except for eMBMS  



git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5299 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 5c0c1eb7
......@@ -332,7 +332,7 @@ uint8_t get_ack(LTE_DL_FRAME_PARMS *frame_parms,
subframe_dl = subframe - 4;
o_ACK[0] = harq_ack[subframe_dl].ack;
status = harq_ack[subframe_dl].send_harq_status;
printf("get_ack: Getting ACK/NAK for PDSCH (subframe %d) => %d\n",subframe_dl,o_ACK[0]);
//printf("get_ack: Getting ACK/NAK for PDSCH (subframe %d) => %d\n",subframe_dl,o_ACK[0]);
}
else {
switch (frame_parms->tdd_config) {
......
......@@ -3093,11 +3093,18 @@ void phy_procedures_eNB_RX(unsigned char last_slot,PHY_VARS_eNB *phy_vars_eNB,ui
phy_vars_eNB->Mod_id,
frame,harq_pid,i);
#endif
mac_xface->rx_sdu(phy_vars_eNB->Mod_id,
frame,
phy_vars_eNB->ulsch_eNB[i]->rnti,
phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->b,
phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->TBS>>3);
/*
mac_xface->terminate_ra_proc(phy_vars_eNB->Mod_id,
frame,
phy_vars_eNB->ulsch_eNB[i]->rnti,
phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->b,
phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->TBS>>3);
*/
#endif
phy_vars_eNB->eNB_UE_stats[i].mode = PUSCH;
......
......@@ -241,7 +241,7 @@ double pbch_bler(double sinr) {
}
bler = pow(10.0,log10_bler);
}
printf ("sinr %f bler %f\n",sinr,bler);
//printf ("sinr %f bler %f\n",sinr,bler);
return(bler);
}
......@@ -12,7 +12,11 @@
#ifndef __PLATFORM_CONSTANTS_H__
# define __PLATFORM_CONSTANTS_H__
#define NL_MAX_PAYLOAD 4096 /* this should cover the max mtu size*/
#ifdef JUMBO_FRAME
#define NL_MAX_PAYLOAD 18000 /* this should cover the max mtu size*/
#else
#define NL_MAX_PAYLOAD 9000 /* this should cover the max mtu size*/
#endif
#ifdef USER_MODE
#ifdef LARGE_SCALE
......
......@@ -36,7 +36,7 @@ typedef uint32_t frame_t;
typedef int32_t sframe_t;
typedef uint32_t sub_frame_t;
typedef uint8_t module_id_t;
typedef int8_t smodule_id_t;
typedef int16_t smodule_id_t;
typedef uint16_t rb_id_t;
typedef uint16_t srb_id_t;
......
......@@ -1069,7 +1069,7 @@ can be scheduled.
@param subframe Index of current subframe
@param calibration_flag Flag to indicate that eNB scheduler should schedule TDD auto-calibration PUSCH.
*/
void eNB_dlsch_ulsch_scheduler(module_id_t module_idP, uint8_t cooperation_flag, frame_t frameP, sub_frame_t subframe);//, int calibration_flag);
void eNB_dlsch_ulsch_scheduler(module_id_t module_idP, uint8_t cooperation_flag, frame_t frameP, sub_frame_t subframeP);//, int calibration_flag);
/* \brief Function to retrieve result of scheduling (DCI) in current subframe. Can be called an arbitrary numeber of times after eNB_dlsch_ulsch_scheduler
in a given subframe.
......
......@@ -436,12 +436,11 @@ unsigned char *get_dlsch_sdu(module_id_t module_idP, frame_t frameP, rnti_t rnti
return((unsigned char *)&eNB_mac_inst[module_idP].BCCH_pdu.payload[0]);
}
else {
ue_mod_id = find_UE_id(module_idP,rntiP);
LOG_D(MAC,"[eNB %d] Frame %d Get DLSCH sdu for rnti %x => UE_id %d\n",module_idP,frameP,rntiP,ue_mod_id);
return((unsigned char *)&eNB_mac_inst[module_idP].DLSCH_pdu[ue_mod_id][TBindex].payload[0]);
else if ((ue_mod_id = find_UE_id(module_idP,rntiP)) != UE_INDEX_INVALID ){
LOG_D(MAC,"[eNB %d] Frame %d: Get DLSCH sdu for rnti %x => UE_id %d\n",module_idP,frameP,rntiP,ue_mod_id);
return((unsigned char *)&eNB_mac_inst[module_idP].DLSCH_pdu[ue_mod_id][TBindex].payload[0]);
} else {
LOG_E(MAC,"[eNB %d] Frame %d: UE with RNTI %x does not exist\n", module_idP,frameP,rntiP);
}
}
......@@ -516,9 +515,9 @@ unsigned char *parse_ulsch_header(unsigned char *mac_header,
void SR_indication(module_id_t enb_mod_idP, frame_t frameP, rnti_t rntiP, sub_frame_t subframeP) {
smodule_id_t ue_mod_id = find_UE_id(enb_mod_idP, rntiP);
module_id_t ue_mod_id = find_UE_id(enb_mod_idP, rntiP);
if (ue_mod_id >= 0) {
if (ue_mod_id != UE_INDEX_INVALID ) {
LOG_D(MAC,"[eNB %d][SR %x] Frame %d subframeP %d Signaling SR for UE %d \n",enb_mod_idP,rntiP,frameP,subframeP, ue_mod_id);
eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].ul_SR = 1;
eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].ul_active = TRUE;
......@@ -533,128 +532,185 @@ void rx_sdu(module_id_t enb_mod_idP,frame_t frameP,rnti_t rntiP,uint8_t *sdu, ui
unsigned char rx_ces[MAX_NUM_CE],num_ce,num_sdu,i,*payload_ptr;
unsigned char rx_lcids[NB_RB_MAX];
unsigned short rx_lengths[NB_RB_MAX];
module_id_t ue_mod_id = find_UE_id(enb_mod_idP,rntiP);
module_id_t ue_mod_id = find_UE_id(enb_mod_idP,rntiP);
int ii,j;
start_meas(&eNB_mac_inst[enb_mod_idP].rx_ulsch_sdu);
if ((ue_mod_id > NUMBER_OF_UE_MAX) || (ue_mod_id == -1) || (ue_mod_id == 255) )
for(ii=0; ii<NB_RB_MAX; ii++) rx_lengths[ii] = 0;
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_RX_SDU,1);
eNB_mac_inst[enb_mod_idP].eNB_UE_stats[ue_mod_id].total_pdu_bytes_rx+=sdu_len;
eNB_mac_inst[enb_mod_idP].eNB_UE_stats[ue_mod_id].total_num_pdus_rx+=1;
LOG_D(MAC,"[eNB %d] Received ULSCH sdu from PHY (rnti %x, UE_id %d), parsing header\n",enb_mod_idP,rntiP,ue_mod_id);
payload_ptr = parse_ulsch_header(sdu,&num_ce,&num_sdu,rx_ces,rx_lcids,rx_lengths,sdu_len);
// control element
for (i=0;i<num_ce;i++) {
switch (rx_ces[i]) { // implement and process BSR + CRNTI +
case POWER_HEADROOM:
eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].phr_info = (payload_ptr[0] & 0x3f);// - PHR_MAPPING_OFFSET;
LOG_D(MAC, "[eNB] MAC CE_LCID %d : Received PHR PH = %d (db)\n", rx_ces[i], eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].phr_info);
payload_ptr+=sizeof(POWER_HEADROOM_CMD);
break;
switch (rx_ces[i]) { // implement and process BSR + CRNTI +
case POWER_HEADROOM:
if (ue_mod_id != UE_INDEX_INVALID ){
eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].phr_info = (payload_ptr[0] & 0x3f);// - PHR_MAPPING_OFFSET;
LOG_D(MAC, "[eNB] MAC CE_LCID %d : Received PHR PH = %d (db)\n", rx_ces[i], eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].phr_info);
}
payload_ptr+=sizeof(POWER_HEADROOM_CMD);
break;
case CRNTI:
LOG_D(MAC, "[eNB] MAC CE_LCID %d : Received CRNTI %d \n", rx_ces[i], payload_ptr[0]);
payload_ptr+=1;
break;
case TRUNCATED_BSR:
case SHORT_BSR: {
uint8_t lcgid;
lcgid = (payload_ptr[0] >> 6);
LOG_D(MAC, "[eNB] MAC CE_LCID %d : Received short BSR LCGID = %u bsr = %d\n",
rx_ces[i], lcgid, payload_ptr[0] & 0x3f);
eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].bsr_info[lcgid] = (payload_ptr[0] & 0x3f);
payload_ptr += 1;//sizeof(SHORT_BSR); // fixme
} break;
case LONG_BSR:
eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].bsr_info[LCGID0] = ((payload_ptr[0] & 0xFC) >> 2);
eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].bsr_info[LCGID1] =
((payload_ptr[0] & 0x03) << 4) | ((payload_ptr[1] & 0xF0) >> 4);
eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].bsr_info[LCGID2] =
((payload_ptr[1] & 0x0F) << 2) | ((payload_ptr[2] & 0xC0) >> 6);
eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].bsr_info[LCGID3] = (payload_ptr[2] & 0x3F);
LOG_D(MAC, "[eNB] MAC CE_LCID %d: Received long BSR LCGID0 = %u LCGID1 = "
"%u LCGID2 = %u LCGID3 = %u\n",
rx_ces[i],
eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].bsr_info[LCGID0],
eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].bsr_info[LCGID1],
eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].bsr_info[LCGID2],
eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].bsr_info[LCGID3]);
payload_ptr += 3;////sizeof(LONG_BSR);
break;
default:
LOG_E(MAC, "[eNB] Received unknown MAC header (0x%02x)\n", rx_ces[i]);
break;
case TRUNCATED_BSR:
case SHORT_BSR: {
if (ue_mod_id != UE_INDEX_INVALID ){
uint8_t lcgid;
lcgid = (payload_ptr[0] >> 6);
LOG_D(MAC, "[eNB] MAC CE_LCID %d : Received short BSR LCGID = %u bsr = %d\n",
rx_ces[i], lcgid, payload_ptr[0] & 0x3f);
eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].bsr_info[lcgid] = (payload_ptr[0] & 0x3f);
}
payload_ptr += 1;//sizeof(SHORT_BSR); // fixme
} break;
case LONG_BSR:
if (ue_mod_id != UE_INDEX_INVALID ){
eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].bsr_info[LCGID0] = ((payload_ptr[0] & 0xFC) >> 2);
eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].bsr_info[LCGID1] =
((payload_ptr[0] & 0x03) << 4) | ((payload_ptr[1] & 0xF0) >> 4);
eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].bsr_info[LCGID2] =
((payload_ptr[1] & 0x0F) << 2) | ((payload_ptr[2] & 0xC0) >> 6);
eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].bsr_info[LCGID3] = (payload_ptr[2] & 0x3F);
LOG_D(MAC, "[eNB] MAC CE_LCID %d: Received long BSR LCGID0 = %u LCGID1 = "
"%u LCGID2 = %u LCGID3 = %u\n",
rx_ces[i],
eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].bsr_info[LCGID0],
eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].bsr_info[LCGID1],
eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].bsr_info[LCGID2],
eNB_mac_inst[enb_mod_idP].UE_template[ue_mod_id].bsr_info[LCGID3]);
}
payload_ptr += 3;////sizeof(LONG_BSR);
break;
default:
LOG_E(MAC, "[eNB] Received unknown MAC header (0x%02x)\n", rx_ces[i]);
break;
}
}
for (i=0;i<num_sdu;i++) {
LOG_D(MAC,"SDU Number %d MAC Subheader SDU_LCID %d, length %d\n",i,rx_lcids[i],rx_lengths[i]);
if ((rx_lcids[i] == DCCH)||(rx_lcids[i] == DCCH1)) {
// if(eNB_mac_inst[module_idP].Dcch_lchan[UE_id].Active==1){
LOG_D(MAC,"SDU Number %d MAC Subheader SDU_LCID %d, length %d\n",i,rx_lcids[i],rx_lengths[i]);
switch (rx_lcids[i]) {
case CCCH :
LOG_I(MAC,"[eNB %d][RAPROC] Frame %d, Received CCCH: %x.%x.%x.%x.%x.%x, Terminating RA procedure for UE rnti %x\n",
enb_mod_idP,frameP,
payload_ptr[0],payload_ptr[1],payload_ptr[2],payload_ptr[3],payload_ptr[4], payload_ptr[5], rntiP);
for (ii=0;ii<NB_RA_PROC_MAX;ii++) {
LOG_D(MAC,"[RAPROC] Checking proc %d : rnti (%x, %x), active %d\n",ii,
eNB_mac_inst[enb_mod_idP].RA_template[ii].rnti, rntiP,
eNB_mac_inst[enb_mod_idP].RA_template[ii].RA_active);
if ((eNB_mac_inst[enb_mod_idP].RA_template[ii].rnti==rntiP) &&
(eNB_mac_inst[enb_mod_idP].RA_template[ii].RA_active==TRUE)) {
//payload_ptr = parse_ulsch_header(msg3,&num_ce,&num_sdu,rx_ces,rx_lcids,rx_lengths,msg3_len);
if (ue_mod_id == UE_INDEX_INVALID) {
memcpy(&eNB_mac_inst[enb_mod_idP].RA_template[ii].cont_res_id[0],payload_ptr,6);
LOG_I(MAC,"[eNB %d][RAPROC] Frame %d CCCH: Received RRCConnectionRequest: length %d, offset %d\n",
enb_mod_idP,frameP,rx_lengths[ii],payload_ptr-sdu);
if ((ue_mod_id=add_new_ue(enb_mod_idP,eNB_mac_inst[enb_mod_idP].RA_template[ii].rnti)) == -1 )
mac_xface->macphy_exit("[MAC][eNB] Max user count reached\n");
else
LOG_I(MAC,"[eNB %d][RAPROC] Frame %d Added user with rnti %x => UE %d\n",
enb_mod_idP,frameP,eNB_mac_inst[enb_mod_idP].RA_template[ii].rnti,ue_mod_id);
} else {
LOG_I(MAC,"[eNB %d][RAPROC] Frame %d CCCH: Received RRCConnectionReestablishment from UE %d: length %d, offset %d\n",
enb_mod_idP,frameP,ue_mod_id,rx_lengths[ii],payload_ptr-sdu);
}
if (Is_rrc_registered == 1)
mac_rrc_data_ind(enb_mod_idP,frameP,CCCH,(uint8_t *)payload_ptr,rx_lengths[ii],1,enb_mod_idP,0);
if (num_ce >0) { // handle msg3 which is not RRCConnectionRequest
// process_ra_message(msg3,num_ce,rx_lcids,rx_ces);
}
eNB_mac_inst[enb_mod_idP].RA_template[ii].generate_Msg4 = 1;
eNB_mac_inst[enb_mod_idP].RA_template[ii].wait_ack_Msg4 = 0;
} // if process is active
} // loop on RA processes
break;
case DCCH :
case DCCH1 :
// if(eNB_mac_inst[module_idP].Dcch_lchan[UE_id].Active==1){
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
LOG_T(MAC,"offset: %d\n",(unsigned char)((unsigned char*)payload_ptr-sdu));
for (j=0;j<32;j++)
LOG_T(MAC,"%x ",payload_ptr[j]);
LOG_T(MAC,"\n");
LOG_T(MAC,"offset: %d\n",(unsigned char)((unsigned char*)payload_ptr-sdu));
for (j=0;j<32;j++)
LOG_T(MAC,"%x ",payload_ptr[j]);
LOG_T(MAC,"\n");
#endif
// This check is just to make sure we didn't get a bogus SDU length, to be removed ...
if (rx_lengths[i]<CCCH_PAYLOAD_SIZE_MAX) {
LOG_D(MAC,"[eNB %d] Frame %d : ULSCH -> UL-DCCH, received %d bytes form UE %d on LCID %d(%d) \n",
enb_mod_idP,frameP, rx_lengths[i], ue_mod_id, rx_lcids[i], rx_lcids[i]);
mac_rlc_data_ind(enb_mod_idP,ue_mod_id, frameP,ENB_FLAG_YES,MBMS_FLAG_NO,
rx_lcids[i],
(char *)payload_ptr,
rx_lengths[i],
1,
NULL);//(unsigned int*)crc_status);
eNB_mac_inst[enb_mod_idP].eNB_UE_stats[ue_mod_id].num_pdu_rx[rx_lcids[i]]+=1;
eNB_mac_inst[enb_mod_idP].eNB_UE_stats[ue_mod_id].num_bytes_rx[rx_lcids[i]]+=rx_lengths[i];
}
// }
} else if (rx_lcids[i] >= DTCH) {
// if(eNB_mac_inst[module_idP].Dcch_lchan[UE_id].Active==1){
// This check is just to make sure we didn't get a bogus SDU length, to be removed ...
if (rx_lengths[i]<CCCH_PAYLOAD_SIZE_MAX) {
LOG_D(MAC,"[eNB %d] Frame %d : ULSCH -> UL-DCCH, received %d bytes form UE %d on LCID %d(%d) \n",
enb_mod_idP,frameP, rx_lengths[i], ue_mod_id, rx_lcids[i], rx_lcids[i]);
mac_rlc_data_ind(enb_mod_idP,ue_mod_id, frameP,ENB_FLAG_YES,MBMS_FLAG_NO,
rx_lcids[i],
(char *)payload_ptr,
rx_lengths[i],
1,
NULL);//(unsigned int*)crc_status);
eNB_mac_inst[enb_mod_idP].eNB_UE_stats[ue_mod_id].num_pdu_rx[rx_lcids[i]]+=1;
eNB_mac_inst[enb_mod_idP].eNB_UE_stats[ue_mod_id].num_bytes_rx[rx_lcids[i]]+=rx_lengths[i];
}
// }
break;
case DTCH: // default DRB
// if(eNB_mac_inst[module_idP].Dcch_lchan[UE_id].Active==1){
#if defined(ENABLE_MAC_PAYLOAD_DEBUG)
LOG_T(MAC,"offset: %d\n",(unsigned char)((unsigned char*)payload_ptr-sdu));
for (j=0;j<32;j++)
LOG_T(MAC,"%x ",payload_ptr[j]);
LOG_T(MAC,"\n");
LOG_T(MAC,"offset: %d\n",(unsigned char)((unsigned char*)payload_ptr-sdu));
for (j=0;j<32;j++)
LOG_T(MAC,"%x ",payload_ptr[j]);
LOG_T(MAC,"\n");
#endif
LOG_D(MAC,"[eNB %d] Frame %d : ULSCH -> UL-DTCH, received %d bytes from UE %d for lcid %d (%d)\n",
enb_mod_idP,frameP, rx_lengths[i], ue_mod_id,rx_lcids[i],rx_lcids[i]);
if ((rx_lengths[i] <SCH_PAYLOAD_SIZE_MAX) && (rx_lengths[i] > 0) ) { // MAX SIZE OF transport block
mac_rlc_data_ind(enb_mod_idP,ue_mod_id, frameP,ENB_FLAG_YES,MBMS_FLAG_NO,
DTCH,
(char *)payload_ptr,
rx_lengths[i],
1,
NULL);//(unsigned int*)crc_status);
eNB_mac_inst[enb_mod_idP].eNB_UE_stats[ue_mod_id].num_pdu_rx[rx_lcids[i]]+=1;
eNB_mac_inst[enb_mod_idP].eNB_UE_stats[ue_mod_id].num_bytes_rx[rx_lcids[i]]+=rx_lengths[i];
}
// }
} else {
eNB_mac_inst[enb_mod_idP].eNB_UE_stats[ue_mod_id].num_errors_rx+=1;
LOG_E(MAC,"[eNB %d] received unknown LCID %d from UE %d ", rx_lcids[i], ue_mod_id);
LOG_D(MAC,"[eNB %d] Frame %d : ULSCH -> UL-DTCH, received %d bytes from UE %d for lcid %d (%d)\n",
enb_mod_idP,frameP, rx_lengths[i], ue_mod_id,rx_lcids[i],rx_lcids[i]);
if ((rx_lengths[i] <SCH_PAYLOAD_SIZE_MAX) && (rx_lengths[i] > 0) ) { // MAX SIZE OF transport block
mac_rlc_data_ind(enb_mod_idP,ue_mod_id, frameP,ENB_FLAG_YES,MBMS_FLAG_NO,
DTCH,
(char *)payload_ptr,
rx_lengths[i],
1,
NULL);//(unsigned int*)crc_status);
eNB_mac_inst[enb_mod_idP].eNB_UE_stats[ue_mod_id].num_pdu_rx[rx_lcids[i]]+=1;
eNB_mac_inst[enb_mod_idP].eNB_UE_stats[ue_mod_id].num_bytes_rx[rx_lcids[i]]+=rx_lengths[i];
}
payload_ptr+=rx_lengths[i];
// }
break;
default : //if (rx_lcids[i] >= DTCH) {
eNB_mac_inst[enb_mod_idP].eNB_UE_stats[ue_mod_id].num_errors_rx+=1;
LOG_E(MAC,"[eNB %d] received unsupported or unknown LCID %d from UE %d ", rx_lcids[i], ue_mod_id);
break;
}
payload_ptr+=rx_lengths[i];
}
eNB_mac_inst[enb_mod_idP].eNB_UE_stats[ue_mod_id].total_pdu_bytes_rx+=sdu_len;
eNB_mac_inst[enb_mod_idP].eNB_UE_stats[ue_mod_id].total_num_pdus_rx+=1;
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_RX_SDU,0);
stop_meas(&eNB_mac_inst[enb_mod_idP].rx_ulsch_sdu);
}
......@@ -1625,7 +1681,7 @@ void schedule_RA(module_id_t module_idP,frame_t frameP, sub_frame_t subframeP,un
unsigned char i;//,harq_pid,round;
uint16_t rrc_sdu_length;
unsigned char lcid,offset;
int8_t UE_id;
module_id_t UE_id= UE_INDEX_INVALID;
unsigned short TBsize = -1;
unsigned short msg4_padding,msg4_post_padding,msg4_header;
......
......@@ -69,7 +69,7 @@ typedef struct
// eNB functions
/// Invoke dlsch/ulsch scheduling procedure for new subframe
void (*eNB_dlsch_ulsch_scheduler)(module_id_t Mod_id, uint8_t cooperation_flag, frame_t frameP, uint8_t subframe);//, int calibration_flag);
void (*eNB_dlsch_ulsch_scheduler)(module_id_t Mod_id, uint8_t cooperation_flag, frame_t frameP, sub_frame_t subframeP);//, int calibration_flag);
/// Fill random access response sdu, passing timing advance
uint16_t (*fill_rar)(module_id_t Mod_id,frame_t frameP,uint8_t *dlsch_buffer,uint16_t N_RB_UL, uint8_t input_buffer_length);
......@@ -84,7 +84,7 @@ typedef struct
void (*cancel_ra_proc)(module_id_t Mod_id,frame_t frameP,uint16_t preamble);
/// Get DCI for current subframe from MAC
DCI_PDU* (*get_dci_sdu)(module_id_t Mod_id,frame_t frameP,uint8_t subframe);
DCI_PDU* (*get_dci_sdu)(module_id_t Mod_id,frame_t frameP,sub_frame_t subframe);
/// Get DLSCH sdu for particular RNTI and Transport block index
uint8_t* (*get_dlsch_sdu)(module_id_t Mod_id,frame_t frameP,rnti_t rnti,uint8_t TB_index);
......@@ -96,7 +96,7 @@ typedef struct
void (*mrbch_phy_sync_failure) (module_id_t Mod_id,frame_t frameP, uint8_t free_eNB_index);
/// Indicate Scheduling Request from UE
void (*SR_indication)(module_id_t Mod_id,frame_t frameP,rnti_t rnti,uint8_t subframe);
void (*SR_indication)(module_id_t Mod_id,frame_t frameP,rnti_t rnti,sub_frame_t subframe);
/// Configure Common PHY parameters from SIB1
void (*phy_config_sib1_eNB)(module_id_t Mod_id,
......@@ -124,7 +124,7 @@ typedef struct
#ifdef Rel10
/// Get MCH sdu and corresponding MCS for particular MBSFN subframe
MCH_PDU* (*get_mch_sdu)(module_id_t Mod_id,frame_t frameP,uint32_t subframe);
MCH_PDU* (*get_mch_sdu)(module_id_t Mod_id,frame_t frameP,sub_frame_t subframe);
#endif
// configure the cba rnti at the physical layer
void (*phy_config_cba_rnti)(module_id_t Mod_id,eNB_flag_t eNB_flag, uint8_t index, uint16_t cba_rnti, uint8_t cba_group_id, uint8_t num_active_cba_groups);
......@@ -149,26 +149,26 @@ typedef struct
/// Function to check if UE PHY needs to decode MCH for MAC
/// get the sync area id, and teturn MCS value if need to decode, otherwise -1
int (*ue_query_mch)(module_id_t Mod_id,frame_t frameP,uint32_t subframe,uint8_t eNB_index,uint8_t *sync_area, uint8_t *mcch_active);
int (*ue_query_mch)(module_id_t Mod_id,frame_t frameP,sub_frame_t subframe,uint8_t eNB_index,uint8_t *sync_area, uint8_t *mcch_active);
#endif
/// Retrieve ULSCH sdu from MAC
void (*ue_get_sdu)(module_id_t Mod_id,frame_t frameP,uint8_t subframe, uint8_t CH_index,uint8_t *ulsch_buffer,uint16_t buflen,uint8_t *access_mode);
void (*ue_get_sdu)(module_id_t Mod_id,frame_t frameP,sub_frame_t subframe, uint8_t CH_index,uint8_t *ulsch_buffer,uint16_t buflen,uint8_t *access_mode);
/// Retrieve RRCConnectionReq from MAC
PRACH_RESOURCES_t* (*ue_get_rach)(module_id_t Mod_id,frame_t frameP,uint8_t Msg3_flag,uint8_t subframe);
PRACH_RESOURCES_t* (*ue_get_rach)(module_id_t Mod_id,frame_t frameP,uint8_t Msg3_flag,sub_frame_t subframe);
/// Process Random-Access Response
uint16_t (*ue_process_rar)(module_id_t Mod_id,frame_t frameP,uint8_t *dlsch_buffer,uint16_t *t_crnti,uint8_t preamble_index);
/// Get SR payload (0,1) from UE MAC
uint32_t (*ue_get_SR)(module_id_t Mod_id,frame_t frameP,uint8_t eNB_id,rnti_t rnti,uint8_t subframe);
uint32_t (*ue_get_SR)(module_id_t Mod_id,frame_t frameP,uint8_t eNB_id,rnti_t rnti,sub_frame_t subframe);
/// Indicate synchronization with valid PBCH
void (*dl_phy_sync_success) (module_id_t Mod_id,frame_t frameP, uint8_t CH_index,uint8_t first_sync);
/// Only calls the PDCP for now
UE_L2_STATE_t (*ue_scheduler)(module_id_t Mod_id, frame_t frameP,uint8_t subframe, lte_subframe_t direction,uint8_t eNB_id);
UE_L2_STATE_t (*ue_scheduler)(module_id_t Mod_id, frame_t frameP,sub_frame_t subframe, lte_subframe_t direction,uint8_t eNB_id);
/// PHY-Config-Dedicated UE
void (*phy_config_dedicated_ue)(module_id_t Mod_id,uint8_t CH_index,
......
......@@ -65,6 +65,7 @@
#include "RRCConnectionSetup.h"
#include "RRCConnectionSetupComplete.h"
#include "RRCConnectionRequest.h"
#include "RRCConnectionReestablishmentRequest.h"
#include "BCCH-DL-SCH-Message.h"
#include "BCCH-BCH-Message.h"
#ifdef Rel10
......@@ -197,6 +198,11 @@ typedef struct eNB_RRC_UE_INFO_s {
UE_S_TMSI Initialue_identity_s_TMSI;
EstablishmentCause_t establishment_cause;
/* Information from UE RRC ConnectionReestablishmentRequest */
ReestablishmentCause_t reestablishment_cause;
/* UE id for initial connection to S1AP */
uint16_t ue_initial_id;
......
......@@ -357,8 +357,7 @@ RRC_status_t rrc_rx_tx(uint8_t Mod_id, const frame_t frameP, const eNB_flag_t eN
}
if ((UE_rrc_inst[Mod_id].Info[index].T310_cnt % 10) == 0)
LOG_D(RRC, "[UE %d] Frame %d T310 Count %d ms\n", Mod_id, frameP, UE_rrc_inst[Mod_id].Info[index].T310_cnt);
if (UE_rrc_inst[Mod_id].Info[index].T310_cnt
== T310[UE_rrc_inst[Mod_id].sib2[index]->ue_TimersAndConstants.t310]) {
if (UE_rrc_inst[Mod_id].Info[index].T310_cnt == T310[UE_rrc_inst[Mod_id].sib2[index]->ue_TimersAndConstants.t310]) {
UE_rrc_inst[Mod_id].Info[index].T310_active = 0;
rrc_t310_expiration (frameP, Mod_id, index);
return (RRC_PHY_RESYNCH);
......
......@@ -48,6 +48,8 @@
#include "COMMON/mac_rrc_primitives.h"
#include "RRC/LITE/MESSAGES/asn1_msg.h"
#include "RRCConnectionRequest.h"
#include "RRCConnectionReestablishmentRequest.h"
//#include "ReestablishmentCause.h"
#include "UL-CCCH-Message.h"
#include "DL-CCCH-Message.h"
#include "UL-DCCH-Message.h"
......@@ -461,6 +463,30 @@ uint8_t rrc_eNB_get_next_transaction_identifier(
/*------------------------------------------------------------------------------*/
/* Functions to handle UE index in eNB UE list */
static module_id_t rrc_eNB_get_UE_index(
module_id_t enb_mod_idP,
uint64_t UE_identity) {
boolean_t reg = FALSE;
module_id_t i;
AssertFatal(enb_mod_idP < NB_eNB_INST, "eNB index invalid (%d/%d)!", enb_mod_idP, NB_eNB_INST);
for (i = 0; i < NUMBER_OF_UE_MAX; i++) {
if (eNB_rrc_inst[enb_mod_idP].Info.UE_list[i] == UE_identity) {
// UE_identity already registered
reg = TRUE;
break;
}
}
if (reg == FALSE) {
return (UE_MODULE_INVALID);
} else
return (i);
}
static module_id_t rrc_eNB_get_next_free_UE_index(
module_id_t enb_mod_idP,
uint64_t UE_identity) {
......@@ -472,21 +498,20 @@ static module_id_t rrc_eNB_get_next_free_UE_index(
for (i = 0; i < NUMBER_OF_UE_MAX; i++) {
if ((first_index == UE_MODULE_INVALID) && (eNB_rrc_inst[enb_mod_idP].Info.UE_list[i] == 0)) {
first_index = i; // save first free position
first_index = i; // save first free position
}
if (eNB_rrc_inst[enb_mod_idP].Info.UE_list[i] == UE_identity) {
// UE_identity already registered
reg = TRUE;
reg = TRUE;
}
}
if (reg == 0) {
LOG_I(RRC, "[eNB %d] Adding UE %d with identity " PRIu64 "\n", enb_mod_idP, first_index, UE_identity);
return (first_index);
} else {
return (UE_MODULE_INVALID);
}
LOG_I(RRC, "[eNB %d] Adding UE %d with identity " PRIu64 "\n", enb_mod_idP, first_index, UE_identity);
return (first_index);
} else
return (UE_MODULE_INVALID);
}
void rrc_eNB_free_UE_index(
......@@ -2613,6 +2638,7 @@ int rrc_eNB_decode_ccch(
asn_dec_rval_t dec_rval;
UL_CCCH_Message_t *ul_ccch_msg = NULL;
RRCConnectionRequest_r8_IEs_t *rrcConnectionRequest;
RRCConnectionReestablishmentRequest_r8_IEs_t *rrcConnectionReestablishmentRequest;
int i, rval;
//memset(ul_ccch_msg,0,sizeof(UL_CCCH_Message_t));
......@@ -2672,13 +2698,40 @@ int rrc_eNB_decode_ccch(
break;
case UL_CCCH_MessageType__c1_PR_rrcConnectionReestablishmentRequest:
#ifdef RRC_MSG_PRINT
LOG_F(RRC, "RRC Connection Reestablishement Request\n");
for (i = 0; i < Srb_info->Rx_buffer.payload_size; i++)
LOG_F(RRC,"%02x ", ((uint8_t*)Srb_info->Rx_buffer.Payload)[i]);
LOG_F(RRC,"\n");
#endif
LOG_D(RRC,
"[FRAME %05d][MAC_eNB][MOD %02d][][--- MAC_DATA_IND (rrcConnectionReestablishmentRequest on SRB0) -->][RRC_eNB][MOD %02d][]\n",
frameP, enb_mod_idP, enb_mod_idP);
LOG_I(RRC, "[eNB %d] Frame %d : RRCConnectionReestablishmentRequest not supported yet\n", enb_mod_idP,
frameP);
break;
rrcConnectionReestablishmentRequest = &ul_ccch_msg->message.choice.c1.choice.rrcConnectionReestablishmentRequest.criticalExtensions.choice.rrcConnectionReestablishmentRequest_r8;
LOG_I(RRC, "[eNB %d] Frame %d UE %d: RRCConnectionReestablishmentRequest cause %s\n", enb_mod_idP,
frameP,