Merge branch 'RU-RAU-split' of https://gitlab.eurecom.fr/oai/openairinterface5g into RU-RAU-split
Conflicts: openair1/PHY/INIT/lte_init.c openair1/PHY/LTE_TRANSPORT/dlsch_coding.c openair1/PHY/LTE_TRANSPORT/prach.c openair1/SCHED/phy_procedures_lte_eNb.c openair2/ENB_APP/enb_config.c openair2/LAYER2/MAC/defs.h openair2/LAYER2/MAC/eNB_scheduler.c openair2/LAYER2/MAC/eNB_scheduler_RA.c openair2/LAYER2/MAC/eNB_scheduler_bch.c openair2/LAYER2/MAC/eNB_scheduler_primitives.c openair2/LAYER2/MAC/eNB_scheduler_ulsch.c openair2/LAYER2/MAC/rar_tools.c openair2/RRC/LITE/MESSAGES/asn1_msg.c openair2/RRC/LITE/rrc_eNB.c
This commit is contained in:
+64
-5
@@ -33,7 +33,7 @@
|
||||
|
||||
#define COMPONENT_LOG
|
||||
#define COMPONENT_LOG_IF
|
||||
|
||||
#include <ctype.h>
|
||||
#include "log.h"
|
||||
#include "vcd_signal_dumper.h"
|
||||
#include "assertions.h"
|
||||
@@ -53,7 +53,7 @@
|
||||
# define FIFO_PRINTF_NO 62
|
||||
# define FIFO_PRINTF_SIZE 65536
|
||||
#endif
|
||||
|
||||
#include "common/config/config_userapi.h"
|
||||
// main log variables
|
||||
log_t *g_log;
|
||||
|
||||
@@ -103,6 +103,65 @@ static char *log_level_highlight_end[] = {LOG_RESET, LOG_RESET, LOG_RESET, LOG
|
||||
static log_instance_type_t log_instance_type;
|
||||
#endif
|
||||
|
||||
/* get log parameters from configuration file */
|
||||
void log_getconfig(log_t *g_log) {
|
||||
char *gloglevel = NULL;
|
||||
char *glogverbo = NULL;
|
||||
int level,verbosity;
|
||||
paramdef_t logparams_defaults[] = LOG_GLOBALPARAMS_DESC;
|
||||
paramdef_t logparams_level[MAX_LOG_COMPONENTS];
|
||||
paramdef_t logparams_verbosity[MAX_LOG_COMPONENTS];
|
||||
paramdef_t logparams_logfile[MAX_LOG_COMPONENTS];
|
||||
|
||||
int ret = config_get( logparams_defaults,sizeof(logparams_defaults)/sizeof(paramdef_t),CONFIG_STRING_LOG_PREFIX);
|
||||
if (ret <0) {
|
||||
fprintf(stderr,"[LOG] init aborted, configuration couldn't be performed");
|
||||
return;
|
||||
}
|
||||
memset(logparams_level, 0, sizeof(paramdef_t)*MAX_LOG_COMPONENTS);
|
||||
memset(logparams_verbosity,0, sizeof(paramdef_t)*MAX_LOG_COMPONENTS);
|
||||
memset(logparams_logfile, 0, sizeof(paramdef_t)*MAX_LOG_COMPONENTS);
|
||||
for (int i=MIN_LOG_COMPONENTS; i < MAX_LOG_COMPONENTS; i++) {
|
||||
if(g_log->log_component[i].name == NULL) {
|
||||
g_log->log_component[i].name = malloc(16);
|
||||
sprintf((char *)g_log->log_component[i].name,"comp%i?",i);
|
||||
logparams_logfile[i].paramflags = PARAMFLAG_DONOTREAD;
|
||||
logparams_level[i].paramflags = PARAMFLAG_DONOTREAD;
|
||||
logparams_verbosity[i].paramflags = PARAMFLAG_DONOTREAD;
|
||||
}
|
||||
sprintf(logparams_level[i].optname, LOG_CONFIG_LEVEL_FORMAT, g_log->log_component[i].name);
|
||||
sprintf(logparams_verbosity[i].optname,LOG_CONFIG_VERBOSITY_FORMAT, g_log->log_component[i].name);
|
||||
sprintf(logparams_logfile[i].optname, LOG_CONFIG_LOGFILE_FORMAT, g_log->log_component[i].name);
|
||||
/* workaround: all log options in existing configuration files use lower case component names
|
||||
where component names include uppercase char in log.h.... */
|
||||
for (int j=0 ; j<strlen(logparams_level[i].optname); j++)
|
||||
logparams_level[i].optname[j] = tolower(logparams_level[i].optname[j]);
|
||||
for (int j=0 ; j<strlen(logparams_level[i].optname); j++)
|
||||
logparams_verbosity[i].optname[j] = tolower(logparams_verbosity[i].optname[j]);
|
||||
for (int j=0 ; j<strlen(logparams_level[i].optname); j++)
|
||||
logparams_logfile[i].optname[j] = tolower(logparams_logfile[i].optname[j]);
|
||||
/* */
|
||||
logparams_level[i].defstrval = gloglevel;
|
||||
logparams_verbosity[i].defstrval = glogverbo;
|
||||
|
||||
logparams_level[i].type = TYPE_STRING;
|
||||
logparams_verbosity[i].type = TYPE_STRING;
|
||||
logparams_logfile[i].type = TYPE_UINT;
|
||||
|
||||
logparams_logfile[i].paramflags = logparams_logfile[i].paramflags|PARAMFLAG_BOOL;
|
||||
}
|
||||
config_get( logparams_level, MAX_LOG_COMPONENTS,CONFIG_STRING_LOG_PREFIX);
|
||||
config_get( logparams_verbosity,MAX_LOG_COMPONENTS,CONFIG_STRING_LOG_PREFIX);
|
||||
config_get( logparams_logfile, MAX_LOG_COMPONENTS,CONFIG_STRING_LOG_PREFIX);
|
||||
for (int i=MIN_LOG_COMPONENTS; i < MAX_LOG_COMPONENTS; i++) {
|
||||
verbosity = map_str_to_int(log_verbosity_names,*(logparams_verbosity[i].strptr));
|
||||
level = map_str_to_int(log_level_names, *(logparams_level[i].strptr));
|
||||
set_comp_log(i, level,verbosity,1);
|
||||
set_component_filelog(*(logparams_logfile[i].uptr));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int logInit (void)
|
||||
{
|
||||
#ifdef USER_MODE
|
||||
@@ -441,7 +500,7 @@ int logInit (void)
|
||||
openlog(g_log->log_component[EMU].name, LOG_PID, g_log->config.facility);
|
||||
#endif // ! defined(CN_BUILD)
|
||||
}
|
||||
|
||||
log_getconfig(g_log);
|
||||
if (g_log->filelog) {
|
||||
gfd = open(g_log->filelog_name, O_WRONLY | O_CREAT, 0666);
|
||||
}
|
||||
@@ -1319,8 +1378,8 @@ int set_comp_log(int component, int level, int verbosity, int interval)
|
||||
|
||||
void set_glog(int level, int verbosity)
|
||||
{
|
||||
g_log->level = level;
|
||||
g_log->flag = verbosity;
|
||||
if( g_log->level >= 0) g_log->level = level;
|
||||
if( g_log->flag >= 0) g_log->flag = verbosity;
|
||||
}
|
||||
void set_glog_syslog(int enable)
|
||||
{
|
||||
|
||||
+55
-13
@@ -45,6 +45,9 @@
|
||||
#include <stdarg.h>
|
||||
#include <time.h>
|
||||
#include <stdint.h>
|
||||
#ifndef __STDC_FORMAT_MACROS
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#endif
|
||||
#include <inttypes.h>
|
||||
#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
@@ -265,8 +268,9 @@ int set_comp_log(int component, int level, int verbosity, int interval);
|
||||
int set_log(int component, int level, int interval);
|
||||
void set_glog(int level, int verbosity);
|
||||
void set_log_syslog(int enable);
|
||||
void set_log_onlinelog(int enable);
|
||||
void set_log_filelog(int enable);
|
||||
void set_glog_onlinelog(int enable);
|
||||
void set_glog_filelog(int enable);
|
||||
|
||||
void set_component_filelog(int comp);
|
||||
int map_str_to_int(mapping *map, const char *str);
|
||||
char *map_int_to_str(mapping *map, int val);
|
||||
@@ -294,7 +298,28 @@ void *log_thread_function(void * list);
|
||||
#endif
|
||||
/* @}*/
|
||||
|
||||
/*----------------macro definitions for reading log configuration from the config module */
|
||||
#define CONFIG_STRING_LOG_PREFIX "log_config"
|
||||
|
||||
#define LOG_CONFIG_STRING_GLOBAL_LOG_LEVEL "global_log_level"
|
||||
#define LOG_CONFIG_STRING_GLOBAL_LOG_VERBOSITY "global_log_verbosity"
|
||||
#define LOG_CONFIG_STRING_GLOBAL_LOG_ONLINE "global_log_online"
|
||||
#define LOG_CONFIG_STRING_GLOBAL_LOG_INFILE "global_log_infile"
|
||||
|
||||
#define LOG_CONFIG_LEVEL_FORMAT "%s_log_level"
|
||||
#define LOG_CONFIG_VERBOSITY_FORMAT "%s_log_verbosity"
|
||||
#define LOG_CONFIG_LOGFILE_FORMAT "%s_log_infile"
|
||||
/*--------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/* LOG globalconfiguration parameters */
|
||||
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
||||
/*--------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
#define LOG_GLOBALPARAMS_DESC { \
|
||||
{LOG_CONFIG_STRING_GLOBAL_LOG_LEVEL, NULL, 0, strptr:(char **)&gloglevel, defstrval:log_level_names[2].name, TYPE_STRING, sizeof(gloglevel)}, \
|
||||
{LOG_CONFIG_STRING_GLOBAL_LOG_VERBOSITY,NULL, 0, strptr:(char **)&glogverbo, defstrval:log_verbosity_names[2].name, TYPE_STRING, sizeof(glogverbo)}, \
|
||||
{LOG_CONFIG_STRING_GLOBAL_LOG_ONLINE, NULL, 0, iptr:&(g_log->onlinelog), defintval:1, TYPE_INT, 0, }, \
|
||||
{LOG_CONFIG_STRING_GLOBAL_LOG_INFILE, NULL, 0, iptr:&(g_log->filelog), defintval:0, TYPE_INT, 0, }, \
|
||||
}
|
||||
/*----------------------------------------------------------------------------------*/
|
||||
/** @defgroup _debugging debugging macros
|
||||
* @ingroup _macro
|
||||
* @brief Macro used to call logIt function with different message levels
|
||||
@@ -315,16 +340,29 @@ void *log_thread_function(void * list);
|
||||
# define LOG_N(c, x...) /* */
|
||||
# define LOG_F(c, x...) /* */
|
||||
# else /* T_TRACER */
|
||||
# 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)
|
||||
# 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...) /* */
|
||||
# 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)
|
||||
# endif /*DISABLE_LOG_X*/
|
||||
# endif /* T_TRACER */
|
||||
#else /* USER_MODE */
|
||||
# define LOG_G(c, x...) printk(x)
|
||||
@@ -408,7 +446,11 @@ static inline void printMeas(char * txt, Meas *M, int period) {
|
||||
M->iterations,
|
||||
M->maxArray[1],M->maxArray[2], M->maxArray[3],M->maxArray[4], M->maxArray[5],
|
||||
M->maxArray[6],M->maxArray[7], M->maxArray[8],M->maxArray[9],M->maxArray[10]);
|
||||
LOG_W(PHY,"%s",txt2);
|
||||
#if DISABLE_LOG_X
|
||||
printf("%s",txt2);
|
||||
#else
|
||||
LOG_W(PHY, "%s",txt2);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -185,16 +185,16 @@ const char* eurecomVariablesNames[] = {
|
||||
"ue0_SFN5",
|
||||
"ue0_SFN6",
|
||||
"ue0_SFN7",
|
||||
"send_if4_symbol",
|
||||
"recv_if4_symbol",
|
||||
"send_if5_pkt_id",
|
||||
"recv_if5_pkt_id",
|
||||
"ue_pdcp_flush_size",
|
||||
"ue_pdcp_flush_err",
|
||||
"ue0_trx_read_ns",
|
||||
"ue0_trx_write_ns",
|
||||
"ue0_trx_read_ns_missing",
|
||||
"ue0_trx_write_ns_missing"
|
||||
"send_if4_symbol",
|
||||
"recv_if4_symbol",
|
||||
"send_if5_pkt_id",
|
||||
"recv_if5_pkt_id"
|
||||
"ue0_trx_write_ns_missing",
|
||||
};
|
||||
|
||||
const char* eurecomFunctionsNames[] = {
|
||||
@@ -398,10 +398,10 @@ const char* eurecomFunctionsNames[] = {
|
||||
"recv_if5",
|
||||
|
||||
"compress_if",
|
||||
"decompress_if"
|
||||
"decompress_if",
|
||||
};
|
||||
|
||||
struct vcd_module_s vcd_modules[VCD_SIGNAL_DUMPER_MODULE_END] = {
|
||||
struct vcd_module_s vcd_modules[] = {
|
||||
{ "variables", VCD_SIGNAL_DUMPER_VARIABLES_END, eurecomVariablesNames, VCD_WIRE, 64 },
|
||||
{ "functions", VCD_SIGNAL_DUMPER_FUNCTIONS_END, eurecomFunctionsNames, VCD_WIRE, 1 },
|
||||
// { "ue_procedures_functions", VCD_SIGNAL_DUMPER_UE_PROCEDURES_FUNCTIONS_END, eurecomUEFunctionsNames, VCD_WIRE, 1 },
|
||||
@@ -702,7 +702,7 @@ void vcd_signal_dumper_create_header(void)
|
||||
fprintf(vcd_fd, "$timescale 1 ns $end\n");
|
||||
|
||||
/* Initialize each module definition */
|
||||
for(i = 0; i < VCD_SIGNAL_DUMPER_MODULE_END; i++) {
|
||||
for(i = 0; i < sizeof(vcd_modules) / sizeof(struct vcd_module_s); i++) {
|
||||
struct vcd_module_s *module;
|
||||
module = &vcd_modules[i];
|
||||
fprintf(vcd_fd, "$scope module %s $end\n", module->name);
|
||||
@@ -727,7 +727,7 @@ void vcd_signal_dumper_create_header(void)
|
||||
/* Init variables and functions to 0 */
|
||||
fprintf(vcd_fd, "$dumpvars\n");
|
||||
|
||||
for(i = 0; i < VCD_SIGNAL_DUMPER_MODULE_END; i++) {
|
||||
for(i = 0; i < sizeof(vcd_modules) / sizeof(struct vcd_module_s); i++) {
|
||||
struct vcd_module_s *module;
|
||||
module = &vcd_modules[i];
|
||||
|
||||
|
||||
@@ -167,8 +167,7 @@ typedef enum {
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_TRX_WRITE_NS,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_TRX_READ_NS_MISSING,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_UE0_TRX_WRITE_NS_MISSING,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_LAST,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_END = VCD_SIGNAL_DUMPER_VARIABLES_LAST,
|
||||
VCD_SIGNAL_DUMPER_VARIABLES_END
|
||||
} vcd_signal_dump_variables;
|
||||
|
||||
typedef enum {
|
||||
@@ -377,8 +376,7 @@ typedef enum {
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_COMPR_IF,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_DECOMPR_IF,
|
||||
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_LAST,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_END = VCD_SIGNAL_DUMPER_FUNCTIONS_LAST,
|
||||
VCD_SIGNAL_DUMPER_FUNCTIONS_END
|
||||
} vcd_signal_dump_functions;
|
||||
|
||||
typedef enum {
|
||||
@@ -387,8 +385,6 @@ typedef enum {
|
||||
VCD_SIGNAL_DUMPER_MODULE_VARIABLES,
|
||||
VCD_SIGNAL_DUMPER_MODULE_FUNCTIONS,
|
||||
// VCD_SIGNAL_DUMPER_MODULE_UE_PROCEDURES_FUNCTIONS,
|
||||
VCD_SIGNAL_DUMPER_MODULE_LAST,
|
||||
VCD_SIGNAL_DUMPER_MODULE_END = VCD_SIGNAL_DUMPER_MODULE_LAST,
|
||||
} vcd_signal_dumper_modules;
|
||||
|
||||
typedef enum {
|
||||
|
||||
Reference in New Issue
Block a user