Commit 70f6f90b authored by Florian Kaltenberger's avatar Florian Kaltenberger

added TM3 scheduling for two two transports blocks to MAC and PHY. So far only...

added TM3 scheduling for two two transports blocks to MAC and PHY. So far only regression working with 1 TB.
parent bd173433
......@@ -2830,7 +2830,6 @@ int generate_eNB_dlsch_params_from_dci(int frame,
int dump_dci(LTE_DL_FRAME_PARMS *frame_parms, DCI_ALLOC_t *dci)
{
switch (dci->format) {
case format0: // This is an UL SCH allocation so nothing here, inform MAC
......@@ -3044,7 +3043,7 @@ int dump_dci(LTE_DL_FRAME_PARMS *frame_parms, DCI_ALLOC_t *dci)
break;
case 25:
LOG_D(PHY,"DCI format1 (FDD, 5 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d, harq_pid %d, ndi %d, RV %d, TPC %d\n",
LOG_I(PHY,"DCI format1 (FDD, 5 MHz), rnti %x (%x): rah %d, rb_alloc %x, mcs %d, harq_pid %d, ndi %d, RV %d, TPC %d\n",
dci->rnti,
((uint32_t*)&dci->dci_pdu)[0],
((DCI1_5MHz_FDD_t *)&dci->dci_pdu[0])->rah,
......@@ -3772,7 +3771,7 @@ int dump_dci(LTE_DL_FRAME_PARMS *frame_parms, DCI_ALLOC_t *dci)
break;
case 25:
LOG_D(PHY,"DCI format2A 2 antennas (FDD, 5 MHz), rnti %x (%"PRIu64"): rah %d, rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, tb_swap %d, TPC %d\n",
LOG_I(PHY,"DCI format2A 2 antennas (FDD, 5 MHz), rnti %x (%"PRIu64"): rah %d, rb_alloc %x, mcs1 %d, mcs2 %d, harq_pid %d, ndi1 %d, ndi2 %d, RV1 %d, RV2 %d, tb_swap %d, TPC %d\n",
dci->rnti,
((uint64_t*)&dci->dci_pdu)[0],
((DCI2A_5MHz_2A_FDD_t *)&dci->dci_pdu[0])->rah,
......
......@@ -112,7 +112,7 @@ uint32_t get_TBS_DL(uint8_t mcs, uint16_t nb_rb)
uint32_t TBS;
if ((nb_rb > 0) && (mcs < 29)) {
if ((nb_rb > 0) && (mcs>=0) && (mcs < 29)) {
#ifdef TBS_FIX
TBS = 3*TBStable[get_I_TBS(mcs)][nb_rb-1]/4;
TBS = TBS>>3;
......@@ -131,7 +131,7 @@ uint32_t get_TBS_UL(uint8_t mcs, uint16_t nb_rb)
uint32_t TBS = 0;
if ((nb_rb > 0) && (mcs < 29)) {
if ((nb_rb > 0) && (mcs>=0) && (mcs < 29)) {
#ifdef TBS_FIX
TBS = 3*TBStable[get_I_TBS_UL(mcs)][nb_rb-1]/4;
TBS = TBS>>3;
......
......@@ -652,9 +652,11 @@ int dump_eNB_stats(PHY_VARS_eNB *eNB, char* buffer, int length)
len += sprintf(&buffer[len],"\n");
*/
len += sprintf(&buffer[len],"DL TM %d, DL_cqi %d, DL_pmi_single %jx ",
len += sprintf(&buffer[len],"DL TM %d, DL_cqi (%d,%d), RI %d, DL_pmi_single %jx ",
eNB->transmission_mode[UE_id],
eNB->UE_stats[UE_id].DL_cqi[0],
eNB->UE_stats[UE_id].DL_cqi[1],
eNB->UE_stats[UE_id].rank,
pmi2hex_2Ar1(eNB->UE_stats[UE_id].DL_pmi_single));
len += sprintf(&buffer[len],"Timing advance %d samples (%d 16Ts), update %d ",
......
......@@ -169,7 +169,7 @@ void extract_CQI(void *o,UCI_format_t uci_format,LTE_eNB_UE_stats *stats, uint8_
//UCI_format fmt;
//uint8_t N_RB_DL = 25;
uint8_t i;
LOG_D(PHY,"[eNB][UCI] N_RB_DL %d uci format %d\n", N_RB_DL,uci_format);
LOG_I(PHY,"[eNB][UCI] N_RB_DL %d uci format %d\n", N_RB_DL,uci_format);
switch(N_RB_DL) {
case 6:
......
......@@ -1546,6 +1546,8 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,
ulsch_harq->o_RI[0] = ((ulsch_harq->q_RI[0] + ulsch_harq->q_RI[Q_m/2]) > 0) ? 0 : 1;
}
LOG_D(PHY,"ulsch_decoding: o_RI=%d\n",ulsch_harq->o_RI[0]);
// CQI
// printf("before cqi c[%d] = %p\n",0,ulsch_harq->c[0]);
......
......@@ -101,7 +101,7 @@ double sinr_to_cqi[4][16]= { {-2.5051, -2.5051, -1.7451, -0.3655, 1.0812, 2.4012
{ -4.1057, -4.1057, -3.3768, -2.2916, -1.1392, 0.1236, 1.2849, 3.1933, 5.9298, 6.4052, 9.6245, 10.9414, 13.5166, 14.9545, 14.9545, 14.9545}
};
//int cqi_to_mcs[16]={0, 0, 1, 3, 5, 7, 9, 13, 15, 16, 20, 23, 25, 27, 27, 27};
//int cqi_to_mcs[16]={-1, 0, 1, 3, 5, 7, 9, 13, 15, 16, 20, 23, 25, 27, 27, 27};
int cqi_to_mcs[16]= {0, 0, 1, 2, 4, 6, 8, 11, 13, 16, 18, 20, 23, 25, 27, 28};
//for SNR to MI conversion 7 th order Polynomial coeff
......
......@@ -890,22 +890,23 @@ void generate_eNB_ulsch_params(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,DCI_ALLOC
T_INT(eNB->ulsch[(uint32_t)UE_id]->harq_processes[harq_pid]->TBS));
}
void pdsch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,LTE_eNB_DLSCH_t *dlsch, LTE_eNB_DLSCH_t *dlsch1,LTE_eNB_UE_stats *ue_stats,int ra_flag,int num_pdcch_symbols) {
void pdsch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,LTE_eNB_DLSCH_t *dlsch0,LTE_eNB_DLSCH_t *dlsch1,LTE_eNB_UE_stats *ue_stats,int ra_flag,int num_pdcch_symbols) {
int frame=proc->frame_tx;
int subframe=proc->subframe_tx;
int harq_pid = dlsch->current_harq_pid;
LTE_DL_eNB_HARQ_t *dlsch_harq=dlsch->harq_processes[harq_pid];
int harq_pid = dlsch0->current_harq_pid;
LTE_DL_eNB_HARQ_t *dlsch_harq=dlsch0->harq_processes[harq_pid];
int input_buffer_length = dlsch_harq->TBS/8;
LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms;
uint8_t *DLSCH_pdu=NULL;
uint8_t DLSCH_pdu_tmp[input_buffer_length+4]; //[768*8];
LTE_eNB_DLSCH_t *dlsch[2] = {dlsch0, dlsch1};
uint8_t *DLSCH_pdu[2]={NULL,NULL};
uint8_t DLSCH_pdu_tmp[2][input_buffer_length+4]; //[768*8];
uint8_t DLSCH_pdu_rar[256];
int i;
int i,tb;
LOG_D(PHY,
"[eNB %"PRIu8"][PDSCH %"PRIx16"/%"PRIu8"] Frame %d, subframe %d: Generating PDSCH/DLSCH with input size = %"PRIu16", G %d, nb_rb %"PRIu16", mcs %"PRIu8", pmi_alloc %"PRIx64", rv %"PRIu8" (round %"PRIu8")\n",
eNB->Mod_id, dlsch->rnti,harq_pid,
eNB->Mod_id, dlsch0->rnti,harq_pid,
frame, subframe, input_buffer_length,
get_G(fp,
dlsch_harq->nb_rb,
......@@ -954,11 +955,13 @@ void pdsch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,LTE_eNB_DLSCH_t *d
if (eNB->mac_enabled==1) {
if (ra_flag == 0) {
DLSCH_pdu = mac_xface->get_dlsch_sdu(eNB->Mod_id,
eNB->CC_id,
frame,
dlsch->rnti,
0);
//at this point we are only getting pointers, we don't care here if the second TB is used or even valid. this is handled below
for (tb=0;tb<2;tb++)
DLSCH_pdu[tb] = mac_xface->get_dlsch_sdu(eNB->Mod_id,
eNB->CC_id,
frame,
dlsch0->rnti,
tb);
}
else {
int16_t crnti = mac_xface->fill_rar(eNB->Mod_id,
......@@ -967,7 +970,7 @@ void pdsch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,LTE_eNB_DLSCH_t *d
DLSCH_pdu_rar,
fp->N_RB_UL,
input_buffer_length);
DLSCH_pdu = DLSCH_pdu_rar;
DLSCH_pdu[0] = DLSCH_pdu_rar;
int UE_id;
......@@ -987,7 +990,7 @@ void pdsch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,LTE_eNB_DLSCH_t *d
// Initialize indicator for first SR (to be cleared after ConnectionSetup is acknowledged)
eNB->first_sr[(uint32_t)UE_id] = 1;
generate_eNB_ulsch_params_from_rar(DLSCH_pdu,
generate_eNB_ulsch_params_from_rar(DLSCH_pdu[0],
frame,
(subframe),
eNB->ulsch[(uint32_t)UE_id],
......@@ -1027,10 +1030,12 @@ void pdsch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,LTE_eNB_DLSCH_t *d
}
}
else {
DLSCH_pdu = DLSCH_pdu_tmp;
for (i=0; i<input_buffer_length; i++)
DLSCH_pdu[i] = (unsigned char)(taus()&0xff);
for (tb=0;tb<2;tb++) {
DLSCH_pdu[tb] = DLSCH_pdu_tmp[tb];
for (i=0; i<input_buffer_length; i++)
DLSCH_pdu[tb][i] = (unsigned char)(taus()&0xff);
}
}
#if defined(SMBV)
......@@ -1056,7 +1061,7 @@ void pdsch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,LTE_eNB_DLSCH_t *d
for (i=0; i<dlsch_harq->TBS>>3; i++)
LOG_T(PHY,"%"PRIx8".",DLSCH_pdu[i]);
LOG_T(PHY,"%"PRIx8".",DLSCH_pdu[0][i]);
LOG_T(PHY,"\n");
#endif
......@@ -1072,45 +1077,48 @@ void pdsch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,LTE_eNB_DLSCH_t *d
if (eNB->abstraction_flag==0) {
LOG_D(PHY,"Generating DLSCH/PDSCH %d\n",ra_flag);
// 36-212
start_meas(&eNB->dlsch_encoding_stats);
eNB->te(eNB,
DLSCH_pdu,
num_pdcch_symbols,
dlsch,
frame,subframe,
&eNB->dlsch_rate_matching_stats,
&eNB->dlsch_turbo_encoding_stats,
&eNB->dlsch_interleaving_stats);
stop_meas(&eNB->dlsch_encoding_stats);
// 36-211
start_meas(&eNB->dlsch_scrambling_stats);
dlsch_scrambling(fp,
0,
dlsch,
get_G(fp,
dlsch_harq->nb_rb,
dlsch_harq->rb_alloc,
get_Qm(dlsch_harq->mcs),
dlsch_harq->Nl,
num_pdcch_symbols,
frame,subframe,
0),
0,
subframe<<1);
stop_meas(&eNB->dlsch_scrambling_stats);
for (tb=0;tb<2;tb++) {
LOG_D(PHY,"Generating DLSCH/PDSCH for TB %d (ra_flag %d)\n",tb,ra_flag);
// 36-212
start_meas(&eNB->dlsch_encoding_stats);
if (dlsch[tb] && dlsch[tb]->active) {
eNB->te(eNB,
DLSCH_pdu[tb],
num_pdcch_symbols,
dlsch[tb],
frame,subframe,
&eNB->dlsch_rate_matching_stats,
&eNB->dlsch_turbo_encoding_stats,
&eNB->dlsch_interleaving_stats);
stop_meas(&eNB->dlsch_encoding_stats);
// 36-211
start_meas(&eNB->dlsch_scrambling_stats);
dlsch_scrambling(fp,
0,
dlsch[tb],
get_G(fp,
dlsch_harq->nb_rb,
dlsch_harq->rb_alloc,
get_Qm(dlsch_harq->mcs),
dlsch_harq->Nl,
num_pdcch_symbols,
frame,subframe,
0),
0,
subframe<<1);
stop_meas(&eNB->dlsch_scrambling_stats);
dlsch[tb]->active = 0;
}
}
start_meas(&eNB->dlsch_modulation_stats);
dlsch_modulation(eNB,
eNB->common_vars.txdataF[0],
AMP,
subframe,
num_pdcch_symbols,
dlsch,
dlsch1);
dlsch[0],
dlsch[1]);
stop_meas(&eNB->dlsch_modulation_stats);
}
......@@ -1126,7 +1134,6 @@ void pdsch_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,LTE_eNB_DLSCH_t *d
}
#endif
dlsch->active = 0;
}
void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
......@@ -1230,6 +1237,8 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
eNB->CC_id,
frame,
subframe);
for (i=0; i<DCI_pdu->Num_common_dci + DCI_pdu->Num_ue_spec_dci ; i++)
dump_dci(fp,&DCI_pdu->dci_alloc[i]);
}
else {
DCI_pdu = &DCI_pdu_tmp;
......@@ -2475,7 +2484,6 @@ void cba_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,int UE_id,int harq_p
if (eNB->ulsch[UE_id]->harq_processes[harq_pid]->cqi_crc_status == 1) {
#ifdef DEBUG_PHY_PROC
print_CQI(eNB->ulsch[UE_id]->harq_processes[harq_pid]->o,eNB->ulsch[UE_id]->harq_processes[harq_pid]->uci_format,0,fp->N_RB_DL);
#endif
access_mode = UNKNOWN_ACCESS;
......@@ -3051,8 +3059,8 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,const
eNB->ulsch[i]->harq_processes[harq_pid]->subframe_scheduling_flag=0;
if (eNB->ulsch[i]->harq_processes[harq_pid]->cqi_crc_status == 1) {
LOG_D(PHY,"CQI status 1\n");
#ifdef DEBUG_PHY_PROC
//if (((frame%10) == 0) || (frame < 50))
print_CQI(eNB->ulsch[i]->harq_processes[harq_pid]->o,eNB->ulsch[i]->harq_processes[harq_pid]->uci_format,0,fp->N_RB_DL);
#endif
extract_CQI(eNB->ulsch[i]->harq_processes[harq_pid]->o,
......@@ -3063,6 +3071,14 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,const
eNB->UE_stats[i].rank = eNB->ulsch[i]->harq_processes[harq_pid]->o_RI[0];
}
else {
if ((eNB->ulsch[i]->harq_processes[harq_pid]->O_RI == 0) &&
(eNB->ulsch[i]->harq_processes[harq_pid]->Or2 == 0) &&
(eNB->ulsch[i]->harq_processes[harq_pid]->Or1 == 0))
LOG_D(PHY,"no CQI transmitted\n");
else
LOG_D(PHY,"CQI not decoded\n");\
}
if (eNB->ulsch[i]->Msg3_flag == 1)
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_ULSCH_MSG3,0);
......
......@@ -359,6 +359,7 @@ typedef struct {
/*! \brief Downlink SCH PDU Structure */
typedef struct {
//uint8_t payload_valid;
int8_t payload[8][SCH_PAYLOAD_SIZE_MAX];
uint16_t Pdu_size[8];
} __attribute__ ((__packed__)) DLSCH_PDU;
......@@ -502,7 +503,7 @@ typedef struct {
/// harq rounf
uint8_t harq_round;
/// DL Wideband CQI index (2 TBs)
uint8_t dl_cqi;
uint8_t dl_cqi[2];
/// total available number of PRBs for a new transmission
uint16_t rbs_used;
/// total available number of PRBs for a retransmission
......@@ -621,7 +622,7 @@ typedef struct {
/// C-RNTI of UE
rnti_t rnti;
/// NDI from last scheduling
uint8_t oldNDI[8];
uint8_t oldNDI[2][8];
/// NDI from last UL scheduling
uint8_t oldNDI_UL[8];
/// Flag to indicate UL has been scheduled at least once
......@@ -629,8 +630,10 @@ typedef struct {
/// Flag to indicate UE has been configured (ACK from RRCConnectionSetup received)
boolean_t configured;
/// MCS from last scheduling
uint8_t mcs[8];
// active TBs
uint8_t TB_active[2][8];
// current MCS
uint8_t mcs[2][8];
/// TPC from last scheduling
uint8_t oldTPC[8];
......
This diff is collapsed.
......@@ -287,7 +287,8 @@ printf("MAC: new UE id %d rnti %x\n", i, rntiP);
memset((void*)&UE_list->UE_sched_ctrl[UE_id],0,sizeof(UE_sched_ctrl));
for (j=0; j<8; j++) {
UE_list->UE_template[cc_idP][UE_id].oldNDI[j] = (j==0)?1:0; // 1 because first transmission is with format1A (Msg4) for harq_pid 0
UE_list->UE_template[cc_idP][UE_id].oldNDI[0][j] = (j==0)?1:0; // 1 because first transmission is with format1A (Msg4) for harq_pid 0
UE_list->UE_template[cc_idP][UE_id].oldNDI[1][j] = 0;
UE_list->UE_template[cc_idP][UE_id].oldNDI_UL[j] = (j==harq_pidP)?0:1; // 1st transmission is with Msg3;
}
......@@ -670,7 +671,7 @@ void add_ue_spec_dci(DCI_PDU *DCI_pdu,void *pdu,rnti_t rnti,unsigned char dci_si
DCI_pdu->Num_ue_spec_dci++;
LOG_D(MAC,"add ue specific dci format %d for rnti %x \n",dci_fmt,rnti);
LOG_I(MAC,"add ue specific dci format %d for rnti %x \n",dci_fmt,rnti);
}
......
......@@ -99,7 +99,7 @@ int errno;
# endif
#endif
//#define XER_PRINT
#define XER_PRINT
extern Enb_properties_array_t enb_properties;
typedef struct xer_sprint_string_s {
......
......@@ -148,9 +148,9 @@ eNBs =
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth1";
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.147/24";
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.150/24";
ENB_INTERFACE_NAME_FOR_S1U = "eth1";
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.147/24";
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.150/24";
ENB_PORT_FOR_S1U = 2152; # Spec 2152
};
......
......@@ -148,10 +148,10 @@ eNBs =
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.212/24";
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.150/24";
ENB_INTERFACE_NAME_FOR_S1U = "eth0";
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.212/24";
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.150/24";
ENB_PORT_FOR_S1U = 2152; # Spec 2152
};
......
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