Deadline scheduling for 40MHz

This commit is contained in:
Wang Tsu-Han
2017-12-11 14:27:26 +01:00
parent d174e15ac8
commit 7ac9d2ab81
5 changed files with 50 additions and 28 deletions
+8 -6
View File
@@ -205,7 +205,7 @@ static void* tx_thread(void* param) {
char thread_name[100];
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) {
@@ -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);
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);
pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
//CPU_SET(3, &cpuset);
//pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
while (!oai_exit) {
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 ) {
// set default return value
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) {
@@ -663,7 +665,7 @@ static void* eNB_thread_prach_br( void* param ) {
// set default return value
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) {
+22 -9
View File
@@ -690,6 +690,17 @@ static void* emulatedRF_thread(void* param) {
struct timespec req = {0};
req.tv_sec = 0;
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");
while(!oai_exit){
nanosleep(&req, (struct timespec *)NULL);
@@ -878,7 +889,7 @@ static void* ru_thread_asynch_rxtx( void* param ) {
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
@@ -975,7 +986,7 @@ static void* ru_thread_prach( void* param ) {
// set default return value
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) {
@@ -1014,7 +1025,7 @@ static void* ru_thread_prach_br( void* param ) {
// set default return value
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) {
@@ -1398,10 +1409,10 @@ static void* ru_thread_tx( void* param ) {
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);
pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
//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");
@@ -1461,10 +1472,12 @@ static void* ru_thread( void* param ) {
// 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);
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));
LOG_I(PHY,"Starting RU %d (%s,%s),\n",ru->idx,eNB_functions[ru->function],eNB_timing[ru->if_timing]);
+2
View File
@@ -43,6 +43,7 @@
#include <getopt.h>
#include <sys/sysinfo.h>
#include "rt_wrapper.h"
#include <errno.h>
static int latency_target_fd = -1;
static int32_t latency_target_value = 0;
@@ -281,6 +282,7 @@ void thread_top_init(char *thread_name,
if (sched_setattr(0, &attr, flags) < 0 ) {
perror("[SCHED] eNB tx thread: sched_setattr failed\n");
fprintf(stderr,"sched_setattr Error = %s",strerror(errno));
exit(1);
}