commit before merge
This commit is contained in:
+184
-89
@@ -157,7 +157,7 @@ static struct {
|
||||
|
||||
void exit_fun(const char* s);
|
||||
|
||||
void init_eNB(eNB_func_t node_function);
|
||||
void init_eNB(eNB_func_t node_function,int nb_inst);
|
||||
void stop_eNB(void);
|
||||
|
||||
|
||||
@@ -350,7 +350,7 @@ static void* eNB_thread_rxtx( void* param ) {
|
||||
|
||||
/* Set affinity mask to include CPUs 1 to MAX_CPUS */
|
||||
/* CPU 0 is reserved for UHD threads */
|
||||
/* CPU 1 is reserved for all TX threads */
|
||||
/* CPU 1 is reserved for all RX_TX threads */
|
||||
/* Enable CPU Affinity only if number of CPUs >2 */
|
||||
CPU_ZERO(&cpuset);
|
||||
|
||||
@@ -398,7 +398,7 @@ static void* eNB_thread_rxtx( void* param ) {
|
||||
exit_fun("Error getting thread priority");
|
||||
}
|
||||
|
||||
LOG_I(HW, "[SCHED][eNB] TX thread started on CPU %d TID %ld, sched_policy = %s , priority = %d, CPU Affinity=%s \n",sched_getcpu(),gettid(),
|
||||
LOG_I(HW, "[SCHED][eNB] RXn_TXnp4 thread started on CPU %d TID %ld, sched_policy = %s , priority = %d, CPU Affinity=%s \n",sched_getcpu(),gettid(),
|
||||
(policy == SCHED_FIFO) ? "SCHED_FIFO" :
|
||||
(policy == SCHED_RR) ? "SCHED_RR" :
|
||||
(policy == SCHED_OTHER) ? "SCHED_OTHER" :
|
||||
@@ -644,12 +644,103 @@ static void* eNB_thread_asynch_rx( void* param ) {
|
||||
LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms;
|
||||
openair0_timestamp timestamp_rx;
|
||||
int frame_rx,subframe_rx;
|
||||
int first_rx = 1;
|
||||
static int first_rx = 1;
|
||||
uint16_t packet_type;
|
||||
uint32_t symbol_number=0;
|
||||
uint32_t symbol_mask, symbol_mask_full;
|
||||
int prach_rx;
|
||||
|
||||
#ifdef DEADLINE_SCHEDULER
|
||||
struct sched_attr attr;
|
||||
unsigned int flags = 0;
|
||||
uint64_t runtime = 870000 ;
|
||||
uint64_t deadline = 1 * 1000000;
|
||||
uint64_t period = 1 * 10000000; // each rx thread has a period of 10ms from the starting point
|
||||
|
||||
attr.size = sizeof(attr);
|
||||
attr.sched_flags = 0;
|
||||
attr.sched_nice = 0;
|
||||
attr.sched_priority = 0;
|
||||
|
||||
attr.sched_policy = SCHED_DEADLINE;
|
||||
attr.sched_runtime = runtime;
|
||||
attr.sched_deadline = deadline;
|
||||
attr.sched_period = period;
|
||||
|
||||
if (sched_setattr(0, &attr, flags) < 0 ) {
|
||||
perror("[SCHED] eNB FH sched_setattr failed\n");
|
||||
return &eNB_thread_FH_status;
|
||||
}
|
||||
|
||||
LOG_I( HW, "[SCHED] eNB asynch RX deadline thread (TID %ld) started on CPU %d\n", gettid(), sched_getcpu() );
|
||||
#else // LOW_LATENCY
|
||||
int policy, s, j;
|
||||
struct sched_param sparam;
|
||||
char cpu_affinity[1024];
|
||||
cpu_set_t cpuset;
|
||||
|
||||
/* Set affinity mask to include CPUs 1 to MAX_CPUS */
|
||||
/* CPU 0 is reserved for UHD */
|
||||
/* CPU 1 is reserved for all TX threads */
|
||||
/* CPU 2..MAX_CPUS is reserved for all RX threads */
|
||||
/* Set CPU Affinity only if number of CPUs >2 */
|
||||
CPU_ZERO(&cpuset);
|
||||
#ifdef CPU_AFFINITY
|
||||
if (get_nprocs() >2) {
|
||||
for (j = 1; j < get_nprocs(); j++)
|
||||
CPU_SET(j, &cpuset);
|
||||
|
||||
s = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
|
||||
if (s != 0) {
|
||||
perror( "pthread_setaffinity_np");
|
||||
exit_fun (" Error setting processor affinity :");
|
||||
}
|
||||
}
|
||||
#endif //CPU_AFFINITY
|
||||
/* Check the actual affinity mask assigned to the thread */
|
||||
|
||||
s = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
|
||||
if (s != 0) {
|
||||
perror ("pthread_getaffinity_np");
|
||||
exit_fun (" Error getting processor affinity :");
|
||||
}
|
||||
memset(cpu_affinity,0, sizeof(cpu_affinity));
|
||||
|
||||
for (j = 0; j < CPU_SETSIZE; j++)
|
||||
if (CPU_ISSET(j, &cpuset)) {
|
||||
char temp[1024];
|
||||
sprintf (temp, " CPU_%d", j);
|
||||
strcat(cpu_affinity, temp);
|
||||
}
|
||||
|
||||
memset(&sparam, 0 , sizeof (sparam));
|
||||
sparam.sched_priority = sched_get_priority_max(SCHED_FIFO);
|
||||
|
||||
policy = SCHED_FIFO ;
|
||||
s = pthread_setschedparam(pthread_self(), policy, &sparam);
|
||||
if (s != 0) {
|
||||
perror("pthread_setschedparam : ");
|
||||
exit_fun("Error setting thread priority");
|
||||
}
|
||||
|
||||
memset(&sparam, 0 , sizeof (sparam));
|
||||
|
||||
s = pthread_getschedparam(pthread_self(), &policy, &sparam);
|
||||
if (s != 0) {
|
||||
perror("pthread_getschedparam");
|
||||
exit_fun("Error getting thread priority");
|
||||
}
|
||||
|
||||
LOG_I(HW, "[SCHED][eNB] eNB asynch RX thread started on CPU %d TID %ld, sched_policy = %s, priority = %d, CPU Affinity = %s\n", sched_getcpu(),gettid(),
|
||||
(policy == SCHED_FIFO) ? "SCHED_FIFO" :
|
||||
(policy == SCHED_RR) ? "SCHED_RR" :
|
||||
(policy == SCHED_OTHER) ? "SCHED_OTHER" :
|
||||
"???",
|
||||
sparam.sched_priority, cpu_affinity);
|
||||
|
||||
|
||||
#endif // DEADLINE_SCHEDULER
|
||||
|
||||
if (eNB->node_function == eNodeB_3GPP_BBU) { // acquisition from IF
|
||||
/// **** recv_IF5 of rxdata from RRH **** ///
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_RECV_IF5, 1 );
|
||||
@@ -772,11 +863,11 @@ static void* eNB_thread_FH( void* param ) {
|
||||
attr.sched_period = period;
|
||||
|
||||
if (sched_setattr(0, &attr, flags) < 0 ) {
|
||||
perror("[SCHED] eNB RX sched_setattr failed\n");
|
||||
perror("[SCHED] eNB FH sched_setattr failed\n");
|
||||
return &eNB_thread_FH_status;
|
||||
}
|
||||
|
||||
LOG_I( HW, "[SCHED] eNB RX deadline thread (TID %ld) started on CPU %d\n", gettid(), sched_getcpu() );
|
||||
LOG_I( HW, "[SCHED] eNB FH deadline thread (TID %ld) started on CPU %d\n", gettid(), sched_getcpu() );
|
||||
#else // LOW_LATENCY
|
||||
int policy, s, j;
|
||||
struct sched_param sparam;
|
||||
@@ -835,7 +926,7 @@ static void* eNB_thread_FH( void* param ) {
|
||||
exit_fun("Error getting thread priority");
|
||||
}
|
||||
|
||||
LOG_I(HW, "[SCHED][eNB] RX thread started on CPU %d TID %ld, sched_policy = %s, priority = %d, CPU Affinity = %s\n", sched_getcpu(),gettid(),
|
||||
LOG_I(HW, "[SCHED][eNB] FH thread started on CPU %d TID %ld, sched_policy = %s, priority = %d, CPU Affinity = %s\n", sched_getcpu(),gettid(),
|
||||
(policy == SCHED_FIFO) ? "SCHED_FIFO" :
|
||||
(policy == SCHED_RR) ? "SCHED_RR" :
|
||||
(policy == SCHED_OTHER) ? "SCHED_OTHER" :
|
||||
@@ -848,8 +939,8 @@ static void* eNB_thread_FH( void* param ) {
|
||||
|
||||
mlockall(MCL_CURRENT | MCL_FUTURE);
|
||||
|
||||
// wait for top-level synchronization and do one acquisition to get timestamp for setting frame/subframe of TX and RX threads
|
||||
printf( "waiting for sync (eNB_thread_rx_common)\n");
|
||||
// wait for top-level synchronization and do one acquisition to get timestamp for setting frame/subframe
|
||||
printf( "waiting for sync (eNB_thread_FH)\n");
|
||||
pthread_mutex_lock( &sync_mutex );
|
||||
|
||||
while (sync_var<0)
|
||||
@@ -1080,8 +1171,8 @@ static void* eNB_thread_FH( void* param ) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
LOG_W( PHY,"[eNB] Frame %d, FH CC_id %d thread busy!! (cnt_rxtx %i)\n",slave_proc->frame_rx,slave_proc->CC_id, cnt_slave);
|
||||
exit_fun( "TX thread busy" );
|
||||
LOG_W( PHY,"[eNB] Frame %d, FH CC_id %d thread busy!! (cnt_FH %i)\n",slave_proc->frame_rx,slave_proc->CC_id, cnt_slave);
|
||||
exit_fun( "FH thread busy" );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1324,91 +1415,94 @@ static void* eNB_thread_prach( void* param ) {
|
||||
}
|
||||
|
||||
|
||||
void init_eNB_proc(void) {
|
||||
void init_eNB_proc(int nb_inst) {
|
||||
|
||||
int i;
|
||||
int CC_id;
|
||||
PHY_VARS_eNB *eNB;
|
||||
eNB_proc_t *proc;
|
||||
eNB_rxtx_proc_t *proc_rxtx;
|
||||
int inst;
|
||||
|
||||
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
||||
eNB = PHY_vars_eNB_g[0][CC_id];
|
||||
|
||||
proc = &eNB->proc;
|
||||
proc_rxtx = proc->proc_rxtx;
|
||||
for (inst = 0; inst < nb_inst; inst++) {
|
||||
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
||||
eNB = PHY_vars_eNB_g[inst][CC_id];
|
||||
LOG_I(PHY,"Initializing eNB %d CC_id %d (%s,%s),\n",inst,CC_id,eNB_functions[eNB->node_function],eNB_timing[eNB->node_timing]);
|
||||
proc = &eNB->proc;
|
||||
proc_rxtx = proc->proc_rxtx;
|
||||
#ifndef DEADLINE_SCHEDULER
|
||||
/*
|
||||
pthread_attr_init( &attr_eNB_proc_tx[CC_id][i] );
|
||||
if (pthread_attr_setstacksize( &attr_eNB_proc_tx[CC_id][i], 64 *PTHREAD_STACK_MIN ) != 0)
|
||||
perror("[ENB_PROC_TX] setting thread stack size failed\n");
|
||||
|
||||
pthread_attr_init( &attr_eNB_proc_rx[CC_id][i] );
|
||||
if (pthread_attr_setstacksize( &attr_eNB_proc_rx[CC_id][i], 64 * PTHREAD_STACK_MIN ) != 0)
|
||||
perror("[ENB_PROC_RX] setting thread stack size failed\n");
|
||||
*/
|
||||
// set the kernel scheduling policy and priority
|
||||
proc_rxtx[0].sched_param_rxtx.sched_priority = sched_get_priority_max(SCHED_FIFO)-1; //OPENAIR_THREAD_PRIORITY;
|
||||
pthread_attr_setschedparam (&proc_rxtx[0].attr_rxtx, &proc_rxtx[0].sched_param_rxtx);
|
||||
pthread_attr_setschedpolicy (&proc_rxtx[0].attr_rxtx, SCHED_FIFO);
|
||||
proc_rxtx[1].sched_param_rxtx.sched_priority = sched_get_priority_max(SCHED_FIFO)-1; //OPENAIR_THREAD_PRIORITY;
|
||||
pthread_attr_setschedparam (&proc_rxtx[1].attr_rxtx, &proc_rxtx[1].sched_param_rxtx);
|
||||
pthread_attr_setschedpolicy (&proc_rxtx[1].attr_rxtx, SCHED_FIFO);
|
||||
|
||||
proc->sched_param_FH.sched_priority = sched_get_priority_max(SCHED_FIFO); //OPENAIR_THREAD_PRIORITY;
|
||||
pthread_attr_setschedparam (&proc->attr_FH, &proc->sched_param_FH);
|
||||
pthread_attr_setschedpolicy (&proc->attr_FH, SCHED_FIFO);
|
||||
|
||||
proc->sched_param_prach.sched_priority = sched_get_priority_max(SCHED_FIFO)-1; //OPENAIR_THREAD_PRIORITY;
|
||||
pthread_attr_setschedparam (&proc->attr_prach, &proc->sched_param_prach);
|
||||
pthread_attr_setschedpolicy (&proc->attr_prach, SCHED_FIFO);
|
||||
|
||||
printf("Setting OS scheduler to SCHED_FIFO for eNB [cc%d][thread%d] \n",CC_id, i);
|
||||
/*
|
||||
pthread_attr_init( &attr_eNB_proc_tx[CC_id][i] );
|
||||
if (pthread_attr_setstacksize( &attr_eNB_proc_tx[CC_id][i], 64 *PTHREAD_STACK_MIN ) != 0)
|
||||
perror("[ENB_PROC_TX] setting thread stack size failed\n");
|
||||
|
||||
pthread_attr_init( &attr_eNB_proc_rx[CC_id][i] );
|
||||
if (pthread_attr_setstacksize( &attr_eNB_proc_rx[CC_id][i], 64 * PTHREAD_STACK_MIN ) != 0)
|
||||
perror("[ENB_PROC_RX] setting thread stack size failed\n");
|
||||
*/
|
||||
// set the kernel scheduling policy and priority
|
||||
proc_rxtx[0].sched_param_rxtx.sched_priority = sched_get_priority_max(SCHED_FIFO)-1; //OPENAIR_THREAD_PRIORITY;
|
||||
pthread_attr_setschedparam (&proc_rxtx[0].attr_rxtx, &proc_rxtx[0].sched_param_rxtx);
|
||||
pthread_attr_setschedpolicy (&proc_rxtx[0].attr_rxtx, SCHED_FIFO);
|
||||
proc_rxtx[1].sched_param_rxtx.sched_priority = sched_get_priority_max(SCHED_FIFO)-1; //OPENAIR_THREAD_PRIORITY;
|
||||
pthread_attr_setschedparam (&proc_rxtx[1].attr_rxtx, &proc_rxtx[1].sched_param_rxtx);
|
||||
pthread_attr_setschedpolicy (&proc_rxtx[1].attr_rxtx, SCHED_FIFO);
|
||||
|
||||
proc->sched_param_FH.sched_priority = sched_get_priority_max(SCHED_FIFO); //OPENAIR_THREAD_PRIORITY;
|
||||
pthread_attr_setschedparam (&proc->attr_FH, &proc->sched_param_FH);
|
||||
pthread_attr_setschedpolicy (&proc->attr_FH, SCHED_FIFO);
|
||||
|
||||
proc->sched_param_prach.sched_priority = sched_get_priority_max(SCHED_FIFO)-1; //OPENAIR_THREAD_PRIORITY;
|
||||
pthread_attr_setschedparam (&proc->attr_prach, &proc->sched_param_prach);
|
||||
pthread_attr_setschedpolicy (&proc->attr_prach, SCHED_FIFO);
|
||||
|
||||
printf("Setting OS scheduler to SCHED_FIFO for eNB [cc%d][thread%d] \n",CC_id, i);
|
||||
#endif
|
||||
proc_rxtx[0].instance_cnt_rxtx = -1;
|
||||
proc_rxtx[1].instance_cnt_rxtx = -1;
|
||||
proc->instance_cnt_prach = -1;
|
||||
proc->instance_cnt_FH = -1;
|
||||
proc->CC_id = CC_id;
|
||||
|
||||
proc->first_rx=4;
|
||||
|
||||
pthread_mutex_init( &proc_rxtx[0].mutex_rxtx, NULL);
|
||||
pthread_mutex_init( &proc_rxtx[1].mutex_rxtx, NULL);
|
||||
pthread_mutex_init( &proc->mutex_prach, NULL);
|
||||
pthread_cond_init( &proc_rxtx[0].cond_rxtx, NULL);
|
||||
pthread_cond_init( &proc_rxtx[1].cond_rxtx, NULL);
|
||||
pthread_cond_init( &proc->cond_prach, NULL);
|
||||
pthread_cond_init( &proc->cond_FH, NULL);
|
||||
proc_rxtx[0].instance_cnt_rxtx = -1;
|
||||
proc_rxtx[1].instance_cnt_rxtx = -1;
|
||||
proc->instance_cnt_prach = -1;
|
||||
proc->instance_cnt_FH = -1;
|
||||
proc->CC_id = CC_id;
|
||||
|
||||
proc->first_rx=4;
|
||||
|
||||
pthread_mutex_init( &proc_rxtx[0].mutex_rxtx, NULL);
|
||||
pthread_mutex_init( &proc_rxtx[1].mutex_rxtx, NULL);
|
||||
pthread_mutex_init( &proc->mutex_prach, NULL);
|
||||
pthread_cond_init( &proc_rxtx[0].cond_rxtx, NULL);
|
||||
pthread_cond_init( &proc_rxtx[1].cond_rxtx, NULL);
|
||||
pthread_cond_init( &proc->cond_prach, NULL);
|
||||
pthread_cond_init( &proc->cond_FH, NULL);
|
||||
#ifndef DEADLINE_SCHEDULER
|
||||
pthread_create( &proc_rxtx[0].pthread_rxtx, &proc_rxtx[0].attr_rxtx, eNB_thread_rxtx, &proc_rxtx[0] );
|
||||
pthread_create( &proc_rxtx[1].pthread_rxtx, &proc_rxtx[1].attr_rxtx, eNB_thread_rxtx, &proc_rxtx[1] );
|
||||
pthread_create( &proc->pthread_FH, &proc->attr_FH, eNB_thread_FH, &eNB->proc );
|
||||
pthread_create( &proc->pthread_prach, &proc->attr_prach, eNB_thread_prach, &eNB->proc );
|
||||
if (eNB->node_timing == synch_to_other)
|
||||
pthread_create( &proc->pthread_asynch_rx, &proc->attr_asynch_rx, eNB_thread_asynch_rx, &eNB->proc );
|
||||
pthread_create( &proc_rxtx[0].pthread_rxtx, &proc_rxtx[0].attr_rxtx, eNB_thread_rxtx, &proc_rxtx[0] );
|
||||
pthread_create( &proc_rxtx[1].pthread_rxtx, &proc_rxtx[1].attr_rxtx, eNB_thread_rxtx, &proc_rxtx[1] );
|
||||
pthread_create( &proc->pthread_FH, &proc->attr_FH, eNB_thread_FH, &eNB->proc );
|
||||
pthread_create( &proc->pthread_prach, &proc->attr_prach, eNB_thread_prach, &eNB->proc );
|
||||
if (eNB->node_timing == synch_to_other)
|
||||
pthread_create( &proc->pthread_asynch_rx, &proc->attr_asynch_rx, eNB_thread_asynch_rx, &eNB->proc );
|
||||
#else
|
||||
pthread_create( &proc_rxtx[0].pthread_rxtx, NULL, eNB_thread_rxtx, &eNB->proc_rxtx[0] );
|
||||
pthread_create( &proc_rxtx[1].pthread_rxtx, NULL, eNB_thread_rxtx, &eNB->proc_rxtx[1] );
|
||||
pthread_create( &proc->pthread_FH, NULL, eNB_thread_FH, &eNB->proc );
|
||||
pthread_create( &proc->pthread_prach, NULL, eNB_thread_prach, &eNB->proc );
|
||||
if (eNB->node_timing == synch_to_other)
|
||||
pthread_create( &proc->pthread_asynch_rx, NULL, eNB_thread_asynch_rx, &eNB->proc );
|
||||
|
||||
pthread_create( &proc_rxtx[0].pthread_rxtx, NULL, eNB_thread_rxtx, &eNB->proc_rxtx[0] );
|
||||
pthread_create( &proc_rxtx[1].pthread_rxtx, NULL, eNB_thread_rxtx, &eNB->proc_rxtx[1] );
|
||||
pthread_create( &proc->pthread_FH, NULL, eNB_thread_FH, &eNB->proc );
|
||||
pthread_create( &proc->pthread_prach, NULL, eNB_thread_prach, &eNB->proc );
|
||||
if (eNB->node_timing == synch_to_other)
|
||||
pthread_create( &proc->pthread_asynch_rx, NULL, eNB_thread_asynch_rx, &eNB->proc );
|
||||
|
||||
#endif
|
||||
char name[16];
|
||||
snprintf( name, sizeof(name), "RXTX0 %d", i );
|
||||
pthread_setname_np( proc_rxtx[0].pthread_rxtx, name );
|
||||
snprintf( name, sizeof(name), "RXTX1 %d", i );
|
||||
pthread_setname_np( proc_rxtx[1].pthread_rxtx, name );
|
||||
snprintf( name, sizeof(name), "FH %d", i );
|
||||
pthread_setname_np( proc->pthread_FH, name );
|
||||
char name[16];
|
||||
snprintf( name, sizeof(name), "RXTX0 %d", i );
|
||||
pthread_setname_np( proc_rxtx[0].pthread_rxtx, name );
|
||||
snprintf( name, sizeof(name), "RXTX1 %d", i );
|
||||
pthread_setname_np( proc_rxtx[1].pthread_rxtx, name );
|
||||
snprintf( name, sizeof(name), "FH %d", i );
|
||||
pthread_setname_np( proc->pthread_FH, name );
|
||||
}
|
||||
|
||||
/* setup PHY proc TX sync mechanism */
|
||||
pthread_mutex_init(&sync_phy_proc.mutex_phy_proc_tx, NULL);
|
||||
pthread_cond_init(&sync_phy_proc.cond_phy_proc_tx, NULL);
|
||||
sync_phy_proc.phy_proc_CC_id = 0;
|
||||
}
|
||||
|
||||
/* setup PHY proc TX sync mechanism */
|
||||
pthread_mutex_init(&sync_phy_proc.mutex_phy_proc_tx, NULL);
|
||||
pthread_cond_init(&sync_phy_proc.cond_phy_proc_tx, NULL);
|
||||
sync_phy_proc.phy_proc_CC_id = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1577,14 +1671,15 @@ void print_opp_meas(void) {
|
||||
}
|
||||
|
||||
|
||||
void init_eNB(eNB_func_t node_function) {
|
||||
void init_eNB(eNB_func_t node_function,int nb_inst) {
|
||||
|
||||
int CC_id;
|
||||
|
||||
for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++)
|
||||
PHY_vars_eNB_g[0][CC_id]->node_function = node_function;
|
||||
|
||||
init_eNB_proc();
|
||||
int inst;
|
||||
for (inst=0;inst<nb_inst;inst++)
|
||||
for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++)
|
||||
PHY_vars_eNB_g[0][CC_id]->node_function = node_function;
|
||||
|
||||
init_eNB_proc(nb_inst);
|
||||
sleep(1);
|
||||
LOG_D(HW,"[lte-softmodem.c] eNB threads created\n");
|
||||
|
||||
|
||||
@@ -119,14 +119,14 @@ unsigned short config_frames[4] = {2,9,11,13};
|
||||
|
||||
// In lte-enb.c
|
||||
extern int setup_eNB_buffers(PHY_VARS_eNB **phy_vars_eNB, openair0_config_t *openair0_cfg, openair0_rf_map rf_map[MAX_NUM_CCs]);
|
||||
extern void init_eNB(eNB_func_t);
|
||||
extern void init_eNB(eNB_func_t,int);
|
||||
extern void stop_eNB(void);
|
||||
extern void kill_eNB_proc(void);
|
||||
|
||||
// In lte-ue.c
|
||||
extern int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg, openair0_rf_map rf_map[MAX_NUM_CCs]);
|
||||
extern void fill_ue_band_info(void);
|
||||
extern void init_UE(void);
|
||||
extern void init_UE(int);
|
||||
|
||||
#ifdef XFORMS
|
||||
// current status is that every UE has a DL scope for a SINGLE eNB (eNB_id=0)
|
||||
@@ -284,9 +284,6 @@ eth_params_t *eth_params;
|
||||
|
||||
openair0_config_t openair0_cfg[MAX_CARDS];
|
||||
|
||||
// Change to openair_global to handle UE
|
||||
openair0_device openair0;
|
||||
|
||||
double cpuf;
|
||||
|
||||
char uecap_xer[1024],uecap_xer_in=0;
|
||||
@@ -1677,40 +1674,15 @@ int main( int argc, char **argv )
|
||||
}
|
||||
}
|
||||
}
|
||||
/* device host type is set*/
|
||||
openair0.host_type = BBU_HOST;
|
||||
/* device type is initialized NONE_DEV (no RF device) when the RF device will be initiated device type will be set */
|
||||
openair0.type = NONE_DEV;
|
||||
/* transport type is initialized NONE_TP (no transport protocol) when the transport protocol will be initiated transport protocol type will be set */
|
||||
openair0.transp_type = NONE_TP;
|
||||
|
||||
// Legacy BBU - RRH init
|
||||
//int returns=-1;
|
||||
///* BBU can have either a local or a remote radio head */
|
||||
//if (local_remote_radio == BBU_LOCAL_RADIO_HEAD) { //local radio head active - load library of radio head and initiate it
|
||||
//if (mode!=loop_through_memory) {
|
||||
//returns=openair0_device_load(&openair0, &openair0_cfg[0]);
|
||||
//printf("openair0_device_init returns %d\n",returns);
|
||||
//if (returns<0) {
|
||||
//printf("Exiting, cannot initialize device\n");
|
||||
//exit(-1);
|
||||
//}
|
||||
//}
|
||||
//else if (mode==loop_through_memory) {
|
||||
//}
|
||||
//} else { //remote radio head active - load library of transport protocol and initiate it
|
||||
//if (mode!=loop_through_memory) {
|
||||
//returns=openair0_transport_load(&openair0, &openair0_cfg[0], eth_params);
|
||||
//printf("openair0_transport_init returns %d\n",returns);
|
||||
//if (returns<0) {
|
||||
//printf("Exiting, cannot initialize transport protocol\n");
|
||||
//exit(-1);
|
||||
//}
|
||||
//}
|
||||
//else if (mode==loop_through_memory) {
|
||||
//}
|
||||
//}
|
||||
|
||||
else {
|
||||
/* device host type is set*/
|
||||
PHY_vars_UE_g[0][0]->rfdevice.host_type = BBU_HOST;
|
||||
/* device type is initialized NONE_DEV (no RF device) when the RF device will be initiated device type will be set */
|
||||
PHY_vars_UE_g[0][0]->rfdevice.type = NONE_DEV;
|
||||
/* transport type is initialized NONE_TP (no transport protocol) when the transport protocol will be initiated transport protocol type will be set */
|
||||
PHY_vars_UE_g[0][0]->rfdevice.transp_type = NONE_TP;
|
||||
}
|
||||
|
||||
int returns=-1;
|
||||
|
||||
// Handle spatially distributed MIMO antenna ports
|
||||
@@ -1720,7 +1692,7 @@ int main( int argc, char **argv )
|
||||
if (mode!=loop_through_memory) {
|
||||
returns= (UE_flag == 0) ?
|
||||
openair0_device_load(&(PHY_vars_eNB_g[0][CC_id]->rfdevice), &openair0_cfg[0]) :
|
||||
openair0_device_load(&openair0, &openair0_cfg[0]);
|
||||
openair0_device_load(&(PHY_vars_UE_g[0][CC_id]->rfdevice), &openair0_cfg[0]);
|
||||
|
||||
printf("openair0_device_init returns %d for CC_id %d\n",returns,CC_id);
|
||||
if (returns<0) {
|
||||
@@ -1904,8 +1876,8 @@ int main( int argc, char **argv )
|
||||
|
||||
|
||||
// start the main thread
|
||||
if (UE_flag == 1) init_UE();
|
||||
else init_eNB(node_function);
|
||||
if (UE_flag == 1) init_UE(1);
|
||||
else init_eNB(node_function,1);
|
||||
|
||||
// Sleep to allow all threads to setup
|
||||
sleep(3);
|
||||
@@ -1978,16 +1950,18 @@ int main( int argc, char **argv )
|
||||
pthread_mutex_destroy(&sync_mutex);
|
||||
|
||||
// *** Handle per CC_id openair0
|
||||
if (UE_flag==1)
|
||||
openair0.trx_end_func(&openair0);
|
||||
|
||||
for(CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
||||
if (PHY_vars_eNB_g[0][CC_id]->rfdevice.trx_end_func)
|
||||
PHY_vars_eNB_g[0][CC_id]->rfdevice.trx_end_func(&PHY_vars_eNB_g[0][CC_id]->rfdevice);
|
||||
if (PHY_vars_eNB_g[0][CC_id]->ifdevice.trx_end_func)
|
||||
PHY_vars_eNB_g[0][CC_id]->ifdevice.trx_end_func(&PHY_vars_eNB_g[0][CC_id]->ifdevice);
|
||||
if (UE_flag==1) {
|
||||
if (PHY_vars_UE_g[0][0]->rfdevice.trx_end_func)
|
||||
PHY_vars_UE_g[0][0]->rfdevice.trx_end_func(&PHY_vars_UE_g[0][0]->rfdevice);
|
||||
}
|
||||
else {
|
||||
for(CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
|
||||
if (PHY_vars_eNB_g[0][CC_id]->rfdevice.trx_end_func)
|
||||
PHY_vars_eNB_g[0][CC_id]->rfdevice.trx_end_func(&PHY_vars_eNB_g[0][CC_id]->rfdevice);
|
||||
if (PHY_vars_eNB_g[0][CC_id]->ifdevice.trx_end_func)
|
||||
PHY_vars_eNB_g[0][CC_id]->ifdevice.trx_end_func(&PHY_vars_eNB_g[0][CC_id]->ifdevice);
|
||||
}
|
||||
}
|
||||
|
||||
if (ouput_vcd)
|
||||
VCD_SIGNAL_DUMPER_CLOSE();
|
||||
|
||||
|
||||
+81
-262
@@ -92,9 +92,9 @@ typedef enum {
|
||||
si=2
|
||||
} sync_mode_t;
|
||||
|
||||
void init_UE_threads(void);
|
||||
void init_UE_threads(int nb_inst);
|
||||
void *UE_thread(void *arg);
|
||||
void init_UE(void);
|
||||
void init_UE(int nb_inst);
|
||||
|
||||
extern pthread_cond_t sync_cond;
|
||||
extern pthread_mutex_t sync_mutex;
|
||||
@@ -105,8 +105,6 @@ extern openair0_config_t openair0_cfg[MAX_CARDS];
|
||||
extern uint32_t downlink_frequency[MAX_NUM_CCs][4];
|
||||
extern int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
|
||||
extern openair0_rf_map rf_map[MAX_NUM_CCs];
|
||||
|
||||
extern openair0_device openair0;
|
||||
extern int oai_exit;
|
||||
|
||||
extern int32_t **rxdata;
|
||||
@@ -176,21 +174,26 @@ pthread_t main_ue_thread;
|
||||
pthread_attr_t attr_UE_thread;
|
||||
struct sched_param sched_param_UE_thread;
|
||||
|
||||
void init_UE() {
|
||||
void init_UE(int nb_inst) {
|
||||
|
||||
int error_code;
|
||||
|
||||
printf("Intializing UE Threads ...\n");
|
||||
init_UE_threads();
|
||||
sleep(1);
|
||||
error_code = pthread_create(&main_ue_thread, &attr_UE_thread, UE_thread, NULL);
|
||||
|
||||
if (error_code!= 0) {
|
||||
LOG_D(HW,"[lte-softmodem.c] Could not allocate UE_thread, error %d\n",error_code);
|
||||
return;
|
||||
} else {
|
||||
LOG_D( HW, "[lte-softmodem.c] Allocate UE_thread successful\n" );
|
||||
pthread_setname_np( main_ue_thread, "main UE" );
|
||||
int inst;
|
||||
PHY_VARS_UE *UE;
|
||||
|
||||
for (inst=0;inst<nb_inst;inst++) {
|
||||
printf("Intializing UE Threads for instance %d ...\n",inst);
|
||||
init_UE_threads(inst);
|
||||
sleep(1);
|
||||
UE = PHY_vars_UE_g[inst][0];
|
||||
error_code = pthread_create(&UE->proc.pthread_ue, &UE->proc.attr_ue, UE_thread, NULL);
|
||||
|
||||
if (error_code!= 0) {
|
||||
LOG_D(HW,"[lte-softmodem.c] Could not allocate UE_thread, error %d\n",error_code);
|
||||
return;
|
||||
} else {
|
||||
LOG_D(HW, "[lte-softmodem.c] Allocate UE_thread successful\n" );
|
||||
pthread_setname_np( UE->proc.pthread_ue, "main UE" );
|
||||
}
|
||||
}
|
||||
|
||||
printf("UE threads created\n");
|
||||
@@ -362,7 +365,7 @@ static void *UE_thread_synch(void *arg)
|
||||
|
||||
}
|
||||
|
||||
if (openair0.trx_start_func(&openair0) != 0 ) {
|
||||
if (UE->rfdevice.trx_start_func(&UE->rfdevice) != 0 ) {
|
||||
LOG_E(HW,"Could not start the device\n");
|
||||
oai_exit=1;
|
||||
}
|
||||
@@ -484,12 +487,12 @@ static void *UE_thread_synch(void *arg)
|
||||
break;
|
||||
}
|
||||
|
||||
//openair0.trx_set_freq_func(&openair0,&openair0_cfg[0],0);
|
||||
//openair0.trx_set_gains_func(&openair0,&openair0_cfg[0]);
|
||||
openair0.trx_stop_func(&openair0);
|
||||
//UE->rfdevice.trx_set_freq_func(&openair0,&openair0_cfg[0],0);
|
||||
//UE->rfdevice.trx_set_gains_func(&openair0,&openair0_cfg[0]);
|
||||
UE->rfdevice.trx_stop_func(&UE->rfdevice);
|
||||
sleep(1);
|
||||
init_frame_parms(&UE->frame_parms,1);
|
||||
if (openair0.trx_start_func(&openair0) != 0 ) {
|
||||
if (UE->rfdevice.trx_start_func(&UE->rfdevice) != 0 ) {
|
||||
LOG_E(HW,"Could not start the device\n");
|
||||
oai_exit=1;
|
||||
}
|
||||
@@ -568,7 +571,7 @@ static void *UE_thread_synch(void *arg)
|
||||
|
||||
}
|
||||
}
|
||||
// openair0.trx_set_freq_func(&openair0,&openair0_cfg[0],0);
|
||||
// UE->rfdevice.trx_set_freq_func(&openair0,&openair0_cfg[0],0);
|
||||
|
||||
if (UE->UE_scan_carrier==1) {
|
||||
for (i=0;i<openair0_cfg[0].rx_num_channels;i++) {
|
||||
@@ -606,192 +609,6 @@ static void *UE_thread_synch(void *arg)
|
||||
return &UE_thread_synch_retval;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief This is the UE transmit thread.
|
||||
* This thread performs the phy_procedures_UE_TX() on every transmit slot.
|
||||
* \param arg is a pointer to a \ref PHY_VARS_UE structure.
|
||||
* \returns a pointer to an int. The storage is not on the heap and must not be freed.
|
||||
*/
|
||||
/*
|
||||
static void *UE_thread_tx(void *arg)
|
||||
{
|
||||
static int UE_thread_tx_retval;
|
||||
//int ret;
|
||||
|
||||
PHY_VARS_UE *UE = (PHY_VARS_UE*)arg;
|
||||
|
||||
UE->instance_cnt_tx=-1;
|
||||
|
||||
#ifdef DEADLINE_SCHEDULER
|
||||
|
||||
struct sched_attr attr;
|
||||
unsigned int flags = 0;
|
||||
|
||||
attr.size = sizeof(attr);
|
||||
attr.sched_flags = 0;
|
||||
attr.sched_nice = 0;
|
||||
attr.sched_priority = 0;
|
||||
|
||||
// This creates a 1ms reservation every 10ms period
|
||||
attr.sched_policy = SCHED_DEADLINE;
|
||||
attr.sched_runtime = 900000; // each tx thread requires .5ms to finish its job
|
||||
attr.sched_deadline = 1000000; // each tx thread will finish within 1ms
|
||||
attr.sched_period = 1000000; // each tx thread has a period of 1ms from the starting point
|
||||
|
||||
|
||||
if (sched_setattr(0, &attr, flags) < 0 ) {
|
||||
perror("[SCHED] UE_thread_tx thread: sched_setattr failed\n");
|
||||
return &UE_thread_tx_retval;
|
||||
}
|
||||
|
||||
#else
|
||||
int policy, s, j;
|
||||
struct sched_param sparam;
|
||||
char cpu_affinity[1024];
|
||||
cpu_set_t cpuset;
|
||||
|
||||
// Set affinity mask to include CPUs 1 to MAX_CPUS
|
||||
// CPU 0 is reserved for UHD threads
|
||||
CPU_ZERO(&cpuset);
|
||||
|
||||
#ifdef CPU_AFFINITY
|
||||
if (get_nprocs() >2)
|
||||
{
|
||||
for (j = 1; j < get_nprocs(); j++)
|
||||
CPU_SET(j, &cpuset);
|
||||
|
||||
s = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
|
||||
if (s != 0)
|
||||
{
|
||||
perror( "pthread_setaffinity_np");
|
||||
exit_fun("Error setting processor affinity");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Check the actual affinity mask assigned to the thread
|
||||
|
||||
s = pthread_getaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
|
||||
if (s != 0)
|
||||
{
|
||||
perror( "pthread_getaffinity_np");
|
||||
exit_fun("Error getting processor affinity ");
|
||||
}
|
||||
memset(cpu_affinity, 0 , sizeof(cpu_affinity));
|
||||
for (j = 0; j < CPU_SETSIZE; j++)
|
||||
if (CPU_ISSET(j, &cpuset))
|
||||
{
|
||||
char temp[1024];
|
||||
sprintf(temp, " CPU_%d ", j);
|
||||
strcat(cpu_affinity, temp);
|
||||
}
|
||||
|
||||
memset(&sparam, 0 , sizeof (sparam));
|
||||
sparam.sched_priority = sched_get_priority_max(SCHED_FIFO)-1;
|
||||
policy = SCHED_FIFO ;
|
||||
|
||||
s = pthread_setschedparam(pthread_self(), policy, &sparam);
|
||||
if (s != 0)
|
||||
{
|
||||
perror("pthread_setschedparam : ");
|
||||
exit_fun("Error setting thread priority");
|
||||
}
|
||||
s = pthread_getschedparam(pthread_self(), &policy, &sparam);
|
||||
if (s != 0)
|
||||
{
|
||||
perror("pthread_getschedparam : ");
|
||||
exit_fun("Error getting thread priority");
|
||||
|
||||
}
|
||||
|
||||
LOG_I( HW, "[SCHED][UE] Started UE thread TX on CPU %d TID %ld , sched_policy = %s, priority = %d, CPU Affinity = %s \n", (int)sched_getcpu(), gettid(),
|
||||
(policy == SCHED_FIFO) ? "SCHED_FIFO" :
|
||||
(policy == SCHED_RR) ? "SCHED_RR" :
|
||||
(policy == SCHED_OTHER) ? "SCHED_OTHER" :
|
||||
"???",
|
||||
(int) sparam.sched_priority, cpu_affinity);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
printf("waiting for sync (UE_thread_tx)\n");
|
||||
|
||||
pthread_mutex_lock(&sync_mutex);
|
||||
printf("Locked sync_mutex, waiting (UE_thread_tx)\n");
|
||||
|
||||
while (sync_var<0)
|
||||
pthread_cond_wait(&sync_cond, &sync_mutex);
|
||||
|
||||
pthread_mutex_unlock(&sync_mutex);
|
||||
printf("unlocked sync_mutex, waiting (UE_thread_tx)\n");
|
||||
|
||||
printf("Starting UE TX thread\n");
|
||||
|
||||
// Lock memory from swapping. This is a process wide call (not constraint to this thread).
|
||||
mlockall(MCL_CURRENT | MCL_FUTURE);
|
||||
|
||||
while (!oai_exit) {
|
||||
|
||||
if (pthread_mutex_lock(&UE->mutex_tx) != 0) {
|
||||
LOG_E( PHY, "[SCHED][UE] error locking mutex for UE TX\n" );
|
||||
exit_fun("nothing to add");
|
||||
return &UE_thread_tx_retval;
|
||||
}
|
||||
|
||||
while (UE->instance_cnt_tx < 0) {
|
||||
// most of the time, the thread is waiting here
|
||||
pthread_cond_wait( &UE->cond_tx, &UE->mutex_tx );
|
||||
}
|
||||
|
||||
if (pthread_mutex_unlock(&UE->mutex_tx) != 0) {
|
||||
LOG_E( PHY, "[SCHED][UE] error unlocking mutex for UE TX\n" );
|
||||
exit_fun("nothing to add");
|
||||
return &UE_thread_tx_retval;
|
||||
}
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_THREAD_TX, 1 );
|
||||
|
||||
if ((subframe_select( &UE->frame_parms, UE->slot_tx>>1 ) == SF_UL) ||
|
||||
(UE->frame_parms.frame_type == FDD)) {
|
||||
phy_procedures_UE_TX( UE, 0, 0, UE->mode, no_relay );
|
||||
}
|
||||
|
||||
if ((subframe_select( &UE->frame_parms, UE->slot_tx>>1 ) == SF_S) &&
|
||||
((UE->slot_tx&1) == 1)) {
|
||||
phy_procedures_UE_S_TX( UE, 0, 0, no_relay );
|
||||
}
|
||||
|
||||
UE->slot_tx += 2;
|
||||
|
||||
if (UE->slot_tx >= 20) {
|
||||
UE->slot_tx -= 20;
|
||||
UE->frame_tx++;
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_TX_UE, UE->frame_tx );
|
||||
}
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_TX_UE, UE->slot_tx>>1 );
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_THREAD_TX, 0 );
|
||||
|
||||
if (pthread_mutex_lock(&UE->mutex_tx) != 0) {
|
||||
LOG_E( PHY, "[SCHED][UE] error locking mutex for UE TX thread\n" );
|
||||
exit_fun("nothing to add");
|
||||
return &UE_thread_tx_retval;
|
||||
}
|
||||
|
||||
UE->instance_cnt_tx--;
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE_INST_CNT_TX, UE->instance_cnt_tx);
|
||||
|
||||
if (pthread_mutex_unlock(&UE->mutex_tx) != 0) {
|
||||
LOG_E( PHY, "[SCHED][UE] error unlocking mutex for UE TX thread\n" );
|
||||
exit_fun("nothing to add");
|
||||
return &UE_thread_tx_retval;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return &UE_thread_tx_retval;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
@@ -804,7 +621,7 @@ static void *UE_thread_tx(void *arg)
|
||||
|
||||
static void *UE_thread_rxn_txnp4(void *arg)
|
||||
{
|
||||
static int UE_thread_rx_retval;
|
||||
static int UE_thread_rxtx_retval;
|
||||
UE_rxtx_proc_t *proc = (UE_rxtx_proc_t *)arg;
|
||||
int ret;
|
||||
PHY_VARS_UE *UE=PHY_vars_UE_g[0][proc->CC_id];
|
||||
@@ -828,8 +645,8 @@ static void *UE_thread_rxn_txnp4(void *arg)
|
||||
attr.sched_period = 1000000; // each rx thread has a period of 1ms from the starting point
|
||||
|
||||
if (sched_setattr(0, &attr, flags) < 0 ) {
|
||||
perror("[SCHED] UE_thread_rx : sched_setattr failed\n");
|
||||
return &UE_thread_rx_retval;
|
||||
perror("[SCHED] UE_thread_rxtx : sched_setattr failed\n");
|
||||
return &UE_thread_rxtx_retval;
|
||||
}
|
||||
|
||||
#else
|
||||
@@ -914,15 +731,15 @@ static void *UE_thread_rxn_txnp4(void *arg)
|
||||
pthread_cond_wait(&sync_cond, &sync_mutex);
|
||||
|
||||
pthread_mutex_unlock(&sync_mutex);
|
||||
printf("unlocked sync_mutex, waiting (UE_thread_rx)\n");
|
||||
printf("unlocked sync_mutex, waiting (UE_thread_rxtx)\n");
|
||||
|
||||
printf("Starting UE RXN_TXNP4 thread\n");
|
||||
|
||||
while (!oai_exit) {
|
||||
if (pthread_mutex_lock(&proc->mutex_rxtx) != 0) {
|
||||
LOG_E( PHY, "[SCHED][UE] error locking mutex for UE RX\n" );
|
||||
LOG_E( PHY, "[SCHED][UE] error locking mutex for UE RXTX\n" );
|
||||
exit_fun("nothing to add");
|
||||
return &UE_thread_rx_retval;
|
||||
return &UE_thread_rxtx_retval;
|
||||
}
|
||||
|
||||
while (proc->instance_cnt_rxtx < 0) {
|
||||
@@ -933,7 +750,7 @@ static void *UE_thread_rxn_txnp4(void *arg)
|
||||
if (pthread_mutex_unlock(&proc->mutex_rxtx) != 0) {
|
||||
LOG_E( PHY, "[SCHED][UE] error unlocking mutex for UE RXn_TXnp4\n" );
|
||||
exit_fun("nothing to add");
|
||||
return &UE_thread_rx_retval;
|
||||
return &UE_thread_rxtx_retval;
|
||||
}
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_THREAD_RXTX0+(proc->subframe_rx&1), 1 );
|
||||
@@ -976,23 +793,23 @@ static void *UE_thread_rxn_txnp4(void *arg)
|
||||
|
||||
|
||||
if (pthread_mutex_lock(&proc->mutex_rxtx) != 0) {
|
||||
LOG_E( PHY, "[SCHED][UE] error locking mutex for UE RX\n" );
|
||||
LOG_E( PHY, "[SCHED][UE] error locking mutex for UE RXTX\n" );
|
||||
exit_fun("noting to add");
|
||||
return &UE_thread_rx_retval;
|
||||
return &UE_thread_rxtx_retval;
|
||||
}
|
||||
|
||||
proc->instance_cnt_rxtx--;
|
||||
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE_INST_CNT_RX, proc->instance_cnt_rxtx);
|
||||
|
||||
if (pthread_mutex_unlock(&proc->mutex_rxtx) != 0) {
|
||||
LOG_E( PHY, "[SCHED][UE] error unlocking mutex for UE RX\n" );
|
||||
LOG_E( PHY, "[SCHED][UE] error unlocking mutex for UE RXTX\n" );
|
||||
exit_fun("noting to add");
|
||||
return &UE_thread_rx_retval;
|
||||
return &UE_thread_rxtx_retval;
|
||||
}
|
||||
}
|
||||
|
||||
// thread finished
|
||||
return &UE_thread_rx_retval;
|
||||
return &UE_thread_rxtx_retval;
|
||||
}
|
||||
|
||||
|
||||
@@ -1105,11 +922,11 @@ void *UE_thread(void *arg) {
|
||||
rxp[i] = (void*)&rxdata[i][0];
|
||||
|
||||
if (UE->mode != loop_through_memory) {
|
||||
rxs = openair0.trx_read_func(&openair0,
|
||||
×tamp,
|
||||
rxp,
|
||||
UE->frame_parms.samples_per_tti*10,
|
||||
UE->frame_parms.nb_antennas_rx);
|
||||
rxs = UE->rfdevice.trx_read_func(&UE->rfdevice,
|
||||
×tamp,
|
||||
rxp,
|
||||
UE->frame_parms.samples_per_tti*10,
|
||||
UE->frame_parms.nb_antennas_rx);
|
||||
}
|
||||
instance_cnt_synch = ++UE->proc.instance_cnt_synch;
|
||||
if (instance_cnt_synch == 0) {
|
||||
@@ -1132,11 +949,11 @@ void *UE_thread(void *arg) {
|
||||
rxp[i] = (void*)&dummy_rx[i][0];
|
||||
for (int sf=0;sf<10;sf++) {
|
||||
// printf("Reading dummy sf %d\n",sf);
|
||||
rxs = openair0.trx_read_func(&openair0,
|
||||
×tamp,
|
||||
rxp,
|
||||
UE->frame_parms.samples_per_tti,
|
||||
UE->frame_parms.nb_antennas_rx);
|
||||
rxs = UE->rfdevice.trx_read_func(&UE->rfdevice,
|
||||
×tamp,
|
||||
rxp,
|
||||
UE->frame_parms.samples_per_tti,
|
||||
UE->frame_parms.nb_antennas_rx);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1147,11 +964,11 @@ void *UE_thread(void *arg) {
|
||||
start_rx_stream=1;
|
||||
if (UE->mode != loop_through_memory) {
|
||||
LOG_I(PHY,"Resynchronizing RX by %d samples\n",UE->rx_offset);
|
||||
rxs = openair0.trx_read_func(&openair0,
|
||||
×tamp,
|
||||
(void**)rxdata,
|
||||
UE->rx_offset,
|
||||
UE->frame_parms.nb_antennas_rx);
|
||||
rxs = UE->rfdevice.trx_read_func(&UE->rfdevice,
|
||||
×tamp,
|
||||
(void**)rxdata,
|
||||
UE->rx_offset,
|
||||
UE->frame_parms.nb_antennas_rx);
|
||||
if (rxs != UE->rx_offset) {
|
||||
exit_fun("problem in rx");
|
||||
return &UE_thread_retval;
|
||||
@@ -1161,11 +978,11 @@ void *UE_thread(void *arg) {
|
||||
UE->proc.proc_rxtx[1].frame_rx++;
|
||||
|
||||
// read in first symbol
|
||||
rxs = openair0.trx_read_func(&openair0,
|
||||
×tamp,
|
||||
(void**)rxdata,
|
||||
UE->frame_parms.ofdm_symbol_size+UE->frame_parms.nb_prefix_samples0,
|
||||
UE->frame_parms.nb_antennas_rx);
|
||||
rxs = UE->rfdevice.trx_read_func(&UE->rfdevice,
|
||||
×tamp,
|
||||
(void**)rxdata,
|
||||
UE->frame_parms.ofdm_symbol_size+UE->frame_parms.nb_prefix_samples0,
|
||||
UE->frame_parms.nb_antennas_rx);
|
||||
slot_fep(UE,
|
||||
0,
|
||||
0,
|
||||
@@ -1192,21 +1009,21 @@ void *UE_thread(void *arg) {
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ, 1 );
|
||||
if (UE->mode != loop_through_memory) {
|
||||
if (sf<9) {
|
||||
rxs = openair0.trx_read_func(&openair0,
|
||||
×tamp,
|
||||
rxp,
|
||||
UE->frame_parms.samples_per_tti,
|
||||
UE->frame_parms.nb_antennas_rx);
|
||||
rxs = UE->rfdevice.trx_read_func(&UE->rfdevice,
|
||||
×tamp,
|
||||
rxp,
|
||||
UE->frame_parms.samples_per_tti,
|
||||
UE->frame_parms.nb_antennas_rx);
|
||||
}
|
||||
|
||||
else {
|
||||
rxs = openair0.trx_read_func(&openair0,
|
||||
×tamp,
|
||||
rxp,
|
||||
UE->frame_parms.samples_per_tti-UE->frame_parms.ofdm_symbol_size-UE->frame_parms.nb_prefix_samples0,
|
||||
UE->frame_parms.nb_antennas_rx);
|
||||
rxs = UE->rfdevice.trx_read_func(&UE->rfdevice,
|
||||
×tamp,
|
||||
rxp,
|
||||
UE->frame_parms.samples_per_tti-UE->frame_parms.ofdm_symbol_size-UE->frame_parms.nb_prefix_samples0,
|
||||
UE->frame_parms.nb_antennas_rx);
|
||||
// read in first symbol of next frame and adjust for timing drift
|
||||
rxs = openair0.trx_read_func(&openair0,
|
||||
rxs = UE->rfdevice.trx_read_func(&UE->rfdevice,
|
||||
×tamp1,
|
||||
(void**)rxdata,
|
||||
UE->frame_parms.ofdm_symbol_size+UE->frame_parms.nb_prefix_samples0 - rx_off_diff,
|
||||
@@ -1383,7 +1200,7 @@ void *UE_thread_old(void *arg)
|
||||
|
||||
|
||||
if (UE->mode != loop_through_memory) {
|
||||
rxs = openair0.trx_read_func(&openair0,
|
||||
rxs = UE->rfdevice.trx_read_func(&UE->rfdevice,
|
||||
×tamp,
|
||||
rxp,
|
||||
spp - ((first_rx==1) ? rx_off_diff : 0),
|
||||
@@ -1413,7 +1230,7 @@ void *UE_thread_old(void *arg)
|
||||
for (int i=0; i<UE->frame_parms.nb_antennas_tx; i++)
|
||||
txp[i] = (void*)&txdata[i][txpos];
|
||||
|
||||
openair0.trx_write_func(&openair0,
|
||||
UE->rfdevice.trx_write_func(&openair0,
|
||||
(timestamp+openair0_cfg[0].tx_scheduling_advance-openair0_cfg[0].tx_sample_advance),
|
||||
txp,
|
||||
spp - ((first_rx==1) ? rx_off_diff : 0),
|
||||
@@ -1612,7 +1429,7 @@ void *UE_thread_old(void *arg)
|
||||
#ifndef USRP_DEBUG
|
||||
if (UE->mode != loop_through_memory) {
|
||||
LOG_I(PHY,"Resynchronizing RX by %d samples\n",UE->rx_offset);
|
||||
rxs = openair0.trx_read_func(&openair0,
|
||||
rxs = UE->rfdevice.trx_read_func(&UE->rfdevice,
|
||||
×tamp,
|
||||
(void**)rxdata,
|
||||
UE->rx_offset,
|
||||
@@ -1673,16 +1490,18 @@ void *UE_thread_old(void *arg)
|
||||
* - UE_thread_synch
|
||||
* and the locking between them.
|
||||
*/
|
||||
void init_UE_threads(void)
|
||||
void init_UE_threads(int inst)
|
||||
{
|
||||
PHY_VARS_UE *UE = PHY_vars_UE_g[0][0];
|
||||
|
||||
pthread_attr_init (&attr_UE_thread);
|
||||
pthread_attr_setstacksize(&attr_UE_thread,8192);//5*PTHREAD_STACK_MIN);
|
||||
PHY_VARS_UE *UE;
|
||||
|
||||
UE = PHY_vars_UE_g[inst][0];
|
||||
|
||||
pthread_attr_init (&UE->proc.attr_ue);
|
||||
pthread_attr_setstacksize(&UE->proc.attr_ue,8192);//5*PTHREAD_STACK_MIN);
|
||||
|
||||
#ifndef LOWLATENCY
|
||||
sched_param_UE_thread.sched_priority = sched_get_priority_max(SCHED_FIFO);
|
||||
pthread_attr_setschedparam(&attr_UE_thread,&sched_param_UE_thread);
|
||||
UE->proc.sched_param_ue.sched_priority = sched_get_priority_max(SCHED_FIFO);
|
||||
pthread_attr_setschedparam(&UE->proc.attr_ue,&sched_param_UE_thread);
|
||||
#endif
|
||||
|
||||
// the threads are not yet active, therefore access is allowed without locking
|
||||
|
||||
Reference in New Issue
Block a user