Merge branch 'develop' into parallel-config
Conflicts: targets/RT/USER/lte-ru.c
This commit is contained in:
@@ -100,7 +100,7 @@ int load_lib(openair0_device *device, openair0_config_t *openair0_cfg, eth_param
|
||||
libname=OAI_TP_LIBNAME;
|
||||
shlib_fdesc[0].fname="transport_init";
|
||||
}
|
||||
ret=load_module_shlib(libname,shlib_fdesc,1);
|
||||
ret=load_module_shlib(libname,shlib_fdesc,1,NULL);
|
||||
if (ret < 0) {
|
||||
fprintf(stderr,"Library %s couldn't be loaded\n",libname);
|
||||
} else {
|
||||
|
||||
@@ -199,6 +199,8 @@ typedef struct {
|
||||
double tx_bw;
|
||||
//! clock source
|
||||
clock_source_t clock_source;
|
||||
//! Manual SDR IP address
|
||||
char *sdr_addrs;
|
||||
//! Auto calibration flag
|
||||
int autocal[4];
|
||||
//! rf devices work with x bits iqs when oai have its own iq format
|
||||
|
||||
@@ -950,11 +950,15 @@ int trx_usrp_recplay_config_init(paramdef_t *usrp_recplay_params) {
|
||||
#endif
|
||||
|
||||
extern "C" {
|
||||
/*! \brief Initialize Openair USRP target. It returns 0 if OK
|
||||
* \param device the hardware to use
|
||||
* \param openair0_cfg RF frontend parameters set by application
|
||||
*/
|
||||
int device_init(openair0_device* device, openair0_config_t *openair0_cfg) {
|
||||
/*! \brief Initialize Openair USRP target. It returns 0 if OK
|
||||
* \param device the hardware to use
|
||||
* \param openair0_cfg RF frontend parameters set by application
|
||||
*/
|
||||
int device_init(openair0_device* device, openair0_config_t *openair0_cfg) {
|
||||
|
||||
LOG_D(PHY, "openair0_cfg[0].sdr_addrs == '%s'\n", openair0_cfg[0].sdr_addrs);
|
||||
LOG_D(PHY, "openair0_cfg[0].clock_source == '%d'\n", openair0_cfg[0].clock_source);
|
||||
|
||||
#if defined(USRP_REC_PLAY)
|
||||
paramdef_t usrp_recplay_params[7];
|
||||
struct sysinfo systeminfo;
|
||||
@@ -1022,8 +1026,30 @@ extern "C" {
|
||||
// Initialize USRP device
|
||||
device->openair0_cfg = openair0_cfg;
|
||||
|
||||
std::string args = "type=b200";
|
||||
uhd::device_addrs_t device_adds = uhd::device::find(args);
|
||||
std::string args = "type=b200";
|
||||
|
||||
char *addr_args = NULL;
|
||||
// Check whether sdr_addrs is set in the config or not
|
||||
if (openair0_cfg[0].sdr_addrs != NULL) {
|
||||
if (strcmp(openair0_cfg[0].sdr_addrs, "0.0.0.0") != 0) {
|
||||
// Check whether sdr_addrs contains multiple IP addresses
|
||||
// and split and add them to addr_args
|
||||
if (strstr(openair0_cfg[0].sdr_addrs, ",") != NULL) {
|
||||
char *addr0 = openair0_cfg[0].sdr_addrs;
|
||||
// Replace , with \0
|
||||
strsep(&openair0_cfg[0].sdr_addrs, ",");
|
||||
char *addr1 = openair0_cfg[0].sdr_addrs;
|
||||
// Allocate memory for ",addr0=,addr1=\0" and the addresses
|
||||
size_t addr_args_len = sizeof(char)*(15 + strlen(addr0) + strlen(addr1));
|
||||
addr_args = (char *)malloc(addr_args_len);
|
||||
snprintf(addr_args, addr_args_len, ",addr0=%s,addr1=%s", addr0, addr1);
|
||||
args += addr_args;
|
||||
LOG_D(PHY, "addr_args == '%s'\n", addr_args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uhd::device_addrs_t device_adds = uhd::device::find(args);
|
||||
|
||||
int vers=0,subvers=0,subsubvers=0;
|
||||
int bw_gain_adjust=0;
|
||||
@@ -1037,12 +1063,17 @@ extern "C" {
|
||||
LOG_I(PHY,"Checking for USRPs : UHD %s (%d.%d.%d)\n",
|
||||
uhd::get_version_string().c_str(),vers,subvers,subsubvers);
|
||||
|
||||
if(device_adds.size() == 0) {
|
||||
double usrp_master_clock = 184.32e6;
|
||||
std::string args = "type=x300";
|
||||
if(device_adds.size() == 0) {
|
||||
|
||||
// workaround for an api problem, master clock has to be set with the constructor not via set_master_clock_rate
|
||||
args += boost::str(boost::format(",master_clock_rate=%f") % usrp_master_clock);
|
||||
double usrp_master_clock = 184.32e6;
|
||||
std::string args = "type=x300";
|
||||
|
||||
if (addr_args) {
|
||||
args += addr_args;
|
||||
}
|
||||
|
||||
// workaround for an api problem, master clock has to be set with the constructor not via set_master_clock_rate
|
||||
args += boost::str(boost::format(",master_clock_rate=%f") % usrp_master_clock);
|
||||
|
||||
// args += ",num_send_frames=256,num_recv_frames=256, send_frame_size=4096, recv_frame_size=4096";
|
||||
uhd::device_addrs_t device_adds = uhd::device::find(args);
|
||||
@@ -1232,12 +1263,14 @@ extern "C" {
|
||||
}
|
||||
}
|
||||
|
||||
for(int i=0; i<s->usrp->get_tx_num_channels(); i++) {
|
||||
::uhd::gain_range_t gain_range_tx = s->usrp->get_tx_gain_range(i);
|
||||
if (i<openair0_cfg[0].tx_num_channels) {
|
||||
s->usrp->set_tx_rate(openair0_cfg[0].sample_rate,i);
|
||||
s->usrp->set_tx_freq(openair0_cfg[0].tx_freq[i],i);
|
||||
s->usrp->set_tx_gain(gain_range_tx.stop()-openair0_cfg[0].tx_gain[i],i);
|
||||
LOG_D(PHY, "usrp->get_tx_num_channels() == %zd\n", s->usrp->get_tx_num_channels());
|
||||
LOG_D(PHY, "openair0_cfg[0].tx_num_channels == %d\n", openair0_cfg[0].tx_num_channels);
|
||||
for(int i=0; i<s->usrp->get_tx_num_channels(); i++) {
|
||||
::uhd::gain_range_t gain_range_tx = s->usrp->get_tx_gain_range(i);
|
||||
if (i<openair0_cfg[0].tx_num_channels) {
|
||||
s->usrp->set_tx_rate(openair0_cfg[0].sample_rate,i);
|
||||
s->usrp->set_tx_freq(openair0_cfg[0].tx_freq[i],i);
|
||||
s->usrp->set_tx_gain(gain_range_tx.stop()-openair0_cfg[0].tx_gain[i],i);
|
||||
|
||||
LOG_I(PHY,"USRP TX_GAIN:%3.2lf gain_range:%3.2lf tx_gain:%3.2lf\n", gain_range_tx.stop()-openair0_cfg[0].tx_gain[i], gain_range_tx.stop(), openair0_cfg[0].tx_gain[i]);
|
||||
}
|
||||
|
||||
@@ -253,7 +253,7 @@ int tcp_bridge_ue_first_read(openair0_device *device, openair0_timestamp *timest
|
||||
tcp_bridge_state_t *t = device->priv;
|
||||
|
||||
uint32_t b[t->samples_per_subframe * 12];
|
||||
memset(b, 0, nsamps * 4);
|
||||
memset(b, 0, t->samples_per_subframe * 12 * 4);
|
||||
int n = fullwrite(t->sock, b, t->samples_per_subframe * 12 * 4);
|
||||
if (n != t->samples_per_subframe * 12 * 4) {
|
||||
printf("tcp_bridge: write error ret %d error %s\n", n, strerror(errno));
|
||||
|
||||
@@ -22,15 +22,18 @@
|
||||
#if defined(ENABLE_ITTI)
|
||||
# include "intertask_interface.h"
|
||||
# include "create_tasks.h"
|
||||
# include "log.h"
|
||||
# include "common/utils/LOG/log.h"
|
||||
|
||||
# ifdef OPENAIR2
|
||||
# if defined(ENABLE_USE_MME)
|
||||
# include "sctp_eNB_task.h"
|
||||
# include "x2ap_eNB.h"
|
||||
# include "s1ap_eNB.h"
|
||||
# include "nas_ue_task.h"
|
||||
# include "udp_eNB_task.h"
|
||||
# include "gtpv1u_eNB_task.h"
|
||||
# else
|
||||
# define EPC_MODE_ENABLED 0
|
||||
# endif
|
||||
# if ENABLE_RAL
|
||||
# include "lteRALue.h"
|
||||
@@ -59,9 +62,14 @@ int create_tasks(uint32_t enb_nb)
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
# if defined(ENABLE_USE_MME)
|
||||
# if defined(ENABLE_USE_MME)
|
||||
if (EPC_MODE_ENABLED) {
|
||||
if (enb_nb > 0) {
|
||||
if (itti_create_task (TASK_X2AP, x2ap_task, NULL) < 0) {
|
||||
LOG_E(X2AP, "Create task for X2AP failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (itti_create_task (TASK_SCTP, sctp_eNB_task, NULL) < 0) {
|
||||
LOG_E(SCTP, "Create task for SCTP failed\n");
|
||||
return -1;
|
||||
@@ -84,8 +92,8 @@ int create_tasks(uint32_t enb_nb)
|
||||
}
|
||||
}
|
||||
|
||||
# endif
|
||||
|
||||
} /* if (EPC_MODE_ENABLED) */
|
||||
#endif
|
||||
if (enb_nb > 0) {
|
||||
LOG_I(RRC,"Creating RRC eNB Task\n");
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#if defined(ENABLE_ITTI)
|
||||
# include "intertask_interface.h"
|
||||
# include "create_tasks.h"
|
||||
# include "log.h"
|
||||
# include "common/utils/LOG/log.h"
|
||||
|
||||
# ifdef OPENAIR2
|
||||
# if defined(ENABLE_USE_MME)
|
||||
|
||||
@@ -47,6 +47,9 @@ eNBs =
|
||||
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.13.10/24";
|
||||
|
||||
ENB_IPV4_ADDRESS_FOR_X2C = "192.168.13.10/24";
|
||||
ENB_PORT_FOR_X2C = 36422; # Spec 36422
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -59,6 +59,9 @@ eNBs =
|
||||
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.13.10/24";
|
||||
|
||||
ENB_IPV4_ADDRESS_FOR_X2C = "192.168.13.10/24";
|
||||
ENB_PORT_FOR_X2C = 36422; # Spec 36422
|
||||
};
|
||||
# available options for level: error, warn, notice, info, debug, trace
|
||||
# available options for verbosity: none, low, medium, high, full
|
||||
|
||||
@@ -46,6 +46,9 @@ eNBs =
|
||||
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "eth1";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.13.10/24";
|
||||
|
||||
ENB_IPV4_ADDRESS_FOR_X2C = "192.168.13.10/24";
|
||||
ENB_PORT_FOR_X2C = 36422; # Spec 36422
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -151,6 +151,9 @@ eNBs =
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24";
|
||||
ENB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
|
||||
ENB_IPV4_ADDRESS_FOR_X2C = "192.168.12.111/24";
|
||||
ENB_PORT_FOR_X2C = 36422; # Spec 36422
|
||||
};
|
||||
|
||||
log_config :
|
||||
|
||||
@@ -151,6 +151,9 @@ eNBs =
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24";
|
||||
ENB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
|
||||
ENB_IPV4_ADDRESS_FOR_X2C = "192.168.12.111/24";
|
||||
ENB_PORT_FOR_X2C = 36422; # Spec 36422
|
||||
};
|
||||
|
||||
log_config :
|
||||
|
||||
@@ -149,12 +149,14 @@ eNBs =
|
||||
|
||||
NETWORK_INTERFACES :
|
||||
{
|
||||
|
||||
ENB_INTERFACE_NAME_FOR_S1_MME = "eth6";
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.111/24";
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "eth6";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24";
|
||||
ENB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
|
||||
ENB_IPV4_ADDRESS_FOR_X2C = "192.168.12.111/24";
|
||||
ENB_PORT_FOR_X2C = 36422; # Spec 36422
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
@@ -183,12 +183,14 @@ eNBs =
|
||||
|
||||
NETWORK_INTERFACES :
|
||||
{
|
||||
|
||||
ENB_INTERFACE_NAME_FOR_S1_MME = "lo";
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.13.10/24";
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "lo";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.13.10/24";
|
||||
ENB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
|
||||
ENB_IPV4_ADDRESS_FOR_X2C = "192.168.13.10/24";
|
||||
ENB_PORT_FOR_X2C = 36422; # Spec 36422
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
@@ -183,14 +183,14 @@ eNBs =
|
||||
|
||||
NETWORK_INTERFACES :
|
||||
{
|
||||
|
||||
ENB_INTERFACE_NAME_FOR_S1_MME = "lo";
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "127.0.0.2/24";
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "127.0.0.4/24";
|
||||
ENB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
|
||||
|
||||
|
||||
ENB_IPV4_ADDRESS_FOR_X2C = "127.0.0.2/24";
|
||||
ENB_PORT_FOR_X2C = 36422; # Spec 36422
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
@@ -183,12 +183,14 @@ eNBs =
|
||||
|
||||
NETWORK_INTERFACES :
|
||||
{
|
||||
|
||||
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.111/24";
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.111/24";
|
||||
ENB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
|
||||
ENB_IPV4_ADDRESS_FOR_X2C = "192.168.12.111/24";
|
||||
ENB_PORT_FOR_X2C = 36422; # Spec 36422
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
+3
-1
@@ -150,12 +150,14 @@ eNBs =
|
||||
|
||||
NETWORK_INTERFACES :
|
||||
{
|
||||
|
||||
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.19/24";
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.19/24";
|
||||
ENB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
|
||||
ENB_IPV4_ADDRESS_FOR_X2C = "192.168.12.19/24";
|
||||
ENB_PORT_FOR_X2C = 36422; # Spec 36422
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
@@ -152,12 +152,14 @@ eNBs =
|
||||
|
||||
NETWORK_INTERFACES :
|
||||
{
|
||||
|
||||
ENB_INTERFACE_NAME_FOR_S1_MME = "lo";
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "127.0.0.2/24";
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "lo";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "127.0.0.5/24";
|
||||
ENB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
|
||||
ENB_IPV4_ADDRESS_FOR_X2C = "127.0.0.2/24";
|
||||
ENB_PORT_FOR_X2C = 36422; # Spec 36422
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
@@ -153,12 +153,14 @@ eNBs =
|
||||
|
||||
NETWORK_INTERFACES :
|
||||
{
|
||||
|
||||
ENB_INTERFACE_NAME_FOR_S1_MME = "vboxnet0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.56.1/24";
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "vboxnet0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.56.1/24";
|
||||
ENB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
|
||||
ENB_IPV4_ADDRESS_FOR_X2C = "192.168.56.1/24";
|
||||
ENB_PORT_FOR_X2C = 36422; # Spec 36422
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -183,12 +183,14 @@ eNBs =
|
||||
|
||||
NETWORK_INTERFACES :
|
||||
{
|
||||
|
||||
ENB_INTERFACE_NAME_FOR_S1_MME = "lo";
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "127.0.0.2/24";
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "lo";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "127.0.0.5/24";
|
||||
ENB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
|
||||
ENB_IPV4_ADDRESS_FOR_X2C = "127.0.0.2/24";
|
||||
ENB_PORT_FOR_X2C = 36422; # Spec 36422
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
@@ -152,12 +152,14 @@ eNBs =
|
||||
|
||||
NETWORK_INTERFACES :
|
||||
{
|
||||
|
||||
ENB_INTERFACE_NAME_FOR_S1_MME = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.19/24";
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "eth0";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "127.0.0.5/24";
|
||||
ENB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
|
||||
ENB_IPV4_ADDRESS_FOR_X2C = "192.168.12.19/24";
|
||||
ENB_PORT_FOR_X2C = 36422; # Spec 36422
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
@@ -151,12 +151,14 @@ eNBs =
|
||||
|
||||
NETWORK_INTERFACES :
|
||||
{
|
||||
|
||||
ENB_INTERFACE_NAME_FOR_S1_MME = "lo";
|
||||
ENB_IPV4_ADDRESS_FOR_S1_MME = "127.0.0.2/24";
|
||||
ENB_INTERFACE_NAME_FOR_S1U = "lo";
|
||||
ENB_IPV4_ADDRESS_FOR_S1U = "127.0.0.5/24";
|
||||
ENB_PORT_FOR_S1U = 2152; # Spec 2152
|
||||
|
||||
ENB_IPV4_ADDRESS_FOR_X2C = "127.0.0.2/24";
|
||||
ENB_PORT_FOR_X2C = 36422; # Spec 36422
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#define _GNU_SOURCE
|
||||
#include <pthread.h>
|
||||
|
||||
#include "time_utils.h"
|
||||
|
||||
#undef MALLOC //there are two conflicting definitions, so we better make sure we don't use it at all
|
||||
|
||||
@@ -142,7 +141,6 @@ static struct {
|
||||
|
||||
extern double cpuf;
|
||||
|
||||
void exit_fun(const char* s);
|
||||
|
||||
void init_eNB(int,int);
|
||||
void stop_eNB(int nb_inst);
|
||||
@@ -784,10 +782,10 @@ static void* eNB_thread_prach( void* param ) {
|
||||
|
||||
while (!oai_exit) {
|
||||
|
||||
if (oai_exit) break;
|
||||
|
||||
|
||||
if (wait_on_condition(&proc->mutex_prach,&proc->cond_prach,&proc->instance_cnt_prach,"eNB_prach_thread") < 0) break;
|
||||
if (oai_exit) break;
|
||||
|
||||
LOG_D(PHY,"Running eNB prach procedures\n");
|
||||
prach_procedures(eNB
|
||||
@@ -825,10 +823,10 @@ static void* eNB_thread_prach_br( void* param ) {
|
||||
|
||||
while (!oai_exit) {
|
||||
|
||||
if (oai_exit) break;
|
||||
|
||||
|
||||
if (wait_on_condition(&proc->mutex_prach_br,&proc->cond_prach_br,&proc->instance_cnt_prach_br,"eNB_prach_thread_br") < 0) break;
|
||||
if (oai_exit) break;
|
||||
|
||||
LOG_D(PHY,"Running eNB prach procedures for BL/CE UEs\n");
|
||||
prach_procedures(eNB,1);
|
||||
@@ -1032,8 +1030,10 @@ void kill_eNB_proc(int inst) {
|
||||
proc = &eNB->proc;
|
||||
proc_rxtx = &proc->proc_rxtx[0];
|
||||
|
||||
kill_td_thread(eNB);
|
||||
kill_te_thread(eNB);
|
||||
if(get_nprocs() > 2 && codingw) {
|
||||
kill_td_thread(eNB);
|
||||
kill_te_thread(eNB);
|
||||
}
|
||||
LOG_I(PHY, "Killing TX CC_id %d inst %d\n", CC_id, inst );
|
||||
for (i=0; i<2; i++) {
|
||||
pthread_mutex_lock(&proc_rxtx[i].mutex_rxtx);
|
||||
@@ -1042,8 +1042,10 @@ void kill_eNB_proc(int inst) {
|
||||
pthread_cond_signal(&proc_rxtx[i].cond_rxtx);
|
||||
pthread_mutex_unlock(&proc_rxtx[i].mutex_rxtx);
|
||||
}
|
||||
pthread_mutex_lock(&proc->mutex_prach);
|
||||
proc->instance_cnt_prach = 0;
|
||||
pthread_cond_signal( &proc->cond_prach );
|
||||
pthread_mutex_unlock(&proc->mutex_prach);
|
||||
|
||||
pthread_cond_signal( &proc->cond_asynch_rxtx );
|
||||
pthread_cond_broadcast(&sync_phy_proc.cond_phy_proc_tx);
|
||||
@@ -1070,6 +1072,16 @@ void kill_eNB_proc(int inst) {
|
||||
pthread_mutex_destroy( &proc_rxtx[i].mutex_rxtx );
|
||||
pthread_cond_destroy( &proc_rxtx[i].cond_rxtx );
|
||||
}
|
||||
|
||||
pthread_attr_destroy(&proc->attr_prach);
|
||||
pthread_attr_destroy(&proc->attr_asynch_rxtx);
|
||||
pthread_attr_destroy(&proc_rxtx[0].attr_rxtx);
|
||||
pthread_attr_destroy(&proc_rxtx[1].attr_rxtx);
|
||||
#ifdef Rel14
|
||||
pthread_mutex_destroy(&proc->mutex_RU_PRACH_br);
|
||||
pthread_attr_destroy(&proc->attr_prach_br);
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1107,10 +1119,10 @@ void free_transport(PHY_VARS_eNB *eNB)
|
||||
int j;
|
||||
|
||||
for (i=0; i<NUMBER_OF_UE_MAX; i++) {
|
||||
LOG_I(PHY, "Freeing Transport Channel Buffers for DLSCH, UE %d\n",i);
|
||||
LOG_D(PHY, "Freeing Transport Channel Buffers for DLSCH, UE %d\n",i);
|
||||
for (j=0; j<2; j++) free_eNB_dlsch(eNB->dlsch[i][j]);
|
||||
|
||||
LOG_I(PHY, "Freeing Transport Channel Buffer for ULSCH, UE %d\n",i);
|
||||
LOG_D(PHY, "Freeing Transport Channel Buffer for ULSCH, UE %d\n",i);
|
||||
free_eNB_ulsch(eNB->ulsch[1+i]);
|
||||
}
|
||||
free_eNB_ulsch(eNB->ulsch[0]);
|
||||
|
||||
+64
-51
@@ -1081,8 +1081,8 @@ static void* ru_thread_prach( void* param ) {
|
||||
|
||||
while (!oai_exit) {
|
||||
|
||||
if (oai_exit) break;
|
||||
if (wait_on_condition(&proc->mutex_prach,&proc->cond_prach,&proc->instance_cnt_prach,"ru_prach_thread") < 0) break;
|
||||
if (oai_exit) break;
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_RU_PRACH_RX, 1 );
|
||||
if (ru->eNB_list[0]){
|
||||
prach_procedures(
|
||||
@@ -1131,8 +1131,8 @@ static void* ru_thread_prach_br( void* param ) {
|
||||
|
||||
while (!oai_exit) {
|
||||
|
||||
if (oai_exit) break;
|
||||
if (wait_on_condition(&proc->mutex_prach_br,&proc->cond_prach_br,&proc->instance_cnt_prach_br,"ru_prach_thread_br") < 0) break;
|
||||
if (oai_exit) break;
|
||||
rx_prach(NULL,
|
||||
ru,
|
||||
NULL,
|
||||
@@ -1883,13 +1883,13 @@ void *ru_thread_synch(void *arg) {
|
||||
|
||||
LOG_I(PHY,"Estimated sync_pos %d, peak_val %d => timing offset %d\n",sync_pos,peak_val,ru->rx_offset);
|
||||
|
||||
LOG_M_BEGIN(RU)
|
||||
if ((peak_val > 300000) && (sync_pos > 0)) {
|
||||
LOG_M("ru_sync.m","sync",(void*)&sync_corr[0],fp->samples_per_tti*5,1,2);
|
||||
LOG_M("ru_rx.m","rxs",&(ru->eNB_list[0]->common_vars.rxdata[0][0]),fp->samples_per_tti*10,1,1);
|
||||
exit(-1);
|
||||
}
|
||||
LOG_M_END
|
||||
if (LOG_DEBUGFLAG(RU)) {
|
||||
if ((peak_val > 300000) && (sync_pos > 0)) {
|
||||
LOG_M("ru_sync.m","sync",(void*)&sync_corr[0],fp->samples_per_tti*5,1,2);
|
||||
LOG_M("ru_rx.m","rxs",&(ru->eNB_list[0]->common_vars.rxdata[0][0]),fp->samples_per_tti*10,1,1);
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
ru->in_synch=1;
|
||||
}
|
||||
}
|
||||
@@ -2231,11 +2231,36 @@ void init_RU_proc(RU_t *ru) {
|
||||
|
||||
}
|
||||
|
||||
void kill_RU_proc(int inst)
|
||||
void kill_RU_proc(RU_t *ru)
|
||||
{
|
||||
RU_t *ru = RC.ru[inst];
|
||||
RU_proc_t *proc = &ru->proc;
|
||||
|
||||
#if defined(PRE_SCD_THREAD)
|
||||
pthread_mutex_lock(&proc->mutex_pre_scd);
|
||||
ru->proc.instance_pre_scd = 0;
|
||||
pthread_cond_signal(&proc->cond_pre_scd);
|
||||
pthread_mutex_unlock(&proc->mutex_pre_scd);
|
||||
pthread_join(proc->pthread_pre_scd, NULL);
|
||||
pthread_mutex_destroy(&proc->mutex_pre_scd);
|
||||
pthread_cond_destroy(&proc->cond_pre_scd);
|
||||
#endif
|
||||
#ifdef PHY_TX_THREAD
|
||||
pthread_mutex_lock(&proc->mutex_phy_tx);
|
||||
proc->instance_cnt_phy_tx = 0;
|
||||
pthread_cond_signal(&proc->cond_phy_tx);
|
||||
pthread_mutex_unlock(&proc->mutex_phy_tx);
|
||||
pthread_join(ru->proc.pthread_phy_tx, NULL);
|
||||
pthread_mutex_destroy( &proc->mutex_phy_tx);
|
||||
pthread_cond_destroy( &proc->cond_phy_tx);
|
||||
pthread_mutex_lock(&proc->mutex_rf_tx);
|
||||
proc->instance_cnt_rf_tx = 0;
|
||||
pthread_cond_signal(&proc->cond_rf_tx);
|
||||
pthread_mutex_unlock(&proc->mutex_rf_tx);
|
||||
pthread_join(proc->pthread_rf_tx, NULL);
|
||||
pthread_mutex_destroy( &proc->mutex_rf_tx);
|
||||
pthread_cond_destroy( &proc->cond_rf_tx);
|
||||
#endif
|
||||
|
||||
if (get_thread_worker_stage()) {
|
||||
LOG_D(PHY, "killing FEP thread\n");
|
||||
kill_fep_thread(ru);
|
||||
@@ -2272,8 +2297,10 @@ void kill_RU_proc(int inst)
|
||||
|
||||
pthread_mutex_lock(&proc->mutex_eNBs);
|
||||
proc->ru_tx_ready = 0;
|
||||
proc->instance_cnt_eNBs = 0;
|
||||
pthread_cond_signal(&proc->cond_eNBs);
|
||||
proc->instance_cnt_eNBs = 1;
|
||||
// cond_eNBs is used by both ru_thread and ru_thread_tx, so we need to send
|
||||
// a broadcast to wake up both threads
|
||||
pthread_cond_broadcast(&proc->cond_eNBs);
|
||||
pthread_mutex_unlock(&proc->mutex_eNBs);
|
||||
|
||||
pthread_mutex_lock(&proc->mutex_asynch_rxtx);
|
||||
@@ -2281,10 +2308,12 @@ void kill_RU_proc(int inst)
|
||||
pthread_cond_signal(&proc->cond_asynch_rxtx);
|
||||
pthread_mutex_unlock(&proc->mutex_asynch_rxtx);
|
||||
|
||||
/*LOG_D(PHY, "Joining pthread_FH\n");
|
||||
LOG_D(PHY, "Joining pthread_FH\n");
|
||||
pthread_join(proc->pthread_FH, NULL);
|
||||
LOG_D(PHY, "Joining pthread_FHTX\n");
|
||||
pthread_join(proc->pthread_FH1, NULL);*/
|
||||
if (!single_thread_flag && get_nprocs() > 4) {
|
||||
LOG_D(PHY, "Joining pthread_FHTX\n");
|
||||
pthread_join(proc->pthread_FH1, NULL);
|
||||
}
|
||||
if (ru->function == NGFI_RRU_IF4p5) {
|
||||
LOG_D(PHY, "Joining pthread_prach\n");
|
||||
pthread_join(proc->pthread_prach, NULL);
|
||||
@@ -2756,45 +2785,11 @@ void init_RU(char *rf_config_file) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void stop_ru(RU_t *ru) {
|
||||
|
||||
#if defined(PRE_SCD_THREAD) || defined(PHY_TX_THREAD)
|
||||
int *status;
|
||||
#endif
|
||||
printf("Stopping RU %p processing threads\n",(void*)ru);
|
||||
#if defined(PRE_SCD_THREAD)
|
||||
if(ru){
|
||||
ru->proc.instance_pre_scd = 0;
|
||||
pthread_cond_signal( &ru->proc.cond_pre_scd );
|
||||
pthread_join(ru->proc.pthread_pre_scd, (void**)&status );
|
||||
pthread_mutex_destroy(&ru->proc.mutex_pre_scd );
|
||||
pthread_cond_destroy(&ru->proc.cond_pre_scd );
|
||||
}
|
||||
#endif
|
||||
#ifdef PHY_TX_THREAD
|
||||
if(ru){
|
||||
ru->proc.instance_cnt_phy_tx = 0;
|
||||
pthread_cond_signal(&ru->proc.cond_phy_tx);
|
||||
pthread_join( ru->proc.pthread_phy_tx, (void**)&status );
|
||||
pthread_mutex_destroy( &ru->proc.mutex_phy_tx );
|
||||
pthread_cond_destroy( &ru->proc.cond_phy_tx );
|
||||
ru->proc.instance_cnt_rf_tx = 0;
|
||||
pthread_cond_signal(&ru->proc.cond_rf_tx);
|
||||
pthread_join( ru->proc.pthread_rf_tx, (void**)&status );
|
||||
pthread_mutex_destroy( &ru->proc.mutex_rf_tx );
|
||||
pthread_cond_destroy( &ru->proc.cond_rf_tx );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void stop_RU(int nb_ru)
|
||||
{
|
||||
for (int inst = 0; inst < nb_ru; inst++) {
|
||||
LOG_I(PHY, "Stopping RU %d processing threads\n", inst);
|
||||
kill_RU_proc(inst);
|
||||
kill_RU_proc(RC.ru[inst]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2839,6 +2834,24 @@ void RCconfig_RU(void) {
|
||||
RC.ru[j]->num_eNB = 0;
|
||||
for (i=0;i<RC.ru[j]->num_eNB;i++) RC.ru[j]->eNB_list[i] = RC.eNB[RUParamList.paramarray[j][RU_ENB_LIST_IDX].iptr[i]][0];
|
||||
|
||||
if (config_isparamset(RUParamList.paramarray[j], RU_SDR_ADDRS)) {
|
||||
RC.ru[j]->openair0_cfg.sdr_addrs = strdup(*(RUParamList.paramarray[j][RU_SDR_ADDRS].strptr));
|
||||
}
|
||||
|
||||
if (config_isparamset(RUParamList.paramarray[j], RU_SDR_CLK_SRC)) {
|
||||
if (strcmp(*(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr), "internal") == 0) {
|
||||
RC.ru[j]->openair0_cfg.clock_source = internal;
|
||||
LOG_D(PHY, "RU clock source set as internal\n");
|
||||
} else if (strcmp(*(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr), "external") == 0) {
|
||||
RC.ru[j]->openair0_cfg.clock_source = external;
|
||||
LOG_D(PHY, "RU clock source set as external\n");
|
||||
} else if (strcmp(*(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr), "gpsdo") == 0) {
|
||||
RC.ru[j]->openair0_cfg.clock_source = gpsdo;
|
||||
LOG_D(PHY, "RU clock source set as gpsdo\n");
|
||||
} else {
|
||||
LOG_E(PHY, "Erroneous RU clock source in the provided configuration file: '%s'\n", *(RUParamList.paramarray[j][RU_SDR_CLK_SRC].strptr));
|
||||
}
|
||||
}
|
||||
|
||||
if (strcmp(*(RUParamList.paramarray[j][RU_LOCAL_RF_IDX].strptr), "yes") == 0) {
|
||||
if ( !(config_isparamset(RUParamList.paramarray[j],RU_LOCAL_IF_NAME_IDX)) ) {
|
||||
|
||||
+61
-103
@@ -83,7 +83,6 @@ unsigned short config_frames[4] = {2,9,11,13};
|
||||
#endif
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
#include "intertask_interface_init.h"
|
||||
#include "create_tasks.h"
|
||||
#endif
|
||||
|
||||
@@ -108,6 +107,10 @@ unsigned char scope_enb_num_ue = 2;
|
||||
static pthread_t forms_thread; //xforms
|
||||
#endif //XFORMS
|
||||
|
||||
#ifndef ENABLE_USE_MME
|
||||
#define EPC_MODE_ENABLED 0
|
||||
#endif
|
||||
|
||||
pthread_cond_t nfapi_sync_cond;
|
||||
pthread_mutex_t nfapi_sync_mutex;
|
||||
int nfapi_sync_var=-1; //!< protected by mutex \ref nfapi_sync_mutex
|
||||
@@ -360,13 +363,13 @@ void signal_handler(int sig) {
|
||||
|
||||
|
||||
|
||||
void exit_fun(const char* s)
|
||||
void exit_function(const char* file, const char* function, const int line, const char* s)
|
||||
{
|
||||
|
||||
int ru_id;
|
||||
|
||||
if (s != NULL) {
|
||||
printf("%s %s() Exiting OAI softmodem: %s\n",__FILE__, __FUNCTION__, s);
|
||||
printf("%s:%d %s() Exiting OAI softmodem: %s\n",file,line, function, s);
|
||||
}
|
||||
|
||||
oai_exit = 1;
|
||||
@@ -386,11 +389,11 @@ void exit_fun(const char* s)
|
||||
}
|
||||
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
sleep(1); //allow lte-softmodem threads to exit first
|
||||
#if defined(ENABLE_ITTI)
|
||||
itti_terminate_tasks (TASK_UNKNOWN);
|
||||
#endif
|
||||
|
||||
exit(1);
|
||||
|
||||
}
|
||||
|
||||
@@ -485,46 +488,22 @@ void *l2l1_task(void *arg) {
|
||||
itti_set_task_real_time(TASK_L2L1);
|
||||
itti_mark_task_ready(TASK_L2L1);
|
||||
|
||||
/* Wait for the initialize message */
|
||||
printf("Wait for the ITTI initialize message\n");
|
||||
do {
|
||||
if (message_p != NULL) {
|
||||
result = itti_free (ITTI_MSG_ORIGIN_ID(message_p), message_p);
|
||||
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
|
||||
}
|
||||
|
||||
itti_receive_msg (TASK_L2L1, &message_p);
|
||||
|
||||
switch (ITTI_MSG_ID(message_p)) {
|
||||
case INITIALIZE_MESSAGE:
|
||||
/* Start eNB thread */
|
||||
printf("L2L1 TASK received %s\n", ITTI_MSG_NAME(message_p));
|
||||
start_eNB = 1;
|
||||
break;
|
||||
|
||||
case TERMINATE_MESSAGE:
|
||||
printf("received terminate message\n");
|
||||
oai_exit=1;
|
||||
start_eNB = 0;
|
||||
itti_exit_task ();
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("Received unexpected message %s\n", ITTI_MSG_NAME(message_p));
|
||||
break;
|
||||
}
|
||||
} while (ITTI_MSG_ID(message_p) != INITIALIZE_MESSAGE);
|
||||
|
||||
result = itti_free (ITTI_MSG_ORIGIN_ID(message_p), message_p);
|
||||
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
|
||||
/* ???? no else but seems to be UE only ???
|
||||
do {
|
||||
// Wait for a message
|
||||
/* Wait for the initialize message */
|
||||
printf("Wait for the ITTI initialize message\n");
|
||||
while (1) {
|
||||
itti_receive_msg (TASK_L2L1, &message_p);
|
||||
|
||||
switch (ITTI_MSG_ID(message_p)) {
|
||||
case INITIALIZE_MESSAGE:
|
||||
/* Start eNB thread */
|
||||
LOG_D(PHY, "L2L1 TASK received %s\n", ITTI_MSG_NAME(message_p));
|
||||
start_eNB = 1;
|
||||
break;
|
||||
|
||||
case TERMINATE_MESSAGE:
|
||||
LOG_W(PHY, " *** Exiting L2L1 thread\n");
|
||||
oai_exit=1;
|
||||
start_eNB = 0;
|
||||
itti_exit_task ();
|
||||
break;
|
||||
|
||||
@@ -547,14 +526,15 @@ void *l2l1_task(void *arg) {
|
||||
|
||||
result = itti_free (ITTI_MSG_ORIGIN_ID(message_p), message_p);
|
||||
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
|
||||
} while(!oai_exit);
|
||||
*/
|
||||
message_p = NULL;
|
||||
};
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static void get_options(void) {
|
||||
static void get_options(unsigned int *start_msc) {
|
||||
|
||||
int tddflag, nonbiotflag;
|
||||
|
||||
@@ -588,11 +568,9 @@ static void get_options(void) {
|
||||
set_glog(glog_level);
|
||||
}
|
||||
if (start_telnetsrv) {
|
||||
load_module_shlib("telnetsrv",NULL,0);
|
||||
load_module_shlib("telnetsrv",NULL,0,NULL);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ( !(CONFIG_ISFLAGSET(CONFIG_ABORT)) ) {
|
||||
memset((void*)&RC,0,sizeof(RC));
|
||||
/* Read RC configuration file */
|
||||
@@ -811,12 +789,13 @@ void wait_eNBs(void) {
|
||||
/*
|
||||
* helper function to terminate a certain ITTI task
|
||||
*/
|
||||
void terminate_task(task_id_t task_id, module_id_t mod_id)
|
||||
void terminate_task(module_id_t mod_id, task_id_t from, task_id_t to)
|
||||
{
|
||||
LOG_I(ENB_APP, "sending TERMINATE_MESSAGE to task %s (%d)\n", itti_get_task_name(task_id), task_id);
|
||||
LOG_I(ENB_APP, "sending TERMINATE_MESSAGE from task %s (%d) to task %s (%d)\n",
|
||||
itti_get_task_name(from), from, itti_get_task_name(to), to);
|
||||
MessageDef *msg;
|
||||
msg = itti_alloc_new_message (ENB_APP, TERMINATE_MESSAGE);
|
||||
itti_send_msg_to_task (task_id, ENB_MODULE_ID_TO_INSTANCE(mod_id), msg);
|
||||
msg = itti_alloc_new_message (from, TERMINATE_MESSAGE);
|
||||
itti_send_msg_to_task (to, ENB_MODULE_ID_TO_INSTANCE(mod_id), msg);
|
||||
}
|
||||
|
||||
extern void free_transport(PHY_VARS_eNB *);
|
||||
@@ -825,39 +804,20 @@ extern void phy_free_RU(RU_t*);
|
||||
int stop_L1L2(module_id_t enb_id)
|
||||
{
|
||||
LOG_W(ENB_APP, "stopping lte-softmodem\n");
|
||||
oai_exit = 1;
|
||||
|
||||
if (!RC.ru) {
|
||||
LOG_F(ENB_APP, "no RU configured\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* stop trx devices, multiple carrier currently not supported by RU */
|
||||
if (RC.ru[enb_id]) {
|
||||
if (RC.ru[enb_id]->rfdevice.trx_stop_func) {
|
||||
RC.ru[enb_id]->rfdevice.trx_stop_func(&RC.ru[enb_id]->rfdevice);
|
||||
LOG_I(ENB_APP, "turned off RU rfdevice\n");
|
||||
} else {
|
||||
LOG_W(ENB_APP, "can not turn off rfdevice due to missing trx_stop_func callback, proceding anyway!\n");
|
||||
}
|
||||
if (RC.ru[enb_id]->ifdevice.trx_stop_func) {
|
||||
RC.ru[enb_id]->ifdevice.trx_stop_func(&RC.ru[enb_id]->ifdevice);
|
||||
LOG_I(ENB_APP, "turned off RU ifdevice\n");
|
||||
} else {
|
||||
LOG_W(ENB_APP, "can not turn off ifdevice due to missing trx_stop_func callback, proceding anyway!\n");
|
||||
}
|
||||
} else {
|
||||
LOG_W(ENB_APP, "no RU found for index %d\n", enb_id);
|
||||
LOG_UI(ENB_APP, "no RU configured\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* these tasks need to pick up new configuration */
|
||||
terminate_task(TASK_RRC_ENB, enb_id);
|
||||
terminate_task(TASK_L2L1, enb_id);
|
||||
terminate_task(enb_id, TASK_ENB_APP, TASK_RRC_ENB);
|
||||
terminate_task(enb_id, TASK_ENB_APP, TASK_L2L1);
|
||||
oai_exit = 1;
|
||||
LOG_I(ENB_APP, "calling kill_RU_proc() for instance %d\n", enb_id);
|
||||
kill_RU_proc(RC.ru[enb_id]);
|
||||
LOG_I(ENB_APP, "calling kill_eNB_proc() for instance %d\n", enb_id);
|
||||
kill_eNB_proc(enb_id);
|
||||
LOG_I(ENB_APP, "calling kill_RU_proc() for instance %d\n", enb_id);
|
||||
kill_RU_proc(enb_id);
|
||||
oai_exit = 0;
|
||||
for (int cc_id = 0; cc_id < RC.nb_CC[enb_id]; cc_id++) {
|
||||
free_transport(RC.eNB[enb_id][cc_id]);
|
||||
@@ -880,7 +840,9 @@ int restart_L1L2(module_id_t enb_id)
|
||||
LOG_W(ENB_APP, "restarting lte-softmodem\n");
|
||||
|
||||
/* block threads */
|
||||
pthread_mutex_lock(&sync_mutex);
|
||||
sync_var = -1;
|
||||
pthread_mutex_unlock(&sync_mutex);
|
||||
|
||||
for (cc_id = 0; cc_id < RC.nb_L1_CC[enb_id]; cc_id++) {
|
||||
RC.eNB[enb_id][cc_id]->configured = 0;
|
||||
@@ -891,6 +853,9 @@ int restart_L1L2(module_id_t enb_id)
|
||||
/* TODO this should be done for all RUs associated to this eNB */
|
||||
memcpy(&ru->frame_parms, &RC.eNB[enb_id][0]->frame_parms, sizeof(LTE_DL_FRAME_PARMS));
|
||||
set_function_spec_param(RC.ru[enb_id]);
|
||||
/* reset the list of connected UEs in the MAC, since in this process with
|
||||
* loose all UEs (have to reconnect) */
|
||||
init_UE_list(&RC.mac[enb_id]->UE_list);
|
||||
|
||||
LOG_I(ENB_APP, "attempting to create ITTI tasks\n");
|
||||
if (itti_create_task (TASK_RRC_ENB, rrc_enb_task, NULL) < 0) {
|
||||
@@ -965,6 +930,7 @@ int main( int argc, char **argv )
|
||||
#if defined (XFORMS)
|
||||
int ret;
|
||||
#endif
|
||||
unsigned int start_msc=0;
|
||||
|
||||
if ( load_configmodule(argc,argv) == NULL) {
|
||||
exit_fun("[SOFTMODEM] Error, configuration module init failed\n");
|
||||
@@ -982,7 +948,7 @@ int main( int argc, char **argv )
|
||||
|
||||
printf("Reading in command-line options\n");
|
||||
|
||||
get_options ();
|
||||
get_options (&start_msc);
|
||||
if (CONFIG_ISFLAGSET(CONFIG_ABORT) ) {
|
||||
fprintf(stderr,"Getting configuration failed\n");
|
||||
exit(-1);
|
||||
@@ -1007,22 +973,19 @@ int main( int argc, char **argv )
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
|
||||
printf("ITTI init\n");
|
||||
printf("ITTI init, useMME: %i\n" ,EPC_MODE_ENABLED);
|
||||
|
||||
itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info);
|
||||
|
||||
// initialize mscgen log after ITTI
|
||||
if (start_msc) {
|
||||
load_module_shlib("msc",NULL,0,&msc_interface);
|
||||
}
|
||||
MSC_INIT(MSC_E_UTRAN, THREAD_MAX+TASK_MAX);
|
||||
#endif
|
||||
|
||||
if (opt_type != OPT_NONE) {
|
||||
radio_type_t radio_type;
|
||||
|
||||
if (frame_parms[0]->frame_type == FDD)
|
||||
radio_type = RADIO_TYPE_FDD;
|
||||
else
|
||||
radio_type = RADIO_TYPE_TDD;
|
||||
|
||||
if (init_opt(in_path, in_ip, NULL, radio_type) == -1)
|
||||
if (init_opt(in_path, in_ip) == -1)
|
||||
LOG_E(OPT,"failed to run OPT \n");
|
||||
}
|
||||
|
||||
@@ -1305,25 +1268,20 @@ int main( int argc, char **argv )
|
||||
|
||||
printf("stopping MODEM threads\n");
|
||||
|
||||
// cleanup
|
||||
for (ru_id=0;ru_id<RC.nb_RU;ru_id++) {
|
||||
stop_ru(RC.ru[ru_id]);
|
||||
stop_eNB(NB_eNB_INST);
|
||||
stop_RU(RC.nb_RU);
|
||||
/* release memory used by the RU/eNB threads (incomplete), after all
|
||||
* threads have been stopped (they partially use the same memory) */
|
||||
for (int inst = 0; inst < NB_eNB_INST; inst++) {
|
||||
for (int cc_id = 0; cc_id < RC.nb_CC[inst]; cc_id++) {
|
||||
free_transport(RC.eNB[inst][cc_id]);
|
||||
phy_free_lte_eNB(RC.eNB[inst][cc_id]);
|
||||
}
|
||||
}
|
||||
|
||||
stop_eNB(NB_eNB_INST);
|
||||
stop_RU(RC.nb_RU);
|
||||
/* release memory used by the RU/eNB threads (incomplete), after all
|
||||
* threads have been stopped (they partially use the same memory) */
|
||||
for (int inst = 0; inst < NB_eNB_INST; inst++) {
|
||||
for (int cc_id = 0; cc_id < RC.nb_CC[inst]; cc_id++) {
|
||||
free_transport(RC.eNB[inst][cc_id]);
|
||||
phy_free_lte_eNB(RC.eNB[inst][cc_id]);
|
||||
}
|
||||
}
|
||||
for (int inst = 0; inst < RC.nb_RU; inst++) {
|
||||
phy_free_RU(RC.ru[inst]);
|
||||
}
|
||||
free_lte_top();
|
||||
for (int inst = 0; inst < RC.nb_RU; inst++) {
|
||||
phy_free_RU(RC.ru[inst]);
|
||||
}
|
||||
free_lte_top();
|
||||
|
||||
printf("About to call end_configmodule() from %s() %s:%d\n", __FUNCTION__, __FILE__, __LINE__);
|
||||
end_configmodule();
|
||||
|
||||
@@ -190,8 +190,9 @@
|
||||
}
|
||||
|
||||
#define CONFIG_HLP_FLOG "Enable online log \n"
|
||||
#define CONFIG_HLP_LOGL "Set the global log level, valide options: (9:trace, 8/7:debug, 6:info, 4:warn, 3:error)\n"
|
||||
#define CONFIG_HLP_LOGL "Set the global log level, valide options: (4:trace, 3:debug, 2:info, 1:warn, (0:error))\n"
|
||||
#define CONFIG_HLP_TELN "Start embedded telnet server \n"
|
||||
#define CONFIG_HLP_MSC "Enable the MSC tracing utility \n"
|
||||
/*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/* command line parameters for LOG utility */
|
||||
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
||||
@@ -200,6 +201,7 @@
|
||||
{"R" , CONFIG_HLP_FLOG, 0, uptr:&online_log_messages, defintval:1, TYPE_INT, 0}, \
|
||||
{"g" , CONFIG_HLP_LOGL, 0, uptr:&glog_level, defintval:0, TYPE_UINT, 0}, \
|
||||
{"telnetsrv", CONFIG_HLP_TELN, PARAMFLAG_BOOL, uptr:&start_telnetsrv, defintval:0, TYPE_UINT, 0}, \
|
||||
{"msc", CONFIG_HLP_MSC, PARAMFLAG_BOOL, uptr:start_msc, defintval:0, TYPE_UINT, 0}, \
|
||||
}
|
||||
#define CMDLINE_ONLINELOG_IDX 0
|
||||
#define CMDLINE_GLOGLEVEL_IDX 1
|
||||
@@ -238,7 +240,6 @@ extern volatile int start_UE;
|
||||
#include "threads_t.h"
|
||||
extern threads_t threads;
|
||||
|
||||
extern void exit_fun(const char* s);
|
||||
// In lte-enb.c
|
||||
extern void init_eNB(int single_thread_flag,int wait_for_sync);
|
||||
extern void stop_eNB(int);
|
||||
@@ -249,7 +250,7 @@ extern void init_RU(const char*);
|
||||
extern void stop_ru(RU_t *ru);
|
||||
extern void init_RU_proc(RU_t *ru);
|
||||
extern void stop_RU(int nb_ru);
|
||||
extern void kill_RU_proc(int inst);
|
||||
extern void kill_RU_proc(RU_t *ru);
|
||||
extern void set_function_spec_param(RU_t *ru);
|
||||
|
||||
// In lte-ue.c
|
||||
|
||||
+15
-19
@@ -446,7 +446,6 @@ static void *UE_thread_synch(void *arg)
|
||||
int freq_offset=0;
|
||||
char threadname[128];
|
||||
|
||||
UE->is_synchronized = 0;
|
||||
printf("UE_thread_sync in with PHY_vars_UE %p\n",arg);
|
||||
|
||||
cpu_set_t cpuset;
|
||||
@@ -522,11 +521,6 @@ static void *UE_thread_synch(void *arg)
|
||||
|
||||
printf("Started device, unlocked sync_mutex (UE_sync_thread)\n");
|
||||
|
||||
if (UE->rfdevice.trx_start_func(&UE->rfdevice) != 0 ) {
|
||||
LOG_E(HW,"Could not start the device\n");
|
||||
oai_exit=1;
|
||||
}
|
||||
|
||||
while (oai_exit==0) {
|
||||
AssertFatal ( 0== pthread_mutex_lock(&UE->proc.mutex_synch), "");
|
||||
while (UE->proc.instance_cnt_synch < 0)
|
||||
@@ -755,7 +749,6 @@ static void *UE_thread_rxn_txnp4(void *arg) {
|
||||
UE_rxtx_proc_t *proc = rtd->proc;
|
||||
PHY_VARS_UE *UE = rtd->UE;
|
||||
|
||||
proc->instance_cnt_rxtx=-1;
|
||||
proc->subframe_rx=proc->sub_frame_start;
|
||||
|
||||
char threadname[256];
|
||||
@@ -1457,20 +1450,25 @@ void *UE_thread(void *arg) {
|
||||
int sub_frame=-1;
|
||||
//int cumulated_shift=0;
|
||||
|
||||
if (UE->rfdevice.trx_start_func(&UE->rfdevice) != 0 ) {
|
||||
LOG_E(HW,"Could not start the device\n");
|
||||
oai_exit=1;
|
||||
}
|
||||
|
||||
while (!oai_exit) {
|
||||
#if BASIC_SIMULATOR
|
||||
while (!(UE->proc.instance_cnt_synch < 0)) {
|
||||
printf("ue sync not ready\n");
|
||||
usleep(500*1000);
|
||||
}
|
||||
#endif
|
||||
|
||||
AssertFatal ( 0== pthread_mutex_lock(&UE->proc.mutex_synch), "");
|
||||
int instance_cnt_synch = UE->proc.instance_cnt_synch;
|
||||
int is_synchronized = UE->is_synchronized;
|
||||
AssertFatal ( 0== pthread_mutex_unlock(&UE->proc.mutex_synch), "");
|
||||
|
||||
if (is_synchronized == 0) {
|
||||
#if BASIC_SIMULATOR
|
||||
while (!((instance_cnt_synch = UE->proc.instance_cnt_synch) < 0)) {
|
||||
printf("ue sync not ready\n");
|
||||
usleep(500*1000);
|
||||
}
|
||||
#endif
|
||||
if (instance_cnt_synch < 0) { // we can invoke the synch
|
||||
// grab 10 ms of signal and wakeup synch thread
|
||||
for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++)
|
||||
@@ -1661,12 +1659,7 @@ void *UE_thread(void *arg) {
|
||||
|
||||
proc->instance_cnt_rxtx++;
|
||||
LOG_D( PHY, "[SCHED][UE %d] UE RX instance_cnt_rxtx %d subframe %d !!\n", UE->Mod_id, proc->instance_cnt_rxtx,proc->subframe_rx);
|
||||
if (proc->instance_cnt_rxtx == 0) {
|
||||
if (pthread_cond_signal(&proc->cond_rxtx) != 0) {
|
||||
LOG_E( PHY, "[SCHED][UE %d] ERROR pthread_cond_signal for UE RX thread\n", UE->Mod_id);
|
||||
exit_fun("nothing to add");
|
||||
}
|
||||
} else {
|
||||
if (proc->instance_cnt_rxtx != 0) {
|
||||
LOG_E( PHY, "[SCHED][UE %d] UE RX thread busy (IC %d)!!\n", UE->Mod_id, proc->instance_cnt_rxtx);
|
||||
if (proc->instance_cnt_rxtx > 2)
|
||||
exit_fun("instance_cnt_rxtx > 2");
|
||||
@@ -1717,6 +1710,8 @@ void init_UE_threads(int inst) {
|
||||
|
||||
pthread_mutex_init(&UE->proc.mutex_synch,NULL);
|
||||
pthread_cond_init(&UE->proc.cond_synch,NULL);
|
||||
UE->proc.instance_cnt_synch = -1;
|
||||
UE->is_synchronized = 0;
|
||||
|
||||
// the threads are not yet active, therefore access is allowed without locking
|
||||
int nb_threads=RX_NB_TH;
|
||||
@@ -1728,6 +1723,7 @@ void init_UE_threads(int inst) {
|
||||
|
||||
pthread_mutex_init(&UE->proc.proc_rxtx[i].mutex_rxtx,NULL);
|
||||
pthread_cond_init(&UE->proc.proc_rxtx[i].cond_rxtx,NULL);
|
||||
UE->proc.proc_rxtx[i].instance_cnt_rxtx = -1;
|
||||
UE->proc.proc_rxtx[i].sub_frame_start=i;
|
||||
UE->proc.proc_rxtx[i].sub_frame_step=nb_threads;
|
||||
printf("Init_UE_threads rtd %d proc %d nb_threads %d i %d\n",rtd->proc->sub_frame_start, UE->proc.proc_rxtx[i].sub_frame_start,nb_threads, i);
|
||||
|
||||
@@ -84,7 +84,6 @@
|
||||
#endif
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
#include "intertask_interface_init.h"
|
||||
#include "create_tasks.h"
|
||||
#endif
|
||||
|
||||
@@ -323,13 +322,13 @@ void signal_handler(int sig) {
|
||||
|
||||
|
||||
|
||||
void exit_fun(const char* s)
|
||||
void exit_function(const char* file, const char* function, const int line, const char* s)
|
||||
{
|
||||
int CC_id;
|
||||
|
||||
logClean();
|
||||
if (s != NULL) {
|
||||
printf("%s %s() Exiting OAI softmodem: %s\n",__FILE__, __FUNCTION__, s);
|
||||
printf("%s:%d %s() Exiting OAI softmodem: %s\n",file,line, function, s);
|
||||
}
|
||||
|
||||
oai_exit = 1;
|
||||
@@ -342,10 +341,11 @@ void exit_fun(const char* s)
|
||||
PHY_vars_UE_g[0][CC_id]->rfdevice.trx_end_func(&PHY_vars_UE_g[0][CC_id]->rfdevice);
|
||||
}
|
||||
|
||||
#if defined(ENABLE_ITTI)
|
||||
sleep(1); //allow lte-softmodem threads to exit first
|
||||
#if defined(ENABLE_ITTI)
|
||||
itti_terminate_tasks (TASK_UNKNOWN);
|
||||
#endif
|
||||
exit(1);
|
||||
}
|
||||
|
||||
#ifdef XFORMS
|
||||
@@ -470,7 +470,7 @@ void *l2l1_task(void *arg) {
|
||||
|
||||
extern int16_t dlsch_demod_shift;
|
||||
|
||||
static void get_options(void) {
|
||||
static void get_options(unsigned int *start_msc) {
|
||||
int CC_id;
|
||||
int tddflag, nonbiotflag;
|
||||
char *loopfile=NULL;
|
||||
@@ -505,7 +505,7 @@ static void get_options(void) {
|
||||
set_glog(glog_level);
|
||||
}
|
||||
if (start_telnetsrv) {
|
||||
load_module_shlib("telnetsrv",NULL,0);
|
||||
load_module_shlib("telnetsrv",NULL,0,NULL);
|
||||
}
|
||||
|
||||
paramdef_t cmdline_uemodeparams[] =CMDLINE_UEMODEPARAMS_DESC;
|
||||
@@ -770,6 +770,7 @@ int main( int argc, char **argv )
|
||||
|
||||
int CC_id;
|
||||
uint8_t abstraction_flag=0;
|
||||
unsigned int start_msc=0;
|
||||
|
||||
// Default value for the number of UEs. It will hold,
|
||||
// if not changed from the command line option --num-ues
|
||||
@@ -797,7 +798,7 @@ int main( int argc, char **argv )
|
||||
printf("Reading in command-line options\n");
|
||||
|
||||
for (int i=0;i<MAX_NUM_CCs;i++) tx_max_power[i]=23;
|
||||
get_options ();
|
||||
get_options (&start_msc);
|
||||
|
||||
|
||||
printf("Running with %d UE instances\n",NB_UE_INST);
|
||||
@@ -830,21 +831,6 @@ int main( int argc, char **argv )
|
||||
//randominit (0);
|
||||
set_taus_seed (0);
|
||||
|
||||
|
||||
set_log(HW, OAILOG_DEBUG, 1);
|
||||
set_log(PHY, OAILOG_INFO, 1);
|
||||
set_log(MAC, OAILOG_INFO, 1);
|
||||
set_log(RLC, OAILOG_INFO, 1);
|
||||
set_log(PDCP, OAILOG_INFO, 1);
|
||||
set_log(OTG, OAILOG_INFO, 1);
|
||||
set_log(RRC, OAILOG_INFO, 1);
|
||||
#if defined(ENABLE_ITTI)
|
||||
set_log(SIM, OAILOG_INFO, 1);
|
||||
# if defined(ENABLE_USE_MME)
|
||||
set_log(NAS, OAILOG_INFO, 1);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
cpuf=get_cpu_freq_GHz();
|
||||
|
||||
pthread_cond_init(&sync_cond,NULL);
|
||||
@@ -858,18 +844,14 @@ int main( int argc, char **argv )
|
||||
itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info);
|
||||
|
||||
// initialize mscgen log after ITTI
|
||||
if (start_msc) {
|
||||
load_module_shlib("msc",NULL,0,&msc_interface);
|
||||
}
|
||||
MSC_INIT(MSC_E_UTRAN, THREAD_MAX+TASK_MAX);
|
||||
#endif
|
||||
|
||||
if (opt_type != OPT_NONE) {
|
||||
radio_type_t radio_type;
|
||||
|
||||
if (frame_parms[0]->frame_type == FDD)
|
||||
radio_type = RADIO_TYPE_FDD;
|
||||
else
|
||||
radio_type = RADIO_TYPE_TDD;
|
||||
|
||||
if (init_opt(in_path, in_ip, NULL, radio_type) == -1)
|
||||
if (init_opt(in_path, in_ip) == -1)
|
||||
LOG_E(OPT,"failed to run OPT \n");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user