Commit 978b4a17 authored by luis_pereira87's avatar luis_pereira87

Merge remote-tracking branch 'origin/develop' into bler_txoptim

# Conflicts:
#	openair1/PHY/LTE_UE_TRANSPORT/pcfich_ue.c
parents f3399d5d c555d396
......@@ -342,6 +342,8 @@ class Containerize():
if self.ranAllowMerge and forceBaseImageBuild:
mySSH.command(self.cli + ' image rm ' + baseImage + ':' + baseTag + ' || true', '\$', 30)
mySSH.command(self.cli + ' image rm ran-build:' + imageTag + ' || true','\$', 5)
# Cleaning any created tmp volume
mySSH.command(self.cli + ' volume prune --force || true','\$', 15)
mySSH.close()
ZipFile('build_log_' + self.testCase_id + '.zip').extractall('.')
......@@ -595,6 +597,8 @@ class Containerize():
mySSH.command('docker rm -f ' + containerName, '\$', 30)
# Forcing the down now to remove the networks and any artifacts
mySSH.command('docker-compose --file ci-docker-compose.yml down', '\$', 5)
# Cleaning any created tmp volume
mySSH.command('docker volume prune --force || true', '\$', 20)
mySSH.close()
......@@ -754,6 +758,11 @@ class Containerize():
logging.error('\u001B[1m Undeploying OAI Object(s) FAILED\u001B[0m')
return
# Cleaning any created tmp volume
cmd = 'docker volume prune --force || true'
logging.debug(cmd)
deployStatus = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT, universal_newlines=True, timeout=100)
HTML.CreateHtmlTestRow('n/a', 'OK', CONST.ALL_PROCESSES_OK)
logging.info('\u001B[1m Undeploying OAI Object(s) PASS\u001B[0m')
......
......@@ -346,7 +346,7 @@ class RANManagement():
#reboot USRP if requested in xml
if self.USRPIPAddress!='':
logging.debug('USRP '+ self.USRPIPAddress +'reboot request')
logging.debug('USRP '+ self.USRPIPAddress +': reboot request')
mySSH.open(lIpAddr, lUserName, lPassWord)
cmd2usrp='ssh root@'+self.USRPIPAddress+' reboot'
mySSH.command2(cmd2usrp,1)
......
......@@ -37,8 +37,8 @@
000001
050000
050001
070000
070001
070000
050000
050001
010002
......@@ -123,15 +123,15 @@
<iperf_args>-u -b 40M -t 60</iperf_args>
<direction>DL</direction>
<id>idefix</id>
<iperf_packetloss_threshold>3</iperf_packetloss_threshold>
<iperf_bitrate_threshold>95</iperf_bitrate_threshold>
<iperf_packetloss_threshold>20</iperf_packetloss_threshold>
<iperf_bitrate_threshold>85</iperf_bitrate_threshold>
<iperf_profile>single-ue</iperf_profile>
</testCase>
<testCase id="070001">
<class>Iperf</class>
<desc>iperf (UL/2Mbps/UDP)(60 sec)(single-ue profile)</desc>
<iperf_args>-u -b 2M -t 60</iperf_args>
<desc>iperf (UL/3Mbps/UDP)(60 sec)(single-ue profile)</desc>
<iperf_args>-u -b 3M -t 60</iperf_args>
<direction>UL</direction>
<id>idefix</id>
<iperf_packetloss_threshold>1</iperf_packetloss_threshold>
......
......@@ -34,9 +34,8 @@
050000
050001
000001
070000
000001
070001
070003
070002
000001
050000
050001
......@@ -113,17 +112,39 @@
</testCase>
<testCase id="070000">
<class>Iperf</class>
<desc>iperf (DL/30Mbps/UDP)(30 sec)(single-ue profile)</desc>
<iperf_args>-u -b 30M -t 30</iperf_args>
<direction>DL</direction>
<id>idefix</id>
<iperf_packetloss_threshold>5</iperf_packetloss_threshold>
<iperf_bitrate_threshold>95</iperf_bitrate_threshold>
<iperf_profile>single-ue</iperf_profile>
</testCase>
<testCase id="070001">
<class>Iperf</class>
<desc>iperf (DL/40Mbps/UDP)(30 sec)(single-ue profile)</desc>
<iperf_args>-u -b 40M -t 30</iperf_args>
<direction>DL</direction>
<id>idefix</id>
<iperf_packetloss_threshold>5</iperf_packetloss_threshold>
<iperf_bitrate_threshold>95</iperf_bitrate_threshold>
<iperf_profile>single-ue</iperf_profile>
</testCase>
<testCase id="070002">
<class>Iperf</class>
<desc>iperf (DL/60Mbps/UDP)(60 sec)(single-ue profile)</desc>
<iperf_args>-u -b 60M -t 60</iperf_args>
<direction>DL</direction>
<id>idefix</id>
<iperf_packetloss_threshold>3</iperf_packetloss_threshold>
<iperf_packetloss_threshold>5</iperf_packetloss_threshold>
<iperf_bitrate_threshold>95</iperf_bitrate_threshold>
<iperf_profile>single-ue</iperf_profile>
</testCase>
<testCase id="070001">
<testCase id="070003">
<class>Iperf</class>
<desc>iperf (UL/3Mbps/UDP)(60 sec)(single-ue profile)</desc>
<iperf_args>-u -b 3M -t 60</iperf_args>
......
......@@ -21,21 +21,22 @@
-->
<testCaseList>
<htmlTabRef>gNB-PHY-Test</htmlTabRef>
<htmlTabName>Run-gNB-PHY-Test</htmlTabName>
<htmlTabIcon>tasks</htmlTabIcon>
<htmlTabRef>gNB-PHY-Test</htmlTabRef>
<htmlTabName>Run-gNB-PHY-Test</htmlTabName>
<htmlTabIcon>tasks</htmlTabIcon>
<repeatCount>3</repeatCount>
<TestCaseRequestedList>
090101 000001 090109
</TestCaseRequestedList>
<TestCaseExclusionList></TestCaseExclusionList>
<testCase id="090101">
<class>Initialize_eNB</class>
<desc>Initialize gNB USRP</desc>
<testCase id="090101">
<class>Initialize_eNB</class>
<desc>Initialize gNB USRP</desc>
<Initialize_eNB_args>-O ci-scripts/conf_files/gnb.band78.tm1.106PRB.usrpn300.conf --phy-test -q -U 787200 -T 106 -t 28 -D 130175 -m 28 -M 106 --log_config.global_log_options level,nocolor,time</Initialize_eNB_args>
<air_interface>NR</air_interface>
</testCase>
<USRP_IPAddress>192.168.30.2</USRP_IPAddress>
</testCase>
<testCase id="000001">
<class>IdleSleep</class>
......@@ -44,10 +45,10 @@
</testCase>
<testCase id="090109">
<class>Terminate_eNB</class>
<desc>Terminate gNB</desc>
<testCase id="090109">
<class>Terminate_eNB</class>
<desc>Terminate gNB</desc>
<air_interface>NR</air_interface>
</testCase>
</testCase>
</testCaseList>
......@@ -25,7 +25,7 @@
<htmlTabName>Build</htmlTabName>
<htmlTabIcon>wrench</htmlTabIcon>
<TestCaseRequestedList>
010101
000001
</TestCaseRequestedList>
<TestCaseExclusionList>
</TestCaseExclusionList>
......@@ -38,4 +38,10 @@
<eNB_serverId>0</eNB_serverId>
</testCase>
<testCase id="000001">
<class>IdleSleep</class>
<desc>Sleep</desc>
<idle_sleep_time_in_sec>5</idle_sleep_time_in_sec>
</testCase>
</testCaseList>
......@@ -1541,6 +1541,10 @@ set(PHY_LDPC_CL_SRC
${OPENAIR1_DIR}/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_CL.c
${OPENAIR1_DIR}/PHY/CODING/nrLDPC_encoder/ldpc_encoder_optim8segmulti.c
)
add_custom_target( nrLDPC_decoder_kernels_CL
COMMAND gcc ${OPENAIR1_DIR}/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_CL.c -dD -DNRLDPC_KERNEL_SOURCE -E -o ${CMAKE_CURRENT_BINARY_DIR}/nrLDPC_decoder_kernels_CL.clc
SOURCES ${OPENAIR1_DIR}/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_CL.c
)
set(PHY_NR_CODINGIF
${OPENAIR1_DIR}/PHY/CODING/nrLDPC_load.c;
......@@ -1551,6 +1555,7 @@ add_library(ldpc_optim MODULE ${PHY_LDPC_OPTIM_SRC} )
add_library(ldpc_optim8seg MODULE ${PHY_LDPC_OPTIM8SEG_SRC} )
add_library(ldpc_cl MODULE ${PHY_LDPC_CL_SRC} )
target_link_libraries(ldpc_cl OpenCL)
add_dependencies(ldpc_cl nrLDPC_decoder_kernels_CL)
if (CUDA_FOUND)
cuda_add_library(ldpc_cuda MODULE ${PHY_LDPC_CUDA_SRC} )
......@@ -2767,7 +2772,6 @@ target_link_libraries (test5Gnas LIB_5GNAS_GNB CONFIG_LIB minimal_lib )
###################################################
add_executable(lte-softmodem
${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
${OPENAIR_TARGETS}/RT/USER/lte-enb.c
${OPENAIR_TARGETS}/RT/USER/lte-ru.c
${OPENAIR_TARGETS}/RT/USER/ru_control.c
......@@ -2882,7 +2886,6 @@ target_link_libraries(du_test
add_executable(oairu
${OPENAIR_TARGETS}/RT/USER/lte-ru.c
${OPENAIR_TARGETS}/RT/USER/ru_control.c
${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
${OPENAIR_TARGETS}/ARCH/COMMON/record_player.c
${OPENAIR_DIR}/executables/softmodem-common.c
......@@ -2910,7 +2913,6 @@ target_link_libraries (oairu pthread m ${CONFIG_LIB} rt ${CMAKE_DL_LIBS} ${T_LIB
#######################################
add_executable(lte-uesoftmodem
${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
${OPENAIR_TARGETS}/RT/USER/lte-ue.c
${OPENAIR_TARGETS}/RT/USER/lte-uesoftmodem.c
${OPENAIR_DIR}/executables/softmodem-common.c
......
......@@ -707,7 +707,7 @@ function main() {
# generate USIM data
if [ -f $dbin/conf2uedata ]; then
install_nas_tools $conf_nvram_path $gen_nvram_path
install_nas_tools $conf_nvram_path $gen_nvram_path "$dlog/conf2uedata.txt"
echo_info "Copying UE specific part to $DIR/$build_dir/build"
cp -Rvf $dbin/.ue_emm.nvram0 $DIR/$build_dir/build
cp -Rvf $dbin/.ue.nvram0 $DIR/$build_dir/build
......
......@@ -452,17 +452,6 @@ install_asn1c_from_source(){
) > "$asn1_install_log" 2>&1
}
#################################################
# 2. compile
################################################
install_nas_tools() {
echo_success "generate .ue_emm.nvram .ue.nvram"
./nvram --gen -c "$1" -o "$2"
./usim --gen -c "$1" -o "$2"
}
################################
# set_openair_env
###############################
......
......@@ -15,6 +15,7 @@ set(CMAKE_C_FLAGS
set(OPENAIR_DIR $ENV{OPENAIR_DIR})
set(OPENAIR3_DIR $ENV{OPENAIR_DIR}/openair3)
include_directories (${OPENAIR_DIR}/openair2/COMMON)
include_directories (${OPENAIR_DIR})
set(CONF2UEDATA_LIB_SRC
${OPENAIR_DIR}/openair3/NAS/TOOLS/conf_emm.c
......
......@@ -892,20 +892,10 @@ install_asn1c_from_source(){
################################################
install_nas_tools() {
if [ ! -f .ue.nvram0 ]; then
echo_success "generate .ue_emm.nvram .ue.nvram"
./nvram --gen -c $1 -o $2
else
[ ./nvram -nt .ue.nvram0 -o ./nvram -nt .ue_emm.nvram0 ] && ./nvram --gen -c $1 -o $2
fi
if [ ! -f .usim.nvram0 ]; then
echo_success "generate .usim.nvram"
./usim --gen -c $1 -o $2
else
[ ./usim -nt .usim.nvram0 ] && ./usim --gen -c $1 -o $2
fi
echo_success "generate .ue_emm.nvram .ue.nvram"
./nvram --gen -c $1 -o $2 > "$3"
echo_success "generate .usim.nvram"
./usim --gen -c $1 -o $2 >> "$3"
}
......
......@@ -224,11 +224,9 @@ configmodule_interface_t *load_configmodule(int argc,
cfgparam = getenv("OAI_CONFIGMODULE");
}
/* default different for UE and softmodem because UE doesn't use config file*/
/* default different for UE and softmodem because UE may run without config file */
/* and -O option is not mandatory for UE */
/* phy simulators behave as UE */
/* test of exec name would better be replaced by a parameter to the l */
/* oad_configmodule function */
if (cfgparam == NULL) {
tmpflags = tmpflags | CONFIG_NOOOPT;
......@@ -254,9 +252,14 @@ configmodule_interface_t *load_configmodule(int argc,
}
cfgptr = calloc(sizeof(configmodule_interface_t),1);
/* argv_info is used to memorize command line options which have been recognized */
/* and to detect unrecognized command line options which might have been specified */
cfgptr->argv_info = calloc(sizeof(int32_t), argc);
/* argv[0] is the exec name, always Ok */
cfgptr->argv_info[0] |= CONFIG_CMDLINEOPT_PROCESSED;
/* when OoptIdx is >0, -O option has been detected at position OoptIdx
* we must memorize arv[OoptIdx is Ok */
if (OoptIdx >= 0) {
cfgptr->argv_info[OoptIdx] |= CONFIG_CMDLINEOPT_PROCESSED;
cfgptr->argv_info[OoptIdx+1] |= CONFIG_CMDLINEOPT_PROCESSED;
......
......@@ -8,7 +8,7 @@ By default, this facility is included at build-time and activated at run-time. T
```bash
/build_oai --disable-T-Tracer
```
- To use the the T-Tracer instead of the console logging facility, use the command line option *T_stdout*. *T_stdout* is a boolean option, which, when set to 0 (false) disable the console logging facility. All stdout messages are then sent to the T-Tracer.
- To use the the T-Tracer, use the command line option *T_stdout*. When set to 0, it disables the console logging facility. All stdout messages are then sent to the T-Tracer. When set to 1 (the default), the logs are output to the linux console and no T trace is generated. When set to 2 both console logging and T traces are activated.
## Documentation
......
......@@ -428,12 +428,12 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
# if T_TRACER
/* per component, level dependent macros */
# define LOG_E(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_ERR ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_ERR, x) ;} else { T(T_LEGACY_ ## c ## _ERROR, T_PRINTF(x)) ;}} while (0)
# define LOG_W(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_WARNING) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_WARNING, x) ;} else { T(T_LEGACY_ ## c ## _WARNING, T_PRINTF(x)) ;}} while (0)
# define LOG_E(c, x...) do { T(T_LEGACY_ ## c ## _ERROR, T_PRINTF(x)) ; if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_ERR ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_ERR, x) ;} } while (0)
# define LOG_W(c, x...) do { T(T_LEGACY_ ## c ## _WARNING, T_PRINTF(x)); if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_WARNING) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_WARNING, x);} } while (0)
# define LOG_A LOG_I
# define LOG_I(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_INFO ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ;} else { T(T_LEGACY_ ## c ## _INFO, T_PRINTF(x)) ;}} while (0)
# define LOG_D(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_DEBUG ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_DEBUG, x) ;} else { T(T_LEGACY_ ## c ## _DEBUG, T_PRINTF(x)) ;}} while (0)
# define LOG_T(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_TRACE ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_TRACE, x) ;} else { T(T_LEGACY_ ## c ## _TRACE, T_PRINTF(x)) ;}} while (0)
# define LOG_I(c, x...) do { T(T_LEGACY_ ## c ## _INFO, T_PRINTF(x)) ; if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_INFO ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ;} } while (0)
# define LOG_D(c, x...) do { T(T_LEGACY_ ## c ## _DEBUG, T_PRINTF(x)) ; if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_DEBUG ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_DEBUG, x) ;} } while (0)
# define LOG_T(c, x...) do { T(T_LEGACY_ ## c ## _TRACE, T_PRINTF(x)) ; if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_TRACE ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_TRACE, x) ;} } while (0)
# define VLOG(c,l, f, args) do { if (T_stdout) { if( g_log->log_component[c].level >= l ) vlogRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, l, f, args) ;} } while (0)
/* macro used to dump a buffer or a message as in openair2/RRC/LTE/RRC_eNB.c, replaces LOG_F macro */
# define LOG_DUMPMSG(c, f, b, s, x...) do { if(g_log->dump_mask & f) log_dump(c, b, s, LOG_DUMP_CHAR, x) ;} while (0) /* */
......
......@@ -217,6 +217,11 @@ void T_Config_Init(void) {
sizeof(ttraceparams) / sizeof(paramdef_t),
NULL);
if (T_stdout == 0)
if (T_stdout < 0 || T_stdout > 2) {
printf("fatal error: T_stdout = %d but only values 0, 1, or 2 are allowed\n", T_stdout);
exit(1);
}
if (T_stdout == 0 || T_stdout == 2)
T_init(T_port, 1-T_nowait, T_dont_fork);
}
......@@ -100,7 +100,7 @@ extern int T_stdout;
20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)(__VA_ARGS__)
#define TN_N(n0,n1,n2,n3,n4,n5,n6,n7,n8,n9,n10,n11,n12,n13,n14,n15,n16,n17,\
n18,n19,n20,n21,n22,n23,n24,n25,n26,n27,n28,n29,n30,n31,n32,n,...) T##n
#define T(...) do { if (T_stdout == 0) TN(__VA_ARGS__); } while (0)
#define T(...) do { if (T_stdout == 0 || T_stdout == 2) TN(__VA_ARGS__); } while (0)
/* type used to send arbitrary buffer data */
typedef struct {
......@@ -607,7 +607,7 @@ extern int *T_active;
{"T_port", CONFIG_HLP_TPORT, 0, iptr:&T_port, defintval:TTRACER_DEFAULT_PORTNUM, TYPE_INT, 0},\
{"T_nowait", CONFIG_HLP_NOTWAIT, PARAMFLAG_BOOL, iptr:&T_nowait, defintval:0, TYPE_INT, 0},\
{"T_dont_fork", CONFIG_HLP_TNOFORK, PARAMFLAG_BOOL, iptr:&T_dont_fork, defintval:0, TYPE_INT, 0},\
{"T_stdout", CONFIG_HLP_STDOUT, PARAMFLAG_BOOL, iptr:&T_stdout, defintval:1, TYPE_INT, 0},\
{"T_stdout", CONFIG_HLP_STDOUT, 0, iptr:&T_stdout, defintval:1, TYPE_INT, 0},\
}
......
......@@ -211,6 +211,19 @@ void start_background_system(void) {
background_system_process();
}
int rt_sleep_ns (uint64_t x)
{
struct timespec myTime;
clock_gettime(CLOCK_MONOTONIC, &myTime);
myTime.tv_sec += x/1000000000ULL;
myTime.tv_nsec = x%1000000000ULL;
if (myTime.tv_nsec>=1000000000) {
myTime.tv_nsec -= 1000000000;
myTime.tv_sec++;
}
return clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &myTime, NULL);
}
void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name, int affinity, int priority){
pthread_attr_t attr;
......@@ -260,11 +273,128 @@ void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name,
pthread_attr_destroy(&attr);
}
// Legacy, pthread_create + thread_top_init() should be replaced by threadCreate
// threadCreate encapsulates the posix pthread api
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;
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);
}
#else //LOW_LATENCY
int policy, s, j;
struct sched_param sparam;
char cpu_affinity[1024];
cpu_set_t cpuset;
int settingPriority = 1;
/* 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_ZERO(&cpuset);
#ifdef CPU_AFFINITY
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);
s = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset);
if (s != 0)
{
perror( "pthread_setaffinity_np");
exit_fun("Error setting processor affinity");
}
}
#else //CPU_AFFINITY
if (affinity) {
LOG_W(HW,"thread_top_init() called with affinity>0, but overruled by #ifndef CPU_AFFINITY.\n");
}
#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 < 1024; j++)
{
if (CPU_ISSET(j, &cpuset))
{
char temp[1024];
sprintf (temp, " CPU_%d", j);
strcat(cpu_affinity, temp);
}
}
if (checkIfFedoraDistribution())
if (checkIfGenericKernelOnFedora())
if (checkIfInsideContainer())
settingPriority = 0;
if (settingPriority) {
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");
}
s = pthread_getschedparam(pthread_self(), &policy, &sparam);
if (s != 0) {
perror("pthread_getschedparam : ");
exit_fun("Error getting thread priority");
}
pthread_setname_np(pthread_self(), thread_name);
LOG_I(HW, "[SCHED][eNB] %s started on CPU %d, sched_policy = %s , priority = %d, CPU Affinity=%s \n",thread_name,sched_getcpu(),
(policy == SCHED_FIFO) ? "SCHED_FIFO" :
(policy == SCHED_RR) ? "SCHED_RR" :
(policy == SCHED_OTHER) ? "SCHED_OTHER" :
"???",
sparam.sched_priority, cpu_affinity );
}
#endif //LOW_LATENCY
}
// Block CPU C-states deep sleep
void configure_linux(void) {
void set_latency_target(void) {
int ret;
static int latency_target_fd=-1;
uint32_t latency_target_value=10; // in microseconds
uint32_t latency_target_value=2; // in microseconds
if (latency_target_fd == -1) {
if ( (latency_target_fd = open("/dev/cpu_dma_latency", O_RDWR)) != -1 ) {
ret = write(latency_target_fd, &latency_target_value, sizeof(latency_target_value));
......
......@@ -43,10 +43,9 @@ int background_system(char *command);
void start_background_system(void);
void set_latency_target(void);
void configure_linux(void);
void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name, int affinity, int priority);
void threadCreate(pthread_t *t, void *(*func)(void *), void *param, char *name, int affinity, int priority);
#define SCHED_OAI SCHED_RR
#define OAI_PRIORITY_RT_LOW sched_get_priority_min(SCHED_OAI)
#define OAI_PRIORITY_RT ((sched_get_priority_min(SCHED_OAI)+sched_get_priority_max(SCHED_OAI))/2)
......@@ -65,7 +64,7 @@ void thread_top_init(char *thread_name,
int checkIfFedoraDistribution(void);
int checkIfGenericKernelOnFedora(void);
int checkIfInsideContainer(void);
int rt_sleep_ns (uint64_t x);
#ifdef __cplusplus
}
#endif
......
......@@ -7,23 +7,7 @@
#include <errno.h>
#include "utils.h"
void *calloc_or_fail(size_t size) {
void *ptr = calloc(1, size);
if (ptr == NULL) {
fprintf(stderr, "[UE] Failed to calloc %zu bytes", size);
exit(EXIT_FAILURE);
}
return ptr;
}
void *malloc_or_fail(size_t size) {
void *ptr = malloc(size);
if (ptr == NULL) {
fprintf(stderr, "[UE] Failed to malloc %zu bytes", size);
exit(EXIT_FAILURE);
}
return ptr;
}
const char *hexdump(const void *data, size_t data_len, char *out, size_t out_len)
{
......
#ifndef _UTILS_H
#define _UTILS_H
#include <stdint.h>
#include <sys/types.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
#include <sys/types.h>
#include <common/utils/assertions.h>
#ifdef MALLOC_TRACE
#define malloc myMalloc
#endif
#define sizeofArray(a) (sizeof(a)/sizeof(*(a)))
void *calloc_or_fail(size_t size);
void *malloc_or_fail(size_t size);
#define cmax(a,b) ((a>b) ? (a) : (b))
#define cmax3(a,b,c) ((cmax(a,b)>c) ? (cmax(a,b)) : (c))
#define cmin(a,b) ((a<b) ? (a) : (b))
#ifdef __cplusplus
#ifdef min
#undef min
#undef max
#endif
#else
#define max(a,b) cmax(a,b)
#define min(a,b) cmin(a,b)
#endif
#ifndef malloc16
# ifdef __AVX2__
# define malloc16(x) memalign(32,x+32)
# else
# define malloc16(x) memalign(16,x+16)
# endif
#endif
#define free16(y,x) free(y)
#define bigmalloc malloc
#define bigmalloc16 malloc16
#define openair_free(y,x) free((y))
#define PAGE_SIZE 4096
#define free_and_zero(PtR) do { \
if (PtR) { \
free(PtR); \
PtR = NULL; \
} \
} while (0)
static inline void *malloc16_clear( size_t size ) {
#ifdef __AVX2__
void *ptr = memalign(32, size+32);
#else
void *ptr = memalign(16, size+16);
#endif
DevAssert(ptr);
memset( ptr, 0, size );
return ptr;
}
static inline void *calloc_or_fail(size_t size) {
void *ptr = calloc(1, size);
if (ptr == NULL) {
fprintf(stderr, "[UE] Failed to calloc %zu bytes", size);
exit(EXIT_FAILURE);
}
return ptr;
}
static inline void *malloc_or_fail(size_t size) {
void *ptr = malloc(size);
if (ptr == NULL) {
fprintf(stderr, "[UE] Failed to malloc %zu bytes", size);
exit(EXIT_FAILURE);
}
return ptr;
}
#if !defined (msg)
# define msg(aRGS...) LOG_D(PHY, ##aRGS)
#endif
#ifndef malloc16
# ifdef __AVX2__
# define malloc16(x) memalign(32,x)
# else
# define malloc16(x) memalign(16,x)
# endif
#endif
#define free16(y,x) free(y)
#define bigmalloc malloc
#define bigmalloc16 malloc16
#define openair_free(y,x) free((y))
#define PAGE_SIZE 4096
#define PAGE_MASK 0xfffff000
#define virt_to_phys(x) (x)
const char *hexdump(const void *data, size_t data_len, char *out, size_t out_len);
// Converts an hexadecimal ASCII coded digit into its value. **
......
......@@ -27,6 +27,10 @@
FROM ran-base:latest AS phy-sim-build
RUN rm -Rf /oai-ran
WORKDIR /oai-ran
COPY . .
#run build_oai to build the target image
RUN /bin/sh oaienv && \
cd cmake_targets && \
......
......@@ -1150,7 +1150,7 @@ int main ( int argc, char **argv ) {
#if T_TRACER
T_Config_Init();
#endif
configure_linux();
set_latency_target();
set_softmodem_sighandler();
cpuf=get_cpu_freq_GHz();
set_taus_seed (0);
......
......@@ -77,6 +77,7 @@ static int DEFBFW[] = {0x00007fff};
#include "T.h"
#include "nfapi_interface.h"
#include <nfapi/oai_integration/vendor_ext.h>
extern volatile int oai_exit;
......@@ -1335,24 +1336,22 @@ void *ru_thread( void *param ) {
while (!oai_exit) {
// these are local subframe/frame counters to check that we are in synch with the fronthaul timing.
// They are set on the first rx/tx in the underly FH routines.
slot_start = timespec_add(slot_start,slot_duration);
struct timespec curr_time;
clock_gettime(CLOCK_MONOTONIC, &curr_time);
struct timespec sleep_time;
if((slot_start.tv_sec > curr_time.tv_sec) || (slot_start.tv_sec == curr_time.tv_sec && slot_start.tv_nsec > curr_time.tv_nsec)){
sleep_time = timespec_sub(slot_start,curr_time);
if (NFAPI_MODE==NFAPI_MODE_VNF) {
// We should make a VNF main loop with proper tasks calls in case of VNF
slot_start = timespec_add(slot_start,slot_duration);
struct timespec curr_time;
clock_gettime(CLOCK_MONOTONIC, &curr_time);
usleep(sleep_time.tv_nsec * 1e-3);
}
else{//continue
struct timespec sleep_time;
if((slot_start.tv_sec > curr_time.tv_sec) || (slot_start.tv_sec == curr_time.tv_sec && slot_start.tv_nsec > curr_time.tv_nsec)){
sleep_time = timespec_sub(slot_start,curr_time);
usleep(sleep_time.tv_nsec * 1e-3);
}
}
// clock_gettime(CLOCK_MONOTONIC, &curr_time);
//printf("sfn:%d, slot:%d, start time %d.%d slot start %d.%d \n",frame,slot,curr_time.tv_sec,curr_time.tv_nsec,slot_start.tv_sec,slot_start.tv_nsec);
if (slot==(fp->slots_per_frame-1)) {
slot=0;
frame++;
......
......@@ -656,7 +656,7 @@ int main( int argc, char **argv ) {
memset(&openair0_cfg[0],0,sizeof(openair0_config_t)*MAX_CARDS);
memset(tx_max_power,0,sizeof(int)*MAX_NUM_CCs);
logInit();
configure_linux();
set_latency_target();
printf("Reading in command-line options\n");
get_options ();
......
......@@ -698,6 +698,16 @@ void processSlotRX(void *arg) {
int tx_slot_type = nr_ue_slot_select(cfg, proc->frame_tx, proc->nr_slot_tx);
uint8_t gNB_id = 0;
if (IS_SOFTMODEM_NOS1 || get_softmodem_params()->sa) {
/* send tick to RLC and PDCP every ms */
if (proc->nr_slot_rx % UE->frame_parms.slots_per_subframe == 0) {
void nr_rlc_tick(int frame, int subframe);
void nr_pdcp_tick(int frame, int subframe);
nr_rlc_tick(proc->frame_rx, proc->nr_slot_rx / UE->frame_parms.slots_per_subframe);
nr_pdcp_tick(proc->frame_rx, proc->nr_slot_rx / UE->frame_parms.slots_per_subframe);
}
}
if (rx_slot_type == NR_DOWNLINK_SLOT || rx_slot_type == NR_MIXED_SLOT){
if(UE->if_inst != NULL && UE->if_inst->dl_indication != NULL) {
......@@ -720,14 +730,6 @@ void processSlotRX(void *arg) {
protocol_ctxt_t ctxt;
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, UE->Mod_id, ENB_FLAG_NO, mac->crnti, proc->frame_rx, proc->nr_slot_rx, 0);
pdcp_run(&ctxt);
/* send tick to RLC and PDCP every ms */
if (proc->nr_slot_rx % UE->frame_parms.slots_per_subframe == 0) {
void nr_rlc_tick(int frame, int subframe);
void nr_pdcp_tick(int frame, int subframe);
nr_rlc_tick(proc->frame_rx, proc->nr_slot_rx / UE->frame_parms.slots_per_subframe);
nr_pdcp_tick(proc->frame_rx, proc->nr_slot_rx / UE->frame_parms.slots_per_subframe);
}
}
// calling UL_indication to schedule things other than PUSCH (eg, PUCCH)
rxtxD->ue_sched_mode = NOT_PUSCH;
......
......@@ -84,6 +84,7 @@ unsigned short config_frames[4] = {2,9,11,13};
#include "executables/thread-common.h"
#include "nr_nas_msg_sim.h"
#include <openair1/PHY/MODULATION/nr_modulation.h>
extern const char *duplex_mode[];
THREAD_STRUCT thread_struct;
......@@ -522,7 +523,7 @@ int main( int argc, char **argv ) {
// init UE_PF_PO and mutex lock
pthread_mutex_init(&ue_pf_po_mutex, NULL);
memset (&UE_PF_PO[0][0], 0, sizeof(UE_PF_PO_t)*NUMBER_OF_UE_MAX*MAX_NUM_CCs);
configure_linux();
set_latency_target();
mlockall(MCL_CURRENT | MCL_FUTURE);
if(IS_SOFTMODEM_DOSCOPE) {
......
......@@ -920,7 +920,7 @@ int main( int argc, char **argv ) {
# define PACKAGE_VERSION "UNKNOWN"
#endif
LOG_I(HW, "Version: %s\n", PACKAGE_VERSION);
configure_linux();
set_latency_target();
get_options ();
get_common_options(SOFTMODEM_GNB_BIT );
AssertFatal(!CONFIG_ISFLAGSET(CONFIG_ABORT),"Getting configuration failed\n");
......
......@@ -24,12 +24,33 @@ loading `libldpc_cl.so` instead of `libldpc.so`:
`make ldpc_cl`
`cp ../../../openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_kernels_CL.cl`
This command creates the `libldpc_cl.so` shared library. To perform this build successfully, only the OpenCL header `(/usr/include/CL/opencl.h)` and library `(/usr/lib/x86_64-linux-gnu/libOpenCL.so)`are required, they implement OpenCL API support which is not hardware dependent.
```
Scanning dependencies of target nrLDPC_decoder_kernels_CL
Built target nrLDPC_decoder_kernels_CL
Scanning dependencies of target ldpc_cl
Building C object CMakeFiles/ldpc_cl.dir/usr/local/oai/oai-develop/openairinterface5g/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_CL.c.o
In file included from /usr/include/CL/cl.h:32,
from /usr/include/CL/opencl.h:38,
from /usr/local/oai/oai-develop/openairinterface5g/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_CL.c:49:
/usr/include/CL/cl_version.h:34:9: note: #pragma message: cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 220 (OpenCL 2.2)
#pragma message("cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 220 (OpenCL 2.2)")
^~~~~~~
Building C object CMakeFiles/ldpc_cl.dir/usr/local/oai/oai-develop/openairinterface5g/openair1/PHY/CODING/nrLDPC_encoder/ldpc_encoder_optim8segmulti.c.o
Linking C shared module libldpc_cl.so
Built target ldpc_cl
```
At runtime, to successfully use hardware acceleration via OpenCL, you need to install vendor specific packages which deliver the required drivers and tools to make use of their GPU (Nvidia, Intel...) , fpga (Xilinx, Intel) or CPU (Intel, AMD, ARM...) through OpenCL.
`./nr-softmodem -O libconfig:gnb.band78.sa.fr1.106PRB.usrpb210.conf:dbgl5 --rfsim --rfsimulator.serveraddr server --sa --log_config.gtpu_log_level info --loader.ldpc.shlibversion _cl`
``` [LOADER] library libldpc_cl.so successfully loaded
```
------------------------------------------------
[LOADER] library libldpc_cl.so successfully loaded
[HW] Platform 0, OpenCL profile FULL_PROFILE
[HW] Platform 0, OpenCL version OpenCL 2.1 LINUX
[HW] Device 0 is available
......@@ -62,8 +83,9 @@ loading `libldpc_cl.so` instead of `libldpc.so`:
`./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 --rfsim --sa -O libconfig:/usr/local/oai/conf/nrue_sim.conf:dbgl5 --nokrnmod --loader.ldpc.shlibversion _cl --log_config.hw_log_level info`
```[CONFIG] shlibversion set to _cl from command line
```
............................................................
[CONFIG] shlibversion set to _cl from command line
[CONFIG] loader.ldpc 1 options set from command line
[LOADER] library libldpc_cl.so successfully loaded
[HW] Platform 0, OpenCL profile FULL_PROFILE
......@@ -94,7 +116,6 @@ loading `libldpc_cl.so` instead of `libldpc.so`:
[HW] Device 0, max Work Items size for dimension: 1 512
[HW] Device 0, max Work Items size for dimension: 2 512
------------------------------------------------------------
```
```
A mechanism to select ldpc implementation is also available in the `ldpctest` phy simulator via the `-v`option, which can be used to specify the version of the ldpc shared library to be used.
......@@ -103,7 +124,9 @@ A mechanism to select ldpc implementation is also available in the `ldpctest` ph
Loading libldpc_cuda.so, the cuda implementation of the ldpc decoder:
```$ ./ldpctest -v _cuda
```
$ ./ldpctest -v _cuda
ldpctest -v _cuda
Initializing random number generator, seed 0
block length 8448:
n_trials 1:
......@@ -119,18 +142,16 @@ log init done
[CONFIG] loader.ldpc: 1/2 parameters successfully set
[LOADER] library libldpc_cuda.so successfully loaded
...................................
​```
```
Loading libldpc_cl.so, the opencl implementation of the ldpc decoder:
`make ldpc_cl`
`cp ../../../openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder_kernels_CL.cl`
`./ldpctest -v _cl`
```$ ./ldpctest -v _cl
```
$ ./ldpctest -v _cl
Initializing random number generator, seed 0
block length 8448:
n_trials 1:
......@@ -164,7 +185,6 @@ log init done
[HW] Device 0, max Work Items size for dimension: 1 512
[HW] Device 0, max Work Items size for dimension: 2 512
................................
​```
```
......@@ -174,6 +194,6 @@ Libraries implementing the LDPC algorithms must be named `libldpc<_version>.so`,
`libldpc_cuda.so`has been tested with the `ldpctest` executable, usage from the softmodem's has to be tested.
`libldpc_cl`is under development.
`libldpc_cl.so`is under development.
[oai Wikis home](https://gitlab.eurecom.fr/oai/openairinterface5g/wikis/home)
......@@ -514,7 +514,7 @@ int main(int argc, char *argv[])
unsigned char qbits=8;
unsigned int decoded_errors[10000]; // initiate the size of matrix equivalent to size of SNR
int c,i=0, i1 = 0;
int loglvl=OAILOG_WARNING;
int n_trials = 1;
double SNR_step = 0.1;
......@@ -525,8 +525,11 @@ int main(int argc, char *argv[])
n_iter_stats_t dec_iter[3];
short BG=0,Zc,Kb=0;
while ((c = getopt (argc, argv, "q:r:s:S:l:G:n:d:i:t:u:hv:")) != -1)
if ( load_configmodule(argc,argv,CONFIG_ENABLECMDLINEONLY) == 0) {
exit_fun(" Error, configuration module init failed\n");
} // must be done before specific options parsing to prevent errasing them
while ((c = getopt (argc, argv, "q:r:s:S:l:L:G:n:d:i:t:u:hv:")) != -1)
switch (c)
{
case 'q':
......@@ -544,6 +547,10 @@ int main(int argc, char *argv[])
case 'l':
block_length = atoi(optarg);
break;
case 'L':
loglvl = atoi(optarg);
break;
case 'G':
ldpc_version="_cuda";
......@@ -581,10 +588,11 @@ int main(int argc, char *argv[])
printf("BG1 (blocklength > 3840): 1/3, 2/3, 22/25 (8/9) \n");
printf("BG2 (blocklength <= 3840): 1/5, 1/3, 2/3 \n\n");
printf("-h This message\n");
printf("-L <log level, 0(errors), 1(warning), 2(info) 3(debug) 4 (trace)>\n");
printf("-q Quantization bits, Default: 8\n");
printf("-r Nominator rate, (1, 2, 22), Default: 1\n");
printf("-d Denominator rate, (3, 5, 25), Default: 1\n");
printf("-l Block length (l > 3840 -> BG1, rest BG2 ), Default: 8448\n");
printf("-l Block length (l > 3840 -> BG1, rest BG2 ), Default: 8448\n");
printf("-G give 1 to run cuda for LDPC, Default: 0\n");
printf("-n Number of simulation trials, Default: 1\n");
//printf("-M MCS2 for TB 2\n");
......@@ -603,6 +611,8 @@ int main(int argc, char *argv[])
printf("n_trials %d: \n", n_trials);
printf("SNR0 %f: \n", SNR0);
logInit();
set_glog(loglvl);
if (ldpc_version != NULL)
load_nrLDPClib(ldpc_version);
......
......@@ -25,32 +25,37 @@
* \version 1.0
* \note initial implem - translation of cuda version
*/
#define MAX_ITERATION 2
#define MC 1
#define MAX_OCLDEV 10
#define MAX_OCLRUNTIME 5
typedef struct{
char x;
char y;
short value;
} h_element;
#ifdef NRLDPC_KERNEL_SOURCE
#include "nrLDPC_decoder_kernels_CL.c"
#else
/* uses HW component id for log messages ( --log_config.hw_log_level <warning| info|debug|trace>) */
#include <stdio.h>
#include <unistd.h>
#include <cuda_runtime.h>
#include <sys/stat.h>
#include <CL/opencl.h>
#include "PHY/CODING/nrLDPC_decoder/nrLDPC_types.h"
#include "PHY/CODING/nrLDPC_decoder/nrLDPCdecoder_defs.h"
#include "assertions.h"
#include "common/utils/LOG/log.h"
#define MAX_ITERATION 2
#define MC 1
#define MAX_OCLDEV 10
#define MAX_OCLRUNTIME 5
#define CLSETKERNELARG(A,B,C,D) \
rt=clSetKernelArg(A,B,C,D) ;\
AssertFatal(rt == CL_SUCCESS, "Error %d setting kernel argument index %d\n" , (int)rt, B);
typedef struct{
char x;
char y;
short value;
} h_element;
#include "../nrLDPC_decoder_LYC/bgs/BG1_compact_in_C.h"
typedef struct{
......@@ -213,20 +218,31 @@ void get_CompilErr(cl_program program, int pltf) {
}
size_t load_source(char **source_str) {
int MAX_SOURCE_SIZE=(500*132);
size_t load_source(char **source_str, char *filename) {
FILE *fp;
struct stat st ;
size_t source_size;
fp = fopen("nrLDPC_decoder_kernels_CL.cl", "r");
AssertFatal(fp,"failed to open cl source: %s\n",strerror(errno));
char *src= NULL;
*source_str = (char*)malloc(MAX_SOURCE_SIZE);
source_size = fread( *source_str, 1, MAX_SOURCE_SIZE, fp);
fclose( fp );
return source_size;
if (filename == NULL) {
src = "nrLDPC_decoder_kernels_CL.clc";
} else {
src = filename;
}
fp = fopen(src, "r");
AssertFatal(fp,"failed to open cl source %s: %s\n",src,strerror(errno));
fstat(fileno(fp), &st);
source_size = st.st_size;
*source_str = (char*)malloc(source_size);
source_size = fread( *source_str, 1, source_size, fp);
fclose( fp );
LOG_I(HW,"Loaded kernel sources from %s %u bytes\n", (filename==NULL)?"embedded cl code":src,(unsigned int)source_size );
return source_size;
}
/* from here: entry points in decoder shared lib */
int ldpc_autoinit(void) { // called by the library loader
cl_platform_id platforms[10];
......@@ -284,11 +300,11 @@ int ldpc_autoinit(void) { // called by the library loader
ocl.runtime[i].dev_tmp = clCreateBuffer(ocl.runtime[i].context, CL_MEM_READ_ONLY|CL_MEM_HOST_WRITE_ONLY, 68*384, NULL, (cl_int *)&rt);
AssertFatal(rt == CL_SUCCESS, "Error %d creating buffer dev_tmp for platform %i \n" , (int)rt, i);
char *source_str;
size_t source_size=load_source(&source_str);
size_t source_size=load_source(&source_str,"nrLDPC_decoder_kernels_CL.clc");
cl_program program = clCreateProgramWithSource(ocl.runtime[i].context, 1,
(const char **)&source_str, (const size_t *)&source_size, (cl_int *)&rt);
AssertFatal(rt == CL_SUCCESS, "Error %d creating program for platform %i \n" , (int)rt, i);
rt = clBuildProgram(program, ocl.runtime[i].num_devices,ocl.runtime[i].devices, NULL, NULL, NULL);
rt = clBuildProgram(program, ocl.runtime[i].num_devices,ocl.runtime[i].devices, NULL /* compile options */, NULL, NULL);
if (rt == CL_BUILD_PROGRAM_FAILURE) {
get_CompilErr(program,i);
}
......@@ -434,3 +450,4 @@ int32_t nrLDPC_decod(t_nrLDPC_dec_params* p_decParams, int8_t* p_llr, int8_t* p_
return MAX_ITERATION;
}
#endif //NRLDPC_KERNEL_SOURCE
......@@ -29,16 +29,7 @@
* \note initial implem - translation of cuda version
* \warning
*/
#define define MAX_ITERATION 2
#define MC 1
#define INT32_MAX 2147483647
typedef struct{
char x;
char y;
short value;
} h_element;
//__global char dev_dt [46*68*384];
//__local char *dev_t;
......@@ -46,7 +37,7 @@ typedef struct{
//__global unsigned char dev_tmp[68*384];
#define INT32_MAX 2147483647
//__constant h_element dev_h_compact1[46*19] = {}; // used in kernel 1
//__constant h_element dev_h_compact2[68*30] = {}; // used in kernel 2
......@@ -299,4 +290,3 @@ __kernel void pack_decoded_bit(__global unsigned char * dev_llr, __global unsign
}
}
}
......@@ -46,14 +46,14 @@ static loader_shlibfunc_t shlib_fdesc[3];
/* arguments used when called from phy simulators exec's which do not use the config module */
/* arg is used to initialize the config module so that the loader works as expected */
char *arg[64]={"ldpctest","-O","cmdlineonly::dbgl0",NULL,NULL};
char *arg[64]={"ldpctest",NULL};
int load_nrLDPClib(char *version) {
char *ptr = (char*)config_get_if();
char libname[64]="ldpc";
if ( ptr==NULL ) {// phy simulators, config module possibly not loaded
load_configmodule(0,(char **)NULL,CONFIG_ENABLECMDLINEONLY) ;
load_configmodule(1,arg,CONFIG_ENABLECMDLINEONLY) ;
logInit();
}
shlib_fdesc[0].fname = "nrLDPC_decod";
......
......@@ -32,6 +32,7 @@
#include "PHY/NR_REFSIG/ul_ref_seq_nr.h"
#include "PHY/NR_REFSIG/refsig_defs_ue.h"
#include "PHY/NR_REFSIG/nr_refsig.h"
#include <openair1/PHY/MODULATION/nr_modulation.h>
#if 0
void phy_config_harq_ue(module_id_t Mod_id,
......
......@@ -250,11 +250,9 @@ int nr_init_frame_parms(nfapi_nr_config_request_scf_t* cfg,
int Ncp = NFAPI_CP_NORMAL;
int mu = cfg->ssb_config.scs_common.value;
#if DISABLE_LOG_X
printf("Initializing frame parms for mu %d, N_RB %d, Ncp %d\n",mu, fp->N_RB_DL, Ncp);
#else
LOG_I(PHY,"Initializing frame parms for mu %d, N_RB %d, Ncp %d\n",mu, fp->N_RB_DL, Ncp);
#endif
if (Ncp == NFAPI_CP_EXTENDED)
AssertFatal(mu == NR_MU_2,"Invalid cyclic prefix %d for numerology index %d\n", Ncp, mu);
......@@ -343,11 +341,8 @@ int nr_init_frame_parms_ue(NR_DL_FRAME_PARMS *fp,
AssertFatal(fp->ul_CarrierFreq == (fp->dl_CarrierFreq + uplink_frequency_offset), "Disagreement in uplink frequency for band %d: ul_CarrierFreq = %lu Hz vs expected %lu Hz\n", fp->nr_band, fp->ul_CarrierFreq, fp->dl_CarrierFreq + uplink_frequency_offset);
#if DISABLE_LOG_X
printf("Initializing UE frame parms for mu %d, N_RB %d, Ncp %d\n",fp->numerology_index, fp->N_RB_DL, Ncp);
#else
LOG_I(PHY,"Initializing frame parms for mu %d, N_RB %d, Ncp %d\n",fp->numerology_index, fp->N_RB_DL, Ncp);
#endif
if (Ncp == NFAPI_CP_EXTENDED)
AssertFatal(fp->numerology_index == NR_MU_2,"Invalid cyclic prefix %d for numerology index %d\n", Ncp, fp->numerology_index);
......
......@@ -42,7 +42,6 @@
#include "common/utils/LOG/log.h"
#include "targets/RT/USER/lte-softmodem.h"
#include <syscall.h>
#include "targets/RT/USER/rt_wrapper.h"
#include <common/utils/threadPool/thread-pool.h>
//#define DEBUG_DLSCH_CODING
......
......@@ -44,14 +44,14 @@ void pcfich_unscrambling(LTE_DL_FRAME_PARMS *frame_parms,
int16_t *d)
{
uint8_t reset = 1;
uint32_t x1 = 0;
uint32_t s = 0;
uint32_t i;
uint8_t reset;
uint32_t x1=0, x2=0, s=0;
// x1 is set in lte_gold_generic
uint32_t x2 = ((((2*frame_parms->Nid_cell)+1)*(1+subframe))<<9) + frame_parms->Nid_cell; //this is c_init in 36.211 Sec 6.7.1
reset = 1;
x2 = ((((2*frame_parms->Nid_cell)+1)*(1+subframe))<<9) + frame_parms->Nid_cell; //this is c_init in 36.211 Sec 6.7.1
for (uint32_t i=0; i<32; i++) {
for (i=0; i<32; i++) {
if ((i&0x1f)==0) {
s = lte_gold_generic(&x1, &x2, reset);
//printf("lte_gold[%d]=%x\n",i,s);
......
......@@ -1174,7 +1174,7 @@ int nr_rx_pusch(PHY_VARS_gNB *gNB,
uint8_t aarx, aatx;
uint32_t nb_re_pusch, bwp_start_subcarrier;
int avgs;
int avgs = 0;
NR_DL_FRAME_PARMS *frame_parms = &gNB->frame_parms;
nfapi_nr_pusch_pdu_t *rel15_ul = &gNB->ulsch[ulsch_id][0]->harq_processes[harq_pid]->ulsch_pdu;
......
......@@ -302,7 +302,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
int32_t corr_re[1+frame_parms->nb_antennas_rx][2];
int32_t corr_im[1+frame_parms->nb_antennas_rx][2];
//int32_t no_corr = 0;
int seq_index;
int seq_index = 0;
int64_t temp;
for(i=0;i<nr_sequences;i++){
......
......@@ -642,7 +642,6 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
if (LOG_DEBUGFLAG(DEBUG_DLSCH_DECOD))
LOG_I(PHY,"Segmentation: C %d, K %d\n",harq_process->C,harq_process->K);
opp_enabled=1;
Kr = harq_process->K; // [hna] overwrites this line "Kr = p_decParams->Z*kb"
Kr_bytes = Kr>>3;
offset = 0;
......
......@@ -379,13 +379,10 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
len = (pilots==1)? ((config_type==NFAPI_NR_DMRS_TYPE1)?nb_rb*(12-6*dlsch0_harq->n_dmrs_cdm_groups): nb_rb*(12-4*dlsch0_harq->n_dmrs_cdm_groups)):(nb_rb*12);
stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]);
#if DISABLE_LOG_X
printf("[AbsSFN %u.%d] Slot%d Symbol %d type %d: Pilot/Data extraction %5.2f \n",
frame,nr_slot_rx,slot,symbol,type,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0));
#else
LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d type %d: Pilot/Data extraction %5.2f \n",
frame,nr_slot_rx,slot,symbol,type,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0));
#endif
if (cpumeas(CPUMEAS_GETSTATE))
LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d type %d: Pilot/Data extraction %5.2f \n",
frame,nr_slot_rx,slot,symbol,type,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0));
start_meas(&ue->generic_stat_bis[proc->thread_id][slot]);
n_tx = dlsch0_harq->Nl;
......@@ -402,11 +399,9 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
nb_rb_pdsch);
stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]);
#if DISABLE_LOG_X
printf("[AbsSFN %u.%d] Slot%d Symbol %d: Channel Scale %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0));
#else
LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d: Channel Scale %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0));
#endif
if (cpumeas(CPUMEAS_GETSTATE))
LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d: Channel Scale %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0));
start_meas(&ue->generic_stat_bis[proc->thread_id][slot]);
if (first_symbol_flag==1) {
if (beamforming_mode==0){
......@@ -463,11 +458,8 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
#endif
stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]);
#if DISABLE_LOG_X
printf("[AbsSFN %u.%d] Slot%d Symbol %d first_symbol_flag %d: Channel Level %5.2f \n",frame,nr_slot_rx,slot,symbol,first_symbol_flag,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0));
#else
LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d first_symbol_flag %d: Channel Level %5.2f \n",frame,nr_slot_rx,slot,symbol,first_symbol_flag,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0));
#endif
if (cpumeas(CPUMEAS_GETSTATE))
LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d first_symbol_flag %d: Channel Level %5.2f \n",frame,nr_slot_rx,slot,symbol,first_symbol_flag,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0));
start_meas(&ue->generic_stat_bis[proc->thread_id][slot]);
// Now channel compensation
......@@ -515,11 +507,9 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
}
stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]);
#if DISABLE_LOG_X
printf("[AbsSFN %u.%d] Slot%d Symbol %d log2_maxh %d channel_level %d: Channel Comp %5.2f \n", frame, nr_slot_rx, slot, symbol, pdsch_vars[gNB_id]->log2_maxh, proc->channel_level, ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0));
#else
LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d log2_maxh %d channel_level %d: Channel Comp %5.2f \n", frame, nr_slot_rx, slot, symbol, pdsch_vars[gNB_id]->log2_maxh, proc->channel_level, ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0));
#endif
if (cpumeas(CPUMEAS_GETSTATE))
LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d log2_maxh %d channel_level %d: Channel Comp %5.2f \n", frame, nr_slot_rx, slot, symbol, pdsch_vars[gNB_id]->log2_maxh, proc->channel_level, ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0));
start_meas(&ue->generic_stat_bis[proc->thread_id][slot]);
if (frame_parms->nb_antennas_rx > 1) {
......@@ -574,11 +564,9 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
}
stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]);
#if DISABLE_LOG_X
printf("[AbsSFN %u.%d] Slot%d Symbol %d: Channel Combine %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0));
#else
LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d: Channel Combine %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0));
#endif
if (cpumeas(CPUMEAS_GETSTATE))
LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d: Channel Combine %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0));
start_meas(&ue->generic_stat_bis[proc->thread_id][slot]);
/* Store the valid DL RE's */
pdsch_vars[gNB_id]->dl_valid_re[symbol-1] = len;
......@@ -657,11 +645,8 @@ int nr_rx_pdsch(PHY_VARS_NR_UE *ue,
}
stop_meas(&ue->generic_stat_bis[proc->thread_id][slot]);
#if DISABLE_LOG_X
printf("[AbsSFN %u.%d] Slot%d Symbol %d: LLR Computation %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0));
#else
LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d: LLR Computation %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0));
#endif
if (cpumeas(CPUMEAS_GETSTATE))
LOG_D(PHY, "[AbsSFN %u.%d] Slot%d Symbol %d: LLR Computation %5.2f \n",frame,nr_slot_rx,slot,symbol,ue->generic_stat_bis[proc->thread_id][slot].p_time/(cpuf*1000.0));
// Please keep it: useful for debugging
#ifdef DEBUG_PDSCH_RX
......
......@@ -353,21 +353,15 @@ int nr_initial_sync(UE_nr_rxtx_proc_t *proc,
if( (abs(ue->common_vars.freq_offset) > 150) && (ret == 0) )
{
ret=-1;
#if DISABLE_LOG_X
printf("Ignore MIB with high freq offset [%d Hz] estimation \n",ue->common_vars.freq_offset);
#else
LOG_E(HW, "Ignore MIB with high freq offset [%d Hz] estimation \n",ue->common_vars.freq_offset);
#endif
}*/
if (ret==0) { // PBCH found so indicate sync to higher layers and configure frame parameters
//#ifdef DEBUG_INITIAL_SYNCH
#if DISABLE_LOG_X
printf("[UE%d] In synch, rx_offset %d samples\n",ue->Mod_id, ue->rx_offset);
#else
LOG_I(PHY, "[UE%d] In synch, rx_offset %d samples\n",ue->Mod_id, ue->rx_offset);
#endif
//#endif
if (ue->UE_scan_carrier == 0) {
......
......@@ -42,7 +42,7 @@ int main(int argc, char **argv) {
get_common_options(SOFTMODEM_GNB_BIT );
config_process_cmdline( cmdline_params,sizeof(cmdline_params)/sizeof(paramdef_t),NULL);
CONFIG_CLEARRTFLAG(CONFIG_NOEXITONHELP);
configure_linux();
set_latency_target();
int N_RB=50;
......
......@@ -49,9 +49,15 @@ void reset_stats(FL_OBJECT *button, long arg) {
int i,j,k;
PHY_VARS_eNB *phy_vars_eNB = RC.eNB[0][0];
for (i=0; i<NUMBER_OF_UE_MAX; i++) {
for (k=0; k<8; k++) { //harq_processes
for (j=0; j<phy_vars_eNB->dlsch[i][0]->Mlimit; j++) {
printf("XXX %d %d %d\n",
sizeofArray(phy_vars_eNB->UE_stats),
sizeofArray( phy_vars_eNB->UE_stats[i].dlsch_NAK),
sizeofArray( *phy_vars_eNB->UE_stats[i].dlsch_NAK)
);
for (i=0; i<sizeofArray(phy_vars_eNB->UE_stats); i++) {
for (k=0; k<sizeofArray(phy_vars_eNB->UE_stats[i].dlsch_NAK); k++) { //harq_processes
for (j=0; j<sizeofArray(*phy_vars_eNB->UE_stats[i].dlsch_NAK); j++) {
phy_vars_eNB->UE_stats[i].dlsch_NAK[k][j]=0;
phy_vars_eNB->UE_stats[i].dlsch_ACK[k][j]=0;
phy_vars_eNB->UE_stats[i].dlsch_trials[k][j]=0;
......@@ -67,7 +73,6 @@ void reset_stats(FL_OBJECT *button, long arg) {
}
}
static void *scope_thread_eNB(void *arg) {
struct sched_param sched_param;
int UE_id, CC_id;
......@@ -75,7 +80,6 @@ static void *scope_thread_eNB(void *arg) {
sched_param.sched_priority = sched_get_priority_min(SCHED_FIFO)+1;
sched_setscheduler(0, SCHED_FIFO,&sched_param);
printf("Scope thread has priority %d\n",sched_param.sched_priority);
while (!oai_exit) {
ue_cnt=0;
......
......@@ -51,24 +51,7 @@ double get_cpu_freq_GHz(void)
return cpu_freq_GHz;
}
int cpumeas(int action)
{
switch (action) {
case CPUMEAS_ENABLE:
opp_enabled = 1;
break;
case CPUMEAS_DISABLE:
opp_enabled = 0;
break;
case CPUMEAS_GETSTATE:
default:
break;
}
return opp_enabled;
}
void print_meas_now(time_stats_t *ts,
const char *name,
......
......@@ -115,7 +115,24 @@ static inline uint32_t rdtsc_oai(void) {
#define CPUMEAS_DISABLE 0
#define CPUMEAS_ENABLE 1
#define CPUMEAS_GETSTATE 2
int cpumeas(int action);
static inline int cpumeas(int action) {
switch (action) {
case CPUMEAS_ENABLE:
opp_enabled = 1;
break;
case CPUMEAS_DISABLE:
opp_enabled = 0;
break;
case CPUMEAS_GETSTATE:
default:
break;
}
return opp_enabled;
}
static inline void start_meas(time_stats_t *ts) {
if (opp_enabled) {
if (ts->meas_flag==0) {
......
......@@ -107,11 +107,10 @@
* @}
*/
#include <common/utils/utils.h>
#include "defs_eNB.h"
#include "types.h"
/** @addtogroup _PHY_STRUCTURES_
* @{
*/
......@@ -315,50 +314,6 @@ typedef struct {
#include "openairinterface5g_limits.h"
#include "assertions.h"
#define cmax(a,b) ((a>b) ? (a) : (b))
#define cmax3(a,b,c) ((cmax(a,b)>c) ? (cmax(a,b)) : (c))
#define cmin(a,b) ((a<b) ? (a) : (b))
#ifdef __cplusplus
#ifdef min
#undef min
#undef max
#endif
#else
#define max(a,b) cmax(a,b)
#define min(a,b) cmin(a,b)
#endif
#ifndef malloc16
# ifdef __AVX2__
# define malloc16(x) memalign(32,x+32)
# else
# define malloc16(x) memalign(16,x+16)
# endif
#endif
#define free16(y,x) free(y)
#define bigmalloc malloc
#define bigmalloc16 malloc16
#define openair_free(y,x) free((y))
#define PAGE_SIZE 4096
#define free_and_zero(PtR) do { \
if (PtR) { \
free(PtR); \
PtR = NULL; \
} \
} while (0)
static inline void* malloc16_clear( size_t size )
{
#ifdef __AVX2__
void* ptr = memalign(32, size+32);
#else
void* ptr = memalign(16, size+16);
#endif
DevAssert(ptr);
memset( ptr, 0, size );
return ptr;
}
#endif //__PHY_IMPLEMENTATION_DEFS_H__
/**@}
*/
......@@ -855,8 +855,8 @@ int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, int gNB_
} else AssertFatal(1==0,"Not RA_PDSCH, SI_PDSCH or PDSCH\n");
stop_meas(&ue->dlsch_llr_stats_parallelization[proc->thread_id][slot]);
LOG_D(PHY, "[AbsSFN %d.%d] LLR Computation Symbol %d %5.2f \n",frame_rx,nr_slot_rx,m,ue->dlsch_llr_stats_parallelization[proc->thread_id][slot].p_time/(cpuf*1000.0));
if (cpumeas(CPUMEAS_GETSTATE))
LOG_D(PHY, "[AbsSFN %d.%d] LLR Computation Symbol %d %5.2f \n",frame_rx,nr_slot_rx,m,ue->dlsch_llr_stats_parallelization[proc->thread_id][slot].p_time/(cpuf*1000.0));
if(first_symbol_flag) {
proc->first_symbol_available = 1;
}
......@@ -1031,14 +1031,13 @@ bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
LOG_D(PHY, "In %s DL PDU length in bits: %d, in bytes: %d \n", __FUNCTION__, dlsch0->harq_processes[harq_pid]->TBS, dlsch0->harq_processes[harq_pid]->TBS / 8);
stop_meas(&ue->dlsch_decoding_stats[proc->thread_id]);
LOG_D(PHY, " --> Unscrambling for CW0 %5.3f\n",
(ue->dlsch_unscrambling_stats.p_time)/(cpuf*1000.0));
LOG_D(PHY, "AbsSubframe %d.%d --> LDPC Decoding for CW0 %5.3f\n",
frame_rx%1024, nr_slot_rx,(ue->dlsch_decoding_stats[proc->thread_id].p_time)/(cpuf*1000.0));
stop_meas(&ue->dlsch_decoding_stats[proc->thread_id]);
if (cpumeas(CPUMEAS_GETSTATE)) {
LOG_D(PHY, " --> Unscrambling for CW0 %5.3f\n",
(ue->dlsch_unscrambling_stats.p_time)/(cpuf*1000.0));
LOG_D(PHY, "AbsSubframe %d.%d --> LDPC Decoding for CW0 %5.3f\n",
frame_rx%1024, nr_slot_rx,(ue->dlsch_decoding_stats[proc->thread_id].p_time)/(cpuf*1000.0));
}
if(is_cw1_active) {
// start ldpc decode for CW 1
......@@ -1090,21 +1089,15 @@ bool nr_ue_dlsch_procedures(PHY_VARS_NR_UE *ue,
LOG_T(PHY,"CWW sequential dlsch decoding, ret1 = %d\n", ret1);
}
stop_meas(&ue->dlsch_decoding_stats[proc->thread_id]);
LOG_D(PHY, " --> Unscrambling for CW1 %5.3f\n",
(ue->dlsch_unscrambling_stats.p_time)/(cpuf*1000.0));
LOG_D(PHY, "AbsSubframe %d.%d --> ldpc Decoding for CW1 %5.3f\n",
frame_rx%1024, nr_slot_rx,(ue->dlsch_decoding_stats[proc->thread_id].p_time)/(cpuf*1000.0));
LOG_D(PHY,"AbsSubframe %d.%d --> ldpc Decoding for CW1 %5.3f\n",
frame_rx%1024, nr_slot_rx,(ue->dlsch_decoding_stats[proc->thread_id].p_time)/(cpuf*1000.0));
LOG_D(PHY, "harq_pid: %d, TBS expected dlsch1: %d \n", harq_pid, dlsch1->harq_processes[harq_pid]->TBS);
if (cpumeas(CPUMEAS_GETSTATE)) {
LOG_D(PHY, " --> Unscrambling for CW1 %5.3f\n",
(ue->dlsch_unscrambling_stats.p_time)/(cpuf*1000.0));
LOG_D(PHY, "AbsSubframe %d.%d --> ldpc Decoding for CW1 %5.3f\n",
frame_rx%1024, nr_slot_rx,(ue->dlsch_decoding_stats[proc->thread_id].p_time)/(cpuf*1000.0));
}
LOG_D(PHY, "harq_pid: %d, TBS expected dlsch1: %d \n", harq_pid, dlsch1->harq_processes[harq_pid]->TBS);
}
LOG_D(PHY," ------ end ldpc decoder for AbsSubframe %d.%d ------ decoded in %d \n", frame_rx, nr_slot_rx, ret);
// send to mac
if (ue->if_inst && ue->if_inst->dl_indication) {
ue->if_inst->dl_indication(&dl_indication, ul_time_alignment);
......@@ -1405,8 +1398,8 @@ void *UE_thread_slot1_dl_processing(void *arg) {
stop_meas(&ue->ue_front_end_per_slot_stat[proc->thread_id][1]);
LOG_D(PHY, "[AbsSFN %d.%d] Slot1: FFT + Channel Estimate + Pdsch Proc Slot0 %5.2f \n",frame_rx,nr_slot_rx,ue->ue_front_end_per_slot_stat[proc->thread_id][1].p_time/(cpuf*1000.0));
if (cpumeas(CPUMEAS_GETSTATE))
LOG_D(PHY, "[AbsSFN %d.%d] Slot1: FFT + Channel Estimate + Pdsch Proc Slot0 %5.2f \n",frame_rx,nr_slot_rx,ue->ue_front_end_per_slot_stat[proc->thread_id][1].p_time/(cpuf*1000.0));
//wait until pdcch is decoded
uint32_t wait = 0;
......@@ -1495,7 +1488,8 @@ void *UE_thread_slot1_dl_processing(void *arg) {
//printf("Set available LLR slot1 to 1 AbsSubframe %d.%d \n",frame_rx,nr_slot_rx);
stop_meas(&ue->pdsch_procedures_per_slot_stat[proc->thread_id][1]);
LOG_D(PHY, "[AbsSFN %d.%d] Slot1: LLR Computation %5.2f \n",frame_rx,nr_slot_rx,ue->pdsch_procedures_per_slot_stat[proc->thread_id][1].p_time/(cpuf*1000.0));
if (cpumeas(CPUMEAS_GETSTATE))
LOG_D(PHY, "[AbsSFN %d.%d] Slot1: LLR Computation %5.2f \n",frame_rx,nr_slot_rx,ue->pdsch_procedures_per_slot_stat[proc->thread_id][1].p_time/(cpuf*1000.0));
if (pthread_mutex_lock(&proc->mutex_slot1_dl_processing) != 0) {
LOG_E( PHY, "[SCHED][UE] error locking mutex for UE RXTX\n" );
......@@ -1864,9 +1858,10 @@ int phy_procedures_nrUE_RX(PHY_VARS_NR_UE *ue,
dlsch_parallel);
stop_meas(&ue->dlsch_procedures_stat[proc->thread_id]);
LOG_D(PHY, "[SFN %d] Slot1: Pdsch Proc %5.2f\n",nr_slot_rx,ue->pdsch_procedures_stat[proc->thread_id].p_time/(cpuf*1000.0));
LOG_D(PHY, "[SFN %d] Slot0 Slot1: Dlsch Proc %5.2f\n",nr_slot_rx,ue->dlsch_procedures_stat[proc->thread_id].p_time/(cpuf*1000.0));
if (cpumeas(CPUMEAS_GETSTATE)) {
LOG_D(PHY, "[SFN %d] Slot1: Pdsch Proc %5.2f\n",nr_slot_rx,ue->pdsch_procedures_stat[proc->thread_id].p_time/(cpuf*1000.0));
LOG_D(PHY, "[SFN %d] Slot0 Slot1: Dlsch Proc %5.2f\n",nr_slot_rx,ue->dlsch_procedures_stat[proc->thread_id].p_time/(cpuf*1000.0));
}
// deactivate dlsch once dlsch proc is done
ue->dlsch[proc->thread_id][gNB_id][0]->active = 0;
......@@ -1941,6 +1936,8 @@ if (nr_slot_rx==9) {
}
stop_meas(&ue->generic_stat);
if (cpumeas(CPUMEAS_GETSTATE))
LOG_D(PHY,"after tubo until end of Rx %5.2f \n",ue->generic_stat.p_time/(cpuf*1000.0));
#ifdef EMOS
phy_procedures_emos_UE_RX(ue,slot,gNB_id);
......@@ -1950,7 +1947,9 @@ phy_procedures_emos_UE_RX(ue,slot,gNB_id);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_OUT);
stop_meas(&ue->phy_proc_rx[proc->thread_id]);
LOG_D(PHY, "------FULL RX PROC [SFN %d]: %5.2f ------\n",nr_slot_rx,ue->phy_proc_rx[proc->thread_id].p_time/(cpuf*1000.0));
if (cpumeas(CPUMEAS_GETSTATE))
LOG_D(PHY, "------FULL RX PROC [SFN %d]: %5.2f ------\n",nr_slot_rx,ue->phy_proc_rx[proc->thread_id].p_time/(cpuf*1000.0));
//#endif //pdsch
......
......@@ -1234,7 +1234,7 @@ int main(int argc, char **argv) {
break;
}
for (k=0; k<NUMBER_OF_UE_MAX; k++) {
for (k=0; k<NUMBER_OF_DLSCH_MAX; k++) {
// Create transport channel structures for 2 transport blocks (MIMO)
for (i=0; i<2; i++) {
eNB->dlsch[k][i] = new_eNB_dlsch(Kmimo,8,Nsoft,N_RB_DL,0,&eNB->frame_parms);
......@@ -1247,6 +1247,17 @@ int main(int argc, char **argv) {
eNB->dlsch[k][i]->rnti = n_rnti+k;
}
}
for (int i=0;i<NUMBER_OF_ULSCH_MAX; i++) {
LOG_I(PHY,"Allocating Transport Channel Buffer for ULSCH %d/%d\n",i,NUMBER_OF_ULSCH_MAX);
eNB->ulsch[i] = new_eNB_ulsch(MAX_TURBO_ITERATIONS,eNB->frame_parms.N_RB_UL, 0);
if (!eNB->ulsch[i]) {
LOG_E(PHY,"Can't get eNB ulsch structures\n");
exit(-1);
}
}
/* allocate memory for both subframes (only one is really used
* but there is now "copy_harq_proc_struct" which needs both
......@@ -1815,12 +1826,12 @@ int main(int argc, char **argv) {
if (t_rx > 2000 )
n_rx_dropped++;
appendVarArray(table_tx, &t_tx);
appendVarArray(table_tx_ifft, &t_tx_ifft);
appendVarArray(table_rx, &t_rx );
appendVarArray(table_rx_fft, &t_rx_fft );
appendVarArray(table_rx_demod, &t_rx_demod );
appendVarArray(table_rx_dec, &t_rx_dec );
appendVarArray(&table_tx, &t_tx);
appendVarArray(&table_tx_ifft, &t_tx_ifft);
appendVarArray(&table_rx, &t_rx );
appendVarArray(&table_rx_fft, &t_rx_fft );
appendVarArray(&table_rx_demod, &t_rx_demod );
appendVarArray(&table_rx_dec, &t_rx_dec );
} //trials
// round_trials[0]: number of code word : goodput the protocol
......
......@@ -86,12 +86,6 @@ int8_t get_Po_NOMINAL_PUSCH(module_id_t module_idP, uint8_t CC_id) { return(0);}
int8_t get_deltaP_rampup(module_id_t module_idP, uint8_t CC_id) { return(0);}
void thread_top_init(char *thread_name,
int affinity,
uint64_t runtime,
uint64_t deadline,
uint64_t period) {}
int oai_nfapi_hi_dci0_req(nfapi_hi_dci0_request_t *hi_dci0_req) { return(0);}
int oai_nfapi_tx_req(nfapi_tx_request_t *tx_req) { return(0); }
......
......@@ -1971,12 +1971,12 @@ int main(int argc, char **argv) {
if (t_rx > 2000 )
n_rx_dropped++;
appendVarArray(table_tx, &t_tx);
appendVarArray(table_tx_ifft, &t_tx_ifft);
appendVarArray(table_rx, &t_rx );
appendVarArray(table_rx_fft, &t_rx_fft );
appendVarArray(table_rx_demod, &t_rx_demod );
appendVarArray(table_rx_dec, &t_rx_dec );
appendVarArray(&table_tx, &t_tx);
appendVarArray(&table_tx_ifft, &t_tx_ifft);
appendVarArray(&table_rx, &t_rx );
appendVarArray(&table_rx_fft, &t_rx_fft );
appendVarArray(&table_rx_demod, &t_rx_demod );
appendVarArray(&table_rx_dec, &t_rx_dec );
} //trials
// round_trials[0]: number of code word : goodput the protocol
......
......@@ -743,7 +743,7 @@ int main(int argc, char **argv) {
UE2eNB->max_Doppler = maxDoppler;
// NN: N_RB_UL has to be defined in ulsim
for (int k=0; k<NUMBER_OF_UE_MAX; k++) eNB->ulsch[k] = new_eNB_ulsch(max_turbo_iterations,N_RB_DL,0);
for (int k=0; k<NUMBER_OF_ULSCH_MAX; k++) eNB->ulsch[k] = new_eNB_ulsch(max_turbo_iterations,N_RB_DL,0);
UE->ulsch[0] = new_ue_ulsch(N_RB_DL,0);
printf("ULSCH %p\n",UE->ulsch[0]);
......@@ -1279,14 +1279,14 @@ int main(int argc, char **argv) {
n_rx_dropped++;
if (trials < 1000) {
appendVarArray(table_tx, &t_tx);
appendVarArray(table_tx_ifft, &t_tx_ifft);
appendVarArray(table_tx_mod, &t_tx_mod );
appendVarArray(table_tx_enc, &t_tx_enc );
appendVarArray(table_rx, &t_rx );
appendVarArray(table_rx_fft, &t_rx_fft );
appendVarArray(table_rx_demod, &t_rx_demod );
appendVarArray(table_rx_dec, &t_rx_dec );
appendVarArray(&table_tx, &t_tx);
appendVarArray(&table_tx_ifft, &t_tx_ifft);
appendVarArray(&table_tx_mod, &t_tx_mod );
appendVarArray(&table_tx_enc, &t_tx_enc );
appendVarArray(&table_rx, &t_rx );
appendVarArray(&table_rx_fft, &t_rx_fft );
appendVarArray(&table_rx_demod, &t_rx_demod );
appendVarArray(&table_rx_dec, &t_rx_dec );
}
} //trials
......
......@@ -402,7 +402,7 @@ int main(int argc, char **argv)
NR_UE_MAC_INST_t *UE_mac;
int cyclic_prefix_type = NFAPI_CP_NORMAL;
int run_initial_sync=0;
int loglvl=OAILOG_INFO;
int loglvl=OAILOG_WARNING;
//float target_error_rate = 0.01;
int css_flag=0;
......@@ -647,6 +647,7 @@ int main(int argc, char **argv)
printf("%s -h(elp) -p(extended_prefix) -N cell_id -f output_filename -F input_filename -g channel_model -n n_frames -t Delayspread -s snr0 -S snr1 -x transmission_mode -y TXant -z RXant -i Intefrence0 -j Interference1 -A interpolation_file -C(alibration offset dB) -N CellId\n",
argv[0]);
printf("-h This message\n");
printf("-L <log level, 0(errors), 1(warning), 2(info) 3(debug) 4 (trace)>\n");
//printf("-p Use extended prefix mode\n");
//printf("-d Use TDD\n");
printf("-n Number of frames to simulate\n");
......
......@@ -275,7 +275,7 @@ int main(int argc, char **argv)
//unsigned char frame_type = 0;
NR_DL_FRAME_PARMS *frame_parms;
int loglvl = OAILOG_INFO;
int loglvl = OAILOG_WARNING;
//uint64_t SSB_positions=0x01;
uint16_t nb_symb_sch = 12;
int start_symbol = 0;
......@@ -603,6 +603,7 @@ int main(int argc, char **argv)
//printf("-C Generate Calibration information for Abstraction (effective SNR adjustment to remove Pe bias w.r.t. AWGN)\n");
printf("-F Input filename (.txt format) for RX conformance testing\n");
printf("-G Offset of samples to read from file (0 default)\n");
printf("-L <log level, 0(errors), 1(warning), 2(info) 3(debug) 4 (trace)>\n");
printf("-M Multiple SSB positions in burst\n");
printf("-N Nid_cell\n");
printf("-O oversampling factor (1,2,4,8,16)\n");
......@@ -643,7 +644,7 @@ int main(int argc, char **argv)
else if (N_RB_UL == 106) bandwidth = 40;
else if (N_RB_UL == 32) bandwidth = 50;
else { printf("Add N_RB_UL %d\n",N_RB_UL); exit(-1); }
LOG_I( PHY,"++++++++++++++++++++++++++++++++++++++++++++++%i+++++++++++++++++++++++++++++++++++++++++",loglvl);
if (openair0_cfg[0].threequarter_fs == 1) sampling_frequency*=.75;
UE2gNB = new_channel_desc_scm(n_tx, n_rx, channel_model,
......
......@@ -24,26 +24,6 @@
#include <stdio.h>
#include <stdlib.h>
#if !defined (msg)
# define msg(aRGS...) LOG_D(PHY, ##aRGS)
#endif
#ifndef malloc16
# ifdef __AVX2__
# define malloc16(x) memalign(32,x)
# else
# define malloc16(x) memalign(16,x)
# endif
#endif
#define free16(y,x) free(y)
#define bigmalloc malloc
#define bigmalloc16 malloc16
#define openair_free(y,x) free((y))
#define PAGE_SIZE 4096
#define PAGE_MASK 0xfffff000
#define virt_to_phys(x) (x)
#define cmax(a,b) ((a>b) ? (a) : (b))
#define cmin(a,b) ((a<b) ? (a) : (b))
#include <common/utils/utils.h>
#endif // /*__openair_DEFS_H__ */
......@@ -546,7 +546,7 @@ int main( int argc, char **argv )
#endif
logInit();
//configure_linux();
//set_latency_target();
printf("Reading in command-line options\n");
get_options ();
......
......@@ -48,6 +48,8 @@
#include "UTIL/MEM/mem_block.h"
#include <common/utils/assertions.h>
//-----------------------------------------------------------------------------
void list_init (list_t* , char *);
......@@ -126,10 +128,13 @@ static inline void * dataArray(varArray_t * input) {
return input+1;
}
static inline void appendVarArray(varArray_t * input, void* data) {
static inline void appendVarArray(varArray_t ** inputPtr, void* data) {
varArray_t *input=*inputPtr;
if (input->size>=input->mallocedSize) {
input->mallocedSize+=input->increment;
input=(varArray_t *)realloc(input,sizeof(varArray_t)+input->mallocedSize*input->atomSize);
*inputPtr=(varArray_t *)realloc(input,sizeof(varArray_t)+input->mallocedSize*input->atomSize);
AssertFatal(*inputPtr, "no memory left");
input=*inputPtr;
}
memcpy((uint8_t*)(input+1)+input->atomSize*input->size++, data, input->atomSize);
}
......
......@@ -820,7 +820,8 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
AssertFatal((rfsimulator->epollfd = epoll_create1(0)) != -1,"");
//randominit(0);
// we need to call randominit() for telnet server (use gaussdouble=>uniformrand)
randominit(0);
set_taus_seed(0);
/* look for telnet server, if it is loaded, add the channel modeling commands to it */
add_telnetcmd_func_t addcmd = (add_telnetcmd_func_t)get_shlibmodule_fptr("telnetsrv", TELNET_ADDCMD_FNAME);
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <pthread.h>
#include <sched.h>
#include "thread_ipc.h"
g_thread_ipc_t thread_ipc = {0};
void loop_buffer_reset(buffer_t *loop_buf)
{
int i;
for (i = 0; i < BUFFERMAX; i++) {
loop_buf[i].subframe_num = -1;
}
return;
}
static void loop_buffer_init(loop_buffer_op_t *loop_buffer)
{
loop_buffer->packet_num = 0;
loop_buffer->isfull = 0;
loop_buffer->isempty = 1;
pthread_mutex_init(&loop_buffer->buffer_mutex, NULL);
pthread_cond_init(&loop_buffer->full_cond, NULL);
pthread_cond_init(&loop_buffer->empty_cond, NULL);
loop_buffer_reset(loop_buffer->loop_buf);
return;
}
static void sync_buffer_init(sync_buffer_t *sync_buffer)
{
sync_buffer->decoding_subframe_num = 0;
pthread_mutex_init(&sync_buffer->buffer_mutex, NULL);
return;
}
int thread_ipc_init(void)
{
//printf("recv %d\n", thread_ipc.sync_buffer.decoding_subframe_num);
thread_ipc.ue_sync_state = 0;
thread_ipc.rx_timestamp = 0;
thread_ipc.tx_timestamp = 0;
thread_ipc.current_subframe = 0;
pthread_mutex_init(&thread_ipc.dl_decode_mutex, NULL);
pthread_mutex_lock(&thread_ipc.dl_decode_mutex);
pthread_mutex_init(&thread_ipc.ul_send_mutex, NULL);
pthread_mutex_lock(&thread_ipc.ul_send_mutex);
pthread_mutex_init(&thread_ipc.sync_mutex, NULL);
pthread_mutex_lock(&thread_ipc.sync_mutex);
loop_buffer_init(&thread_ipc.loop_buffer);
sync_buffer_init(&thread_ipc.sync_buffer);
return 0;
}
int thread_ipc_deinit(void)
{
pthread_mutex_destroy(&thread_ipc.ul_send_mutex);
pthread_mutex_destroy(&thread_ipc.sync_mutex);
pthread_mutex_destroy(&thread_ipc.dl_decode_mutex);
pthread_mutex_destroy(&thread_ipc.loop_buffer.buffer_mutex);
pthread_cond_destroy(&thread_ipc.loop_buffer.full_cond);
pthread_cond_destroy(&thread_ipc.loop_buffer.empty_cond);
pthread_mutex_destroy(&thread_ipc.sync_buffer.buffer_mutex);
return 0;
}
int set_thread_attr(pthread_attr_t *attr, int policy, int priority, int cpuid)
{
struct sched_param param;
cpu_set_t cpu_info;
pthread_attr_init(attr);
if (pthread_attr_setschedpolicy(attr, policy) != 0) {
perror("pthread_attr_setschedpolicy");
return -1;
}
param.sched_priority = priority;
if (pthread_attr_setschedparam(attr, &param) != 0) {
perror("pthread_attr_setschedparam");
return -1;
}
CPU_ZERO(&cpu_info);
CPU_SET(cpuid, &cpu_info);
if (pthread_attr_setaffinity_np(attr,sizeof(cpu_set_t),&cpu_info)) {
perror("pthread_attr_setaffinity_np");
return -1;
}
if (pthread_attr_setinheritsched(attr, PTHREAD_EXPLICIT_SCHED) != 0) {
perror("pthread_attr_setinheritsched");
return -1;
}
return 0;
}
int find_subframe_num(unsigned long long current_subframe_num, buffer_t *buf, int *flag)
{
long long tmp;
int i;
tmp = current_subframe_num;
for ( i = 0; i < HIGHBUFFER + 1; i++) {
if(tmp == buf[i].subframe_num) {
return i;
} else if (tmp < buf[i].subframe_num) {
*flag = 1;
}
}
return -1;
}
int ue_unsync_thread_ipc_reset(void)
{
thread_ipc.ue_sync_state = 0;
pthread_mutex_lock(&thread_ipc.loop_buffer.buffer_mutex);
if (thread_ipc.loop_buffer.isempty) {
pthread_cond_signal(&thread_ipc.loop_buffer.empty_cond);
}
if (thread_ipc.loop_buffer.isfull) {
pthread_cond_signal(&thread_ipc.loop_buffer.full_cond);
}
thread_ipc.loop_buffer.packet_num = 0;
thread_ipc.loop_buffer.isfull = 0;
thread_ipc.loop_buffer.isempty = 1;
loop_buffer_reset(thread_ipc.loop_buffer.loop_buf);
pthread_mutex_unlock(&thread_ipc.loop_buffer.buffer_mutex);
thread_ipc.current_subframe = 0;
return 0;
}
void bind_thread2kernel(int cpu_id)
{
cpu_set_t mask;
cpu_set_t get;
int i;
int num = sysconf(_SC_NPROCESSORS_CONF);
//printf("system has %d processor(s) by super\n", num);
CPU_ZERO(&mask);
CPU_SET(cpu_id, &mask);
if (pthread_setaffinity_np(pthread_self(), sizeof(mask), &mask) < 0) {
fprintf(stderr, "set thread affinity failed\n");
}
/*CPU_ZERO(&get);
if (pthread_getaffinity_np(pthread_self(), sizeof(get), &get) < 0) {
fprintf(stderr, "get thread affinity failed\n");
}
for (i = 0; i < num; i++) {
if (CPU_ISSET(i, &get)) {
printf("thread %d is running in processor %d\n", (int)pthread_self(), i);
}
}
if (CPU_ISSET(cpu_id, &get)) {
printf("thread %d is running in processor %d by super\n", (int)pthread_self(), cpu_id);
}*/
}
void get_thread2kernel(void)
{
cpu_set_t get;
int i;
int num = sysconf(_SC_NPROCESSORS_CONF);
printf("system has %d processor(s) by super\n", num);
CPU_ZERO(&get);
if (pthread_getaffinity_np(pthread_self(), sizeof(get), &get) < 0) {
fprintf(stderr, "get thread affinity failed\n");
}
for (i = 0; i < num; i++) {
if (CPU_ISSET(i, &get)) {
printf("The thread %d is running in processor %d by super\n", (int)pthread_self(), i);
}
}
}
......@@ -48,8 +48,6 @@
#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all
#include "rt_wrapper.h"
#include "assertions.h"
......@@ -101,7 +99,6 @@ extern RAN_CONTEXT_t RC;
//#define USRP_DEBUG 1
struct timing_info_t {
//unsigned int frame, hw_slot, last_slot, next_slot;
RTIME time_min, time_max, time_avg, time_last, time_now;
//unsigned int mbox0, mbox1, mbox2, mbox_target;
unsigned int n_samples;
} timing_info;
......
......@@ -44,7 +44,6 @@
#include <execinfo.h>
#include <getopt.h>
#include <sys/sysinfo.h>
#include "rt_wrapper.h"
#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all
......
......@@ -34,7 +34,6 @@
#define _GNU_SOURCE /* See feature_test_macros(7) */
#include <sched.h>
#include "rt_wrapper.h"
#include <common/utils/msc/msc.h>
......@@ -518,13 +517,6 @@ static void wait_nfapi_init(char *thread_name) {
int main ( int argc, char **argv )
{
set_priority(79);
if (mlockall(MCL_CURRENT | MCL_FUTURE) == -1)
{
fprintf(stderr, "mlockall: %s\n", strerror(errno));
return EXIT_FAILURE;
}
int i;
int CC_id = 0;
int ru_id;
......@@ -537,8 +529,8 @@ int main ( int argc, char **argv )
}
mode = normal_txrx;
set_latency_target();
logInit();
set_latency_target();
printf("Reading in command-line options\n");
get_options ();
......@@ -573,13 +565,10 @@ int main ( int argc, char **argv )
init_opt();
// to make a graceful exit when ctrl-c is pressed
set_softmodem_sighandler();
check_clock();
#ifndef PACKAGE_VERSION
# define PACKAGE_VERSION "UNKNOWN-EXPERIMENTAL"
#endif
LOG_I(HW, "Version: %s\n", PACKAGE_VERSION);
printf("Runtime table\n");
fill_modeled_runtime_table(runtime_phy_rx,runtime_phy_tx);
/* Read configuration */
if (RC.nb_inst > 0) {
......
......@@ -6,7 +6,6 @@
#include <fcntl.h>
#include <getopt.h>
#include <linux/sched.h>
#include "rt_wrapper.h"
#include <sched.h>
#include <signal.h>
#include <stdint.h>
......@@ -21,7 +20,6 @@
#include <sys/types.h>
#include <unistd.h>
#include "threads_t.h"
#include "rt_wrapper.h"
#include "../../ARCH/COMMON/common_lib.h"
//#undef MALLOC
#include "assertions.h"
......
......@@ -31,7 +31,6 @@
*/
#include "lte-softmodem.h"
#include "rt_wrapper.h"
#include "system.h"
#include "LAYER2/MAC/mac.h"
......
......@@ -34,9 +34,6 @@
#define _GNU_SOURCE /* See feature_test_macros(7) */
#include <sched.h>
#include "rt_wrapper.h"
#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all
#include "assertions.h"
......@@ -542,12 +539,6 @@ AssertFatal(false,"");
}
int main( int argc, char **argv ) {
set_priority(79);
if (mlockall(MCL_CURRENT | MCL_FUTURE) == -1)
{
fprintf(stderr, "mlockall: %s\n", strerror(errno));
return EXIT_FAILURE;
}
int CC_id;
uint8_t abstraction_flag=0;
......@@ -565,8 +556,8 @@ int main( int argc, char **argv ) {
mode = normal_txrx;
memset(&openair0_cfg[0],0,sizeof(openair0_config_t)*MAX_CARDS);
set_latency_target();
logInit();
set_latency_target();
printf("Reading in command-line options\n");
for (int i=0; i<MAX_NUM_CCs; i++) tx_max_power[i]=23;
......@@ -629,7 +620,6 @@ int main( int argc, char **argv ) {
pdcp_pc5_socket_init();
// to make a graceful exit when ctrl-c is pressed
set_softmodem_sighandler();
check_clock();
#ifndef PACKAGE_VERSION
# define PACKAGE_VERSION "UNKNOWN-EXPERIMENTAL"
#endif
......@@ -663,52 +653,6 @@ int main( int argc, char **argv ) {
cpuf=get_cpu_freq_GHz();
#if 0 // #ifndef DEADLINE_SCHEDULER
printf("NO deadline scheduler\n");
/* Currently we set affinity for UHD to CPU 0 for eNB/UE and only if number of CPUS >2 */
cpu_set_t cpuset;
int s;
char cpu_affinity[1024];
CPU_ZERO(&cpuset);
#ifdef CPU_AFFINITY
int j;
if (get_nprocs() > 2) {
for (j = 2; 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");
}
LOG_I(HW, "Setting the affinity of main function to all CPUs, for device library to use CPU 0 only!\n");
}
#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 (int j = 0; j < CPU_SETSIZE; j++) {
if (CPU_ISSET(j, &cpuset)) {
char temp[1024];
sprintf(temp, " CPU_%d ", j);
strcat(cpu_affinity, temp);
}
}
LOG_I(HW, "CPU Affinity of main() function is... %s\n", cpu_affinity);
#endif
if (create_tasks_ue(NB_UE_INST) < 0) {
printf("cannot create ITTI tasks\n");
exit(-1); // need a softer mode
......
This diff is collapsed.
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file rt_wrapper.h
* \brief provides a wrapper for the timing function for real-time opeartions. It also implements an API for the SCHED_DEADLINE kernel scheduler.
* \author F. Kaltenberger and Navid Nikaein
* \date 2013
* \version 0.1
* \company Eurecom
* \email: florian.kaltenberger@eurecom.fr, navid.nikaein@eurecom.fr
* \note
* \warning This code will be removed when a legacy libc API becomes available.
*/
#ifndef _RT_WRAPPER_H_
#define _RT_WRAPPER_H_
#define _GNU_SOURCE
#include <time.h>
#include <errno.h>
#include <stdint.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <pthread.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <syscall.h>
#include <math.h>
#include <sched.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <sched.h>
#include <linux/sched.h>
#include <signal.h>
#include <execinfo.h>
#include <getopt.h>
#include <sys/sysinfo.h>
#include "common/utils/LOG/log_extern.h"
#include "msc.h"
#define RTIME long long int
#define rt_printk printf
void set_latency_target(void);
RTIME rt_get_time_ns (void);
int rt_sleep_ns (RTIME x);
void check_clock(void);
int fill_modeled_runtime_table(uint16_t runtime_phy_rx[29][6],uint16_t runtime_phy_tx[29][6]);
double get_runtime_tx(int tx_subframe, uint16_t runtime_phy_tx[29][6],uint32_t mcs, int N_RB_DL,double cpuf,int nb_tx_antenna);
double get_runtime_rx(int rx_subframe, uint16_t runtime_phy_rx[29][6], uint32_t mcs, int N_RB_DL,double cpuf,int nb_rx_antenna);
/**
* see https://www.kernel.org/doc/Documentation/scheduler/sched-deadline.txt or
* http://www.blaess.fr/christophe/2014/04/05/utiliser-un-appel-systeme-inconnu-de-la-libc/
*/
#ifdef DEADLINE_SCHEDULER
#define gettid() syscall(__NR_gettid)
#define SCHED_DEADLINE 6
/* XXX use the proper syscall numbers */
#ifdef __x86_64__
#define __NR_sched_setattr 314
#define __NR_sched_getattr 315
#endif
#ifdef __i386__
#define __NR_sched_setattr 351
#define __NR_sched_getattr 352
#endif
struct sched_attr {
__u32 size;
__u32 sched_policy;
__u64 sched_flags;
/* SCHED_NORMAL, SCHED_BATCH */
__s32 sched_nice;
/* SCHED_FIFO, SCHED_RR */
__u32 sched_priority;
/* SCHED_DEADLINE (nsec) */
__u64 sched_runtime;
__u64 sched_deadline;
__u64 sched_period;
};
int sched_setattr(pid_t pid, const struct sched_attr *attr, unsigned int flags);
int sched_getattr(pid_t pid,struct sched_attr *attr,unsigned int size, unsigned int flags);
#endif
#define gettid() syscall(__NR_gettid) // for gettid
void thread_top_init(char *thread_name,
int affinity,
uint64_t runtime,
uint64_t deadline,
uint64_t period);
#endif
......@@ -42,7 +42,6 @@
#include <execinfo.h>
#include <getopt.h>
#include <sys/sysinfo.h>
#include "rt_wrapper.h"
#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all
......
This diff is collapsed.
This diff is collapsed.
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