Commit c84ddacd authored by Wang Tsu-Han's avatar Wang Tsu-Han

Seperate Front haul RX TX and process into three threads

parent ecee5edc
......@@ -2260,8 +2260,8 @@ uint8_t generate_dci_top(uint8_t num_pdcch_symbols,
// reset all bits to <NIL>, here we set <NIL> elements as 2
// memset(e, 2, DCI_BITS_MAX);
// here we interpret NIL as a random QPSK sequence. That makes power estimation easier.
for (i=0; i<DCI_BITS_MAX; i++)
e[i]=taus()&1;
/*for (i=0; i<DCI_BITS_MAX; i++)
e[i]=taus()&1;*/
e_ptr = e;
......
......@@ -408,7 +408,6 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
mod_order = dlsch->harq_processes[harq_pid]->Qm;
G = get_G(frame_parms,nb_rb,dlsch->harq_processes[harq_pid]->rb_alloc,mod_order,dlsch->harq_processes[harq_pid]->Nl,num_pdcch_symbols,frame,subframe,dlsch->harq_processes[harq_pid]->mimo_mode==TM7?7:0);
if (dlsch->harq_processes[harq_pid]->round == 0) { // this is a new packet
// Add 24-bit crc (polynomial A) to payload
......@@ -441,7 +440,6 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
return(-1);
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_OUT);
++proc->instance_cnt_te;
proc->tep.eNB = eNB;
......@@ -458,7 +456,6 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
pthread_mutex_unlock( &proc->mutex_te );
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_IN);
for (r=dlsch->harq_processes[harq_pid]->C>>1; r<dlsch->harq_processes[harq_pid]->C; r++) {
if (r<dlsch->harq_processes[harq_pid]->Cminus)
......@@ -590,6 +587,7 @@ int dlsch_encoding_all(PHY_VARS_eNB *eNB,
C = C+1;
}
}
if(C >= 5)
{
encoding_return =
......
......@@ -564,6 +564,8 @@ typedef struct eNB_proc_t_s {
eNB_rxtx_proc_t proc_rxtx[2];
/// stats thread pthread descriptor
pthread_t coding_stats_thread;
/// for waking up tx procedure
RU_proc_t *ru_proc;
} eNB_proc_t;
......
......@@ -336,6 +336,7 @@ void pdsch_procedures(PHY_VARS_eNB *eNB,
// 36-212
start_meas(&eNB->dlsch_encoding_stats);
AssertFatal(dlsch_harq->pdu!=NULL,"dlsch_harq->pdu == NULL (rnti %x)\n",dlsch->rnti);
eNB->te(eNB,
dlsch_harq->pdu,
dlsch_harq->pdsch_start,
......@@ -486,7 +487,7 @@ void phy_procedures_eNB_TX(PHY_VARS_eNB *eNB,
LOG_D(PHY,"[eNB %"PRIu8"] Frame %d, subframe %d: Calling generate_dci_top (pdcch) (num_dci %"PRIu8")\n",eNB->Mod_id,frame, subframe,
num_dci);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PDCCH_TX,1);
generate_dci_top(num_pdcch_symbols,
num_dci,
&eNB->pdcch_vars[subframe&1].dci_alloc[0],
......
......@@ -170,7 +170,7 @@ void feptx_ofdm_2thread(RU_t *ru) {
wait.tv_sec=0;
wait.tv_nsec=5000000L;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM , 1 );
start_meas(&ru->ofdm_mod_stats);
if (subframe_select(fp,subframe) == SF_UL) return;
......@@ -207,6 +207,7 @@ void feptx_ofdm_2thread(RU_t *ru) {
wait_on_busy_condition(&proc->mutex_feptx,&proc->cond_feptx,&proc->instance_cnt_feptx,"feptx thread");
stop_meas(&ru->ofdm_mod_stats);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM , 0 );
}
......@@ -419,8 +420,10 @@ static void *fep_thread(void *param) {
while (!oai_exit) {
if (wait_on_condition(&proc->mutex_fep,&proc->cond_fep,&proc->instance_cnt_fep,"fep thread")<0) break;
if (wait_on_condition(&proc->mutex_fep,&proc->cond_fep,&proc->instance_cnt_fep,"fep thread")<0) break;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX1, 1 );
fep0(ru,0);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX1, 0 );
if (release_thread(&proc->mutex_fep,&proc->instance_cnt_fep,"fep thread")<0) break;
if (pthread_cond_signal(&proc->cond_fep) != 0) {
......@@ -471,6 +474,7 @@ void ru_fep_full_2thread(RU_t *ru) {
wait.tv_sec=0;
wait.tv_nsec=5000000L;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX, 1 );
start_meas(&ru->ofdm_demod_stats);
if (pthread_mutex_timedlock(&proc->mutex_fep,&wait) != 0) {
......@@ -503,6 +507,7 @@ void ru_fep_full_2thread(RU_t *ru) {
wait_on_busy_condition(&proc->mutex_fep,&proc->cond_fep,&proc->instance_cnt_fep,"fep thread");
stop_meas(&ru->ofdm_demod_stats);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX, 0 );
}
......
[*]
[*] GTKWave Analyzer v3.3.58 (w)1999-2014 BSI
[*] Fri Oct 27 14:01:34 2017
[*] Thu Nov 2 14:19:21 2017
[*]
[dumpfile] "/tmp/openair_dump_eNB.vcd"
[dumpfile_mtime] "Fri Oct 27 11:38:57 2017"
[dumpfile_size] 13854600
[savefile] "/homes/kaltenbe/Devel/openair/openairinterface5g/targets/RT/USER/eNB_usrp.gtkw"
[timestart] 15494750000
[dumpfile_mtime] "Thu Nov 2 14:15:28 2017"
[dumpfile_size] 1636821
[savefile] "/homes/wangts/openairinterface5g/targets/RT/USER/eNB_usrp.gtkw"
[timestart] 14181427000
[size] 1855 1056
[pos] 65 0
*-19.872988 15495913242 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
*-19.872988 15497443000 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
[sst_width] 386
[signals_width] 302
[sst_expanded] 1
......@@ -32,9 +32,14 @@ functions.mac_schedule_dlsch
functions.macxface_eNB_dlsch_ulsch_scheduler
functions.macxface_ue_scheduler
functions.phy_eNB_ofdm_mod_l
@24
variables.frame_number_RX0_eNB[63:0]
@25
variables.frame_number_TX0_eNB[63:0]
@28
functions.phy_eNB_dlsch_modulation
functions.phy_eNB_dlsch_encoding
functions.phy_eNB_dlsch_scrambling
functions.phy_eNB_dlsch_modulation
functions.phy_eNB_beam_precoding
functions.phy_enb_pdcch_tx
functions.phy_enb_prach_rx
......
......@@ -170,6 +170,8 @@ static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_nam
// UE-specific RX processing for subframe n
phy_procedures_eNB_uespec_RX(eNB, proc, no_relay );
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER , 1 );
pthread_mutex_lock(&eNB->UL_INFO_mutex);
eNB->UL_INFO.frame = proc->frame_rx;
eNB->UL_INFO.subframe = proc->subframe_rx;
......@@ -177,6 +179,9 @@ static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_nam
eNB->UL_INFO.CC_id = eNB->CC_id;
eNB->if_inst->UL_indication(&eNB->UL_INFO);
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER , 0 );
// *****************************************
// TX processing for subframe n+4
// run PHY TX procedures the one after the other for all CCs to avoid race conditions
......@@ -207,9 +212,10 @@ static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_nam
static void* eNB_thread_rxtx( void* param ) {
static int eNB_thread_rxtx_status;
eNB_rxtx_proc_t *proc = (eNB_rxtx_proc_t*)param;
eNB_proc_t *eNB_proc = (eNB_proc_t*)param;
eNB_rxtx_proc_t *proc = &eNB_proc->proc_rxtx[0];
PHY_VARS_eNB *eNB = RC.eNB[0][proc->CC_id];
//RU_proc_t *ru_proc = NULL;
char thread_name[100];
......@@ -227,14 +233,24 @@ static void* eNB_thread_rxtx( void* param ) {
if (wait_on_condition(&proc->mutex_rxtx,&proc->cond_rxtx,&proc->instance_cnt_rxtx,thread_name)<0) break;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0+(proc->subframe_rx&1), 1 );
//ru_proc = eNB_proc->ru_proc;
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_TX0_ENB,proc->subframe_tx);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_RX0_ENB,proc->subframe_rx);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX0_ENB,proc->frame_tx);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX0_ENB,proc->frame_rx);
if (oai_exit) break;
if (eNB->CC_id==0)
if (rxtx(eNB,proc,thread_name) < 0) break;
pthread_mutex_lock(&eNB_proc->ru_proc->mutex_eNBs);
//printf("//////////////////////////////ru_proc->instance_cnt_eNBs == %d \n",ru_proc->instance_cnt_eNBs);////////////////////////*********
++eNB_proc->ru_proc->instance_cnt_eNBs;
pthread_cond_signal(&eNB_proc->ru_proc->cond_eNBs);
pthread_mutex_unlock(&eNB_proc->ru_proc->mutex_eNBs);
//release_thread(&proc->mutex_rxtx,&proc->instance_cnt_rxtx,thread_name);
} // while !oai_exit
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0+(proc->subframe_rx&1), 0 );
......@@ -294,11 +310,10 @@ void eNB_top(PHY_VARS_eNB *eNB, int frame_rx, int subframe_rx, char *string,RU_t
if (rxtx(eNB,proc_rxtx,string) < 0) LOG_E(PHY,"eNB %d CC_id %d failed during execution\n",eNB->Mod_id,eNB->CC_id);
LOG_D(PHY,"eNB_top out %p (proc %p, CC_id %d), frame %d, subframe %d, instance_cnt_prach %d\n",
(void*)pthread_self(), proc, eNB->CC_id, proc->frame_rx,proc->subframe_rx,proc->instance_cnt_prach);
pthread_mutex_lock(&ru_proc->mutex_eNBs);
++ru_proc->instance_cnt_eNBs;
pthread_mutex_unlock(&ru_proc->mutex_eNBs);
pthread_cond_signal(&ru_proc->cond_eNBs);
pthread_mutex_lock(&ru_proc->mutex_eNBs);
++ru_proc->instance_cnt_eNBs;
pthread_mutex_unlock(&ru_proc->mutex_eNBs);
pthread_cond_signal(&ru_proc->cond_eNBs);
}
}
......@@ -306,8 +321,10 @@ void eNB_top(PHY_VARS_eNB *eNB, int frame_rx, int subframe_rx, char *string,RU_t
int wakeup_rxtx(PHY_VARS_eNB *eNB,RU_t *ru) {
eNB_proc_t *proc=&eNB->proc;
RU_proc_t *ru_proc=&ru->proc;
eNB_rxtx_proc_t *proc_rxtx=&proc->proc_rxtx[proc->frame_rx&1];
eNB_rxtx_proc_t *proc_rxtx=&proc->proc_rxtx[0];//*proc_rxtx=&proc->proc_rxtx[proc->frame_rx&1];
proc->ru_proc = &ru->proc;
LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms;
......@@ -364,11 +381,20 @@ int wakeup_rxtx(PHY_VARS_eNB *eNB,RU_t *ru) {
// The last (TS_rx mod samples_per_frame) was n*samples_per_tti,
// we want to generate subframe (n+4), so TS_tx = TX_rx+4*samples_per_tti,
// and proc->subframe_tx = proc->subframe_rx+4
proc_rxtx->timestamp_tx = proc->timestamp_rx + (4*fp->samples_per_tti);
/*proc_rxtx->timestamp_tx = proc->timestamp_rx + (4*fp->samples_per_tti);
proc_rxtx->frame_rx = proc->frame_rx;
proc_rxtx->subframe_rx = proc->subframe_rx;
proc_rxtx->frame_tx = (proc_rxtx->subframe_rx > 5) ? (proc_rxtx->frame_rx+1)&1023 : proc_rxtx->frame_rx;
proc_rxtx->subframe_tx = (proc_rxtx->subframe_rx + 4)%10;
*/
proc_rxtx->subframe_rx = ru_proc->subframe_rx;
proc_rxtx->frame_rx = ru_proc->frame_rx;
proc_rxtx->subframe_tx = (ru_proc->subframe_rx+4)%10;
proc_rxtx->frame_tx = (ru_proc->subframe_rx>5) ? (1+ru_proc->frame_rx)&1023 : ru_proc->frame_rx;
proc->frame_tx = proc_rxtx->frame_tx;
proc->frame_rx = proc_rxtx->frame_rx;
proc_rxtx->timestamp_tx = ru_proc->timestamp_tx;
// the thread can now be woken up
if (pthread_cond_signal(&proc_rxtx->cond_rxtx) != 0) {
......@@ -612,7 +638,7 @@ void init_eNB_proc(int inst) {
PHY_VARS_eNB *eNB;
eNB_proc_t *proc;
eNB_rxtx_proc_t *proc_rxtx;
pthread_attr_t *attr0=NULL,*attr1=NULL,*attr_prach=NULL,*attr_td=NULL,*attr_te=NULL;
pthread_attr_t *attr0=NULL,*attr1=NULL,*attr_prach=NULL,*attr_te=NULL,*attr_td=NULL;
#ifdef Rel14
pthread_attr_t *attr_prach_br=NULL;
#endif
......@@ -677,6 +703,7 @@ void init_eNB_proc(int inst) {
#endif
attr_td = &proc->attr_td;
attr_te = &proc->attr_te;
pthread_create( &proc_rxtx[0].pthread_rxtx, attr0, eNB_thread_rxtx, proc );
if (eNB->single_thread_flag==0) {
pthread_create( &proc_rxtx[0].pthread_rxtx, attr0, eNB_thread_rxtx, &proc_rxtx[0] );
pthread_create( &proc_rxtx[1].pthread_rxtx, attr1, eNB_thread_rxtx, &proc_rxtx[1] );
......
......@@ -900,6 +900,7 @@ void wakeup_slaves(RU_proc_t *proc) {
wait.tv_nsec=5000000L;
for (i=0;i<proc->num_slaves;i++) {
//printf("////////////////////calling for slave thrads\n");////////////////////////********
RU_proc_t *slave_proc = proc->slave_proc[i];
// wake up slave FH thread
// lock the FH mutex and make sure the thread is ready
......@@ -1116,9 +1117,9 @@ void wakeup_eNBs(RU_t *ru) {
LOG_D(PHY,"wakeup_eNBs (num %d) for RU %d\n",ru->num_eNB,ru->idx);
if (ru->num_eNB==1) {
if (0){//(ru->num_eNB==1) {
// call eNB function directly
char string[20];
sprintf(string,"Incoming RU %d",ru->idx);
LOG_D(PHY,"RU %d Waking up eNB\n",ru->idx);
......@@ -1127,8 +1128,10 @@ void wakeup_eNBs(RU_t *ru) {
else {
for (i=0;i<ru->num_eNB;i++)
{
if (ru->wakeup_rxtx(eNB_list[i],ru) < 0)
LOG_E(PHY,"could not wakeup eNB rxtx process for subframe %d\n", ru->proc.subframe_rx);
LOG_E(PHY,"could not wakeup eNB rxtx process for subframe %d\n", ru->proc.subframe_rx);
}
}
}
......@@ -1384,6 +1387,7 @@ static void* ru_thread_tx( void* param ) {
LOG_D(PHY,"ru_thread_tx: Waiting for TX processing\n");
// wait until eNBs are finished subframe RX n and TX n+4
wait_on_condition(&proc->mutex_eNBs,&proc->cond_eNBs,&proc->instance_cnt_eNBs,"ru_thread");
//printf("//////////////////instance_cnt_eNBs = %d\n",proc->instance_cnt_eNBs);//////////////////*********
// do TX front-end processing if needed (precoding and/or IDFTs)
......
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