Commit e04b8241 authored by Cedric Roux's avatar Cedric Roux

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

Summary of changes:
- bug fixes in various places
parents 35ff6111 1cbd60e9
Pipeline #10253 failed with stage
in 0 seconds
......@@ -897,7 +897,7 @@ set(UTIL_SRC
${OPENAIR2_DIR}/UTIL/FIFO/pad_list.c
${OPENAIR2_DIR}/UTIL/LISTS/list.c
${OPENAIR2_DIR}/UTIL/LISTS/list2.c
${OPENAIR2_DIR}/UTIL/LOG/log.c
${OPENAIR_DIR}/common/utils/LOG/log.c
# ${OPENAIR2_DIR}/UTIL/LOG/vcd_signal_dumper.c
${OPENAIR2_DIR}/UTIL/MATH/oml.c
${OPENAIR2_DIR}/UTIL/MEM/mem_block.c
......@@ -1214,7 +1214,12 @@ set(PHY_MEX_UE
${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation_avx2.c
${OPENAIR1_DIR}/PHY/TOOLS/signal_energy.c
${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_ue_measurements.c
${OPENAIR2_DIR}/UTIL/LOG/log.c
${OPENAIR_DIR}/common/utils/LOG/log.c
${OPENAIR_DIR}/common/utils/T/T.c
${OPENAIR_DIR}/common/utils/T/local_tracer.c
${OPENAIR_DIR}/common/config/config_cmdline.c
${OPENAIR_DIR}/common/config/config_userapi.c
${OPENAIR_DIR}/common/config/config_load_configmodule.c
)
add_library(PHY_MEX ${PHY_MEX_UE})
......@@ -2175,14 +2180,14 @@ if (${T_TRACER})
#all "add_executable" definitions (except tests, rb_tool, updatefw)
lte-softmodem lte-softmodem-nos1 lte-uesoftmodem lte-uesoftmodem-nos1
dlsim_tm4 dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim
pdcchsim pucchsim prachsim syncsim
pdcchsim pucchsim prachsim syncsim ulsim
#all "add_library" definitions
ITTI RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB
oai_exmimodevif oai_usrpdevif oai_bladerfdevif oai_lmssdrdevif
oai_eth_transpro
FLPT_MSG ASYNC_IF FLEXRAN_AGENT HASHTABLE MSC UTIL OMG_SUMO SECU_OSA
SECU_CN SCHED_LIB PHY L2 default_sched remote_sched RAL CN_UTILS
GTPV1U SCTP_CLIENT UDP LIB_NAS_UE LFDS LFDS7 SIMU OPENAIR0_LIB)
GTPV1U SCTP_CLIENT UDP LIB_NAS_UE LFDS LFDS7 SIMU OPENAIR0_LIB PHY_MEX)
if (TARGET ${i})
add_dependencies(${i} generate_T)
endif()
......
......@@ -508,7 +508,9 @@ function main() {
lte_exec=lte-uesoftmodem
fi
fi
if [ "$T_TRACER" = "False" ] ; then
lte_build_dir=${lte_build_dir}_noLOG
fi
# configuration module libraries, one currently available, using libconfig
config_libconfig_shlib=params_libconfig
......
......@@ -37,6 +37,35 @@
#include <errno.h>
#include "config_userapi.h"
void parse_stringlist(paramdef_t *cfgoptions, char *val)
{
char *atoken;
char *tokctx;
char *tmpval=strdup(val);
int numelt=0;
cfgoptions->numelt=0;
atoken=strtok_r(tmpval, ",",&tokctx);
while(atoken != NULL) {
numelt++ ;
atoken=strtok_r(NULL, ",",&tokctx);
}
free(tmpval);
config_check_valptr(cfgoptions,(char **)&(cfgoptions->strlistptr), sizeof(char *) * numelt);
cfgoptions->numelt=numelt;
atoken=strtok_r(val, ",",&tokctx);
for( int i=0; i<cfgoptions->numelt && atoken != NULL ; i++) {
config_check_valptr(cfgoptions,&(cfgoptions->strlistptr[i]),strlen(atoken)+1);
sprintf(cfgoptions->strlistptr[i],"%s",atoken);
printf_params("[LIBCONFIG] %s[%i]: %s\n", cfgoptions->optname,i,cfgoptions->strlistptr[i]);
atoken=strtok_r(NULL, ",",&tokctx);
}
cfgoptions->numelt=numelt;
}
int processoption(paramdef_t *cfgoptions, char *value)
{
char *tmpval = value;
......@@ -66,6 +95,7 @@ char defbool[2]="1";
break;
case TYPE_STRINGLIST:
parse_stringlist(cfgoptions,tmpval);
break;
case TYPE_UINT32:
case TYPE_INT32:
......@@ -140,7 +170,7 @@ char *cfgpath;
exit_fun("[CONFIG] Exiting after displaying help\n");
}
} else {
pp=strtok_r(NULL, "_",&tokctx);
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);
......@@ -167,17 +197,19 @@ char *cfgpath;
((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;
}
if (c > 0) {
pp = config_get_if()->argv[i+1];
if (pp != NULL ) {
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);
j += processoption(&(cfgoptions[n]), valptr);
if ( valptr != NULL ) {
i++;
c--;
......
......@@ -23,15 +23,8 @@
extern log_t *g_log;
#if !defined(LOG_NO_THREAD)
extern LOG_params log_list[2000];
extern pthread_mutex_t log_lock;
extern pthread_cond_t log_notify;
extern int log_shutdown;
#endif
extern mapping log_level_names[];
extern mapping log_verbosity_names[];
extern mapping log_options[];
extern mapping log_maskmap[];
extern int log_mem_flag;
extern char * log_mem_filename;
......@@ -749,7 +749,6 @@ ID = LEGACY_OSA_TRACE
DESC = OSA legacy logs - trace level
GROUP = ALL:LEGACY_OSA:LEGACY_GROUP_TRACE:LEGACY
FORMAT = string,log
ID = LEGACY_SIM_INFO
DESC = SIM legacy logs - info level
GROUP = ALL:LEGACY_SIM:LEGACY_GROUP_INFO:LEGACY
......@@ -770,7 +769,6 @@ ID = LEGACY_SIM_TRACE
DESC = SIM legacy logs - trace level
GROUP = ALL:LEGACY_SIM:LEGACY_GROUP_TRACE:LEGACY
FORMAT = string,log
# this is a bad hack but I won't fix (function util_print_hex_octets
# in openairinterface5g/openair2/LAYER2/PDCP_v10.1.0/pdcp_util.c
# does funky things with the LOG_x macros but we work on the C pre-processor
......
......@@ -174,7 +174,8 @@ void usage(void)
" -ip <host> connect to given IP address (default %s)\n"
" -p <port> connect to given port (default %d)\n"
" -b <event> <arg> <vcd name> trace as binary (0 off, anything else on)\n"
" -l <event> <arg> <vcd name> trace as uint64_t\n",
" -l <event> <arg> <vcd name> trace as uint64_t\n"
" -vcd trace all VCD variables and functions\n",
DEFAULT_REMOTE_IP,
DEFAULT_REMOTE_PORT
);
......@@ -192,6 +193,20 @@ void force_stop(int x)
run = 0;
}
vcd_vars *add_var(vcd_vars *vars, int nvars,
char *event, char *arg, char *vcd_name, int is_boolean)
{
if (nvars % 64 == 0) {
vars = realloc(vars, (nvars+64) * sizeof(vcd_vars));
if (vars == NULL) abort();
}
vars[nvars].event = event;
vars[nvars].arg = arg;
vars[nvars].vcd_name = vcd_name;
vars[nvars].boolean = is_boolean;
return vars;
}
int main(int n, char **v)
{
char *output_filename = NULL;
......@@ -202,11 +217,12 @@ int main(int n, char **v)
int *is_on;
int number_of_events;
int i;
vcd_vars vars[n];
vcd_vars *vars = NULL;
int nvars = 0;
view *vcd_view;
event_handler *h;
logger *textlog;
int all_vcd = 0;
/* write on a socket fails if the other end is closed and we get SIGPIPE */
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) abort();
......@@ -221,19 +237,22 @@ int main(int n, char **v)
if (!strcmp(v[i], "-p"))
{ if (i > n-2) usage(); port = atoi(v[++i]); continue; }
if (!strcmp(v[i], "-b")) { if(i>n-4)usage();
vars[nvars].event = v[++i];
vars[nvars].arg = v[++i];
vars[nvars].vcd_name = v[++i];
vars[nvars++].boolean = 1;
char *event = v[++i];
char *arg = v[++i];
char *vcd_name = v[++i];
vars = add_var(vars, nvars, event, arg, vcd_name, 1);
nvars++;
continue;
}
if (!strcmp(v[i], "-l")) { if(i>n-4)usage();
vars[nvars].event = v[++i];
vars[nvars].arg = v[++i];
vars[nvars].vcd_name = v[++i];
vars[nvars++].boolean = 0;
char *event = v[++i];
char *arg = v[++i];
char *vcd_name = v[++i];
vars = add_var(vars, nvars, event, arg, vcd_name, 0);
nvars++;
continue;
}
if (!strcmp(v[i], "-vcd")) { all_vcd = 1; continue; }
usage();
}
......@@ -260,11 +279,32 @@ int main(int n, char **v)
/* create the view */
vcd_view = new_view_vcd();
if (all_vcd) {
/* activate all VCD traces */
for (i = 0; i < number_of_events; i++) {
int is_boolean;
int prefix_length;
char *name = event_name_from_id(database, i);
char *var_prefix = "VCD_VARIABLE_";
char *fun_prefix = "VCD_FUNCTION_";
if (!strncmp(name, var_prefix, strlen(var_prefix))) {
prefix_length = strlen(var_prefix);
is_boolean = 0;
} else if (!strncmp(name, fun_prefix, strlen(fun_prefix))) {
prefix_length = strlen(fun_prefix);
is_boolean = 1;
} else
continue;
vars = add_var(vars, nvars,
name, "value", name+prefix_length, is_boolean);
nvars++;
}
}
/* setup traces */
for (i = 0; i < nvars; i++) {
char format[256];
if (strlen(vars[i].arg) > 256-3) abort();
if (strlen(vars[i].vcd_name) > 256-1) abort();
if (strlen(vars[i].arg) + strlen(vars[i].vcd_name) > 256-16) abort();
sprintf(format, "%c [%s] %s",
vars[i].boolean ? 'b' : 'l',
vars[i].arg,
......
......@@ -39,7 +39,6 @@ void output_log_mem(void);
#define _Assert_Exit_ \
{ \
fprintf(stderr, "\nExiting execution\n"); \
output_log_mem(); \
display_backtrace(); \
fflush(stdout); \
fflush(stderr); \
......
......@@ -117,19 +117,16 @@ int signal_handle(int *end)
case SIGUSR1:
SIG_DEBUG("Received SIGUSR1\n");
*end = 1;
output_log_mem();
break;
case SIGSEGV: /* Fall through */
case SIGABRT:
SIG_DEBUG("Received SIGABORT\n");
output_log_mem();
backtrace_handle_signal(&info);
break;
case SIGINT:
printf("Received SIGINT\n");
output_log_mem();
itti_send_terminate_message(TASK_UNKNOWN);
*end = 1;
break;
......
......@@ -32,7 +32,7 @@
#ifdef TELNETSRV_LOADER_MAIN
#include "UTIL/LOG/log.h"
#include "common/utils/LOG/log.h"
#include "common/utils/load_module_shlib.h"
......
......@@ -32,7 +32,7 @@
#ifdef TELNETSRV_PHYCMD_MAIN
#include "UTIL/LOG/log.h"
#include "common/utils/LOG/log.h"
#include "openair1/PHY/phy_extern.h"
......
......@@ -52,8 +52,7 @@
#define TELNETSERVERCODE
#include "telnetsrv.h"
#define TELNETSRV_PROCCMD_MAIN
#include "log.h"
#include "log_extern.h"
#include "common/utils/LOG/log.h"
#include "common/config/config_userapi.h"
#include "openair1/PHY/phy_extern.h"
#include "telnetsrv_proccmd.h"
......@@ -200,16 +199,30 @@ int proccmd_show(char *buf, int debug, telnet_printfunc_t prnt)
print_threads(buf,debug,prnt);
}
if (strcasestr(buf,"loglvl") != NULL) {
prnt("component verbosity level enabled\n");
prnt(" component level enabled\n");
for (int i=MIN_LOG_COMPONENTS; i < MAX_LOG_COMPONENTS; i++) {
if (g_log->log_component[i].name != NULL) {
prnt("%02i %17.17s:%10.10s%10.10s %s\n",i ,g_log->log_component[i].name,
map_int_to_str(log_verbosity_names,g_log->log_component[i].flag),
prnt("%02i %17.17s:%10.10s %s\n",i ,g_log->log_component[i].name,
map_int_to_str(log_level_names,g_log->log_component[i].level),
((g_log->log_component[i].interval>0)?"Y":"N") );
}
}
}
if (strcasestr(buf,"logopt") != NULL) {
prnt(" option enabled\n");
for (int i=0; log_options[i].name != NULL; i++) {
prnt("%02i %17.17s %10.10s \n",i ,log_options[i].name,
((g_log->flag & log_options[i].value)?"Y":"N") );
}
}
if (strcasestr(buf,"dbgopt") != NULL) {
prnt(" option debug matlab\n");
for (int i=0; log_maskmap[i].name != NULL ; i++) {
prnt("%02i %17.17s %5.5s %5.5s\n",i ,log_maskmap[i].name,
((g_log->debug_mask & log_maskmap[i].value)?"Y":"N"),
((g_log->matlab_mask & log_maskmap[i].value)?"Y":"N") );
}
}
if (strcasestr(buf,"config") != NULL) {
prnt("Command line arguments:\n");
for (int i=0; i < config_get_if()->argc; i++) {
......@@ -324,24 +337,76 @@ int s = sscanf(buf,"%ms %i-%i\n",&logsubcmd, &idx1,&idx2);
prnt("Available log levels: \n ");
for (int i=0; log_level_names[i].name != NULL; i++)
prnt("%s ",log_level_names[i].name);
prnt("\nAvailable verbosity: \n ");
for (int i=0; log_verbosity_names[i].name != NULL; i++)
prnt("%s ",log_verbosity_names[i].name);
prnt("\n");
prnt("Available display options: \n ");
for (int i=0; log_options[i].name != NULL; i++)
prnt("%s ",log_options[i].name);
prnt("\n");
prnt("Available debug or matlab options: \n ");
for (int i=0; log_maskmap[i].name != NULL; i++)
prnt("%s ",log_maskmap[i].name);
prnt("\n");
proccmd_show("loglvl",debug,prnt);
proccmd_show("logopt",debug,prnt);
proccmd_show("dbgopt",debug,prnt);
}
else if (strcasestr(logsubcmd,"help") != NULL) {
prnt(PROCCMD_LOG_HELP_STRING);
} else {
prnt("%s: wrong log command...\n",logsubcmd);
}
} else if ( s == 2 && logsubcmd != NULL) {
char *opt=NULL;
char *logparam=NULL;
int l;
int optbit;
l=sscanf(logsubcmd,"%m[^'_']_%ms",&logparam,&opt);
if (l == 2 && strcmp(logparam,"print") == 0){
optbit=map_str_to_int(log_options,opt);
if (optbit < 0) {
prnt("option %s unknown\n",opt);
} else {
if (idx1 > 0)
SET_LOG_OPTION(optbit);
else
CLEAR_LOG_OPTION(optbit);
proccmd_show("logopt",debug,prnt);
}
}
else if (l == 2 && strcmp(logparam,"debug") == 0){
optbit=map_str_to_int(log_maskmap,opt);
if (optbit < 0) {
prnt("debug flag %s unknown\n",opt);
} else {
if (idx1 > 0)
SET_LOG_DEBUG(optbit);
else
CLEAR_LOG_DEBUG(optbit);
proccmd_show("dbgopt",debug,prnt);
}
}
else if (l == 2 && strcmp(logparam,"matlab") == 0){
optbit=map_str_to_int(log_maskmap,opt);
if (optbit < 0) {
prnt("matlab flag %s unknown\n",opt);
} else {
if (idx1 > 0)
SET_LOG_MATLAB(optbit);
else
CLEAR_LOG_MATLAB(optbit);
proccmd_show("dbgopt",debug,prnt);
}
}
if (logparam != NULL) free(logparam);
if (opt != NULL) free(opt);
} else if ( s == 3 && logsubcmd != NULL) {
int level, verbosity, interval;
int level, interval;
char *tmpstr=NULL;
char *logparam=NULL;
int l;
level = verbosity = interval = -1;
level = interval = -1;
l=sscanf(logsubcmd,"%m[^'_']_%m[^'_']",&logparam,&tmpstr);
if (debug > 0)
prnt("l=%i, %s %s\n",l,((logparam==NULL)?"\"\"":logparam), ((tmpstr==NULL)?"\"\"":tmpstr));
......@@ -349,9 +414,6 @@ int s = sscanf(buf,"%ms %i-%i\n",&logsubcmd, &idx1,&idx2);
if (strcmp(logparam,"level") == 0) {
level=map_str_to_int(log_level_names,tmpstr);
if (level < 0) prnt("level %s unknown\n",tmpstr);
} else if (strcmp(logparam,"verbos") == 0) {
verbosity=map_str_to_int(log_verbosity_names,tmpstr);
if (verbosity < 0) prnt("verbosity %s unknown\n",tmpstr);
} else {
prnt("%s%s unknown log sub command \n",logparam, tmpstr);
}
......@@ -372,17 +434,13 @@ int s = sscanf(buf,"%ms %i-%i\n",&logsubcmd, &idx1,&idx2);
if (level < 0) {
level=g_log->log_component[i].level;
}
if (verbosity < 0) {
verbosity=g_log->log_component[i].flag;
}
if (interval < 0) {
interval=g_log->log_component[i].interval;
}
set_comp_log(i, level, verbosity, interval);
prnt("log level/verbosity comp %i %s set to %s / %s (%s)\n",
set_log(i, level, interval);
prnt("log level comp %i %s set to %s (%s)\n",
i,((g_log->log_component[i].name==NULL)?"":g_log->log_component[i].name),
map_int_to_str(log_level_names,g_log->log_component[i].level),
map_int_to_str(log_verbosity_names,g_log->log_component[i].flag),
((g_log->log_component[i].interval>0)?"enabled":"disabled"));
......
......@@ -49,9 +49,12 @@ telnetshell_vardef_t proc_vardef[] = {
online, noonline: enable or disable console logs \n\
enable, disable id1-id2: enable or disable logs for components index id1 to id2 \n\
level_<level> id1-id2: set log level to <level> for components index id1 to id2 \n\
level_<verbosity> id1-id2: set log verbosity to <verbosity> for components index id1 to id2 \n\
use the show command to get the values for <level>, <verbosity> and the list of component indexes \
that can be used for id1 and id2 \n"
use the show command to get the authorized values for <level> and the list of component \
indexes that can be used for id1 and id2 \n\
print_<opt> <0|1> disable or enable the \"opt\" log option, use the show command to get \
the available options\n\
matlab_<opt> debug_<func> disable or enable the debug code or matlab file generation \
for \"func\" function. use the show command to get the available options\n"
#define PROCCMD_THREAD_HELP_STRING " thread sub commands: \n\
<thread id> aff <core> : set affinity of thread <thread id> to core <core> \n\
......
......@@ -47,7 +47,7 @@ extern RAN_CONTEXT_t RC;
#include <vendor_ext.h>
#include "fapi_stub.h"
//#include "fapi_l1.h"
#include "UTIL/LOG/log.h"
#include "common/utils/LOG/log.h"
#include "openair2/LAYER2/MAC/mac_proto.h"
#include "PHY/INIT/phy_init.h"
......@@ -193,26 +193,25 @@ typedef struct {
static pnf_info pnf;
static pthread_t pnf_start_pthread;
extern void nfapi_log(char *file, char *func, int line, int comp, int level, const char* format, va_list args);
int nfapitooai_level(int nfapi_level) {
switch(nfapi_level) {
case NFAPI_TRACE_ERROR:
return LOG_ERR;
case NFAPI_TRACE_WARN:
return LOG_WARNING;
case NFAPI_TRACE_NOTE:
return LOG_INFO;
case NFAPI_TRACE_INFO:
return LOG_DEBUG;
}
return LOG_ERR;
}
void pnf_nfapi_trace(nfapi_trace_level_t nfapi_level, const char* message, ...) {
va_list args;
int oai_level;
if (nfapi_level==NFAPI_TRACE_ERROR) {
oai_level = LOG_ERR;
} else if (nfapi_level==NFAPI_TRACE_WARN) {
oai_level = LOG_WARNING;
} else if (nfapi_level==NFAPI_TRACE_NOTE) {
oai_level = LOG_INFO;
} else if (nfapi_level==NFAPI_TRACE_INFO) {
oai_level = LOG_DEBUG;
} else {
oai_level = LOG_ERR;
}
va_start(args, message);
nfapi_log("FILE>", "FUNC", 999, PHY, oai_level, message, args);
nfapi_log("FILE>", "FUNC", 999, PHY, nfapitooai_level(nfapi_level), message, args);
va_end(args);
}
......
......@@ -680,36 +680,13 @@ void vnf_deallocate(void* ptr) {
free(ptr);
}
extern void nfapi_log(char *file, char *func, int line, int comp, int level, const char* format, va_list args);
void vnf_trace(nfapi_trace_level_t nfapi_level, const char* message, ...) {
va_list args;
int oai_level;
if (nfapi_level==NFAPI_TRACE_ERROR)
{
oai_level = LOG_ERR;
}
else if (nfapi_level==NFAPI_TRACE_WARN)
{
oai_level = LOG_WARNING;
}
else if (nfapi_level==NFAPI_TRACE_NOTE)
{
oai_level = LOG_INFO;
}
else if (nfapi_level==NFAPI_TRACE_INFO)
{
oai_level = LOG_INFO;
}
else
{
oai_level = LOG_INFO;
}
va_start(args, message);
nfapi_log("FILE>", "FUNC", 999, PHY, oai_level, message, args);
nfapi_log("FILE>", "FUNC", 999, PHY, nfapitooai_level(nfapi_level), message, args);
va_end(args);
}
......
......@@ -25,7 +25,7 @@ extern "C" {
// todo : move to public_inc so can be used by vendor extensions
#define MAX_BAD_TAG 3
int nfapitooai_level(int nfapilevel);
uint8_t push8(uint8_t in, uint8_t **out, uint8_t *end);
uint8_t pushs8(int8_t in, uint8_t **out, uint8_t *end);
uint8_t push16(uint16_t in, uint8_t **out, uint8_t *end);
......
......@@ -67,15 +67,12 @@ void generate_qpsk_table(void)
void init_lte_top(LTE_DL_FRAME_PARMS *frame_parms)
{
ccodedot11_init();
ccodedot11_init_inv();
ccodelte_init();
ccodelte_init_inv();
init_dfts();
phy_generate_viterbi_tables();