diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index d5c5c10d64efde02ceb35d0c9563deb3a7ec7d2d..d252e17d5249302ad8bcdec73b8186c8c7fd63c8 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -793,7 +793,10 @@ include_directories("${OPENAIR3_DIR}/S1AP") include_directories("${OPENAIR2_DIR}/X2AP") include_directories("${OPENAIR3_DIR}/UDP") include_directories("${OPENAIR3_DIR}/GTPV1-U") +include_directories("${OPENAIR_DIR}/targets/COMMON") include_directories("${OPENAIR_DIR}/targets/ARCH/COMMON") +include_directories("${OPENAIR_DIR}/targets/ARCH/EXMIMO/USERSPACE/LIB/") +include_directories("${OPENAIR_DIR}/targets/ARCH/EXMIMO/DEFS") include_directories("${OPENAIR2_DIR}/ENB_APP") include_directories("${OPENAIR2_DIR}/GNB_APP") include_directories("${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/MAC") @@ -2507,6 +2510,7 @@ target_link_libraries (nr-uesoftmodem-nos1 ${T_LIB}) add_executable(dlsim_tm4 ${OPENAIR1_DIR}/SIMULATION/LTE_PHY/dlsim_tm4.c ${OPENAIR1_DIR}/PHY/TOOLS/lte_phy_scope_tm4.c + ${OPENAIR_DIR}/common/utils/system.c ${T_SOURCE} ) target_link_libraries (dlsim_tm4 @@ -2533,18 +2537,21 @@ target_link_libraries(ldpctest SIMU PHY PHY_NR m ${ATLAS_LIBRARIES}) add_executable(nr_dlschsim ${OPENAIR1_DIR}/SIMULATION/NR_PHY/dlschsim.c ${OPENAIR_DIR}/common/utils/backtrace.c + ${OPENAIR_DIR}/common/utils/system.c ${T_SOURCE}) target_link_libraries(nr_dlschsim -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB CONFIG_LIB -Wl,--end-group m pthread ${ATLAS_LIBRARIES} ${T_LIB} dl) add_executable(nr_pbchsim ${OPENAIR1_DIR}/SIMULATION/NR_PHY/pbchsim.c ${OPENAIR_DIR}/common/utils/backtrace.c + ${OPENAIR_DIR}/common/utils/system.c ${T_SOURCE}) target_link_libraries(nr_pbchsim -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB CONFIG_LIB -Wl,--end-group m pthread ${ATLAS_LIBRARIES} ${T_LIB} dl) add_executable(nr_dlsim ${OPENAIR1_DIR}/SIMULATION/NR_PHY/dlsim.c ${OPENAIR_DIR}/common/utils/backtrace.c + ${OPENAIR_DIR}/common/utils/system.c ${T_SOURCE}) target_link_libraries(nr_dlsim -Wl,--start-group UTIL SIMU PHY_COMMON PHY_NR PHY_NR_UE SCHED_NR_LIB SCHED_NR_UE_LIB MAC_NR MAC_UE_NR MAC_NR_COMMON RRC_LIB NR_RRC_LIB CONFIG_LIB L2_NR -Wl,--end-group m pthread ${ATLAS_LIBRARIES} ${T_LIB} dl) @@ -2560,6 +2567,7 @@ foreach(myExe dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim pdcchsim pucchsim pr add_executable(${myExe} ${OPENAIR1_DIR}/SIMULATION/LTE_PHY/${myExe}.c ${OPENAIR_DIR}/common/utils/backtrace.c + ${OPENAIR_DIR}/common/utils/system.c ${XFORMS_SOURCE} ${T_SOURCE} ${CONFIG_SOURCES} diff --git a/common/utils/system.c b/common/utils/system.c index 0a116661af0c3c1143ded374d3fc82beefa1fcc6..31c1035129998da9a8340b1b80895e0dd4d44120 100644 --- a/common/utils/system.c +++ b/common/utils/system.c @@ -196,48 +196,6 @@ void start_background_system(void) { background_system_process(); } -void thread_top_init(char *thread_name, - int affinity, - uint64_t runtime, - uint64_t deadline, - uint64_t period) { -#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; - attr.sched_policy = SCHED_DEADLINE; - attr.sched_runtime = runtime; - attr.sched_deadline = deadline; - attr.sched_period = period; - - AssertFatal(sched_setattr(0, &attr, flags) == 0, "[SCHED] eNB tx thread: sched_setattr failed\n"); - -#else -#ifdef CPU_AFFINITY - /* Set affinity mask to include CPUs 2 to MAX_CPUS */ - /* CPU 0 is reserved for UHD threads */ /* CPU 1 is reserved for all RX_TX threads */ - /* Enable CPU Affinity only if number of CPUs > 2 */ - cpu_set_t cpuset; - CPU_ZERO(&cpuset); - if (affinity == 0) { - LOG_W(HW,"thread_top_init() called with affinity==0, but overruled by #ifdef CPU_AFFINITY\n"); - } else if (get_nprocs() > 2) { - for (j = 2; j < get_nprocs(); j++) - CPU_SET(j, &cpuset); - AssertFatal( pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset) == 0, "Error setting processor affinity"); - } -#endif //CPU_AFFINITY - - struct sched_param sparam={0}; - sparam.sched_priority = OAI_PRIORITY_RT; - AssertFatal(pthread_setschedparam(pthread_self(),SCHED_FIFO , &sparam) == 0,"Error setting thread priority"); - pthread_setname_np(pthread_self(), thread_name); -#endif - mlockall(MCL_CURRENT | MCL_FUTURE); -} void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name, int affinity, int priority){ pthread_attr_t attr; diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index babf169103e197361e27ef920b4ab6830e4aea29..dae14684c1a13ad601afa55a0d71bb2aff04b7da 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -673,7 +673,7 @@ int main( int argc, char **argv ) { set_taus_seed (0); tpool_t pool; Tpool = &pool; - char params[]="2,3"; + char params[]="-1,-1"; initTpool(params, Tpool, false); cpuf=get_cpu_freq_GHz(); itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c index 56f4d7cb1e33897792592b5d0e1003cb61f9f302..d99abd70a0b3b43b090ca98af524b5a2dce0ccfe 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_dlsch_demodulation.c @@ -36,6 +36,7 @@ //#include "extern.h" #include "PHY/sse_intrin.h" #include "T.h" +#include "openair1/PHY/NR_TRANSPORT/nr_dlsch.h" #ifndef USER_MODE #define NOCYGWIN_STATIC static diff --git a/openair1/PHY/defs_RU.h b/openair1/PHY/defs_RU.h index 73e75bb99274172ce3dbc13d4c3039ea6ddf416c..76769ed4db3866767b88eae7226f99eb94ec3fbb 100644 --- a/openair1/PHY/defs_RU.h +++ b/openair1/PHY/defs_RU.h @@ -191,6 +191,25 @@ 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; diff --git a/openair1/PHY/defs_gNB.h b/openair1/PHY/defs_gNB.h index 8a962bb839f0ac74d4214cfa4079ac7ff4d1dcf3..24be9688dc08039c2df802b1e234b5568288dd29 100644 --- a/openair1/PHY/defs_gNB.h +++ b/openair1/PHY/defs_gNB.h @@ -373,6 +373,8 @@ 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 @@ -428,6 +430,12 @@ 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 diff --git a/targets/ARCH/rfsimulator/simulator.c b/targets/ARCH/rfsimulator/simulator.c index 0edc587263b892b3d6b42b56deb183223a8f5516..679f92a1a0d05f5bcc95b554e78d6f1e5ef09d1e 100644 --- a/targets/ARCH/rfsimulator/simulator.c +++ b/targets/ARCH/rfsimulator/simulator.c @@ -201,6 +201,7 @@ sin_addr: int rfsimulator_write(openair0_device *device, openair0_timestamp timestamp, void **samplesVoid, int nsamps, int nbAnt, int flags) { rfsimulator_state_t *t = device->priv; + LOG_D(HW,"sending %d samples at time: %ld\n", nsamps, timestamp); for (int i=0; i<FD_SETSIZE; i++) { buffer_t *ptr=&t->buf[i]; @@ -231,7 +232,7 @@ static bool flushInput(rfsimulator_state_t *t) { // Process all incoming events on sockets // store the data in lists struct epoll_event events[FD_SETSIZE]= {0}; - int nfds = epoll_wait(t->epollfd, events, FD_SETSIZE, 200); + int nfds = epoll_wait(t->epollfd, events, FD_SETSIZE, 20); if ( nfds==-1 ) { if ( errno==EINTR || errno==EAGAIN ) @@ -310,6 +311,7 @@ static bool flushInput(rfsimulator_state_t *t) { } if ( b->headerMode==false ) { + LOG_D(HW,"Set b->lastReceivedTS %ld\n", b->lastReceivedTS); b->lastReceivedTS=b->th.timestamp+b->th.size-byteToSample(b->remainToTransfer,b->th.nbAnt); if ( b->remainToTransfer==0) { @@ -364,13 +366,14 @@ int rfsimulator_read(openair0_device *device, openair0_timestamp *ptimestamp, vo do { have_to_wait=false; - for ( int sock=0; sock<FD_SETSIZE; sock++) + for ( int sock=0; sock<FD_SETSIZE; sock++) { if ( t->buf[sock].circularBuf && t->buf[sock].alreadyRead && //>= t->initialAhead && (t->nextTimestamp+nsamps) > t->buf[sock].lastReceivedTS ) { have_to_wait=true; break; } + } if (have_to_wait) /*printf("Waiting on socket, current last ts: %ld, expected at least : %ld\n", diff --git a/targets/COMMON/openairinterface5g_limits.h b/targets/COMMON/openairinterface5g_limits.h index 9645acf4ddb4bb30ce2a395df81cc32ea2319b17..9b4ee23dc8bc1e179cfa95616b3703a235d68bec 100644 --- a/targets/COMMON/openairinterface5g_limits.h +++ b/targets/COMMON/openairinterface5g_limits.h @@ -8,10 +8,10 @@ # define NUMBER_OF_NR_RU_MAX 2 # ifndef PHYSIM # ifndef UE_EXPANSION -# define NUMBER_OF_UE_MAX 16 -# define NUMBER_OF_NR_UE_MAX 16 -# define NUMBER_OF_CONNECTED_eNB_MAX 3 -# define NUMBER_OF_CONNECTED_gNB_MAX 3 +# define NUMBER_OF_UE_MAX 4 +# define NUMBER_OF_NR_UE_MAX 4 +# define NUMBER_OF_CONNECTED_eNB_MAX 1 +# define NUMBER_OF_CONNECTED_gNB_MAX 1 # else # define NUMBER_OF_UE_MAX 256 # define NUMBER_OF_NR_UE_MAX 256