Commit 4d787625 authored by Thomas Laurent's avatar Thomas Laurent
Browse files

still to compile

parent 8a921380
......@@ -281,7 +281,7 @@ extern "C" {
int itti_create_task(task_id_t task_id, void *(*start_routine)(void *), void *args_p) {
task_list_t *t=&tasks[task_id];
threadCreate (&t->thread, start_routine, args_p, itti_get_task_name(task_id),-1,OAI_PRIORITY_RT);
threadCreate (&t->thread, start_routine, args_p, (char*)itti_get_task_name(task_id),-1,OAI_PRIORITY_RT);
LOG_I(TMR,"Created Posix thread %s\n", itti_get_task_name(task_id) );
return 0;
}
......
......@@ -239,17 +239,27 @@ void thread_top_init(char *thread_name,
mlockall(MCL_CURRENT | MCL_FUTURE);
}
void threadTopInit(const char* name, const int affinity, const int priority){
struct sched_param sparam={0};
void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name, int affinity, int priority){
pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
pthread_attr_setschedpolicy(&attr, SCHED_FIFO);
struct sched_param sparam={0};
sparam.sched_priority = priority;
AssertFatal(pthread_setschedparam(pthread_self(),SCHED_FIFO , &sparam) == 0,"Error setting thread priority");
pthread_setname_np(pthread_self(), name);
pthread_attr_setschedparam(&attr, &sparam);
pthread_create(t, &attr, func, param);
pthread_setname_np(*t, name);
if (affinity != -1 ) {
cpu_set_t cpuset;
CPU_ZERO(&cpuset);
CPU_SET(affinity, &cpuset);
AssertFatal( pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset) == 0, "Error setting processor affinity");
AssertFatal( pthread_setaffinity_np(*t, sizeof(cpu_set_t), &cpuset) == 0, "Error setting processor affinity");
}
pthread_attr_destroy(&attr);
}
// Block CPU C-states deep sleep
......
......@@ -22,6 +22,7 @@
#ifndef _SYSTEM_H_OAI_
#define _SYSTEM_H_OAI_
#include <stdint.h>
#include <pthread.h>
#ifdef __cplusplus
extern "C" {
#endif
......
......@@ -38,6 +38,8 @@
#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all
#include "assertions.h"
#include <common/utils/LOG/log.h>
#include <common/utils/system.h>
#include "PHY/types.h"
......@@ -676,8 +678,8 @@ static void* gNB_thread_prach( void* param ) {
}
*/
extern void init_td_thread(PHY_VARS_gNB *, pthread_attr_t *);
extern void init_te_thread(PHY_VARS_gNB *, pthread_attr_t *);
extern void init_td_thread(PHY_VARS_gNB *);
extern void init_te_thread(PHY_VARS_gNB *);
void init_gNB_proc(int inst) {
int i=0;
......@@ -685,8 +687,6 @@ void init_gNB_proc(int inst) {
PHY_VARS_gNB *gNB;
gNB_L1_proc_t *proc;
gNB_L1_rxtx_proc_t *L1_proc,*L1_proc_tx;
pthread_attr_t *attr0=NULL,*attr1=NULL;
//*attr_prach=NULL;
LOG_I(PHY,"%s(inst:%d) RC.nb_nr_CC[inst]:%d \n",__FUNCTION__,inst,RC.nb_nr_CC[inst]);
for (CC_id=0; CC_id<RC.nb_nr_CC[inst]; CC_id++) {
......@@ -721,14 +721,6 @@ void init_gNB_proc(int inst) {
pthread_mutex_init( &proc->mutex_RU_PRACH,NULL);
pthread_cond_init( &proc->cond_prach, NULL);
pthread_cond_init( &proc->cond_asynch_rxtx, NULL);
pthread_attr_init( &proc->attr_prach);
pthread_attr_init( &proc->attr_asynch_rxtx);
// pthread_attr_init( &proc->attr_td);
// pthread_attr_init( &proc->attr_te);
pthread_attr_init( &L1_proc->attr);
pthread_attr_init( &L1_proc_tx->attr);
attr0 = &L1_proc->attr;
attr1 = &L1_proc_tx->attr;
LOG_I(PHY,"gNB->single_thread_flag:%d\n", gNB->single_thread_flag);
if (get_thread_parallel_conf() == PARALLEL_RU_L1_SPLIT || get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT) {
......
......@@ -604,7 +604,6 @@ static void *emulatedRF_thread(void *param) {
struct timespec req = {0};
req.tv_sec = 0;
req.tv_nsec = (numerology>0)? ((microsec * 1000L)/numerology):(microsec * 1000L)*2;
threadTopInit("emulatedRF",-1,OAI_PRIORITY_RT_LOW);
wait_sync("emulatedRF_thread");
while(!oai_exit) {
......@@ -1592,17 +1591,12 @@ extern void ru_fep_full_2thread(RU_t *ru);
extern void nr_feptx_ofdm(RU_t *ru);
extern void nr_feptx_ofdm_2thread(RU_t *ru);
extern void feptx_prec(RU_t *ru);
extern void init_fep_thread(RU_t *ru,pthread_attr_t *attr);
extern void init_nr_feptx_thread(RU_t *ru,pthread_attr_t *attr);
extern void init_fep_thread(RU_t *ru);
extern void init_nr_feptx_thread(RU_t *ru);
void init_RU_proc(RU_t *ru) {
int i=0;
RU_proc_t *proc;
pthread_attr_t *attr_FH=NULL, *attr_FH1=NULL,*attr_prach=NULL,*attr_asynch=NULL, *attr_emulateRF=NULL;// *attr_synch=NULL;
//pthread_attr_t *attr_fep=NULL;
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
//pthread_attr_t *attr_prach_br=NULL;
#endif
char name[100];
#ifndef OCP_FRAMEWORK
LOG_I(PHY,"Initializing RU proc %d (%s,%s),\n",ru->idx,NB_functions[ru->function],NB_timing[ru->if_timing]);
......@@ -1639,21 +1633,6 @@ void init_RU_proc(RU_t *ru) {
pthread_cond_init( &proc->cond_asynch_rxtx, NULL);
pthread_cond_init( &proc->cond_synch,NULL);
pthread_cond_init( &proc->cond_gNBs, NULL);
pthread_attr_init( &proc->attr_FH);
pthread_attr_init( &proc->attr_FH1);
pthread_attr_init( &proc->attr_emulateRF);
pthread_attr_init( &proc->attr_prach);
pthread_attr_init( &proc->attr_synch);
pthread_attr_init( &proc->attr_asynch_rxtx);
pthread_attr_init( &proc->attr_fep);
#ifndef DEADLINE_SCHEDULER
attr_FH = &proc->attr_FH;
attr_FH1 = &proc->attr_FH1;
attr_emulateRF = &proc->attr_emulateRF;
attr_prach = &proc->attr_prach;
//attr_synch = &proc->attr_synch;
attr_asynch = &proc->attr_asynch_rxtx;
#endif
threadCreate( &proc->pthread_FH, ru_thread, (void *)ru, "thread_FH", -1, OAI_PRIORITY_RT );
if (get_thread_parallel_conf() == PARALLEL_RU_L1_SPLIT || get_thread_parallel_conf() == PARALLEL_RU_L1_TRX_SPLIT)
......@@ -1679,9 +1658,9 @@ void init_RU_proc(RU_t *ru) {
}
if (get_nprocs()>=2) {
if (ru->feprx) init_fep_thread(ru,NULL);
if (ru->feprx) init_fep_thread(ru);
if (ru->feptx_ofdm) nr_init_feptx_thread(ru,NULL);
if (ru->feptx_ofdm) nr_init_feptx_thread(ru);
}
if (opp_enabled == 1) threadCreate(&ru->ru_stats_thread,ru_stats_thread,(void *)ru, "emulateRF", -1, OAI_PRIORITY_RT_LOW);
......@@ -1769,11 +1748,6 @@ void kill_RU_proc(int inst) {
pthread_cond_destroy(&proc->cond_asynch_rxtx);
pthread_cond_destroy(&proc->cond_synch);
pthread_cond_destroy(&proc->cond_gNBs);
pthread_attr_destroy(&proc->attr_FH);
pthread_attr_destroy(&proc->attr_prach);
pthread_attr_destroy(&proc->attr_synch);
pthread_attr_destroy(&proc->attr_asynch_rxtx);
pthread_attr_destroy(&proc->attr_fep);
}
int check_capabilities(RU_t *ru,RRU_capabilities_t *cap) {
......
......@@ -394,7 +394,6 @@ void reset_stats(FL_OBJECT *button, long arg) {
}
static void *scope_thread(void *arg) {
threadTopInit("scope",-1,OAI_PRIORITY_RT_LOW);
int UE_id, CC_id;
int ue_cnt=0;
# ifdef ENABLE_XFORMS_WRITE_STATS
......@@ -1065,10 +1064,7 @@ int main( int argc, char **argv ) {
} // CC_id
} // UE_id
ret = threadCreate(&forms_thread, scope_thread, NULL, "scope", -1, OAI_PRIORITY_RT_LOW);
if (ret == 0)
pthread_setname_np( forms_thread, "xforms" );
threadCreate(&forms_thread, scope_thread, NULL, "scope", -1, OAI_PRIORITY_RT_LOW);
printf("Scope thread created, ret=%d\n",ret);
}
......
......@@ -240,7 +240,7 @@ extern void set_function_spec_param(RU_t *ru);
extern void reset_opp_meas(void);
extern void print_opp_meas(void);
extern void init_fep_thread(PHY_VARS_gNB *, pthread_attr_t *);
extern void init_fep_thread(PHY_VARS_gNB *);
void init_gNB_afterRU(void);
......
......@@ -538,7 +538,6 @@ int computeSamplesShift(PHY_VARS_NR_UE *UE) {
void *UE_thread(void *arg) {
//this thread should be over the processing thread to keep in real time
threadTopInit("UE_IQ",1,OAI_PRIORITY_RT_MAX);
PHY_VARS_NR_UE *UE = (PHY_VARS_NR_UE *) arg;
// int tx_enabled = 0;
openair0_timestamp timestamp;
......@@ -741,11 +740,6 @@ void init_UE(int nb_inst) {
int inst;
NR_UE_MAC_INST_t *mac_inst;
pthread_t threads[nb_inst];
pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
pthread_attr_setschedpolicy(&attr, SCHED_FIFO);
for (inst=0; inst < nb_inst; inst++) {
PHY_VARS_NR_UE *UE = PHY_vars_UE_g[inst][0];
......
......@@ -191,25 +191,6 @@ typedef struct RU_proc_t_s {
int first_rx;
/// flag to indicate first TX transmission
int first_tx;
/// pthread attributes for RU FH processing thread
pthread_attr_t attr_FH;
pthread_attr_t attr_FH1;
/// pthread attributes for RU prach
pthread_attr_t attr_prach;
#if (RRC_VERSION >= MAKE_VERSION(14, 0, 0))
/// pthread attributes for RU prach BL/CE UEs
pthread_attr_t attr_prach_br;
#endif
/// pthread attributes for RU synch thread
pthread_attr_t attr_synch;
/// pthread attributes for asynchronous RX thread
pthread_attr_t attr_asynch_rxtx;
/// pthread attributes for worker fep thread
pthread_attr_t attr_fep;
/// pthread attributes for worker feptx thread
pthread_attr_t attr_feptx;
/// pthread attributes for emulated RF
pthread_attr_t attr_emulateRF;
/// scheduling parameters for RU FH thread
struct sched_param sched_param_FH;
struct sched_param sched_param_FH1;
......
......@@ -373,8 +373,6 @@ typedef struct {
int instance_cnt;
/// pthread structure for RXn-TXnp4 processing thread
pthread_t pthread;
/// pthread attributes for RXn-TXnp4 processing thread
pthread_attr_t attr;
/// condition variable for tx processing thread
pthread_cond_t cond;
/// mutex for RXn-TXnp4 processing thread
......@@ -430,12 +428,6 @@ typedef struct gNB_L1_proc_t_s {
int first_rx;
/// flag to indicate first TX transmission
int first_tx;
/// pthread attributes for single gNB processing thread
pthread_attr_t attr_single;
/// pthread attributes for prach processing thread
pthread_attr_t attr_prach;
/// pthread attributes for asynchronous RX thread
pthread_attr_t attr_asynch_rxtx;
/// scheduling parameters for parallel turbo-decoder thread
struct sched_param sched_param_td;
/// scheduling parameters for parallel turbo-encoder thread
......
......@@ -32,8 +32,6 @@ typedef struct {
//pthread_t pthread_slot0_dl_processing;
pthread_t pthread_slot1_dl_processing;
/// pthread attributes for fep_slot1 processing thread
// pthread_attr_t attr_slot0_dl_processing;
pthread_attr_t attr_slot1_dl_processing;
/// condition variable for UE fep_slot1 thread;
//pthread_cond_t cond_slot0_dl_processing;
pthread_cond_t cond_slot1_dl_processing;
......@@ -46,8 +44,6 @@ typedef struct {
//pthread_t pthread_slot0_dl_processing;
pthread_t pthread_dlsch_td;
/// pthread attributes for fep_slot1 processing thread
// pthread_attr_t attr_slot0_dl_processing;
pthread_attr_t attr_dlsch_td;
/// condition variable for UE fep_slot1 thread;
//pthread_cond_t cond_slot0_dl_processing;
pthread_cond_t cond_dlsch_td;
......
......@@ -38,6 +38,7 @@
#include "nfapi_interface.h"
#include "fapi_l1.h"
#include "common/utils/LOG/log.h"
#include <common/utils/system.h>
#include "common/utils/LOG/vcd_signal_dumper.h"
#include "assertions.h"
......@@ -1473,11 +1474,7 @@ void init_td_thread(PHY_VARS_eNB *eNB) {
proc->tdp.eNB = eNB;
proc->instance_cnt_td = -1;
pthread_attr_init( &proc->attr_td);
pthread_mutex_init( &proc->mutex_td, NULL);
pthread_cond_init( &proc->cond_td, NULL);
pthread_create(&proc->pthread_td, &proc->attr_td, td_thread, (void*)&proc->tdp);
threadCreate(&proc->pthread_td, td_thread, (void*)&proc->tdp, "TD", -1, OAI_PRIORITY_RT);
}
void kill_td_thread(PHY_VARS_eNB *eNB) {
......@@ -1501,12 +1498,10 @@ void init_te_thread(PHY_VARS_eNB *eNB) {
proc->tep[i].eNB = eNB;
proc->tep[i].instance_cnt_te = -1;
pthread_mutex_init( &proc->tep[i].mutex_te, NULL);
pthread_cond_init( &proc->tep[i].cond_te, NULL);
pthread_attr_init( &proc->tep[i].attr_te);
LOG_I(PHY,"Creating te_thread %d\n",i);
pthread_create(&proc->tep[i].pthread_te, &proc->tep[i].attr_te, te_thread, (void*)&proc->tep[i]);
char txt[128];
sprintf(txt,"TE_%d", i);
threadCreate(&proc->tep[i].pthread_te, te_thread, (void*)&proc->tep[i], txt, -1, OAI_PRIORITY_RT);
}
}
void kill_te_thread(PHY_VARS_eNB *eNB) {
......
......@@ -41,6 +41,7 @@
#include "LAYER2/MAC/mac_extern.h"
#include "LAYER2/MAC/mac.h"
#include "common/utils/LOG/log.h"
#include "common/utils/system.h"
#include "common/utils/LOG/vcd_signal_dumper.h"
#include "T.h"
......@@ -196,7 +197,7 @@ static void *nr_feptx_thread(void *param) {
return(NULL);
}
void nr_init_feptx_thread(RU_t *ru,pthread_attr_t *attr_feptx) {
void nr_init_feptx_thread(RU_t *ru) {
RU_proc_t *proc = &ru->proc;
......
......@@ -38,7 +38,7 @@ nr_slot_t nr_slot_select (nfapi_nr_config_request_t *cfg, unsigned char slot);
void nr_set_ssb_first_subcarrier(nfapi_nr_config_request_t *cfg, NR_DL_FRAME_PARMS *fp);
void phy_procedures_gNB_TX(PHY_VARS_gNB *gNB, gNB_L1_rxtx_proc_t *proc, int do_meas);
void nr_common_signal_procedures (PHY_VARS_gNB *gNB,int frame, int slot);
void nr_init_feptx_thread(RU_t *ru,pthread_attr_t *attr_feptx);
void nr_init_feptx_thread(RU_t *ru);
void nr_feptx_ofdm(RU_t *ru);
void nr_feptx_ofdm_2thread(RU_t *ru);
void nr_feptx0(RU_t *ru,int first_symbol, int num_symbols);
......
......@@ -102,7 +102,6 @@ void *flexran_agent_task(void *args){
}
void *receive_thread(void *args) {
threadTopInit("flexran",-1,OAI_PRIORITY_RT_LOW);
flexran_agent_info_t *d = args;
void *data;
......
......@@ -53,7 +53,6 @@
extern pthread_t pdcp_thread;
extern pthread_attr_t pdcp_thread_attr;
extern pthread_mutex_t pdcp_mutex;
extern pthread_cond_t pdcp_cond;
extern int pdcp_instance_cnt;
......
......@@ -97,8 +97,6 @@ pdcp_netlink_init(
int i;
int nb_inst_enb;
int nb_inst_ue;
pthread_attr_t attr;
struct sched_param sched_param;
reset_meas(&ip_pdcp_stats_tmp);
nb_inst_enb = 1;
......@@ -141,28 +139,12 @@ pdcp_netlink_init(
}
if ((nb_inst_ue + nb_inst_enb) > 0) {
if (pthread_attr_init(&attr) != 0) {
LOG_E(PDCP, "[NETLINK]Failed to initialize pthread attribute for Netlink -> PDCP communication (%d:%s)\n",
errno, strerror(errno));
exit(EXIT_FAILURE);
}
sched_param.sched_priority = 10;
pthread_attr_setschedpolicy(&attr, SCHED_RR);
pthread_attr_setschedparam(&attr, &sched_param);
/* Create one thread that fetchs packets from the netlink.
* When the netlink fifo is full, packets are silently dropped, this behaviour
* should be avoided if we want a reliable link.
*/
if (pthread_create(&pdcp_netlink_thread, &attr, pdcp_netlink_thread_fct, NULL) != 0) {
LOG_E(PDCP, "[NETLINK]Failed to create new thread for Netlink/PDCP communication (%d:%s)\n",
errno, strerror(errno));
exit(EXIT_FAILURE);
}
pthread_setname_np( pdcp_netlink_thread, "PDCP netlink" );
threadCreate(&pdcp_netlink_thread, pdcp_netlink_thread_fct, "PDCP netlink", -1, OAI_PRIORITY_RT_LOW );
}
return 0;
......
......@@ -45,7 +45,6 @@ extern int oai_exit;
extern char UE_flag;
pthread_t pdcp_thread;
pthread_attr_t pdcp_thread_attr;
pthread_mutex_t pdcp_mutex;
pthread_cond_t pdcp_cond;
int pdcp_instance_cnt;
......
......@@ -5477,7 +5477,6 @@ rrc_ue_process_sidelink_radioResourceConfig(
void rrc_control_socket_init(){
struct sockaddr_in rrc_ctrl_socket_addr;
pthread_attr_t attr;
int optval; // flag value for setsockopt
//int n; // message byte size
......@@ -5506,7 +5505,6 @@ void rrc_control_socket_init(){
exit(1);
}
threadTopInit("RRC Control Socket",-1,OAI_PRIORITY_RT);
pthread_t rrc_control_socket_thread;
threadCreate(&rrc_control_socket_thread, rrc_control_socket_thread_fct, NULL, "RRC/ProSeApp", -1, OAI_PRIORITY_RT);
......
......@@ -30,6 +30,7 @@
#include "link_manager.h"
#include "common/utils/LOG/log.h"
#include <common/utils/assertions.h>
#include <common/utils/system.h>
#include <stdio.h>
......@@ -104,9 +105,7 @@ link_manager_t *create_link_manager(
LOG_D(MAC, "create new link manager\n");
ret = calloc(1, sizeof(link_manager_t));
if (ret == NULL)
goto error;
AssertFatal( (ret=calloc(1, sizeof(link_manager_t))) != NULL,"");
ret->send_queue = send_queue;
ret->receive_queue = receive_queue;
......
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