Commit f446a5ea authored by Florian Kaltenberger's avatar Florian Kaltenberger

Merge branch 'develop' into feature-21-TM7

parents e450941f c3c3f274
......@@ -65,6 +65,14 @@ ID = ENB_PHY_PHICH
DESC = eNodeB PHICH
GROUP = ALL:PHY:ENB
FORMAT = int,eNB_ID : int,frame : int,subframe : int,UE_id : int,rnti : int,harq_pid : int,NGROUP : int,NSF : int,ngroup : int,nseq : int,ACK : int,first_rb : int,n_DMRS
ID = ENB_PHY_MSG3_ALLOCATION
DESC = eNodeB Msg3 allocation/reallocation
GROUP = ALL:PHY:ENB
FORMAT = int,eNB_ID : int,frame : int,subframe : int,UE_id : int,rnti : int,first_transmission : int,Msg3_frame : int,Msg3_subframe
ID = ENB_PHY_INITIATE_RA_PROCEDURE
DESC = eNodeB initiates a random access procedure after detecting enough energy for one of the preambles
GROUP = ALL:PHY:ENB
FORMAT = int,eNB_ID : int,frame : int,subframe : int,UE_id : int,preamble : int,energy : int,delay
#MAC logs
ID = ENB_MAC_UE_DL_SDU
......@@ -74,7 +82,7 @@ ID = ENB_MAC_UE_DL_SDU
ID = ENB_MAC_UE_UL_SCHEDULE
DESC = MAC uplink UE scheduling decision
GROUP = ALL:MAC:ENB
FORMAT = int,eNB_ID : int,CC_id : int,rnti : int,frame : int,subframe : int,harq_pid : int,mcs : int,first_rb : int,nb_rb : int,TBS
FORMAT = int,eNB_ID : int,CC_id : int,rnti : int,frame : int,subframe : int,harq_pid : int,mcs : int,first_rb : int,nb_rb : int,TBS : int,ndi
ID = ENB_MAC_UE_UL_SCHEDULE_RETRANSMISSION
DESC = MAC uplink UE scheduling retransmission decision
GROUP = ALL:MAC:ENB
......
......@@ -177,7 +177,7 @@ void usage(void)
printf(
"options:\n"
" -d <database file> this option is mandatory\n"
" -in <dump file> read events from this dump file\n"
" -i <dump file> read events from this dump file\n"
" -ip <IP address> send packets to this IP address (default %s)\n"
" -p <port> send packets to this port (default %d)\n",
DEFAULT_IP,
......@@ -205,7 +205,7 @@ int main(int n, char **v)
if (!strcmp(v[i], "-h") || !strcmp(v[i], "--help")) usage();
if (!strcmp(v[i], "-d"))
{ if (i > n-2) usage(); database_filename = v[++i]; continue; }
if (!strcmp(v[i], "-in"))
if (!strcmp(v[i], "-i"))
{ if (i > n-2) usage(); input_filename = v[++i]; continue; }
if (!strcmp(v[i], "-ip")) { if (i > n-2) usage(); ip = v[++i]; continue; }
if (!strcmp(v[i], "-p")) {if(i>n-2)usage(); port=atoi(v[++i]); continue; }
......
......@@ -486,7 +486,7 @@ void compute_beta8(llr_t* alpha,llr_t* beta,llr_t *m_11,llr_t* m_10,unsigned sho
#endif
if (frame_length > 6143) {
if (frame_length > 6144) {
LOG_E(PHY,"compute_beta: frame_length %d\n",frame_length);
return;
}
......
......@@ -449,7 +449,7 @@ int ulsch_decoding_data_2thread(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr
int16_t dummy_w[MAX_NUM_ULSCH_SEGMENTS][3*(6144+64)];
LTE_eNB_ULSCH_t *ulsch = eNB->ulsch[UE_id];
LTE_UL_eNB_HARQ_t *ulsch_harq = ulsch->harq_processes[harq_pid];
int Q_m = get_Qm_ul(ulsch_harq->mcs);
//int Q_m = get_Qm_ul(ulsch_harq->mcs);
int G = ulsch_harq->G;
unsigned int E;
int Cby2;
......@@ -657,7 +657,7 @@ int ulsch_decoding_data(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr8_flag)
int16_t dummy_w[MAX_NUM_ULSCH_SEGMENTS][3*(6144+64)];
LTE_eNB_ULSCH_t *ulsch = eNB->ulsch[UE_id];
LTE_UL_eNB_HARQ_t *ulsch_harq = ulsch->harq_processes[harq_pid];
int Q_m = get_Qm_ul(ulsch_harq->mcs);
//int Q_m = get_Qm_ul(ulsch_harq->mcs);
int G = ulsch_harq->G;
unsigned int E;
......@@ -1533,6 +1533,7 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,
// CQI
// printf("before cqi c[%d] = %p\n",0,ulsch_harq->c[0]);
ulsch_harq->cqi_crc_status = 0;
if (Q_CQI>0) {
memset((void *)&dummy_w_cc[0],0,3*(ulsch_harq->Or1+8+32));
......@@ -1555,9 +1556,6 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,
if (extract_cqi_crc(o_flip,ulsch_harq->Or1) == (crc8(o_flip,ulsch_harq->Or1)>>24))
ulsch_harq->cqi_crc_status = 1;
else
ulsch_harq->cqi_crc_status = 0;
if (ulsch->harq_processes[harq_pid]->Or1<=32) {
ulsch_harq->o[3] = o_flip[0] ;
......
......@@ -70,6 +70,7 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
case 5:
DCI_pdu->Num_common_dci = 1;
DCI_pdu->dci_alloc[0].L = 2;
DCI_pdu->dci_alloc[0].firstCCE = 0;
DCI_pdu->dci_alloc[0].rnti = SI_RNTI;
DCI_pdu->dci_alloc[0].format = format1A;
DCI_pdu->dci_alloc[0].ra_flag = 0;
......@@ -212,6 +213,7 @@ void fill_dci(DCI_PDU *DCI_pdu,PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
case 7:
DCI_pdu->Num_ue_spec_dci = 1;
DCI_pdu->dci_alloc[0].L = 2;
DCI_pdu->dci_alloc[0].firstCCE = 0;
DCI_pdu->dci_alloc[0].rnti = 0x1235;
DCI_pdu->dci_alloc[0].format = format1;
DCI_pdu->dci_alloc[0].ra_flag = 0;
......
......@@ -977,6 +977,22 @@ void pdsch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,LTE_eNB_DLSCH_t *d
UE_id,
eNB->ulsch[(uint32_t)UE_id]->Msg3_frame,
eNB->ulsch[(uint32_t)UE_id]->Msg3_subframe);
/* TODO: get rid of this hack. The problem is that the eNodeB may
* sometimes wrongly generate PHICH because somewhere 'phich_active' was
* not reset to 0, due to an unidentified reason. When adding this
* resetting here the problem seems to disappear completely.
*/
LOG_D(PHY, "hack: set phich_active to 0 for UE %d fsf %d %d all HARQs\n", UE_id, frame, subframe);
for (i = 0; i < 8; i++)
eNB->ulsch[(uint32_t)UE_id]->harq_processes[i]->phich_active = 0;
mac_xface->set_msg3_subframe(eNB->Mod_id, eNB->CC_id, frame, subframe, (uint16_t)crnti,
eNB->ulsch[UE_id]->Msg3_frame, eNB->ulsch[UE_id]->Msg3_subframe);
T(T_ENB_PHY_MSG3_ALLOCATION, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe),
T_INT(UE_id), T_INT((uint16_t)crnti), T_INT(1 /* 1 is for initial transmission*/),
T_INT(eNB->ulsch[UE_id]->Msg3_frame), T_INT(eNB->ulsch[UE_id]->Msg3_subframe));
}
if (ue_stats) ue_stats->total_TBS_MAC += dlsch_harq->TBS;
}
......@@ -1970,6 +1986,9 @@ void prach_procedures(PHY_VARS_eNB *eNB) {
preamble_energy_max%10,
preamble_delay_list[preamble_max]);
T(T_ENB_PHY_INITIATE_RA_PROCEDURE, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe), T_INT(UE_id),
T_INT(preamble_max), T_INT(preamble_energy_max), T_INT(preamble_delay_list[preamble_max]));
if (eNB->mac_enabled==1) {
uint8_t update_TA=4;
......@@ -3070,6 +3089,13 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,const
frame,
&eNB->ulsch[i]->Msg3_frame,
&eNB->ulsch[i]->Msg3_subframe);
mac_xface->set_msg3_subframe(eNB->Mod_id, eNB->CC_id, frame, subframe, eNB->ulsch[i]->rnti,
eNB->ulsch[i]->Msg3_frame, eNB->ulsch[i]->Msg3_subframe);
T(T_ENB_PHY_MSG3_ALLOCATION, T_INT(eNB->Mod_id), T_INT(frame), T_INT(subframe),
T_INT(i), T_INT(eNB->ulsch[i]->rnti), T_INT(0 /* 0 is for retransmission*/),
T_INT(eNB->ulsch[i]->Msg3_frame), T_INT(eNB->ulsch[i]->Msg3_subframe));
}
LOG_D(PHY,"[eNB] Frame %d, Subframe %d: Msg3 in error, i = %d \n", frame,subframe,i);
} // This is Msg3 error
......
......@@ -259,7 +259,8 @@ void schedule_RA(module_id_t module_idP,frame_t frameP, sub_frame_t subframeP,un
RA_template->RA_dci_fmt1,
1);
RA_template->Msg3_subframe=Msg3_subframe;
/* this will be updated when PHY calls set_msg3_subframe */
RA_template->Msg3_subframe = -1;
}
} else if (RA_template->generate_Msg4 == 1) {
......
......@@ -601,6 +601,29 @@ unsigned char *parse_ulsch_header(unsigned char *mac_header,
return(mac_header_ptr);
}
/* This function is called by PHY layer when it schedules some
* uplink for a random access message 3.
* The MAC scheduler has to skip the RBs used by this message 3
* (done below in schedule_ulsch).
*/
void set_msg3_subframe(module_id_t Mod_id,
int CC_id,
int frame,
int subframe,
int rnti,
int Msg3_frame,
int Msg3_subframe)
{
eNB_MAC_INST *eNB=&eNB_mac_inst[Mod_id];
int i;
for (i=0; i<NB_RA_PROC_MAX; i++) {
if (eNB->common_channels[CC_id].RA_template[i].RA_active == TRUE &&
eNB->common_channels[CC_id].RA_template[i].rnti == rnti) {
eNB->common_channels[CC_id].RA_template[i].Msg3_subframe = Msg3_subframe;
break;
}
}
}
void schedule_ulsch(module_id_t module_idP,
frame_t frameP,
......@@ -619,6 +642,7 @@ void schedule_ulsch(module_id_t module_idP,
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
//leave out first RB for PUCCH
first_rb[CC_id] = 1;
// UE data info;
......@@ -637,9 +661,11 @@ void schedule_ulsch(module_id_t module_idP,
for (i=0; i<NB_RA_PROC_MAX; i++) {
if ((eNB->common_channels[CC_id].RA_template[i].RA_active == TRUE) &&
(eNB->common_channels[CC_id].RA_template[i].generate_rar == 0) &&
(eNB->common_channels[CC_id].RA_template[i].generate_Msg4 == 0) &&
(eNB->common_channels[CC_id].RA_template[i].wait_ack_Msg4 == 0) &&
(eNB->common_channels[CC_id].RA_template[i].Msg3_subframe == sched_subframe)) {
//leave out first RB for PUCCH
first_rb[CC_id]++;
eNB->common_channels[CC_id].RA_template[i].Msg3_subframe = -1;
break;
}
}
......@@ -854,7 +880,7 @@ void schedule_ulsch_rnti(module_id_t module_idP,
T(T_ENB_MAC_UE_UL_SCHEDULE, T_INT(module_idP), T_INT(CC_id), T_INT(rnti), T_INT(frameP),
T_INT(subframeP), T_INT(harq_pid), T_INT(mcs), T_INT(first_rb[CC_id]), T_INT(rb_table[rb_table_index]),
T_INT(TBS));
T_INT(TBS), T_INT(ndi));
// bad indices : 20 (40 PRB), 21 (45 PRB), 22 (48 PRB)
// increment for next UE allocation
......
......@@ -454,6 +454,7 @@ int l2_init(LTE_DL_FRAME_PARMS *frame_parms,int eMBMS_active, char *uecap_xer,ui
mac_xface->fill_rar = fill_rar;
mac_xface->initiate_ra_proc = initiate_ra_proc;
mac_xface->cancel_ra_proc = cancel_ra_proc;
mac_xface->set_msg3_subframe = set_msg3_subframe;
mac_xface->SR_indication = SR_indication;
mac_xface->UL_failure_indication = UL_failure_indication;
mac_xface->rx_sdu = rx_sdu;
......
......@@ -246,6 +246,25 @@ unsigned short fill_rar(
*/
void cancel_ra_proc(module_id_t module_idP,int CC_id,frame_t frameP, uint16_t preamble_index);
/* \brief Function used by PHY to inform MAC that an uplink is scheduled
for Msg3 in given subframe. This is used so that the MAC
scheduler marks as busy the RBs used by the Msg3.
@param Mod_id Instance ID of eNB
@param CC_id CC ID of eNB
@param frame current frame
@param subframe current subframe
@param rnti UE rnti concerned
@param Msg3_frame frame where scheduling takes place
@param Msg3_subframe subframe where scheduling takes place
*/
void set_msg3_subframe(module_id_t Mod_id,
int CC_id,
int frame,
int subframe,
int rnti,
int Msg3_frame,
int Msg3_subframe);
/* \brief Function to indicate a received SDU on ULSCH.
@param Mod_id Instance ID of eNB
@param rnti RNTI of UE transmitting the SR
......
......@@ -72,6 +72,16 @@ typedef struct {
/// cancel an ongoing RA procedure
void (*cancel_ra_proc)(module_id_t Mod_id,int CC_id,frame_t frameP,uint16_t preamble);
/// Inform MAC layer that an uplink is scheduled for Msg3 in given subframe.
/// This is used so that the MAC scheduler marks as busy the RBs used by the Msg3.
void (*set_msg3_subframe)(module_id_t Mod_id,
int CC_id,
int frame,
int subframe,
int rnti,
int Msg3_frame,
int Msg3_subframe);
/// Get DCI for current subframe from MAC
DCI_PDU* (*get_dci_sdu)(module_id_t Mod_id,int CC_id,frame_t frameP,sub_frame_t subframe);
......
......@@ -1601,6 +1601,11 @@ int main( int argc, char **argv )
PHY_vars_eNB_g[0][CC_id] = init_lte_eNB(frame_parms[CC_id],0,frame_parms[CC_id]->Nid_cell,abstraction_flag);
PHY_vars_eNB_g[0][CC_id]->CC_id = CC_id;
PHY_vars_eNB_g[0][CC_id]->ue_dl_rb_alloc=0x1fff;
PHY_vars_eNB_g[0][CC_id]->target_ue_dl_mcs=target_dl_mcs;
PHY_vars_eNB_g[0][CC_id]->ue_ul_nb_rb=6;
PHY_vars_eNB_g[0][CC_id]->target_ue_ul_mcs=target_ul_mcs;
if (phy_test==1) PHY_vars_eNB_g[0][CC_id]->mac_enabled = 0;
else PHY_vars_eNB_g[0][CC_id]->mac_enabled = 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment