Commit fb465455 authored by frtabu's avatar frtabu

Fix corrupted LOGs in L1L2simulator, introducing two new components NFAPI_VNF...

Fix corrupted LOGs in L1L2simulator, introducing two new components NFAPI_VNF and NFAPI_pnf. Integrate Fujitsu fix for up to 50 UEs. Apply astyle to all modified files in the branch
parent f3dc8d44
...@@ -303,8 +303,8 @@ void log_getconfig(log_t *g_log) { ...@@ -303,8 +303,8 @@ void log_getconfig(log_t *g_log) {
logparams_dump[i].numelt = 0; logparams_dump[i].numelt = 0;
} }
config_get( logparams_debug,(sizeof(log_maskmap)/sizeof(mapping)) - 1 ,CONFIG_STRING_LOG_PREFIX); config_get( logparams_debug,(sizeof(log_maskmap)/sizeof(mapping)) - 1,CONFIG_STRING_LOG_PREFIX);
config_get( logparams_dump,(sizeof(log_maskmap)/sizeof(mapping)) - 1 ,CONFIG_STRING_LOG_PREFIX); config_get( logparams_dump,(sizeof(log_maskmap)/sizeof(mapping)) - 1,CONFIG_STRING_LOG_PREFIX);
config_check_unknown_cmdlineopt(CONFIG_STRING_LOG_PREFIX); config_check_unknown_cmdlineopt(CONFIG_STRING_LOG_PREFIX);
/* set the debug mask according to the debug parameters values */ /* set the debug mask according to the debug parameters values */
...@@ -385,7 +385,6 @@ int logInit (void) { ...@@ -385,7 +385,6 @@ int logInit (void) {
register_log_component("OCG","",OCG); register_log_component("OCG","",OCG);
register_log_component("PERF","",PERF); register_log_component("PERF","",PERF);
register_log_component("OIP","",OIP); register_log_component("OIP","",OIP);
register_log_component("CLI","",CLI);
register_log_component("MSC","log",MSC); register_log_component("MSC","log",MSC);
register_log_component("OCM","log",OCM); register_log_component("OCM","log",OCM);
register_log_component("HW","",HW); register_log_component("HW","",HW);
...@@ -408,6 +407,8 @@ int logInit (void) { ...@@ -408,6 +407,8 @@ int logInit (void) {
register_log_component("X2AP","",X2AP); register_log_component("X2AP","",X2AP);
register_log_component("LOADER","log",LOADER); register_log_component("LOADER","log",LOADER);
register_log_component("ASN","log",ASN); register_log_component("ASN","log",ASN);
register_log_component("NFAPI_PNF","log",NFAPI_PNF);
register_log_component("NFAPI_VNF","log",NFAPI_VNF);
for (int i=0 ; log_level_names[i].name != NULL ; i++) for (int i=0 ; log_level_names[i].name != NULL ; i++)
g_log->level2string[i] = toupper(log_level_names[i].name[0]); // uppercased first letter of level name g_log->level2string[i] = toupper(log_level_names[i].name[0]); // uppercased first letter of level name
...@@ -438,7 +439,7 @@ char *log_getthreadname(char *threadname, int bufsize) { ...@@ -438,7 +439,7 @@ char *log_getthreadname(char *threadname, int bufsize) {
static int log_header(char *log_buffer, int buffsize, int comp, int level,const char *format) { static int log_header(char *log_buffer, int buffsize, int comp, int level,const char *format) {
char threadname[PR_SET_NAME]; char threadname[PR_SET_NAME];
return snprintf(log_buffer, buffsize , "%s%s[%s]%c %s %s%s", return snprintf(log_buffer, buffsize, "%s%s[%s]%c %s %s%s",
log_level_highlight_end[level], log_level_highlight_end[level],
( (g_log->flag & FLAG_NOCOLOR)?"":log_level_highlight_start[level]), ( (g_log->flag & FLAG_NOCOLOR)?"":log_level_highlight_start[level]),
g_log->log_component[comp].name, g_log->log_component[comp].name,
...@@ -452,11 +453,17 @@ void logRecord_mt(const char *file, const char *func, int line, int comp, int le ...@@ -452,11 +453,17 @@ void logRecord_mt(const char *file, const char *func, int line, int comp, int le
char log_buffer[MAX_LOG_TOTAL]; char log_buffer[MAX_LOG_TOTAL];
va_list args; va_list args;
va_start(args, format); va_start(args, format);
log_header(log_buffer,MAX_LOG_TOTAL ,comp, level,format); log_header(log_buffer,MAX_LOG_TOTAL,comp, level,format);
g_log->log_component[comp].vprint(g_log->log_component[comp].stream,log_buffer, args); g_log->log_component[comp].vprint(g_log->log_component[comp].stream,log_buffer, args);
va_end(args); va_end(args);
} }
void vlogRecord_mt(const char *file, const char *func, int line, int comp, int level, const char *format, va_list args ) {
char log_buffer[MAX_LOG_TOTAL];
log_header(log_buffer,MAX_LOG_TOTAL,comp, level,format);
g_log->log_component[comp].vprint(g_log->log_component[comp].stream,log_buffer, args);
}
void log_dump(int component, void *buffer, int buffsize,int datatype, const char *format, ... ) { void log_dump(int component, void *buffer, int buffsize,int datatype, const char *format, ... ) {
va_list args; va_list args;
char *wbuf; char *wbuf;
...@@ -474,7 +481,7 @@ void log_dump(int component, void *buffer, int buffsize,int datatype, const char ...@@ -474,7 +481,7 @@ void log_dump(int component, void *buffer, int buffsize,int datatype, const char
if (wbuf != NULL) { if (wbuf != NULL) {
va_start(args, format); va_start(args, format);
int pos=log_header(wbuf,MAX_LOG_TOTAL ,component, OAILOG_INFO,""); int pos=log_header(wbuf,MAX_LOG_TOTAL,component, OAILOG_INFO,"");
int pos2=vsprintf(wbuf+pos,format, args); int pos2=vsprintf(wbuf+pos,format, args);
pos=pos+pos2; pos=pos+pos2;
va_end(args); va_end(args);
......
...@@ -198,7 +198,6 @@ typedef enum { ...@@ -198,7 +198,6 @@ typedef enum {
NAS, NAS,
PERF, PERF,
OIP, OIP,
CLI,
MSC, MSC,
OCM, OCM,
UDP_, UDP_,
...@@ -218,6 +217,8 @@ typedef enum { ...@@ -218,6 +217,8 @@ typedef enum {
X2AP, X2AP,
LOADER, LOADER,
ASN, ASN,
NFAPI_VNF,
NFAPI_PNF,
MAX_LOG_PREDEF_COMPONENTS, MAX_LOG_PREDEF_COMPONENTS,
} }
comp_name_t; comp_name_t;
...@@ -286,6 +287,7 @@ extern "C" { ...@@ -286,6 +287,7 @@ extern "C" {
int logInit (void); int logInit (void);
int isLogInitDone (void); int isLogInitDone (void);
void logRecord_mt(const char *file, const char *func, int line,int comp, int level, const char *format, ...) __attribute__ ((format (printf, 6, 7))); void logRecord_mt(const char *file, const char *func, int line,int comp, int level, const char *format, ...) __attribute__ ((format (printf, 6, 7)));
void vlogRecord_mt(const char *file, const char *func, int line, int comp, int level, const char *format, va_list args );
void log_dump(int component, void *buffer, int buffsize,int datatype, const char *format, ... ); void log_dump(int component, void *buffer, int buffsize,int datatype, const char *format, ... );
int set_log(int component, int level); int set_log(int component, int level);
void set_glog(int level); void set_glog(int level);
...@@ -365,9 +367,9 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int ...@@ -365,9 +367,9 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int
# define LOG_I(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_INFO ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ;} else { T(T_LEGACY_ ## c ## _INFO, T_PRINTF(x)) ;}} while (0) # define LOG_I(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_INFO ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_INFO, x) ;} else { T(T_LEGACY_ ## c ## _INFO, T_PRINTF(x)) ;}} while (0)
# define LOG_D(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_DEBUG ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_DEBUG, x) ;} else { T(T_LEGACY_ ## c ## _DEBUG, T_PRINTF(x)) ;}} while (0) # define LOG_D(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_DEBUG ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_DEBUG, x) ;} else { T(T_LEGACY_ ## c ## _DEBUG, T_PRINTF(x)) ;}} while (0)
# define LOG_T(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_TRACE ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_TRACE, x) ;} else { T(T_LEGACY_ ## c ## _TRACE, T_PRINTF(x)) ;}} while (0) # define LOG_T(c, x...) do { if (T_stdout) { if( g_log->log_component[c].level >= OAILOG_TRACE ) logRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, OAILOG_TRACE, x) ;} else { T(T_LEGACY_ ## c ## _TRACE, T_PRINTF(x)) ;}} while (0)
# define VLOG(c,l, f, args) do { if (T_stdout) { if( g_log->log_component[c].level >= l ) vlogRecord_mt(__FILE__, __FUNCTION__, __LINE__,c, l, f, args) ;} } while (0)
/* macro used to dump a buffer or a message as in openair2/RRC/LTE/RRC_eNB.c, replaces LOG_F macro */ /* 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) log_dump(c, b, s, LOG_DUMP_CHAR, x) ;} while (0) /* */ # define LOG_DUMPMSG(c, f, b, s, x...) do { if(g_log->dump_mask & f) log_dump(c, b, s, LOG_DUMP_CHAR, x) ;} while (0) /* */
# define nfapi_log(FILE, FNC, LN, COMP, LVL, F...) do { if (T_stdout) { logRecord_mt(__FILE__, __FUNCTION__, __LINE__,COMP, LVL, F) ;}} while (0) /* */
/* bitmask dependant macros, to isolate debugging code */ /* bitmask dependant macros, to isolate debugging code */
# define LOG_DEBUGFLAG(D) (g_log->debug_mask & D) # define LOG_DEBUGFLAG(D) (g_log->debug_mask & D)
......
...@@ -800,6 +800,47 @@ ID = LEGACY_SIM_TRACE ...@@ -800,6 +800,47 @@ ID = LEGACY_SIM_TRACE
GROUP = ALL:LEGACY_SIM:LEGACY_GROUP_TRACE:LEGACY GROUP = ALL:LEGACY_SIM:LEGACY_GROUP_TRACE:LEGACY
FORMAT = string,log FORMAT = string,log
ID = LEGACY_NFAPI_VNF_INFO
DESC = NFAPI_VNF legacy logs - info level
GROUP = ALL:LEGACY_NFAPI_VNF:LEGACY_GROUP_INFO:LEGACY
FORMAT = string,log
ID = LEGACY_NFAPI_VNF_ERROR
DESC = NFAPI_VNF legacy logs - error level
GROUP = ALL:LEGACY_NFAPI_VNF:LEGACY_GROUP_ERROR:LEGACY
FORMAT = string,log
ID = LEGACY_NFAPI_VNF_WARNING
DESC = NFAPI_VNF legacy logs - warning level
GROUP = ALL:LEGACY_NFAPI_VNF:LEGACY_GROUP_WARNING:LEGACY
FORMAT = string,log
ID = LEGACY_NFAPI_VNF_DEBUG
DESC = NFAPI_VNF legacy logs - debug level
GROUP = ALL:LEGACY_NFAPI_VNF:LEGACY_GROUP_DEBUG:LEGACY
FORMAT = string,log
ID = LEGACY_NFAPI_VNF_TRACE
DESC = NFAPI_VNF legacy logs - trace level
GROUP = ALL:LEGACY_NFAPI_VNF:LEGACY_GROUP_TRACE:LEGACY
FORMAT = string,log
ID = LEGACY_NFAPI_PNF_INFO
DESC = NFAPI_PNF legacy logs - info level
GROUP = ALL:LEGACY_NFAPI_PNF:LEGACY_GROUP_INFO:LEGACY
FORMAT = string,log
ID = LEGACY_NFAPI_PNF_ERROR
DESC = NFAPI_PNF legacy logs - error level
GROUP = ALL:LEGACY_NFAPI_PNF:LEGACY_GROUP_ERROR:LEGACY
FORMAT = string,log
ID = LEGACY_NFAPI_PNF_WARNING
DESC = NFAPI_PNF legacy logs - warning level
GROUP = ALL:LEGACY_NFAPI_PNF:LEGACY_GROUP_WARNING:LEGACY
FORMAT = string,log
ID = LEGACY_NFAPI_PNF_DEBUG
DESC = NFAPI_PNF legacy logs - debug level
GROUP = ALL:LEGACY_NFAPI_PNF:LEGACY_GROUP_DEBUG:LEGACY
FORMAT = string,log
ID = LEGACY_NFAPI_PNF_TRACE
DESC = NFAPI_PNF legacy logs - trace level
GROUP = ALL:LEGACY_NFAPI_PNF:LEGACY_GROUP_TRACE:LEGACY
FORMAT = string,log
# this is a bad hack but I won't fix (function util_print_hex_octets # this is a bad hack but I won't fix (function util_print_hex_octets
# in openairinterface5g/openair2/LAYER2/PDCP_v10.1.0/pdcp_util.c # in openairinterface5g/openair2/LAYER2/PDCP_v10.1.0/pdcp_util.c
# does funky things with the LOG_x macros but we work on the C pre-processor # does funky things with the LOG_x macros but we work on the C pre-processor
...@@ -845,27 +886,7 @@ ID = LEGACY_componentP_TRACE ...@@ -845,27 +886,7 @@ ID = LEGACY_componentP_TRACE
GROUP = ALL:LEGACY_componentP:LEGACY_GROUP_TRACE:LEGACY GROUP = ALL:LEGACY_componentP:LEGACY_GROUP_TRACE:LEGACY
FORMAT = string,log FORMAT = string,log
#needed?
ID = LEGACY_CLI_INFO
DESC = CLI legacy logs - info level
GROUP = ALL:LEGACY_CLI:LEGACY_GROUP_INFO:LEGACY
FORMAT = string,log
ID = LEGACY_CLI_ERROR
DESC = CLI legacy logs - error level
GROUP = ALL:LEGACY_CLI:LEGACY_GROUP_ERROR:LEGACY
FORMAT = string,log
ID = LEGACY_CLI_WARNING
DESC = CLI legacy logs - warning level
GROUP = ALL:LEGACY_CLI:LEGACY_GROUP_WARNING:LEGACY
FORMAT = string,log
ID = LEGACY_CLI_DEBUG
DESC = CLI legacy logs - debug level
GROUP = ALL:LEGACY_CLI:LEGACY_GROUP_DEBUG:LEGACY
FORMAT = string,log
ID = LEGACY_CLI_TRACE
DESC = CLI legacy logs - trace level
GROUP = ALL:LEGACY_CLI:LEGACY_GROUP_TRACE:LEGACY
FORMAT = string,log
################# #################
#### UE LOGS #### #### UE LOGS ####
......
This diff is collapsed.
...@@ -606,7 +606,7 @@ void vnf_deallocate(void *ptr) { ...@@ -606,7 +606,7 @@ void vnf_deallocate(void *ptr) {
void vnf_trace(nfapi_trace_level_t nfapi_level, const char *message, ...) { void vnf_trace(nfapi_trace_level_t nfapi_level, const char *message, ...) {
va_list args; va_list args;
va_start(args, message); va_start(args, message);
nfapi_log("FILE>", "FUNC", 999, PHY, nfapitooai_level(nfapi_level), message, args); VLOG( NFAPI_VNF, nfapitooai_level(nfapi_level), message, args);
va_end(args); va_end(args);
} }
......
...@@ -126,10 +126,10 @@ int netlink_init_tun(void) { ...@@ -126,10 +126,10 @@ int netlink_init_tun(void) {
nas_dest_addr.nl_family = AF_NETLINK; nas_dest_addr.nl_family = AF_NETLINK;
nas_dest_addr.nl_pid = 0; /* For Linux Kernel */ nas_dest_addr.nl_pid = 0; /* For Linux Kernel */
nas_dest_addr.nl_groups = 0; /* unicast */ nas_dest_addr.nl_groups = 0; /* unicast */
// TX PART // TX PART
nas_nlh_tx=(struct nlmsghdr *)malloc(NLMSG_SPACE(NL_MAX_PAYLOAD)); nas_nlh_tx=(struct nlmsghdr *)malloc(NLMSG_SPACE(NL_MAX_PAYLOAD));
memset(nas_nlh_tx, 0, NLMSG_SPACE(NL_MAX_PAYLOAD)); memset(nas_nlh_tx, 0, NLMSG_SPACE(NL_MAX_PAYLOAD));
/* Fill the netlink message header */ /* Fill the netlink message header */
nas_nlh_tx->nlmsg_len = NLMSG_SPACE(NL_MAX_PAYLOAD); nas_nlh_tx->nlmsg_len = NLMSG_SPACE(NL_MAX_PAYLOAD);
nas_nlh_tx->nlmsg_pid = 1;//getpid(); /* self pid */ nas_nlh_tx->nlmsg_pid = 1;//getpid(); /* self pid */
nas_nlh_tx->nlmsg_flags = 0; nas_nlh_tx->nlmsg_flags = 0;
...@@ -140,13 +140,14 @@ int netlink_init_tun(void) { ...@@ -140,13 +140,14 @@ int netlink_init_tun(void) {
nas_msg_tx.msg_namelen = sizeof(nas_dest_addr); nas_msg_tx.msg_namelen = sizeof(nas_dest_addr);
nas_msg_tx.msg_iov = &nas_iov_tx; nas_msg_tx.msg_iov = &nas_iov_tx;
nas_msg_tx.msg_iovlen = 1; nas_msg_tx.msg_iovlen = 1;
// RX PART // RX PART
memset(&nas_msg_rx,0,sizeof(nas_msg_rx)); memset(&nas_msg_rx,0,sizeof(nas_msg_rx));
nas_msg_rx.msg_name = (void *)&nas_src_addr; nas_msg_rx.msg_name = (void *)&nas_src_addr;
nas_msg_rx.msg_namelen = sizeof(nas_src_addr); nas_msg_rx.msg_namelen = sizeof(nas_src_addr);
nas_msg_rx.msg_iov = &nas_iov_rx; nas_msg_rx.msg_iov = &nas_iov_rx;
nas_msg_rx.msg_iovlen = 1; nas_msg_rx.msg_iovlen = 1;
} /* for */ } /* for */
return 1; return 1;
} }
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#define EMU_PROTO_H_ #define EMU_PROTO_H_
void init_bypass (void); void init_bypass (void);
void bypass_init ( unsigned int (*tx_handlerP) (unsigned char,char*, unsigned int*, unsigned int*),unsigned int (*rx_handlerP) (unsigned char,char*,unsigned int)); void bypass_init ( unsigned int (*tx_handlerP) (unsigned char,char *, unsigned int *, unsigned int *),unsigned int (*rx_handlerP) (unsigned char,char *,unsigned int));
int bypass_rx_data(unsigned int frame, unsigned int last_slot, int bypass_rx_data(unsigned int frame, unsigned int last_slot,
unsigned int next_slot, uint8_t is_master); unsigned int next_slot, uint8_t is_master);
void bypass_signal_mac_phy(unsigned int frame, unsigned int last_slot, void bypass_signal_mac_phy(unsigned int frame, unsigned int last_slot,
...@@ -43,7 +43,7 @@ void bypass_tx_data (emu_transport_info_t Type, unsigned int frame, unsigned int ...@@ -43,7 +43,7 @@ void bypass_tx_data (emu_transport_info_t Type, unsigned int frame, unsigned int
void emulation_tx_rx(void); void emulation_tx_rx(void);
unsigned int emul_tx_handler(unsigned char Mode,char *Tx_buffer,unsigned int* Nbytes,unsigned int *Nb_flows); unsigned int emul_tx_handler(unsigned char Mode,char *Tx_buffer,unsigned int *Nbytes,unsigned int *Nb_flows);
unsigned int emul_rx_handler(unsigned char Mode,char *rx_buffer, unsigned int Nbytes); unsigned int emul_rx_handler(unsigned char Mode,char *rx_buffer, unsigned int Nbytes);
unsigned int emul_rx_data(void); unsigned int emul_rx_data(void);
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
------------------- -------------------
AUTHOR : Francois TABURET AUTHOR : Francois TABURET
COMPANY : NOKIA BellLabs France COMPANY : NOKIA BellLabs France
EMAIL : francois.taburet@nokia-bell-labs.com EMAIL : francois.taburet@nokia-bell-labs.com
*/ */
...@@ -80,8 +80,7 @@ int config_check_band_frequencies( int ind, ...@@ -80,8 +80,7 @@ int config_check_band_frequencies( int ind,
int16_t band, int16_t band,
uint32_t downlink_frequency, uint32_t downlink_frequency,
int32_t uplink_frequency_offset, int32_t uplink_frequency_offset,
uint32_t frame_type) uint32_t frame_type) {
{
int errors = 0; int errors = 0;
if (band > 0) { if (band > 0) {
...@@ -90,21 +89,18 @@ int config_check_band_frequencies( int ind, ...@@ -90,21 +89,18 @@ int config_check_band_frequencies( int ind,
for (band_index = 0; band_index < sizeof (eutra_bands) / sizeof (eutra_bands[0]); band_index++) { for (band_index = 0; band_index < sizeof (eutra_bands) / sizeof (eutra_bands[0]); band_index++) {
if (band == eutra_bands[band_index].band) { if (band == eutra_bands[band_index].band) {
uint32_t uplink_frequency = downlink_frequency + uplink_frequency_offset; uint32_t uplink_frequency = downlink_frequency + uplink_frequency_offset;
AssertError (eutra_bands[band_index].dl_min < downlink_frequency, errors ++, AssertError (eutra_bands[band_index].dl_min < downlink_frequency, errors ++,
"enb %d downlink frequency %u too low (%u) for band %d!", "enb %d downlink frequency %u too low (%u) for band %d!",
ind, downlink_frequency, eutra_bands[band_index].dl_min, band); ind, downlink_frequency, eutra_bands[band_index].dl_min, band);
AssertError (downlink_frequency < eutra_bands[band_index].dl_max, errors ++, AssertError (downlink_frequency < eutra_bands[band_index].dl_max, errors ++,
"enb %d downlink frequency %u too high (%u) for band %d!", "enb %d downlink frequency %u too high (%u) for band %d!",
ind, downlink_frequency, eutra_bands[band_index].dl_max, band); ind, downlink_frequency, eutra_bands[band_index].dl_max, band);
AssertError (eutra_bands[band_index].ul_min < uplink_frequency, errors ++, AssertError (eutra_bands[band_index].ul_min < uplink_frequency, errors ++,
"enb %d uplink frequency %u too low (%u) for band %d!", "enb %d uplink frequency %u too low (%u) for band %d!",
ind, uplink_frequency, eutra_bands[band_index].ul_min, band); ind, uplink_frequency, eutra_bands[band_index].ul_min, band);
AssertError (uplink_frequency < eutra_bands[band_index].ul_max, errors ++, AssertError (uplink_frequency < eutra_bands[band_index].ul_max, errors ++,
"enb %d uplink frequency %u too high (%u) for band %d!", "enb %d uplink frequency %u too high (%u) for band %d!",
ind, uplink_frequency, eutra_bands[band_index].ul_max, band); ind, uplink_frequency, eutra_bands[band_index].ul_max, band);
AssertError (eutra_bands[band_index].frame_type == frame_type, errors ++, AssertError (eutra_bands[band_index].frame_type == frame_type, errors ++,
"enb %d invalid frame type (%d/%d) for band %d!", "enb %d invalid frame type (%d/%d) for band %d!",
ind, eutra_bands[band_index].frame_type, frame_type, band); ind, eutra_bands[band_index].frame_type, frame_type, band);
...@@ -112,7 +108,6 @@ int config_check_band_frequencies( int ind, ...@@ -112,7 +108,6 @@ int config_check_band_frequencies( int ind,
} }
} }
return errors; return errors;
} }
...@@ -87,28 +87,21 @@ static void configure_phy(module_id_t enb_id, const Enb_properties_array_t* enb_ ...@@ -87,28 +87,21 @@ static void configure_phy(module_id_t enb_id, const Enb_properties_array_t* enb_
*/ */
/*------------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------*/
static void configure_rrc(uint32_t enb_id) static void configure_rrc(uint32_t enb_id) {
{
MessageDef *msg_p = NULL; MessageDef *msg_p = NULL;
// int CC_id; // int CC_id;
msg_p = itti_alloc_new_message (TASK_ENB_APP, RRC_CONFIGURATION_REQ); msg_p = itti_alloc_new_message (TASK_ENB_APP, RRC_CONFIGURATION_REQ);
if (RC.rrc[enb_id]) { if (RC.rrc[enb_id]) {
RCconfig_RRC(msg_p,enb_id, RC.rrc[enb_id]); RCconfig_RRC(msg_p,enb_id, RC.rrc[enb_id]);
LOG_I(ENB_APP,"Sending configuration message to RRC task\n"); LOG_I(ENB_APP,"Sending configuration message to RRC task\n");
itti_send_msg_to_task (TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p); itti_send_msg_to_task (TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p);
} else AssertFatal(0,"RRC context for eNB %d not allocated\n",enb_id);
}
else AssertFatal(0,"RRC context for eNB %d not allocated\n",enb_id);
} }
/*------------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------*/
static uint32_t eNB_app_register(uint32_t enb_id_start, uint32_t enb_id_end)//, const Enb_properties_array_t *enb_properties) static uint32_t eNB_app_register(uint32_t enb_id_start, uint32_t enb_id_end) { //, const Enb_properties_array_t *enb_properties)
{
uint32_t enb_id; uint32_t enb_id;
MessageDef *msg_p; MessageDef *msg_p;
uint32_t register_enb_pending = 0; uint32_t register_enb_pending = 0;
...@@ -117,17 +110,13 @@ static uint32_t eNB_app_register(uint32_t enb_id_start, uint32_t enb_id_end)//, ...@@ -117,17 +110,13 @@ static uint32_t eNB_app_register(uint32_t enb_id_start, uint32_t enb_id_end)//,
{ {
/* note: there is an implicit relationship between the data structure and the message name */ /* note: there is an implicit relationship between the data structure and the message name */
msg_p = itti_alloc_new_message (TASK_ENB_APP, S1AP_REGISTER_ENB_REQ); msg_p = itti_alloc_new_message (TASK_ENB_APP, S1AP_REGISTER_ENB_REQ);
RCconfig_S1(msg_p, enb_id); RCconfig_S1(msg_p, enb_id);
if (enb_id == 0) RCconfig_gtpu(); if (enb_id == 0) RCconfig_gtpu();
LOG_I(ENB_APP,"default drx %d\n",((S1AP_REGISTER_ENB_REQ(msg_p)).default_drx)); LOG_I(ENB_APP,"default drx %d\n",((S1AP_REGISTER_ENB_REQ(msg_p)).default_drx));
LOG_I(ENB_APP,"[eNB %d] eNB_app_register for instance %d\n", enb_id, ENB_MODULE_ID_TO_INSTANCE(enb_id)); LOG_I(ENB_APP,"[eNB %d] eNB_app_register for instance %d\n", enb_id, ENB_MODULE_ID_TO_INSTANCE(enb_id));
itti_send_msg_to_task (TASK_S1AP, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p); itti_send_msg_to_task (TASK_S1AP, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p);
register_enb_pending++; register_enb_pending++;
} }
} }
...@@ -137,22 +126,16 @@ static uint32_t eNB_app_register(uint32_t enb_id_start, uint32_t enb_id_end)//, ...@@ -137,22 +126,16 @@ static uint32_t eNB_app_register(uint32_t enb_id_start, uint32_t enb_id_end)//,
/*------------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------*/
static uint32_t eNB_app_register_x2(uint32_t enb_id_start, uint32_t enb_id_end) static uint32_t eNB_app_register_x2(uint32_t enb_id_start, uint32_t enb_id_end) {
{
uint32_t enb_id; uint32_t enb_id;
MessageDef *msg_p; MessageDef *msg_p;
uint32_t register_enb_x2_pending = 0; uint32_t register_enb_x2_pending = 0;
for (enb_id = enb_id_start; (enb_id < enb_id_end) ; enb_id++) { for (enb_id = enb_id_start; (enb_id < enb_id_end) ; enb_id++) {
{ {
msg_p = itti_alloc_new_message (TASK_ENB_APP, X2AP_REGISTER_ENB_REQ); msg_p = itti_alloc_new_message (TASK_ENB_APP, X2AP_REGISTER_ENB_REQ);
RCconfig_X2(msg_p, enb_id); RCconfig_X2(msg_p, enb_id);
itti_send_msg_to_task (TASK_X2AP, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p); itti_send_msg_to_task (TASK_X2AP, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p);
register_enb_x2_pending++; register_enb_x2_pending++;
} }
} }
...@@ -161,9 +144,8 @@ static uint32_t eNB_app_register_x2(uint32_t enb_id_start, uint32_t enb_id_end) ...@@ -161,9 +144,8 @@ static uint32_t eNB_app_register_x2(uint32_t enb_id_start, uint32_t enb_id_end)
} }
/*------------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------*/
void *eNB_app_task(void *args_p) void *eNB_app_task(void *args_p) {
{ uint32_t enb_nb = RC.nb_inst;
uint32_t enb_nb = RC.nb_inst;
uint32_t enb_id_start = 0; uint32_t enb_id_start = 0;
uint32_t enb_id_end = enb_id_start + enb_nb; uint32_t enb_id_end = enb_id_start + enb_nb;
uint32_t register_enb_pending=0; uint32_t register_enb_pending=0;
...@@ -178,15 +160,10 @@ void *eNB_app_task(void *args_p) ...@@ -178,15 +160,10 @@ void *eNB_app_task(void *args_p)
int result; int result;
/* for no gcc warnings */ /* for no gcc warnings */
(void)instance; (void)instance;
itti_mark_task_ready (TASK_ENB_APP); itti_mark_task_ready (TASK_ENB_APP);
LOG_I(PHY, "%s() Task ready initialise structures\n", __FUNCTION__); LOG_I(PHY, "%s() Task ready initialise structures\n", __FUNCTION__);
RCconfig_L1(); RCconfig_L1();
RCconfig_macrlc(); RCconfig_macrlc();
LOG_I(PHY, "%s() RC.nb_L1_inst:%d\n", __FUNCTION__, RC.nb_L1_inst); LOG_I(PHY, "%s() RC.nb_L1_inst:%d\n", __FUNCTION__, RC.nb_L1_inst);
if (RC.nb_L1_inst>0) AssertFatal(l1_north_init_eNB()==0,"could not initialize L1 north interface\n"); if (RC.nb_L1_inst>0) AssertFatal(l1_north_init_eNB()==0,"could not initialize L1 north interface\n");
...@@ -194,24 +171,22 @@ void *eNB_app_task(void *args_p) ...@@ -194,24 +171,22 @@ void *eNB_app_task(void *args_p)
AssertFatal (enb_nb <= RC.nb_inst, AssertFatal (enb_nb <= RC.nb_inst,
"Number of eNB is greater than eNB defined in configuration file (%d/%d)!", "Number of eNB is greater than eNB defined in configuration file (%d/%d)!",
enb_nb, RC.nb_inst); enb_nb, RC.nb_inst);
LOG_I(ENB_APP,"Allocating eNB_RRC_INST for %d instances\n",RC.nb_inst); LOG_I(ENB_APP,"Allocating eNB_RRC_INST for %d instances\n",RC.nb_inst);
RC.rrc = (eNB_RRC_INST **)malloc(RC.nb_inst*sizeof(eNB_RRC_INST *)); RC.rrc = (eNB_RRC_INST **)malloc(RC.nb_inst*sizeof(eNB_RRC_INST *));
LOG_I(PHY, "%s() RC.nb_inst:%d RC.rrc:%p\n", __FUNCTION__, RC.nb_inst, RC.rrc); LOG_I(PHY, "%s() RC.nb_inst:%d RC.rrc:%p\n", __FUNCTION__, RC.nb_inst, RC.rrc);
for (enb_id = enb_id_start; (enb_id < enb_id_end) ; enb_id++) { for (enb_id = enb_id_start; (enb_id < enb_id_end) ; enb_id++) {
RC.rrc[enb_id] = (eNB_RRC_INST*)malloc(sizeof(eNB_RRC_INST)); RC.rrc[enb_id] = (eNB_RRC_INST *)malloc(sizeof(eNB_RRC_INST));
LOG_I(PHY, "%s() Creating RRC instance RC.rrc[%d]:%p (%d of %d)\n", __FUNCTION__, enb_id, RC.rrc[enb_id], enb_id+1, enb_id_end); LOG_I(PHY, "%s() Creating RRC instance RC.rrc[%d]:%p (%d of %d)\n", __FUNCTION__, enb_id, RC.rrc[enb_id], enb_id+1, enb_id_end);
memset((void *)RC.rrc[enb_id],0,sizeof(eNB_RRC_INST)); memset((void *)RC.rrc[enb_id],0,sizeof(eNB_RRC_INST));
configure_rrc(enb_id); configure_rrc(enb_id);
} }
if (EPC_MODE_ENABLED) { if (EPC_MODE_ENABLED) {
/* Try to register each eNB */ /* Try to register each eNB */
registered_enb = 0; registered_enb = 0;
register_enb_pending = eNB_app_register (enb_id_start, enb_id_end);//, enb_properties_p); register_enb_pending = eNB_app_register (enb_id_start, enb_id_end);//, enb_properties_p);
} }
/* Try to register each eNB with each other */ /* Try to register each eNB with each other */
x2_registered_enb = 0;