Commit 3f2dd171 authored by Laurent THOMAS's avatar Laurent THOMAS

code review comments + re-test

parent d7515686
...@@ -707,7 +707,7 @@ function main() { ...@@ -707,7 +707,7 @@ function main() {
# generate USIM data # generate USIM data
if [ -f $dbin/conf2uedata ]; then 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" 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_emm.nvram0 $DIR/$build_dir/build
cp -Rvf $dbin/.ue.nvram0 $DIR/$build_dir/build cp -Rvf $dbin/.ue.nvram0 $DIR/$build_dir/build
......
...@@ -452,17 +452,6 @@ install_asn1c_from_source(){ ...@@ -452,17 +452,6 @@ install_asn1c_from_source(){
) > "$asn1_install_log" 2>&1 ) > "$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 # set_openair_env
############################### ###############################
......
...@@ -15,6 +15,7 @@ set(CMAKE_C_FLAGS ...@@ -15,6 +15,7 @@ set(CMAKE_C_FLAGS
set(OPENAIR_DIR $ENV{OPENAIR_DIR}) set(OPENAIR_DIR $ENV{OPENAIR_DIR})
set(OPENAIR3_DIR $ENV{OPENAIR_DIR}/openair3) set(OPENAIR3_DIR $ENV{OPENAIR_DIR}/openair3)
include_directories (${OPENAIR_DIR}/openair2/COMMON) include_directories (${OPENAIR_DIR}/openair2/COMMON)
include_directories (${OPENAIR_DIR})
set(CONF2UEDATA_LIB_SRC set(CONF2UEDATA_LIB_SRC
${OPENAIR_DIR}/openair3/NAS/TOOLS/conf_emm.c ${OPENAIR_DIR}/openair3/NAS/TOOLS/conf_emm.c
......
...@@ -901,7 +901,7 @@ install_nas_tools() { ...@@ -901,7 +901,7 @@ install_nas_tools() {
if [ ! -f .usim.nvram0 ]; then if [ ! -f .usim.nvram0 ]; then
echo_success "generate .usim.nvram" echo_success "generate .usim.nvram"
./usim --gen -c $1 -o $2 ./usim --gen -c $1 -o $2 > "$3"
else else
[ ./usim -nt .usim.nvram0 ] && ./usim --gen -c $1 -o $2 [ ./usim -nt .usim.nvram0 ] && ./usim --gen -c $1 -o $2
fi fi
......
...@@ -391,7 +391,7 @@ void thread_top_init(char *thread_name, ...@@ -391,7 +391,7 @@ void thread_top_init(char *thread_name,
// Block CPU C-states deep sleep // Block CPU C-states deep sleep
void configure_linux(void) { void set_latency_target(void) {
int ret; int ret;
static int latency_target_fd=-1; static int latency_target_fd=-1;
uint32_t latency_target_value=2; // in microseconds uint32_t latency_target_value=2; // in microseconds
......
...@@ -43,10 +43,9 @@ int background_system(char *command); ...@@ -43,10 +43,9 @@ int background_system(char *command);
void start_background_system(void); void start_background_system(void);
void set_latency_target(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 SCHED_OAI SCHED_RR
#define OAI_PRIORITY_RT_LOW sched_get_priority_min(SCHED_OAI) #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) #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, ...@@ -65,7 +64,7 @@ void thread_top_init(char *thread_name,
int checkIfFedoraDistribution(void); int checkIfFedoraDistribution(void);
int checkIfGenericKernelOnFedora(void); int checkIfGenericKernelOnFedora(void);
int checkIfInsideContainer(void); int checkIfInsideContainer(void);
int rt_sleep_ns (uint64_t x); int rt_sleep_ns (uint64_t x);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
...@@ -7,23 +7,7 @@ ...@@ -7,23 +7,7 @@
#include <errno.h> #include <errno.h>
#include "utils.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) const char *hexdump(const void *data, size_t data_len, char *out, size_t out_len)
{ {
......
#ifndef _UTILS_H #ifndef _UTILS_H
#define _UTILS_H #define _UTILS_H
#include <stdint.h>
#include <sys/types.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #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))) #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))
const char *hexdump(const void *data, size_t data_len, char *out, size_t out_len); #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. ** // Converts an hexadecimal ASCII coded digit into its value. **
int hex_char_to_hex_value (char c); int hex_char_to_hex_value (char c);
......
...@@ -1150,7 +1150,7 @@ int main ( int argc, char **argv ) { ...@@ -1150,7 +1150,7 @@ int main ( int argc, char **argv ) {
#if T_TRACER #if T_TRACER
T_Config_Init(); T_Config_Init();
#endif #endif
configure_linux(); set_latency_target();
set_softmodem_sighandler(); set_softmodem_sighandler();
cpuf=get_cpu_freq_GHz(); cpuf=get_cpu_freq_GHz();
set_taus_seed (0); set_taus_seed (0);
......
...@@ -656,7 +656,7 @@ int main( int argc, char **argv ) { ...@@ -656,7 +656,7 @@ int main( int argc, char **argv ) {
memset(&openair0_cfg[0],0,sizeof(openair0_config_t)*MAX_CARDS); memset(&openair0_cfg[0],0,sizeof(openair0_config_t)*MAX_CARDS);
memset(tx_max_power,0,sizeof(int)*MAX_NUM_CCs); memset(tx_max_power,0,sizeof(int)*MAX_NUM_CCs);
logInit(); logInit();
configure_linux(); set_latency_target();
printf("Reading in command-line options\n"); printf("Reading in command-line options\n");
get_options (); get_options ();
......
...@@ -523,7 +523,7 @@ int main( int argc, char **argv ) { ...@@ -523,7 +523,7 @@ int main( int argc, char **argv ) {
// init UE_PF_PO and mutex lock // init UE_PF_PO and mutex lock
pthread_mutex_init(&ue_pf_po_mutex, NULL); 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); 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); mlockall(MCL_CURRENT | MCL_FUTURE);
if(IS_SOFTMODEM_DOSCOPE) { if(IS_SOFTMODEM_DOSCOPE) {
......
...@@ -920,7 +920,7 @@ int main( int argc, char **argv ) { ...@@ -920,7 +920,7 @@ int main( int argc, char **argv ) {
# define PACKAGE_VERSION "UNKNOWN" # define PACKAGE_VERSION "UNKNOWN"
#endif #endif
LOG_I(HW, "Version: %s\n", PACKAGE_VERSION); LOG_I(HW, "Version: %s\n", PACKAGE_VERSION);
configure_linux(); set_latency_target();
get_options (); get_options ();
get_common_options(SOFTMODEM_GNB_BIT ); get_common_options(SOFTMODEM_GNB_BIT );
AssertFatal(!CONFIG_ISFLAGSET(CONFIG_ABORT),"Getting configuration failed\n"); AssertFatal(!CONFIG_ISFLAGSET(CONFIG_ABORT),"Getting configuration failed\n");
......
...@@ -42,7 +42,7 @@ int main(int argc, char **argv) { ...@@ -42,7 +42,7 @@ int main(int argc, char **argv) {
get_common_options(SOFTMODEM_GNB_BIT ); get_common_options(SOFTMODEM_GNB_BIT );
config_process_cmdline( cmdline_params,sizeof(cmdline_params)/sizeof(paramdef_t),NULL); config_process_cmdline( cmdline_params,sizeof(cmdline_params)/sizeof(paramdef_t),NULL);
CONFIG_CLEARRTFLAG(CONFIG_NOEXITONHELP); CONFIG_CLEARRTFLAG(CONFIG_NOEXITONHELP);
configure_linux(); set_latency_target();
int N_RB=50; int N_RB=50;
......
...@@ -107,11 +107,10 @@ ...@@ -107,11 +107,10 @@
* @} * @}
*/ */
#include <common/utils/utils.h>
#include "defs_eNB.h" #include "defs_eNB.h"
#include "types.h" #include "types.h"
/** @addtogroup _PHY_STRUCTURES_ /** @addtogroup _PHY_STRUCTURES_
* @{ * @{
*/ */
...@@ -315,50 +314,6 @@ typedef struct { ...@@ -315,50 +314,6 @@ typedef struct {
#include "openairinterface5g_limits.h" #include "openairinterface5g_limits.h"
#include "assertions.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__ #endif //__PHY_IMPLEMENTATION_DEFS_H__
/**@} /**@}
*/ */
...@@ -24,26 +24,6 @@ ...@@ -24,26 +24,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#if !defined (msg) #include <common/utils/utils.h>
# 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))
#endif // /*__openair_DEFS_H__ */ #endif // /*__openair_DEFS_H__ */
...@@ -546,7 +546,7 @@ int main( int argc, char **argv ) ...@@ -546,7 +546,7 @@ int main( int argc, char **argv )
#endif #endif
logInit(); logInit();
//configure_linux(); //set_latency_target();
printf("Reading in command-line options\n"); printf("Reading in command-line options\n");
get_options (); get_options ();
......
...@@ -530,7 +530,7 @@ int main ( int argc, char **argv ) ...@@ -530,7 +530,7 @@ int main ( int argc, char **argv )
mode = normal_txrx; mode = normal_txrx;
logInit(); logInit();
configure_linux(); set_latency_target();
printf("Reading in command-line options\n"); printf("Reading in command-line options\n");
get_options (); get_options ();
......
...@@ -557,7 +557,7 @@ int main( int argc, char **argv ) { ...@@ -557,7 +557,7 @@ int main( int argc, char **argv ) {
mode = normal_txrx; mode = normal_txrx;
memset(&openair0_cfg[0],0,sizeof(openair0_config_t)*MAX_CARDS); memset(&openair0_cfg[0],0,sizeof(openair0_config_t)*MAX_CARDS);
logInit(); logInit();
configure_linux(); set_latency_target();
printf("Reading in command-line options\n"); printf("Reading in command-line options\n");
for (int i=0; i<MAX_NUM_CCs; i++) tx_max_power[i]=23; for (int i=0; i<MAX_NUM_CCs; i++) tx_max_power[i]=23;
......
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