Commit 7ac9d2ab authored by Wang Tsu-Han's avatar Wang Tsu-Han

Deadline scheduling for 40MHz

parent d174e15a
...@@ -456,12 +456,12 @@ void *te_thread(void *param) { ...@@ -456,12 +456,12 @@ void *te_thread(void *param) {
cpu_set_t cpuset; cpu_set_t cpuset;
CPU_ZERO(&cpuset); CPU_ZERO(&cpuset);
//thread_top_init("te_thread",1,870000,1000000,1000000); thread_top_init("te_thread",1,200000,250000,500000);
pthread_setname_np( pthread_self(),"te processing"); pthread_setname_np( pthread_self(),"te processing");
LOG_I(PHY,"thread te created id=%ld\n", syscall(__NR_gettid)); LOG_I(PHY,"thread te created id=%ld\n", syscall(__NR_gettid));
CPU_SET(4, &cpuset); //CPU_SET(4, &cpuset);
pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); //pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
PHY_VARS_eNB *eNB = ((te_params *)param)->eNB; PHY_VARS_eNB *eNB = ((te_params *)param)->eNB;
eNB_proc_t *proc = &eNB->proc; eNB_proc_t *proc = &eNB->proc;
...@@ -494,12 +494,12 @@ void *te_thread1(void *param) { ...@@ -494,12 +494,12 @@ void *te_thread1(void *param) {
cpu_set_t cpuset; cpu_set_t cpuset;
CPU_ZERO(&cpuset); CPU_ZERO(&cpuset);
//thread_top_init("te_thread1",1,870000,1000000,1000000); thread_top_init("te_thread1",1,200000,250000,500000);
pthread_setname_np( pthread_self(),"te processing 1"); pthread_setname_np( pthread_self(),"te processing 1");
LOG_I(PHY,"thread te 1 created id=%ld\n", syscall(__NR_gettid)); LOG_I(PHY,"thread te 1 created id=%ld\n", syscall(__NR_gettid));
CPU_SET(7, &cpuset); //CPU_SET(7, &cpuset);
pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); //pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
PHY_VARS_eNB *eNB = ((te_params *)param)->eNB; PHY_VARS_eNB *eNB = ((te_params *)param)->eNB;
eNB_proc_t *proc = &eNB->proc; eNB_proc_t *proc = &eNB->proc;
......
...@@ -143,11 +143,14 @@ static void *feptx_thread(void *param) { ...@@ -143,11 +143,14 @@ static void *feptx_thread(void *param) {
cpu_set_t cpuset; cpu_set_t cpuset;
CPU_ZERO(&cpuset); CPU_ZERO(&cpuset);
CPU_SET(6, &cpuset); thread_top_init("feptx_thread",1,85000,120000,500000);
pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); pthread_setname_np( pthread_self(),"feptx processing");
LOG_I(PHY,"thread feptx created id=%ld\n", syscall(__NR_gettid));
//CPU_SET(6, &cpuset);
//pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
thread_top_init("feptx_thread",0,870000,1000000,1000000);
while (!oai_exit) { while (!oai_exit) {
...@@ -434,12 +437,14 @@ static void *fep_thread(void *param) { ...@@ -434,12 +437,14 @@ static void *fep_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;
thread_top_init("fep_thread",0,870000,1000000,1000000); thread_top_init("fep_thread",1,100000,120000,5000000);
pthread_setname_np( pthread_self(),"fep processing");
LOG_I(PHY,"thread fep created id=%ld\n", syscall(__NR_gettid));
cpu_set_t cpuset; cpu_set_t cpuset;
CPU_ZERO(&cpuset); CPU_ZERO(&cpuset);
CPU_SET(2, &cpuset); //CPU_SET(2, &cpuset);
pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset); //pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
while (!oai_exit) { while (!oai_exit) {
......
...@@ -205,7 +205,7 @@ static void* tx_thread(void* param) { ...@@ -205,7 +205,7 @@ static void* tx_thread(void* param) {
char thread_name[100]; char thread_name[100];
sprintf(thread_name,"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); thread_top_init(thread_name,1,470000,500000,500000);
while (!oai_exit) { while (!oai_exit) {
...@@ -258,10 +258,12 @@ static void* eNB_thread_rxtx( void* param ) { ...@@ -258,10 +258,12 @@ 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,470000,500000,500000);
pthread_setname_np( pthread_self(),"rxtx processing");
LOG_I(PHY,"thread rxtx created id=%ld\n", syscall(__NR_gettid));
CPU_SET(3, &cpuset); //CPU_SET(3, &cpuset);
pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &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 );
...@@ -621,7 +623,7 @@ static void* eNB_thread_prach( void* param ) { ...@@ -621,7 +623,7 @@ static void* eNB_thread_prach( void* param ) {
// set default return value // set default return value
eNB_thread_prach_status = 0; eNB_thread_prach_status = 0;
thread_top_init("eNB_thread_prach",1,500000L,1000000L,20000000L); thread_top_init("eNB_thread_prach",1,500000,1000000,20000000);
while (!oai_exit) { while (!oai_exit) {
...@@ -663,7 +665,7 @@ static void* eNB_thread_prach_br( void* param ) { ...@@ -663,7 +665,7 @@ static void* eNB_thread_prach_br( void* param ) {
// set default return value // set default return value
eNB_thread_prach_status = 0; eNB_thread_prach_status = 0;
thread_top_init("eNB_thread_prach_br",1,500000L,1000000L,20000000L); thread_top_init("eNB_thread_prach_br",1,500000,1000000,20000000);
while (!oai_exit) { while (!oai_exit) {
......
...@@ -690,6 +690,17 @@ static void* emulatedRF_thread(void* param) { ...@@ -690,6 +690,17 @@ static void* emulatedRF_thread(void* param) {
struct timespec req = {0}; struct timespec req = {0};
req.tv_sec = 0; req.tv_sec = 0;
req.tv_nsec = microsec * 1000L; req.tv_nsec = microsec * 1000L;
cpu_set_t cpuset;
CPU_SET(1,&cpuset);
pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
int policy;
struct sched_param sparam;
memset(&sparam, 0, sizeof(sparam));
sparam.sched_priority = sched_get_priority_max(SCHED_FIFO);
policy = SCHED_FIFO ;
pthread_setschedparam(pthread_self(), policy, &sparam);
wait_sync("emulatedRF_thread"); wait_sync("emulatedRF_thread");
while(!oai_exit){ while(!oai_exit){
nanosleep(&req, (struct timespec *)NULL); nanosleep(&req, (struct timespec *)NULL);
...@@ -878,7 +889,7 @@ static void* ru_thread_asynch_rxtx( void* param ) { ...@@ -878,7 +889,7 @@ static void* ru_thread_asynch_rxtx( void* param ) {
int subframe=0, frame=0; int subframe=0, frame=0;
thread_top_init("ru_thread_asynch_rxtx",1,870000L,1000000L,1000000L); thread_top_init("ru_thread_asynch_rxtx",1,870000,1000000,1000000);
// wait for top-level synchronization and do one acquisition to get timestamp for setting frame/subframe // wait for top-level synchronization and do one acquisition to get timestamp for setting frame/subframe
...@@ -975,7 +986,7 @@ static void* ru_thread_prach( void* param ) { ...@@ -975,7 +986,7 @@ static void* ru_thread_prach( void* param ) {
// set default return value // set default return value
ru_thread_prach_status = 0; ru_thread_prach_status = 0;
thread_top_init("ru_thread_prach",1,500000L,1000000L,20000000L); thread_top_init("ru_thread_prach",1,500000,1000000,20000000);
while (!oai_exit) { while (!oai_exit) {
...@@ -1014,7 +1025,7 @@ static void* ru_thread_prach_br( void* param ) { ...@@ -1014,7 +1025,7 @@ static void* ru_thread_prach_br( void* param ) {
// set default return value // set default return value
ru_thread_prach_status = 0; ru_thread_prach_status = 0;
thread_top_init("ru_thread_prach_br",1,500000L,1000000L,20000000L); thread_top_init("ru_thread_prach_br",1,500000,1000000,20000000);
while (!oai_exit) { while (!oai_exit) {
...@@ -1398,10 +1409,10 @@ static void* ru_thread_tx( void* param ) { ...@@ -1398,10 +1409,10 @@ static void* ru_thread_tx( void* param ) {
CPU_ZERO(&cpuset); CPU_ZERO(&cpuset);
thread_top_init("ru_thread_tx",1,870000L,1000000L,1000000L); thread_top_init("ru_thread_tx",1,400000,500000,500000);
CPU_SET(5, &cpuset); //CPU_SET(5, &cpuset);
pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &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");
...@@ -1461,10 +1472,12 @@ static void* ru_thread( void* param ) { ...@@ -1461,10 +1472,12 @@ 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,400000,500000,500000);
CPU_SET(1, &cpuset); //CPU_SET(1, &cpuset);
pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &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));
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]);
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#include <getopt.h> #include <getopt.h>
#include <sys/sysinfo.h> #include <sys/sysinfo.h>
#include "rt_wrapper.h" #include "rt_wrapper.h"
#include <errno.h>
static int latency_target_fd = -1; static int latency_target_fd = -1;
static int32_t latency_target_value = 0; static int32_t latency_target_value = 0;
...@@ -281,6 +282,7 @@ void thread_top_init(char *thread_name, ...@@ -281,6 +282,7 @@ void thread_top_init(char *thread_name,
if (sched_setattr(0, &attr, flags) < 0 ) { if (sched_setattr(0, &attr, flags) < 0 ) {
perror("[SCHED] eNB tx thread: sched_setattr failed\n"); perror("[SCHED] eNB tx thread: sched_setattr failed\n");
fprintf(stderr,"sched_setattr Error = %s",strerror(errno));
exit(1); exit(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