diff --git a/CMakeLists.txt b/CMakeLists.txt index 15e79dcd72..eff1778c0f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -260,7 +260,6 @@ endif() # Debug related options ######################################### -add_boolean_option(DEBUG_ASN1 False "Enable ASN1 debug logs" OFF) # asn1c skeletons have hardcoded this flag to make customized debug logs # OAI uses this feature to re-use OAI LOG_I(ASN1, ...) # see common/utils/config.h @@ -494,7 +493,6 @@ include_directories ("${OPENAIR_DIR}/radio/COMMON") add_boolean_option(UE_EXPANSION False "enable UE_EXPANSION with max 256 UE" ON) add_boolean_option(PHY_TX_THREAD False "enable UE_EXPANSION with max 256 UE" ON) add_boolean_option(PRE_SCD_THREAD False "enable UE_EXPANSION with max 256 UE" ON) -add_boolean_option(UESIM_EXPANSION False "enable UESIM_EXPANSION with max 256 UE" ON) ########################## # SCHEDULING/REAL-TIME/PERF options @@ -506,20 +504,15 @@ add_boolean_option(ENABLE_VCD_FIFO False "time measurements of proc cal ########################## # PHY options ########################## -add_boolean_option(LOCALIZATION False "???" ON) -add_integer_option(MAX_NUM_CCs 1 "????" ON) +add_integer_option(MAX_NUM_CCs 1 "Carrier component data arrays size (oai doesn't support carrier aggreagtion for now)" ON) add_boolean_option(SMBV False "Rohde&Schwarz SMBV100A vector signal generator" ON) add_boolean_option(DEBUG_PHY False "Enable PHY layer debugging options" ON) add_boolean_option(DEBUG_PHY_PROC False "Enable debugging of PHY layer procedures" ON) -add_boolean_option(MEX False "Enabling compilation with mex" ON) ########################## # NAS LAYER OPTIONS ########################## -add_boolean_option(ENABLE_NAS_UE_LOGGING True "????" ON) add_boolean_option(NAS_BUILT_IN_UE True "UE NAS layer present in this executable" ON) -add_boolean_option(NAS_UE True "NAS UE INSTANCE (<> NAS_MME)" ON) - ########################## # RRC LAYER OPTIONS @@ -897,6 +890,7 @@ set(PHY_SRC_UE ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/ulsch_coding.c ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/rar_tools_ue.c ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/initial_sync.c + ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation_avx2.c ${OPENAIR1_DIR}/PHY/MODULATION/slot_fep.c ${OPENAIR1_DIR}/PHY/MODULATION/slot_fep_mbsfn.c ${OPENAIR1_DIR}/PHY/MODULATION/ul_7_5_kHz_ue.c @@ -1026,8 +1020,6 @@ if (${SMBV}) set(PHY_SRC "${PHY_SRC} ${OPENAIR1_DIR}/PHY/TOOLS/smbv.c") endif (${SMBV}) -set(PHY_SRC_UE ${PHY_SRC_UE} ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation_avx2.c) - add_library(PHY_COMMON ${PHY_SRC_COMMON}) target_link_libraries(PHY_COMMON PRIVATE shlib_loader) add_dependencies(PHY_COMMON dfts) @@ -1063,28 +1055,6 @@ target_link_libraries(PHY_NR_UE PRIVATE asn1_nr_rrc_hdrs nr_phy_common nr_common add_library(PHY_RU ${PHY_SRC_RU}) target_link_libraries(PHY_RU PRIVATE asn1_lte_rrc_hdrs UTIL) -#Library for mex functions -#########################3 -set(PHY_MEX_UE - ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/linear_preprocessing_rec.c - ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation.c - ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_demodulation.c - ${OPENAIR1_DIR}/PHY/TOOLS/log2_approx.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/lte_mcs.c - ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/get_pmi.c - ${OPENAIR1_DIR}/PHY/TOOLS/dB_routines.c - ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pmch_common.c - ${OPENAIR1_DIR}/PHY/TOOLS/cadd_vv.c - ${OPENAIR1_DIR}/PHY/TOOLS/cmult_sv.c - ${OPENAIR1_DIR}/PHY/TOOLS/cmult_vv.c - ${OPENAIR1_DIR}/PHY/TOOLS/signal_energy.c - ${OPENAIR1_DIR}/PHY/TOOLS/simde_operations.c - ${OPENAIR1_DIR}/PHY/LTE_UE_TRANSPORT/dlsch_llr_computation_avx2.c - ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_ue_measurements.c - ) -add_library(PHY_MEX ${PHY_MEX_UE}) -target_link_libraries(PHY_MEX PRIVATE asn1_lte_rrc_hdrs UTIL) - #Layer 2 library ##################### set(MAC_DIR ${OPENAIR2_DIR}/LAYER2/MAC) @@ -2214,7 +2184,7 @@ if (${T_TRACER}) SECURITY SCHED_LIB SCHED_NR_LIB SCHED_RU_LIB SCHED_UE_LIB SCHED_NR_UE_LIB default_sched remote_sched RAL NFAPI_LIB NFAPI_PNF_LIB NFAPI_VNF_LIB NFAPI_USER_LIB MISC_NFAPI_LTE_LIB MISC_NFAPI_NR_LIB - PHY_COMMON PHY PHY_UE PHY_NR PHY_NR_COMMON PHY_NR_UE PHY_RU PHY_MEX + PHY_COMMON PHY PHY_UE PHY_NR PHY_NR_COMMON PHY_NR_UE PHY_RU L2 L2_LTE L2_NR L2_LTE_NR L2_UE NR_L2_UE L2_UE_LTE_NR MAC_NR_COMMON MAC_UE_NR ngap CN_UTILS GTPV1U SCTP_CLIENT MME_APP LIB_NAS_UE NB_IoT SIMU OPENAIR0_LIB dfts config_internals nr_common) diff --git a/cmake_targets/at_commands/CMakeLists.txt b/cmake_targets/at_commands/CMakeLists.txt index 146b63028c..c912bf9602 100755 --- a/cmake_targets/at_commands/CMakeLists.txt +++ b/cmake_targets/at_commands/CMakeLists.txt @@ -105,11 +105,7 @@ add_definitions("-DFIRMWARE_VERSION=\"${FIRMWARE_VERSION}\"") ########################## # NAS LAYER OPTIONS ########################## -add_boolean_option(ENABLE_NAS_UE_LOGGING True "????") -add_boolean_option(NAS_BUILT_IN_EPC False "MME NAS layer not present in this executable") add_boolean_option(NAS_BUILT_IN_UE False "UE NAS layer present in this executable") -add_boolean_option(NAS_UE True "NAS UE INSTANCE (<> NAS_MME)") -add_boolean_option(NAS_MME False "NAS_UE and NAS_MME are incompatible options") ################################################################################ # SECU LIB diff --git a/common/utils/LOG/DOC/rtusage.md b/common/utils/LOG/DOC/rtusage.md index b3de6cd71e..7d5bd94b8c 100644 --- a/common/utils/LOG/DOC/rtusage.md +++ b/common/utils/LOG/DOC/rtusage.md @@ -228,6 +228,10 @@ It can also be retrieved when using the telnet server, as explained [below](### | `_debug` | `boolean` | 0 = false | Triggers the activation of conditional code identified by the specified flag. | `_dump` | `boolean` | 0 = false| Triggers buffer dump, on the console in text form or in a file in matlab format, depending on the developper choice and forcasted usage| +Example: dump all ASN.1 structures during operation with +`--log_config.ASN1_debug`. To get a list of all flag/dump options, provide an +invalid flag, e.g. `--log_config.HELP_debug`. + ### Using the configuration file to configure the logging facility The following example sets all components log level to info, exept for hw,phy,mac,rlc,pdcp,rrc which log levels are set to error or warning. ```bash diff --git a/common/utils/LOG/log.c b/common/utils/LOG/log.c index af6c30b858..b8349fb358 100644 --- a/common/utils/LOG/log.c +++ b/common/utils/LOG/log.c @@ -120,28 +120,6 @@ mapping * log_option_names_ptr(void) return log_options; } -static mapping log_maskmap[] = {{"PRACH", DEBUG_PRACH}, - {"RU", DEBUG_RU}, - {"UE_PHYPROC", DEBUG_UE_PHYPROC}, - {"LTEESTIM", DEBUG_LTEESTIM}, - {"DLCELLSPEC", DEBUG_DLCELLSPEC}, - {"ULSCH", DEBUG_ULSCH}, - {"RRC", DEBUG_RRC}, - {"PDCP", DEBUG_PDCP}, - {"DFT", DEBUG_DFT}, - {"ASN1", DEBUG_ASN1}, - {"CTRLSOCKET", DEBUG_CTRLSOCKET}, - {"SECURITY", DEBUG_SECURITY}, - {"NAS", DEBUG_NAS}, - {"RLC", DEBUG_RLC}, - {"DLSCH_DECOD", DEBUG_DLSCH_DECOD}, - {"UE_TIMING", UE_TIMING}, - {NULL, -1}}; -mapping * log_maskmap_ptr(void) -{ - return log_maskmap; -} - /* .log_format = 0x13 uncolored standard messages * .log_format = 0x93 colored standard messages */ /* keep white space in first position; switching it to 0 allows colors to be disabled*/ @@ -327,6 +305,9 @@ int write_file_matlab(const char *fname, const char *vname, void *data, int leng return 0; } +#define FLAG_SETDEBUG(flag) g_log->debug_mask.DEBUG_##flag = *logparams_debug[i++].uptr; +#define FLAG_SETDUMP(flag) g_log->dump_mask.DEBUG_##flag = *logparams_dump[i++].uptr; + /* get log parameters from configuration file */ void log_getconfig(log_t *g_log) { @@ -335,8 +316,6 @@ void log_getconfig(log_t *g_log) paramdef_t logparams_defaults[] = LOG_GLOBALPARAMS_DESC; paramdef_t logparams_level[MAX_LOG_PREDEF_COMPONENTS]; paramdef_t logparams_logfile[MAX_LOG_PREDEF_COMPONENTS]; - paramdef_t logparams_debug[sizeofArray(log_maskmap)]; - paramdef_t logparams_dump[sizeofArray(log_maskmap)]; int ret = config_get(config_get_if(), logparams_defaults, sizeofArray(logparams_defaults), CONFIG_STRING_LOG_PREFIX); if (ret <0) { @@ -404,37 +383,45 @@ void log_getconfig(log_t *g_log) } /* build then read the debug and dump parameter array */ - for (int i=0; log_maskmap[i].name != NULL ; i++) { - sprintf(logparams_debug[i].optname, LOG_CONFIG_DEBUG_FORMAT, log_maskmap[i].name); - sprintf(logparams_dump[i].optname, LOG_CONFIG_DUMP_FORMAT, log_maskmap[i].name); - logparams_debug[i].defuintval = 0; - logparams_debug[i].type = TYPE_UINT; - logparams_debug[i].paramflags = PARAMFLAG_BOOL; - logparams_debug[i].uptr = NULL; - logparams_debug[i].chkPptr = NULL; - logparams_debug[i].numelt = 0; - logparams_dump[i].defuintval = 0; - logparams_dump[i].type = TYPE_UINT; - logparams_dump[i].paramflags = PARAMFLAG_BOOL; - logparams_dump[i].uptr = NULL; - logparams_dump[i].chkPptr = NULL; - logparams_dump[i].numelt = 0; + int sz = 0; + for (const char *const *ptr = flag_name; strlen(*ptr) > 1; ptr++) + sz++; + paramdef_t logparams_debug[sz]; + paramdef_t logparams_dump[sz]; + for (int i = 0; i < sz; i++) { + logparams_debug[i] = (paramdef_t){ + .type = TYPE_UINT, + .paramflags = PARAMFLAG_BOOL, + }; + sprintf(logparams_debug[i].optname, LOG_CONFIG_DEBUG_FORMAT, flag_name[i]); + logparams_dump[i] = (paramdef_t){.type = TYPE_UINT, .paramflags = PARAMFLAG_BOOL}; + sprintf(logparams_dump[i].optname, LOG_CONFIG_DUMP_FORMAT, flag_name[i]); } - config_get(config_get_if(), logparams_debug, sizeofArray(log_maskmap) - 1, CONFIG_STRING_LOG_PREFIX); - config_get(config_get_if(), logparams_dump, sizeofArray(log_maskmap) - 1, CONFIG_STRING_LOG_PREFIX); + config_get(config_get_if(), logparams_debug, sz, CONFIG_STRING_LOG_PREFIX); + config_get(config_get_if(), logparams_dump, sz, CONFIG_STRING_LOG_PREFIX); - if (config_check_unknown_cmdlineopt(config_get_if(), CONFIG_STRING_LOG_PREFIX) > 0) + bool old = CONFIG_ISFLAGSET(CONFIG_NOABORTONCHKF); + CONFIG_SETRTFLAG(CONFIG_NOABORTONCHKF); + if (config_check_unknown_cmdlineopt(config_get_if(), CONFIG_STRING_LOG_PREFIX) > 0) { + printf("Existing log_config options:\n"); + printf(" Boolean options:\n"); + for (int i = 0; i < sz; i++) + printf(" %s, \t%s\n", logparams_debug[i].optname, logparams_dump[i].optname); + printf(" Log level per module ("); + for (int i = 0; log_level_names[i].name != NULL; i++) + printf("%s ", log_level_names[i].name); + printf(")\n"); + for (int i = 0; i < MAX_LOG_PREDEF_COMPONENTS; i++) + printf(" %s\n", logparams_level[i].optname); exit(1); - - /* set the debug mask according to the debug parameters values */ - for (int i=0; log_maskmap[i].name != NULL ; i++) { - if (*(logparams_debug[i].uptr) ) - g_log->debug_mask = g_log->debug_mask | log_maskmap[i].value; - - if (*(logparams_dump[i].uptr) ) - g_log->dump_mask = g_log->dump_mask | log_maskmap[i].value; } + if (!old) + CONFIG_CLEARRTFLAG(CONFIG_NOABORTONCHKF); + int i = 0; + FOREACH_FLAG(FLAG_SETDEBUG); + i = 0; + FOREACH_FLAG(FLAG_SETDUMP); /* log globally enabled/disabled */ set_glog_onlinelog(consolelog); diff --git a/common/utils/LOG/log.h b/common/utils/LOG/log.h index f16ee296d4..d153a4aeaf 100644 --- a/common/utils/LOG/log.h +++ b/common/utils/LOG/log.h @@ -88,7 +88,7 @@ extern "C" { #define NUM_LOG_LEVEL 6 /*!< \brief the number of message levels users have with LOG (OAILOG_DISABLE is not available to user as a level, so it is not included)*/ /** @}*/ -#define SET_LOG_OPTION(O) g_log->flag = (g_log->flag | O) +#define SET_LOG_OPTION(O) g_log->flag = (g_log->flag | O) #define CLEAR_LOG_OPTION(O) g_log->flag = (g_log->flag & (~O)) /** @defgroup macros to identify a debug entity @@ -99,28 +99,37 @@ extern "C" { * server. * @brief * @{*/ -#define DEBUG_PRACH (1<<0) -#define DEBUG_RU (1<<1) -#define DEBUG_UE_PHYPROC (1<<2) -#define DEBUG_LTEESTIM (1<<3) -#define DEBUG_DLCELLSPEC (1<<4) -#define DEBUG_ULSCH (1<<5) -#define DEBUG_RRC (1<<6) -#define DEBUG_PDCP (1<<7) -#define DEBUG_DFT (1<<8) -#define DEBUG_ASN1 (1<<9) -#define DEBUG_CTRLSOCKET (1<<10) -#define DEBUG_SECURITY (1<<11) -#define DEBUG_NAS (1<<12) -#define DEBUG_RLC (1<<13) -#define DEBUG_DLSCH_DECOD (1<<14) -#define UE_TIMING (1<<20) -#define SET_LOG_DEBUG(B) g_log->debug_mask = (g_log->debug_mask | B) -#define CLEAR_LOG_DEBUG(B) g_log->debug_mask = (g_log->debug_mask & (~B)) +#define FOREACH_FLAG(FLAG_DEF) \ + FLAG_DEF(PRACH) \ + FLAG_DEF(UE_PHYPROC) \ + FLAG_DEF(LTEESTIM) \ + FLAG_DEF(DLCELLSPEC) \ + FLAG_DEF(ULSCH) \ + FLAG_DEF(RRC) \ + FLAG_DEF(PDCP) \ + FLAG_DEF(DFT) \ + FLAG_DEF(ASN1) \ + FLAG_DEF(CTRLSOCKET) \ + FLAG_DEF(SECURITY) \ + FLAG_DEF(NAS) \ + FLAG_DEF(DLSCH_DECOD) \ + FLAG_DEF(UE_TIMING) \ + FLAG_DEF(F1AP) -#define SET_LOG_DUMP(B) g_log->dump_mask = (g_log->dump_mask | B) -#define CLEAR_LOG_DUMP(B) g_log->dump_mask = (g_log->dump_mask & (~B)) +#define FLAG_BITF(flag) uint64_t DEBUG_##flag: 1; +typedef struct { + FOREACH_FLAG(FLAG_BITF) +} debug_flags_t; + +#define FLAG_TEXT(flag) #flag, +static const char *const flag_name[] = {FOREACH_FLAG(FLAG_TEXT) ""}; + +#define SET_LOG_DEBUG(B) g_log->debug_mask.B = true +#define CLEAR_LOG_DEBUG(B) g_log->debug_mask.B = false + +#define SET_LOG_DUMP(B) g_log->dump_mask.B = true +#define CLEAR_LOG_DUMP(B) g_log->dump_mask.B = false #define FOREACH_COMP(COMP_DEF) \ COMP_DEF(PHY, log) \ @@ -215,8 +224,8 @@ typedef struct { char level2string[NUM_LOG_LEVEL]; int flag; char *filelog_name; - uint64_t debug_mask; - uint64_t dump_mask; + debug_flags_t debug_mask; + debug_flags_t dump_mask; } log_t; #ifdef LOG_MAIN @@ -230,7 +239,28 @@ extern "C" { } #endif #endif - +#define FLAG_DEBUG_SET(flag) \ + if (strcmp(name, #flag) == 0) { \ + g_log->debug_mask.DEBUG_##flag = val; \ + return true; \ + }; +static inline bool set_log_debug(char *name, bool val) +{ + FOREACH_FLAG(FLAG_DEBUG_SET); + printf("Error: setting log debug of %s option, not existing\n", name); + return false; +} +#define FLAG_DUMP_SET(flag) \ + if (strcmp(name, #flag) == 0) { \ + g_log->dump_mask.DEBUG_##flag = val; \ + return true; \ + }; +static inline bool set_log_dump(char *name, bool val) +{ + FOREACH_FLAG(FLAG_DUMP_SET); + printf("Error: setting log dump of %s option, not existing\n", name); + return false; +} /*----------------------------------------------------------------------------*/ int logInit (void); void logTerm (void); @@ -418,15 +448,15 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int /* macro used to dump a buffer or a message as in openair2/RRC/LTE/RRC_eNB.c, replaces LOG_F macro */ #define LOG_DUMPMSG(c, f, b, s, x...) \ do { \ - if (g_log->dump_mask & f) \ + if (g_log->dump_mask.f) \ log_dump(c, b, s, LOG_DUMP_CHAR, x); \ } while (0) /* bitmask dependent macros, to isolate debugging code */ -#define LOG_DEBUGFLAG(D) (g_log->debug_mask & D) +#define LOG_DEBUGFLAG(D) (g_log->debug_mask.D) /* bitmask dependent macros, to generate debug file such as matlab file or message dump */ -#define LOG_DUMPFLAG(D) (g_log->dump_mask & D) +#define LOG_DUMPFLAG(D) (g_log->dump_mask.D) #define LOG_M(file, vector, data, len, dec, format) \ do { \ @@ -529,11 +559,11 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int } while (0) #define nfapi_log(FILE, FNC, LN, COMP, LVL, FMT...) -#define LOG_DEBUGFLAG(D) (g_log->debug_mask & D) -#define LOG_DUMPFLAG(D) (g_log->dump_mask & D) +#define LOG_DEBUGFLAG(D) (g_log->debug_mask.D) +#define LOG_DUMPFLAG(D) (g_log->dump_mask.D) #define LOG_DUMPMSG(c, f, b, s, x...) \ do { \ - if (g_log->dump_mask & f) \ + if (g_log->dump_mask.f) \ log_dump(c, b, s, LOG_DUMP_CHAR, x); \ } while (0) /* */ diff --git a/common/utils/telnetsrv/telnetsrv_proccmd.c b/common/utils/telnetsrv/telnetsrv_proccmd.c index f081bb66a1..f79e9f5287 100644 --- a/common/utils/telnetsrv/telnetsrv_proccmd.c +++ b/common/utils/telnetsrv/telnetsrv_proccmd.c @@ -251,12 +251,17 @@ void print_threads(char *buf, int debug, telnet_printfunc_t prnt) proccmd_get_threaddata(buf, debug, prnt, NULL); } +#define FLAG_PRINT_DEBUG_DUMP(flag) \ + logsdata->lines[i].val[0] = (char *)flag_name[i]; \ + logsdata->lines[i].val[1] = g_log->debug_mask.DEBUG_##flag ? "true" : "false"; \ + logsdata->lines[i].val[1] = g_log->dump_mask.DEBUG_##flag ? "true" : "false"; \ + i++; + int proccmd_websrv_getdata(char *cmdbuff, int debug, void *data, telnet_printfunc_t prnt) { webdatadef_t *logsdata = (webdatadef_t *)data; const mapping *const log_level_names = log_level_names_ptr(); const mapping *const log_options = log_option_names_ptr(); - const mapping *log_maskmap = log_maskmap_ptr(); if (strncmp(cmdbuff, "set", 3) == 0) { telnet_printfunc_t printfunc = (prnt != NULL) ? prnt : (telnet_printfunc_t)printf; if (strcasestr(cmdbuff, "loglvl") != NULL) { @@ -291,23 +296,16 @@ int proccmd_websrv_getdata(char *cmdbuff, int debug, void *data, telnet_printfun } } if (strcasestr(cmdbuff, "dbgopt") != NULL) { - int optbit = map_str_to_int(log_maskmap, logsdata->lines[0].val[0]); - if (optbit < 0) { - printfunc("debug option %s unknown\n", logsdata->lines[0].val[0]); - } else { - if (strcmp(logsdata->lines[0].val[1], "true") == 0) - SET_LOG_DEBUG(optbit); - else - CLEAR_LOG_DEBUG(optbit); - if (strcmp(logsdata->lines[0].val[2], "true") == 0) - SET_LOG_DUMP(optbit); - else - CLEAR_LOG_DUMP(optbit); - printfunc("%s debug %s dump %s\n", - logsdata->lines[0].val[0], - (strcmp(logsdata->lines[0].val[1], "true") == 0) ? "enabled" : "disabled", - (strcmp(logsdata->lines[0].val[2], "true") == 0) ? "enabled" : "disabled"); - } + if (strcmp(logsdata->lines[0].val[1], "true") == 0) + if (!set_log_debug(logsdata->lines[0].val[0], strcmp(logsdata->lines[0].val[2], "true") == 0)) + printfunc("debug option %s unknown\n", logsdata->lines[0].val[0]); + if (strcmp(logsdata->lines[0].val[2], "true") == 0) + if (!set_log_dump(logsdata->lines[0].val[0], strcmp(logsdata->lines[0].val[2], "true") == 0)) + printfunc("debug option %s unknown\n", logsdata->lines[0].val[0]); + printfunc("%s debug %s dump %s\n", + logsdata->lines[0].val[0], + (strcmp(logsdata->lines[0].val[1], "true") == 0) ? "enabled" : "disabled", + (strcmp(logsdata->lines[0].val[2], "true") == 0) ? "enabled" : "disabled"); } if (strcasestr(cmdbuff, "threadsched") != NULL) { unsigned int tid = strtoll(logsdata->lines[0].val[0], NULL, 0); @@ -354,12 +352,9 @@ int proccmd_websrv_getdata(char *cmdbuff, int debug, void *data, telnet_printfun snprintf(logsdata->columns[2].coltitle, TELNET_CMD_MAXSIZE, "dump"); logsdata->columns[2].coltype = TELNET_CHECKVAL_BOOL; - for (int i = 0; log_maskmap[i].name != NULL; i++) { - logsdata->numlines++; - logsdata->lines[i].val[0] = (char *)log_maskmap[i].name; - logsdata->lines[i].val[1] = (g_log->debug_mask & log_maskmap[i].value) ? "true" : "false"; - logsdata->lines[i].val[2] = (g_log->dump_mask & log_maskmap[i].value) ? "true" : "false"; - } + int i = 0; + FOREACH_FLAG(FLAG_PRINT_DEBUG_DUMP); + logsdata->numlines += i; } if (strcasestr(cmdbuff, "logopt") != NULL) { @@ -385,6 +380,14 @@ int proccmd_websrv_getdata(char *cmdbuff, int debug, void *data, telnet_printfun return 0; } +#define FLAG_PRINT2_DEBUG_DUMP(flag) \ + prnt("%02i %17.17s %5.5s %5.5s\n", \ + i, \ + flag_name[i], \ + g_log->debug_mask.DEBUG_##flag ? "Y" : "N", \ + g_log->dump_mask.DEBUG_##flag ? "Y" : "N"); \ + i++; + int proccmd_show(char *buf, int debug, telnet_printfunc_t prnt) { if (buf == NULL) { @@ -422,12 +425,8 @@ int proccmd_show(char *buf, int debug, telnet_printfunc_t prnt) } if (strcasestr(buf,"dbgopt") != NULL) { prnt("\n module debug dumpfile\n"); - const mapping *log_maskmap = log_maskmap_ptr(); - 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->dump_mask & log_maskmap[i].value)?"Y":"N") ); - } + int i = 0; + FOREACH_FLAG(FLAG_PRINT2_DEBUG_DUMP); } if (strcasestr(buf,"config") != NULL) { prnt("Command line arguments:\n"); @@ -593,28 +592,16 @@ int s = sscanf(buf,"%ms %i-%i\n",&logsubcmd, &idx1,&idx2); } } else if (l == 2 && strcmp(logparam,"debug") == 0){ - optbit = map_str_to_int(log_maskmap, opt); - if (optbit < 0) { + int ret = set_log_debug(opt, idx1 > 0); + if (!ret) prnt("module %s unknown\n", opt); - } else { - if (idx1 > 0) - SET_LOG_DEBUG(optbit); - else - CLEAR_LOG_DEBUG(optbit); - proccmd_show("dbgopt", debug, prnt); - } + proccmd_show("dbgopt", debug, prnt); } else if (l == 2 && strcmp(logparam,"dump") == 0){ - optbit = map_str_to_int(log_maskmap, opt); - if (optbit < 0) { + int ret = set_log_dump(opt, idx1 > 0); + if (!ret) prnt("module %s unknown\n", opt); - } else { - if (idx1 > 0) - SET_LOG_DUMP(optbit); - else - CLEAR_LOG_DUMP(optbit); - proccmd_show("dump", debug, prnt); - } + proccmd_show("dump", debug, prnt); } if (logparam != NULL) free(logparam); if (opt != NULL) free(opt); diff --git a/executables/lte-ue.c b/executables/lte-ue.c index 41ce61f384..e941690f26 100644 --- a/executables/lte-ue.c +++ b/executables/lte-ue.c @@ -1726,7 +1726,8 @@ void *UE_thread(void *arg) { pthread_mutex_unlock(&sync_mutex); */ wait_sync("UE thread"); -#ifdef NAS_UE + +#ifdef NAS_BUILT_IN_UE MessageDef *message_p; message_p = itti_alloc_new_message(TASK_NAS_UE, 0, INITIALIZE_MESSAGE); itti_send_msg_to_task (TASK_NAS_UE, UE->Mod_id + NB_eNB_INST, message_p); @@ -2089,7 +2090,7 @@ void init_UE_single_thread_stub(int nb_inst) { AssertFatal(PHY_vars_UE_g[i][0]!=NULL,"PHY_vars_UE_g[inst][0] is NULL\n"); if(NFAPI_MODE==NFAPI_UE_STUB_PNF || NFAPI_MODE==NFAPI_MODE_STANDALONE_PNF) { -#ifdef NAS_UE +#ifdef NAS_BUILT_IN_UE MessageDef *message_p; message_p = itti_alloc_new_message(TASK_NAS_UE, 0, INITIALIZE_MESSAGE); itti_send_msg_to_task (TASK_NAS_UE, i + NB_eNB_INST, message_p); diff --git a/openair1/PHY/CODING/3gpplte_turbo_decoder_avx2_16bit.c b/openair1/PHY/CODING/3gpplte_turbo_decoder_avx2_16bit.c index 57c53df1b1..4d7f91acda 100644 --- a/openair1/PHY/CODING/3gpplte_turbo_decoder_avx2_16bit.c +++ b/openair1/PHY/CODING/3gpplte_turbo_decoder_avx2_16bit.c @@ -54,10 +54,6 @@ #include #endif -#ifdef MEX -#include "mex.h" -#endif - #include "PHY/sse_intrin.h" //#define DEBUG_LOGMAP @@ -837,19 +833,11 @@ void init_td16avx2(void) for (ind=0; ind<188; ind++) { n = f1f2mat[ind].nb_bits; - base_interleaver=il_tb+f1f2mat[ind].beg_index; -#ifdef MEX - // This is needed for the Mex implementation to make the memory persistent - pi2tab16[ind] = mxMalloc((n+8)*sizeof(int)); - pi5tab16[ind] = mxMalloc((n+8)*sizeof(int)); - pi4tab16[ind] = mxMalloc((n+8)*sizeof(int)); - pi6tab16[ind] = mxMalloc((n+8)*sizeof(int)); -#else + base_interleaver = il_tb + f1f2mat[ind].beg_index; pi2tab16avx2[ind] = malloc((n+8)*sizeof(int)); pi5tab16avx2[ind] = malloc((n+8)*sizeof(int)); pi4tab16avx2[ind] = malloc((n+8)*sizeof(int)); - pi6tab16avx2[ind] = malloc((n+8)*sizeof(int)); -#endif + pi6tab16avx2[ind] = malloc((n + 8) * sizeof(int)); // fprintf(fdavx2,"Interleaver index %d\n",ind); for (i=i2=0; i2<8; i2++) { diff --git a/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_16bit.c b/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_16bit.c index cae2093e99..12cbe867a4 100644 --- a/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_16bit.c +++ b/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_16bit.c @@ -52,12 +52,6 @@ #include #endif -#ifdef MEX - #include "mex.h" -#endif - -//#define DEBUG_LOGMAP - #ifdef DEBUG_LOGMAP #define print_shorts(s,x) fprintf(fdsse4,"%s %d,%d,%d,%d,%d,%d,%d,%d\n",s,(x)[0],(x)[1],(x)[2],(x)[3],(x)[4],(x)[5],(x)[6],(x)[7]) #endif @@ -933,20 +927,11 @@ void init_td16(void) { for (ind=0; ind<188; ind++) { n = f1f2mat[ind].nb_bits; - base_interleaver=il_tb+f1f2mat[ind].beg_index; -#ifdef MEX - // This is needed for the Mex implementation to make the memory persistent - pi2tab16[ind] = mxMalloc((n+8)*sizeof(int)); - pi5tab16[ind] = mxMalloc((n+8)*sizeof(int)); - pi4tab16[ind] = mxMalloc((n+8)*sizeof(int)); - pi6tab16[ind] = mxMalloc((n+8)*sizeof(int)); -#else + base_interleaver = il_tb + f1f2mat[ind].beg_index; pi2tab16[ind] = malloc((n+8)*sizeof(int)); pi5tab16[ind] = malloc((n+8)*sizeof(int)); pi4tab16[ind] = malloc((n+8)*sizeof(int)); - pi6tab16[ind] = malloc((n+8)*sizeof(int)); -#endif - + pi6tab16[ind] = malloc((n + 8) * sizeof(int)); for (i=i2=0; i2<8; i2++) { j=i2; diff --git a/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c b/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c index 1447dbc6cc..0180bed149 100644 --- a/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c +++ b/openair1/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c @@ -50,10 +50,6 @@ #include #endif -#ifdef MEX - #include "mex.h" -#endif - #include "common/ran_context.h" #define SHUFFLE16(a, b, c, d, e, f, g, h) \ @@ -858,19 +854,11 @@ void init_td8(void) { for (ind=0; ind<188; ind++) { n = f1f2mat[ind].nb_bits; - base_interleaver=il_tb+f1f2mat[ind].beg_index; -#ifdef MEX - // This is needed for the Mex implementation to make the memory persistent - pi2tab8[ind] = mxMalloc((n+8)*sizeof(int)); - pi5tab8[ind] = mxMalloc((n+8)*sizeof(int)); - pi4tab8[ind] = mxMalloc((n+8)*sizeof(int)); - pi6tab8[ind] = mxMalloc((n+8)*sizeof(int)); -#else + base_interleaver = il_tb + f1f2mat[ind].beg_index; pi2tab8[ind] = malloc((n+8)*sizeof(int)); pi5tab8[ind] = malloc((n+8)*sizeof(int)); pi4tab8[ind] = malloc((n+8)*sizeof(int)); - pi6tab8[ind] = malloc((n+8)*sizeof(int)); -#endif + pi6tab8[ind] = malloc((n + 8) * sizeof(int)); if ((n&15)>0) { n2 = n+8; diff --git a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/nrLDPC_debug.h b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/nrLDPC_debug.h index 13f533781e..c63fdc948b 100644 --- a/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/nrLDPC_debug.h +++ b/openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_tools/nrLDPC_debug.h @@ -165,18 +165,4 @@ static inline void nrLDPC_debug_initBuffer2File(e_nrLDPC_buffers buffer) } } -/** - \brief Prints 256 data type - \param in Input to print -*/ -static inline void nrLDPC_debug_print256i_epi8(simde__m256i* in) -{ - uint32_t i; - - for (i=0; i<32; i++) - { - mexPrintf("%d ", ((int8_t*)&in)[i]); - } -} - #endif diff --git a/openair1/PHY/LTE_TRANSPORT/defs_NB_IoT.h b/openair1/PHY/LTE_TRANSPORT/defs_NB_IoT.h index 7ee3be6701..44eac0ff0c 100644 --- a/openair1/PHY/LTE_TRANSPORT/defs_NB_IoT.h +++ b/openair1/PHY/LTE_TRANSPORT/defs_NB_IoT.h @@ -756,17 +756,7 @@ typedef struct { /// num active cba group uint8_t num_active_cba_groups; /// allocated CBA RNTI for this ulsch - uint16_t cba_rnti[4];//NUM_MAX_CBA_GROUP]; - #ifdef LOCALIZATION - /// epoch timestamp in millisecond - int32_t reference_timestamp_ms; - /// aggregate physical states every n millisecond - int32_t aggregation_period_ms; - /// a set of lists used for localization - struct list loc_rss_list[10], loc_rssi_list[10], loc_subcarrier_rss_list[10], loc_timing_advance_list[10], loc_timing_update_list[10]; - struct list tot_loc_rss_list, tot_loc_rssi_list, tot_loc_subcarrier_rss_list, tot_loc_timing_advance_list, tot_loc_timing_update_list; - #endif - + uint16_t cba_rnti[4]; // NUM_MAX_CBA_GROUP]; } NB_IoT_eNB_NULSCH_t; #define NPBCH_A 34 diff --git a/openair1/PHY/LTE_TRANSPORT/prach.c b/openair1/PHY/LTE_TRANSPORT/prach.c index 92350194ca..e220549045 100644 --- a/openair1/PHY/LTE_TRANSPORT/prach.c +++ b/openair1/PHY/LTE_TRANSPORT/prach.c @@ -132,7 +132,7 @@ void rx_prach0(PHY_VARS_eNB *eNB, prach_ifftp = eNB->prach_vars_br.prach_ifft[ce_level]; rxsigF = eNB->prach_vars_br.rxsigF[ce_level]; - if (LOG_DEBUGFLAG(PRACH)) { + if (LOG_DEBUGFLAG(DEBUG_PRACH)) { if (((frame_prach)&1023) < 20) LOG_D(PHY, "PRACH (eNB) : running rx_prach (br_flag %d, ce_level %d) for frame %d subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d, rootSequenceIndex %d, repetition number %d,numRepetitionsPrePreambleAttempt %d\n", br_flag,ce_level,frame_prach,subframe, @@ -145,23 +145,26 @@ void rx_prach0(PHY_VARS_eNB *eNB, prach_ifftp = eNB->prach_vars.prach_ifft[0]; rxsigF = eNB->prach_vars.rxsigF[0]; - //if (LOG_DEBUGFLAG(PRACH)) { - if (((frame_prach)&1023) < 20) LOG_D(PHY,"PRACH (eNB) : running rx_prach for subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d , rootSequenceIndex %d\n", subframe, - fp->prach_config_common.prach_ConfigInfo.prach_FreqOffset,prach_ConfigIndex,rootSequenceIndex); - //} + if (((frame_prach) & 1023) < 20) + LOG_D(PHY, + "PRACH (eNB) : running rx_prach for subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d , rootSequenceIndex %d\n", + subframe, + fp->prach_config_common.prach_ConfigInfo.prach_FreqOffset, + prach_ConfigIndex, + rootSequenceIndex); } } else { if (br_flag == 1) { rxsigF = ru->prach_rxsigF_br[ce_level]; - if (LOG_DEBUGFLAG(PRACH)) { + if (LOG_DEBUGFLAG(DEBUG_PRACH)) { if (((frame_prach)&1023) < 20) LOG_D(PHY,"PRACH (RU) : running rx_prach (br_flag %d, ce_level %d) for frame %d subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d\n", br_flag,ce_level,frame_prach,subframe,fp->prach_emtc_config_common.prach_ConfigInfo.prach_FreqOffset[ce_level],prach_ConfigIndex); } } else { rxsigF = ru->prach_rxsigF[0]; - if (LOG_DEBUGFLAG(PRACH)) { + if (LOG_DEBUGFLAG(DEBUG_PRACH)) { if (((frame_prach)&1023) < 20) LOG_D(PHY,"PRACH (RU) : running rx_prach for subframe %d, prach_FreqOffset %d, prach_ConfigIndex %d\n", subframe,fp->prach_config_common.prach_ConfigInfo.prach_FreqOffset,prach_ConfigIndex); } @@ -178,7 +181,7 @@ void rx_prach0(PHY_VARS_eNB *eNB, // DJP - indexing below in subframe zero takes us off the beginning of the array??? prach[aa] = (int16_t *)&ru->common.rxdata[aa][(subframe*fp->samples_per_tti)-ru->N_TA_offset]; - if (LOG_DUMPFLAG(PRACH)) { + if (LOG_DUMPFLAG(DEBUG_PRACH)) { int32_t en0=signal_energy((int32_t *)prach[aa],fp->samples_per_tti); dBEn0 = dB_fixed(en0); int8_t rach_dBm = dBEn0 - ru->rx_total_gain_dB; @@ -281,7 +284,7 @@ void rx_prach0(PHY_VARS_eNB *eNB, if (((eNB!=NULL) && (ru->function != NGFI_RAU_IF4p5))|| ((eNB==NULL) && (ru->function == NGFI_RRU_IF4p5))) { // compute the DFTs of the PRACH temporal resources // Do forward transform - if (LOG_DEBUGFLAG(PRACH)) { + if (LOG_DEBUGFLAG(DEBUG_PRACH)) { LOG_D(PHY,"rx_prach: Doing FFT for N_RB_UL %d nb_rx:%d Ncp:%d\n",fp->N_RB_UL, nb_rx, Ncp); } @@ -353,7 +356,7 @@ void rx_prach0(PHY_VARS_eNB *eNB, return; } else if (eNB!=NULL) { - if ( LOG_DEBUGFLAG(PRACH)) { + if (LOG_DEBUGFLAG(DEBUG_PRACH)) { int en = dB_fixed(signal_energy((int32_t *)&rxsigF[0][0],840)); if ((en > 10)&&(br_flag==1)) LOG_I(PHY,"PRACH (br_flag %d,ce_level %d, n_ra_prb %d, k %d): Frame %d, Subframe %d => %d dB\n",br_flag,ce_level,n_ra_prb,k,frame_prach,subframe,en); @@ -394,8 +397,8 @@ void rx_prach0(PHY_VARS_eNB *eNB, uint64_t avg_en=0; for (preamble_index=0 ; preamble_index<64 ; preamble_index++) { - if (LOG_DEBUGFLAG(PRACH)) { - // int en = dB_fixed(signal_energy((int32_t *)&rxsigF[0][0],840)); + if (LOG_DEBUGFLAG(DEBUG_PRACH)) { + // int en = dB_fixed(signal_energy((int32_t *)&rxsigF[0][0],840)); if (dBEn0>30) LOG_I(PHY,"frame %d, subframe %d : Trying preamble %d (br_flag %d)\n",frame_prach,subframe,preamble_index,br_flag); } @@ -479,7 +482,7 @@ void rx_prach0(PHY_VARS_eNB *eNB, } // Compute DFT of RX signal (conjugate input, results in conjugate output) for each new rootSequenceIndex - if (LOG_DEBUGFLAG(PRACH)) { + if (LOG_DEBUGFLAG(DEBUG_PRACH)) { //en = dB_fixed(signal_energy((int32_t *)&rxsigF[0][0],840)); if (dBEn0>30) LOG_I(PHY,"frame %d, subframe %d : preamble index %d: offset %d, preamble shift %d (br_flag %d, en %d)\n", @@ -502,8 +505,8 @@ void rx_prach0(PHY_VARS_eNB *eNB, memset(prach_ifft,0,((N_ZC==839) ? 2048 : 256)*sizeof(int32_t)); } c16_t prachF[1024] __attribute__((aligned(32)))={0}; - - if (LOG_DUMPFLAG(PRACH)) + + if (LOG_DUMPFLAG(DEBUG_PRACH)) for (int z=0; z>9; } - if (LOG_DUMPFLAG(PRACH)) { + if (LOG_DUMPFLAG(DEBUG_PRACH)) { if (aa==0) LOG_M("prach_rxF_comp0.m","prach_rxF_comp0",prachF,1024,1,1); if (aa==1) LOG_M("prach_rxF_comp1.m","prach_rxF_comp1",prachF,1024,1,1); @@ -555,7 +558,7 @@ void rx_prach0(PHY_VARS_eNB *eNB, if ((br_flag==0) || (eNB->prach_vars_br.repetition_number[ce_level]== eNB->frame_parms.prach_emtc_config_common.prach_ConfigInfo.prach_numRepetitionPerPreambleAttempt[ce_level])) { - if (LOG_DEBUGFLAG(PRACH)) { + if (LOG_DEBUGFLAG(DEBUG_PRACH)) { int en = dB_fixed(signal_energy((int32_t *)&rxsigF[0][0],840)); if (en>60) LOG_I(PHY,"frame %d, subframe %d: Checking for peak in time-domain (br_flag %d, en %d)\n",frame_prach,subframe,br_flag,en); @@ -573,8 +576,8 @@ void rx_prach0(PHY_VARS_eNB *eNB, *max_preamble_delay = ((i*fft_size)>>log2_ifft_size)*update_TA/update_TA2; *max_preamble = preamble_index; - if (LOG_DEBUGFLAG(PRACH)) { - // int en = dB_fixed(signal_energy((int32_t *)&rxsigF[0][0],840)); + if (LOG_DEBUGFLAG(DEBUG_PRACH)) { + // int en = dB_fixed(signal_energy((int32_t *)&rxsigF[0][0],840)); if (dBEn0>30) LOG_D(PHY,"frame %d, subframe %d : max_preamble_energy %d, max_preamble_delay %d, max_preamble %d (br_flag %d,ce_level %d, levdB %d, lev %d)\n", @@ -613,7 +616,7 @@ void rx_prach0(PHY_VARS_eNB *eNB, LOG_M("prach_ifft0_br.m","prach_t0_br",prach_ifft,1024,1,1); } } - } /* LOG_DUMPFLAG(PRACH) */ + } if (eNB) stop_meas(&eNB->rx_prach); AssertFatal(exit_flag==0,"exiting\n"); diff --git a/openair1/PHY/NR_TRANSPORT/nr_prach.c b/openair1/PHY/NR_TRANSPORT/nr_prach.c index 3f41712f2c..9e3df3f223 100644 --- a/openair1/PHY/NR_TRANSPORT/nr_prach.c +++ b/openair1/PHY/NR_TRANSPORT/nr_prach.c @@ -383,11 +383,10 @@ void rx_nr_prach_ru(RU_t *ru, int prachFormat, int numRA, int prachStartSymbol, const dft_size_idx_t dftsize = get_dft(dftlen); // Do forward transform - if (LOG_DEBUGFLAG(PRACH)) { + if (LOG_DEBUGFLAG(DEBUG_PRACH)) { LOG_D(PHY, "rx_prach: Doing PRACH FFT for nb_rx:%d Ncp:%d dftlen:%d\n", ru->nb_rx, Ncp, dftlen); } - // Note: Assumes PUSCH SCS @ 30 kHz, take values for formats 0-2 and adjust for others below int kbar = 1; int K = 24; @@ -497,7 +496,7 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, LOG_D(PHY,"L1 PRACH RX: rooSequenceIndex %d, numRootSeqeuences %d, NCS %d, N_ZC %d, format %d \n",rootSequenceIndex,numrootSequenceIndex,NCS,N_ZC,prach_fmt); prach_ifft = gNB->prach_vars.prach_ifft; - if (LOG_DEBUGFLAG(PRACH)){ + if (LOG_DEBUGFLAG(DEBUG_PRACH)) { if ((frame&1023) < 20) LOG_D(PHY,"PRACH (gNB) : running rx_prach for slot %d, msg1_frequencystart %d, rootSequenceIndex %d\n", slot, msg1_frequencystart, rootSequenceIndex); } @@ -520,8 +519,7 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, *max_preamble = 0; int16_t prachF[2 * 1024]; for (preamble_index=0 ; preamble_index<64 ; preamble_index++) { - - if (LOG_DEBUGFLAG(PRACH)){ + if (LOG_DEBUGFLAG(DEBUG_PRACH)) { int en = dB_fixed(signal_energy((int32_t*)&rxsigF[0][0],(N_ZC==839) ? 840: 140)); if (en>60) LOG_D(PHY,"frame %d, slot %d : Trying preamble %d \n",frame,slot,preamble_index); } @@ -599,7 +597,7 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, } // Compute DFT of RX signal (conjugate input, results in conjugate output) for each new rootSequenceIndex - if (LOG_DEBUGFLAG(PRACH)) { + if (LOG_DEBUGFLAG(DEBUG_PRACH)) { int en = dB_fixed(signal_energy((int32_t*)&rxsigF[0][0],840)); if (en>60) LOG_D(PHY, @@ -626,11 +624,11 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, memset(prach_ifft,0,((N_ZC==839) ? 2048 : 256)*sizeof(int32_t)); memset(prachF, 0, sizeof(int16_t) * 2 * 1024); - if (LOG_DUMPFLAG(PRACH)) { + if (LOG_DUMPFLAG(DEBUG_PRACH)) { LOG_M("prach_rxF0.m","prach_rxF0",rxsigF[0],N_ZC,1,1); LOG_M("prach_rxF1.m","prach_rxF1",rxsigF[1],6144,1,1); } - + for (int aa = 0; aa < nb_rx; aa++) { // Do componentwise product with Xu* on each antenna @@ -653,7 +651,7 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, prach_ifft[i] += (int32_t)prach_ifft_tmp[i<<1]*(int32_t)prach_ifft_tmp[(i<<1)] + (int32_t)prach_ifft_tmp[1+(i<<1)]*(int32_t)prach_ifft_tmp[1+(i<<1)]; } - if (LOG_DUMPFLAG(PRACH)) { + if (LOG_DUMPFLAG(DEBUG_PRACH)) { if (aa == 0) LOG_M("prach_rxF_comp0.m","prach_rxF_comp0", prachF, 1024, 1, 1); if (aa == 1) @@ -717,8 +715,7 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, } else *TA = *TA/2; - - if (LOG_DUMPFLAG(PRACH)) { + if (LOG_DUMPFLAG(DEBUG_PRACH)) { //int en = dB_fixed(signal_energy((int32_t*)&rxsigF[0][0],840)); // if (en>60) { int k = (12 * n_ra_prb) - 6 * fp->N_RB_UL; @@ -734,7 +731,7 @@ void rx_nr_prach(PHY_VARS_gNB *gNB, LOG_M("Xu.m","xu", Xu, N_ZC, 1, 1); LOG_M("prach_ifft0.m","prach_t0", prach_ifft, 1024, 1, 1); // } - } /* LOG_DUMPFLAG(PRACH) */ + } stop_meas(&gNB->rx_prach); } diff --git a/openair1/PHY/TOOLS/tools_defs.h b/openair1/PHY/TOOLS/tools_defs.h index d7e738a9f4..b456fab82b 100644 --- a/openair1/PHY/TOOLS/tools_defs.h +++ b/openair1/PHY/TOOLS/tools_defs.h @@ -726,13 +726,6 @@ int32_t sub_cpx_vector16(int16_t *x, */ int32_t signal_energy(int32_t *,uint32_t); -#ifdef LOCALIZATION -/*!\fn int32_t signal_energy(int *,uint32_t); -\brief Computes the signal energy per subcarrier -*/ -int32_t subcarrier_energy(int32_t *,uint32_t, int32_t *subcarrier_energy, uint16_t rx_power_correction); -#endif - /*!\fn uint32_t signal_energy_nodc(c16_t *,uint32_t); \brief Computes the signal energy per subcarrier, without DC removal */ diff --git a/openair1/PHY/defs_L1_NB_IoT.h b/openair1/PHY/defs_L1_NB_IoT.h index 163e9e3d2b..aba1ffb255 100644 --- a/openair1/PHY/defs_L1_NB_IoT.h +++ b/openair1/PHY/defs_L1_NB_IoT.h @@ -45,17 +45,13 @@ #include "defs_eNB.h" //#include #include "assertions.h" -#ifdef MEX - #define msg mexPrintf -#else - #if ENABLE_RAL - #include "collection/hashtable/hashtable.h" - #include "COMMON/ral_messages_types.h" - #include "UTIL/queue.h" - #endif - #include "common/utils/LOG/log.h" - #define msg(aRGS...) LOG_D(PHY, ##aRGS) +#if ENABLE_RAL +#include "collection/hashtable/hashtable.h" +#include "COMMON/ral_messages_types.h" +#include "UTIL/queue.h" #endif +#include "common/utils/LOG/log.h" +#define msg(aRGS...) LOG_D(PHY, ##aRGS) //use msg in the real-time thread context #define msg_nrt printf //use msg_nrt in the non real-time context (for initialization, ...) @@ -663,13 +659,7 @@ typedef struct PHY_VARS_eNB_NB_IoT_s { time_stats_t ulsch_tc_gamma_stats; time_stats_t ulsch_tc_ext_stats; time_stats_t ulsch_tc_intl1_stats; - time_stats_t ulsch_tc_intl2_stats; - -#ifdef LOCALIZATION - /// time state for localization - time_stats_t localization_stats; -#endif - + time_stats_t ulsch_tc_intl2_stats; int32_t pucch1_stats_cnt[NUMBER_OF_UE_MAX_NB_IoT][10]; int32_t pucch1_stats[NUMBER_OF_UE_MAX_NB_IoT][10*1024]; int32_t pucch1_stats_thres[NUMBER_OF_UE_MAX_NB_IoT][10*1024]; diff --git a/openair1/PHY/defs_UE.h b/openair1/PHY/defs_UE.h index 5a090752d5..17ae02610e 100644 --- a/openair1/PHY/defs_UE.h +++ b/openair1/PHY/defs_UE.h @@ -76,34 +76,13 @@ #define stop_UE_TIMING(a) #endif -#ifdef MEX - #include "mex.h" - #define msg mexPrintf - #undef LOG_D - #undef LOG_E - #undef LOG_I - #undef LOG_N - #undef LOG_T - #undef LOG_W - #undef LOG_M - #define LOG_D(x, ...) mexPrintf(__VA_ARGS__) - #define LOG_E(x, ...) mexPrintf(__VA_ARGS__) - #define LOG_I(x, ...) mexPrintf(__VA_ARGS__) - #define LOG_N(x, ...) mexPrintf(__VA_ARGS__) - #define LOG_T(x, ...) mexPrintf(__VA_ARGS__) - #define LOG_W(x, ...) mexPrintf(__VA_ARGS__) - #define LOG_M(x, ...) mexPrintf(__VA_ARGS__) -#else - #if ENABLE_RAL - #include "collection/hashtable/hashtable.h" - #include "COMMON/ral_messages_types.h" - #include "UTIL/queue.h" - #endif - #include "common/utils/LOG/log.h" - #define msg(aRGS...) LOG_D(PHY, ##aRGS) +#if ENABLE_RAL +#include "collection/hashtable/hashtable.h" +#include "COMMON/ral_messages_types.h" +#include "UTIL/queue.h" #endif - - +#include "common/utils/LOG/log.h" +#define msg(aRGS...) LOG_D(PHY, ##aRGS) /// Context data structure for RX/TX portion of subframe processing typedef struct { diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h index dd035a73e3..5e04969e43 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -56,16 +56,12 @@ #include "actor.h" //#include "openair1/SCHED_NR_UE/defs.h" -#ifdef MEX - #define msg mexPrintf -#else - #if ENABLE_RAL - #include "common/utils/hashtable/hashtable.h" - #include "COMMON/ral_messages_types.h" - #include "UTIL/queue.h" - #endif - #define msg(aRGS...) LOG_D(PHY, ##aRGS) +#if ENABLE_RAL +#include "common/utils/hashtable/hashtable.h" +#include "COMMON/ral_messages_types.h" +#include "UTIL/queue.h" #endif +#define msg(aRGS...) LOG_D(PHY, ##aRGS) // use msg in the real-time thread context #define msg_nrt printf // use msg_nrt in the non real-time context (for initialization, ...) diff --git a/openair1/PHY/impl_defs_lte_NB_IoT.h b/openair1/PHY/impl_defs_lte_NB_IoT.h index 50b66409ed..b9e5965452 100644 --- a/openair1/PHY/impl_defs_lte_NB_IoT.h +++ b/openair1/PHY/impl_defs_lte_NB_IoT.h @@ -748,12 +748,6 @@ typedef struct { /// \brief llr values. /// - first index: ? [0..1179743] (hard coded) int16_t *llr; -#ifdef LOCALIZATION - /// number of active subcarrier for a specific UE - int32_t active_subcarrier; - /// subcarrier power in dBm - int32_t *subcarrier_power; -#endif } NB_IoT_eNB_PUSCH; #define PBCH_A_NB_IoT 24 diff --git a/openair1/SCHED_UE/phy_procedures_lte_ue.c b/openair1/SCHED_UE/phy_procedures_lte_ue.c index 1f165380d4..32e248d52b 100644 --- a/openair1/SCHED_UE/phy_procedures_lte_ue.c +++ b/openair1/SCHED_UE/phy_procedures_lte_ue.c @@ -1145,7 +1145,7 @@ void ulsch_common_procedures(PHY_VARS_UE *ue, int dummy_tx_buffer[frame_parms->samples_per_tti] __attribute__((aligned(16))); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_ULSCH_COMMON,VCD_FUNCTION_IN); - if ( LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { start_meas(&ue->ofdm_mod_stats); } @@ -1211,7 +1211,7 @@ void ulsch_common_procedures(PHY_VARS_UE *ue, } } //nb_antennas_tx - if ( LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { stop_meas(&ue->ofdm_mod_stats); } @@ -1544,7 +1544,7 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue, ue->prach_resources[eNB_id]->Msg3[7], ue->prach_resources[eNB_id]->Msg3[8]); - if ( LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { start_meas(&ue->ulsch_encoding_stats); } @@ -1556,7 +1556,7 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue, ue->transmission_mode[eNB_id],0,0)==0, "ulsch_coding.c: FATAL ERROR: returning\n"); - if ( LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { stop_meas(&ue->phy_proc_tx); LOG_I(PHY,"------FULL TX PROC : %5.2f ------\n",ue->phy_proc_tx.p_time/(cpuf*1000.0)); stop_meas(&ue->ulsch_encoding_stats); @@ -1605,7 +1605,7 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue, ulsch_input_buffer[i]= (uint8_t)(taus()&0xff); } - if ( LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { start_meas(&ue->ulsch_encoding_stats); } @@ -1620,7 +1620,7 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue, LOG_E(PHY,"ulsch_coding.c: FATAL ERROR: returning\n"); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX, VCD_FUNCTION_OUT); - if (LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { stop_meas(&ue->phy_proc_tx); } @@ -1628,7 +1628,7 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue, } } - if(LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { stop_meas(&ue->ulsch_encoding_stats); } } @@ -1656,7 +1656,7 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue, Mod_id,harq_pid,frame_tx%1024,subframe_tx,ue->tx_power_dBm[subframe_tx],ue->tx_power_max_dBm, tx_amp); } - if (LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { start_meas(&ue->ulsch_modulation_stats); } @@ -1679,7 +1679,7 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue, nb_rb, aa); - if (LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { stop_meas(&ue->ulsch_modulation_stats); } } @@ -2123,7 +2123,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *ue, T(T_UE_PHY_UL_TICK, T_INT(ue->Mod_id), T_INT(frame_tx%1024), T_INT(subframe_tx)); ue->generate_ul_signal[eNB_id] = 0; - if ( LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { start_meas(&ue->phy_proc_tx); } @@ -2208,7 +2208,7 @@ void phy_procedures_UE_TX(PHY_VARS_UE *ue, LOG_D(PHY,"****** end TX-Chain for AbsSubframe %d.%d ******\n", frame_tx, subframe_tx); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX, VCD_FUNCTION_OUT); - if ( LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { stop_meas(&ue->phy_proc_tx); } } @@ -2489,7 +2489,7 @@ int ue_pdcch_procedures(uint8_t eNB_id, LOG_D(PHY,"DCI Decoding procedure in %d.%d\n",frame_rx,subframe_rx); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PDCCH_PROCEDURES, VCD_FUNCTION_IN); - if (LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { start_meas(&ue->dlsch_rx_pdcch_stats); } @@ -2790,7 +2790,7 @@ int ue_pdcch_procedures(uint8_t eNB_id, } } - if (LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { stop_meas(&ue->dlsch_rx_pdcch_stats); } @@ -3086,7 +3086,7 @@ void ue_pdsch_procedures(PHY_VARS_UE *ue, else first_symbol_flag = 0; - if (LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { uint8_t slot = 0; if(m >= ue->frame_parms.symbols_per_tti>>1) @@ -3108,7 +3108,7 @@ void ue_pdsch_procedures(PHY_VARS_UE *ue, i_mod, dlsch0->current_harq_pid); - if (LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { uint8_t slot = 0; if(m >= ue->frame_parms.symbols_per_tti>>1) @@ -3299,7 +3299,7 @@ void ue_dlsch_procedures(PHY_VARS_UE *ue, subframe_rx, ue->transmission_mode[eNB_id]<7?0:ue->transmission_mode[eNB_id]); - if (LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { start_meas(&ue->dlsch_unscrambling_stats); } @@ -3311,7 +3311,7 @@ void ue_dlsch_procedures(PHY_VARS_UE *ue, 0, subframe_rx<<1); - if (LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { stop_meas(&ue->dlsch_unscrambling_stats); } @@ -3326,7 +3326,7 @@ void ue_dlsch_procedures(PHY_VARS_UE *ue, LOG_D(PHY,"start turbo decode for CW 0 for AbsSubframe %d.%d / %d --> Pdcch Sym %d \n", frame_rx, subframe_rx, harq_pid, ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->num_pdcch_symbols); - if (LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { start_meas(&ue->dlsch_decoding_stats[ue->current_thread_id[subframe_rx]]); } @@ -3341,7 +3341,7 @@ void ue_dlsch_procedures(PHY_VARS_UE *ue, pdsch==PDSCH?1:0, dlsch0->harq_processes[harq_pid]->TBS>256?1:0); - if (LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { stop_meas(&ue->dlsch_decoding_stats[ue->current_thread_id[subframe_rx]]); LOG_I(PHY, " --> Unscrambling for CW0 %5.3f\n", (ue->dlsch_unscrambling_stats.p_time)/(cpuf*1000.0)); @@ -3361,7 +3361,7 @@ void ue_dlsch_procedures(PHY_VARS_UE *ue, subframe_rx, ue->transmission_mode[eNB_id]<7?0:ue->transmission_mode[eNB_id]); - if (LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { start_meas(&ue->dlsch_unscrambling_stats); } @@ -3373,7 +3373,7 @@ void ue_dlsch_procedures(PHY_VARS_UE *ue, 1, subframe_rx<<1); - if (LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { stop_meas(&ue->dlsch_unscrambling_stats); } @@ -3386,7 +3386,7 @@ void ue_dlsch_procedures(PHY_VARS_UE *ue, LOG_D(PHY,"start turbo decode for CW 1 for AbsSubframe %d.%d / %d --> Pdcch Sym %d \n", frame_rx, subframe_rx, harq_pid, ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->num_pdcch_symbols); - if (LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { start_meas(&ue->dlsch_decoding_stats[ue->current_thread_id[subframe_rx]]); } @@ -3401,7 +3401,7 @@ void ue_dlsch_procedures(PHY_VARS_UE *ue, pdsch==PDSCH?1:0, dlsch1->harq_processes[harq_pid]->TBS>256?1:0); - if (LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { stop_meas(&ue->dlsch_decoding_stats[ue->current_thread_id[subframe_rx]]); LOG_I(PHY, " --> Unscrambling for CW1 %5.3f\n", (ue->dlsch_unscrambling_stats.p_time)/(cpuf*1000.0)); @@ -3653,7 +3653,7 @@ void *UE_thread_slot1_dl_processing(void *arg) { } /**** Slot1 FE Processing ****/ - if (LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { start_meas(&ue->ue_front_end_per_slot_stat[ue->current_thread_id[subframe_rx]][1]); } @@ -3680,7 +3680,7 @@ void *UE_thread_slot1_dl_processing(void *arg) { for (int l=1; lframe_parms.symbols_per_tti>>1; l++) { //if( (l != pilot0) && (l != pilot1)) { - if (LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { start_meas(&ue->ofdm_demod_stats); } @@ -3693,7 +3693,7 @@ void *UE_thread_slot1_dl_processing(void *arg) { 0); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP, VCD_FUNCTION_OUT); - if (LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { stop_meas(&ue->ofdm_demod_stats); } } @@ -3746,7 +3746,7 @@ void *UE_thread_slot1_dl_processing(void *arg) { //printf(" [slot1 dl processing] ==> Start LLR Comuptation slot1 for AbsSubframe %d.%d \n", proc->frame_rx, proc->subframe_rx); - if ( LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { stop_meas(&ue->ue_front_end_per_slot_stat[ue->current_thread_id[subframe_rx]][1]); LOG_D(PHY, "[AbsSFN %d.%d] Slot1: FFT + Channel Estimate + Pdsch Proc Slot0 %5.2f \n",frame_rx,subframe_rx,ue->ue_front_end_per_slot_stat[ue->current_thread_id[subframe_rx]][1].p_time/(cpuf*1000.0)); } @@ -3766,7 +3766,7 @@ void *UE_thread_slot1_dl_processing(void *arg) { // do procedures for C-RNTI //printf("AbsSubframe %d.%d Pdsch Procedure (slot1)\n",frame_rx,subframe_rx); - if ( LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { start_meas(&ue->pdsch_procedures_per_slot_stat[ue->current_thread_id[subframe_rx]][1]); } @@ -3840,7 +3840,7 @@ void *UE_thread_slot1_dl_processing(void *arg) { proc->llr_slot1_available=1; //printf("Set available LLR slot1 to 1 AbsSubframe %d.%d \n",frame_rx,subframe_rx); - if ( LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { stop_meas(&ue->pdsch_procedures_per_slot_stat[ue->current_thread_id[subframe_rx]][1]); LOG_D(PHY, "[AbsSFN %d.%d] Slot1: LLR Computation %5.2f \n",frame_rx,subframe_rx,ue->pdsch_procedures_per_slot_stat[ue->current_thread_id[subframe_rx]][1].p_time/(cpuf*1000.0)); } @@ -3891,7 +3891,7 @@ int phy_procedures_slot_parallelization_UE_RX(PHY_VARS_UE *ue, LOG_D(PHY," ****** start RX-Chain for AbsSubframe %d.%d ****** \n", frame_rx%1024, subframe_rx); } - if (LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { start_meas(&ue->phy_proc_rx[ue->current_thread_id[subframe_rx]]); start_meas(&ue->ue_front_end_stat[ue->current_thread_id[subframe_rx]]); } @@ -3994,7 +3994,7 @@ int phy_procedures_slot_parallelization_UE_RX(PHY_VARS_UE *ue, /**** Slot0 FE Processing ****/ // I- start main thread for FFT/ChanEst symbol: 0/1 --> 7 - if ( LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { start_meas(&ue->ue_front_end_per_slot_stat[ue->current_thread_id[subframe_rx]][0]); } @@ -4028,7 +4028,7 @@ int phy_procedures_slot_parallelization_UE_RX(PHY_VARS_UE *ue, for (l=first_ofdm_sym; l<=l2; l++) { if( (l != pilot0) && (l != pilot1)) { //printf("AbsSubframe %d.%d FFT slot %d, symbol %d\n", frame_rx,subframe_rx,slot0,l); - if (LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { start_meas(&ue->ofdm_demod_stats); } @@ -4040,7 +4040,7 @@ int phy_procedures_slot_parallelization_UE_RX(PHY_VARS_UE *ue, 0); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP, VCD_FUNCTION_OUT); - if (LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { stop_meas(&ue->ofdm_demod_stats); } } @@ -4060,14 +4060,14 @@ int phy_procedures_slot_parallelization_UE_RX(PHY_VARS_UE *ue, } if (do_pdcch_flag) { - if (LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { start_meas(&ue->pdcch_procedures_stat[ue->current_thread_id[subframe_rx]]); } if (ue_pdcch_procedures(eNB_id,ue,proc,abstraction_flag) == -1) { LOG_E(PHY,"[UE %d] Frame %d, subframe %d: Error in pdcch procedures\n",ue->Mod_id,frame_rx,subframe_rx); - if (LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { LOG_D(PHY, "[AbsSFN %d.%d] Slot0: PDCCH %5.2f \n",frame_rx,subframe_rx,ue->pdcch_procedures_stat[ue->current_thread_id[subframe_rx]].p_time/(cpuf*1000.0)); } @@ -4076,7 +4076,7 @@ int phy_procedures_slot_parallelization_UE_RX(PHY_VARS_UE *ue, } //proc->dci_slot0_available=1; - if (LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { stop_meas(&ue->pdcch_procedures_stat[ue->current_thread_id[subframe_rx]]); LOG_D(PHY, "[AbsSFN %d.%d] Slot0: PDCCH %5.2f \n",frame_rx,subframe_rx,ue->pdcch_procedures_stat[ue->current_thread_id[subframe_rx]].p_time/(cpuf*1000.0)); } @@ -4085,7 +4085,7 @@ int phy_procedures_slot_parallelization_UE_RX(PHY_VARS_UE *ue, //printf("num_pdcch_symbols %d\n",ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->num_pdcch_symbols); // first slot has been processed (FFTs + Channel Estimation, PCFICH/PHICH/PDCCH) - if (LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { stop_meas(&ue->ue_front_end_per_slot_stat[ue->current_thread_id[subframe_rx]][0]); LOG_D(PHY, "[AbsSFN %d.%d] Slot0: FFT + Channel Estimate + PCFICH/PHICH/PDCCH %5.2f \n",frame_rx,subframe_rx, ue->ue_front_end_per_slot_stat[ue->current_thread_id[subframe_rx]][0].p_time/(cpuf*1000.0)); @@ -4099,7 +4099,7 @@ int phy_procedures_slot_parallelization_UE_RX(PHY_VARS_UE *ue, wait++; } - if (LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { stop_meas(&ue->ue_front_end_stat[ue->current_thread_id[subframe_rx]]); LOG_D(PHY, "[AbsSFN %d.%d] FULL FE Processing %5.2f \n",frame_rx,subframe_rx,ue->ue_front_end_per_slot_stat[ue->current_thread_id[subframe_rx]][0].p_time/(cpuf*1000.0)); } @@ -4116,11 +4116,11 @@ int phy_procedures_slot_parallelization_UE_RX(PHY_VARS_UE *ue, //printf("AbsSubframe %d.%d Pdsch Procedure (slot0)\n",frame_rx%1024,subframe_rx); //printf("AbsSubframe %d.%d Pdsch Procedure PDSCH Active %d \n",frame_rx%1024,subframe_rx, ue->dlsch[ue->current_thread_id[subframe_rx]][0][0]->active); - if (LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { start_meas(&ue->pdsch_procedures_stat[ue->current_thread_id[subframe_rx]]); } - if (LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { start_meas(&ue->pdsch_procedures_per_slot_stat[ue->current_thread_id[subframe_rx]][0]); } @@ -4187,7 +4187,7 @@ int phy_procedures_slot_parallelization_UE_RX(PHY_VARS_UE *ue, proc->dci_slot0_available=1; //printf("Set available dci slot0 to 1 AbsSubframe %d.%d \n",frame_rx%1024,subframe_rx); - if (LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { stop_meas(&ue->pdsch_procedures_per_slot_stat[ue->current_thread_id[subframe_rx]][0]); LOG_D(PHY, "[AbsSFN %d.%d] Slot0: LLR Computation %5.2f \n",frame_rx,subframe_rx,ue->pdsch_procedures_per_slot_stat[ue->current_thread_id[subframe_rx]][0].p_time/(cpuf*1000.0)); } @@ -4200,13 +4200,13 @@ int phy_procedures_slot_parallelization_UE_RX(PHY_VARS_UE *ue, wait++; } - if (LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { stop_meas(&ue->pdsch_procedures_stat[ue->current_thread_id[subframe_rx]]); LOG_D(PHY, "[AbsSFN %d.%d] Full LLR Computation %5.2f \n",frame_rx,subframe_rx,ue->pdsch_procedures_stat[ue->current_thread_id[subframe_rx]].p_time/(cpuf*1000.0)); } //=====================================================================// - if (LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { start_meas(&ue->dlsch_procedures_stat[ue->current_thread_id[subframe_rx]]); } @@ -4272,7 +4272,7 @@ int phy_procedures_slot_parallelization_UE_RX(PHY_VARS_UE *ue, ue->dlsch_ra[eNB_id]->active = 0; } - if (LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { stop_meas(&ue->dlsch_procedures_stat[ue->current_thread_id[subframe_rx]]); LOG_D(PHY, "[AbsSFN %d.%d] Channel Decoder: %5.2f \n",frame_rx,subframe_rx,ue->dlsch_procedures_stat[ue->current_thread_id[subframe_rx]].p_time/(cpuf*1000.0)); } @@ -4332,7 +4332,7 @@ int phy_procedures_slot_parallelization_UE_RX(PHY_VARS_UE *ue, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_OUT); - if (LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { stop_meas(&ue->phy_proc_rx[ue->current_thread_id[subframe_rx]]); LOG_I(PHY, "------FULL RX PROC [AbsSFN %d.%d]: %5.2f ------\n",frame_rx,subframe_rx,ue->phy_proc_rx[ue->current_thread_id[subframe_rx]].p_time/(cpuf*1000.0)); } @@ -4371,7 +4371,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue, LOG_I(PHY," ****** start RX-Chain for AbsSubframe->0 %d.%d ****** \n", frame_rx%1024, subframe_rx); } - if(LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { start_meas(&ue->phy_proc_rx[ue->current_thread_id[subframe_rx]]); start_meas(&ue->ue_front_end_stat[ue->current_thread_id[subframe_rx]]); } @@ -4447,7 +4447,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue, for (; l<=l2; l++) { if (abstraction_flag == 0) { - if (LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { start_meas(&ue->ofdm_demod_stats); } @@ -4460,7 +4460,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue, 0); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP, VCD_FUNCTION_OUT); - if (LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { stop_meas(&ue->ofdm_demod_stats); } } @@ -4516,14 +4516,14 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue, 0); // first slot has been processed (FFTs + Channel Estimation, PCFICH/PHICH/PDCCH) - if (LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { stop_meas(&ue->ue_front_end_stat[ue->current_thread_id[subframe_rx]]); LOG_I(PHY, "[SFN %d] Slot0: FFT + Channel Estimate + PCFICH/PHICH/PDCCH %5.2f \n",subframe_rx,ue->ue_front_end_stat[ue->current_thread_id[subframe_rx]].p_time/(cpuf*1000.0)); } LOG_D(PHY," ------ --> PDSCH ChannelComp/LLR slot 0: AbsSubframe %d.%d ------ \n", frame_rx%1024, subframe_rx); - if (LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { start_meas(&ue->generic_stat); start_meas(&ue->crnti_procedures_stats); } @@ -4543,7 +4543,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_OUT); } - if (LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { stop_meas(&ue->crnti_procedures_stats); } @@ -4600,7 +4600,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue, if (subframe_select(&ue->frame_parms,subframe_rx) != SF_S) { // do front-end processing for second slot, and first symbol of next subframe for (l=1; lframe_parms.symbols_per_tti>>1; l++) { if (abstraction_flag == 0) { - if (LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { start_meas(&ue->ofdm_demod_stats); } @@ -4613,7 +4613,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue, 0); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SLOT_FEP, VCD_FUNCTION_OUT); - if (LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { stop_meas(&ue->ofdm_demod_stats); } } @@ -4635,7 +4635,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue, } } // not an S-subframe - if(LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { stop_meas(&ue->generic_stat); LOG_I(PHY, "[SFN %d] Slot1: FFT + Channel Estimate + Pdsch Proc Slot0 %5.2f \n",subframe_rx,ue->generic_stat.p_time/(cpuf*1000.0)); } @@ -4652,7 +4652,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue, if (ue->dlsch[ue->current_thread_id[subframe_rx]][eNB_id][0]->active == 1) { VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_IN); - if (LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { start_meas(&ue->pdsch_procedures_stat[ue->current_thread_id[subframe_rx]]); } @@ -4668,7 +4668,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue, LOG_D(PHY," ------ end PDSCH ChannelComp/LLR slot 0: AbsSubframe %d.%d ------ \n", frame_rx%1024, subframe_rx); LOG_D(PHY," ------ --> PDSCH Turbo Decoder slot 0/1: AbsSubframe %d.%d ------ \n", frame_rx%1024, subframe_rx); - if (LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { stop_meas(&ue->pdsch_procedures_stat[ue->current_thread_id[subframe_rx]]); start_meas(&ue->dlsch_procedures_stat[ue->current_thread_id[subframe_rx]]); } @@ -4683,7 +4683,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue, mode, abstraction_flag); - if (LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { stop_meas(&ue->dlsch_procedures_stat[ue->current_thread_id[subframe_rx]]); LOG_I(PHY, "[SFN %d] Slot1: Pdsch Proc %5.2f\n",subframe_rx,ue->pdsch_procedures_stat[ue->current_thread_id[subframe_rx]].p_time/(cpuf*1000.0)); LOG_I(PHY, "[SFN %d] Slot0 Slot1: Dlsch Proc %5.2f\n",subframe_rx,ue->dlsch_procedures_stat[ue->current_thread_id[subframe_rx]].p_time/(cpuf*1000.0)); @@ -4692,7 +4692,7 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PDSCH_PROC, VCD_FUNCTION_OUT); } - if (LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { start_meas(&ue->generic_stat); } @@ -4818,14 +4818,14 @@ int phy_procedures_UE_RX(PHY_VARS_UE *ue, } } - if ( LOG_DEBUGFLAG(UE_TIMING)) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { stop_meas(&ue->generic_stat); LOG_I(PHY,"after tubo until end of Rx %5.2f \n",ue->generic_stat.p_time/(cpuf*1000.0)); } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_OUT); - if ( LOG_DEBUGFLAG(UE_TIMING) ) { + if (LOG_DEBUGFLAG(DEBUG_UE_TIMING)) { stop_meas(&ue->phy_proc_rx[ue->current_thread_id[subframe_rx]]); LOG_I(PHY, "------FULL RX PROC [SFN %d]: %5.2f ------\n",subframe_rx,ue->phy_proc_rx[ue->current_thread_id[subframe_rx]].p_time/(cpuf*1000.0)); } diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index 40d35c4a00..5cfb21f8b0 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -892,7 +892,7 @@ int main(int argc, char **argv) { set_glog_onlinelog(true); // enable these lines if you need debug info set_glog(loglvl); - SET_LOG_DEBUG(UE_TIMING); + SET_LOG_DEBUG(DEBUG_UE_TIMING); // moreover you need to init itti with the following line // however itti will catch all signals, so ctrl-c won't work anymore // alternatively you can disable ITTI completely in CMakeLists.txt diff --git a/openair1/SIMULATION/LTE_PHY/mbmssim.c b/openair1/SIMULATION/LTE_PHY/mbmssim.c index f10c287a1a..ac50bf62bd 100644 --- a/openair1/SIMULATION/LTE_PHY/mbmssim.c +++ b/openair1/SIMULATION/LTE_PHY/mbmssim.c @@ -989,7 +989,7 @@ int main(int argc, char **argv) { set_glog_onlinelog(true); // enable these lines if you need debug info set_glog(loglvl); - SET_LOG_DEBUG(UE_TIMING); + set_log_debug("UE_TIMING", true); // moreover you need to init itti with the following line // however itti will catch all signals, so ctrl-c won't work anymore // alternatively you can disable ITTI completely in CMakeLists.txt diff --git a/openair1/SIMULATION/LTE_PHY/ulsim.c b/openair1/SIMULATION/LTE_PHY/ulsim.c index 14e3c69696..d17f767a2a 100644 --- a/openair1/SIMULATION/LTE_PHY/ulsim.c +++ b/openair1/SIMULATION/LTE_PHY/ulsim.c @@ -938,7 +938,7 @@ int main(int argc, char **argv) { ndi=0; phy_reset_ue(0,0,0); UE->UE_mode[eNB_id]=PUSCH; - SET_LOG_DEBUG(UE_TIMING); + set_log_debug("UE_TIMING", true); for (trials = 0; trials UE if (NFAPI_MODE == NFAPI_UE_STUB_PNF || NFAPI_MODE == NFAPI_MODE_STANDALONE_PNF) { -#ifdef UESIM_EXPANSION - ctxt.module_id = inst_pdcp_list[pdcp_read_header_g.inst]; -#else ctxt.module_id = pdcp_read_header_g.inst; -#endif } else { ctxt.module_id = 0; } diff --git a/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.h b/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.h index 3ed4428db6..4a26bc8a28 100644 --- a/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.h +++ b/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.h @@ -45,46 +45,6 @@ mac_rrc_data_req( const uint8_t mbsfn_sync_areaP ); -/*int8_t -mac_rrc_data_ind( - const module_id_t module_idP, - const int CC_id, - const frame_t frameP, - const sub_frame_t sub_frameP, - const int UE_id, - const rnti_t rntiP, - const rb_id_t srb_idP, - const uint8_t* sduP, - const sdu_size_t sdu_lenP, - const uint8_t mbsfn_sync_areaP -); - -int8_t -mac_rrc_data_req_ue( - const module_id_t module_idP, - const int CC_idP, - const frame_t frameP, - const rb_id_t srb_idP, - const uint8_t nb_tbP, - uint8_t* const buffer_pP, - const mac_enb_index_t eNB_indexP, - const uint8_t mbsfn_sync_areaP -); - -int8_t -mac_rrc_data_ind_ue( - const module_id_t module_idP, - const int CC_idP, - const frame_t frameP, - const sub_frame_t sub_frameP, - const rnti_t rntiP, - const rb_id_t srb_idP, - const uint8_t *sduP, - const sdu_size_t sdu_lenP, - const mac_enb_index_t eNB_indexP, - const uint8_t mbsfn_sync_area -);*/ - void mac_lite_sync_ind( const module_id_t module_idP, const uint8_t statusP); @@ -128,10 +88,6 @@ void mac_out_of_sync_ind( char openair_rrc_eNB_init( const module_id_t module_idP); -char openair_rrc_ue_init( - const module_id_t module_idP, - const unsigned char eNB_indexP); - int mac_eNB_get_rrc_status( const module_id_t module_idP, @@ -143,12 +99,6 @@ mac_UE_get_rrc_status( const uint8_t sig_indexP ); -char -openair_rrc_ue_init( - const module_id_t module_idP, - const unsigned char eNB_indexP -); - void mac_in_sync_ind( const module_id_t module_idP, const frame_t frameP, diff --git a/openair2/RRC/LTE/rrc_UE.c b/openair2/RRC/LTE/rrc_UE.c index 105153ed87..1e12543604 100644 --- a/openair2/RRC/LTE/rrc_UE.c +++ b/openair2/RRC/LTE/rrc_UE.c @@ -241,18 +241,24 @@ static int rrc_set_sub_state( module_id_t ue_mod_idP, Rrc_Sub_State_t subState ) if (!IS_SOFTMODEM_NOS1) { switch (UE_rrc_inst[ue_mod_idP].RrcState) { case RRC_STATE_INACTIVE: - AssertFatal ((RRC_SUB_STATE_INACTIVE_FIRST <= subState) && (subState <= RRC_SUB_STATE_INACTIVE_LAST), - "Invalid sub state %d for state %d!\n", subState, UE_rrc_inst[ue_mod_idP].RrcState); + AssertFatal(RRC_SUB_STATE_INACTIVE <= subState, + "Invalid sub state %d for state %d!\n", + subState, + UE_rrc_inst[ue_mod_idP].RrcState); break; case RRC_STATE_IDLE: - AssertFatal ((RRC_SUB_STATE_IDLE_FIRST <= subState) && (subState <= RRC_SUB_STATE_IDLE_LAST), - "Invalid sub state %d for state %d!\n", subState, UE_rrc_inst[ue_mod_idP].RrcState); + AssertFatal((RRC_SUB_STATE_IDLE_SEARCHING <= subState) && (subState <= RRC_SUB_STATE_IDLE), + "Invalid sub state %d for state %d!\n", + subState, + UE_rrc_inst[ue_mod_idP].RrcState); break; case RRC_STATE_CONNECTED: - AssertFatal ((RRC_SUB_STATE_CONNECTED_FIRST <= subState) && (subState <= RRC_SUB_STATE_CONNECTED_LAST), - "Invalid sub state %d for state %d!\n", subState, UE_rrc_inst[ue_mod_idP].RrcState); + AssertFatal(RRC_SUB_STATE_CONNECTED <= subState, + "Invalid sub state %d for state %d!\n", + subState, + UE_rrc_inst[ue_mod_idP].RrcState); break; } } @@ -6295,10 +6301,6 @@ rrc_rx_tx_ue( ) //----------------------------------------------------------------------------- { -#ifdef LOCALIZATION - double estimated_distance; - protocol_ctxt_t ctxt; -#endif VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_IN); // check timers diff --git a/openair2/RRC/LTE/rrc_defs.h b/openair2/RRC/LTE/rrc_defs.h index d180c47c87..959abc11f9 100644 --- a/openair2/RRC/LTE/rrc_defs.h +++ b/openair2/RRC/LTE/rrc_defs.h @@ -752,17 +752,6 @@ typedef struct eNB_RRC_INST_s { hash_table_t *initial_id2_s1ap_ids; // key is content is rrc_ue_s1ap_ids_t hash_table_t *s1ap_id2_s1ap_ids ; // key is content is rrc_ue_s1ap_ids_t -#ifdef LOCALIZATION - /// localization type, 0: power based, 1: time based - uint8_t loc_type; - /// epoch timestamp in millisecond, RRC - int32_t reference_timestamp_ms; - /// aggregate physical states every n millisecond - int32_t aggregation_period_ms; - /// localization list for aggregated measurements from PHY - struct list loc_list; -#endif - //RRC configuration RrcConfigurationReq configuration; diff --git a/openair2/RRC/LTE/rrc_types.h b/openair2/RRC/LTE/rrc_types.h index 6b339af563..ffd2f306bb 100644 --- a/openair2/RRC/LTE/rrc_types.h +++ b/openair2/RRC/LTE/rrc_types.h @@ -41,7 +41,7 @@ typedef enum Rrc_State_e { } Rrc_State_t; typedef enum Rrc_Sub_State_e { - RRC_SUB_STATE_INACTIVE=0, + RRC_SUB_STATE_INACTIVE = 0, RRC_SUB_STATE_IDLE_SEARCHING, RRC_SUB_STATE_IDLE_RECEIVING_SIB, @@ -50,15 +50,6 @@ typedef enum Rrc_Sub_State_e { RRC_SUB_STATE_IDLE, RRC_SUB_STATE_CONNECTED, - - RRC_SUB_STATE_INACTIVE_FIRST = RRC_SUB_STATE_INACTIVE, - RRC_SUB_STATE_INACTIVE_LAST = RRC_SUB_STATE_INACTIVE, - - RRC_SUB_STATE_IDLE_FIRST = RRC_SUB_STATE_IDLE_SEARCHING, - RRC_SUB_STATE_IDLE_LAST = RRC_SUB_STATE_IDLE, - - RRC_SUB_STATE_CONNECTED_FIRST = RRC_SUB_STATE_CONNECTED, - RRC_SUB_STATE_CONNECTED_LAST = RRC_SUB_STATE_CONNECTED, } Rrc_Sub_State_t; typedef enum Rrc_Msg_Type_e { diff --git a/openair3/NAS/COMMON/API/NETWORK/nas_message.c b/openair3/NAS/COMMON/API/NETWORK/nas_message.c index 80551c5b5c..a3bb781f92 100644 --- a/openair3/NAS/COMMON/API/NETWORK/nas_message.c +++ b/openair3/NAS/COMMON/API/NETWORK/nas_message.c @@ -47,7 +47,7 @@ Description Defines the layer 3 messages supported by the NAS sublayer #include // malloc, free #include // memcpy -#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE))) +#if defined(NAS_BUILT_IN_UE) # include "nas_itti_messaging.h" #endif #include "secu_defs.h" @@ -158,15 +158,12 @@ nas_message_encrypt( LOG_FUNC_RETURN (TLV_ENCODE_BUFFER_TOO_SHORT); } else if (size > 1) { /* Encrypt the plain NAS message */ - bytes = _nas_message_encrypt(outbuf + size, inbuf, + bytes = _nas_message_encrypt(outbuf + size, + inbuf, header->security_header_type, header->message_authentication_code, header->sequence_number, -#ifdef NAS_MME - SECU_DIRECTION_DOWNLINK, -#else SECU_DIRECTION_UPLINK, -#endif length - size, emm_security_context); @@ -175,15 +172,7 @@ nas_message_encrypt( /* Compute offset of the sequence number field */ int offset = size - sizeof(uint8_t); /* Compute the NAS message authentication code */ - uint32_t mac = _nas_message_get_mac( - outbuf + offset, - bytes + size - offset, -#ifdef NAS_MME - SECU_DIRECTION_DOWNLINK, -#else - SECU_DIRECTION_UPLINK, -#endif - emm_security_context); + uint32_t mac = _nas_message_get_mac(outbuf + offset, bytes + size - offset, SECU_DIRECTION_UPLINK, emm_security_context); /* Set the message authentication code of the NAS message */ *(uint32_t*)(outbuf + sizeof(uint8_t)) = htonl(mac); } @@ -191,29 +180,6 @@ nas_message_encrypt( /* The input buffer does not need to be encrypted */ memcpy(outbuf, inbuf, length); } - -#ifdef NAS_MME - /* TS 124.301, section 4.4.3.1 - * The NAS sequence number part of the NAS COUNT shall be - * exchanged between the UE and the MME as part of the - * NAS signalling. After each new or retransmitted outbound - * security protected NAS message, the sender shall increase - * the NAS COUNT number by one. Specifically, on the sender - * side, the NAS sequence number shall be increased by one, - * and if the result is zero (due to wrap around), the NAS - * overflow counter shall also be incremented by one (see - * subclause 4.4.3.5). - */ - emm_security_context->dl_count.seq_num += 1; - - if ( ! emm_security_context->dl_count.seq_num) { - emm_security_context->dl_count.overflow += 1; - } - - LOG_TRACE(DEBUG, - "Incremented emm_security_context.dl_count.seq_num -> %u", - emm_security_context->dl_count.seq_num); -#else emm_security_context->ul_count.seq_num += 1; if ( ! emm_security_context->ul_count.seq_num) { @@ -223,8 +189,6 @@ nas_message_encrypt( LOG_TRACE(DEBUG, "Incremented emm_security_context.ul_count.seq_num -> %u", emm_security_context->ul_count.seq_num); -#endif - if (bytes < 0) { LOG_FUNC_RETURN (bytes); } @@ -276,48 +240,30 @@ int nas_message_decrypt( LOG_FUNC_RETURN (TLV_DECODE_BUFFER_TOO_SHORT); } else if (size > 1) { if (security) { - emm_security_context = (emm_security_context_t*)security; -#if defined(NAS_MME) - - if (emm_security_context->ul_count.seq_num > header->sequence_number) { - emm_security_context->ul_count.overflow += 1; - } - - emm_security_context->ul_count.seq_num = header->sequence_number; -#else + emm_security_context = (emm_security_context_t *)security; if (emm_security_context->dl_count.seq_num > header->sequence_number) { emm_security_context->dl_count.overflow += 1; } emm_security_context->dl_count.seq_num = header->sequence_number; -#endif } /* Compute offset of the sequence number field */ int offset = size - sizeof(uint8_t); /* Compute the NAS message authentication code */ - uint32_t mac = _nas_message_get_mac( - inbuf + offset, - length - offset, -#ifdef NAS_MME - SECU_DIRECTION_UPLINK, -#else - SECU_DIRECTION_DOWNLINK, -#endif - emm_security_context); + uint32_t mac = _nas_message_get_mac(inbuf + offset, length - offset, SECU_DIRECTION_DOWNLINK, emm_security_context); /* Check NAS message integrity */ if (mac != header->message_authentication_code) { - LOG_TRACE(DEBUG, "MAC Failure MSG:%08X(%u) <> INT ALGO:%08X(%u) Type of security context %u", - header->message_authentication_code,header->message_authentication_code, - mac,mac, (emm_security_context!=NULL)?emm_security_context->type:88); -#if defined(NAS_MME) - LOG_FUNC_RETURN (TLV_DECODE_MAC_MISMATCH); -#else -//#warning "added test on integrity algorithm because of SECURITY_MODE_COMMAND not correctly handled in UE (check integrity)" + header->message_authentication_code, + header->message_authentication_code, + mac, + mac, + (emm_security_context != NULL) ? emm_security_context->type : 88); + // #warning "added test on integrity algorithm because of SECURITY_MODE_COMMAND not correctly handled in UE (check integrity)" if (emm_security_context->selected_algorithms.integrity != NAS_SECURITY_ALGORITHMS_EIA0) { @@ -326,8 +272,6 @@ int nas_message_decrypt( LOG_TRACE(WARNING, "MAC failure but continue due to EIA0 selected"); } - -#endif } else { LOG_TRACE(DEBUG, "Integrity: MAC Success"); } @@ -385,38 +329,19 @@ int nas_message_decode( LOG_FUNC_RETURN (TLV_DECODE_BUFFER_TOO_SHORT); } else if (size > 1) { if (security) { - emm_security_context = (emm_security_context_t*)security; -#if defined(NAS_MME) - - if (emm_security_context->ul_count.seq_num > msg->header.sequence_number) { - emm_security_context->ul_count.overflow += 1; - } - - emm_security_context->ul_count.seq_num = msg->header.sequence_number; - -#else + emm_security_context = (emm_security_context_t *)security; if (emm_security_context->dl_count.seq_num > msg->header.sequence_number) { emm_security_context->dl_count.overflow += 1; } emm_security_context->dl_count.seq_num = msg->header.sequence_number; -#endif } /* Compute offset of the sequence number field */ int offset = size - sizeof(uint8_t); /* Compute the NAS message authentication code */ - uint32_t mac = _nas_message_get_mac( - buffer + offset, - length - offset, -#ifdef NAS_MME - SECU_DIRECTION_UPLINK, -#else - SECU_DIRECTION_DOWNLINK, -#endif - emm_security_context - ); + uint32_t mac = _nas_message_get_mac(buffer + offset, length - offset, SECU_DIRECTION_DOWNLINK, emm_security_context); #define NAS_CODE_TO_BE_MODIFIED 1 #ifdef NAS_CODE_TO_BE_MODIFIED @@ -445,10 +370,6 @@ int nas_message_decode( LOG_FUNC_RETURN (TLV_DECODE_MAC_MISMATCH); } -#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE))) - /* Log message header */ -#endif - /* Decode security protected NAS message */ bytes = _nas_message_protected_decode(buffer + size, &msg->header, @@ -525,62 +446,24 @@ int nas_message_encode( "offset %d = %d - %d, hdr encode = %d, length = %d bytes = %d", offset, size, (int)sizeof(uint8_t), size, length, bytes); - uint32_t mac = _nas_message_get_mac( - buffer + offset, - bytes + size - offset, -#ifdef NAS_MME - SECU_DIRECTION_DOWNLINK, -#else - SECU_DIRECTION_UPLINK, -#endif - emm_security_context); + uint32_t mac = _nas_message_get_mac(buffer + offset, bytes + size - offset, SECU_DIRECTION_UPLINK, emm_security_context); /* Set the message authentication code of the NAS message */ uint32_t mac_nl = htonl(mac); memcpy(buffer + sizeof(uint8_t), &mac_nl, sizeof(mac_nl)); if (emm_security_context) { -#ifdef NAS_MME - /* TS 124.301, section 4.4.3.1 - * The NAS sequence number part of the NAS COUNT shall be - * exchanged between the UE and the MME as part of the - * NAS signalling. After each new or retransmitted outbound - * security protected NAS message, the sender shall increase - * the NAS COUNT number by one. Specifically, on the sender - * side, the NAS sequence number shall be increased by one, - * and if the result is zero (due to wrap around), the NAS - * overflow counter shall also be incremented by one (see - * subclause 4.4.3.5). - */ - - emm_security_context->dl_count.seq_num += 1; - - if ( ! emm_security_context->dl_count.seq_num) { - emm_security_context->dl_count.overflow += 1; - } - - LOG_TRACE(DEBUG, - "Incremented emm_security_context.dl_count.seq_num -> %u", - emm_security_context->dl_count.seq_num); -#else emm_security_context->ul_count.seq_num += 1; if ( ! emm_security_context->ul_count.seq_num) { emm_security_context->ul_count.overflow += 1; } - LOG_TRACE(DEBUG, - "Incremented emm_security_context.ul_count.seq_num -> %u", - emm_security_context->ul_count.seq_num); -#endif + LOG_TRACE(DEBUG, "Incremented emm_security_context.ul_count.seq_num -> %u", emm_security_context->ul_count.seq_num); } else { LOG_TRACE(DEBUG, "Did not increment emm_security_context.dl_count.seq_num because no security context"); } } - -#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE))) - /* Log message header */ -#endif } else { /* Encode plain NAS message */ bytes = _nas_message_plain_encode(buffer, &msg->header, @@ -907,11 +790,7 @@ static int _nas_message_protected_encode( msg->header.security_header_type, msg->header.message_authentication_code, msg->header.sequence_number, -#ifdef NAS_MME - SECU_DIRECTION_DOWNLINK, -#else SECU_DIRECTION_UPLINK, -#endif size, emm_security_context); //seq, size); @@ -967,11 +846,7 @@ static int _nas_message_decrypt( int size = 0; nas_message_security_header_t header; -#ifdef NAS_MME - direction = SECU_DIRECTION_UPLINK; -#else direction = SECU_DIRECTION_DOWNLINK; -#endif if (emm_security_context == NULL) LOG_FUNC_RETURN (0); @@ -1287,7 +1162,7 @@ static uint32_t _nas_message_get_mac( if (!emm_security_context) { LOG_TRACE(DEBUG, "No security context set for integrity protection algorithm"); -#if defined(NAS_BUILT_IN_EPC) || defined(NAS_BUILT_IN_UE) +#if defined(NAS_BUILT_IN_UE) LOG_FUNC_RETURN (0); #else LOG_FUNC_RETURN (0xabababab); @@ -1415,7 +1290,7 @@ static uint32_t _nas_message_get_mac( (direction == SECU_DIRECTION_UPLINK) ? emm_security_context->ul_count.seq_num:emm_security_context->dl_count.seq_num ); -#if defined(NAS_BUILT_IN_EPC) || defined(NAS_BUILT_IN_UE) +#if defined(NAS_BUILT_IN_UE) LOG_FUNC_RETURN (0); #else LOG_FUNC_RETURN (0xabababab); diff --git a/openair3/NAS/COMMON/API/NETWORK/nas_message.h b/openair3/NAS/COMMON/API/NETWORK/nas_message.h index 8fde6eb97d..19dbf38fe6 100644 --- a/openair3/NAS/COMMON/API/NETWORK/nas_message.h +++ b/openair3/NAS/COMMON/API/NETWORK/nas_message.h @@ -42,11 +42,7 @@ Description Defines the layer 3 messages supported by the NAS sublayer #include "commonDef.h" #include "emm_msg.h" -#if defined(NAS_BUILT_IN_EPC) -#include "emmData.h" -#endif #include "esm_msg.h" - /****************************************************************************/ /********************* G L O B A L C O N S T A N T S *******************/ /****************************************************************************/ diff --git a/openair3/NAS/COMMON/API/NETWORK/network_api.c b/openair3/NAS/COMMON/API/NETWORK/network_api.c index a2ef101e92..0d99c8c570 100644 --- a/openair3/NAS/COMMON/API/NETWORK/network_api.c +++ b/openair3/NAS/COMMON/API/NETWORK/network_api.c @@ -129,13 +129,7 @@ int network_api_initialize(const char* host, const char* port) _network_api_id.send = socket_send; _network_api_id.close = socket_close; /* Initialize UDP communication channel with the network layer */ -#ifdef NAS_UE _network_api_id.endpoint = NETWORK_API_OPEN(SOCKET_CLIENT, host, port); -#endif -#ifdef NAS_MME - _network_api_id.endpoint = NETWORK_API_OPEN(SOCKET_SERVER, NULL, port); -#endif - if (_network_api_id.endpoint == NULL) { LOG_TRACE(ERROR, "NET-API - Failed to open connection endpoint, %s", ((errno < 0) ? gai_strerror(errno) : strerror(errno))); diff --git a/openair3/NAS/COMMON/EMM/MSG/emm_msg.c b/openair3/NAS/COMMON/EMM/MSG/emm_msg.c index cd55a3fffb..8ce145deec 100644 --- a/openair3/NAS/COMMON/EMM/MSG/emm_msg.c +++ b/openair3/NAS/COMMON/EMM/MSG/emm_msg.c @@ -86,14 +86,6 @@ int emm_msg_decode(EMM_msg *msg, uint8_t *buffer, uint32_t len) { LOG_FUNC_IN; int header_result; int decode_result; - uint8_t *buffer_log = buffer; - uint32_t len_log = len; - int down_link; -# if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME))) - down_link = 0; -# else - down_link = 1; -# endif /* First decode the EMM message header */ header_result = _emm_msg_decode_header(&msg->header, buffer, len); @@ -247,14 +239,13 @@ int emm_msg_decode(EMM_msg *msg, uint8_t *buffer, uint32_t len) { if (decode_result < 0) { LOG_TRACE(ERROR, "EMM-MSG - Failed to decode L3 EMM message 0x%x " "(%d)", msg->header.message_type, decode_result); - LOG_FUNC_RETURN (decode_result); + LOG_FUNC_RETURN(decode_result); } else { -#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE))) /* Message has been decoded and security header removed, handle it has a plain message */ - nas_itti_plain_msg((char *) buffer_log, (nas_message_t *) msg, len_log, down_link); +#if defined(NAS_BUILT_IN_EPC) + nas_itti_plain_msg((char *)buffer_log, (nas_message_t *)msg, len_log, 0); #endif } - LOG_FUNC_RETURN (header_result + decode_result); } @@ -279,13 +270,6 @@ int emm_msg_encode(EMM_msg *msg, uint8_t *buffer, uint32_t len) { LOG_FUNC_IN; int header_result; int encode_result; - uint8_t *buffer_log = buffer; - int down_link; -# if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME))) - down_link = 1; -# else - down_link = 0; -# endif /* First encode the EMM message header */ header_result = _emm_msg_encode_header(&msg->header, buffer, len); @@ -443,8 +427,8 @@ int emm_msg_encode(EMM_msg *msg, uint8_t *buffer, uint32_t len) { LOG_TRACE(ERROR, "EMM-MSG - Failed to encode L3 EMM message 0x%x " "(%d)", msg->header.message_type, encode_result); } else { -#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE))) - nas_itti_plain_msg((char *) buffer_log, (nas_message_t *) msg, header_result + encode_result, down_link); +#if defined(NAS_BUILT_IN_EPC) + nas_itti_plain_msg((char *)buffer_log, (nas_message_t *)msg, header_result + encode_result, 1); #endif } diff --git a/openair3/NAS/COMMON/ESM/MSG/esm_msg.c b/openair3/NAS/COMMON/ESM/MSG/esm_msg.c index f4d3dd94dd..599120355e 100644 --- a/openair3/NAS/COMMON/ESM/MSG/esm_msg.c +++ b/openair3/NAS/COMMON/ESM/MSG/esm_msg.c @@ -43,10 +43,6 @@ Description Defines EPS Session Management messages #include "TLVDecoder.h" #include "TLVEncoder.h" -#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE))) -# include "nas_itti_messaging.h" -#endif - /****************************************************************************/ /**************** E X T E R N A L D E F I N I T I O N S ****************/ /****************************************************************************/ @@ -84,19 +80,6 @@ int esm_msg_decode(ESM_msg *msg, uint8_t *buffer, uint32_t len) { int header_result; int decode_result; - -#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE))) - uint8_t *buffer_log = buffer; - uint32_t len_log = len; - int down_link; - -# if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME))) - down_link = 0; -# else - down_link = 1; -# endif -#endif - LOG_FUNC_IN; /* First decode the ESM message header */ @@ -210,14 +193,12 @@ int esm_msg_decode(ESM_msg *msg, uint8_t *buffer, uint32_t len) if (decode_result < 0) { LOG_TRACE(ERROR, "ESM-MSG - Failed to decode L3 ESM message 0x%x " "(%u)", msg->header.message_type, decode_result); - LOG_FUNC_RETURN (decode_result); + LOG_FUNC_RETURN(decode_result); } else { -#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE))) - /* Message has been decoded and security header removed, handle it has a plain message */ - nas_itti_plain_msg((char *) buffer_log, (nas_message_t *) msg, len_log, down_link); +#if defined(NAS_BUILT_IN_EPC) + nas_itti_plain_msg((char *)buffer_log, (nas_message_t *)msg, len_log, 0); #endif } - LOG_FUNC_RETURN (header_result + decode_result); } @@ -245,17 +226,6 @@ int esm_msg_encode(ESM_msg *msg, uint8_t *buffer, uint32_t len) int header_result; int encode_result; -#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE))) - uint8_t *buffer_log = buffer; - int down_link; - -# if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME))) - down_link = 1; -# else - down_link = 0; -# endif -#endif - /* First encode the ESM message header */ header_result = _esm_msg_encode_header(&msg->header, buffer, len); @@ -371,11 +341,10 @@ int esm_msg_encode(ESM_msg *msg, uint8_t *buffer, uint32_t len) LOG_TRACE(ERROR, "ESM-MSG - Failed to encode L3 ESM message 0x%x " "(%d)", msg->header.message_type, encode_result); } else { -#if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) && defined(NAS_UE))) - nas_itti_plain_msg((char *) buffer_log, (nas_message_t *) msg, header_result + encode_result, down_link); +#if defined(NAS_BUILT_IN_EPC) + nas_itti_plain_msg((char *)buffer_log, (nas_message_t *)msg, header_result + encode_result, 1); #endif } - LOG_FUNC_RETURN (header_result + encode_result); } diff --git a/openair3/NAS/COMMON/UTIL/nas_log.h b/openair3/NAS/COMMON/UTIL/nas_log.h index d1531fa6db..710c165440 100644 --- a/openair3/NAS/COMMON/UTIL/nas_log.h +++ b/openair3/NAS/COMMON/UTIL/nas_log.h @@ -38,7 +38,7 @@ Description Usefull logging functions #ifndef __NAS_LOG_H__ #define __NAS_LOG_H__ -#if defined(NAS_BUILT_IN_UE) && defined(NAS_UE) +#if defined(NAS_BUILT_IN_UE) # include "common/utils/LOG/log.h" # undef LOG_TRACE #endif diff --git a/openair3/NAS/COMMON/UTIL/nas_timer.c b/openair3/NAS/COMMON/UTIL/nas_timer.c index b67a3bc232..0a521ceeb4 100644 --- a/openair3/NAS/COMMON/UTIL/nas_timer.c +++ b/openair3/NAS/COMMON/UTIL/nas_timer.c @@ -216,11 +216,7 @@ int nas_timer_start(long sec, nas_timer_callback_t cb, void *args) /* Insert the new entry into the timer queue */ _nas_timer_db_insert_entry(id, te); -# if defined(NAS_MME) - ret = timer_setup(sec, 0, TASK_NAS_MME, INSTANCE_DEFAULT, TIMER_PERIODIC, args, &timer_id); -# else ret = timer_setup(sec, 0, TASK_NAS_UE, INSTANCE_DEFAULT, TIMER_PERIODIC, args, &timer_id); -# endif if (ret == -1) { return NAS_TIMER_INACTIVE_ID; @@ -295,39 +291,6 @@ int nas_timer_restart(int id) return (NAS_TIMER_INACTIVE_ID); } -/****************************************************************************/ -/********************* L O C A L F U N C T I O N S *********************/ -/****************************************************************************/ - -/**************************************************************************** - ** ** - ** Name: _nas_timer_handler() ** - ** ** - ** Description: The timer handler is executed whenever the system deli- ** - ** vers signal SIGALARM. It starts execution of the callback ** - ** function of the first entry within the queue of active ** - ** timer entries. The entry is not removed from the queue of ** - ** active timer entries and shall be explicitly removed when ** - ** the timer expires. ** - ** ** - ** Inputs: None ** - ** Others: None ** - ** ** - ** Outputs: None ** - ** Return: None ** - ** Others: _nas_timer_db ** - ** ** - ***************************************************************************/ - -void nas_timer_handle_signal_expiry(long timer_id, void *arg_p) -{ - /* Get the timer entry for which the system timer expired */ - nas_timer_entry_t *te = _nas_timer_db.head->entry; - - te->cb(te->args); -} - - /* * ----------------------------------------------------------------------------- * Functions used to manage the timer database diff --git a/openair3/NAS/COMMON/UTIL/nas_timer.h b/openair3/NAS/COMMON/UTIL/nas_timer.h index b1149f21c0..2af27f63dd 100644 --- a/openair3/NAS/COMMON/UTIL/nas_timer.h +++ b/openair3/NAS/COMMON/UTIL/nas_timer.h @@ -74,8 +74,4 @@ int nas_timer_start(long sec, nas_timer_callback_t cb, void *args); int nas_timer_stop(int id); int nas_timer_restart(int id); -#if defined(NAS_BUILT_IN_EPC) -void nas_timer_handle_signal_expiry(long timer_id, void *arg_p); -#endif - #endif /* __NAS_TIMER_H__ */ diff --git a/openair3/NAS/UE/nas_itti_messaging.c b/openair3/NAS/UE/nas_itti_messaging.c index e7707a8ccd..6f64413b70 100644 --- a/openair3/NAS/UE/nas_itti_messaging.c +++ b/openair3/NAS/UE/nas_itti_messaging.c @@ -27,8 +27,7 @@ # define TASK_ORIGIN TASK_NAS_UE - -#if (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE) ) +#if defined(NAS_BUILT_IN_UE) __attribute__ ((unused)) static const uint8_t emm_message_ids[] = { ATTACH_REQUEST, ATTACH_ACCEPT, diff --git a/openair3/NAS/UE/nas_itti_messaging.h b/openair3/NAS/UE/nas_itti_messaging.h index 79b70394f0..7fdda32960 100644 --- a/openair3/NAS/UE/nas_itti_messaging.h +++ b/openair3/NAS/UE/nas_itti_messaging.h @@ -30,22 +30,13 @@ #ifndef NAS_ITTI_MESSAGING_H_ #define NAS_ITTI_MESSAGING_H_ -# if (defined(ENABLE_NAS_UE_LOGGING) && defined(NAS_BUILT_IN_UE)) int nas_itti_plain_msg( const char *buffer, const nas_message_t *msg, const int lengthP, const int instance); -int nas_itti_protected_msg( - const char *buffer, - const nas_message_t *msg, - const int lengthP, - const int instance); -# endif - - -# if defined(NAS_BUILT_IN_UE) +int nas_itti_protected_msg(const char *buffer, const nas_message_t *msg, const int lengthP, const int instance); int nas_itti_kenb_refresh_req(const Byte_t kenb[32], int user_id); @@ -56,5 +47,4 @@ int nas_itti_nas_establish_req(as_cause_t cause, as_call_type_t type, as_stmsi_t int nas_itti_ul_data_req(const uint32_t ue_idP, void *const data_pP, const uint32_t lengthP, int user_id); int nas_itti_rab_establish_rsp(const as_stmsi_t s_tmsi, const as_rab_id_t rabID, const nas_error_code_t errCode, int user_id); -# endif #endif /* NAS_ITTI_MESSAGING_H_ */ diff --git a/openair3/NAS/UE/nas_ue_task.c b/openair3/NAS/UE/nas_ue_task.c index dfb4a98d4f..473ca46834 100644 --- a/openair3/NAS/UE/nas_ue_task.c +++ b/openair3/NAS/UE/nas_ue_task.c @@ -34,8 +34,6 @@ #include "nas_user.h" #include "common/ran_context.h" -// FIXME make command line option for NAS_UE_AUTOSTART -# define NAS_UE_AUTOSTART 1 // FIXME review these externs extern uint16_t NB_UE_INST; @@ -203,15 +201,12 @@ void *nas_ue_task(void *args_p) switch (ITTI_MSG_ID(msg_p)) { case INITIALIZE_MESSAGE: - LOG_I(NAS, "[UE %d] Received %s\n", Mod_id, ITTI_MSG_NAME (msg_p)); -#if (NAS_UE_AUTOSTART != 0) + LOG_I(NAS, "[UE %d] Received %s\n", Mod_id, ITTI_MSG_NAME(msg_p)); { /* Send an activate modem command to NAS like UserProcess should do it */ char *user_data = "at+cfun=1\r"; - nas_user_receive_and_process (user, user_data); } -#endif break; case TERMINATE_MESSAGE: diff --git a/openair3/SECU/key_nas_deriver.c b/openair3/SECU/key_nas_deriver.c index 8a7b32ee2f..20aba64e1e 100644 --- a/openair3/SECU/key_nas_deriver.c +++ b/openair3/SECU/key_nas_deriver.c @@ -139,7 +139,6 @@ void nr_derive_key(algorithm_type_dist_t alg_type, uint8_t alg_id, const uint8_t * NOTE: knas is dynamically allocated by the KDF function */ -#ifndef NAS_UE void derive_keNB(const uint8_t kasme[32], const uint32_t nas_count, uint8_t *keNB) { uint8_t s[7] = {0}; @@ -159,7 +158,6 @@ void derive_keNB(const uint8_t kasme[32], const uint32_t nas_count, uint8_t *keN byte_array_t data = {.buf = s, .len = 7}; kdf(kasme, data, 32, keNB); } -#endif void derive_keNB_star(const uint8_t *kenb_32, const uint16_t pci,