Commit 1a591da2 authored by fnabet's avatar fnabet

Merge tag '2017.w06' into bugfix-189-rlc-am-fixes

parents d3af6f1f b2b1dc9f
......@@ -1883,6 +1883,7 @@ add_executable(oaisim
${OPENAIR_TARGETS}/SIMU/USER/oaisim_functions.c
${OPENAIR_TARGETS}/SIMU/USER/event_handler.c
${OPENAIR_TARGETS}/SIMU/USER/oaisim.c
${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
${OPENAIR2_DIR}/RRC/NAS/nas_config.c
${OPENAIR2_DIR}/RRC/NAS/rb_config.c
${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c
......@@ -1897,7 +1898,7 @@ add_executable(oaisim
target_include_directories(oaisim PUBLIC ${OPENAIR_TARGETS}/SIMU/USER)
target_link_libraries (oaisim
-Wl,--start-group
-Wl,-ldl,--start-group
RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB GTPV1U SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS ${MSC_LIB} L2 ${RAL_LIB} LIB_NAS_UE SIMU SIMU_ETH SECU_OSA ${ITTI_LIB} ${MIH_LIB}
-Wl,--end-group )
......@@ -1928,6 +1929,7 @@ add_executable(oaisim_nos1
${OPENAIR_TARGETS}/SIMU/USER/oaisim_functions.c
${OPENAIR_TARGETS}/SIMU/USER/event_handler.c
${OPENAIR_TARGETS}/SIMU/USER/oaisim.c
${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
${OPENAIR2_DIR}/RRC/NAS/nas_config.c
${OPENAIR2_DIR}/RRC/NAS/rb_config.c
${OPENAIR_TARGETS}/COMMON/create_tasks.c
......
......@@ -3,6 +3,9 @@ source oaienv
cd cmake_targets
rm -rf log
mkdir -p log
echo $PRE_BUILD
bash -c "$PRE_BUILD"
echo $BUILD_PROG $BUILD_ARGUMENTS
$BUILD_PROG $BUILD_ARGUMENTS
echo $PRE_EXEC
bash -c "$PRE_EXEC"
......@@ -418,9 +418,9 @@ function main() {
if [ "$oaisim" = "1" ] ; then
#to be discussed
# there is no RF device and no transport protocol
# there is no RF device transport protocol
HW="None"
TP="None"
TP="ETHERNET"
if [ "$XFORMS" == "True" ] ; then
PRINT_STATS="True"
......@@ -671,6 +671,15 @@ function main() {
# CMakeFiles/oai_nw_drv/oai_nw_drv.ko $dbin/oai_nw_drv.ko
fi
if [ "$TP" == "ETHERNET" ] ; then
compilations \
$oaisim_build_dir oai_eth_transpro \
liboai_eth_transpro.so $dbin/liboai_eth_transpro.so.$REL
ln -s liboai_eth_transpro.so liboai_transpro.so
ln -s $dbin/liboai_eth_transpro.so.$REL $dbin/liboai_transpro.so
echo_info "liboai_transpro.so is linked with ETHERNET library"
fi
cmake_file=$DIR/oaisim_mme_build_oai/CMakeLists.txt
cp $DIR/oaisim_mme_build_oai/CMakeLists.template $cmake_file
echo "set ( CMAKE_BUILD_TYPE $CMAKE_BUILD_TYPE )" >> $cmake_file
......
......@@ -171,7 +171,7 @@ install_protobuf_from_source(){
echo "Downloading protobuf"
rm -rf /tmp/protobuf-2.6.1.tar.gz* /tmp/protobuf-2.6.1
wget https://github.com/google/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.gz
tar -xzvf protobuf-2.6.1.tar.gz
tar -xzvf protobuf-2.6.1.tar.gz --owner $USER --group $USER --no-same-owner
cd protobuf-2.6.1/
./configure
echo "Compiling protobuf"
......@@ -208,8 +208,8 @@ check_install_usrp_uhd_driver(){
#The new USRP repository
$SUDO add-apt-repository ppa:ettusresearch/uhd -y
$SUDO apt-get update
$SUDO apt-get -y install python python-tk libboost-all-dev libusb-1.0-0-dev
$SUDO apt-get -y install libuhd-dev libuhd003 uhd-host
$SUDO apt-get -y --allow-unauthenticated install python python-tk libboost-all-dev libusb-1.0-0-dev
$SUDO apt-get -y --allow-unauthenticated install libuhd-dev libuhd003 uhd-host
}
install_usrp_uhd_driver() {
......@@ -224,9 +224,9 @@ check_install_bladerf_driver(){
$SUDO add-apt-repository -y ppa:bladerf/bladerf
$SUDO apt-get update
fi
$SUDO apt-get install -y bladerf libbladerf-dev
$SUDO apt-get install -y bladerf-firmware-fx3
$SUDO apt-get install -y bladerf-fpga-hostedx40
$SUDO apt-get install -y--allow-unauthenticated bladerf libbladerf-dev
$SUDO apt-get install -y --allow-unauthenticated bladerf-firmware-fx3
$SUDO apt-get install -y --allow-unauthenticated bladerf-fpga-hostedx40
}
flash_firmware_bladerf() {
......
......@@ -3831,6 +3831,8 @@ int generate_ue_dlsch_params_from_dci(int frame,
LTE_UE_DLSCH_t *dlsch0=NULL,*dlsch1=NULL;
LTE_DL_UE_HARQ_t *dlsch0_harq,*dlsch1_harq;
if (!dlsch[0]) return -1;
#ifdef DEBUG_DCI
LOG_D(PHY,"dci_tools.c: Filling ue dlsch params -> rnti %x, SFN/SF %d/%d, dci_format %s\n",
rnti,
......@@ -7395,8 +7397,8 @@ int generate_eNB_ulsch_params_from_dci(PHY_VARS_eNB *eNB,
rb_alloc = rballoc;
if (rb_alloc>RIV_max) {
LOG_E(PHY,"Format 0: rb_alloc > RIV_max\n");
mac_xface->macphy_exit("Format 0: rb_alloc > RIV_max\n");
LOG_E(PHY,"Format 0: rb_alloc (%d) > RIV_max (%d)\n",rb_alloc,RIV_max);
mac_xface->macphy_exit("Format 0: error");
return(-1);
}
......
......@@ -108,8 +108,8 @@ void send_IF4p5(PHY_VARS_eNB *eNB, int frame, int subframe, uint16_t packet_type
(packet_type == IF4p5_PULTICK)){
db_fulllength = 12*fp->N_RB_UL;
db_halflength = (db_fulllength)>>1;
slotoffsetF = 1;
blockoffsetF = slotoffsetF + fp->ofdm_symbol_size - db_halflength - 1;
slotoffsetF = 0;
blockoffsetF = slotoffsetF + fp->ofdm_symbol_size - db_halflength;
if (subframe_select(fp,subframe)==SF_S) {
nsym=fp->ul_symbols_in_S_subframe;
......@@ -131,10 +131,12 @@ void send_IF4p5(PHY_VARS_eNB *eNB, int frame, int subframe, uint16_t packet_type
LOG_D(PHY,"IF4p5_PULFFT: frame %d, subframe %d, symbol %d\n",frame,subframe,symbol_id);
for (element_id=0; element_id<db_halflength; element_id++) {
i = (uint16_t*) &rxdataF[0][blockoffsetF+element_id];
data_block[element_id] = ((uint16_t) lin2alaw[*i]) | (lin2alaw[*(i+1)]<<8);
data_block[element_id] = ((uint16_t) lin2alaw[*i]) | ((uint16_t)(lin2alaw[*(i+1)]<<8));
i = (uint16_t*) &rxdataF[0][slotoffsetF+element_id];
data_block[element_id+db_halflength] = ((uint16_t) lin2alaw[*i]) | (lin2alaw[*(i+1)]<<8);
data_block[element_id+db_halflength] = ((uint16_t) lin2alaw[*i]) | ((uint16_t)(lin2alaw[*(i+1)]<<8));
//if (element_id==0) LOG_I(PHY,"send_if4p5: symbol %d rxdata0 = (%d,%d)\n",symbol_id,*i,*(i+1));
}
packet_header->frame_status &= ~(0x000f<<26);
......@@ -235,7 +237,7 @@ void recv_IF4p5(PHY_VARS_eNB *eNB, int *frame, int *subframe, uint16_t *packet_t
0) < 0) {
perror("ETHERNET read");
}
if (eth->flags == ETH_RAW_IF4p5_MODE) {
packet_header = (IF4p5_header_t*) (rx_buffer+MAC_HEADER_SIZE_BYTES);
data_block = (uint16_t*) (rx_buffer+MAC_HEADER_SIZE_BYTES+sizeof_IF4p5_header_t);
......@@ -251,7 +253,6 @@ void recv_IF4p5(PHY_VARS_eNB *eNB, int *frame, int *subframe, uint16_t *packet_t
*packet_type = packet_header->sub_type;
if (*packet_type == IF4p5_PDLFFT) {
*symbol_number = ((packet_header->frame_status)>>26)&0x000f;
......@@ -273,10 +274,10 @@ void recv_IF4p5(PHY_VARS_eNB *eNB, int *frame, int *subframe, uint16_t *packet_t
} else if (*packet_type == IF4p5_PULFFT) {
*symbol_number = ((packet_header->frame_status)>>26)&0x000f;
if (eNB->CC_id==1) LOG_I(PHY,"UL_IF4p5: CC_id %d : frame %d, subframe %d, symbol %d\n",eNB->CC_id,*frame,*subframe,*symbol_number);
if (eNB->CC_id==0) LOG_D(PHY,"UL_IF4p5: CC_id %d : frame %d, subframe %d, symbol %d\n",eNB->CC_id,*frame,*subframe,*symbol_number);
slotoffsetF = (*symbol_number)*(fp->ofdm_symbol_size) + 1;
blockoffsetF = slotoffsetF + fp->ofdm_symbol_size - db_halflength - 1;
slotoffsetF = (*symbol_number)*(fp->ofdm_symbol_size);
blockoffsetF = slotoffsetF + fp->ofdm_symbol_size - db_halflength;
for (element_id=0; element_id<db_halflength; element_id++) {
i = (uint16_t*) &rxdataF[0][blockoffsetF+element_id];
......@@ -286,9 +287,12 @@ void recv_IF4p5(PHY_VARS_eNB *eNB, int *frame, int *subframe, uint16_t *packet_t
i = (uint16_t*) &rxdataF[0][slotoffsetF+element_id];
*i = alaw2lin[ (data_block[element_id+db_halflength] & 0xff) ];
*(i+1) = alaw2lin[ (data_block[element_id+db_halflength]>>8) ];
//if (element_id==0) LOG_I(PHY,"recv_if4p5: symbol %d rxdata0 = (%u,%u)\n",*symbol_number,*i,*(i+1));
}
} else if (*packet_type == IF4p5_PRACH) {
} else if (*packet_type == IF4p5_PRACH) {
LOG_D(PHY,"PRACH_IF4p5: CC_id %d : frame %d, subframe %d, symbol %d\n",eNB->CC_id,*frame,*subframe);
if (eNB->CC_id==1) LOG_I(PHY,"PRACH_IF4p5: CC_id %d : frame %d, subframe %d, symbol %d\n",eNB->CC_id,*frame,*subframe);
// FIX: hard coded prach samples length
......
......@@ -645,6 +645,12 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
#else //normal case (simulation)
prach_start = subframe*ue->frame_parms.samples_per_tti-ue->N_TA_offset;
LOG_D(PHY,"[UE %d] prach_start %d, rx_offset %d, hw_timing_advance %d, N_TA_offset %d\n", ue->Mod_id,
prach_start,
ue->rx_offset,
ue->hw_timing_advance,
ue->N_TA_offset);
#endif
......@@ -1074,6 +1080,8 @@ int32_t generate_prach( PHY_VARS_UE *ue, uint8_t eNB_id, uint8_t subframe, uint1
#ifdef PRACH_DEBUG
write_output("prach_txF0.m","prachtxF0",prachF,prach_len-Ncp,1,1);
write_output("prach_tx0.m","prachtx0",prach+(Ncp<<1),prach_len-Ncp,1,1);
write_output("txsig.m","txs",(int16_t*)(&ue->common_vars.txdata[0][0]),2*ue->frame_parms.samples_per_tti,1,1);
exit(-1);
#endif
return signal_energy( (int*)prach, 256 );
......@@ -1125,7 +1133,7 @@ void rx_prach(PHY_VARS_eNB *eNB,
int fft_size,log2_ifft_size;
uint8_t nb_ant_rx = 1; //eNB->frame_parms.nb_antennas_rx;
// int en;
int en;
for (aa=0; aa<nb_ant_rx; aa++) {
prach[aa] = (int16_t*)&eNB->common_vars.rxdata[0][aa][subframe*eNB->frame_parms.samples_per_tti-eNB->N_TA_offset];
......@@ -1327,9 +1335,26 @@ void rx_prach(PHY_VARS_eNB *eNB,
/// **** send_IF4 of rxsigF to RCC **** ///
send_IF4p5(eNB, eNB->proc.frame_prach, eNB->proc.subframe_prach, IF4p5_PRACH, k);
// en = dB_fixed(signal_energy(&rxsigF[0][k],840));
// if (en>60)
// printf("PRACH: Frame %d, Subframe %d => %d dB\n",eNB->proc.frame_rx,eNB->proc.subframe_rx,en);
#if 0
/* TODO: resolv this conflict (there should be no printf anyway, so no big deal) */
<<<<<<< HEAD
/*
en = dB_fixed(signal_energy(&rxsigF[0][k],840));
printf("Sending PRACH, k %d,n_ra_prb %d, N_RB_UL %d, en %d\n",k,n_ra_prb,eNB->frame_parms.N_RB_UL,en);
if (en>60) {
printf("PRACH: Frame %d, Subframe %d => %d dB\n",eNB->proc.frame_rx,eNB->proc.subframe_rx,en);
write_output("prach_rx0.m","prach_rx0",(int16_t*)&rxsigF[0][k],839,1,1);
exit(-1);
}
*/
=======
en = dB_fixed(signal_energy(&rxsigF[0][k],840));
if (en>60)
printf("PRACH: Frame %d, Subframe %d => %d dB\n",eNB->proc.frame_rx,eNB->proc.subframe_rx,en);
>>>>>>> origin/fix-if4p5
#endif
return;
} else if (eNB->node_function == NGFI_RCC_IF4p5) {
k = (12*n_ra_prb) - 6*eNB->frame_parms.N_RB_UL;
......@@ -1347,9 +1372,25 @@ void rx_prach(PHY_VARS_eNB *eNB,
(&rxsigF[0][0]),
839*2*sizeof(int16_t));
//en = dB_fixed(signal_energy(&rxsigF[0][k],840));
// if (en>60)
//printf("PRACH: Frame %d, Subframe %d => %d dB\n",eNB->proc.frame_rx,eNB->proc.subframe_rx,en);
#if 0
/* TODO: resolv this conflict (there should be no printf anyway, so no big deal) */
<<<<<<< HEAD
/*
en = dB_fixed(signal_energy(&rxsigF[0][k],840));
printf("Receiving PRACH, k %d,n_ra_prb %d, N_RB_UL %d, en %d\n",k,n_ra_prb,eNB->frame_parms.N_RB_UL,en);
if (en>60) {
printf("PRACH: Frame %d, Subframe %d => %d dB\n",eNB->proc.frame_rx,eNB->proc.subframe_rx,en);
write_output("prach_rx0.m","prach_rx0",(int16_t*)&rxsigF[0][k],839,1,1);
exit(-1);
}
*/
=======
en = dB_fixed(signal_energy(&rxsigF[0][k],840));
/*if (en>60)
printf("PRACH: Frame %d, Subframe %d => %d dB\n",eNB->proc.frame_rx,eNB->proc.subframe_rx,en);*/
>>>>>>> origin/fix-if4p5
#endif
}
......@@ -1523,7 +1564,7 @@ void rx_prach(PHY_VARS_eNB *eNB,
#ifdef PRACH_DEBUG
// if (en>40) {
if (en>40) {
k = (12*n_ra_prb) - 6*eNB->frame_parms.N_RB_UL;
if (k<0)
......@@ -1537,7 +1578,7 @@ void rx_prach(PHY_VARS_eNB *eNB,
write_output("prach_rxF_comp0.m","prach_rxF_comp0",prachF,1024,1,1);
write_output("prach_ifft0.m","prach_t0",prach_ifft[0],1024,1,1);
exit(-1);
// }
}
#endif
} // new dft
......@@ -1551,7 +1592,7 @@ void rx_prach(PHY_VARS_eNB *eNB,
for (aa=0; aa<nb_ant_rx; aa++) {
lev += (int32_t)prach_ifft[aa][(preamble_shift2+i)<<1]*prach_ifft[aa][(preamble_shift2+i)<<1] + (int32_t)prach_ifft[aa][1+((preamble_shift2+i)<<1)]*prach_ifft[aa][1+((preamble_shift2+i)<<1)];
}
levdB = dB_fixed_times10(lev);
if (levdB>preamble_energy_list[preamble_index] ) {
......@@ -1559,12 +1600,12 @@ void rx_prach(PHY_VARS_eNB *eNB,
preamble_delay_list[preamble_index] = (i*fft_size)>>log2_ifft_size;
}
}
#ifdef PRACH_DEBUG
LOG_D(PHY,"[RAPROC] Preamble %d => %d dB, %d (shift %d (%d), NCS2 %d(%d), Ncp %d)\n",preamble_index,preamble_energy_list[preamble_index],preamble_delay_list[preamble_index],preamble_shift2,
preamble_shift, NCS2,NCS,Ncp);
#endif
// exit(-1);
#endif
}// preamble_index
stop_meas(&eNB->rx_prach);
......
......@@ -415,7 +415,7 @@ void ulsch_modulation(int32_t **txdataF,
return;
}
if (first_rb >25 ) {
if (first_rb > frame_parms->N_RB_UL) {
printf("ulsch_modulation.c: Frame %d, Subframe %d Illegal first_rb %d\n",frame,subframe,first_rb);
return;
}
......
......@@ -430,6 +430,7 @@ typedef struct PHY_VARS_eNB_s {
eNB_proc_t proc;
eNB_func_t node_function;
eNB_timing_t node_timing;
eth_params_t *eth_params;
int single_thread_flag;
openair0_rf_map rf_map;
int abstraction_flag;
......
This diff is collapsed.
......@@ -92,6 +92,9 @@ extern uint16_t hundred_times_log10_NPRB[100];
unsigned int max_peak_val;
int max_sync_pos;
int harq_pid_updated[NUMBER_OF_UE_MAX][8] = {{0}};
int harq_pid_round[NUMBER_OF_UE_MAX][8] = {{0}};
//DCI_ALLOC_t dci_alloc[8];
#ifdef EMOS
......@@ -1444,15 +1447,6 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
eNB->dlsch_ra->active = 0;
}
#if defined(FLEXRAN_AGENT_SB_IF)
#ifndef DISABLE_SF_TRIGGER
//Send subframe trigger to the controller
if (mac_agent_registered[eNB->Mod_id]) {
agent_mac_xface[eNB->Mod_id]->flexran_agent_send_sf_trigger(eNB->Mod_id);
}
#endif
#endif
// Now scan UE specific DLSCH
for (UE_id=0; UE_id<NUMBER_OF_UE_MAX; UE_id++)
{
......@@ -1553,7 +1547,6 @@ void process_HARQ_feedback(uint8_t UE_id,
int subframe = proc->subframe_rx;
int harq_pid = subframe2harq_pid( fp,frame,subframe);
if (fp->frame_type == FDD) { //FDD
subframe_m4 = (subframe<4) ? subframe+6 : subframe-4;
......@@ -1681,6 +1674,7 @@ void process_HARQ_feedback(uint8_t UE_id,
mp = m;
dl_harq_pid[m] = dlsch->harq_ids[dl_subframe];
harq_pid_updated[UE_id][dl_harq_pid[m]] = 1;
if ((pucch_sel != 2)&&(pusch_flag == 0)) { // multiplexing
if ((SR_payload == 1)&&(all_ACKed == 1))
......@@ -1768,7 +1762,7 @@ void process_HARQ_feedback(uint8_t UE_id,
eNB->dlsch[(uint8_t)UE_id][0]->harq_processes[dl_harq_pid[m]]->TBS;
*/
}
// Do fine-grain rate-adaptation for DLSCH
if (ue_stats->dlsch_NAK_round0 > dlsch->error_threshold) {
if (ue_stats->dlsch_mcs_offset == 1)
......@@ -1781,7 +1775,7 @@ void process_HARQ_feedback(uint8_t UE_id,
LOG_D(PHY,"[process_HARQ_feedback] Frame %d Setting round to %d for pid %d (subframe %d)\n",frame,
dlsch_harq_proc->round,dl_harq_pid[m],subframe);
#endif
harq_pid_round[UE_id][dl_harq_pid[m]] = dlsch_harq_proc->round;
// Clear NAK stats and adjust mcs offset
// after measurement window timer expires
if (ue_stats->dlsch_sliding_cnt == dlsch->ra_window_size) {
......@@ -1800,8 +1794,6 @@ void process_HARQ_feedback(uint8_t UE_id,
ue_stats->dlsch_NAK_round0 = 0;
ue_stats->dlsch_sliding_cnt = 0;
}
}
}
}
......@@ -2750,6 +2742,7 @@ void eNB_fep_full(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc_rxtx) {
if (eNB->node_function == NGFI_RRU_IF4p5) {
/// **** send_IF4 of rxdataF to RCC (no prach now) **** ///
LOG_D(PHY,"send_IF4p5 (PULFFT): frame %d, subframe %d\n",proc_rxtx->frame_rx,proc_rxtx->subframe_rx);
send_IF4p5(eNB, proc_rxtx->frame_rx, proc_rxtx->subframe_rx, IF4p5_PULFFT, 0);
}
}
......@@ -3070,12 +3063,15 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,const
LOG_D(PHY,"[eNB][PUSCH %d] Increasing to round %d\n",harq_pid,eNB->ulsch[i]->harq_processes[harq_pid]->round);
if (eNB->ulsch[i]->Msg3_flag == 1) {
LOG_D(PHY,"[eNB %d/%d][RAPROC] frame %d, subframe %d, UE %d: Error receiving ULSCH (Msg3), round %d/%d\n",
eNB->Mod_id,
eNB->CC_id,
frame,subframe, i,
eNB->ulsch[i]->harq_processes[harq_pid]->round-1,
fp->maxHARQ_Msg3Tx-1);
/*dump_ulsch(eNB,proc,i);
exit(-1);*/
LOG_D(PHY,"[eNB %d][PUSCH %d] frame %d subframe %d RNTI %x RX power (%d,%d) RSSI (%d,%d) N0 (%d,%d) dB ACK (%d,%d), decoding iter %d\n",
eNB->Mod_id,harq_pid,
......@@ -3158,6 +3154,10 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,const
eNB->UE_stats[i].ulsch_errors[harq_pid]++;
eNB->UE_stats[i].ulsch_consecutive_errors++;
/*if (eNB->ulsch[i]->harq_processes[harq_pid]->nb_rb > 20) {
dump_ulsch(eNB,proc,i);
exit(-1);
}*/
// indicate error to MAC
if (eNB->mac_enabled == 1)
mac_xface->rx_sdu(eNB->Mod_id,
......@@ -3422,14 +3422,21 @@ void phy_procedures_eNB_uespec_RX(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,const
}
#endif
//}
#ifdef EMOS
phy_procedures_emos_eNB_RX(subframe,eNB);
#endif
#if defined(FLEXRAN_AGENT_SB_IF)
#ifndef DISABLE_SF_TRIGGER
//Send subframe trigger to the controller
if (mac_agent_registered[eNB->Mod_id]) {
agent_mac_xface[eNB->Mod_id]->flexran_agent_send_sf_trigger(eNB->Mod_id);
}
#endif
#endif
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_RX_UESPEC+offset, 0 );
stop_meas(&eNB->phy_proc_rx);
......
......@@ -2188,11 +2188,12 @@ void phy_procedures_UE_TX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,ui
subframe_tx,
ue->ulsch[eNB_id]->o_ACK);
reset_ack(&ue->frame_parms,
ue->dlsch_SI[eNB_id]->harq_ack,
subframe_tx,
ue->ulsch[eNB_id]->o_ACK);
if (ue->dlsch_SI[eNB_id])
reset_ack(&ue->frame_parms,
ue->dlsch_SI[eNB_id]->harq_ack,
subframe_tx,
ue->ulsch[eNB_id]->o_ACK);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX, VCD_FUNCTION_OUT);
stop_meas(&ue->phy_proc_tx);
......@@ -2605,19 +2606,19 @@ void ue_pbch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc, uin
#endif
} else {
/*
LOG_E(PHY,"[UE %d] frame %d, subframe %d, Error decoding PBCH!\n",
ue->Mod_id,frame_rx, subframe_rx);
/*
LOG_I(PHY,"[UE %d] rx_offset %d\n",ue->Mod_id,ue->rx_offset);
write_output("rxsig0.m","rxs0", ue->common_vars.rxdata[0],ue->frame_parms.samples_per_tti,1,1);
write_output("H00.m","h00",&(ue->common_vars.dl_ch_estimates[0][0][0]),((ue->frame_parms.Ncp==0)?7:6)*(ue->frame_parms.ofdm_symbol_size),1,1);
write_output("H10.m","h10",&(ue->common_vars.dl_ch_estimates[0][2][0]),((ue->frame_parms.Ncp==0)?7:6)*(ue->frame_parms.ofdm_symbol_size),1,1);
write_output("H00.m","h00",&(ue->common_vars.common_vars_rx_data_per_thread[0].dl_ch_estimates[0][0][0]),((ue->frame_parms.Ncp==0)?7:6)*(ue->frame_parms.ofdm_symbol_size),1,1);
write_output("H10.m","h10",&(ue->common_vars.common_vars_rx_data_per_thread[0].dl_ch_estimates[0][2][0]),((ue->frame_parms.Ncp==0)?7:6)*(ue->frame_parms.ofdm_symbol_size),1,1);
write_output("rxsigF0.m","rxsF0", ue->common_vars.rxdataF[0],8*ue->frame_parms.ofdm_symbol_size,1,1);
write_output("rxsigF0.m","rxsF0", ue->common_vars.common_vars_rx_data_per_thread[0].rxdataF[0],8*ue->frame_parms.ofdm_symbol_size,1,1);
write_output("PBCH_rxF0_ext.m","pbch0_ext",ue->pbch_vars[0]->rxdataF_ext[0],12*4*6,1,1);
write_output("PBCH_rxF0_comp.m","pbch0_comp",ue->pbch_vars[0]->rxdataF_comp[0],12*4*6,1,1);
write_output("PBCH_rxF_llr.m","pbch_llr",ue->pbch_vars[0]->llr,(ue->frame_parms.Ncp==0) ? 1920 : 1728,1,4);
......@@ -2969,17 +2970,14 @@ int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint
#endif
}
} else if( (dci_alloc_rx[i].rnti == ue->ulsch[eNB_id]->cba_rnti[0]) &&
}
/* else if( (dci_alloc_rx[i].rnti == ue->ulsch[eNB_id]->cba_rnti[0]) &&
(dci_alloc_rx[i].format == format0)) {
// UE could belong to more than one CBA group
// ue->Mod_id%ue->ulsch[eNB_id]->num_active_cba_groups]
#ifdef DEBUG_PHY_PROC
LOG_D(PHY,"[UE %d][PUSCH] Frame %d subframe %d: Found cba rnti %x, format 0, dci_cnt %d\n",
ue->Mod_id,frame_rx,subframe_rx,dci_alloc_rx[i].rnti,i);
/*
if (((frame_rx%100) == 0) || (frame_rx < 20))
dump_dci(&ue->frame_parms, &dci_alloc_rx[i]);
*/
#endif
ue->ulsch_no_allocation_counter[eNB_id] = 0;
......@@ -3003,9 +3001,8 @@ int ue_pdcch_procedures(uint8_t eNB_id,PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint
LOG_D(PHY,"[UE %d] Generate UE ULSCH CBA_RNTI format 0 (subframe %d)\n",ue->Mod_id,subframe_rx);
#endif
ue->ulsch[eNB_id]->num_cba_dci[(subframe_rx+4)%10]++;
}
}
}
*/
else {
#ifdef DEBUG_PHY_PROC
LOG_D(PHY,"[UE %d] frame %d, subframe %d: received DCI %d with RNTI=%x (C-RNTI:%x, CBA_RNTI %x) and format %d!\n",ue->Mod_id,frame_rx,subframe_rx,i,dci_alloc_rx[i].rnti,
......
......@@ -443,14 +443,14 @@ int flexran_agent_mac_stats_reply(mid_t mod_id,
if (rlc_reports[j] == NULL)
goto error;
protocol__flex_rlc_bsr__init(rlc_reports[j]);
rlc_reports[j]->lc_id = j+1;
rlc_reports[j]->lc_id = j + 1;
rlc_reports[j]->has_lc_id = 1;
rlc_reports[j]->tx_queue_size = flexran_get_tx_queue_size(enb_id,i,j+1);
rlc_reports[j]->tx_queue_size = flexran_get_tx_queue_size(enb_id,i,j + 1);
rlc_reports[j]->has_tx_queue_size = 1;
//TODO:Set tx queue head of line delay in ms
rlc_reports[j]->tx_queue_hol_delay = 100;
rlc_reports[j]->has_tx_queue_hol_delay = 0;
rlc_reports[j]->tx_queue_hol_delay = flexran_get_hol_delay(enb_id, i, j+1);
rlc_reports[j]->has_tx_queue_hol_delay = 1;
//TODO:Set retransmission queue size in bytes
rlc_reports[j]->retransmission_queue_size = 10;
rlc_reports[j]->has_retransmission_queue_size = 0;
......@@ -657,6 +657,8 @@ int flexran_agent_mac_stats_reply(mid_t mod_id,
full_ul_report->pucch_dbm[j]->p0_pucch_dbm = flexran_get_p0_pucch_dbm(enb_id,i,j);
full_ul_report->pucch_dbm[j]->has_p0_pucch_dbm = 1;
}
full_ul_report->pucch_dbm[j]->has_p0_pucch_updated = 1;
full_ul_report->pucch_dbm[j]->p0_pucch_updated = flexran_get_p0_pucch_status(enb_id, i, j);
}
//Add full UL CQI report to the UE report
......@@ -921,9 +923,13 @@ int flexran_agent_mac_destroy_sr_info(Protocol__FlexranMessage *msg) {
int flexran_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__FlexranMessage **msg) {
Protocol__FlexHeader *header;
int i,j;
int i, j, UE_id;
int available_harq[NUMBER_OF_UE_MAX];
const int xid = *((int *)params);
Protocol__FlexSfTrigger *sf_trigger_msg;
sf_trigger_msg = malloc(sizeof(Protocol__FlexSfTrigger));
if (sf_trigger_msg == NULL) {
......@@ -937,29 +943,47 @@ int flexran_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Fle
frame_t frame;
sub_frame_t subframe;
int ahead_of_time = 1;
for (i = 0; i < NUMBER_OF_UE_MAX; i++) {
available_harq[i] = -1;
}
int ahead_of_time = 0;
frame = (frame_t) flexran_get_current_system_frame_num(mod_id);
subframe = (sub_frame_t) flexran_get_current_subframe(mod_id);
subframe = ((subframe + ahead_of_time) % 10);
int full_frames_ahead = ((ahead_of_time / 10) % 10);
frame = frame + full_frames_ahead;
if (subframe < flexran_get_current_subframe(mod_id)) {
frame++;
frame = (frame + 1) % 1024;
}
int additional_frames = ahead_of_time / 10;
frame = (frame + additional_frames) % 1024;
sf_trigger_msg->header = header;
sf_trigger_msg->has_sfn_sf = 1;
sf_trigger_msg->sfn_sf = flexran_get_future_sfn_sf(mod_id, 1);
sf_trigger_msg->sfn_sf = flexran_get_future_sfn_sf(mod_id, 3);
sf_trigger_msg->n_dl_info = 0;
for (i = 0; i < NUMBER_OF_UE_MAX; i++) {
for (j = 0; j < 8; j++) {
if (harq_pid_updated[i][j] == 1) {
available_harq[i] = j;
sf_trigger_msg->n_dl_info++;
break;
}
}
}
// LOG_I(FLEXRAN_AGENT, "Sending subframe trigger for frame %d and subframe %d\n", flexran_get_current_frame(mod_id), (flexran_get_current_subframe(mod_id) + 1) % 10);
/*TODO: Fill in the number of dl HARQ related info, based on the number of currently
*transmitting UEs
*/
sf_trigger_msg->n_dl_info = flexran_get_num_ues(mod_id);
// sf_trigger_msg->n_dl_info = flexran_get_num_ues(mod_id);
Protocol__FlexDlInfo **dl_info = NULL;
......@@ -967,29 +991,39 @@ int flexran_agent_mac_sf_trigger(mid_t mod_id, const void *params, Protocol__Fle
dl_info = malloc(sizeof(Protocol__FlexDlInfo *) * sf_trigger_msg->n_dl_info);
if(dl_info == NULL)
goto error;
i = -1;
//Fill the status of the current HARQ process for each UE
for(i = 0; i < sf_trigger_msg->n_dl_info; i++) {
for(UE_id = 0; UE_id < NUMBER_OF_UE_MAX; UE_id++) {
if (available_harq[UE_id] < 0) {
continue;
} else {
i++;
}
dl_info[i] = malloc(sizeof(Protocol__FlexDlInfo));
if(dl_info[i] == NULL)
goto error;
protocol__flex_dl_info__init(dl_info[i]);
dl_info[i]->rnti = flexran_get_ue_crnti(mod_id, i);
dl_info[i]->rnti = flexran_get_ue_crnti(mod_id, UE_id);
dl_info[i]->has_rnti = 1;
/*Fill in the right id of this round's HARQ process for this UE*/
unsigned char harq_id;
unsigned char harq_status;
flexran_get_harq(mod_id, UE_PCCID(mod_id,i), i, frame, subframe, &harq_id, &harq_status);
dl_info[i]->harq_process_id = harq_id;
// uint8_t harq_id;
//uint8_t harq_status;
// flexran_get_harq(mod_id, UE_PCCID(mod_id,i), i, frame, subframe, &harq_id, &harq_status);
dl_info[i]->harq_process_id = available_harq[UE_id];
harq_pid_updated[UE_id][available_harq[UE_id]] = 0;
dl_info[i]->has_harq_process_id = 1;
/* Fill in the status of the HARQ process (2 TBs)*/
dl_info[i]->n_harq_status = 2;
dl_info[i]->harq_status = malloc(sizeof(uint32_t) * dl_info[i]->n_harq_status);
for (j = 0; j < dl_info[i]->n_harq_status; j++) {
dl_info[i]->harq_status[j] = harq_pid_round[UE_id][available_harq[UE_id]];
// TODO: This should be different per TB
if(harq_status == 0)
dl_info[i]->harq_status[j] = PROTOCOL__FLEX_HARQ_STATUS__FLHS_ACK;
else if (harq_status > 0)
dl_info[i]->harq_status[j] = PROTOCOL__FLEX_HARQ_STATUS__FLHS_NACK;
}
// LOG_I(FLEXRAN_AGENT, "Sending subframe trigger for frame %d and subframe %d and harq %d (round %d)\n", flexran_get_current_frame(mod_id), (flexran_get_current_subframe(mod_id) + 1) % 10, dl_info[i]->harq_process_id, dl_info[i]->harq_status[0]);
if(dl_info[i]->harq_status[0] > 0) {
// LOG_I(FLEXRAN_AGENT, "[Frame %d][Subframe %d]Need to make a retransmission for harq %d (round %d)\n", flexran_get_current_frame(mod_id), flexran_get_current_subframe(mod_id), dl_info[i]->harq_process_id, dl_info[i]->harq_status[0]);
}
/*Fill in the serving cell index for this UE */
dl_info[i]->serv_cell_index = UE_PCCID(mod_id,i);
......@@ -1234,12 +1268,18 @@ int flexran_agent_mac_handle_dl_mac_config(mid_t mod_id, const void *params, Pro
}
void flexran_agent_init_mac_agent(mid_t mod_id) {
int i, j;
lfds700_misc_library_init_valid_on_current_logical_core();
lfds700_misc_prng_init(&ps[mod_id]);
int num_elements = RINGBUFFER_SIZE + 1;
//Allow RINGBUFFER_SIZE messages to be stored in the ringbuffer at any time
dl_mac_config_array[mod_id] = malloc( sizeof(struct lfds700_ringbuffer_element) * num_elements);
lfds700_ringbuffer_init_valid_on_current_logical_core( &ringbuffer_state[mod_id], dl_mac_config_array[mod_id], num_elements, &ps[mod_id], NULL );