Commit 3efaa383 authored by Wang Tsu-Han's avatar Wang Tsu-Han

adjustable thread structure

parent 13c8931b
......@@ -597,7 +597,7 @@ add_boolean_option(NAS_ADDRESS_FIX False "specific to oaisim: for nasmesh driver
add_boolean_option(NAS_NETLINK False "???? Must be True to compile nasmesh driver without rtai")
add_boolean_option(OAISIM False "specific to oaisim")
add_boolean_option(OAI_NW_DRIVER_USE_NETLINK True "????")
add_boolean_option(EMULATE_RF True "allows to run lte-softmodem without HW")
add_boolean_option(EMULATE_RF False "allows to run lte-softmodem without HW")
add_boolean_option(USE_MME False "this flag is used only one time in lte-softmodem.c")
add_list_string_option(PACKAGE_NAME "NotDefined" "As per attribute name")
......
......@@ -58,6 +58,8 @@
uint64_t deadline,
uint64_t period);*/
extern int codingw;
void free_eNB_dlsch(LTE_eNB_DLSCH_t *dlsch)
{
int i;
......@@ -606,16 +608,28 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
}
stop_meas(te_main_stats);
// wait for worker to finish
start_meas(te_wait_stats);
wait_on_busy_condition(&proc->tep[0].mutex_te,&proc->tep[0].cond_te,&proc->tep[0].instance_cnt_te,"te thread 0");
wait_on_busy_condition(&proc->tep[1].mutex_te,&proc->tep[1].cond_te,&proc->tep[1].instance_cnt_te,"te thread 1");
wait_on_busy_condition(&proc->tep[2].mutex_te,&proc->tep[2].cond_te,&proc->tep[2].instance_cnt_te,"te thread 2");
if(worker_num == 1)
{
wait_on_busy_condition(&proc->tep[0].mutex_te,&proc->tep[0].cond_te,&proc->tep[0].instance_cnt_te,"te thread 0");
}
else if(worker_num == 2)
{
wait_on_busy_condition(&proc->tep[0].mutex_te,&proc->tep[0].cond_te,&proc->tep[0].instance_cnt_te,"te thread 0");
wait_on_busy_condition(&proc->tep[1].mutex_te,&proc->tep[1].cond_te,&proc->tep[1].instance_cnt_te,"te thread 1");
}
else
{
wait_on_busy_condition(&proc->tep[0].mutex_te,&proc->tep[0].cond_te,&proc->tep[0].instance_cnt_te,"te thread 0");
wait_on_busy_condition(&proc->tep[1].mutex_te,&proc->tep[1].cond_te,&proc->tep[1].instance_cnt_te,"te thread 1");
wait_on_busy_condition(&proc->tep[2].mutex_te,&proc->tep[2].cond_te,&proc->tep[2].instance_cnt_te,"te thread 2");
}
stop_meas(te_wait_stats);
if(opp_enabled == 1 && te_wait_stats->diff_now>100*3000){
/*if(opp_enabled == 1 && te_wait_stats->diff_now>100*3000){
print_meas_now(te_wait_stats,"coding_wait",stderr);
printf("delay in wait on codition in frame_rx: %d \n",proc->frame_rx);
}
printf("coding delay in wait on codition in frame_rx: %d \n",proc->frame_rx);
}*/
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_OUT);
......@@ -654,7 +668,7 @@ int dlsch_encoding_all(PHY_VARS_eNB *eNB,
}
}
if(C >= 8&&get_nprocs()>=6)//one main three worker
if(C >= 8 && get_nprocs()>8 && codingw)//one main three worker
{
encoding_return =
dlsch_encoding_2threads(eNB,
......@@ -672,7 +686,7 @@ int dlsch_encoding_all(PHY_VARS_eNB *eNB,
i_stats,
3);
}
else if(C >= 6&&get_nprocs()>=4)//one main two worker
else if(C >= 6 && get_nprocs()>=6 && codingw)//one main two worker
{
encoding_return =
dlsch_encoding_2threads(eNB,
......@@ -690,7 +704,7 @@ int dlsch_encoding_all(PHY_VARS_eNB *eNB,
i_stats,
2);
}
else if(C >= 4&&get_nprocs()>=2)//one main one worker
else if(C >= 4 && get_nprocs()>=4 && codingw)//one main one worker
{
encoding_return =
dlsch_encoding_2threads(eNB,
......
......@@ -52,6 +52,8 @@
#include "UTIL/LOG/vcd_signal_dumper.h"
//#define DEBUG_ULSCH_DECODING
extern int codingw;
void free_eNB_ulsch(LTE_eNB_ULSCH_t *ulsch)
{
......@@ -817,7 +819,7 @@ int ulsch_decoding_data_all(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr8_fl
int ret = 0;
LTE_eNB_ULSCH_t *ulsch = eNB->ulsch[UE_id];
LTE_UL_eNB_HARQ_t *ulsch_harq = ulsch->harq_processes[harq_pid];
if(ulsch_harq->C>3)
if(ulsch_harq->C>3 && get_nprocs()>=2 && codingw)
{
ret = ulsch_decoding_data_2thread(eNB,UE_id,harq_pid,llr8_flag);
}
......
......@@ -222,10 +222,10 @@ void feptx_ofdm_2thread(RU_t *ru) {
start_meas(&ru->ofdm_mod_wait_stats);
wait_on_busy_condition(&proc->mutex_feptx,&proc->cond_feptx,&proc->instance_cnt_feptx,"feptx thread");
stop_meas(&ru->ofdm_mod_wait_stats);
if(opp_enabled == 1 && ru->ofdm_mod_wait_stats.diff_now>30*3000){
/*if(opp_enabled == 1 && ru->ofdm_mod_wait_stats.diff_now>30*3000){
print_meas_now(&ru->ofdm_mod_wait_stats,"fep wakeup",stderr);
printf("delay in feptx wait on codition in frame_rx: %d subframe_rx: %d \n",proc->frame_tx,proc->subframe_tx);
}
}*/
stop_meas(&ru->ofdm_mod_stats);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM , 0 );
......
......@@ -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 = 0;
int32_t mcs = 28;
int32_t cqi = 15;
int32_t ndi = subframeP/5;
int32_t dai = 0;
......
......@@ -150,10 +150,10 @@ eNBs =
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "em1";
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.155/24";
ENB_INTERFACE_NAME_FOR_S1U = "em1";
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.155/24";
ENB_INTERFACE_NAME_FOR_S1_MME = "eth6";
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.111/24";
ENB_INTERFACE_NAME_FOR_S1U = "eth6";
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24";
ENB_PORT_FOR_S1U = 2152; # Spec 2152
};
}
......
......@@ -150,6 +150,7 @@ void wakeup_prach_eNB(PHY_VARS_eNB *eNB,RU_t *ru,int frame,int subframe);
#ifdef Rel14
void wakeup_prach_eNB_br(PHY_VARS_eNB *eNB,RU_t *ru,int frame,int subframe);
#endif
extern int codingw;
static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_name) {
......@@ -182,14 +183,25 @@ 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 );
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);
if(get_nprocs() > 8)
{
wakeup_tx(eNB,eNB->proc.ru_proc);
}
else if(get_nprocs() > 4)
{
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);
}
else
{
if(oai_exit) return(-1);
phy_procedures_eNB_TX(eNB, proc, no_relay, NULL, 1);
}
stop_meas( &softmodem_stats_rxtx_sf );
......@@ -350,10 +362,6 @@ 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);
}
}
......@@ -824,9 +832,13 @@ void init_eNB_proc(int inst) {
//////////////////////////////////////need to modified////////////////*****
init_te_thread(eNB);
init_td_thread(eNB,attr_td);
if (opp_enabled == 1) pthread_create(&proc->process_stats_thread,NULL,process_stats_thread,(void*)eNB);
//printf("//////////////////////////////////////////////////////////////////**************************************************************** codingw = %d\n",codingw);
if(get_nprocs() > 2 && codingw)
{
init_te_thread(eNB);
init_td_thread(eNB,attr_td);
}
if (opp_enabled == 1) pthread_create(&proc->process_stats_thread,NULL,process_stats_thread,(void*)eNB);
}
......
......@@ -113,7 +113,7 @@ unsigned short config_frames[4] = {2,9,11,13};
extern volatile int oai_exit;
extern int numerology;
extern int fh_two_thread;
extern int fepw;
extern void phy_init_RU(RU_t*);
......@@ -681,6 +681,7 @@ void fh_if4p5_north_out(RU_t *ru) {
if (ru->idx == 0) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX, 0 );
}
#ifdef EMULATE_RF
static void* emulatedRF_thread(void* param) {
RU_proc_t *proc = (RU_proc_t *) param;
int microsec = 500; // length of time to sleep, in miliseconds
......@@ -708,6 +709,7 @@ static void* emulatedRF_thread(void* param) {
}
return 0;
}
#endif
void rx_rf(RU_t *ru,int *frame,int *subframe) {
......@@ -716,7 +718,7 @@ void rx_rf(RU_t *ru,int *frame,int *subframe) {
void *rxp[ru->nb_rx];
unsigned int rxs;
int i;
openair0_timestamp ts,old_ts;
openair0_timestamp ts=0,old_ts=0;
for (i=0; i<ru->nb_rx; i++)
rxp[i] = (void*)&ru->common.rxdata[i][*subframe*fp->samples_per_tti];
......@@ -1024,7 +1026,7 @@ static void* ru_thread_prach_br( void* param ) {
ru_thread_prach_status = 0;
thread_top_init("ru_thread_prach_br",1,500000,1000000,20000000);
wait_sync(ru_thread_prach_br);
wait_sync("ru_thread_prach_br");
while (!oai_exit) {
......@@ -1154,7 +1156,7 @@ void wakeup_eNBs(RU_t *ru) {
LOG_D(PHY,"wakeup_eNBs (num %d) for RU %d\n",ru->num_eNB,ru->idx);
if (0){//(ru->num_eNB==1) {
if (get_nprocs() <= 4) {
// call eNB function directly
char string[20];
......@@ -1165,10 +1167,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)
{
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);
}
}
}
}
......@@ -1392,7 +1394,7 @@ static void* ru_stats_thread(void* param) {
while (!oai_exit) {
sleep(1);
if (opp_enabled == 1) {
if (opp_enabled == 1 && fepw) {
if (ru->feprx) print_meas(&ru->ofdm_demod_stats,"feprx",NULL,NULL);
if (ru->feptx_ofdm) print_meas(&ru->ofdm_mod_stats,"feptx_ofdm",NULL,NULL);
}
......@@ -1422,17 +1424,10 @@ static void* ru_thread_tx( void* param ) {
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_CPUID_RU_THREAD_TX,sched_getcpu());
if (oai_exit) break;
if (subframe==9) {
subframe=0;
frame++;
frame&=1023;
} else {
subframe++;
}
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_tx");
//printf("//////////////////instance_cnt_eNBs = %d\n",proc->instance_cnt_eNBs);//////////////////*********
#ifdef EMULATE_RF
#else
......@@ -1474,8 +1469,8 @@ static void* ru_thread( void* param ) {
// set default return value
thread_top_init("ru_thread",1,400000,500000,500000);
CPU_SET(1, &cpuset);
pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
//CPU_SET(1, &cpuset);
//pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
pthread_setname_np( pthread_self(),"ru thread");
LOG_I(PHY,"thread ru created id=%ld\n", syscall(__NR_gettid));
......@@ -1604,24 +1599,23 @@ static void* ru_thread( void* param ) {
// wakeup all eNB processes waiting for this RU
if (ru->num_eNB>0) wakeup_eNBs(ru);
/*
if(fh_two_thread == 0)
if(get_nprocs() <=4)
{
// 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");
// do TX front-end processing if needed (precoding and/or IDFTs)
if (ru->feptx_prec) ru->feptx_prec(ru);
// do OFDM if needed
if ((ru->fh_north_asynch_in == NULL) && (ru->feptx_ofdm)) ru->feptx_ofdm(ru);
// do outgoing fronthaul (south) if needed
if ((ru->fh_north_asynch_in == NULL) && (ru->fh_south_out)) ru->fh_south_out(ru);
if (ru->fh_north_out) ru->fh_north_out(ru);
#ifdef EMULATE_RF
#else
// do TX front-end processing if needed (precoding and/or IDFTs)
if (ru->feptx_prec) ru->feptx_prec(ru);
// do OFDM if needed
if ((ru->fh_north_asynch_in == NULL) && (ru->feptx_ofdm)) ru->feptx_ofdm(ru);
// do outgoing fronthaul (south) if needed
if ((ru->fh_north_asynch_in == NULL) && (ru->fh_south_out)) ru->fh_south_out(ru);
if (ru->fh_north_out) ru->fh_north_out(ru);
#endif
}
*/
}
......@@ -1809,7 +1803,7 @@ void init_RU_proc(RU_t *ru) {
pthread_create( &proc->pthread_emulateRF, attr_emulateRF, emulatedRF_thread, (void*)proc );
#endif
if (fh_two_thread==1)
if (get_nprocs() > 4)
pthread_create( &proc->pthread_FH1, attr_FH1, ru_thread_tx, (void*)ru );
if (ru->function == NGFI_RRU_IF4p5) {
......@@ -1832,7 +1826,7 @@ void init_RU_proc(RU_t *ru) {
}
if (get_nprocs()>=2) {
if (get_nprocs()> 2 && fepw) {
if (ru->feprx) init_fep_thread(ru,NULL);
if (ru->feptx_ofdm) init_feptx_thread(ru,NULL);
}
......
......@@ -206,8 +206,9 @@ extern void reset_opp_meas(void);
extern void print_opp_meas(void);
int transmission_mode=1;
int numerology = 2;
int fh_two_thread = 1;
int numerology = 0;
int codingw = 1;
int fepw = 1;
......
This diff is collapsed.
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