Commit 90cb9d6c authored by Raymond Knopp's avatar Raymond Knopp

adding RRU/Fronthaul functionality to oaisim

parent 2045a493
......@@ -1883,6 +1883,7 @@ add_executable(oaisim
${OPENAIR_TARGETS}/SIMU/USER/oaisim_functions.c
${OPENAIR_TARGETS}/SIMU/USER/event_handler.c
${OPENAIR_TARGETS}/SIMU/USER/oaisim.c
${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c
${OPENAIR2_DIR}/RRC/NAS/nas_config.c
${OPENAIR2_DIR}/RRC/NAS/rb_config.c
${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c
......@@ -1897,7 +1898,7 @@ add_executable(oaisim
target_include_directories(oaisim PUBLIC ${OPENAIR_TARGETS}/SIMU/USER)
target_link_libraries (oaisim
-Wl,--start-group
-Wl,-ldl,--start-group
RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB GTPV1U SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS ${MSC_LIB} L2 ${RAL_LIB} LIB_NAS_UE SIMU SIMU_ETH SECU_OSA ${ITTI_LIB} ${MIH_LIB}
-Wl,--end-group )
......
......@@ -418,9 +418,9 @@ function main() {
if [ "$oaisim" = "1" ] ; then
#to be discussed
# there is no RF device and no transport protocol
# there is no RF device transport protocol
HW="None"
TP="None"
TP="ETHERNET"
if [ "$XFORMS" == "True" ] ; then
PRINT_STATS="True"
......@@ -666,6 +666,15 @@ function main() {
CMakeFiles/oai_nw_drv/oai_nw_drv.ko $dbin/oai_nw_drv.ko
fi
if [ "$TP" == "ETHERNET" ] ; then
compilations \
$oaisim_build_dir oai_eth_transpro \
liboai_eth_transpro.so $dbin/liboai_eth_transpro.so.$REL
ln -s liboai_eth_transpro.so liboai_transpro.so
ln -s $dbin/liboai_eth_transpro.so.$REL $dbin/liboai_transpro.so
echo_info "liboai_transpro.so is linked with ETHERNET library"
fi
cmake_file=$DIR/oaisim_mme_build_oai/CMakeLists.txt
cp $DIR/oaisim_mme_build_oai/CMakeLists.template $cmake_file
echo "set ( CMAKE_BUILD_TYPE $CMAKE_BUILD_TYPE )" >> $cmake_file
......
......@@ -430,6 +430,7 @@ typedef struct PHY_VARS_eNB_s {
eNB_proc_t proc;
eNB_func_t node_function;
eNB_timing_t node_timing;
eth_params_t *eth_params;
int single_thread_flag;
openair0_rf_map rf_map;
int abstraction_flag;
......
......@@ -97,7 +97,7 @@ int trx_eth_start(openair0_device *device) {
if(eth_set_dev_conf_udp(device)!=0) return -1;
} else {
if(eth_get_dev_conf_udp(device)!=0) return -1;
}
}
}
/* apply additional configuration */
if(ethernet_tune (device, SND_BUF_SIZE,2000000000)!=0) return -1;
......
......@@ -130,6 +130,8 @@ extern int sync_var;
extern int transmission_mode;
extern int oaisim_flag;
//pthread_t main_eNB_thread;
time_stats_t softmodem_stats_mt; // main thread
......@@ -1986,6 +1988,7 @@ void init_eNB(eNB_func_t node_function[], eNB_timing_t node_timing[],int nb_inst
eNB = PHY_vars_eNB_g[inst][CC_id];
eNB->node_function = node_function[CC_id];
eNB->node_timing = node_timing[CC_id];
eNB->eth_params = eth_params+CC_id;
eNB->abstraction_flag = 0;
eNB->single_thread_flag = single_thread_flag;
eNB->ts_offset = 0;
......@@ -2011,14 +2014,16 @@ void init_eNB(eNB_func_t node_function[], eNB_timing_t node_timing[],int nb_inst
eNB->start_rf = start_rf;
eNB->start_if = start_if;
eNB->fh_asynch = fh_if5_asynch_DL;
ret = openair0_device_load(&eNB->rfdevice, &openair0_cfg[CC_id]);
if (ret<0) {
printf("Exiting, cannot initialize rf device\n");
exit(-1);
}
if (oaisim_flag == 0) {
ret = openair0_device_load(&eNB->rfdevice, &openair0_cfg[CC_id]);
if (ret<0) {
printf("Exiting, cannot initialize rf device\n");
exit(-1);
}
}
eNB->rfdevice.host_type = RRH_HOST;
eNB->ifdevice.host_type = RRH_HOST;
ret = openair0_transport_load(&eNB->ifdevice, &openair0_cfg[CC_id], (eth_params+CC_id));
ret = openair0_transport_load(&eNB->ifdevice, &openair0_cfg[CC_id], eNB->eth_params);
printf("openair0_transport_init returns %d for CC_id %d\n",ret,CC_id);
if (ret<0) {
printf("Exiting, cannot initialize transport protocol\n");
......@@ -2038,15 +2043,17 @@ void init_eNB(eNB_func_t node_function[], eNB_timing_t node_timing[],int nb_inst
eNB->fh_asynch = fh_if4p5_asynch_DL;
eNB->start_rf = start_rf;
eNB->start_if = start_if;
ret = openair0_device_load(&eNB->rfdevice, &openair0_cfg[CC_id]);
if (ret<0) {
printf("Exiting, cannot initialize rf device\n");
exit(-1);
}
if (oaisim_flag == 0) {
ret = openair0_device_load(&eNB->rfdevice, &openair0_cfg[CC_id]);
if (ret<0) {
printf("Exiting, cannot initialize rf device\n");
exit(-1);
}
}
eNB->rfdevice.host_type = RRH_HOST;
eNB->ifdevice.host_type = RRH_HOST;
printf("loading transport interface ...\n");
ret = openair0_transport_load(&eNB->ifdevice, &openair0_cfg[CC_id], (eth_params+CC_id));
ret = openair0_transport_load(&eNB->ifdevice, &openair0_cfg[CC_id], eNB->eth_params);
printf("openair0_transport_init returns %d for CC_id %d\n",ret,CC_id);
if (ret<0) {
printf("Exiting, cannot initialize transport protocol\n");
......@@ -2103,7 +2110,7 @@ void init_eNB(eNB_func_t node_function[], eNB_timing_t node_timing[],int nb_inst
eNB->ifdevice.host_type = BBU_HOST;
ret = openair0_transport_load(&eNB->ifdevice, &openair0_cfg[CC_id], (eth_params+CC_id));
ret = openair0_transport_load(&eNB->ifdevice, &openair0_cfg[CC_id], eNB->eth_params);
printf("openair0_transport_init returns %d for CC_id %d\n",ret,CC_id);
if (ret<0) {
printf("Exiting, cannot initialize transport protocol\n");
......@@ -2125,7 +2132,7 @@ void init_eNB(eNB_func_t node_function[], eNB_timing_t node_timing[],int nb_inst
eNB->fh_asynch = (eNB->node_timing == synch_to_other) ? fh_if4p5_asynch_UL : NULL;
eNB->rfdevice.host_type = BBU_HOST;
eNB->ifdevice.host_type = BBU_HOST;
ret = openair0_transport_load(&eNB->ifdevice, &openair0_cfg[CC_id], (eth_params+CC_id));
ret = openair0_transport_load(&eNB->ifdevice, &openair0_cfg[CC_id], eNB->eth_params);
printf("openair0_transport_init returns %d for CC_id %d\n",ret,CC_id);
if (ret<0) {
printf("Exiting, cannot initialize transport protocol\n");
......@@ -2151,7 +2158,7 @@ void init_eNB(eNB_func_t node_function[], eNB_timing_t node_timing[],int nb_inst
eNB->rfdevice.host_type = BBU_HOST;
eNB->ifdevice.host_type = BBU_HOST;
ret = openair0_transport_load(&eNB->ifdevice, &openair0_cfg[CC_id], (eth_params+CC_id));
ret = openair0_transport_load(&eNB->ifdevice, &openair0_cfg[CC_id], eNB->eth_params);
printf("openair0_transport_init returns %d for CC_id %d\n",ret,CC_id);
if (ret<0) {
printf("Exiting, cannot initialize transport protocol\n");
......
......@@ -112,7 +112,7 @@ extern int netlink_init(void);
// In lte-enb.c
extern int setup_eNB_buffers(PHY_VARS_eNB **phy_vars_eNB, openair0_config_t *openair0_cfg);
extern void init_eNB(eNB_func_t *, eNB_timing_t *,int,eth_params_t *,int,int);
extern void init_eNB(eNB_func_t *, eNB_timing_t *,int),eth_params_t *,int,int);
extern void stop_eNB(int);
extern void kill_eNB_proc(void);
......@@ -285,7 +285,7 @@ double cpuf;
char uecap_xer[1024],uecap_xer_in=0;
int oaisim_flag=0;
/*---------------------BMC: timespec helpers -----------------------------*/
......
......@@ -110,6 +110,8 @@ extern int rx_input_level_dBm;
extern uint8_t exit_missed_slots;
extern uint64_t num_missed_slots; // counter for the number of missed slots
extern int oaisim_flag;
extern void exit_fun(const char* s);
#define KHz (1000UL)
......@@ -180,9 +182,11 @@ void init_UE(int nb_inst) {
sleep(1);
UE = PHY_vars_UE_g[inst][0];
ret = openair0_device_load(&(UE->rfdevice), &openair0_cfg[0]);
if (ret !=0){
exit_fun("Error loading device library");
if (oaisim_flag == 0) {
ret = openair0_device_load(&(UE->rfdevice), &openair0_cfg[0]);
if (ret !=0){
exit_fun("Error loading device library");
}
}
UE->rfdevice.host_type = BBU_HOST;
// UE->rfdevice.type = NONE_DEV;
......
......@@ -1286,7 +1286,25 @@ main (int argc, char **argv)
init_openair2 ();
init_openair0();
init_ocm ();
#if defined(ENABLE_ITTI)
// Handle signals until all tasks are terminated
// Note: Cannot handle both RRU/RAU and eNB at the same time, if the first "eNB" is an RRU/RAU, no NAS
if (oai_emulation.info.node_function[0] < NGFI_RAU_IF4p5) {
if (create_tasks(oai_emulation.info.nb_enb_local,
oai_emulation.info.nb_ue_local) < 0)
exit(-1); // need a softer mode
}
else {
if (create_tasks(0,
oai_emulation.info.nb_ue_local) < 0)
exit(-1); // need a softer mode
}
#endif
// wait for all threads to startup
sleep(3);
......@@ -1327,12 +1345,8 @@ main (int argc, char **argv)
#if defined(ENABLE_ITTI)
// Handle signals until all tasks are terminated
if (create_tasks(oai_emulation.info.nb_enb_local, oai_emulation.info.nb_ue_local) >= 0) {
itti_wait_tasks_end();
} else {
exit(-1); // need a softer mode
}
itti_wait_tasks_end();
#else
......
......@@ -77,6 +77,9 @@
# include "s1ap_eNB.h"
#endif
#include "../../ARCH/COMMON/common_lib.h"
#include "../../ARCH/ETHERNET/USERSPACE/LIB/if_defs.h"
#ifdef SMBV
extern uint8_t config_smbv;
extern char smbv_ip[16];
......@@ -88,6 +91,8 @@ extern char smbv_ip[16];
#define K 2 // averaging coefficient
#define TARGET_SF_TIME_NS 1000000 // 1ms = 1000000 ns
#define min(a,b) ((a)<(b)?(a):(b))
int otg_times = 0;
int if_times = 0;
int for_times = 0;
......@@ -170,11 +175,14 @@ extern int xforms;
extern uint32_t downlink_frequency[MAX_NUM_CCs][4];
extern int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
void init_eNB(eNB_func_t node_function[], eNB_timing_t node_timing[],int nb_inst);
eth_params_t *eth_params;
void init_eNB(eNB_func_t node_function[], eNB_timing_t node_timing[],int nb_inst,eth_params_t *,int,int);
void stop_eNB(int nb_inst);
const Enb_properties_array_t *enb_properties;
int oaisim_flag=1;
void get_simulation_options(int argc, char *argv[])
{
......@@ -786,7 +794,33 @@ void get_simulation_options(int argc, char *argv[])
AssertFatal (oai_emulation.info.nb_enb_local <= enb_properties->number,
"Number of eNB is greater than eNB defined in configuration file %s (%d/%d)!",
conf_config_file_name, oai_emulation.info.nb_enb_local, enb_properties->number);
eth_params = (eth_params_t*)malloc(enb_properties->properties[0]->nb_rrh_gw * sizeof(eth_params_t));
memset(eth_params, 0, enb_properties->properties[0]->nb_rrh_gw * sizeof(eth_params_t));
for (int j=0; j<enb_properties->properties[0]->nb_rrh_gw; j++) {
if (enb_properties->properties[0]->rrh_gw_config[j].active == 1 ) {
// local_remote_radio = BBU_REMOTE_RADIO_HEAD;
(eth_params+j)->local_if_name = enb_properties->properties[0]->rrh_gw_config[j].rrh_gw_if_name;
(eth_params+j)->my_addr = enb_properties->properties[0]->rrh_gw_config[j].local_address;
(eth_params+j)->my_port = enb_properties->properties[0]->rrh_gw_config[j].local_port;
(eth_params+j)->remote_addr = enb_properties->properties[0]->rrh_gw_config[j].remote_address;
(eth_params+j)->remote_port = enb_properties->properties[0]->rrh_gw_config[j].remote_port;
if (enb_properties->properties[0]->rrh_gw_config[j].raw == 1) {
(eth_params+j)->transp_preference = ETH_RAW_MODE;
} else if (enb_properties->properties[0]->rrh_gw_config[j].rawif4p5 == 1) {
(eth_params+j)->transp_preference = ETH_RAW_IF4p5_MODE;
} else if (enb_properties->properties[0]->rrh_gw_config[j].udpif4p5 == 1) {
(eth_params+j)->transp_preference = ETH_UDP_IF4p5_MODE;
} else if (enb_properties->properties[0]->rrh_gw_config[j].rawif5_mobipass == 1) {
(eth_params+j)->transp_preference = ETH_RAW_IF5_MOBIPASS;
} else {
(eth_params+j)->transp_preference = ETH_UDP_MODE;
}
}
}
/* Update some simulation parameters */
oai_emulation.info.frame_type[0] = enb_properties->properties[0]->frame_type[0];
oai_emulation.info.tdd_config[0] = enb_properties->properties[0]->tdd_config[0];
......@@ -1126,6 +1160,85 @@ int UE_trx_write(openair0_device *device,openair0_timestamp timestamp, void **bu
return(nsamps);
}
void init_openair0(void);
openair0_config_t openair0_cfg[MAX_CARDS];
void init_openair0() {
int card;
int i;
for (card=0; card<MAX_CARDS; card++) {
openair0_cfg[card].configFilename = NULL;
if(frame_parms[0]->N_RB_DL == 100) {
if (frame_parms[0]->threequarter_fs) {
openair0_cfg[card].sample_rate=23.04e6;
openair0_cfg[card].samples_per_frame = 230400;
openair0_cfg[card].tx_bw = 10e6;
openair0_cfg[card].rx_bw = 10e6;
}
else {
openair0_cfg[card].sample_rate=30.72e6;
openair0_cfg[card].samples_per_frame = 307200;
openair0_cfg[card].tx_bw = 10e6;
openair0_cfg[card].rx_bw = 10e6;
}
} else if(frame_parms[0]->N_RB_DL == 50) {
openair0_cfg[card].sample_rate=15.36e6;
openair0_cfg[card].samples_per_frame = 153600;
openair0_cfg[card].tx_bw = 5e6;
openair0_cfg[card].rx_bw = 5e6;
} else if (frame_parms[0]->N_RB_DL == 25) {
openair0_cfg[card].sample_rate=7.68e6;
openair0_cfg[card].samples_per_frame = 76800;
openair0_cfg[card].tx_bw = 2.5e6;
openair0_cfg[card].rx_bw = 2.5e6;
} else if (frame_parms[0]->N_RB_DL == 6) {
openair0_cfg[card].sample_rate=1.92e6;
openair0_cfg[card].samples_per_frame = 19200;
openair0_cfg[card].tx_bw = 1.5e6;
openair0_cfg[card].rx_bw = 1.5e6;
}
if (frame_parms[0]->frame_type==TDD)
openair0_cfg[card].duplex_mode = duplex_mode_TDD;
else //FDD
openair0_cfg[card].duplex_mode = duplex_mode_FDD;
openair0_cfg[card].remote_addr = (eth_params+card)->remote_addr;
openair0_cfg[card].remote_port = (eth_params+card)->remote_port;
openair0_cfg[card].my_addr = (eth_params+card)->my_addr;
openair0_cfg[card].my_port = (eth_params+card)->my_port;
printf("HW: Configuring card %d, nb_antennas_tx/rx %d/%d\n",card,
PHY_vars_eNB_g[0][0]->frame_parms.nb_antennas_tx,
PHY_vars_eNB_g[0][0]->frame_parms.nb_antennas_rx);
openair0_cfg[card].Mod_id = 0;
openair0_cfg[card].num_rb_dl=frame_parms[0]->N_RB_DL;
openair0_cfg[card].tx_num_channels=min(2,PHY_vars_eNB_g[0][0]->frame_parms.nb_antennas_tx);
openair0_cfg[card].rx_num_channels=min(2,PHY_vars_eNB_g[0][0]->frame_parms.nb_antennas_rx);
for (i=0; i<4; i++) {
openair0_cfg[card].rx_gain[i] = PHY_vars_eNB_g[0][0]->rx_total_gain_dB;
printf("Card %d, channel %d, Setting tx_gain %f, rx_gain %f, tx_freq %f, rx_freq %f\n",
card,i, openair0_cfg[card].tx_gain[i],
openair0_cfg[card].rx_gain[i],
openair0_cfg[card].tx_freq[i],
openair0_cfg[card].rx_freq[i]);
}
}
}
void init_devices(void){
module_id_t UE_id, eNB_id;
......@@ -1270,7 +1383,7 @@ void init_openair1(void)
init_devices ();
init_eNB(oai_emulation.info.node_function,oai_emulation.info.node_timing,NB_eNB_INST);
init_eNB(oai_emulation.info.node_function,oai_emulation.info.node_timing,NB_eNB_INST,eth_params,1,0);
// init_ue_status();
for (UE_id=0; UE_id<NB_UE_INST; UE_id++) {
......@@ -1820,6 +1933,7 @@ void init_time()
td_avg = TARGET_SF_TIME_NS;
}
/*
int openair0_transport_load(openair0_device *device, openair0_config_t *openair0_cfg, eth_params_t * eth_params) {
return(0);
......@@ -1831,3 +1945,4 @@ int openair0_device_load(openair0_device *device, openair0_config_t *openair0_cf
return(0);
}
*/
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment