Commit 9fe0ecba authored by Wang Tsu-Han's avatar Wang Tsu-Han

changing back the rxtx thread and add another worker thread for coding

parent 4f72b8da
This diff is collapsed.
......@@ -461,7 +461,7 @@ typedef struct eNB_proc_t_s {
/// \internal This variable is protected by \ref mutex_td.
int instance_cnt_td;
/// \internal This variable is protected by \ref mutex_te.
int instance_cnt_te;
int instance_cnt_te[2];
/// \internal This variable is protected by \ref mutex_prach.
int instance_cnt_prach;
#ifdef Rel14
......@@ -483,7 +483,7 @@ typedef struct eNB_proc_t_s {
/// pthread attributes for parallel turbo-decoder thread
pthread_attr_t attr_td;
/// pthread attributes for parallel turbo-encoder thread
pthread_attr_t attr_te;
pthread_attr_t attr_te[2];
/// pthread attributes for single eNB processing thread
pthread_attr_t attr_single;
/// pthread attributes for prach processing thread
......@@ -497,7 +497,7 @@ typedef struct eNB_proc_t_s {
/// scheduling parameters for parallel turbo-decoder thread
struct sched_param sched_param_td;
/// scheduling parameters for parallel turbo-encoder thread
struct sched_param sched_param_te;
struct sched_param sched_param_te[2];
/// scheduling parameters for single eNB thread
struct sched_param sched_param_single;
/// scheduling parameters for prach thread
......@@ -511,7 +511,7 @@ typedef struct eNB_proc_t_s {
/// pthread structure for parallel turbo-decoder thread
pthread_t pthread_td;
/// pthread structure for parallel turbo-encoder thread
pthread_t pthread_te;
pthread_t pthread_te[2];
/// pthread structure for PRACH thread
pthread_t pthread_prach;
#ifdef Rel14
......@@ -521,7 +521,7 @@ typedef struct eNB_proc_t_s {
/// condition variable for parallel turbo-decoder thread
pthread_cond_t cond_td;
/// condition variable for parallel turbo-encoder thread
pthread_cond_t cond_te;
pthread_cond_t cond_te[2];
/// condition variable for PRACH processing thread;
pthread_cond_t cond_prach;
#ifdef Rel14
......@@ -533,7 +533,7 @@ typedef struct eNB_proc_t_s {
/// mutex for parallel turbo-decoder thread
pthread_mutex_t mutex_td;
/// mutex for parallel turbo-encoder thread
pthread_mutex_t mutex_te;
pthread_mutex_t mutex_te[2];
/// mutex for PRACH thread
pthread_mutex_t mutex_prach;
#ifdef Rel14
......@@ -559,11 +559,11 @@ typedef struct eNB_proc_t_s {
/// parameters for turbo-decoding worker thread
td_params tdp;
/// parameters for turbo-encoding worker thread
te_params tep;
te_params tep[2];
/// set of scheduling variables RXn-TXnp4 threads
eNB_rxtx_proc_t proc_rxtx[2];
/// stats thread pthread descriptor
pthread_t coding_stats_thread;
pthread_t process_stats_thread;
/// for waking up tx procedure
RU_proc_t *ru_proc;
} eNB_proc_t;
......
......@@ -1502,19 +1502,30 @@ void init_td_thread(PHY_VARS_eNB *eNB,pthread_attr_t *attr_td) {
}
extern void *te_thread(void*);
extern void *te_thread1(void*);
void init_te_thread(PHY_VARS_eNB *eNB,pthread_attr_t *attr_te) {
void init_te_thread(PHY_VARS_eNB *eNB,pthread_attr_t *attr_te,pthread_attr_t *attr_te1) {
eNB_proc_t *proc = &eNB->proc;
proc->tep.eNB = eNB;
proc->instance_cnt_te = -1;
proc->tep[0].eNB = eNB;
proc->instance_cnt_te[0] = -1;
pthread_mutex_init( &proc->mutex_te, NULL);
pthread_cond_init( &proc->cond_te, NULL);
pthread_mutex_init( &proc->mutex_te[0], NULL);
pthread_cond_init( &proc->cond_te[0], NULL);
printf("Creating te_thread\n");
pthread_create(&proc->pthread_te, attr_te, te_thread, (void*)&proc->tep);
pthread_create(&proc->pthread_te[0], attr_te, te_thread, (void*)&proc->tep[0]);
/////////////////////////////////////////////////////////////////////////
proc->tep[1].eNB = eNB;
proc->instance_cnt_te[1] = -1;
pthread_mutex_init( &proc->mutex_te[1], NULL);
pthread_cond_init( &proc->cond_te[1], NULL);
printf("Creating te_thread1\n");
pthread_create(&proc->pthread_te[1], attr_te1, te_thread1, (void*)&proc->tep[1]);
}
......
......@@ -71,7 +71,7 @@ schedule_ue_spec_phy_test(
uint16_t rnti = 0x1235;
uint32_t rb_alloc = 0x1FFFFFFF;
int32_t tpc = 1;
int32_t mcs = 28;
int32_t mcs = 22;
int32_t cqi = 15;
int32_t ndi = subframeP/5;
int32_t dai = 0;
......@@ -94,7 +94,7 @@ schedule_ue_spec_phy_test(
nb_rb = conv_nprb(0,rb_alloc,N_RB_DL);
TBS = get_TBS_DL(mcs,nb_rb);
LOG_D(PHY,"schedule_ue_spec_phy_test: subframe %d: nb_rb=%d, TBS=%d, mcs=%d (rb_alloc=%x, N_RB_DL=%d)\n",subframeP,nb_rb,TBS,mcs,rb_alloc,N_RB_DL);
LOG_D(PHY,"schedule_ue_spec_phy_test: subframe %d/%d: nb_rb=%d, TBS=%d, mcs=%d (rb_alloc=%x, N_RB_DL=%d)\n",frameP,subframeP,nb_rb,TBS,mcs,rb_alloc,N_RB_DL);
dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu];
memset((void*)dl_config_pdu,0,sizeof(nfapi_dl_config_request_pdu_t));
......@@ -183,5 +183,8 @@ schedule_ue_spec_phy_test(
eNB->pdu_index[CC_id],
eNB->UE_list.DLSCH_pdu[CC_id][0][(unsigned char)UE_id].payload[0]);
}
else {
LOG_W(MAC,"[eNB_scheduler_phytest] DCI allocation infeasible!\n");
}
}
}
[*]
[*] GTKWave Analyzer v3.3.58 (w)1999-2014 BSI
[*] Thu Nov 2 14:19:21 2017
[*] Fri Nov 3 16:03:52 2017
[*]
[dumpfile] "/tmp/openair_dump_eNB.vcd"
[dumpfile_mtime] "Thu Nov 2 14:15:28 2017"
[dumpfile_size] 1636821
[dumpfile_mtime] "Fri Nov 3 16:00:30 2017"
[dumpfile_size] 56765827
[savefile] "/homes/wangts/openairinterface5g/targets/RT/USER/eNB_usrp.gtkw"
[timestart] 14181427000
[size] 1855 1056
[pos] 65 0
*-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
[timestart] 15220241000
[size] 1920 1018
[pos] 0 22
*-19.666586 15221741584 -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
[sst_vpaned_height] 317
[sst_vpaned_height] 303
@28
functions.trx_read
functions.trx_write
......@@ -34,8 +34,11 @@ 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]
@25
variables.frame_number_RX1_eNB[63:0]
@24
variables.frame_number_TX1_eNB[63:0]
@28
functions.phy_eNB_dlsch_modulation
functions.phy_eNB_dlsch_encoding
......
......@@ -182,9 +182,14 @@ static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_nam
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER , 0 );
if (release_thread(&proc->mutex_rxtx,&proc->instance_cnt_rxtx,thread_name)<0) return(-1);
wakeup_tx(eNB,eNB->proc.ru_proc);
// wakeup_tx(eNB,eNB->proc.ru_proc);
if(oai_exit) return(-1);
phy_procedures_eNB_TX(eNB, proc, no_relay, NULL, 1);
pthread_mutex_lock(&eNB->proc.ru_proc->mutex_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);
stop_meas( &softmodem_stats_rxtx_sf );
......@@ -199,7 +204,7 @@ static void* tx_thread(void* param) {
PHY_VARS_eNB *eNB = RC.eNB[0][proc->CC_id];
char thread_name[100];
sprintf(thread_name,"RXn_TXnp4_%d\n",&eNB->proc.proc_rxtx[0] == proc ? 0 : 1);
sprintf(thread_name,"TXnp4_%d\n",&eNB->proc.proc_rxtx[0] == proc ? 0 : 1);
thread_top_init(thread_name,1,850000L,1000000L,2000000L);
while (!oai_exit) {
......@@ -211,8 +216,10 @@ static void* tx_thread(void* param) {
// run PHY TX procedures the one after the other for all CCs to avoid race conditions
// (may be relaxed in the future for performance reasons)
// *****************************************
//if (wait_CCs(proc)<0) return(-1);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_TX1_ENB,proc->subframe_tx);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_RX1_ENB,proc->subframe_rx);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX1_ENB,proc->frame_tx);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX1_ENB,proc->frame_rx);
phy_procedures_eNB_TX(eNB, proc, no_relay, NULL, 1);
if (release_thread(&proc->mutex_rxtx,&proc->instance_cnt_rxtx,thread_name)<0) break;
......@@ -275,6 +282,9 @@ static void* eNB_thread_rxtx( void* param ) {
if (eNB->CC_id==0)
if (rxtx(eNB,proc,thread_name) < 0) break;
if (release_thread(&proc->mutex_rxtx,&proc->instance_cnt_rxtx,thread_name)<0) break;
} // while !oai_exit
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0+(proc->subframe_rx&1), 0 );
......@@ -353,9 +363,14 @@ int wakeup_tx(PHY_VARS_eNB *eNB,RU_proc_t *ru_proc) {
wait.tv_sec=0;
wait.tv_nsec=5000000L;
if (proc_rxtx->instance_cnt_rxtx == 0) {
LOG_E(PHY,"Frame %d, subframe %d: TX1 thread busy, dropping\n",proc_rxtx->frame_rx,proc_rxtx->subframe_rx);
return(-1);
}
if (pthread_mutex_timedlock(&proc_rxtx->mutex_rxtx,&wait) != 0) {
LOG_E( PHY, "[eNB] ERROR pthread_mutex_lock for eNB RXTX thread %d (IC %d)\n", proc_rxtx->subframe_rx&1,proc_rxtx->instance_cnt_rxtx );
exit_fun( "error locking mutex_rxtx" );
LOG_E( PHY, "[eNB] ERROR pthread_mutex_lock for eNB TX1 thread %d (IC %d)\n", proc_rxtx->subframe_rx&1,proc_rxtx->instance_cnt_rxtx );
exit_fun( "error locking mutex_tx" );
return(-1);
}
......@@ -372,7 +387,7 @@ int wakeup_tx(PHY_VARS_eNB *eNB,RU_proc_t *ru_proc) {
// the thread can now be woken up
if (pthread_cond_signal(&proc_rxtx->cond_rxtx) != 0) {
LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB RXn-TXnp4 thread\n");
LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB TXnp4 thread\n");
exit_fun( "ERROR pthread_cond_signal" );
return(-1);
}
......@@ -420,9 +435,8 @@ int wakeup_rxtx(PHY_VARS_eNB *eNB,RU_t *ru) {
wait.tv_nsec=5000000L;
/* accept some delay in processing - up to 5ms */
if (proc_rxtx->instance_cnt_rxtx == 0) {
LOG_E(PHY,"Frame %d, subframe %d: RXTX thread busy, dropping",proc_rxtx->frame_rx,proc_rxtx->subframe_rx);
LOG_E(PHY,"Frame %d, subframe %d: RXTX0 thread busy, dropping\n",proc_rxtx->frame_rx,proc_rxtx->subframe_rx);
return(-1);
}
......@@ -434,6 +448,11 @@ int wakeup_rxtx(PHY_VARS_eNB *eNB,RU_t *ru) {
return(-1);
}
/*if (proc_rxtx->instance_cnt_rxtx == 0) {
LOG_E(PHY,"Frame %d, subframe %d: RXTX0 thread busy, dropping\n",proc_rxtx->frame_rx,proc_rxtx->subframe_rx);
return(-1);
}*/
++proc_rxtx->instance_cnt_rxtx;
// We have just received and processed the common part of a subframe, say n.
......@@ -672,20 +691,21 @@ static void* eNB_thread_prach_br( void* param ) {
extern void init_td_thread(PHY_VARS_eNB *, pthread_attr_t *);
extern void init_te_thread(PHY_VARS_eNB *, pthread_attr_t *);
extern void init_te_thread(PHY_VARS_eNB *, pthread_attr_t *,pthread_attr_t *);
//////////////////////////////////////need to modified////////////////*****
static void* coding_stats_thread(void* param) {
static void* process_stats_thread(void* param) {
PHY_VARS_eNB *eNB = (PHY_VARS_eNB*)param;
wait_sync("coding_stats_thread");
wait_sync("process_stats_thread");
while (!oai_exit) {
sleep(1);
if (opp_enabled == 1) {
if (eNB->td) print_meas(&eNB->ulsch_decoding_stats,"ulsch_decoding",NULL,NULL);
if (eNB->te) print_meas(&eNB->dlsch_encoding_stats,"dlsch_encoding",NULL,NULL);
print_meas(&eNB->dlsch_modulation_stats,"dlsch_modulation",NULL,NULL);
}
}
return(NULL);
......@@ -699,7 +719,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_te=NULL,*attr_td=NULL;
pthread_attr_t *attr0=NULL,*attr1=NULL,*attr_prach=NULL,*attr_te=NULL,*attr_te1=NULL;//*attr_td=NULL;
#ifdef Rel14
pthread_attr_t *attr_prach_br=NULL;
#endif
......@@ -740,7 +760,8 @@ void init_eNB_proc(int inst) {
pthread_attr_init( &proc->attr_prach);
pthread_attr_init( &proc->attr_asynch_rxtx);
pthread_attr_init( &proc->attr_td);
pthread_attr_init( &proc->attr_te);
pthread_attr_init( &proc->attr_te[0]);
pthread_attr_init( &proc->attr_te[1]);
pthread_attr_init( &proc_rxtx[0].attr_rxtx);
pthread_attr_init( &proc_rxtx[1].attr_rxtx);
#ifdef Rel14
......@@ -762,8 +783,9 @@ void init_eNB_proc(int inst) {
// attr_td = &proc->attr_td;
// attr_te = &proc->attr_te;
#endif
attr_td = &proc->attr_td;
attr_te = &proc->attr_te;
//attr_td = &proc->attr_td;
attr_te = &proc->attr_te[0];
attr_te1 = &proc->attr_te[1];
pthread_create( &proc_rxtx[0].pthread_rxtx, attr0, eNB_thread_rxtx, proc );
pthread_create( &proc_rxtx[1].pthread_rxtx, attr1, tx_thread, proc);
if (eNB->single_thread_flag==0) {
......@@ -786,9 +808,9 @@ void init_eNB_proc(int inst) {
//////////////////////////////////////need to modified////////////////*****
init_te_thread(eNB,attr_te);
init_te_thread(eNB,attr_te,attr_te1);
//init_td_thread(eNB,attr_td);
if (opp_enabled == 1) pthread_create(&proc->coding_stats_thread,NULL,coding_stats_thread,(void*)eNB);
if (opp_enabled == 1) pthread_create(&proc->process_stats_thread,NULL,process_stats_thread,(void*)eNB);
}
......
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