From 3539761c285b1fa66ab8c9b803e8936b72b417b0 Mon Sep 17 00:00:00 2001 From: Raymond Knopp <raymond.knopp@eurecom.fr> Date: Fri, 13 Jul 2018 16:43:34 +0200 Subject: [PATCH] Log review step 1: legacy VCD removal, LOG macro modified, TTracer enabled at build time by default, in a way it, by default configuration, provides console logs, as in previous versions --- cmake_targets/CMakeLists.txt | 6 +- cmake_targets/build_oai | 14 +- common/config/config_cmdline.c | 89 +++++++++---- common/config/config_load_configmodule.c | 124 ++++++++++++++--- common/config/config_load_configmodule.h | 28 ++-- common/config/config_paramdesc.h | 3 + common/config/config_userapi.c | 146 ++++++++++++++++++++- common/config/config_userapi.h | 15 +++ common/config/libconfig/config_libconfig.c | 98 +++----------- common/utils/T/T.c | 16 +-- common/utils/T/local_tracer.c | 14 +- openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.c | 1 - openair2/UTIL/LOG/log.h | 58 ++++---- openair2/UTIL/LOG/vcd_signal_dumper.h | 21 +-- targets/RT/USER/lte-softmodem.c | 11 -- targets/RT/USER/lte-softmodem.h | 2 - targets/RT/USER/lte-uesoftmodem.c | 12 -- 17 files changed, 404 insertions(+), 254 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 245bba4f8b..3135ecfddf 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -244,7 +244,7 @@ add_boolean_option(TEST_OMG False "???") add_boolean_option(DEBUG_OMG False "???") add_boolean_option(XFORMS False "This adds the possibility to see the signal oscilloscope") add_boolean_option(PRINT_STATS False "This adds the possibility to see the status") -add_boolean_option(T_TRACER False "Activate the T tracer, a debugging/monitoring framework" ) +add_boolean_option(T_TRACER True "Activate the T tracer, a debugging/monitoring framework" ) add_boolean_option(UE_AUTOTEST_TRACE False "Activate UE autotest specific logs") add_boolean_option(UE_DEBUG_TRACE False "Activate UE debug trace") add_boolean_option(UE_TIMING_TRACE False "Activate UE timing trace") @@ -927,7 +927,7 @@ set(UTIL_SRC ${OPENAIR2_DIR}/UTIL/LISTS/list.c ${OPENAIR2_DIR}/UTIL/LISTS/list2.c ${OPENAIR2_DIR}/UTIL/LOG/log.c - ${OPENAIR2_DIR}/UTIL/LOG/vcd_signal_dumper.c +# ${OPENAIR2_DIR}/UTIL/LOG/vcd_signal_dumper.c ${OPENAIR2_DIR}/UTIL/MATH/oml.c ${OPENAIR2_DIR}/UTIL/MEM/mem_block.c # ${OPENAIR2_DIR}/UTIL/OCG/OCG.c @@ -2267,7 +2267,7 @@ endforeach(myExe) if (${T_TRACER}) foreach(i #all "add_executable" definitions (except tests, rb_tool, updatefw) - lte-softmodem lte-softmodem-nos1 oaisim oaisim_nos1 + lte-softmodem lte-softmodem-nos1 lte-uesoftmodem lte-uesoftmodem-nos1 oaisim oaisim_nos1 dlsim_tm4 dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim pdcchsim pucchsim prachsim syncsim #all "add_library" definitions diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index 1d511f36f6..bdd522d006 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -58,7 +58,7 @@ CFLAGS_PROCESSOR_USER="" RUN_GROUP=0 TEST_CASE_GROUP="" BUILD_DOXYGEN=0 -T_TRACER="False" +T_TRACER="True" DISABLE_HARDWARE_DEPENDENCY="False" CMAKE_BUILD_TYPE="" CMAKE_CMD="$CMAKE" @@ -143,8 +143,8 @@ Options Enable deadline scheduler of Linux kernel (>=3.14.x). --disable-cpu-affinity Disables CPU Affinity between UHD/TX/RX Threads (Valid only when deadline scheduler is disabled). By defaulT, CPU Affinity is enabled when not using deadline scheduler. It is enabled only with >2 CPUs. For eNB, CPU_0-> Device library (UHD), CPU_1->TX Threads, CPU_2...CPU_MAX->Rx Threads. For UE, CPU_0->Device Library(UHD), CPU_1..CPU_MAX -> All the UE threads ---T-tracer - Enables the T tracer. +--disable-T-Tracer + Disables the T tracer. --disable-hardware-dependency Disable HW dependency during installation --ue-autotest-trace @@ -318,9 +318,9 @@ function main() { CPU_AFFINITY_FLAG_USER="False" echo_info "Disabling CPU Affinity (only valid when not using deadline scheduler)" shift 1;; - --T-tracer) - T_TRACER="True" - echo_info "Enabling the T tracer" + --disable-T-Tracer) + T_TRACER="False" + echo_info "Disabling the T tracer" shift 1;; --disable-hardware-dependency) echo_info "Disabling hardware dependency for compiling software" @@ -1020,7 +1020,7 @@ fi echo "set(PACKAGE_NAME \"simulator_ue\")" >> $cmake_file echo "set (DEADLINE_SCHEDULER \"False\" )" >> $cmake_file echo "set (CPU_AFFINITY \"False\" )" >> $cmake_file - echo "set ( T_TRACER \"False\" )" >> $cmake_file + echo "set ( T_TRACER \"True\" )" >> $cmake_file echo "set (UE_AUTOTEST_TRACE $UE_AUTOTEST_TRACE)" >> $cmake_file echo "set (UE_DEBUG_TRACE $UE_DEBUG_TRACE)" >> $cmake_file echo "set (UE_TIMING_TRACE $UE_TIMING_TRACE)" >> $cmake_file diff --git a/common/config/config_cmdline.c b/common/config/config_cmdline.c index 040cd92faf..d5e099451a 100644 --- a/common/config/config_cmdline.c +++ b/common/config/config_cmdline.c @@ -29,9 +29,11 @@ * \note * \warning */ +#define _GNU_SOURCE #include <string.h> #include <stdlib.h> #include <stdio.h> +#include <ctype.h> #include <errno.h> #include "config_userapi.h" @@ -41,6 +43,7 @@ char *tmpval = value; int optisset=0; char defbool[2]="1"; + if ( value == NULL) { if( (cfgoptions->paramflags &PARAMFLAG_BOOL) == 0 ) { /* not a boolean, argument required */ fprintf(stderr,"[CONFIG] command line, option %s requires an argument\n",cfgoptions->optname); @@ -103,15 +106,15 @@ char defbool[2]="1"; if (optisset == 1) { cfgoptions->paramflags = cfgoptions->paramflags | PARAMFLAG_PARAMSET; } - return optisset; } int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix) { -char **p = config_get_if()->argv; + + int c = config_get_if()->argc; -int j; +int i,j; char *pp; char *cfgpath; @@ -122,42 +125,72 @@ char *cfgpath; return -1; } - j=0; - p++; - c--; - while (c > 0 && *p != NULL) { - if (strcmp(*p, "-h") == 0 || strcmp(*p, "--help") == 0 ) { - config_printhelp(cfgoptions,numoptions); + j = 0; + i = 0; + while (c > 0 ) { + char *oneargv = strdup(config_get_if()->argv[i]); /* we use strtok_r which modifies its string paramater, and we don't want argv to be modified */ +/* first check help options, either --help, -h or --help_<section> */ + if (strncmp(oneargv, "-h",2) == 0 || strncmp(oneargv, "--help",6) == 0 ) { + char *tokctx; + pp=strtok_r(oneargv, "_",&tokctx); + if (pp == NULL || strcasecmp(pp,config_get_if()->argv[i] ) == 0 ) { + if( prefix == NULL) { + config_printhelp(cfgoptions,numoptions); + if ( ! ( CONFIG_ISFLAGSET(CONFIG_NOEXITONHELP))) + exit_fun("[CONFIG] Exiting after displaying help\n"); + } + } else { + pp=strtok_r(NULL, "_",&tokctx); + if ( prefix != NULL && pp != NULL && strncasecmp(prefix,pp,strlen(pp)) == 0 ) { + printf ("Help for %s section:\n",prefix); + config_printhelp(cfgoptions,numoptions); + if ( ! (CONFIG_ISFLAGSET(CONFIG_NOEXITONHELP))) { + fprintf(stderr,"[CONFIG] %s %i section %s:", __FILE__, __LINE__, prefix); + exit_fun(" Exiting after displaying help\n"); + } + } + } } - if (*p[0] == '-') { - for(int i=0;i<numoptions;i++) { - if ( ( cfgoptions[i].paramflags & PARAMFLAG_DISABLECMDLINE) != 0) { +/* now, check for non help options */ + if (oneargv[0] == '-') { + for(int n=0;n<numoptions;n++) { + if ( ( cfgoptions[n].paramflags & PARAMFLAG_DISABLECMDLINE) != 0) { continue; } if (prefix != NULL) { - sprintf(cfgpath,"%s.%s",prefix,cfgoptions[i].optname); + sprintf(cfgpath,"%s.%s",prefix,cfgoptions[n].optname); } else { - sprintf(cfgpath,"%s",cfgoptions[i].optname); + sprintf(cfgpath,"%s",cfgoptions[n].optname); } - - if ( ((strlen(*p) == 2) && (strcmp(*p + 1,cfgpath) == 0)) || - ((strlen(*p) > 2) && (strcmp(*p + 2,cfgpath ) == 0 )) ) { - pp = *(p+1); - if ( ( pp != NULL ) && (c>1) && (pp[0]!= '-') ) { - - j += processoption(&(cfgoptions[i]), pp); - } else { - j += processoption(&(cfgoptions[i]), NULL); - } + if ( ((strlen(oneargv) == 2) && (strcmp(oneargv + 1,cfgpath) == 0)) || /* short option, one "-" */ + ((strlen(oneargv) > 2) && (strcmp(oneargv + 2,cfgpath ) == 0 )) ) { + char *valptr=NULL; + int ret; + pp = config_get_if()->argv[i+1]; + if (pp != NULL && c > 1) { + ret = strlen(pp); + if (ret > 0 ) { + if (pp[0] != '-') + valptr=pp; + else if ( ret > 1 && pp[0] == '-' && isdigit(pp[1]) ) + valptr=pp; + } + } + j += processoption(&(cfgoptions[n]), pp); + if ( valptr != NULL ) { + i++; + c--; + } break; } - } /* for */ - } /* if (*p[0] == '-') */ - p++; + } /* for n... */ + } /* if (oneargv[0] == '-') */ + free(oneargv); + i++; c--; } /* fin du while */ - printf_cmdl("[CONFIG] %s %i options set from command line\n",((prefix == NULL) ? "":prefix),j); + printf_cmdl("[CONFIG] %s %i options set from command line\n",((prefix == NULL) ? "(root)":prefix),j); free(cfgpath); return j; } /* parse_cmdline*/ diff --git a/common/config/config_load_configmodule.c b/common/config/config_load_configmodule.c index 7860742804..f879c0930a 100644 --- a/common/config/config_load_configmodule.c +++ b/common/config/config_load_configmodule.c @@ -97,7 +97,77 @@ int st; } /*-----------------------------------------------------------------------------------*/ /* from here: interface implementtion of the configuration module */ +int nooptfunc(void) { + return 0; +}; +int config_cmdlineonly_getlist(paramlist_def_t *ParamList, + paramdef_t *params, int numparams, char *prefix) +{ + ParamList->numelt = 0; + return 0; +} + + +int config_cmdlineonly_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) +{ + int defval; + int fatalerror=0; + int numdefvals=0; + + + for(int i=0;i<numoptions;i++) { + defval=0; + switch(cfgoptions[i].type) { + case TYPE_STRING: + defval=config_setdefault_string(&(cfgoptions[i]), prefix); + break; + case TYPE_STRINGLIST: + defval=config_setdefault_stringlist(&(cfgoptions[i]), prefix); + break; + case TYPE_UINT8: + case TYPE_INT8: + case TYPE_UINT16: + case TYPE_INT16: + case TYPE_UINT32: + case TYPE_INT32: + case TYPE_MASK: + defval=config_setdefault_int(&(cfgoptions[i]), prefix); + break; + case TYPE_UINT64: + case TYPE_INT64: + defval=config_setdefault_int64(&(cfgoptions[i]), prefix); + break; + case TYPE_UINTARRAY: + case TYPE_INTARRAY: + defval=config_setdefault_intlist(&(cfgoptions[i]), prefix); + break; + case TYPE_DOUBLE: + defval=config_setdefault_double(&(cfgoptions[i]), prefix); + break; + case TYPE_IPV4ADDR: + defval=config_setdefault_ipv4addr(&(cfgoptions[i]), prefix); + + break; + default: + fprintf(stderr,"[CONFIG] %s.%s type %i not supported\n",prefix, cfgoptions[i].optname,cfgoptions[i].type); + fatalerror=1; + break; + } /* switch on param type */ + if (defval == 1) { + numdefvals++; + cfgoptions[i].paramflags = cfgoptions[i].paramflags | PARAMFLAG_PARAMSETDEF; + } + } /* for loop on options */ + printf("[CONFIG] %s: %i/%i parameters successfully set \n", + ((prefix == NULL)?"(root)":prefix), + numdefvals,numoptions ); + if (fatalerror == 1) { + fprintf(stderr,"[CONFIG] fatal errors found when assigning %s parameters \n", + prefix); + } + return numdefvals; +} configmodule_interface_t *load_configmodule(int argc, char **argv) { @@ -110,17 +180,19 @@ uint32_t tmpflags=0; int i; /* first parse the command line to look for the -O option */ - opterr=0; for (i = 0;i<argc;i++) { if (strlen(argv[i]) < 2) continue; if ( argv[i][1] == 'O' && i < (argc -1)) { cfgparam = argv[i+1]; } - if ( argv[i][1] == 'h' ) { + if ( strstr(argv[i], "help_config") != NULL ) { + config_printhelp(Config_Params,CONFIG_PARAMLENGTH(Config_Params)); + exit(0); + } + if ( (strcmp(argv[i]+1, "h") == 0) || (strstr(argv[i]+1, "help_") != NULL ) ) { tmpflags = CONFIG_HELP; } } - optind=1; /* look for the OAI_CONFIGMODULE environement variable */ if ( cfgparam == NULL ) { @@ -129,21 +201,25 @@ int i; /* default */ if (cfgparam == NULL) { - tmpflags = tmpflags | CONFIG_NOOOPT; - cfgparam = DEFAULT_CFGMODE ":" DEFAULT_CFGFILENAME; - } + tmpflags = tmpflags | CONFIG_NOOOPT; + if (strstr(argv[0],"uesoftmodem") == NULL) { + cfgparam = CONFIG_LIBCONFIGFILE ":" DEFAULT_CFGFILENAME; + } else { + cfgparam = CONFIG_CMDLINEONLY ":dbgl0" ; + } + } + /* parse the config parameters to set the config source */ i = sscanf(cfgparam,"%m[^':']:%ms",&cfgmode,&modeparams); if (i< 0) { fprintf(stderr,"[CONFIG] %s, %d, sscanf error parsing config source %s: %s\n", __FILE__, __LINE__,cfgparam, strerror(errno)); - cfgmode=strdup(DEFAULT_CFGMODE); - modeparams = strdup(DEFAULT_CFGFILENAME); + exit(-1); } else if ( i == 1 ) { /* -O argument doesn't contain ":" separator, assume -O <conf file> option, default cfgmode to libconfig with one parameter, the path to the configuration file */ modeparams=cfgmode; - cfgmode=strdup(DEFAULT_CFGMODE); + cfgmode=strdup(CONFIG_LIBCONFIGFILE); } cfgptr = malloc(sizeof(configmodule_interface_t)); @@ -153,7 +229,6 @@ int i; cfgptr->argc = argc; cfgptr->argv = argv; cfgptr->cfgmode=strdup(cfgmode); - cfgptr->num_cfgP=0; atoken=strtok_r(modeparams,":",&strtokctx); while ( cfgptr->num_cfgP< CONFIG_MAX_OOPT_PARAMS && atoken != NULL) { @@ -176,24 +251,33 @@ int i; for (i=0;i<cfgptr->num_cfgP; i++) { printf("%s ",cfgptr->cfgP[i]); } - printf("\n"); + printf(", debug flags: 0x%08x\n",cfgptr->rtflags); - - i=load_config_sharedlib(cfgptr); - if (i< 0) { - fprintf(stderr,"[CONFIG] %s %d config module %s couldn't be loaded\n", __FILE__, __LINE__,cfgmode); - cfgptr->rtflags = cfgptr->rtflags | CONFIG_HELP | CONFIG_ABORT; + if (strstr(cfgparam,CONFIG_CMDLINEONLY) == NULL) { + i=load_config_sharedlib(cfgptr); + if (i == 0) { + printf("[CONFIG] config module %s loaded\n",cfgmode); + Config_Params[CONFIGPARAM_DEBUGFLAGS_IDX].uptr=&(cfgptr->rtflags); + config_get(Config_Params,CONFIG_PARAMLENGTH(Config_Params), CONFIG_SECTIONNAME ); + } else { + fprintf(stderr,"[CONFIG] %s %d config module \"%s\" couldn't be loaded\n", __FILE__, __LINE__,cfgmode); + cfgptr->rtflags = cfgptr->rtflags | CONFIG_HELP | CONFIG_ABORT; + } } else { - printf("[CONFIG] config module %s loaded\n",cfgmode); - Config_Params[CONFIGPARAM_DEBUGFLAGS_IDX].uptr=&(cfgptr->rtflags); - config_get(Config_Params,CONFIG_PARAMLENGTH(Config_Params), CONFIG_SECTIONNAME ); + cfgptr->init = (configmodule_initfunc_t)nooptfunc; + cfgptr->get = config_cmdlineonly_get; + cfgptr->getlist = config_cmdlineonly_getlist; + cfgptr->end = (configmodule_endfunc_t)nooptfunc; } if (modeparams != NULL) free(modeparams); if (cfgmode != NULL) free(cfgmode); - if (CONFIG_ISFLAGSET(CONFIG_ABORT)) config_printhelp(Config_Params,CONFIG_PARAMLENGTH(Config_Params)); + if (CONFIG_ISFLAGSET(CONFIG_ABORT)) { + config_printhelp(Config_Params,CONFIG_PARAMLENGTH(Config_Params)); + exit(-1); + } return cfgptr; } diff --git a/common/config/config_load_configmodule.h b/common/config/config_load_configmodule.h index 724cd1dbf5..ff3fa80f4e 100644 --- a/common/config/config_load_configmodule.h +++ b/common/config/config_load_configmodule.h @@ -41,17 +41,19 @@ #define CONFIG_MAX_ALLOCATEDPTRS 1024 // maximum number of parameters that can be dynamicaly allocated in the config module /* default values for configuration module parameters */ -#define DEFAULT_CFGMODE "libconfig" // use libconfig file -#define DEFAULT_CFGFILENAME "oai.conf" // default config file +#define CONFIG_LIBCONFIGFILE "libconfig" // use libconfig file +#define CONFIG_CMDLINEONLY "cmdline" // use only command line options +#define DEFAULT_CFGFILENAME "oai.conf" // default config file /* rtflags bit position definitions */ -#define CONFIG_PRINTPARAMS 1 // print parameters values while processing -#define CONFIG_DEBUGPTR 1<<1 // print memory allocation/free debug messages -#define CONFIG_DEBUGCMDLINE 1<<2 // print command line processing messages -#define CONFIG_NOABORTONCHKF 1<<3 // disable abort execution when parameter checking function fails -#define CONFIG_HELP 1<<20 // print help message -#define CONFIG_ABORT 1<<21 // config failed,abort execution -#define CONFIG_NOOOPT 1<<22 // no -O option found when parsing command line +#define CONFIG_PRINTPARAMS 1 // print parameters values while processing +#define CONFIG_DEBUGPTR (1<<1) // print memory allocation/free debug messages +#define CONFIG_DEBUGCMDLINE (1<<2) // print command line processing messages +#define CONFIG_NOABORTONCHKF (1<<3) // disable abort execution when parameter checking function fails +#define CONFIG_NOEXITONHELP (1<<19) // do not exit after printing help +#define CONFIG_HELP (1<<20) // print help message +#define CONFIG_ABORT (1<<21) // config failed,abort execution +#define CONFIG_NOOOPT (1<<22) // no -O option found when parsing command line typedef int(*configmodule_initfunc_t)(char *cfgP[],int numP); typedef int(*configmodule_getfunc_t)(paramdef_t *,int numparams, char *prefix); typedef int(*configmodule_getlistfunc_t)(paramlist_def_t *, paramdef_t *,int numparams, char *prefix); @@ -75,7 +77,7 @@ typedef struct configmodule_interface #ifdef CONFIG_LOADCONFIG_MAIN configmodule_interface_t *cfgptr=NULL; -static char config_helpstr [] = "\n lte-softmodem -O [config mode]<:dbg[debugflags]> \n \ +static char config_helpstr [] = "\n lte-softmodem -O [config mode]<:dbgl[debugflags]> \n \ debugflags can also be defined in the config_libconfig section of the config file\n \ debugflags: mask, 1->print parameters, 2->print memory allocations debug messages\n \ 4->print command line processing debug messages\n "; @@ -97,9 +99,9 @@ extern configmodule_interface_t *cfgptr; #endif -#define printf_params(...) if ( (cfgptr->rtflags & CONFIG_PRINTPARAMS) != 0 ) { printf ( __VA_ARGS__ ); } -#define printf_ptrs(...) if ( (cfgptr->rtflags & CONFIG_DEBUGPTR) != 0 ) { printf ( __VA_ARGS__ ); } -#define printf_cmdl(...) if ( (cfgptr->rtflags & CONFIG_DEBUGCMDLINE) != 0 ) { printf ( __VA_ARGS__ ); } +#define printf_params(...) if ( (cfgptr->rtflags & (CONFIG_PRINTPARAMS)) != 0 ) { printf ( __VA_ARGS__ ); } +#define printf_ptrs(...) if ( (cfgptr->rtflags & (CONFIG_DEBUGPTR)) != 0 ) { printf ( __VA_ARGS__ ); } +#define printf_cmdl(...) if ( (cfgptr->rtflags & (CONFIG_DEBUGCMDLINE)) != 0 ) { printf ( __VA_ARGS__ ); } extern configmodule_interface_t *load_configmodule(int argc, char **argv); extern void end_configmodule(void); diff --git a/common/config/config_paramdesc.h b/common/config/config_paramdesc.h index 6f153535fb..c65e298dfb 100644 --- a/common/config/config_paramdesc.h +++ b/common/config/config_paramdesc.h @@ -148,7 +148,10 @@ typedef struct paramdef #define TYPE_MASK 10 #define TYPE_DOUBLE 16 #define TYPE_IPV4ADDR 20 +#define TYPE_LASTSCALAR 25 +#define PARAM_ISLISTORARRAY(P) (P->type > TYPE_LASTSCALAR ) +#define PARAM_ISSCALAR(P) (P->type < TYPE_LASTSCALAR ) #define TYPE_STRINGLIST 50 #define TYPE_INTARRAY 51 diff --git a/common/config/config_userapi.c b/common/config/config_userapi.c index c1acc84384..3f3651aa01 100644 --- a/common/config/config_userapi.c +++ b/common/config/config_userapi.c @@ -35,6 +35,8 @@ #include <unistd.h> #include <errno.h> #include <dlfcn.h> +#include <arpa/inet.h> + #include "config_userapi.h" extern void exit_fun(const char* s); // lte-softmodem clean exit function @@ -50,10 +52,30 @@ configmodule_interface_t *config_get_if(void) char * config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) { - + if (ptr == NULL ) { + ptr = malloc(sizeof(char *)); + if (ptr != NULL) { + *ptr=NULL; + cfgoptions->strptr=ptr; + if ( (cfgoptions->paramflags & PARAMFLAG_NOFREE) == 0) { + config_get_if()->ptrs[config_get_if()->numptrs] = (char *)ptr; + config_get_if()->numptrs++; + } + } else { + fprintf(stderr, "[CONFIG] %s %d option %s, cannot allocate pointer: %s \n", + __FILE__, __LINE__, cfgoptions->optname, strerror(errno)); + exit(-1); + } + } printf_ptrs("[CONFIG] %s ptr: 0x%08lx requested size: %i\n",cfgoptions->optname,(uintptr_t)(ptr),length); - if(cfgoptions->numelt > 0) { /* already allocated */ - return *ptr; + if(cfgoptions->numelt > 0 && PARAM_ISSCALAR(cfgoptions) ) { /* already allocated */ + if (*ptr != NULL) { + return *ptr; + } else { + fprintf(stderr,"[CONFIG] %s %d option %s, definition error: value pointer is NULL, declared as %i bytes allocated\n", + __FILE__, __LINE__,cfgoptions->optname, cfgoptions->numelt); + exit(-1); + } } if (*ptr == NULL) { @@ -75,7 +97,7 @@ char * config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) void config_assign_int(paramdef_t *cfgoptions, char *fullname, int val) { int tmpval=val; - if ( ((cfgoptions->paramflags &PARAMFLAG_BOOL) != 0) && tmpval >1) { + if ( ((cfgoptions->paramflags &PARAMFLAG_BOOL) != 0) && tmpval >0) { tmpval =1; } switch (cfgoptions->type) { @@ -160,7 +182,7 @@ int st=0; } } if (st != 0) { - fprintf(stderr,"[CONFIG] config_execcheck: %i parameters with wrong value\n", -st); + fprintf(stderr,"[CONFIG] config_execcheck: section %s %i parameters with wrong value\n", prefix, -st); if ( CONFIG_ISFLAGSET(CONFIG_NOABORTONCHKF) == 0) { exit_fun("exit because configuration failed\n"); } @@ -173,7 +195,7 @@ int config_get(paramdef_t *params,int numparams, char *prefix) int ret= -1; if (CONFIG_ISFLAGSET(CONFIG_ABORT)) { - fprintf(stderr,"[CONFIG] config_get skipped, config module not properly initialized\n"); + fprintf(stderr,"[CONFIG] config_get, section %s skipped, config module not properly initialized\n",prefix); return ret; } configmodule_interface_t *cfgif = config_get_if(); @@ -283,3 +305,115 @@ int config_checkstr_assign_integer(paramdef_t *param) return -1; } + +int config_setdefault_string(paramdef_t *cfgoptions, char *prefix) +{ + int status = 0; + if( cfgoptions->defstrval != NULL) { + status=1; + + if (cfgoptions->numelt == 0 ) { + config_check_valptr(cfgoptions, (char **)(cfgoptions->strptr), sizeof(char *)); + config_check_valptr(cfgoptions, cfgoptions->strptr, strlen(cfgoptions->defstrval)+1); + sprintf(*(cfgoptions->strptr), "%s",cfgoptions->defstrval); + printf_params("[CONFIG] %s.%s set to default value \"%s\"\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname, *(cfgoptions->strptr)); + } else { + sprintf((char *)*(cfgoptions->strptr), "%s",cfgoptions->defstrval); + printf_params("[CONFIG] %s.%s set to default value \"%s\"\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname, (char *)*(cfgoptions->strptr)); + } + } + return status; +} + +int config_setdefault_stringlist(paramdef_t *cfgoptions, char *prefix) +{ + int status = 0; + if( cfgoptions->defstrlistval != NULL) { + cfgoptions->strlistptr=cfgoptions->defstrlistval; + status=1; + for(int j=0; j<cfgoptions->numelt; j++) + printf_params("[CONFIG] %s.%s[%i] set to default value %s\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname,j, cfgoptions->strlistptr[j]); + } + return status; +} + +int config_setdefault_int(paramdef_t *cfgoptions, char *prefix) +{ + int status = 0; + config_check_valptr(cfgoptions, (char **)(&(cfgoptions->iptr)),sizeof(int32_t)); + if( ((cfgoptions->paramflags & PARAMFLAG_MANDATORY) == 0)) { + config_assign_int(cfgoptions,cfgoptions->optname,cfgoptions->defintval); + status=1; + printf_params("[CONFIG] %s.%s set to default value\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname); + } + return status; +} + +int config_setdefault_int64(paramdef_t *cfgoptions, char *prefix) +{ + int status = 0; + config_check_valptr(cfgoptions, (char **)&(cfgoptions->i64ptr),sizeof(long long)); + if( ((cfgoptions->paramflags & PARAMFLAG_MANDATORY) == 0)) { + *(cfgoptions->u64ptr)=cfgoptions->defuintval; + status=1; + printf_params("[CONFIG] %s.%s set to default value %llu\n", ((prefix == NULL) ? "" : prefix), cfgoptions->optname, (long long unsigned)(*(cfgoptions->u64ptr))); + } + return status; +} + +int config_setdefault_intlist(paramdef_t *cfgoptions, char *prefix) +{ + int status = 0; + if( cfgoptions->defintarrayval != NULL) { + config_check_valptr(cfgoptions,(char **)&(cfgoptions->iptr), sizeof(int32_t*)); + cfgoptions->iptr=cfgoptions->defintarrayval; + status=1; + for (int j=0; j<cfgoptions->numelt ; j++) { + printf_params("[CONFIG] %s[%i] set to default value %i\n",cfgoptions->optname ,j,(int)cfgoptions->iptr[j]); + } + } + return status; +} + +int config_setdefault_double(paramdef_t *cfgoptions, char *prefix) +{ + int status = 0; + config_check_valptr(cfgoptions, (char **)&(cfgoptions->dblptr),sizeof(double)); + if( ((cfgoptions->paramflags & PARAMFLAG_MANDATORY) == 0)) { + *(cfgoptions->u64ptr)=cfgoptions->defdblval; + status=1; + printf_params("[CONFIG] %s set to default value %lf\n",cfgoptions->optname , *(cfgoptions->dblptr)); + } + return status; +} + +int config_assign_ipv4addr(paramdef_t *cfgoptions, char *ipv4addr) +{ + config_check_valptr(cfgoptions,(char **)&(cfgoptions->uptr), sizeof(int)); + int rst=inet_pton(AF_INET, ipv4addr ,cfgoptions->uptr ); + if (rst == 1 && *(cfgoptions->uptr) > 0) { + printf_params("[CONFIG] %s: %s\n",cfgoptions->optname, ipv4addr); + return 1; + } else { + if ( strncmp(ipv4addr,ANY_IPV4ADDR_STRING,sizeof(ANY_IPV4ADDR_STRING)) == 0) { + printf_params("[CONFIG] %s:%s (INADDR_ANY) \n",cfgoptions->optname,ipv4addr); + *cfgoptions->uptr=INADDR_ANY; + return 1; + } else { + fprintf(stderr,"[CONFIG] %s not valid for %s \n", ipv4addr, cfgoptions->optname); + return -1; + } + } + return 0; +} + + +int config_setdefault_ipv4addr(paramdef_t *cfgoptions, char *prefix) +{ + int status = 0; + + if (cfgoptions->defstrval != NULL) { + status = config_assign_ipv4addr(cfgoptions, cfgoptions->defstrval); + } + return status; +} diff --git a/common/config/config_userapi.h b/common/config/config_userapi.h index 923a690f51..217310db36 100644 --- a/common/config/config_userapi.h +++ b/common/config/config_userapi.h @@ -38,10 +38,15 @@ extern "C" { #endif +/* get rid of "exit_fun undeclared" warning */ +extern void exit_fun(const char* s); + #define CONFIG_GETSOURCE ( (config_get_if()==NULL) ? NULL : config_get_if()->cfgmode ) #define CONFIG_GETNUMP ( (config_get_if()==NULL) ? 0 : config_get_if()->num_cfgP ) #define CONFIG_GETP(P) ( (config_get_if()==NULL) ? NULL : config_get_if()->cfgP[P] ) #define CONFIG_ISFLAGSET(P) ( (config_get_if()==NULL) ? 0 : !!(config_get_if()->rtflags & P)) +#define CONFIG_SETRTFLAG(P) if (config_get_if()) { config_get_if()->rtflags |= P; } +#define CONFIG_CLEARRTFLAG(P) if (config_get_if()) { config_get_if()->rtflags &= (~P); } #define CONFIG_ISPARAMFLAGSET(P,F) ( !!(P.paramflags & F)) /* utility functions, to be used by configuration module and/or configuration libraries */ extern configmodule_interface_t *config_get_if(void); @@ -50,6 +55,7 @@ extern void config_printhelp(paramdef_t *,int numparams); extern int config_process_cmdline(paramdef_t *params,int numparams, char *prefix); extern void config_assign_processedint(paramdef_t *cfgoption, int val); extern void config_assign_int(paramdef_t *cfgoptions, char *fullname, int val); +extern int config_assign_ipv4addr(paramdef_t *cfgoptions, char *ipv4addr); /* apis to get parameters, to be used by oai modules, at configuration time */ extern int config_get(paramdef_t *params,int numparams, char *prefix); @@ -66,6 +72,15 @@ extern int config_check_intrange(paramdef_t *param); extern int config_check_strval(paramdef_t *param); extern int config_checkstr_assign_integer(paramdef_t *param); +/* functions to set a parameter to its default value */ +extern int config_setdefault_string(paramdef_t *cfgoptions, char *prefix); +extern int config_setdefault_stringlist(paramdef_t *cfgoptions, char *prefix); +extern int config_setdefault_int(paramdef_t *cfgoptions, char *prefix); +extern int config_setdefault_int64(paramdef_t *cfgoptions, char *prefix); +extern int config_setdefault_intlist(paramdef_t *cfgoptions, char *prefix); +extern int config_setdefault_double(paramdef_t *cfgoptions, char *prefix); +extern int config_setdefault_ipv4addr(paramdef_t *cfgoptions, char *prefix); + #define CONFIG_GETCONFFILE (config_get_if()->cfgP[0]) #ifdef __cplusplus diff --git a/common/config/libconfig/config_libconfig.c b/common/config/libconfig/config_libconfig.c index cfb0a214cf..f192fd2dc5 100644 --- a/common/config/libconfig/config_libconfig.c +++ b/common/config/libconfig/config_libconfig.c @@ -129,8 +129,6 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix ) switch(cfgoptions[i].type) { case TYPE_STRING: - -printf("call config_lookup_string for '%s' %p\n", cfgpath, &(libconfig_privdata.cfg)); fflush(stdout); if ( config_lookup_string(&(libconfig_privdata.cfg),cfgpath, (const char **)&str)) { if ( cfgoptions[i].numelt > 0 && str != NULL && strlen(str) >= cfgoptions[i].numelt ) { fprintf(stderr,"[LIBCONFIG] %s: %s exceeds maximum length of %i bytes, value truncated\n", @@ -138,7 +136,7 @@ printf("call config_lookup_string for '%s' %p\n", cfgpath, &(libconfig_privdata. str[strlen(str)-1] = 0; } if (cfgoptions[i].numelt == 0 ) { - config_check_valptr(&(cfgoptions[i]), (char **)(&(cfgoptions[i].strptr)), sizeof(char *)); + // config_check_valptr(&(cfgoptions[i]), (char **)(&(cfgoptions[i].strptr)), sizeof(char *)); config_check_valptr(&(cfgoptions[i]), cfgoptions[i].strptr, strlen(str)+1); sprintf( *(cfgoptions[i].strptr) , "%s", str); printf_params("[LIBCONFIG] %s: \"%s\"\n", cfgpath,*(cfgoptions[i].strptr) ); @@ -147,21 +145,7 @@ printf("call config_lookup_string for '%s' %p\n", cfgpath, &(libconfig_privdata. printf_params("[LIBCONFIG] %s: \"%s\"\n", cfgpath,(char *)cfgoptions[i].strptr ); } } else { - if( cfgoptions[i].defstrval != NULL) { - defval=1; - - if (cfgoptions[i].numelt == 0 ) { - config_check_valptr(&(cfgoptions[i]), (char **)(&(cfgoptions[i].strptr)), sizeof(char *)); - config_check_valptr(&(cfgoptions[i]), cfgoptions[i].strptr, strlen(cfgoptions[i].defstrval)+1); - sprintf(*(cfgoptions[i].strptr), "%s",cfgoptions[i].defstrval); - printf_params("[LIBCONFIG] %s set to default value \"%s\"\n", cfgpath, *(cfgoptions[i].strptr)); - } else { - sprintf((char *)*(cfgoptions[i].strptr), "%s",cfgoptions[i].defstrval); - printf_params("[LIBCONFIG] %s set to default value \"%s\"\n", cfgpath, (char *)*(cfgoptions[i].strptr)); - } - } else { - notfound=1; - } + defval=config_setdefault_string(&(cfgoptions[i]),prefix); } break; case TYPE_STRINGLIST: @@ -169,14 +153,7 @@ printf("call config_lookup_string for '%s' %p\n", cfgpath, &(libconfig_privdata. if ( setting != NULL) { read_strlist(&cfgoptions[i],setting,cfgpath); } else { - if( cfgoptions[i].defstrlistval != NULL) { - cfgoptions[i].strlistptr=cfgoptions[i].defstrlistval; - defval=1; - for(int j=0; j<cfgoptions[i].numelt; j++) - printf_params("[LIBCONFIG] %s%i set to default value %s\n", cfgpath,j, cfgoptions[i].strlistptr[j]); - } else { - notfound=1; - } + defval=config_setdefault_stringlist(&(cfgoptions[i]),prefix); } break; case TYPE_UINT8: @@ -186,23 +163,17 @@ printf("call config_lookup_string for '%s' %p\n", cfgpath, &(libconfig_privdata. case TYPE_UINT32: case TYPE_INT32: case TYPE_MASK: - config_check_valptr(&(cfgoptions[i]), (char **)(&(cfgoptions[i].iptr)),sizeof(int32_t)); if ( config_lookup_int(&(libconfig_privdata.cfg),cfgpath, &u)) { + config_check_valptr(&(cfgoptions[i]), (char **)(&(cfgoptions[i].iptr)),sizeof(int32_t)); config_assign_int(&(cfgoptions[i]),cfgpath,u); } else { - if( ((cfgoptions[i].paramflags & PARAMFLAG_MANDATORY) == 0)) { - config_assign_int(&(cfgoptions[i]),cfgpath,cfgoptions[i].defintval); - defval=1; - printf_params("[LIBCONFIG] %s set to default value\n", cfgpath); - } else { - notfound=1; - } + defval=config_setdefault_int(&(cfgoptions[i]),prefix); } break; case TYPE_UINT64: case TYPE_INT64: - config_check_valptr(&(cfgoptions[i]), (char **)&(cfgoptions[i].i64ptr),sizeof(long long)); if ( config_lookup_int64(&(libconfig_privdata.cfg),cfgpath, &llu)) { + config_check_valptr(&(cfgoptions[i]), (char **)&(cfgoptions[i].i64ptr),sizeof(long long)); if(cfgoptions[i].type==TYPE_UINT64) { *(cfgoptions[i].u64ptr) = (uint64_t)llu; printf_params("[LIBCONFIG] %s: %llu\n", cfgpath,(long long unsigned)(*(cfgoptions[i].u64ptr)) ); @@ -211,13 +182,7 @@ printf("call config_lookup_string for '%s' %p\n", cfgpath, &(libconfig_privdata. printf_params("[LIBCONFIG] %s: %lli\n", cfgpath,(long long unsigned)(*(cfgoptions[i].i64ptr)) ); } } else { - if( ((cfgoptions[i].paramflags & PARAMFLAG_MANDATORY) == 0)) { - *(cfgoptions[i].u64ptr)=cfgoptions[i].defuintval; - defval=1; - printf_params("[LIBCONFIG] %s set to default value %llu\n", cfgpath, (long long unsigned)(*(cfgoptions[i].u64ptr))); - } else { - notfound=1; - } + defval=config_setdefault_int64(&(cfgoptions[i]),prefix); } break; case TYPE_UINTARRAY: @@ -226,57 +191,28 @@ printf("call config_lookup_string for '%s' %p\n", cfgpath, &(libconfig_privdata. if ( setting != NULL) { read_intarray(&cfgoptions[i],setting,cfgpath); } else { - if( cfgoptions[i].defintarrayval != NULL) { - config_check_valptr(&(cfgoptions[i]),(char **)&(cfgoptions[i].iptr), sizeof(int32_t*)); - cfgoptions[i].iptr=cfgoptions[i].defintarrayval; - defval=1; - for (int j=0; j<cfgoptions[i].numelt ; j++) { - printf_params("[LIBCONFIG] %s[%i] set to default value %i\n", cfgpath,j,(int)cfgoptions[i].iptr[j]); - } - } else { - notfound=1; - } + defval=config_setdefault_intlist(&(cfgoptions[i]),prefix); } break; case TYPE_DOUBLE: - config_check_valptr(&(cfgoptions[i]), (char **)&(cfgoptions[i].dblptr),sizeof(double)); if ( config_lookup_float(&(libconfig_privdata.cfg),cfgpath, &dbl)) { + config_check_valptr(&(cfgoptions[i]), (char **)&(cfgoptions[i].dblptr),sizeof(double)); *(cfgoptions[i].dblptr) = dbl; printf_params("[LIBCONFIG] %s: %lf\n", cfgpath,*(cfgoptions[i].dblptr) ); } else { - if( ((cfgoptions[i].paramflags & PARAMFLAG_MANDATORY) == 0)) { - *(cfgoptions[i].u64ptr)=cfgoptions[i].defdblval; - defval=1; - printf_params("[LIBCONFIG] %s set to default value %lf\n", cfgpath, *(cfgoptions[i].dblptr)); - } else { - notfound=1; - } + defval=config_setdefault_double(&(cfgoptions[i]),prefix); } break; case TYPE_IPV4ADDR: - config_check_valptr(&(cfgoptions[i]),(char **)&(cfgoptions[i].uptr), sizeof(int)); if ( !config_lookup_string(&(libconfig_privdata.cfg),cfgpath, (const char **)&str)) { - str=cfgoptions[i].defstrval; - defval=1; - printf_params("[LIBCONFIG] %s set to default value %s\n", cfgpath, str); - } - if (str != NULL) { - rst=inet_pton(AF_INET, str,cfgoptions[i].uptr ); - if (rst == 1 && *(cfgoptions[i].uptr) > 0) { - printf_params("[LIBCONFIG] %s: %s\n", cfgpath,str ); - } else { - if ( strncmp(str,ANY_IPV4ADDR_STRING,sizeof(ANY_IPV4ADDR_STRING)) == 0) { - printf_params("[LIBCONFIG] %s:%s (INADDR_ANY) \n",cfgpath,str); - *cfgoptions[i].uptr=INADDR_ANY; - } else { - fprintf(stderr,"[LIBCONFIG] %s not valid for %s \n", str, cfgpath); - fatalerror=1; - } + defval=config_setdefault_ipv4addr(&(cfgoptions[i]),prefix); + } else { + rst=config_assign_ipv4addr(cfgoptions, str); + if (rst < 0) { + fprintf(stderr,"[LIBCONFIG] %s not valid for %s \n", str, cfgpath); + fatalerror=1; } - } else { - notfound=1; - } - + } break; case TYPE_LIST: setting = config_setting_lookup (config_root_setting(&(libconfig_privdata.cfg)),cfgpath ); diff --git a/common/utils/T/T.c b/common/utils/T/T.c index acc44b0ff0..8679a4185f 100644 --- a/common/utils/T/T.c +++ b/common/utils/T/T.c @@ -169,19 +169,13 @@ int T_dont_fork; /* default is to fork, see 'T_init' to understand */ paramdef_t ttraceparams[] = CMDLINE_TTRACEPARAMS_DESC ; -/* compatibility: look for TTracer parameters in root section */ - config_get( ttraceparams,sizeof(ttraceparams)/sizeof(paramdef_t),NULL); +/* for a cleaner config file, TTracer params should be defined in a specific section... */ + config_get( ttraceparams,sizeof(ttraceparams)/sizeof(paramdef_t),TTRACER_CONFIG_PREFIX); + +/* compatibility: look for TTracer command line options in root section */ + config_process_cmdline( ttraceparams,sizeof(ttraceparams)/sizeof(paramdef_t),NULL); -/* but for a cleaner config file, TTracer params should be defined in a specific section... */ - int ret = config_get( ttraceparams,sizeof(ttraceparams)/sizeof(paramdef_t),TTRACER_CONFIG_PREFIX); - if (ret <0) { - printf( "TTracer configuration couldn't be performed via config module\n"); - } if (T_stdout == 0) { T_init(T_port, 1-T_nowait, T_dont_fork); - } else { - for( int i=0 ; i<T_NUMBER_OF_IDS ; i++ ) { - T_active[i] = T_ACTIVE_STDOUT; - } } } diff --git a/common/utils/T/local_tracer.c b/common/utils/T/local_tracer.c index 43680b4099..c331daa4a9 100644 --- a/common/utils/T/local_tracer.c +++ b/common/utils/T/local_tracer.c @@ -367,20 +367,24 @@ void T_local_tracer_main(int remote_port, int wait_for_tracer, int port = remote_port; int dont_wait = wait_for_tracer ? 0 : 1; void *f; - + printf("local tracer starting\n"); /* write on a socket fails if the other end is closed and we get SIGPIPE */ - if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) abort(); + if (signal(SIGPIPE, SIG_IGN) == SIG_ERR){ + printf("local tracer received SIGPIPE\n"); + abort(); + } init_shm(shm_file); s = local_socket; - + printf("local tracer starting step 2\n"); if (dont_wait) { char t = 2; + printf("local tracer in no wait mode \n"); if (write(s, &t, 1) != 1) abort(); } - + printf("local tracer starting step 3\n"); f = forwarder(port, s); - + printf("local tracer main loop.... \n"); /* read messages */ while (1) { wait_message(); diff --git a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.c b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.c index cd92cf2c5e..9405fb7ec1 100644 --- a/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.c +++ b/openair2/LAYER2/RLC/UM_v9.3.0/rlc_um_dar.c @@ -32,7 +32,6 @@ #include "list.h" #include "UTIL/LOG/log.h" #include "UTIL/LOG/vcd_signal_dumper.h" - //----------------------------------------------------------------------------- signed int rlc_um_get_pdu_infos( const protocol_ctxt_t* const ctxt_pP, diff --git a/openair2/UTIL/LOG/log.h b/openair2/UTIL/LOG/log.h index 9a89b7f0c0..642c7b9a3d 100644 --- a/openair2/UTIL/LOG/log.h +++ b/openair2/UTIL/LOG/log.h @@ -300,7 +300,7 @@ int register_log_component(char *name, char *fext, int compidx); * @{*/ #define logIt(component, level, format, args...) (g_log->log_component[component].interval?logRecord_mt(__FILE__, __FUNCTION__, __LINE__, component, level, format, ##args):(void)0) -#define logItS(component, level, format, args...) (g_log->log_component[component].interval?logRecord(__FILE__, __FUNCTION__, __LINE__, component, level, format, ##args):(void)0) + /* @}*/ @@ -346,43 +346,29 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int // debugging macros(g_log->log_component[component].interval?logRecord_mt(__FILE__, __FUNCTION__, __LINE__, component, level, format, ##args):(void)0) # if T_TRACER # include "T.h" -# define LOG_I(c, x...) do { if (T_active[c] == T_ACTIVE_STDOUT) { logIt(c, LOG_INFO, x) ;} else { T(T_LEGACY_ ## c ## _INFO, T_PRINTF(x)) ;}} while (0) -# define LOG_W(c, x...) do { if (T_active[c] == T_ACTIVE_STDOUT) { logIt(c, LOG_WARNING, x) ;} else { T(T_LEGACY_ ## c ## _WARNING, T_PRINTF(x)) ;}} while (0) -# define LOG_E(c, x...) do { if (T_active[c] == T_ACTIVE_STDOUT) { logIt(c, LOG_ERR, x) ;} else { T(T_LEGACY_ ## c ## _ERROR, T_PRINTF(x)) ;}} while (0) -# define LOG_D(c, x...) do { if (T_active[c] == T_ACTIVE_STDOUT) { logIt(c, LOG_DEBUG, x) ;} else { T(T_LEGACY_ ## c ## _DEBUG, T_PRINTF(x)) ;}} while (0) -# define LOG_T(c, x...) do { if (T_active[c] == T_ACTIVE_STDOUT) { logIt(c, LOG_TRACE, x) ;} else { T(T_LEGACY_ ## c ## _TRACE, T_PRINTF(x)) ;}} while (0) -# define LOG_G(c, x...) do { if (T_active[c] == T_ACTIVE_STDOUT) { logIt(c, LOG_EMERG, x) ;}} while (0) /* */ -# define LOG_A(c, x...) do { if (T_active[c] == T_ACTIVE_STDOUT) { logIt(c, LOG_ALERT, x) ;}} while (0) /* */ -# define LOG_C(c, x...) do { if (T_active[c] == T_ACTIVE_STDOUT) { logIt(c, LOG_CRIT, x) ;}} while (0) /* */ -# define LOG_N(c, x...) do { if (T_active[c] == T_ACTIVE_STDOUT) { logIt(c, LOG_NOTICE, x) ;}} while (0) /* */ -# define LOG_F(c, x...) do { if (T_active[c] == T_ACTIVE_STDOUT) { logIt(c, LOG_FILE, x) ;}} while (0) /* */ +# define LOG_I(c, x...) do { if (T_stdout) { logIt(c, LOG_INFO, x) ;} else { T(T_LEGACY_ ## c ## _INFO, T_PRINTF(x)) ;}} while (0) +# define LOG_W(c, x...) do { if (T_stdout) { logIt(c, LOG_WARNING, x) ;} else { T(T_LEGACY_ ## c ## _WARNING, T_PRINTF(x)) ;}} while (0) +# define LOG_E(c, x...) do { if (T_stdout) { logIt(c, LOG_ERR, x) ;} else { T(T_LEGACY_ ## c ## _ERROR, T_PRINTF(x)) ;}} while (0) +# define LOG_D(c, x...) do { if (T_stdout) { logIt(c, LOG_DEBUG, x) ;} else { T(T_LEGACY_ ## c ## _DEBUG, T_PRINTF(x)) ;}} while (0) +# define LOG_T(c, x...) do { if (T_stdout) { logIt(c, LOG_TRACE, x) ;} else { T(T_LEGACY_ ## c ## _TRACE, T_PRINTF(x)) ;}} while (0) +# define LOG_G(c, x...) do { if (T_stdout) { logIt(c, LOG_EMERG, x) ;}} while (0) /* */ +# define LOG_A(c, x...) do { if (T_stdout) { logIt(c, LOG_ALERT, x) ;}} while (0) /* */ +# define LOG_C(c, x...) do { if (T_stdout) { logIt(c, LOG_CRIT, x) ;}} while (0) /* */ +# define LOG_N(c, x...) do { if (T_stdout) { logIt(c, LOG_NOTICE, x) ;}} while (0) /* */ +# define LOG_F(c, x...) do { if (T_stdout) { logIt(c, LOG_FILE, x) ;}} while (0) /* */ # define LOG_M(file, vector, data, len, dec, format) write_file_matlab(file, vector, data, len, dec, format)/* */ # else /* T_TRACER */ -# if DISABLE_LOG_X -# define LOG_I(c, x...) /* */ -# define LOG_W(c, x...) /* */ -# define LOG_E(c, x...) /* */ -# define LOG_D(c, x...) /* */ -# define LOG_T(c, x...) /* */ -# define LOG_G(c, x...) /* */ -# define LOG_A(c, x...) /* */ -# define LOG_C(c, x...) /* */ -# define LOG_N(c, x...) /* */ -# define LOG_F(c, x...) /* */ -# define LOG_M(file, vector, data, len, dec, format) /* */ -# else /*DISABLE_LOG_X*/ -# define LOG_G(c, x...) logIt(c, LOG_EMERG, x) -# define LOG_A(c, x...) logIt(c, LOG_ALERT, x) -# define LOG_C(c, x...) logIt(c, LOG_CRIT, x) -# define LOG_E(c, x...) logIt(c, LOG_ERR, x) -# define LOG_W(c, x...) logIt(c, LOG_WARNING, x) -# define LOG_N(c, x...) logIt(c, LOG_NOTICE, x) -# define LOG_I(c, x...) logIt(c, LOG_INFO, x) -# define LOG_D(c, x...) logIt(c, LOG_DEBUG, x) -# define LOG_F(c, x...) logIt(c, LOG_FILE, x) // log to a file, useful for the MSC chart generation -# define LOG_T(c, x...) logIt(c, LOG_TRACE, x) -# define LOG_M(file, vector, data, len, dec, format) write_file_matlab(file, vector, data, len, dec, format) -# endif /*DISABLE_LOG_X*/ +# define LOG_I(c, x...) /* */ +# define LOG_W(c, x...) /* */ +# define LOG_E(c, x...) /* */ +# define LOG_D(c, x...) /* */ +# define LOG_T(c, x...) /* */ +# define LOG_G(c, x...) /* */ +# define LOG_A(c, x...) /* */ +# define LOG_C(c, x...) /* */ +# define LOG_N(c, x...) /* */ +# define LOG_F(c, x...) /* */ +# define LOG_M(file, vector, data, len, dec, format) /* */ # endif /* T_TRACER */ /* @}*/ diff --git a/openair2/UTIL/LOG/vcd_signal_dumper.h b/openair2/UTIL/LOG/vcd_signal_dumper.h index a47cdc059d..7e544424ec 100644 --- a/openair2/UTIL/LOG/vcd_signal_dumper.h +++ b/openair2/UTIL/LOG/vcd_signal_dumper.h @@ -447,28 +447,13 @@ extern int ouput_vcd; #include "T.h" -#define VCD_SIGNAL_DUMPER_INIT(x) /* nothing */ -#define VCD_SIGNAL_DUMPER_CLOSE() /* nothing */ -#define VCD_SIGNAL_DUMPER_CREATE_HEADER() /* nothing */ #define VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(var, val) T_VCD_VARIABLE(var, val) #define VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(var, val) T_VCD_FUNCTION(var, val) - -#else /* T_TRACER */ - -#if defined(ENABLE_VCD) - #define VCD_SIGNAL_DUMPER_INIT(aRgUmEnT) vcd_signal_dumper_init(aRgUmEnT) - #define VCD_SIGNAL_DUMPER_CLOSE() vcd_signal_dumper_close() - #define VCD_SIGNAL_DUMPER_CREATE_HEADER() vcd_signal_dumper_create_header() - #define VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(vAr1,vAr2) vcd_signal_dumper_dump_variable_by_name(vAr1,vAr2) - #define VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(vAr1,vAr2) vcd_signal_dumper_dump_function_by_name(vAr1,vAr2) #else - #define VCD_SIGNAL_DUMPER_INIT(aRgUmEnT) - #define VCD_SIGNAL_DUMPER_CLOSE() - #define VCD_SIGNAL_DUMPER_CREATE_HEADER() - #define VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(vAr1,vAr2) - #define VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(vAr1,vAr2) -#endif +#define VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(var, val) +#define VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(var, val) + #endif /* T_TRACER */ #endif /* !defined (VCD_SIGNAL_DUMPER_H_) */ diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index dac53fc3f0..d844a1c6ab 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -937,10 +937,6 @@ int main( int argc, char **argv ) exit_fun("[SOFTMODEM] Error, configuration module init failed\n"); } -#ifdef DEBUG_CONSOLE - setvbuf(stdout, NULL, _IONBF, 0); - setvbuf(stderr, NULL, _IONBF, 0); -#endif mode = normal_txrx; memset(&openair0_cfg[0],0,sizeof(openair0_config_t)*MAX_CARDS); @@ -971,11 +967,6 @@ int main( int argc, char **argv ) printf("configuring for RAU/RRU\n"); - - if (ouput_vcd) { - VCD_SIGNAL_DUMPER_INIT("/tmp/openair_dump_eNB.vcd"); - } - if (opp_enabled ==1) { reset_opp_meas(); } @@ -1331,8 +1322,6 @@ int main( int argc, char **argv ) RC.ru[ru_id]->ifdevice.trx_end_func = NULL; } } - if (ouput_vcd) - VCD_SIGNAL_DUMPER_CLOSE(); if (opt_enabled == 1) terminate_opt(); diff --git a/targets/RT/USER/lte-softmodem.h b/targets/RT/USER/lte-softmodem.h index 10e9d420ff..2e1d7f24f3 100644 --- a/targets/RT/USER/lte-softmodem.h +++ b/targets/RT/USER/lte-softmodem.h @@ -83,7 +83,6 @@ #define CONFIG_HLP_UE "Set the lte softmodem as a UE\n" #define CONFIG_HLP_L2MONW "Enable L2 wireshark messages on localhost \n" #define CONFIG_HLP_L2MONP "Enable L2 pcap messages on localhost \n" -#define CONFIG_HLP_VCD "Enable VCD (generated file will is named openair_dump_eNB.vcd, read it with target/RT/USER/eNB.gtkw\n" #define CONFIG_HLP_TQFS "Apply three-quarter of sampling frequency, 23.04 Msps to reduce the data rate on USB/PCIe transfers (only valid for 20 MHz)\n" #define CONFIG_HLP_TPORT "tracer port\n" #define CONFIG_HLP_NOTWAIT "don't wait for tracer, start immediately\n" @@ -177,7 +176,6 @@ {"t" , CONFIG_HLP_ULMCS, 0, uptr:&target_ul_mcs, defintval:0, TYPE_UINT, 0}, \ {"W" , CONFIG_HLP_L2MONW, 0, strptr:(char **)&in_ip, defstrval:"127.0.0.1", TYPE_STRING, sizeof(in_ip)}, \ {"P" , CONFIG_HLP_L2MONP, 0, strptr:(char **)&in_path, defstrval:"/tmp/oai_opt.pcap", TYPE_STRING, sizeof(in_path)}, \ -{"V" , CONFIG_HLP_VCD, PARAMFLAG_BOOL, iptr:&ouput_vcd, defintval:0, TYPE_INT, 0}, \ {"q" , CONFIG_HLP_STMON, PARAMFLAG_BOOL, iptr:&opp_enabled, defintval:0, TYPE_INT, 0}, \ {"S" , CONFIG_HLP_MSLOTS, PARAMFLAG_BOOL, u8ptr:&exit_missed_slots, defintval:1, TYPE_UINT8, 0}, \ {"T" , CONFIG_HLP_TDD, PARAMFLAG_BOOL, iptr:&tddflag, defintval:0, TYPE_INT, 0}, \ diff --git a/targets/RT/USER/lte-uesoftmodem.c b/targets/RT/USER/lte-uesoftmodem.c index 27fe6ebe8a..9da65c32fe 100644 --- a/targets/RT/USER/lte-uesoftmodem.c +++ b/targets/RT/USER/lte-uesoftmodem.c @@ -793,10 +793,6 @@ int main( int argc, char **argv ) exit_fun("[SOFTMODEM] Error, configuration module init failed\n"); } -#ifdef DEBUG_CONSOLE - setvbuf(stdout, NULL, _IONBF, 0); - setvbuf(stderr, NULL, _IONBF, 0); -#endif PHY_VARS_UE *UE[MAX_NUM_CCs]; @@ -852,11 +848,6 @@ int main( int argc, char **argv ) # endif #endif - - if (ouput_vcd) { - VCD_SIGNAL_DUMPER_INIT("/tmp/openair_dump_UE.vcd"); - } - cpuf=get_cpu_freq_GHz(); #if defined(ENABLE_ITTI) @@ -1252,9 +1243,6 @@ int main( int argc, char **argv ) if (PHY_vars_UE_g[0][0]->rfdevice.trx_end_func) PHY_vars_UE_g[0][0]->rfdevice.trx_end_func(&PHY_vars_UE_g[0][0]->rfdevice); - if (ouput_vcd) - VCD_SIGNAL_DUMPER_CLOSE(); - if (opt_enabled == 1) terminate_opt(); -- GitLab