Commit 38a908a4 authored by laurent's avatar laurent

code review comments

parent 2a49e1fb
......@@ -2337,16 +2337,6 @@ void init_RU_proc(RU_t *ru) {
if (opp_enabled == 1)
pthread_create(&ru->ru_stats_thread, NULL, ru_stats_thread, (void *)ru);
/*
if (ru->function == eNodeB_3GPP) {
usleep(10000);
LOG_I(PHY, "Signaling main thread that RU %d (is_slave %d,send_dmrs %d) is ready in state %s\n",ru->idx,ru->is_slave,ru->generate_dmrs_sync,ru_states[ru->state]);
AssertFatal((ret=pthread_mutex_lock(ru->ru_mutex))==0,"mutex_lock returns %d\n",ret);
*ru->ru_mask &= ~(1<<ru->idx);
pthread_cond_signal(ru->ru_cond);
AssertFatal((ret=pthread_mutex_unlock(ru->ru_mutex))==0,"mutex_unlock returns %d\n",ret);
}
*/
}
......
......@@ -790,9 +790,7 @@ static void *UE_thread_rxn_txnp4(void *arg) {
#endif
}
#if UE_TIMING_TRACE
start_meas(&UE->generic_stat);
#endif
start_UE_TIMING(UE->generic_stat);
if (UE->mac_enabled==1) {
int ret = ue_scheduler(UE->Mod_id,
......@@ -810,9 +808,7 @@ static void *UE_thread_rxn_txnp4(void *arg) {
}
}
#if UE_TIMING_TRACE
stop_meas(&UE->generic_stat);
#endif
stop_UE_TIMING(UE->generic_stat);
// Prepare the future Tx data
......@@ -1082,9 +1078,7 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) {
for (ue_index = 0; ue_index < ue_num; ue_index++) {
ue_Mod_id = ue_thread_id + NB_THREAD_INST * ue_index; // Always 0 in standalone pnf mode
UE = PHY_vars_UE_g[ue_Mod_id][0];
#if UE_TIMING_TRACE
start_meas(&UE->generic_stat);
#endif
start_UE_TIMING(UE->generic_stat);
int rx_frame = NFAPI_SFNSF2SF(sfn_sf) < 4 ? (NFAPI_SFNSF2SFN(sfn_sf) + 1023) % 1024 : NFAPI_SFNSF2SFN(sfn_sf); // subtracting 4 from subframe_tx
int rx_subframe = NFAPI_SFNSF2SF(sfn_sf) < 4 ? NFAPI_SFNSF2SF(sfn_sf) + 6 : NFAPI_SFNSF2SF(sfn_sf) - 4;
LOG_D(MAC, "rx_frame %d rx_subframe %d\n", rx_frame, rx_subframe);
......@@ -1105,10 +1099,7 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) {
}
}
#if UE_TIMING_TRACE
stop_meas(&UE->generic_stat);
#endif
stop_UE_TIMING(UE->generic_stat);
// Prepare the future Tx data
if ((subframe_select(&UE->frame_parms, NFAPI_SFNSF2SF(sfn_sf)) == SF_UL) ||
(UE->frame_parms.frame_type == FDD)) {
......@@ -1499,9 +1490,7 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
phy_procedures_UE_SL_TX(UE,proc);
}
#if UE_TIMING_TRACE
start_meas(&UE->generic_stat);
#endif
start_UE_TIMING(UE->generic_stat);
if (UE->mac_enabled==1) {
ret = ue_scheduler(ue_Mod_id,
......@@ -1519,10 +1508,7 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
}
}
#if UE_TIMING_TRACE
stop_meas(&UE->generic_stat);
#endif
stop_UE_TIMING(UE->generic_stat);
// Prepare the future Tx data
if ((subframe_select( &UE->frame_parms, proc->subframe_tx) == SF_UL) ||
......@@ -1699,160 +1685,13 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
* \returns a pointer to an int. The storage is not on the heap and must not be freed.
*/
static void *UE_phy_stub_thread_rxn_txnp4(void *arg) {
#if 0
thread_top_init("UE_phy_stub_thread_rxn_txnp4",1,870000L,1000000L,1000000L);
module_id_t Mod_id = 0;
static __thread int UE_thread_rxtx_retval;
struct rx_tx_thread_data *rtd = arg;
UE_rxtx_proc_t *proc = rtd->proc;
PHY_VARS_UE *UE = rtd->UE;
phy_stub_ticking->ticking_var = -1;
proc->subframe_rx=proc->sub_frame_start;
// CAREFUL HERE!
wait_sync("UE_phy_stub_thread_rxn_txnp4");
while (!oai_exit) {
if (pthread_mutex_lock(&phy_stub_ticking->mutex_ticking) != 0) {
LOG_E( MAC, "[SCHED][UE] error locking mutex for UE RXTX\n" );
exit_fun("nothing to add");
}
while (phy_stub_ticking->ticking_var < 0) {
// most of the time, the thread is waiting here
//pthread_cond_wait( &proc->cond_rxtx, &proc->mutex_rxtx )
LOG_D(MAC,"Waiting for ticking_var\n");
pthread_cond_wait( &phy_stub_ticking->cond_ticking, &phy_stub_ticking->mutex_ticking);
}
phy_stub_ticking->ticking_var--;
if (pthread_mutex_unlock(&phy_stub_ticking->mutex_ticking) != 0) {
LOG_E( MAC, "[SCHED][UE] error unlocking mutex for UE RXn_TXnp4\n" );
exit_fun("nothing to add");
}
proc->subframe_rx=timer_subframe;
proc->frame_rx = timer_frame;
proc->subframe_tx=(timer_subframe+4)%10;
proc->frame_tx = proc->frame_rx + (proc->subframe_rx>5?1:0);
// Process Rx data for one sub-frame
lte_subframe_t sf_type = subframe_select( &UE->frame_parms, proc->subframe_rx);
if ((sf_type == SF_DL) ||
(UE->frame_parms.frame_type == FDD) ||
(sf_type == SF_S)) {
if (UE->frame_parms.frame_type == TDD) {
LOG_D(PHY, "TDD%d,%s: calling UE_RX\n",
UE->frame_parms.tdd_config,
(sf_type==SF_DL? "SF_DL" :
(sf_type==SF_UL? "SF_UL" :
(sf_type==SF_S ? "SF_S" : "UNKNOWN_SF_TYPE"))));
} else {
LOG_D(PHY, "%s,%s: calling UE_RX\n",
(UE->frame_parms.frame_type==FDD? "FDD":
(UE->frame_parms.frame_type==TDD? "TDD":"UNKNOWN_DUPLEX_MODE")),
(sf_type==SF_DL? "SF_DL" :
(sf_type==SF_UL? "SF_UL" :
(sf_type==SF_S ? "SF_S" : "UNKNOWN_SF_TYPE"))));
}
phy_procedures_UE_SL_RX(UE,proc);
oai_subframe_ind(timer_frame, timer_subframe);
if(dl_config_req!= NULL) {
AssertFatal(0, "dl_config_req_UE_MAC() not handled\n");
//dl_config_req_UE_MAC(dl_config_req, Mod_id);
}
//if(UE_mac_inst[Mod_id].hi_dci0_req!= NULL){
if (hi_dci0_req!=NULL && hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list!=NULL) {
AssertFatal(0, "hi_dci0_req_UE_MAC() not handled\n");
//hi_dci0_req_UE_MAC(hi_dci0_req, Mod_id);
//if(UE_mac_inst[Mod_id].hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list!=NULL){
free(hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list);
hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list = NULL;
//}
free(hi_dci0_req);
hi_dci0_req = NULL;
} else if(hi_dci0_req!=NULL) {
free(hi_dci0_req);
hi_dci0_req = NULL;
}
if (NFAPI_MODE!=NFAPI_UE_STUB_PNF)
phy_procedures_UE_SL_TX(UE,proc);
}
#if UE_TIMING_TRACE
start_meas(&UE->generic_stat);
#endif
if (UE->mac_enabled==1) {
int ret = ue_scheduler(UE->Mod_id,
proc->frame_rx,
proc->subframe_rx,
proc->frame_tx,
proc->subframe_tx,
subframe_select(&UE->frame_parms,proc->subframe_tx),
0,
0);
if (ret != CONNECTION_OK)
LOG_E( PHY, "[UE %"PRIu8"] Frame %"PRIu32", subframe %u %s\n",
UE->Mod_id, proc->frame_rx, proc->subframe_tx,get_connectionloss_errstr(ret) );
}
#if UE_TIMING_TRACE
stop_meas(&UE->generic_stat);
#endif
// Prepare the future Tx data
if ((subframe_select( &UE->frame_parms, proc->subframe_tx) == SF_UL) ||
(UE->frame_parms.frame_type == FDD) )
if ((UE_mac_inst[Mod_id].UE_mode[0] == PRACH) ) {
// check if we have PRACH opportunity
if (is_prach_subframe(&UE->frame_parms,proc->frame_tx, proc->subframe_tx)) {
PRACH_RESOURCES_t *prach_resources = ue_get_rach(Mod_id, 0, proc->frame_tx, 0, proc->subframe_tx);
if(prach_resources!=NULL) {
fill_rach_indication_UE_MAC(Mod_id, proc->frame_tx,proc->subframe_tx, UL_INFO, prach_resources->ra_PreambleIndex, prach_resources->ra_RNTI);
Msg1_transmitted(Mod_id, 0, proc->frame_tx, 0);
UE_mac_inst[Mod_id].UE_mode[0] = RA_RESPONSE;
}
//ue_prach_procedures(ue,proc,eNB_id,abstraction_flag,mode);
}
} // mode is PRACH
// Substitute call to phy_procedures Tx with call to phy_stub functions in order to trigger
// UE Tx procedures directly at the MAC layer, based on the received ul_config requests from the vnf (eNB).
// Generate UL_indications which correspond to UL traffic.
if(ul_config_req!= NULL && ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL) {
//LOG_I(MAC, "UE_phy_stub_thread_rxn_txnp4 ul_config_req is not NULL \n");
ul_config_req_UE_MAC(ul_config_req, timer_frame, timer_subframe, Mod_id);
if(ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL) {
free(ul_config_req->ul_config_request_body.ul_config_pdu_list);
ul_config_req->ul_config_request_body.ul_config_pdu_list = NULL;
}
free(ul_config_req);
ul_config_req = NULL;
} else if(ul_config_req!=NULL) {
free(ul_config_req);
ul_config_req = NULL;
}
}
#endif // disabled
static void *UE_phy_stub_thread_rxn_txnp4(void *arg)
{
// thread finished
free(arg);
return NULL; //return &UE_thread_rxtx_retval;
}
/*!
* \brief This is the main UE thread.
* This thread controls the other three UE threads:
......
......@@ -1091,7 +1091,6 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB,
LOG_D(PHY,"frame %d subframe %d O_ACK:%d o_ACK[]=%d:%d:%d:%d\n",frame,subframe,ulsch_harq->O_ACK,ulsch_harq->o_ACK[0],ulsch_harq->o_ACK[1],ulsch_harq->o_ACK[2],ulsch_harq->o_ACK[3]);
// Do ULSCH Decoding for data portion
start_meas(&eNB->ulsch_turbo_decoding_stats);
ret = ulsch_decoding_data(eNB, proc, UE_id, harq_pid, llr8_flag);
return(ret);
}
......
......@@ -370,8 +370,15 @@ int rx_pdsch(PHY_VARS_UE *ue,
#if UE_TIMING_TRACE
stop_meas(&ue->generic_stat_bis[ue->current_thread_id[subframe]][slot]);
LOG_D(PHY, "[AbsSFN %d.%d] Slot%d Symbol %d Flag %d type %d: Pilot/Data extraction %5.2f \n",frame,subframe,slot,symbol,
ue->high_speed_flag,type,ue->generic_stat_bis[ue->current_thread_id[subframe]][slot].p_time/(cpuf*1000.0));
LOG_D(PHY,
"[AbsSFN %d.%d] Slot%d Symbol %d Flag %d type %d: Pilot/Data extraction %5.2f \n",
frame,
subframe,
slot,
symbol,
ue->high_speed_flag,
type,
ue->generic_stat_bis[ue->current_thread_id[subframe]][slot].p_time / (get_cpu_freq_GHz() * 1000.0));
#endif
#if UE_TIMING_TRACE
start_meas(&ue->generic_stat_bis[ue->current_thread_id[subframe]][slot]);
......@@ -398,7 +405,13 @@ int rx_pdsch(PHY_VARS_UE *ue,
#if UE_TIMING_TRACE
stop_meas(&ue->generic_stat_bis[ue->current_thread_id[subframe]][slot]);
LOG_D(PHY, "[AbsSFN %d.%d] Slot%d Symbol %d: Channel Scale %5.2f \n",frame,subframe,slot,symbol,ue->generic_stat_bis[ue->current_thread_id[subframe]][slot].p_time/(cpuf*1000.0));
LOG_D(PHY,
"[AbsSFN %d.%d] Slot%d Symbol %d: Channel Scale %5.2f \n",
frame,
subframe,
slot,
symbol,
ue->generic_stat_bis[ue->current_thread_id[subframe]][slot].p_time / (get_cpu_freq_GHz() * 1000.0));
start_meas(&ue->generic_stat_bis[ue->current_thread_id[subframe]][slot]);
#endif
......@@ -507,8 +520,14 @@ int rx_pdsch(PHY_VARS_UE *ue,
#endif
#if UE_TIMING_TRACE
stop_meas(&ue->generic_stat_bis[ue->current_thread_id[subframe]][slot]);
LOG_D(PHY, "[AbsSFN %d.%d] Slot%d Symbol %d first_symbol_flag %d: Channel Level %5.2f \n",frame,subframe,slot,symbol,first_symbol_flag,
ue->generic_stat_bis[ue->current_thread_id[subframe]][slot].p_time/(cpuf*1000.0));
LOG_D(PHY,
"[AbsSFN %d.%d] Slot%d Symbol %d first_symbol_flag %d: Channel Level %5.2f \n",
frame,
subframe,
slot,
symbol,
first_symbol_flag,
ue->generic_stat_bis[ue->current_thread_id[subframe]][slot].p_time / (get_cpu_freq_GHz() * 1000.0));
start_meas(&ue->generic_stat_bis[ue->current_thread_id[subframe]][slot]);
#endif
......@@ -731,8 +750,14 @@ int rx_pdsch(PHY_VARS_UE *ue,
#if UE_TIMING_TRACE
stop_meas(&ue->generic_stat_bis[ue->current_thread_id[subframe]][slot]);
LOG_D(PHY, "[AbsSFN %d.%d] Slot%d Symbol %d log2_maxh %d Channel Comp %5.2f \n",frame,subframe,slot,symbol,pdsch_vars[eNB_id]->log2_maxh,
ue->generic_stat_bis[ue->current_thread_id[subframe]][slot].p_time/(cpuf*1000.0));
LOG_D(PHY,
"[AbsSFN %d.%d] Slot%d Symbol %d log2_maxh %d Channel Comp %5.2f \n",
frame,
subframe,
slot,
symbol,
pdsch_vars[eNB_id]->log2_maxh,
ue->generic_stat_bis[ue->current_thread_id[subframe]][slot].p_time / (get_cpu_freq_GHz() * 1000.0));
start_meas(&ue->generic_stat_bis[ue->current_thread_id[subframe]][slot]);
#endif
......@@ -805,7 +830,13 @@ int rx_pdsch(PHY_VARS_UE *ue,
#if UE_TIMING_TRACE
stop_meas(&ue->generic_stat_bis[ue->current_thread_id[subframe]][slot]);
LOG_D(PHY, "[AbsSFN %d.%d] Slot%d Symbol %d: Channel Combine %5.2f \n",frame,subframe,slot,symbol,ue->generic_stat_bis[ue->current_thread_id[subframe]][slot].p_time/(cpuf*1000.0));
LOG_D(PHY,
"[AbsSFN %d.%d] Slot%d Symbol %d: Channel Combine %5.2f \n",
frame,
subframe,
slot,
symbol,
ue->generic_stat_bis[ue->current_thread_id[subframe]][slot].p_time / (get_cpu_freq_GHz() * 1000.0));
start_meas(&ue->generic_stat_bis[ue->current_thread_id[subframe]][slot]);
#endif
//printf("LLR dlsch0_harq->Qm %d rx_type %d cw0 %d cw1 %d symbol %d \n",dlsch0_harq->Qm,rx_type,codeword_TB0,codeword_TB1,symbol);
......@@ -1168,7 +1199,13 @@ int rx_pdsch(PHY_VARS_UE *ue,
#if UE_TIMING_TRACE
stop_meas(&ue->generic_stat_bis[ue->current_thread_id[subframe]][slot]);
LOG_D(PHY, "[AbsSFN %d.%d] Slot%d Symbol %d: LLR Computation %5.2f \n",frame,subframe,slot,symbol,ue->generic_stat_bis[ue->current_thread_id[subframe]][slot].p_time/(cpuf*1000.0));
LOG_D(PHY,
"[AbsSFN %d.%d] Slot%d Symbol %d: LLR Computation %5.2f \n",
frame,
subframe,
slot,
symbol,
ue->generic_stat_bis[ue->current_thread_id[subframe]][slot].p_time / (get_cpu_freq_GHz() * 1000.0));
#endif
// Please keep it: useful for debugging
#if 0
......
......@@ -121,14 +121,10 @@ int slot_fep(PHY_VARS_UE *ue,
dft(dftsizeidx,(int16_t *)tmp_dft_in,
(int16_t *)&common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1);
} else { // use dft input from RX buffer directly
#if UE_TIMING_TRACE
start_meas(&ue->rx_dft_stats);
#endif
start_UE_TIMING(ue->rx_dft_stats);
dft(dftsizeidx,(int16_t *)&common_vars->rxdata[aa][(rx_offset) % frame_length_samples],
(int16_t *)&common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1);
#if UE_TIMING_TRACE
stop_meas(&ue->rx_dft_stats);
#endif
stop_UE_TIMING(ue->rx_dft_stats);
}
} else {
rx_offset += (frame_parms->ofdm_symbol_size+nb_prefix_samples)*l;// +
......@@ -145,9 +141,7 @@ int slot_fep(PHY_VARS_UE *ue,
(void *)&common_vars->rxdata[aa][0],
frame_parms->ofdm_symbol_size*sizeof(int));
#if UE_TIMING_TRACE
start_meas(&ue->rx_dft_stats);
#endif
start_UE_TIMING(ue->rx_dft_stats);
if ((rx_offset&7)!=0) { // if input to dft is not 128-bit aligned, issue for size 6 and 15 PRBs
memcpy((void *)tmp_dft_in,
......@@ -160,9 +154,7 @@ int slot_fep(PHY_VARS_UE *ue,
(int16_t *)&common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].rxdataF[aa][frame_parms->ofdm_symbol_size*symbol],1);
}
#if UE_TIMING_TRACE
stop_meas(&ue->rx_dft_stats);
#endif
stop_UE_TIMING(ue->rx_dft_stats);
}
......@@ -178,17 +170,13 @@ int slot_fep(PHY_VARS_UE *ue,
#ifdef DEBUG_FEP
printf("Channel estimation eNB %d, aatx %d, slot %d, symbol %d\n",eNB_id,aa,Ns,l);
#endif
#if UE_TIMING_TRACE
start_meas(&ue->dlsch_channel_estimation_stats);
#endif
start_UE_TIMING(ue->dlsch_channel_estimation_stats);
lte_dl_channel_estimation(ue,eNB_id,0,
Ns,
aa,
l,
symbol);
#if UE_TIMING_TRACE
stop_meas(&ue->dlsch_channel_estimation_stats);
#endif
stop_UE_TIMING(ue->dlsch_channel_estimation_stats);
for (i=0; i<ue->measurements.n_adj_cells; i++) {
lte_dl_channel_estimation(ue,eNB_id,i+1,
......@@ -206,17 +194,13 @@ int slot_fep(PHY_VARS_UE *ue,
#endif
if (l==(4-frame_parms->Ncp)) {
#if UE_TIMING_TRACE
start_meas(&ue->dlsch_freq_offset_estimation_stats);
#endif
start_UE_TIMING(ue->dlsch_freq_offset_estimation_stats);
lte_est_freq_offset(common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[Ns>>1]].dl_ch_estimates[0],
frame_parms,
l,
&common_vars->freq_offset,
reset_freq_est);
#if UE_TIMING_TRACE
stop_meas(&ue->dlsch_freq_offset_estimation_stats);
#endif
stop_UE_TIMING(ue->dlsch_freq_offset_estimation_stats);
}
}
}
......
......@@ -107,17 +107,13 @@ int slot_fep_mbsfn(PHY_VARS_UE *ue,
memset(&common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF[aa][frame_parms->ofdm_symbol_size*l],0,frame_parms->ofdm_symbol_size*sizeof(int));
if (l==0) {
#if UE_TIMING_TRACE
start_meas(&ue->rx_dft_stats);
#endif
start_UE_TIMING(ue->rx_dft_stats);
dft(dftsizeidx,(int16_t *)&common_vars->rxdata[aa][(sample_offset +
nb_prefix_samples0 +
subframe_offset -
SOFFSET) % frame_length_samples],
(int16_t *)&common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF[aa][frame_parms->ofdm_symbol_size*l],1);
#if UE_TIMING_TRACE
stop_meas(&ue->rx_dft_stats);
#endif
stop_UE_TIMING(ue->rx_dft_stats);
} else {
if ((sample_offset +
(frame_parms->ofdm_symbol_size+nb_prefix_samples0+nb_prefix_samples) +
......@@ -128,18 +124,14 @@ int slot_fep_mbsfn(PHY_VARS_UE *ue,
(short *)&common_vars->rxdata[aa][0],
frame_parms->ofdm_symbol_size*sizeof(int));
#if UE_TIMING_TRACE
start_meas(&ue->rx_dft_stats);
#endif
start_UE_TIMING(ue->rx_dft_stats);
dft(dftsizeidx,(int16_t *)&common_vars->rxdata[aa][(sample_offset +
(frame_parms->ofdm_symbol_size+nb_prefix_samples0+nb_prefix_samples) +
(frame_parms->ofdm_symbol_size+nb_prefix_samples)*(l-1) +
subframe_offset-
SOFFSET) % frame_length_samples],
(int16_t *)&common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF[aa][frame_parms->ofdm_symbol_size*l],1);
#if UE_TIMING_TRACE
stop_meas(&ue->rx_dft_stats);
#endif
stop_UE_TIMING(ue->rx_dft_stats);
}
}
......@@ -262,17 +254,13 @@ int slot_fep_mbsfn_khz_1dot25(PHY_VARS_UE *ue,
for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
memset(&common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF[aa][0],0,ofdm_symbol_size*sizeof(int));
#if UE_TIMING_TRACE
start_meas(&ue->rx_dft_stats);
#endif
start_UE_TIMING(ue->rx_dft_stats);
dft(dftsizeidx,(int16_t *)&common_vars->rxdata[aa][(sample_offset +
nb_prefix_samples +
subframe_offset -
SOFFSET) % frame_length_samples],
(int16_t *)&common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF[aa][0],1);
#if UE_TIMING_TRACE
stop_meas(&ue->rx_dft_stats);
#endif
stop_UE_TIMING(ue->rx_dft_stats);
}
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
......
......@@ -68,6 +68,14 @@
#include <pthread.h>
#include "assertions.h"
#if UE_TIMING_TRACE
#define start_UE_TIMING(a) start_meas(&(a))
#define stop_UE_TIMING(a) stop_meas(&(a))
#else
#define start_UE_TIMING(a)
#define stop_UE_TIMING(a)
#endif
#ifdef MEX
#include "mex.h"
#define msg mexPrintf
......
......@@ -1453,17 +1453,6 @@ void pusch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) {
0, // control_only_flag
ulsch_harq->V_UL_DAI,
ulsch_harq->nb_rb > 20 ? 1 : 0);
/*
int ulsch_id=-1;
for (ulsch_id=0;ulsch_id<NUMBER_OF_ULSCH_MAX;ulsch_id++)
if (ulsch->rnti == eNB->ulsch_stats[ulsch_id].rnti) break;
AssertFatal(ulsch_id>=0,"no ulsch_id found\n");
if (eNB->ulsch_stats[ulsch_id].round_trials[0]>100) {
dump_ulsch(eNB,frame,subframe,i,ulsch_harq->round);
AssertFatal(1==0,"exiting\n");
}
*/
}
else if ((ulsch) &&
(ulsch->rnti>0) &&
......@@ -1485,12 +1474,12 @@ void pusch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) {
if (req == NULL)
break; // Tpool has been stopped
postDecode(proc, req);
const time_stats_t ts = exec_time_stats_NotifiedFIFO(req);
merge_meas(&eNB->ulsch_turbo_decoding_stats, &ts);
delNotifiedFIFO_elt(req);
}
if (decode) {
if (decode)
stop_meas(&eNB->ulsch_decoding_stats);
stop_meas(&eNB->ulsch_turbo_decoding_stats);
}
}
extern int oai_exit;
......
......@@ -377,9 +377,7 @@ ue_send_sdu(module_id_t module_idP,
unsigned char rx_lcids[NB_RB_MAX];
unsigned short rx_lengths[NB_RB_MAX];
unsigned char *tx_sdu;
#if UE_TIMING_TRACE
start_meas(&UE_mac_inst[module_idP].rx_dlsch_sdu);
#endif
start_UE_TIMING(UE_mac_inst[module_idP].rx_dlsch_sdu);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SEND_SDU, VCD_FUNCTION_IN);
//LOG_D(MAC,"sdu: %x.%x.%x\n",sdu[0],sdu[1],sdu[2]);
......@@ -563,16 +561,12 @@ ue_send_sdu(module_id_t module_idP,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SEND_SDU, VCD_FUNCTION_OUT);
#if UE_TIMING_TRACE
stop_meas(&UE_mac_inst[module_idP].rx_dlsch_sdu);
#endif
stop_UE_TIMING(UE_mac_inst[module_idP].rx_dlsch_sdu);
}
void ue_decode_si_mbms(module_id_t module_idP, int CC_id, frame_t frameP,
uint8_t eNB_index, void *pdu, uint16_t len) {
#if UE_TIMING_TRACE
start_meas(&UE_mac_inst[module_idP].rx_si);
#endif
start_UE_TIMING(UE_mac_inst[module_idP].rx_si);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_SI, VCD_FUNCTION_IN);
LOG_D(MAC, "[UE %d] Frame %d Sending SI MBMS to RRC (LCID Id %d,len %d)\n",
......@@ -583,9 +577,7 @@ void ue_decode_si_mbms(module_id_t module_idP, int CC_id, frame_t frameP,
0);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_SI, VCD_FUNCTION_OUT);
#if UE_TIMING_TRACE
stop_meas(&UE_mac_inst[module_idP].rx_si);
#endif
stop_UE_TIMING(UE_mac_inst[module_idP].rx_si);
trace_pdu(DIRECTION_UPLINK,
(uint8_t *) pdu,
......@@ -603,9 +595,7 @@ void ue_decode_si_mbms(module_id_t module_idP, int CC_id, frame_t frameP,
void
ue_decode_si(module_id_t module_idP, int CC_id, frame_t frameP,
uint8_t eNB_index, void *pdu, uint16_t len) {
#if UE_TIMING_TRACE
start_meas(&UE_mac_inst[module_idP].rx_si);
#endif
start_UE_TIMING(UE_mac_inst[module_idP].rx_si);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_SI, VCD_FUNCTION_IN);
LOG_D(MAC, "[UE %d] Frame %d Sending SI to RRC (LCID Id %d,len %d)\n",
......@@ -616,9 +606,7 @@ ue_decode_si(module_id_t module_idP, int CC_id, frame_t frameP,
0);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_SI, VCD_FUNCTION_OUT);
#if UE_TIMING_TRACE
stop_meas(&UE_mac_inst[module_idP].rx_si);
#endif
stop_UE_TIMING(UE_mac_inst[module_idP].rx_si);
trace_pdu(DIRECTION_UPLINK,
(uint8_t *) pdu,
len,
......@@ -632,9 +620,7 @@ ue_decode_si(module_id_t module_idP, int CC_id, frame_t frameP,
void
ue_decode_p(module_id_t module_idP, int CC_id, frame_t frameP,
uint8_t eNB_index, void *pdu, uint16_t len) {
#if UE_TIMING_TRACE
start_meas(&UE_mac_inst[module_idP].rx_p);
#endif
start_UE_TIMING(UE_mac_inst[module_idP].rx_p);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_PCCH, VCD_FUNCTION_IN);
LOG_D(MAC,
......@@ -646,9 +632,7 @@ ue_decode_p(module_id_t module_idP, int CC_id, frame_t frameP,
0);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_PCCH, VCD_FUNCTION_OUT);
#if UE_TIMING_TRACE
stop_meas(&UE_mac_inst[module_idP].rx_p);
#endif
stop_UE_TIMING(UE_mac_inst[module_idP].rx_p);
trace_pdu(DIRECTION_UPLINK,
(uint8_t *) pdu,
len,
......@@ -719,9 +703,7 @@ ue_send_mch_sdu(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
unsigned char num_sdu, i, j, *payload_ptr;
unsigned char rx_lcids[NB_RB_MAX];
unsigned short rx_lengths[NB_RB_MAX];
#if UE_TIMING_TRACE
start_meas(&UE_mac_inst[module_idP].rx_mch_sdu);
#endif
start_UE_TIMING(UE_mac_inst[module_idP].rx_mch_sdu);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SEND_MCH_SDU, VCD_FUNCTION_IN);
LOG_D(MAC,
......@@ -814,9 +796,7 @@ ue_send_mch_sdu(module_id_t module_idP, uint8_t CC_id, frame_t frameP,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SEND_MCH_SDU, VCD_FUNCTION_OUT);
#if UE_TIMING_TRACE
stop_meas(&UE_mac_inst[module_idP].rx_mch_sdu);
#endif
stop_UE_TIMING(UE_mac_inst[module_idP].rx_mch_sdu);
}
void ue_send_sl_sdu(module_id_t module_idP,
......@@ -1493,10 +1473,7 @@ int ue_query_mch(module_id_t module_idP, uint8_t CC_id, uint32_t frameP, uint32_
int mcch_flag = 0, mtch_flag = 0, msi_flag = 0;
long mch_scheduling_period = -1;
uint8_t mch_lcid = 0;
#if UE_TIMING_TRACE
start_meas(&UE_mac_inst[module_idP].ue_query_mch);
#endif
start_UE_TIMING(UE_mac_inst[module_idP].ue_query_mch);
if (UE_mac_inst[module_idP].pmch_Config[0]) {
mch_scheduling_period = 8 << UE_mac_inst[module_idP].pmch_Config[0]->mch_SchedulingPeriod_r9;
}
......@@ -1996,9 +1973,7 @@ int ue_query_mch(module_id_t module_idP, uint8_t CC_id, uint32_t frameP, uint32_
}
} // end of for
#if UE_TIMING_TRACE
stop_meas(&UE_mac_inst[module_idP].ue_query_mch);
#endif
stop_UE_TIMING(UE_mac_inst[module_idP].ue_query_mch);
if ((mcch_flag == 1)) { // || (msi_flag==1))
*mcch_active = 1;
......@@ -2349,9 +2324,7 @@ ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
module_idP, frameP, subframe, buflen);
AssertFatal(CC_id == 0,
"Transmission on secondary CCs is not supported yet\n");
#if UE_TIMING_TRACE
start_meas(&UE_mac_inst[module_idP].tx_ulsch_sdu);
#endif
start_UE_TIMING(UE_mac_inst[module_idP].tx_ulsch_sdu);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GET_SDU, VCD_FUNCTION_IN);
bsr_header_len = 0;
......@@ -2893,9 +2866,7 @@ ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GET_SDU, VCD_FUNCTION_OUT);
#if UE_TIMING_TRACE
stop_meas(&UE_mac_inst[module_idP].tx_ulsch_sdu);
#endif
stop_UE_TIMING(UE_mac_inst[module_idP].tx_ulsch_sdu);
trace_pdu(DIRECTION_UPLINK, ulsch_buffer, buflen, module_idP, WS_C_RNTI,
UE_mac_inst[module_idP].crnti,
UE_mac_inst[module_idP].txFrame,
......@@ -2933,9 +2904,7 @@ ue_scheduler(const module_id_t module_idP,
protocol_ctxt_t ctxt;
MessageDef *msg_p;
int result;
#if UE_TIMING_TRACE
start_meas(&UE_mac_inst[module_idP].ue_scheduler);
#endif
start_UE_TIMING(UE_mac_inst[module_idP].ue_scheduler);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SCHEDULER, VCD_FUNCTION_IN);
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_NO,
......@@ -3001,9 +2970,7 @@ ue_scheduler(const module_id_t module_idP,
LOG_E(MAC, "RRCConnectionSetup failed, returning to IDLE state\n");
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SCHEDULER, VCD_FUNCTION_OUT);
#if UE_TIMING_TRACE
stop_meas(&UE_mac_inst[module_idP].ue_scheduler);
#endif
stop_UE_TIMING(UE_mac_inst[module_idP].ue_scheduler);
return (CONNECTION_LOST);
break;
......@@ -3011,9 +2978,7 @@ ue_scheduler(const module_id_t module_idP,
LOG_E(MAC, "RRC Loss of synch, returning PHY_RESYNCH\n");
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SCHEDULER, VCD_FUNCTION_OUT);
#if UE_TIMING_TRACE
stop_meas(&UE_mac_inst[module_idP].ue_scheduler);
#endif
stop_UE_TIMING(UE_mac_inst[module_idP].ue_scheduler);
return (PHY_RESYNCH);
case RRC_Handover_failed:
......@@ -3030,9 +2995,7 @@ ue_scheduler(const module_id_t module_idP,
"RRC handover, Instruct PHY to start the contention-free PRACH and synchronization\n");
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SCHEDULER, VCD_FUNCTION_OUT);
#if UE_TIMING_TRACE
stop_meas(&UE_mac_inst[module_idP].ue_scheduler);
#endif
stop_UE_TIMING(UE_mac_inst[module_idP].ue_scheduler);
return (PHY_HO_PRACH);
default:
......@@ -3052,11 +3015,9 @@ ue_scheduler(const module_id_t module_idP,
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SCHEDULER,
VCD_FUNCTION_OUT);
stop_meas(&UE_mac_inst[module_idP].ue_scheduler);
stop_UE_TIMING(UE_mac_inst[module_idP].ue_scheduler);
AssertFatal(1 == 0, "");
#if UE_TIMING_TRACE
stop_meas(&UE_mac_inst[module_idP].ue_scheduler);
#endif
stop_UE_TIMING(UE_mac_inst[module_idP].ue_scheduler);
//return(RRC_OK);
}
......@@ -3175,9 +3136,7 @@ ue_scheduler(const module_id_t module_idP,
LOG_T(MAC, "[UE %d] Release all SRs \n", module_idP);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SCHEDULER, VCD_FUNCTION_OUT);
#if UE_TIMING_TRACE
stop_meas(&UE_mac_inst[module_idP].ue_scheduler);
#endif
stop_UE_TIMING(UE_mac_inst[module_idP].ue_scheduler);
return (CONNECTION_OK);
}
......@@ -3233,9 +3192,7 @@ ue_scheduler(const module_id_t module_idP,
//If the UE has UL resources allocated for new transmission for this TTI here:
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME
(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SCHEDULER, VCD_FUNCTION_OUT);
#if UE_TIMING_TRACE
stop_meas(&UE_mac_inst[module_idP].ue_scheduler);
#endif
stop_UE_TIMING(UE_mac_inst[module_idP].ue_scheduler);
return (CONNECTION_OK);
}
......
......@@ -971,7 +971,7 @@ void release_UE_in_freeList(module_id_t mod_id) {
for(int ue_num = 0; ue_num < sizeofArray(eNB_MAC->UE_free_ctrl) ; ue_num++) {
rnti_t rnti = eNB_MAC->UE_free_ctrl[ue_num].rnti;
if (!rnti)
if (rnti == 0)
continue;
protocol_ctxt_t ctxt;
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, mod_id, ENB_FLAG_YES, rnti, 0, 0, mod_id);
......@@ -1006,15 +1006,14 @@ void release_UE_in_freeList(module_id_t mod_id) {
int pdu_number = ul_req_tmp->number_of_pdus;
for (int pdu_index = pdu_number - 1; pdu_index >= 0; pdu_index--) {
if ((ul_req_tmp->ul_config_pdu_list[pdu_index].ulsch_pdu.ulsch_pdu_rel8.rnti == rnti)
|| (ul_req_tmp->ul_config_pdu_list[pdu_index].uci_harq_pdu.ue_information.ue_information_rel8.rnti == rnti)
|| (ul_req_tmp->ul_config_pdu_list[pdu_index].uci_cqi_pdu.ue_information.ue_information_rel8.rnti == rnti)
|| (ul_req_tmp->ul_config_pdu_list[pdu_index].uci_sr_pdu.ue_information.ue_information_rel8.rnti == rnti)
|| (ul_req_tmp->ul_config_pdu_list[pdu_index].srs_pdu.srs_pdu_rel8.rnti == rnti)) {
nfapi_ul_config_request_pdu_t *pdu = ul_req_tmp->ul_config_pdu_list + pdu_index;
if (pdu->ulsch_pdu.ulsch_pdu_rel8.rnti == rnti || pdu->uci_harq_pdu.ue_information.ue_information_rel8.rnti == rnti || pdu->uci_cqi_pdu.ue_information.ue_information_rel8.rnti == rnti
|| pdu->uci_sr_pdu.ue_information.ue_information_rel8.rnti == rnti || pdu->srs_pdu.srs_pdu_rel8.rnti == rnti) {
LOG_I(RRC, "remove UE %x from ul_config_pdu_list %d/%d\n", rnti, pdu_index, pdu_number);
// Very inefficient memory management, but simple
if (pdu_index < pdu_number - 1) {
memcpy(&ul_req_tmp->ul_config_pdu_list[pdu_index], &ul_req_tmp->ul_config_pdu_list[pdu_index + 1], (pdu_number - 1 - pdu_index) * sizeof(nfapi_ul_config_request_pdu_t));
memcpy(pdu, pdu + 1, (pdu_number - 1 - pdu_index) * sizeof(nfapi_ul_config_request_pdu_t));
}
ul_req_tmp->number_of_pdus--;
......@@ -1879,46 +1878,6 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete(
PDCP_TRANSMISSION_MODE_CONTROL);
}
// delete UE data of prior RNTI. UE use current RNTI.
// protocol_ctxt_t ctxt_prior = *ctxt_pP;
// ctxt_prior.rnti = reestablish_rnti;
//
// LTE_eNB_ULSCH_t *ulsch = NULL;
// nfapi_ul_config_request_body_t *ul_req_tmp = NULL;
// PHY_VARS_eNB *eNB_PHY = NULL;
// eNB_MAC_INST *eNB_MAC = RC.mac[ctxt_prior.module_id];
// for (int CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
// eNB_PHY = RC.eNB[ctxt_prior.module_id][CC_id];
// for (int i=0; i<MAX_MOBILES_PER_ENB; i++) {
// ulsch = eNB_PHY->ulsch[i];
// if((ulsch != NULL) && (ulsch->rnti == ctxt_prior.rnti)){
// void clean_eNb_ulsch(LTE_eNB_ULSCH_t *ulsch);
// LOG_I(RRC, "clean_eNb_ulsch UE %x \n", ctxt_prior.rnti);
// clean_eNb_ulsch(ulsch);
// break;
// }
// }
//
// for(int j = 0; j < 10; j++){
// ul_req_tmp = &eNB_MAC->UL_req_tmp[CC_id][j].ul_config_request_body;
// if(ul_req_tmp){
// int pdu_number = ul_req_tmp->number_of_pdus;
// for(int pdu_index = pdu_number-1; pdu_index >= 0; pdu_index--){
// if(ul_req_tmp->ul_config_pdu_list[pdu_index].ulsch_pdu.ulsch_pdu_rel8.rnti == ctxt_prior.rnti){
// LOG_I(RRC, "remove UE %x from ul_config_pdu_list %d/%d\n", ctxt_prior.rnti, pdu_index, pdu_number);
// if(pdu_index < pdu_number -1){
// memcpy(&ul_req_tmp->ul_config_pdu_list[pdu_index], &ul_req_tmp->ul_config_pdu_list[pdu_index+1], (pdu_number-1-pdu_index) * sizeof(nfapi_ul_config_request_pdu_t));
// }
// ul_req_tmp->number_of_pdus--;
// }
// }
// }
// }
// }
// rrc_mac_remove_ue(ctxt_prior.module_id, ctxt_prior.rnti);
// rrc_rlc_remove_ue(&ctxt_prior);
// pdcp_remove_UE(&ctxt_prior);
// add UE info to freeList for RU_thread to remove the UE instead of remove it here
LOG_I(RRC, "[RRCConnectionReestablishment]put UE %x into freeList\n", reestablish_rnti);
put_UE_in_freelist(ctxt_pP->module_id, reestablish_rnti, 0);
}
......
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