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

fixing the sleep delay problem for tx

parent c84ddacd
...@@ -354,9 +354,15 @@ int dlsch_encoding_2threads0(te_params *tep) { ...@@ -354,9 +354,15 @@ int dlsch_encoding_2threads0(te_params *tep) {
extern int oai_exit; extern int oai_exit;
void *te_thread(void *param) { void *te_thread(void *param) {
cpu_set_t cpuset;
CPU_ZERO(&cpuset);
pthread_setname_np( pthread_self(),"te processing"); pthread_setname_np( pthread_self(),"te processing");
LOG_I(PHY,"thread te created id=%ld", syscall(__NR_gettid)); LOG_I(PHY,"thread te created id=%ld", syscall(__NR_gettid));
CPU_SET(4, &cpuset);
pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
eNB_proc_t *proc = &((te_params *)param)->eNB->proc; eNB_proc_t *proc = &((te_params *)param)->eNB->proc;
while (!oai_exit) { while (!oai_exit) {
......
...@@ -140,6 +140,12 @@ static void *feptx_thread(void *param) { ...@@ -140,6 +140,12 @@ static void *feptx_thread(void *param) {
RU_t *ru = (RU_t *)param; RU_t *ru = (RU_t *)param;
RU_proc_t *proc = &ru->proc; RU_proc_t *proc = &ru->proc;
cpu_set_t cpuset;
CPU_ZERO(&cpuset);
CPU_SET(6, &cpuset);
pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
thread_top_init("feptx_thread",0,870000,1000000,1000000); thread_top_init("feptx_thread",0,870000,1000000,1000000);
...@@ -418,6 +424,11 @@ static void *fep_thread(void *param) { ...@@ -418,6 +424,11 @@ static void *fep_thread(void *param) {
thread_top_init("fep_thread",0,870000,1000000,1000000); thread_top_init("fep_thread",0,870000,1000000,1000000);
cpu_set_t cpuset;
CPU_ZERO(&cpuset);
CPU_SET(2, &cpuset);
pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
while (!oai_exit) { 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;
......
...@@ -195,6 +195,9 @@ const char* eurecomVariablesNames[] = { ...@@ -195,6 +195,9 @@ const char* eurecomVariablesNames[] = {
"ue0_trx_write_ns", "ue0_trx_write_ns",
"ue0_trx_read_ns_missing", "ue0_trx_read_ns_missing",
"ue0_trx_write_ns_missing", "ue0_trx_write_ns_missing",
"enb_thread_rxtx_CPUID",
"ru_thread_CPUID",
"ru_thread_tx_CPUID"
}; };
const char* eurecomFunctionsNames[] = { const char* eurecomFunctionsNames[] = {
......
...@@ -167,6 +167,9 @@ typedef enum { ...@@ -167,6 +167,9 @@ typedef enum {
VCD_SIGNAL_DUMPER_VARIABLES_UE0_TRX_WRITE_NS, VCD_SIGNAL_DUMPER_VARIABLES_UE0_TRX_WRITE_NS,
VCD_SIGNAL_DUMPER_VARIABLES_UE0_TRX_READ_NS_MISSING, VCD_SIGNAL_DUMPER_VARIABLES_UE0_TRX_READ_NS_MISSING,
VCD_SIGNAL_DUMPER_VARIABLES_UE0_TRX_WRITE_NS_MISSING, VCD_SIGNAL_DUMPER_VARIABLES_UE0_TRX_WRITE_NS_MISSING,
VCD_SIGNAL_DUMPER_VARIABLES_CPUID_ENB_THREAD_RXTX,
VCD_SIGNAL_DUMPER_VARIABLES_CPUID_RU_THREAD,
VCD_SIGNAL_DUMPER_VARIABLES_CPUID_RU_THREAD_TX,
VCD_SIGNAL_DUMPER_VARIABLES_END VCD_SIGNAL_DUMPER_VARIABLES_END
} vcd_signal_dump_variables; } vcd_signal_dump_variables;
......
...@@ -219,6 +219,8 @@ static void* eNB_thread_rxtx( void* param ) { ...@@ -219,6 +219,8 @@ static void* eNB_thread_rxtx( void* param ) {
char thread_name[100]; char thread_name[100];
cpu_set_t cpuset;
CPU_ZERO(&cpuset);
// set default return value // set default return value
eNB_thread_rxtx_status = 0; eNB_thread_rxtx_status = 0;
...@@ -227,11 +229,15 @@ static void* eNB_thread_rxtx( void* param ) { ...@@ -227,11 +229,15 @@ static void* eNB_thread_rxtx( void* param ) {
sprintf(thread_name,"RXn_TXnp4_%d\n",&eNB->proc.proc_rxtx[0] == proc ? 0 : 1); sprintf(thread_name,"RXn_TXnp4_%d\n",&eNB->proc.proc_rxtx[0] == proc ? 0 : 1);
thread_top_init(thread_name,1,850000L,1000000L,2000000L); thread_top_init(thread_name,1,850000L,1000000L,2000000L);
CPU_SET(3, &cpuset);
pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
while (!oai_exit) { while (!oai_exit) {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0+(proc->subframe_rx&1), 0 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0+(proc->subframe_rx&1), 0 );
if (wait_on_condition(&proc->mutex_rxtx,&proc->cond_rxtx,&proc->instance_cnt_rxtx,thread_name)<0) break; if (wait_on_condition(&proc->mutex_rxtx,&proc->cond_rxtx,&proc->instance_cnt_rxtx,thread_name)<0) break;
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_CPUID_ENB_THREAD_RXTX,sched_getcpu());
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_eNB_PROC_RXTX0+(proc->subframe_rx&1), 1 ); 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; //ru_proc = eNB_proc->ru_proc;
...@@ -356,12 +362,9 @@ int wakeup_rxtx(PHY_VARS_eNB *eNB,RU_t *ru) { ...@@ -356,12 +362,9 @@ int wakeup_rxtx(PHY_VARS_eNB *eNB,RU_t *ru) {
wait.tv_nsec=5000000L; wait.tv_nsec=5000000L;
/* accept some delay in processing - up to 5ms */ /* accept some delay in processing - up to 5ms */
for (i = 0; i < 10 && proc_rxtx->instance_cnt_rxtx == 0; i++) {
LOG_W( PHY,"[eNB] Frame %d, eNB RXn-TXnp4 thread busy!! (cnt_rxtx %i)\n", proc_rxtx->frame_tx, proc_rxtx->instance_cnt_rxtx);
usleep(500);
}
if (proc_rxtx->instance_cnt_rxtx == 0) { if (proc_rxtx->instance_cnt_rxtx == 0) {
exit_fun( "TX thread busy" ); LOG_E(PHY,"Frame %d, subframe %d: RXTX thread busy, dropping",proc_rxtx->frame_rx,proc_rxtx->subframe_rx);
return(-1); return(-1);
} }
......
...@@ -1367,14 +1367,21 @@ static void* ru_thread_tx( void* param ) { ...@@ -1367,14 +1367,21 @@ static void* ru_thread_tx( void* param ) {
RU_t *ru = (RU_t*)param; RU_t *ru = (RU_t*)param;
RU_proc_t *proc = &ru->proc; RU_proc_t *proc = &ru->proc;
int subframe=0, frame=0; int subframe=0, frame=0;
cpu_set_t cpuset;
CPU_ZERO(&cpuset);
thread_top_init("ru_thread_tx",1,870000L,1000000L,1000000L); thread_top_init("ru_thread_tx",1,870000L,1000000L,1000000L);
CPU_SET(5, &cpuset);
pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
wait_on_condition(&proc->mutex_FH1,&proc->cond_FH1,&proc->instance_cnt_FH1,"ru_thread_tx"); wait_on_condition(&proc->mutex_FH1,&proc->cond_FH1,&proc->instance_cnt_FH1,"ru_thread_tx");
printf( "ru_thread_tx ready\n"); printf( "ru_thread_tx ready\n");
while (!oai_exit) { while (!oai_exit) {
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_CPUID_RU_THREAD_TX,sched_getcpu());
if (oai_exit) break; if (oai_exit) break;
if (subframe==9) { if (subframe==9) {
...@@ -1416,6 +1423,9 @@ static void* ru_thread( void* param ) { ...@@ -1416,6 +1423,9 @@ static void* ru_thread( void* param ) {
int ret; int ret;
int subframe =9; int subframe =9;
int frame =1023; int frame =1023;
cpu_set_t cpuset;
CPU_ZERO(&cpuset);
// set default return value // set default return value
ru_thread_status = 0; ru_thread_status = 0;
...@@ -1424,6 +1434,9 @@ static void* ru_thread( void* param ) { ...@@ -1424,6 +1434,9 @@ static void* ru_thread( void* param ) {
// set default return value // set default return value
thread_top_init("ru_thread",0,870000,1000000,1000000); thread_top_init("ru_thread",0,870000,1000000,1000000);
CPU_SET(1, &cpuset);
pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
LOG_I(PHY,"Starting RU %d (%s,%s),\n",ru->idx,eNB_functions[ru->function],eNB_timing[ru->if_timing]); LOG_I(PHY,"Starting RU %d (%s,%s),\n",ru->idx,eNB_functions[ru->function],eNB_timing[ru->if_timing]);
...@@ -1491,6 +1504,8 @@ static void* ru_thread( void* param ) { ...@@ -1491,6 +1504,8 @@ static void* ru_thread( void* param ) {
// This is a forever while loop, it loops over subframes which are scheduled by incoming samples from HW devices // This is a forever while loop, it loops over subframes which are scheduled by incoming samples from HW devices
while (!oai_exit) { while (!oai_exit) {
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_CPUID_RU_THREAD,sched_getcpu());
// these are local subframe/frame counters to check that we are in synch with the fronthaul timing. // these are local subframe/frame counters to check that we are in synch with the fronthaul timing.
// They are set on the first rx/tx in the underly FH routines. // They are set on the first rx/tx in the underly FH routines.
if (subframe==9) { if (subframe==9) {
...@@ -1537,6 +1552,7 @@ static void* ru_thread( void* param ) { ...@@ -1537,6 +1552,7 @@ static void* ru_thread( void* param ) {
// wakeup all eNB processes waiting for this RU // wakeup all eNB processes waiting for this RU
if (ru->num_eNB>0) wakeup_eNBs(ru); if (ru->num_eNB>0) wakeup_eNBs(ru);
/*
if(fh_two_thread == 0) if(fh_two_thread == 0)
{ {
// wait until eNBs are finished subframe RX n and TX n+4 // wait until eNBs are finished subframe RX n and TX n+4
...@@ -1553,7 +1569,7 @@ static void* ru_thread( void* param ) { ...@@ -1553,7 +1569,7 @@ static void* ru_thread( void* param ) {
if (ru->fh_north_out) ru->fh_north_out(ru); if (ru->fh_north_out) ru->fh_north_out(ru);
} }
*/
} }
......
...@@ -206,7 +206,7 @@ extern void reset_opp_meas(void); ...@@ -206,7 +206,7 @@ extern void reset_opp_meas(void);
extern void print_opp_meas(void); extern void print_opp_meas(void);
int transmission_mode=1; int transmission_mode=1;
int numerology = 0; int numerology = 1;
int fh_two_thread = 1; int fh_two_thread = 1;
......
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